[CSS Box Alignment] Unifying alignment data in a single class
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Apr 2015 00:12:25 +0000 (00:12 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Apr 2015 00:12:25 +0000 (00:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144384

Reviewed by David Hyatt.

The new CSS Box Alignment specification introduces more complex
values and syntax for defining alignment properties. Most of the
alignment values were just keyword identifiers, but the new syntax
allows different combinations of identifiers to determine the
alignment behavior (eg. overflow-alignment keyword).

This patch wll help to implement later overflow handling and
specially Content Dstribution alignment, the most complex case by
far. It will be more consistent against style changes and repaint,
snce we will have just one field to monitoring for value
modfications.

No new tests, because no new functionality was added; it's just a
code refactoring which is just expected to pass current tests.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::resolveSelfAlignmentAuto):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSPropertyNames.in:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
(WebCore::StyleBuilderConverter::convertSVGColor): Deleted.
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInitialWebkitMaskImage): Deleted.
(WebCore::StyleBuilderCustom::applyInheritWebkitMaskImage): Deleted.
(WebCore::ApplyPropertyBorderImageModifier::applyInheritValue): Deleted.
(WebCore::ApplyPropertyBorderImageModifier::applyInitialValue): Deleted.
(WebCore::ApplyPropertyBorderImageModifier::applyValue): Deleted.
(WebCore::ApplyPropertyBorderImageModifier::getValue): Deleted.
(WebCore::ApplyPropertyBorderImageModifier::setValue): Deleted.
(WebCore::StyleBuilderCustom::applyInheritLineHeight): Deleted.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::createElementRenderer):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::styleDidChange):
* rendering/RenderFullScreen.cpp:
(WebCore::createFullScreenStyle):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::adjustInnerStyle):
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::updateStyle):
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair):
(WebCore::RenderMathMLScripts::fixAnonymousStyles):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::resolveAlignment):
(WebCore::RenderStyle::resolveJustification):
* rendering/style/RenderStyle.h:
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
(WebCore::StyleRareNonInheritedData::contentDataEquivalent): Deleted.
* rendering/style/StyleRareNonInheritedData.h:
* rendering/style/StyleSelfAlignmentData.h: Added.
(WebCore::StyleSelfAlignmentData::StyleSelfAlignmentData):
(WebCore::StyleSelfAlignmentData::setPosition):
(WebCore::StyleSelfAlignmentData::setPositionType):
(WebCore::StyleSelfAlignmentData::setOverflow):
(WebCore::StyleSelfAlignmentData::position):
(WebCore::StyleSelfAlignmentData::positionType):
(WebCore::StyleSelfAlignmentData::overflow):
(WebCore::StyleSelfAlignmentData::operator==):
(WebCore::StyleSelfAlignmentData::operator!=):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183591 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/mathml/MathMLTextElement.cpp
Source/WebCore/rendering/RenderFlexibleBox.cpp
Source/WebCore/rendering/RenderFullScreen.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h
Source/WebCore/rendering/style/StyleSelfAlignmentData.h [new file with mode: 0644]

index 7b5a81d..ab9f151 100644 (file)
@@ -1,3 +1,76 @@
+2015-04-29  Javier Fernandez  <jfernandez@igalia.com>
+
+        [CSS Box Alignment] Unifying alignment data in a single class
+        https://bugs.webkit.org/show_bug.cgi?id=144384
+
+        Reviewed by David Hyatt.
+
+        The new CSS Box Alignment specification introduces more complex
+        values and syntax for defining alignment properties. Most of the
+        alignment values were just keyword identifiers, but the new syntax
+        allows different combinations of identifiers to determine the
+        alignment behavior (eg. overflow-alignment keyword).
+
+        This patch wll help to implement later overflow handling and
+        specially Content Dstribution alignment, the most complex case by
+        far. It will be more consistent against style changes and repaint,
+        snce we will have just one field to monitoring for value
+        modfications.
+
+        No new tests, because no new functionality was added; it's just a
+        code refactoring which is just expected to pass current tests.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::resolveSelfAlignmentAuto):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSPropertyNames.in:
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
+        (WebCore::StyleBuilderConverter::convertSVGColor): Deleted.
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyInitialWebkitMaskImage): Deleted.
+        (WebCore::StyleBuilderCustom::applyInheritWebkitMaskImage): Deleted.
+        (WebCore::ApplyPropertyBorderImageModifier::applyInheritValue): Deleted.
+        (WebCore::ApplyPropertyBorderImageModifier::applyInitialValue): Deleted.
+        (WebCore::ApplyPropertyBorderImageModifier::applyValue): Deleted.
+        (WebCore::ApplyPropertyBorderImageModifier::getValue): Deleted.
+        (WebCore::ApplyPropertyBorderImageModifier::setValue): Deleted.
+        (WebCore::StyleBuilderCustom::applyInheritLineHeight): Deleted.
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        * mathml/MathMLTextElement.cpp:
+        (WebCore::MathMLTextElement::createElementRenderer):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::styleDidChange):
+        * rendering/RenderFullScreen.cpp:
+        (WebCore::createFullScreenStyle):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::adjustInnerStyle):
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::updateStyle):
+        * rendering/mathml/RenderMathMLScripts.cpp:
+        (WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair):
+        (WebCore::RenderMathMLScripts::fixAnonymousStyles):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::resolveAlignment):
+        (WebCore::RenderStyle::resolveJustification):
+        * rendering/style/RenderStyle.h:
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        (WebCore::StyleRareNonInheritedData::contentDataEquivalent): Deleted.
+        * rendering/style/StyleRareNonInheritedData.h:
+        * rendering/style/StyleSelfAlignmentData.h: Added.
+        (WebCore::StyleSelfAlignmentData::StyleSelfAlignmentData):
+        (WebCore::StyleSelfAlignmentData::setPosition):
+        (WebCore::StyleSelfAlignmentData::setPositionType):
+        (WebCore::StyleSelfAlignmentData::setOverflow):
+        (WebCore::StyleSelfAlignmentData::position):
+        (WebCore::StyleSelfAlignmentData::positionType):
+        (WebCore::StyleSelfAlignmentData::overflow):
+        (WebCore::StyleSelfAlignmentData::operator==):
+        (WebCore::StyleSelfAlignmentData::operator!=):
+
 2015-04-29  Joseph Pecoraro  <pecoraro@apple.com>
 
         NodeList has issues with Symbol and empty string
