| Differences between
and this patch
- a/Source/WebCore/ChangeLog +93 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2013-09-16  Sergio Villar Senin  <svillar@igalia.com>
2
3
        [CSS Grid Layout] Implement support for <flex>
4
        https://bugs.webkit.org/show_bug.cgi?id=115362
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        From Blink r149134, r149480, r149532, r150287 and r156127 by <jchaffraix@chromium.org>
9
        From Blink r157820 by <svillar@igalia.com>
10
11
        Added support for flexible lengths ('fr' unit) in CSS Grid Layout
12
        code. This requires the addition of GridLength class to
13
        encapsulate the knowledge of <flex> to the grid layout code.
14
15
        Also updated the algorithm that computes the layout. It increases
16
        the value of 1fr based on the grid tracks' usedBreath to fraction
17
        ratio (called normalizedFractionValue). This enables increasing
18
        the fraction value while updating the available space to account
19
        for processed grid tracks. The algorithm stops when we run out of
20
        grid tracks or available space (one grid item has an intrinsic
21
        size too big). This matches the specs to the letter for the known
22
        available space case (both the unknown case and the interaction
23
        with 'span' are left out of this patch).
24
25
        Tests: fast/css-grid-layout/flex-and-minmax-content-resolution-columns.html
26
               fast/css-grid-layout/flex-and-minmax-content-resolution-rows.html
27
               fast/css-grid-layout/flex-content-resolution-columns.html
28
               fast/css-grid-layout/flex-content-resolution-rows.html
29
30
        * GNUmakefile.list.am: Added GridLength.h to the build system.
31
        * Target.pri: Ditto.
32
        * WebCore.vcxproj/WebCore.vcxproj: Ditto.
33
        * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
34
        * WebCore.xcodeproj/project.pbxproj: Ditto.
35
        * css/CSSComputedStyleDeclaration.cpp:
36
        (WebCore::valueForGridTrackBreadth): Replace Length by GridLength.
37
        * css/CSSGrammar.y.in: Added FR support.
38
        * css/CSSParser.cpp: Ditto.
39
        (WebCore::CSSParser::parseGridBreadth):
40
        (WebCore::CSSParser::detectNumberToken):
41
        * css/CSSParserValues.cpp: Added FR support.
42
        (WebCore::CSSParserValue::createCSSValue):
43
        * css/CSSParserValues.h:
44
        (WebCore::CSSParserString::operator[]):
45
        (WebCore::CSSParserString::equalIgnoringCase):
46
        * css/CSSPrimitiveValue.cpp: Added FR support.
47
        (WebCore::isValidCSSUnitTypeForDoubleConversion):
48
        (WebCore::CSSPrimitiveValue::cleanup):
49
        (WebCore::CSSPrimitiveValue::customCSSText):
50
        (WebCore::CSSPrimitiveValue::cloneForCSSOM):
51
        (WebCore::CSSPrimitiveValue::equals):
52
        * css/CSSPrimitiveValue.h: Added a couple of missing const.
53
        (WebCore::CSSPrimitiveValue::isFlex):
54
        * css/StyleResolver.cpp: Added FR support.
55
        (WebCore::createGridTrackBreadth):
56
        (WebCore::createGridTrackSize):
57
        * rendering/RenderGrid.cpp:
58
        (WebCore::GridTrackForNormalization::GridTrackForNormalization):
59
        New helper struct to ease the computation of track breadths with
60
        flexible lengths.
61
        (WebCore::GridTrackForNormalization::operator=):
62
        (WebCore::RenderGrid::computePreferredTrackWidth): Replaced Length by GridLength.
63
        (WebCore::RenderGrid::computedUsedBreadthOfGridTracks): Grow grid lines
64
        having a fraction as the MaxTrackSizingFunction.
65
        (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Replaced Length by GridLength.
66
        (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
67
        (WebCore::sortByGridNormalizedFlexValue):
68
        (WebCore::RenderGrid::computeNormalizedFractionBreadth): Increase
69
        the fraction value while updating the available space to account
70
        for processed grid tracks.
71
        (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
72
        (WebCore::RenderGrid::distributeSpaceToTracks): Never shrink track sizes.
73
        (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth):
74
        * rendering/RenderGrid.h:
75
        * rendering/style/GridLength.h: Added.
76
        (WebCore::GridLength::GridLength):
77
        (WebCore::GridLength::isLength):
78
        (WebCore::GridLength::isFlex):
79
        (WebCore::GridLength::length):
80
        (WebCore::GridLength::flex):
81
        (WebCore::GridLength::setFlex):
82
        (WebCore::GridLength::operator==):
83
        * rendering/style/GridTrackSize.h: Replaced Length by GridLength.
84
        (WebCore::GridTrackSize::length):
85
        (WebCore::GridTrackSize::setLength):
86
        (WebCore::GridTrackSize::minTrackBreadth):
87
        (WebCore::GridTrackSize::maxTrackBreadth):
88
        (WebCore::GridTrackSize::setMinMax):
89
        (WebCore::GridTrackSize::hasMinOrMaxContentMinTrackBreadth):
90
        (WebCore::GridTrackSize::hasMaxContentMinTrackBreadth):
91
        (WebCore::GridTrackSize::hasMinOrMaxContentMaxTrackBreadth):
92
        (WebCore::GridTrackSize::hasMaxContentMaxTrackBreadth):
93
1
2013-09-15  Andreas Kling  <akling@apple.com>
94
2013-09-15  Andreas Kling  <akling@apple.com>
2
95
3
        CTTE: RenderCombineText always has a Text node.
96
        CTTE: RenderCombineText always has a Text node.
- a/Source/WebCore/GNUmakefile.list.am -1 / +2 lines
Lines 4606-4612 webcore_sources += \ a/Source/WebCore/GNUmakefile.list.am_sec1
4606
	Source/WebCore/rendering/style/DataRef.h \
4606
	Source/WebCore/rendering/style/DataRef.h \
4607
	Source/WebCore/rendering/style/FillLayer.cpp \
4607
	Source/WebCore/rendering/style/FillLayer.cpp \
4608
	Source/WebCore/rendering/style/FillLayer.h \
4608
	Source/WebCore/rendering/style/FillLayer.h \
4609
	Source/WebCore/rendering/style/GridLength.h \
4609
	Source/WebCore/rendering/style/GridPosition.h \
4610
	Source/WebCore/rendering/style/GridPosition.h \
4611
	Source/WebCore/rendering/style/GridTrackSize.h \
4610
	Source/WebCore/rendering/style/KeyframeList.cpp \
4612
	Source/WebCore/rendering/style/KeyframeList.cpp \
4611
	Source/WebCore/rendering/style/KeyframeList.h \
4613
	Source/WebCore/rendering/style/KeyframeList.h \
4612
	Source/WebCore/rendering/style/LineClampValue.h \
4614
	Source/WebCore/rendering/style/LineClampValue.h \
Lines 4670-4676 webcore_sources += \ a/Source/WebCore/GNUmakefile.list.am_sec2
4670
	Source/WebCore/rendering/style/StyleVariableData.h \
4672
	Source/WebCore/rendering/style/StyleVariableData.h \
4671
	Source/WebCore/rendering/style/StyleVisualData.cpp \
4673
	Source/WebCore/rendering/style/StyleVisualData.cpp \
4672
	Source/WebCore/rendering/style/StyleVisualData.h \
4674
	Source/WebCore/rendering/style/StyleVisualData.h \
4673
	Source/WebCore/rendering/style/GridTrackSize.h \
4674
	Source/WebCore/rendering/TableLayout.h \
4675
	Source/WebCore/rendering/TableLayout.h \
4675
	Source/WebCore/rendering/TrailingFloatsRootInlineBox.h \
4676
	Source/WebCore/rendering/TrailingFloatsRootInlineBox.h \
4676
	Source/WebCore/storage/StorageThread.cpp \
4677
	Source/WebCore/storage/StorageThread.cpp \
- a/Source/WebCore/Target.pri +1 lines
Lines 2539-2544 HEADERS += \ a/Source/WebCore/Target.pri_sec1
2539
    rendering/style/StyleTransformData.h \
2539
    rendering/style/StyleTransformData.h \
2540
    rendering/style/StyleVariableData.h \
2540
    rendering/style/StyleVariableData.h \
2541
    rendering/style/StyleVisualData.h \
2541
    rendering/style/StyleVisualData.h \
2542
    rendering/style/GridLength.h \
2542
    rendering/style/GridTrackSize.h \
2543
    rendering/style/GridTrackSize.h \
2543
    rendering/style/SVGRenderStyleDefs.h \
2544
    rendering/style/SVGRenderStyleDefs.h \
2544
    rendering/style/SVGRenderStyle.h \
2545
    rendering/style/SVGRenderStyle.h \
- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj +1 lines
Lines 20113-20118 a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj_sec1
20113
    <ClInclude Include="..\rendering\style\CursorList.h" />
20113
    <ClInclude Include="..\rendering\style\CursorList.h" />
20114
    <ClInclude Include="..\rendering\style\DataRef.h" />
20114
    <ClInclude Include="..\rendering\style\DataRef.h" />
20115
    <ClInclude Include="..\rendering\style\FillLayer.h" />
20115
    <ClInclude Include="..\rendering\style\FillLayer.h" />
20116
    <ClInclude Include="..\rendering\style\GridLength.h" />
20116
    <ClInclude Include="..\rendering\style\GridPosition.h" />
20117
    <ClInclude Include="..\rendering\style\GridPosition.h" />
20117
    <ClInclude Include="..\rendering\style\GridTrackSize.h" />
20118
    <ClInclude Include="..\rendering\style\GridTrackSize.h" />
20118
    <ClInclude Include="..\rendering\style\KeyframeList.h" />
20119
    <ClInclude Include="..\rendering\style\KeyframeList.h" />
- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters +3 lines
Lines 9879-9884 a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters_sec1
9879
    <ClInclude Include="..\rendering\style\FillLayer.h">
9879
    <ClInclude Include="..\rendering\style\FillLayer.h">
9880
      <Filter>rendering\style</Filter>
9880
      <Filter>rendering\style</Filter>
9881
    </ClInclude>
9881
    </ClInclude>
9882
    <ClInclude Include="..\rendering\style\GridLength.h">
9883
      <Filter>rendering\style</Filter>
9884
    </ClInclude>
9882
    <ClInclude Include="..\rendering\style\GridPosition.h">
9885
    <ClInclude Include="..\rendering\style\GridPosition.h">
9883
      <Filter>rendering\style</Filter>
9886
      <Filter>rendering\style</Filter>
9884
    </ClInclude>
9887
    </ClInclude>
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +4 lines
Lines 3433-3438 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
3433
		A110DB9D14F5DF8700A03B93 /* StyleGridItemData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A110DB9C14F5DF8700A03B93 /* StyleGridItemData.cpp */; };
3433
		A110DB9D14F5DF8700A03B93 /* StyleGridItemData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A110DB9C14F5DF8700A03B93 /* StyleGridItemData.cpp */; };
3434
		A120ACA413F998CA00FE4AC7 /* LayoutRepainter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */; };
3434
		A120ACA413F998CA00FE4AC7 /* LayoutRepainter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */; };
3435
		A12538D413F9B60A00024754 /* LayoutRepainter.h in Headers */ = {isa = PBXBuildFile; fileRef = A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */; settings = {ATTRIBUTES = (Private, ); }; };
3435
		A12538D413F9B60A00024754 /* LayoutRepainter.h in Headers */ = {isa = PBXBuildFile; fileRef = A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */; settings = {ATTRIBUTES = (Private, ); }; };
3436
		AA279D501B4939EB0105B4D6 /* GridLength.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB302915CDBAAEF7CE7673C /* GridLength.h */; settings = {ATTRIBUTES = (Private, ); }; };
