1/*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 *           (C) 2000 Antti Koivisto (koivisto@kde.org)
4 *           (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2014 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB.  If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25#ifndef RenderStyle_h
26#define RenderStyle_h
27
28#include "AnimationList.h"
29#include "BorderValue.h"
30#include "CSSLineBoxContainValue.h"
31#include "CSSPrimitiveValue.h"
32#include "CSSPropertyNames.h"
33#include "Color.h"
34#include "ColorSpace.h"
35#include "CounterDirectives.h"
36#include "DataRef.h"
37#include "FontBaseline.h"
38#include "FontDescription.h"
39#include "GraphicsTypes.h"
40#include "LayoutBoxExtent.h"
41#include "Length.h"
42#include "LengthBox.h"
43#include "LengthFunctions.h"
44#include "LengthSize.h"
45#include "LineClampValue.h"
46#include "NinePieceImage.h"
47#include "OutlineValue.h"
48#include "Pagination.h"
49#include "RenderStyleConstants.h"
50#include "RoundedRect.h"
51#include "SVGPaint.h"
52#include "SVGRenderStyle.h"
53#include "ShadowData.h"
54#include "ShapeValue.h"
55#include "StyleBackgroundData.h"
56#include "StyleBoxData.h"
57#include "StyleDeprecatedFlexibleBoxData.h"
58#include "StyleFlexibleBoxData.h"
59#include "StyleMarqueeData.h"
60#include "StyleMultiColData.h"
61#include "StyleRareInheritedData.h"
62#include "StyleRareNonInheritedData.h"
63#include "StyleReflection.h"
64#include "StyleSurroundData.h"
65#include "StyleTransformData.h"
66#include "StyleVisualData.h"
67#include "TextDirection.h"
68#include "ThemeTypes.h"
69#include "TransformOperations.h"
70#include "UnicodeBidi.h"
71#include <memory>
72#include <wtf/Forward.h>
73#include <wtf/RefCounted.h>
74#include <wtf/StdLibExtras.h>
75#include <wtf/Vector.h>
76
77#if ENABLE(CSS_FILTERS)
78#include "StyleFilterData.h"
79#endif
80
81#if ENABLE(CSS_GRID_LAYOUT)
82#include "StyleGridData.h"
83#include "StyleGridItemData.h"
84#endif
85
86#if ENABLE(DASHBOARD_SUPPORT)
87#include "StyleDashboardRegion.h"
88#endif
89
90#if ENABLE(IOS_TEXT_AUTOSIZING)
91#include "TextSizeAdjustment.h"
92#endif
93
94template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<const T&>(u); }
95
96#define SET_VAR(group, variable, value) \
97    if (!compareEqual(group->variable, value)) \
98        group.access()->variable = value
99
100#define SET_BORDERVALUE_COLOR(group, variable, value) \
101    if (!compareEqual(group->variable.color(), value)) \
102        group.access()->variable.setColor(value)
103
104namespace WebCore {
105
106#if ENABLE(CSS_FILTERS)
107class FilterOperations;
108#endif
109
110class BorderData;
111class CounterContent;
112class CursorList;
113class Font;
114class FontMetrics;
115class IntRect;
116class Pair;
117class ShadowData;
118class StyleImage;
119class StyleInheritedData;
120class StyleResolver;
121class TransformationMatrix;
122
123class ContentData;
124
125typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
126
127class RenderStyle: public RefCounted<RenderStyle> {
128    friend class CSSPropertyAnimationWrapperMap; // Used by CSS animations. We can't allow them to animate based off visited colors.
129    friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
130    friend class DeprecatedStyleBuilder; // Sets members directly.
131    friend class EditingStyle; // Editing has to only reveal unvisited info.
132    friend class ComputedStyleExtractor; // Ignores visited styles, so needs to be able to see unvisited info.
133    friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
134    friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
135    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.
136    friend class StyleResolver; // Sets members directly.
137
138public:
139    struct NonInheritedFlags {
140        NonInheritedFlags()
141        {
142            // The default values should all be zero.
143            ASSERT(!initialOverflowX());
144            ASSERT(!initialOverflowY());
145            ASSERT(!initialClear());
146            ASSERT(!initialDisplay());
147            ASSERT(!initialUnicodeBidi());
148            ASSERT(!initialPosition());
149            ASSERT(!initialVerticalAlign());
150            ASSERT(!initialFloating());
151            ASSERT(!initialTableLayout());
152
153            m_flags = 0;
154        }
155
156        bool operator==(const NonInheritedFlags& other) const
157        {
158            return m_flags == other.m_flags;
159        }
160
161        bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
162
163        void copyNonInheritedFrom(const NonInheritedFlags& other)
164        {
165            // Only a subset is copied because NonInheritedFlags contains a bunch of stuff other than real style data.
166            uint64_t nonInheritedMask = overflowMask << overflowXOffset
167                | overflowMask << overflowYOffset
168                | clearMask << clearOffset
169                | displayMask << effectiveDisplayOffset
170                | positionMask << positionOffset
171                | displayMask << originalDisplayOffset
172                | unicodeBidiMask << unicodeBidiOffset
173                | verticalAlignMask << verticalAlignOffset
174                | floatingMask << floatingOffset
175                | pageBreakMask << pageBreakInsideOffset
176                | pageBreakMask << pageBreakBeforeOffset
177                | pageBreakMask << pageBreakAfterOffset
178                | oneBitMask << explicitInheritanceOffset
179                | tableLayoutBitMask << tableLayoutOffset
180                | hasViewportUnitsBitMask << hasViewportUnitsOffset;
181
182            m_flags = (m_flags & ~nonInheritedMask) | (other.m_flags & nonInheritedMask);
183        }
184
185        EOverflow overflowX() const { return static_cast<EOverflow>(getValue(overflowMask, overflowXOffset)); }
186        void setOverflowX(EOverflow overflowX) { updateValue(overflowX, overflowMask, overflowXOffset); }
187
188        EOverflow overflowY() const { return static_cast<EOverflow>(getValue(overflowMask, overflowYOffset)); }
189        void setOverflowY(EOverflow overflowY) { updateValue(overflowY, overflowMask, overflowYOffset); }
190
191        EClear clear() const { return static_cast<EClear>(getValue(clearMask, clearOffset)); }
192        void setClear(EClear clear) { updateValue(clear, clearMask, clearOffset); }
193
194        EDisplay effectiveDisplay() const { return static_cast<EDisplay>(getValue(displayMask, effectiveDisplayOffset)); }
195        void setEffectiveDisplay(EDisplay effectiveDisplay) { updateValue(effectiveDisplay, displayMask, effectiveDisplayOffset); }
196
197        EPosition position() const { return static_cast<EPosition>(getValue(positionMask, positionOffset)); }
198        void setPosition(EPosition position) { updateValue(position, positionMask, positionOffset); }
199
200        EDisplay originalDisplay() const { return static_cast<EDisplay>(getValue(displayMask, originalDisplayOffset)); }
201        void setOriginalDisplay(EDisplay originalDisplay) { updateValue(originalDisplay, displayMask, originalDisplayOffset); }
202
203        EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(getValue(unicodeBidiMask, unicodeBidiOffset)); }
204        void setUnicodeBidi(EUnicodeBidi unicodeBidi) { updateValue(unicodeBidi, unicodeBidiMask, unicodeBidiOffset); }
205
206        bool hasViewportUnits() const { return getBoolean(hasViewportUnitsOffset); }
207        void setHasViewportUnits(bool value) { updateBoolean(value, hasViewportUnitsOffset); }
208
209        EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(getValue(verticalAlignMask, verticalAlignOffset)); }
210        void setVerticalAlign(EVerticalAlign verticalAlign) { updateValue(verticalAlign, verticalAlignMask, verticalAlignOffset); }
211
212        bool hasExplicitlyInheritedProperties() const { return getBoolean(explicitInheritanceOffset); }
213        void setHasExplicitlyInheritedProperties(bool value) { updateBoolean(value, explicitInheritanceOffset); }
214
215        bool isFloating() const { return floating() != NoFloat; }
216        EFloat floating() const { return static_cast<EFloat>(getValue(floatingMask, floatingOffset)); }
217        void setFloating(EFloat floating) { updateValue(floating, floatingMask, floatingOffset); }
218
219        // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
220        EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(getValue(pageBreakMask, pageBreakInsideOffset)); }
221        void setPageBreakInside(EPageBreak pageBreakInside) { ASSERT(pageBreakInside == PBAUTO || pageBreakInside == PBAVOID); updateValue(pageBreakInside, pageBreakMask, pageBreakInsideOffset); }
222
223        EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(getValue(pageBreakMask, pageBreakBeforeOffset)); }
224        void setPageBreakBefore(EPageBreak pageBreakBefore) { updateValue(pageBreakBefore, pageBreakMask, pageBreakBeforeOffset); }
225
226        EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(getValue(pageBreakMask, pageBreakAfterOffset)); }
227        void setPageBreakAfter(EPageBreak pageBreakAfter) { updateValue(pageBreakAfter, pageBreakMask, pageBreakAfterOffset); }
228
229        bool hasAnyPublicPseudoStyles() const { return PUBLIC_PSEUDOID_MASK & getValue(pseudoBitsMask, pseudoBitsOffset); }
230        bool hasPseudoStyle(PseudoId pseudo) const
231        {
232            ASSERT(pseudo > NOPSEUDO);
233            ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
234            return (oneBitMask << (pseudoBitsOffset - 1 + pseudo)) & m_flags;
235        }
236        void setHasPseudoStyle(PseudoId pseudo)
237        {
238            ASSERT(pseudo > NOPSEUDO);
239            ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
240            m_flags |= oneBitMask << (pseudoBitsOffset - 1 + pseudo);
241        }
242
243        ETableLayout tableLayout() const { return static_cast<ETableLayout>(getValue(tableLayoutBitMask, tableLayoutOffset)); }
244        void setTableLayout(ETableLayout tableLayout) { updateValue(tableLayout, tableLayoutBitMask, tableLayoutOffset); }
245
246        PseudoId styleType() const { return static_cast<PseudoId>(getValue(styleTypeMask, styleTypeOffset)); }
247        void setStyleType(PseudoId styleType) { updateValue(styleType, styleTypeMask, styleTypeOffset); }
248
249        bool isUnique() const { return getBoolean(isUniqueOffset); }
250        void setIsUnique() { updateBoolean(true, isUniqueOffset); }
251
252        bool emptyState() const { return getBoolean(emptyStateOffset);  }
253        void setEmptyState(bool value) { updateBoolean(value, emptyStateOffset); }
254
255        bool firstChildState() const { return getBoolean(firstChildStateOffset);  }
256        void setFirstChildState(bool value) { updateBoolean(value, firstChildStateOffset); }
257
258        bool lastChildState() const { return getBoolean(lastChildStateOffset);  }
259        void setLastChildState(bool value) { updateBoolean(value, lastChildStateOffset); }
260
261        bool affectedByHover() const { return getBoolean(affectedByHoverOffset); }
262        void setAffectedByHover(bool value) { updateBoolean(value, affectedByHoverOffset); }
263
264        bool affectedByActive() const { return getBoolean(affectedByActiveOffset); }
265        void setAffectedByActive(bool value) { updateBoolean(value, affectedByActiveOffset); }
266
267        bool affectedByDrag() const { return getBoolean(affectedByDragOffset); }
268        void setAffectedByDrag(bool value) { updateBoolean(value, affectedByDragOffset); }
269
270        bool isLink() const { return getBoolean(isLinkOffset); }
271        void setIsLink(bool value) { updateBoolean(value, isLinkOffset); }
272
273        static EOverflow initialOverflowX() { return OVISIBLE; }
274        static EOverflow initialOverflowY() { return OVISIBLE; }
275        static EClear initialClear() { return CNONE; }
276        static EDisplay initialDisplay() { return INLINE; }
277        static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
278        static EPosition initialPosition() { return StaticPosition; }
279        static EVerticalAlign initialVerticalAlign() { return BASELINE; }
280        static EFloat initialFloating() { return NoFloat; }
281        static EPageBreak initialPageBreak() { return PBAUTO; }
282        static ETableLayout initialTableLayout() { return TAUTO; }
283
284        static ptrdiff_t flagsMemoryOffset() { return OBJECT_OFFSETOF(NonInheritedFlags, m_flags); }
285        static uint64_t flagIsUnique() { return oneBitMask << isUniqueOffset; }
286        static uint64_t flagIsaffectedByActive() { return oneBitMask << affectedByActiveOffset; }
287        static uint64_t flagIsaffectedByHover() { return oneBitMask << affectedByHoverOffset; }
288        static uint64_t setFirstChildStateFlags() { return flagFirstChildState() | flagIsUnique(); }
289        static uint64_t setLastChildStateFlags() { return flagLastChildState() | flagIsUnique(); }
290    private:
291        void updateBoolean(bool isSet, uint64_t offset)
292        {
293            if (isSet)
294                m_flags |= (oneBitMask << offset);
295            else
296                m_flags &= ~(oneBitMask << offset);
297        }
298
299        bool getBoolean(uint64_t offset) const
300        {
301            return m_flags & (oneBitMask << offset);
302        }
303
304        void updateValue(uint8_t newValue, uint64_t positionIndependentMask, uint64_t offset)
305        {
306            ASSERT(!(newValue & ~positionIndependentMask));
307            uint64_t positionDependentMask = positionIndependentMask << offset;
308            m_flags = (m_flags & ~positionDependentMask) | (static_cast<uint64_t>(newValue) << offset);
309        }
310
311        unsigned getValue(uint64_t positionIndependentMask, uint64_t offset) const
312        {
313            return static_cast<unsigned>((m_flags >> offset) & positionIndependentMask);
314        }
315
316        static uint64_t flagFirstChildState() { return oneBitMask << firstChildStateOffset; }
317        static uint64_t flagLastChildState() { return oneBitMask << lastChildStateOffset; }
318
319        // To type the bit mask properly on 64bits.
320        static const uint64_t oneBitMask = 0x1;
321
322        // Byte 1.
323        static const unsigned overflowBitCount = 3;
324        static const uint64_t overflowMask = (oneBitMask << overflowBitCount) - 1;
325        static const unsigned overflowXOffset = 0;
326        static const unsigned overflowYOffset = overflowXOffset + overflowBitCount;
327        static const unsigned clearBitCount = 2;
328        static const uint64_t clearMask = (oneBitMask << clearBitCount) - 1;
329        static const unsigned clearOffset = overflowYOffset + overflowBitCount;
330
331        // Byte 2.
332        static const unsigned displayBitCount = 5;
333        static const uint64_t displayMask = (oneBitMask << displayBitCount) - 1;
334        static const unsigned effectiveDisplayOffset = clearOffset + clearBitCount;
335        static const unsigned positionBitCount = 3;
336        static const uint64_t positionMask = (oneBitMask << positionBitCount) - 1;
337        static const unsigned positionOffset = effectiveDisplayOffset + displayBitCount;
338
339        // Byte 3.
340        static const unsigned originalDisplayOffset = positionOffset + positionBitCount;
341        static const unsigned unicodeBidiBitCount = 3;
342        static const uint64_t unicodeBidiMask = (oneBitMask << unicodeBidiBitCount) - 1;
343        static const unsigned unicodeBidiOffset = originalDisplayOffset + displayBitCount;
344
345        // Byte 4.
346        static const unsigned floatingBitCount = 2;
347        static const uint64_t floatingMask = (oneBitMask << floatingBitCount) - 1;
348        static const unsigned floatingOffset = unicodeBidiOffset + unicodeBidiBitCount;
349        static const unsigned pageBreakBitCount = 2;
350        static const uint64_t pageBreakMask = (oneBitMask << pageBreakBitCount) - 1;
351        static const unsigned pageBreakInsideOffset = floatingOffset + floatingBitCount;
352        static const unsigned pageBreakBeforeOffset = pageBreakInsideOffset + pageBreakBitCount;
353        static const unsigned pageBreakAfterOffset = pageBreakBeforeOffset + pageBreakBitCount;
354
355        // Byte 5.
356        static const unsigned explicitInheritanceBitCount = 1;
357        static const unsigned explicitInheritanceOffset = pageBreakAfterOffset + pageBreakBitCount;
358        static const unsigned tableLayoutBitCount = 1;
359        static const uint64_t tableLayoutBitMask = oneBitMask;
360        static const unsigned tableLayoutOffset = explicitInheritanceOffset + explicitInheritanceBitCount;
361        static const unsigned verticalAlignBitCount = 4;
362        static const unsigned verticalAlignPadding = 2;
363        static const unsigned verticalAlignAndPaddingBitCount = verticalAlignBitCount + verticalAlignPadding;
364        static const uint64_t verticalAlignMask = (oneBitMask << verticalAlignBitCount) - 1;
365        static const unsigned verticalAlignOffset = tableLayoutOffset + tableLayoutBitCount;
366
367        // Byte 6.
368        static const unsigned pseudoBitsBitCount = 7;
369        static const uint64_t pseudoBitsMask = (oneBitMask << pseudoBitsBitCount) - 1;
370        static const unsigned pseudoBitsOffset = verticalAlignOffset + verticalAlignBitCount;
371
372        static const unsigned hasViewportUnitsBitCount = 1;
373        static const uint64_t hasViewportUnitsBitMask = (oneBitMask << hasViewportUnitsBitCount) - 1;
374        static const unsigned hasViewportUnitsOffset = pseudoBitsOffset + pseudoBitsBitCount;
375
376        // Byte 7.
377        static const unsigned styleTypeBitCount = 6;
378        static const unsigned styleTypePadding = 2;
379        static const unsigned styleTypeAndPaddingBitCount = styleTypeBitCount + styleTypePadding;
380        static const uint64_t styleTypeMask = (oneBitMask << styleTypeAndPaddingBitCount) - 1;
381        static const unsigned styleTypeOffset = hasViewportUnitsBitCount + hasViewportUnitsOffset;
382
383        // Byte 8.
384        static const unsigned isUniqueOffset = styleTypeOffset + styleTypeAndPaddingBitCount;
385        static const unsigned emptyStateOffset = isUniqueOffset + 1;
386        static const unsigned firstChildStateOffset = emptyStateOffset + 1;
387        static const unsigned lastChildStateOffset = firstChildStateOffset + 1;
388        static const unsigned affectedByHoverOffset = lastChildStateOffset + 1;
389        static const unsigned affectedByActiveOffset = affectedByHoverOffset + 1;
390        static const unsigned affectedByDragOffset = affectedByActiveOffset + 1;
391        static const unsigned isLinkOffset = affectedByDragOffset + 1;
392
393
394        // Only 60 bits are assigned. There are 4 bits available currently used as padding to improve code generation.
395        // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom().
396        uint64_t m_flags;
397    };
398
399protected:
400
401    // non-inherited attributes
402    DataRef<StyleBoxData> m_box;
403    DataRef<StyleVisualData> visual;
404    DataRef<StyleBackgroundData> m_background;
405    DataRef<StyleSurroundData> surround;
406    DataRef<StyleRareNonInheritedData> rareNonInheritedData;
407
408    // inherited attributes
409    DataRef<StyleRareInheritedData> rareInheritedData;
410    DataRef<StyleInheritedData> inherited;
411
412    // list of associated pseudo styles
413    std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles;
414
415    DataRef<SVGRenderStyle> m_svgStyle;
416
417// !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp and implicitlyInherited() in StyleResolver.cpp
418
419    // inherit
420    struct InheritedFlags {
421        bool operator==(const InheritedFlags& other) const
422        {
423            return (_empty_cells == other._empty_cells)
424                && (_caption_side == other._caption_side)
425                && (_list_style_type == other._list_style_type)
426                && (_list_style_position == other._list_style_position)
427                && (_visibility == other._visibility)
428                && (_text_align == other._text_align)
429                && (_text_transform == other._text_transform)
430                && (_text_decorations == other._text_decorations)
431                && (_cursor_style == other._cursor_style)
432#if ENABLE(CURSOR_VISIBILITY)
433                && (m_cursorVisibility == other.m_cursorVisibility)
434#endif
435                && (_direction == other._direction)
436                && (_white_space == other._white_space)
437                && (_border_collapse == other._border_collapse)
438                && (_box_direction == other._box_direction)
439                && (m_rtlOrdering == other.m_rtlOrdering)
440                && (m_printColorAdjust == other.m_printColorAdjust)
441                && (_pointerEvents == other._pointerEvents)
442                && (_insideLink == other._insideLink)
443                && (m_writingMode == other.m_writingMode);
444        }
445
446        bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
447
448        unsigned _empty_cells : 1; // EEmptyCell
449        unsigned _caption_side : 2; // ECaptionSide
450        unsigned _list_style_type : 7; // EListStyleType
451        unsigned _list_style_position : 1; // EListStylePosition
452        unsigned _visibility : 2; // EVisibility
453        unsigned _text_align : 4; // ETextAlign
454        unsigned _text_transform : 2; // ETextTransform
455        unsigned _text_decorations : TextDecorationBits;
456        unsigned _cursor_style : 6; // ECursor
457#if ENABLE(CURSOR_VISIBILITY)
458        unsigned m_cursorVisibility : 1; // CursorVisibility
459#endif
460        unsigned _direction : 1; // TextDirection
461        unsigned _white_space : 3; // EWhiteSpace
462        // 32 bits
463        unsigned _border_collapse : 1; // EBorderCollapse
464        unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
465
466        // non CSS2 inherited
467        unsigned m_rtlOrdering : 1; // Order
468        unsigned m_printColorAdjust : PrintColorAdjustBits;
469        unsigned _pointerEvents : 4; // EPointerEvents
470        unsigned _insideLink : 2; // EInsideLink
471        // 43 bits
472
473        // CSS Text Layout Module Level 3: Vertical writing support
474        unsigned m_writingMode : 2; // WritingMode
475        // 45 bits
476    } inherited_flags;
477
478// don't inherit
479    NonInheritedFlags noninherited_flags;
480
481// !END SYNC!
482private:
483    // used to create the default style.
484    ALWAYS_INLINE RenderStyle(bool);
485    ALWAYS_INLINE RenderStyle(const RenderStyle&);
486
487public:
488    static PassRef<RenderStyle> create();
489    static PassRef<RenderStyle> createDefaultStyle();
490    static PassRef<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay);
491    static PassRef<RenderStyle> clone(const RenderStyle*);
492
493    // Create a RenderStyle for generated content by inheriting from a pseudo style.
494    static PassRef<RenderStyle> createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle);
495
496    enum IsAtShadowBoundary {
497        AtShadowBoundary,
498        NotAtShadowBoundary,
499    };
500
501    void inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary = NotAtShadowBoundary);
502    void copyNonInheritedFrom(const RenderStyle*);
503
504    PseudoId styleType() const { return noninherited_flags.styleType(); }
505    void setStyleType(PseudoId styleType) { noninherited_flags.setStyleType(styleType); }
506
507    RenderStyle* getCachedPseudoStyle(PseudoId) const;
508    RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
509    void removeCachedPseudoStyle(PseudoId);
510
511    const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
512
513    void setHasViewportUnits(bool hasViewportUnits = true) { noninherited_flags.setHasViewportUnits(hasViewportUnits); }
514    bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits(); }
515
516    bool affectedByHover() const { return noninherited_flags.affectedByHover(); }
517    bool affectedByActive() const { return noninherited_flags.affectedByActive(); }
518    bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); }
519
520    void setAffectedByHover() { noninherited_flags.setAffectedByHover(true); }
521    void setAffectedByActive() { noninherited_flags.setAffectedByActive(true); }
522    void setAffectedByDrag() { noninherited_flags.setAffectedByDrag(true); }
523
524    void setColumnStylesFromPaginationMode(const Pagination::Mode&);
525
526    bool operator==(const RenderStyle& other) const;
527    bool operator!=(const RenderStyle& other) const { return !(*this == other); }
528    bool isFloating() const { return noninherited_flags.isFloating(); }
529    bool hasMargin() const { return surround->margin.nonZero(); }
530    bool hasBorder() const { return surround->border.hasBorder(); }
531    bool hasPadding() const { return surround->padding.nonZero(); }
532    bool hasOffset() const { return surround->offset.nonZero(); }
533    bool hasMarginBeforeQuirk() const { return marginBefore().hasQuirk(); }
534    bool hasMarginAfterQuirk() const { return marginAfter().hasQuirk(); }
535
536    bool hasBackgroundImage() const { return m_background->background().hasImage(); }
537    bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
538
539    bool hasEntirelyFixedBackground() const;
540
541    bool hasAppearance() const { return appearance() != NoControlPart; }
542
543    bool hasBackground() const
544    {
545        Color color = visitedDependentColor(CSSPropertyBackgroundColor);
546        if (color.isValid() && color.alpha())
547            return true;
548        return hasBackgroundImage();
549    }
550
551    LayoutBoxExtent imageOutsets(const NinePieceImage&) const;
552    bool hasBorderImageOutsets() const
553    {
554        return borderImage().hasImage() && borderImage().outset().nonZero();
555    }
556    LayoutBoxExtent borderImageOutsets() const
557    {
558        return imageOutsets(borderImage());
559    }
560
561    LayoutBoxExtent maskBoxImageOutsets() const
562    {
563        return imageOutsets(maskBoxImage());
564    }
565
566#if ENABLE(CSS_FILTERS)
567    bool hasFilterOutsets() const { return hasFilter() && filter().hasOutsets(); }
568    FilterOutsets filterOutsets() const { return hasFilter() ? filter().outsets() : FilterOutsets(); }
569#endif
570
571    Order rtlOrdering() const { return static_cast<Order>(inherited_flags.m_rtlOrdering); }
572    void setRTLOrdering(Order o) { inherited_flags.m_rtlOrdering = o; }
573
574    bool isStyleAvailable() const;
575
576    bool hasAnyPublicPseudoStyles() const;
577    bool hasPseudoStyle(PseudoId pseudo) const;
578    void setHasPseudoStyle(PseudoId pseudo);
579    bool hasUniquePseudoStyle() const;
580
581    // attribute getter methods
582
583    EDisplay display() const { return noninherited_flags.effectiveDisplay(); }
584    EDisplay originalDisplay() const { return noninherited_flags.originalDisplay(); }
585
586    const Length& left() const { return surround->offset.left(); }
587    const Length& right() const { return surround->offset.right(); }
588    const Length& top() const { return surround->offset.top(); }
589    const Length& bottom() const { return surround->offset.bottom(); }
590
591    // Accessors for positioned object edges that take into account writing mode.
592    const Length& logicalLeft() const { return surround->offset.logicalLeft(writingMode()); }
593    const Length& logicalRight() const { return surround->offset.logicalRight(writingMode()); }
594    const Length& logicalTop() const { return surround->offset.before(writingMode()); }
595    const Length& logicalBottom() const { return surround->offset.after(writingMode()); }
596
597    // Whether or not a positioned element requires normal flow x/y to be computed
598    // to determine its position.
599    bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); }
600    bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); }
601    bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
602    bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
603
604    EPosition position() const { return noninherited_flags.position(); }
605    bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; }
606    bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; }
607    bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; }
608    EFloat floating() const { return noninherited_flags.floating(); }
609
610    const Length& width() const { return m_box->width(); }
611    const Length& height() const { return m_box->height(); }
612    const Length& minWidth() const { return m_box->minWidth(); }
613    const Length& maxWidth() const { return m_box->maxWidth(); }
614    const Length& minHeight() const { return m_box->minHeight(); }
615    const Length& maxHeight() const { return m_box->maxHeight(); }
616
617    const Length& logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); }
618    const Length& logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); }
619    const Length& logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); }
620    const Length& logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); }
621    const Length& logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
622    const Length& logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
623
624    const BorderData& border() const { return surround->border; }
625    const BorderValue& borderLeft() const { return surround->border.left(); }
626    const BorderValue& borderRight() const { return surround->border.right(); }
627    const BorderValue& borderTop() const { return surround->border.top(); }
628    const BorderValue& borderBottom() const { return surround->border.bottom(); }
629
630    const BorderValue& borderBefore() const;
631    const BorderValue& borderAfter() const;
632    const BorderValue& borderStart() const;
633    const BorderValue& borderEnd() const;
634
635    const NinePieceImage& borderImage() const { return surround->border.image(); }
636    StyleImage* borderImageSource() const { return surround->border.image().image(); }
637    const LengthBox& borderImageSlices() const { return surround->border.image().imageSlices(); }
638    const LengthBox& borderImageWidth() const { return surround->border.image().borderSlices(); }
639    const LengthBox& borderImageOutset() const { return surround->border.image().outset(); }
640
641    const LengthSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
642    const LengthSize& borderTopRightRadius() const { return surround->border.topRight(); }
643    const LengthSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
644    const LengthSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
645    bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
646
647    float borderLeftWidth() const { return surround->border.borderLeftWidth(); }
648    EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
649    bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
650    float borderRightWidth() const { return surround->border.borderRightWidth(); }
651    EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
652    bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
653    float borderTopWidth() const { return surround->border.borderTopWidth(); }
654    EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
655    bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
656    float borderBottomWidth() const { return surround->border.borderBottomWidth(); }
657    EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
658    bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
659
660    float borderBeforeWidth() const;
661    float borderAfterWidth() const;
662    float borderStartWidth() const;
663    float borderEndWidth() const;
664
665    unsigned short outlineSize() const { return std::max(0, outlineWidth() + outlineOffset()); }
666    unsigned short outlineWidth() const
667    {
668        if (m_background->outline().style() == BNONE)
669            return 0;
670        return m_background->outline().width();
671    }
672    bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
673    EBorderStyle outlineStyle() const { return m_background->outline().style(); }
674    OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_background->outline().isAuto()); }
675
676    EOverflow overflowX() const { return noninherited_flags.overflowX(); }
677    EOverflow overflowY() const { return noninherited_flags.overflowY(); }
678
679    EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
680    EVerticalAlign verticalAlign() const { return noninherited_flags.verticalAlign(); }
681    const Length& verticalAlignLength() const { return m_box->verticalAlign(); }
682
683    const Length& clipLeft() const { return visual->clip.left(); }
684    const Length& clipRight() const { return visual->clip.right(); }
685    const Length& clipTop() const { return visual->clip.top(); }
686    const Length& clipBottom() const { return visual->clip.bottom(); }
687    const LengthBox& clip() const { return visual->clip; }
688    bool hasClip() const { return visual->hasClip; }
689
690    EUnicodeBidi unicodeBidi() const { return noninherited_flags.unicodeBidi(); }
691
692    EClear clear() const { return noninherited_flags.clear(); }
693    ETableLayout tableLayout() const { return noninherited_flags.tableLayout(); }
694
695    const Font& font() const;
696    const FontMetrics& fontMetrics() const;
697    const FontDescription& fontDescription() const;
698    float specifiedFontSize() const;
699    float computedFontSize() const;
700    int fontSize() const;
701    void getFontAndGlyphOrientation(FontOrientation&, NonCJKGlyphOrientation&);
702
703#if ENABLE(TEXT_AUTOSIZING)
704    float textAutosizingMultiplier() const { return visual->m_textAutosizingMultiplier; }
705#endif
706
707    const Length& textIndent() const { return rareInheritedData->indent; }
708#if ENABLE(CSS3_TEXT)
709    TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(rareInheritedData->m_textIndentLine); }
710    TextIndentType textIndentType() const { return static_cast<TextIndentType>(rareInheritedData->m_textIndentType); }
711#endif
712    ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
713    ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
714    TextDecoration textDecorationsInEffect() const { return static_cast<TextDecoration>(inherited_flags._text_decorations); }
715    TextDecoration textDecoration() const { return static_cast<TextDecoration>(visual->textDecoration); }
716#if ENABLE(CSS3_TEXT)
717    TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
718    TextJustify textJustify() const { return static_cast<TextJustify>(rareInheritedData->m_textJustify); }
719#endif // CSS3_TEXT
720    TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
721    TextDecorationSkip textDecorationSkip() const { return static_cast<TextDecorationSkip>(rareInheritedData->m_textDecorationSkip); }
722    TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
723
724    const Length& wordSpacing() const;
725    float letterSpacing() const;
726
727    float zoom() const { return visual->m_zoom; }
728    float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
729
730    TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
731    bool isLeftToRightDirection() const { return direction() == LTR; }
732
733    const Length& specifiedLineHeight() const;
734    Length lineHeight() const;
735    int computedLineHeight() const;
736
737    EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
738    static bool autoWrap(EWhiteSpace ws)
739    {
740        // Nowrap and pre don't automatically wrap.
741        return ws != NOWRAP && ws != PRE;
742    }
743
744    bool autoWrap() const
745    {
746        return autoWrap(whiteSpace());
747    }
748
749    static bool preserveNewline(EWhiteSpace ws)
750    {
751        // Normal and nowrap do not preserve newlines.
752        return ws != NORMAL && ws != NOWRAP;
753    }
754
755    bool preserveNewline() const
756    {
757        return preserveNewline(whiteSpace());
758    }
759
760    static bool collapseWhiteSpace(EWhiteSpace ws)
761    {
762        // Pre and prewrap do not collapse whitespace.
763        return ws != PRE && ws != PRE_WRAP;
764    }
765
766    bool collapseWhiteSpace() const
767    {
768        return collapseWhiteSpace(whiteSpace());
769    }
770
771    bool isCollapsibleWhiteSpace(UChar c) const
772    {
773        switch (c) {
774            case ' ':
775            case '\t':
776                return collapseWhiteSpace();
777            case '\n':
778                return !preserveNewline();
779        }
780        return false;
781    }
782
783    bool breakOnlyAfterWhiteSpace() const
784    {
785        return whiteSpace() == PRE_WRAP || lineBreak() == LineBreakAfterWhiteSpace;
786    }
787
788    bool breakWords() const
789    {
790        return wordBreak() == BreakWordBreak || overflowWrap() == BreakOverflowWrap;
791    }
792
793    EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
794    EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
795    CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); }
796    EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
797    EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
798    EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
799    const Length& backgroundXPosition() const { return m_background->background().xPosition(); }
800    const Length& backgroundYPosition() const { return m_background->background().yPosition(); }
801    EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
802    const LengthSize& backgroundSizeLength() const { return m_background->background().sizeLength(); }
803    FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
804    const FillLayer* backgroundLayers() const { return &(m_background->background()); }
805
806    StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
807    EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); }
808    EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); }
809    CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
810    EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
811    EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
812    const Length& maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
813    const Length& maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
814    EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
815    const LengthSize& maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
816    FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
817    const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
818    const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
819    StyleImage* maskBoxImageSource() const { return rareNonInheritedData->m_maskBoxImage.image(); }
820
821    EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse>(inherited_flags._border_collapse); }
822    short horizontalBorderSpacing() const;
823    short verticalBorderSpacing() const;
824    EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); }
825    ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); }
826
827    EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); }
828    StyleImage* listStyleImage() const;
829    EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
830
831    const Length& marginTop() const { return surround->margin.top(); }
832    const Length& marginBottom() const { return surround->margin.bottom(); }
833    const Length& marginLeft() const { return surround->margin.left(); }
834    const Length& marginRight() const { return surround->margin.right(); }
835    const Length& marginBefore() const { return surround->margin.before(writingMode()); }
836    const Length& marginAfter() const { return surround->margin.after(writingMode()); }
837    const Length& marginStart() const { return surround->margin.start(writingMode(), direction()); }
838    const Length& marginEnd() const { return surround->margin.end(writingMode(), direction()); }
839    const Length& marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
840    const Length& marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
841    const Length& marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); }
842    const Length& marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); }
843
844    const LengthBox& paddingBox() const { return surround->padding; }
845    const Length& paddingTop() const { return surround->padding.top(); }
846    const Length& paddingBottom() const { return surround->padding.bottom(); }
847    const Length& paddingLeft() const { return surround->padding.left(); }
848    const Length& paddingRight() const { return surround->padding.right(); }
849    const Length& paddingBefore() const { return surround->padding.before(writingMode()); }
850    const Length& paddingAfter() const { return surround->padding.after(writingMode()); }
851    const Length& paddingStart() const { return surround->padding.start(writingMode(), direction()); }
852    const Length& paddingEnd() const { return surround->padding.end(writingMode(), direction()); }
853
854    ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
855#if ENABLE(CURSOR_VISIBILITY)
856    CursorVisibility cursorVisibility() const { return static_cast<CursorVisibility>(inherited_flags.m_cursorVisibility); }
857#endif
858
859    CursorList* cursors() const { return rareInheritedData->cursorData.get(); }
860
861    EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
862    bool isLink() const { return noninherited_flags.isLink(); }
863
864    short widows() const { return rareInheritedData->widows; }
865    short orphans() const { return rareInheritedData->orphans; }
866    bool hasAutoWidows() const { return rareInheritedData->m_hasAutoWidows; }
867    bool hasAutoOrphans() const { return rareInheritedData->m_hasAutoOrphans; }
868    EPageBreak pageBreakInside() const { return noninherited_flags.pageBreakInside(); }
869    EPageBreak pageBreakBefore() const { return noninherited_flags.pageBreakBefore(); }
870    EPageBreak pageBreakAfter() const { return noninherited_flags.pageBreakAfter(); }
871
872    // CSS3 Getter Methods
873
874    int outlineOffset() const
875    {
876        if (m_background->outline().style() == BNONE)
877            return 0;
878        return m_background->outline().offset();
879    }
880
881    const ShadowData* textShadow() const { return rareInheritedData->textShadow.get(); }
882    void getTextShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }
883    void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
884    void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
885    void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }
886    void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }
887
888    float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
889    ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
890    float opacity() const { return rareNonInheritedData->opacity; }
891    ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
892    AspectRatioType aspectRatioType() const { return static_cast<AspectRatioType>(rareNonInheritedData->m_aspectRatioType); }
893    float aspectRatio() const { return aspectRatioNumerator() / aspectRatioDenominator(); }
894    float aspectRatioDenominator() const { return rareNonInheritedData->m_aspectRatioDenominator; }
895    float aspectRatioNumerator() const { return rareNonInheritedData->m_aspectRatioNumerator; }
896    EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->align); }
897    EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
898    float boxFlex() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex; }
899    unsigned int boxFlexGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex_group; }
900    EBoxLines boxLines() const { return static_cast<EBoxLines>(rareNonInheritedData->m_deprecatedFlexibleBox->lines); }
901    unsigned int boxOrdinalGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->ordinal_group; }
902    EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->m_deprecatedFlexibleBox->orient); }
903    EBoxPack boxPack() const { return static_cast<EBoxPack>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); }
904
905    int order() const { return rareNonInheritedData->m_order; }
906    float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; }
907    float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
908    const Length& flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
909    EAlignContent alignContent() const { return static_cast<EAlignContent>(rareNonInheritedData->m_alignContent); }
910    EAlignItems alignItems() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignItems); }
911    EAlignItems alignSelf() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignSelf); }
912    EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
913    bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
914    bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
915    EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
916    EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); }
917    EJustifySelf justifySelf() const { return static_cast<EJustifySelf>(rareNonInheritedData->m_justifySelf); }
918    EJustifySelfOverflowAlignment justifySelfOverflowAlignment() const { return static_cast<EJustifySelfOverflowAlignment>(rareNonInheritedData->m_justifySelfOverflowAlignment); }
919
920#if ENABLE(CSS_GRID_LAYOUT)
921    const Vector<GridTrackSize>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; }
922    const Vector<GridTrackSize>& gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; }
923    const NamedGridLinesMap& namedGridColumnLines() const { return rareNonInheritedData->m_grid->m_namedGridColumnLines; }
924    const NamedGridLinesMap& namedGridRowLines() const { return rareNonInheritedData->m_grid->m_namedGridRowLines; }
925    const OrderedNamedGridLinesMap& orderedNamedGridColumnLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridColumnLines; }
926    const OrderedNamedGridLinesMap& orderedNamedGridRowLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridRowLines; }
927    const NamedGridAreaMap& namedGridArea() const { return rareNonInheritedData->m_grid->m_namedGridArea; }
928    size_t namedGridAreaRowCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaRowCount; }
929    size_t namedGridAreaColumnCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaColumnCount; }
930    GridAutoFlow gridAutoFlow() const { return static_cast<GridAutoFlow>(rareNonInheritedData->m_grid->m_gridAutoFlow); }
931    bool isGridAutoFlowDirectionRow() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowDirectionRow); }
932    bool isGridAutoFlowDirectionColumn() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowDirectionColumn); }
933    bool isGridAutoFlowAlgorithmSparse() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmSparse); }
934    bool isGridAutoFlowAlgorithmDense() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmDense); }
935    bool isGridAutoFlowAlgorithmStack() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmStack); }
936    const GridTrackSize& gridAutoColumns() const { return rareNonInheritedData->m_grid->m_gridAutoColumns; }
937    const GridTrackSize& gridAutoRows() const { return rareNonInheritedData->m_grid->m_gridAutoRows; }
938
939    const GridPosition& gridItemColumnStart() const { return rareNonInheritedData->m_gridItem->m_gridColumnStart; }
940    const GridPosition& gridItemColumnEnd() const { return rareNonInheritedData->m_gridItem->m_gridColumnEnd; }
941    const GridPosition& gridItemRowStart() const { return rareNonInheritedData->m_gridItem->m_gridRowStart; }
942    const GridPosition& gridItemRowEnd() const { return rareNonInheritedData->m_gridItem->m_gridRowEnd; }
943#endif /* ENABLE(CSS_GRID_LAYOUT) */
944
945    const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
946    void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
947    LayoutBoxExtent getBoxShadowInsetExtent() const { return getShadowInsetExtent(boxShadow()); }
948    void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
949    void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }
950    void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); }
951    void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); }
952
953#if ENABLE(CSS_BOX_DECORATION_BREAK)
954    EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecorationBreak(); }
955#endif
956    StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
957    EBoxSizing boxSizing() const { return m_box->boxSizing(); }
958    const Length& marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; }
959    int marqueeSpeed() const { return rareNonInheritedData->m_marquee->speed; }
960    int marqueeLoopCount() const { return rareNonInheritedData->m_marquee->loops; }
961    EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->m_marquee->behavior); }
962    EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(rareNonInheritedData->m_marquee->direction); }
963    EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
964    EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
965    EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
966    TextOverflow textOverflow() const { return static_cast<TextOverflow>(rareNonInheritedData->textOverflow); }
967    EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); }
968    EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); }
969    EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
970    EOverflowWrap overflowWrap() const { return static_cast<EOverflowWrap>(rareInheritedData->overflowWrap); }
971    ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
972    LineBreak lineBreak() const { return static_cast<LineBreak>(rareInheritedData->lineBreak); }
973    Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
974    short hyphenationLimitBefore() const { return rareInheritedData->hyphenationLimitBefore; }
975    short hyphenationLimitAfter() const { return rareInheritedData->hyphenationLimitAfter; }
976    short hyphenationLimitLines() const { return rareInheritedData->hyphenationLimitLines; }
977    const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
978    const AtomicString& locale() const { return rareInheritedData->locale; }
979    EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
980    EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
981    ColumnAxis columnAxis() const { return static_cast<ColumnAxis>(rareNonInheritedData->m_multiCol->m_axis); }
982    bool hasInlineColumnAxis() const {
983        ColumnAxis axis = columnAxis();
984        return axis == AutoColumnAxis || isHorizontalWritingMode() == (axis == HorizontalColumnAxis);
985    }
986    ColumnProgression columnProgression() const { return static_cast<ColumnProgression>(rareNonInheritedData->m_multiCol->m_progression); }
987    float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
988    bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
989    unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
990    bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
991    bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth() || !hasInlineColumnAxis(); }
992    ColumnFill columnFill() const { return static_cast<ColumnFill>(rareNonInheritedData->m_multiCol->m_fill); }
993    float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
994    bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
995    EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
996    unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
997    bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
998    ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheritedData->m_multiCol->m_columnSpan); }
999    EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
1000    EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
1001    EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
1002    EPageBreak regionBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakBefore); }
1003    EPageBreak regionBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakInside); }
1004    EPageBreak regionBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakAfter); }
1005    const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
1006    const Length& transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
1007    const Length& transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
1008    float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
1009    bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
1010
1011    TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(rareInheritedData->textEmphasisFill); }
1012    TextEmphasisMark textEmphasisMark() const;
1013    const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; }
1014    TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); }
1015    const AtomicString& textEmphasisMarkString() const;
1016
1017    RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInheritedData->m_rubyPosition); }
1018
1019    TextOrientation textOrientation() const { return static_cast<TextOrientation>(rareInheritedData->m_textOrientation); }
1020
1021    ObjectFit objectFit() const { return static_cast<ObjectFit>(rareNonInheritedData->m_objectFit); }
1022
1023    // Return true if any transform related property (currently transform, transformStyle3D or perspective)
1024    // indicates that we are transforming
1025    bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
1026
1027    enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
1028    void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin = IncludeTransformOrigin) const;
1029    void setPageScaleTransform(float);
1030
1031    bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
1032
1033    TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInheritedData->m_textCombine); }
1034    bool hasTextCombine() const { return textCombine() != TextCombineNone; }
1035
1036    unsigned tabSize() const { return rareInheritedData->m_tabSize; }
1037
1038    // End CSS3 Getters
1039
1040    bool hasFlowInto() const { return !rareNonInheritedData->m_flowThread.isNull(); }
1041    const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
1042    bool hasFlowFrom() const { return !rareNonInheritedData->m_regionThread.isNull(); }
1043    const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
1044    RegionFragment regionFragment() const { return static_cast<RegionFragment>(rareNonInheritedData->m_regionFragment); }
1045
1046    const AtomicString& lineGrid() const { return rareInheritedData->m_lineGrid; }
1047    LineSnap lineSnap() const { return static_cast<LineSnap>(rareInheritedData->m_lineSnap); }
1048    LineAlign lineAlign() const { return static_cast<LineAlign>(rareInheritedData->m_lineAlign); }
1049
1050    // Apple-specific property getter methods
1051    EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
1052    const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
1053    const AnimationList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
1054
1055    AnimationList* accessAnimations();
1056    AnimationList* accessTransitions();
1057
1058    bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
1059    bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; }
1060
1061    // return the first found Animation (including 'all' transitions)
1062    const Animation* transitionForProperty(CSSPropertyID) const;
1063
1064    ETransformStyle3D transformStyle3D() const { return static_cast<ETransformStyle3D>(rareNonInheritedData->m_transformStyle3D); }
1065    bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
1066
1067    EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfaceVisibility>(rareNonInheritedData->m_backfaceVisibility); }
1068    float perspective() const { return rareNonInheritedData->m_perspective; }
1069    bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
1070    const Length& perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
1071    const Length& perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
1072    const LengthSize& pageSize() const { return rareNonInheritedData->m_pageSize; }
1073    PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNonInheritedData->m_pageSizeType); }
1074
1075    // When set, this ensures that styles compare as different. Used during accelerated animations.
1076    bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
1077
1078    LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
1079    const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
1080#if ENABLE(TOUCH_EVENTS)
1081    Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; }
1082#endif
1083#if PLATFORM(IOS)
1084    bool touchCalloutEnabled() const { return rareInheritedData->touchCalloutEnabled; }
1085    Color compositionFillColor() const { return rareInheritedData->compositionFillColor; }
1086#endif
1087#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
1088    bool useTouchOverflowScrolling() const { return rareInheritedData->useTouchOverflowScrolling; }
1089#endif
1090#if ENABLE(IOS_TEXT_AUTOSIZING)
1091    TextSizeAdjustment textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
1092#endif
1093    ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
1094
1095    WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); }
1096    bool isHorizontalWritingMode() const { return WebCore::isHorizontalWritingMode(writingMode()); }
1097    bool isFlippedLinesWritingMode() const { return WebCore::isFlippedLinesWritingMode(writingMode()); }
1098    bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedBlocksWritingMode(writingMode()); }
1099
1100#if ENABLE(CSS_IMAGE_ORIENTATION)
1101    ImageOrientationEnum imageOrientation() const { return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation); }
1102#endif
1103
1104    EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
1105
1106#if ENABLE(CSS_IMAGE_RESOLUTION)
1107    ImageResolutionSource imageResolutionSource() const { return static_cast<ImageResolutionSource>(rareInheritedData->m_imageResolutionSource); }
1108    ImageResolutionSnap imageResolutionSnap() const { return static_cast<ImageResolutionSnap>(rareInheritedData->m_imageResolutionSnap); }
1109    float imageResolution() const { return rareInheritedData->m_imageResolution; }
1110#endif
1111
1112    ESpeak speak() const { return static_cast<ESpeak>(rareInheritedData->speak); }
1113
1114#if ENABLE(CSS_FILTERS)
1115    FilterOperations& mutableFilter() { return rareNonInheritedData.access()->m_filter.access()->m_operations; }
1116    const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; }
1117    bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); }
1118#else
1119    bool hasFilter() const { return false; }
1120#endif
1121
1122#if ENABLE(CSS_COMPOSITING)
1123    BlendMode blendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode); }
1124    void setBlendMode(BlendMode blendMode) { SET_VAR(rareNonInheritedData, m_effectiveBlendMode, blendMode); }
1125    bool hasBlendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode) != BlendModeNormal; }
1126
1127    Isolation isolation() const { return static_cast<Isolation>(rareNonInheritedData->m_isolation); }
1128    void setIsolation(Isolation isolation) { SET_VAR(rareNonInheritedData, m_isolation, isolation); }
1129    bool hasIsolation() const { return rareNonInheritedData->m_isolation != IsolationAuto; }
1130#else
1131    BlendMode blendMode() const { return BlendModeNormal; }
1132    bool hasBlendMode() const { return false; }
1133
1134    Isolation isolation() const { return IsolationAuto; }
1135    bool hasIsolation() const { return false; }
1136#endif
1137
1138#if USE(RTL_SCROLLBAR)
1139    bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
1140#else
1141    bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return false; }
1142#endif
1143
1144// attribute setter methods
1145
1146    void setDisplay(EDisplay v) { noninherited_flags.setEffectiveDisplay(v); }
1147    void setOriginalDisplay(EDisplay v) { noninherited_flags.setOriginalDisplay(v); }
1148    void setPosition(EPosition v) { noninherited_flags.setPosition(v); }
1149    void setFloating(EFloat v) { noninherited_flags.setFloating(v); }
1150
1151    void setLeft(Length v) { SET_VAR(surround, offset.m_left, WTF::move(v)); }
1152    void setRight(Length v) { SET_VAR(surround, offset.m_right, WTF::move(v)); }
1153    void setTop(Length v) { SET_VAR(surround, offset.m_top, WTF::move(v)); }
1154    void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, WTF::move(v)); }
1155
1156    void setWidth(Length v) { SET_VAR(m_box, m_width, WTF::move(v)); }
1157    void setHeight(Length v) { SET_VAR(m_box, m_height, WTF::move(v)); }
1158
1159    void setLogicalWidth(Length v)
1160    {
1161        if (isHorizontalWritingMode()) {
1162            SET_VAR(m_box, m_width, WTF::move(v));
1163        } else {
1164            SET_VAR(m_box, m_height, WTF::move(v));
1165        }
1166    }
1167
1168    void setLogicalHeight(Length v)
1169    {
1170        if (isHorizontalWritingMode()) {
1171            SET_VAR(m_box, m_height, WTF::move(v));
1172        } else {
1173            SET_VAR(m_box, m_width, WTF::move(v));
1174        }
1175    }
1176
1177    void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, WTF::move(v)); }
1178    void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, WTF::move(v)); }
1179    void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, WTF::move(v)); }
1180    void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, WTF::move(v)); }
1181
1182#if ENABLE(DASHBOARD_SUPPORT)
1183    Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
1184    void setDashboardRegions(Vector<StyleDashboardRegion> regions) { SET_VAR(rareNonInheritedData, m_dashboardRegions, regions); }
1185
1186    void setDashboardRegion(int type, const String& label, Length t, Length r, Length b, Length l, bool append)
1187    {
1188        StyleDashboardRegion region;
1189        region.label = label;
1190        region.offset.m_top = WTF::move(t);
1191        region.offset.m_right = WTF::move(r);
1192        region.offset.m_bottom = WTF::move(b);
1193        region.offset.m_left = WTF::move(l);
1194        region.type = type;
1195        if (!append)
1196            rareNonInheritedData.access()->m_dashboardRegions.clear();
1197        rareNonInheritedData.access()->m_dashboardRegions.append(region);
1198    }
1199#endif
1200
1201    void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
1202    void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()); }
1203    void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()); }
1204    void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()); }
1205    void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()); }
1206    void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()); }
1207    void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
1208    void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()); }
1209    void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()); }
1210    void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()); }
1211    void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()); }
1212
1213    void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v); }
1214
1215    void setBackgroundXPosition(Length length) { SET_VAR(m_background, m_background.m_xPosition, WTF::move(length)); }
1216    void setBackgroundYPosition(Length length) { SET_VAR(m_background, m_background.m_yPosition, WTF::move(length)); }
1217    void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b); }
1218    void setBackgroundSizeLength(LengthSize size) { SET_VAR(m_background, m_background.m_sizeLength, WTF::move(size)); }
1219
1220    void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b); }
1221    void setBorderImageSource(PassRefPtr<StyleImage>);
1222    void setBorderImageSlices(LengthBox);
1223    void setBorderImageWidth(LengthBox);
1224    void setBorderImageOutset(LengthBox);
1225
1226    void setBorderTopLeftRadius(LengthSize size) { SET_VAR(surround, border.m_topLeft, WTF::move(size)); }
1227    void setBorderTopRightRadius(LengthSize size) { SET_VAR(surround, border.m_topRight, WTF::move(size)); }
1228    void setBorderBottomLeftRadius(LengthSize size) { SET_VAR(surround, border.m_bottomLeft, WTF::move(size)); }
1229    void setBorderBottomRightRadius(LengthSize size) { SET_VAR(surround, border.m_bottomRight, WTF::move(size)); }
1230
1231    void setBorderRadius(LengthSize s)
1232    {
1233        setBorderTopLeftRadius(s);
1234        setBorderTopRightRadius(s);
1235        setBorderBottomLeftRadius(s);
1236        setBorderBottomRightRadius(s);
1237    }
1238    void setBorderRadius(const IntSize& s)
1239    {
1240        setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
1241    }
1242
1243    RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1244    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1245
1246    RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, LayoutUnit topWidth, LayoutUnit bottomWidth,
1247        LayoutUnit leftWidth, LayoutUnit rightWidth, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1248
1249    void setBorderLeftWidth(float v) { SET_VAR(surround, border.m_left.m_width, v); }
1250    void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v); }
1251    void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, v); }
1252    void setBorderRightWidth(float v) { SET_VAR(surround, border.m_right.m_width, v); }
1253    void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v); }
1254    void setBorderRightColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, v); }
1255    void setBorderTopWidth(float v) { SET_VAR(surround, border.m_top.m_width, v); }
1256    void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v); }
1257    void setBorderTopColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, v); }
1258    void setBorderBottomWidth(float v) { SET_VAR(surround, border.m_bottom.m_width, v); }
1259    void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v); }
1260    void setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v); }
1261
1262    void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v); }
1263    void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto); }
1264    void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v); }
1265    void setOutlineColor(const Color& v) { SET_BORDERVALUE_COLOR(m_background, m_outline, v); }
1266
1267    void setOverflowX(EOverflow v) { noninherited_flags.setOverflowX(v); }
1268    void setOverflowY(EOverflow v) { noninherited_flags.setOverflowY(v); }
1269    void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
1270    void setVerticalAlign(EVerticalAlign v) { noninherited_flags.setVerticalAlign(v); }
1271    void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, WTF::move(length)); }
1272
1273    void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b); }
1274    void setClipLeft(Length length) { SET_VAR(visual, clip.m_left, WTF::move(length)); }
1275    void setClipRight(Length length) { SET_VAR(visual, clip.m_right, WTF::move(length)); }
1276    void setClipTop(Length length) { SET_VAR(visual, clip.m_top, WTF::move(length)); }
1277    void setClipBottom(Length length) { SET_VAR(visual, clip.m_bottom, WTF::move(length)); }
1278    void setClip(Length top, Length right, Length bottom, Length left);
1279    void setClip(LengthBox box) { SET_VAR(visual, clip, WTF::move(box)); }
1280
1281    void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags.setUnicodeBidi(b); }
1282
1283    void setClear(EClear v) { noninherited_flags.setClear(v); }
1284    void setTableLayout(ETableLayout v) { noninherited_flags.setTableLayout(v); }
1285
1286    bool setFontDescription(const FontDescription&);
1287    // Only used for blending font sizes when animating, for MathML anonymous blocks, and for text autosizing.
1288    void setFontSize(float);
1289
1290#if ENABLE(TEXT_AUTOSIZING)
1291    void setTextAutosizingMultiplier(float v)
1292    {
1293        SET_VAR(visual, m_textAutosizingMultiplier, v);
1294        setFontSize(fontDescription().specifiedSize());
1295    }
1296#endif
1297
1298    void setColor(const Color&);
1299    void setTextIndent(Length length) { SET_VAR(rareInheritedData, indent, WTF::move(length)); }
1300#if ENABLE(CSS3_TEXT)
1301    void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); }
1302    void setTextIndentType(TextIndentType v) { SET_VAR(rareInheritedData, m_textIndentType, v); }
1303#endif
1304    void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
1305    void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
1306    void addToTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations |= v; }
1307    void setTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations = v; }
1308    void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v); }
1309#if ENABLE(CSS3_TEXT)
1310    void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
1311    void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); }
1312#endif // CSS3_TEXT
1313    void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
1314    void setTextDecorationSkip(TextDecorationSkip skip) { SET_VAR(rareInheritedData, m_textDecorationSkip, skip); }
1315    void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); }
1316    void setDirection(TextDirection v) { inherited_flags._direction = v; }
1317#if ENABLE(IOS_TEXT_AUTOSIZING)
1318    void setSpecifiedLineHeight(Length v);
1319#endif
1320    void setLineHeight(Length specifiedLineHeight);
1321    bool setZoom(float);
1322    void setZoomWithoutReturnValue(float f) { setZoom(f); }
1323    bool setEffectiveZoom(float);
1324
1325#if ENABLE(CSS_IMAGE_ORIENTATION)
1326    void setImageOrientation(ImageOrientationEnum v) { SET_VAR(rareInheritedData, m_imageOrientation, static_cast<int>(v)); }
1327#endif
1328
1329    void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v); }
1330
1331#if ENABLE(CSS_IMAGE_RESOLUTION)
1332    void setImageResolutionSource(ImageResolutionSource v) { SET_VAR(rareInheritedData, m_imageResolutionSource, v); }
1333    void setImageResolutionSnap(ImageResolutionSnap v) { SET_VAR(rareInheritedData, m_imageResolutionSnap, v); }
1334    void setImageResolution(float f) { SET_VAR(rareInheritedData, m_imageResolution, f); }
1335#endif
1336
1337    void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
1338
1339    void setWordSpacing(Length);
1340    void setLetterSpacing(float);
1341
1342    void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
1343    void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
1344
1345    void adjustBackgroundLayers()
1346    {
1347        if (backgroundLayers()->next()) {
1348            accessBackgroundLayers()->cullEmptyLayers();
1349            accessBackgroundLayers()->fillUnsetProperties();
1350        }
1351    }
1352
1353    void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); }
1354    void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; }
1355
1356    void adjustMaskLayers()
1357    {
1358        if (maskLayers()->next()) {
1359            accessMaskLayers()->cullEmptyLayers();
1360            accessMaskLayers()->fillUnsetProperties();
1361        }
1362    }
1363
1364    void setMaskImage(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_mask.setImage(v); }
1365
1366    void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); }
1367    void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
1368    void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, WTF::move(length)); }
1369    void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, WTF::move(length)); }
1370    void setMaskSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, WTF::move(size)); }
1371
1372    void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
1373    void setHorizontalBorderSpacing(short);
1374    void setVerticalBorderSpacing(short);
1375    void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
1376    void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
1377
1378    void setAspectRatioType(AspectRatioType aspectRatioType) { SET_VAR(rareNonInheritedData, m_aspectRatioType, aspectRatioType); }
1379    void setAspectRatioDenominator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioDenominator, v); }
1380    void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); }
1381
1382    void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
1383    void setListStyleImage(PassRefPtr<StyleImage>);
1384    void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
1385
1386    void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)); }
1387    void setMarginTop(Length length) { SET_VAR(surround, margin.m_top, WTF::move(length)); }
1388    void setMarginBottom(Length length) { SET_VAR(surround, margin.m_bottom, WTF::move(length)); }
1389    void setMarginLeft(Length length) { SET_VAR(surround, margin.m_left, WTF::move(length)); }
1390    void setMarginRight(Length length) { SET_VAR(surround, margin.m_right, WTF::move(length)); }
1391    void setMarginStart(Length);
1392    void setMarginEnd(Length);
1393
1394    void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)); }
1395    void setPaddingBox(LengthBox box) { SET_VAR(surround, padding, WTF::move(box)); }
1396    void setPaddingTop(Length length) { SET_VAR(surround, padding.m_top, WTF::move(length)); }
1397    void setPaddingBottom(Length length) { SET_VAR(surround, padding.m_bottom, WTF::move(length)); }
1398    void setPaddingLeft(Length length) { SET_VAR(surround, padding.m_left, WTF::move(length)); }
1399    void setPaddingRight(Length length) { SET_VAR(surround, padding.m_right, WTF::move(length)); }
1400
1401    void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
1402    void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
1403    void setCursorList(PassRefPtr<CursorList>);
1404    void clearCursorList();
1405
1406#if ENABLE(CURSOR_VISIBILITY)
1407    void setCursorVisibility(CursorVisibility c) { inherited_flags.m_cursorVisibility = c; }
1408#endif
1409
1410    void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
1411    void setIsLink(bool b) { noninherited_flags.setIsLink(b); }
1412
1413    PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(inherited_flags.m_printColorAdjust); }
1414    void setPrintColorAdjust(PrintColorAdjust value) { inherited_flags.m_printColorAdjust = value; }
1415
1416    bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
1417    void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_box, m_zIndex, 0); }
1418    int zIndex() const { return m_box->zIndex(); }
1419    void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v); }
1420
1421    void setHasAutoWidows() { SET_VAR(rareInheritedData, m_hasAutoWidows, true); SET_VAR(rareInheritedData, widows, initialWidows()); }
1422    void setWidows(short w) { SET_VAR(rareInheritedData, m_hasAutoWidows, false); SET_VAR(rareInheritedData, widows, w); }
1423
1424    void setHasAutoOrphans() { SET_VAR(rareInheritedData, m_hasAutoOrphans, true); SET_VAR(rareInheritedData, orphans, initialOrphans()); }
1425    void setOrphans(short o) { SET_VAR(rareInheritedData, m_hasAutoOrphans, false); SET_VAR(rareInheritedData, orphans, o); }
1426
1427    // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
1428    void setPageBreakInside(EPageBreak b) { noninherited_flags.setPageBreakInside(b); }
1429    void setPageBreakBefore(EPageBreak b) { noninherited_flags.setPageBreakBefore(b); }
1430    void setPageBreakAfter(EPageBreak b) { noninherited_flags.setPageBreakAfter(b); }
1431
1432    // CSS3 Setters
1433    void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); }
1434    void setTextShadow(std::unique_ptr<ShadowData>, bool add = false);
1435    void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c); }
1436    void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w); }
1437    void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c); }
1438    void setColorSpace(ColorSpace space) { SET_VAR(rareInheritedData, colorSpace, space); }
1439    void setOpacity(float f) { float v = clampTo<float>(f, 0, 1); SET_VAR(rareNonInheritedData, opacity, v); }
1440    void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
1441    // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
1442    void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, align, a); }
1443#if ENABLE(CSS_BOX_DECORATION_BREAK)
1444    void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_box, m_boxDecorationBreak, b); }
1445#endif
1446    void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
1447    void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex, f); }
1448    void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex_group, fg); }
1449    void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, lines, l); }
1450    void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, ordinal_group, og); }
1451    void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, orient, o); }
1452    void setBoxPack(EBoxPack p) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, pack, p); }
1453    void setBoxShadow(std::unique_ptr<ShadowData>, bool add = false);
1454    void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
1455    void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
1456    void setFlexGrow(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexGrow, f); }
1457    void setFlexShrink(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexShrink, f); }
1458    void setFlexBasis(Length length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, WTF::move(length)); }
1459    void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); }
1460    void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); }
1461    void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
1462    void setAlignSelf(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); }
1463    void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
1464    void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
1465    void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); }
1466    void setJustifySelf(EJustifySelf p) { SET_VAR(rareNonInheritedData, m_justifySelf, p); }
1467    void setJustifySelfOverflowAlignment(EJustifySelfOverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelfOverflowAlignment, overflowAlignment); }
1468#if ENABLE(CSS_GRID_LAYOUT)
1469    void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); }
1470    void setGridAutoRows(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoRows, length); }
1471    void setGridColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); }
1472    void setGridRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, lengths); }
1473    void setNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridColumnLines, namedGridColumnLines); }
1474    void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridRowLines, namedGridRowLines); }
1475    void setOrderedNamedGridColumnLines(const OrderedNamedGridLinesMap& orderedNamedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_orderedNamedGridColumnLines, orderedNamedGridColumnLines); }
1476    void setOrderedNamedGridRowLines(const OrderedNamedGridLinesMap& orderedNamedGridRowLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_orderedNamedGridRowLines, orderedNamedGridRowLines); }
1477    void setNamedGridArea(const NamedGridAreaMap& namedGridArea) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridArea, namedGridArea); }
1478    void setNamedGridAreaRowCount(size_t rowCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaRowCount, rowCount); }
1479    void setNamedGridAreaColumnCount(size_t columnCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaColumnCount, columnCount); }
1480    void setGridAutoFlow(GridAutoFlow flow) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoFlow, flow); }
1481    void setGridItemColumnStart(const GridPosition& columnStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnStart, columnStartPosition); }
1482    void setGridItemColumnEnd(const GridPosition& columnEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnEnd, columnEndPosition); }
1483    void setGridItemRowStart(const GridPosition& rowStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowStart, rowStartPosition); }
1484    void setGridItemRowEnd(const GridPosition& rowEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowEnd, rowEndPosition); }
1485#endif /* ENABLE(CSS_GRID_LAYOUT) */
1486    void setMarqueeIncrement(Length length) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, WTF::move(length)); }
1487    void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
1488    void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
1489    void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->m_marquee, behavior, b); }
1490    void setMarqueeLoopCount(int i) { SET_VAR(rareNonInheritedData.access()->m_marquee, loops, i); }
1491    void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
1492    void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
1493    void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
1494    void setTextOverflow(TextOverflow overflow) { SET_VAR(rareNonInheritedData, textOverflow, overflow); }
1495    void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); }
1496    void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); }
1497    void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
1498    void setOverflowWrap(EOverflowWrap b) { SET_VAR(rareInheritedData, overflowWrap, b); }
1499    void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
1500    void setLineBreak(LineBreak b) { SET_VAR(rareInheritedData, lineBreak, b); }
1501    void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
1502    void setHyphenationLimitBefore(short limit) { SET_VAR(rareInheritedData, hyphenationLimitBefore, limit); }
1503    void setHyphenationLimitAfter(short limit) { SET_VAR(rareInheritedData, hyphenationLimitAfter, limit); }
1504    void setHyphenationLimitLines(short limit) { SET_VAR(rareInheritedData, hyphenationLimitLines, limit); }
1505    void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
1506    void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); }
1507    void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
1508    void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
1509    void setColumnAxis(ColumnAxis axis) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_axis, axis); }
1510    void setColumnProgression(ColumnProgression progression) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_progression, progression); }
1511    void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
1512    void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
1513    void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
1514    void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
1515    void setColumnFill(ColumnFill columnFill) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_fill, columnFill); }
1516    void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
1517    void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
1518    void setColumnRuleColor(const Color& c) { SET_BORDERVALUE_COLOR(rareNonInheritedData.access()->m_multiCol, m_rule, c); }
1519    void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
1520    void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
1521    void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()); }
1522    void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, columnSpan); }
1523    void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
1524    // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
1525    void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
1526    void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
1527    void setRegionBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakBefore, p); }
1528    void setRegionBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData, m_regionBreakInside, p); }
1529    void setRegionBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakAfter, p); }
1530    void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
1531    void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
1532    void setTransformOriginX(Length length) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, WTF::move(length)); }
1533    void setTransformOriginY(Length length) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, WTF::move(length)); }
1534    void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
1535    void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
1536    void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
1537    void setTextDecorationColor(const Color& c) { SET_VAR(rareNonInheritedData, m_textDecorationColor, c); }
1538    void setTextEmphasisColor(const Color& c) { SET_VAR(rareInheritedData, textEmphasisColor, c); }
1539    void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); }
1540    void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); }
1541    void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); }
1542    void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); }
1543    bool setTextOrientation(TextOrientation);
1544
1545    void setObjectFit(ObjectFit fit) { SET_VAR(rareNonInheritedData, m_objectFit, fit); }
1546
1547    void setRubyPosition(RubyPosition position) { SET_VAR(rareInheritedData, m_rubyPosition, position); }
1548
1549#if ENABLE(CSS_FILTERS)
1550    void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); }
1551#endif
1552
1553    void setTabSize(unsigned size) { SET_VAR(rareInheritedData, m_tabSize, size); }
1554
1555    // End CSS3 Setters
1556
1557    void setLineGrid(const AtomicString& lineGrid) { SET_VAR(rareInheritedData, m_lineGrid, lineGrid); }
1558    void setLineSnap(LineSnap lineSnap) { SET_VAR(rareInheritedData, m_lineSnap, lineSnap); }
1559    void setLineAlign(LineAlign lineAlign) { SET_VAR(rareInheritedData, m_lineAlign, lineAlign); }
1560
1561    void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); }
1562    void setRegionThread(const AtomicString& regionThread) { SET_VAR(rareNonInheritedData, m_regionThread, regionThread); }
1563    void setRegionFragment(RegionFragment regionFragment) { SET_VAR(rareNonInheritedData, m_regionFragment, regionFragment); }
1564
1565    // Apple-specific property setters
1566    void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
1567
1568    void clearAnimations()
1569    {
1570        rareNonInheritedData.access()->m_animations = nullptr;
1571    }
1572
1573    void clearTransitions()
1574    {
1575        rareNonInheritedData.access()->m_transitions = nullptr;
1576    }
1577
1578    void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? std::make_unique<AnimationList>(*parent) : nullptr; }
1579    void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? std::make_unique<AnimationList>(*parent) : nullptr; }
1580    void adjustAnimations();
1581    void adjustTransitions();
1582
1583    void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
1584    void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
1585    void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
1586    void setPerspectiveOriginX(Length length) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, WTF::move(length)); }
1587    void setPerspectiveOriginY(Length length) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, WTF::move(length)); }
1588    void setPageSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_pageSize, WTF::move(size)); }
1589    void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
1590    void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
1591
1592    void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
1593
1594    void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
1595    void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
1596#if ENABLE(TOUCH_EVENTS)
1597    void setTapHighlightColor(const Color& c) { SET_VAR(rareInheritedData, tapHighlightColor, c); }
1598#endif
1599#if PLATFORM(IOS)
1600    void setTouchCalloutEnabled(bool v) { SET_VAR(rareInheritedData, touchCalloutEnabled, v); }
1601    void setCompositionFillColor(const Color &c) { SET_VAR(rareInheritedData, compositionFillColor, c); }
1602#endif
1603#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
1604    void setUseTouchOverflowScrolling(bool v) { SET_VAR(rareInheritedData, useTouchOverflowScrolling, v); }
1605#endif
1606#if ENABLE(IOS_TEXT_AUTOSIZING)
1607    void setTextSizeAdjust(TextSizeAdjustment anAdjustment) { SET_VAR(rareInheritedData, textSizeAdjust, anAdjustment); }
1608#endif
1609    void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
1610
1611    const SVGRenderStyle& svgStyle() const { return *m_svgStyle; }
1612    SVGRenderStyle& accessSVGStyle() { return *m_svgStyle.access(); }
1613
1614    const SVGPaint::SVGPaintType& fillPaintType() const { return svgStyle().fillPaintType(); }
1615    Color fillPaintColor() const { return svgStyle().fillPaintColor(); }
1616    void setFillPaintColor(const Color& c) { accessSVGStyle().setFillPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
1617    float fillOpacity() const { return svgStyle().fillOpacity(); }
1618    void setFillOpacity(float f) { accessSVGStyle().setFillOpacity(f); }
1619
1620    const SVGPaint::SVGPaintType& strokePaintType() const { return svgStyle().strokePaintType(); }
1621    Color strokePaintColor() const { return svgStyle().strokePaintColor(); }
1622    void setStrokePaintColor(const Color& c) { accessSVGStyle().setStrokePaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
1623    float strokeOpacity() const { return svgStyle().strokeOpacity(); }
1624    void setStrokeOpacity(float f) { accessSVGStyle().setStrokeOpacity(f); }
1625    SVGLength strokeWidth() const { return svgStyle().strokeWidth(); }
1626    void setStrokeWidth(SVGLength w) { accessSVGStyle().setStrokeWidth(w); }
1627    Vector<SVGLength> strokeDashArray() const { return svgStyle().strokeDashArray(); }
1628    void setStrokeDashArray(Vector<SVGLength> array) { accessSVGStyle().setStrokeDashArray(array); }
1629    SVGLength strokeDashOffset() const { return svgStyle().strokeDashOffset(); }
1630    void setStrokeDashOffset(SVGLength d) { accessSVGStyle().setStrokeDashOffset(d); }
1631    float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); }
1632    void setStrokeMiterLimit(float f) { accessSVGStyle().setStrokeMiterLimit(f); }
1633
1634    float floodOpacity() const { return svgStyle().floodOpacity(); }
1635    void setFloodOpacity(float f) { accessSVGStyle().setFloodOpacity(f); }
1636
1637    float stopOpacity() const { return svgStyle().stopOpacity(); }
1638    void setStopOpacity(float f) { accessSVGStyle().setStopOpacity(f); }
1639
1640    void setStopColor(const Color& c) { accessSVGStyle().setStopColor(c); }
1641    void setFloodColor(const Color& c) { accessSVGStyle().setFloodColor(c); }
1642    void setLightingColor(const Color& c) { accessSVGStyle().setLightingColor(c); }
1643
1644    SVGLength baselineShiftValue() const { return svgStyle().baselineShiftValue(); }
1645    void setBaselineShiftValue(SVGLength s) { accessSVGStyle().setBaselineShiftValue(s); }
1646    SVGLength kerning() const { return svgStyle().kerning(); }
1647    void setKerning(SVGLength k) { accessSVGStyle().setKerning(k); }
1648
1649#if ENABLE(CSS_SHAPES)
1650    void setShapeOutside(PassRefPtr<ShapeValue> value)
1651    {
1652        if (rareNonInheritedData->m_shapeOutside == value)
1653            return;
1654        rareNonInheritedData.access()->m_shapeOutside = value;
1655    }
1656    ShapeValue* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); }
1657
1658    static ShapeValue* initialShapeOutside() { return 0; }
1659
1660    const Length& shapeMargin() const { return rareNonInheritedData->m_shapeMargin; }
1661    void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, WTF::move(shapeMargin)); }
1662    static Length initialShapeMargin() { return Length(0, Fixed); }
1663
1664    float shapeImageThreshold() const { return rareNonInheritedData->m_shapeImageThreshold; }
1665    void setShapeImageThreshold(float shapeImageThreshold)
1666    {
1667        float clampedShapeImageThreshold = clampTo<float>(shapeImageThreshold, 0, 1);
1668        SET_VAR(rareNonInheritedData, m_shapeImageThreshold, clampedShapeImageThreshold);
1669    }
1670    static float initialShapeImageThreshold() { return 0; }
1671#endif
1672
1673    void setClipPath(PassRefPtr<ClipPathOperation> operation)
1674    {
1675        if (rareNonInheritedData->m_clipPath != operation)
1676            rareNonInheritedData.access()->m_clipPath = operation;
1677    }
1678    ClipPathOperation* clipPath() const { return rareNonInheritedData->m_clipPath.get(); }
1679
1680    static ClipPathOperation* initialClipPath() { return 0; }
1681
1682    bool hasContent() const { return contentData(); }
1683    const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
1684    bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
1685    void clearContent();
1686    void setContent(const String&, bool add = false);
1687    void setContent(PassRefPtr<StyleImage>, bool add = false);
1688    void setContent(std::unique_ptr<CounterContent>, bool add = false);
1689    void setContent(QuoteType, bool add = false);
1690    void setContentAltText(const String&);
1691    const String& contentAltText() const;
1692
1693    const CounterDirectiveMap* counterDirectives() const;
1694    CounterDirectiveMap& accessCounterDirectives();
1695    const CounterDirectives getCounterDirectives(const AtomicString& identifier) const;
1696
1697    QuotesData* quotes() const { return rareInheritedData->quotes.get(); }
1698    void setQuotes(PassRefPtr<QuotesData>);
1699
1700    const AtomicString& hyphenString() const;
1701
1702    bool inheritedNotEqual(const RenderStyle*) const;
1703    bool inheritedDataShared(const RenderStyle*) const;
1704
1705#if ENABLE(IOS_TEXT_AUTOSIZING)
1706    uint32_t hashForTextAutosizing() const;
1707    bool equalForTextAutosizing(const RenderStyle *other) const;
1708#endif
1709
1710    StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1711    bool diffRequiresLayerRepaint(const RenderStyle&, bool isComposited) const;
1712
1713    bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); }
1714    bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
1715    bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
1716    bool isDisplayRegionType() const
1717    {
1718        return display() == BLOCK || display() == INLINE_BLOCK
1719            || display() == TABLE_CELL || display() == TABLE_CAPTION
1720            || display() == LIST_ITEM;
1721    }
1722
1723    bool setWritingMode(WritingMode v)
1724    {
1725        if (v == writingMode())
1726            return false;
1727
1728        inherited_flags.m_writingMode = v;
1729        return true;
1730    }
1731
1732    // A unique style is one that has matches something that makes it impossible to share.
1733    bool unique() const { return noninherited_flags.isUnique(); }
1734    void setUnique() { noninherited_flags.setIsUnique(); }
1735
1736    bool emptyState() const { return noninherited_flags.emptyState(); }
1737    void setEmptyState(bool b) { setUnique(); noninherited_flags.setEmptyState(b); }
1738    bool firstChildState() const { return noninherited_flags.firstChildState(); }
1739    void setFirstChildState() { setUnique(); noninherited_flags.setFirstChildState(true); }
1740    bool lastChildState() const { return noninherited_flags.lastChildState(); }
1741    void setLastChildState() { setUnique(); noninherited_flags.setLastChildState(true); }
1742
1743    Color visitedDependentColor(int colorProperty) const;
1744
1745    void setHasExplicitlyInheritedProperties() { noninherited_flags.setHasExplicitlyInheritedProperties(true); }
1746    bool hasExplicitlyInheritedProperties() const { return noninherited_flags.hasExplicitlyInheritedProperties(); }
1747
1748    // Initial values for all the properties
1749    static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1750    static EBorderStyle initialBorderStyle() { return BNONE; }
1751    static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
1752    static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
1753    static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
1754    static ECaptionSide initialCaptionSide() { return CAPTOP; }
1755    static ColorSpace initialColorSpace() { return ColorSpaceDeviceRGB; }
1756    static ColumnAxis initialColumnAxis() { return AutoColumnAxis; }
1757    static ColumnProgression initialColumnProgression() { return NormalColumnProgression; }
1758    static TextDirection initialDirection() { return LTR; }
1759    static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
1760    static TextCombine initialTextCombine() { return TextCombineNone; }
1761    static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
1762    static ObjectFit initialObjectFit() { return ObjectFitFill; }
1763    static EEmptyCell initialEmptyCells() { return SHOW; }
1764    static EListStylePosition initialListStylePosition() { return OUTSIDE; }
1765    static EListStyleType initialListStyleType() { return Disc; }
1766    static ETextTransform initialTextTransform() { return TTNONE; }
1767    static EVisibility initialVisibility() { return VISIBLE; }
1768    static EWhiteSpace initialWhiteSpace() { return NORMAL; }
1769    static short initialHorizontalBorderSpacing() { return 0; }
1770    static short initialVerticalBorderSpacing() { return 0; }
1771    static ECursor initialCursor() { return CURSOR_AUTO; }
1772#if ENABLE(CURSOR_VISIBILITY)
1773    static CursorVisibility initialCursorVisibility() { return CursorVisibilityAuto; }
1774#endif
1775    static Color initialColor() { return Color::black; }
1776    static StyleImage* initialListStyleImage() { return 0; }
1777    static float initialBorderWidth() { return 3; }
1778    static unsigned short initialColumnRuleWidth() { return 3; }
1779    static unsigned short initialOutlineWidth() { return 3; }
1780    static float initialLetterSpacing() { return 0; }
1781    static Length initialWordSpacing() { return Length(Fixed); }
1782    static Length initialSize() { return Length(); }
1783    static Length initialMinSize() { return Length(Fixed); }
1784    static Length initialMaxSize() { return Length(Undefined); }
1785    static Length initialOffset() { return Length(); }
1786    static Length initialMargin() { return Length(Fixed); }
1787    static Length initialPadding() { return Length(Fixed); }
1788    static Length initialTextIndent() { return Length(Fixed); }
1789#if ENABLE(CSS3_TEXT)
1790    static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; }
1791    static TextIndentType initialTextIndentType() { return TextIndentNormal; }
1792#endif
1793    static short initialWidows() { return 2; }
1794    static short initialOrphans() { return 2; }
1795    static Length initialLineHeight() { return Length(-100.0f, Percent); }
1796#if ENABLE(IOS_TEXT_AUTOSIZING)
1797    static Length initialSpecifiedLineHeight() { return Length(-100.0f, Percent); }
1798#endif
1799    static ETextAlign initialTextAlign() { return TASTART; }
1800    static TextDecoration initialTextDecoration() { return TextDecorationNone; }
1801#if ENABLE(CSS3_TEXT)
1802    static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
1803    static TextJustify initialTextJustify() { return TextJustifyAuto; }
1804#endif // CSS3_TEXT
1805    static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
1806    static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipAuto; }
1807    static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
1808    static float initialZoom() { return 1.0f; }
1809    static int initialOutlineOffset() { return 0; }
1810    static float initialOpacity() { return 1.0f; }
1811    static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
1812    static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; }
1813    static EBoxDirection initialBoxDirection() { return BNORMAL; }
1814    static EBoxLines initialBoxLines() { return SINGLE; }
1815    static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
1816    static EBoxPack initialBoxPack() { return Start; }
1817    static float initialBoxFlex() { return 0.0f; }
1818    static unsigned int initialBoxFlexGroup() { return 1; }
1819    static unsigned int initialBoxOrdinalGroup() { return 1; }
1820    static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
1821    static StyleReflection* initialBoxReflect() { return 0; }
1822    static float initialFlexGrow() { return 0; }
1823    static float initialFlexShrink() { return 1; }
1824    static Length initialFlexBasis() { return Length(Auto); }
1825    static int initialOrder() { return 0; }
1826    static EAlignContent initialAlignContent() { return AlignContentStretch; }
1827    static EAlignItems initialAlignItems() { return AlignStretch; }
1828    static EAlignItems initialAlignSelf() { return AlignAuto; }
1829    static EFlexDirection initialFlexDirection() { return FlowRow; }
1830    static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
1831    static EJustifyContent initialJustifyContent() { return JustifyFlexStart; }
1832    static EJustifySelf initialJustifySelf() { return JustifySelfAuto; }
1833    static EJustifySelfOverflowAlignment initialJustifySelfOverflowAlignment() { return JustifySelfOverflowAlignmentDefault; }
1834    static int initialMarqueeLoopCount() { return -1; }
1835    static int initialMarqueeSpeed() { return 85; }
1836    static Length initialMarqueeIncrement() { return Length(6, Fixed); }
1837    static EMarqueeBehavior initialMarqueeBehavior() { return MSCROLL; }
1838    static EMarqueeDirection initialMarqueeDirection() { return MAUTO; }
1839    static EUserModify initialUserModify() { return READ_ONLY; }
1840    static EUserDrag initialUserDrag() { return DRAG_AUTO; }
1841    static EUserSelect initialUserSelect() { return SELECT_TEXT; }
1842    static TextOverflow initialTextOverflow() { return TextOverflowClip; }
1843    static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; }
1844    static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; }
1845    static EWordBreak initialWordBreak() { return NormalWordBreak; }
1846    static EOverflowWrap initialOverflowWrap() { return NormalOverflowWrap; }
1847    static ENBSPMode initialNBSPMode() { return NBNORMAL; }
1848    static LineBreak initialLineBreak() { return LineBreakAuto; }
1849    static ESpeak initialSpeak() { return SpeakNormal; }
1850    static Hyphens initialHyphens() { return HyphensManual; }
1851    static short initialHyphenationLimitBefore() { return -1; }
1852    static short initialHyphenationLimitAfter() { return -1; }
1853    static short initialHyphenationLimitLines() { return -1; }
1854    static const AtomicString& initialHyphenationString() { return nullAtom; }
1855    static const AtomicString& initialLocale() { return nullAtom; }
1856    static EBorderFit initialBorderFit() { return BorderFitBorder; }
1857    static EResize initialResize() { return RESIZE_NONE; }
1858    static ControlPart initialAppearance() { return NoControlPart; }
1859    static AspectRatioType initialAspectRatioType() { return AspectRatioAuto; }
1860    static float initialAspectRatioDenominator() { return 1; }
1861    static float initialAspectRatioNumerator() { return 1; }
1862    static Order initialRTLOrdering() { return LogicalOrder; }
1863    static float initialTextStrokeWidth() { return 0; }
1864    static unsigned short initialColumnCount() { return 1; }
1865    static ColumnFill initialColumnFill() { return ColumnFillBalance; }
1866    static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
1867    static const TransformOperations& initialTransform() { DEPRECATED_DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
1868    static Length initialTransformOriginX() { return Length(50.0f, Percent); }
1869    static Length initialTransformOriginY() { return Length(50.0f, Percent); }
1870    static EPointerEvents initialPointerEvents() { return PE_AUTO; }
1871    static float initialTransformOriginZ() { return 0; }
1872    static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
1873    static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
1874    static float initialPerspective() { return 0; }
1875    static Length initialPerspectiveOriginX() { return Length(50.0f, Percent); }
1876    static Length initialPerspectiveOriginY() { return Length(50.0f, Percent); }
1877    static Color initialBackgroundColor() { return Color::transparent; }
1878    static Color initialTextEmphasisColor() { return TextEmphasisFillFilled; }
1879    static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; }
1880    static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
1881    static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
1882    static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver | TextEmphasisPositionRight; }
1883    static RubyPosition initialRubyPosition() { return RubyPositionBefore; }
1884    static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
1885    static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; }
1886    static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
1887    static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; }
1888    static ImageResolutionSnap initialImageResolutionSnap() { return ImageResolutionNoSnap; }
1889    static float initialImageResolution() { return 1; }
1890    static StyleImage* initialBorderImageSource() { return 0; }
1891    static StyleImage* initialMaskBoxImageSource() { return 0; }
1892    static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
1893
1894#if ENABLE(CSS_GRID_LAYOUT)
1895    // The initial value is 'none' for grid tracks.
1896    static Vector<GridTrackSize> initialGridColumns() { return Vector<GridTrackSize>(); }
1897    static Vector<GridTrackSize> initialGridRows() { return Vector<GridTrackSize>(); }
1898
1899    static GridAutoFlow initialGridAutoFlow() { return AutoFlowRow; }
1900
1901    static GridTrackSize initialGridAutoColumns() { return GridTrackSize(Auto); }
1902    static GridTrackSize initialGridAutoRows() { return GridTrackSize(Auto); }
1903
1904    static NamedGridAreaMap initialNamedGridArea() { return NamedGridAreaMap(); }
1905    static size_t initialNamedGridAreaCount() { return 0; }
1906
1907    static NamedGridLinesMap initialNamedGridColumnLines() { return NamedGridLinesMap(); }
1908    static NamedGridLinesMap initialNamedGridRowLines() { return NamedGridLinesMap(); }
1909
1910    static OrderedNamedGridLinesMap initialOrderedNamedGridColumnLines() { return OrderedNamedGridLinesMap(); }
1911    static OrderedNamedGridLinesMap initialOrderedNamedGridRowLines() { return OrderedNamedGridLinesMap(); }
1912
1913    // 'auto' is the default.
1914    static GridPosition initialGridItemColumnStart() { return GridPosition(); }
1915    static GridPosition initialGridItemColumnEnd() { return GridPosition(); }
1916    static GridPosition initialGridItemRowStart() { return GridPosition(); }
1917    static GridPosition initialGridItemRowEnd() { return GridPosition(); }
1918#endif /* ENABLE(CSS_GRID_LAYOUT) */
1919
1920    static unsigned initialTabSize() { return 8; }
1921
1922    static const AtomicString& initialLineGrid() { return nullAtom; }
1923    static LineSnap initialLineSnap() { return LineSnapNone; }
1924    static LineAlign initialLineAlign() { return LineAlignNone; }
1925
1926    static const AtomicString& initialFlowThread() { return nullAtom; }
1927    static const AtomicString& initialRegionThread() { return nullAtom; }
1928    static RegionFragment initialRegionFragment() { return AutoRegionFragment; }
1929
1930    // Keep these at the end.
1931    static LineClampValue initialLineClamp() { return LineClampValue(); }
1932    static ETextSecurity initialTextSecurity() { return TSNONE; }
1933#if ENABLE(IOS_TEXT_AUTOSIZING)
1934    static TextSizeAdjustment initialTextSizeAdjust() { return TextSizeAdjustment(); }
1935#endif
1936#if PLATFORM(IOS)
1937    static bool initialTouchCalloutEnabled() { return true; }
1938    static Color initialCompositionFillColor() { return Color::compositionFill; }
1939#endif
1940#if ENABLE(TOUCH_EVENTS)
1941    static Color initialTapHighlightColor();
1942#endif
1943#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
1944    static bool initialUseTouchOverflowScrolling() { return false; }
1945#endif
1946#if ENABLE(DASHBOARD_SUPPORT)
1947    static const Vector<StyleDashboardRegion>& initialDashboardRegions();
1948    static const Vector<StyleDashboardRegion>& noneDashboardRegions();
1949#endif
1950#if ENABLE(CSS_FILTERS)
1951    static const FilterOperations& initialFilter() { DEPRECATED_DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
1952#endif
1953#if ENABLE(CSS_COMPOSITING)
1954    static BlendMode initialBlendMode() { return BlendModeNormal; }
1955    static Isolation initialIsolation() { return IsolationAuto; }
1956#endif
1957
1958    static ptrdiff_t noninheritedFlagsMemoryOffset() { return OBJECT_OFFSETOF(RenderStyle, noninherited_flags); }
1959
1960private:
1961    bool changeAffectsVisualOverflow(const RenderStyle&) const;
1962    bool changeRequiresLayout(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1963    bool changeRequiresPositionedLayoutOnly(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1964    bool changeRequiresLayerRepaint(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1965    bool changeRequiresRepaint(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1966    bool changeRequiresRepaintIfTextOrBorderOrOutline(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1967    bool changeRequiresRecompositeLayer(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1968
1969    void setVisitedLinkColor(const Color&);
1970    void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v); }
1971    void setVisitedLinkBorderLeftColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v); }
1972    void setVisitedLinkBorderRightColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v); }
1973    void setVisitedLinkBorderBottomColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v); }
1974    void setVisitedLinkBorderTopColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v); }
1975    void setVisitedLinkOutlineColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v); }
1976    void setVisitedLinkColumnRuleColor(const Color& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v); }
1977    void setVisitedLinkTextDecorationColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkTextDecorationColor, v); }
1978    void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextEmphasisColor, v); }
1979    void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextFillColor, v); }
1980    void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextStrokeColor, v); }
1981
1982    void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags.setUnicodeBidi(parent->noninherited_flags.unicodeBidi()); }
1983    void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
1984    LayoutBoxExtent getShadowInsetExtent(const ShadowData*) const;
1985    void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const;
1986    void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom) const;
1987    void getShadowInlineDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
1988    {
1989        return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight);
1990    }
1991    void getShadowBlockDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
1992    {
1993        return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom);
1994    }
1995
1996    bool isDisplayReplacedType(EDisplay display) const
1997    {
1998        return display == INLINE_BLOCK || display == INLINE_BOX || display == INLINE_FLEX
1999#if ENABLE(CSS_GRID_LAYOUT)
2000            || display == INLINE_GRID
2001#endif
2002            || display == INLINE_TABLE;
2003    }
2004
2005    bool isDisplayInlineType(EDisplay display) const
2006    {
2007        return display == INLINE || isDisplayReplacedType(display);
2008    }
2009
2010    // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
2011    Color invalidColor() const { static Color invalid; return invalid; }
2012    Color borderLeftColor() const { return surround->border.left().color(); }
2013    Color borderRightColor() const { return surround->border.right().color(); }
2014    Color borderTopColor() const { return surround->border.top().color(); }
2015    Color borderBottomColor() const { return surround->border.bottom().color(); }
2016    Color backgroundColor() const { return m_background->color(); }
2017    Color color() const;
2018    Color columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
2019    Color outlineColor() const { return m_background->outline().color(); }
2020    Color textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
2021    Color textFillColor() const { return rareInheritedData->textFillColor; }
2022    Color textStrokeColor() const { return rareInheritedData->textStrokeColor; }
2023    Color visitedLinkColor() const;
2024    Color visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
2025    Color visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
2026    Color visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
2027    Color visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
2028    Color visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
2029    Color visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
2030    Color visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
2031    Color textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; }
2032    Color visitedLinkTextDecorationColor() const { return rareNonInheritedData->m_visitedLinkTextDecorationColor; }
2033    Color visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor; }
2034    Color visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor; }
2035    Color visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor; }
2036
2037    Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
2038
2039    Color stopColor() const { return svgStyle().stopColor(); }
2040    Color floodColor() const { return svgStyle().floodColor(); }
2041    Color lightingColor() const { return svgStyle().lightingColor(); }
2042
2043    void appendContent(std::unique_ptr<ContentData>);
2044};
2045
2046inline int adjustForAbsoluteZoom(int value, const RenderStyle& style)
2047{
2048    double zoomFactor = style.effectiveZoom();
2049    if (zoomFactor == 1)
2050        return value;
2051    // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
2052    if (zoomFactor > 1) {
2053        if (value < 0)
2054            value--;
2055        else
2056            value++;
2057    }
2058
2059    return roundForImpreciseConversion<int>(value / zoomFactor);
2060}
2061
2062inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)
2063{
2064    return value / style->effectiveZoom();
2065}
2066
2067#if ENABLE(SUBPIXEL_LAYOUT)
2068inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const RenderStyle& style)
2069{
2070    return value / style.effectiveZoom();
2071}
2072#endif
2073
2074inline bool RenderStyle::setZoom(float f)
2075{
2076    if (compareEqual(visual->m_zoom, f))
2077        return false;
2078    visual.access()->m_zoom = f;
2079    setEffectiveZoom(effectiveZoom() * zoom());
2080    return true;
2081}
2082
2083inline bool RenderStyle::setEffectiveZoom(float f)
2084{
2085    if (compareEqual(rareInheritedData->m_effectiveZoom, f))
2086        return false;
2087    rareInheritedData.access()->m_effectiveZoom = f;
2088    return true;
2089}
2090
2091inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation)
2092{
2093    if (compareEqual(rareInheritedData->m_textOrientation, textOrientation))
2094        return false;
2095
2096    rareInheritedData.access()->m_textOrientation = textOrientation;
2097    return true;
2098}
2099
2100inline bool RenderStyle::hasAnyPublicPseudoStyles() const
2101{
2102    return noninherited_flags.hasAnyPublicPseudoStyles();
2103}
2104
2105inline bool RenderStyle::hasPseudoStyle(PseudoId pseudo) const
2106{
2107    return noninherited_flags.hasPseudoStyle(pseudo);
2108}
2109
2110inline void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
2111{
2112    noninherited_flags.setHasPseudoStyle(pseudo);
2113}
2114
2115} // namespace WebCore
2116
2117#endif // RenderStyle_h
2118