Title: [115819] trunk/Source
Revision
115819
Author
[email protected]
Date
2012-05-02 06:00:47 -0700 (Wed, 02 May 2012)

Log Message

Source/WebCore: [Qt] Remove redundant updateViewportArguments() call from HTMLBodyElement::didNotifyDescendantInseretions()
https://bugs.webkit.org/show_bug.cgi?id=84241

Patch by Zalan Bujtas <[email protected]> on 2012-05-02
Reviewed by Kenneth Rohde Christiansen.

No need to update viewport arguments when the body element is inserted into the Document.
Viewport arguments are updated first when the Document is set on the Frame, and later
on any subsequent occurence of the viewport meta tag in the document.
It is sufficient to dispatch viewport update once per main frame, if no viewport meta tag is present.

Also add a flag to be able to track viewport argument update dispatch.

No tests. Currrent viewport tests cover this behaviour.

* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::updateViewportArguments):
(WebCore::Document::documentWillSuspendForPageCache):
* dom/Document.h:
(Document):
(WebCore::Document::didDispatchViewportPropertiesChanged):
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::didNotifyDescendantInseretions):

Source/WebKit2: [Qt][WK2] Remove redundant updateViewportArguments() call from HTMLBodyElement::didNotifyDescendantInseretions()
https://bugs.webkit.org/show_bug.cgi?id=84241

Patch by Zalan Bujtas <[email protected]> on 2012-05-02
Reviewed by Kenneth Rohde Christiansen.

Add ASSERT to ensure at least one viewport argument change call is dispatched to WebPage per main frame.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidFirstLayout):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (115818 => 115819)


--- trunk/Source/WebCore/ChangeLog	2012-05-02 12:13:57 UTC (rev 115818)
+++ trunk/Source/WebCore/ChangeLog	2012-05-02 13:00:47 UTC (rev 115819)
@@ -1,3 +1,29 @@
+2012-05-02  Zalan Bujtas  <[email protected]>
+
+        [Qt] Remove redundant updateViewportArguments() call from HTMLBodyElement::didNotifyDescendantInseretions()
+        https://bugs.webkit.org/show_bug.cgi?id=84241
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        No need to update viewport arguments when the body element is inserted into the Document.
+        Viewport arguments are updated first when the Document is set on the Frame, and later
+        on any subsequent occurence of the viewport meta tag in the document.
+        It is sufficient to dispatch viewport update once per main frame, if no viewport meta tag is present.
+
+        Also add a flag to be able to track viewport argument update dispatch.
+
+        No tests. Currrent viewport tests cover this behaviour.
+
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::updateViewportArguments):
+        (WebCore::Document::documentWillSuspendForPageCache):
+        * dom/Document.h:
+        (Document):
+        (WebCore::Document::didDispatchViewportPropertiesChanged):
+        * html/HTMLBodyElement.cpp:
+        (WebCore::HTMLBodyElement::didNotifyDescendantInseretions):
+
 2012-05-02  Pavel Feldman  <[email protected]>
 
         Web Inspector: Cannot read property 'length' of undefined TextEditorModel.js:467

Modified: trunk/Source/WebCore/dom/Document.cpp (115818 => 115819)


--- trunk/Source/WebCore/dom/Document.cpp	2012-05-02 12:13:57 UTC (rev 115818)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-05-02 13:00:47 UTC (rev 115819)
@@ -481,6 +481,9 @@
     , m_scheduledTasksAreSuspended(false)
     , m_visualUpdatesAllowed(true)
     , m_visualUpdatesSuppressionTimer(this, &Document::visualUpdatesSuppressionTimerFired)
