Bug 108327

Summary: [Qt] visibility of embedded widget
Product: WebKit Reporter: 123powerd231 <kvodinskiy>
Component: WebKit QtAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: hausmann, pierre.rossi
Priority: P2 Keywords: Qt, QtTriaged
Version: 525.x (Safari 3.2)   
Hardware: PC   
OS: Windows 7   

Description 123powerd231 2013-01-30 04:46:02 PST
My app uses qtwebkit and embedded in webpage widget through my derived QWebPluginFactory.
My web page uses some layers one of which is my widget.
The problem: Widget is visible, but his parent layer isn’t visible(css property visibility:hidden)

My toolset: Qt 5.0.0, mvs c++ compiler(visual studio 2008sp1+sdk), windows 7
Comment 1 123powerd231 2013-01-30 23:30:24 PST
1) I noticed that the first calls
Qt5WebKitWidgetsd.dll! QWidgetPluginImpl :: setVisible (bool visible = false) Line 52
 Qt5WebKitd.dll! WebCore :: QtPluginWidget :: hide () Line 1439
 Qt5WebKitd.dll! WebCore :: RenderWidget :: styleDidChange (WebCore :: StyleDifference diff = StyleDifferenceRepaint, const WebCore :: RenderStyle * oldStyle = 0x1881ea50) Line 226
 Qt5WebKitd.dll! WebCore :: RenderObject :: setStyle (WTF :: PassRefPtr <WebCore::RenderStyle> style = {...}) Line 1801
 Qt5WebKitd.dll! WebCore :: RenderObject :: setAnimatableStyle (WTF :: PassRefPtr <WebCore::RenderStyle> style = {...}) Line 1697
 Qt5WebKitd.dll! WebCore :: Element :: recalcStyle (WebCore :: Node :: StyleChange change = Inherit) Line 1293 + 0x19 bytes C + +
...
 Qt5WebKitd.dll! WebCore :: Element :: recalcStyle (WebCore :: Node :: StyleChange change = NoChange) Line 1346 C + +
...
 Qt5WebKitd.dll! WebCore :: Document :: updateStyleIfNeeded () Line 1892
 Qt5WebKitd.dll! WebCore :: Document :: styleRecalcTimerFired (WebCore :: Timer <WebCore::Document> * __ formal = 0x06b5f108) Line 1781
 Qt5WebKitd.dll! WebCore :: Timer <WebCore::CSSFontSelector> :: fired () Line 106 + 0x1f bytes
 Qt5WebKitd.dll! WebCore :: ThreadTimers :: sharedTimerFiredInternal () Line 119
 Qt5WebKitd.dll! WebCore :: ThreadTimers :: sharedTimerFired () Line 94
 Qt5WebKitd.dll! WebCore :: SharedTimerQt :: timerEvent (QTimerEvent * ev = 0x0522c83c) Line 114
 Qt5Cored.dll! QObject :: event (QEvent * e = 0x0522c83c) Line 1052



2) followed
Qt5WebKitWidgetsd.dll! QWidgetPluginImpl :: setVisible (bool visible = true) Line 52
 Qt5WebKitWidgetsd.dll! QWidgetPluginImpl :: setGeometryAndClip (const QRect & geometry = {...}, const QRect & clipRect = {...}, bool isVisible = true) Line 45
 Qt5WebKitd.dll! WebCore :: QtPluginWidget :: frameRectsChanged () Line 1428
 Qt5WebKitd.dll! WebCore :: Widget :: setFrameRect (const WebCore :: IntRect & rect = {...}) Line 71
 Qt5WebKitd.dll! WebCore :: RenderWidget :: setWidgetGeometry (const WebCore :: LayoutRect & frame = {...}) Line 159
 Qt5WebKitd.dll! WebCore :: RenderWidget :: updateWidgetGeometry () Line 179
 Qt5WebKitd.dll! WebCore :: RenderWidget :: updateWidgetPosition () Line 334 + 0x8 bytes
 Qt5WebKitd.dll! WebCore :: RenderView :: updateWidgetPositions () Line 764 + 0x13 bytes
 Qt5WebKitd.dll! WebCore :: FrameView :: performPostLayoutTasks () Line 2499
 Qt5WebKitd.dll! WebCore :: FrameView :: layout (bool allowSubtree = true) Line 1255
 Qt5WebKitd.dll! WebCore :: FrameView :: layoutTimerFired (WebCore :: Timer <WebCore::FrameView> * __ formal = 0x0ad8cf58) Line 2137
 Qt5WebKitd.dll! WebCore :: Timer <WebCore::CSSFontSelector> :: fired () Line 106 + 0x1f bytes
 Qt5WebKitd.dll! WebCore :: ThreadTimers :: sharedTimerFiredInternal () Line 119
 Qt5WebKitd.dll! WebCore :: ThreadTimers :: sharedTimerFired () Line 94
 Qt5WebKitd.dll! WebCore :: SharedTimerQt :: timerEvent (QTimerEvent * ev = 0x052169ec) Line 114
 Qt5Cored.dll! QObject :: event (QEvent * e = 0x052169ec) Line 1052
Comment 2 123powerd231 2013-01-31 03:36:14 PST
The problem is that QtPluginWidget::hide not call Widget::hide()

fix code: 

virtual void show()
{
 Widget::show();
 handleVisibility();
}
virtual void hide()
{
 Widget::hide();
 handleVisibility();
}

void handleVisibility()
{
 if (platformWidget())
  widgetAdapter()->setVisible(isVisible());
}
Comment 3 Simon Hausmann 2013-02-01 00:26:27 PST
You're right. However http://trac.webkit.org/changeset/135515 added an implementation of hide() that will call setVisible(false) on the widget now :)
Comment 4 Pierre Rossi 2013-02-01 02:43:29 PST
Nice catch !

Should be fixed in r141569 <http://trac.webkit.org/changeset/141569>