Source/WebCore/ChangeLog

 12011-11-28 Julien Chaffraix <jchaffraix@webkit.org>
 2
 3 Add limited parsing support for grid-columns and grid-rows
 4 https://bugs.webkit.org/show_bug.cgi?id=72531
 5
 6 Reviewed by Tony Chang.
 7
 8 Test: fast/css-grid-layout/grid-columns-rows-get-set.html
 9
 10 Added support for:
 11 <track-list> := <length> | <percentage> | 'none' | 'auto'
 12
 13 * CMakeLists.txt:
 14 * GNUmakefile.list.am:
 15 * Target.pri:
 16 * WebCore.gypi:
 17 * WebCore.vcproj/WebCore.vcproj:
 18 * WebCore.xcodeproj/project.pbxproj:
 19 * rendering/style/StyleAllInOne.cpp:
 20 Updated our build systems.
 21
 22 * css/CSSComputedStyleDeclaration.cpp:
 23 (WebCore::valueForGridTrackList):
 24 Helper function to convert our RenderStyle information to a proper CSSValue.
 25 It doesn't do much now but it will be expanded as we add more support.
 26
 27 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Call the previous
 28 function.
 29
 30 * css/CSSParser.h:
 31 * css/CSSParser.cpp:
 32 (WebCore::CSSParser::parseValue):
 33 (WebCore::CSSParser::parseGridTrackList):
 34 CSS parsing part of this change. Pretty simple for now.
 35
 36 * css/CSSPropertyNames.in:
 37 Added -webkit-grid-columns and -webkit-grid-rows.
 38
 39 * css/CSSProperty.cpp:
 40 (WebCore::CSSProperty::isInheritedProperty):
 41 * css/CSSStyleApplyProperty.cpp:
 42 (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
 43 * css/CSSStyleSelector.cpp:
 44 (WebCore::CSSStyleSelector::applyProperty):
 45 Style application plumbing.
 46
 47 * rendering/style/RenderStyle.cpp:
 48 (WebCore::RenderStyle::RenderStyle):
 49 (WebCore::RenderStyle::diff):
 50 This change is required for later when we add layout for our grid.
 51
 52 * rendering/style/RenderStyle.h:
 53 (WebCore::InheritedFlags::gridColumns):
 54 (WebCore::InheritedFlags::gridRows):
 55 (WebCore::InheritedFlags::setGridColumns):
 56 (WebCore::InheritedFlags::setGridRows):
 57 (WebCore::InheritedFlags::initialGridColumns):
 58 (WebCore::InheritedFlags::initialGridRows):
 59 Getters / Setters and initial values.
 60
 61 * rendering/style/StyleGridData.cpp: Added.
 62 (WebCore::StyleGridData::StyleGridData):
 63 * rendering/style/StyleGridData.h: Added.
 64 (WebCore::StyleGridData::create):
 65 (WebCore::StyleGridData::copy):
 66 (WebCore::StyleGridData::operator==):
 67 (WebCore::StyleGridData::operator!=):
 68 This class holds the grid element information. For now pretty simple
 69 shell that will be used for the rest of the support.
 70
 71 * rendering/style/StyleRareNonInheritedData.cpp:
 72 (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
 73 (WebCore::StyleRareNonInheritedData::operator==):
 74 * rendering/style/StyleRareNonInheritedData.h:
 75 Added StyleGridElementData to StyleRareNonInheritedData.
 76
1772011-11-28 Martin Robinson <mrobinson@igalia.com>
278
379 Fix 'make dist' by adding two missing files to source list.

Source/WebCore/CMakeLists.txt

@@SET(WebCore_SOURCES
13271327 rendering/style/StyleFilterData.cpp
13281328 rendering/style/StyleFlexibleBoxData.cpp
13291329 rendering/style/StyleGeneratedImage.cpp
 1330 rendering/style/StyleGridData.cpp
13301331 rendering/style/StyleInheritedData.cpp
13311332 rendering/style/StyleMarqueeData.cpp
13321333 rendering/style/StyleMultiColData.cpp

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
33003300 Source/WebCore/rendering/style/StyleFlexibleBoxData.h \
33013301 Source/WebCore/rendering/style/StyleGeneratedImage.cpp \
33023302 Source/WebCore/rendering/style/StyleGeneratedImage.h \
 3303 Source/WebCore/rendering/style/StyleGridData.cpp \
 3304 Source/WebCore/rendering/style/StyleGridData.h \
33033305 Source/WebCore/rendering/style/StyleImage.h \
33043306 Source/WebCore/rendering/style/StyleInheritedData.cpp \
33053307 Source/WebCore/rendering/style/StyleInheritedData.h \

Source/WebCore/Target.pri

@@SOURCES += \
12631263 rendering/style/StyleFilterData.cpp \
12641264 rendering/style/StyleFlexibleBoxData.cpp \
12651265 rendering/style/StyleGeneratedImage.cpp \
 1266 rendering/style/StyleGridData.cpp \
12661267 rendering/style/StyleInheritedData.cpp \
12671268 rendering/style/StyleMarqueeData.cpp \
12681269 rendering/style/StyleMultiColData.cpp \

Source/WebCore/WebCore.gypi

953953 'rendering/style/StyleFilterData.h',
954954 'rendering/style/StyleFlexibleBoxData.h',
955955 'rendering/style/StyleGeneratedImage.h',
 956 'rendering/style/StyleGridData.h',
956957 'rendering/style/StyleImage.h',
957958 'rendering/style/StyleInheritedData.h',
958959 'rendering/style/StyleMarqueeData.h',

47724773 'rendering/style/StyleFilterData.cpp',
47734774 'rendering/style/StyleFlexibleBoxData.cpp',
47744775 'rendering/style/StyleGeneratedImage.cpp',
 4776 'rendering/style/StyleGridData.cpp',
47754777 'rendering/style/StyleInheritedData.cpp',
47764778 'rendering/style/StyleMarqueeData.cpp',
47774779 'rendering/style/StyleMultiColData.cpp',

Source/WebCore/WebCore.vcproj/WebCore.vcproj

4077140771 >
4077240772 </File>
4077340773 <File
 40774 RelativePath="..\rendering\style\StyleGridData.cpp"
 40775 >
 40776 <FileConfiguration
 40777 Name="Debug|Win32"
 40778 ExcludedFromBuild="true"
 40779 >
 40780 <Tool
 40781 Name="VCCLCompilerTool"
 40782 />
 40783 </FileConfiguration>
 40784 <FileConfiguration
 40785 Name="Release|Win32"
 40786 ExcludedFromBuild="true"
 40787 >
 40788 <Tool
 40789 Name="VCCLCompilerTool"
 40790 />
 40791 </FileConfiguration>
 40792 <FileConfiguration
 40793 Name="Debug_Cairo_CFLite|Win32"
 40794 ExcludedFromBuild="true"
 40795 >
 40796 <Tool
 40797 Name="VCCLCompilerTool"
 40798 />
 40799 </FileConfiguration>
 40800 <FileConfiguration
 40801 Name="Release_Cairo_CFLite|Win32"
 40802 ExcludedFromBuild="true"
 40803 >
 40804 <Tool
 40805 Name="VCCLCompilerTool"
 40806 />
 40807 </FileConfiguration>
 40808 <FileConfiguration
 40809 Name="Debug_All|Win32"
 40810 ExcludedFromBuild="true"
 40811 >
 40812 <Tool
 40813 Name="VCCLCompilerTool"
 40814 />
 40815 </FileConfiguration>
 40816 <FileConfiguration
 40817 Name="Production|Win32"
 40818 ExcludedFromBuild="true"
 40819 >
 40820 <Tool
 40821 Name="VCCLCompilerTool"
 40822 />
 40823 </FileConfiguration>
 40824 </File>
 40825 <File
 40826 RelativePath="..\rendering\style\StyleGridData.h"
 40827 >
 40828 </File>
 40829 <File
4077440830 RelativePath="..\rendering\style\StyleImage.h"
4077540831 >
4077640832 </File>

Source/WebCore/WebCore.xcodeproj/project.pbxproj

33983398 A0EE0DF6144F825500F80B0D /* WebGLDebugRendererInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF2144F825500F80B0D /* WebGLDebugRendererInfo.h */; };
33993399 A0EE0DF7144F825500F80B0D /* WebGLDebugShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */; };
34003400 A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */; };
 3401 A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A10DC76814747BAB005E2471 /* StyleGridData.cpp */; };
 3402 A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DC76914747BAB005E2471 /* StyleGridData.h */; settings = {ATTRIBUTES = (Private, ); }; };