index b6df042..7cbe785 100644 (file)
                9BD8A95A18BEFC7600987E9A /* CollectionIndexCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD8A95918BEFC7600987E9A /* CollectionIndexCache.cpp */; };
                9BF9A8801648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */; };
                9BF9A8811648DD2F001C6B23 /* JSHTMLFormControlsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */; };
+               9D6380101AF173220031A15C /* StyleSelfAlignmentData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304C11184B4100AD0126 /* ScriptProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9FA37EE41172FC8000C4CD55 /* ScriptProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EE31172FC8000C4CD55 /* ScriptProfileNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37EF61172FD9300C4CD55 /* JSScriptProfile.cpp */; };
                9BD8A95918BEFC7600987E9A /* CollectionIndexCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CollectionIndexCache.cpp; sourceTree = "<group>"; };
                9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollection.cpp; sourceTree = "<group>"; };
                9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLFormControlsCollection.h; sourceTree = "<group>"; };
+               9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleSelfAlignmentData.h; path = style/StyleSelfAlignmentData.h; sourceTree = "<group>"; };
                9F72304C11184B4100AD0126 /* ScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfile.h; sourceTree = "<group>"; };
                9FA37EE31172FC8000C4CD55 /* ScriptProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfileNode.h; sourceTree = "<group>"; };
                9FA37EEF1172FD4100C4CD55 /* ScriptProfile.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScriptProfile.idl; sourceTree = "<group>"; };
                BC8C8FAA0DDCD2F200B592F4 /* style */ = {
                        isa = PBXGroup;
                        children = (
+                               9D63800F1AF16E160031A15C /* StyleSelfAlignmentData.h */,
                                FBD6AF8215EF21A3008B7110 /* BasicShapes.cpp */,
                                FBD6AF8315EF21A3008B7110 /* BasicShapes.h */,
                                BC5EB5E00E81BE8700B25965 /* BorderData.h */,
                                CE1252371A15BDBE00864480 /* CoreGraphicsSPI.h in Headers */,
                                443818001A91B2F8006E04F2 /* CoreMediaSoftLink.h in Headers */,
                                7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */,
+                               9D6380101AF173220031A15C /* StyleSelfAlignmentData.h in Headers */,
                                4449A4051A964B0000B64AD5 /* CoreMediaSPI.h in Headers */,
                                1C6466251A12C38E0094603C /* CoreTextSPI.h in Headers */,
                                862F129E18C1576F005C54AF /* CountedUserActivity.h in Headers */,
index 98ea7f7..2f705a6 100644 (file)
@@ -1728,7 +1728,7 @@ static ItemPosition resolveSelfAlignmentAuto(ItemPosition position, OverflowAlig
         return ItemPositionStart;
 
     overflow = parent->style().alignItemsOverflowAlignment();
-    return resolveContainerAlignmentAuto(parent->style().alignItems(), parent);
+    return resolveContainerAlignmentAuto(parent->style().alignItemsPosition(), parent);
 }
 
 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
@@ -2186,10 +2186,10 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         case CSSPropertyAlignContent:
             return cssValuePool().createValue(style->alignContent());
         case CSSPropertyAlignItems:
-            return valueForItemPositionWithOverflowAlignment(resolveContainerAlignmentAuto(style->alignItems(), renderer), style->alignItemsOverflowAlignment(), NonLegacyPosition);
+            return valueForItemPositionWithOverflowAlignment(resolveContainerAlignmentAuto(style->alignItemsPosition(), renderer), style->alignItemsOverflowAlignment(), NonLegacyPosition);
         case CSSPropertyAlignSelf: {
             OverflowAlignment overflow = style->alignSelfOverflowAlignment();
-            ItemPosition alignSelf = resolveSelfAlignmentAuto(style->alignSelf(), overflow, renderer);
+            ItemPosition alignSelf = resolveSelfAlignmentAuto(style->alignSelfPosition(), overflow, renderer);
             return valueForItemPositionWithOverflowAlignment(alignSelf, overflow, NonLegacyPosition);
         }
         case CSSPropertyFlex:
@@ -2209,10 +2209,10 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
         case CSSPropertyJustifyContent:
             return cssValuePool().createValue(style->justifyContent());
         case CSSPropertyJustifyItems:
-            return valueForItemPositionWithOverflowAlignment(resolveContainerAlignmentAuto(style->justifyItems(), renderer), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType());
+            return valueForItemPositionWithOverflowAlignment(resolveContainerAlignmentAuto(style->justifyItemsPosition(), renderer), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType());
         case CSSPropertyJustifySelf: {
             OverflowAlignment overflow = style->justifySelfOverflowAlignment();
-            ItemPosition justifySelf = resolveSelfAlignmentAuto(style->justifySelf(), overflow, renderer);
+            ItemPosition justifySelf = resolveSelfAlignmentAuto(style->justifySelfPosition(), overflow, renderer);
             return valueForItemPositionWithOverflowAlignment(justifySelf, overflow, NonLegacyPosition);
         }
         case CSSPropertyOrder:
index 0536de3..28b28a9 100644 (file)
@@ -455,9 +455,9 @@ isolation
 -webkit-filter [ConditionalConverter=FilterOperations]
 align-content
 -webkit-align-content = align-content
-align-items [Custom=All]
+align-items [Initial=initialSelfAlignment, Converter=SelfOrDefaultAlignmentData]
 -webkit-align-items = align-items
-align-self [Custom=All]
+align-self [Initial=initialSelfAlignment, Converter=SelfOrDefaultAlignmentData]
 -webkit-align-self = align-self
 flex [Longhands=flex-grow|flex-shrink|flex-basis]
 -webkit-flex = flex
@@ -478,9 +478,9 @@ justify-content
 #if defined(ENABLE_FILTERS_LEVEL_2) && ENABLE_FILTERS_LEVEL_2
 -webkit-backdrop-filter [ConditionalConverter=FilterOperations]
 #endif
-justify-self [Custom=All]
+justify-self [Initial=initialSelfAlignment, Converter=SelfOrDefaultAlignmentData]
 -webkit-font-size-delta [SkipBuilder]
-justify-items [Custom=All]
+justify-items [Initial=initialSelfAlignment, Converter=SelfOrDefaultAlignmentData]
 -webkit-justify-items = justify-items
 #if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
 -webkit-grid [Longhands=-webkit-grid-template-columns|-webkit-grid-template-rows|-webkit-grid-template-areas|-webkit-grid-auto-flow|-webkit-grid-auto-columns|-webkit-grid-auto-rows]
index b35c122..1d034dc 100644 (file)
@@ -121,6 +121,7 @@ public:
     static float convertOpacity(StyleResolver&, CSSValue&);
     static String convertSVGURIReference(StyleResolver&, CSSValue&);
     static Color convertSVGColor(StyleResolver&, CSSValue&);
+    static StyleSelfAlignmentData convertSelfOrDefaultAlignmentData(StyleResolver&, CSSValue&);
     static EGlyphOrientation convertGlyphOrientation(StyleResolver&, CSSValue&);
     static EGlyphOrientation convertGlyphOrientationOrAuto(StyleResolver&, CSSValue&);
     static Optional<Length> convertLineHeight(StyleResolver&, CSSValue&, float multiplier = 1.f);
@@ -1170,6 +1171,23 @@ inline Color StyleBuilderConverter::convertSVGColor(StyleResolver& styleResolver
     return svgColor.colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR ? styleResolver.style()->color() : svgColor.color();
 }
 
+inline StyleSelfAlignmentData StyleBuilderConverter::convertSelfOrDefaultAlignmentData(StyleResolver&, CSSValue& value)
+{
+    StyleSelfAlignmentData alignmentData = RenderStyle::initialSelfAlignment();
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (Pair* pairValue = primitiveValue.getPairValue()) {
+        if (pairValue->first()->getValueID() == CSSValueLegacy) {
+            alignmentData.setPositionType(LegacyPosition);
+            alignmentData.setPosition(*pairValue->second());
+        } else {
+            alignmentData.setPosition(*pairValue->first());
+            alignmentData.setOverflow(*pairValue->second());
+        }
+    } else
+        alignmentData.setPosition(primitiveValue);
+    return alignmentData;
+}
+
 inline EGlyphOrientation StyleBuilderConverter::convertGlyphOrientation(StyleResolver&, CSSValue& value)
 {
     float angle = fabsf(fmodf(downcast<CSSPrimitiveValue>(value).getFloatValue(), 360.0f));
index 4bcf6c5..d440bd2 100644 (file)
@@ -102,10 +102,6 @@ public:
     DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitSvgShadow);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitTextEmphasisStyle);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(Zoom);
-    DECLARE_PROPERTY_CUSTOM_HANDLERS(JustifySelf);
-    DECLARE_PROPERTY_CUSTOM_HANDLERS(JustifyItems);
-    DECLARE_PROPERTY_CUSTOM_HANDLERS(AlignItems);
-    DECLARE_PROPERTY_CUSTOM_HANDLERS(AlignSelf);
 
     // Custom handling of initial + inherit value setting only.
     static void applyInitialWebkitMaskImage(StyleResolver&) { }
@@ -507,111 +503,6 @@ inline void StyleBuilderCustom::applyValueTextIndent(StyleResolver& styleResolve
 #endif
 }
 
-inline void StyleBuilderCustom::applyInheritAlignSelf(StyleResolver& styleResolver)
-{
-    styleResolver.style()->setAlignSelf(styleResolver.parentStyle()->alignSelf());
-    styleResolver.style()->setAlignSelfOverflowAlignment(styleResolver.parentStyle()->alignSelfOverflowAlignment());
-}
-
-inline void StyleBuilderCustom::applyInitialAlignSelf(StyleResolver& styleResolver)
-{
-    styleResolver.style()->setAlignSelf(RenderStyle::initialAlignSelf());
-    styleResolver.style()->setAlignSelfOverflowAlignment(RenderStyle::initialAlignSelfOverflowAlignment());
-}
-
-inline void StyleBuilderCustom::applyValueAlignSelf(StyleResolver& styleResolver, CSSValue& value)
-{
-    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
-    if (Pair* pairValue = primitiveValue.getPairValue()) {
-        styleResolver.style()->setAlignSelf(*pairValue->first());
-        styleResolver.style()->setAlignSelfOverflowAlignment(*pairValue->second());
-    } else {
-        styleResolver.style()->setAlignSelf(primitiveValue);
-        styleResolver.style()->setAlignSelfOverflowAlignment(RenderStyle::initialAlignSelfOverflowAlignment());
-    }
-}
-
-inline void StyleBuilderCustom::applyInheritAlignItems(StyleResolver& styleResolver)
-{
-    styleResolver.style()->setAlignItems(styleResolver.parentStyle()->alignItems());
-    styleResolver.style()->setAlignItemsOverflowAlignment(styleResolver.parentStyle()->alignItemsOverflowAlignment());
-}
-
-inline void StyleBuilderCustom::applyInitialAlignItems(StyleResolver& styleResolver)
-{
-    styleResolver.style()->setAlignItems(RenderStyle::initialAlignItems());
-    styleResolver.style()->setAlignItemsOverflowAlignment(RenderStyle::initialAlignItemsOverflowAlignment());
-}
-
-inline void StyleBuilderCustom::applyValueAlignItems(StyleResolver& styleResolver, CSSValue& value)
-{
-    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
-    if (Pair* pairValue = primitiveValue.getPairValue()) {
-        styleResolver.style()->setAlignItems(*pairValue->first());
-        styleResolver.style()->setAlignItemsOverflowAlignment(*pairValue->second());
-    } else {
-        styleResolver.style()->setAlignItems(primitiveValue);
-        styleResolver.style()->setAlignItemsOverflowAlignment(RenderStyle::initialAlignItemsOverflowAlignment());
-    }
-}
-
-inline void StyleBuilderCustom::applyInheritJustifySelf(StyleResolver& styleResolver)
-{
-    styleResolver.style()->setJustifySelf(styleResolver.parentStyle()->justifySelf());
-    styleResolver.style()->setJustifySelfOverflowAlignment(styleResolver.parentStyle()->justifySelfOverflowAlignment());
-}
-
-inline void StyleBuilderCustom::applyInitialJustifySelf(StyleResolver& styleResolver)
-{
-    styleResolver.style()->setJustifySelf(RenderStyle::initialJustifySelf());
-    styleResolver.style()->setJustifySelfOverflowAlignment(RenderStyle::initialJustifySelfOverflowAlignment());
-}
-
-inline void StyleBuilderCustom::applyValueJustifySelf(StyleResolver& styleResolver, CSSValue& value)
-{
-    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
-    if (Pair* pairValue = primitiveValue.getPairValue()) {
-        styleResolver.style()->setJustifySelf(*pairValue->first());
-        styleResolver.style()->setJustifySelfOverflowAlignment(*pairValue->second());
-    } else {
-        styleResolver.style()->setJustifySelf(primitiveValue);
-        styleResolver.style()->setJustifySelfOverflowAlignment(RenderStyle::initialJustifySelfOverflowAlignment());
-    }
-}
-
-inline void StyleBuilderCustom::applyInheritJustifyItems(StyleResolver& styleResolver)
-{
-    styleResolver.style()->setJustifyItems(styleResolver.parentStyle()->justifyItems());
-    styleResolver.style()->setJustifyItemsOverflowAlignment(styleResolver.parentStyle()->justifyItemsOverflowAlignment());
-    styleResolver.style()->setJustifyItemsPositionType(styleResolver.parentStyle()->justifyItemsPositionType());
-}
-
-inline void StyleBuilderCustom::applyInitialJustifyItems(StyleResolver& styleResolver)
-{
-    styleResolver.style()->setJustifyItems(RenderStyle::initialJustifyItems());
-    styleResolver.style()->setJustifyItemsOverflowAlignment(RenderStyle::initialJustifyItemsOverflowAlignment());
-    styleResolver.style()->setJustifyItemsPositionType(RenderStyle::initialJustifyItemsPositionType());
-}
-
-inline void StyleBuilderCustom::applyValueJustifyItems(StyleResolver& styleResolver, CSSValue& value)
-{
-    styleResolver.style()->setJustifyItems(RenderStyle::initialJustifyItems());
-    styleResolver.style()->setJustifyItemsOverflowAlignment(RenderStyle::initialJustifyItemsOverflowAlignment());
-    styleResolver.style()->setJustifyItemsPositionType(RenderStyle::initialJustifyItemsPositionType());
-
-    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
-    if (Pair* pairValue = primitiveValue.getPairValue()) {
-        if (pairValue->first()->getValueID() == CSSValueLegacy) {
-            styleResolver.style()->setJustifyItemsPositionType(LegacyPosition);
-            styleResolver.style()->setJustifyItems(*pairValue->second());
-        } else {
-            styleResolver.style()->setJustifyItems(*pairValue->first());
-            styleResolver.style()->setJustifyItemsOverflowAlignment(*pairValue->second());
-        }
-    } else
-        styleResolver.style()->setJustifyItems(primitiveValue);
-}
-
 enum BorderImageType { BorderImage, WebkitMaskBoxImage };
 enum BorderImageModifierType { Outset, Repeat, Slice, Width };
 template <BorderImageType type, BorderImageModifierType modifier>
index a6609ad..9a60e0c 100644 (file)
@@ -1437,10 +1437,8 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par
 
     // If the inherited value of justify-items includes the legacy keyword, 'auto'
     // computes to the the inherited value.
-    if (parentStyle.justifyItemsPositionType() == LegacyPosition && style.justifyItems() == ItemPositionAuto) {
+    if (parentStyle.justifyItemsPositionType() == LegacyPosition && style.justifyItemsPosition() == ItemPositionAuto)
         style.setJustifyItems(parentStyle.justifyItems());
-        style.setJustifyItemsPositionType(parentStyle.justifyItemsPositionType());
-    }
 }
 
 bool StyleResolver::checkRegionStyle(Element* regionElement)
