Title: [106492] trunk
Revision
106492
Author
[email protected]
Date
2012-02-01 13:52:41 -0800 (Wed, 01 Feb 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=77383
Add a different didFirstVisuallNonEmptyLayout heuristic to experiment with
-and corresponding-
<rdar://problem/10709560>

Reviewed by Sam Weinig.

Source/WebCore: 

The goal is to re-vamp didFirstVisuallyNonEmptyLayout to be more accurate. 
This patch adds a new heuristic called didNewFirstVisuallNonEmptyLayout and 
leaves the old one for the time being. That is temporary.

The heuristic for didNewFirstVisuallNonEmptyLayout is to count relevant 
painted RenderObjects on Page.
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setPaintedObjectsCounterThreshold):
(WebCore::Page::addRelevantRepaintedObject):
* page/Page.h:
(WebCore):
(Page):
(WebCore::Page::startCountingRepaintedObjects):
* WebCore.exp.in:

Start counting relevant painted RenderObjects on the page once the first 
layout is complete.
* page/FrameView.cpp:
(WebCore::FrameView::performPostLayoutTasks):

Machinery for firing didNewFirstVisuallNonEmptyLayout.
* loader/EmptyClients.h:
(WebCore::EmptyFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didNewFirstVisuallyNonEmptyLayout):
(WebCore):
* loader/FrameLoader.h:
(FrameLoader):
* loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout):

These RenderObjects are the ones that this api currently consider to be 
relevant. If their repaint rects intersect with the viewRect, then they are 
added to the relevant objects set on the Page.
* rendering/InlineBox.cpp:
(WebCore::InlineBox::paint):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::paintReplaced):
* rendering/RenderHTMLCanvas.cpp:
(WebCore::RenderHTMLCanvas::paintReplaced):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::paintReplaced):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::paintReplaced):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::paintReplaced):

Source/WebKit2: 

Machinery for didNewFirstVisuallNonEmptyLayout.
* UIProcess/API/C/WKPage.h:
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::didNewFirstVisuallyNonEmptyLayout):
(WebKit):
* UIProcess/WebLoaderClient.h:
(WebLoaderClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didNewFirstVisuallyNonEmptyLayout):
(WebKit):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout):
(WebKit):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient):

This temporary API allows the client to specify the threshold for the painted 
objects counter on Page. This is temporary.
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageSetPaintedObjectsCounterThreshold):
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setPaintedObjectsCounterThreshold):
(WebKit):
* WebProcess/WebPage/WebPage.h:
(WebPage):

Tools: 

WebKit2's WebLoaderClient has a temporary new function that must be accounted 
for.
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106491 => 106492)


--- trunk/Source/WebCore/ChangeLog	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/ChangeLog	2012-02-01 21:52:41 UTC (rev 106492)
@@ -1,3 +1,66 @@
+2012-02-01  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=77383
+        Add a different didFirstVisuallNonEmptyLayout heuristic to experiment with
+        -and corresponding-
+        <rdar://problem/10709560>
+
+        Reviewed by Sam Weinig.
+
+        The goal is to re-vamp didFirstVisuallyNonEmptyLayout to be more accurate. 
+        This patch adds a new heuristic called didNewFirstVisuallNonEmptyLayout and 
+        leaves the old one for the time being. That is temporary.
+
+        The heuristic for didNewFirstVisuallNonEmptyLayout is to count relevant 
+        painted RenderObjects on Page.
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::setPaintedObjectsCounterThreshold):
+        (WebCore::Page::addRelevantRepaintedObject):
+        * page/Page.h:
+        (WebCore):
+        (Page):
+        (WebCore::Page::startCountingRepaintedObjects):
+        * WebCore.exp.in:
+
+        Start counting relevant painted RenderObjects on the page once the first 
+        layout is complete.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::performPostLayoutTasks):
+
+        Machinery for firing didNewFirstVisuallNonEmptyLayout.
+        * loader/EmptyClients.h:
+        (WebCore::EmptyFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::didNewFirstVisuallyNonEmptyLayout):
+        (WebCore):
+        * loader/FrameLoader.h:
+        (FrameLoader):
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout):
+
+        These RenderObjects are the ones that this api currently consider to be 
+        relevant. If their repaint rects intersect with the viewRect, then they are 
+        added to the relevant objects set on the Page.
+        * rendering/InlineBox.cpp:
+        (WebCore::InlineBox::paint):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paint):
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::paintReplaced):
+        * rendering/RenderHTMLCanvas.cpp:
+        (WebCore::RenderHTMLCanvas::paintReplaced):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::paintReplaced):
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::paintReplaced):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::paint):
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::paintReplaced):
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::paintReplaced):
+
 2012-02-01  Alexis Menard  <[email protected]>
 
         CSSStyleDeclaration.getPropertyPriority() fails for CSS shorthand properties with 'important' priority

