/*
 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
 *           (C) 2000 Antti Koivisto (koivisto@kde.org)
 *           (C) 2000 Dirk Mueller (mueller@kde.org)
 * Copyright (C) 2003-2023 Apple Inc. All rights reserved.
 * Copyright (C) 2014 Google Inc. All rights reserved.
 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#pragma once

#include "AnimationList.h"
#include "BorderValue.h"
#include "CSSLineBoxContainValue.h"
#include "CSSPrimitiveValue.h"
#include "CSSPropertyNames.h"
#include "Color.h"
#include "ColorSpace.h"
#include "CounterDirectives.h"
#include "ShapeValue.h"
#include "FontCascade.h"
#include "GapLength.h"
#include "GraphicsTypes.h"
#include "Length.h"
#include "LengthBox.h"
#include "LengthFunctions.h"
#include "LengthPoint.h"
#include "LengthSize.h"
#include "LineClampValue.h"
#include "NinePieceImage.h"
#include "OutlineValue.h"
#include "Pagination.h"
#include "RenderStyleConstants.h"
#include "RotateTransformOperation.h"
#include "RoundedRect.h"
#include "ScaleTransformOperation.h"
#include "ShadowData.h"
#include "StyleBackgroundData.h"
#include "StyleBoxData.h"
#include "StyleDeprecatedFlexibleBoxData.h"
#include "StyleFlexibleBoxData.h"
#include "StyleGridData.h"
#include "StyleGridItemData.h"
#include "StyleInheritedData.h"
#include "StyleMarqueeData.h"
#include "StyleMultiColData.h"
#include "StyleRareInheritedData.h"
#include "StyleRareNonInheritedData.h"
#include "StyleReflection.h"
#include "StyleSurroundData.h"
#include "StyleTransformData.h"
#include "StyleVisualData.h"
#include "TextDirection.h"
#include "TextFlags.h"
#include "ThemeTypes.h"
#include "TransformOperations.h"
#include "TranslateTransformOperation.h"
#include "UnicodeBidi.h"
#include <wtf/DataRef.h>
#include <wtf/Forward.h>
#include <wtf/OptionSet.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/StdLibExtras.h>
#include <wtf/Vector.h>

#if ENABLE(CSS_FILTERS)
#include "StyleFilterData.h"
#endif

#if ENABLE(DASHBOARD_SUPPORT)
#include "StyleDashboardRegion.h"
#endif

#if ENABLE(SVG)
#include "SVGRenderStyle.h"
#endif

template<typename T, typename U> ALWAYS_INLINE bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }

#define SET_VAR(group, variable, value) \
    if (!compareEqual(group->variable, value)) \
        group.access().variable = value;

#define SET_NESTED_VAR(group, parentVariable, variable, value) do { \
        if (!compareEqual(group->parentVariable->variable, value)) \
            group.access().parentVariable.access().variable = value; \
    } while (0)

#define SET_BORDERVALUE_COLOR(group, variable, value) \
    if (!compareEqual(group->variable.color(), value)) \
        group.access().variable.setColor(value);

namespace WebCore {

using std::max;

#if ENABLE(CSS_FILTERS)
class FilterOperations;
#endif

class BorderData;
class CounterContent;
class CursorList;
class IntRect;
class Pair;
class RenderObject;
class ShadowData;
class StyleImage;
class StyleResolver;
class TransformationMatrix;
class WillChangeData;

class ContentData;

typedef Vector<OwnPtr<RenderStyle>, 4> PseudoStyleCache;

constexpr unsigned PublicPseudoIDBits = 16;
constexpr unsigned TextDecorationLineBits = 4;
constexpr unsigned TextTransformBits = 5;
constexpr unsigned StyleTypeBits = 5;

class RenderStyle final {
    WTF_MAKE_FAST_ALLOCATED;

    friend class CSSPropertyAnimation; // Used by CSS animations. We can't allow them to animate based off visited colors.
    friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
	friend class EditingStyle; // Editing has to only reveal unvisited info.
    friend class ComputedStyleExtractor; // Ignores visited styles, so needs to be able to see unvisited info.
    friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
    friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
    friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors.  Rebaselining would allow this to be yanked.
    friend class StyleBuilderConverter; // Sets members directly.
	friend class StyleBuilderCustom; // Sets members directly.
    friend class StyleBuilderFunctions; // Sets members directly.
	friend class StyleResolver; // Sets members directly.

    enum CloneTag { Clone };
    enum CreateDefaultStyleTag { CreateDefaultStyle };

public:
    ~RenderStyle();

    static RenderStyle& defaultStyle();

    static PassOwnPtr<RenderStyle> create();
    static PassOwnPtr<RenderStyle> createPtr();
    static PassOwnPtr<RenderStyle> createDefaultStyle();
    static PassOwnPtr<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle& parentStyle, DisplayType);
    static PassOwnPtr<RenderStyle> clone(const RenderStyle&);
    static PassOwnPtr<RenderStyle> clone(const RenderStyle* style) { return clone(*style); }
    static PassOwnPtr<RenderStyle> cloneIncludingPseudoElements(const RenderStyle&);
    static PassOwnPtr<RenderStyle> clonePtr(const RenderStyle&);

    // Create a RenderStyle for generated content by inheriting from a pseudo style.
    static PassOwnPtr<RenderStyle> createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle);

#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
    bool deletionHasBegun() const { return m_deletionHasBegun; }
#endif

    bool operator==(const RenderStyle& other) const;
    ALWAYS_INLINE bool operator!=(const RenderStyle& other) const { return !(*this == other); }

    ContentPosition resolvedJustifyContentPosition(const StyleContentAlignmentData& normalValueBehavior) const;
    ContentDistributionType resolvedJustifyContentDistribution(const StyleContentAlignmentData& normalValueBehavior) const;
    ContentPosition resolvedAlignContentPosition(const StyleContentAlignmentData& normalValueBehavior) const;
    ContentDistributionType resolvedAlignContentDistribution(const StyleContentAlignmentData& normalValueBehavior) const;
    StyleSelfAlignmentData resolvedAlignItems(ItemPosition normalValueBehaviour) const;
	StyleSelfAlignmentData resolvedAlignSelf(const RenderStyle* parentStyle, ItemPosition normalValueBehaviour) const;
	StyleContentAlignmentData resolvedAlignContent(const StyleContentAlignmentData& normalValueBehaviour) const;
	StyleSelfAlignmentData resolvedJustifyItems(ItemPosition normalValueBehaviour) const;
	StyleSelfAlignmentData resolvedJustifySelf(const RenderStyle* parentStyle, ItemPosition normalValueBehaviour) const;
	StyleContentAlignmentData resolvedJustifyContent(const StyleContentAlignmentData& normalValueBehaviour) const;

    void inheritFrom(const RenderStyle& inheritParent);
    void fastPathInheritFrom(const RenderStyle&);
    void copyNonInheritedFrom(const RenderStyle*);
    void copyContentFrom(const RenderStyle&);
    void copyPseudoElementsFrom(const RenderStyle&);

    ALWAYS_INLINE PseudoId styleType() const { return static_cast<PseudoId>(m_nonInheritedFlags.u.styleType); }
    ALWAYS_INLINE void setStyleType(PseudoId styleType) { m_nonInheritedFlags.u.styleType = static_cast<unsigned>(styleType); }

    RenderStyle* getCachedPseudoStyle(PseudoId) const;
    RenderStyle* addCachedPseudoStyle(PassOwnPtr<RenderStyle>);

    ALWAYS_INLINE const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }

    void deduplicateInheritedCustomProperties(const RenderStyle&);
    const CustomPropertyValueMap& inheritedCustomProperties() const { return m_rareInheritedData->customProperties->values; }
    const CustomPropertyValueMap& nonInheritedCustomProperties() const { return m_rareNonInheritedData->customProperties->values; }
    const CSSCustomPropertyValue* getCustomProperty(const AtomicString&) const;
    void setInheritedCustomPropertyValue(const AtomicString& name, PassRefPtr<CSSCustomPropertyValue>);
    void setNonInheritedCustomPropertyValue(const AtomicString& name, PassRefPtr<CSSCustomPropertyValue> value);

    void setUsesViewportUnits() { m_nonInheritedFlags.u.usesViewportUnits = true; }
    bool usesViewportUnits() const { return m_nonInheritedFlags.u.usesViewportUnits; }
    void setUsesContainerUnits() { m_nonInheritedFlags.u.usesContainerUnits = true; }
    bool usesContainerUnits() const { return m_nonInheritedFlags.u.usesContainerUnits; }

    void setColumnStylesFromPaginationMode(const Pagination::Mode&);

    ALWAYS_INLINE bool isFloating() const { return static_cast<Float>(m_nonInheritedFlags.u.floating) != Float::None; }
    ALWAYS_INLINE bool hasMargin() const { return !m_surroundData->margin.isZero(); }
    ALWAYS_INLINE bool hasBorder() const { return m_surroundData->border.hasBorder(); }
    bool hasBorderImage() const { return m_surroundData->border.hasBorderImage(); }
	bool hasVisibleBorderDecoration() const { return hasVisibleBorder() || hasBorderImage(); }
	bool hasVisibleBorder() const { return m_surroundData->border.hasVisibleBorder(); }
	ALWAYS_INLINE bool hasPadding() const { return !m_surroundData->padding.isZero(); }
	ALWAYS_INLINE bool hasOffset() const { return !m_surroundData->offset.isZero(); }
    ALWAYS_INLINE bool hasMarginBeforeQuirk() const { return marginBefore().hasQuirk(); }
    ALWAYS_INLINE bool hasMarginAfterQuirk() const { return marginAfter().hasQuirk(); }

    ALWAYS_INLINE bool hasBackgroundImage() const { return m_background->background->hasImage(); }
    ALWAYS_INLINE bool hasFixedBackgroundImage() const { return m_background->background->hasFixedImage(); }

    bool hasEntirelyFixedBackground() const;

    ALWAYS_INLINE bool hasAppearance() const { return appearance() != NoControlPart; }
    bool hasEffectiveAppearance() const { return effectiveAppearance() != NoControlPart; }

    bool hasBackground() const
    {
        Color color = visitedDependentColor(CSSPropertyBackgroundColor);
        if (color.isValid() && color.alpha())
            return true;
        return hasBackgroundImage();
    }
    
    LayoutBoxExtent imageOutsets(const NinePieceImage&) const;
    bool hasBorderImageOutsets() const
    {
        return borderImage().hasImage() && !borderImage().outset().isZero();
    }
    LayoutBoxExtent borderImageOutsets() const
    {
        return imageOutsets(borderImage());
    }

    LayoutBoxExtent maskBoxImageOutsets() const
    {
        return imageOutsets(maskBoxImage());
    }

    IntOutsets filterOutsets() const { return hasFilter() ? filter().outsets() : IntOutsets(); }

    ALWAYS_INLINE Order rtlOrdering() const { return static_cast<Order>(m_inheritedFlags.u.m_rtlOrdering); }
    ALWAYS_INLINE void setRTLOrdering(Order o) { m_inheritedFlags.u.m_rtlOrdering = o; }

    bool hasAnyPublicPseudoStyles() const;
    bool hasPseudoStyle(PseudoId pseudo) const;
    void setHasPseudoStyle(PseudoId pseudo);
    void setHasPseudoStyles(PseudoIdSet);
    bool hasUniquePseudoStyle() const;

    // attribute getter methods

    ALWAYS_INLINE DisplayType display() const { return static_cast<DisplayType>(m_nonInheritedFlags.u.effectiveDisplay); }

    ALWAYS_INLINE const Length& left() const { return m_surroundData->offset.left(); }
    ALWAYS_INLINE const Length& right() const { return m_surroundData->offset.right(); }
    ALWAYS_INLINE const Length& top() const { return m_surroundData->offset.top(); }
    ALWAYS_INLINE const Length& bottom() const { return m_surroundData->offset.bottom(); }

    // Accessors for positioned object edges that take into account writing mode.
    ALWAYS_INLINE const Length& logicalLeft() const { return m_surroundData->offset.start(writingMode()); }
    ALWAYS_INLINE const Length& logicalRight() const { return m_surroundData->offset.end(writingMode()); }
    ALWAYS_INLINE const Length& logicalTop() const { return m_surroundData->offset.before(writingMode()); }
    ALWAYS_INLINE const Length& logicalBottom() const { return m_surroundData->offset.after(writingMode()); }

    // Whether or not a positioned element requires normal flow x/y to be computed
    // to determine its position.
    bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); }
    bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); }
    ALWAYS_INLINE bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
    ALWAYS_INLINE bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }

    ALWAYS_INLINE PositionType position() const { return static_cast<PositionType>(m_nonInheritedFlags.u.position); }
    ALWAYS_INLINE bool hasOutOfFlowPosition() const { return position() == PositionType::Absolute || position() == PositionType::Fixed; }
    ALWAYS_INLINE bool hasInFlowPosition() const { return position() == PositionType::Relative || position() == PositionType::Sticky; }
    ALWAYS_INLINE bool hasViewportConstrainedPosition() const { return position() == PositionType::Fixed || position() == PositionType::Sticky; }
	ALWAYS_INLINE Float floating() const { return static_cast<Float>(m_nonInheritedFlags.u.floating); }
	static UsedFloat usedFloat(const RenderObject&);

    ALWAYS_INLINE const Length& width() const { return m_boxData->width(); }
    ALWAYS_INLINE const Length& height() const { return m_boxData->height(); }
    ALWAYS_INLINE const Length& minWidth() const { return m_boxData->minWidth(); }
    ALWAYS_INLINE const Length& maxWidth() const { return m_boxData->maxWidth(); }
    ALWAYS_INLINE const Length& minHeight() const { return m_boxData->minHeight(); }
    ALWAYS_INLINE const Length& maxHeight() const { return m_boxData->maxHeight(); }
    
    const Length& logicalWidth() const
    {
        if (LIKELY(isHorizontalWritingMode()))
            return width();
        return height();
    }

    const Length& logicalHeight() const
    {
    	if (LIKELY(isHorizontalWritingMode()))
            return height();
        return width();
    }

    const Length& logicalMinWidth() const
    {
    	if (LIKELY(isHorizontalWritingMode()))
            return minWidth();
        return minHeight();
    }

    const Length& logicalMaxWidth() const
    {
    	if (LIKELY(isHorizontalWritingMode()))
            return maxWidth();
        return maxHeight();
    }

    const Length& logicalMinHeight() const
    {
    	if (LIKELY(isHorizontalWritingMode()))
            return minHeight();
        return minWidth();
    }

    const Length& logicalMaxHeight() const
    {
    	if (LIKELY(isHorizontalWritingMode()))
            return maxHeight();
        return maxWidth();
    }

    ALWAYS_INLINE const BorderData& border() const { return m_surroundData->border; }
    ALWAYS_INLINE const BorderValue& borderLeft() const { return m_surroundData->border.left(); }
    ALWAYS_INLINE const BorderValue& borderRight() const { return m_surroundData->border.right(); }
    ALWAYS_INLINE const BorderValue& borderTop() const { return m_surroundData->border.top(); }
    ALWAYS_INLINE const BorderValue& borderBottom() const { return m_surroundData->border.bottom(); }

    const BorderValue& borderBefore() const;
    const BorderValue& borderAfter() const;
    const BorderValue& borderStart() const;
    const BorderValue& borderEnd() const;

    ALWAYS_INLINE const NinePieceImage& borderImage() const { return m_surroundData->border.image(); }
    StyleImage* borderImageSource() const { return m_surroundData->border.image().image(); }
    const LengthBox& borderImageSlices() const { return m_surroundData->border.image().imageSlices(); }
    const LengthBox& borderImageWidth() const { return m_surroundData->border.image().borderSlices(); }
    const LengthBox& borderImageOutset() const { return m_surroundData->border.image().outset(); }

    const LengthSize& borderTopLeftRadius() const { return m_surroundData->border.topLeft(); }
    const LengthSize& borderTopRightRadius() const { return m_surroundData->border.topRight(); }
    const LengthSize& borderBottomLeftRadius() const { return m_surroundData->border.bottomLeft(); }
    const LengthSize& borderBottomRightRadius() const { return m_surroundData->border.bottomRight(); }
    ALWAYS_INLINE bool hasBorderRadius() const { return m_surroundData->border.hasBorderRadius(); }

    ALWAYS_INLINE float borderLeftWidth() const { return m_surroundData->border.borderLeftWidth(); }
    ALWAYS_INLINE EBorderStyle borderLeftStyle() const { return m_surroundData->border.left().style(); }
    ALWAYS_INLINE bool borderLeftIsTransparent() const { return m_surroundData->border.left().isTransparent(); }
    ALWAYS_INLINE float borderRightWidth() const { return m_surroundData->border.borderRightWidth(); }
    ALWAYS_INLINE EBorderStyle borderRightStyle() const { return m_surroundData->border.right().style(); }
    ALWAYS_INLINE bool borderRightIsTransparent() const { return m_surroundData->border.right().isTransparent(); }
    ALWAYS_INLINE float borderTopWidth() const { return m_surroundData->border.borderTopWidth(); }
    ALWAYS_INLINE EBorderStyle borderTopStyle() const { return m_surroundData->border.top().style(); }
    ALWAYS_INLINE bool borderTopIsTransparent() const { return m_surroundData->border.top().isTransparent(); }
    ALWAYS_INLINE float borderBottomWidth() const { return m_surroundData->border.borderBottomWidth(); }
    ALWAYS_INLINE EBorderStyle borderBottomStyle() const { return m_surroundData->border.bottom().style(); }
    ALWAYS_INLINE bool borderBottomIsTransparent() const { return m_surroundData->border.bottom().isTransparent(); }
    ALWAYS_INLINE FloatBoxExtent borderWidth() const { return m_surroundData->border.borderWidth(); }

    float borderBeforeWidth() const;
    float borderAfterWidth() const;
    float borderStartWidth() const;
    float borderEndWidth() const;

    float outlineSize() const { return max<float>(0, outlineWidth() + outlineOffset()); }
    float outlineWidth() const;
    bool hasOutline() const { return outlineStyle() > BHIDDEN && outlineWidth() > 0; }
    float outlineWidthIgnoreStyle() const
    {
        return m_background->outline.width();
    }
    EBorderStyle outlineStyle() const { return m_background->outline.style(); }
    OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_background->outline.isAuto()); }
    bool hasOutlineInVisualOverflow() const { return hasOutline() && outlineSize() > 0; }

    ALWAYS_INLINE Overflow overflowX() const { return static_cast<Overflow>(m_nonInheritedFlags.u.overflowX); }
    ALWAYS_INLINE Overflow overflowY() const { return static_cast<Overflow>(m_nonInheritedFlags.u.overflowY); }
    Overflow overflowInlineDirection() const { return isHorizontalWritingMode() ? overflowX() : overflowY(); }
	Overflow overflowBlockDirection() const { return isHorizontalWritingMode() ? overflowY() : overflowX(); }
	bool isOverflowVisible() const { return overflowX() == Overflow::Visible || overflowY() == Overflow::Visible; }

    ALWAYS_INLINE EVisibility visibility() const { return static_cast<EVisibility>(m_inheritedFlags.u._visibility); }
    ALWAYS_INLINE EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(m_nonInheritedFlags.u.verticalAlign); }
    ALWAYS_INLINE const Length& verticalAlignLength() const { return m_boxData->verticalAlign(); }

    ALWAYS_INLINE const Length& clipLeft() const { return visual->clip.left(); }
    ALWAYS_INLINE const Length& clipRight() const { return visual->clip.right(); }
    ALWAYS_INLINE const Length& clipTop() const { return visual->clip.top(); }
    ALWAYS_INLINE const Length& clipBottom() const { return visual->clip.bottom(); }
    ALWAYS_INLINE const LengthBox& clip() const { return visual->clip; }
    ALWAYS_INLINE bool hasClip() const { return visual->hasClip; }

    ALWAYS_INLINE EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(m_nonInheritedFlags.u.unicodeBidi); }

    ALWAYS_INLINE Clear clear() const { return static_cast<Clear>(m_nonInheritedFlags.u.clear); }
    static UsedClear usedClear(const RenderObject&);
	ALWAYS_INLINE ETableLayout tableLayout() const { return static_cast<ETableLayout>(m_nonInheritedFlags.u.tableLayout); }

    ALWAYS_INLINE const FontCascade& font() const { return m_inheritedData->font; }
    ALWAYS_INLINE const FontCascade& fontCascade() const { return m_inheritedData->font; }
    ALWAYS_INLINE const FontMetrics& fontMetrics() const { return m_inheritedData->font.fontMetrics(); }
    ALWAYS_INLINE const FontMetrics& metricsOfPrimaryFont() const { return m_inheritedData->font.metricsOfPrimaryFont(); }
    ALWAYS_INLINE const FontDescription& fontDescription() const { return m_inheritedData->font.fontDescription(); }
    float specifiedFontSize() const { return fontDescription().specifiedSize(); }
    float computedFontSize() const { return fontDescription().computedSize(); }
    std::pair<FontOrientation, NonCJKGlyphOrientation> fontAndGlyphOrientation();

    ALWAYS_INLINE const Length& textIndent() const { return m_rareInheritedData->indent; }
    TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(m_rareInheritedData->textIndentLine); }
    TextIndentType textIndentType() const { return static_cast<TextIndentType>(m_rareInheritedData->textIndentType); }
    ALWAYS_INLINE TextAlignMode textAlign() const { return static_cast<TextAlignMode>(m_inheritedFlags.u._text_align); }
    ALWAYS_INLINE TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(m_rareInheritedData->textAlignLast); }
	ALWAYS_INLINE ETextTransform textTransform() const { return static_cast<ETextTransform>(m_inheritedFlags.u._text_transform); }
    ALWAYS_INLINE TextDecoration textDecorationsInEffect() const { return static_cast<TextDecoration>(m_inheritedFlags.u._text_decorations); }
    ALWAYS_INLINE TextDecoration textDecoration() const { return static_cast<TextDecoration>(visual->textDecoration); }
    ALWAYS_INLINE TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(m_rareNonInheritedData->textDecorationStyle); }
    ALWAYS_INLINE TextDecorationSkip textDecorationSkip() const { return static_cast<TextDecorationSkip>(m_rareInheritedData->textDecorationSkip); }
    TextJustify textJustify() const { return static_cast<TextJustify>(m_rareInheritedData->textJustify); }
	ALWAYS_INLINE TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(m_rareInheritedData->textUnderlinePosition); }
    ALWAYS_INLINE TextUnderlineOffset textUnderlineOffset() const { return m_rareInheritedData->textUnderlineOffset; }
    ALWAYS_INLINE TextDecorationThickness textDecorationThickness() const { return m_rareNonInheritedData->textDecorationThickness; }

    const Length& wordSpacing() const { return m_rareInheritedData->wordSpacing; }
    ALWAYS_INLINE float letterSpacing() const { return m_inheritedData->font.letterSpacing(); }

    ALWAYS_INLINE float zoom() const { return visual->m_zoom; }
    ALWAYS_INLINE float effectiveZoom() const { return m_rareInheritedData->effectiveZoom; }

    TextZoom textZoom() const { return static_cast<TextZoom>(m_rareInheritedData->textZoom); }

    ALWAYS_INLINE TextDirection direction() const { return static_cast<TextDirection>(m_inheritedFlags.u._direction); }
    ALWAYS_INLINE bool isLeftToRightDirection() const { return direction() == LTR; }
    ALWAYS_INLINE bool hasExplicitlySetDirection() const { return m_nonInheritedFlags.u.hasExplicitlySetDirection; }

    ALWAYS_INLINE const Length& specifiedLineHeight() const { return m_inheritedData->line_height; }
    ALWAYS_INLINE const Length& lineHeight() const
    {
        const Length& lh = m_inheritedData->line_height;
#if ENABLE(TEXT_AUTOSIZING)
        // Unlike fontDescription().computedSize() and hence fontSize(), this is
        // recalculated on demand as we only store the specified line height.
        // FIXME: Should consider scaling the fixed part of any calc expressions
        // too, though this involves messily poking into CalcExpressionLength.
        float multiplier = textAutosizingMultiplier();
        if (multiplier > 1 && lh.isFixed())
            return Length(lh.value() * multiplier, LengthType::Fixed);
#endif
        return lh;
    }
    LayoutUnit computedLineHeight() const;
    LayoutUnit computeLineHeight(const Length&) const;

    ALWAYS_INLINE WhiteSpace whiteSpace() const { return static_cast<WhiteSpace>(m_inheritedFlags.u._white_space); }
    static bool autoWrap(WhiteSpace ws)
    {
        // Nowrap and pre don't automatically wrap.
        return ws != WhiteSpace::NoWrap && ws != WhiteSpace::Pre;
    }

    ALWAYS_INLINE bool autoWrap() const
    {
        return autoWrap(whiteSpace());
    }

    static bool preserveNewline(WhiteSpace ws)
    {
        // Normal and nowrap do not preserve newlines.
        return ws != WhiteSpace::Normal && ws != WhiteSpace::NoWrap;
    }

    ALWAYS_INLINE bool preserveNewline() const
    {
        return preserveNewline(whiteSpace());
    }

    static bool collapseWhiteSpace(WhiteSpace ws)
    {
        // Pre and prewrap do not collapse whitespace.
        return ws != WhiteSpace::Pre && ws != WhiteSpace::PreWrap && ws != WhiteSpace::BreakSpaces;
    }

    ALWAYS_INLINE bool collapseWhiteSpace() const
    {
        return collapseWhiteSpace(whiteSpace());
    }

    bool isCollapsibleWhiteSpace(UChar c) const
    {
        switch (c) {
            case ' ':
            case '\t':
                return collapseWhiteSpace();
            case '\n':
                return !preserveNewline();
        }
        return false;
    }

    bool breakOnlyAfterWhiteSpace() const
    {
        return whiteSpace() == WhiteSpace::PreWrap || whiteSpace() == WhiteSpace::BreakSpaces || lineBreak() == LineBreak::AfterWhiteSpace;
    }

    ALWAYS_INLINE bool breakWords() const
    {
        return wordBreak() == WordBreak::BreakWord || overflowWrap() == OverflowWrap::BreakWord || overflowWrap() == OverflowWrap::Anywhere;
    }

    ALWAYS_INLINE EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background->repeatX()); }
    ALWAYS_INLINE EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background->repeatY()); }
    ALWAYS_INLINE CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background->composite()); }
    ALWAYS_INLINE EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background->attachment()); }
    ALWAYS_INLINE EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background->clip()); }
    ALWAYS_INLINE EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background->origin()); }
    ALWAYS_INLINE const Length& backgroundXPosition() const { return m_background->background->xPosition(); }
    ALWAYS_INLINE const Length& backgroundYPosition() const { return m_background->background->yPosition(); }
    ALWAYS_INLINE EFillSizeType backgroundSizeType() const { return m_background->background->sizeType(); }
    ALWAYS_INLINE LengthSize backgroundSizeLength() const { return m_background->background->sizeLength(); }
    ALWAYS_INLINE FillLayer& ensureBackgroundLayers() { return m_background.access().background.access(); }
    ALWAYS_INLINE const FillLayer& backgroundLayers() const { return m_background->background; }

    ALWAYS_INLINE StyleImage* maskImage() const { return m_rareNonInheritedData->mask->image(); }
    ALWAYS_INLINE EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(m_rareNonInheritedData->mask->repeatX()); }
    ALWAYS_INLINE EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(m_rareNonInheritedData->mask->repeatY()); }
    ALWAYS_INLINE CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(m_rareNonInheritedData->mask->composite()); }
    ALWAYS_INLINE EFillBox maskClip() const { return static_cast<EFillBox>(m_rareNonInheritedData->mask->clip()); }
    ALWAYS_INLINE EFillBox maskOrigin() const { return static_cast<EFillBox>(m_rareNonInheritedData->mask->origin()); }
    ALWAYS_INLINE const Length& maskXPosition() const { return m_rareNonInheritedData->mask->xPosition(); }
    ALWAYS_INLINE const Length& maskYPosition() const { return m_rareNonInheritedData->mask->yPosition(); }
    ALWAYS_INLINE EFillSizeType maskSizeType() const { return m_rareNonInheritedData->mask->sizeType(); }
    ALWAYS_INLINE LengthSize maskSizeLength() const { return m_rareNonInheritedData->mask->sizeLength(); }
    ALWAYS_INLINE FillLayer& ensureMaskLayers() { return m_rareNonInheritedData.access().mask.access(); }
    ALWAYS_INLINE const FillLayer& maskLayers() const { return m_rareNonInheritedData->mask; }
    ALWAYS_INLINE const NinePieceImage& maskBoxImage() const { return m_rareNonInheritedData->m_maskBoxImage; }
    ALWAYS_INLINE StyleImage* maskBoxImageSource() const { return m_rareNonInheritedData->m_maskBoxImage.image(); }
 
    ALWAYS_INLINE EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse>(m_inheritedFlags.u._border_collapse); }
    ALWAYS_INLINE float horizontalBorderSpacing() const { return m_inheritedData->horizontal_border_spacing; }
    ALWAYS_INLINE float verticalBorderSpacing() const { return m_inheritedData->vertical_border_spacing; }
    ALWAYS_INLINE EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(m_inheritedFlags.u._empty_cells); }
    ALWAYS_INLINE ECaptionSide captionSide() const { return static_cast<ECaptionSide>(m_inheritedFlags.u._caption_side); }

    ALWAYS_INLINE EListStyleType listStyleType() const { return static_cast<EListStyleType>(m_inheritedFlags.u._list_style_type); }
    ALWAYS_INLINE StyleImage* listStyleImage() const { return m_rareInheritedData->listStyleImage.get(); }
    ALWAYS_INLINE EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(m_inheritedFlags.u._list_style_position); }
    bool isFixedTableLayout() const { return tableLayout() == TFIXED && (logicalWidth().isSpecified() || logicalWidth().isFitContent() || logicalWidth().isMinContent()); }

    ALWAYS_INLINE const Length& marginTop() const { return m_surroundData->margin.top(); }
    ALWAYS_INLINE const Length& marginBottom() const { return m_surroundData->margin.bottom(); }
    ALWAYS_INLINE const Length& marginLeft() const { return m_surroundData->margin.left(); }
    ALWAYS_INLINE const Length& marginRight() const { return m_surroundData->margin.right(); }
    ALWAYS_INLINE const Length& marginBefore() const { return m_surroundData->margin.before(writingMode()); }
    ALWAYS_INLINE const Length& marginAfter() const { return m_surroundData->margin.after(writingMode()); }
    ALWAYS_INLINE const Length& marginStart() const { return m_surroundData->margin.start(writingMode(), direction()); }
    ALWAYS_INLINE const Length& marginEnd() const { return m_surroundData->margin.end(writingMode(), direction()); }
    ALWAYS_INLINE const Length& marginStartUsing(const RenderStyle* otherStyle) const { return m_surroundData->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
    ALWAYS_INLINE const Length& marginEndUsing(const RenderStyle* otherStyle) const { return m_surroundData->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
    ALWAYS_INLINE const Length& marginBeforeUsing(const RenderStyle* otherStyle) const { return m_surroundData->margin.before(otherStyle->writingMode()); }
    ALWAYS_INLINE const Length& marginAfterUsing(const RenderStyle* otherStyle) const { return m_surroundData->margin.after(otherStyle->writingMode()); }

    ALWAYS_INLINE const LengthBox& paddingBox() const { return m_surroundData->padding; }
    ALWAYS_INLINE const Length& paddingTop() const { return m_surroundData->padding.top(); }
    ALWAYS_INLINE const Length& paddingBottom() const { return m_surroundData->padding.bottom(); }
    ALWAYS_INLINE const Length& paddingLeft() const { return m_surroundData->padding.left(); }
    ALWAYS_INLINE const Length& paddingRight() const { return m_surroundData->padding.right(); }
    ALWAYS_INLINE const Length& paddingBefore() const { return m_surroundData->padding.before(writingMode()); }
    ALWAYS_INLINE const Length& paddingAfter() const { return m_surroundData->padding.after(writingMode()); }
    ALWAYS_INLINE const Length& paddingStart() const { return m_surroundData->padding.start(writingMode(), direction()); }
    ALWAYS_INLINE const Length& paddingEnd() const { return m_surroundData->padding.end(writingMode(), direction()); }

    ALWAYS_INLINE ECursor cursor() const { return static_cast<ECursor>(m_inheritedFlags.u._cursor_style); }

    ALWAYS_INLINE CursorList* cursors() const { return m_rareInheritedData->cursorData.get(); }

    ALWAYS_INLINE EInsideLink insideLink() const { return static_cast<EInsideLink>(m_inheritedFlags.u._insideLink); }
    ALWAYS_INLINE bool isLink() const { return m_nonInheritedFlags.u.isLink; }

    ALWAYS_INLINE short widows() const { return m_rareInheritedData->widows; }
    ALWAYS_INLINE short orphans() const { return m_rareInheritedData->orphans; }
    ALWAYS_INLINE bool hasAutoWidows() const { return m_rareInheritedData->hasAutoWidows; }
    ALWAYS_INLINE bool hasAutoOrphans() const { return m_rareInheritedData->hasAutoOrphans; }

    // CSS3 Getter Methods
    ALWAYS_INLINE BreakInside breakInside() const { return static_cast<BreakInside>(m_rareNonInheritedData->breakInside); }
    ALWAYS_INLINE BreakBetween breakBefore() const { return static_cast<BreakBetween>(m_rareNonInheritedData->breakBefore); }
    ALWAYS_INLINE BreakBetween breakAfter() const { return static_cast<BreakBetween>(m_rareNonInheritedData->breakAfter); }

    HangingPunctuation hangingPunctuation() const { return static_cast<HangingPunctuation>(m_rareInheritedData->hangingPunctuation); }

    float outlineOffset() const;
    const ShadowData* textShadow() const { return m_rareInheritedData->textShadow.get(); }
    void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
    void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
    void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }
    void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }

    ALWAYS_INLINE float textStrokeWidth() const { return m_rareInheritedData->textStrokeWidth; }
    ALWAYS_INLINE float opacity() const { return m_rareNonInheritedData->opacity; }
    bool hasOpacity() const { return m_rareNonInheritedData->opacity < 1; }
    ControlPart appearance() const { return static_cast<ControlPart>(m_rareNonInheritedData->appearance); }
    ControlPart effectiveAppearance() const { return static_cast<ControlPart>(m_rareNonInheritedData->effectiveAppearance); }
	AspectRatioType aspectRatioType() const { return static_cast<AspectRatioType>(m_rareNonInheritedData->m_aspectRatioType); }
    double aspectRatioWidth() const { return m_rareNonInheritedData->aspectRatioWidth; }
	double aspectRatioHeight() const { return m_rareNonInheritedData->aspectRatioHeight; }
	double logicalAspectRatio() const
	{
		ASSERT(aspectRatioType() != AspectRatioType::Auto);
		if (isHorizontalWritingMode())
			return aspectRatioWidth() / aspectRatioHeight();
		return aspectRatioHeight() / aspectRatioWidth();
	}
    EBoxSizing boxSizingForAspectRatio() const
    {
        if (aspectRatioType() == AspectRatioType::AutoAndRatio)
            return EBoxSizing::CONTENT_BOX;
        return boxSizing();
    }
	bool hasAspectRatio() const { return aspectRatioType() == AspectRatioType::Ratio || aspectRatioType() == AspectRatioType::AutoAndRatio; }
#if 0
    OptionSet<Containment> contain() const { return m_rareNonInheritedData->contain; }
    OptionSet<Containment> effectiveContainment() const { return m_rareNonInheritedData->effectiveContainment(); }
    bool containsLayout() const { return effectiveContainment().contains(Containment::Layout); }
    bool containsSize() const { return effectiveContainment().contains(Containment::Size); }
#else
    OptionSet<Containment> contain() const { return OptionSet<Containment>(); }
    OptionSet<Containment> effectiveContainment() const { return OptionSet<Containment>(); }
    bool containsLayout() const { return false; }
    bool containsSize() const { return false; }
#endif

    ContentVisibility contentVisibility() const { return static_cast<ContentVisibility>(m_rareNonInheritedData->contentVisibility); }

    // effectiveContentVisibility will return ContentVisibility::Hidden in a content-visibility: hidden subtree (overriding
    // content-visibility: auto at all times), ContentVisibility::Auto in a content-visibility: auto subtree (when the
    // content is not user relevant and thus skipped), and ContentVisibility::Visible otherwise.
    inline ContentVisibility effectiveContentVisibility() const{ return static_cast<ContentVisibility>(m_rareInheritedData->effectiveContentVisibility); }
    // Returns true for skipped content roots and skipped content itself.
    inline bool hasSkippedContent() const { return effectiveContentVisibility() != ContentVisibility::Visible; }

	EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); }
    ALWAYS_INLINE EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(m_inheritedFlags.u._box_direction); }
    float boxFlex() const { return m_rareNonInheritedData->deprecatedFlexibleBox->flex; }
    unsigned int boxFlexGroup() const { return m_rareNonInheritedData->deprecatedFlexibleBox->flex_group; }
    EBoxLines boxLines() const { return static_cast<EBoxLines>(m_rareNonInheritedData->deprecatedFlexibleBox->lines); }
    unsigned int boxOrdinalGroup() const { return m_rareNonInheritedData->deprecatedFlexibleBox->ordinal_group; }
    EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(m_rareNonInheritedData->deprecatedFlexibleBox->orient); }
    EBoxPack boxPack() const { return static_cast<EBoxPack>(m_rareNonInheritedData->deprecatedFlexibleBox->pack); }

    ALWAYS_INLINE int order() const { return m_rareNonInheritedData->order; }
    ALWAYS_INLINE float flexGrow() const { return m_rareNonInheritedData->flexibleBox->m_flexGrow; }
    ALWAYS_INLINE float flexShrink() const { return m_rareNonInheritedData->flexibleBox->m_flexShrink; }
    ALWAYS_INLINE const Length& flexBasis() const { return m_rareNonInheritedData->flexibleBox->m_flexBasis; }
    const StyleContentAlignmentData& alignContent() const { return m_rareNonInheritedData->alignContent; }
	ContentPosition alignContentPosition() const { return m_rareNonInheritedData->alignContent.position(); }
	ContentDistributionType alignContentDistribution() const { return m_rareNonInheritedData->alignContent.distribution(); }
	OverflowAlignment alignContentOverflowAlignment() const { return m_rareNonInheritedData->alignContent.overflow(); }
	const StyleSelfAlignmentData& alignItems() const { return m_rareNonInheritedData->alignItems; }
	ItemPosition alignItemsPosition() const { return m_rareNonInheritedData->alignItems.position(); }
	OverflowAlignment alignItemsOverflowAlignment() const { return m_rareNonInheritedData->alignItems.overflow(); }
	const StyleSelfAlignmentData& alignSelf() const { return m_rareNonInheritedData->alignSelf; }
	ItemPosition alignSelfPosition() const { return m_rareNonInheritedData->alignSelf.position(); }
	OverflowAlignment alignSelfOverflowAlignment() const { return m_rareNonInheritedData->alignSelf.overflow(); }
	ALWAYS_INLINE EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(m_rareNonInheritedData->flexibleBox->m_flexDirection); }
    bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
    bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
    ALWAYS_INLINE EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(m_rareNonInheritedData->flexibleBox->m_flexWrap); }
    const StyleContentAlignmentData& justifyContent() const { return m_rareNonInheritedData->justifyContent; }
	ContentPosition justifyContentPosition() const { return m_rareNonInheritedData->justifyContent.position(); }
	ContentDistributionType justifyContentDistribution() const { return m_rareNonInheritedData->justifyContent.distribution(); }
	OverflowAlignment justifyContentOverflowAlignment() const { return m_rareNonInheritedData->justifyContent.overflow(); }
	const StyleSelfAlignmentData& justifyItems() const { return m_rareNonInheritedData->justifyItems; }
	ItemPosition justifyItemsPosition() const { return m_rareNonInheritedData->justifyItems.position(); }
	OverflowAlignment justifyItemsOverflowAlignment() const { return m_rareNonInheritedData->justifyItems.overflow(); }
	ItemPositionType justifyItemsPositionType() const { return m_rareNonInheritedData->justifyItems.positionType(); }
	const StyleSelfAlignmentData& justifySelf() const { return m_rareNonInheritedData->justifySelf; }
	ItemPosition justifySelfPosition() const { return m_rareNonInheritedData->justifySelf.position(); }
	OverflowAlignment justifySelfOverflowAlignment() const { return m_rareNonInheritedData->justifySelf.overflow(); }

    const Vector<GridTrackSize>& gridColumns() const { return m_rareNonInheritedData->grid->m_gridColumns; }
    const Vector<GridTrackSize>& gridRows() const { return m_rareNonInheritedData->grid->m_gridRows; }
    const Vector<GridTrackSize>& gridAutoRepeatColumns() const { return m_rareNonInheritedData->grid->m_gridAutoRepeatColumns; }
	const Vector<GridTrackSize>& gridAutoRepeatRows() const { return m_rareNonInheritedData->grid->m_gridAutoRepeatRows; }
	unsigned gridAutoRepeatColumnsInsertionPoint() const { return m_rareNonInheritedData->grid->m_autoRepeatColumnsInsertionPoint; }
	unsigned gridAutoRepeatRowsInsertionPoint() const { return m_rareNonInheritedData->grid->m_autoRepeatRowsInsertionPoint; }
	AutoRepeatType gridAutoRepeatColumnsType() const  { return m_rareNonInheritedData->grid->m_autoRepeatColumnsType; }
	AutoRepeatType gridAutoRepeatRowsType() const  { return m_rareNonInheritedData->grid->m_autoRepeatRowsType; }
    const NamedGridLinesMap& namedGridColumnLines() const { return m_rareNonInheritedData->grid->m_namedGridColumnLines; }
	const NamedGridLinesMap& namedGridRowLines() const { return m_rareNonInheritedData->grid->m_namedGridRowLines; }
	const OrderedNamedGridLinesMap& orderedNamedGridColumnLines() const { return m_rareNonInheritedData->grid->m_orderedNamedGridColumnLines; }
	const OrderedNamedGridLinesMap& orderedNamedGridRowLines() const { return m_rareNonInheritedData->grid->m_orderedNamedGridRowLines; }
	const NamedGridLinesMap& implicitNamedGridColumnLines() const { return m_rareNonInheritedData->grid->implicitNamedGridColumnLines; }
	const NamedGridLinesMap& implicitNamedGridRowLines() const { return m_rareNonInheritedData->grid->implicitNamedGridRowLines; }
	const NamedGridLinesMap& autoRepeatNamedGridColumnLines() const { return m_rareNonInheritedData->grid->m_autoRepeatNamedGridColumnLines; }
	const NamedGridLinesMap& autoRepeatNamedGridRowLines() const { return m_rareNonInheritedData->grid->m_autoRepeatNamedGridRowLines; }
	const OrderedNamedGridLinesMap& autoRepeatOrderedNamedGridColumnLines() const { return m_rareNonInheritedData->grid->m_autoRepeatOrderedNamedGridColumnLines; }
	const OrderedNamedGridLinesMap& autoRepeatOrderedNamedGridRowLines() const { return m_rareNonInheritedData->grid->m_autoRepeatOrderedNamedGridRowLines; }
	const NamedGridAreaMap& namedGridArea() const { return m_rareNonInheritedData->grid->m_namedGridArea; }
	size_t namedGridAreaRowCount() const { return m_rareNonInheritedData->grid->m_namedGridAreaRowCount; }
	size_t namedGridAreaColumnCount() const { return m_rareNonInheritedData->grid->m_namedGridAreaColumnCount; }
	GridAutoFlow gridAutoFlow() const { return static_cast<GridAutoFlow>(m_rareNonInheritedData->grid->m_gridAutoFlow); }
	bool isGridAutoFlowDirectionRow() const { return (m_rareNonInheritedData->grid->m_gridAutoFlow & InternalAutoFlowDirectionRow); }
	bool isGridAutoFlowDirectionColumn() const { return (m_rareNonInheritedData->grid->m_gridAutoFlow & InternalAutoFlowDirectionColumn); }
	bool isGridAutoFlowAlgorithmSparse() const { return (m_rareNonInheritedData->grid->m_gridAutoFlow & InternalAutoFlowAlgorithmSparse); }
	bool isGridAutoFlowAlgorithmDense() const { return (m_rareNonInheritedData->grid->m_gridAutoFlow & InternalAutoFlowAlgorithmDense); }
	const Vector<GridTrackSize>& gridAutoColumns() const { return m_rareNonInheritedData->grid->m_gridAutoColumns; }
	const Vector<GridTrackSize>& gridAutoRows() const { return m_rareNonInheritedData->grid->m_gridAutoRows; }

	const GridPosition& gridItemColumnStart() const { return m_rareNonInheritedData->gridItem->m_gridColumnStart; }
	const GridPosition& gridItemColumnEnd() const { return m_rareNonInheritedData->gridItem->m_gridColumnEnd; }
	const GridPosition& gridItemRowStart() const { return m_rareNonInheritedData->gridItem->m_gridRowStart; }
	const GridPosition& gridItemRowEnd() const { return m_rareNonInheritedData->gridItem->m_gridRowEnd; }

	ALWAYS_INLINE const ShadowData* boxShadow() const { return m_rareNonInheritedData->m_boxShadow.get(); }
	LayoutBoxExtent boxShadowExtent() const { return shadowExtent(boxShadow()); }
	LayoutBoxExtent boxShadowInsetExtent() const { return shadowInsetExtent(boxShadow()); }
	void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
    void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }
    void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); }
    void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); }

#if ENABLE(CSS_BOX_DECORATION_BREAK)
    EBoxDecorationBreak boxDecorationBreak() const { return m_boxData->boxDecorationBreak(); }
#endif
    ALWAYS_INLINE StyleReflection* boxReflect() const { return m_rareNonInheritedData->boxReflect.get(); }
    ALWAYS_INLINE EBoxSizing boxSizing() const { return m_boxData->boxSizing(); }
    ALWAYS_INLINE const Length& marqueeIncrement() const { return m_rareNonInheritedData->m_marquee->increment; }
    ALWAYS_INLINE int marqueeSpeed() const { return m_rareNonInheritedData->m_marquee->speed; }
    ALWAYS_INLINE int marqueeLoopCount() const { return m_rareNonInheritedData->m_marquee->loops; }
    MarqueeBehavior marqueeBehavior() const { return static_cast<MarqueeBehavior>(m_rareNonInheritedData->m_marquee->behavior); }
	MarqueeDirection marqueeDirection() const { return static_cast<MarqueeDirection>(m_rareNonInheritedData->m_marquee->direction); }
	ALWAYS_INLINE EUserModify userModify() const { return static_cast<EUserModify>(m_rareInheritedData->userModify); }
    ALWAYS_INLINE EUserDrag userDrag() const { return static_cast<EUserDrag>(m_rareNonInheritedData->userDrag); }
    WEBCORE_EXPORT EUserSelect effectiveUserSelect() const;
	EUserSelect userSelect() const { return static_cast<EUserSelect>(m_rareInheritedData->userSelect); }
    ALWAYS_INLINE TextOverflow textOverflow() const { return static_cast<TextOverflow>(m_rareNonInheritedData->textOverflow); }
    ALWAYS_INLINE WordBreak wordBreak() const { return static_cast<WordBreak>(m_rareInheritedData->wordBreak); }
    ALWAYS_INLINE OverflowWrap overflowWrap() const { return static_cast<OverflowWrap>(m_rareInheritedData->overflowWrap); }
	ALWAYS_INLINE ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(m_rareInheritedData->nbspMode); }
	ALWAYS_INLINE LineBreak lineBreak() const { return static_cast<LineBreak>(m_rareInheritedData->lineBreak); }
    ALWAYS_INLINE Hyphens hyphens() const { return static_cast<Hyphens>(m_rareInheritedData->hyphens); }
    ALWAYS_INLINE short hyphenationLimitBefore() const { return m_rareInheritedData->hyphenationLimitBefore; }
    ALWAYS_INLINE short hyphenationLimitAfter() const { return m_rareInheritedData->hyphenationLimitAfter; }
    ALWAYS_INLINE short hyphenationLimitLines() const { return m_rareInheritedData->hyphenationLimitLines; }
    ALWAYS_INLINE const AtomicString& hyphenationString() const { return m_rareInheritedData->hyphenationString; }
    ALWAYS_INLINE const AtomicString& locale() const { return fontDescription().locale(); }
    ALWAYS_INLINE EResize resize() const { return static_cast<EResize>(m_rareInheritedData->resize); }
    ALWAYS_INLINE ColumnAxis columnAxis() const { return static_cast<ColumnAxis>(m_rareNonInheritedData->multiCol->m_axis); }
    bool hasInlineColumnAxis() const {
        ColumnAxis axis = columnAxis();
        return axis == AutoColumnAxis || isHorizontalWritingMode() == (axis == HorizontalColumnAxis);
    }
    ALWAYS_INLINE ColumnProgression columnProgression() const { return static_cast<ColumnProgression>(m_rareNonInheritedData->multiCol->m_progression); }
    ALWAYS_INLINE float columnWidth() const { return m_rareNonInheritedData->multiCol->m_width; }
    ALWAYS_INLINE bool hasAutoColumnWidth() const { return m_rareNonInheritedData->multiCol->m_autoWidth; }
    ALWAYS_INLINE unsigned short columnCount() const { return m_rareNonInheritedData->multiCol->m_count; }
    ALWAYS_INLINE bool hasAutoColumnCount() const { return m_rareNonInheritedData->multiCol->m_autoCount; }
    bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth() || !hasInlineColumnAxis(); }
    ALWAYS_INLINE ColumnFill columnFill() const { return static_cast<ColumnFill>(m_rareNonInheritedData->multiCol->m_fill); }
    const GapLength& columnGap() const { return m_rareNonInheritedData->columnGap; }
	const GapLength& rowGap() const { return m_rareNonInheritedData->rowGap; }
	ALWAYS_INLINE EBorderStyle columnRuleStyle() const { return m_rareNonInheritedData->multiCol->m_rule.style(); }
    ALWAYS_INLINE unsigned short columnRuleWidth() const { return m_rareNonInheritedData->multiCol->ruleWidth(); }
    ALWAYS_INLINE bool columnRuleIsTransparent() const { return m_rareNonInheritedData->multiCol->m_rule.isTransparent(); }
    ALWAYS_INLINE ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(m_rareNonInheritedData->multiCol->m_columnSpan); }

    ALWAYS_INLINE const TransformOperations& transform() const { return m_rareNonInheritedData->transform->m_operations; }
    ALWAYS_INLINE bool hasTransform() const { return !m_rareNonInheritedData->transform->m_operations.operations().isEmpty(); }
	ALWAYS_INLINE const Length& transformOriginX() const { return m_rareNonInheritedData->transform->m_x; }
    ALWAYS_INLINE const Length& transformOriginY() const { return m_rareNonInheritedData->transform->m_y; }
    ALWAYS_INLINE float transformOriginZ() const { return m_rareNonInheritedData->transform->m_z; }
    ALWAYS_INLINE LengthPoint transformOriginXY() const { return m_rareNonInheritedData->transform->originXY(); }

    TransformBox transformBox() const { return m_rareNonInheritedData->transform->transformBox; }

    RotateTransformOperation* rotate() const { return m_rareNonInheritedData->rotate.get(); }
    ScaleTransformOperation* scale() const { return m_rareNonInheritedData->scale.get(); }
    TranslateTransformOperation* translate() const { return m_rareNonInheritedData->translate.get(); }

    ClipPathOperation* offsetPath() const { return m_rareNonInheritedData->offsetPath.get(); }
    void setOffsetPath(PassRefPtr<ClipPathOperation> path) { SET_VAR(m_rareNonInheritedData, offsetPath, path); }
    static ClipPathOperation* initialOffsetPath() { return nullptr; }

    bool affectsTransform() const { return hasTransform() || offsetPath() || rotate() || scale() || translate(); }

    ALWAYS_INLINE TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(m_rareInheritedData->textEmphasisFill); }
    TextEmphasisMark textEmphasisMark() const;
    ALWAYS_INLINE const AtomicString& textEmphasisCustomMark() const { return m_rareInheritedData->textEmphasisCustomMark; }
    ALWAYS_INLINE TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(m_rareInheritedData->textEmphasisPosition); }
    const AtomicString& textEmphasisMarkString() const;

    TextOrientation textOrientation() const { return static_cast<TextOrientation>(m_rareInheritedData->textOrientation); }

    RubyPosition rubyPosition() const { return static_cast<RubyPosition>(m_rareInheritedData->rubyPosition); }

    ALWAYS_INLINE ObjectFit objectFit() const { return static_cast<ObjectFit>(m_rareNonInheritedData->m_objectFit); }
    const LengthPoint& objectPosition() const { return m_rareNonInheritedData->m_objectPosition; }

    // Return true if any transform related property (currently transform, translate, scale, rotate, transformStyle3D or perspective)

    // Return true if any transform related property (currently transform, translate, scale, rotate, transformStyle3D or perspective)
    // indicates that we are transforming. The usedTransformStyle3D is not used here because in many cases (such as for deciding
    // whether or not to establish a containing block), the computed value is what matters.
    bool hasTransformRelatedProperty() const { return hasTransform() || translate() || scale() || rotate() || transformStyle3D() == TransformStyle3DPreserve3D || hasPerspective(); }

    enum class TransformOperationOption : uint8_t {
        TransformOrigin = 1 << 0,
        Translate       = 1 << 1,
        Rotate          = 1 << 2,
        Scale           = 1 << 3
    };

    static OptionSet<TransformOperationOption> allTransformOperations() {
    	return OptionSet<TransformOperationOption>(TransformOperationOption::TransformOrigin, TransformOperationOption::Translate, TransformOperationOption::Rotate, TransformOperationOption::Scale);
    }
    static OptionSet<TransformOperationOption> individualTransformOperations()
    {
    	return OptionSet<TransformOperationOption>(TransformOperationOption::Translate, TransformOperationOption::Rotate, TransformOperationOption::Scale);
    }

    bool affectedByTransformOrigin() const;

    FloatPoint computePerspectiveOrigin(const FloatRect& boundingBox) const;
    void applyPerspective(TransformationMatrix&, const RenderObject&, const FloatPoint& originTranslate) const;

    FloatPoint3D computeTransformOrigin(const FloatRect& boundingBox) const;
    void applyTransformOrigin(TransformationMatrix&, const FloatPoint3D& originTranslate) const;
    void unapplyTransformOrigin(TransformationMatrix&, const FloatPoint3D& originTranslate) const;

    // applyTransform calls applyTransformOrigin(), then applyCSSTransform(), followed by unapplyTransformOrigin().
    void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, OptionSet<TransformOperationOption> = allTransformOperations()) const;
    void applyCSSTransform(TransformationMatrix&, const FloatRect& boundingBox, OptionSet<TransformOperationOption> = allTransformOperations()) const;
    void setPageScaleTransform(float);

	bool hasPositionedMask() const { return m_rareNonInheritedData->mask->hasImage(); }
	bool hasMask() const { return m_rareNonInheritedData->mask->hasImage() || m_rareNonInheritedData->m_maskBoxImage.hasImage(); }

    ALWAYS_INLINE TextCombine textCombine() const { return static_cast<TextCombine>(m_rareNonInheritedData->textCombine); }
    ALWAYS_INLINE bool hasTextCombine() const { return textCombine() != TextCombineNone; }

    const TabSize& tabSize() const { return m_rareInheritedData->tabSize; }

    // End CSS3 Getters

    ALWAYS_INLINE const AtomicString& lineGrid() const { return m_rareInheritedData->lineGrid; }
    ALWAYS_INLINE LineSnap lineSnap() const { return static_cast<LineSnap>(m_rareInheritedData->lineSnap); }
    ALWAYS_INLINE LineAlign lineAlign() const { return static_cast<LineAlign>(m_rareInheritedData->lineAlign); }

    // Apple-specific property getter methods
    ALWAYS_INLINE EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(m_inheritedFlags.u._pointerEvents); }
    ALWAYS_INLINE const AnimationList* animations() const { return m_rareNonInheritedData->m_animations.get(); }
    ALWAYS_INLINE const AnimationList* transitions() const { return m_rareNonInheritedData->m_transitions.get(); }

    bool hasAnimationsOrTransitions() const { return hasAnimations() || hasTransitions(); }

    AnimationList& ensureAnimations();
    AnimationList& ensureTransitions();

    ALWAYS_INLINE bool hasAnimations() const { return m_rareNonInheritedData->m_animations && m_rareNonInheritedData->m_animations->size() > 0; }
    ALWAYS_INLINE bool hasTransitions() const { return m_rareNonInheritedData->m_transitions && m_rareNonInheritedData->m_transitions->size() > 0; }

    // return the first found Animation (including 'all' transitions)
    const Animation* transitionForProperty(CSSPropertyID) const;

    ETransformStyle3D transformStyle3D() const { return static_cast<ETransformStyle3D>(m_rareNonInheritedData->m_transformStyle3D); }
    ETransformStyle3D usedTransformStyle3D() const { return static_cast<bool>(m_rareNonInheritedData->transformStyleForcedToFlat) ? TransformStyle3DFlat : transformStyle3D(); }
	bool preserves3D() const { return usedTransformStyle3D() == TransformStyle3DPreserve3D; }

    EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfaceVisibility>(m_rareNonInheritedData->m_backfaceVisibility); }
    float perspective() const { return m_rareNonInheritedData->m_perspective; }
    float usedPerspective(const RenderObject&) const;
    bool hasPerspective() const { return m_rareNonInheritedData->m_perspective > 0; }
    const Length& perspectiveOriginX() const { return m_rareNonInheritedData->m_perspectiveOriginX; }
    const Length& perspectiveOriginY() const { return m_rareNonInheritedData->m_perspectiveOriginY; }
    LengthPoint perspectiveOrigin() const { return m_rareNonInheritedData->perspectiveOrigin(); }

    const LengthSize& pageSize() const { return m_rareNonInheritedData->m_pageSize; }
    PageSizeType pageSizeType() const { return static_cast<PageSizeType>(m_rareNonInheritedData->m_pageSizeType); }
    
#if USE(ACCELERATED_COMPOSITING)
    // When set, this ensures that styles compare as different. Used during accelerated animations.
    bool isRunningAcceleratedAnimation() const { return m_rareNonInheritedData->m_runningAcceleratedAnimation; }
#endif

    ALWAYS_INLINE LineBoxContain lineBoxContain() const { return m_rareInheritedData->lineBoxContain; }
    ALWAYS_INLINE const LineClampValue& lineClamp() const { return m_rareNonInheritedData->lineClamp; }
    ALWAYS_INLINE const IntSize& initialLetter() const { return m_rareNonInheritedData->initialLetter; }
    ALWAYS_INLINE int initialLetterDrop() const { return initialLetter().width(); }
    ALWAYS_INLINE int initialLetterHeight() const { return initialLetter().height(); }

    bool effectiveInert() const { return m_rareInheritedData->effectiveInert; }

#if ENABLE(TOUCH_EVENTS)
    Color tapHighlightColor() const { return m_rareInheritedData->tapHighlightColor; }
#endif
#if ENABLE(OVERFLOW_SCROLLING)
    bool useTouchOverflowScrolling() const { return m_rareInheritedData->useTouchOverflowScrolling; }
#endif
    ALWAYS_INLINE bool textSizeAdjust() const { return m_rareInheritedData->textSizeAdjust; }
    ALWAYS_INLINE ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(m_rareInheritedData->textSecurity); }

    ALWAYS_INLINE WritingMode writingMode() const { return static_cast<WritingMode>(m_inheritedFlags.u.m_writingMode); }
    ALWAYS_INLINE bool isHorizontalWritingMode() const { return WebCore::isHorizontalWritingMode(writingMode()); }
    ALWAYS_INLINE bool isVerticalWritingMode() const { return WebCore::isVerticalWritingMode(writingMode()); }
    ALWAYS_INLINE bool isFlippedLinesWritingMode() const { return WebCore::isFlippedLinesWritingMode(writingMode()); }
    ALWAYS_INLINE bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedWritingMode(writingMode()); }

#if ENABLE(CSS_IMAGE_ORIENTATION)
    ImageOrientation::Orientation imageOrientation() const { return static_cast<ImageOrientation::Orientation>(m_rareInheritedData->imageOrientation); }
#endif

    EImageRendering imageRendering() const { return static_cast<EImageRendering>(m_rareInheritedData->imageRendering); }
    
    ESpeak speak() const { return static_cast<ESpeak>(m_rareInheritedData->speak); }

    const FilterOperations& appleColorFilter() const { return m_rareInheritedData->appleColorFilter->m_operations; }
    bool hasAppleColorFilter() const { return !m_rareInheritedData->appleColorFilter->m_operations.isEmpty(); }

#if ENABLE(CSS_FILTERS)
    FilterOperations& mutableFilter() { return m_rareNonInheritedData.access().m_filter.access().m_operations; }
    const FilterOperations& filter() const { return m_rareNonInheritedData->m_filter->m_operations; }
    bool hasFilter() const { return !m_rareNonInheritedData->m_filter->m_operations.isEmpty(); }
    bool hasReferenceFilterOnly() const;
#else
    bool hasFilter() const { return false; }
#endif

#if ENABLE(FILTERS_LEVEL_2)
    FilterOperations& mutableBackdropFilter() { return m_rareNonInheritedData.access().m_backdropFilter.access().m_operations; }
    const FilterOperations& backdropFilter() const { return m_rareNonInheritedData->m_backdropFilter->m_operations; }
    bool hasBackdropFilter() const { return !m_rareNonInheritedData->m_backdropFilter->m_operations.isEmpty(); }
#else
    bool hasBackdropFilter() const { return false; }
#endif

#if ENABLE(CSS_COMPOSITING)
    BlendMode blendMode() const { return static_cast<BlendMode>(m_rareNonInheritedData->m_effectiveBlendMode); }
    void setBlendMode(BlendMode blendMode) { SET_VAR(m_rareNonInheritedData, m_effectiveBlendMode, blendMode); }
    bool hasBlendMode() const { return static_cast<BlendMode>(m_rareNonInheritedData->m_effectiveBlendMode) != BlendModeNormal; }

    Isolation isolation() const { return static_cast<Isolation>(m_rareNonInheritedData->isolation); }
    void setIsolation(Isolation isolation) { SET_VAR(m_rareNonInheritedData, isolation, isolation); }
    bool hasIsolation() const { return m_rareNonInheritedData->isolation != IsolationAuto; }
#else
    BlendMode blendMode() const { return BlendModeNormal; }
    bool hasBlendMode() const { return false; }

    Isolation isolation() const { return IsolationAuto; }
    bool hasIsolation() const { return false; }
#endif

    bool shouldPlaceVerticalScrollbarOnLeft() const;

// attribute setter methods

    void setDisplay(DisplayType value)
	{
		m_nonInheritedFlags.u.originalDisplay = static_cast<unsigned>(value);
		m_nonInheritedFlags.u.effectiveDisplay = m_nonInheritedFlags.u.originalDisplay;
	}
	void setEffectiveDisplay(DisplayType v) { m_nonInheritedFlags.u.effectiveDisplay = static_cast<unsigned>(v); }
	ALWAYS_INLINE void setPosition(PositionType v) { m_nonInheritedFlags.u.position = static_cast<unsigned>(v); }
    ALWAYS_INLINE void setFloating(Float v) { m_nonInheritedFlags.u.floating = static_cast<unsigned>(v); }

    void setLeft(const Length& v) { SET_VAR(m_surroundData, offset.left(), v) }
    void setRight(const Length& v) { SET_VAR(m_surroundData, offset.right(), v) }
    void setTop(const Length& v) { SET_VAR(m_surroundData, offset.top(), v) }
    void setBottom(const Length& v) { SET_VAR(m_surroundData, offset.bottom(), v) }

    void setWidth(const Length& v) { SET_VAR(m_boxData, m_width, v) }
    void setHeight(const Length& v) { SET_VAR(m_boxData, m_height, v) }

    void setLogicalWidth(const Length& v)
    {
        if (isHorizontalWritingMode()) {
            SET_VAR(m_boxData, m_width, v);
        } else {
            SET_VAR(m_boxData, m_height, v);
        }
    }

    void setLogicalHeight(const Length& v)
    {
        if (isHorizontalWritingMode()) {
            SET_VAR(m_boxData, m_height, v);
        } else {
            SET_VAR(m_boxData, m_width, v);
        }
    }

    void setMinWidth(const Length& v) { SET_VAR(m_boxData, m_minWidth, v) }
    void setMaxWidth(const Length& v) { SET_VAR(m_boxData, m_maxWidth, v) }
    void setMinHeight(const Length& v) { SET_VAR(m_boxData, m_minHeight, v) }
    void setMaxHeight(const Length& v) { SET_VAR(m_boxData, m_maxHeight, v) }

#if ENABLE(DASHBOARD_SUPPORT)
    Vector<StyleDashboardRegion> dashboardRegions() const { return m_rareNonInheritedData->m_dashboardRegions; }
    void setDashboardRegions(Vector<StyleDashboardRegion> regions) { SET_VAR(m_rareNonInheritedData, m_dashboardRegions, regions); }

    void setDashboardRegion(int type, const String& label, Length t, Length r, Length b, Length l, bool append)
    {
        StyleDashboardRegion region;
        region.label = label;
        region.offset.top() = WTF::move(t);
        region.offset.right() = WTF::move(r);
        region.offset.bottom() = WTF::move(b);
        region.offset.left() = WTF::move(l);
        region.type = type;
        if (!append)
            m_rareNonInheritedData.access().m_dashboardRegions.clear();
        m_rareNonInheritedData.access().m_dashboardRegions.append(region);
    }
#endif

    void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
    void resetBorderTop() { SET_VAR(m_surroundData, border.m_top, BorderValue()) }
    void resetBorderRight() { SET_VAR(m_surroundData, border.m_right, BorderValue()) }
    void resetBorderBottom() { SET_VAR(m_surroundData, border.m_bottom, BorderValue()) }
    void resetBorderLeft() { SET_VAR(m_surroundData, border.m_left, BorderValue()) }
    void resetBorderImage() { SET_VAR(m_surroundData, border.m_image, NinePieceImage()) }
    void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
    void resetBorderTopLeftRadius() { SET_VAR(m_surroundData, border.m_topLeft, initialBorderRadius()) }
    void resetBorderTopRightRadius() { SET_VAR(m_surroundData, border.m_topRight, initialBorderRadius()) }
    void resetBorderBottomLeftRadius() { SET_VAR(m_surroundData, border.m_bottomLeft, initialBorderRadius()) }
    void resetBorderBottomRightRadius() { SET_VAR(m_surroundData, border.m_bottomRight, initialBorderRadius()) }

    void setBackgroundColor(const Color& v) { SET_VAR(m_background, color, v) }

    void setBackgroundXPosition(const Length& l) { SET_NESTED_VAR(m_background, background, m_xPosition, l); }
    void setBackgroundYPosition(const Length& l) { SET_NESTED_VAR(m_background, background, m_yPosition, l); }
    void setBackgroundSize(EFillSizeType b) { SET_NESTED_VAR(m_background, background, m_sizeType, b); }
    void setBackgroundSizeLength(const LengthSize& l) { SET_NESTED_VAR(m_background, background, m_sizeLength, l); }
    
    void setBorderImage(const NinePieceImage& b) { SET_VAR(m_surroundData, border.m_image, b) }
    void setBorderImageSource(PassRefPtr<StyleImage>);
    void setBorderImageSliceFill(bool);
	void setBorderImageSlices(const LengthBox&);
	void setBorderImageWidth(const LengthBox&);
	void setBorderImageOutset(const LengthBox&);

    void setBorderTopLeftRadius(const LengthSize& s) { SET_VAR(m_surroundData, border.m_topLeft, s) }
    void setBorderTopRightRadius(const LengthSize& s) { SET_VAR(m_surroundData, border.m_topRight, s) }
    void setBorderBottomLeftRadius(const LengthSize& s) { SET_VAR(m_surroundData, border.m_bottomLeft, s) }
    void setBorderBottomRightRadius(const LengthSize& s) { SET_VAR(m_surroundData, border.m_bottomRight, s) }

    void setBorderRadius(const LengthSize& s)
    {
        setBorderTopLeftRadius(s);
        setBorderTopRightRadius(s);
        setBorderBottomLeftRadius(s);
        setBorderBottomRightRadius(s);
    }
    void setBorderRadius(const IntSize& s)
    {
        setBorderRadius(LengthSize(Length(s.width(), LengthType::Fixed), Length(s.height(), LengthType::Fixed)));
    }
    
    RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;

    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, LayoutUnit topWidth, LayoutUnit bottomWidth,
    	LayoutUnit leftWidth, LayoutUnit rightWidth, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;

    void setBorderLeftWidth(float v) { SET_VAR(m_surroundData, border.m_left.m_width, v) }
    void setBorderLeftStyle(EBorderStyle v) { SET_VAR(m_surroundData, border.m_left.m_style, v) }
    void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(m_surroundData, border.m_left, v) }
    void setBorderRightWidth(float v) { SET_VAR(m_surroundData, border.m_right.m_width, v) }
    void setBorderRightStyle(EBorderStyle v) { SET_VAR(m_surroundData, border.m_right.m_style, v) }
    void setBorderRightColor(const Color& v) { SET_BORDERVALUE_COLOR(m_surroundData, border.m_right, v) }
    void setBorderTopWidth(float v) { SET_VAR(m_surroundData, border.m_top.m_width, v) }
    void setBorderTopStyle(EBorderStyle v) { SET_VAR(m_surroundData, border.m_top.m_style, v) }
    void setBorderTopColor(const Color& v) { SET_BORDERVALUE_COLOR(m_surroundData, border.m_top, v) }
    void setBorderBottomWidth(float v) { SET_VAR(m_surroundData, border.m_bottom.m_width, v) }
    void setBorderBottomStyle(EBorderStyle v) { SET_VAR(m_surroundData, border.m_bottom.m_style, v) }
    void setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(m_surroundData, border.m_bottom, v) }

    void setOutlineWidth(float v) { SET_VAR(m_background, outline.m_width, v) }
    void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, outline.m_isAuto, isAuto) }
    void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, outline.m_style, v) }
    void setOutlineColor(const Color& v) { SET_BORDERVALUE_COLOR(m_background, outline, v) }

    ALWAYS_INLINE void setOverflowX(Overflow v) { m_nonInheritedFlags.u.overflowX = static_cast<unsigned>(v); }
    ALWAYS_INLINE void setOverflowY(Overflow v) { m_nonInheritedFlags.u.overflowY = static_cast<unsigned>(v); }
    ALWAYS_INLINE void setVisibility(EVisibility v) { m_inheritedFlags.u._visibility = static_cast<unsigned>(v); }
    ALWAYS_INLINE void setVerticalAlign(EVerticalAlign v) { m_nonInheritedFlags.u.verticalAlign = static_cast<unsigned>(v); }
    void setVerticalAlignLength(const Length& length) { setVerticalAlign(LENGTH); SET_VAR(m_boxData, m_verticalAlign, length) }

    void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b) }
    void setClipLeft(const Length& v) { SET_VAR(visual, clip.left(), v) }
    void setClipRight(const Length& v) { SET_VAR(visual, clip.right(), v) }
    void setClipTop(const Length& v) { SET_VAR(visual, clip.top(), v) }
    void setClipBottom(const Length& v) { SET_VAR(visual, clip.bottom(), v) }
    void setClip(const Length& top, const Length& right, const Length& bottom, const Length& left);
    void setClip(const LengthBox& box) { SET_VAR(visual, clip, box) }

    ALWAYS_INLINE void setUnicodeBidi(EUnicodeBidi b) { m_nonInheritedFlags.u.unicodeBidi = b; }

    ALWAYS_INLINE void setClear(Clear v) { m_nonInheritedFlags.u.clear = static_cast<unsigned>(v); }
    ALWAYS_INLINE void setTableLayout(ETableLayout v) { m_nonInheritedFlags.u.tableLayout = static_cast<unsigned>(v); }

    bool setFontDescription(const FontDescription& v)
    {
        if (m_inheritedData->font.fontDescription() != v) {
            m_inheritedData.access().font = FontCascade(v, m_inheritedData->font.letterSpacing(), m_inheritedData->font.wordSpacing());
            return true;
        }
        return false;
    }

    // Only used for blending font sizes when animating, for MathML anonymous blocks, and for text autosizing.
    void setFontSize(float);

    ALWAYS_INLINE void setColor(const Color& v) { SET_VAR(m_inheritedData, color, v) }
    ALWAYS_INLINE void setTextIndent(const Length& v) { SET_VAR(m_rareInheritedData, indent, v) }
    ALWAYS_INLINE void setTextIndentLine(TextIndentLine v) { SET_VAR(m_rareInheritedData, textIndentLine, static_cast<unsigned>(v)); }
    ALWAYS_INLINE void setTextIndentType(TextIndentType v) { SET_VAR(m_rareInheritedData, textIndentType, static_cast<unsigned>(v)); }
    ALWAYS_INLINE void setTextAlign(TextAlignMode v) { m_inheritedFlags.u._text_align = static_cast<unsigned>(v); }
    ALWAYS_INLINE void setTextAlignLast(TextAlignLast v) { SET_VAR(m_rareInheritedData, textAlignLast, static_cast<unsigned>(v)) }
	ALWAYS_INLINE void setTextTransform(ETextTransform v) { m_inheritedFlags.u._text_transform = static_cast<unsigned>(v); }
    ALWAYS_INLINE void addToTextDecorationsInEffect(TextDecoration v) { m_inheritedFlags.u._text_decorations |= v; }
    ALWAYS_INLINE void setTextDecorationsInEffect(TextDecoration v) { m_inheritedFlags.u._text_decorations = v; }
    void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v); }
    void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(m_rareNonInheritedData, textDecorationStyle, v); }
    void setTextJustify(TextJustify v) { SET_VAR(m_rareInheritedData, textJustify, v); }
	void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(m_rareInheritedData, textUnderlinePosition, static_cast<unsigned>(v)); }
    void setTextUnderlineOffset(TextUnderlineOffset textUnderlineOffset) { SET_VAR(m_rareInheritedData, textUnderlineOffset, textUnderlineOffset); }
    void setTextDecorationThickness(TextDecorationThickness textDecorationThickness) { SET_VAR(m_rareNonInheritedData, textDecorationThickness, textDecorationThickness); }

    void setTextDecorationSkip(TextDecorationSkip skip) { SET_VAR(m_rareInheritedData, textDecorationSkip, skip); }
    void setDirection(TextDirection v) { m_inheritedFlags.u._direction = v; }
    void setHasExplicitlySetDirection(bool v) { m_nonInheritedFlags.u.hasExplicitlySetDirection = v; }
	void setLineHeight(const Length& specifiedLineHeight) { SET_VAR(m_inheritedData, line_height, specifiedLineHeight); }
    bool setZoom(float);
    void setZoomWithoutReturnValue(float f) { setZoom(f); }
    bool setEffectiveZoom(float);
    void setTextZoom(TextZoom v) { SET_VAR(m_rareInheritedData, textZoom, v); }

#if ENABLE(CSS_IMAGE_ORIENTATION)
    void setImageOrientation(ImageOrientation::Orientation v) { SET_VAR(m_rareInheritedData, imageOrientation, static_cast<int>(v)) }
#endif

    void setImageRendering(EImageRendering v) { SET_VAR(m_rareInheritedData, imageRendering, v) }

    ALWAYS_INLINE void setWhiteSpace(WhiteSpace v) { m_inheritedFlags.u._white_space = static_cast<unsigned>(v); }

    void setWordSpacing(const Length&);
    void setLetterSpacing(float v) { m_inheritedData.access().font.setLetterSpacing(v); }

    void clearBackgroundLayers() { m_background.access().background = FillLayer::create(BackgroundFillLayer); }
    void inheritBackgroundLayers(const FillLayer& parent) { m_background.access().background = FillLayer::create(parent); }

    void adjustBackgroundLayers()
    {
        if (backgroundLayers().next()) {
        	ensureBackgroundLayers().cullEmptyLayers();
        	ensureBackgroundLayers().fillUnsetProperties();
        }
    }

    void clearMaskLayers() { m_rareNonInheritedData.access().mask = FillLayer::create(MaskFillLayer); }
    void inheritMaskLayers(const FillLayer& parent) { m_rareNonInheritedData.access().mask = FillLayer::create(parent); }

    void adjustMaskLayers()
    {
        if (maskLayers().next()) {
        	ensureMaskLayers().cullEmptyLayers();
        	ensureMaskLayers().fillUnsetProperties();
        }
    }

    void setMaskImage(PassRefPtr<StyleImage> v) { m_rareNonInheritedData.access().mask.access().setImage(v); }

    void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(m_rareNonInheritedData, m_maskBoxImage, b) }
    void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { m_rareNonInheritedData.access().m_maskBoxImage.setImage(v); }
    void setMaskXPosition(const Length& l) { SET_NESTED_VAR(m_rareNonInheritedData, mask, m_xPosition, l); }
    void setMaskYPosition(const Length& l) { SET_NESTED_VAR(m_rareNonInheritedData, mask, m_yPosition, l); }
    void setMaskSize(LengthSize l) { SET_NESTED_VAR(m_rareNonInheritedData, mask, m_sizeLength, l); }

    ALWAYS_INLINE void setBorderCollapse(EBorderCollapse collapse) { m_inheritedFlags.u._border_collapse = collapse; }
    void setHorizontalBorderSpacing(float v) { SET_VAR(m_inheritedData, horizontal_border_spacing, v) }
    void setVerticalBorderSpacing(float v) { SET_VAR(m_inheritedData, vertical_border_spacing, v) }
    ALWAYS_INLINE void setEmptyCells(EEmptyCell v) { m_inheritedFlags.u._empty_cells = v; }
    ALWAYS_INLINE void setCaptionSide(ECaptionSide v) { m_inheritedFlags.u._caption_side = v; }

    void setAspectRatioType(AspectRatioType aspectRatioType) { SET_VAR(m_rareNonInheritedData, m_aspectRatioType, static_cast<unsigned>(aspectRatioType)); }
    void setAspectRatio(double width, double height) { SET_VAR(m_rareNonInheritedData, aspectRatioWidth, width); SET_VAR(m_rareNonInheritedData, aspectRatioHeight, height); }

    void setContentVisibility(ContentVisibility value) { SET_VAR(m_rareNonInheritedData, contentVisibility, static_cast<unsigned>(value)); }

    inline void setEffectiveContentVisibility(ContentVisibility effectiveContentVisibility) { SET_VAR(m_rareInheritedData, effectiveContentVisibility, static_cast<unsigned>(effectiveContentVisibility)); }

    ALWAYS_INLINE void setListStyleType(EListStyleType v) { m_inheritedFlags.u._list_style_type = v; }
    void setListStyleImage(PassRefPtr<StyleImage> v)
    {
        if (m_rareInheritedData->listStyleImage != v)
            m_rareInheritedData.access().listStyleImage = v;
    }
    ALWAYS_INLINE void setListStylePosition(EListStylePosition v) { m_inheritedFlags.u._list_style_position = v; }

    void resetMargin() { SET_VAR(m_surroundData, margin, LengthBox(LengthType::Fixed)) }
    void setMarginTop(const Length& v) { SET_VAR(m_surroundData, margin.top(), v) }
    void setMarginBottom(const Length& v) { SET_VAR(m_surroundData, margin.bottom(), v) }
    void setMarginLeft(const Length& v) { SET_VAR(m_surroundData, margin.left(), v) }
    void setMarginRight(const Length& v) { SET_VAR(m_surroundData, margin.right(), v) }
    void setMarginStart(Length);
    void setMarginEnd(Length);

    void resetPadding() { SET_VAR(m_surroundData, padding, LengthBox(LengthType::Auto)) }
    void setPaddingBox(const LengthBox& b) { SET_VAR(m_surroundData, padding, b) }
    void setPaddingTop(const Length& v) { SET_VAR(m_surroundData, padding.top(), v) }
    void setPaddingBottom(const Length& v) { SET_VAR(m_surroundData, padding.bottom(), v) }
    void setPaddingLeft(const Length& v) { SET_VAR(m_surroundData, padding.left(), v) }
    void setPaddingRight(const Length& v) { SET_VAR(m_surroundData, padding.right(), v) }

    ALWAYS_INLINE void setCursor(ECursor c) { m_inheritedFlags.u._cursor_style = c; }
    void addCursor(PassRefPtr<StyleImage>, const Optional<IntPoint>& hotSpot);
    void setCursorList(PassRefPtr<CursorList>);
    void clearCursorList();

    ALWAYS_INLINE void setInsideLink(EInsideLink insideLink) { m_inheritedFlags.u._insideLink = insideLink; }
    ALWAYS_INLINE void setIsLink(bool b) { m_nonInheritedFlags.u.isLink = b; }

    ALWAYS_INLINE PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(m_inheritedFlags.u.m_printColorAdjust); }
    ALWAYS_INLINE void setPrintColorAdjust(PrintColorAdjust value) { m_inheritedFlags.u.m_printColorAdjust = value; }

    int specifiedZIndex() const { return m_boxData->specifiedZIndex(); }
    bool hasAutoSpecifiedZIndex() const { return m_boxData->hasAutoSpecifiedZIndex(); }
    void setSpecifiedZIndex(int v)
    {
        SET_VAR(m_boxData, m_hasAutoSpecifiedZIndex, false);
        SET_VAR(m_boxData, m_specifiedZIndex, v);
    }
    void setHasAutoSpecifiedZIndex()
    {
        SET_VAR(m_boxData, m_hasAutoSpecifiedZIndex, true);
        SET_VAR(m_boxData, m_specifiedZIndex, 0);
    }

    int usedZIndex() const { return m_boxData->usedZIndex(); }
    bool hasAutoUsedZIndex() const { return m_boxData->hasAutoUsedZIndex(); }
    void setUsedZIndex(int v)
    {
        SET_VAR(m_boxData, m_hasAutoUsedZIndex, false);
        SET_VAR(m_boxData, m_usedZIndex, v);
    }
    void setHasAutoUsedZIndex()
    {
        SET_VAR(m_boxData, m_hasAutoUsedZIndex, true);
        SET_VAR(m_boxData, m_usedZIndex, 0);
    }

    void setHasAutoWidows() { SET_VAR(m_rareInheritedData, hasAutoWidows, true); SET_VAR(m_rareInheritedData, widows, initialWidows()) }
    void setWidows(short w) { SET_VAR(m_rareInheritedData, hasAutoWidows, false); SET_VAR(m_rareInheritedData, widows, w); }

    void setHasAutoOrphans() { SET_VAR(m_rareInheritedData, hasAutoOrphans, true); SET_VAR(m_rareInheritedData, orphans, initialOrphans()) }
    void setOrphans(short o) { SET_VAR(m_rareInheritedData, hasAutoOrphans, false); SET_VAR(m_rareInheritedData, orphans, o); }

    // CSS3 Setters
    void setOutlineOffset(float v) { SET_VAR(m_background, outline.m_offset, v) }
    void setTextShadow(PassOwnPtr<ShadowData>, bool add = false);
    void setTextStrokeColor(const Color& c) { SET_VAR(m_rareInheritedData, textStrokeColor, c) }
    void setTextStrokeWidth(float w) { SET_VAR(m_rareInheritedData, textStrokeWidth, w) }
    void setTextFillColor(const Color& c) { SET_VAR(m_rareInheritedData, textFillColor, c) }
    void setCaretColor(const Color& c) { SET_VAR(m_rareInheritedData, caretColor, c); }
	void setOpacity(float f) { float v = clampTo<float>(f, 0.f, 1.f); SET_VAR(m_rareNonInheritedData, opacity, v); }
	void setAppearance(ControlPart a) { SET_VAR(m_rareNonInheritedData, appearance, a); SET_VAR(m_rareNonInheritedData, effectiveAppearance, a); }
	void setEffectiveAppearance(ControlPart a) { SET_VAR(m_rareNonInheritedData, effectiveAppearance, a); }
	// For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
    void setBoxAlign(EBoxAlignment a) { SET_NESTED_VAR(m_rareNonInheritedData, deprecatedFlexibleBox, align, a); }
#if ENABLE(CSS_BOX_DECORATION_BREAK)
    void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_boxData, m_boxDecorationBreak, b); }
#endif
    ALWAYS_INLINE void setBoxDirection(EBoxDirection d) { m_inheritedFlags.u._box_direction = d; }
    void setBoxFlex(float f) { SET_NESTED_VAR(m_rareNonInheritedData, deprecatedFlexibleBox, flex, f); }
    void setBoxFlexGroup(unsigned int fg) { SET_NESTED_VAR(m_rareNonInheritedData, deprecatedFlexibleBox, flex_group, fg); }
    void setBoxLines(EBoxLines l) { SET_NESTED_VAR(m_rareNonInheritedData, deprecatedFlexibleBox, lines, l); }
    void setBoxOrdinalGroup(unsigned int og) { SET_NESTED_VAR(m_rareNonInheritedData, deprecatedFlexibleBox, ordinal_group, og); }
    void setBoxOrient(EBoxOrient o) { SET_NESTED_VAR(m_rareNonInheritedData, deprecatedFlexibleBox, orient, o); }
    void setBoxPack(EBoxPack p) { SET_NESTED_VAR(m_rareNonInheritedData, deprecatedFlexibleBox, pack, p); }
    void setBoxShadow(PassOwnPtr<ShadowData>, bool add = false);
    void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (m_rareNonInheritedData->boxReflect != reflect) m_rareNonInheritedData.access().boxReflect = reflect; }
    void setBoxSizing(EBoxSizing s) { SET_VAR(m_boxData, m_boxSizing, s); }
    void setFlexGrow(float f) { float clampedGrow = std::max<float>(f, 0.f); SET_NESTED_VAR(m_rareNonInheritedData, flexibleBox, m_flexGrow, clampedGrow); }
    void setFlexShrink(float f) { float clampledShrink = std::max<float>(f, 0.f); SET_NESTED_VAR(m_rareNonInheritedData, flexibleBox, m_flexShrink, clampledShrink); }
    void setFlexBasis(const Length& length) { SET_NESTED_VAR(m_rareNonInheritedData, flexibleBox, m_flexBasis, length); }
    void setOrder(int o) { SET_VAR(m_rareNonInheritedData, order, o); }
    void setAlignContent(const StyleContentAlignmentData& data) { SET_VAR(m_rareNonInheritedData, alignContent, data); }
	void setAlignContentPosition(ContentPosition position) { m_rareNonInheritedData.access().alignContent.setPosition(position); }
	void setAlignContentOverflow(OverflowAlignment overflow) { m_rareNonInheritedData.access().alignContent.setOverflow(overflow); }
	void setAlignContentDistribution(ContentDistributionType distribution) { m_rareNonInheritedData.access().alignContent.setDistribution(distribution); }
	void setAlignItems(const StyleSelfAlignmentData& data) { SET_VAR(m_rareNonInheritedData, alignItems, data); }
	void setAlignItemsPosition(ItemPosition position) { m_rareNonInheritedData.access().alignItems.setPosition(position); }
	void setAlignItemsOverflow(OverflowAlignment overflow) { m_rareNonInheritedData.access().alignItems.setOverflow(overflow); }
	void setAlignSelf(const StyleSelfAlignmentData& data) { SET_VAR(m_rareNonInheritedData, alignSelf, data); }
	void setAlignSelfPosition(ItemPosition position) { m_rareNonInheritedData.access().alignSelf.setPosition(position); }
	void setAlignSelfOverflow(OverflowAlignment overflow) { m_rareNonInheritedData.access().alignSelf.setOverflow(overflow); }
	void setFlexDirection(EFlexDirection direction) { SET_NESTED_VAR(m_rareNonInheritedData, flexibleBox, m_flexDirection, direction); }
    void setFlexWrap(EFlexWrap w) { SET_NESTED_VAR(m_rareNonInheritedData, flexibleBox, m_flexWrap, w); }
    void setJustifyContent(const StyleContentAlignmentData& data) { SET_VAR(m_rareNonInheritedData, justifyContent, data); }
	void setJustifyContentPosition(ContentPosition position) { m_rareNonInheritedData.access().justifyContent.setPosition(position); }
	void setJustifyContentOverflow(OverflowAlignment overflow) { m_rareNonInheritedData.access().justifyContent.setOverflow(overflow); }
	void setJustifyContentDistribution(ContentDistributionType distribution) { m_rareNonInheritedData.access().justifyContent.setDistribution(distribution); }
	void setJustifyItems(const StyleSelfAlignmentData& data) { SET_VAR(m_rareNonInheritedData, justifyItems, data); }
	void setJustifyItemsPosition(ItemPosition position) { m_rareNonInheritedData.access().justifyItems.setPosition(position); }
	void setJustifyItemsOverflow(OverflowAlignment overflow) { m_rareNonInheritedData.access().justifyItems.setOverflow(overflow); }
	void setJustifyItemsPositionType(ItemPositionType positionType) { m_rareNonInheritedData.access().justifyItems.setPositionType(positionType); }
	void setJustifySelf(const StyleSelfAlignmentData& data) { SET_VAR(m_rareNonInheritedData, justifySelf, data); }
	void setJustifySelfPosition(ItemPosition position) { m_rareNonInheritedData.access().justifySelf.setPosition(position); }
	void setJustifySelfOverflow(OverflowAlignment overflow) { m_rareNonInheritedData.access().justifySelf.setOverflow(overflow); }
	void setGridAutoColumns(const Vector<GridTrackSize>& trackSizeList) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_gridAutoColumns, trackSizeList); }
	void setGridAutoRows(const Vector<GridTrackSize>& trackSizeList) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_gridAutoRows, trackSizeList); }
    void setGridColumns(const Vector<GridTrackSize>& lengths) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_gridColumns, lengths); }
    void setGridRows(const Vector<GridTrackSize>& lengths) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_gridRows, lengths); }
    void setGridAutoRepeatColumns(const Vector<GridTrackSize>& lengths) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_gridAutoRepeatColumns, lengths); }
	void setGridAutoRepeatRows(const Vector<GridTrackSize>& lengths) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_gridAutoRepeatRows, lengths); }
	void setGridAutoRepeatColumnsInsertionPoint(const unsigned insertionPoint) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_autoRepeatColumnsInsertionPoint, insertionPoint); }
	void setGridAutoRepeatRowsInsertionPoint(const unsigned insertionPoint) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_autoRepeatRowsInsertionPoint, insertionPoint); }
	void setGridAutoRepeatColumnsType(const AutoRepeatType autoRepeatType) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_autoRepeatColumnsType, autoRepeatType); }
	void setGridAutoRepeatRowsType(const AutoRepeatType autoRepeatType) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_autoRepeatRowsType, autoRepeatType); }
	void setNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_namedGridColumnLines, namedGridColumnLines); }
	void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_namedGridRowLines, namedGridRowLines); }
	void setOrderedNamedGridColumnLines(const OrderedNamedGridLinesMap& orderedNamedGridColumnLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_orderedNamedGridColumnLines, orderedNamedGridColumnLines); }
	void setOrderedNamedGridRowLines(const OrderedNamedGridLinesMap& orderedNamedGridRowLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_orderedNamedGridRowLines, orderedNamedGridRowLines); }
	void setAutoRepeatNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_autoRepeatNamedGridColumnLines, namedGridColumnLines); }
	void setAutoRepeatNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_autoRepeatNamedGridRowLines, namedGridRowLines); }
	void setAutoRepeatOrderedNamedGridColumnLines(const OrderedNamedGridLinesMap& orderedNamedGridColumnLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_autoRepeatOrderedNamedGridColumnLines, orderedNamedGridColumnLines); }
	void setAutoRepeatOrderedNamedGridRowLines(const OrderedNamedGridLinesMap& orderedNamedGridRowLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_autoRepeatOrderedNamedGridRowLines, orderedNamedGridRowLines); }
	void setImplicitNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, implicitNamedGridColumnLines, namedGridColumnLines); }
	void setImplicitNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_NESTED_VAR(m_rareNonInheritedData, grid, implicitNamedGridRowLines, namedGridRowLines); }
	void setNamedGridArea(const NamedGridAreaMap& namedGridArea) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_namedGridArea, namedGridArea); }
	void setNamedGridAreaRowCount(size_t rowCount) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_namedGridAreaRowCount, rowCount); }
	void setNamedGridAreaColumnCount(size_t columnCount) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_namedGridAreaColumnCount, columnCount); }
	void setGridAutoFlow(GridAutoFlow flow) { SET_NESTED_VAR(m_rareNonInheritedData, grid, m_gridAutoFlow, flow); }
    void setGridItemColumnStart(const GridPosition& columnStartPosition) { SET_NESTED_VAR(m_rareNonInheritedData, gridItem, m_gridColumnStart, columnStartPosition); }
	void setGridItemColumnEnd(const GridPosition& columnEndPosition) { SET_NESTED_VAR(m_rareNonInheritedData, gridItem, m_gridColumnEnd, columnEndPosition); }
	void setGridItemRowStart(const GridPosition& rowStartPosition) { SET_NESTED_VAR(m_rareNonInheritedData, gridItem, m_gridRowStart, rowStartPosition); }
	void setGridItemRowEnd(const GridPosition& rowEndPosition) { SET_NESTED_VAR(m_rareNonInheritedData, gridItem, m_gridRowEnd, rowEndPosition); }

    void setMarqueeIncrement(const Length& f) { SET_NESTED_VAR(m_rareNonInheritedData, m_marquee, increment, f); }
    void setMarqueeSpeed(int f) { SET_NESTED_VAR(m_rareNonInheritedData, m_marquee, speed, f); }
    void setMarqueeDirection(MarqueeDirection d) { SET_NESTED_VAR(m_rareNonInheritedData, m_marquee, direction, static_cast<unsigned>(d)); }
    void setMarqueeBehavior(MarqueeBehavior b) { SET_NESTED_VAR(m_rareNonInheritedData, m_marquee, behavior, static_cast<unsigned>(b)); }
    void setMarqueeLoopCount(int i) { SET_NESTED_VAR(m_rareNonInheritedData, m_marquee, loops, i); }
    void setUserModify(EUserModify u) { SET_VAR(m_rareInheritedData, userModify, u); }
    void setUserDrag(EUserDrag d) { SET_VAR(m_rareNonInheritedData, userDrag, d); }
    void setUserSelect(EUserSelect s) { SET_VAR(m_rareInheritedData, userSelect, s); }
    void setTextOverflow(TextOverflow overflow) { SET_VAR(m_rareNonInheritedData, textOverflow, overflow); }
    void setWordBreak(WordBreak b) { SET_VAR(m_rareInheritedData, wordBreak, static_cast<unsigned>(b)); }
    void setOverflowWrap(OverflowWrap b) { SET_VAR(m_rareInheritedData, overflowWrap, static_cast<unsigned>(b)); }
	void setNBSPMode(ENBSPMode b) { SET_VAR(m_rareInheritedData, nbspMode, b); }
	void setLineBreak(LineBreak b) { SET_VAR(m_rareInheritedData, lineBreak, static_cast<unsigned>(b)); }
    void setHyphens(Hyphens h) { SET_VAR(m_rareInheritedData, hyphens, h); }
    void setHyphenationLimitBefore(short limit) { SET_VAR(m_rareInheritedData, hyphenationLimitBefore, limit); }
    void setHyphenationLimitAfter(short limit) { SET_VAR(m_rareInheritedData, hyphenationLimitAfter, limit); }
    void setHyphenationLimitLines(short limit) { SET_VAR(m_rareInheritedData, hyphenationLimitLines, limit); }
    void setHyphenationString(const AtomicString& h) { SET_VAR(m_rareInheritedData, hyphenationString, h); }
    void setResize(EResize r) { SET_VAR(m_rareInheritedData, resize, r); }
    void setColumnAxis(ColumnAxis axis) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_axis, axis); }
    void setColumnProgression(ColumnProgression progression) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_progression, progression); }
    void setColumnWidth(float f) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_autoWidth, false); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_width, f); }
    void setHasAutoColumnWidth() { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_autoWidth, true); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_width, 0); }
    void setColumnCount(unsigned short c) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_autoCount, false); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_count, c); }
    void setHasAutoColumnCount() { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_autoCount, true); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_count, initialColumnCount()); }
    void setColumnFill(ColumnFill columnFill) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_fill, columnFill); }
    void setColumnGap(const GapLength& gapLength) { SET_VAR(m_rareNonInheritedData, columnGap, gapLength); }
	void setRowGap(const GapLength& gapLength) { SET_VAR(m_rareNonInheritedData, rowGap, gapLength); }
	void setColumnRuleColor(const Color& c) { SET_BORDERVALUE_COLOR(m_rareNonInheritedData.access().multiCol, m_rule, c); }
    void setColumnRuleStyle(EBorderStyle b) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_rule.m_style, b); }
    void setColumnRuleWidth(unsigned short w) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_rule.m_width, w); }
    void resetColumnRule() { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_rule, BorderValue()); }
    void setColumnSpan(ColumnSpan columnSpan) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_columnSpan, columnSpan); }
    void inheritColumnPropertiesFrom(const RenderStyle* parent) { m_rareNonInheritedData.access().multiCol = parent->m_rareNonInheritedData->multiCol; }

    void setTransform(const TransformOperations& ops) { SET_NESTED_VAR(m_rareNonInheritedData, transform, m_operations, ops); }
    void setTransformOriginX(const Length& l) { SET_NESTED_VAR(m_rareNonInheritedData, transform, m_x, l); }
    void setTransformOriginY(const Length& l) { SET_NESTED_VAR(m_rareNonInheritedData, transform, m_y, l); }
    void setTransformOriginZ(float f) { SET_NESTED_VAR(m_rareNonInheritedData, transform, m_z, f); }
    void setTransformBox(TransformBox box) { SET_NESTED_VAR(m_rareNonInheritedData, transform, transformBox, box); }

    void setRotate(PassRefPtr<RotateTransformOperation>);
    void setScale(PassRefPtr<ScaleTransformOperation>);
    void setTranslate(PassRefPtr<TranslateTransformOperation>);

    void setSpeak(ESpeak s) { SET_VAR(m_rareInheritedData, speak, s); }
    void setTextCombine(TextCombine v) { SET_VAR(m_rareNonInheritedData, textCombine, v); }
    void setTextDecorationColor(const Color& c) { SET_VAR(m_rareNonInheritedData, m_textDecorationColor, c); }
    void setTextEmphasisColor(const Color& c) { SET_VAR(m_rareInheritedData, textEmphasisColor, c) }
    void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(m_rareInheritedData, textEmphasisFill, fill); }
    void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(m_rareInheritedData, textEmphasisMark, mark); }
    void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(m_rareInheritedData, textEmphasisCustomMark, mark); }
    void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(m_rareInheritedData, textEmphasisPosition, position); }
    bool setTextOrientation(TextOrientation);

    void setRubyPosition(RubyPosition position) { SET_VAR(m_rareInheritedData, rubyPosition, position); }

    void setObjectFit(ObjectFit fit) { SET_VAR(m_rareNonInheritedData, m_objectFit, fit); }
    void setObjectPosition(const LengthPoint& position) { SET_VAR(m_rareNonInheritedData, m_objectPosition, position); }

#if ENABLE(CSS_FILTERS)
    void setFilter(const FilterOperations& ops) { SET_NESTED_VAR(m_rareNonInheritedData, m_filter, m_operations, ops); }
#endif
#if ENABLE(FILTERS_LEVEL_2)
    void setBackdropFilter(const FilterOperations& ops) { SET_NESTED_VAR(m_rareNonInheritedData, m_backdropFilter, m_operations, ops); }
#endif

    void setTabSize(const TabSize& size) { SET_VAR(m_rareInheritedData, tabSize, size); }

    void setBreakBefore(BreakBetween breakBehavior) { SET_VAR(m_rareNonInheritedData, breakBefore, breakBehavior); }
    void setBreakAfter(BreakBetween breakBehavior) { SET_VAR(m_rareNonInheritedData, breakAfter, breakBehavior); }
    void setBreakInside(BreakInside breakBehavior) { SET_VAR(m_rareNonInheritedData, breakInside, breakBehavior); }

    void setHangingPunctuation(HangingPunctuation punctuation) { SET_VAR(m_rareInheritedData, hangingPunctuation, punctuation); }

    // End CSS3 Setters

    void setLineGrid(const AtomicString& lineGrid) { SET_VAR(m_rareInheritedData, lineGrid, lineGrid); }
    void setLineSnap(LineSnap lineSnap) { SET_VAR(m_rareInheritedData, lineSnap, lineSnap); }
    void setLineAlign(LineAlign lineAlign) { SET_VAR(m_rareInheritedData, lineAlign, lineAlign); }

    // Apple-specific property setters
    ALWAYS_INLINE void setPointerEvents(EPointerEvents p) { m_inheritedFlags.u._pointerEvents = p; }

    void clearAnimations()
    {
        m_rareNonInheritedData.access().m_animations.clear();
    }

    void clearTransitions()
    {
        m_rareNonInheritedData.access().m_transitions.clear();
    }

    void adjustAnimations();
    void adjustTransitions();

    void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(m_rareNonInheritedData, m_transformStyle3D, b); }
    void setTransformStyleForcedToFlat(bool b) { SET_VAR(m_rareNonInheritedData, transformStyleForcedToFlat, static_cast<unsigned>(b)); }
	void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(m_rareNonInheritedData, m_backfaceVisibility, b); }
    void setPerspective(float p) { SET_VAR(m_rareNonInheritedData, m_perspective, p); }
    void setPerspectiveOriginX(const Length& l) { SET_VAR(m_rareNonInheritedData, m_perspectiveOriginX, l); }
    void setPerspectiveOriginY(const Length& l) { SET_VAR(m_rareNonInheritedData, m_perspectiveOriginY, l); }
    void setPageSize(LengthSize s) { SET_VAR(m_rareNonInheritedData, m_pageSize, s); }
    void setPageSizeType(PageSizeType t) { SET_VAR(m_rareNonInheritedData, m_pageSizeType, t); }
    void resetPageSizeType() { SET_VAR(m_rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }

#if USE(ACCELERATED_COMPOSITING)
    void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(m_rareNonInheritedData, m_runningAcceleratedAnimation, b); }
#endif

    void setLineBoxContain(LineBoxContain c) { SET_VAR(m_rareInheritedData, lineBoxContain, c); }
    void setLineClamp(LineClampValue c) { SET_VAR(m_rareNonInheritedData, lineClamp, c); }

    void setInitialLetter(const IntSize& size) { SET_VAR(m_rareNonInheritedData, initialLetter, size); }

    // internal property
    void setEffectiveInert(bool effectiveInert) { SET_VAR(m_rareInheritedData, effectiveInert, effectiveInert); }

#if ENABLE(TOUCH_EVENTS)
    void setTapHighlightColor(const Color& c) { SET_VAR(m_rareInheritedData, tapHighlightColor, c); }
#endif
#if ENABLE(OVERFLOW_SCROLLING)
    void setUseTouchOverflowScrolling(bool v) { SET_VAR(m_rareInheritedData, useTouchOverflowScrolling, v); }
#endif
    bool setTextSizeAdjust(bool);
    void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(m_rareInheritedData, textSecurity, aTextSecurity); }

    // Support for paint-order, stroke-linecap, stroke-linejoin, and stroke-miterlimit from https://drafts.fxtf.org/paint/.
	void setPaintOrder(PaintOrder order) { SET_VAR(m_rareInheritedData, paintOrder, static_cast<unsigned>(order)); }
    PaintOrder paintOrder() const { return static_cast<PaintOrder>(m_rareInheritedData->paintOrder); }
    static PaintOrder initialPaintOrder() { return PaintOrder::Normal; }
    static Vector<PaintType, 3> paintTypesForPaintOrder(PaintOrder);

    void setCapStyle(LineCap val) { SET_VAR(m_rareInheritedData, capStyle, val); }
    LineCap capStyle() const { return static_cast<LineCap>(m_rareInheritedData->capStyle); }
    static LineCap initialCapStyle() { return ButtCap; }

    void setJoinStyle(LineJoin val) { SET_VAR(m_rareInheritedData, joinStyle, val); }
    LineJoin joinStyle() const { return static_cast<LineJoin>(m_rareInheritedData->joinStyle); }
    static LineJoin initialJoinStyle() { return MiterJoin; }

    const Length& strokeWidth() const { return m_rareInheritedData->strokeWidth; }
    void setStrokeWidth(const Length& w) { SET_VAR(m_rareInheritedData, strokeWidth, w); }
    static Length initialStrokeWidth() { return initialOneLength(); }

    const Color& strokeColor() const { return m_rareInheritedData->strokeColor; }
    void setStrokeColor(const Color& v)  { SET_VAR(m_rareInheritedData, strokeColor, v); }
    void setVisitedLinkStrokeColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkStrokeColor, v); }
    const Color& visitedLinkStrokeColor() const { return m_rareInheritedData->visitedLinkStrokeColor; }
    void setHasExplicitlySetStrokeColor(bool v) { SET_VAR(m_rareInheritedData, hasSetStrokeColor, static_cast<unsigned>(v)); }
    bool hasExplicitlySetStrokeColor() const { return m_rareInheritedData->hasSetStrokeColor; };
    static Color initialStrokeColor() { return Color(Color::transparent); }
    Color computedStrokeColor() const;
    CSSPropertyID effectiveStrokeColorProperty() const { return hasExplicitlySetStrokeColor() ? CSSPropertyStrokeColor : CSSPropertyWebkitTextStrokeColor; }

    float strokeMiterLimit() const { return m_rareInheritedData->miterLimit; }
    void setStrokeMiterLimit(float f) { SET_VAR(m_rareInheritedData, miterLimit, f); }
    static float initialStrokeMiterLimit() { return defaultMiterLimit; }

#if ENABLE(SVG)
    bool hasVisibleStroke() const { return svgStyle().hasStroke() && !strokeWidth().isZero(); }

    float computedStrokeWidth(const IntSize& viewportSize) const;
    void setHasExplicitlySetStrokeWidth(bool v) { SET_VAR(m_rareInheritedData, hasSetStrokeWidth, static_cast<unsigned>(v)); }
    bool hasExplicitlySetStrokeWidth() const { return m_rareInheritedData->hasSetStrokeWidth; };
    bool hasPositiveStrokeWidth() const;

    const SVGRenderStyle& svgStyle() const { return m_svgStyle.get(); }
    SVGRenderStyle& accessSVGStyle() { return m_svgStyle.access(); }

    SVGPaintType fillPaintType() const { return svgStyle().fillPaintType(); }
    SVGPaintType visitedFillPaintType() const { return svgStyle().visitedLinkFillPaintType(); }
    const Color& fillPaintColor() const { return svgStyle().fillPaintColor(); }
    const Color& visitedFillPaintColor() const { return svgStyle().visitedLinkFillPaintColor(); }
    void setFillPaintColor(const Color& c) { accessSVGStyle().setFillPaint(SVG_PAINTTYPE_RGBCOLOR, c, emptyString(), true, false); }
    void setVisitedFillPaintColor(const Color& c) { accessSVGStyle().setFillPaint(SVG_PAINTTYPE_RGBCOLOR, c, emptyString(), false, true); }
    float fillOpacity() const { return svgStyle().fillOpacity(); }
    void setFillOpacity(float f) { accessSVGStyle().setFillOpacity(f); }

    SVGPaintType strokePaintType() const { return svgStyle().strokePaintType(); }
    SVGPaintType visitedStrokePaintType() const { return svgStyle().visitedLinkStrokePaintType(); }
    const Color& strokePaintColor() const { return svgStyle().strokePaintColor(); }
    const Color& visitedStrokePaintColor() const { return svgStyle().visitedLinkStrokePaintColor(); }
    void setStrokePaintColor(const Color& c) { accessSVGStyle().setStrokePaint(SVG_PAINTTYPE_RGBCOLOR, c, emptyString(), true, false); }
    void setVisitedStrokePaintColor(const Color& c) { accessSVGStyle().setStrokePaint(SVG_PAINTTYPE_RGBCOLOR, c, emptyString(), false, true); }
    float strokeOpacity() const { return svgStyle().strokeOpacity(); }
    void setStrokeOpacity(float f) { accessSVGStyle().setStrokeOpacity(f); }
    const Vector<SVGLengthValue>& strokeDashArray() const { return svgStyle().strokeDashArray(); }
    void setStrokeDashArray(const Vector<SVGLengthValue>& array) { accessSVGStyle().setStrokeDashArray(array); }
    const Length& strokeDashOffset() const { return svgStyle().strokeDashOffset(); }
    void setStrokeDashOffset(const Length& d) { accessSVGStyle().setStrokeDashOffset(d); }

    const Length& cx() const { return svgStyle().cx(); }
    void setCx(const Length& cx) { accessSVGStyle().setCx(cx); }
    const Length& cy() const { return svgStyle().cy(); }
    void setCy(const Length& cy) { accessSVGStyle().setCy(cy); }
    const Length& r() const { return svgStyle().r(); }
    void setR(const Length& r) { accessSVGStyle().setR(r); }
    const Length& rx() const { return svgStyle().rx(); }
    void setRx(const Length& rx) { accessSVGStyle().setRx(rx); }
    const Length& ry() const { return svgStyle().ry(); }
    void setRy(const Length& ry) { accessSVGStyle().setRy(ry); }
    const Length& x() const { return svgStyle().x(); }
    void setX(const Length& x) { accessSVGStyle().setX(x); }
    const Length& y() const { return svgStyle().y(); }
    void setY(const Length& y) { accessSVGStyle().setY(y); }

    float floodOpacity() const { return svgStyle().floodOpacity(); }
    void setFloodOpacity(float f) { accessSVGStyle().setFloodOpacity(f); }

    float stopOpacity() const { return svgStyle().stopOpacity(); }
    void setStopOpacity(float f) { accessSVGStyle().setStopOpacity(f); }

    void setStopColor(const Color& c) { accessSVGStyle().setStopColor(c); }
    void setFloodColor(const Color& c) { accessSVGStyle().setFloodColor(c); }
    void setLightingColor(const Color& c) { accessSVGStyle().setLightingColor(c); }

    const SVGLengthValue& baselineShiftValue() const { return svgStyle().baselineShiftValue(); }
    void setBaselineShiftValue(const SVGLengthValue& s) { accessSVGStyle().setBaselineShiftValue(s); }
    const SVGLengthValue& kerning() const { return svgStyle().kerning(); }
    void setKerning(const SVGLengthValue& k) { accessSVGStyle().setKerning(k); }
#endif

    void setShapeOutside(PassRefPtr<ShapeValue> value)
    {
        if (m_rareNonInheritedData->m_shapeOutside == value)
            return;
        m_rareNonInheritedData.access().m_shapeOutside = value;
    }
    ShapeValue* shapeOutside() const { return m_rareNonInheritedData->m_shapeOutside.get(); }

    static ShapeValue* initialShapeOutside() { return 0; }

    const Length& shapeMargin() const { return m_rareNonInheritedData->shapeMargin; }
    void setShapeMargin(const Length& shapeMargin) { SET_VAR(m_rareNonInheritedData, shapeMargin, shapeMargin); }
    static Length initialShapeMargin() { return Length(0, LengthType::Fixed); }

    float shapeImageThreshold() const { return m_rareNonInheritedData->m_shapeImageThreshold; }
    void setShapeImageThreshold(float shapeImageThreshold)
    {
        float clampedShapeImageThreshold = clampTo<float>(shapeImageThreshold, 0.f, 1.f);
        SET_VAR(m_rareNonInheritedData, m_shapeImageThreshold, clampedShapeImageThreshold);
    }
    static float initialShapeImageThreshold() { return 0; }

    void setClipPath(PassRefPtr<ClipPathOperation> operation)
    {
        if (m_rareNonInheritedData->m_clipPath != operation)
            m_rareNonInheritedData.access().m_clipPath = operation;
    }
    ClipPathOperation* clipPath() const { return m_rareNonInheritedData->m_clipPath.get(); }

    static ClipPathOperation* initialClipPath() { return 0; }

    bool hasContent() const { return contentData(); }
    const ContentData* contentData() const { return m_rareNonInheritedData->m_content.get(); }
    bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->m_rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->m_rareNonInheritedData); }
    void clearContent();
    void setContent(const String&, bool add = false);
    void setContent(PassRefPtr<StyleImage>, bool add = false);
    void setContent(PassOwnPtr<CounterContent>, bool add = false);
    void setContent(QuoteType, bool add = false);
    void setContentAltText(const String&);
    const String& contentAltText() const { return m_rareNonInheritedData->m_altText; }
    bool hasAttrContent() const { return m_rareNonInheritedData->m_hasAttrContent; }
    void setHasAttrContent();

	String navProperty(ENavProperty index) const
	{
		if(m_rareNonInheritedData->m_navPropertyData)
			return m_rareNonInheritedData->m_navPropertyData->values[static_cast<int>(index)];
		return String();
	}
	void setNavProperty(ENavProperty, const String&);

	void setCharacterType(const String& characterType) { m_rareNonInheritedData.access().m_characterType = characterType; }
	const String& characterType() const { return m_rareNonInheritedData->m_characterType; }

    const CounterDirectiveMap* counterDirectives() const;
    CounterDirectiveMap& accessCounterDirectives();

    QuotesData* quotes() const { return m_rareInheritedData->quotes.get(); }
    void setQuotes(PassRefPtr<QuotesData>);

    WillChangeData* willChange() const { return m_rareNonInheritedData->willChange.get(); }
    void setWillChange(PassRefPtr<WillChangeData>);

    bool willChangeCreatesStackingContext() const
    {
        if (!willChange())
            return false;

        return willChange()->canCreateStackingContext();
    }

    const AtomicString& hyphenString() const;

    bool inheritedEqual(const RenderStyle&) const;
    bool fastPathInheritedEqual(const RenderStyle&) const;
    bool nonFastPathInheritedEqual(const RenderStyle&) const;

    bool descendantAffectingNonInheritedPropertiesEqual(const RenderStyle&) const;

    StyleDifference diff(const RenderStyle*, OptionSet<StyleDifferenceContextSensitiveProperty>&) const;
    bool diffRequiresLayerRepaint(const RenderStyle&, bool isComposited) const;

    ALWAYS_INLINE bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); }
    ALWAYS_INLINE bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
    ALWAYS_INLINE bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
    bool isDisplayBlockLevel() const { return isDisplayBlockType(display()); }
    bool isOriginalDisplayBlockType() const { return isDisplayBlockType(originalDisplay()); }
    bool isDisplayFlexibleOrGridBox() const { return isDisplayFlexibleOrGridBox(display()); }
    bool isDisplayDeprecatedFlexibleBox() const;
    bool isDisplayFlexibleBoxIncludingDeprecatedOrGridBox() const;
	bool isDisplayFlexibleBox() const { return isDisplayFlexibleBox(display()); }
	bool isDisplayRegionType() const
    {
        return display() == DisplayType::Block || display() == DisplayType::InlineBlock
            || display() == DisplayType::TableCell || display() == DisplayType::TableCaption
            || display() == DisplayType::ListItem;
    }

    bool setWritingMode(WritingMode v)
    {
        if (v == writingMode())
            return false;

        m_inheritedFlags.u.m_writingMode = v;
        return true;
    }

    ALWAYS_INLINE bool hasExplicitlySetWritingMode() const { return m_nonInheritedFlags.u.hasExplicitlySetWritingMode; }
    ALWAYS_INLINE void setHasExplicitlySetWritingMode(bool v) { m_nonInheritedFlags.u.hasExplicitlySetWritingMode = v; }

    // A unique style is one that has matches something that makes it impossible to share.
    ALWAYS_INLINE bool unique() const { return m_nonInheritedFlags.u.isUnique; }
    ALWAYS_INLINE void setUnique() { m_nonInheritedFlags.u.isUnique = true; }

    ALWAYS_INLINE bool emptyState() const { return m_nonInheritedFlags.u.emptyState; }
    ALWAYS_INLINE void setEmptyState(bool b) { setUnique(); m_nonInheritedFlags.u.emptyState = b; }
    ALWAYS_INLINE bool firstChildState() const { return m_nonInheritedFlags.u.firstChildState; }
    ALWAYS_INLINE void setFirstChildState() { setUnique(); m_nonInheritedFlags.u.firstChildState = true; }
    ALWAYS_INLINE bool lastChildState() const { return m_nonInheritedFlags.u.lastChildState; }
    ALWAYS_INLINE void setLastChildState() { setUnique(); m_nonInheritedFlags.u.lastChildState = true; }

    Color unresolvedColorForProperty(CSSPropertyID colorProperty, bool visitedLink = false) const;
	Color colorResolvingCurrentColor(const Color&) const;

	Color visitedDependentColor(CSSPropertyID colorProperty) const;
    WEBCORE_EXPORT Color visitedDependentColorWithColorFilter(CSSPropertyID) const;
    bool backgroundColorEqualsToColorIgnoringVisited(const Color& color) const { return color == backgroundColor(); }

    WEBCORE_EXPORT Color colorByApplyingColorFilter(const Color&) const;

	void setHasExplicitlyInheritedProperties() { m_nonInheritedFlags.u.hasExplicitlyInheritedProperties = true; }
	ALWAYS_INLINE bool hasExplicitlyInheritedProperties() const { return m_nonInheritedFlags.u.hasExplicitlyInheritedProperties; }

    bool disallowsFastPathInheritance() const { return m_nonInheritedFlags.u.disallowsFastPathInheritance; }
    void setDisallowsFastPathInheritance() { m_nonInheritedFlags.u.disallowsFastPathInheritance = true; }

    // Initial values for all the properties
    static Overflow initialOverflowX() { return Overflow::Visible; }
    static Overflow initialOverflowY() { return Overflow::Visible; }
    static Clear initialClear() { return Clear::None; }
    static DisplayType initialDisplay() { return DisplayType::Inline; }
    static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
    static PositionType initialPosition() { return PositionType::Static; }
    static EVerticalAlign initialVerticalAlign() { return BASELINE; }
    static Float initialFloating() { return Float::None; }
    static BreakBetween initialBreakBetween() { return AutoBreakBetween; }
    static BreakInside initialBreakInside() { return AutoBreakInside; }
    static HangingPunctuation initialHangingPunctuation() { return NoHangingPunctuation; }
    static ETableLayout initialTableLayout() { return TAUTO; }
    static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
    static EBorderStyle initialBorderStyle() { return BNONE; }
    static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
    static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
    static LengthSize initialBorderRadius() { return LengthSize(Length(0, LengthType::Fixed), Length(0, LengthType::Fixed)); }
    static ECaptionSide initialCaptionSide() { return CAPTOP; }
    static ColumnAxis initialColumnAxis() { return AutoColumnAxis; }
    static ColumnProgression initialColumnProgression() { return NormalColumnProgression; }
    static TextDirection initialDirection() { return LTR; }
    static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
    static TextCombine initialTextCombine() { return TextCombineNone; }
    static TextOrientation initialTextOrientation() { return TextOrientation::Mixed; }
    static ObjectFit initialObjectFit() { return ObjectFitFill; }
    static LengthPoint initialObjectPosition() { return LengthPoint(Length(50.0f, LengthType::Percent), Length(50.0f, LengthType::Percent)); }
    static EEmptyCell initialEmptyCells() { return SHOW; }
    static EListStylePosition initialListStylePosition() { return OUTSIDE; }
    static EListStyleType initialListStyleType() { return Disc; }
    static ETextTransform initialTextTransform() { return TTNONE; }
    static EVisibility initialVisibility() { return VISIBLE; }
    static WhiteSpace initialWhiteSpace() { return WhiteSpace::Normal; }
    static float initialHorizontalBorderSpacing() { return 0; }
    static float initialVerticalBorderSpacing() { return 0; }
    static ECursor initialCursor() { return CURSOR_AUTO; }
    static Color initialColor() { return Color::black; }
    static StyleImage* initialListStyleImage() { return 0; }
    static float initialBorderWidth() { return 3; }
    static unsigned short initialColumnRuleWidth() { return 3; }
    static float initialOutlineWidth() { return 3; }
    static float initialLetterSpacing() { return 0; }
    static Length initialWordSpacing() { return Length(LengthType::Fixed); }
    static Length initialSize() { return Length(); }
    static Length initialMinSize() { return Length(); }
    static Length initialMaxSize() { return Length(LengthType::Undefined); }
    static Length initialOffset() { return Length(); }
    static Length initialRadius() { return Length(); }
    static Length initialMargin() { return Length(LengthType::Fixed); }
    static Length initialPadding() { return Length(LengthType::Fixed); }
    static Length initialTextIndent() { return Length(LengthType::Fixed); }
    static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; }
    static TextIndentType initialTextIndentType() { return TextIndentNormal; }
    static Length initialZeroLength() { return Length(LengthType::Fixed); }
    static Length initialOneLength() { return Length(1, LengthType::Fixed); }
    static short initialWidows() { return 2; }
    static short initialOrphans() { return 2; }
    // Returning -100% percent here means the line-height is not set.
    static Length initialLineHeight() { return Length(-100.0f, LengthType::Percent); }
    static TextAlignMode initialTextAlign() { return TextAlignMode::Start; }
    static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
	static TextDecoration initialTextDecoration() { return TextDecorationNone; }
    static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
    static TextJustify initialTextJustify() { return TextJustifyAuto; }
	static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePosition::Auto; }
    static TextUnderlineOffset initialTextUnderlineOffset() { return TextUnderlineOffset::createWithAuto(); }
	static TextDecorationThickness initialTextDecorationThickness() { return TextDecorationThickness::createWithAuto(); }
    static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipAuto; }
    static float initialZoom() { return 1.0f; }
    static TextZoom initialTextZoom() { return TextZoomNormal; }
    static float initialOutlineOffset() { return 0; }
    static float initialOpacity() { return 1.0f; }
    static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
    static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; }
    static EBoxDirection initialBoxDirection() { return BNORMAL; }
    static EBoxLines initialBoxLines() { return SINGLE; }
    static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
    static EBoxPack initialBoxPack() { return Start; }
    static float initialBoxFlex() { return 0.0f; }
    static unsigned int initialBoxFlexGroup() { return 1; }
    static unsigned int initialBoxOrdinalGroup() { return 1; }
    static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
    static StyleReflection* initialBoxReflect() { return 0; }
    static float initialFlexGrow() { return 0; }
    static float initialFlexShrink() { return 1; }
    static Length initialFlexBasis() { return Length(LengthType::Auto); }
    static int initialOrder() { return 0; }
    static StyleSelfAlignmentData initialJustifyItems() { return StyleSelfAlignmentData(ItemPositionLegacy, OverflowAlignmentDefault); }
	static StyleSelfAlignmentData initialSelfAlignment() { return StyleSelfAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); }
    static StyleSelfAlignmentData initialDefaultAlignment() { return StyleSelfAlignmentData(ItemPositionNormal, OverflowAlignmentDefault); }
    static StyleContentAlignmentData initialContentAlignment() { return StyleContentAlignmentData(ContentPositionNormal, ContentDistributionDefault, OverflowAlignmentDefault); }
    static EFlexDirection initialFlexDirection() { return FlowRow; }
    static EFlexWrap initialFlexWrap() { return FlexWrapNone; }
    static int initialMarqueeLoopCount() { return -1; }
    static int initialMarqueeSpeed() { return 85; }
    static Length initialMarqueeIncrement() { return Length(6, LengthType::Fixed); }
    static MarqueeBehavior initialMarqueeBehavior() { return MarqueeBehavior::Scroll; }
    static MarqueeDirection initialMarqueeDirection() { return MarqueeDirection::Auto; }
    static EUserModify initialUserModify() { return READ_ONLY; }
    static EUserDrag initialUserDrag() { return DRAG_AUTO; }
    static EUserSelect initialUserSelect() { return SELECT_TEXT; }
    static TextOverflow initialTextOverflow() { return TextOverflowClip; }
    static WordBreak initialWordBreak() { return WordBreak::Normal; }
    static OverflowWrap initialOverflowWrap() { return OverflowWrap::Normal; }
    static ENBSPMode initialNBSPMode() { return NBNORMAL; }
    static LineBreak initialLineBreak() { return LineBreak::Auto; }
    static const AtomicString& initialHighlight() { return nullAtom; }
    static ESpeak initialSpeak() { return SpeakNormal; }
    static Hyphens initialHyphens() { return HyphensManual; }
    static short initialHyphenationLimitBefore() { return -1; }
    static short initialHyphenationLimitAfter() { return -1; }
    static short initialHyphenationLimitLines() { return -1; }
    static const AtomicString& initialHyphenationString() { return nullAtom; }
    static String initialNullString() { return String(); }
    static EResize initialResize() { return RESIZE_NONE; }
    static ControlPart initialAppearance() { return NoControlPart; }
    static AspectRatioType initialAspectRatioType() { return AspectRatioType::Auto; }
    static constexpr ContentVisibility initialContentVisibility() { return ContentVisibility::Visible; }
    static double initialAspectRatioWidth() { return 1.0; }
    static double initialAspectRatioHeight() { return 1.0; }
    static Order initialRTLOrdering() { return LogicalOrder; }
    static float initialTextStrokeWidth() { return 0; }
    static unsigned short initialColumnCount() { return 1; }
    static ColumnFill initialColumnFill() { return ColumnFillBalance; }
    static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
    static GapLength initialColumnGap() { return GapLength(); }
    static GapLength initialRowGap() { return GapLength(); }
    static const TransformOperations& initialTransform() { static TransformOperations ops; return ops; }
    static Length initialTransformOriginX() { return Length(50.0f, LengthType::Percent); }
    static Length initialTransformOriginY() { return Length(50.0f, LengthType::Percent); }
    static TransformBox initialTransformBox() { return TransformBox::ViewBox; }
    static RotateTransformOperation* initialRotate() { return nullptr; }
    static ScaleTransformOperation* initialScale() { return nullptr; }
    static TranslateTransformOperation* initialTranslate() { return nullptr; }
    static EPointerEvents initialPointerEvents() { return PE_AUTO; }
    static float initialTransformOriginZ() { return 0; }
    static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
    static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
    static float initialPerspective() { return 0; }
    static Length initialPerspectiveOriginX() { return Length(50.0f, LengthType::Percent); }
    static Length initialPerspectiveOriginY() { return Length(50.0f, LengthType::Percent); }
    static Color initialBackgroundColor() { return Color::transparent; }
    static Color initialTextEmphasisColor() { return currentColor(); }
    static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; }
    static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
    static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
    static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver | TextEmphasisPositionRight; }
    static RubyPosition initialRubyPosition() { return RubyPositionBefore; }
    static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
    static ImageOrientation::Orientation initialImageOrientation() { return ImageOrientation::OriginTopLeft; }
    static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
    static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; }
    static ImageResolutionSnap initialImageResolutionSnap() { return ImageResolutionNoSnap; }
    static float initialImageResolution() { return 1; }
    static StyleImage* initialBorderImageSource() { return 0; }
    static StyleImage* initialMaskBoxImageSource() { return 0; }
    static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
    static QuotesData* initialQuotes() { return nullptr; }
    static const AtomicString& initialContentAltText() { return emptyAtom; }

    static WillChangeData* initialWillChange() { return 0; }

    // The initial value is 'none' for grid tracks.
    static Vector<GridTrackSize> initialGridColumns() { return Vector<GridTrackSize>(); }
    static Vector<GridTrackSize> initialGridRows() { return Vector<GridTrackSize>(); }

    static GridAutoFlow initialGridAutoFlow() { return AutoFlowRow; }

    static Vector<GridTrackSize> initialGridAutoColumns() { return Vector<GridTrackSize> { GridTrackSize(Length()) }; }
    static Vector<GridTrackSize> initialGridAutoRows() { return Vector<GridTrackSize> { GridTrackSize(Length()) }; }

    static Vector<GridTrackSize> initialGridAutoRepeatTracks() { return Vector<GridTrackSize>(); }
    static unsigned initialGridAutoRepeatInsertionPoint() { return 0; }
    static AutoRepeatType initialGridAutoRepeatType() { return NoAutoRepeat; }

    static NamedGridAreaMap initialNamedGridArea() { return NamedGridAreaMap(); }
    static size_t initialNamedGridAreaCount() { return 0; }

    static NamedGridLinesMap initialNamedGridColumnLines() { return NamedGridLinesMap(); }
    static NamedGridLinesMap initialNamedGridRowLines() { return NamedGridLinesMap(); }

    static OrderedNamedGridLinesMap initialOrderedNamedGridColumnLines() { return OrderedNamedGridLinesMap(); }
    static OrderedNamedGridLinesMap initialOrderedNamedGridRowLines() { return OrderedNamedGridLinesMap(); }

    // 'auto' is the default.
    static GridPosition initialGridItemColumnStart() { return GridPosition(); }
    static GridPosition initialGridItemColumnEnd() { return GridPosition(); }
    static GridPosition initialGridItemRowStart() { return GridPosition(); }
    static GridPosition initialGridItemRowEnd() { return GridPosition(); }
    static GridPosition initialGridPosition() { return GridPosition(); }

    static TabSize initialTabSize() { return 8; }

    static const AtomicString& initialLineGrid() { return nullAtom; }
    static LineSnap initialLineSnap() { return LineSnapNone; }
    static LineAlign initialLineAlign() { return LineAlignNone; }

    // Keep these at the end.
    static IntSize initialInitialLetter() { return IntSize(); }
    static LineClampValue initialLineClamp() { return LineClampValue(); }
    static bool initialTextSizeAdjust() { return true; }
    static ETextSecurity initialTextSecurity() { return TSNONE; }
#if ENABLE(TOUCH_EVENTS)
    static Color initialTapHighlightColor();
#endif
#if ENABLE(OVERFLOW_SCROLLING)
    static bool initialUseTouchOverflowScrolling() { return false; }
#endif
#if ENABLE(DASHBOARD_SUPPORT)
    static const Vector<StyleDashboardRegion>& initialDashboardRegions();
    static const Vector<StyleDashboardRegion>& noneDashboardRegions();
#endif
#if ENABLE(CSS_FILTERS)
    static const FilterOperations& initialFilter() { static FilterOperations ops; return ops; }
#endif
#if ENABLE(FILTERS_LEVEL_2)
    static const FilterOperations& initialBackdropFilter() { static FilterOperations ops; return ops; }
#endif
#if ENABLE(CSS_COMPOSITING)
    static BlendMode initialBlendMode() { return BlendModeNormal; }
    static Isolation initialIsolation() { return IsolationAuto; }
#endif

    const Color& caretColor() const { return m_rareInheritedData->caretColor; }

    // In RenderStyle invalid color value is used to signify 'currentcolor' which resolves to color().
    static Color currentColor() { return Color(); }
    static bool isCurrentColor(const Color& color) { return !color.isValid(); }

    ALWAYS_INLINE const Color& backgroundColor() const { return m_background->color; }
    ALWAYS_INLINE const Color& color() const { return m_inheritedData->color; }
	ALWAYS_INLINE const Color& visitedLinkColor() const { return m_inheritedData->visitedLinkColor; }

    const Length& offsetDistance() const { return m_rareNonInheritedData->offsetDistance; }
    void setOffsetDistance(const Length& distance) { SET_VAR(m_rareNonInheritedData, offsetDistance, distance); }
    static Length initialOffsetDistance() { return Length(0, LengthType::Fixed); }

    const LengthPoint& offsetPosition() const { return m_rareNonInheritedData->offsetPosition; }
    void setOffsetPosition(const LengthPoint& position) { SET_VAR(m_rareNonInheritedData, offsetPosition, position); }
    static LengthPoint initialOffsetPosition() { return LengthPoint(Length(LengthType::Auto), Length(LengthType::Auto)); }

    const LengthPoint& offsetAnchor() const { return m_rareNonInheritedData->offsetAnchor; }
    void setOffsetAnchor(const LengthPoint& position) { SET_VAR(m_rareNonInheritedData, offsetAnchor, position); }
    static LengthPoint initialOffsetAnchor() { return LengthPoint(Length(LengthType::Auto), Length(LengthType::Auto)); }

private:
    bool changeAffectsVisualOverflow(const RenderStyle&) const;
    bool changeRequiresLayout(const RenderStyle&, OptionSet<StyleDifferenceContextSensitiveProperty>&) const;
    bool changeRequiresPositionedLayoutOnly(const RenderStyle*, OptionSet<StyleDifferenceContextSensitiveProperty>&) const;
    bool changeRequiresLayerRepaint(const RenderStyle&, OptionSet<StyleDifferenceContextSensitiveProperty>&) const;
    bool changeRequiresRepaint(const RenderStyle&, OptionSet<StyleDifferenceContextSensitiveProperty>&) const;
    bool changeRequiresRepaintIfText(const RenderStyle&, OptionSet<StyleDifferenceContextSensitiveProperty>&) const;
    bool changeRequiresRecompositeLayer(const RenderStyle*, OptionSet<StyleDifferenceContextSensitiveProperty>&) const;

    void setVisitedLinkColor(const Color& v) { SET_VAR(m_inheritedData, visitedLinkColor, v) }
    void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(m_rareNonInheritedData, m_visitedLinkBackgroundColor, v) }
    void setVisitedLinkBorderLeftColor(const Color& v) { SET_VAR(m_rareNonInheritedData, m_visitedLinkBorderLeftColor, v) }
    void setVisitedLinkBorderRightColor(const Color& v) { SET_VAR(m_rareNonInheritedData, m_visitedLinkBorderRightColor, v) }
    void setVisitedLinkBorderBottomColor(const Color& v) { SET_VAR(m_rareNonInheritedData, m_visitedLinkBorderBottomColor, v) }
    void setVisitedLinkBorderTopColor(const Color& v) { SET_VAR(m_rareNonInheritedData, m_visitedLinkBorderTopColor, v) }
    void setVisitedLinkOutlineColor(const Color& v) { SET_VAR(m_rareNonInheritedData, m_visitedLinkOutlineColor, v) }
    void setVisitedLinkColumnRuleColor(const Color& v) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, m_visitedLinkColumnRuleColor, v); }
    void setVisitedLinkTextDecorationColor(const Color& v) { SET_VAR(m_rareNonInheritedData, m_visitedLinkTextDecorationColor, v); }
    void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextEmphasisColor, v) }
    void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextFillColor, v) }
    void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextStrokeColor, v) }
    void setVisitedLinkCaretColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkCaretColor, v); }

    ALWAYS_INLINE void inheritUnicodeBidiFrom(const RenderStyle* parent) { m_nonInheritedFlags.u.unicodeBidi = parent->m_nonInheritedFlags.u.unicodeBidi; }
	void getShadowInlineDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
    {
        isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight);
    }
    void getShadowBlockDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
    {
        isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom);
    }

    static bool isDisplayReplacedType(DisplayType display)
    {
        return display == DisplayType::InlineBlock || display == DisplayType::InlineBox || display == DisplayType::InlineFlex || display == DisplayType::InlineTable || display == DisplayType::InlineGrid;
    }

    ALWAYS_INLINE static bool isDisplayInlineType(DisplayType display)
    {
        return display == DisplayType::Inline
            || display == DisplayType::InlineBlock
            || display == DisplayType::InlineBox
            || display == DisplayType::InlineFlex
            || display == DisplayType::InlineGrid
            || display == DisplayType::InlineTable;
    }

    ALWAYS_INLINE static bool isDisplayFlexibleBox(DisplayType display)
    {
        return display == DisplayType::Flex || display == DisplayType::InlineFlex;
    }

    ALWAYS_INLINE static bool isDisplayGridBox(DisplayType display)
    {
        return display == DisplayType::Grid || display == DisplayType::InlineGrid;
    }

    ALWAYS_INLINE static bool isDisplayFlexibleOrGridBox(DisplayType display)
    {
        return isDisplayFlexibleBox(display) || isDisplayGridBox(display);
    }

    static bool isDisplayDeprecatedFlexibleBox(DisplayType display)
    {
        return display == DisplayType::Box || display == DisplayType::InlineBox;
    }

    static bool isDisplayBlockType(DisplayType display)
    {
        return display == DisplayType::Block || display == DisplayType::Table
            || display == DisplayType::FlowRoot || display == DisplayType::Grid
            || display == DisplayType::Flex || display == DisplayType::Box
            || display == DisplayType::ListItem;
    }

    // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.

    ALWAYS_INLINE const Color& borderLeftColor() const { return m_surroundData->border.left().color(); }
    ALWAYS_INLINE const Color& borderRightColor() const { return m_surroundData->border.right().color(); }
    ALWAYS_INLINE const Color& borderTopColor() const { return m_surroundData->border.top().color(); }
    ALWAYS_INLINE const Color& borderBottomColor() const { return m_surroundData->border.bottom().color(); }
    ALWAYS_INLINE const Color& columnRuleColor() const { return m_rareNonInheritedData->multiCol->m_rule.color(); }
    ALWAYS_INLINE const Color& outlineColor() const { return m_background->outline.color(); }
    ALWAYS_INLINE const Color& textEmphasisColor() const { return m_rareInheritedData->textEmphasisColor; }
    ALWAYS_INLINE const Color& textFillColor() const { return m_rareInheritedData->textFillColor; }
    ALWAYS_INLINE const Color& textStrokeColor() const { return m_rareInheritedData->textStrokeColor; }
    ALWAYS_INLINE const Color& visitedLinkBackgroundColor() const { return m_rareNonInheritedData->m_visitedLinkBackgroundColor; }
    ALWAYS_INLINE const Color& visitedLinkBorderLeftColor() const { return m_rareNonInheritedData->m_visitedLinkBorderLeftColor; }
    ALWAYS_INLINE const Color& visitedLinkBorderRightColor() const { return m_rareNonInheritedData->m_visitedLinkBorderRightColor; }
    ALWAYS_INLINE const Color& visitedLinkBorderBottomColor() const { return m_rareNonInheritedData->m_visitedLinkBorderBottomColor; }
    ALWAYS_INLINE const Color& visitedLinkBorderTopColor() const { return m_rareNonInheritedData->m_visitedLinkBorderTopColor; }
    ALWAYS_INLINE const Color& visitedLinkOutlineColor() const { return m_rareNonInheritedData->m_visitedLinkOutlineColor; }
    ALWAYS_INLINE const Color& visitedLinkColumnRuleColor() const { return m_rareNonInheritedData->multiCol->m_visitedLinkColumnRuleColor; }
    const Color& textDecorationColor() const { return m_rareNonInheritedData->m_textDecorationColor; }
    const Color& visitedLinkTextDecorationColor() const { return m_rareNonInheritedData->m_visitedLinkTextDecorationColor; }
	ALWAYS_INLINE const Color& visitedLinkTextEmphasisColor() const { return m_rareInheritedData->visitedLinkTextEmphasisColor; }
    ALWAYS_INLINE const Color& visitedLinkTextFillColor() const { return m_rareInheritedData->visitedLinkTextFillColor; }
    ALWAYS_INLINE const Color& visitedLinkTextStrokeColor() const { return m_rareInheritedData->visitedLinkTextStrokeColor; }
    const Color& visitedLinkCaretColor() const { return m_rareInheritedData->visitedLinkCaretColor; }

    static LayoutBoxExtent shadowExtent(const ShadowData*);
    static LayoutBoxExtent shadowInsetExtent(const ShadowData*);
    static void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right);
    static void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom);

    Color colorResolvingCurrentColor(CSSPropertyID colorProperty, bool visitedLink) const;

#if ENABLE(SVG)
    ALWAYS_INLINE const Color& stopColor() const { return svgStyle().stopColor(); }
    ALWAYS_INLINE const Color& floodColor() const { return svgStyle().floodColor(); }
    ALWAYS_INLINE const Color& lightingColor() const { return svgStyle().lightingColor(); }
#endif

    void appendContent(PassOwnPtr<ContentData>);

    static ALWAYS_INLINE int pseudoBit(PseudoId pseudo)
    {
        return 1 << (static_cast<unsigned>(pseudo) - 1);
    }

public:
    struct NonInheritedFlags {
    	NonInheritedFlags() { u.m_bits = 0; }
    	NonInheritedFlags(const NonInheritedFlags& other) { u.m_bits = other.u.m_bits; }

    	NonInheritedFlags& operator=(const NonInheritedFlags& other) { u.m_bits = other.u.m_bits; return *this; }

        bool operator==(const NonInheritedFlags&) const;
        bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }

        void copyNonInheritedFrom(const NonInheritedFlags&);

        bool hasAnyPublicPseudoStyles() const { return static_cast<unsigned>(PseudoId::PublicPseudoIdMask) & u.pseudoBits; }
        bool hasPseudoStyle(PseudoId) const;
        void setHasPseudoStyle(PseudoId);
        void setHasPseudoStyles(PseudoIdSet);

        union {
        	struct {
				unsigned effectiveDisplay : 5; // DisplayType
				unsigned originalDisplay : 5; // DisplayType
				unsigned overflowX : 3; // Overflow
				unsigned overflowY : 3; // Overflow
				unsigned verticalAlign : 4; // EVerticalAlign
				unsigned clear : 3; // Clear
				unsigned position : 3; // PositionType
				unsigned unicodeBidi : 3; // EUnicodeBidi
		        unsigned floating : 3; // Float
				unsigned tableLayout : 1; // ETableLayout

				unsigned hasExplicitlySetDirection : 1;
				unsigned hasExplicitlySetWritingMode : 1;
		        unsigned usesViewportUnits : 1;
		        unsigned usesContainerUnits : 1;
				unsigned hasExplicitlyInheritedProperties : 1; // Explicitly inherits a non-inherited property.
				unsigned disallowsFastPathInheritance : 1;

				unsigned isUnique : 1; // Style cannot be shared.
				unsigned emptyState : 1;
				unsigned firstChildState : 1;
				unsigned lastChildState : 1;
				unsigned isLink : 1;

				unsigned styleType : StyleTypeBits; // PseudoId
		        unsigned pseudoBits : (static_cast<unsigned>(PseudoId::FirstInternalPseudoId) - static_cast<unsigned>(PseudoId::FirstPublicPseudoId));

		        // If you add more style bits here, you will also need to update RenderStyle::NonInheritedFlags::copyNonInheritedFrom().
        	};

        	uint64_t m_bits;
        } u;
    };

    // inherit
    struct InheritedFlags {
    	InheritedFlags() { u.m_bits = 0; }
    	InheritedFlags(const InheritedFlags& other) { u.m_bits = other.u.m_bits; }

    	InheritedFlags& operator=(const InheritedFlags& other) { u.m_bits = other.u.m_bits; return *this; }

        bool operator==(const InheritedFlags& other) const
        {
#if 0
            return (_empty_cells == other._empty_cells)
                && (_caption_side == other._caption_side)
                && (_list_style_type == other._list_style_type)
                && (_list_style_position == other._list_style_position)
                && (_visibility == other._visibility)
                && (_text_align == other._text_align)
                && (_text_transform == other._text_transform)
                && (_text_decorations == other._text_decorations)
                && (_cursor_style == other._cursor_style)
                && (_direction == other._direction)
                && (_white_space == other._white_space)
                && (_border_collapse == other._border_collapse)
                && (_box_direction == other._box_direction)
                && (m_rtlOrdering == other.m_rtlOrdering)
                && (m_printColorAdjust == other.m_printColorAdjust)
                && (_pointerEvents == other._pointerEvents)
                && (_insideLink == other._insideLink)
                && (m_writingMode == other.m_writingMode);
#else
            return u.m_bits == other.u.m_bits;
#endif
        }

        ALWAYS_INLINE bool operator!=(const InheritedFlags& other) const { return !(*this == other); }

        union {
        	struct {
				unsigned _empty_cells : 1; // EEmptyCell
				unsigned _caption_side : 2; // ECaptionSide
				unsigned _list_style_type : 7; // EListStyleType
				unsigned _list_style_position : 1; // EListStylePosition
				unsigned _visibility : 2; // EVisibility
				unsigned _text_align : 4; // TextAlignMode
				unsigned _text_transform : 2; // ETextTransform
				unsigned _text_decorations : TextDecorationBits;
				unsigned _cursor_style : 6; // ECursor
				unsigned _direction : 1; // TextDirection
				unsigned _white_space : 3; // WhiteSpace
				// 32 bits
				unsigned _border_collapse : 1; // EBorderCollapse
				unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)

				// non CSS2 inherited
				unsigned m_rtlOrdering : 1; // Order
				unsigned m_printColorAdjust : PrintColorAdjustBits;
				unsigned _pointerEvents : 4; // EPointerEvents
				unsigned _insideLink : 2; // EInsideLink
				// 43 bits

				// CSS Text Layout Module Level 3: Vertical writing support
				unsigned m_writingMode : 2; // WritingMode
				// 45 bits
        	};
        	uint64_t m_bits;
        } u;
    };

private:
    // used to create the default style.
    RenderStyle(CreateDefaultStyleTag);
    RenderStyle(const RenderStyle&, CloneTag);

    ALWAYS_INLINE DisplayType originalDisplay() const { return static_cast<DisplayType>(m_nonInheritedFlags.u.originalDisplay); }

    // non-inherited attributes
    DataRef<StyleBoxData> m_boxData;
    DataRef<StyleVisualData> visual;
    DataRef<StyleBackgroundData> m_background;
    DataRef<StyleSurroundData> m_surroundData;
    DataRef<StyleRareNonInheritedData> m_rareNonInheritedData;
    NonInheritedFlags m_nonInheritedFlags;

    // inherited attributes
    DataRef<StyleRareInheritedData> m_rareInheritedData;
    DataRef<StyleInheritedData> m_inheritedData;
    InheritedFlags m_inheritedFlags;

    // list of associated pseudo styles
    OwnPtr<PseudoStyleCache> m_cachedPseudoStyles;

#if ENABLE(SVG)
    DataRef<SVGRenderStyle> m_svgStyle;
#endif

#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
    bool m_deletionHasBegun { false };
#endif

};

inline bool RenderStyle::NonInheritedFlags::operator==(const NonInheritedFlags& other) const
{
#if 0
    return u.effectiveDisplay == other.u.effectiveDisplay
        && u.originalDisplay == other.u.originalDisplay
        && u.overflowX == other.u.overflowX
        && u.overflowY == other.u.overflowY
        && u.verticalAlign == other.u.verticalAlign
        && u.clear == other.u.clear
        && u.position == other.u.position
        && u.unicodeBidi == other.u.unicodeBidi
        && u.floating == other.u.floating
        && u.tableLayout == other.u.tableLayout
        && u.hasExplicitlySetDirection == other.u.hasExplicitlySetDirection
        && u.hasExplicitlySetWritingMode == other.u.hasExplicitlySetWritingMode
        && usesViewportUnits == other.usesViewportUnits
        && usesContainerUnits == other.usesContainerUnits
        && u.hasExplicitlyInheritedProperties == other.u.hasExplicitlyInheritedProperties
        && u.disallowsFastPathInheritance == other.u.disallowsFastPathInheritance
		&& u.isUnique == other.u.isUnique
        && u.emptyState == other.u.emptyState
        && u.firstChildState == other.u.firstChildState
        && u.lastChildState == other.u.lastChildState
        && u.isLink == other.u.isLink
        && u.styleType == other.u.styleType
        && u.pseudoBits == other.u.pseudoBits;
#else
    return u.m_bits == other.u.m_bits;
#endif
}

inline void RenderStyle::NonInheritedFlags::copyNonInheritedFrom(const NonInheritedFlags& other)
{
    // Only a subset is copied because NonInheritedFlags contains a bunch of stuff other than real style data.
	u.effectiveDisplay = other.u.effectiveDisplay;
	u.originalDisplay = other.u.originalDisplay;
	u.overflowX = other.u.overflowX;
	u.overflowY = other.u.overflowY;
	u.verticalAlign = other.u.verticalAlign;
	u.clear = other.u.clear;
	u.position = other.u.position;
	u.unicodeBidi = other.u.unicodeBidi;
	u.floating = other.u.floating;
	u.tableLayout = other.u.tableLayout;
    u.usesViewportUnits = other.u.usesViewportUnits;
    u.usesContainerUnits = other.u.usesContainerUnits;
	u.hasExplicitlyInheritedProperties = other.u.hasExplicitlyInheritedProperties;
    u.disallowsFastPathInheritance = other.u.disallowsFastPathInheritance;
}

ALWAYS_INLINE bool RenderStyle::NonInheritedFlags::hasPseudoStyle(PseudoId pseudo) const
{
    ASSERT(pseudo > PseudoId::None);
    ASSERT(pseudo < PseudoId::FirstInternalPseudoId);
    return u.pseudoBits & (1 << (static_cast<unsigned>(pseudo) - 1 /* PseudoId::None */));
}

