Title: [149317] trunk/Source
Revision
149317
Author
[email protected]
Date
2013-04-29 14:53:37 -0700 (Mon, 29 Apr 2013)

Log Message

Need a LayoutMilestone to fire when we have done our first paint after suppressing 
incremental layout
https://bugs.webkit.org/show_bug.cgi?id=115330
-and corresponding-
<rdar://problem/12722365>

Reviewed by Simon Fraser.

Source/WebCore: 

To meet the needs of all of our clients, we really need two milestones. One 
indicating that a layout has happened after setVisualUpdatesAllowed(true), and 
another indicating that painting has happened.

If layout is needed when setVisualUpdatesAllowed(true) is called, we need to 
update it so that we can guarantee the first paint is really happening at this 
time. Also fire the DidFirstLayoutAfterSuppressedIncrementalRendering milestone, 
and call add DidFirstPaintAfterSuppressedIncrementalRendering to the FrameView's 
pending paint milestones. 
up the painting milestone.
* dom/Document.cpp:
(WebCore::Document::setVisualUpdatesAllowed):

FrameView now stores m_milestonesPendingPaint. We'll send and clear them once we 
have painted.
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::paintContents):
(WebCore::FrameView::addPaintPendingMilestones):
(WebCore::FrameView::firePaintRelatedMilestones):
* page/FrameView.h:
(WebCore::FrameView::milestonesPendingPaint):

Two new milestones.
* page/LayoutMilestones.h:
(WebCore):

We don't need m_headerLayerAwaitingFirstFlush anymore since we can use FrameView's 
pending paint milestones instead.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
(WebCore::RenderLayerCompositor::updateLayerForHeader):
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):

Source/WebKit2: 

Two new millstones.
* Shared/API/c/WKPageLoadTypes.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toWKLayoutMilestones):
(WebKit::toLayoutMilestones):

This null-check is necessary now since this code ends up running at 
WebFrame::init() time while we're setting up the Document. 
setVisualUpdatesAllowed(true) has always been called as a part of that process, 
and now the updateLayout(), ends up calling this code too, but we don't actually 
have a mainFrame yet since it's still being created.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::findLargestFrameInFrameSet):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149316 => 149317)