Modified: trunk/Source/WebCore/WebCore.exp.in (106491 => 106492)


--- trunk/Source/WebCore/WebCore.exp.in	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-02-01 21:52:41 UTC (rev 106492)
@@ -780,6 +780,7 @@
 __ZN7WebCore4Page31setCustomHTMLTokenizerTimeDelayEd
 __ZN7WebCore4Page32setMemoryCacheClientCallsEnabledEb
 __ZN7WebCore4Page37setInLowQualityImageInterpolationModeEb
+__ZN7WebCore4Page43setRelevantRepaintedObjectsCounterThresholdEy
 __ZN7WebCore4Page6goBackEv
 __ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
 __ZN7WebCore4Page9goForwardEv

Modified: trunk/Source/WebCore/loader/EmptyClients.h (106491 => 106492)


--- trunk/Source/WebCore/loader/EmptyClients.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -292,6 +292,7 @@
     virtual void dispatchDidFinishLoad() { }
     virtual void dispatchDidFirstLayout() { }
     virtual void dispatchDidFirstVisuallyNonEmptyLayout() { }
+    virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() { }
 
     virtual Frame* dispatchCreatePage(const NavigationAction&) { return 0; }
     virtual void dispatchShow() { }

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (106491 => 106492)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -2399,6 +2399,11 @@
     m_client->dispatchDidFirstVisuallyNonEmptyLayout();
 }
 