3436
		A12705C31656BD6500C2E27C /* GridPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = A12705C21656BD6500C2E27C /* GridPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
3437
		A12705C31656BD6500C2E27C /* GridPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = A12705C21656BD6500C2E27C /* GridPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
3437
		A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */ = {isa = PBXBuildFile; fileRef = A12A104E166444DC008FA311 /* GridTrackSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
3438
		A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */ = {isa = PBXBuildFile; fileRef = A12A104E166444DC008FA311 /* GridTrackSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
3438
		A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; };
3439
		A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; };
Lines 10023-10028 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
10023
		A110DB9C14F5DF8700A03B93 /* StyleGridItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StyleGridItemData.cpp; path = style/StyleGridItemData.cpp; sourceTree = "<group>"; };
10024
		A110DB9C14F5DF8700A03B93 /* StyleGridItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StyleGridItemData.cpp; path = style/StyleGridItemData.cpp; sourceTree = "<group>"; };
10024
		A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutRepainter.h; sourceTree = "<group>"; };
10025
		A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutRepainter.h; sourceTree = "<group>"; };
10025
		A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutRepainter.cpp; sourceTree = "<group>"; };
10026
		A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutRepainter.cpp; sourceTree = "<group>"; };
10027
		BCB302915CDBAAEF7CE7673C /* GridLength.h */ = {isa = PBXFileReference; fileEncondig = 4; lastKnownFileType = sourcecode.c.h; name = GridLength.h; path = style/GriLength.h; sourceTree = "<group>"; };
10026
		A12705C21656BD6500C2E27C /* GridPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridPosition.h; path = style/GridPosition.h; sourceTree = "<group>"; };
10028
		A12705C21656BD6500C2E27C /* GridPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridPosition.h; path = style/GridPosition.h; sourceTree = "<group>"; };
10027
		A12A104E166444DC008FA311 /* GridTrackSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridTrackSize.h; path = style/GridTrackSize.h; sourceTree = "<group>"; };
10029
		A12A104E166444DC008FA311 /* GridTrackSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridTrackSize.h; path = style/GridTrackSize.h; sourceTree = "<group>"; };
10028
		A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; };
10030
		A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; };
Lines 19367-19372 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
19367
				BC22746E0E83664500E7F975 /* DataRef.h */,
19369
				BC22746E0E83664500E7F975 /* DataRef.h */,
19368
				BC5EB69C0E81DAEB00B25965 /* FillLayer.cpp */,
19370
				BC5EB69C0E81DAEB00B25965 /* FillLayer.cpp */,
19369
				BC5EB69D0E81DAEB00B25965 /* FillLayer.h */,
19371
				BC5EB69D0E81DAEB00B25965 /* FillLayer.h */,
19372
				BCB302915CDBAAEF7CE7673C /* GridLength.h */,
19370
				A12705C21656BD6500C2E27C /* GridPosition.h */,
19373
				A12705C21656BD6500C2E27C /* GridPosition.h */,
19371
				A12A104E166444DC008FA311 /* GridTrackSize.h */,
19374
				A12A104E166444DC008FA311 /* GridTrackSize.h */,
19372
				BC5EBA0E0E823E4700B25965 /* KeyframeList.cpp */,
19375
				BC5EBA0E0E823E4700B25965 /* KeyframeList.cpp */,
Lines 22381-22386 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
22381
				0FA24D7A162DF91900A3F4C0 /* GraphicsLayerUpdater.h in Headers */,
22384
				0FA24D7A162DF91900A3F4C0 /* GraphicsLayerUpdater.h in Headers */,
22382
				B2A015AB0AF6CD53006BCE0E /* GraphicsTypes.h in Headers */,
22385
				B2A015AB0AF6CD53006BCE0E /* GraphicsTypes.h in Headers */,
22383
				77A17A7B12F2890B004E02F6 /* GraphicsTypes3D.h in Headers */,
22386
				77A17A7B12F2890B004E02F6 /* GraphicsTypes3D.h in Headers */,
22387
				AA279D501B4939EB0105B4D6 /* GridLength.h in Headers */,
22384
				A12705C31656BD6500C2E27C /* GridPosition.h in Headers */,
22388
				A12705C31656BD6500C2E27C /* GridPosition.h in Headers */,
22385
				A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */,
22389
				A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */,
22386
				C50B561712119D23008B46E0 /* GroupSettings.h in Headers */,
22390
				C50B561712119D23008B46E0 /* GroupSettings.h in Headers */,
- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp -5 / +9 lines
Lines 1091-1103 PassRefPtr<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderObject* a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec1
1091
}
1091
}
1092
#endif
1092
#endif
1093
1093
1094
static PassRefPtr<CSSValue> valueForGridTrackBreadth(const Length& trackBreadth, const RenderStyle* style, RenderView *renderView)
1094
static PassRefPtr<CSSValue> valueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style, RenderView* renderView)
1095
{
1095
{
1096
    if (trackBreadth.isAuto())
1096
    if (!trackBreadth.isLength())
1097
        return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
1098
1099
    const Length& trackBreadthLength = trackBreadth.length();
1100
    if (trackBreadthLength.isAuto())
1097
        return cssValuePool().createIdentifierValue(CSSValueAuto);
1101
        return cssValuePool().createIdentifierValue(CSSValueAuto);
1098
    if (trackBreadth.isViewportPercentage())
1102
    if (trackBreadthLength.isViewportPercentage())
1099
        return zoomAdjustedPixelValue(valueForLength(trackBreadth, 0, renderView), style);
1103
        return zoomAdjustedPixelValue(valueForLength(trackBreadthLength, 0, renderView), style);
1100
    return zoomAdjustedPixelValueForLength(trackBreadth, style);
1104
    return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
1101
}
1105
}
1102
1106
1103
static PassRefPtr<CSSValue> valueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
1107
static PassRefPtr<CSSValue> valueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
- a/Source/WebCore/css/CSSGrammar.y.in +2 lines
Lines 170-175 static inline bool isCSSTokenAString(int yytype) a/Source/WebCore/css/CSSGrammar.y.in_sec1
170
%token <number> DPPX
170
%token <number> DPPX
171
%token <number> DPI
171
%token <number> DPI
172
%token <number> DPCM
172
%token <number> DPCM
173
%token <number> FR
173
174
174
%token <string> URI
175
%token <string> URI
175
%token <string> FUNCTION
176
%token <string> FUNCTION
Lines 1535-1540 unary_term: a/Source/WebCore/css/CSSGrammar.y.in_sec2
1535
  | DPPX { $$.id = CSSValueInvalid; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; }
1536
  | DPPX { $$.id = CSSValueInvalid; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; }
1536
  | DPI { $$.id = CSSValueInvalid; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; }
1537
  | DPI { $$.id = CSSValueInvalid; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; }
1537
  | DPCM { $$.id = CSSValueInvalid; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; }
1538
  | DPCM { $$.id = CSSValueInvalid; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPCM; }
1539
  | FR { $$.id = CSSValueInvalid; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_FR; }
1538
  ;
1540
  ;
1539
1541
1540
function:
1542
function:
- a/Source/WebCore/css/CSSParser.cpp +14 lines
Lines 4969-4974 PassRefPtr<CSSPrimitiveValue> CSSParser::parseGridBreadth(CSSParserValue* curren a/Source/WebCore/css/CSSParser.cpp_sec1
4969
    if (currentValue->id == CSSValueWebkitMinContent || currentValue->id == CSSValueWebkitMaxContent)
4969
    if (currentValue->id == CSSValueWebkitMinContent || currentValue->id == CSSValueWebkitMaxContent)
4970
        return cssValuePool().createIdentifierValue(currentValue->id);
4970
        return cssValuePool().createIdentifierValue(currentValue->id);
4971
4971
4972
    if (currentValue->unit == CSSPrimitiveValue::CSS_FR) {
4973
        double flexValue = currentValue->fValue;
4974
4975
        // Fractional unit is a non-negative dimension.
4976
        if (flexValue <= 0)
4977
            return 0;
4978
4979
        return cssValuePool().createValue(flexValue, CSSPrimitiveValue::CSS_FR);
4980
    }
4981
4972
    if (!validUnit(currentValue, FNonNeg | FLength | FPercent))
4982
    if (!validUnit(currentValue, FNonNeg | FLength | FPercent))
4973
        return 0;
4983
        return 0;
4974
4984
Lines 10692-10697 inline void CSSParser::detectNumberToken(CharacterType* type, int length) a/Source/WebCore/css/CSSParser.cpp_sec2
10692
        }
10702
        }
10693
        return;
10703
        return;
10694
10704
10705
    case 'f':
10706
        if (length == 2 && isASCIIAlphaCaselessEqual(type[1], 'r'))
10707
            m_token = FR;
10708
        return;
10695
    case 'g':
10709
    case 'g':
10696
        if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'r')
10710
        if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'r')
10697
                && isASCIIAlphaCaselessEqual(type[2], 'a') && isASCIIAlphaCaselessEqual(type[3], 'd'))
10711
                && isASCIIAlphaCaselessEqual(type[2], 'a') && isASCIIAlphaCaselessEqual(type[3], 'd'))
- a/Source/WebCore/css/CSSParserValues.cpp +1 lines
Lines 120-125 PassRefPtr<CSSValue> CSSParserValue::createCSSValue() a/Source/WebCore/css/CSSParserValues.cpp_sec1
120
    case CSSPrimitiveValue::CSS_TURN:
120
    case CSSPrimitiveValue::CSS_TURN:
121
    case CSSPrimitiveValue::CSS_REMS:
121
    case CSSPrimitiveValue::CSS_REMS:
122
    case CSSPrimitiveValue::CSS_CHS:
122
    case CSSPrimitiveValue::CSS_CHS:
123
    case CSSPrimitiveValue::CSS_FR:
123
        return CSSPrimitiveValue::create(fValue, primitiveUnit);
124
        return CSSPrimitiveValue::create(fValue, primitiveUnit);
124
    case CSSPrimitiveValue::CSS_UNKNOWN:
125
    case CSSPrimitiveValue::CSS_UNKNOWN:
125
    case CSSPrimitiveValue::CSS_DIMENSION:
126
    case CSSPrimitiveValue::CSS_DIMENSION:
- a/Source/WebCore/css/CSSParserValues.h -2 / +2 lines
Lines 77-83 struct CSSParserString { a/Source/WebCore/css/CSSParserValues.h_sec1
77
77
78
    void lower();
78
    void lower();
79
79
80
    UChar operator[](unsigned i)
80
    UChar operator[](unsigned i) const
81
    {
81
    {
82
        ASSERT_WITH_SECURITY_IMPLICATION(i < m_length);
82
        ASSERT_WITH_SECURITY_IMPLICATION(i < m_length);
83
        if (is8Bit())
83
        if (is8Bit())
Lines 85-91 struct CSSParserString { a/Source/WebCore/css/CSSParserValues.h_sec2
85
        return m_data.characters16[i];
85
        return m_data.characters16[i];
86
    }
86
    }
87
87
88
    bool equalIgnoringCase(const char* str)
88
    bool equalIgnoringCase(const char* str) const
89
    {
89
    {
90
        if (is8Bit())
90
        if (is8Bit())
91
            return WTF::equalIgnoringCase(str, characters8(), length());
91
            return WTF::equalIgnoringCase(str, characters8(), length());
- a/Source/WebCore/css/CSSPrimitiveValue.cpp -1 / +9 lines
Lines 94-99 static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::Unit a/Source/WebCore/css/CSSPrimitiveValue.cpp_sec1
94
    case CSSPrimitiveValue::CSS_VH:
94
    case CSSPrimitiveValue::CSS_VH:
95
    case CSSPrimitiveValue::CSS_VMIN:
95
    case CSSPrimitiveValue::CSS_VMIN:
96
    case CSSPrimitiveValue::CSS_VMAX:
96
    case CSSPrimitiveValue::CSS_VMAX:
97
    case CSSPrimitiveValue::CSS_FR:
97
        return true;
98
        return true;
98
    case CSSPrimitiveValue::CSS_ATTR:
99
    case CSSPrimitiveValue::CSS_ATTR:
99
    case CSSPrimitiveValue::CSS_COUNTER:
100
    case CSSPrimitiveValue::CSS_COUNTER:
Lines 473-478 void CSSPrimitiveValue::cleanup() a/Source/WebCore/css/CSSPrimitiveValue.cpp_sec2
473
    case CSS_DPPX:
474
    case CSS_DPPX:
474
    case CSS_DPI:
475
    case CSS_DPI:
475
    case CSS_DPCM:
476
    case CSS_DPCM:
477
    case CSS_FR:
476
    case CSS_IDENT:
478
    case CSS_IDENT:
477
    case CSS_RGBCOLOR:
479
    case CSS_RGBCOLOR:
478
    case CSS_DIMENSION:
480
    case CSS_DIMENSION:
Lines 997-1004 String CSSPrimitiveValue::customCSSText() const a/Source/WebCore/css/CSSPrimitiveValue.cpp_sec3
997
        case CSS_TURN:
999
        case CSS_TURN:
998
            text = formatNumber(m_value.num, "turn");
1000
            text = formatNumber(m_value.num, "turn");
999
            break;
1001
            break;
1002
        case CSS_FR:
1003
            text = formatNumber(m_value.num, "fr");
1004
            break;
1000
        case CSS_DIMENSION:
1005
        case CSS_DIMENSION:
1001
            // FIXME
1006
            // FIXME: We currently don't handle CSS_DIMENSION properly as we don't store
1007
            // the actual dimension, just the numeric value as a string.
1002
            break;
1008
            break;
1003
        case CSS_STRING:
1009
        case CSS_STRING:
1004
            text = quoteCSSStringIfNeeded(m_value.string);
1010
            text = quoteCSSStringIfNeeded(m_value.string);
Lines 1298-1303 PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::cloneForCSSOM() const a/Source/WebCore/css/CSSPrimitiveValue.cpp_sec4
1298
    case CSS_DPI:
1304
    case CSS_DPI:
1299
    case CSS_DPCM:
1305
    case CSS_DPCM:
1300
#endif
1306
#endif
1307
    case CSS_FR:
1301
        result = CSSPrimitiveValue::create(m_value.num, static_cast<UnitTypes>(m_primitiveUnitType));
1308
        result = CSSPrimitiveValue::create(m_value.num, static_cast<UnitTypes>(m_primitiveUnitType));
1302
        break;
1309
        break;
1303
    case CSS_PROPERTY_ID:
1310
    case CSS_PROPERTY_ID:
Lines 1360-1365 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const a/Source/WebCore/css/CSSPrimitiveValue.cpp_sec5
1360
    case CSS_VH:
1367
    case CSS_VH:
1361
    case CSS_VMIN:
1368
    case CSS_VMIN:
1362
    case CSS_DIMENSION:
1369
    case CSS_DIMENSION:
1370
    case CSS_FR:
1363
        return m_value.num == other.m_value.num;
1371
        return m_value.num == other.m_value.num;
1364
    case CSS_PROPERTY_ID:
1372
    case CSS_PROPERTY_ID:
1365
        return propertyName(m_value.propertyID) == propertyName(other.m_value.propertyID);
1373
        return propertyName(m_value.propertyID) == propertyName(other.m_value.propertyID);
- a/Source/WebCore/css/CSSPrimitiveValue.h +2 lines
Lines 101-106 public: a/Source/WebCore/css/CSSPrimitiveValue.h_sec1
101
        CSS_DPPX = 30,
101
        CSS_DPPX = 30,
102
        CSS_DPI = 31,
102
        CSS_DPI = 31,
103
        CSS_DPCM = 32,
103
        CSS_DPCM = 32,
104
        CSS_FR = 33,
104
        CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
105
        CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
105
#if ENABLE(DASHBOARD_SUPPORT)
106
#if ENABLE(DASHBOARD_SUPPORT)
106
        CSS_DASHBOARD_REGION = 101, // FIXME: Dashboard region should not be a primitive value.
107
        CSS_DASHBOARD_REGION = 101, // FIXME: Dashboard region should not be a primitive value.
Lines 205-210 public: a/Source/WebCore/css/CSSPrimitiveValue.h_sec2
205
    bool isViewportPercentageWidth() const { return m_primitiveUnitType == CSS_VW; }
206
    bool isViewportPercentageWidth() const { return m_primitiveUnitType == CSS_VW; }
206
    bool isViewportPercentageHeight() const { return m_primitiveUnitType == CSS_VH; }
207
    bool isViewportPercentageHeight() const { return m_primitiveUnitType == CSS_VH; }
207
    bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; }
208
    bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; }
209
    bool isFlex() const { return primitiveType() == CSS_FR; }
208
    
210
    
209
    static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) { return adoptRef(new CSSPrimitiveValue(valueID)); }
211
    static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) { return adoptRef(new CSSPrimitiveValue(valueID)); }
210
    static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSPropertyID propertyID) { return adoptRef(new CSSPrimitiveValue(propertyID)); }
212
    static PassRefPtr<CSSPrimitiveValue> createIdentifier(CSSPropertyID propertyID) { return adoptRef(new CSSPrimitiveValue(propertyID)); }
- a/Source/WebCore/css/StyleResolver.cpp -6 / +12 lines
Lines 1893-1899 bool StyleResolver::useSVGZoomRules() a/Source/WebCore/css/StyleResolver.cpp_sec1
1893
    return m_state.element() && m_state.element()->isSVGElement();
1893
    return m_state.element() && m_state.element()->isSVGElement();
1894
}
1894
}
1895
1895
1896
static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const StyleResolver::State& state, Length& workingLength)
1896
static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const StyleResolver::State& state, GridLength& workingLength)
1897
{
1897
{
1898
    if (primitiveValue->getValueID() == CSSValueWebkitMinContent) {
1898
    if (primitiveValue->getValueID() == CSSValueWebkitMinContent) {
1899
        workingLength = Length(MinContent);
1899
        workingLength = Length(MinContent);
Lines 1905-1916 static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const Styl a/Source/WebCore/css/StyleResolver.cpp_sec2
1905
        return true;
1905
        return true;
1906
    }
1906
    }
1907
1907
1908
    if (primitiveValue->isFlex()) {
1909
        // Fractional unit.
1910
        workingLength.setFlex(primitiveValue->getDoubleValue());
1911
        return true;
1912
    }
1913
1908
    workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
1914
    workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom());
1909
    if (workingLength.isUndefined())
1915
    if (workingLength.length().isUndefined())
1910
        return false;
1916
        return false;
1911
1917
1912
    if (primitiveValue->isLength())
1918
    if (primitiveValue->isLength())
1913
        workingLength.setQuirk(primitiveValue->isQuirkValue());
1919
        workingLength.length().setQuirk(primitiveValue->isQuirkValue());
1914
1920
1915
    return true;
1921
    return true;
1916
}
1922
}
Lines 1923-1929 static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const a/Source/WebCore/css/StyleResolver.cpp_sec3
1923
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1929
    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1924
    Pair* minMaxTrackBreadth = primitiveValue->getPairValue();
1930
    Pair* minMaxTrackBreadth = primitiveValue->getPairValue();
1925
    if (!minMaxTrackBreadth) {
1931
    if (!minMaxTrackBreadth) {
1926
        Length workingLength;
1932
        GridLength workingLength;
1927
        if (!createGridTrackBreadth(primitiveValue, state, workingLength))
1933
        if (!createGridTrackBreadth(primitiveValue, state, workingLength))
1928
            return false;
1934
            return false;
1929
1935
Lines 1931-1938 static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const a/Source/WebCore/css/StyleResolver.cpp_sec4
1931
        return true;
1937
        return true;
1932
    }
1938
    }
1933
1939
1934
    Length minTrackBreadth;
1940
    GridLength minTrackBreadth;
1935
    Length maxTrackBreadth;
1941
    GridLength maxTrackBreadth;
1936
    if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBreadth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBreadth))
1942
    if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBreadth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBreadth))
1937
        return false;
1943
        return false;
1938
1944
- a/Source/WebCore/rendering/RenderGrid.cpp -11 / +111 lines
Lines 66-71 public: a/Source/WebCore/rendering/RenderGrid.cpp_sec1
66
    LayoutUnit m_maxBreadth;
66
    LayoutUnit m_maxBreadth;
67
};
67
};
68
68
69
struct GridTrackForNormalization {
70
    GridTrackForNormalization(const GridTrack& track, double flex)
71
        : m_track(&track)
72
        , m_flex(flex)
73
        , m_normalizedFlexValue(track.m_usedBreadth / flex)
74
    {
75
    }
76
77
    // Required by std::sort.
78
    GridTrackForNormalization operator=(const GridTrackForNormalization& o)
79
    {
80
        m_track = o.m_track;
81
        m_flex = o.m_flex;
82
        m_normalizedFlexValue = o.m_normalizedFlexValue;
83
        return *this;
84
    }
85
86
    const GridTrack* m_track;
87
    double m_flex;
88
    LayoutUnit m_normalizedFlexValue;
89
};
90
69
class RenderGrid::GridIterator {
91
class RenderGrid::GridIterator {
70
    WTF_MAKE_NONCOPYABLE(GridIterator);
92
    WTF_MAKE_NONCOPYABLE(GridIterator);
71
public:
93
public:
Lines 228-235 void RenderGrid::computePreferredLogicalWidths() a/Source/WebCore/rendering/RenderGrid.cpp_sec2
228
    setPreferredLogicalWidthsDirty(false);
250
    setPreferredLogicalWidthsDirty(false);
229
}
251
}
230
252
231
LayoutUnit RenderGrid::computePreferredTrackWidth(const Length& length, size_t trackIndex) const
253
LayoutUnit RenderGrid::computePreferredTrackWidth(const GridLength& gridLength, size_t trackIndex) const
232
{
254
{
255
    if (gridLength.isFlex())
256
        return 0;
257
258
    const Length& length = gridLength.length();
259
233
    if (length.isFixed()) {
260
    if (length.isFixed()) {
234
        // Grid areas don't have borders, margins or paddings so we don't need to account for them.
261
        // Grid areas don't have borders, margins or paddings so we don't need to account for them.
235
        return length.intValue();
262
        return length.intValue();
Lines 267-277 void RenderGrid::computedUsedBreadthOfGridTracks(TrackSizingDirection direction, a/Source/WebCore/rendering/RenderGrid.cpp_sec3
267
    for (size_t i = 0; i < tracks.size(); ++i) {
294
    for (size_t i = 0; i < tracks.size(); ++i) {
268
        GridTrack& track = tracks[i];
295
        GridTrack& track = tracks[i];
269
        const GridTrackSize& trackSize = gridTrackSize(direction, i);
296
        const GridTrackSize& trackSize = gridTrackSize(direction, i);
270
        const Length& minTrackBreadth = trackSize.minTrackBreadth();
297
        const GridLength& minTrackBreadth = trackSize.minTrackBreadth();
271
        const Length& maxTrackBreadth = trackSize.maxTrackBreadth();
298
        const GridLength& maxTrackBreadth = trackSize.maxTrackBreadth();
272
299
273
        track.m_usedBreadth = computeUsedBreadthOfMinLength(direction, minTrackBreadth);
300
        track.m_usedBreadth = computeUsedBreadthOfMinLength(direction, minTrackBreadth);
274
        track.m_maxBreadth = computeUsedBreadthOfMaxLength(direction, maxTrackBreadth);
301
        track.m_maxBreadth = computeUsedBreadthOfMaxLength(direction, maxTrackBreadth, track.m_usedBreadth);
275
302
276
        track.m_maxBreadth = std::max(track.m_maxBreadth, track.m_usedBreadth);
303
        track.m_maxBreadth = std::max(track.m_maxBreadth, track.m_usedBreadth);
277
    }
304
    }
Lines 288-313 void RenderGrid::computedUsedBreadthOfGridTracks(TrackSizingDirection direction, a/Source/WebCore/rendering/RenderGrid.cpp_sec4
288
        tracksForDistribution[i] = tracks.data() + i;
315
        tracksForDistribution[i] = tracks.data() + i;
289
316
290
    distributeSpaceToTracks(tracksForDistribution, 0, &GridTrack::usedBreadth, &GridTrack::growUsedBreadth, availableLogicalSpace);
317
    distributeSpaceToTracks(tracksForDistribution, 0, &GridTrack::usedBreadth, &GridTrack::growUsedBreadth, availableLogicalSpace);
318
319
    // 4. Grow all Grid tracks having a fraction as the MaxTrackSizingFunction.
320
321
    // FIXME: Handle the case where RemainingSpace is not defined.
322
    double normalizedFractionBreadth = computeNormalizedFractionBreadth(tracks, direction, availableLogicalSpace);
323
    for (size_t i = 0; i < tracksSize; ++i) {
324
        const GridTrackSize& trackSize = gridTrackSize(direction, i);
325
        if (!trackSize.maxTrackBreadth().isFlex())
326
            continue;
327
328
        tracks[i].m_usedBreadth = std::max<LayoutUnit>(tracks[i].m_usedBreadth, normalizedFractionBreadth * trackSize.maxTrackBreadth().flex());
329
    }
291
}
330
}
292
331
293
LayoutUnit RenderGrid::computeUsedBreadthOfMinLength(TrackSizingDirection direction, const Length& trackLength) const
332
LayoutUnit RenderGrid::computeUsedBreadthOfMinLength(TrackSizingDirection direction, const GridLength& gridLength) const
294
{
333
{
334
    if (gridLength.isFlex())
335
        return 0;
336
337
    const Length& trackLength = gridLength.length();
338
    ASSERT(!trackLength.isAuto());
295
    if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage())
339
    if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage())
296
        return computeUsedBreadthOfSpecifiedLength(direction, trackLength);
340
        return computeUsedBreadthOfSpecifiedLength(direction, trackLength);
297
341
298
    ASSERT(trackLength.isMinContent() || trackLength.isMaxContent() || trackLength.isAuto());
342
    ASSERT(trackLength.isMinContent() || trackLength.isMaxContent());
299
    return 0;
343
    return 0;
300
}
344
}
301
345
302
LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(TrackSizingDirection direction, const Length& trackLength) const
346
LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(TrackSizingDirection direction, const GridLength& gridLength, LayoutUnit usedBreadth) const
303
{
347
{
348
    if (gridLength.isFlex())
349
        return usedBreadth;
350
351
    const Length& trackLength = gridLength.length();
352
    ASSERT(!trackLength.isAuto());
304
    if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage()) {
353
    if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewportPercentage()) {
305
        LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(direction, trackLength);
354
        LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(direction, trackLength);
306
        ASSERT(computedBreadth != infinity);
355
        ASSERT(computedBreadth != infinity);
307
        return computedBreadth;
356
        return computedBreadth;
308
    }
357
    }
309
358
310
    ASSERT(trackLength.isMinContent() || trackLength.isMaxContent() || trackLength.isAuto());
359
    ASSERT(trackLength.isMinContent() || trackLength.isMaxContent());
311
    return infinity;
360
    return infinity;
312
}
361
}
313
362
Lines 318-323 LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(TrackSizingDirection a/Source/WebCore/rendering/RenderGrid.cpp_sec5
318
    return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(style()->logicalHeight()), &view());
