Bug 105608

Summary: [Qt] Outmost window's content size doesn't update when inner <object> frame is expanded
Product: WebKit Reporter: Chen Zhixiang <chenzx>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Critical CC: webkit.review.bot, zalan
Priority: P3 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: All   
Attachments:
Description Flags
A patch make <object> element support FrameFlattening which corrently update outmost window's contentsSize & scrollbar position
none
The previous patch is short of RenderEmbeddedObject::layoutWithFlattening due to my mistake, sorry none

Chen Zhixiang
Reported 2012-12-20 20:33:36 PST
Shameful qt-project doesn't accept bug report? https://bugreports.qt-project.org/secure/CreateIssue.jspa It tells me to post here: Recur method: add QWebSettings::globalSettings()->setAttribute(QWebSettings::FrameFlatteningEnabled, true); to demos/browser or any QWebView test app; Problem page: direct access http://www.w3.org/Style/CSS/Test/CSS1/current/sec522.htm , or use attachment;
Attachments
A patch make <object> element support FrameFlattening which corrently update outmost window's contentsSize & scrollbar position (4.23 KB, application/octet-stream)
2012-12-28 03:06 PST, Chen Zhixiang
no flags
The previous patch is short of RenderEmbeddedObject::layoutWithFlattening due to my mistake, sorry (6.40 KB, patch)
2013-01-07 00:16 PST, Chen Zhixiang
no flags
Chen Zhixiang
Comment 1 2012-12-20 20:34:23 PST
Affected: qt-4.8.4, qt-5.0
Chen Zhixiang
Comment 2 2012-12-25 22:31:32 PST
During some debugging and watching, I found that when a html contains child frames (using <object> to include), And enable FrameFlatteningEnabled, The outer FrameView does not get correct contentsSize. Add log to Qt-4.8.4 demos/browser: #include "qwebframe.h" void WebView::loadFinished() { ... QWebFrame* pMainFrame = m_page->mainFrame(); int scrollBarVerticalMaximum = pMainFrame->scrollBarMaximum(Qt::Vertical); qDebug()<<"scrollBarVerticalMaximum="<<scrollBarVerticalMaximum; QSize contentsSize = pMainFrame->contentsSize(); qDebug()<<"contentsSize="<<contentsSize; } Test cases: bug.html: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head> <body> <object type="text/html" data="a.html" border="0" height="100%" width="100%"></object> </body></html> a.html: <body style="width:100%; height:2000px;"> a </body> (1)When directly accessing a.html using default Qt demos/browser: scrollBarVerticalMaximum= 1717 contentsSize= QSize(551, 2016) (2)When accessing bug.html: ERROR: called FrameView::paint with nil renderer .\page\FrameView.cpp(2377) : WebCore::FrameView::paintContents scrollBarVerticalMaximum= 16 contentsSize= QSize(543, 517)
Chen Zhixiang
Comment 3 2012-12-25 22:38:54 PST
Related to Bug 50391, seems no one is solving this
Chen Zhixiang
Comment 4 2012-12-25 22:40:19 PST
Also related to Bug 53546, it uses a <iframe>, this one uses <object>
Chen Zhixiang
Comment 5 2012-12-26 19:15:24 PST
DRT result: layer at (0,0) size 551x371 RenderView at (0,0) size 551x355 layer at (0,0) size 551x371 RenderBlock {HTML} at (0,0) size 551x371 RenderBody {BODY} at (8,8) size 535x355 RenderEmbeddedObject {OBJECT} at (0,0) size 535x355 layer at (0,0) size 543x2016 RenderView at (0,0) size 535x355 layer at (0,0) size 535x2016 RenderBlock {HTML} at (0,0) size 535x2016 RenderBody {BODY} at (8,8) size 535x2000 RenderText {#text} at (0,0) size 7x19 text run at (0,0) width 7: "a" RenderText {#text} at (0,0) size 0x0 seems RenderEmbeddedObject's height() doesn't get correctly updated. There is some common code logic between <object src="a.html"/> and <iframe/frame src="a.html"/>. But the implementation is broken.
Chen Zhixiang
Comment 6 2012-12-26 20:35:42 PST
If modify outer html to use <iframe>, <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head> <body> <iframe type="text/html" src="a.html" border="0" height="100%" width="100%"></iframe> </body></html> Then the scrollbar's height/position is right. Seems QtWebKit should treat <object data="a.html" .../> like <iframe/frame src="a.html" .../> when doing frame flattening.
Chen Zhixiang
Comment 7 2012-12-27 21:56:18 PST
Since iframe is correct but object is wrong, I merged RenderIFrame & RenderFrameBase 's code into RenderEmbeddedObject This does not solve the problem, However, whenever i adjust the QWebView main window's size, The scrollbar recover to correct state! I doesn't know why, could any body help? May related to Bug 57890.
Chen Zhixiang
Comment 8 2012-12-27 22:00:43 PST
By view the WebKit trunk edition, https://svn.webkit.org/repository/webkit/trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp The newest WebKit should have the same problem, although Frame Flattening is a mobile feature, this should be fixed.
Chen Zhixiang
Comment 9 2012-12-28 02:34:48 PST
The problem is solved: The final shoot: void FrameView::scheduleRelayout() { // FIXME: We should assert the page is not in the page cache, but that is causing // too many false assertions. See <rdar://problem/7218118>. ASSERT(m_frame->view() == this); if (m_layoutRoot) { m_layoutRoot->markContainingBlocksForLayout(false); m_layoutRoot = 0; } if (!m_layoutSchedulingEnabled) return; if (!needsLayout()) return; if (!m_frame->document()->shouldScheduleLayout()) return; // When frame flattening is enabled, the contents of the frame affects layout of the parent frames. // Also invalidate parent frame starting from the owner element of this frame. if (m_frame->settings() && m_frame->settings()->frameFlatteningEnabled() && m_frame->ownerRenderer()) { if (m_frame->ownerElement()->hasTagName(iframeTag) || m_frame->ownerElement()->hasTagName(frameTag)) m_frame->ownerRenderer()->setNeedsLayout(true, true); + if (m_frame->ownerElement()->hasTagName(objectTag)) + m_frame->ownerRenderer()->setNeedsLayout(true, true); }
Chen Zhixiang
Comment 10 2012-12-28 03:06:03 PST
Created attachment 180859 [details] A patch make <object> element support FrameFlattening which corrently update outmost window's contentsSize & scrollbar position A patch based on Qt-4.8.0 is provided, should be easily applied to Qt-5.0 & WebKit trunk.
Michael Brüning
Comment 11 2013-01-04 04:01:45 PST
Comment on attachment 180859 [details] A patch make <object> element support FrameFlattening which corrently update outmost window's contentsSize & scrollbar position I think this was meant to be set to r? instead of r+ (r? is for requesting reviews, r+ should only be set by reviewers for reviewed/accepted patches). Also, it seems that the patch format is wrong, so before this can be reviewed, please rebase the patch on top of trunk. You may consider using ./Tools/Scripts/webkit-patch upload for this as it is very convenient.
WebKit Review Bot
Comment 12 2013-01-04 04:03:53 PST
Attachment 180859 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files']" exit_code: 1 Total errors found: 0 in 0 files If any of these errors are false positives, please file a bug against check-webkit-style.
Michael Brüning
Comment 13 2013-01-04 04:06:31 PST
Comment on attachment 180859 [details] A patch make <object> element support FrameFlattening which corrently update outmost window's contentsSize & scrollbar position As this is both not based on trunk and missing a change log, I am clearing the review flag for now. You can find the details about contributing patches at http://www.webkit.org/coding/contributing.html. I can also help you getting this rebased and into the right format if you want.
Chen Zhixiang
Comment 14 2013-01-06 18:01:52 PST
To Michael Brüning: Please help, much thanks! I'm using QtWebKit of Qt-4.8.4 on Windows now, rebasing on newest WebKit trunk is not convenient for me.
Chen Zhixiang
Comment 15 2013-01-06 18:09:33 PST
& Changelog for this patch: WebKit should treat <object data="a.html"/> the same like <iframe src="a.html"/> when do Frame Flattening. However there may need more code refactoring.
Chen Zhixiang
Comment 16 2013-01-07 00:16:01 PST
Created attachment 181482 [details] The previous patch is short of RenderEmbeddedObject::layoutWithFlattening due to my mistake, sorry
Chen Zhixiang
Comment 17 2013-01-07 01:53:43 PST
I've tried to rebase to WebKit trunk using GitHub, But it take my 3 modify's as 3 independent commits, and i can't also export patch online. https://github.com/chenzx/webkit/commits/master The modidication view points are: 1) Merge RenderIFrame & RenderFrameBase 's code logic into RenderEmbeddedObject relating to Frame Flattening 2) Treat <object data="a.html"/> the same like <iframe src="a.html"/> when do Frame Flattening, and modify FrameView accordingly However, I find WebKit trunk newest has add a `seamless()` layout mode to iframe which i cannot understand.
Jocelyn Turcotte
Comment 18 2014-02-03 03:24:06 PST
=== Bulk closing of Qt bugs === If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary. If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.
Note You need to log in before you can comment on or make changes to this bug.