| Differences between
and this patch
- a/Source/WebCore/ChangeLog +59 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-11-16  Julien Chaffraix  <jchaffraix@webkit.org>
2
3
        Add limited parsing support for grid-columns and grid-rows
4
        https://bugs.webkit.org/show_bug.cgi?id=72531
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Test: fast/css-grid-layout/grid-columns-rows-get-set.html
9
10
        Added support for:
11
        <track-list> := <length> | <percentage> | 'none' | 'auto'
12
13
        * WebCore.gypi:
14
        * css/CSSComputedStyleDeclaration.cpp:
15
        (WebCore::valueForGridTrackList):
16
        Helper function to convert our Rendertyle information to a proper CSSValue.
17
        It doesn't do much now but it will be expanded as we add more support.
18
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
19
        * css/CSSComputedStyleDeclaration.h:
20
        * css/CSSParser.cpp:
21
        (WebCore::CSSParser::parseValue):
22
        (WebCore::CSSParser::parseTrackList):
23
        CSS parsing part of this change. Pretty simple for now.
24
        * css/CSSParser.h:
25
        * css/CSSProperty.cpp:
26
        (WebCore::CSSProperty::isInheritedProperty):
27
        * css/CSSPropertyNames.in:
28
        * css/CSSStyleApplyProperty.cpp:
29
        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
30
        * css/CSSStyleSelector.cpp:
31
        (WebCore::CSSStyleSelector::applyProperty):
32
        * rendering/style/RenderStyle.cpp:
33
        (WebCore::RenderStyle::RenderStyle):
34
        (WebCore::RenderStyle::diff):
35
        * rendering/style/RenderStyle.h:
36
        (WebCore::InheritedFlags::gridColumns):
37
        (WebCore::InheritedFlags::gridRows):
38
        (WebCore::InheritedFlags::setGridColumns):
39
        (WebCore::InheritedFlags::setGridRows):
40
        (WebCore::InheritedFlags::initialGridColumns):
41
        (WebCore::InheritedFlags::initialGridRows):
42
        Getters / Setters and initial values.
43
44
        * rendering/style/StyleGridElementData.cpp: Added.
45
        (WebCore::StyleGridElementData::StyleGridElementData):
46
        * rendering/style/StyleGridElementData.h: Added.
47
        (WebCore::StyleGridElementData::create):
48
        (WebCore::StyleGridElementData::copy):
49
        (WebCore::StyleGridElementData::operator==):
50
        (WebCore::StyleGridElementData::operator!=):
51
        This class holds the grid element information. For now pretty simple
52
        shell that will be used for the rest of the support.
53
54
        * rendering/style/StyleRareNonInheritedData.cpp:
55
        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
56
        (WebCore::StyleRareNonInheritedData::operator==):
57
        * rendering/style/StyleRareNonInheritedData.h:
58
        Added StyleGridElementData to StyleRareNonInheritedData.
59
1
2011-11-16  Philip Rogers  <pdr@google.com>
60
2011-11-16  Philip Rogers  <pdr@google.com>
2
61
3
        Remove extra GraphicsContextStateSaver restore() call.
62
        Remove extra GraphicsContextStateSaver restore() call.
- a/Source/WebCore/WebCore.gypi +2 lines
Lines 949-954 a/Source/WebCore/WebCore.gypi_sec1
949
            'rendering/style/StyleFilterData.h',
949
            'rendering/style/StyleFilterData.h',
950
            'rendering/style/StyleFlexibleBoxData.h',
950
            'rendering/style/StyleFlexibleBoxData.h',
951
            'rendering/style/StyleGeneratedImage.h',
951
            'rendering/style/StyleGeneratedImage.h',
952
            'rendering/style/StyleGridElementData.h',
952
            'rendering/style/StyleImage.h',
953
            'rendering/style/StyleImage.h',
953
            'rendering/style/StyleInheritedData.h',
954
            'rendering/style/StyleInheritedData.h',
