- // 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( wxSplitterWindow ) ) && GetParent()->IsKindOf( CLASSINFO( wxSplitterWindow ) ) ){
+ // When parent is not a wxSplitterWindow, we can rely on it's GetPosition() to give us the correct
+ // coordinates, but when the parent is a wxSplitterWindow, we need to manually calculate
+ // the sash position of it and any parent wxSplitterWindows into the webkit's position.
+ wxSplitterWindow* splitter;
+ splitter = dynamic_cast<wxSplitterWindow*>(parent);
+ if (splitter->GetSplitMode() == wxSPLIT_HORIZONTAL){
+ if (splitter->GetPosition().y > 0)
+ y += splitter->GetPosition().y;
+
+ if (splitter->GetSashSize() > 0)
+ y += splitter->GetSashSize();
+
+ if (splitter->GetSashPosition() > 0)
+ y += splitter->GetSashPosition();
+ }
+ else{
+ if (splitter->GetPosition().x > 0)
+ x += splitter->GetPosition().x;
+
+ if (splitter->GetSashSize() > 0)
+ x += splitter->GetSashSize();
+
+ if (splitter->GetSashPosition() > 0)
+ x += splitter->GetSashPosition();
+ }