34013403 A120ACA413F998CA00FE4AC7 /* LayoutRepainter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */; };
34023404 A12538D413F9B60A00024754 /* LayoutRepainter.h in Headers */ = {isa = PBXBuildFile; fileRef = A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */; settings = {ATTRIBUTES = (Private, ); }; };
34033405 A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; };

1062010622 A0EE0DF2144F825500F80B0D /* WebGLDebugRendererInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDebugRendererInfo.h; path = canvas/WebGLDebugRendererInfo.h; sourceTree = "<group>"; };
1062110623 A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLDebugShaders.cpp; path = canvas/WebGLDebugShaders.cpp; sourceTree = "<group>"; };
1062210624 A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDebugShaders.h; path = canvas/WebGLDebugShaders.h; sourceTree = "<group>"; };
 10625 A10DC76814747BAB005E2471 /* StyleGridData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StyleGridData.cpp; path = style/StyleGridData.cpp; sourceTree = "<group>"; };
 10626 A10DC76914747BAB005E2471 /* StyleGridData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleGridData.h; path = style/StyleGridData.h; sourceTree = "<group>"; };
1062310627 A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutRepainter.h; sourceTree = "<group>"; };
1062410628 A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutRepainter.cpp; sourceTree = "<group>"; };
1062510629 A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; };

1983019834 BC8C8FAA0DDCD2F200B592F4 /* style */ = {
1983119835 isa = PBXGroup;
1983219836 children = (
 19837 A10DC76814747BAB005E2471 /* StyleGridData.cpp */,
 19838 A10DC76914747BAB005E2471 /* StyleGridData.h */,
1983319839 5038BE2D1472AD230095E0D1 /* StyleCachedShader.cpp */,
1983419840 5038BE2E1472AD230095E0D1 /* StyleCachedShader.h */,
1983519841 BC5EB5E00E81BE8700B25965 /* BorderData.h */,

2479424800 033A6A7C147E07D200509B36 /* HTMLPropertiesCollection.h in Headers */,
2479524801 033A6A83147E08A600509B36 /* JSHTMLPropertiesCollection.h in Headers */,
2479624802 7AA51B6E1483B61600AD2752 /* InspectorBaseAgent.h in Headers */,
 24803 A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */,
2479724804 );
2479824805 runOnlyForDeploymentPostprocessing = 0;
2479924806 };