+void FrameLoader::didNewFirstVisuallyNonEmptyLayout()
+{
+    m_client->dispatchDidNewFirstVisuallyNonEmptyLayout();
+}
+
 void FrameLoader::frameLoadCompleted()
 {
     // Note: Can be called multiple times.

Modified: trunk/Source/WebCore/loader/FrameLoader.h (106491 => 106492)


--- trunk/Source/WebCore/loader/FrameLoader.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -178,7 +178,11 @@
     CachePolicy subresourceCachePolicy() const;
 
     void didFirstLayout();
+
+    // FIXME: didFirstVisuallyNonEmptyLayout() and didNewFirstVisuallyNonEmptyLayout() should be merged.
+    // The only reason for both to exist is to experiment with different heuristics for the time being.
     void didFirstVisuallyNonEmptyLayout();
+    void didNewFirstVisuallyNonEmptyLayout();
 
     void loadedResourceFromMemoryCache(CachedResource*);
     void tellClientAboutPastMemoryCacheLoads();

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (106491 => 106492)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -161,6 +161,7 @@
 
         virtual void dispatchDidFirstLayout() = 0;
         virtual void dispatchDidFirstVisuallyNonEmptyLayout() = 0;
+        virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() { }
         virtual void dispatchDidLayout() { }
 
         virtual Frame* dispatchCreatePage(const NavigationAction&) = 0;

Modified: trunk/Source/WebCore/page/FrameView.cpp (106491 => 106492)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -2280,6 +2280,8 @@
         if (m_firstLayoutCallbackPending) {
             m_firstLayoutCallbackPending = false;
             m_frame->loader()->didFirstLayout();
+            if (Page* page = m_frame->page())
+                page->startCountingRelevantRepaintedObjects();
         }
 
         // Ensure that we always send this eventually.

Modified: trunk/Source/WebCore/page/Page.cpp (106491 => 106492)


--- trunk/Source/WebCore/page/Page.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/page/Page.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -186,6 +186,7 @@
     , m_visibilityState(PageVisibilityStateVisible)
 #endif
     , m_displayID(0)
+    , m_isCountingRelevantRepaintedObjects(false)
 {
     if (!allPages) {
         allPages = new HashSet<Page*>;
@@ -1080,6 +1081,46 @@
 }
 #endif
 
+static uint64_t gPaintedObjectCounterThreshold = 0;
+
+void Page::setRelevantRepaintedObjectsCounterThreshold(uint64_t threshold)
+{
+    gPaintedObjectCounterThreshold = threshold;
+}
+
+void Page::startCountingRelevantRepaintedObjects()
+{
+    m_isCountingRelevantRepaintedObjects = true;
+
+    // Clear the HashSet in case we didn't hit the threshold last time.
+    m_relevantPaintedRenderObjects.clear();
+}
+
+void Page::addRelevantRepaintedObject(RenderObject* object, const IntRect& objectPaintRect)
+{
+    if (!m_isCountingRelevantRepaintedObjects)
+        return;
+
+    // We don't need to do anything if there is no counter threshold.
+    if (!gPaintedObjectCounterThreshold)
+        return;
+
+    // The objects are only relevant if they are being painted within the viewRect().
+    if (RenderView* view = object->view()) {
+        if (!objectPaintRect.intersects(view->viewRect()))
+            return;
+    }
+
+    m_relevantPaintedRenderObjects.add(object);
+
+    if (m_relevantPaintedRenderObjects.size() == static_cast<int>(gPaintedObjectCounterThreshold)) {
+        m_isCountingRelevantRepaintedObjects = false;
+        m_relevantPaintedRenderObjects.clear();
+        if (Frame* frame = mainFrame())
+            frame->loader()->didNewFirstVisuallyNonEmptyLayout();
+    }
+}
+
 Page::PageClients::PageClients()
     : chromeClient(0)
     , contextMenuClient(0)

Modified: trunk/Source/WebCore/page/Page.h (106491 => 106492)


--- trunk/Source/WebCore/page/Page.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/page/Page.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -79,6 +79,7 @@
     class PointerLockController;
     class ProgressTracker;
     class Range;
+    class RenderObject;
     class RenderTheme;
     class VisibleSelection;
     class ScrollableArea;
@@ -352,6 +353,10 @@
 #endif
 
         PlatformDisplayID displayID() const { return m_displayID; }
+
+        void setRelevantRepaintedObjectsCounterThreshold(uint64_t);
+        void startCountingRelevantRepaintedObjects();
+        void addRelevantRepaintedObject(RenderObject*, const IntRect& objectPaintRect);
         
     private:
         void initGroup();
@@ -469,6 +474,9 @@
         PageVisibilityState m_visibilityState;
 #endif
         PlatformDisplayID m_displayID;
+
+        HashSet<RenderObject*> m_relevantPaintedRenderObjects;
+        bool m_isCountingRelevantRepaintedObjects;
     };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/InlineBox.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/InlineBox.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/InlineBox.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -20,8 +20,10 @@
 #include "config.h"
 #include "InlineBox.h"
 
+#include "Frame.h"
 #include "HitTestResult.h"
 #include "InlineFlowBox.h"
+#include "Page.h"
 #include "PaintInfo.h"
 #include "RenderArena.h"
 #include "RenderBlock.h"
@@ -211,6 +213,11 @@
     if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection))
         return;
 
+    if (Frame* frame = renderer()->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(renderer(), paintInfo.rect);
+    }
+
     LayoutPoint childPoint = paintOffset;
     if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
         childPoint = renderer()->containingBlock()->flipForWritingModeForChild(toRenderBox(renderer()), childPoint);

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -496,6 +496,11 @@
         // When only painting the selection, don't bother to paint if there is none.
         return;
 
