+void wxWebKitCtrl::OnSize(wxSizeEvent &event){
+ // This is a nasty hack because WebKit does not seem to recognize a Tabs control as its parent.
+ // Therefore, coordinates must be relative to the left-hand side of the screen, rather than
+ // relative to the Tabs control.
+ wxWindow* parent = GetParent();
+ bool inNotebook = false;
+ int x = 0;
+ int y = 18;
+ while(parent != NULL)
+ {
+ // keep adding the position until we hit the notebook
+ if (!inNotebook){
+ x += parent->GetPosition().x;
+ y += parent->GetPosition().y;
+ }
+
+ if ( parent->GetClassInfo()->GetClassName() == wxT("wxSplitterWindow") ){
+ x += 3;
+ }
+
+ if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ){
+ inNotebook = true;
+ }
+ parent = parent->GetParent();
+ }
+
+ if (inNotebook){
+ NSRect bounds = [m_webView frame];
+ bounds.origin.x += x;
+ bounds.origin.y += y;
+ [m_webView setFrame:bounds];
+ }
+
+ [m_webView display];
+ event.Skip();
+}
+
+void wxWebKitCtrl::MacVisibilityChanged(){
+ bool isHidden = !IsControlVisible( m_peer->GetControlRef());
+ [m_webView setHidden:isHidden];
+}