2767627683 033A6A7E147E07E700509B36 /* HTMLPropertiesCollection.cpp in Sources */,
2767727684 033A6A81147E088600509B36 /* JSHTMLPropertiesCollection.cpp in Sources */,
2767827685 7AA51B6F1483B61600AD2752 /* InspectorBaseAgent.cpp in Sources */,
 27686 A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */,
2767927687 );
2768027688 runOnlyForDeploymentPostprocessing = 0;
2768127689 };

Source/WebCore/css/CSSComputedStyleDeclaration.cpp

@@static const int computedProperties[] = {
218218 CSSPropertyWebkitFlexAlign,
219219 CSSPropertyWebkitFlexFlow,
220220 CSSPropertyWebkitFontSmoothing,
 221#if ENABLE(CSS_GRID_LAYOUT)
 222 CSSPropertyWebkitGridColumns,
 223 CSSPropertyWebkitGridRows,
 224#endif
221225 CSSPropertyWebkitHighlight,
222226 CSSPropertyWebkitHyphenateCharacter,
223227 CSSPropertyWebkitHyphenateLimitAfter,

@@PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(RenderStyle* st
787791}
788792#endif
789793
 794#if ENABLE(CSS_GRID_LAYOUT)
 795static PassRefPtr<CSSValue> valueForGridTrackList(const Length& trackLength, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
 796{
 797 if (trackLength.isPercent())
 798 return primitiveValueCache->createValue(trackLength);
 799 if (trackLength.isAuto())
 800 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
 801 if (trackLength.isUndefined())
 802 return primitiveValueCache->createIdentifierValue(CSSValueNone);
 803 return zoomAdjustedPixelValue(trackLength.value(), style, primitiveValueCache);
 804}
 805#endif
 806
790807static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList, CSSPrimitiveValueCache* primitiveValueCache)
791808{
792809 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();

@@PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
14941511 }
14951512 return list.release();
14961513 }
 1514#if ENABLE(CSS_GRID_LAYOUT)
 1515 case CSSPropertyWebkitGridColumns: {
 1516 Length gridColumns = style->gridColumns();
 1517 return valueForGridTrackList(gridColumns, style.get(), primitiveValueCache);
 1518 }
 1519 case CSSPropertyWebkitGridRows: {
 1520 Length gridRows = style->gridRows();
 1521 return valueForGridTrackList(gridRows, style.get(), primitiveValueCache);
 1522 }
 1523#endif
