Source/WebCore/ChangeLog

 12011-11-16 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 NOBODY (OOPS!).
 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-16 Alexandre Elias <aelias@google.com>
278
379 [chromium] Add null pointer check in setDeviceScaleFactor

Source/WebCore/CMakeLists.txt

@@SET(WebCore_SOURCES
13151315 rendering/style/StyleFilterData.cpp
13161316 rendering/style/StyleFlexibleBoxData.cpp
13171317 rendering/style/StyleGeneratedImage.cpp
 1318 rendering/style/StyleGridData.cpp
13181319 rendering/style/StyleInheritedData.cpp
13191320 rendering/style/StyleMarqueeData.cpp
13201321 rendering/style/StyleMultiColData.cpp

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
32793279 Source/WebCore/rendering/style/StyleFlexibleBoxData.h \
32803280 Source/WebCore/rendering/style/StyleGeneratedImage.cpp \
32813281 Source/WebCore/rendering/style/StyleGeneratedImage.h \
 3282 Source/WebCore/rendering/style/StyleGridData.cpp \
 3283 Source/WebCore/rendering/style/StyleGridData.h \
32823284 Source/WebCore/rendering/style/StyleImage.h \
32833285 Source/WebCore/rendering/style/StyleInheritedData.cpp \
32843286 Source/WebCore/rendering/style/StyleInheritedData.h \

Source/WebCore/Target.pri

@@SOURCES += \
12571257 rendering/style/StyleFilterData.cpp \
12581258 rendering/style/StyleFlexibleBoxData.cpp \
12591259 rendering/style/StyleGeneratedImage.cpp \
 1260 rendering/style/StyleGridData.cpp \
12601261 rendering/style/StyleInheritedData.cpp \
12611262 rendering/style/StyleMarqueeData.cpp \
12621263 rendering/style/StyleMultiColData.cpp \

Source/WebCore/WebCore.gypi

949949 'rendering/style/StyleFilterData.h',
950950 'rendering/style/StyleFlexibleBoxData.h',
951951 'rendering/style/StyleGeneratedImage.h',
 952 'rendering/style/StyleGridData.h',
952953 'rendering/style/StyleImage.h',
953954 'rendering/style/StyleInheritedData.h',
954955 'rendering/style/StyleMarqueeData.h',

47544755 'rendering/style/StyleFilterData.cpp',
47554756 'rendering/style/StyleFlexibleBoxData.cpp',
47564757 'rendering/style/StyleGeneratedImage.cpp',
 4758 'rendering/style/StyleGridData.cpp',
47574759 'rendering/style/StyleInheritedData.cpp',
47584760 'rendering/style/StyleMarqueeData.cpp',
47594761 'rendering/style/StyleMultiColData.cpp',

Source/WebCore/WebCore.vcproj/WebCore.vcproj

4070340703 >
4070440704 </File>
4070540705 <File
 40706 RelativePath="..\rendering\style\StyleGridData.cpp"
 40707 >
 40708 <FileConfiguration
 40709 Name="Debug|Win32"
 40710 ExcludedFromBuild="true"
 40711 >
 40712 <Tool
 40713 Name="VCCLCompilerTool"
 40714 />
 40715 </FileConfiguration>
 40716 <FileConfiguration
 40717 Name="Release|Win32"
 40718 ExcludedFromBuild="true"
 40719 >
 40720 <Tool
 40721 Name="VCCLCompilerTool"
 40722 />
 40723 </FileConfiguration>
 40724 <FileConfiguration
 40725 Name="Debug_Cairo_CFLite|Win32"
 40726 ExcludedFromBuild="true"
 40727 >
 40728 <Tool
 40729 Name="VCCLCompilerTool"
 40730 />
 40731 </FileConfiguration>
 40732 <FileConfiguration
 40733 Name="Release_Cairo_CFLite|Win32"
 40734 ExcludedFromBuild="true"
 40735 >
 40736 <Tool
 40737 Name="VCCLCompilerTool"
 40738 />
 40739 </FileConfiguration>
 40740 <FileConfiguration
 40741 Name="Debug_All|Win32"
 40742 ExcludedFromBuild="true"
 40743 >
 40744 <Tool
 40745 Name="VCCLCompilerTool"
 40746 />
 40747 </FileConfiguration>
 40748 <FileConfiguration
 40749 Name="Production|Win32"
 40750 ExcludedFromBuild="true"
 40751 >
 40752 <Tool
 40753 Name="VCCLCompilerTool"
 40754 />
 40755 </FileConfiguration>
 40756 </File>
 40757 <File
 40758 RelativePath="..\rendering\style\StyleGridData.h"
 40759 >
 40760 </File>
 40761 <File
4070640762 RelativePath="..\rendering\style\StyleImage.h"
4070740763 >
4070840764 </File>

Source/WebCore/WebCore.xcodeproj/project.pbxproj

33823382 A0EE0DF6144F825500F80B0D /* WebGLDebugRendererInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF2144F825500F80B0D /* WebGLDebugRendererInfo.h */; };
33833383 A0EE0DF7144F825500F80B0D /* WebGLDebugShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */; };
33843384 A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */; };
 3385 A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A10DC76814747BAB005E2471 /* StyleGridData.cpp */; };
 3386 A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DC76914747BAB005E2471 /* StyleGridData.h */; settings = {ATTRIBUTES = (Private, ); }; };
