[css-grid] Rename GridCoordinate to GridArea
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2016 15:10:07 +0000 (15:10 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2016 15:10:07 +0000 (15:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155489

Reviewed by Sergio Villar Senin.

As the comment in GridCoordinate states,
it actually represents a grid area as it stores
the initial and final positions in both axis (columns and rows).

Someone can think about a grid coordinate just like a single cell.
However this class was representing an area of several cells.

On top of that the "grid area" concept is defined in the spec:
https://drafts.csswg.org/css-grid/#grid-area-concept

No new tests, no change of behavior.

* WebCore.xcodeproj/project.pbxproj:
* css/CSSGridTemplateAreasValue.cpp:
(WebCore::stringForPosition):
* css/CSSGridTemplateAreasValue.h:
* css/CSSParser.cpp:
(WebCore::CSSParser::parseGridTemplateAreasRow):
* css/CSSParser.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::GridIterator::nextEmptyGridArea):
(WebCore::RenderGrid::insertItemIntoGrid):
(WebCore::RenderGrid::placeItemsOnGrid):
(WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
(WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid):
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
(WebCore::RenderGrid::clearGrid):
(WebCore::RenderGrid::cachedGridArea):
(WebCore::RenderGrid::cachedGridSpan):
* rendering/RenderGrid.h:
* rendering/style/GridArea.h: Renamed from Source/WebCore/rendering/style/GridCoordinate.h.
(WebCore::GridSpan::untranslatedDefiniteGridSpan):
(WebCore::GridSpan::translatedDefiniteGridSpan):
(WebCore::GridSpan::indefiniteGridSpan):
(WebCore::GridSpan::operator==):
(WebCore::GridSpan::integerSpan):
(WebCore::GridSpan::untranslatedResolvedInitialPosition):
(WebCore::GridSpan::untranslatedResolvedFinalPosition):
(WebCore::GridSpan::resolvedInitialPosition):
(WebCore::GridSpan::resolvedFinalPosition):
(WebCore::GridSpan::GridSpanIterator::GridSpanIterator):
(WebCore::GridSpan::GridSpanIterator::operator unsigned&):
(WebCore::GridSpan::GridSpanIterator::operator*):
(WebCore::GridSpan::begin):
(WebCore::GridSpan::end):
(WebCore::GridSpan::isTranslatedDefinite):
(WebCore::GridSpan::isIndefinite):
(WebCore::GridSpan::translate):
(WebCore::GridSpan::GridSpan):
(WebCore::GridArea::GridArea):
(WebCore::GridArea::operator==):
(WebCore::GridArea::operator!=):
* rendering/style/GridPositionsResolver.cpp:
* rendering/style/StyleGridData.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198210 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSGridTemplateAreasValue.cpp
Source/WebCore/css/CSSGridTemplateAreasValue.h
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/style/GridArea.h [moved from Source/WebCore/rendering/style/GridCoordinate.h with 94% similarity]
Source/WebCore/rendering/style/GridPositionsResolver.cpp
Source/WebCore/rendering/style/StyleGridData.h

index 690ce08..680593b 100644 (file)
@@ -1,3 +1,66 @@
+2016-03-15  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [css-grid] Rename GridCoordinate to GridArea
+        https://bugs.webkit.org/show_bug.cgi?id=155489
+
+        Reviewed by Sergio Villar Senin.
+
+        As the comment in GridCoordinate states,
+        it actually represents a grid area as it stores
+        the initial and final positions in both axis (columns and rows).
+
+        Someone can think about a grid coordinate just like a single cell.
+        However this class was representing an area of several cells.
+
+        On top of that the "grid area" concept is defined in the spec:
+        https://drafts.csswg.org/css-grid/#grid-area-concept
+
+        No new tests, no change of behavior.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSGridTemplateAreasValue.cpp:
+        (WebCore::stringForPosition):
+        * css/CSSGridTemplateAreasValue.h:
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseGridTemplateAreasRow):
+        * css/CSSParser.h:
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::GridIterator::nextEmptyGridArea):
+        (WebCore::RenderGrid::insertItemIntoGrid):
+        (WebCore::RenderGrid::placeItemsOnGrid):
+        (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
+        (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid):
+        (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
+        (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
+        (WebCore::RenderGrid::clearGrid):
+        (WebCore::RenderGrid::cachedGridArea):
+        (WebCore::RenderGrid::cachedGridSpan):
+        * rendering/RenderGrid.h:
+        * rendering/style/GridArea.h: Renamed from Source/WebCore/rendering/style/GridCoordinate.h.
+        (WebCore::GridSpan::untranslatedDefiniteGridSpan):
+        (WebCore::GridSpan::translatedDefiniteGridSpan):
+        (WebCore::GridSpan::indefiniteGridSpan):
+        (WebCore::GridSpan::operator==):
+        (WebCore::GridSpan::integerSpan):
+        (WebCore::GridSpan::untranslatedResolvedInitialPosition):
+        (WebCore::GridSpan::untranslatedResolvedFinalPosition):
+        (WebCore::GridSpan::resolvedInitialPosition):
+        (WebCore::GridSpan::resolvedFinalPosition):
+        (WebCore::GridSpan::GridSpanIterator::GridSpanIterator):
+        (WebCore::GridSpan::GridSpanIterator::operator unsigned&):
+        (WebCore::GridSpan::GridSpanIterator::operator*):
+        (WebCore::GridSpan::begin):
+        (WebCore::GridSpan::end):
+        (WebCore::GridSpan::isTranslatedDefinite):
+        (WebCore::GridSpan::isIndefinite):
+        (WebCore::GridSpan::translate):
+        (WebCore::GridSpan::GridSpan):
+        (WebCore::GridArea::GridArea):
+        (WebCore::GridArea::operator==):
+        (WebCore::GridArea::operator!=):
+        * rendering/style/GridPositionsResolver.cpp:
+        * rendering/style/StyleGridData.h:
+
 2016-03-15  Joonghun Park  <jh718.park@samsung.com>
 
         [GTK] Remove duplicate HashMap traversal and unneeded reference count churn in DataObjectGtk::forClipboard
index f9d331b..a12a978 100644 (file)
                CD3A496217A9D01B00274E42 /* SourceBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3A495917A9D01B00274E42 /* SourceBuffer.h */; };
                CD3A496417A9D01B00274E42 /* SourceBufferList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3A495B17A9D01B00274E42 /* SourceBufferList.cpp */; };
                CD3A496517A9D01B00274E42 /* SourceBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3A495C17A9D01B00274E42 /* SourceBufferList.h */; };