954
            'rendering/style/StyleMarqueeData.h',
955
            'rendering/style/StyleMarqueeData.h',
Lines 4756-4761 a/Source/WebCore/WebCore.gypi_sec2
4756
            'rendering/style/StyleFilterData.cpp',
4757
            'rendering/style/StyleFilterData.cpp',
4757
            'rendering/style/StyleFlexibleBoxData.cpp',
4758
            'rendering/style/StyleFlexibleBoxData.cpp',
4758
            'rendering/style/StyleGeneratedImage.cpp',
4759
            'rendering/style/StyleGeneratedImage.cpp',
4760
            'rendering/style/StyleGridElementData.cpp',
4759
            'rendering/style/StyleInheritedData.cpp',
4761
            'rendering/style/StyleInheritedData.cpp',
4760
            'rendering/style/StyleMarqueeData.cpp',
4762
            'rendering/style/StyleMarqueeData.cpp',
4761
            'rendering/style/StyleMultiColData.cpp',
4763
            'rendering/style/StyleMultiColData.cpp',
- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +27 lines
Lines 218-223 static const int computedProperties[] = { a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec1
218
    CSSPropertyWebkitFlexAlign,
218
    CSSPropertyWebkitFlexAlign,
219
    CSSPropertyWebkitFlexFlow,
219
    CSSPropertyWebkitFlexFlow,
220
    CSSPropertyWebkitFontSmoothing,
220
    CSSPropertyWebkitFontSmoothing,
221
#if ENABLE(CSS_GRID_LAYOUT)
222
    CSSPropertyWebkitGridColumns,
223
    CSSPropertyWebkitGridRows,
224
#endif
221
    CSSPropertyWebkitHighlight,
225
    CSSPropertyWebkitHighlight,
222
    CSSPropertyWebkitHyphenateCharacter,
226
    CSSPropertyWebkitHyphenateCharacter,
223
    CSSPropertyWebkitHyphenateLimitAfter,
227
    CSSPropertyWebkitHyphenateLimitAfter,
Lines 766-771 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(RenderStyle* st a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec2
766
}
770
}
767
#endif
771
#endif
768
772
773
#if ENABLE(CSS_GRID_LAYOUT)
774
static PassRefPtr<CSSValue> valueForGridTrackList(const Length& trackLength, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
775
{
776
    if (trackLength.isPercent())
777
        return primitiveValueCache->createValue(trackLength);
778
    if (trackLength.isAuto())
779
        return primitiveValueCache->createIdentifierValue(CSSValueAuto);
780
    if (trackLength.isUndefined())
781
        return primitiveValueCache->createIdentifierValue(CSSValueNone);
782
    return zoomAdjustedPixelValue(trackLength.value(), style, primitiveValueCache);
783
}
784
#endif
785
769
static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList, CSSPrimitiveValueCache* primitiveValueCache)
786
static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList, CSSPrimitiveValueCache* primitiveValueCache)
770
{
787
{
771
    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
788
    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
Lines 1473-1478 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec3
1473
            }
1490
            }
1474
            return list.release();
1491
            return list.release();
1475
        }
1492
        }
1493
#if ENABLE(CSS_GRID_LAYOUT)
1494
        case CSSPropertyWebkitGridColumns: {
1495
            Length gridColumns = style->gridColumns();
1496
            return valueForGridTrackList(gridColumns, style.get(), primitiveValueCache);
1497
        }
1498
        case CSSPropertyWebkitGridRows: {
1499
            Length gridRows = style->gridRows();
1500
            return valueForGridTrackList(gridRows, style.get(), primitiveValueCache);
1501
        }
1502
#endif
1476
        case CSSPropertyHeight:
1503
        case CSSPropertyHeight:
1477
            if (renderer)
1504
            if (renderer)
1478
                return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get(), primitiveValueCache);
1505
                return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get(), primitiveValueCache);