index 4d7c1ca..17594d1 100644 (file)
@@ -88,7 +88,7 @@ RenderPtr<RenderElement> MathMLTextElement::createElementRenderer(Ref<RenderStyl
 
     // FIXME: why do we have to set the alignment here ? It seems needed to make the
     // style-changed.htmt test to pass, since mathml renders expect Stretch as default.
-    style.get().setAlignItems(ItemPositionStretch);
+    style.get().setAlignItemsPosition(ItemPositionStretch);
 
     return createRenderer<RenderMathMLToken>(*this, WTF::move(style));
 }
index 1650a9c..849e6e2 100644 (file)
@@ -228,7 +228,7 @@ void RenderFlexibleBox::styleDidChange(StyleDifference diff, const RenderStyle*
 {
     RenderBlock::styleDidChange(diff, oldStyle);
 
-    if (oldStyle && (oldStyle->alignItems() == ItemPositionStretch || oldStyle->alignItems() == ItemPositionAuto) && diff == StyleDifferenceLayout) {
+    if (oldStyle && (oldStyle->alignItemsPosition() == ItemPositionStretch || oldStyle->alignItemsPosition() == ItemPositionAuto) && diff == StyleDifferenceLayout) {
         // Flex items that were previously stretching need to be relayed out so we can compute new available cross axis space.
         // This is only necessary for stretching since other alignment values don't change the size of the box.
         for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
index fd5eba8..891087c 100644 (file)
@@ -90,7 +90,7 @@ static Ref<RenderStyle> createFullScreenStyle()
 
     fullscreenStyle.get().setDisplay(FLEX);
     fullscreenStyle.get().setJustifyContent(JustifyCenter);
-    fullscreenStyle.get().setAlignItems(ItemPositionCenter);
+    fullscreenStyle.get().setAlignItemsPosition(ItemPositionCenter);
     fullscreenStyle.get().setFlexDirection(FlowColumn);
     
     fullscreenStyle.get().setPosition(FixedPosition);
index ddbf050..dbe7b1b 100644 (file)
@@ -118,10 +118,10 @@ void RenderMenuList::adjustInnerStyle()
     // Use margin:auto instead of align-items:center to get safe centering, i.e.
     // when the content overflows, treat it the same as align-items: flex-start.
     // But we only do that for the cases where html.css would otherwise use center.
-    if (style().alignItems() == ItemPositionCenter) {
+    if (style().alignItemsPosition() == ItemPositionCenter) {
         innerStyle.setMarginTop(Length());
         innerStyle.setMarginBottom(Length());
-        innerStyle.setAlignSelf(ItemPositionFlexStart);
+        innerStyle.setAlignSelfPosition(ItemPositionFlexStart);
     }
 
     innerStyle.setPaddingLeft(Length(theme().popupInternalPaddingLeft(style()), Fixed));
index 3bfc68d..dc8fb6b 100644 (file)
@@ -233,7 +233,7 @@ void RenderMathMLRoot::updateStyle()
     auto base = baseWrapper();
     auto baseStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX);
     baseStyle.get().setMarginTop(Length(0, Fixed)); // This will be updated in RenderMathMLRoot::layout().
-    baseStyle.get().setAlignItems(ItemPositionBaseline);
+    baseStyle.get().setAlignItemsPosition(ItemPositionBaseline);
     base->setStyle(WTF::move(baseStyle));
     base->setNeedsLayoutAndPrefWidthsRecalc();
 
@@ -244,7 +244,7 @@ void RenderMathMLRoot::updateStyle()
         indexStyle.get().setMarginTop(Length(0, Fixed)); // This will be updated in RenderMathMLRoot::layout().
         indexStyle.get().setMarginStart(Length(kernBeforeDegree, Fixed));
         indexStyle.get().setMarginEnd(Length(kernAfterDegree, Fixed));
-        indexStyle.get().setAlignItems(ItemPositionBaseline);
+        indexStyle.get().setAlignItemsPosition(ItemPositionBaseline);
         index->setStyle(WTF::move(indexStyle));
         index->setNeedsLayoutAndPrefWidthsRecalc();
     }
index d8c3bbd..4161e46 100644 (file)
@@ -100,7 +100,7 @@ void RenderMathMLScripts::fixAnonymousStyleForSubSupPair(RenderObject* subSupPai
     // The MathML specification does not specify vertical alignment of scripts.
     // Let's right align prescripts and left align postscripts.
     // See http://lists.w3.org/Archives/Public/www-math/2012Aug/0006.html
-    scriptsStyle.setAlignItems(isPostScript ? ItemPositionFlexStart : ItemPositionFlexEnd);
+    scriptsStyle.setAlignItemsPosition(isPostScript ? ItemPositionFlexStart : ItemPositionFlexEnd);
 
     // We set the order property so that the prescripts are drawn before the base.
     scriptsStyle.setOrder(isPostScript ? 0 : -1);
@@ -114,7 +114,7 @@ void RenderMathMLScripts::fixAnonymousStyles()
 {
     // We set the base wrapper's style so that baseHeight in layout() will be an unstretched height.
     ASSERT(m_baseWrapper && m_baseWrapper->style().hasOneRef());
-    m_baseWrapper->style().setAlignSelf(ItemPositionFlexStart);
+    m_baseWrapper->style().setAlignSelfPosition(ItemPositionFlexStart);
 
     // This sets the style for postscript pairs.
     RenderObject* subSupPair = m_baseWrapper;
@@ -134,7 +134,7 @@ void RenderMathMLScripts::fixAnonymousStyles()
             RenderStyle& scriptsStyle = subSupPair->style();
             scriptsStyle.setFlexDirection(FlowRow);
             scriptsStyle.setJustifyContent(JustifyFlexStart);
-            scriptsStyle.setAlignItems(ItemPositionCenter);
+            scriptsStyle.setAlignItemsPosition(ItemPositionCenter);
             scriptsStyle.setOrder(0);
             scriptsStyle.setFontSize(style().fontSize());
         }
index e955251..e73f929 100644 (file)
@@ -174,16 +174,16 @@ ALWAYS_INLINE RenderStyle::RenderStyle(const RenderStyle& o)
 ItemPosition RenderStyle::resolveAlignment(const RenderStyle& parentStyle, const RenderStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer)
 {
     // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
-    if (childStyle.alignSelf() == ItemPositionAuto)
-        return (parentStyle.alignItems() == ItemPositionAuto) ? resolvedAutoPositionForRenderer : parentStyle.alignItems();
-    return childStyle.alignSelf();
+    if (childStyle.alignSelfPosition() == ItemPositionAuto)
+        return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolvedAutoPositionForRenderer : parentStyle.alignItemsPosition();
+    return childStyle.alignSelfPosition();
 }
 
 ItemPosition RenderStyle::resolveJustification(const RenderStyle& parentStyle, const RenderStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject)
 {
-    if (childStyle.justifySelf() == ItemPositionAuto)
-        return (parentStyle.justifyItems() == ItemPositionAuto) ? resolvedAutoPositionForLayoutObject : parentStyle.justifyItems();
-    return childStyle.justifySelf();
+    if (childStyle.justifySelfPosition() == ItemPositionAuto)
+        return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolvedAutoPositionForLayoutObject : parentStyle.justifyItemsPosition();
+    return childStyle.justifySelfPosition();
 }
 
 void RenderStyle::inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary isAtShadowBoundary)
index 460be9f..8bbd51a 100644 (file)
@@ -910,20 +910,24 @@ public:
     float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
     const Length& flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
     EAlignContent alignContent() const { return static_cast<EAlignContent>(rareNonInheritedData->m_alignContent); }
-    ItemPosition alignItems() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignItems); }
-    OverflowAlignment alignItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignItemsOverflowAlignment); }
-    ItemPosition alignSelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignSelf); }
-    OverflowAlignment alignSelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignSelfOverflowAlignment); }
+    const StyleSelfAlignmentData& alignItems() const { return rareNonInheritedData->m_alignItems; }
+    ItemPosition alignItemsPosition() const { return rareNonInheritedData->m_alignItems.position(); }
+    OverflowAlignment alignItemsOverflowAlignment() const { return rareNonInheritedData->m_alignItems.overflow(); }
+    const StyleSelfAlignmentData& alignSelf() const { return rareNonInheritedData->m_alignSelf; }
+    ItemPosition alignSelfPosition() const { return rareNonInheritedData->m_alignSelf.position(); }
+    OverflowAlignment alignSelfOverflowAlignment() const { return rareNonInheritedData->m_alignSelf.overflow(); }
     EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
     bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
     bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
     EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
     EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); }