ALWAYS_INLINE void RenderStyle::NonInheritedFlags::setHasPseudoStyle(PseudoId pseudo)
{
    ASSERT(pseudo > PseudoId::None);
    ASSERT(pseudo < PseudoId::FirstInternalPseudoId);
    u.pseudoBits |= 1 << (static_cast<unsigned>(pseudo) - 1 /* PseudoId::None */);
}

ALWAYS_INLINE void RenderStyle::NonInheritedFlags::setHasPseudoStyles(PseudoIdSet pseudoIdSet)
{
    ASSERT(pseudoIdSet);
    ASSERT((pseudoIdSet.data() & static_cast<unsigned>(PseudoId::PublicPseudoIdMask)) == pseudoIdSet.data());
    u.pseudoBits |= pseudoIdSet.data() >> 1; // Shift down as we do not store a bit for NOPSUEDO.
}

inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
{
    double zoomFactor = style->effectiveZoom();
    if (zoomFactor == 1)
        return value;
    // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
    if (zoomFactor > 1) {
        if (value < 0)
            value--;
        else 
            value++;
    }

    return roundForImpreciseConversion<int>(value / zoomFactor);
}

ALWAYS_INLINE float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)
{
    return value / style->effectiveZoom();
}

ALWAYS_INLINE LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const RenderStyle& style)
{
    return value / style.effectiveZoom();
}