+    if (Frame* frame = renderer()->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(renderer(), paintInfo.rect);
+    }
+
     if (m_truncation != cNoTruncation) {
         if (renderer()->containingBlock()->style()->isLeftToRightDirection() != isLeftToRightDirection()) {
             // Make the visible fragment of text hug the edge closest to the rest of the run by moving the origin

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -167,6 +167,11 @@
     float textWidth;
     if (!getReplacementTextGeometry(paintOffset, contentRect, path, replacementTextRect, font, run, textWidth))
         return;
+
+    if (Frame* frame = this->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(this, paintInfo.rect);
+    }
     
     GraphicsContextStateSaver stateSaver(*context);
     context->clip(contentRect);

Modified: trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -28,10 +28,12 @@
 
 #include "CanvasRenderingContext.h"
 #include "Document.h"
+#include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
 #include "HTMLCanvasElement.h"
 #include "HTMLNames.h"
+#include "Page.h"
 #include "PaintInfo.h"
 #include "RenderView.h"
 
@@ -56,6 +58,11 @@
 
 void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
+    if (Frame* frame = this->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(this, paintInfo.rect);
+    }
+
     LayoutRect rect = contentBoxRect();
     rect.moveBy(paintOffset);
     bool useLowQualityScale = style()->imageRendering() == ImageRenderingOptimizeContrast;

Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/RenderImage.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -328,6 +328,11 @@
         if (!img || img->isNull())
             return;
 
+    if (Frame* frame = this->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(this, paintInfo.rect);
+    }
+
 #if PLATFORM(MAC)
         if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
             paintCustomHighlight(toPoint(paintOffset - location()), style()->highlight(), true);

Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/RenderRegion.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -140,6 +140,11 @@
     if (!m_flowThread || !isValid())
         return;
 
+    if (Frame* frame = this->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(this, paintInfo.rect);
+    }
+
 #ifndef NDEBUG
     m_insideRegionPaint = true;
 #endif

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -23,8 +23,10 @@
 #include "config.h"
 #include "RenderReplaced.h"
 
+#include "Frame.h"
 #include "GraphicsContext.h"
 #include "LayoutRepainter.h"
+#include "Page.h"
 #include "RenderBlock.h"
 #include "RenderLayer.h"
 #include "RenderTheme.h"
@@ -135,6 +137,11 @@
         drawSelectionTint = false;
     }
 
+    if (Frame* frame = this->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(this, paintInfo.rect);
+    }
+
     bool completelyClippedOut = false;
     if (style()->hasBorderRadius()) {
         LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());

Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/RenderVideo.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -29,11 +29,13 @@
 #include "RenderVideo.h"
 
 #include "Document.h"
+#include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
 #include "HTMLNames.h"
 #include "HTMLVideoElement.h"
 #include "MediaPlayer.h"
+#include "Page.h"
 #include "PaintInfo.h"
 #include "RenderView.h"
 
@@ -207,6 +209,11 @@
         return;
     rect.moveBy(paintOffset);
 
+    if (Frame* frame = this->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(this, paintInfo.rect);
+    }
+
     if (displayingPoster)
         paintIntoRect(paintInfo.context, rect);
     else if (document()->view() && document()->view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers)

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (106491 => 106492)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -245,6 +245,11 @@
             return;
     }
 
+    if (Frame* frame = this->frame()) {
+        if (Page* page = frame->page())
+            page->addRelevantRepaintedObject(this, paintInfo.rect);
+    }
+
     // Make a copy of the PaintInfo because applyTransform will modify the damage rect.
     PaintInfo childPaintInfo(paintInfo);
     childPaintInfo.context->save();

Modified: trunk/Source/WebKit2/ChangeLog (106491 => 106492)