-    ItemPosition justifyItems() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifyItems); }
-    OverflowAlignment justifyItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifyItemsOverflowAlignment); }
-    ItemPositionType justifyItemsPositionType() const { return static_cast<ItemPositionType>(rareNonInheritedData->m_justifyItemsPositionType); }
-    ItemPosition justifySelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifySelf); }
-    OverflowAlignment justifySelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifySelfOverflowAlignment); }
+    const StyleSelfAlignmentData& justifyItems() const { return rareNonInheritedData->m_justifyItems; }
+    ItemPosition justifyItemsPosition() const { return rareNonInheritedData->m_justifyItems.position(); }
+    OverflowAlignment justifyItemsOverflowAlignment() const { return rareNonInheritedData->m_justifyItems.overflow(); }
+    ItemPositionType justifyItemsPositionType() const { return rareNonInheritedData->m_justifyItems.positionType(); }
+    const StyleSelfAlignmentData& justifySelf() const { return rareNonInheritedData->m_justifySelf; }
+    ItemPosition justifySelfPosition() const { return rareNonInheritedData->m_justifySelf.position(); }
+    OverflowAlignment justifySelfOverflowAlignment() const { return rareNonInheritedData->m_justifySelf.overflow(); }
 
 #if ENABLE(CSS_GRID_LAYOUT)
     const Vector<GridTrackSize>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; }