-               CD3E251C18046B0600E27F56 /* GridCoordinate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3E251B18046B0600E27F56 /* GridCoordinate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               CD3E251C18046B0600E27F56 /* GridArea.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3E251B18046B0600E27F56 /* GridArea.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CD3E252318046BCD00E27F56 /* CSSGridTemplateAreasValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3E252118046BCD00E27F56 /* CSSGridTemplateAreasValue.cpp */; };
                CD3E252418046BCD00E27F56 /* CSSGridTemplateAreasValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3E252218046BCD00E27F56 /* CSSGridTemplateAreasValue.h */; };
                CD4AC52A1496AE9A0087C4EF /* Composite.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD4AC5281496AE2F0087C4EF /* Composite.wav */; };
                CD3A495B17A9D01B00274E42 /* SourceBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceBufferList.cpp; sourceTree = "<group>"; };
                CD3A495C17A9D01B00274E42 /* SourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferList.h; sourceTree = "<group>"; };
                CD3A495D17A9D01B00274E42 /* SourceBufferList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceBufferList.idl; sourceTree = "<group>"; };
-               CD3E251B18046B0600E27F56 /* GridCoordinate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridCoordinate.h; sourceTree = "<group>"; };
+               CD3E251B18046B0600E27F56 /* GridArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridArea.h; sourceTree = "<group>"; };
                CD3E252118046BCD00E27F56 /* CSSGridTemplateAreasValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSGridTemplateAreasValue.cpp; sourceTree = "<group>"; };
                CD3E252218046BCD00E27F56 /* CSSGridTemplateAreasValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGridTemplateAreasValue.h; sourceTree = "<group>"; };
                CD4097FF1A8C855F004C65E9 /* CFNSURLConnectionSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFNSURLConnectionSPI.h; sourceTree = "<group>"; };
                                BC22746E0E83664500E7F975 /* DataRef.h */,
                                BC5EB69C0E81DAEB00B25965 /* FillLayer.cpp */,
                                BC5EB69D0E81DAEB00B25965 /* FillLayer.h */,