--- trunk/Source/WebKit2/ChangeLog	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-01 21:52:41 UTC (rev 106492)
@@ -1,3 +1,42 @@
+2012-02-01  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=77383
+        Add a different didFirstVisuallNonEmptyLayout heuristic to experiment with
+        -and corresponding-
+        <rdar://problem/10709560>
+
+        Reviewed by Sam Weinig.
+
+        Machinery for didNewFirstVisuallNonEmptyLayout.
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebLoaderClient.cpp:
+        (WebKit::WebLoaderClient::didNewFirstVisuallyNonEmptyLayout):
+        (WebKit):
+        * UIProcess/WebLoaderClient.h:
+        (WebLoaderClient):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didNewFirstVisuallyNonEmptyLayout):
+        (WebKit):
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout):
+        (WebKit):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        (WebFrameLoaderClient):
+
+        This temporary API allows the client to specify the threshold for the painted 
+        objects counter on Page. This is temporary.
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageSetPaintedObjectsCounterThreshold):
+        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setPaintedObjectsCounterThreshold):
+        (WebKit):
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage):
+
 2012-01-31  Alexey Proskuryakov  <[email protected]>
 
         REGRESSION (WebKit2): event.keyCode is always zero when typing in Russian

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (106491 => 106492)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -70,6 +70,7 @@
 typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo);
 typedef bool (*WKPageShouldGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo);
 typedef void (*WKPageDidFailToInitializePluginCallback)(WKPageRef page, WKStringRef mimeType, const void* clientInfo);
+typedef void (*WKPageDidNewFirstVisuallyNonEmptyLayoutCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
 
 struct WKPageLoaderClient {
     int                                                                 version;
@@ -106,6 +107,9 @@
 
     // Version 1
     WKPageDidDetectXSSForFrameCallback                                  didDetectXSSForFrame;
+
+    // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged.
+    WKPageDidNewFirstVisuallyNonEmptyLayoutCallback                     didNewFirstVisuallyNonEmptyLayout;
 };
 typedef struct WKPageLoaderClient WKPageLoaderClient;
 

Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp (106491 => 106492)


--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -123,6 +123,14 @@
     m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
+void WebLoaderClient::didNewFirstVisuallyNonEmptyLayout(WebPageProxy* page, APIObject* userData)
+{
+    if (!m_client.didNewFirstVisuallyNonEmptyLayout)
+        return;
+
+    m_client.didNewFirstVisuallyNonEmptyLayout(toAPI(page), toAPI(userData), m_client.clientInfo);
+}
+
 void WebLoaderClient::didRemoveFrameFromHierarchy(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
 {
     if (!m_client.didRemoveFrameFromHierarchy)

Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.h (106491 => 106492)


--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -64,6 +64,10 @@
     void didDisplayInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
     void didRunInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
     void didDetectXSSForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
+
+    // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged.
+    // The only reason for both to exist is to experiment with different heuristics for the time being.
+    void didNewFirstVisuallyNonEmptyLayout(WebPageProxy*, APIObject*);
     
     bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy*, WebFrameProxy*, WebProtectionSpace*);
     void didReceiveAuthenticationChallengeInFrame(WebPageProxy*, WebFrameProxy*, AuthenticationChallengeProxy*);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (106491 => 106492)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -1866,6 +1866,16 @@
     m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
 }
 
+void WebPageProxy::didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder* arguments)
+{
+    RefPtr<APIObject> userData;
+    WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
+    if (!arguments->decode(messageDecoder))
+        return;
+
+    m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get());
+}
+
 void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
 {
     RefPtr<APIObject> userData;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (106491 => 106492)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -655,6 +655,7 @@
     void didReceiveTitleForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
     void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
     void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
+    void didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder*);
     void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder*);
     void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
     void didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (106491 => 106492)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-02-01 21:52:41 UTC (rev 106492)
@@ -106,6 +106,7 @@
     DidFinishLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
     DidFirstLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
     DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
+    DidNewFirstVisuallyNonEmptyLayout(WebKit::InjectedBundleUserMessageEncoder userData)
     DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData)
     DidRemoveFrameFromHierarchy(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
     DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WTF::String unreachableURL, WebKit::InjectedBundleUserMessageEncoder userData)

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (106491 => 106492)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -328,6 +328,11 @@
     return toImpl(pageRef)->renderTreeSize();
 }
 