367
    return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(style()->logicalHeight()), &view());
319
}
368
}
320
369
370
static bool sortByGridNormalizedFlexValue(const GridTrackForNormalization& track1, const GridTrackForNormalization& track2)
371
{
372
    return track1.m_normalizedFlexValue < track2.m_normalizedFlexValue;
373
}
374
375
double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, TrackSizingDirection direction, LayoutUnit availableLogicalSpace) const
376
{
377
    // |availableLogicalSpace| already accounts for the used breadths so no need to remove it here.
378
379
    Vector<GridTrackForNormalization> tracksForNormalization;
380
    for (size_t i = 0; i < tracks.size(); ++i) {
381
        const GridTrackSize& trackSize = gridTrackSize(direction, i);
382
        if (!trackSize.maxTrackBreadth().isFlex())
383
            continue;
384
385
        tracksForNormalization.append(GridTrackForNormalization(tracks[i], trackSize.maxTrackBreadth().flex()));
386
    }
387
388
    // FIXME: Ideally we shouldn't come here without any <flex> grid track.
389
    if (tracksForNormalization.isEmpty())
390
        return LayoutUnit();
391
392
    std::sort(tracksForNormalization.begin(), tracksForNormalization.end(), sortByGridNormalizedFlexValue);
393
394
    // These values work together: as we walk over our grid tracks, we increase fractionValueBasedOnGridItemsRatio
395
    // to match a grid track's usedBreadth to <flex> ratio until the total fractions sized grid tracks wouldn't
396
    // fit into availableLogicalSpaceIgnoringFractionTracks.
397
    double accumulatedFractions = 0;
398
    LayoutUnit fractionValueBasedOnGridItemsRatio = 0;
399
    LayoutUnit availableLogicalSpaceIgnoringFractionTracks = availableLogicalSpace;
400
401
    for (size_t i = 0; i < tracksForNormalization.size(); ++i) {
402
        const GridTrackForNormalization& track = tracksForNormalization[i];
403
        if (track.m_normalizedFlexValue > fractionValueBasedOnGridItemsRatio) {
404
            // If the normalized flex value (we ordered |tracksForNormalization| by increasing normalized flex value)
405
            // will make us overflow our container, then stop. We have the previous step's ratio is the best fit.
406
            if (track.m_normalizedFlexValue * accumulatedFractions > availableLogicalSpaceIgnoringFractionTracks)
407
                break;
408
409
            fractionValueBasedOnGridItemsRatio = track.m_normalizedFlexValue;
410
        }
411
412
        accumulatedFractions += track.m_flex;
413
        // This item was processed so we re-add its used breadth to the available space to accurately count the remaining space.
414
        availableLogicalSpaceIgnoringFractionTracks += track.m_track->m_usedBreadth;
415
    }
416
417
    return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions;
418
}
419
321
const GridTrackSize& RenderGrid::gridTrackSize(TrackSizingDirection direction, size_t i) const
420
const GridTrackSize& RenderGrid::gridTrackSize(TrackSizingDirection direction, size_t i) const
322
{
421
{
323
    const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows();
422
    const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows();
Lines 411-417 LayoutUnit RenderGrid::maxContentForChild(RenderBox* child, TrackSizingDirection a/Source/WebCore/rendering/RenderGrid.cpp_sec6
411
510
412
void RenderGrid::resolveContentBasedTrackSizingFunctions(TrackSizingDirection direction, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, LayoutUnit& availableLogicalSpace)
511
void RenderGrid::resolveContentBasedTrackSizingFunctions(TrackSizingDirection direction, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, LayoutUnit& availableLogicalSpace)
413
{
512
{
414
    // FIXME: Split the grid tracks once we support fractions (step 1 of the algorithm).
513
    // FIXME: Split the grid tracks into groups that doesn't overlap a <flex> grid track.
415
514
416
    Vector<GridTrack>& tracks = (direction == ForColumns) ? columnTracks : rowTracks;
515
    Vector<GridTrack>& tracks = (direction == ForColumns) ? columnTracks : rowTracks;
417
516
Lines 474-480 void RenderGrid::distributeSpaceToTracks(Vector<GridTrack*>& tracks, Vector<Grid a/Source/WebCore/rendering/RenderGrid.cpp_sec7
474
        GridTrack& track = *tracks[i];
573
        GridTrack& track = *tracks[i];
475
        LayoutUnit availableLogicalSpaceShare = availableLogicalSpace / (tracksSize - i);
574
        LayoutUnit availableLogicalSpaceShare = availableLogicalSpace / (tracksSize - i);
476
        LayoutUnit trackBreadth = (tracks[i]->*trackGetter)();
575
        LayoutUnit trackBreadth = (tracks[i]->*trackGetter)();
477
        LayoutUnit growthShare = std::min(availableLogicalSpaceShare, track.m_maxBreadth - trackBreadth);
576
        LayoutUnit growthShare = std::max(LayoutUnit(), std::min(availableLogicalSpaceShare, track.m_maxBreadth - trackBreadth));
577
        // We should never shrink any grid track or else we can't guarantee we abide by our min-sizing function.
478
        updatedTrackBreadths[i] = trackBreadth + growthShare;
578
        updatedTrackBreadths[i] = trackBreadth + growthShare;
479
        availableLogicalSpace -= growthShare;
579
        availableLogicalSpace -= growthShare;
480
    }
580
    }
Lines 500-506 bool RenderGrid::tracksAreWiderThanMinTrackBreadth(TrackSizingDirection directio a/Source/WebCore/rendering/RenderGrid.cpp_sec8
500
{
600
{
501
    for (size_t i = 0; i < tracks.size(); ++i) {
601
    for (size_t i = 0; i < tracks.size(); ++i) {
502
        const GridTrackSize& trackSize = gridTrackSize(direction, i);
602
        const GridTrackSize& trackSize = gridTrackSize(direction, i);
503
        const Length& minTrackBreadth = trackSize.minTrackBreadth();
603
        const GridLength& minTrackBreadth = trackSize.minTrackBreadth();
504
        if (computeUsedBreadthOfMinLength(direction, minTrackBreadth) > tracks[i].m_usedBreadth)
604
        if (computeUsedBreadthOfMinLength(direction, minTrackBreadth) > tracks[i].m_usedBreadth)
505
            return false;
605
            return false;
506
    }
606
    }
- a/Source/WebCore/rendering/RenderGrid.h -3 / +5 lines
Lines 59-65 private: a/Source/WebCore/rendering/RenderGrid.h_sec1
59
    virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
59
    virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
60
    virtual void computePreferredLogicalWidths() OVERRIDE;
60
    virtual void computePreferredLogicalWidths() OVERRIDE;
61
61
62
    LayoutUnit computePreferredTrackWidth(const Length&, size_t) const;
62
    LayoutUnit computePreferredTrackWidth(const GridLength&, size_t) const;
63
63
64
    struct GridSpan {
64
    struct GridSpan {
65
        static PassOwnPtr<GridSpan> create(size_t initialPosition, size_t finalPosition)
65
        static PassOwnPtr<GridSpan> create(size_t initialPosition, size_t finalPosition)
Lines 99-106 private: a/Source/WebCore/rendering/RenderGrid.h_sec2
99
    class GridIterator;
99
    class GridIterator;
100
    enum TrackSizingDirection { ForColumns, ForRows };
100
    enum TrackSizingDirection { ForColumns, ForRows };
101
    void computedUsedBreadthOfGridTracks(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks);
101
    void computedUsedBreadthOfGridTracks(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks);
102
    LayoutUnit computeUsedBreadthOfMinLength(TrackSizingDirection, const Length&) const;
102
    LayoutUnit computeUsedBreadthOfMinLength(TrackSizingDirection, const GridLength&) const;
103
    LayoutUnit computeUsedBreadthOfMaxLength(TrackSizingDirection, const Length&) const;
103
    LayoutUnit computeUsedBreadthOfMaxLength(TrackSizingDirection, const GridLength&, LayoutUnit usedBreadth) const;
104
    LayoutUnit computeUsedBreadthOfSpecifiedLength(TrackSizingDirection, const Length&) const;
104
    LayoutUnit computeUsedBreadthOfSpecifiedLength(TrackSizingDirection, const Length&) const;
105
    void resolveContentBasedTrackSizingFunctions(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, LayoutUnit& availableLogicalSpace);
105
    void resolveContentBasedTrackSizingFunctions(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, LayoutUnit& availableLogicalSpace);
106
106
Lines 124-129 private: a/Source/WebCore/rendering/RenderGrid.h_sec3
124
    void resolveContentBasedTrackSizingFunctionsForItems(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, RenderBox*, FilterFunction, SizingFunction, AccumulatorGetter, AccumulatorGrowFunction);
124
    void resolveContentBasedTrackSizingFunctionsForItems(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks, RenderBox*, FilterFunction, SizingFunction, AccumulatorGetter, AccumulatorGrowFunction);
125
    void distributeSpaceToTracks(Vector<GridTrack*>&, Vector<GridTrack*>* tracksForGrowthAboveMaxBreadth, AccumulatorGetter, AccumulatorGrowFunction, LayoutUnit& availableLogicalSpace);
125
    void distributeSpaceToTracks(Vector<GridTrack*>&, Vector<GridTrack*>* tracksForGrowthAboveMaxBreadth, AccumulatorGetter, AccumulatorGrowFunction, LayoutUnit& availableLogicalSpace);
126
126
127
    double computeNormalizedFractionBreadth(Vector<GridTrack>&, TrackSizingDirection, LayoutUnit availableLogicalSpace) const;
128
127
    const GridTrackSize& gridTrackSize(TrackSizingDirection, size_t) const;
129
    const GridTrackSize& gridTrackSize(TrackSizingDirection, size_t) const;
128
    size_t explicitGridColumnCount() const;
130
    size_t explicitGridColumnCount() const;
129
    size_t explicitGridRowCount() const;
131
    size_t explicitGridRowCount() const;
- a/Source/WebCore/rendering/style/GridLength.h +89 lines
Line 0 a/Source/WebCore/rendering/style/GridLength.h_sec1
1
/*
2
 * Copyright (C) 2013 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 are
6
 * met:
7
 *
8
 *     * Redistributions of source code must retain the above copyright
9
 * notice, this list of conditions and the following disclaimer.
10
 *     * Redistributions in binary form must reproduce the above
11
 * copyright notice, this list of conditions and the following disclaimer
12
 * in the documentation and/or other materials provided with the
13
 * distribution.
14
 *     * Neither the name of Google Inc. nor the names of its
15
 * contributors may be used to endorse or promote products derived from
16
 * this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
 */
30
31
#ifndef GridLength_h
32
#define GridLength_h
33
34
#include "Length.h"
35
36
namespace WebCore {
37
38
// This class wraps the <track-breadth> which can be either a <percentage>, <length>, min-content, max-content
39
// or <flex>. This class avoids spreading the knowledge of <flex> throughout the rendering directory by adding
40
// an new unit to Length.h.
41
class GridLength {
42
public:
43
    GridLength()
44
        : m_length(Undefined)
45
        , m_flex(0)
46
        , m_type(LengthType)
47
    {
48
    }
49
50
    GridLength(const Length& length)
51
        : m_length(length)
52
        , m_flex(0)
53
        , m_type(LengthType)
54
    {
55
    }
56
57
    bool isLength() const { return m_type == LengthType; }
58
    bool isFlex() const { return m_type == FlexType; }
59
60
    const Length& length() const { ASSERT(isLength()); return m_length; }
61
    Length& length() { ASSERT(isLength()); return m_length; }
62
63
    double flex() const { ASSERT(isFlex()); return m_flex; }
64
    void setFlex(double flex)
65
    {
66
        m_type = FlexType;
67
        m_flex = flex;
68
    }
69
70
    bool operator==(const GridLength& o) const
71
    {
72
        return m_length == o.m_length && m_flex == o.m_flex && m_type == o.m_type;
73
    }
74
75
private:
76
    // Ideally we would put the 2 following fields in a union, but Length has a constructor,
77
    // a destructor and a copy assignment which isn't allowed.
78
    Length m_length;
79
    double m_flex;
80
    enum GridLengthType {
81
        LengthType,
82
        FlexType
83
    };
84
    GridLengthType m_type;
85
};
86
87
} // namespace WebCore
88
89
#endif // GridLength_h
- a/Source/WebCore/rendering/style/GridTrackSize.h -20 / +21 lines
Lines 31-37 a/Source/WebCore/rendering/style/GridTrackSize.h_sec1
31
#ifndef GridTrackSize_h
31
#ifndef GridTrackSize_h
32
#define GridTrackSize_h
32
#define GridTrackSize_h
33
33
34
#include "Length.h"
34
#include "GridLength.h"
35
35
36
namespace WebCore {
36
namespace WebCore {
37
37
Lines 49-90 public: a/Source/WebCore/rendering/style/GridTrackSize.h_sec2
49
    {
49
    {
50
    }
50
    }
51
51
52
    const Length& length() const
52
    const GridLength& length() const
53
    {
53
    {
54
        ASSERT(m_type == LengthTrackSizing);
54
        ASSERT(m_type == LengthTrackSizing);
55
        ASSERT(!m_minTrackBreadth.isUndefined());
56
        ASSERT(m_minTrackBreadth == m_maxTrackBreadth);
55
        ASSERT(m_minTrackBreadth == m_maxTrackBreadth);
57
        return m_minTrackBreadth;
56
        const GridLength& minTrackBreadth = m_minTrackBreadth;
57
        ASSERT(!minTrackBreadth.isLength() || !minTrackBreadth.length().isUndefined());
58
        return minTrackBreadth;
58
    }
59
    }
59
60
60
    void setLength(const Length& length)
61
    void setLength(const GridLength& length)
61
    {
62
    {
62
        m_type = LengthTrackSizing;
63
        m_type = LengthTrackSizing;
63
        m_minTrackBreadth = length;
64
        m_minTrackBreadth = length;
64
        m_maxTrackBreadth = length;
65
        m_maxTrackBreadth = length;
65
    }
66
    }
66
67
67
    const Length& minTrackBreadth() const
68
    const GridLength& minTrackBreadth() const
68
    {
69
    {
69
        ASSERT(!m_minTrackBreadth.isUndefined());
70
        ASSERT(!m_minTrackBreadth.isLength() || !m_minTrackBreadth.length().isUndefined());
70
        if (m_minTrackBreadth.isAuto()) {
71
        if (m_minTrackBreadth.isLength() && m_minTrackBreadth.length().isAuto()) {
71
            DEFINE_STATIC_LOCAL(Length, minContent, (MinContent));
72
            DEFINE_STATIC_LOCAL(GridLength, minContent, (MinContent));
72
            return minContent;
73
            return minContent;
73
        }
74
        }
74
        return m_minTrackBreadth;
75
        return m_minTrackBreadth;
75
    }
76
    }
76
77
77
    const Length& maxTrackBreadth() const
78
    const GridLength& maxTrackBreadth() const
78
    {
79
    {
79
        ASSERT(!m_maxTrackBreadth.isUndefined());
80
        ASSERT(!m_maxTrackBreadth.isLength() || !m_maxTrackBreadth.length().isUndefined());
80
        if (m_maxTrackBreadth.isAuto()) {
81
        if (m_maxTrackBreadth.isLength() && m_maxTrackBreadth.length().isAuto()) {
81
            DEFINE_STATIC_LOCAL(Length, maxContent, (MaxContent));
82
            DEFINE_STATIC_LOCAL(GridLength, maxContent, (MaxContent));
82
            return maxContent;
83
            return maxContent;
83
        }
84
        }
84
        return m_maxTrackBreadth;
85
        return m_maxTrackBreadth;
85
    }
86
    }
86
87
87
    void setMinMax(const Length& minTrackBreadth, const Length& maxTrackBreadth)
88
    void setMinMax(const GridLength& minTrackBreadth, const GridLength& maxTrackBreadth)
88
    {
89
    {
89
        m_type = MinMaxTrackSizing;
90
        m_type = MinMaxTrackSizing;
90
        m_minTrackBreadth = minTrackBreadth;
91
        m_minTrackBreadth = minTrackBreadth;
Lines 98-112 public: a/Source/WebCore/rendering/style/GridTrackSize.h_sec3
98
        return m_type == other.m_type && m_minTrackBreadth == other.m_minTrackBreadth && m_maxTrackBreadth == other.m_maxTrackBreadth;
99
        return m_type == other.m_type && m_minTrackBreadth == other.m_minTrackBreadth && m_maxTrackBreadth == other.m_maxTrackBreadth;
99
    }
100
    }
100
101
101
    bool hasMinOrMaxContentMinTrackBreadth() const { return minTrackBreadth().isMinContent() || minTrackBreadth().isMaxContent(); }
102
    bool hasMinOrMaxContentMinTrackBreadth() const { return minTrackBreadth().isLength() && (minTrackBreadth().length().isMinContent() || minTrackBreadth().length().isMaxContent()); }
102
    bool hasMaxContentMinTrackBreadth() const { return minTrackBreadth().isMaxContent(); }
103
    bool hasMaxContentMinTrackBreadth() const { return minTrackBreadth().isLength() && minTrackBreadth().length().isMaxContent(); }
103
    bool hasMinOrMaxContentMaxTrackBreadth() const { return maxTrackBreadth().isMinContent() || maxTrackBreadth().isMaxContent(); }
104
    bool hasMinOrMaxContentMaxTrackBreadth() const { return maxTrackBreadth().isLength() && (maxTrackBreadth().length().isMinContent() || maxTrackBreadth().length().isMaxContent()); }
104
    bool hasMaxContentMaxTrackBreadth() const { return maxTrackBreadth().isMaxContent(); }
105
    bool hasMaxContentMaxTrackBreadth() const { return maxTrackBreadth().isLength() && maxTrackBreadth().length().isMaxContent(); }
105
106
106
private:
107
private:
107
    GridTrackSizeType m_type;
108
    GridTrackSizeType m_type;
108
    Length m_minTrackBreadth;
109
    GridLength m_minTrackBreadth;
109
    Length m_maxTrackBreadth;
110
    GridLength m_maxTrackBreadth;
110
};
111
};
111
112
112
} // namespace WebCore
113
} // namespace WebCore
- a/LayoutTests/ChangeLog +31 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2013-09-16  Sergio Villar Senin  <svillar@igalia.com>
2
3
        [CSS Grid Layout] Implement support for <flex>
4
        https://bugs.webkit.org/show_bug.cgi?id=115362
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        From Blink r149134, r149480, r149532, r150287 and r156127 by <jchaffraix@chromium.org>
9
        From Blink r157820 by <svillar@igalia.com>
10
11
        Added 4 new test cases to test the support for <flex> in CSS Grid
12
        Layout code. Also updated some of the existing ones to check the
13
        support for 'fr' units.
14
15
        * fast/css-grid-layout/flex-and-minmax-content-resolution-columns-expected.txt: Added.
16
        * fast/css-grid-layout/flex-and-minmax-content-resolution-columns.html: Added.
17
        * fast/css-grid-layout/flex-and-minmax-content-resolution-rows-expected.txt: Added.
18
        * fast/css-grid-layout/flex-and-minmax-content-resolution-rows.html: Added.
19
        * fast/css-grid-layout/flex-content-resolution-columns-expected.txt: Added.
20
        * fast/css-grid-layout/flex-content-resolution-columns.html: Added.
21
        * fast/css-grid-layout/flex-content-resolution-rows-expected.txt: Added.
22
        * fast/css-grid-layout/flex-content-resolution-rows.html: Added.
23
        * fast/css-grid-layout/grid-columns-rows-get-set-expected.txt:
24
        * fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt:
25
        * fast/css-grid-layout/grid-columns-rows-get-set-multiple.html:
26
        * fast/css-grid-layout/grid-columns-rows-get-set.html:
27
        * fast/css-grid-layout/grid-dynamic-updates-relayout-expected.txt:
28
        * fast/css-grid-layout/grid-dynamic-updates-relayout.html:
29
        * fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js:
30
        * fast/css-grid-layout/resources/grid-columns-rows-get-set.js:
31
1
2013-09-16  Wojciech Bielawski  <w.bielawski@samsung.com>
32
2013-09-16  Wojciech Bielawski  <w.bielawski@samsung.com>
2
33
3
        [WKTR] Add implementation of click() method of objects returned by eventSender.contextClick().
34
        [WKTR] Add implementation of click() method of objects returned by eventSender.contextClick().
- a/LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-columns-expected.txt +26 lines
Line 0 a/LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-columns-expected.txt_sec1
1
Test that resolving auto tracks on grid items works properly.
2
3
XXXXX
4
PASS
5
XXXXX
6
PASS
7
XXXXX
8
PASS
9
XX XX
10
XX XX
11
PASS
12
XX XX
13
XX XX
14
PASS
15
XX XX
16
XX XX
17
PASS
18
 PASS
19
XXXXXXXXXX
20
PASS
21
XXXXXXXXXX XXXXXXXXX
22
PASS
23
XXXXXXXXXX XXXXXXXXX
24
PASS
25
XXXXXXXXXX XXXXXXXXX
26
PASS
- a/LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-columns.html +150 lines
Line 0 a/LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-columns.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<script>
4
if (window.testRunner)
5
    testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
6
</script>
7
<link href="resources/grid.css" rel="stylesheet">
8
<style>
9
.gridMaxMaxContent {
10
    -webkit-grid-definition-columns: minmax(10px, -webkit-max-content) minmax(10px, 1fr);
11
    -webkit-grid-definition-rows: 50px;
12
}
13
14
.gridMinMinContent {
15
    -webkit-grid-definition-columns: minmax(10px, 1fr) minmax(-webkit-min-content, 50px);
16
    -webkit-grid-definition-rows: 50px;
17
}
18
19
.gridWithIntrinsicSizeBiggerThanFlex {
20
    -webkit-grid-definition-columns: minmax(-webkit-min-content, 0.5fr) minmax(18px, 2fr);
21
    -webkit-grid-definition-rows: 50px;
22
}
23
24
.gridShrinkBelowItemsIntrinsicSize {
25
    -webkit-grid-definition-columns: minmax(0px, 1fr) minmax(0px, 2fr);
26
    -webkit-grid-definition-rows: 50px;
27
}
28
29
.gridWithNonFlexingItems {
30
    -webkit-grid-definition-columns: 40px minmax(-webkit-min-content, 1fr) auto minmax(20px, 2fr);
31
    -webkit-grid-definition-rows: 50px;
32
}
33
34
.firstRowThirdColumn {
35
    -webkit-grid-column: 3;
36
    -webkit-grid-row: 1;
37
}
38
.firstRowFourthColumn {
39
    -webkit-grid-column: 4;
40
    -webkit-grid-row: 1;
41
}
42
</style>
43
<script src="../../resources/check-layout.js"></script>
44
<body onload="checkLayout('.grid');">
45
46
<p>Test that resolving auto tracks on grid items works properly.</p>
47
48
<div class="constrainedContainer">
49
    <div class="grid gridMaxMaxContent">
50
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="10" data-expected-height="50">XXXXX</div>
51
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="10" data-expected-height="50"></div>
52
    </div>
53
</div>
54
55
<!-- Allow the extra logical space distribution to occur. -->
56
<div style="width: 40px; height: 10px">
57
    <div class="grid gridMaxMaxContent">
58
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="30" data-expected-height="50">XXXXX</div>
59
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="10" data-expected-height="50"></div>
60
    </div>
61
</div>
62
63
<div style="width: 110px; height: 10px;">
64
    <div class="grid gridMaxMaxContent">
65
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="50">XXXXX</div>
66
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="60" data-expected-height="50"></div>
67
    </div>
68
</div>
69
70
71
<div class="constrainedContainer">
72
    <div class="grid gridMinMinContent">
73
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="10" data-expected-height="50">XX XX</div>
74
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="20" data-expected-height="50">XX XX</div>
75
    </div>
76
</div>
77
78
<!-- Allow the extra logical space distribution to occur. -->
79
<div style="width: 40px; height: 10px">
80
    <div class="grid gridMinMinContent">
81
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="10" data-expected-height="50">XX XX</div>
82
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="30" data-expected-height="50">XX XX</div>
83
    </div>
84
</div>
85
86
<div style="width: 110px; height: 10px;">
87
    <div class="grid gridMinMinContent">
88
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="60" data-expected-height="50">XX XX</div>
89
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="50" data-expected-height="50">XX XX</div>
90
    </div>
91
</div>
92
93
94
<div style="width: 220px; height: 10px;">
95
    <div class="grid gridWithIntrinsicSizeBiggerThanFlex">
96
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="200" data-expected-height="50">
97
            <div style="display: inline-block; width: 200px;"></div>
98
        </div>
99
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="20" data-expected-height="50"></div>
100
    </div>
101
</div>
102
103
104
<div style="width: 120px; height: 10px;">
105
    <div class="grid gridShrinkBelowItemsIntrinsicSize">
106
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50">
107
            <div style="display: inline-block; width: 200px;"></div>
108
        </div>
109
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="80" data-expected-height="50">XXXXXXXXXX</div>
110
    </div>
111
</div>
112
113
114
<!-- No space available for the <flex> -->
115
<div style="width: 220px; height: 10px;">
116
    <div class="grid gridWithNonFlexingItems">
117
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
118
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="100" data-expected-height="50">
119
            <div style="display: inline-block; width: 100px;"></div>
120
        </div>
121
        <div class="sizedToGridArea firstRowThirdColumn" data-expected-width="100" data-expected-height="50">XXXXXXXXXX XXXXXXXXX</div>
122
        <div class="sizedToGridArea firstRowFourthColumn" data-expected-width="20" data-expected-height="50"></div>
123
    </div>
124
</div>
125
126
<!-- The second track should be sized after the min-content as the <flex> value should be too small. -->
127
<div style="width: 380px; height: 10px;">
128
    <div class="grid gridWithNonFlexingItems">
129
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
130
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="100" data-expected-height="50">
131
            <div style="display: inline-block; width: 100px;"></div>
132
        </div>
133
        <div class="sizedToGridArea firstRowThirdColumn" data-expected-width="200" data-expected-height="50">XXXXXXXXXX XXXXXXXXX</div>
134
        <div class="sizedToGridArea firstRowFourthColumn" data-expected-width="40" data-expected-height="50"></div>
135
    </div>
136
</div>
137
138
<div style="width: 400px; height: 10px;">
139
    <div class="grid gridWithNonFlexingItems">
140
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
141
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="100" data-expected-height="50">
142
            <div style="display: inline-block; width: 100px;"></div>
143
        </div>
144
        <div class="sizedToGridArea firstRowThirdColumn" data-expected-width="200" data-expected-height="50">XXXXXXXXXX XXXXXXXXX</div>
145
        <div class="sizedToGridArea firstRowFourthColumn" data-expected-width="60" data-expected-height="50"></div>
146
    </div>
147
</div>
148
149
</body>
150
</html>
- a/LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-rows-expected.txt +31 lines
Line 0 a/LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-rows-expected.txt_sec1
1
Test that resolving auto tracks on grid items works properly.
2
3
XXXXX
4
PASS
5
XXXXX
6
PASS
7
XXXXX
8
PASS
9
XXXXX XXXX
10
XXXXX XXXX
11
PASS
12
XXXXX XXXX
13
XXXXX XXXX
14
PASS
15
XXXXX XXXX
16
XXXXX XXXX
17
PASS
18
XXXXX XXXXX XXXXX XXXXX
19
PASS
20
XXXXX XXXXX XXXXX XXXXX XXXXX
21
XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX
22
PASS
23
XXXXX XXXXX XXXXX XXXXX
24
XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX
25
PASS
26
XXXXX XXXXX XXXXX XXXXX
27
XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX
28
PASS
29
XXXXX XXXXX XXXXX XXXXX
30
XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX
31
PASS
- a/LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-rows.html +140 lines
Line 0 a/LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-rows.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<script>
4
if (window.testRunner)
5
    testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
6
</script>
7
<link href="resources/grid.css" rel="stylesheet">
8
<style>
9
.gridMaxMaxContent {
10
    -webkit-grid-definition-columns: 50px;
11
    -webkit-grid-definition-rows: minmax(10px, -webkit-max-content) minmax(10px, 1fr);
12
}
13
14
.gridMinMinContent {
15
    -webkit-grid-definition-columns: 50px;
16
    -webkit-grid-definition-rows: minmax(10px, 1fr) minmax(-webkit-min-content, 50px);
17
}
18
19
.gridWithIntrinsicSizeBiggerThanFlex {
20
    -webkit-grid-definition-columns: 50px;
21
    -webkit-grid-definition-rows: minmax(-webkit-min-content, 0.5fr) minmax(18px, 2fr);
22
}
23
24
.gridShrinkBelowItemsIntrinsicSize {
25
    -webkit-grid-definition-columns: 50px;
26
    -webkit-grid-definition-rows: minmax(0px, 1fr) minmax(0px, 2fr);
27
}
28
29
.gridWithNonFlexingItems {
30
    -webkit-grid-definition-columns: 50px;
31
    -webkit-grid-definition-rows: 40px minmax(-webkit-min-content, 1fr) auto minmax(20px, 2fr);
32
}
33
34
.thirdRowFirstColumn {
35
    -webkit-grid-column: 1;
36
    -webkit-grid-row: 3;
37
}
38
.fourthRowFirstColumn {
39
    -webkit-grid-column: 1;
40
    -webkit-grid-row: 4;
41
}
42
</style>
43
<script src="../../resources/check-layout.js"></script>
44
<body onload="checkLayout('.grid');">
45
46
<p>Test that resolving auto tracks on grid items works properly.</p>
47
48
<div class="constrainedContainer">
49
    <div class="grid gridMaxMaxContent">
50
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10">XXXXX</div>
51
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
52
    </div>
53
</div>
54
55
<!-- Allow the extra logical space distribution to occur. -->
56
<div style="width: 10px; height: 40px">
57
    <div class="grid gridMaxMaxContent">
58
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10">XXXXX</div>
59
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="30"></div>
60
    </div>
61
</div>
62
63
<div style="width: 10px; height: 110px;">
64
    <div class="grid gridMaxMaxContent">
65
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10">XXXXX</div>
66
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="100"></div>
67
    </div>
68
</div>
69
70
71
<div class="constrainedContainer">
72
    <div class="grid gridMinMinContent">
73
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10">XXXXX XXXX</div>
74
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="20">XXXXX XXXX</div>
75
    </div>
76
</div>
77
78
<!-- Allow the extra logical space distribution to occur. -->
79
<div style="width: 10px; height: 40px">
80
    <div class="grid gridMinMinContent">
81
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10">XXXXX XXXX</div>
82
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="30">XXXXX XXXX</div>
83
    </div>
84
</div>
85
86
<div style="width: 10px; height: 110px;">
87
    <div class="grid gridMinMinContent">
88
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="60">XXXXX XXXX</div>
89
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="50">XXXXX XXXX</div>
90
    </div>
91
</div>
92
93
94
<div style="width: 10px; height: 60px;">
95
    <div class="grid gridWithIntrinsicSizeBiggerThanFlex">
96
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40">XXXXX XXXXX XXXXX XXXXX</div>
97
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
98
    </div>
99
</div>
100
101
102
<div style="width: 10px; height: 60px;">
103
    <div class="grid gridShrinkBelowItemsIntrinsicSize">
104
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="20">XXXXX XXXXX XXXXX XXXXX XXXXX</div>
105
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="40">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div>
106
    </div>
107
</div>
108
109
110
<!-- No space available for the <flex> -->
111
<div style="width: 10px; height: 100px;">
112
    <div class="grid gridWithNonFlexingItems">
113
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
114
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="40">XXXXX XXXXX XXXXX XXXXX</div>
115
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="60">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div>
116
        <div class="sizedToGridArea fourthRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
117
    </div>
118
</div>
119
120
<!-- The second track should be sized after the min-content as the <flex> value should be too small. -->
121
<div style="width: 10px; height: 180px;">
122
    <div class="grid gridWithNonFlexingItems">
123
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
124
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="40">XXXXX XXXXX XXXXX XXXXX</div>
125
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="60">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div>
126
        <div class="sizedToGridArea fourthRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
127
    </div>
128
</div>
129
130
<div style="width: 10px; height: 400px;">
131
    <div class="grid gridWithNonFlexingItems">
132
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
133
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="100">XXXXX XXXXX XXXXX XXXXX</div>
134
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="60">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div>
135
        <div class="sizedToGridArea fourthRowFirstColumn" data-expected-width="50" data-expected-height="200"></div>
136
    </div>
137
</div>
138
139
</body>
140
</html>
- a/LayoutTests/fast/css-grid-layout/flex-content-resolution-columns-expected.txt +15 lines
Line 0 a/LayoutTests/fast/css-grid-layout/flex-content-resolution-columns-expected.txt_sec1
1
Test that resolving auto tracks on grid items works properly.
2
3
PASS
4
PASS
5
PASS
6
PASS
7
PASS
8
PASS
9
PASS
10
PASS
11
PASS
12
PASS
13
PASS
14
PASS
15
PASS
- a/LayoutTests/fast/css-grid-layout/flex-content-resolution-columns.html +129 lines
Line 0 a/LayoutTests/fast/css-grid-layout/flex-content-resolution-columns.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<script>
4
if (window.testRunner)
5
    testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
6
</script>
7
<link href="resources/grid.css" rel="stylesheet">
8
<style>
9
.gridMinFlexContent {
10
    -webkit-grid-definition-columns: minmax(1fr, 50px);
11
    -webkit-grid-definition-rows: 50px;
12
}
13
.gridMaxFlexContent {
14
    -webkit-grid-definition-columns: minmax(30px, 2fr);
15
    -webkit-grid-definition-rows: 50px;
16
}
17
.gridTwoMaxFlexContent {
18
    -webkit-grid-definition-columns: minmax(10px, 1fr) minmax(10px, 2fr);
19
    -webkit-grid-definition-rows: 50px;
20
}
21
.gridTwoDoubleMaxFlexContent {
22
    -webkit-grid-definition-columns: minmax(10px, 0.5fr) minmax(10px, 2fr);
23
    -webkit-grid-definition-rows: 50px;
24
}
25
.gridIgnoreSecondGridItem {
26
    -webkit-grid-definition-columns: minmax(300px, 3fr) minmax(150px, 1fr);
27
    -webkit-grid-definition-rows: 50px;
28
}
29
</style>
30
<script src="../../resources/check-layout.js"></script>
31
<body onload="checkLayout('.grid');">
32
33
<p>Test that resolving auto tracks on grid items works properly.</p>
34
35
<div style="width: 0px">
36
    <div class="grid gridMinFlexContent">
37
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="0" data-expected-height="50"></div>
38
    </div>
39
</div>
40
41
<!-- Allow the extra logical space distribution to occur. -->
42
<div style="width: 40px; height: 10px">
43
    <div class="grid gridMinFlexContent">
44
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
45
    </div>
46
</div>
47
48
<div style="width: 100px; height: 10px;">
49
    <div class="grid gridMinFlexContent">
50
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
51
    </div>
52
</div>
53
54
<div class="constrainedContainer">
55
    <div class="grid gridMaxFlexContent">
56
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="30" data-expected-height="50"></div>
57
    </div>
58
</div>
59
60
<!-- Allow the extra logical space distribution to occur. -->
61
<div style="width: 40px; height: 10px">
62
    <div class="grid gridMaxFlexContent">
63
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
64
    </div>
65
</div>
66
67
<div style="width: 100px; height: 10px;">
68
    <div class="grid gridMaxFlexContent">
69
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="100" data-expected-height="50"></div>
70
    </div>
71
</div>
72
73
74
<div class="constrainedContainer">
75
    <div class="grid gridTwoMaxFlexContent">
76
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="10" data-expected-height="50"></div>
77
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="10" data-expected-height="50"></div>
78
    </div>
79
</div>
80
81
<!-- Allow the extra logical space distribution to occur. -->
82
<div style="width: 60px; height: 10px">
83
    <div class="grid gridTwoMaxFlexContent">
84
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="20" data-expected-height="50"></div>
85
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="40" data-expected-height="50"></div>
86
    </div>
87
</div>
88
89
<div style="width: 120px; height: 10px;">
90
    <div class="grid gridTwoMaxFlexContent">
91
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
92
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="80" data-expected-height="50"></div>
93
    </div>
94
</div>
95
96
97
<div class="constrainedContainer">
98
    <div class="grid gridTwoDoubleMaxFlexContent">
99
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="10" data-expected-height="50"></div>
100
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="10" data-expected-height="50"></div>
101
    </div>
102
</div>
103
104
<!-- Allow the extra logical space distribution to occur. -->
105
<div style="width: 60px; height: 10px">
106
    <div class="grid gridTwoDoubleMaxFlexContent">
107
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="12" data-expected-height="50"></div>
108
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="48" data-expected-height="50"></div>
109
    </div>
110
</div>
111
112
<div style="width: 120px; height: 10px;">
113
    <div class="grid gridTwoDoubleMaxFlexContent">
114
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="24" data-expected-height="50"></div>
115
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="96" data-expected-height="50"></div>
116
    </div>
117
</div>
118
119
120
<!-- Custom test for a corner case. -->
121
<div style="width: 570px; height: 10px;">
122
    <div class="grid gridIgnoreSecondGridItem">
123
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="420" data-expected-height="50"></div>
124
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="150" data-expected-height="50"></div>
125
    </div>
126
</div>
127
128
</body>
129
</html>
- a/LayoutTests/fast/css-grid-layout/flex-content-resolution-rows-expected.txt +14 lines
Line 0 a/LayoutTests/fast/css-grid-layout/flex-content-resolution-rows-expected.txt_sec1
1
Test that resolving auto tracks on grid items works properly.
2
3
PASS
4
PASS
5
PASS
6
PASS
7
PASS
8
PASS
9
PASS
10
PASS
11
PASS
12
PASS
13
PASS
14
PASS
- a/LayoutTests/fast/css-grid-layout/flex-content-resolution-rows.html +117 lines
Line 0 a/LayoutTests/fast/css-grid-layout/flex-content-resolution-rows.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<script>
4
if (window.testRunner)
5
    testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
6
</script>
7
<link href="resources/grid.css" rel="stylesheet">
8
<style>
9
.gridMinFlexContent {
10
    -webkit-grid-definition-columns: 50px;
11
    -webkit-grid-definition-rows: minmax(1fr, 50px);
12
}
13
.gridMaxFlexContent {
14
    -webkit-grid-definition-columns: 50px;
15
    -webkit-grid-definition-rows: minmax(30px, 2fr);
16
}
17
.gridTwoMaxFlexContent {
18
    -webkit-grid-definition-columns: 50px;
19
    -webkit-grid-definition-rows: minmax(10px, 1fr) minmax(10px, 2fr);
20
}
21
.gridTwoDoubleMaxFlexContent {
22
    -webkit-grid-definition-columns: 50px;
23
    -webkit-grid-definition-rows: minmax(10px, 0.5fr) minmax(10px, 2fr);
24
}
25
</style>
26
<script src="../../resources/check-layout.js"></script>
27
<body onload="checkLayout('.grid');">
28
29
<p>Test that resolving auto tracks on grid items works properly.</p>
30
31
<div style="height: 0px">
32
    <div class="grid gridMinFlexContent">
33
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="0"></div>
34
    </div>
35
</div>
36
37
<!-- Allow the extra logical space distribution to occur. -->
38
<div style="width: 10px; height: 40px">
39
    <div class="grid gridMinFlexContent">
40
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
41
    </div>
42
</div>
43
44
<div style="width: 10px; height: 100px;">
45
    <div class="grid gridMinFlexContent">
46
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
47
    </div>
48
</div>
49
50
51
<div class="constrainedContainer">
52
    <div class="grid gridMaxFlexContent">
53
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="30"></div>
54
    </div>
55
</div>
56
57
<!-- Allow the extra logical space distribution to occur. -->
58
<div style="width: 10px; height: 40px">
59
    <div class="grid gridMaxFlexContent">
60
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
61
    </div>
62
</div>
63
64
<div style="width: 10px; height: 100px;">
65
    <div class="grid gridMaxFlexContent">
66
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="100"></div>
67
    </div>
68
</div>
69
70
71
<div class="constrainedContainer">
72
    <div class="grid gridTwoMaxFlexContent">
73
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
74
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
75
    </div>
76
</div>
77
78
<!-- Allow the extra logical space distribution to occur. -->
79
<div style="width: 10px; height: 60px">
80
    <div class="grid gridTwoMaxFlexContent">
81
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
82
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
83
    </div>
84
</div>
85
86
<div style="width: 10px; height: 120px;">
87
    <div class="grid gridTwoMaxFlexContent">
88
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
89
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="80"></div>
90
    </div>
91
</div>
92
93
94
<div class="constrainedContainer">
95
    <div class="grid gridTwoDoubleMaxFlexContent">
96
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
97
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
98
    </div>
99
</div>
100
101
<!-- Allow the extra logical space distribution to occur. -->
102
<div style="width: 10px; height: 60px">
103
    <div class="grid gridTwoDoubleMaxFlexContent">
104
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="12"></div>
105
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="48"></div>
106
    </div>
107
</div>
108
109
<div style="width: 10px; height: 120px;">
110
    <div class="grid gridTwoDoubleMaxFlexContent">
111
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="24"></div>
112
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="96"></div>
113
    </div>
114
</div>
115
116
</body>
117
</html>
- a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt -1 / +19 lines
Lines 22-27 PASS getComputedStyle(gridWithMinContent, '').getPropertyValue('-webkit-grid-def a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt_sec1
22
PASS getComputedStyle(gridWithMinContent, '').getPropertyValue('-webkit-grid-definition-rows') is '-webkit-min-content'
22
PASS getComputedStyle(gridWithMinContent, '').getPropertyValue('-webkit-grid-definition-rows') is '-webkit-min-content'
23
PASS getComputedStyle(gridWithMaxContent, '').getPropertyValue('-webkit-grid-definition-columns') is '-webkit-max-content'
23
PASS getComputedStyle(gridWithMaxContent, '').getPropertyValue('-webkit-grid-definition-columns') is '-webkit-max-content'
24
PASS getComputedStyle(gridWithMaxContent, '').getPropertyValue('-webkit-grid-definition-rows') is '-webkit-max-content'
24
PASS getComputedStyle(gridWithMaxContent, '').getPropertyValue('-webkit-grid-definition-rows') is '-webkit-max-content'
25
PASS getComputedStyle(gridWithFraction, '').getPropertyValue('-webkit-grid-definition-columns') is '1fr'
26
PASS getComputedStyle(gridWithFraction, '').getPropertyValue('-webkit-grid-definition-rows') is '2fr'
25
27
26
Test getting wrong values for -webkit-grid-definition-columns and -webkit-grid-definition-rows through CSS (they should resolve to the default: 'none')
28
Test getting wrong values for -webkit-grid-definition-columns and -webkit-grid-definition-rows through CSS (they should resolve to the default: 'none')
27
PASS getComputedStyle(gridWithFitContentElement, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
29
PASS getComputedStyle(gridWithFitContentElement, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
Lines 60-67 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-col a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt_sec2
60
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'minmax(-webkit-max-content, 50px)'
62
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'minmax(-webkit-max-content, 50px)'
61
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'minmax(-webkit-min-content, -webkit-max-content)'
63
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'minmax(-webkit-min-content, -webkit-max-content)'
62
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'minmax(-webkit-max-content, -webkit-min-content)'
64
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'minmax(-webkit-max-content, -webkit-min-content)'
65
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is '3600fr'
66
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is '154fr'
67
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is '3.1459fr'
68
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is '2.718fr'
69
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is '3fr'
70
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is '4fr'
63
71
64
Test setting grid-definition-columns and grid-definition-rows to bad minmax value through JS
72
Test setting grid-definition-columns and grid-definition-rows to bad values through JS
73
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
74
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
75
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
76
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
77
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
78
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
79
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
80
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
81
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
82
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
65
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
83
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
66
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
84
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'none'
67
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
85
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
- a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt +6 lines
Lines 24-29 PASS getComputedStyle(gridWithMinMaxAndFixed, '').getPropertyValue('-webkit-grid a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt_sec1
24
PASS getComputedStyle(gridWithMinMaxAndFixed, '').getPropertyValue('-webkit-grid-definition-rows') is '120px minmax(35%, 10px)'
24
PASS getComputedStyle(gridWithMinMaxAndFixed, '').getPropertyValue('-webkit-grid-definition-rows') is '120px minmax(35%, 10px)'
25
PASS getComputedStyle(gridWithMinMaxAndMinMaxContent, '').getPropertyValue('-webkit-grid-definition-columns') is 'minmax(-webkit-min-content, 30%) 15px'
25
PASS getComputedStyle(gridWithMinMaxAndMinMaxContent, '').getPropertyValue('-webkit-grid-definition-columns') is 'minmax(-webkit-min-content, 30%) 15px'
26
PASS getComputedStyle(gridWithMinMaxAndMinMaxContent, '').getPropertyValue('-webkit-grid-definition-rows') is '120px minmax(35%, -webkit-max-content)'
26
PASS getComputedStyle(gridWithMinMaxAndMinMaxContent, '').getPropertyValue('-webkit-grid-definition-rows') is '120px minmax(35%, -webkit-max-content)'
27
PASS getComputedStyle(gridWithFractionFraction, '').getPropertyValue('-webkit-grid-definition-columns') is '1fr 2fr'
28
PASS getComputedStyle(gridWithFractionFraction, '').getPropertyValue('-webkit-grid-definition-rows') is '3fr 4fr'
29
PASS getComputedStyle(gridWithFractionMinMax, '').getPropertyValue('-webkit-grid-definition-columns') is 'minmax(-webkit-min-content, 45px) 2fr'
30
PASS getComputedStyle(gridWithFractionMinMax, '').getPropertyValue('-webkit-grid-definition-rows') is '3fr minmax(14px, -webkit-max-content)'
27
31
28
Test the initial value
32
Test the initial value
29
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
33
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
Lines 40-45 PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-col a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt_sec2
40
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is '56% 100px auto'
44
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is '56% 100px auto'
41
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is '160px minmax(16px, 20px)'
45
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is '160px minmax(16px, 20px)'
42
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'minmax(10%, 15%) auto'
46
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is 'minmax(10%, 15%) auto'
47
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns') is '160px 2fr'
48
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows') is '14fr auto'
43
49
44
Test getting wrong values set from CSS
50
Test getting wrong values set from CSS
45
PASS getComputedStyle(gridWithNoneAndAuto, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
51
PASS getComputedStyle(gridWithNoneAndAuto, '').getPropertyValue('-webkit-grid-definition-columns') is 'none'
- a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple.html +10 lines
Lines 60-65 if (window.testRunner) a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple.html_sec1
60
    -webkit-grid-definition-rows: 12em minmax(35%, -webkit-max-content);
60
    -webkit-grid-definition-rows: 12em minmax(35%, -webkit-max-content);
61
    font: 10px Ahem;
61
    font: 10px Ahem;
62
}
62
}
63
.gridWithFractionFraction {
64
    -webkit-grid-definition-columns: 1fr 2fr;
65
    -webkit-grid-definition-rows: 3fr 4fr;
66
}
67
.gridWithFractionMinMax {
68
    -webkit-grid-definition-columns: minmax(-webkit-min-content, 45px) 2fr;
69
    -webkit-grid-definition-rows: 3fr minmax(14px, -webkit-max-content);
70
}
63
</style>
71
</style>
64
<script src="../../resources/js-test-pre.js"></script>
72
<script src="../../resources/js-test-pre.js"></script>
65
</head>
73
</head>
Lines 76-81 if (window.testRunner) a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-multiple.html_sec2
76
<div class="grid gridWithMinMaxContent" id="gridWithMinMaxContent"></div>
84
<div class="grid gridWithMinMaxContent" id="gridWithMinMaxContent"></div>
77
<div class="grid gridWithMinMaxAndFixed" id="gridWithMinMaxAndFixed"></div>
85
<div class="grid gridWithMinMaxAndFixed" id="gridWithMinMaxAndFixed"></div>
78
<div class="grid gridWithMinMaxAndMinMaxContent" id="gridWithMinMaxAndMinMaxContent"></div>
86
<div class="grid gridWithMinMaxAndMinMaxContent" id="gridWithMinMaxAndMinMaxContent"></div>
87
<div class="grid gridWithFractionFraction" id="gridWithFractionFraction"></div>
88
<div class="grid gridWithFractionMinMax" id="gridWithFractionMinMax"></div>
79
<script src="resources/grid-columns-rows-get-set-multiple.js"></script>
89
<script src="resources/grid-columns-rows-get-set-multiple.js"></script>
80
<script src="../../resources/js-test-post.js"></script>
90
<script src="../../resources/js-test-post.js"></script>
81
</body>
91
</body>
- a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html +5 lines
Lines 52-57 if (window.testRunner) a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html_sec1
52
    -webkit-grid-definition-columns: -webkit-max-content;
52
    -webkit-grid-definition-columns: -webkit-max-content;
53
    -webkit-grid-definition-rows: -webkit-max-content;
53
    -webkit-grid-definition-rows: -webkit-max-content;
54
}
54
}
55
.gridWithFraction {
56
    -webkit-grid-definition-columns: 1fr;
57
    -webkit-grid-definition-rows: 2fr;
58
}
55
</style>
59
</style>
56
<script src="../../resources/js-test-pre.js"></script>
60
<script src="../../resources/js-test-pre.js"></script>
57
</head>
61
</head>
Lines 67-72 if (window.testRunner) a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html_sec2
67
<div class="grid gridWithMinMax" id="gridWithMinMax"></div>
71
<div class="grid gridWithMinMax" id="gridWithMinMax"></div>
68
<div class="grid gridWithMinContent" id="gridWithMinContent"></div>
72
<div class="grid gridWithMinContent" id="gridWithMinContent"></div>
69
<div class="grid gridWithMaxContent" id="gridWithMaxContent"></div>
73
<div class="grid gridWithMaxContent" id="gridWithMaxContent"></div>
74
<div class="grid gridWithFraction" id="gridWithFraction"></div>
70
<script src="resources/grid-columns-rows-get-set.js"></script>
75
<script src="resources/grid-columns-rows-get-set.js"></script>
71
<script src="../../resources/js-test-post.js"></script>
76
<script src="../../resources/js-test-post.js"></script>
72
</body>
77
</body>
- a/LayoutTests/fast/css-grid-layout/grid-dynamic-updates-relayout-expected.txt +2 lines
Lines 14-16 PASS a/LayoutTests/fast/css-grid-layout/grid-dynamic-updates-relayout-expected.txt_sec1
14
PASS
14
PASS
15
PASS
15
PASS
16
PASS
16
PASS
17
PASS
18
PASS
- a/LayoutTests/fast/css-grid-layout/grid-dynamic-updates-relayout.html +2 lines
Lines 35-40 function updateRowsColumns() a/LayoutTests/fast/css-grid-layout/grid-dynamic-updates-relayout.html_sec1
35
    testLayout("unconstrainedGrid", { 'rows': 'auto', 'columns': 'minmax(20px, -webkit-max-content)' }, { 'width': '120', 'height': '10' });
35
    testLayout("unconstrainedGrid", { 'rows': 'auto', 'columns': 'minmax(20px, -webkit-max-content)' }, { 'width': '120', 'height': '10' });
36
    testLayout("unconstrainedGrid", { 'rows': 'auto', 'columns': 'minmax(150px, -webkit-max-content)' }, { 'width': '150', 'height': '10' });
36
    testLayout("unconstrainedGrid", { 'rows': 'auto', 'columns': 'minmax(150px, -webkit-max-content)' }, { 'width': '150', 'height': '10' });
37
    testLayout("unconstrainedGrid", { 'rows': 'auto', 'columns': 'auto' }, { 'width': '120', 'height': '10' });
37
    testLayout("unconstrainedGrid", { 'rows': 'auto', 'columns': 'auto' }, { 'width': '120', 'height': '10' });
38
    testLayout("unconstrainedGrid", { 'rows': 'auto', 'columns': 'minmax(-webkit-min-content, 1fr) 3fr' }, { 'width': '250', 'height': '10' });
39
    testLayout("unconstrainedGrid", { 'rows': 'auto', 'columns': 'minmax(-webkit-min-content, 3fr) 3fr' }, { 'width': '500', 'height': '10' });
38
}
40
}
39
41
40
window.addEventListener("load", updateRowsColumns, false);
42
window.addEventListener("load", updateRowsColumns, false);
- a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js +16 lines
Lines 41-46 var gridWithMinMaxAndMinMaxContent = document.getElementById("gridWithMinMaxAndM a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js_sec1
41
shouldBe("getComputedStyle(gridWithMinMaxAndMinMaxContent, '').getPropertyValue('-webkit-grid-definition-columns')", "'minmax(-webkit-min-content, 30%) 15px'");
41
shouldBe("getComputedStyle(gridWithMinMaxAndMinMaxContent, '').getPropertyValue('-webkit-grid-definition-columns')", "'minmax(-webkit-min-content, 30%) 15px'");
42
shouldBe("getComputedStyle(gridWithMinMaxAndMinMaxContent, '').getPropertyValue('-webkit-grid-definition-rows')", "'120px minmax(35%, -webkit-max-content)'");
42
shouldBe("getComputedStyle(gridWithMinMaxAndMinMaxContent, '').getPropertyValue('-webkit-grid-definition-rows')", "'120px minmax(35%, -webkit-max-content)'");
43
43
44
var gridWithFractionFraction = document.getElementById("gridWithFractionFraction");
45
shouldBe("getComputedStyle(gridWithFractionFraction, '').getPropertyValue('-webkit-grid-definition-columns')", "'1fr 2fr'");
46
shouldBe("getComputedStyle(gridWithFractionFraction, '').getPropertyValue('-webkit-grid-definition-rows')", "'3fr 4fr'");
47
48
var gridWithFractionMinMax = document.getElementById("gridWithFractionMinMax");
49
shouldBe("getComputedStyle(gridWithFractionMinMax, '').getPropertyValue('-webkit-grid-definition-columns')", "'minmax(-webkit-min-content, 45px) 2fr'");
50
shouldBe("getComputedStyle(gridWithFractionMinMax, '').getPropertyValue('-webkit-grid-definition-rows')", "'3fr minmax(14px, -webkit-max-content)'");
51
44
debug("");
52
debug("");
45
debug("Test the initial value");
53
debug("Test the initial value");
46
var element = document.createElement("div");
54
var element = document.createElement("div");
Lines 85-90 element.style.webkitGridDefinitionRows = "minmax(10%, 15%) auto"; a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js_sec2
85
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'160px minmax(16px, 20px)'");
93
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'160px minmax(16px, 20px)'");
86
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'minmax(10%, 15%) auto'");
94
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'minmax(10%, 15%) auto'");
87
95
96
element = document.createElement("div");
97
document.body.appendChild(element);
98
element.style.font = "10px Ahem";
99
element.style.webkitGridDefinitionColumns = "16em 2fr";
100
element.style.webkitGridDefinitionRows = "14fr auto";
101
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'160px 2fr'");
102
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'14fr auto'");
103
88
debug("");
104
debug("");
89
debug("Test getting wrong values set from CSS");
105
debug("Test getting wrong values set from CSS");
90
var gridWithNoneAndAuto = document.getElementById("gridWithNoneAndAuto");
106
var gridWithNoneAndAuto = document.getElementById("gridWithNoneAndAuto");
- a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js -1 / +62 lines
Lines 37-42 var gridWithMaxContent = document.getElementById("gridWithMaxContent"); a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js_sec1
37
shouldBe("getComputedStyle(gridWithMaxContent, '').getPropertyValue('-webkit-grid-definition-columns')", "'-webkit-max-content'");
37
shouldBe("getComputedStyle(gridWithMaxContent, '').getPropertyValue('-webkit-grid-definition-columns')", "'-webkit-max-content'");
38
shouldBe("getComputedStyle(gridWithMaxContent, '').getPropertyValue('-webkit-grid-definition-rows')", "'-webkit-max-content'");
38
shouldBe("getComputedStyle(gridWithMaxContent, '').getPropertyValue('-webkit-grid-definition-rows')", "'-webkit-max-content'");
39
39
40
var gridWithFraction = document.getElementById("gridWithFraction");
41
shouldBe("getComputedStyle(gridWithFraction, '').getPropertyValue('-webkit-grid-definition-columns')", "'1fr'");
42
shouldBe("getComputedStyle(gridWithFraction, '').getPropertyValue('-webkit-grid-definition-rows')", "'2fr'");
43
40
debug("");
44
debug("");
41
debug("Test getting wrong values for -webkit-grid-definition-columns and -webkit-grid-definition-rows through CSS (they should resolve to the default: 'none')");
45
debug("Test getting wrong values for -webkit-grid-definition-columns and -webkit-grid-definition-rows through CSS (they should resolve to the default: 'none')");
42
var gridWithFitContentElement = document.getElementById("gridWithFitContentElement");
46
var gridWithFitContentElement = document.getElementById("gridWithFitContentElement");
Lines 143-150 element.style.webkitGridDefinitionRows = "minmax(-webkit-max-content, -webkit-mi a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js_sec2
143
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'minmax(-webkit-min-content, -webkit-max-content)'");
147
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'minmax(-webkit-min-content, -webkit-max-content)'");
144
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'minmax(-webkit-max-content, -webkit-min-content)'");
148
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'minmax(-webkit-max-content, -webkit-min-content)'");
145
149
150
// Unit comparison should be case-insensitive.
151
element = document.createElement("div");
152
document.body.appendChild(element);
153
element.style.webkitGridDefinitionColumns = "3600Fr";
154
element.style.webkitGridDefinitionRows = "154fR";
155
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'3600fr'");
156
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'154fr'");
157
158
// Float values are allowed.
159
element = document.createElement("div");
160
document.body.appendChild(element);
161
element.style.webkitGridDefinitionColumns = "3.1459fr";
162
element.style.webkitGridDefinitionRows = "2.718fr";
163
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'3.1459fr'");
164
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'2.718fr'");
165
166
// A leading '+' is allowed.
167
element = document.createElement("div");
168
document.body.appendChild(element);
169
element.style.webkitGridDefinitionColumns = "+3fr";
170
element.style.webkitGridDefinitionRows = "+4fr";
171
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'3fr'");
172
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'4fr'");
173
146
debug("");
174
debug("");
147
debug("Test setting grid-definition-columns and grid-definition-rows to bad minmax value through JS");
175
debug("Test setting grid-definition-columns and grid-definition-rows to bad values through JS");
148
element = document.createElement("div");
176
element = document.createElement("div");
149
document.body.appendChild(element);
177
document.body.appendChild(element);
150
// No comma.
178
// No comma.
Lines 191-196 element.style.webkitGridDefinitionRows = "minmax(2vw, -6em)"; a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js_sec3
191
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
219
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
192
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
220
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
193
221
222
element = document.createElement("div");
223
document.body.appendChild(element);
224
element.style.webkitGridDefinitionColumns = "-2fr";
225
element.style.webkitGridDefinitionRows = "3ffr";
226
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
227
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
228
229
element = document.createElement("div");
230
document.body.appendChild(element);
231
element.style.webkitGridDefinitionColumns = "-2.05fr";
232
element.style.webkitGridDefinitionRows = "+-3fr";
233
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
234
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
235
236
element = document.createElement("div");
237
document.body.appendChild(element);
238
element.style.webkitGridDefinitionColumns = "0fr";
239
element.style.webkitGridDefinitionRows = "1r";
240
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
241
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
242
243
element = document.createElement("div");
244
document.body.appendChild(element);
245
element.style.webkitGridDefinitionColumns = ".0000fr";
246
element.style.webkitGridDefinitionRows = "13 fr"; // A dimension doesn't allow spaces between the number and the unit.
247
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
248
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
249
250
element.style.webkitGridDefinitionColumns = "7.-fr";
251
element.style.webkitGridDefinitionRows = "-8,0fr";
252
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-columns')", "'none'");
253
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-definition-rows')", "'none'");
254
194
debug("");
255
debug("");
195
debug("Test setting grid-definition-columns and grid-definition-rows back to 'none' through JS");
256
debug("Test setting grid-definition-columns and grid-definition-rows back to 'none' through JS");
196
element.style.webkitGridDefinitionColumns = "18px";
257
element.style.webkitGridDefinitionColumns = "18px";

Return to Bug 115362