-                               CD3E251B18046B0600E27F56 /* GridCoordinate.h */,
+                               CD3E251B18046B0600E27F56 /* GridArea.h */,
                                CDEF4FD617E85C8F00AEE24B /* GridLength.h */,
                                A12705C21656BD6500C2E27C /* GridPosition.h */,
                                CDF7483C18FEBCEC0006ECC0 /* GridPositionsResolver.cpp */,
                                CEC337AF1A46086D009B8523 /* GraphicsServicesSPI.h in Headers */,
                                B2A015AB0AF6CD53006BCE0E /* GraphicsTypes.h in Headers */,
                                77A17A7B12F2890B004E02F6 /* GraphicsTypes3D.h in Headers */,
-                               CD3E251C18046B0600E27F56 /* GridCoordinate.h in Headers */,
+                               CD3E251C18046B0600E27F56 /* GridArea.h in Headers */,
                                CDEF4FD717E85C8F00AEE24B /* GridLength.h in Headers */,
                                A12705C31656BD6500C2E27C /* GridPosition.h in Headers */,
                                CDF7483F18FEBCEC0006ECC0 /* GridPositionsResolver.h in Headers */,
index d272b73..63f6697 100644 (file)
@@ -34,7 +34,7 @@
 
 #if ENABLE(CSS_GRID_LAYOUT)
 