14971524 case CSSPropertyHeight:
14981525 if (renderer)
14991526 return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get(), primitiveValueCache);

Source/WebCore/css/CSSParser.cpp

@@bool CSSParser::parseValue(int propId, bool important)
17721772 }
17731773 return false;
17741774 }
 1775#if ENABLE(CSS_GRID_LAYOUT)
 1776 case CSSPropertyWebkitGridColumns:
 1777 case CSSPropertyWebkitGridRows:
 1778 return parseGridTrackList(propId, important);
 1779#endif
17751780 case CSSPropertyWebkitMarginCollapse: {
17761781 const int properties[2] = { CSSPropertyWebkitMarginBeforeCollapse,
17771782 CSSPropertyWebkitMarginAfterCollapse };

@@bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
35163521 return false;
35173522}
35183523
 3524#if ENABLE(CSS_GRID_LAYOUT)
 3525bool CSSParser::parseGridTrackList(int propId, bool important)
 3526{
 3527 CSSParserValue* value = m_valueList->current();
 3528 if (value->id == CSSValueNone || value->id == CSSValueAuto) {
 3529 addProperty(propId, primitiveValueCache()->createIdentifierValue(value->id), important);
 3530 return true;
 3531 }
 3532
 3533 if (validUnit(value, FLength | FPercent, m_strict)) {
 3534 addProperty(propId, createPrimitiveNumericValue(value), important);
 3535 return true;
 3536 }
 3537 return false;
 3538}
 3539#endif
 3540
35193541
35203542
35213543#if ENABLE(DASHBOARD_SUPPORT)

Source/WebCore/css/CSSParser.h

@@public:
125125 bool parseTransitionShorthand(bool important);
126126 bool parseAnimationShorthand(bool important);
127127
 128#if ENABLE(CSS_GRID_LAYOUT)
 129 bool parseGridTrackList(int propId, bool important);
 130#endif
 131
128132 bool parseDashboardRegions(int propId, bool important);
129133
130134 bool parseShape(int propId, bool important);

Source/WebCore/css/CSSProperty.cpp

@@bool CSSProperty::isInheritedProperty(unsigned propertyID)
561561 case CSSPropertyWebkitFlexAlign:
562562 case CSSPropertyWebkitFlexFlow:
563563 case CSSPropertyWebkitFontSizeDelta:
 564#if ENABLE(CSS_GRID_LAYOUT)
 565 case CSSPropertyWebkitGridColumns:
 566 case CSSPropertyWebkitGridRows:
 567#endif
564568 case CSSPropertyWebkitLineClamp:
565569 case CSSPropertyWebkitLogicalWidth:
566570 case CSSPropertyWebkitLogicalHeight:

Source/WebCore/css/CSSPropertyNames.in

@@z-index
367367#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
368368-webkit-tap-highlight-color
369369#endif
370 
 370#if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
 371-webkit-grid-columns
 372-webkit-grid-rows
 373#endif

Source/WebCore/css/CSSStyleApplyProperty.cpp

@@CSSStyleApplyProperty::CSSStyleApplyProperty()
11351135 setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
11361136 setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
11371137
 1138#if ENABLE(CSS_GRID_LAYOUT)
 1139 setPropertyHandler(CSSPropertyWebkitGridColumns, ApplyPropertyLength<&RenderStyle::gridColumns, &RenderStyle::setGridColumns, &RenderStyle::initialGridColumns, AutoEnabled, IntrinsicDisabled, MinIntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
 1140 setPropertyHandler(CSSPropertyWebkitGridRows, ApplyPropertyLength<&RenderStyle::gridRows, &RenderStyle::setGridRows, &RenderStyle::initialGridRows, AutoEnabled, IntrinsicDisabled, MinIntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
 1141#endif
 1142
11381143 setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>::createHandler());
11391144 setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>::createHandler());
11401145

Source/WebCore/css/CSSStyleSelector.cpp

@@void CSSStyleSelector::applyProperty(int id, CSSValue *value)
38463846 case CSSPropertyWebkitFlexFlow:
38473847 case CSSPropertyFontStyle:
38483848 case CSSPropertyFontVariant:
 3849#if ENABLE(CSS_GRID_LAYOUT)
 3850 case CSSPropertyWebkitGridColumns:
 3851 case CSSPropertyWebkitGridRows:
 3852#endif