@@ -1496,18 +1500,22 @@ public:
     void setFlexBasis(Length length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, WTF::move(length)); }
     void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); }
     void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); }
-    void setAlignItems(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
-    void setAlignItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignItemsOverflowAlignment, overflowAlignment); }
-    void setAlignSelf(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); }
-    void setAlignSelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignSelfOverflowAlignment, overflowAlignment); }
+    void setAlignItems(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_alignItems, data); }
+    void setAlignItemsPosition(ItemPosition position) { rareNonInheritedData.access()->m_alignItems.setPosition(position); }
+    void setAlignItemsOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_alignItems.setOverflow(overflow); }
+    void setAlignSelf(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_alignSelf, data); }
+    void setAlignSelfPosition(ItemPosition position) { rareNonInheritedData.access()->m_alignSelf.setPosition(position); }
+    void setAlignSelfOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_alignSelf.setOverflow(overflow); }
     void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
     void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
     void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); }
-    void setJustifyItems(ItemPosition justifyItems) { SET_VAR(rareNonInheritedData, m_justifyItems, justifyItems); }
-    void setJustifyItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifyItemsOverflowAlignment, overflowAlignment); }
-    void setJustifyItemsPositionType(ItemPositionType positionType) { SET_VAR(rareNonInheritedData, m_justifyItemsPositionType, positionType); }
-    void setJustifySelf(ItemPosition p) { SET_VAR(rareNonInheritedData, m_justifySelf, p); }
-    void setJustifySelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelfOverflowAlignment, overflowAlignment); }
+    void setJustifyItems(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifyItems, data); }
+    void setJustifyItemsPosition(ItemPosition position) { rareNonInheritedData.access()->m_justifyItems.setPosition(position); }
+    void setJustifyItemsOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_justifyItems.setOverflow(overflow); }
+    void setJustifyItemsPositionType(ItemPositionType positionType) { rareNonInheritedData.access()->m_justifyItems.setPositionType(positionType); }
+    void setJustifySelf(const StyleSelfAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifySelf, data); }
+    void setJustifySelfPosition(ItemPosition position) { rareNonInheritedData.access()->m_justifySelf.setPosition(position); }
+    void setJustifySelfOverflow(OverflowAlignment overflow) { rareNonInheritedData.access()->m_justifySelf.setOverflow(overflow); }
 #if ENABLE(CSS_GRID_LAYOUT)
     void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); }
     void setGridAutoRows(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoRows, length); }