--- trunk/Source/WebCore/ChangeLog	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebCore/ChangeLog	2013-04-29 21:53:37 UTC (rev 149317)
@@ -1,3 +1,49 @@
+2013-04-29  Beth Dakin  <[email protected]>
+
+        Need a LayoutMilestone to fire when we have done our first paint after suppressing 
+        incremental layout
+        https://bugs.webkit.org/show_bug.cgi?id=115330
+        -and corresponding-
+        <rdar://problem/12722365>
+
+        Reviewed by Simon Fraser.
+
+        To meet the needs of all of our clients, we really need two milestones. One 
+        indicating that a layout has happened after setVisualUpdatesAllowed(true), and 
+        another indicating that painting has happened.
+
+        If layout is needed when setVisualUpdatesAllowed(true) is called, we need to 
+        update it so that we can guarantee the first paint is really happening at this 
+        time. Also fire the DidFirstLayoutAfterSuppressedIncrementalRendering milestone, 
+        and call add DidFirstPaintAfterSuppressedIncrementalRendering to the FrameView's 
+        pending paint milestones. 
+        up the painting milestone.
+        * dom/Document.cpp:
+        (WebCore::Document::setVisualUpdatesAllowed):
+
+        FrameView now stores m_milestonesPendingPaint. We'll send and clear them once we 
+        have painted.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::FrameView):
+        (WebCore::FrameView::paintContents):
+        (WebCore::FrameView::addPaintPendingMilestones):
+        (WebCore::FrameView::firePaintRelatedMilestones):
+        * page/FrameView.h:
+        (WebCore::FrameView::milestonesPendingPaint):
+
+        Two new milestones.
+        * page/LayoutMilestones.h:
+        (WebCore):
+
+        We don't need m_headerLayerAwaitingFirstFlush anymore since we can use FrameView's 
+        pending paint milestones instead.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+        (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
+        (WebCore::RenderLayerCompositor::updateLayerForHeader):
+        * rendering/RenderLayerCompositor.h:
+        (RenderLayerCompositor):
+
 2013-04-29  David Hyatt  <[email protected]>
 
         [Mac] Links can't be hovered or clicked with overlay scrollbars hidden.

Modified: trunk/Source/WebCore/dom/Document.cpp (149316 => 149317)


--- trunk/Source/WebCore/dom/Document.cpp	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-04-29 21:53:37 UTC (rev 149317)
@@ -1289,10 +1289,14 @@
 
     FrameView* frameView = view();
     bool needsLayout = frameView && renderer() && (frameView->layoutPending() || renderer()->needsLayout());
-    if (needsLayout) {
-        // There might be a layout pending, so make sure we don't update the screen with bogus data.
-        // The layout will actually update the compositing layers and repaint if needed.
-        return;
+    if (needsLayout)
+        updateLayout();
+
+    if (Page* page = this->page()) {
+        if (frame() == page->mainFrame())
+            frameView->addPaintPendingMilestones(DidFirstPaintAfterSuppressedIncrementalRendering);
+        if (page->requestedLayoutMilestones() & DidFirstLayoutAfterSuppressedIncrementalRendering)
+            frame()->loader()->didLayout(DidFirstLayoutAfterSuppressedIncrementalRendering);
     }
 
 #if USE(ACCELERATED_COMPOSITING)
@@ -1300,8 +1304,8 @@
         view()->updateCompositingLayersAfterLayout();
 #endif
 
-    if (renderer())
-        renderer()->repaint();
+    if (RenderView* renderView = this->renderView())
+        renderView->repaintViewAndCompositedLayers();
 }
 
 void Document::visualUpdatesSuppressionTimerFired(Timer<Document>*)

Modified: trunk/Source/WebCore/page/FrameView.cpp (149316 => 149317)


--- trunk/Source/WebCore/page/FrameView.cpp	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebCore/page/FrameView.cpp	2013-04-29 21:53:37 UTC (rev 149317)
@@ -198,6 +198,7 @@
     , m_didRunAutosize(false)
     , m_headerHeight(0)
     , m_footerHeight(0)
+    , m_milestonesPendingPaint(0)
 #if ENABLE(CSS_FILTERS)
     , m_hasSoftwareFilters(false)
 #endif
@@ -3559,6 +3560,7 @@
         sCurrentPaintTimeStamp = 0;
 
     InspectorInstrumentation::didPaint(renderView, p, rect);
+    firePaintRelatedMilestones();
 }
 
 void FrameView::setPaintBehavior(PaintBehavior behavior)
@@ -4128,4 +4130,36 @@
     }
 }
 
