Title: [199222] trunk/Source/WebCore
Revision
199222
Author
[email protected]
Date
2016-04-08 01:01:04 -0700 (Fri, 08 Apr 2016)

Log Message

[css-grid] Remove unnecessary iteration in populateGridPositions loop
https://bugs.webkit.org/show_bug.cgi?id=156376

Reviewed by Darin Adler.

The populateGridPositions loop limit was set to 'lastLine'. However, the
the position of last track's start line is updated after the loop, since
it does not follow the same pattern; it does not have a content
distribution offset.

So, since we are essentially overwriting the value stored in the last
iteration, we can just lower the loop limit.

No new tests added, because there is no change in the functionality.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::populateGridPositions):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (199221 => 199222)


--- trunk/Source/WebCore/ChangeLog	2016-04-08 07:17:50 UTC (rev 199221)
+++ trunk/Source/WebCore/ChangeLog	2016-04-08 08:01:04 UTC (rev 199222)
@@ -1,3 +1,23 @@
+2016-04-08  Javier Fernandez  <[email protected]>
+
+        [css-grid] Remove unnecessary iteration in populateGridPositions loop
+        https://bugs.webkit.org/show_bug.cgi?id=156376
+
+        Reviewed by Darin Adler.
+
+        The populateGridPositions loop limit was set to 'lastLine'. However, the
+        the position of last track's start line is updated after the loop, since
+        it does not follow the same pattern; it does not have a content
+        distribution offset.
+
+        So, since we are essentially overwriting the value stored in the last
+        iteration, we can just lower the loop limit.
+
+        No new tests added, because there is no change in the functionality.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::populateGridPositions):
+
 2016-04-08  John Wilander  <[email protected]>
 
         CSP: Block XHR when calling XMLHttpRequest.send() and throw network error.

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (199221 => 199222)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2016-04-08 07:17:50 UTC (rev 199221)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2016-04-08 08:01:04 UTC (rev 199222)
@@ -1606,6 +1606,9 @@
     // FIXME: This will affect the computed style value of grid tracks size, since we are
     // using these positions to compute them.
 
+    // The grid container's frame elements (border, padding and <content-position> offset) are sensible to the
+    // inline-axis flow direction. However, column lines positions are 'direction' unaware. This simplification
+    // allows us to use the same indexes to identify the columns independently on the inline-axis direction.
     unsigned numberOfTracks = sizingData.columnTracks.size();
     unsigned numberOfLines = numberOfTracks + 1;
     unsigned lastLine = numberOfLines - 1;
@@ -1614,7 +1617,7 @@
     LayoutUnit trackGap = guttersSize(ForColumns, 2);
     m_columnPositions.resize(numberOfLines);
     m_columnPositions[0] = borderAndPaddingStart() + offset.positionOffset;
-    for (unsigned i = 0; i < lastLine; ++i)
+    for (unsigned i = 0; i < nextToLastLine; ++i)
         m_columnPositions[i + 1] = m_columnPositions[i] + offset.distributionOffset + sizingData.columnTracks[i].baseSize() + trackGap;
     m_columnPositions[lastLine] = m_columnPositions[nextToLastLine] + sizingData.columnTracks[nextToLastLine].baseSize();
 
@@ -1626,7 +1629,7 @@
     trackGap = guttersSize(ForRows, 2);
     m_rowPositions.resize(numberOfLines);
     m_rowPositions[0] = borderAndPaddingBefore() + offset.positionOffset;
-    for (unsigned i = 0; i < lastLine; ++i)
+    for (unsigned i = 0; i < nextToLastLine; ++i)
         m_rowPositions[i + 1] = m_rowPositions[i] + offset.distributionOffset + sizingData.rowTracks[i].baseSize() + trackGap;
     m_rowPositions[lastLine] = m_rowPositions[nextToLastLine] + sizingData.rowTracks[nextToLastLine].baseSize();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to