38493853 case CSSPropertyTextRendering:
38503854 case CSSPropertyWebkitTextOrientation:
38513855 case CSSPropertyWebkitFontSmoothing:

Source/WebCore/rendering/style/RenderStyle.cpp

@@ALWAYS_INLINE RenderStyle::RenderStyle(bool)
133133#if ENABLE(CSS_FILTERS)
134134 rareNonInheritedData.access()->m_filter.init();
135135#endif
 136#if ENABLE(CSS_GRID_LAYOUT)
 137 rareNonInheritedData.access()->m_grid.init();
 138#endif
136139 rareInheritedData.init();
137140 inherited.init();
138141

@@StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
426429 return StyleDifferenceLayout;
427430 }
428431#endif
 432#if ENABLE(CSS_GRID_LAYOUT)
 433 if (rareNonInheritedData->m_grid.get() != other->rareNonInheritedData->m_grid.get())
 434 return StyleDifferenceLayout;
 435#endif
429436
430437#if !USE(ACCELERATED_COMPOSITING)
431438 if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {

Source/WebCore/rendering/style/RenderStyle.h

5656#include "StyleFilterData.h"
5757#endif
5858#include "StyleFlexibleBoxData.h"
 59#if ENABLE(CSS_GRID_LAYOUT)
 60#include "StyleGridData.h"
 61#endif
5962#include "StyleInheritedData.h"
6063#include "StyleMarqueeData.h"
6164#include "StyleMultiColData.h"

@@public:
724727 EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); }
725728 EFlexFlow flexFlow() const { return static_cast<EFlexFlow>(rareNonInheritedData->m_flexibleBox->m_flexFlow); }
726729
 730#if ENABLE(CSS_GRID_LAYOUT)
 731 Length gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; }
 732 Length gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; }
 733#endif
 734
727735 const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
728736 void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
729737 void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }

@@public:
11361144 void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); }
11371145 void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); }
11381146 void setFlexFlow(EFlexFlow flow) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexFlow, flow); }
 1147#if ENABLE(CSS_GRID_LAYOUT)
 1148 void setGridColumns(Length length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, length); }
 1149 void setGridRows(Length length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, length); }
 1150#endif
 1151
11391152 void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
11401153 void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
11411154 void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }

@@public:
15091522 static StyleImage* initialMaskBoxImageSource() { return 0; }
15101523 static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
15111524
 1525#if ENABLE(CSS_GRID_LAYOUT)
 1526 static Length initialGridColumns() { return Length(Undefined); }
 1527 static Length initialGridRows() { return Length(Undefined); }
 1528#endif
 1529
15121530 static const AtomicString& initialLineGrid() { return nullAtom; }
15131531 static LineGridSnap initialLineGridSnap() { return LineGridSnapNone; }
15141532

Source/WebCore/rendering/style/StyleAllInOne.cpp

4242#include "StyleFilterData.cpp"
4343#include "StyleFlexibleBoxData.cpp"
4444#include "StyleGeneratedImage.cpp"
 45#include "StyleGridData.cpp"
4546#include "StyleInheritedData.cpp"
4647#include "StyleMarqueeData.cpp"
4748#include "StyleMultiColData.cpp"

Source/WebCore/rendering/style/StyleGridData.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 23 *
 24 */
 25
 26#include "config.h"
 27#include "StyleGridData.h"
 28
 29#if ENABLE(CSS_GRID_LAYOUT)
 30
 31#include "RenderStyle.h"
 32
 33namespace WebCore {
 34
 35StyleGridData::StyleGridData()
 36 : m_gridColumns(RenderStyle::initialGridColumns())
 37 , m_gridRows(RenderStyle::initialGridRows())
 38{
 39}
 40
 41StyleGridData::StyleGridData(const StyleGridData& o)
 42 : RefCounted<StyleGridData>()
 43 , m_gridColumns(o.m_gridColumns)
 44 , m_gridRows(o.m_gridRows)
 45{
 46}
 47
 48} // namespace WebCore
 49
 50#endif // ENABLE(CSS_GRID_LAYOUT)
 51