-#include "GridCoordinate.h"
+#include "GridArea.h"
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -54,14 +54,14 @@ static String stringForPosition(const NamedGridAreaMap& gridAreaMap, size_t row,
     Vector<String> candidates;
 
     for (const auto& it : gridAreaMap) {
-        const GridCoordinate& coordinate = it.value;
-        if (row >= coordinate.rows.resolvedInitialPosition() && row < coordinate.rows.resolvedFinalPosition())
+        const GridArea& area = it.value;
+        if (row >= area.rows.resolvedInitialPosition() && row < area.rows.resolvedFinalPosition())
             candidates.append(it.key);
     }
 
     for (const auto& it : gridAreaMap) {
-        const GridCoordinate& coordinate = it.value;
-        if (column >= coordinate.columns.resolvedInitialPosition() && column < coordinate.columns.resolvedFinalPosition() && candidates.contains(it.key))
+        const GridArea& area = it.value;
+        if (column >= area.columns.resolvedInitialPosition() && column < area.columns.resolvedFinalPosition() && candidates.contains(it.key))
             return it.key;
     }
 
index 1d97513..f433718 100644 (file)
@@ -35,7 +35,7 @@
 #if ENABLE(CSS_GRID_LAYOUT)
 
 #include "CSSValue.h"
-#include "GridCoordinate.h"
+#include "GridArea.h"
 
 namespace WebCore {
 
index d878382..40b8469 100644 (file)
@@ -71,7 +71,7 @@
 #include "Counter.h"
 #include "Document.h"
 #include "FloatConversion.h"
-#include "GridCoordinate.h"
+#include "GridArea.h"
 #include "HTMLParserIdioms.h"
 #include "HashTools.h"
 #include "MediaList.h"
@@ -6249,24 +6249,24 @@ bool CSSParser::parseGridTemplateAreasRow(NamedGridAreaMap& gridAreaMap, const u
 
         auto gridAreaIterator = gridAreaMap.find(gridAreaName);
         if (gridAreaIterator == gridAreaMap.end())
-            gridAreaMap.add(gridAreaName, GridCoordinate(GridSpan::translatedDefiniteGridSpan(rowCount, rowCount + 1), GridSpan::translatedDefiniteGridSpan(currentColumn, lookAheadColumn)));
+            gridAreaMap.add(gridAreaName, GridArea(GridSpan::translatedDefiniteGridSpan(rowCount, rowCount + 1), GridSpan::translatedDefiniteGridSpan(currentColumn, lookAheadColumn)));
         else {
-            GridCoordinate& gridCoordinate = gridAreaIterator->value;
+            GridArea& gridArea = gridAreaIterator->value;
 
             // The following checks test that the grid area is a single filled-in rectangle.
             // 1. The new row is adjacent to the previously parsed row.
-            if (rowCount != gridCoordinate.rows.resolvedFinalPosition())
+            if (rowCount != gridArea.rows.resolvedFinalPosition())
                 return false;
 
             // 2. The new area starts at the same position as the previously parsed area.
-            if (currentColumn != gridCoordinate.columns.resolvedInitialPosition())
+            if (currentColumn != gridArea.columns.resolvedInitialPosition())
                 return false;
 
             // 3. The new area ends at the same position as the previously parsed area.
-            if (lookAheadColumn != gridCoordinate.columns.resolvedFinalPosition())
+            if (lookAheadColumn != gridArea.columns.resolvedFinalPosition())
                 return false;
 
-            gridCoordinate.rows = GridSpan::translatedDefiniteGridSpan(gridCoordinate.rows.resolvedInitialPosition(), gridCoordinate.rows.resolvedFinalPosition() + 1);
+            gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.resolvedInitialPosition(), gridArea.rows.resolvedFinalPosition() + 1);
         }
         currentColumn = lookAheadColumn - 1;
     }
index feff844..9a3f5f8 100644 (file)
@@ -43,7 +43,7 @@
 #include <wtf/text/TextPosition.h>
 
 #if ENABLE(CSS_GRID_LAYOUT)
-#include "GridCoordinate.h"
+#include "GridArea.h"
 #endif
 
 namespace WebCore {
index 4f874a1..5788a01 100644 (file)
@@ -29,7 +29,7 @@
 
 #if ENABLE(CSS_GRID_LAYOUT)
 
-#include "GridCoordinate.h"
+#include "GridArea.h"
 #include "GridPositionsResolver.h"
 #include "LayoutRepainter.h"
 #include "RenderLayer.h"
@@ -177,7 +177,7 @@ public:
         return true;
     }
 
-    std::unique_ptr<GridCoordinate> nextEmptyGridArea(unsigned fixedTrackSpan, unsigned varyingTrackSpan)
+    std::unique_ptr<GridArea> nextEmptyGridArea(unsigned fixedTrackSpan, unsigned varyingTrackSpan)
     {
         ASSERT(fixedTrackSpan >= 1 && varyingTrackSpan >= 1);
 
@@ -191,7 +191,7 @@ public:
         const unsigned endOfVaryingTrackIndex = (m_direction == ForColumns) ? m_grid.size() : m_grid[0].size();
         for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex) {
             if (isEmptyAreaEnough(rowSpan, columnSpan)) {
-                std::unique_ptr<GridCoordinate> result = std::make_unique<GridCoordinate>(GridSpan::translatedDefiniteGridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan::translatedDefiniteGridSpan(m_columnIndex, m_columnIndex + columnSpan));
+                std::unique_ptr<GridArea> result = std::make_unique<GridArea>(GridSpan::translatedDefiniteGridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan::translatedDefiniteGridSpan(m_columnIndex, m_columnIndex + columnSpan));
                 // Advance the iterator to avoid an infinite loop where we would return the same grid area over and over.
                 ++varyingTrackIndex;
                 return result;
@@ -1139,13 +1139,13 @@ void RenderGrid::ensureGridSize(unsigned maximumRowSize, unsigned maximumColumnS
     }
 }
 
-void RenderGrid::insertItemIntoGrid(RenderBox& child, const GridCoordinate& coordinate)
+void RenderGrid::insertItemIntoGrid(RenderBox& child, const GridArea& area)
 {
-    ASSERT(coordinate.rows.isTranslatedDefinite() && coordinate.columns.isTranslatedDefinite());
-    ensureGridSize(coordinate.rows.resolvedFinalPosition(), coordinate.columns.resolvedFinalPosition());
+    ASSERT(area.rows.isTranslatedDefinite() && area.columns.isTranslatedDefinite());
+    ensureGridSize(area.rows.resolvedFinalPosition(), area.columns.resolvedFinalPosition());
 
-    for (auto row : coordinate.rows) {
-        for (auto column : coordinate.columns)
+    for (auto row : area.rows) {
+        for (auto column : area.columns)
             m_grid[row][column].append(&child);
     }
 }
@@ -1153,7 +1153,7 @@ void RenderGrid::insertItemIntoGrid(RenderBox& child, const GridCoordinate& coor
 void RenderGrid::placeItemsOnGrid()
 {
     ASSERT(!gridWasPopulated());
-    ASSERT(m_gridItemCoordinate.isEmpty());
+    ASSERT(m_gridItemArea.isEmpty());
 
     populateExplicitGridAndOrderIterator();
 
@@ -1163,23 +1163,23 @@ void RenderGrid::placeItemsOnGrid()
         if (child->isOutOfFlowPositioned())
             continue;
 
-        GridCoordinate coordinate = cachedGridCoordinate(*child);
-        if (!coordinate.rows.isIndefinite())
-            coordinate.rows.translate(std::abs(m_smallestRowStart));
-        if (!coordinate.columns.isIndefinite())
-            coordinate.columns.translate(std::abs(m_smallestColumnStart));
-        m_gridItemCoordinate.set(child, coordinate);
+        GridArea area = cachedGridArea(*child);
+        if (!area.rows.isIndefinite())
+            area.rows.translate(std::abs(m_smallestRowStart));
+        if (!area.columns.isIndefinite())
+            area.columns.translate(std::abs(m_smallestColumnStart));
+        m_gridItemArea.set(child, area);
 
-        if (coordinate.rows.isIndefinite() || coordinate.columns.isIndefinite()) {
+        if (area.rows.isIndefinite() || area.columns.isIndefinite()) {
             bool majorAxisDirectionIsForColumns = autoPlacementMajorAxisDirection() == ForColumns;
-            if ((majorAxisDirectionIsForColumns && coordinate.columns.isIndefinite())
-                || (!majorAxisDirectionIsForColumns && coordinate.rows.isIndefinite()))
+            if ((majorAxisDirectionIsForColumns && area.columns.isIndefinite())
+                || (!majorAxisDirectionIsForColumns && area.rows.isIndefinite()))
                 autoMajorAxisAutoGridItems.append(child);
             else
                 specifiedMajorAxisAutoGridItems.append(child);
             continue;
         }
-        insertItemIntoGrid(*child, GridCoordinate(coordinate.rows, coordinate.columns));
+        insertItemIntoGrid(*child, GridArea(area.rows, area.columns));
     }
 
     ASSERT(gridRowCount() >= GridPositionsResolver::explicitGridRowCount(style()));
@@ -1193,8 +1193,8 @@ void RenderGrid::placeItemsOnGrid()
         if (child->isOutOfFlowPositioned())
             continue;
 
-        GridCoordinate coordinate = cachedGridCoordinate(*child);
-        ASSERT(coordinate.rows.isTranslatedDefinite() && coordinate.columns.isTranslatedDefinite());
+        GridArea area = cachedGridArea(*child);
+        ASSERT(area.rows.isTranslatedDefinite() && area.columns.isTranslatedDefinite());
     }
 #endif
 }
@@ -1232,7 +1232,7 @@ void RenderGrid::populateExplicitGridAndOrderIterator()
             maximumColumnIndex = std::max(maximumColumnIndex, spanSize);
         }
 
-        m_gridItemCoordinate.set(child, GridCoordinate(rowPositions, columnPositions));
+        m_gridItemArea.set(child, GridArea(rowPositions, columnPositions));
     }
 
     m_grid.grow(maximumRowIndex + std::abs(m_smallestRowStart));
@@ -1240,13 +1240,13 @@ void RenderGrid::populateExplicitGridAndOrderIterator()
         column.grow(maximumColumnIndex + std::abs(m_smallestColumnStart));
 }
 
