Title: [168534] trunk/Source/WebCore
Revision
168534
Author
abu...@adobe.com
Date
2014-05-09 09:15:59 -0700 (Fri, 09 May 2014)

Log Message

[CSS Regions] 1-2% performance regression in html5-full-render after r168286
https://bugs.webkit.org/show_bug.cgi?id=132672

Reviewed by Mihnea Ovidenie.

The patch optimizes the search of regions when there's a single region in the chain.
There's no need to execute advanced search logic, we can directly return that region.

Tests: No function change, no tests.

* rendering/RenderBlock.cpp:
(WebCore::canComputeRegionRangeForBox):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::regionAtBlockOffset):
(WebCore::RenderFlowThread::hasCachedRegionRangeForBox): Renamed from hasRegionRangeForBox to
better suggest what the function does.
(WebCore::RenderFlowThread::getRegionRangeForBox):
(WebCore::RenderFlowThread::hasRegionRangeForBox): Deleted.
* rendering/RenderFlowThread.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168533 => 168534)


--- trunk/Source/WebCore/ChangeLog	2014-05-09 15:54:05 UTC (rev 168533)
+++ trunk/Source/WebCore/ChangeLog	2014-05-09 16:15:59 UTC (rev 168534)
@@ -1,3 +1,25 @@
+2014-05-09  Andrei Bucur  <abu...@adobe.com>
+
+        [CSS Regions] 1-2% performance regression in html5-full-render after r168286
+        https://bugs.webkit.org/show_bug.cgi?id=132672
+
+        Reviewed by Mihnea Ovidenie.
+
+        The patch optimizes the search of regions when there's a single region in the chain.
+        There's no need to execute advanced search logic, we can directly return that region.
+
+        Tests: No function change, no tests.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::canComputeRegionRangeForBox):
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::regionAtBlockOffset):
+        (WebCore::RenderFlowThread::hasCachedRegionRangeForBox): Renamed from hasRegionRangeForBox to
+        better suggest what the function does.
+        (WebCore::RenderFlowThread::getRegionRangeForBox):
+        (WebCore::RenderFlowThread::hasRegionRangeForBox): Deleted.
+        * rendering/RenderFlowThread.h:
+
 2014-05-09  Jer Noble  <jer.no...@apple.com>
 
         [EME] Call suspendIfNeeded() in the MediaKeySession create() method to avoid an ASSERT.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (168533 => 168534)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-05-09 15:54:05 UTC (rev 168533)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-05-09 16:15:59 UTC (rev 168534)
@@ -3897,7 +3897,7 @@
     if (!childBox.canHaveOutsideRegionRange())
         return false;
 
-    return flowThreadContainingBlock->hasRegionRangeForBox(parentBlock);
+    return flowThreadContainingBlock->hasCachedRegionRangeForBox(parentBlock);
 }
 
 bool RenderBlock::childBoxIsUnsplittableForFragmentation(const RenderBox& child) const

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (168533 => 168534)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-05-09 15:54:05 UTC (rev 168533)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-05-09 16:15:59 UTC (rev 168534)
@@ -401,6 +401,9 @@
     if (m_regionList.isEmpty())
         return 0;
 
+    if (m_regionList.size() == 1 && extendLastRegion)
+        return m_regionList.first();
+
     if (offset <= 0)
         return clampBox ? clampBox->clampToStartAndEndRegions(m_regionList.first()) : m_regionList.first();
 
@@ -747,7 +750,7 @@
     range.setRange(startRegion, endRegion);
 }
 
-bool RenderFlowThread::hasRegionRangeForBox(const RenderBox* box) const
+bool RenderFlowThread::hasCachedRegionRangeForBox(const RenderBox* box) const
 {
     ASSERT(box);
 
@@ -794,6 +797,11 @@
     if (!hasValidRegionInfo()) // We clear the ranges when we invalidate the regions.
         return false;
 
+    if (m_regionList.size() == 1) {
+        startRegion = endRegion = m_regionList.first();
+        return true;
+    }
+
     if (getRegionRangeForBoxFromCachedInfo(box, startRegion, endRegion))
         return true;
 
@@ -810,7 +818,7 @@
         cb = cb->parent()->enclosingBox();
         ASSERT(cb);
 
-        if (hasRegionRangeForBox(cb))
+        if (hasCachedRegionRangeForBox(cb))
             cbToUse = cb;
     }
 

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.h (168533 => 168534)


--- trunk/Source/WebCore/rendering/RenderFlowThread.h	2014-05-09 15:54:05 UTC (rev 168533)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.h	2014-05-09 16:15:59 UTC (rev 168534)
@@ -141,7 +141,7 @@
 
     virtual void setRegionRangeForBox(const RenderBox*, RenderRegion*, RenderRegion*);
     bool getRegionRangeForBox(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const;
-    bool hasRegionRangeForBox(const RenderBox*) const;
+    bool hasCachedRegionRangeForBox(const RenderBox*) const;
 
     // Check if the object is in region and the region is part of this flow thread.
     bool objectInFlowRegion(const RenderObject*, const RenderRegion*) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to