33853387 A120ACA413F998CA00FE4AC7 /* LayoutRepainter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */; };
33863388 A12538D413F9B60A00024754 /* LayoutRepainter.h in Headers */ = {isa = PBXBuildFile; fileRef = A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */; settings = {ATTRIBUTES = (Private, ); }; };
33873389 A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; };

1058110583 A0EE0DF2144F825500F80B0D /* WebGLDebugRendererInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDebugRendererInfo.h; path = canvas/WebGLDebugRendererInfo.h; sourceTree = "<group>"; };
1058210584 A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLDebugShaders.cpp; path = canvas/WebGLDebugShaders.cpp; sourceTree = "<group>"; };
1058310585 A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLDebugShaders.h; path = canvas/WebGLDebugShaders.h; sourceTree = "<group>"; };
 10586 A10DC76814747BAB005E2471 /* StyleGridData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StyleGridData.cpp; path = style/StyleGridData.cpp; sourceTree = "<group>"; };
 10587 A10DC76914747BAB005E2471 /* StyleGridData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleGridData.h; path = style/StyleGridData.h; sourceTree = "<group>"; };
1058410588 A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutRepainter.h; sourceTree = "<group>"; };
1058510589 A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutRepainter.cpp; sourceTree = "<group>"; };
1058610590 A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; };

1976719771 BC8C8FAA0DDCD2F200B592F4 /* style */ = {
1976819772 isa = PBXGroup;
1976919773 children = (
 19774 A10DC76814747BAB005E2471 /* StyleGridData.cpp */,
 19775 A10DC76914747BAB005E2471 /* StyleGridData.h */,
1977019776 5038BE2D1472AD230095E0D1 /* StyleCachedShader.cpp */,
1977119777 5038BE2E1472AD230095E0D1 /* StyleCachedShader.h */,
1977219778 BC5EB5E00E81BE8700B25965 /* BorderData.h */,

2471624722 5038BC0B14711D340095E0D1 /* CustomFilterOperation.h in Headers */,
2471724723 5038BE301472AD230095E0D1 /* StyleCachedShader.h in Headers */,
2471824724 5038BE411472AD980095E0D1 /* CachedShader.h in Headers */,
 24725 A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */,
2471924726 );
2472024727 runOnlyForDeploymentPostprocessing = 0;
2472124728 };

2758927596 5038BC0714711CDB0095E0D1 /* WebKitCSSShaderValue.cpp in Sources */,
2759027597 5038BE2F1472AD230095E0D1 /* StyleCachedShader.cpp in Sources */,
2759127598 5038BE401472AD980095E0D1 /* CachedShader.cpp in Sources */,
 27599 A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */,