-std::unique_ptr<GridCoordinate> RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const RenderBox& gridItem, GridTrackSizingDirection specifiedDirection, const GridSpan& specifiedPositions) const
+std::unique_ptr<GridArea> RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const RenderBox& gridItem, GridTrackSizingDirection specifiedDirection, const GridSpan& specifiedPositions) const
 {
     GridTrackSizingDirection crossDirection = specifiedDirection == ForColumns ? ForRows : ForColumns;
     const unsigned endOfCrossDirection = crossDirection == ForColumns ? gridColumnCount() : gridRowCount();
     unsigned crossDirectionSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(style(), gridItem, crossDirection);
     GridSpan crossDirectionPositions = GridSpan::translatedDefiniteGridSpan(endOfCrossDirection, endOfCrossDirection + crossDirectionSpanSize);
-    return std::make_unique<GridCoordinate>(specifiedDirection == ForColumns ? crossDirectionPositions : specifiedPositions, specifiedDirection == ForColumns ? specifiedPositions : crossDirectionPositions);
+    return std::make_unique<GridArea>(specifiedDirection == ForColumns ? crossDirectionPositions : specifiedPositions, specifiedDirection == ForColumns ? specifiedPositions : crossDirectionPositions);
 }
 
 void RenderGrid::placeSpecifiedMajorAxisItemsOnGrid(const Vector<RenderBox*>& autoGridItems)
