Title: [174101] trunk/Source/WebCore
Revision
174101
Author
[email protected]
Date
2014-09-30 05:48:42 -0700 (Tue, 30 Sep 2014)

Log Message

Avoid copying the iterated-over items in range-based for-loops in RenderGrid
https://bugs.webkit.org/show_bug.cgi?id=137246

Reviewed by Sergio Villar Senin.

Adjust the range-based for-loops in RenderGrid to avoid the unnecessary copying
of the items that are being iterated.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeNormalizedFractionBreadth):
(WebCore::RenderGrid::insertItemIntoGrid):
(WebCore::RenderGrid::gridAreaBreadthForChild):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174100 => 174101)


--- trunk/Source/WebCore/ChangeLog	2014-09-30 12:17:04 UTC (rev 174100)
+++ trunk/Source/WebCore/ChangeLog	2014-09-30 12:48:42 UTC (rev 174101)
@@ -1,3 +1,18 @@
+2014-09-30  Zan Dobersek  <[email protected]>
+
+        Avoid copying the iterated-over items in range-based for-loops in RenderGrid
+        https://bugs.webkit.org/show_bug.cgi?id=137246
+
+        Reviewed by Sergio Villar Senin.
+
+        Adjust the range-based for-loops in RenderGrid to avoid the unnecessary copying
+        of the items that are being iterated.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeNormalizedFractionBreadth):
+        (WebCore::RenderGrid::insertItemIntoGrid):
+        (WebCore::RenderGrid::gridAreaBreadthForChild):
+
 2014-09-29  Sergio Villar Senin  <[email protected]>
 
         [CSS Grid Layout] Use modern for-loops in RenderGrid

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (174100 => 174101)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2014-09-30 12:17:04 UTC (rev 174100)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2014-09-30 12:48:42 UTC (rev 174101)
@@ -422,7 +422,7 @@
     // |availableLogicalSpace| already accounts for the used breadths so no need to remove it here.
 
     Vector<GridTrackForNormalization> tracksForNormalization;
-    for (auto position : tracksSpan) {
+    for (auto& position : tracksSpan) {
         const GridTrackSize& trackSize = gridTrackSize(direction, position.toInt());
         if (!trackSize.maxTrackBreadth().isFlex())
             continue;
@@ -698,8 +698,8 @@
 {
     ensureGridSize(coordinate.rows.resolvedFinalPosition.toInt(), coordinate.columns.resolvedFinalPosition.toInt());
 
-    for (auto row : coordinate.rows) {
-        for (auto column : coordinate.columns)
+    for (auto& row : coordinate.rows) {
+        for (auto& column : coordinate.columns)
             m_grid[row.toInt()][column.toInt()].append(&child);
     }
     m_gridItemCoordinate.set(&child, coordinate);
@@ -950,7 +950,7 @@
     const GridCoordinate& coordinate = cachedGridCoordinate(child);
     const GridSpan& span = (direction == ForColumns) ? coordinate.columns : coordinate.rows;
     LayoutUnit gridAreaBreadth = 0;
-    for (auto trackPosition : span)
+    for (auto& trackPosition : span)
         gridAreaBreadth += tracks[trackPosition.toInt()].m_usedBreadth;
     return gridAreaBreadth;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to