- a/Source/WebCore/css/CSSComputedStyleDeclaration.h +2 lines
Lines 31-36 namespace WebCore { a/Source/WebCore/css/CSSComputedStyleDeclaration.h_sec1
31
class Color;
31
class Color;
32
class CSSMutableStyleDeclaration;
32
class CSSMutableStyleDeclaration;
33
class CSSPrimitiveValue;
33
class CSSPrimitiveValue;
34
class CSSPrimitiveValueCache;
35
class Length;
34
class Node;
36
class Node;
35
class RenderStyle;
37
class RenderStyle;
36
class ShadowData;
38
class ShadowData;
- a/Source/WebCore/css/CSSParser.cpp +22 lines
Lines 1770-1775 bool CSSParser::parseValue(int propId, bool important) a/Source/WebCore/css/CSSParser.cpp_sec1
1770
        }
1770
        }
1771
        return false;
1771
        return false;
1772
    }
1772
    }
1773
#if ENABLE(CSS_GRID_LAYOUT)
1774
    case CSSPropertyWebkitGridColumns:
1775
    case CSSPropertyWebkitGridRows:
1776
        return parseTrackList(propId, important);
1777
#endif
1773
    case CSSPropertyWebkitMarginCollapse: {
1778
    case CSSPropertyWebkitMarginCollapse: {
1774
        const int properties[2] = { CSSPropertyWebkitMarginBeforeCollapse,
1779
        const int properties[2] = { CSSPropertyWebkitMarginBeforeCollapse,
1775
            CSSPropertyWebkitMarginAfterCollapse };
1780
            CSSPropertyWebkitMarginAfterCollapse };
Lines 3497-3502 bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result) a/Source/WebCore/css/CSSParser.cpp_sec2
3497
    return false;
3502
    return false;
3498
}
3503
}
3499
3504
3505
#if ENABLE(CSS_GRID_LAYOUT)
3506
bool CSSParser::parseTrackList(int propId, bool important)
3507
{
3508
    CSSParserValue* value = m_valueList->current();
3509
    if (value->id == CSSValueNone || value->id == CSSValueAuto) {
3510
        addProperty(propId, primitiveValueCache()->createIdentifierValue(value->id), important);
3511
        return true;
3512
    }
3513
3514
    if (validUnit(value, FLength | FPercent, m_strict)) {
3515
        addProperty(propId, createPrimitiveNumericValue(value), important);
3516
        return true;
3517
    }
3518
    return false;
3519
}
3520
#endif
3521
3500
3522
3501
3523
3502
#if ENABLE(DASHBOARD_SUPPORT)
3524
#if ENABLE(DASHBOARD_SUPPORT)
- a/Source/WebCore/css/CSSParser.h +4 lines
Lines 125-130 public: a/Source/WebCore/css/CSSParser.h_sec1
125
    bool parseTransitionShorthand(bool important);
125
    bool parseTransitionShorthand(bool important);
126
    bool parseAnimationShorthand(bool important);
126
    bool parseAnimationShorthand(bool important);
127
127
128
#if ENABLE(CSS_GRID_LAYOUT)
129
    bool parseTrackList(int propId, bool important);
130
#endif
131
128
    bool parseDashboardRegions(int propId, bool important);
132
    bool parseDashboardRegions(int propId, bool important);
129
133
130
    bool parseShape(int propId, bool important);
134
    bool parseShape(int propId, bool important);
- a/Source/WebCore/css/CSSProperty.cpp +4 lines
Lines 566-571 bool CSSProperty::isInheritedProperty(unsigned propertyID) a/Source/WebCore/css/CSSProperty.cpp_sec1
566
    case CSSPropertyWebkitFlexAlign:
566
    case CSSPropertyWebkitFlexAlign:
567
    case CSSPropertyWebkitFlexFlow:
567
    case CSSPropertyWebkitFlexFlow:
568
    case CSSPropertyWebkitFontSizeDelta:
568
    case CSSPropertyWebkitFontSizeDelta:
569
#if ENABLE(CSS_GRID_LAYOUT)
570
    case CSSPropertyWebkitGridColumns:
571
    case CSSPropertyWebkitGridRows:
572
#endif
569
    case CSSPropertyWebkitLineClamp:
573
    case CSSPropertyWebkitLineClamp:
570
    case CSSPropertyWebkitLogicalWidth:
574
    case CSSPropertyWebkitLogicalWidth:
571
    case CSSPropertyWebkitLogicalHeight:
575
    case CSSPropertyWebkitLogicalHeight:
- a/Source/WebCore/css/CSSPropertyNames.in -1 / +4 lines
Lines 361-364 z-index a/Source/WebCore/css/CSSPropertyNames.in_sec1
361
#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
361
#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
362
-webkit-tap-highlight-color
362
-webkit-tap-highlight-color
363
#endif
363
#endif
364
364
#if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
365
-webkit-grid-columns
366
-webkit-grid-rows
367
#endif
- a/Source/WebCore/css/CSSStyleApplyProperty.cpp +5 lines
Lines 980-985 CSSStyleApplyProperty::CSSStyleApplyProperty() a/Source/WebCore/css/CSSStyleApplyProperty.cpp_sec1
980
    setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
980
    setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
981
    setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
981
    setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
982
982
983
#if ENABLE(CSS_GRID_LAYOUT)
984
    setPropertyHandler(CSSPropertyWebkitGridColumns, ApplyPropertyLength<&RenderStyle::gridColumns, &RenderStyle::setGridColumns, &RenderStyle::initialGridColumns, AutoEnabled, IntrinsicDisabled, MinIntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
985
    setPropertyHandler(CSSPropertyWebkitGridRows, ApplyPropertyLength<&RenderStyle::gridRows, &RenderStyle::setGridRows, &RenderStyle::initialGridRows, AutoEnabled, IntrinsicDisabled, MinIntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
986
#endif
987
983
    setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>::createHandler());
988
    setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>::createHandler());
984
    setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>::createHandler());
989
    setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>::createHandler());
985
990
- a/Source/WebCore/css/CSSStyleSelector.cpp +4 lines
Lines 3965-3970 void CSSStyleSelector::applyProperty(int id, CSSValue *value) a/Source/WebCore/css/CSSStyleSelector.cpp_sec1
3965
    case CSSPropertyWebkitFlexFlow:
3965
    case CSSPropertyWebkitFlexFlow:
3966
    case CSSPropertyFontStyle:
3966
    case CSSPropertyFontStyle:
3967
    case CSSPropertyFontVariant:
3967
    case CSSPropertyFontVariant:
3968
#if ENABLE(CSS_GRID_LAYOUT)
3969
    case CSSPropertyWebkitGridColumns:
3970
    case CSSPropertyWebkitGridRows:
3971
#endif
3968
    case CSSPropertyTextRendering:
3972
    case CSSPropertyTextRendering:
3969
    case CSSPropertyWebkitTextOrientation:
3973
    case CSSPropertyWebkitTextOrientation:
3970
    case CSSPropertyWebkitFontSmoothing:
3974
    case CSSPropertyWebkitFontSmoothing:
- a/Source/WebCore/rendering/style/RenderStyle.cpp +7 lines
Lines 133-138 ALWAYS_INLINE RenderStyle::RenderStyle(bool) a/Source/WebCore/rendering/style/RenderStyle.cpp_sec1
133
#if ENABLE(CSS_FILTERS)
133
#if ENABLE(CSS_FILTERS)
134
    rareNonInheritedData.access()->m_filter.init();
134
    rareNonInheritedData.access()->m_filter.init();
135
#endif
135
#endif
136
#if ENABLE(CSS_GRID_LAYOUT)
137
    rareNonInheritedData.access()->m_gridLayout.init();
138
#endif
136
    rareInheritedData.init();
139
    rareInheritedData.init();