+void FrameView::addPaintPendingMilestones(LayoutMilestones milestones)
+{
+    m_milestonesPendingPaint |= milestones;
+}
+
+void FrameView::firePaintRelatedMilestones()
+{
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    LayoutMilestones milestonesAchieved = 0;
+
+    // Make sure the pending paint milestones have actually been requested before we send them.
+    if (m_milestonesPendingPaint & DidFirstFlushForHeaderLayer) {
+        if (page->requestedLayoutMilestones() & DidFirstFlushForHeaderLayer)
+            milestonesAchieved |= DidFirstFlushForHeaderLayer;
+    }
+
+    if (m_milestonesPendingPaint & DidFirstPaintAfterSuppressedIncrementalRendering) {
+        if (page->requestedLayoutMilestones() & DidFirstPaintAfterSuppressedIncrementalRendering)
+            milestonesAchieved |= DidFirstPaintAfterSuppressedIncrementalRendering;
+    }
+
+    m_milestonesPendingPaint = 0;
+
+    if (milestonesAchieved) {
+        if (Frame* frame = page->mainFrame())
+            frame->loader()->didLayout(milestonesAchieved);
+    }
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/FrameView.h (149316 => 149317)


--- trunk/Source/WebCore/page/FrameView.h	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebCore/page/FrameView.h	2013-04-29 21:53:37 UTC (rev 149317)
@@ -421,6 +421,10 @@
     virtual void willStartLiveResize() OVERRIDE;
     virtual void willEndLiveResize() OVERRIDE;
 
+    void addPaintPendingMilestones(LayoutMilestones);
+    void firePaintRelatedMilestones();
+    LayoutMilestones milestonesPendingPaint() const { return m_milestonesPendingPaint; }
+
 protected:
     virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
     virtual void scrollContentsSlowPath(const IntRect& updateRect);
@@ -621,6 +625,8 @@
     int m_headerHeight;
     int m_footerHeight;
 
+    LayoutMilestones m_milestonesPendingPaint;
+
     static double s_normalDeferredRepaintDelay;
     static double s_initialDeferredRepaintDelayDuringLoading;
     static double s_maxDeferredRepaintDelayDuringLoading;

Modified: trunk/Source/WebCore/page/LayoutMilestones.h (149316 => 149317)


--- trunk/Source/WebCore/page/LayoutMilestones.h	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebCore/page/LayoutMilestones.h	2013-04-29 21:53:37 UTC (rev 149317)
@@ -28,11 +28,16 @@
 
 namespace WebCore {
 
+// FIXME: Some of these milestones are about layout, and others are about painting.
+// We should either re-name them to something more generic, or split them into
+// two enums -- one for painting and one for layout.
 enum LayoutMilestoneFlag {
     DidFirstLayout = 1 << 0,
     DidFirstVisuallyNonEmptyLayout = 1 << 1,
     DidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2,
-    DidFirstFlushForHeaderLayer = 1 << 3
+    DidFirstFlushForHeaderLayer = 1 << 3,
+    DidFirstLayoutAfterSuppressedIncrementalRendering = 1 << 4,
+    DidFirstPaintAfterSuppressedIncrementalRendering = 1 << 5
 };
 
 typedef unsigned LayoutMilestones;

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (149316 => 149317)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-04-29 21:53:37 UTC (rev 149317)
@@ -214,7 +214,6 @@
     , m_layerFlushThrottlingEnabled(false)
     , m_layerFlushThrottlingTemporarilyDisabledForInteraction(false)
     , m_hasPendingLayerFlush(false)
-    , m_headerLayerAwaitingFirstFlush(false)
 #if !LOG_DISABLED
     , m_rootLayerUpdateCount(0)
     , m_obligateCompositedLayerCount(0)
@@ -361,8 +360,8 @@
     ASSERT(!m_flushingLayers);
     m_flushingLayers = true;
 
+    FrameView* frameView = m_renderView ? m_renderView->frameView() : 0;
     if (GraphicsLayer* rootLayer = rootGraphicsLayer()) {
-        FrameView* frameView = m_renderView ? m_renderView->frameView() : 0;
         if (frameView) {
             // Having a m_clipLayer indicates that we're doing scrolling via GraphicsLayers.
             IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView->contentsSize()) : frameView->visibleContentRect();
@@ -373,15 +372,8 @@
     ASSERT(m_flushingLayers);
     m_flushingLayers = false;
 
-    if (m_headerLayerAwaitingFirstFlush) {
-        m_headerLayerAwaitingFirstFlush = false;
-        if (Page* page = this->page()) {
-            if (page->requestedLayoutMilestones() & DidFirstFlushForHeaderLayer) {
-                if (Frame* frame = page->mainFrame())
-                    frame->loader()->didLayout(DidFirstFlushForHeaderLayer);
-            }
-        }
-    }
+    if (frameView)
+        frameView->firePaintRelatedMilestones();
 
     if (!m_viewportConstrainedLayersNeedingUpdate.isEmpty()) {
         HashSet<RenderLayer*>::const_iterator end = m_viewportConstrainedLayersNeedingUpdate.end();
@@ -2524,7 +2516,7 @@
         m_layerForHeader->setName("header");
 #endif
         m_scrollLayer->addChildBelow(m_layerForHeader.get(), m_rootContentLayer.get());
-        m_headerLayerAwaitingFirstFlush = true;
+        m_renderView->frameView()->addPaintPendingMilestones(DidFirstFlushForHeaderLayer);
     }
 
     m_layerForHeader->setPosition(FloatPoint(0, 0));

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (149316 => 149317)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2013-04-29 21:53:37 UTC (rev 149317)
@@ -449,7 +449,6 @@
     bool m_layerFlushThrottlingEnabled;
     bool m_layerFlushThrottlingTemporarilyDisabledForInteraction;
     bool m_hasPendingLayerFlush;
-    bool m_headerLayerAwaitingFirstFlush;
 
 #if !LOG_DISABLED
     int m_rootLayerUpdateCount;

Modified: trunk/Source/WebKit2/ChangeLog (149316 => 149317)


--- trunk/Source/WebKit2/ChangeLog	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-29 21:53:37 UTC (rev 149317)
@@ -1,3 +1,27 @@
+2013-04-28  Beth Dakin  <[email protected]>
+
+        Need a LayoutMilestone to fire when we have done our first paint after suppressing 
+        incremental layout
+        https://bugs.webkit.org/show_bug.cgi?id=115330
+        -and corresponding-
+        <rdar://problem/12722365>
+
+        Reviewed by Simon Fraser.
+
+        Two new millstones.
+        * Shared/API/c/WKPageLoadTypes.h:
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toWKLayoutMilestones):
+        (WebKit::toLayoutMilestones):
+
+        This null-check is necessary now since this code ends up running at 
+        WebFrame::init() time while we're setting up the Document. 
+        setVisualUpdatesAllowed(true) has always been called as a part of that process, 
+        and now the updateLayout(), ends up calling this code too, but we don't actually 
+        have a mainFrame yet since it's still being created.
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::findLargestFrameInFrameSet):
+
 2013-04-29  Brady Eidson  <[email protected]>
 
         REGRESSION: We see authentication challenge sheets for favicon requests.

Modified: trunk/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h (149316 => 149317)


--- trunk/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h	2013-04-29 21:53:37 UTC (rev 149317)
@@ -52,7 +52,9 @@
     kWKDidFirstLayout = 1 << 0,
     kWKDidFirstVisuallyNonEmptyLayout = 1 << 1,
     kWKDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2,
-    kWKReserved = 1 << 3 // Note that the fourth member of this enum is actually private and defined in WKPageLoadTypesPrivate.h
+    kWKReserved = 1 << 3, // Note that the fourth member of this enum is actually private and defined in WKPageLoadTypesPrivate.h
+    kWKDidFirstLayoutAfterSuppressedIncrementalRendering = 1 << 4,
+    kWKDidFirstPaintAfterSuppressedIncrementalRendering = 1 << 5
 };
 typedef uint32_t WKLayoutMilestones;
 

