Changeset 157211 in webkit
- Timestamp:
- Oct 10, 2013 1:38:57 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r157199 r157211 1 2013-10-08 Sergio Villar Senin <svillar@igalia.com> 2 3 [CSS Grid Layout] Implement support for grid-template 4 https://bugs.webkit.org/show_bug.cgi?id=103313 5 6 Reviewed by Dean Jackson. 7 8 From Blink r153427, r155199 and r155712 by <jchaffraix@chromium.org> 9 10 Added a test to verify that we properly recognize, parse, store 11 and return the value of grid-template. 12 13 * fast/css-grid-layout/grid-template-get-set-expected.txt: Added. 14 * fast/css-grid-layout/grid-template-get-set.html: Added. 15 1 16 2013-10-09 Alexandru Chiculita <achicu@adobe.com> 2 17 -
trunk/Source/WebCore/CMakeLists.txt
r157203 r157211 991 991 css/CSSFunctionValue.cpp 992 992 css/CSSGradientValue.cpp 993 css/CSSGridTemplateValue.cpp 993 994 css/CSSGroupingRule.cpp 994 995 css/CSSHostRule.cpp -
trunk/Source/WebCore/ChangeLog
r157210 r157211 1 2013-10-08 Sergio Villar Senin <svillar@igalia.com> 2 3 [CSS Grid Layout] Implement support for grid-template 4 https://bugs.webkit.org/show_bug.cgi?id=103313 5 6 Reviewed by Dean Jackson. 7 8 Based on Blink r153427, r155199 and r155712 by <jchaffraix@chromium.org> 9 10 Test: fast/css-grid-layout/grid-template-get-set.html 11 12 Recognize, parse, store and return properly the value of 13 grid-template. It required some extra parsing code because the 14 specs mandates to check that the defined grid areas are indeed 15 rectangular. Named grid areas are still not fully supported, will 16 be done in a follow up patch. 17 18 As validating involves building the grid areas a new CSSValue was 19 added to hold the computed value. Note that we have to track the 20 explicit size of the named grid areas as the named grid areas 21 (".") are not tracked in our HashMap of grid areas. 22 23 This change also involves moving GridCoordinate and GridSpan to a 24 separate file in order to share the code that describes the grid 25 area coordinates. 26 27 * CMakeLists.txt: Added new files to the build. 28 * GNUmakefile.list.am: Ditto. 29 * WebCore.vcxproj/WebCore.vcxproj: Ditto. 30 * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto. 31 * WebCore.xcodeproj/project.pbxproj: Ditto. 32 * css/CSSComputedStyleDeclaration.cpp: 33 (WebCore::ComputedStyleExtractor::propertyValue): 34 * css/CSSGridTemplateValue.cpp: Added. 35 (WebCore::CSSGridTemplateValue::CSSGridTemplateValue): 36 (WebCore::stringForPosition): 37 (WebCore::CSSGridTemplateValue::customCSSText): 38 * css/CSSGridTemplateValue.h: Added. 39 (WebCore::CSSGridTemplateValue::create): 40 (WebCore::CSSGridTemplateValue::~CSSGridTemplateValue): 41 (WebCore::CSSGridTemplateValue::gridAreaMap): 42 (WebCore::CSSGridTemplateValue::rowCount): 43 (WebCore::CSSGridTemplateValue::columnCount): 44 (WebCore::toCSSGridTemplateValue): 45 * css/CSSParser.cpp: 46 (WebCore::CSSParser::parseValue): 47 (WebCore::CSSParser::parseGridTemplate): create the grid areas and 48 validate that they define rectangular sections. 49 * css/CSSParser.h: 50 * css/CSSPropertyNames.in: Added -webkit-grid-template. 51 * css/CSSValue.cpp: 52 (WebCore::CSSValue::equals): add support for the new CSSGridTemplateValue. 53 (WebCore::CSSValue::cssText): Ditto. 54 (WebCore::CSSValue::destroy): Ditto. 55 * css/CSSValue.h: 56 (WebCore::CSSValue::isGridTemplateValue): 57 * css/StyleResolver.cpp: 58 (WebCore::StyleResolver::applyProperty): 59 * rendering/RenderGrid.cpp: 60 (WebCore::RenderGrid::cachedGridCoordinate): Replaced RenderGrid::GridSpan by WebCore::GridSpan. 61 (WebCore::RenderGrid::resolveGridPositionsFromAutoPlacementPosition): Ditto. 62 (WebCore::RenderGrid::resolveGridPositionsFromStyle): Ditto. 63 (WebCore::RenderGrid::resolveGridPositionAgainstOppositePosition): Ditto. 64 (WebCore::RenderGrid::resolveNamedGridLinePositionAgainstOppositePosition): Ditto. 65 (WebCore::RenderGrid::resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition): Ditto. 66 (WebCore::RenderGrid::resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition): Ditto. 67 * rendering/RenderGrid.h: Took GridSpan and GridCoordinate out. 68 * rendering/style/GridCoordinate.h: Added. 69 (WebCore::GridSpan::create): 70 (WebCore::GridSpan::GridSpan): 71 (WebCore::GridSpan::operator==): 72 (WebCore::GridCoordinate::GridCoordinate): 73 (WebCore::GridCoordinate::operator==): 74 (WebCore::GridCoordinate::operator!=): 75 * rendering/style/RenderStyle.h: 76 * rendering/style/StyleGridData.cpp: 77 (WebCore::StyleGridData::StyleGridData): 78 * rendering/style/StyleGridData.h: 79 (WebCore::StyleGridData::operator==): 80 1 81 2013-10-09 Ryosuke Niwa <rniwa@webkit.org> 2 82 -
trunk/Source/WebCore/GNUmakefile.list.am
r157203 r157211 2526 2526 Source/WebCore/css/CSSGradientValue.cpp \ 2527 2527 Source/WebCore/css/CSSGradientValue.h \ 2528 Source/WebCore/css/CSSGridTemplateValue.cpp \ 2529 Source/WebCore/css/CSSGridTemplateValue.h \ 2528 2530 Source/WebCore/css/CSSGroupingRule.cpp \ 2529 2531 Source/WebCore/css/CSSGroupingRule.h \ … … 4532 4534 Source/WebCore/rendering/style/FillLayer.cpp \ 4533 4535 Source/WebCore/rendering/style/FillLayer.h \ 4536 Source/WebCore/rendering/style/GridCoordinate.h \ 4534 4537 Source/WebCore/rendering/style/GridPosition.h \ 4535 4538 Source/WebCore/rendering/style/KeyframeList.cpp \ -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r157203 r157211 8690 8690 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> 8691 8691 </ClCompile> 8692 <ClCompile Include="..\css\CSSGridTemplateValue.cpp" /> 8692 8693 <ClCompile Include="..\css\CSSGroupingRule.cpp"> 8693 8694 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> … … 19326 19327 <ClInclude Include="..\css\CSSFunctionValue.h" /> 19327 19328 <ClInclude Include="..\css\CSSGradientValue.h" /> 19329 <ClInclude Include="..\css\CSSGridTemplateValue.h" /> 19328 19330 <ClInclude Include="..\css\CSSGroupingRule.h" /> 19329 19331 <ClInclude Include="..\css\CSSHelper.h" /> … … 19577 19579 <ClInclude Include="..\rendering\style\DataRef.h" /> 19578 19580 <ClInclude Include="..\rendering\style\FillLayer.h" /> 19581 <ClInclude Include="..\rendering\style\GridCoordinate.h" /> 19579 19582 <ClInclude Include="..\rendering\style\GridPosition.h" /> 19580 19583 <ClInclude Include="..\rendering\style\GridTrackSize.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r157203 r157211 9571 9571 <Filter>rendering\style</Filter> 9572 9572 </ClInclude> 9573 <ClInclude Include="..\rendering\style\GridCoordinate.h"> 9574 <Filter>rendering\style</Filter> 9575 </ClInclude> 9573 9576 <ClInclude Include="..\rendering\style\GridPosition.h"> 9574 9577 <Filter>rendering\style</Filter> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r157203 r157211 5289 5289 CD3A496417A9D01B00274E42 /* SourceBufferList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3A495B17A9D01B00274E42 /* SourceBufferList.cpp */; }; 5290 5290 CD3A496517A9D01B00274E42 /* SourceBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3A495C17A9D01B00274E42 /* SourceBufferList.h */; }; 5291 CD3E251C18046B0600E27F56 /* GridCoordinate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3E251B18046B0600E27F56 /* GridCoordinate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5292 CD3E252318046BCD00E27F56 /* CSSGridTemplateValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3E252118046BCD00E27F56 /* CSSGridTemplateValue.cpp */; }; 5293 CD3E252418046BCD00E27F56 /* CSSGridTemplateValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3E252218046BCD00E27F56 /* CSSGridTemplateValue.h */; }; 5291 5294 CD47B3FC16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */; }; 5292 5295 CD4AC52A1496AE9A0087C4EF /* Composite.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD4AC5281496AE2F0087C4EF /* Composite.wav */; }; … … 12203 12206 CD3A495C17A9D01B00274E42 /* SourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferList.h; sourceTree = "<group>"; }; 12204 12207 CD3A495D17A9D01B00274E42 /* SourceBufferList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceBufferList.idl; sourceTree = "<group>"; }; 12208 CD3E251B18046B0600E27F56 /* GridCoordinate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridCoordinate.h; path = style/GridCoordinate.h; sourceTree = "<group>"; }; 12209 CD3E252118046BCD00E27F56 /* CSSGridTemplateValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSGridTemplateValue.cpp; sourceTree = "<group>"; }; 12210 CD3E252218046BCD00E27F56 /* CSSGridTemplateValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGridTemplateValue.h; sourceTree = "<group>"; }; 12205 12211 CD47B3F916CC34F800A21EC8 /* CDMPrivateAVFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDMPrivateAVFoundation.h; path = Modules/encryptedmedia/CDMPrivateAVFoundation.h; sourceTree = "<group>"; }; 12206 12212 CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CDMPrivateAVFoundation.mm; path = Modules/encryptedmedia/CDMPrivateAVFoundation.mm; sourceTree = "<group>"; }; … … 19400 19406 isa = PBXGroup; 19401 19407 children = ( 19408 CD3E251B18046B0600E27F56 /* GridCoordinate.h */, 19402 19409 FBD6AF8215EF21A3008B7110 /* BasicShapes.cpp */, 19403 19410 FBD6AF8315EF21A3008B7110 /* BasicShapes.h */, … … 20156 20163 isa = PBXGroup; 20157 20164 children = ( 20165 CD3E252118046BCD00E27F56 /* CSSGridTemplateValue.cpp */, 20166 CD3E252218046BCD00E27F56 /* CSSGridTemplateValue.h */, 20158 20167 93CA4C9C09DF93FA00DF8677 /* maketokenizer */, 20159 20168 FBD6AF8415EF21D4008B7110 /* BasicShapeFunctions.cpp */, … … 24622 24631 A0CB002517DF826C0017896B /* LineWidth.h in Headers */, 24623 24632 A06BFE2E17DFB43F008302BB /* LineInfo.h in Headers */, 24633 CD3E251C18046B0600E27F56 /* GridCoordinate.h in Headers */, 24634 CD3E252418046BCD00E27F56 /* CSSGridTemplateValue.h in Headers */, 24624 24635 ); 24625 24636 runOnlyForDeploymentPostprocessing = 0; … … 27686 27697 BC10D76717D8EE6E005E2626 /* RenderBlockFlow.cpp in Sources */, 27687 27698 A0CB002417DF82660017896B /* LineWidth.cpp in Sources */, 27699 CD3E252318046BCD00E27F56 /* CSSGridTemplateValue.cpp in Sources */, 27688 27700 ); 27689 27701 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r157098 r157211 34 34 #include "CSSFontValue.h" 35 35 #include "CSSFunctionValue.h" 36 #include "CSSGridTemplateValue.h" 36 37 #include "CSSLineBoxContainValue.h" 37 38 #include "CSSParser.h" … … 2145 2146 case CSSPropertyWebkitGridRow: 2146 2147 return getCSSPropertyValuesForGridShorthand(webkitGridRowShorthand()); 2148 2149 case CSSPropertyWebkitGridTemplate: 2150 if (!style->namedGridAreaRowCount()) { 2151 ASSERT(!style->namedGridAreaColumnCount()); 2152 return cssValuePool().createIdentifierValue(CSSValueNone); 2153 } 2154 2155 return CSSGridTemplateValue::create(style->namedGridArea(), style->namedGridAreaRowCount(), style->namedGridAreaColumnCount()); 2147 2156 2148 2157 case CSSPropertyHeight: -
trunk/Source/WebCore/css/CSSParser.cpp
r156991 r157211 41 41 #include "CSSFunctionValue.h" 42 42 #include "CSSGradientValue.h" 43 #include "CSSGridTemplateValue.h" 43 44 #include "CSSImageValue.h" 44 45 #include "CSSInheritedValue.h" … … 2713 2714 } 2714 2715 2716 case CSSPropertyWebkitGridTemplate: 2717 if (!cssGridLayoutEnabled()) 2718 return false; 2719 2720 parsedValue = parseGridTemplate(); 2721 break; 2722 2715 2723 case CSSPropertyWebkitMarginCollapse: { 2716 2724 if (num == 1) { … … 5139 5147 5140 5148 #endif /* ENABLE(DASHBOARD_SUPPORT) */ 5149 5150 PassRefPtr<CSSValue> CSSParser::parseGridTemplate() 5151 { 5152 NamedGridAreaMap gridAreaMap; 5153 size_t rowCount = 0; 5154 size_t columnCount = 0; 5155 5156 while (CSSParserValue* currentValue = m_valueList->current()) { 5157 if (currentValue->unit != CSSPrimitiveValue::CSS_STRING) 5158 return 0; 5159 5160 String gridRowNames = currentValue->string; 5161 if (!gridRowNames.length()) 5162 return 0; 5163 5164 Vector<String> columnNames; 5165 gridRowNames.split(' ', columnNames); 5166 5167 if (columnCount && (columnCount != columnNames.size())) { 5168 // The declaration is invalid if all the rows don't have the number of columns. 5169 return 0; 5170 } 5171 5172 if (!columnCount) { 5173 columnCount = columnNames.size(); 5174 ASSERT(columnCount); 5175 } 5176 5177 for (size_t currentColumn = 0; currentColumn < columnCount; ++currentColumn) { 5178 const String& gridAreaName = columnNames[currentColumn]; 5179 5180 // Unamed areas are always valid (we consider them to be 1x1). 5181 if (gridAreaName == ".") 5182 continue; 5183 5184 // We handle several grid areas with the same name at once to simplify the validation code. 5185 size_t lookAheadColumn; 5186 for (lookAheadColumn = currentColumn; lookAheadColumn < (columnCount - 1); ++lookAheadColumn) { 5187 if (columnNames[lookAheadColumn + 1] != gridAreaName) 5188 break; 5189 } 5190 5191 auto gridAreaIterator = gridAreaMap.find(gridAreaName); 5192 if (gridAreaIterator == gridAreaMap.end()) 5193 gridAreaMap.add(gridAreaName, GridCoordinate(GridSpan(rowCount, rowCount), GridSpan(currentColumn, lookAheadColumn))); 5194 else { 5195 GridCoordinate& gridCoordinate = gridAreaIterator->value; 5196 5197 // The following checks test that the grid area is a single filled-in rectangle. 5198 // 1. The new row is adjacent to the previously parsed row. 5199 if (rowCount != gridCoordinate.rows.initialPositionIndex + 1) 5200 return 0; 5201 5202 // 2. The new area starts at the same position as the previously parsed area. 5203 if (currentColumn != gridCoordinate.columns.initialPositionIndex) 5204 return 0; 5205 5206 // 3. The new area ends at the same position as the previously parsed area. 5207 if (lookAheadColumn != gridCoordinate.columns.finalPositionIndex) 5208 return 0; 5209 5210 ++gridCoordinate.rows.finalPositionIndex; 5211 } 5212 currentColumn = lookAheadColumn; 5213 } 5214 5215 ++rowCount; 5216 m_valueList->next(); 5217 } 5218 5219 if (!rowCount || !columnCount) 5220 return 0; 5221 5222 return CSSGridTemplateValue::create(gridAreaMap, rowCount, columnCount); 5223 } 5141 5224 5142 5225 PassRefPtr<CSSValue> CSSParser::parseCounterContent(CSSParserValueList* args, bool counters) -
trunk/Source/WebCore/css/CSSParser.h
r156550 r157211 170 170 PassRefPtr<CSSPrimitiveValue> parseGridTrackSize(); 171 171 PassRefPtr<CSSPrimitiveValue> parseGridBreadth(CSSParserValue*); 172 PassRefPtr<CSSValue> parseGridTemplate(); 172 173 173 174 bool parseDashboardRegions(CSSPropertyID, bool important); -
trunk/Source/WebCore/css/CSSPropertyNames.in
r156814 r157211 315 315 -webkit-grid-column 316 316 -webkit-grid-row 317 -webkit-grid-template 317 318 -webkit-grid-auto-flow 318 319 -webkit-highlight [Inherited] -
trunk/Source/WebCore/css/CSSValue.cpp
r157098 r157211 41 41 #include "CSSFunctionValue.h" 42 42 #include "CSSGradientValue.h" 43 #include "CSSGridTemplateValue.h" 43 44 #include "CSSImageGeneratorValue.h" 44 45 #include "CSSImageSetValue.h" … … 199 200 case InitialClass: 200 201 return compareCSSValues<CSSInitialValue>(*this, other); 202 case GridTemplateClass: 203 return compareCSSValues<CSSGridTemplateValue>(*this, other); 201 204 case PrimitiveClass: 202 205 return compareCSSValues<CSSPrimitiveValue>(*this, other); … … 301 304 case InitialClass: 302 305 return toCSSInitialValue(this)->customCSSText(); 306 case GridTemplateClass: 307 return toCSSGridTemplateValue(this)->customCSSText(); 303 308 case PrimitiveClass: 304 309 return toCSSPrimitiveValue(this)->customCSSText(); … … 426 431 delete toCSSInitialValue(this); 427 432 return; 433 case GridTemplateClass: 434 delete toCSSGridTemplateValue(this); 435 return; 428 436 case PrimitiveClass: 429 437 delete toCSSPrimitiveValue(this); -
trunk/Source/WebCore/css/CSSValue.h
r157024 r157211 110 110 bool isVariableValue() const { return m_classType == VariableClass; } 111 111 #endif 112 bool isGridTemplateValue() const { return m_classType == GridTemplateClass; } 112 113 #if ENABLE(SVG) 113 114 bool isSVGColor() const { return m_classType == SVGColorClass || m_classType == SVGPaintClass; } … … 180 181 VariableClass, 181 182 #endif 183 GridTemplateClass, 182 184 #if ENABLE(SVG) 183 185 SVGColorClass, -
trunk/Source/WebCore/css/StyleResolver.cpp
r157121 r157211 40 40 #include "CSSFontSelector.h" 41 41 #include "CSSFontValue.h" 42 #include "CSSGridTemplateValue.h" 42 43 #include "CSSLineBoxContainValue.h" 43 44 #include "CSSPageRule.h" … … 2787 2788 return; 2788 2789 } 2790 case CSSPropertyWebkitGridTemplate: { 2791 if (isInherit) { 2792 state.style()->setNamedGridArea(state.parentStyle()->namedGridArea()); 2793 state.style()->setNamedGridAreaRowCount(state.parentStyle()->namedGridAreaRowCount()); 2794 state.style()->setNamedGridAreaColumnCount(state.parentStyle()->namedGridAreaColumnCount()); 2795 return; 2796 } 2797 if (isInitial) { 2798 state.style()->setNamedGridArea(RenderStyle::initialNamedGridArea()); 2799 state.style()->setNamedGridAreaRowCount(RenderStyle::initialNamedGridAreaCount()); 2800 state.style()->setNamedGridAreaColumnCount(RenderStyle::initialNamedGridAreaCount()); 2801 return; 2802 } 2803 2804 if (value->isPrimitiveValue()) { 2805 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); 2806 return; 2807 } 2808 2809 CSSGridTemplateValue* gridTemplateValue = toCSSGridTemplateValue(value); 2810 state.style()->setNamedGridArea(gridTemplateValue->gridAreaMap()); 2811 state.style()->setNamedGridAreaRowCount(gridTemplateValue->rowCount()); 2812 state.style()->setNamedGridAreaColumnCount(gridTemplateValue->columnCount()); 2813 return; 2814 } 2789 2815 2790 2816 // These properties are aliased and DeprecatedStyleBuilder already applied the property on the prefixed version. -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r156876 r157211 27 27 #include "RenderGrid.h" 28 28 29 #include "GridCoordinate.h" 29 30 #include "LayoutRepainter.h" 30 31 #include "NotImplemented.h" … … 706 707 } 707 708 708 RenderGrid::GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox* gridItem) const709 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox* gridItem) const 709 710 { 710 711 ASSERT(m_gridItemCoordinate.contains(gridItem)); … … 712 713 } 713 714 714 RenderGrid::GridSpan RenderGrid::resolveGridPositionsFromAutoPlacementPosition(const RenderBox*, TrackSizingDirection, size_t initialPosition) const715 GridSpan RenderGrid::resolveGridPositionsFromAutoPlacementPosition(const RenderBox*, TrackSizingDirection, size_t initialPosition) const 715 716 { 716 717 // FIXME: We don't support spanning with auto positions yet. Once we do, this is wrong. Also we should make … … 719 720 } 720 721 721 PassOwnPtr< RenderGrid::GridSpan> RenderGrid::resolveGridPositionsFromStyle(const RenderBox* gridItem, TrackSizingDirection direction) const722 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionsFromStyle(const RenderBox* gridItem, TrackSizingDirection direction) const 722 723 { 723 724 const GridPosition& initialPosition = (direction == ForColumns) ? gridItem->style()->gridItemColumnStart() : gridItem->style()->gridItemRowStart(); … … 830 831 } 831 832 832 PassOwnPtr< RenderGrid::GridSpan> RenderGrid::resolveGridPositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side) const833 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side) const 833 834 { 834 835 if (position.isAuto()) … … 854 855 } 855 856 856 PassOwnPtr< RenderGrid::GridSpan> RenderGrid::resolveNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side) const857 PassOwnPtr<GridSpan> RenderGrid::resolveNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side) const 857 858 { 858 859 ASSERT(position.isSpan()); … … 875 876 } 876 877 877 PassOwnPtr< RenderGrid::GridSpan> RenderGrid::resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines) const878 PassOwnPtr<GridSpan> RenderGrid::resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines) const 878 879 { 879 880 // The grid line inequality needs to be strict (which doesn't match the after / end case) because |resolvedOppositePosition| … … 890 891 } 891 892 892 PassOwnPtr< RenderGrid::GridSpan> RenderGrid::resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines) const893 PassOwnPtr<GridSpan> RenderGrid::resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition(size_t resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines) const 893 894 { 894 895 // FIXME: This could be a binary search as |gridLines| is ordered. -
trunk/Source/WebCore/rendering/RenderGrid.h
r156155 r157211 31 31 namespace WebCore { 32 32 33 class GridCoordinate; 34 class GridSpan; 33 35 class GridTrack; 34 36 … … 59 61 60 62 LayoutUnit computePreferredTrackWidth(const Length&, size_t) const; 61 62 struct GridSpan {63 static PassOwnPtr<GridSpan> create(size_t initialPosition, size_t finalPosition)64 {65 return adoptPtr(new GridSpan(initialPosition, finalPosition));66 }67 68 GridSpan(size_t initialPosition, size_t finalPosition)69 : initialPositionIndex(initialPosition)70 , finalPositionIndex(finalPosition)71 {72 ASSERT(initialPositionIndex <= finalPositionIndex);73 }74 75 size_t initialPositionIndex;76 size_t finalPositionIndex;77 };78 79 struct GridCoordinate {80 // HashMap requires a default constuctor.81 GridCoordinate()82 : columns(0, 0)83 , rows(0, 0)84 {85 }86 87 GridCoordinate(const GridSpan& r, const GridSpan& c)88 : columns(c)89 , rows(r)90 {91 }92 93 GridSpan columns;94 GridSpan rows;95 };96 63 97 64 class GridIterator; -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r157121 r157211 784 784 const NamedGridLinesMap& namedGridColumnLines() const { return rareNonInheritedData->m_grid->m_namedGridColumnLines; } 785 785 const NamedGridLinesMap& namedGridRowLines() const { return rareNonInheritedData->m_grid->m_namedGridRowLines; } 786 const NamedGridAreaMap& namedGridArea() const { return rareNonInheritedData->m_grid->m_namedGridArea; } 787 size_t namedGridAreaRowCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaRowCount; } 788 size_t namedGridAreaColumnCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaColumnCount; } 786 789 GridAutoFlow gridAutoFlow() const { return rareNonInheritedData->m_grid->m_gridAutoFlow; } 787 790 const GridTrackSize& gridAutoColumns() const { return rareNonInheritedData->m_grid->m_gridAutoColumns; } … … 1320 1323 void setNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridColumnLines, namedGridColumnLines); } 1321 1324 void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridRowLines, namedGridRowLines); } 1325 void setNamedGridArea(const NamedGridAreaMap& namedGridArea) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridArea, namedGridArea); } 1326 void setNamedGridAreaRowCount(size_t rowCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaRowCount, rowCount); } 1327 void setNamedGridAreaColumnCount(size_t columnCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaColumnCount, columnCount); } 1322 1328 void setGridAutoFlow(GridAutoFlow flow) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoFlow, flow); } 1323 1329 void setGridItemColumnStart(const GridPosition& columnStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnStart, columnStartPosition); } … … 1775 1781 static GridTrackSize initialGridAutoRows() { return GridTrackSize(Auto); } 1776 1782 1783 static NamedGridAreaMap initialNamedGridArea() { return NamedGridAreaMap(); } 1784 static size_t initialNamedGridAreaCount() { return 0; } 1785 1777 1786 // 'auto' is the default. 1778 1787 static GridPosition initialGridPosition() { return GridPosition(); } -
trunk/Source/WebCore/rendering/style/StyleGridData.cpp
r153752 r157211 37 37 , m_gridAutoRows(RenderStyle::initialGridAutoRows()) 38 38 , m_gridAutoColumns(RenderStyle::initialGridAutoColumns()) 39 , m_namedGridArea(RenderStyle::initialNamedGridArea()) 40 , m_namedGridAreaRowCount(RenderStyle::initialNamedGridAreaCount()) 41 , m_namedGridAreaColumnCount(RenderStyle::initialNamedGridAreaCount()) 39 42 { 40 43 } … … 49 52 , m_gridAutoRows(o.m_gridAutoRows) 50 53 , m_gridAutoColumns(o.m_gridAutoColumns) 54 , m_namedGridArea(o.m_namedGridArea) 55 , m_namedGridAreaRowCount(o.m_namedGridAreaRowCount) 56 , m_namedGridAreaColumnCount(o.m_namedGridAreaColumnCount) 51 57 { 52 58 } -
trunk/Source/WebCore/rendering/style/StyleGridData.h
r153752 r157211 27 27 #define StyleGridData_h 28 28 29 #include "GridCoordinate.h" 29 30 #include "GridTrackSize.h" 30 31 #include "RenderStyleConstants.h" … … 46 47 { 47 48 // FIXME: comparing two hashes doesn't look great for performance. Something to keep in mind going forward. 48 return m_gridColumns == o.m_gridColumns && m_gridRows == o.m_gridRows && m_gridAutoFlow == o.m_gridAutoFlow && m_gridAutoRows == o.m_gridAutoRows && m_gridAutoColumns == o.m_gridAutoColumns && m_namedGridColumnLines == o.m_namedGridColumnLines && m_namedGridRowLines == o.m_namedGridRowLines ;49 return m_gridColumns == o.m_gridColumns && m_gridRows == o.m_gridRows && m_gridAutoFlow == o.m_gridAutoFlow && m_gridAutoRows == o.m_gridAutoRows && m_gridAutoColumns == o.m_gridAutoColumns && m_namedGridColumnLines == o.m_namedGridColumnLines && m_namedGridRowLines == o.m_namedGridRowLines && m_namedGridArea == o.m_namedGridArea && m_namedGridArea == o.m_namedGridArea && m_namedGridAreaRowCount == o.m_namedGridAreaRowCount && m_namedGridAreaColumnCount == o.m_namedGridAreaColumnCount; 49 50 } 50 51 … … 66 67 GridTrackSize m_gridAutoColumns; 67 68 69 NamedGridAreaMap m_namedGridArea; 70 // Because m_namedGridArea doesn't store the unnamed grid areas, we need to keep track 71 // of the explicit grid size defined by both named and unnamed grid areas. 72 size_t m_namedGridAreaRowCount; 73 size_t m_namedGridAreaColumnCount; 74 68 75 private: 69 76 StyleGridData();
Note: See TracChangeset
for help on using the changeset viewer.