137
    inherited.init();
140
    inherited.init();
138
141
Lines 420-425 StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon a/Source/WebCore/rendering/style/RenderStyle.cpp_sec2
420
            return StyleDifferenceLayout;
423
            return StyleDifferenceLayout;
421
        }
424
        }
422
#endif
425
#endif
426
#if ENABLE(CSS_GRID_LAYOUT)
427
        if (rareNonInheritedData->m_gridLayout.get() != other->rareNonInheritedData->m_gridLayout.get())
428
            return StyleDifferenceLayout;
429
#endif
423
430
424
#if !USE(ACCELERATED_COMPOSITING)
431
#if !USE(ACCELERATED_COMPOSITING)
425
        if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {
432
        if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {
- a/Source/WebCore/rendering/style/RenderStyle.h +18 lines
Lines 56-61 a/Source/WebCore/rendering/style/RenderStyle.h_sec1
56
#include "StyleFilterData.h"
56
#include "StyleFilterData.h"
57
#endif
57
#endif
58
#include "StyleFlexibleBoxData.h"
58
#include "StyleFlexibleBoxData.h"
59
#if ENABLE(CSS_GRID_LAYOUT)
60
#include "StyleGridElementData.h"
61
#endif
59
#include "StyleInheritedData.h"
62
#include "StyleInheritedData.h"
60
#include "StyleMarqueeData.h"
63
#include "StyleMarqueeData.h"
61
#include "StyleMultiColData.h"
64
#include "StyleMultiColData.h"
Lines 719-724 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec2
719
    EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); }
722
    EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); }
720
    EFlexFlow flexFlow() const { return static_cast<EFlexFlow>(rareNonInheritedData->m_flexibleBox->m_flexFlow); }
723
    EFlexFlow flexFlow() const { return static_cast<EFlexFlow>(rareNonInheritedData->m_flexibleBox->m_flexFlow); }
721
724
725
#if ENABLE(CSS_GRID_LAYOUT)
726
    Length gridColumns() const { return rareNonInheritedData->m_gridLayout->m_gridColumns; }
727
    Length gridRows() const { return rareNonInheritedData->m_gridLayout->m_gridRows; }
728
#endif
729
722
    const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
730
    const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
723
    void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
731
    void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
724
    void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
732
    void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
Lines 1125-1130 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec3
1125
    void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); }
1133
    void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); }
1126
    void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); }
1134
    void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); }
1127
    void setFlexFlow(EFlexFlow flow) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexFlow, flow); }
1135
    void setFlexFlow(EFlexFlow flow) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexFlow, flow); }
1136
#if ENABLE(CSS_GRID_LAYOUT)
1137
    void setGridColumns(Length length) { SET_VAR(rareNonInheritedData.access()->m_gridLayout, m_gridColumns, length); }
1138
    void setGridRows(Length length) { SET_VAR(rareNonInheritedData.access()->m_gridLayout, m_gridRows, length); }
1139
#endif
1140
1128
    void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
1141
    void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
1129
    void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
1142
    void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
1130
    void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
1143
    void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
Lines 1475-1480 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec4
1475
    static StyleImage* initialMaskBoxImageSource() { return 0; }
1488
    static StyleImage* initialMaskBoxImageSource() { return 0; }
1476
    static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
1489
    static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
1477
1490
1491
#if ENABLE(CSS_GRID_LAYOUT)
1492
    static Length initialGridColumns() { return Length(Undefined); }
1493
    static Length initialGridRows() { return Length(Undefined); }
1494
#endif
1495
1478
    static const AtomicString& initialLineGrid() { return nullAtom; }
1496
    static const AtomicString& initialLineGrid() { return nullAtom; }
1479
    static LineGridSnap initialLineGridSnap() { return LineGridSnapNone; }
1497
    static LineGridSnap initialLineGridSnap() { return LineGridSnapNone; }