@@ -1267,11 +1267,11 @@ void RenderGrid::placeSpecifiedMajorAxisItemsOnGrid(const Vector<RenderBox*>& au
         unsigned majorAxisInitialPosition = majorAxisPositions.resolvedInitialPosition();
 
         GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), majorAxisPositions.resolvedInitialPosition(), isGridAutoFlowDense ? 0 : minorAxisCursors.get(majorAxisInitialPosition));
-        std::unique_ptr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridArea(majorAxisPositions.integerSpan(), minorAxisSpanSize);
+        std::unique_ptr<GridArea> emptyGridArea = iterator.nextEmptyGridArea(majorAxisPositions.integerSpan(), minorAxisSpanSize);
         if (!emptyGridArea)
             emptyGridArea = createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(*autoGridItem, autoPlacementMajorAxisDirection(), majorAxisPositions);
 
-        m_gridItemCoordinate.set(autoGridItem, *emptyGridArea);
+        m_gridItemArea.set(autoGridItem, *emptyGridArea);
         insertItemIntoGrid(*autoGridItem, *emptyGridArea);
 
         if (!isGridAutoFlowDense)
@@ -1303,7 +1303,7 @@ void RenderGrid::placeAutoMajorAxisItemOnGrid(RenderBox& gridItem, AutoPlacement
     unsigned majorAxisAutoPlacementCursor = autoPlacementMajorAxisDirection() == ForColumns ? autoPlacementCursor.second : autoPlacementCursor.first;
     unsigned minorAxisAutoPlacementCursor = autoPlacementMajorAxisDirection() == ForColumns ? autoPlacementCursor.first : autoPlacementCursor.second;
 
-    std::unique_ptr<GridCoordinate> emptyGridArea;
+    std::unique_ptr<GridArea> emptyGridArea;
     GridSpan minorAxisPositions = cachedGridSpan(gridItem, autoPlacementMinorAxisDirection());
     if (minorAxisPositions.isTranslatedDefinite()) {
         // Move to the next track in major axis if initial position in minor axis is before auto-placement cursor.
@@ -1344,7 +1344,7 @@ void RenderGrid::placeAutoMajorAxisItemOnGrid(RenderBox& gridItem, AutoPlacement
             emptyGridArea = createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(gridItem, autoPlacementMinorAxisDirection(), GridSpan::translatedDefiniteGridSpan(0, minorAxisSpanSize));
     }
 
-    m_gridItemCoordinate.set(&gridItem, *emptyGridArea);
+    m_gridItemArea.set(&gridItem, *emptyGridArea);
     insertItemIntoGrid(gridItem, *emptyGridArea);
     autoPlacementCursor.first = emptyGridArea->rows.resolvedInitialPosition();
     autoPlacementCursor.second = emptyGridArea->columns.resolvedInitialPosition();
@@ -1363,7 +1363,7 @@ GridTrackSizingDirection RenderGrid::autoPlacementMinorAxisDirection() const
 void RenderGrid::clearGrid()
 {
     m_grid.clear();
-    m_gridItemCoordinate.clear();
+    m_gridItemArea.clear();
 }
 
 static const StyleContentAlignmentData& normalValueBehaviorGrid()
@@ -1542,16 +1542,16 @@ void RenderGrid::offsetAndBreadthForPositionedChild(const RenderBox& child, Grid
     }
 }
 
-GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox& gridItem) const
+GridArea RenderGrid::cachedGridArea(const RenderBox& gridItem) const
 {
-    ASSERT(m_gridItemCoordinate.contains(&gridItem));
-    return m_gridItemCoordinate.get(&gridItem);
+    ASSERT(m_gridItemArea.contains(&gridItem));
+    return m_gridItemArea.get(&gridItem);
 }
 
 GridSpan RenderGrid::cachedGridSpan(const RenderBox& gridItem, GridTrackSizingDirection direction) const
 {
-    GridCoordinate coordinate = cachedGridCoordinate(gridItem);
-    return direction == ForColumns ? coordinate.columns : coordinate.rows;
+    GridArea area = cachedGridArea(gridItem);
+    return direction == ForColumns ? area.columns : area.rows;
 }
 
 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDirection direction, const Vector<GridTrack>& tracks) const
index 752645d..014a046 100644 (file)
@@ -35,7 +35,7 @@
 
 namespace WebCore {
 
-class GridCoordinate;
+class GridArea;
 class GridSpan;
 class GridTrack;
 class GridItemWithSpan;
@@ -77,10 +77,10 @@ private:
     void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridSizingData&);
 
     void ensureGridSize(unsigned maximumRowSize, unsigned maximumColumnSize);