2759227600 );
2759327601 runOnlyForDeploymentPostprocessing = 0;
2759427602 };

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
766770}
767771#endif
768772
 773#if ENABLE(CSS_GRID_LAYOUT)
 774static PassRefPtr<CSSValue> valueForGridTrackList(const Length& trackLength, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
 775{
 776 if (trackLength.isPercent())
 777 return primitiveValueCache->createValue(trackLength);
 778 if (trackLength.isAuto())
 779 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
 780 if (trackLength.isUndefined())
 781 return primitiveValueCache->createIdentifierValue(CSSValueNone);
 782 return zoomAdjustedPixelValue(trackLength.value(), style, primitiveValueCache);
 783}
 784#endif
 785
769786static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList, CSSPrimitiveValueCache* primitiveValueCache)
770787{
771788 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();

@@PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
14731490 }
14741491 return list.release();
14751492 }
 1493#if ENABLE(CSS_GRID_LAYOUT)
 1494 case CSSPropertyWebkitGridColumns: {
 1495 Length gridColumns = style->gridColumns();
 1496 return valueForGridTrackList(gridColumns, style.get(), primitiveValueCache);
 1497 }
 1498 case CSSPropertyWebkitGridRows: {
 1499 Length gridRows = style->gridRows();
 1500 return valueForGridTrackList(gridRows, style.get(), primitiveValueCache);
 1501 }
 1502#endif
14761503 case CSSPropertyHeight:
14771504 if (renderer)
14781505 return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get(), primitiveValueCache);

Source/WebCore/css/CSSParser.cpp

@@bool CSSParser::parseValue(int propId, bool important)
17701770 }
17711771 return false;
17721772 }
 1773#if ENABLE(CSS_GRID_LAYOUT)
 1774 case CSSPropertyWebkitGridColumns:
 1775 case CSSPropertyWebkitGridRows:
 1776 return parseGridTrackList(propId, important);
 1777#endif
17731778 case CSSPropertyWebkitMarginCollapse: {
17741779 const int properties[2] = { CSSPropertyWebkitMarginBeforeCollapse,
17751780 CSSPropertyWebkitMarginAfterCollapse };

@@bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
34973502 return false;
34983503}
34993504
 3505#if ENABLE(CSS_GRID_LAYOUT)
 3506bool CSSParser::parseGridTrackList(int propId, bool important)
 3507{
 3508 CSSParserValue* value = m_valueList->current();
 3509 if (value->id == CSSValueNone || value->id == CSSValueAuto) {
 3510 addProperty(propId, primitiveValueCache()->createIdentifierValue(value->id), important);
 3511 return true;
 3512 }
 3513
 3514 if (validUnit(value, FLength | FPercent, m_strict)) {
 3515 addProperty(propId, createPrimitiveNumericValue(value), important);
 3516 return true;
 3517 }
 3518 return false;
 3519}
 3520#endif
 3521
35003522
35013523
35023524#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)
566566 case CSSPropertyWebkitFlexAlign:
567567 case CSSPropertyWebkitFlexFlow:
568568 case CSSPropertyWebkitFontSizeDelta:
 569#if ENABLE(CSS_GRID_LAYOUT)
 570 case CSSPropertyWebkitGridColumns:
 571 case CSSPropertyWebkitGridRows:
 572#endif
569573 case CSSPropertyWebkitLineClamp:
570574 case CSSPropertyWebkitLogicalWidth:
571575 case CSSPropertyWebkitLogicalHeight:

Source/WebCore/css/CSSPropertyNames.in

@@z-index
361361#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
362362-webkit-tap-highlight-color
363363#endif
364 
 364#if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
 365-webkit-grid-columns
 366-webkit-grid-rows
 367#endif

Source/WebCore/css/CSSStyleApplyProperty.cpp

@@CSSStyleApplyProperty::CSSStyleApplyProperty()
980980 setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
981981 setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
982982
 983#if ENABLE(CSS_GRID_LAYOUT)
 984 setPropertyHandler(CSSPropertyWebkitGridColumns, ApplyPropertyLength<&RenderStyle::gridColumns, &RenderStyle::setGridColumns, &RenderStyle::initialGridColumns, AutoEnabled, IntrinsicDisabled, MinIntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
 985 setPropertyHandler(CSSPropertyWebkitGridRows, ApplyPropertyLength<&RenderStyle::gridRows, &RenderStyle::setGridRows, &RenderStyle::initialGridRows, AutoEnabled, IntrinsicDisabled, MinIntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
 986#endif
 987
983988 setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>::createHandler());
984989 setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>::createHandler());
985990

Source/WebCore/css/CSSStyleSelector.cpp