Source/WebCore/rendering/style/StyleGridData.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 23 *
 24 */
 25
 26#ifndef StyleGridData_h
 27#define StyleGridData_h
 28
 29#if ENABLE(CSS_GRID_LAYOUT)
 30
 31#include "Length.h"
 32#include <wtf/PassRefPtr.h>
 33#include <wtf/RefCounted.h>
 34
 35namespace WebCore {
 36
 37class StyleGridData : public RefCounted<StyleGridData> {
 38public:
 39 static PassRefPtr<StyleGridData> create() { return adoptRef(new StyleGridData); }
 40 PassRefPtr<StyleGridData> copy() const { return adoptRef(new StyleGridData(*this)); }
 41
 42 bool operator==(const StyleGridData& o) const
 43 {
 44 return m_gridColumns == o.m_gridColumns && m_gridRows == o.m_gridRows;
 45 }
 46
 47 bool operator!=(const StyleGridData& o) const
 48 {
 49 return !(*this == o);
 50 }
 51
 52 // FIXME: For the moment, we only support a subset of the grammar which correspond to:
 53 // 'auto' | <length> | <percentage> | 'none'
 54 Length m_gridColumns;
 55 Length m_gridRows;
 56
 57private:
 58 StyleGridData();
 59 StyleGridData(const StyleGridData&);
 60};
 61
 62} // namespace WebCore
 63
 64#endif // ENABLE(CSS_LAYOUT_GRID)
 65
 66#endif // StyleGridData_h

Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

@@StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
9696#if ENABLE(CSS_FILTERS)
9797 , m_filter(o.m_filter)
9898#endif
 99#if ENABLE(CSS_GRID_LAYOUT)
 100 , m_grid(o.m_grid)
 101#endif
99102 , m_content(o.m_content ? o.m_content->clone() : nullptr)
100103 , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
101104 , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)

@@bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
160163#if ENABLE(CSS_FILTERS)
161164 && m_filter == o.m_filter
162165#endif
 166#if ENABLE(CSS_GRID_LAYOUT)
 167 && m_grid == o.m_grid
 168#endif
163169 && contentDataEquivalent(o)
164170 && counterDataEquivalent(o)
165171 && userDrag == o.userDrag

Source/WebCore/rendering/style/StyleRareNonInheritedData.h

@@class StyleDeprecatedFlexibleBoxData;
4646class StyleFilterData;
4747#endif
4848class StyleFlexibleBoxData;
 49#if ENABLE(CSS_GRID_LAYOUT)
 50class StyleGridData;
 51#endif
4952class StyleMarqueeData;
5053class StyleMultiColData;
5154class StyleReflection;

@@public:
114117 DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
115118#endif
116119
 120#if ENABLE(CSS_GRID_LAYOUT)
 121 DataRef<StyleGridData> m_grid;
 122#endif
 123
117124 OwnPtr<ContentData> m_content;
118125 OwnPtr<CounterDirectiveMap> m_counterDirectives;
119126

LayoutTests/ChangeLog

 12011-11-28 Julien Chaffraix <jchaffraix@webkit.org>
 2
 3 Add limited parsing support for grid-columns and grid-rows
 4 https://bugs.webkit.org/show_bug.cgi?id=72531
 5
 6 Reviewed by Tony Chang.
 7
 8 Test our currently supported grammar.
 9
 10 * fast/css-grid-layout/grid-columns-rows-get-set.html: Added.
 11 * fast/css-grid-layout/resources/grid-columns-rows-get-set.js: Added.
 12 * fast/css-grid-layout/grid-columns-rows-get-set-expected.txt: Added.
 13
1142011-11-24 Ryosuke Niwa <rniwa@webkit.org>
215
316 dir=auto should imply unicode-bidi:isolate by default

LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt

 1Test that setting and getting grid-columns and grid-rows works as expected
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Test getting |display| set through CSS
 7PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-columns') is 'none'
 8PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-rows') is 'none'
 9PASS getComputedStyle(gridWithFixedElement, '').getPropertyValue('-webkit-grid-columns') is '10px'
 10PASS getComputedStyle(gridWithFixedElement, '').getPropertyValue('-webkit-grid-rows') is '15px'
 11PASS getComputedStyle(gridWithPercentElement, '').getPropertyValue('-webkit-grid-columns') is '53%'
 12PASS getComputedStyle(gridWithPercentElement, '').getPropertyValue('-webkit-grid-rows') is '27%'
 13PASS getComputedStyle(gridWithAutoElement, '').getPropertyValue('-webkit-grid-columns') is 'auto'
 14PASS getComputedStyle(gridWithAutoElement, '').getPropertyValue('-webkit-grid-rows') is 'auto'
 15PASS getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-columns') is '100px'
 16PASS getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-rows') is '150px'
 17
 18Test the initial value
 19PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'none'
 20PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'none'
 21
 22Test getting and setting display through JS
 23PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is '18px'
 24PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is '66px'
 25PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is '55%'
 26PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is '40%'
 27PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'auto'
 28PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'auto'
 29PASS successfullyParsed is true
 30
 31TEST COMPLETE
 32

LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<style>
 5.grid {
 6 display: -webkit-grid;
 7 -webkit-grid-columns: none;
 8 -webkit-grid-rows: none;
 9}
 10.gridWithFixed {
 11 display: -webkit-grid;
 12 -webkit-grid-columns: 10px;
 13 -webkit-grid-rows: 15px;
 14}
 15.gridWithPercent {
 16 display: -webkit-grid;
 17 -webkit-grid-columns: 53%;
 18 -webkit-grid-rows: 27%;
 19}
 20.gridWithAuto {
 21 display: -webkit-grid;
 22 -webkit-grid-columns: auto;
 23 -webkit-grid-rows: auto;
 24}
 25.gridWithEM {
 26 display: -webkit-grid;
 27 -webkit-grid-columns: 10em;
 28 -webkit-grid-rows: 15em;
 29 font: 10px Ahem;
 30}
 31</style>
 32<script src="../js/resources/js-test-pre.js"></script>
 33</head>
 34<body>
 35<div class="grid" id="gridElement"></div>
 36<div class="gridWithFixed" id="gridWithFixedElement"></div>
 37<div class="gridWithPercent" id="gridWithPercentElement"></div>
 38<div class="gridWithAuto" id="gridWithAutoElement"></div>
 39<div class="gridWithEM" id="gridWithEMElement"></div>
 40<script src="resources/grid-columns-rows-get-set.js"></script>
 41<script src="../js/resources/js-test-post.js"></script>
 42</body>
 43</html>

LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js

 1description('Test that setting and getting grid-columns and grid-rows works as expected');
 2
 3debug("Test getting |display| set through CSS");
 4var gridElement = document.getElementById("gridElement");
 5shouldBe("getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-columns')", "'none'");
 6shouldBe("getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-rows')", "'none'");
 7
 8var gridWithFixedElement = document.getElementById("gridWithFixedElement");
 9shouldBe("getComputedStyle(gridWithFixedElement, '').getPropertyValue('-webkit-grid-columns')", "'10px'");
 10shouldBe("getComputedStyle(gridWithFixedElement, '').getPropertyValue('-webkit-grid-rows')", "'15px'");
 11
 12var gridWithPercentElement = document.getElementById("gridWithPercentElement");
 13shouldBe("getComputedStyle(gridWithPercentElement, '').getPropertyValue('-webkit-grid-columns')", "'53%'");
 14shouldBe("getComputedStyle(gridWithPercentElement, '').getPropertyValue('-webkit-grid-rows')", "'27%'");
 15
 16var gridWithAutoElement = document.getElementById("gridWithAutoElement");
 17shouldBe("getComputedStyle(gridWithAutoElement, '').getPropertyValue('-webkit-grid-columns')", "'auto'");
 18shouldBe("getComputedStyle(gridWithAutoElement, '').getPropertyValue('-webkit-grid-rows')", "'auto'");
 19
 20var gridWithEMElement = document.getElementById("gridWithEMElement");
 21shouldBe("getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-columns')", "'100px'");
 22shouldBe("getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-rows')", "'150px'");
 23
 24debug("");
 25debug("Test the initial value");
 26var element = document.createElement("div");
 27document.body.appendChild(element);
 28shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'none'");
 29shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'none'");
 30
 31debug("");
 32debug("Test getting and setting display through JS");
 33element.style.webkitGridColumns = "18px";
 34element.style.webkitGridRows = "66px";
 35shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'18px'");
 36shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'66px'");
 37
 38element = document.createElement("div");
 39document.body.appendChild(element);
 40element.style.webkitGridColumns = "55%";
 41element.style.webkitGridRows = "40%";
 42shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'55%'");
 43shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'40%'");
 44
 45element = document.createElement("div");
 46document.body.appendChild(element);
 47element.style.webkitGridColumns = "auto";
 48element.style.webkitGridRows = "auto";
 49shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'auto'");
 50shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'auto'");