@@ -1917,18 +1925,10 @@ public:
     static Length initialFlexBasis() { return Length(Auto); }
     static int initialOrder() { return 0; }
     static EAlignContent initialAlignContent() { return AlignContentStretch; }
-    static ItemPosition initialAlignItems() { return ItemPositionAuto; }
-    static OverflowAlignment initialAlignItemsOverflowAlignment() { return OverflowAlignmentDefault; }
-    static ItemPosition initialAlignSelf() { return ItemPositionAuto; }
-    static OverflowAlignment initialAlignSelfOverflowAlignment() { return OverflowAlignmentDefault; }
+    static StyleSelfAlignmentData initialSelfAlignment() { return StyleSelfAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); }
     static EFlexDirection initialFlexDirection() { return FlowRow; }
     static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
     static EJustifyContent initialJustifyContent() { return JustifyFlexStart; }
-    static ItemPosition initialJustifyItems() { return ItemPositionAuto; }
-    static OverflowAlignment initialJustifyItemsOverflowAlignment() { return OverflowAlignmentDefault; }
-    static ItemPositionType initialJustifyItemsPositionType() { return NonLegacyPosition; }
-    static ItemPosition initialJustifySelf() { return ItemPositionAuto; }
-    static OverflowAlignment initialJustifySelfOverflowAlignment() { return OverflowAlignmentDefault; }
     static int initialMarqueeLoopCount() { return -1; }
     static int initialMarqueeSpeed() { return 85; }
     static Length initialMarqueeIncrement() { return Length(6, Fixed); }