1480
1498
- a/Source/WebCore/rendering/style/StyleGridElementData.cpp +50 lines
Line 0 a/Source/WebCore/rendering/style/StyleGridElementData.cpp_sec1
1
/*
2
 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 *  THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14
 *  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
 *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
 *  DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17
 *  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
 *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
 *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 *
24
 */
25
26
#include "config.h"
27
#include "StyleGridElementData.h"
28
29
#if ENABLE(CSS_GRID_LAYOUT)
30
31
#include "RenderStyle.h"
32
33
namespace WebCore {
34
35
StyleGridElementData::StyleGridElementData()
36
    : m_gridColumns(RenderStyle::initialGridColumns())
37
    , m_gridRows(RenderStyle::initialGridRows())
38
{
39
}
40
41
StyleGridElementData::StyleGridElementData(const StyleGridElementData& o)
42
    : m_gridColumns(o.m_gridColumns)
43
    , m_gridRows(o.m_gridRows)
44
{
45
}
46
47
} // namespace WebCore
48
49
#endif // ENABLE(CSS_GRID_LAYOUT)
50
- a/Source/WebCore/rendering/style/StyleGridElementData.h +66 lines
Line 0 a/Source/WebCore/rendering/style/StyleGridElementData.h_sec1
1
/*
2
 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 *  THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14
 *  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
 *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
 *  DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17
 *  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
 *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
 *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 *
24
 */
25
26
#ifndef StyleGridElementData_h
27
#define StyleGridElementData_h
28
29
#if ENABLE(CSS_GRID_LAYOUT)
30
31
#include "Length.h"
32
#include "PassRefPtr.h"
33
#include "RefCounted.h"
34
35
namespace WebCore {
36
37
class StyleGridElementData : public RefCounted<StyleGridElementData> {
38
public:
39
    static PassRefPtr<StyleGridElementData> create() { return adoptRef(new StyleGridElementData); }
40
    PassRefPtr<StyleGridElementData> copy() const { return adoptRef(new StyleGridElementData(*this)); }
41
42
    bool operator==(const StyleGridElementData& o) const
43
    {
44
        return m_gridColumns == o.m_gridColumns && m_gridRows == o.m_gridRows;
45
    }
46
47
    bool operator!=(const StyleGridElementData& o) const
48
    {
49
        return !(*this == o);
50
    }
51
52
    // FIXME: For the moment, we only support a subset of the grammar which correspond to:
53
    // 'auto' | <length> | <percentage> | 'none'
54
    Length m_gridColumns;
55
    Length m_gridRows;
56
57
private:
58
    StyleGridElementData();
59
    StyleGridElementData(const StyleGridElementData&);
60
};
61
62
} // namespace WebCore
63
64
#endif // ENABLE(CSS_LAYOUT_GRID)
65
66
#endif // StyleGridElementData_h
- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp +6 lines
Lines 86-91 StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp_sec1
86
#if ENABLE(CSS_FILTERS)
86
#if ENABLE(CSS_FILTERS)
87
    , m_filter(o.m_filter)
87
    , m_filter(o.m_filter)
88
#endif
88
#endif
89
#if ENABLE(CSS_GRID_LAYOUT)
90
    , m_gridLayout(o.m_gridLayout)
91
#endif
89
    , m_content(o.m_content ? o.m_content->clone() : nullptr)
92
    , m_content(o.m_content ? o.m_content->clone() : nullptr)
90
    , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
93
    , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
91
    , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)
94
    , m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)
Lines 144-149 bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp_sec2
144
#if ENABLE(CSS_FILTERS)
147
#if ENABLE(CSS_FILTERS)
145
        && m_filter == o.m_filter
148
        && m_filter == o.m_filter
146
#endif
149
#endif
150
#if ENABLE(CSS_GRID_LAYOUT)
151
        && m_gridLayout == o.m_gridLayout
152
#endif
147
        && contentDataEquivalent(o)
153
        && contentDataEquivalent(o)