+#ifndef NDEBUG
+    , m_didDispatchViewportPropertiesChanged(false)
+#endif
 {
     m_document = this;
 
@@ -3008,8 +3011,12 @@
 
 void Document::updateViewportArguments()
 {
-    if (page() && page()->mainFrame() == frame())
+    if (page() && page()->mainFrame() == frame()) {
+#ifndef NDEBUG
+        m_didDispatchViewportPropertiesChanged = true;
+#endif
         page()->chrome()->dispatchViewportPropertiesDidChange(m_viewportArguments);
+    }
 }
 
 void Document::processReferrerPolicy(const String& policy)
@@ -4307,6 +4314,12 @@
     HashSet<Element*>::iterator end = m_documentSuspensionCallbackElements.end();
     for (HashSet<Element*>::iterator i = m_documentSuspensionCallbackElements.begin(); i != end; ++i)
         (*i)->documentWillSuspendForPageCache();
+
+#ifndef NDEBUG
+    // Clear the update flag to be able to check if the viewport arguments update
+    // is dispatched, after the document is restored from the page cache.
+    m_didDispatchViewportPropertiesChanged = false;
+#endif
 }
 
 void Document::documentDidResumeFromPageCache() 

Modified: trunk/Source/WebCore/dom/Document.h (115818 => 115819)


--- trunk/Source/WebCore/dom/Document.h	2012-05-02 12:13:57 UTC (rev 115818)
+++ trunk/Source/WebCore/dom/Document.h	2012-05-02 13:00:47 UTC (rev 115819)
@@ -326,6 +326,9 @@
 #endif
 
     ViewportArguments viewportArguments() const { return m_viewportArguments; }
+#ifndef NDEBUG
+    bool didDispatchViewportPropertiesChanged() const { return m_didDispatchViewportPropertiesChanged; }
+#endif
 
     ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; }
 
@@ -1495,6 +1498,10 @@
     
     bool m_visualUpdatesAllowed;
     Timer<Document> m_visualUpdatesSuppressionTimer;
+
+#ifndef NDEBUG
+    bool m_didDispatchViewportPropertiesChanged;
+#endif
 };
 
 // Put these methods here, because they require the Document definition, but we really want to inline them.

Modified: trunk/Source/WebCore/html/HTMLBodyElement.cpp (115818 => 115819)


--- trunk/Source/WebCore/html/HTMLBodyElement.cpp	2012-05-02 12:13:57 UTC (rev 115818)
+++ trunk/Source/WebCore/html/HTMLBodyElement.cpp	2012-05-02 13:00:47 UTC (rev 115819)
@@ -181,8 +181,6 @@
     // But without it we hang during WebKit tests; need to fix that and remove this.
     if (FrameView* view = document()->view())
         view->scheduleRelayout();
-
-    document()->updateViewportArguments();
 }
 
 bool HTMLBodyElement::isURLAttribute(Attribute *attr) const

Modified: trunk/Source/WebKit2/ChangeLog (115818 => 115819)


--- trunk/Source/WebKit2/ChangeLog	2012-05-02 12:13:57 UTC (rev 115818)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-02 13:00:47 UTC (rev 115819)
@@ -1,3 +1,15 @@
+2012-05-02  Zalan Bujtas  <[email protected]>
+
+        [Qt][WK2] Remove redundant updateViewportArguments() call from HTMLBodyElement::didNotifyDescendantInseretions()
+        https://bugs.webkit.org/show_bug.cgi?id=84241
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add ASSERT to ensure at least one viewport argument change call is dispatched to WebPage per main frame.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidFirstLayout):
+
 2012-05-02  Lars Knudsen  <[email protected]>
 
         [Qt] Make DeviceMotion and DeviceOrientation work with WebKit2

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (115818 => 115819)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-05-02 12:13:57 UTC (rev 115818)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-05-02 13:00:47 UTC (rev 115819)
@@ -543,6 +543,11 @@
 
     if (m_frame == m_frame->page()->mainWebFrame() && !webPage->corePage()->settings()->suppressesIncrementalRendering())
         webPage->drawingArea()->setLayerTreeStateIsFrozen(false);
+
+#if USE(TILED_BACKING_STORE)
+    // Make sure viewport properties are dispatched on the main frame by the time the first layout happens.
+    ASSERT(!webPage->useFixedLayout() || m_frame != m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged());
+#endif
 }
 
 void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to