index 38d1235..bf2e7aa 100644 (file)
@@ -71,6 +71,10 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_order(RenderStyle::initialOrder())
     , m_flowThread(RenderStyle::initialFlowThread())
     , m_regionThread(RenderStyle::initialRegionThread())
+    , m_alignItems(RenderStyle::initialSelfAlignment())
+    , m_alignSelf(RenderStyle::initialSelfAlignment())
+    , m_justifyItems(RenderStyle::initialSelfAlignment())
+    , m_justifySelf(RenderStyle::initialSelfAlignment())
 #if ENABLE(CSS_SCROLL_SNAP)
     , m_scrollSnapType(static_cast<unsigned>(RenderStyle::initialScrollSnapType()))
 #endif
@@ -82,16 +86,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_transformStyle3D(RenderStyle::initialTransformStyle3D())
     , m_backfaceVisibility(RenderStyle::initialBackfaceVisibility())
     , m_alignContent(RenderStyle::initialAlignContent())
-    , m_alignItems(RenderStyle::initialAlignItems())
-    , m_alignItemsOverflowAlignment(RenderStyle::initialAlignItemsOverflowAlignment())
-    , m_alignSelf(RenderStyle::initialAlignSelf())
-    , m_alignSelfOverflowAlignment(RenderStyle::initialAlignSelfOverflowAlignment())
     , m_justifyContent(RenderStyle::initialJustifyContent())
-    , m_justifyItems(RenderStyle::initialJustifyItems())
-    , m_justifyItemsOverflowAlignment(RenderStyle::initialJustifyItemsOverflowAlignment())
-    , m_justifyItemsPositionType(NonLegacyPosition)
-    , m_justifySelf(RenderStyle::initialJustifySelf())
-    , m_justifySelfOverflowAlignment(RenderStyle::initialJustifySelfOverflowAlignment())
     , userDrag(RenderStyle::initialUserDrag())
     , textOverflow(RenderStyle::initialTextOverflow())
     , marginBeforeCollapse(MCOLLAPSE)
@@ -164,6 +159,10 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
     , m_order(o.m_order)
     , m_flowThread(o.m_flowThread)
     , m_regionThread(o.m_regionThread)
+    , m_alignItems(o.m_alignItems)
+    , m_alignSelf(o.m_alignSelf)
+    , m_justifyItems(o.m_justifyItems)
+    , m_justifySelf(o.m_justifySelf)
 #if ENABLE(CSS_SCROLL_SNAP)
     , m_scrollSnapType(o.m_scrollSnapType)
 #endif
@@ -175,16 +174,7 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
     , m_transformStyle3D(o.m_transformStyle3D)
     , m_backfaceVisibility(o.m_backfaceVisibility)
     , m_alignContent(o.m_alignContent)
-    , m_alignItems(o.m_alignItems)
-    , m_alignItemsOverflowAlignment(o.m_alignItemsOverflowAlignment)
-    , m_alignSelf(o.m_alignSelf)
-    , m_alignSelfOverflowAlignment(o.m_alignSelfOverflowAlignment)
     , m_justifyContent(o.m_justifyContent)
-    , m_justifyItems(o.m_justifyItems)
-    , m_justifyItemsOverflowAlignment(o.m_justifyItemsOverflowAlignment)
-    , m_justifyItemsPositionType(o.m_justifyItemsPositionType)
-    , m_justifySelf(o.m_justifySelf)
-    , m_justifySelfOverflowAlignment(o.m_justifySelfOverflowAlignment)
     , userDrag(o.userDrag)
     , textOverflow(o.textOverflow)
     , marginBeforeCollapse(o.marginBeforeCollapse)