148
        && counterDataEquivalent(o)
154
        && counterDataEquivalent(o)
149
        && userDrag == o.userDrag
155
        && userDrag == o.userDrag
- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h +7 lines
Lines 46-51 class StyleDeprecatedFlexibleBoxData; a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h_sec1
46
class StyleFilterData;
46
class StyleFilterData;
47
#endif
47
#endif
48
class StyleFlexibleBoxData;
48
class StyleFlexibleBoxData;
49
#if ENABLE(CSS_GRID_LAYOUT)
50
class StyleGridElementData;
51
#endif
49
class StyleMarqueeData;
52
class StyleMarqueeData;
50
class StyleMultiColData;
53
class StyleMultiColData;
51
class StyleReflection;
54
class StyleReflection;
Lines 111-116 public: a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h_sec2
111
    DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
114
    DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
112
#endif
115
#endif
113
116
117
#if ENABLE(CSS_GRID_LAYOUT)
118
    DataRef<StyleGridElementData> m_gridLayout;
119
#endif
120
114
    OwnPtr<ContentData> m_content;
121
    OwnPtr<ContentData> m_content;
115
    OwnPtr<CounterDirectiveMap> m_counterDirectives;
122
    OwnPtr<CounterDirectiveMap> m_counterDirectives;
116
123
- a/LayoutTests/ChangeLog +13 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-11-16  Julien Chaffraix  <jchaffraix@webkit.org>
2
3
        Add limited parsing support for grid-columns and grid-rows
4
        https://bugs.webkit.org/show_bug.cgi?id=72531
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Test our currently supported grammar.
9
10
        * fast/css-grid-layout/grid-columns-rows-get-set.html: Added.
11
        * fast/css-grid-layout/resources/grid-columns-rows-get-set.js: Added.
12
        * fast/css-grid-layout/grid-columns-rows-get-set-expected.txt: Added.
13
1
2011-11-16  Adam Barth  <abarth@webkit.org>
14
2011-11-16  Adam Barth  <abarth@webkit.org>
2
15
3
        Update test results after tightening up SecurityOrigin logic in
16
        Update test results after tightening up SecurityOrigin logic in