@@void CSSStyleSelector::applyProperty(int id, CSSValue *value)
39653965 case CSSPropertyWebkitFlexFlow:
39663966 case CSSPropertyFontStyle:
39673967 case CSSPropertyFontVariant:
 3968#if ENABLE(CSS_GRID_LAYOUT)
 3969 case CSSPropertyWebkitGridColumns:
 3970 case CSSPropertyWebkitGridRows:
 3971#endif
39683972 case CSSPropertyTextRendering:
39693973 case CSSPropertyWebkitTextOrientation:
39703974 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
420423 return StyleDifferenceLayout;
421424 }
422425#endif
 426#if ENABLE(CSS_GRID_LAYOUT)
 427 if (rareNonInheritedData->m_grid.get() != other->rareNonInheritedData->m_grid.get())
 428 return StyleDifferenceLayout;
 429#endif
423430
424431#if !USE(ACCELERATED_COMPOSITING)
425432 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:
719722 EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); }
720723 EFlexFlow flexFlow() const { return static_cast<EFlexFlow>(rareNonInheritedData->m_flexibleBox->m_flexFlow); }
721724
 725#if ENABLE(CSS_GRID_LAYOUT)
 726 Length gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; }
 727 Length gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; }
 728#endif
 729
722730 const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
723731 void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
724732 void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }

@@public:
11251133 void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); }
11261134 void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); }
11271135 void setFlexFlow(EFlexFlow flow) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexFlow, flow); }
 1136#if ENABLE(CSS_GRID_LAYOUT)
 1137 void setGridColumns(Length length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, length); }
 1138 void setGridRows(Length length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, length); }
 1139#endif
 1140
11281141 void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
11291142 void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
11301143 void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }

@@public:
14751488 static StyleImage* initialMaskBoxImageSource() { return 0; }
14761489 static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
14771490
 1491#if ENABLE(CSS_GRID_LAYOUT)
 1492 static Length initialGridColumns() { return Length(Undefined); }
 1493 static Length initialGridRows() { return Length(Undefined); }
 1494#endif
 1495
14781496 static const AtomicString& initialLineGrid() { return nullAtom; }
14791497 static LineGridSnap initialLineGridSnap() { return LineGridSnapNone; }
14801498

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
8686#if ENABLE(CSS_FILTERS)
8787 , m_filter(o.m_filter)
8888#endif
 89#if ENABLE(CSS_GRID_LAYOUT)
 90 , m_grid(o.m_grid)
 91#endif
8992 , m_content(o.m_content ? o.m_content->clone() : nullptr)
9093 , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
9194 , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)

@@bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
144147#if ENABLE(CSS_FILTERS)
145148 && m_filter == o.m_filter
146149#endif
 150#if ENABLE(CSS_GRID_LAYOUT)
 151 && m_grid == o.m_grid
 152#endif
147153 && contentDataEquivalent(o)
148154 && counterDataEquivalent(o)
149155 && 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:
111114 DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
112115#endif
113116
 117#if ENABLE(CSS_GRID_LAYOUT)
 118 DataRef<StyleGridData> m_grid;
 119#endif
 120
114121 OwnPtr<ContentData> m_content;
115122 OwnPtr<CounterDirectiveMap> m_counterDirectives;
116123

LayoutTests/ChangeLog

 12011-11-16 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 NOBODY (OOPS!).
 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-16 James Robinson <jamesr@chromium.org>
215
316 [chromium] Update chromium expectations for fast/media/mq-transform-0[23].html to reflect that chromium DRT has

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 '160px'
 16PASS getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-rows') is '240px'
 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}
 30</style>
 31<script src="../js/resources/js-test-pre.js"></script>
 32</head>
 33<body>
 34<div class="grid" id="gridElement"></div>
 35<div class="gridWithFixed" id="gridWithFixedElement"></div>
 36<div class="gridWithPercent" id="gridWithPercentElement"></div>
 37<div class="gridWithAuto" id="gridWithAutoElement"></div>
 38<div class="gridWithEM" id="gridWithEMElement"></div>
 39<script src="resources/grid-columns-rows-get-set.js"></script>
 40<script src="../js/resources/js-test-post.js"></script>
 41</body>
 42</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')", "'160px'");
 22shouldBe("getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-rows')", "'240px'");
 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'");