Modified: trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h (149316 => 149317)


--- trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2013-04-29 21:53:37 UTC (rev 149317)
@@ -802,6 +802,10 @@
         wkMilestones |= kWKDidHitRelevantRepaintedObjectsAreaThreshold;
     if (milestones & WebCore::DidFirstFlushForHeaderLayer)
         wkMilestones |= kWKDidFirstFlushForHeaderLayer;
+    if (milestones & WebCore::DidFirstLayoutAfterSuppressedIncrementalRendering)
+        wkMilestones |= kWKDidFirstLayoutAfterSuppressedIncrementalRendering;
+    if (milestones & WebCore::DidFirstPaintAfterSuppressedIncrementalRendering)
+        wkMilestones |= kWKDidFirstPaintAfterSuppressedIncrementalRendering;
     
     return wkMilestones;
 }
@@ -818,6 +822,10 @@
         milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold;
     if (wkMilestones & kWKDidFirstFlushForHeaderLayer)
         milestones |= WebCore::DidFirstFlushForHeaderLayer;
+    if (wkMilestones & kWKDidFirstLayoutAfterSuppressedIncrementalRendering)
+        milestones |= WebCore::DidFirstLayoutAfterSuppressedIncrementalRendering;
+    if (wkMilestones & kWKDidFirstPaintAfterSuppressedIncrementalRendering)
+        milestones |= WebCore::DidFirstPaintAfterSuppressedIncrementalRendering;
     
     return milestones;
 }

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (149316 => 149317)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2013-04-29 21:40:24 UTC (rev 149316)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2013-04-29 21:53:37 UTC (rev 149317)
@@ -84,7 +84,7 @@
     // Approximate what a user could consider a default target frame for application menu operations.
 
     WebFrame* mainFrame = page->mainWebFrame();
-    if (!mainFrame->isFrameSet())
+    if (!mainFrame || !mainFrame->isFrameSet())
         return 0;
 
     WebFrame* largestSoFar = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to