Title: [144395] trunk/Source/WebCore
Revision
144395
Author
[email protected]
Date
2013-02-28 16:42:18 -0800 (Thu, 28 Feb 2013)

Log Message

RelevantRepaintedObjects heuristic should ensure there is some coverage in the 
bottom half of the relevant view rect
https://bugs.webkit.org/show_bug.cgi?id=111124
-and corresponding-
<rdar://problem/12257164>

Reviewed by Simon Fraser.

We need two Regions now -- one for the top and another for the bottom. Make sure 
we have at least half of our desired coverage in both.
* page/Page.cpp:
(WebCore::Page::resetRelevantPaintedObjectCounter):
(WebCore::Page::addRelevantRepaintedObject):
(WebCore::Page::reportMemoryUsage):
* page/Page.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144394 => 144395)


--- trunk/Source/WebCore/ChangeLog	2013-03-01 00:30:52 UTC (rev 144394)
+++ trunk/Source/WebCore/ChangeLog	2013-03-01 00:42:18 UTC (rev 144395)
@@ -1,3 +1,21 @@
+2013-02-28  Beth Dakin  <[email protected]>
+
+        RelevantRepaintedObjects heuristic should ensure there is some coverage in the 
+        bottom half of the relevant view rect
+        https://bugs.webkit.org/show_bug.cgi?id=111124
+        -and corresponding-
+        <rdar://problem/12257164>
+
+        Reviewed by Simon Fraser.
+
+        We need two Regions now -- one for the top and another for the bottom. Make sure 
+        we have at least half of our desired coverage in both.
+        * page/Page.cpp:
+        (WebCore::Page::resetRelevantPaintedObjectCounter):
+        (WebCore::Page::addRelevantRepaintedObject):
+        (WebCore::Page::reportMemoryUsage):
+        * page/Page.h:
+
 2013-02-28  Chris Fleizach  <[email protected]>
 
         WebSpeech: support pitch change

Modified: trunk/Source/WebCore/page/Page.cpp (144394 => 144395)


--- trunk/Source/WebCore/page/Page.cpp	2013-03-01 00:30:52 UTC (rev 144394)
+++ trunk/Source/WebCore/page/Page.cpp	2013-03-01 00:42:18 UTC (rev 144395)
@@ -1283,7 +1283,8 @@
 {
     m_isCountingRelevantRepaintedObjects = false;
     m_relevantUnpaintedRenderObjects.clear();
-    m_relevantPaintedRegion = Region();
+    m_topRelevantPaintedRegion = Region();
+    m_bottomRelevantPaintedRegion = Region();
     m_relevantUnpaintedRegion = Region();
 }
 
@@ -1333,13 +1334,38 @@
         m_relevantUnpaintedRegion.subtract(snappedPaintRect);
     }
 
-    m_relevantPaintedRegion.unite(snappedPaintRect);
-    
+    // Split the relevantRect into a top half and a bottom half. Making sure we have coverage in
+    // both halves helps to prevent cases where we have a fully loaded menu bar or masthead with
+    // no content beneath that.
+    LayoutRect topRelevantRect = relevantRect;
+    topRelevantRect.contract(LayoutSize(0, relevantRect.height() / 2));
+    LayoutRect bottomRelevantRect = topRelevantRect;
+    bottomRelevantRect.setY(relevantRect.height() / 2);
+
+    // If the rect straddles both Regions, split it appropriately.
+    if (topRelevantRect.intersects(snappedPaintRect) && bottomRelevantRect.intersects(snappedPaintRect)) {
+        IntRect topIntersection = snappedPaintRect;
+        topIntersection.intersect(pixelSnappedIntRect(topRelevantRect));
+        m_topRelevantPaintedRegion.unite(topIntersection);
+
+        IntRect bottomIntersection = snappedPaintRect;
+        bottomIntersection.intersect(pixelSnappedIntRect(bottomRelevantRect));
+        m_bottomRelevantPaintedRegion.unite(bottomIntersection);
+    } else if (topRelevantRect.intersects(snappedPaintRect))
+        m_topRelevantPaintedRegion.unite(snappedPaintRect);
+    else
+        m_bottomRelevantPaintedRegion.unite(snappedPaintRect);
+
+    float topPaintedArea = m_topRelevantPaintedRegion.totalArea();
+    float bottomPaintedArea = m_bottomRelevantPaintedRegion.totalArea();
     float viewArea = relevantRect.width() * relevantRect.height();
-    float ratioOfViewThatIsPainted = m_relevantPaintedRegion.totalArea() / viewArea;
+
+    float ratioThatIsPaintedOnTop = topPaintedArea / viewArea;
+    float ratioThatIsPaintedOnBottom = bottomPaintedArea / viewArea;
     float ratioOfViewThatIsUnpainted = m_relevantUnpaintedRegion.totalArea() / viewArea;
 
-    if (ratioOfViewThatIsPainted > gMinimumPaintedAreaRatio && ratioOfViewThatIsUnpainted < gMaximumUnpaintedAreaRatio) {
+    if (ratioThatIsPaintedOnTop > (gMinimumPaintedAreaRatio / 2) && ratioThatIsPaintedOnBottom > (gMinimumPaintedAreaRatio / 2)
+        && ratioOfViewThatIsUnpainted < gMaximumUnpaintedAreaRatio) {
         m_isCountingRelevantRepaintedObjects = false;
         resetRelevantPaintedObjectCounter();
         if (Frame* frame = mainFrame())
@@ -1449,7 +1475,8 @@
     info.addMember(m_group, "group");
     info.addMember(m_sessionStorage, "sessionStorage");
     info.addMember(m_relevantUnpaintedRenderObjects, "relevantUnpaintedRenderObjects");
-    info.addMember(m_relevantPaintedRegion, "relevantPaintedRegion");
+    info.addMember(m_topRelevantPaintedRegion, "relevantPaintedRegion");
+    info.addMember(m_bottomRelevantPaintedRegion, "relevantPaintedRegion");
     info.addMember(m_relevantUnpaintedRegion, "relevantUnpaintedRegion");
     info.addMember(m_seenPlugins, "seenPlugins");
     info.addMember(m_seenMediaEngines, "seenMediaEngines");

Modified: trunk/Source/WebCore/page/Page.h (144394 => 144395)


--- trunk/Source/WebCore/page/Page.h	2013-03-01 00:30:52 UTC (rev 144394)
+++ trunk/Source/WebCore/page/Page.h	2013-03-01 00:42:18 UTC (rev 144395)
@@ -486,7 +486,8 @@
     LayoutMilestones m_layoutMilestones;
 
     HashSet<RenderObject*> m_relevantUnpaintedRenderObjects;
-    Region m_relevantPaintedRegion;
+    Region m_topRelevantPaintedRegion;
+    Region m_bottomRelevantPaintedRegion;
     Region m_relevantUnpaintedRegion;
     bool m_isCountingRelevantRepaintedObjects;
 #ifndef NDEBUG
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to