- a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt +32 lines
Line 0 a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set-expected.txt_sec1
1
Test that setting and getting grid-columns and grid-rows works as expected
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Test getting |display| set through CSS
7
PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-columns') is 'none'
8
PASS getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-rows') is 'none'
9
PASS getComputedStyle(gridWithFixedElement, '').getPropertyValue('-webkit-grid-columns') is '10px'
10
PASS getComputedStyle(gridWithFixedElement, '').getPropertyValue('-webkit-grid-rows') is '15px'
11
PASS getComputedStyle(gridWithPercentElement, '').getPropertyValue('-webkit-grid-columns') is '53%'
12
PASS getComputedStyle(gridWithPercentElement, '').getPropertyValue('-webkit-grid-rows') is '27%'
13
PASS getComputedStyle(gridWithAutoElement, '').getPropertyValue('-webkit-grid-columns') is 'auto'
14
PASS getComputedStyle(gridWithAutoElement, '').getPropertyValue('-webkit-grid-rows') is 'auto'
15
PASS getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-columns') is '160px'
16
PASS getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-rows') is '240px'
17
18
Test the initial value
19
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'none'
20
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'none'
21
22
Test getting and setting display through JS
23
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is '18px'
24
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is '66px'
25
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is '55%'
26
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is '40%'
27
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns') is 'auto'
28
PASS getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows') is 'auto'
29
PASS successfullyParsed is true
30
31
TEST COMPLETE
32
- a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html +42 lines
Line 0 a/LayoutTests/fast/css-grid-layout/grid-columns-rows-get-set.html_sec1
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<style>
5
.grid {
6
    display: -webkit-grid;
7
    -webkit-grid-columns: none;
8
    -webkit-grid-rows: none;
9
}
10
.gridWithFixed {
11
    display: -webkit-grid;
12
    -webkit-grid-columns: 10px;
13
    -webkit-grid-rows: 15px;
14
}
15
.gridWithPercent {
16
    display: -webkit-grid;
17
    -webkit-grid-columns: 53%;
18
    -webkit-grid-rows: 27%;
19
}
20
.gridWithAuto {
21
    display: -webkit-grid;
22
    -webkit-grid-columns: auto;
23
    -webkit-grid-rows: auto;
24
}
25
.gridWithEM {
26
    display: -webkit-grid;
27
    -webkit-grid-columns: 10em;
28
    -webkit-grid-rows: 15em;
29
}
30
</style>
31
<script src="../js/resources/js-test-pre.js"></script>
32
</head>
33
<body>
34
<div class="grid" id="gridElement"></div>
35
<div class="gridWithFixed" id="gridWithFixedElement"></div>
36
<div class="gridWithPercent" id="gridWithPercentElement"></div>
37
<div class="gridWithAuto" id="gridWithAutoElement"></div>
38
<div class="gridWithEM" id="gridWithEMElement"></div>
39
<script src="resources/grid-columns-rows-get-set.js"></script>
40
<script src="../js/resources/js-test-post.js"></script>
41
</body>
42
</html>
- a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js +50 lines
Line 0 a/LayoutTests/fast/css-grid-layout/resources/grid-columns-rows-get-set.js_sec1
1
description('Test that setting and getting grid-columns and grid-rows works as expected');
2
3
debug("Test getting |display| set through CSS");
4
var gridElement = document.getElementById("gridElement");
5
shouldBe("getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-columns')", "'none'");
6
shouldBe("getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-rows')", "'none'");
7
8
var gridWithFixedElement = document.getElementById("gridWithFixedElement");
9
shouldBe("getComputedStyle(gridWithFixedElement, '').getPropertyValue('-webkit-grid-columns')", "'10px'");
10
shouldBe("getComputedStyle(gridWithFixedElement, '').getPropertyValue('-webkit-grid-rows')", "'15px'");
11
12
var gridWithPercentElement = document.getElementById("gridWithPercentElement");
13
shouldBe("getComputedStyle(gridWithPercentElement, '').getPropertyValue('-webkit-grid-columns')", "'53%'");
14
shouldBe("getComputedStyle(gridWithPercentElement, '').getPropertyValue('-webkit-grid-rows')", "'27%'");
15
16
var gridWithAutoElement = document.getElementById("gridWithAutoElement");
17
shouldBe("getComputedStyle(gridWithAutoElement, '').getPropertyValue('-webkit-grid-columns')", "'auto'");
18
shouldBe("getComputedStyle(gridWithAutoElement, '').getPropertyValue('-webkit-grid-rows')", "'auto'");
19
20
var gridWithEMElement = document.getElementById("gridWithEMElement");
21
shouldBe("getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-columns')", "'160px'");
22
shouldBe("getComputedStyle(gridWithEMElement, '').getPropertyValue('-webkit-grid-rows')", "'240px'");
23
24
debug("");
25
debug("Test the initial value");
26
var element = document.createElement("div");
27
document.body.appendChild(element);
28
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'none'");
29
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'none'");
30
31
debug("");
32
debug("Test getting and setting display through JS");
33
element.style.webkitGridColumns = "18px";
34
element.style.webkitGridRows = "66px";
35
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'18px'");
36
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'66px'");
37
38
element = document.createElement("div");
39
document.body.appendChild(element);
40
element.style.webkitGridColumns = "55%";
41
element.style.webkitGridRows = "40%";
42
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'55%'");
43
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'40%'");
44
45
element = document.createElement("div");
46
document.body.appendChild(element);
47
element.style.webkitGridColumns = "auto";
48
element.style.webkitGridRows = "auto";
49
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-columns')", "'auto'");
50
shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-rows')", "'auto'");

Return to Bug 72531