@@ -266,6 +256,10 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && m_visitedLinkBorderBottomColor == o.m_visitedLinkBorderBottomColor
         && m_order == o.m_order
         && m_flowThread == o.m_flowThread
+        && m_alignItems == o.m_alignItems
+        && m_alignSelf == o.m_alignSelf
+        && m_justifyItems == o.m_justifyItems
+        && m_justifySelf == o.m_justifySelf
         && m_regionThread == o.m_regionThread
         && m_regionFragment == o.m_regionFragment
         && m_regionBreakAfter == o.m_regionBreakAfter
@@ -275,10 +269,6 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && m_transformStyle3D == o.m_transformStyle3D
         && m_backfaceVisibility == o.m_backfaceVisibility
         && m_alignContent == o.m_alignContent
-        && m_alignItems == o.m_alignItems
-        && m_alignItemsOverflowAlignment == o.m_alignItemsOverflowAlignment
-        && m_alignSelf == o.m_alignSelf
-        && m_alignSelfOverflowAlignment == o.m_alignSelfOverflowAlignment
         && m_justifyContent == o.m_justifyContent
         && userDrag == o.userDrag
         && textOverflow == o.textOverflow
@@ -297,12 +287,7 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && m_isolation == o.m_isolation
 #endif
         && m_aspectRatioType == o.m_aspectRatioType
-        && m_objectFit == o.m_objectFit
-        && m_justifyItems == o.m_justifyItems
-        && m_justifyItemsOverflowAlignment == o.m_justifyItemsOverflowAlignment
-        && m_justifyItemsPositionType == o.m_justifyItemsPositionType
-        && m_justifySelf == o.m_justifySelf
-        && m_justifySelfOverflowAlignment == o.m_justifySelfOverflowAlignment;
+        && m_objectFit == o.m_objectFit;
 }
 
 bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& o) const
index 2012092..0340930 100644 (file)
@@ -34,6 +34,7 @@
 #include "LineClampValue.h"
 #include "NinePieceImage.h"
 #include "ShapeValue.h"
+#include "StyleSelfAlignmentData.h"
 #include <memory>
 #include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
@@ -175,6 +176,11 @@ public:
     AtomicString m_flowThread;
     AtomicString m_regionThread;
 
+    StyleSelfAlignmentData m_alignItems;
+    StyleSelfAlignmentData m_alignSelf;
+    StyleSelfAlignmentData m_justifyItems;
+    StyleSelfAlignmentData m_justifySelf;
+
 #if ENABLE(CSS_SCROLL_SNAP)
     unsigned m_scrollSnapType : 2; // ScrollSnapType
 #endif
@@ -190,19 +196,8 @@ public:
     unsigned m_backfaceVisibility : 1; // EBackfaceVisibility
 
     unsigned m_alignContent : 3; // EAlignContent
-    unsigned m_alignItems : 4; // ItemPosition
-    unsigned m_alignItemsOverflowAlignment : 2; // OverflowAlignment
-    unsigned m_alignSelf : 4; // ItemPosition
-    unsigned m_alignSelfOverflowAlignment : 2; // OverflowAlignment
     unsigned m_justifyContent : 3; // EJustifyContent
 
-    unsigned m_justifyItems : 4; // ItemPosition
-    unsigned m_justifyItemsOverflowAlignment : 2; // OverflowAlignment
-    unsigned m_justifyItemsPositionType: 1; // Whether or not alignment uses the 'legacy' keyword.
-
-    unsigned m_justifySelf : 4; // ItemPosition
-    unsigned m_justifySelfOverflowAlignment : 2; // OverflowAlignment
-
     unsigned userDrag : 2; // EUserDrag
     unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
     unsigned marginBeforeCollapse : 2; // EMarginCollapse
diff --git a/Source/WebCore/rendering/style/StyleSelfAlignmentData.h b/Source/WebCore/rendering/style/StyleSelfAlignmentData.h
new file mode 100644 (file)
index 0000000..895558d
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2015 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef StyleSelfAlignmentData_h
+#define StyleSelfAlignmentData_h
+
+#include "RenderStyleConstants.h"
+
+
+namespace WebCore {
+
+class StyleSelfAlignmentData {
+public:
+    // Style data for Self-Aligment and Default-Alignment properties: align-{self, items}, justify-{self, items}.
+    // [ <self-position> && <overflow-position>? ] | [ legacy && [ left | right | center ] ]
+    StyleSelfAlignmentData(ItemPosition position, OverflowAlignment overflow, ItemPositionType positionType = NonLegacyPosition)
+        : m_position(position)
+        , m_positionType(positionType)
+        , m_overflow(overflow)
+    {
+    }
+
+    void setPosition(ItemPosition position) { m_position = position; }
+    void setPositionType(ItemPositionType positionType) { m_positionType = positionType; }
+    void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; }
+
+    ItemPosition position() const { return static_cast<ItemPosition>(m_position); }
+    ItemPositionType positionType() const { return static_cast<ItemPositionType>(m_positionType); }
+    OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m_overflow); }
+
+    bool operator==(const StyleSelfAlignmentData& o) const
+    {
+        return m_position == o.m_position && m_positionType == o.m_positionType && m_overflow == o.m_overflow;
+    }
+
+    bool operator!=(const StyleSelfAlignmentData& o) const
+    {
+        return !(*this == o);
+    }
+
+private:
+    unsigned m_position : 4; // ItemPosition
+    unsigned m_positionType: 1; // Whether or not alignment uses the 'legacy' keyword.
+    unsigned m_overflow : 2; // OverflowAlignment
+};
+
+} // namespace WebCore
+
+#endif // StyleSelfAlignmentData_h