-    void insertItemIntoGrid(RenderBox&, const GridCoordinate&);
+    void insertItemIntoGrid(RenderBox&, const GridArea&);
     void placeItemsOnGrid();
     void populateExplicitGridAndOrderIterator();
-    std::unique_ptr<GridCoordinate> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const RenderBox&, GridTrackSizingDirection, const GridSpan&) const;
+    std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const RenderBox&, GridTrackSizingDirection, const GridSpan&) const;
     void placeSpecifiedMajorAxisItemsOnGrid(const Vector<RenderBox*>&);
     void placeAutoMajorAxisItemsOnGrid(const Vector<RenderBox*>&);
     typedef std::pair<unsigned, unsigned> AutoPlacementCursor;
@@ -140,7 +140,7 @@ private:
     LayoutUnit rowAxisOffsetForChild(const RenderBox&) const;
     ContentAlignmentData computeContentPositionAndDistributionOffset(GridTrackSizingDirection, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks) const;
     LayoutPoint findChildLogicalPosition(const RenderBox&) const;
-    GridCoordinate cachedGridCoordinate(const RenderBox&) const;
+    GridArea cachedGridArea(const RenderBox&) const;
     GridSpan cachedGridSpan(const RenderBox&, GridTrackSizingDirection) const;
 
 
@@ -185,7 +185,7 @@ private:
     Vector<Vector<Vector<RenderBox*, 1>>> m_grid;
     Vector<LayoutUnit> m_columnPositions;
     Vector<LayoutUnit> m_rowPositions;
-    HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate;
+    HashMap<const RenderBox*, GridArea> m_gridItemArea;
     OrderIterator m_orderIterator;
 
     Optional<LayoutUnit> m_minContentHeight;
similarity index 94%
rename from Source/WebCore/rendering/style/GridCoordinate.h
rename to Source/WebCore/rendering/style/GridArea.h
index ab0a3f9..898063e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
- * Copyright (C) 2013, 2014 Igalia S.L.
+ * Copyright (C) 2013, 2014, 2016 Igalia S.L.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,8 +29,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef GridCoordinate_h
-#define GridCoordinate_h
+#ifndef GridArea_h
+#define GridArea_h
 
 #if ENABLE(CSS_GRID_LAYOUT)
 
@@ -174,27 +174,27 @@ private:
 };
 
 // This represents a grid area that spans in both rows' and columns' direction.
-class GridCoordinate {
+class GridArea {
 public:
     // HashMap requires a default constuctor.
-    GridCoordinate()
+    GridArea()
         : columns(GridSpan::indefiniteGridSpan())
         , rows(GridSpan::indefiniteGridSpan())
     {
     }
 
-    GridCoordinate(const GridSpan& r, const GridSpan& c)
+    GridArea(const GridSpan& r, const GridSpan& c)
         : columns(c)
         , rows(r)
     {
     }
 
-    bool operator==(const GridCoordinate& o) const
+    bool operator==(const GridArea& o) const
     {
         return columns == o.columns && rows == o.rows;
     }
 
-    bool operator!=(const GridCoordinate& o) const
+    bool operator!=(const GridArea& o) const
     {
         return !(*this == o);
     }
@@ -203,10 +203,10 @@ public:
     GridSpan rows;
 };
 
-typedef HashMap<String, GridCoordinate> NamedGridAreaMap;
+typedef HashMap<String, GridArea> NamedGridAreaMap;
 
 } // namespace WebCore
 
 #endif /* ENABLE(CSS_GRID_LAYOUT) */
 
-#endif // GridCoordinate_h
+#endif // GridArea_h
index 9573b67..90c46ea 100644 (file)
@@ -33,7 +33,7 @@
 
 #if ENABLE(CSS_GRID_LAYOUT)
 
-#include "GridCoordinate.h"
+#include "GridArea.h"
 #include "RenderBox.h"
 #include <cstdlib>
 
index d895cda..7e16325 100644 (file)
@@ -28,7 +28,7 @@
 
 #if ENABLE(CSS_GRID_LAYOUT)
 
-#include "GridCoordinate.h"
+#include "GridArea.h"
 #include "GridTrackSize.h"
 #include "RenderStyleConstants.h"
 #include <wtf/PassRefPtr.h>