+void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold)
+{
+    toImpl(page)->setPaintedObjectsCounterThreshold(threshold);
+}
+
 void WKBundlePageSetTracksRepaints(WKBundlePageRef pageRef, bool trackRepaints)
 {
     toImpl(pageRef)->setTracksRepaints(trackRepaints);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h (106491 => 106492)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -55,6 +55,9 @@
 
 WK_EXPORT uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef page);
 
+// FIXME: This is temporary. Ultimately WebKit should choose the threshold itself.
+WK_EXPORT void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold);
+
 WK_EXPORT void WKBundlePageSetTracksRepaints(WKBundlePageRef page, bool trackRepaints);
 WK_EXPORT bool WKBundlePageIsTrackingRepaints(WKBundlePageRef page);
 WK_EXPORT void WKBundlePageResetTrackedRepaints(WKBundlePageRef page);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (106491 => 106492)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -552,6 +552,18 @@
     webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
 }
 
+void WebFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout()
+{
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    RefPtr<APIObject> userData;
+
+    // Notify the UIProcess.
+    webPage->send(Messages::WebPageProxy::DidNewFirstVisuallyNonEmptyLayout(InjectedBundleUserMessageEncoder(userData.get())));
+}
+
 void WebFrameLoaderClient::dispatchDidLayout()
 {
     WebPage* webPage = m_frame->page();

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (106491 => 106492)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -93,6 +93,7 @@
 
     virtual void dispatchDidFirstLayout() OVERRIDE;
     virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE;
+    virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() OVERRIDE;
     virtual void dispatchDidLayout() OVERRIDE;
 
     virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) OVERRIDE;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (106491 => 106492)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -487,6 +487,13 @@
     return size;
 }
 
+void WebPage::setPaintedObjectsCounterThreshold(uint64_t threshold)
+{
+    if (!m_page)
+        return;
+    m_page->setRelevantRepaintedObjectsCounterThreshold(threshold);
+}
+
 void WebPage::setTracksRepaints(bool trackRepaints)
 {
     if (FrameView* view = mainFrameView())

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (106491 => 106492)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-02-01 21:52:41 UTC (rev 106492)
@@ -252,6 +252,7 @@
 
     String renderTreeExternalRepresentation() const;
     uint64_t renderTreeSize() const;
+    void setPaintedObjectsCounterThreshold(uint64_t);
 
     void setTracksRepaints(bool);
     bool isTrackingRepaints() const;

Modified: trunk/Tools/ChangeLog (106491 => 106492)


--- trunk/Tools/ChangeLog	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Tools/ChangeLog	2012-02-01 21:52:41 UTC (rev 106492)
@@ -1,3 +1,19 @@
+2012-02-01  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=77383
+        Add a different didFirstVisuallNonEmptyLayout heuristic to experiment with
+        -and corresponding-
+        <rdar://problem/10709560>
+
+        Reviewed by Sam Weinig.
+
+        WebKit2's WebLoaderClient has a temporary new function that must be accounted 
+        for.
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController awakeFromNib]):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+
 2012-02-01  Dirk Pranke  <[email protected]>
 
         TestWebKitAPI isn't being built on chromium bots any more

Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.m (106491 => 106492)


--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.m	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.m	2012-02-01 21:52:41 UTC (rev 106492)
@@ -608,6 +608,7 @@
         0, // shouldGoToBackForwardItem
         0,  // didFailToInitializePlugin
         didDetectXSSForFrame,
+        0, // didNewFirstVisuallyNonEmptyLayout
     };
     WKPageSetPageLoaderClient(_webView.pageRef, &loadClient);
     

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (106491 => 106492)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2012-02-01 21:49:29 UTC (rev 106491)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2012-02-01 21:52:41 UTC (rev 106492)
@@ -389,7 +389,8 @@
         0, // didChangeBackForwardList
         0, // shouldGoToBackForwardListItem
         0, // didRunInsecureContentForFrame
-        0  // didDetectXSSForFrame
+        0, // didDetectXSSForFrame 
+        0  // didNewFirstVisuallyNonEmptyLayout 
     };
     WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to