inline EBorderStyle collapsedBorderStyle(EBorderStyle style)
{
    if (style == OUTSET)
        return GROOVE;
    if (style == INSET)
        return RIDGE;
    return style;
}

inline const CSSCustomPropertyValue* RenderStyle::getCustomProperty(const AtomicString& name) const
{
	const CustomPropertyValueMap* maps[2] = { &nonInheritedCustomProperties(), &inheritedCustomProperties() };
    for (int i = 0; i < 2; ++i ) {
    	auto* map = maps[i];
        if (auto* val = map->get(name))
            return val;
    }
    return nullptr;
}

inline bool RenderStyle::setZoom(float f)
{
	setEffectiveZoom(effectiveZoom() * f);
    if (compareEqual(visual->m_zoom, f))
        return false;
    visual.access().m_zoom = f;
    return true;
}

inline bool RenderStyle::setEffectiveZoom(float f)
{
    if (compareEqual(m_rareInheritedData->effectiveZoom, f))
        return false;
    m_rareInheritedData.access().effectiveZoom = f;
    return true;
}

inline bool RenderStyle::setTextSizeAdjust(bool b)
{
    if (compareEqual(m_rareInheritedData->textSizeAdjust, b))
        return false;
    m_rareInheritedData.access().textSizeAdjust = b;
    return true;
}

inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation)
{
    if (compareEqual(m_rareInheritedData->textOrientation, static_cast<unsigned>(textOrientation)))
        return false;

    m_rareInheritedData.access().textOrientation = static_cast<unsigned>(textOrientation);
    return true;
}

ALWAYS_INLINE bool RenderStyle::hasAnyPublicPseudoStyles() const
{
    return m_nonInheritedFlags.hasAnyPublicPseudoStyles();
}

ALWAYS_INLINE bool RenderStyle::hasPseudoStyle(PseudoId pseudo) const
{
    return m_nonInheritedFlags.hasPseudoStyle(pseudo);
}

ALWAYS_INLINE void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
{
    m_nonInheritedFlags.setHasPseudoStyle(pseudo);
}

ALWAYS_INLINE void RenderStyle::setHasPseudoStyles(PseudoIdSet pseudoIdSet)
{
    m_nonInheritedFlags.setHasPseudoStyles(pseudoIdSet);
}

ALWAYS_INLINE bool pseudoElementRendererIsNeeded(const RenderStyle& style)
{
    return style.display() != DisplayType::None && style.contentData();
}

ALWAYS_INLINE bool pseudoElementRendererIsNeeded(const RenderStyle* style)
{
    return style && pseudoElementRendererIsNeeded(*style);
}

inline bool generatesBox(const RenderStyle& style)
{
    return style.display() != DisplayType::None && style.display() != DisplayType::Contents;
}

inline bool RenderStyle::isDisplayDeprecatedFlexibleBox() const { return isDisplayDeprecatedFlexibleBox(display()); }
inline bool RenderStyle::isDisplayFlexibleBoxIncludingDeprecatedOrGridBox() const { return isDisplayFlexibleOrGridBox() || isDisplayDeprecatedFlexibleBox(); }

} // namespace WebCore
