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 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
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.
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.
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.
25 #ifndef ComputedStyle_h
26 #define ComputedStyle_h
28 #include "core/CSSPropertyNames.h"
29 #include "core/CoreExport.h"
30 #include "core/animation/css/CSSAnimationData.h"
31 #include "core/animation/css/CSSTransitionData.h"
32 #include "core/css/CSSPrimitiveValue.h"
33 #include "core/style/BorderValue.h"
34 #include "core/style/CounterDirectives.h"
35 #include "core/style/DataRef.h"
36 #include "core/style/ComputedStyleConstants.h"
37 #include "core/style/LineClampValue.h"
38 #include "core/style/NinePieceImage.h"
39 #include "core/style/OutlineValue.h"
40 #include "core/style/SVGComputedStyle.h"
41 #include "core/style/ShapeValue.h"
42 #include "core/style/StyleBackgroundData.h"
43 #include "core/style/StyleBoxData.h"
44 #include "core/style/StyleContentAlignmentData.h"
45 #include "core/style/StyleDeprecatedFlexibleBoxData.h"
46 #include "core/style/StyleDifference.h"
47 #include "core/style/StyleFilterData.h"
48 #include "core/style/StyleFlexibleBoxData.h"
49 #include "core/style/StyleGridData.h"
50 #include "core/style/StyleGridItemData.h"
51 #include "core/style/StyleInheritedData.h"
52 #include "core/style/StyleMotionPath.h"
53 #include "core/style/StyleMultiColData.h"
54 #include "core/style/StyleRareInheritedData.h"
55 #include "core/style/StyleRareNonInheritedData.h"
56 #include "core/style/StyleReflection.h"
57 #include "core/style/StyleScrollSnapData.h"
58 #include "core/style/StyleSelfAlignmentData.h"
59 #include "core/style/StyleSurroundData.h"
60 #include "core/style/StyleTransformData.h"
61 #include "core/style/StyleVisualData.h"
62 #include "core/style/StyleWillChangeData.h"
63 #include "core/style/TransformOrigin.h"
64 #include "platform/Length.h"
65 #include "platform/LengthBox.h"
66 #include "platform/LengthPoint.h"
67 #include "platform/LengthSize.h"
68 #include "platform/ThemeTypes.h"
69 #include "platform/fonts/FontBaseline.h"
70 #include "platform/fonts/FontDescription.h"
71 #include "platform/geometry/FloatRoundedRect.h"
72 #include "platform/geometry/LayoutRectOutsets.h"
73 #include "platform/graphics/Color.h"
74 #include "platform/graphics/GraphicsTypes.h"
75 #include "platform/scroll/ScrollableArea.h"
76 #include "platform/text/TextDirection.h"
77 #include "platform/text/TextRun.h"
78 #include "platform/text/UnicodeBidi.h"
79 #include "platform/transforms/TransformOperations.h"
80 #include "wtf/Forward.h"
81 #include "wtf/OwnPtr.h"
82 #include "wtf/RefCounted.h"
83 #include "wtf/StdLibExtras.h"
84 #include "wtf/Vector.h"
86 template<typename T
, typename U
> inline bool compareEqual(const T
& t
, const U
& u
) { return t
== static_cast<T
>(u
); }
88 #define SET_VAR(group, variable, value) \
89 if (!compareEqual(group->variable, value)) \
90 group.access()->variable = value
92 #define SET_VAR_WITH_SETTER(group, getter, setter, value) \
93 if (!compareEqual(group->getter(), value)) \
94 group.access()->setter(value)
96 #define SET_BORDERVALUE_COLOR(group, variable, value) \
97 if (!compareEqual(group->variable.color(), value)) \
98 group.access()->variable.setColor(value)
104 class FilterOperations
;
106 class AppliedTextDecoration
;
109 class CounterContent
;
112 class RotateTransformOperation
;
113 class ScaleTransformOperation
;
116 class StyleInheritedData
;
118 class TransformationMatrix
;
119 class TranslateTransformOperation
;
123 typedef Vector
<RefPtr
<ComputedStyle
>, 4> PseudoStyleCache
;
125 class CORE_EXPORT ComputedStyle
: public RefCounted
<ComputedStyle
> {
126 friend class AnimatedStyleBuilder
; // Used by Web Animations CSS. Sets the color styles
127 friend class CSSAnimatableValueFactory
; // Used by Web Animations CSS. Gets visited and unvisited colors separately.
128 friend class CSSPropertyEquality
; // 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 EditingStyle
; // Editing has to only reveal unvisited info.
131 friend class ComputedStyleCSSValueMapping
; // Needs to be able to see visited and unvisited colors for devtools.
132 friend class StyleBuilderFunctions
; // Sets color styles
133 friend class CachedUAStyle
; // Saves Border/Background information for later comparison.
134 friend class ColorPropertyFunctions
; // Reads initial style values and accesses visited and unvisited colors.
135 friend class LengthPropertyFunctions
; // Reads initial style values.
136 friend class NumberPropertyFunctions
; // Reads initial style values.
137 friend class PaintPropertyFunctions
; // Reads initial style values.
139 // FIXME: When we stop resolving currentColor at style time, these can be removed.
140 friend class CSSToStyleMap
;
141 friend class FilterOperationResolver
;
142 friend class StyleBuilderConverter
;
143 friend class StyleResolverState
;
144 friend class StyleResolver
;
147 // non-inherited attributes
148 DataRef
<StyleBoxData
> m_box
;
149 DataRef
<StyleVisualData
> visual
;
150 DataRef
<StyleBackgroundData
> m_background
;
151 DataRef
<StyleSurroundData
> surround
;
152 DataRef
<StyleRareNonInheritedData
> rareNonInheritedData
;
154 // inherited attributes
155 DataRef
<StyleRareInheritedData
> rareInheritedData
;
156 DataRef
<StyleInheritedData
> inherited
;
158 // list of associated pseudo styles
159 OwnPtr
<PseudoStyleCache
> m_cachedPseudoStyles
;
161 DataRef
<SVGComputedStyle
> m_svgStyle
;
163 // !START SYNC!: Keep this in sync with the copy constructor in ComputedStyle.cpp and implicitlyInherited() in StyleResolver.cpp
166 struct InheritedFlags
{
167 bool operator==(const InheritedFlags
& other
) const
169 return (_empty_cells
== other
._empty_cells
)
170 && (_caption_side
== other
._caption_side
)
171 && (_list_style_type
== other
._list_style_type
)
172 && (_list_style_position
== other
._list_style_position
)
173 && (_visibility
== other
._visibility
)
174 && (_text_align
== other
._text_align
)
175 && (_text_transform
== other
._text_transform
)
176 && (m_textUnderline
== other
.m_textUnderline
)
177 && (_cursor_style
== other
._cursor_style
)
178 && (_direction
== other
._direction
)
179 && (_white_space
== other
._white_space
)
180 && (_border_collapse
== other
._border_collapse
)
181 && (_box_direction
== other
._box_direction
)
182 && (m_rtlOrdering
== other
.m_rtlOrdering
)
183 && (m_printColorAdjust
== other
.m_printColorAdjust
)
184 && (_pointerEvents
== other
._pointerEvents
)
185 && (_insideLink
== other
._insideLink
)
186 && (m_writingMode
== other
.m_writingMode
);
189 bool operator!=(const InheritedFlags
& other
) const { return !(*this == other
); }
191 unsigned _empty_cells
: 1; // EEmptyCell
192 unsigned _caption_side
: 2; // ECaptionSide
193 unsigned _list_style_type
: 7; // EListStyleType
194 unsigned _list_style_position
: 1; // EListStylePosition
195 unsigned _visibility
: 2; // EVisibility
196 unsigned _text_align
: 4; // ETextAlign
197 unsigned _text_transform
: 2; // ETextTransform
198 unsigned m_textUnderline
: 1;
199 unsigned _cursor_style
: 6; // ECursor
200 unsigned _direction
: 1; // TextDirection
201 unsigned _white_space
: 3; // EWhiteSpace
202 unsigned _border_collapse
: 1; // EBorderCollapse
203 unsigned _box_direction
: 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
206 // non CSS2 inherited
207 unsigned m_rtlOrdering
: 1; // Order
208 unsigned m_printColorAdjust
: PrintColorAdjustBits
;
209 unsigned _pointerEvents
: 4; // EPointerEvents
210 unsigned _insideLink
: 2; // EInsideLink
212 // CSS Text Layout Module Level 3: Vertical writing support
213 unsigned m_writingMode
: 2; // WritingMode
218 struct NonInheritedFlags
{
219 // Compare computed styles, differences in other flags should not cause an inequality.
220 bool operator==(const NonInheritedFlags
& other
) const
222 return effectiveDisplay
== other
.effectiveDisplay
223 && originalDisplay
== other
.originalDisplay
224 && overflowX
== other
.overflowX
225 && overflowY
== other
.overflowY
226 && verticalAlign
== other
.verticalAlign
227 && clear
== other
.clear
228 && position
== other
.position
229 && floating
== other
.floating
230 && tableLayout
== other
.tableLayout
231 && unicodeBidi
== other
.unicodeBidi
233 && pageBreakBefore
== other
.pageBreakBefore
234 && pageBreakAfter
== other
.pageBreakAfter
235 && pageBreakInside
== other
.pageBreakInside
;
238 // explicitInheritance
248 bool operator!=(const NonInheritedFlags
& other
) const { return !(*this == other
); }
250 unsigned effectiveDisplay
: 5; // EDisplay
251 unsigned originalDisplay
: 5; // EDisplay
252 unsigned overflowX
: 3; // EOverflow
253 unsigned overflowY
: 3; // EOverflow
254 unsigned verticalAlign
: 4; // EVerticalAlign
255 unsigned clear
: 2; // EClear
256 unsigned position
: 3; // EPosition
257 unsigned floating
: 2; // EFloat
258 unsigned tableLayout
: 1; // ETableLayout
259 unsigned unicodeBidi
: 3; // EUnicodeBidi
261 // This is set if we used viewport units when resolving a length.
262 // It is mutable so we can pass around const ComputedStyles to resolve lengths.
263 mutable unsigned hasViewportUnits
: 1;
267 unsigned pageBreakBefore
: 2; // EPageBreak
268 unsigned pageBreakAfter
: 2; // EPageBreak
269 unsigned pageBreakInside
: 2; // EPageBreak
271 unsigned styleType
: 6; // PseudoId
272 unsigned pseudoBits
: 8;
273 unsigned explicitInheritance
: 1; // Explicitly inherits a non-inherited property
274 unsigned unique
: 1; // Style can not be shared.
276 unsigned emptyState
: 1;
278 unsigned affectedByFocus
: 1;
279 unsigned affectedByHover
: 1;
280 unsigned affectedByActive
: 1;
281 unsigned affectedByDrag
: 1;
285 mutable unsigned hasRemUnits
: 1;
286 // If you add more style bits here, you will also need to update ComputedStyle::copyNonInheritedFromCached()
288 } noninherited_flags
;
293 void setBitDefaults()
295 inherited_flags
._empty_cells
= initialEmptyCells();
296 inherited_flags
._caption_side
= initialCaptionSide();
297 inherited_flags
._list_style_type
= initialListStyleType();
298 inherited_flags
._list_style_position
= initialListStylePosition();
299 inherited_flags
._visibility
= initialVisibility();
300 inherited_flags
._text_align
= initialTextAlign();
301 inherited_flags
._text_transform
= initialTextTransform();
302 inherited_flags
.m_textUnderline
= false;
303 inherited_flags
._cursor_style
= initialCursor();
304 inherited_flags
._direction
= initialDirection();
305 inherited_flags
._white_space
= initialWhiteSpace();
306 inherited_flags
._border_collapse
= initialBorderCollapse();
307 inherited_flags
.m_rtlOrdering
= initialRTLOrdering();
308 inherited_flags
._box_direction
= initialBoxDirection();
309 inherited_flags
.m_printColorAdjust
= initialPrintColorAdjust();
310 inherited_flags
._pointerEvents
= initialPointerEvents();
311 inherited_flags
._insideLink
= NotInsideLink
;
312 inherited_flags
.m_writingMode
= initialWritingMode();
314 noninherited_flags
.effectiveDisplay
= noninherited_flags
.originalDisplay
= initialDisplay();
315 noninherited_flags
.overflowX
= initialOverflowX();
316 noninherited_flags
.overflowY
= initialOverflowY();
317 noninherited_flags
.verticalAlign
= initialVerticalAlign();
318 noninherited_flags
.clear
= initialClear();
319 noninherited_flags
.position
= initialPosition();
320 noninherited_flags
.floating
= initialFloating();
321 noninherited_flags
.tableLayout
= initialTableLayout();
322 noninherited_flags
.unicodeBidi
= initialUnicodeBidi();
323 noninherited_flags
.pageBreakBefore
= initialPageBreak();
324 noninherited_flags
.pageBreakAfter
= initialPageBreak();
325 noninherited_flags
.pageBreakInside
= initialPageBreak();
326 noninherited_flags
.styleType
= NOPSEUDO
;
327 noninherited_flags
.pseudoBits
= 0;
328 noninherited_flags
.explicitInheritance
= false;
329 noninherited_flags
.unique
= false;
330 noninherited_flags
.emptyState
= false;
331 noninherited_flags
.hasViewportUnits
= false;
332 noninherited_flags
.affectedByFocus
= false;
333 noninherited_flags
.affectedByHover
= false;
334 noninherited_flags
.affectedByActive
= false;
335 noninherited_flags
.affectedByDrag
= false;
336 noninherited_flags
.isLink
= false;
337 noninherited_flags
.hasRemUnits
= false;
341 ALWAYS_INLINE
ComputedStyle();
343 enum InitialStyleTag
{
346 ALWAYS_INLINE
explicit ComputedStyle(InitialStyleTag
);
347 ALWAYS_INLINE
ComputedStyle(const ComputedStyle
&);
349 static PassRefPtr
<ComputedStyle
> createInitialStyle();
350 static inline ComputedStyle
* initialStyle()
352 DEFINE_STATIC_REF(ComputedStyle
, s_initialStyle
, (ComputedStyle::createInitialStyle()));
353 return s_initialStyle
;
357 static PassRefPtr
<ComputedStyle
> create();
358 static PassRefPtr
<ComputedStyle
> createAnonymousStyleWithDisplay(const ComputedStyle
& parentStyle
, EDisplay
);
359 static PassRefPtr
<ComputedStyle
> clone(const ComputedStyle
&);
361 // Computes how the style change should be propagated down the tree.
362 static StyleRecalcChange
stylePropagationDiff(const ComputedStyle
* oldStyle
, const ComputedStyle
* newStyle
);
364 static ItemPosition
resolveAlignment(const ComputedStyle
& parentStyle
, const ComputedStyle
& childStyle
, ItemPosition resolvedAutoPositionForLayoutObject
);
365 static ItemPosition
resolveJustification(const ComputedStyle
& parentStyle
, const ComputedStyle
& childStyle
, ItemPosition resolvedAutoPositionForLayoutObject
);
367 StyleDifference
visualInvalidationDiff(const ComputedStyle
&) const;
369 enum IsAtShadowBoundary
{
374 void inheritFrom(const ComputedStyle
& inheritParent
, IsAtShadowBoundary
= NotAtShadowBoundary
);
375 void copyNonInheritedFromCached(const ComputedStyle
&);
377 PseudoId
styleType() const { return static_cast<PseudoId
>(noninherited_flags
.styleType
); }
378 void setStyleType(PseudoId styleType
) { noninherited_flags
.styleType
= styleType
; }
380 ComputedStyle
* getCachedPseudoStyle(PseudoId
) const;
381 ComputedStyle
* addCachedPseudoStyle(PassRefPtr
<ComputedStyle
>);
382 void removeCachedPseudoStyle(PseudoId
);
384 const PseudoStyleCache
* cachedPseudoStyles() const { return m_cachedPseudoStyles
.get(); }
386 void setHasViewportUnits(bool hasViewportUnits
= true) const { noninherited_flags
.hasViewportUnits
= hasViewportUnits
; }
387 bool hasViewportUnits() const { return noninherited_flags
.hasViewportUnits
; }
389 void setHasRemUnits() const { noninherited_flags
.hasRemUnits
= true; }
390 bool hasRemUnits() const { return noninherited_flags
.hasRemUnits
; }
392 bool affectedByFocus() const { return noninherited_flags
.affectedByFocus
; }
393 bool affectedByHover() const { return noninherited_flags
.affectedByHover
; }
394 bool affectedByActive() const { return noninherited_flags
.affectedByActive
; }
395 bool affectedByDrag() const { return noninherited_flags
.affectedByDrag
; }
397 void setAffectedByFocus() { noninherited_flags
.affectedByFocus
= true; }
398 void setAffectedByHover() { noninherited_flags
.affectedByHover
= true; }
399 void setAffectedByActive() { noninherited_flags
.affectedByActive
= true; }
400 void setAffectedByDrag() { noninherited_flags
.affectedByDrag
= true; }
402 bool operator==(const ComputedStyle
& other
) const;
403 bool operator!=(const ComputedStyle
& other
) const { return !(*this == other
); }
404 bool isFloating() const { return noninherited_flags
.floating
!= NoFloat
; }
405 bool hasMargin() const { return surround
->margin
.nonZero(); }
406 bool hasBorderFill() const { return surround
->border
.hasBorderFill(); }
407 bool hasBorder() const { return surround
->border
.hasBorder(); }
408 bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); }
409 bool hasPadding() const { return surround
->padding
.nonZero(); }
410 bool hasMarginBeforeQuirk() const { return marginBefore().quirk(); }
411 bool hasMarginAfterQuirk() const { return marginAfter().quirk(); }
413 bool hasBackgroundImage() const { return m_background
->background().hasImage(); }
414 bool hasFixedBackgroundImage() const { return m_background
->background().hasFixedImage(); }
416 bool hasEntirelyFixedBackground() const;
418 bool hasAppearance() const { return appearance() != NoControlPart
; }
420 bool isBackgroundColorCurrentColor() const { return backgroundColor().isCurrentColor() || visitedLinkBackgroundColor().isCurrentColor(); }
422 bool hasBackground() const
424 Color color
= visitedDependentColor(CSSPropertyBackgroundColor
);
427 return hasBackgroundImage();
430 LayoutRectOutsets
imageOutsets(const NinePieceImage
&) const;
431 bool hasBorderImageOutsets() const
433 return borderImage().hasImage() && borderImage().outset().nonZero();
435 LayoutRectOutsets
borderImageOutsets() const
437 return imageOutsets(borderImage());
440 bool hasFilterOutsets() const { return hasFilter() && filter().hasOutsets(); }
441 FilterOutsets
filterOutsets() const { return hasFilter() ? filter().outsets() : FilterOutsets(); }
443 Order
rtlOrdering() const { return static_cast<Order
>(inherited_flags
.m_rtlOrdering
); }
444 void setRTLOrdering(Order o
) { inherited_flags
.m_rtlOrdering
= o
; }
446 bool isStyleAvailable() const;
448 bool hasAnyPublicPseudoStyles() const;
449 bool hasPseudoStyle(PseudoId
) const;
450 void setHasPseudoStyle(PseudoId
);
451 bool hasUniquePseudoStyle() const;
452 bool hasPseudoElementStyle() const;
454 // attribute getter methods
456 EDisplay
display() const { return static_cast<EDisplay
>(noninherited_flags
.effectiveDisplay
); }
457 EDisplay
originalDisplay() const { return static_cast<EDisplay
>(noninherited_flags
.originalDisplay
); }
459 const Length
& left() const { return surround
->offset
.left(); }
460 const Length
& right() const { return surround
->offset
.right(); }
461 const Length
& top() const { return surround
->offset
.top(); }
462 const Length
& bottom() const { return surround
->offset
.bottom(); }
464 // Accessors for positioned object edges that take into account writing mode.
465 const Length
& logicalLeft() const { return surround
->offset
.logicalLeft(writingMode()); }
466 const Length
& logicalRight() const { return surround
->offset
.logicalRight(writingMode()); }
467 const Length
& logicalTop() const { return surround
->offset
.before(writingMode()); }
468 const Length
& logicalBottom() const { return surround
->offset
.after(writingMode()); }
470 // Whether or not a positioned element requires normal flow x/y to be computed
471 // to determine its position.
472 bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); }
473 bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); }
474 bool hasStaticInlinePosition(bool horizontal
) const { return horizontal
? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
475 bool hasStaticBlockPosition(bool horizontal
) const { return horizontal
? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
477 EPosition
position() const { return static_cast<EPosition
>(noninherited_flags
.position
); }
478 bool hasOutOfFlowPosition() const { return position() == AbsolutePosition
|| position() == FixedPosition
; }
479 bool hasInFlowPosition() const { return position() == RelativePosition
|| position() == StickyPosition
; }
480 bool hasViewportConstrainedPosition() const { return position() == FixedPosition
; }
481 EFloat
floating() const { return static_cast<EFloat
>(noninherited_flags
.floating
); }
483 const Length
& width() const { return m_box
->width(); }
484 const Length
& height() const { return m_box
->height(); }
485 const Length
& minWidth() const { return m_box
->minWidth(); }
486 const Length
& maxWidth() const { return m_box
->maxWidth(); }
487 const Length
& minHeight() const { return m_box
->minHeight(); }
488 const Length
& maxHeight() const { return m_box
->maxHeight(); }
490 const Length
& logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); }
491 const Length
& logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); }
492 const Length
& logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); }
493 const Length
& logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); }
494 const Length
& logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
495 const Length
& logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
497 const BorderData
& border() const { return surround
->border
; }
498 const BorderValue
& borderLeft() const { return surround
->border
.left(); }
499 const BorderValue
& borderRight() const { return surround
->border
.right(); }
500 const BorderValue
& borderTop() const { return surround
->border
.top(); }
501 const BorderValue
& borderBottom() const { return surround
->border
.bottom(); }
503 const BorderValue
& borderBefore() const;
504 const BorderValue
& borderAfter() const;
505 const BorderValue
& borderStart() const;
506 const BorderValue
& borderEnd() const;
508 const NinePieceImage
& borderImage() const { return surround
->border
.image(); }
509 StyleImage
* borderImageSource() const { return surround
->border
.image().image(); }
510 const LengthBox
& borderImageSlices() const { return surround
->border
.image().imageSlices(); }
511 bool borderImageSlicesFill() const { return surround
->border
.image().fill(); }
512 const BorderImageLengthBox
& borderImageWidth() const { return surround
->border
.image().borderSlices(); }
513 const BorderImageLengthBox
& borderImageOutset() const { return surround
->border
.image().outset(); }
515 const LengthSize
& borderTopLeftRadius() const { return surround
->border
.topLeft(); }
516 const LengthSize
& borderTopRightRadius() const { return surround
->border
.topRight(); }
517 const LengthSize
& borderBottomLeftRadius() const { return surround
->border
.bottomLeft(); }
518 const LengthSize
& borderBottomRightRadius() const { return surround
->border
.bottomRight(); }
519 bool hasBorderRadius() const { return surround
->border
.hasBorderRadius(); }
521 int borderLeftWidth() const { return surround
->border
.borderLeftWidth(); }
522 EBorderStyle
borderLeftStyle() const { return surround
->border
.left().style(); }
523 int borderRightWidth() const { return surround
->border
.borderRightWidth(); }
524 EBorderStyle
borderRightStyle() const { return surround
->border
.right().style(); }
525 int borderTopWidth() const { return surround
->border
.borderTopWidth(); }
526 EBorderStyle
borderTopStyle() const { return surround
->border
.top().style(); }
527 int borderBottomWidth() const { return surround
->border
.borderBottomWidth(); }
528 EBorderStyle
borderBottomStyle() const { return surround
->border
.bottom().style(); }
530 int borderBeforeWidth() const;
531 int borderAfterWidth() const;
532 int borderStartWidth() const;
533 int borderEndWidth() const;
535 int outlineWidth() const
537 if (m_background
->outline().style() == BNONE
)
539 return m_background
->outline().width();
541 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN
; }
542 EBorderStyle
outlineStyle() const { return m_background
->outline().style(); }
543 OutlineIsAuto
outlineStyleIsAuto() const { return static_cast<OutlineIsAuto
>(m_background
->outline().isAuto()); }
544 int outlineOutsetExtent() const;
546 EOverflow
overflowX() const { return static_cast<EOverflow
>(noninherited_flags
.overflowX
); }
547 EOverflow
overflowY() const { return static_cast<EOverflow
>(noninherited_flags
.overflowY
); }
548 // It's sufficient to just check one direction, since it's illegal to have visible on only one overflow value.
549 bool isOverflowVisible() const { ASSERT(overflowX() != OVISIBLE
|| overflowX() == overflowY()); return overflowX() == OVISIBLE
; }
550 bool isOverflowPaged() const { return overflowY() == OPAGEDX
|| overflowY() == OPAGEDY
; }
552 EVisibility
visibility() const { return static_cast<EVisibility
>(inherited_flags
._visibility
); }
553 EVerticalAlign
verticalAlign() const { return static_cast<EVerticalAlign
>(noninherited_flags
.verticalAlign
); }
554 const Length
& verticalAlignLength() const { return m_box
->verticalAlign(); }
556 const Length
& clipLeft() const { return visual
->clip
.left(); }
557 const Length
& clipRight() const { return visual
->clip
.right(); }
558 const Length
& clipTop() const { return visual
->clip
.top(); }
559 const Length
& clipBottom() const { return visual
->clip
.bottom(); }
560 const LengthBox
& clip() const { return visual
->clip
; }
561 bool hasAutoClip() const { return visual
->hasAutoClip
; }
563 EUnicodeBidi
unicodeBidi() const { return static_cast<EUnicodeBidi
>(noninherited_flags
.unicodeBidi
); }
565 EClear
clear() const { return static_cast<EClear
>(noninherited_flags
.clear
); }
566 ETableLayout
tableLayout() const { return static_cast<ETableLayout
>(noninherited_flags
.tableLayout
); }
567 bool isFixedTableLayout() const { return tableLayout() == TFIXED
&& !logicalWidth().isAuto(); }
569 const Font
& font() const;
570 const FontMetrics
& fontMetrics() const;
571 const FontDescription
& fontDescription() const;
572 float specifiedFontSize() const;
573 float computedFontSize() const;
574 int fontSize() const;
575 float fontSizeAdjust() const;
576 bool hasFontSizeAdjust() const;
577 FontWeight
fontWeight() const;
578 FontStretch
fontStretch() const;
580 float textAutosizingMultiplier() const { return inherited
->textAutosizingMultiplier
; }
582 const Length
& textIndent() const { return rareInheritedData
->indent
; }
583 TextIndentLine
textIndentLine() const { return static_cast<TextIndentLine
>(rareInheritedData
->m_textIndentLine
); }
584 TextIndentType
textIndentType() const { return static_cast<TextIndentType
>(rareInheritedData
->m_textIndentType
); }
585 ETextAlign
textAlign() const { return static_cast<ETextAlign
>(inherited_flags
._text_align
); }
586 TextAlignLast
textAlignLast() const { return static_cast<TextAlignLast
>(rareInheritedData
->m_textAlignLast
); }
587 TextJustify
textJustify() const { return static_cast<TextJustify
>(rareInheritedData
->m_textJustify
); }
588 ETextTransform
textTransform() const { return static_cast<ETextTransform
>(inherited_flags
._text_transform
); }
589 TextDecoration
textDecorationsInEffect() const;
590 const Vector
<AppliedTextDecoration
>& appliedTextDecorations() const;
591 TextDecoration
textDecoration() const { return static_cast<TextDecoration
>(visual
->textDecoration
); }
592 TextUnderlinePosition
textUnderlinePosition() const { return static_cast<TextUnderlinePosition
>(rareInheritedData
->m_textUnderlinePosition
); }
593 TextDecorationStyle
textDecorationStyle() const { return static_cast<TextDecorationStyle
>(rareNonInheritedData
->m_textDecorationStyle
); }
594 float wordSpacing() const;
595 float letterSpacing() const;
597 float zoom() const { return visual
->m_zoom
; }
598 float effectiveZoom() const { return rareInheritedData
->m_effectiveZoom
; }
600 TextDirection
direction() const { return static_cast<TextDirection
>(inherited_flags
._direction
); }
601 bool isLeftToRightDirection() const { return direction() == LTR
; }
602 bool selfOrAncestorHasDirAutoAttribute() const { return rareInheritedData
->m_selfOrAncestorHasDirAutoAttribute
; }
604 const Length
& specifiedLineHeight() const;
605 Length
lineHeight() const;
606 int computedLineHeight() const;
608 EWhiteSpace
whiteSpace() const { return static_cast<EWhiteSpace
>(inherited_flags
._white_space
); }
609 static bool autoWrap(EWhiteSpace ws
)
611 // Nowrap and pre don't automatically wrap.
612 return ws
!= NOWRAP
&& ws
!= PRE
;
615 bool autoWrap() const
617 return autoWrap(whiteSpace());
620 static bool preserveNewline(EWhiteSpace ws
)
622 // Normal and nowrap do not preserve newlines.
623 return ws
!= NORMAL
&& ws
!= NOWRAP
;
626 bool preserveNewline() const
628 return preserveNewline(whiteSpace());
631 static bool collapseWhiteSpace(EWhiteSpace ws
)
633 // Pre and prewrap do not collapse whitespace.
634 return ws
!= PRE
&& ws
!= PRE_WRAP
;
637 bool collapseWhiteSpace() const
639 return collapseWhiteSpace(whiteSpace());
642 bool isCollapsibleWhiteSpace(UChar c
) const
647 return collapseWhiteSpace();
649 return !preserveNewline();
654 bool breakOnlyAfterWhiteSpace() const
656 return whiteSpace() == PRE_WRAP
|| lineBreak() == LineBreakAfterWhiteSpace
;
659 bool breakWords() const
661 return wordBreak() == BreakWordBreak
|| overflowWrap() == BreakOverflowWrap
;
664 EFillBox
backgroundClip() const { return static_cast<EFillBox
>(m_background
->background().clip()); }
665 FillLayer
& accessBackgroundLayers() { return m_background
.access()->m_background
; }
666 const FillLayer
& backgroundLayers() const { return m_background
->background(); }
668 StyleImage
* maskImage() const { return rareNonInheritedData
->m_mask
.image(); }
669 FillLayer
& accessMaskLayers() { return rareNonInheritedData
.access()->m_mask
; }
670 const FillLayer
& maskLayers() const { return rareNonInheritedData
->m_mask
; }
672 const NinePieceImage
& maskBoxImage() const { return rareNonInheritedData
->m_maskBoxImage
; }
673 StyleImage
* maskBoxImageSource() const { return rareNonInheritedData
->m_maskBoxImage
.image(); }
674 const LengthBox
& maskBoxImageSlices() const { return rareNonInheritedData
->m_maskBoxImage
.imageSlices(); }
675 bool maskBoxImageSlicesFill() const { return rareNonInheritedData
->m_maskBoxImage
.fill(); }
676 const BorderImageLengthBox
& maskBoxImageWidth() const { return rareNonInheritedData
->m_maskBoxImage
.borderSlices(); }
677 const BorderImageLengthBox
& maskBoxImageOutset() const { return rareNonInheritedData
->m_maskBoxImage
.outset(); }
679 EBorderCollapse
borderCollapse() const { return static_cast<EBorderCollapse
>(inherited_flags
._border_collapse
); }
680 short horizontalBorderSpacing() const;
681 short verticalBorderSpacing() const;
682 EEmptyCell
emptyCells() const { return static_cast<EEmptyCell
>(inherited_flags
._empty_cells
); }
683 ECaptionSide
captionSide() const { return static_cast<ECaptionSide
>(inherited_flags
._caption_side
); }
685 EListStyleType
listStyleType() const { return static_cast<EListStyleType
>(inherited_flags
._list_style_type
); }
686 StyleImage
* listStyleImage() const;
687 EListStylePosition
listStylePosition() const { return static_cast<EListStylePosition
>(inherited_flags
._list_style_position
); }
689 const Length
& marginTop() const { return surround
->margin
.top(); }
690 const Length
& marginBottom() const { return surround
->margin
.bottom(); }
691 const Length
& marginLeft() const { return surround
->margin
.left(); }
692 const Length
& marginRight() const { return surround
->margin
.right(); }
693 const Length
& marginBefore() const { return surround
->margin
.before(writingMode()); }
694 const Length
& marginAfter() const { return surround
->margin
.after(writingMode()); }
695 const Length
& marginStart() const { return surround
->margin
.start(writingMode(), direction()); }
696 const Length
& marginEnd() const { return surround
->margin
.end(writingMode(), direction()); }
697 const Length
& marginStartUsing(const ComputedStyle
* otherStyle
) const { return surround
->margin
.start(otherStyle
->writingMode(), otherStyle
->direction()); }
698 const Length
& marginEndUsing(const ComputedStyle
* otherStyle
) const { return surround
->margin
.end(otherStyle
->writingMode(), otherStyle
->direction()); }
699 const Length
& marginBeforeUsing(const ComputedStyle
* otherStyle
) const { return surround
->margin
.before(otherStyle
->writingMode()); }
700 const Length
& marginAfterUsing(const ComputedStyle
* otherStyle
) const { return surround
->margin
.after(otherStyle
->writingMode()); }
702 const LengthBox
& paddingBox() const { return surround
->padding
; }
703 const Length
& paddingTop() const { return surround
->padding
.top(); }
704 const Length
& paddingBottom() const { return surround
->padding
.bottom(); }
705 const Length
& paddingLeft() const { return surround
->padding
.left(); }
706 const Length
& paddingRight() const { return surround
->padding
.right(); }
707 const Length
& paddingBefore() const { return surround
->padding
.before(writingMode()); }
708 const Length
& paddingAfter() const { return surround
->padding
.after(writingMode()); }
709 const Length
& paddingStart() const { return surround
->padding
.start(writingMode(), direction()); }
710 const Length
& paddingEnd() const { return surround
->padding
.end(writingMode(), direction()); }
712 ECursor
cursor() const { return static_cast<ECursor
>(inherited_flags
._cursor_style
); }
713 CursorList
* cursors() const { return rareInheritedData
->cursorData
.get(); }
715 EInsideLink
insideLink() const { return static_cast<EInsideLink
>(inherited_flags
._insideLink
); }
716 bool isLink() const { return noninherited_flags
.isLink
; }
718 short widows() const { return rareInheritedData
->widows
; }
719 short orphans() const { return rareInheritedData
->orphans
; }
720 bool hasAutoWidows() const { return rareInheritedData
->widows
== 1; }
721 bool hasAutoOrphans() const { return rareInheritedData
->m_hasAutoOrphans
; }
722 EPageBreak
pageBreakInside() const { return static_cast<EPageBreak
>(noninherited_flags
.pageBreakInside
); }
723 EPageBreak
pageBreakBefore() const { return static_cast<EPageBreak
>(noninherited_flags
.pageBreakBefore
); }
724 EPageBreak
pageBreakAfter() const { return static_cast<EPageBreak
>(noninherited_flags
.pageBreakAfter
); }
726 // CSS3 Getter Methods
728 int outlineOffset() const
730 if (m_background
->outline().style() == BNONE
)
732 return m_background
->outline().offset();
735 ShadowList
* textShadow() const { return rareInheritedData
->textShadow
.get(); }
737 float textStrokeWidth() const { return rareInheritedData
->textStrokeWidth
; }
738 float opacity() const { return rareNonInheritedData
->opacity
; }
739 bool hasOpacity() const { return opacity() < 1.0f
; }
740 ControlPart
appearance() const { return static_cast<ControlPart
>(rareNonInheritedData
->m_appearance
); }
741 EBoxAlignment
boxAlign() const { return static_cast<EBoxAlignment
>(rareNonInheritedData
->m_deprecatedFlexibleBox
->align
); }
742 EBoxDirection
boxDirection() const { return static_cast<EBoxDirection
>(inherited_flags
._box_direction
); }
743 float boxFlex() const { return rareNonInheritedData
->m_deprecatedFlexibleBox
->flex
; }
744 unsigned boxFlexGroup() const { return rareNonInheritedData
->m_deprecatedFlexibleBox
->flexGroup
; }
745 EBoxLines
boxLines() const { return static_cast<EBoxLines
>(rareNonInheritedData
->m_deprecatedFlexibleBox
->lines
); }
746 unsigned boxOrdinalGroup() const { return rareNonInheritedData
->m_deprecatedFlexibleBox
->ordinalGroup
; }
747 EBoxOrient
boxOrient() const { return static_cast<EBoxOrient
>(rareNonInheritedData
->m_deprecatedFlexibleBox
->orient
); }
748 EBoxPack
boxPack() const { return static_cast<EBoxPack
>(rareNonInheritedData
->m_deprecatedFlexibleBox
->pack
); }
750 int order() const { return rareNonInheritedData
->m_order
; }
751 const Vector
<String
>& callbackSelectors() const { return rareNonInheritedData
->m_callbackSelectors
; }
752 float flexGrow() const { return rareNonInheritedData
->m_flexibleBox
->m_flexGrow
; }
753 float flexShrink() const { return rareNonInheritedData
->m_flexibleBox
->m_flexShrink
; }
754 const Length
& flexBasis() const { return rareNonInheritedData
->m_flexibleBox
->m_flexBasis
; }
755 const StyleContentAlignmentData
& alignContent() const { return rareNonInheritedData
->m_alignContent
; }
756 ContentPosition
alignContentPosition() const { return rareNonInheritedData
->m_alignContent
.position(); }
757 ContentDistributionType
alignContentDistribution() const { return rareNonInheritedData
->m_alignContent
.distribution(); }
758 OverflowAlignment
alignContentOverflowAlignment() const { return rareNonInheritedData
->m_alignContent
.overflow(); }
759 const StyleSelfAlignmentData
& alignItems() const { return rareNonInheritedData
->m_alignItems
; }
760 ItemPosition
alignItemsPosition() const { return rareNonInheritedData
->m_alignItems
.position(); }
761 OverflowAlignment
alignItemsOverflowAlignment() const { return rareNonInheritedData
->m_alignItems
.overflow(); }
762 const StyleSelfAlignmentData
& alignSelf() const { return rareNonInheritedData
->m_alignSelf
; }
763 ItemPosition
alignSelfPosition() const { return rareNonInheritedData
->m_alignSelf
.position(); }
764 OverflowAlignment
alignSelfOverflowAlignment() const { return rareNonInheritedData
->m_alignSelf
.overflow(); }
765 EFlexDirection
flexDirection() const { return static_cast<EFlexDirection
>(rareNonInheritedData
->m_flexibleBox
->m_flexDirection
); }
766 bool isColumnFlexDirection() const { return flexDirection() == FlowColumn
|| flexDirection() == FlowColumnReverse
; }
767 bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse
|| flexDirection() == FlowColumnReverse
; }
768 EFlexWrap
flexWrap() const { return static_cast<EFlexWrap
>(rareNonInheritedData
->m_flexibleBox
->m_flexWrap
); }
769 const StyleContentAlignmentData
& justifyContent() const { return rareNonInheritedData
->m_justifyContent
; }
770 ContentPosition
justifyContentPosition() const { return rareNonInheritedData
->m_justifyContent
.position(); }
771 ContentDistributionType
justifyContentDistribution() const { return rareNonInheritedData
->m_justifyContent
.distribution(); }
772 OverflowAlignment
justifyContentOverflowAlignment() const { return rareNonInheritedData
->m_justifyContent
.overflow(); }
773 const StyleSelfAlignmentData
& justifyItems() const { return rareNonInheritedData
->m_justifyItems
; }
774 ItemPosition
justifyItemsPosition() const { return rareNonInheritedData
->m_justifyItems
.position(); }
775 OverflowAlignment
justifyItemsOverflowAlignment() const { return rareNonInheritedData
->m_justifyItems
.overflow(); }
776 ItemPositionType
justifyItemsPositionType() const { return rareNonInheritedData
->m_justifyItems
.positionType(); }
777 const StyleSelfAlignmentData
& justifySelf() const { return rareNonInheritedData
->m_justifySelf
; }
778 ItemPosition
justifySelfPosition() const { return rareNonInheritedData
->m_justifySelf
.position(); }
779 OverflowAlignment
justifySelfOverflowAlignment() const { return rareNonInheritedData
->m_justifySelf
.overflow(); }
781 const Vector
<GridTrackSize
>& gridTemplateColumns() const { return rareNonInheritedData
->m_grid
->m_gridTemplateColumns
; }
782 const Vector
<GridTrackSize
>& gridTemplateRows() const { return rareNonInheritedData
->m_grid
->m_gridTemplateRows
; }
783 const NamedGridLinesMap
& namedGridColumnLines() const { return rareNonInheritedData
->m_grid
->m_namedGridColumnLines
; }
784 const NamedGridLinesMap
& namedGridRowLines() const { return rareNonInheritedData
->m_grid
->m_namedGridRowLines
; }
785 const OrderedNamedGridLines
& orderedNamedGridColumnLines() const { return rareNonInheritedData
->m_grid
->m_orderedNamedGridColumnLines
; }
786 const OrderedNamedGridLines
& orderedNamedGridRowLines() const { return rareNonInheritedData
->m_grid
->m_orderedNamedGridRowLines
; }
787 const NamedGridAreaMap
& namedGridArea() const { return rareNonInheritedData
->m_grid
->m_namedGridArea
; }
788 size_t namedGridAreaRowCount() const { return rareNonInheritedData
->m_grid
->m_namedGridAreaRowCount
; }
789 size_t namedGridAreaColumnCount() const { return rareNonInheritedData
->m_grid
->m_namedGridAreaColumnCount
; }
790 GridAutoFlow
gridAutoFlow() const { return static_cast<GridAutoFlow
>(rareNonInheritedData
->m_grid
->m_gridAutoFlow
); }
791 bool isGridAutoFlowDirectionRow() const { return (rareNonInheritedData
->m_grid
->m_gridAutoFlow
& InternalAutoFlowDirectionRow
) == InternalAutoFlowDirectionRow
; }
792 bool isGridAutoFlowDirectionColumn() const { return (rareNonInheritedData
->m_grid
->m_gridAutoFlow
& InternalAutoFlowDirectionColumn
) == InternalAutoFlowDirectionColumn
; }
793 bool isGridAutoFlowAlgorithmSparse() const { return (rareNonInheritedData
->m_grid
->m_gridAutoFlow
& InternalAutoFlowAlgorithmSparse
) == InternalAutoFlowAlgorithmSparse
; }
794 bool isGridAutoFlowAlgorithmDense() const { return (rareNonInheritedData
->m_grid
->m_gridAutoFlow
& InternalAutoFlowAlgorithmDense
) == InternalAutoFlowAlgorithmDense
; }
795 const GridTrackSize
& gridAutoColumns() const { return rareNonInheritedData
->m_grid
->m_gridAutoColumns
; }
796 const GridTrackSize
& gridAutoRows() const { return rareNonInheritedData
->m_grid
->m_gridAutoRows
; }
798 const GridPosition
& gridColumnStart() const { return rareNonInheritedData
->m_gridItem
->m_gridColumnStart
; }
799 const GridPosition
& gridColumnEnd() const { return rareNonInheritedData
->m_gridItem
->m_gridColumnEnd
; }
800 const GridPosition
& gridRowStart() const { return rareNonInheritedData
->m_gridItem
->m_gridRowStart
; }
801 const GridPosition
& gridRowEnd() const { return rareNonInheritedData
->m_gridItem
->m_gridRowEnd
; }
803 ShadowList
* boxShadow() const { return rareNonInheritedData
->m_boxShadow
.get(); }
805 EBoxDecorationBreak
boxDecorationBreak() const { return m_box
->boxDecorationBreak(); }
806 StyleReflection
* boxReflect() const { return rareNonInheritedData
->m_boxReflect
.get(); }
807 bool reflectionDataEquivalent(const ComputedStyle
* otherStyle
) const { return rareNonInheritedData
->reflectionDataEquivalent(*otherStyle
->rareNonInheritedData
); }
809 // FIXME: reflections should belong to this helper function but they are currently handled
810 // through their self-painting layers. So the layout code doesn't account for them.
811 bool hasVisualOverflowingEffect() const { return boxShadow() || hasBorderImageOutsets() || hasOutline(); }
813 EBoxSizing
boxSizing() const { return m_box
->boxSizing(); }
814 EUserModify
userModify() const { return static_cast<EUserModify
>(rareInheritedData
->userModify
); }
815 EUserDrag
userDrag() const { return static_cast<EUserDrag
>(rareNonInheritedData
->userDrag
); }
816 EUserSelect
userSelect() const { return static_cast<EUserSelect
>(rareInheritedData
->userSelect
); }
817 TextOverflow
textOverflow() const { return static_cast<TextOverflow
>(rareNonInheritedData
->textOverflow
); }
818 EMarginCollapse
marginBeforeCollapse() const { return static_cast<EMarginCollapse
>(rareNonInheritedData
->marginBeforeCollapse
); }
819 EMarginCollapse
marginAfterCollapse() const { return static_cast<EMarginCollapse
>(rareNonInheritedData
->marginAfterCollapse
); }
820 EWordBreak
wordBreak() const { return static_cast<EWordBreak
>(rareInheritedData
->wordBreak
); }
821 EOverflowWrap
overflowWrap() const { return static_cast<EOverflowWrap
>(rareInheritedData
->overflowWrap
); }
822 LineBreak
lineBreak() const { return static_cast<LineBreak
>(rareInheritedData
->lineBreak
); }
823 const AtomicString
& highlight() const { return rareInheritedData
->highlight
; }
824 const AtomicString
& hyphenationString() const { return rareInheritedData
->hyphenationString
; }
825 const AtomicString
& locale() const { return rareInheritedData
->locale
; }
826 EResize
resize() const { return static_cast<EResize
>(rareNonInheritedData
->m_resize
); }
827 bool hasInlinePaginationAxis() const
829 // If the pagination axis is parallel with the writing mode inline axis, columns may be laid
830 // out along the inline axis, just like for regular multicol. Otherwise, we need to lay out
831 // along the block axis.
832 if (isOverflowPaged())
833 return (overflowY() == OPAGEDX
) == isHorizontalWritingMode();
836 float columnWidth() const { return rareNonInheritedData
->m_multiCol
->m_width
; }
837 bool hasAutoColumnWidth() const { return rareNonInheritedData
->m_multiCol
->m_autoWidth
; }
838 unsigned short columnCount() const { return rareNonInheritedData
->m_multiCol
->m_count
; }
839 bool hasAutoColumnCount() const { return rareNonInheritedData
->m_multiCol
->m_autoCount
; }
840 bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth(); }
841 ColumnFill
columnFill() const { return static_cast<ColumnFill
>(rareNonInheritedData
->m_multiCol
->m_fill
); }
842 float columnGap() const { return rareNonInheritedData
->m_multiCol
->m_gap
; }
843 bool hasNormalColumnGap() const { return rareNonInheritedData
->m_multiCol
->m_normalGap
; }
844 EBorderStyle
columnRuleStyle() const { return rareNonInheritedData
->m_multiCol
->m_rule
.style(); }
845 unsigned short columnRuleWidth() const { return rareNonInheritedData
->m_multiCol
->ruleWidth(); }
846 bool columnRuleIsTransparent() const { return rareNonInheritedData
->m_multiCol
->m_rule
.isTransparent(); }
847 bool columnRuleEquivalent(const ComputedStyle
* otherStyle
) const;
848 ColumnSpan
columnSpan() const { return static_cast<ColumnSpan
>(rareNonInheritedData
->m_multiCol
->m_columnSpan
); }
849 EPageBreak
columnBreakBefore() const { return static_cast<EPageBreak
>(rareNonInheritedData
->m_multiCol
->m_breakBefore
); }
850 EPageBreak
columnBreakInside() const { return static_cast<EPageBreak
>(rareNonInheritedData
->m_multiCol
->m_breakInside
); }
851 EPageBreak
columnBreakAfter() const { return static_cast<EPageBreak
>(rareNonInheritedData
->m_multiCol
->m_breakAfter
); }
852 bool hasInlineTransform() const { return rareNonInheritedData
->m_hasInlineTransform
; }
853 bool hasCompositorProxy() const { return rareNonInheritedData
->m_hasCompositorProxy
; }
854 const TransformOperations
& transform() const { return rareNonInheritedData
->m_transform
->m_operations
; }
855 const TransformOrigin
& transformOrigin() const { return rareNonInheritedData
->m_transform
->m_origin
; }
856 const Length
& transformOriginX() const { return transformOrigin().x(); }
857 const Length
& transformOriginY() const { return transformOrigin().y(); }
858 TranslateTransformOperation
* translate() const { return rareNonInheritedData
->m_transform
->m_translate
.get(); }
859 RotateTransformOperation
* rotate() const { return rareNonInheritedData
->m_transform
->m_rotate
.get(); }
860 ScaleTransformOperation
* scale() const { return rareNonInheritedData
->m_transform
->m_scale
.get(); }
861 float transformOriginZ() const { return transformOrigin().z(); }
862 bool has3DTransform() const { return rareNonInheritedData
->m_transform
->has3DTransform(); }
863 bool hasTransform() const { return hasTransformOperations() || hasMotionPath() || hasCurrentTransformAnimation() || translate() || rotate() || scale(); }
864 bool hasTransformOperations() const { return !rareNonInheritedData
->m_transform
->m_operations
.operations().isEmpty(); }
865 bool transformDataEquivalent(const ComputedStyle
& otherStyle
) const { return rareNonInheritedData
->m_transform
== otherStyle
.rareNonInheritedData
->m_transform
; }
867 StyleMotionPath
* motionPath() const { return rareNonInheritedData
->m_transform
->m_motion
.m_path
.get(); }
868 bool hasMotionPath() const { return rareNonInheritedData
->m_transform
->m_motion
.m_path
; }
869 const Length
& motionOffset() const { return rareNonInheritedData
->m_transform
->m_motion
.m_offset
; }
870 float motionRotation() const { return rareNonInheritedData
->m_transform
->m_motion
.m_rotation
; }
871 MotionRotationType
motionRotationType() const { return rareNonInheritedData
->m_transform
->m_motion
.m_rotationType
; }
873 TextEmphasisFill
textEmphasisFill() const { return static_cast<TextEmphasisFill
>(rareInheritedData
->textEmphasisFill
); }
874 TextEmphasisMark
textEmphasisMark() const;
875 const AtomicString
& textEmphasisCustomMark() const { return rareInheritedData
->textEmphasisCustomMark
; }
876 TextEmphasisPosition
textEmphasisPosition() const { return static_cast<TextEmphasisPosition
>(rareInheritedData
->textEmphasisPosition
); }
877 const AtomicString
& textEmphasisMarkString() const;
879 RubyPosition
rubyPosition() const { return static_cast<RubyPosition
>(rareInheritedData
->m_rubyPosition
); }
881 TextOrientation
textOrientation() const { return static_cast<TextOrientation
>(rareInheritedData
->m_textOrientation
); }
883 ObjectFit
objectFit() const { return static_cast<ObjectFit
>(rareNonInheritedData
->m_objectFit
); }
884 LengthPoint
objectPosition() const { return rareNonInheritedData
->m_objectPosition
; }
886 // Return true if any transform related property (currently transform/motionPath, transformStyle3D, perspective,
887 // or will-change:transform) indicates that we are transforming. will-change:transform should result in
888 // the same rendering behavior as having a transform, including the creation of a containing block
889 // for fixed position descendants.
890 bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective() || hasWillChangeTransformHint(); }
892 enum ApplyTransformOrigin
{ IncludeTransformOrigin
, ExcludeTransformOrigin
};
893 enum ApplyMotionPath
{ IncludeMotionPath
, ExcludeMotionPath
};
894 enum ApplyIndependentTransformProperties
{ IncludeIndependentTransformProperties
, ExcludeIndependentTransformProperties
};
895 void applyTransform(TransformationMatrix
&, const LayoutSize
& borderBoxSize
, ApplyTransformOrigin
, ApplyMotionPath
, ApplyIndependentTransformProperties
) const;
896 void applyTransform(TransformationMatrix
&, const FloatRect
& boundingBox
, ApplyTransformOrigin
, ApplyMotionPath
, ApplyIndependentTransformProperties
) const;
897 bool hasMask() const { return rareNonInheritedData
->m_mask
.hasImage() || rareNonInheritedData
->m_maskBoxImage
.hasImage(); }
899 TextCombine
textCombine() const { return static_cast<TextCombine
>(rareInheritedData
->m_textCombine
); }
900 bool hasTextCombine() const { return textCombine() != TextCombineNone
; }
902 TabSize
tabSize() const { return rareInheritedData
->m_tabSize
; }
904 RespectImageOrientationEnum
respectImageOrientation() const { return static_cast<RespectImageOrientationEnum
>(rareInheritedData
->m_respectImageOrientation
); }
908 // Apple-specific property getter methods
909 EPointerEvents
pointerEvents() const { return static_cast<EPointerEvents
>(inherited_flags
._pointerEvents
); }
910 const CSSAnimationData
* animations() const { return rareNonInheritedData
->m_animations
.get(); }
911 const CSSTransitionData
* transitions() const { return rareNonInheritedData
->m_transitions
.get(); }
913 CSSAnimationData
& accessAnimations();
914 CSSTransitionData
& accessTransitions();
916 ETransformStyle3D
transformStyle3D() const { return static_cast<ETransformStyle3D
>(rareNonInheritedData
->m_transformStyle3D
); }
917 bool preserves3D() const { return rareNonInheritedData
->m_transformStyle3D
== TransformStyle3DPreserve3D
; }
919 EBackfaceVisibility
backfaceVisibility() const { return static_cast<EBackfaceVisibility
>(rareNonInheritedData
->m_backfaceVisibility
); }
920 float perspective() const { return rareNonInheritedData
->m_perspective
; }
921 bool hasPerspective() const { return rareNonInheritedData
->m_perspective
> 0; }
922 const LengthPoint
& perspectiveOrigin() const { return rareNonInheritedData
->m_perspectiveOrigin
; }
923 const Length
& perspectiveOriginX() const { return perspectiveOrigin().x(); }
924 const Length
& perspectiveOriginY() const { return perspectiveOrigin().y(); }
925 const FloatSize
& pageSize() const { return rareNonInheritedData
->m_pageSize
; }
926 PageSizeType
pageSizeType() const { return static_cast<PageSizeType
>(rareNonInheritedData
->m_pageSizeType
); }
928 bool hasCurrentOpacityAnimation() const { return rareNonInheritedData
->m_hasCurrentOpacityAnimation
; }
929 bool hasCurrentTransformAnimation() const { return rareNonInheritedData
->m_hasCurrentTransformAnimation
; }
930 bool hasCurrentFilterAnimation() const { return rareNonInheritedData
->m_hasCurrentFilterAnimation
; }
931 bool hasCurrentBackdropFilterAnimation() const { return rareNonInheritedData
->m_hasCurrentBackdropFilterAnimation
; }
932 bool shouldCompositeForCurrentAnimations() const { return hasCurrentOpacityAnimation() || hasCurrentTransformAnimation() || hasCurrentFilterAnimation() || hasCurrentBackdropFilterAnimation(); }
934 bool isRunningOpacityAnimationOnCompositor() const { return rareNonInheritedData
->m_runningOpacityAnimationOnCompositor
; }
935 bool isRunningTransformAnimationOnCompositor() const { return rareNonInheritedData
->m_runningTransformAnimationOnCompositor
; }
936 bool isRunningFilterAnimationOnCompositor() const { return rareNonInheritedData
->m_runningFilterAnimationOnCompositor
; }
937 bool isRunningBackdropFilterAnimationOnCompositor() const { return rareNonInheritedData
->m_runningBackdropFilterAnimationOnCompositor
; }
938 bool isRunningAnimationOnCompositor() const { return isRunningOpacityAnimationOnCompositor() || isRunningTransformAnimationOnCompositor() || isRunningFilterAnimationOnCompositor() || isRunningBackdropFilterAnimationOnCompositor(); }
940 const LineClampValue
& lineClamp() const { return rareNonInheritedData
->lineClamp
; }
941 Color
tapHighlightColor() const { return rareInheritedData
->tapHighlightColor
; }
942 ETextSecurity
textSecurity() const { return static_cast<ETextSecurity
>(rareInheritedData
->textSecurity
); }
944 WritingMode
writingMode() const { return static_cast<WritingMode
>(inherited_flags
.m_writingMode
); }
945 bool isHorizontalWritingMode() const { return blink::isHorizontalWritingMode(writingMode()); }
946 bool isFlippedLinesWritingMode() const { return blink::isFlippedLinesWritingMode(writingMode()); }
947 bool isFlippedBlocksWritingMode() const { return blink::isFlippedBlocksWritingMode(writingMode()); }
949 EImageRendering
imageRendering() const { return static_cast<EImageRendering
>(rareInheritedData
->m_imageRendering
); }
951 ESpeak
speak() const { return static_cast<ESpeak
>(rareInheritedData
->speak
); }
953 FilterOperations
& mutableFilter() { return rareNonInheritedData
.access()->m_filter
.access()->m_operations
; }
954 const FilterOperations
& filter() const { return rareNonInheritedData
->m_filter
->m_operations
; }
955 bool hasFilter() const { return !rareNonInheritedData
->m_filter
->m_operations
.operations().isEmpty(); }
957 FilterOperations
& mutableBackdropFilter() { return rareNonInheritedData
.access()->m_backdropFilter
.access()->m_operations
; }
958 const FilterOperations
& backdropFilter() const { return rareNonInheritedData
->m_backdropFilter
->m_operations
; }
959 bool hasBackdropFilter() const { return !rareNonInheritedData
->m_backdropFilter
->m_operations
.operations().isEmpty(); }
961 WebBlendMode
blendMode() const { return static_cast<WebBlendMode
>(rareNonInheritedData
->m_effectiveBlendMode
); }
962 void setBlendMode(WebBlendMode v
) { rareNonInheritedData
.access()->m_effectiveBlendMode
= v
; }
963 bool hasBlendMode() const { return blendMode() != WebBlendModeNormal
; }
965 EIsolation
isolation() const { return static_cast<EIsolation
>(rareNonInheritedData
->m_isolation
); }
966 void setIsolation(EIsolation v
) { rareNonInheritedData
.access()->m_isolation
= v
; }
967 bool hasIsolation() const { return isolation() != IsolationAuto
; }
969 bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
971 TouchAction
touchAction() const { return static_cast<TouchAction
>(rareNonInheritedData
->m_touchAction
); }
973 ScrollBehavior
scrollBehavior() const { return static_cast<ScrollBehavior
>(rareNonInheritedData
->m_scrollBehavior
); }
975 ScrollSnapType
scrollSnapType() const { return static_cast<ScrollSnapType
>(rareNonInheritedData
->m_scrollSnapType
); }
976 ScrollSnapPoints
scrollSnapPointsX() const { return rareNonInheritedData
->m_scrollSnap
->m_xPoints
; }
977 ScrollSnapPoints
scrollSnapPointsY() const { return rareNonInheritedData
->m_scrollSnap
->m_yPoints
; }
978 Vector
<LengthPoint
> scrollSnapCoordinate() const { return rareNonInheritedData
->m_scrollSnap
->m_coordinates
; }
979 LengthPoint
scrollSnapDestination() const { return rareNonInheritedData
->m_scrollSnap
->m_destination
; }
981 const Vector
<CSSPropertyID
>& willChangeProperties() const { return rareNonInheritedData
->m_willChange
->m_properties
; }
982 bool willChangeContents() const { return rareNonInheritedData
->m_willChange
->m_contents
; }
983 bool willChangeScrollPosition() const { return rareNonInheritedData
->m_willChange
->m_scrollPosition
; }
984 bool hasWillChangeCompositingHint() const;
985 bool hasWillChangeTransformHint() const;
986 bool subtreeWillChangeContents() const { return rareInheritedData
->m_subtreeWillChangeContents
; }
988 // attribute setter methods
990 void setDisplay(EDisplay v
) { noninherited_flags
.effectiveDisplay
= v
; }
991 void setOriginalDisplay(EDisplay v
) { noninherited_flags
.originalDisplay
= v
; }
992 void setPosition(EPosition v
) { noninherited_flags
.position
= v
; }
993 void setFloating(EFloat v
) { noninherited_flags
.floating
= v
; }
995 void setLeft(const Length
& v
) { SET_VAR(surround
, offset
.m_left
, v
); }
996 void setRight(const Length
& v
) { SET_VAR(surround
, offset
.m_right
, v
); }
997 void setTop(const Length
& v
) { SET_VAR(surround
, offset
.m_top
, v
); }
998 void setBottom(const Length
& v
) { SET_VAR(surround
, offset
.m_bottom
, v
); }
1000 void setWidth(const Length
& v
) { SET_VAR(m_box
, m_width
, v
); }
1001 void setHeight(const Length
& v
) { SET_VAR(m_box
, m_height
, v
); }
1003 void setLogicalWidth(const Length
& v
)
1005 if (isHorizontalWritingMode()) {
1006 SET_VAR(m_box
, m_width
, v
);
1008 SET_VAR(m_box
, m_height
, v
);
1012 void setLogicalHeight(const Length
& v
)
1014 if (isHorizontalWritingMode()) {
1015 SET_VAR(m_box
, m_height
, v
);
1017 SET_VAR(m_box
, m_width
, v
);
1021 void setMinWidth(const Length
& v
) { SET_VAR(m_box
, m_minWidth
, v
); }
1022 void setMaxWidth(const Length
& v
) { SET_VAR(m_box
, m_maxWidth
, v
); }
1023 void setMinHeight(const Length
& v
) { SET_VAR(m_box
, m_minHeight
, v
); }
1024 void setMaxHeight(const Length
& v
) { SET_VAR(m_box
, m_maxHeight
, v
); }
1026 DraggableRegionMode
getDraggableRegionMode() const { return rareNonInheritedData
->m_draggableRegionMode
; }
1027 void setDraggableRegionMode(DraggableRegionMode v
) { SET_VAR(rareNonInheritedData
, m_draggableRegionMode
, v
); }
1034 resetBorderBottom();
1036 resetBorderTopLeftRadius();
1037 resetBorderTopRightRadius();
1038 resetBorderBottomLeftRadius();
1039 resetBorderBottomRightRadius();
1041 void resetBorderTop() { SET_VAR(surround
, border
.m_top
, BorderValue()); }
1042 void resetBorderRight() { SET_VAR(surround
, border
.m_right
, BorderValue()); }
1043 void resetBorderBottom() { SET_VAR(surround
, border
.m_bottom
, BorderValue()); }
1044 void resetBorderLeft() { SET_VAR(surround
, border
.m_left
, BorderValue()); }
1045 void resetBorderImage() { SET_VAR(surround
, border
.m_image
, NinePieceImage()); }
1046 void resetBorderTopLeftRadius() { SET_VAR(surround
, border
.m_topLeft
, initialBorderRadius()); }
1047 void resetBorderTopRightRadius() { SET_VAR(surround
, border
.m_topRight
, initialBorderRadius()); }
1048 void resetBorderBottomLeftRadius() { SET_VAR(surround
, border
.m_bottomLeft
, initialBorderRadius()); }
1049 void resetBorderBottomRightRadius() { SET_VAR(surround
, border
.m_bottomRight
, initialBorderRadius()); }
1051 void setBackgroundColor(const StyleColor
& v
) { SET_VAR(m_background
, m_color
, v
); }
1053 void setBorderImage(const NinePieceImage
& b
) { SET_VAR(surround
, border
.m_image
, b
); }
1054 void setBorderImageSource(PassRefPtrWillBeRawPtr
<StyleImage
>);
1055 void setBorderImageSlices(const LengthBox
&);
1056 void setBorderImageSlicesFill(bool);
1057 void setBorderImageWidth(const BorderImageLengthBox
&);
1058 void setBorderImageOutset(const BorderImageLengthBox
&);
1060 void setBorderTopLeftRadius(const LengthSize
& s
) { SET_VAR(surround
, border
.m_topLeft
, s
); }
1061 void setBorderTopRightRadius(const LengthSize
& s
) { SET_VAR(surround
, border
.m_topRight
, s
); }
1062 void setBorderBottomLeftRadius(const LengthSize
& s
) { SET_VAR(surround
, border
.m_bottomLeft
, s
); }
1063 void setBorderBottomRightRadius(const LengthSize
& s
) { SET_VAR(surround
, border
.m_bottomRight
, s
); }
1065 void setBorderRadius(const LengthSize
& s
)
1067 setBorderTopLeftRadius(s
);
1068 setBorderTopRightRadius(s
);
1069 setBorderBottomLeftRadius(s
);
1070 setBorderBottomRightRadius(s
);
1072 void setBorderRadius(const IntSize
& s
)
1074 setBorderRadius(LengthSize(Length(s
.width(), Fixed
), Length(s
.height(), Fixed
)));
1077 FloatRoundedRect
getRoundedBorderFor(const LayoutRect
& borderRect
, bool includeLogicalLeftEdge
= true,
1078 bool includeLogicalRightEdge
= true) const;
1079 FloatRoundedRect
getRoundedInnerBorderFor(const LayoutRect
& borderRect
, bool includeLogicalLeftEdge
= true, bool includeLogicalRightEdge
= true) const;
1081 FloatRoundedRect
getRoundedInnerBorderFor(const LayoutRect
& borderRect
,
1082 const LayoutRectOutsets insets
, bool includeLogicalLeftEdge
, bool includeLogicalRightEdge
) const;
1084 void setBorderLeftWidth(unsigned v
) { SET_VAR(surround
, border
.m_left
.m_width
, v
); }
1085 void setBorderLeftStyle(EBorderStyle v
) { SET_VAR(surround
, border
.m_left
.m_style
, v
); }
1086 void setBorderLeftColor(const StyleColor
& v
) { SET_BORDERVALUE_COLOR(surround
, border
.m_left
, v
); }
1087 void setBorderRightWidth(unsigned v
) { SET_VAR(surround
, border
.m_right
.m_width
, v
); }
1088 void setBorderRightStyle(EBorderStyle v
) { SET_VAR(surround
, border
.m_right
.m_style
, v
); }
1089 void setBorderRightColor(const StyleColor
& v
) { SET_BORDERVALUE_COLOR(surround
, border
.m_right
, v
); }
1090 void setBorderTopWidth(unsigned v
) { SET_VAR(surround
, border
.m_top
.m_width
, v
); }
1091 void setBorderTopStyle(EBorderStyle v
) { SET_VAR(surround
, border
.m_top
.m_style
, v
); }
1092 void setBorderTopColor(const StyleColor
& v
) { SET_BORDERVALUE_COLOR(surround
, border
.m_top
, v
); }
1093 void setBorderBottomWidth(unsigned v
) { SET_VAR(surround
, border
.m_bottom
.m_width
, v
); }
1094 void setBorderBottomStyle(EBorderStyle v
) { SET_VAR(surround
, border
.m_bottom
.m_style
, v
); }
1095 void setBorderBottomColor(const StyleColor
& v
) { SET_BORDERVALUE_COLOR(surround
, border
.m_bottom
, v
); }
1097 void setOutlineWidth(unsigned short v
) { SET_VAR(m_background
, m_outline
.m_width
, v
); }
1098 void setOutlineStyleIsAuto(OutlineIsAuto isAuto
) { SET_VAR(m_background
, m_outline
.m_isAuto
, isAuto
); }
1099 void setOutlineStyle(EBorderStyle v
) { SET_VAR(m_background
, m_outline
.m_style
, v
); }
1100 void setOutlineColor(const StyleColor
& v
) { SET_BORDERVALUE_COLOR(m_background
, m_outline
, v
); }
1101 bool isOutlineEquivalent(const ComputedStyle
* otherStyle
) const
1103 // No other style, so we don't have an outline then we consider them to be the same.
1105 return !hasOutline();
1106 return m_background
->outline().visuallyEqual(otherStyle
->m_background
->outline());
1108 void setOutlineFromStyle(const ComputedStyle
& o
)
1110 ASSERT(!isOutlineEquivalent(&o
));
1111 m_background
.access()->m_outline
= o
.m_background
->m_outline
;
1114 void setOverflowX(EOverflow v
) { noninherited_flags
.overflowX
= v
; }
1115 void setOverflowY(EOverflow v
) { noninherited_flags
.overflowY
= v
; }
1116 void setVisibility(EVisibility v
) { inherited_flags
._visibility
= v
; }
1117 void setVerticalAlign(EVerticalAlign v
) { noninherited_flags
.verticalAlign
= v
; }
1118 void setVerticalAlignLength(const Length
& length
) { setVerticalAlign(LENGTH
); SET_VAR(m_box
, m_verticalAlign
, length
); }
1120 void setHasAutoClip() { SET_VAR(visual
, hasAutoClip
, true); SET_VAR(visual
, clip
, ComputedStyle::initialClip()); }
1121 void setClip(const LengthBox
& box
) { SET_VAR(visual
, hasAutoClip
, false); SET_VAR(visual
, clip
, box
); }
1123 void setUnicodeBidi(EUnicodeBidi b
) { noninherited_flags
.unicodeBidi
= b
; }
1125 void setClear(EClear v
) { noninherited_flags
.clear
= v
; }
1126 void setTableLayout(ETableLayout v
) { noninherited_flags
.tableLayout
= v
; }
1128 bool setFontDescription(const FontDescription
&);
1129 void setFont(const Font
&);
1131 void setTextAutosizingMultiplier(float);
1133 void setColor(const Color
&);
1134 void setTextIndent(const Length
& v
) { SET_VAR(rareInheritedData
, indent
, v
); }
1135 void setTextIndentLine(TextIndentLine v
) { SET_VAR(rareInheritedData
, m_textIndentLine
, v
); }
1136 void setTextIndentType(TextIndentType v
) { SET_VAR(rareInheritedData
, m_textIndentType
, v
); }
1137 void setTextAlign(ETextAlign v
) { inherited_flags
._text_align
= v
; }
1138 void setTextAlignLast(TextAlignLast v
) { SET_VAR(rareInheritedData
, m_textAlignLast
, v
); }
1139 void setTextJustify(TextJustify v
) { SET_VAR(rareInheritedData
, m_textJustify
, v
); }
1140 void setTextTransform(ETextTransform v
) { inherited_flags
._text_transform
= v
; }
1141 void applyTextDecorations();
1142 void clearAppliedTextDecorations();
1143 void setTextDecoration(TextDecoration v
) { SET_VAR(visual
, textDecoration
, v
); }
1144 void setTextUnderlinePosition(TextUnderlinePosition v
) { SET_VAR(rareInheritedData
, m_textUnderlinePosition
, v
); }
1145 void setTextDecorationStyle(TextDecorationStyle v
) { SET_VAR(rareNonInheritedData
, m_textDecorationStyle
, v
); }
1146 void setDirection(TextDirection v
) { inherited_flags
._direction
= v
; }
1147 void setSelfOrAncestorHasDirAutoAttribute(bool v
) { SET_VAR(rareInheritedData
, m_selfOrAncestorHasDirAutoAttribute
, v
); }
1148 void setLineHeight(const Length
& specifiedLineHeight
);
1149 bool setZoom(float);
1150 bool setEffectiveZoom(float);
1151 void clearMultiCol();
1153 void setImageRendering(EImageRendering v
) { SET_VAR(rareInheritedData
, m_imageRendering
, v
); }
1155 void setWhiteSpace(EWhiteSpace v
) { inherited_flags
._white_space
= v
; }
1157 // FIXME: Remove these two and replace them with respective FontBuilder calls.
1158 void setWordSpacing(float);
1159 void setLetterSpacing(float);
1161 void adjustBackgroundLayers()
1163 if (backgroundLayers().next()) {
1164 accessBackgroundLayers().cullEmptyLayers();
1165 accessBackgroundLayers().fillUnsetProperties();
1169 void adjustMaskLayers()
1171 if (maskLayers().next()) {
1172 accessMaskLayers().cullEmptyLayers();
1173 accessMaskLayers().fillUnsetProperties();
1177 void setMaskBoxImage(const NinePieceImage
& b
) { SET_VAR(rareNonInheritedData
, m_maskBoxImage
, b
); }
1178 void setMaskBoxImageSource(PassRefPtrWillBeRawPtr
<StyleImage
> v
) { rareNonInheritedData
.access()->m_maskBoxImage
.setImage(v
); }
1179 void setMaskBoxImageSlices(const LengthBox
& slices
)
1181 rareNonInheritedData
.access()->m_maskBoxImage
.setImageSlices(slices
);
1183 void setMaskBoxImageSlicesFill(bool fill
)
1185 rareNonInheritedData
.access()->m_maskBoxImage
.setFill(fill
);
1187 void setMaskBoxImageWidth(const BorderImageLengthBox
& slices
)
1189 rareNonInheritedData
.access()->m_maskBoxImage
.setBorderSlices(slices
);
1191 void setMaskBoxImageOutset(const BorderImageLengthBox
& outset
)
1193 rareNonInheritedData
.access()->m_maskBoxImage
.setOutset(outset
);
1196 void setBorderCollapse(EBorderCollapse collapse
) { inherited_flags
._border_collapse
= collapse
; }
1197 void setHorizontalBorderSpacing(short);
1198 void setVerticalBorderSpacing(short);
1199 void setEmptyCells(EEmptyCell v
) { inherited_flags
._empty_cells
= v
; }
1200 void setCaptionSide(ECaptionSide v
) { inherited_flags
._caption_side
= v
; }
1202 void setListStyleType(EListStyleType v
) { inherited_flags
._list_style_type
= v
; }
1203 void setListStyleImage(PassRefPtrWillBeRawPtr
<StyleImage
>);
1204 void setListStylePosition(EListStylePosition v
) { inherited_flags
._list_style_position
= v
; }
1206 void setMarginTop(const Length
& v
) { SET_VAR(surround
, margin
.m_top
, v
); }
1207 void setMarginBottom(const Length
& v
) { SET_VAR(surround
, margin
.m_bottom
, v
); }
1208 void setMarginLeft(const Length
& v
) { SET_VAR(surround
, margin
.m_left
, v
); }
1209 void setMarginRight(const Length
& v
) { SET_VAR(surround
, margin
.m_right
, v
); }
1210 void setMarginStart(const Length
&);
1211 void setMarginEnd(const Length
&);
1213 void resetPadding() { SET_VAR(surround
, padding
, LengthBox(Fixed
)); }
1214 void setPaddingBox(const LengthBox
& b
) { SET_VAR(surround
, padding
, b
); }
1215 void setPaddingTop(const Length
& v
) { SET_VAR(surround
, padding
.m_top
, v
); }
1216 void setPaddingBottom(const Length
& v
) { SET_VAR(surround
, padding
.m_bottom
, v
); }
1217 void setPaddingLeft(const Length
& v
) { SET_VAR(surround
, padding
.m_left
, v
); }
1218 void setPaddingRight(const Length
& v
) { SET_VAR(surround
, padding
.m_right
, v
); }
1220 void setCursor(ECursor c
) { inherited_flags
._cursor_style
= c
; }
1221 void addCursor(PassRefPtrWillBeRawPtr
<StyleImage
>, bool hotSpotSpecified
, const IntPoint
& hotSpot
= IntPoint());
1222 void setCursorList(PassRefPtrWillBeRawPtr
<CursorList
>);
1223 void clearCursorList();
1225 void setInsideLink(EInsideLink insideLink
) { inherited_flags
._insideLink
= insideLink
; }
1226 void setIsLink(bool b
) { noninherited_flags
.isLink
= b
; }
1228 PrintColorAdjust
printColorAdjust() const { return static_cast<PrintColorAdjust
>(inherited_flags
.m_printColorAdjust
); }
1229 void setPrintColorAdjust(PrintColorAdjust value
) { inherited_flags
.m_printColorAdjust
= value
; }
1231 // A stacking context is painted atomically and defines a stacking order, whereas
1232 // a containing stacking context defines in which order the stacking contexts
1233 // below are painted. In Blink, a stacking context is defined by non-auto
1234 // z-index'. This invariant is enforced by the logic in StyleAdjuster
1235 // See CSS 2.1, Appendix E for more details.
1236 bool isStackingContext() const { return !hasAutoZIndex(); }
1238 // Some elements are "treated as if they create a new stacking context" for
1239 // the purpose of painting and hit testing. This means that they are painted
1240 // atomically (like a stacking context) but they don't determine the
1241 // stacking of the elements underneath them (stacking contexts or elements
1242 // "treated as stacking context"). See DeprecatedPaintLayerStackingNode for
1243 // more about painting order.
1244 bool isTreatedAsStackingContext() const
1246 // FIXME: Floating objects are also considered stacking contexts.
1247 return position() != StaticPosition
;
1250 // Returns true if an element is a stacking context or "treated as a
1251 // stacking context". Most callers care about this as it follows the
1252 // painting order where we collect anything that returns true from this
1253 // function under the enclosing stacking context.
1254 bool isTreatedAsOrStackingContext() const
1256 return isStackingContext() || isTreatedAsStackingContext();
1259 bool hasAutoZIndex() const { return m_box
->hasAutoZIndex(); }
1260 void setHasAutoZIndex() { SET_VAR(m_box
, m_hasAutoZIndex
, true); SET_VAR(m_box
, m_zIndex
, 0); }
1261 int zIndex() const { return m_box
->zIndex(); }
1262 void setZIndex(int v
) { SET_VAR(m_box
, m_hasAutoZIndex
, false); SET_VAR(m_box
, m_zIndex
, v
); }
1264 void setHasAutoWidows() { SET_VAR(rareInheritedData
, widows
, initialWidows()); }
1265 void setWidows(short w
) { SET_VAR(rareInheritedData
, widows
, w
); }
1267 void setHasAutoOrphans() { SET_VAR(rareInheritedData
, m_hasAutoOrphans
, true); SET_VAR(rareInheritedData
, orphans
, initialOrphans()); }
1268 void setOrphans(short o
) { SET_VAR(rareInheritedData
, m_hasAutoOrphans
, false); SET_VAR(rareInheritedData
, orphans
, o
); }
1270 // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
1271 void setPageBreakInside(EPageBreak b
) { ASSERT(b
== PBAUTO
|| b
== PBAVOID
); noninherited_flags
.pageBreakInside
= b
; }
1272 void setPageBreakBefore(EPageBreak b
) { noninherited_flags
.pageBreakBefore
= b
; }
1273 void setPageBreakAfter(EPageBreak b
) { noninherited_flags
.pageBreakAfter
= b
; }
1276 void setOutlineOffset(int v
) { SET_VAR(m_background
, m_outline
.m_offset
, v
); }
1277 void setTextShadow(PassRefPtr
<ShadowList
>);
1278 void setTextStrokeColor(const StyleColor
& c
) { SET_VAR_WITH_SETTER(rareInheritedData
, textStrokeColor
, setTextStrokeColor
, c
); }
1279 void setTextStrokeWidth(float w
) { SET_VAR(rareInheritedData
, textStrokeWidth
, w
); }
1280 void setTextFillColor(const StyleColor
& c
) { SET_VAR_WITH_SETTER(rareInheritedData
, textFillColor
, setTextFillColor
, c
); }
1281 void setOpacity(float f
) { float v
= clampTo
<float>(f
, 0, 1); SET_VAR(rareNonInheritedData
, opacity
, v
); }
1282 void setAppearance(ControlPart a
) { SET_VAR(rareNonInheritedData
, m_appearance
, a
); }
1283 // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
1284 void setBoxAlign(EBoxAlignment a
) { SET_VAR(rareNonInheritedData
.access()->m_deprecatedFlexibleBox
, align
, a
); }
1285 void setBoxDecorationBreak(EBoxDecorationBreak b
) { SET_VAR(m_box
, m_boxDecorationBreak
, b
); }
1286 void setBoxDirection(EBoxDirection d
) { inherited_flags
._box_direction
= d
; }
1287 void setBoxFlex(float f
) { SET_VAR(rareNonInheritedData
.access()->m_deprecatedFlexibleBox
, flex
, f
); }
1288 void setBoxFlexGroup(unsigned fg
) { SET_VAR(rareNonInheritedData
.access()->m_deprecatedFlexibleBox
, flexGroup
, fg
); }
1289 void setBoxLines(EBoxLines l
) { SET_VAR(rareNonInheritedData
.access()->m_deprecatedFlexibleBox
, lines
, l
); }
1290 void setBoxOrdinalGroup(unsigned og
) { SET_VAR(rareNonInheritedData
.access()->m_deprecatedFlexibleBox
, ordinalGroup
, og
); }
1291 void setBoxOrient(EBoxOrient o
) { SET_VAR(rareNonInheritedData
.access()->m_deprecatedFlexibleBox
, orient
, o
); }
1292 void setBoxPack(EBoxPack p
) { SET_VAR(rareNonInheritedData
.access()->m_deprecatedFlexibleBox
, pack
, p
); }
1293 void setBoxShadow(PassRefPtr
<ShadowList
>);
1294 void setBoxReflect(PassRefPtr
<StyleReflection
> reflect
) { if (rareNonInheritedData
->m_boxReflect
!= reflect
) rareNonInheritedData
.access()->m_boxReflect
= reflect
; }
1295 void setBoxSizing(EBoxSizing s
) { SET_VAR(m_box
, m_boxSizing
, s
); }
1296 void setFlexGrow(float f
) { SET_VAR(rareNonInheritedData
.access()->m_flexibleBox
, m_flexGrow
, f
); }
1297 void setFlexShrink(float f
) { SET_VAR(rareNonInheritedData
.access()->m_flexibleBox
, m_flexShrink
, f
); }
1298 void setFlexBasis(const Length
& length
) { SET_VAR(rareNonInheritedData
.access()->m_flexibleBox
, m_flexBasis
, length
); }
1299 // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set.
1300 void setOrder(int o
) { SET_VAR(rareNonInheritedData
, m_order
, max(std::numeric_limits
<int>::min() + 2, o
)); }
1301 void addCallbackSelector(const String
& selector
);
1302 void setAlignContent(const StyleContentAlignmentData
& data
) { SET_VAR(rareNonInheritedData
, m_alignContent
, data
); }
1303 void setAlignContentPosition(ContentPosition position
) { rareNonInheritedData
.access()->m_alignContent
.setPosition(position
); }
1304 void setAlignContentDistribution(ContentDistributionType distribution
) { rareNonInheritedData
.access()->m_alignContent
.setDistribution(distribution
); }
1305 void setAlignContentOverflow(OverflowAlignment overflow
) { rareNonInheritedData
.access()->m_alignContent
.setOverflow(overflow
); }
1306 void setAlignItems(const StyleSelfAlignmentData
& data
) { SET_VAR(rareNonInheritedData
, m_alignItems
, data
); }
1307 void setAlignItemsPosition(ItemPosition position
) { rareNonInheritedData
.access()->m_alignItems
.setPosition(position
); }
1308 void setAlignItemsOverflow(OverflowAlignment overflow
) { rareNonInheritedData
.access()->m_alignItems
.setOverflow(overflow
); }
1309 void setAlignSelf(const StyleSelfAlignmentData
& data
) { SET_VAR(rareNonInheritedData
, m_alignSelf
, data
); }
1310 void setAlignSelfPosition(ItemPosition position
) { rareNonInheritedData
.access()->m_alignSelf
.setPosition(position
); }
1311 void setAlignSelfOverflow(OverflowAlignment overflow
) { rareNonInheritedData
.access()->m_alignSelf
.setOverflow(overflow
); }
1312 void setFlexDirection(EFlexDirection direction
) { SET_VAR(rareNonInheritedData
.access()->m_flexibleBox
, m_flexDirection
, direction
); }
1313 void setFlexWrap(EFlexWrap w
) { SET_VAR(rareNonInheritedData
.access()->m_flexibleBox
, m_flexWrap
, w
); }
1314 void setJustifyContent(const StyleContentAlignmentData
& data
) { SET_VAR(rareNonInheritedData
, m_justifyContent
, data
); }
1315 void setJustifyContentPosition(ContentPosition position
) { rareNonInheritedData
.access()->m_justifyContent
.setPosition(position
); }
1316 void setJustifyContentDistribution(ContentDistributionType distribution
) { rareNonInheritedData
.access()->m_justifyContent
.setDistribution(distribution
); }
1317 void setJustifyContentOverflow(OverflowAlignment overflow
) { rareNonInheritedData
.access()->m_justifyContent
.setOverflow(overflow
); }
1318 void setJustifyItems(const StyleSelfAlignmentData
& data
) { SET_VAR(rareNonInheritedData
, m_justifyItems
, data
); }
1319 void setJustifyItemsPosition(ItemPosition position
) { rareNonInheritedData
.access()->m_justifyItems
.setPosition(position
); }
1320 void setJustifyItemsOverflow(OverflowAlignment overflow
) { rareNonInheritedData
.access()->m_justifyItems
.setOverflow(overflow
); }
1321 void setJustifyItemsPositionType(ItemPositionType positionType
) { rareNonInheritedData
.access()->m_justifyItems
.setPositionType(positionType
); }
1322 void setJustifySelf(const StyleSelfAlignmentData
& data
) { SET_VAR(rareNonInheritedData
, m_justifySelf
, data
); }
1323 void setJustifySelfPosition(ItemPosition position
) { rareNonInheritedData
.access()->m_justifySelf
.setPosition(position
); }
1324 void setJustifySelfOverflow(OverflowAlignment overflow
) { rareNonInheritedData
.access()->m_justifySelf
.setOverflow(overflow
); }
1325 void setGridAutoColumns(const GridTrackSize
& length
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_gridAutoColumns
, length
); }
1326 void setGridAutoRows(const GridTrackSize
& length
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_gridAutoRows
, length
); }
1327 void setGridTemplateColumns(const Vector
<GridTrackSize
>& lengths
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_gridTemplateColumns
, lengths
); }
1328 void setGridTemplateRows(const Vector
<GridTrackSize
>& lengths
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_gridTemplateRows
, lengths
); }
1329 void setNamedGridColumnLines(const NamedGridLinesMap
& namedGridColumnLines
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_namedGridColumnLines
, namedGridColumnLines
); }
1330 void setNamedGridRowLines(const NamedGridLinesMap
& namedGridRowLines
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_namedGridRowLines
, namedGridRowLines
); }
1331 void setOrderedNamedGridColumnLines(const OrderedNamedGridLines
& orderedNamedGridColumnLines
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_orderedNamedGridColumnLines
, orderedNamedGridColumnLines
); }
1332 void setOrderedNamedGridRowLines(const OrderedNamedGridLines
& orderedNamedGridRowLines
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_orderedNamedGridRowLines
, orderedNamedGridRowLines
); }
1333 void setNamedGridArea(const NamedGridAreaMap
& namedGridArea
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_namedGridArea
, namedGridArea
); }
1334 void setNamedGridAreaRowCount(size_t rowCount
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_namedGridAreaRowCount
, rowCount
); }
1335 void setNamedGridAreaColumnCount(size_t columnCount
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_namedGridAreaColumnCount
, columnCount
); }
1336 void setGridAutoFlow(GridAutoFlow flow
) { SET_VAR(rareNonInheritedData
.access()->m_grid
, m_gridAutoFlow
, flow
); }
1338 void setGridColumnStart(const GridPosition
& columnStartPosition
) { SET_VAR(rareNonInheritedData
.access()->m_gridItem
, m_gridColumnStart
, columnStartPosition
); }
1339 void setGridColumnEnd(const GridPosition
& columnEndPosition
) { SET_VAR(rareNonInheritedData
.access()->m_gridItem
, m_gridColumnEnd
, columnEndPosition
); }
1340 void setGridRowStart(const GridPosition
& rowStartPosition
) { SET_VAR(rareNonInheritedData
.access()->m_gridItem
, m_gridRowStart
, rowStartPosition
); }
1341 void setGridRowEnd(const GridPosition
& rowEndPosition
) { SET_VAR(rareNonInheritedData
.access()->m_gridItem
, m_gridRowEnd
, rowEndPosition
); }
1343 void setUserModify(EUserModify u
) { SET_VAR(rareInheritedData
, userModify
, u
); }
1344 void setUserDrag(EUserDrag d
) { SET_VAR(rareNonInheritedData
, userDrag
, d
); }
1345 void setUserSelect(EUserSelect s
) { SET_VAR(rareInheritedData
, userSelect
, s
); }
1346 void setTextOverflow(TextOverflow overflow
) { SET_VAR(rareNonInheritedData
, textOverflow
, overflow
); }
1347 void setMarginBeforeCollapse(EMarginCollapse c
) { SET_VAR(rareNonInheritedData
, marginBeforeCollapse
, c
); }
1348 void setMarginAfterCollapse(EMarginCollapse c
) { SET_VAR(rareNonInheritedData
, marginAfterCollapse
, c
); }
1349 void setWordBreak(EWordBreak b
) { SET_VAR(rareInheritedData
, wordBreak
, b
); }
1350 void setOverflowWrap(EOverflowWrap b
) { SET_VAR(rareInheritedData
, overflowWrap
, b
); }
1351 void setLineBreak(LineBreak b
) { SET_VAR(rareInheritedData
, lineBreak
, b
); }
1352 void setHighlight(const AtomicString
& h
) { SET_VAR(rareInheritedData
, highlight
, h
); }
1353 void setHyphenationString(const AtomicString
& h
) { SET_VAR(rareInheritedData
, hyphenationString
, h
); }
1354 void setLocale(const AtomicString
& locale
) { SET_VAR(rareInheritedData
, locale
, locale
); }
1355 void setResize(EResize r
) { SET_VAR(rareNonInheritedData
, m_resize
, r
); }
1356 void setColumnWidth(float f
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_autoWidth
, false); SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_width
, f
); }
1357 void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_autoWidth
, true); SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_width
, 0); }
1358 void setColumnCount(unsigned short c
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_autoCount
, false); SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_count
, c
); }
1359 void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_autoCount
, true); SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_count
, initialColumnCount()); }
1360 void setColumnFill(ColumnFill columnFill
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_fill
, columnFill
); }
1361 void setColumnGap(float f
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_normalGap
, false); SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_gap
, f
); }
1362 void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_normalGap
, true); SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_gap
, 0); }
1363 void setColumnRuleColor(const StyleColor
& c
) { SET_BORDERVALUE_COLOR(rareNonInheritedData
.access()->m_multiCol
, m_rule
, c
); }
1364 void setColumnRuleStyle(EBorderStyle b
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_rule
.m_style
, b
); }
1365 void setColumnRuleWidth(unsigned short w
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_rule
.m_width
, w
); }
1366 void setColumnSpan(ColumnSpan columnSpan
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_columnSpan
, columnSpan
); }
1367 void setColumnBreakBefore(EPageBreak p
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_breakBefore
, p
); }
1368 // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
1369 void setColumnBreakInside(EPageBreak p
) { ASSERT(p
== PBAUTO
|| p
== PBAVOID
); SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_breakInside
, p
); }
1370 void setColumnBreakAfter(EPageBreak p
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_breakAfter
, p
); }
1371 void inheritColumnPropertiesFrom(const ComputedStyle
& parent
) { rareNonInheritedData
.access()->m_multiCol
= parent
.rareNonInheritedData
->m_multiCol
; }
1372 void setHasInlineTransform(bool b
) { SET_VAR(rareNonInheritedData
, m_hasInlineTransform
, b
); }
1373 void setHasCompositorProxy(bool b
) { SET_VAR(rareNonInheritedData
, m_hasCompositorProxy
, b
); }
1374 void setTransform(const TransformOperations
& ops
) { SET_VAR(rareNonInheritedData
.access()->m_transform
, m_operations
, ops
); }
1375 void setTransformOriginX(const Length
& v
) { setTransformOrigin(TransformOrigin(v
, transformOriginY(), transformOriginZ())); }
1376 void setTransformOriginY(const Length
& v
) { setTransformOrigin(TransformOrigin(transformOriginX(), v
, transformOriginZ())); }
1377 void setTransformOriginZ(float f
) { setTransformOrigin(TransformOrigin(transformOriginX(), transformOriginY(), f
)); }
1378 void setTransformOrigin(const TransformOrigin
& o
) { SET_VAR(rareNonInheritedData
.access()->m_transform
, m_origin
, o
); }
1379 void setTranslate(PassRefPtr
<TranslateTransformOperation
> v
) { rareNonInheritedData
.access()->m_transform
.access()->m_translate
= v
; }
1380 void setRotate(PassRefPtr
<RotateTransformOperation
> v
) { rareNonInheritedData
.access()->m_transform
.access()->m_rotate
= v
; }
1381 void setScale(PassRefPtr
<ScaleTransformOperation
> v
) { rareNonInheritedData
.access()->m_transform
.access()->m_scale
= v
; }
1383 void setSpeak(ESpeak s
) { SET_VAR(rareInheritedData
, speak
, s
); }
1384 void setTextCombine(TextCombine v
) { SET_VAR(rareInheritedData
, m_textCombine
, v
); }
1385 void setTextDecorationColor(const StyleColor
& c
) { SET_VAR(rareNonInheritedData
, m_textDecorationColor
, c
); }
1386 void setTextEmphasisColor(const StyleColor
& c
) { SET_VAR_WITH_SETTER(rareInheritedData
, textEmphasisColor
, setTextEmphasisColor
, c
); }
1387 void setTextEmphasisFill(TextEmphasisFill fill
) { SET_VAR(rareInheritedData
, textEmphasisFill
, fill
); }
1388 void setTextEmphasisMark(TextEmphasisMark mark
) { SET_VAR(rareInheritedData
, textEmphasisMark
, mark
); }
1389 void setTextEmphasisCustomMark(const AtomicString
& mark
) { SET_VAR(rareInheritedData
, textEmphasisCustomMark
, mark
); }
1390 void setTextEmphasisPosition(TextEmphasisPosition position
) { SET_VAR(rareInheritedData
, textEmphasisPosition
, position
); }
1391 bool setTextOrientation(TextOrientation
);
1393 void setMotionPath(PassRefPtr
<StyleMotionPath
>);
1394 void resetMotionPath();
1395 void setMotionOffset(const Length
& motionOffset
) { SET_VAR(rareNonInheritedData
.access()->m_transform
, m_motion
.m_offset
, motionOffset
); }
1396 void setMotionRotation(float motionRotation
) { SET_VAR(rareNonInheritedData
.access()->m_transform
, m_motion
.m_rotation
, motionRotation
); }
1397 void setMotionRotationType(MotionRotationType motionRotationType
) { SET_VAR(rareNonInheritedData
.access()->m_transform
, m_motion
.m_rotationType
, motionRotationType
); }
1399 void setObjectFit(ObjectFit f
) { SET_VAR(rareNonInheritedData
, m_objectFit
, f
); }
1400 void setObjectPosition(LengthPoint position
) { SET_VAR(rareNonInheritedData
, m_objectPosition
, position
); }
1402 void setRubyPosition(RubyPosition position
) { SET_VAR(rareInheritedData
, m_rubyPosition
, position
); }
1404 void setFilter(const FilterOperations
& ops
) { SET_VAR(rareNonInheritedData
.access()->m_filter
, m_operations
, ops
); }
1405 void setBackdropFilter(const FilterOperations
& ops
) { SET_VAR(rareNonInheritedData
.access()->m_backdropFilter
, m_operations
, ops
); }
1407 void setTabSize(TabSize size
) { SET_VAR(rareInheritedData
, m_tabSize
, size
); }
1409 void setRespectImageOrientation(RespectImageOrientationEnum v
) { SET_VAR(rareInheritedData
, m_respectImageOrientation
, v
); }
1413 void setWrapFlow(WrapFlow wrapFlow
) { SET_VAR(rareNonInheritedData
, m_wrapFlow
, wrapFlow
); }
1414 void setWrapThrough(WrapThrough wrapThrough
) { SET_VAR(rareNonInheritedData
, m_wrapThrough
, wrapThrough
); }
1416 // Apple-specific property setters
1417 void setPointerEvents(EPointerEvents p
) { inherited_flags
._pointerEvents
= p
; }
1419 void setTransformStyle3D(ETransformStyle3D b
) { SET_VAR(rareNonInheritedData
, m_transformStyle3D
, b
); }
1420 void setBackfaceVisibility(EBackfaceVisibility b
) { SET_VAR(rareNonInheritedData
, m_backfaceVisibility
, b
); }
1421 void setPerspective(float p
) { SET_VAR(rareNonInheritedData
, m_perspective
, p
); }
1422 void setPerspectiveOriginX(const Length
& v
) { setPerspectiveOrigin(LengthPoint(v
, perspectiveOriginY())); }
1423 void setPerspectiveOriginY(const Length
& v
) { setPerspectiveOrigin(LengthPoint(perspectiveOriginX(), v
)); }
1424 void setPerspectiveOrigin(const LengthPoint
& p
) { SET_VAR(rareNonInheritedData
, m_perspectiveOrigin
, p
); }
1425 void setPageSize(const FloatSize
& s
) { SET_VAR(rareNonInheritedData
, m_pageSize
, s
); }
1426 void setPageSizeType(PageSizeType t
) { SET_VAR(rareNonInheritedData
, m_pageSizeType
, t
); }
1427 void resetPageSizeType() { SET_VAR(rareNonInheritedData
, m_pageSizeType
, PAGE_SIZE_AUTO
); }
1429 void setHasCurrentOpacityAnimation(bool b
= true) { SET_VAR(rareNonInheritedData
, m_hasCurrentOpacityAnimation
, b
); }
1430 void setHasCurrentTransformAnimation(bool b
= true) { SET_VAR(rareNonInheritedData
, m_hasCurrentTransformAnimation
, b
); }
1431 void setHasCurrentFilterAnimation(bool b
= true) { SET_VAR(rareNonInheritedData
, m_hasCurrentFilterAnimation
, b
); }
1432 void setHasCurrentBackdropFilterAnimation(bool b
= true) { SET_VAR(rareNonInheritedData
, m_hasCurrentBackdropFilterAnimation
, b
); }
1434 void setIsRunningOpacityAnimationOnCompositor(bool b
= true) { SET_VAR(rareNonInheritedData
, m_runningOpacityAnimationOnCompositor
, b
); }
1435 void setIsRunningTransformAnimationOnCompositor(bool b
= true) { SET_VAR(rareNonInheritedData
, m_runningTransformAnimationOnCompositor
, b
); }
1436 void setIsRunningFilterAnimationOnCompositor(bool b
= true) { SET_VAR(rareNonInheritedData
, m_runningFilterAnimationOnCompositor
, b
); }
1437 void setIsRunningBackdropFilterAnimationOnCompositor(bool b
= true) { SET_VAR(rareNonInheritedData
, m_runningBackdropFilterAnimationOnCompositor
, b
); }
1439 void setLineClamp(LineClampValue c
) { SET_VAR(rareNonInheritedData
, lineClamp
, c
); }
1440 void setTapHighlightColor(const Color
& c
) { SET_VAR(rareInheritedData
, tapHighlightColor
, c
); }
1441 void setTextSecurity(ETextSecurity aTextSecurity
) { SET_VAR(rareInheritedData
, textSecurity
, aTextSecurity
); }
1442 void setTouchAction(TouchAction t
) { SET_VAR(rareNonInheritedData
, m_touchAction
, t
); }
1444 void setScrollBehavior(ScrollBehavior b
) { SET_VAR(rareNonInheritedData
, m_scrollBehavior
, b
); }
1446 void setScrollSnapType(ScrollSnapType b
) { SET_VAR(rareNonInheritedData
, m_scrollSnapType
, b
); }
1447 void setScrollSnapPointsX(const ScrollSnapPoints
& b
) { SET_VAR(rareNonInheritedData
.access()->m_scrollSnap
, m_xPoints
, b
); }
1448 void setScrollSnapPointsY(const ScrollSnapPoints
& b
) { SET_VAR(rareNonInheritedData
.access()->m_scrollSnap
, m_yPoints
, b
); }
1449 void setScrollSnapDestination(const LengthPoint
& b
) { SET_VAR(rareNonInheritedData
.access()->m_scrollSnap
, m_destination
, b
); }
1450 void setScrollSnapCoordinate(const Vector
<LengthPoint
>& b
) { SET_VAR(rareNonInheritedData
.access()->m_scrollSnap
, m_coordinates
, b
); }
1452 void setWillChangeProperties(const Vector
<CSSPropertyID
>& properties
) { SET_VAR(rareNonInheritedData
.access()->m_willChange
, m_properties
, properties
); }
1453 void setWillChangeContents(bool b
) { SET_VAR(rareNonInheritedData
.access()->m_willChange
, m_contents
, b
); }
1454 void setWillChangeScrollPosition(bool b
) { SET_VAR(rareNonInheritedData
.access()->m_willChange
, m_scrollPosition
, b
); }
1455 void setSubtreeWillChangeContents(bool b
) { SET_VAR(rareInheritedData
, m_subtreeWillChangeContents
, b
); }
1457 bool requiresAcceleratedCompositingForExternalReasons(bool b
) { return rareNonInheritedData
->m_requiresAcceleratedCompositingForExternalReasons
; }
1458 void setRequiresAcceleratedCompositingForExternalReasons(bool b
) { SET_VAR(rareNonInheritedData
, m_requiresAcceleratedCompositingForExternalReasons
, b
); }
1460 const SVGComputedStyle
& svgStyle() const { return *m_svgStyle
.get(); }
1461 SVGComputedStyle
& accessSVGStyle() { return *m_svgStyle
.access(); }
1463 const SVGPaintType
& fillPaintType() const { return svgStyle().fillPaintType(); }
1464 Color
fillPaintColor() const { return svgStyle().fillPaintColor(); }
1465 float fillOpacity() const { return svgStyle().fillOpacity(); }
1466 void setFillOpacity(float f
) { accessSVGStyle().setFillOpacity(f
); }
1468 const SVGPaintType
& strokePaintType() const { return svgStyle().strokePaintType(); }
1469 Color
strokePaintColor() const { return svgStyle().strokePaintColor(); }
1470 float strokeOpacity() const { return svgStyle().strokeOpacity(); }
1471 void setStrokeOpacity(float f
) { accessSVGStyle().setStrokeOpacity(f
); }
1472 const UnzoomedLength
& strokeWidth() const { return svgStyle().strokeWidth(); }
1473 void setStrokeWidth(const UnzoomedLength
& w
) { accessSVGStyle().setStrokeWidth(w
); }
1474 SVGDashArray
* strokeDashArray() const { return svgStyle().strokeDashArray(); }
1475 void setStrokeDashArray(PassRefPtr
<SVGDashArray
> array
) { accessSVGStyle().setStrokeDashArray(array
); }
1476 const Length
& strokeDashOffset() const { return svgStyle().strokeDashOffset(); }
1477 void setStrokeDashOffset(const Length
& d
) { accessSVGStyle().setStrokeDashOffset(d
); }
1478 float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); }
1479 void setStrokeMiterLimit(float f
) { accessSVGStyle().setStrokeMiterLimit(f
); }
1481 void setCx(const Length
& cx
) { accessSVGStyle().setCx(cx
); }
1482 void setCy(const Length
& cy
) { accessSVGStyle().setCy(cy
); }
1483 void setX(const Length
& x
) { accessSVGStyle().setX(x
); }
1484 void setY(const Length
& y
) { accessSVGStyle().setY(y
); }
1485 void setR(const Length
& r
) { accessSVGStyle().setR(r
); }
1486 void setRx(const Length
& rx
) { accessSVGStyle().setRx(rx
); }
1487 void setRy(const Length
& ry
) { accessSVGStyle().setRy(ry
); }
1489 float floodOpacity() const { return svgStyle().floodOpacity(); }
1490 void setFloodOpacity(float f
) { accessSVGStyle().setFloodOpacity(f
); }
1492 float stopOpacity() const { return svgStyle().stopOpacity(); }
1493 void setStopOpacity(float f
) { accessSVGStyle().setStopOpacity(f
); }
1495 void setStopColor(const Color
& c
) { accessSVGStyle().setStopColor(c
); }
1496 void setFloodColor(const Color
& c
) { accessSVGStyle().setFloodColor(c
); }
1497 void setLightingColor(const Color
& c
) { accessSVGStyle().setLightingColor(c
); }
1499 EBaselineShift
baselineShift() const { return svgStyle().baselineShift(); }
1500 const Length
& baselineShiftValue() const { return svgStyle().baselineShiftValue(); }
1501 void setBaselineShiftValue(const Length
& value
)
1503 SVGComputedStyle
& svgStyle
= accessSVGStyle();
1504 svgStyle
.setBaselineShift(BS_LENGTH
);
1505 svgStyle
.setBaselineShiftValue(value
);
1508 void setShapeOutside(PassRefPtrWillBeRawPtr
<ShapeValue
> value
)
1510 if (rareNonInheritedData
->m_shapeOutside
== value
)
1512 rareNonInheritedData
.access()->m_shapeOutside
= value
;
1514 ShapeValue
* shapeOutside() const { return rareNonInheritedData
->m_shapeOutside
.get(); }
1516 static ShapeValue
* initialShapeOutside() { return 0; }
1518 void setClipPath(PassRefPtr
<ClipPathOperation
> operation
)
1520 if (rareNonInheritedData
->m_clipPath
!= operation
)
1521 rareNonInheritedData
.access()->m_clipPath
= operation
;
1523 ClipPathOperation
* clipPath() const { return rareNonInheritedData
->m_clipPath
.get(); }
1525 static ClipPathOperation
* initialClipPath() { return 0; }
1527 const Length
& shapeMargin() const { return rareNonInheritedData
->m_shapeMargin
; }
1528 void setShapeMargin(const Length
& shapeMargin
) { SET_VAR(rareNonInheritedData
, m_shapeMargin
, shapeMargin
); }
1529 static Length
initialShapeMargin() { return Length(0, Fixed
); }
1531 float shapeImageThreshold() const { return rareNonInheritedData
->m_shapeImageThreshold
; }
1532 void setShapeImageThreshold(float shapeImageThreshold
)
1534 float clampedShapeImageThreshold
= clampTo
<float>(shapeImageThreshold
, 0, 1);
1535 SET_VAR(rareNonInheritedData
, m_shapeImageThreshold
, clampedShapeImageThreshold
);
1537 static float initialShapeImageThreshold() { return 0; }
1539 bool hasContent() const { return contentData(); }
1540 const ContentData
* contentData() const { return rareNonInheritedData
->m_content
.get(); }
1541 bool contentDataEquivalent(const ComputedStyle
* otherStyle
) const { return const_cast<ComputedStyle
*>(this)->rareNonInheritedData
->contentDataEquivalent(*const_cast<ComputedStyle
*>(otherStyle
)->rareNonInheritedData
); }
1542 void clearContent();
1543 void setContent(const String
&, bool add
= false);
1544 void setContent(PassRefPtrWillBeRawPtr
<StyleImage
>, bool add
= false);
1545 void setContent(PassOwnPtr
<CounterContent
>, bool add
= false);
1546 void setContent(QuoteType
, bool add
= false);
1548 const CounterDirectiveMap
* counterDirectives() const;
1549 CounterDirectiveMap
& accessCounterDirectives();
1550 const CounterDirectives
getCounterDirectives(const AtomicString
& identifier
) const;
1551 void clearIncrementDirectives();
1552 void clearResetDirectives();
1554 QuotesData
* quotes() const { return rareInheritedData
->quotes
.get(); }
1555 void setQuotes(PassRefPtr
<QuotesData
>);
1557 const AtomicString
& hyphenString() const;
1559 bool inheritedNotEqual(const ComputedStyle
&) const;
1560 bool inheritedDataShared(const ComputedStyle
&) const;
1562 bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); }
1563 bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
1564 bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
1565 bool isDisplayFlexibleOrGridBox() const { return isDisplayFlexibleBox(display()) || isDisplayGridBox(display()); }
1566 bool isDisplayFlexibleBox() const { return isDisplayFlexibleBox(display()); }
1569 bool setWritingMode(WritingMode v
)
1571 if (v
== writingMode())
1574 inherited_flags
.m_writingMode
= v
;
1578 // A unique style is one that has matches something that makes it impossible to share.
1579 bool unique() const { return noninherited_flags
.unique
; }
1580 void setUnique() { noninherited_flags
.unique
= true; }
1582 bool isSharable() const;
1584 bool emptyState() const { return noninherited_flags
.emptyState
; }
1585 void setEmptyState(bool b
) { setUnique(); noninherited_flags
.emptyState
= b
; }
1587 Color
visitedDependentColor(int colorProperty
) const;
1589 void setHasExplicitlyInheritedProperties() { noninherited_flags
.explicitInheritance
= true; }
1590 bool hasExplicitlyInheritedProperties() const { return noninherited_flags
.explicitInheritance
; }
1592 bool hasChildDependentFlags() const { return emptyState() || hasExplicitlyInheritedProperties(); }
1593 void copyChildDependentFlagsFrom(const ComputedStyle
&);
1595 bool hasBoxDecorations() const { return hasBorderDecoration() || hasBorderRadius() || hasOutline() || hasAppearance() || boxShadow() || hasFilter() || resize() != RESIZE_NONE
; }
1597 bool borderObscuresBackground() const;
1598 void getBorderEdgeInfo(BorderEdge edges
[], bool includeLogicalLeftEdge
= true, bool includeLogicalRightEdge
= true) const;
1600 void setHasAuthorBackground(bool authorBackground
) { SET_VAR(rareNonInheritedData
, m_hasAuthorBackground
, authorBackground
); }
1601 void setHasAuthorBorder(bool authorBorder
) { SET_VAR(rareNonInheritedData
, m_hasAuthorBorder
, authorBorder
); }
1602 bool hasAuthorBackground() const { return rareNonInheritedData
->m_hasAuthorBackground
; };
1603 bool hasAuthorBorder() const { return rareNonInheritedData
->m_hasAuthorBorder
; };
1605 // Initial values for all the properties
1606 static EBorderCollapse
initialBorderCollapse() { return BSEPARATE
; }
1607 static EBorderStyle
initialBorderStyle() { return BNONE
; }
1608 static OutlineIsAuto
initialOutlineStyleIsAuto() { return AUTO_OFF
; }
1609 static NinePieceImage
initialNinePieceImage() { return NinePieceImage(); }
1610 static LengthSize
initialBorderRadius() { return LengthSize(Length(0, Fixed
), Length(0, Fixed
)); }
1611 static ECaptionSide
initialCaptionSide() { return CAPTOP
; }
1612 static EClear
initialClear() { return CNONE
; }
1613 static LengthBox
initialClip() { return LengthBox(); }
1614 static TextDirection
initialDirection() { return LTR
; }
1615 static WritingMode
initialWritingMode() { return TopToBottomWritingMode
; }
1616 static TextCombine
initialTextCombine() { return TextCombineNone
; }
1617 static TextOrientation
initialTextOrientation() { return TextOrientationVerticalRight
; }
1618 static ObjectFit
initialObjectFit() { return ObjectFitFill
; }
1619 static LengthPoint
initialObjectPosition() { return LengthPoint(Length(50.0, Percent
), Length(50.0, Percent
)); }
1620 static EDisplay
initialDisplay() { return INLINE
; }
1621 static EEmptyCell
initialEmptyCells() { return SHOW
; }
1622 static EFloat
initialFloating() { return NoFloat
; }
1623 static EListStylePosition
initialListStylePosition() { return OUTSIDE
; }
1624 static EListStyleType
initialListStyleType() { return Disc
; }
1625 static EOverflow
initialOverflowX() { return OVISIBLE
; }
1626 static EOverflow
initialOverflowY() { return OVISIBLE
; }
1627 static EPageBreak
initialPageBreak() { return PBAUTO
; }
1628 static EPosition
initialPosition() { return StaticPosition
; }
1629 static ETableLayout
initialTableLayout() { return TAUTO
; }
1630 static EUnicodeBidi
initialUnicodeBidi() { return UBNormal
; }
1631 static ETextTransform
initialTextTransform() { return TTNONE
; }
1632 static EVisibility
initialVisibility() { return VISIBLE
; }
1633 static EWhiteSpace
initialWhiteSpace() { return NORMAL
; }
1634 static short initialHorizontalBorderSpacing() { return 0; }
1635 static short initialVerticalBorderSpacing() { return 0; }
1636 static ECursor
initialCursor() { return CURSOR_AUTO
; }
1637 static Color
initialColor() { return Color::black
; }
1638 static StyleImage
* initialListStyleImage() { return 0; }
1639 static unsigned initialBorderWidth() { return 3; }
1640 static unsigned short initialColumnRuleWidth() { return 3; }
1641 static unsigned short initialOutlineWidth() { return 3; }
1642 static float initialLetterWordSpacing() { return 0.0f
; }
1643 static Length
initialSize() { return Length(); }
1644 static Length
initialMinSize() { return Length(); }
1645 static Length
initialMaxSize() { return Length(MaxSizeNone
); }
1646 static Length
initialOffset() { return Length(); }
1647 static Length
initialMargin() { return Length(Fixed
); }
1648 static Length
initialPadding() { return Length(Fixed
); }
1649 static Length
initialTextIndent() { return Length(Fixed
); }
1650 static TextIndentLine
initialTextIndentLine() { return TextIndentFirstLine
; }
1651 static TextIndentType
initialTextIndentType() { return TextIndentNormal
; }
1652 static EVerticalAlign
initialVerticalAlign() { return BASELINE
; }
1653 static short initialWidows() { return 1; }
1654 static short initialOrphans() { return 2; }
1655 static Length
initialLineHeight() { return Length(-100.0, Percent
); }
1656 static ETextAlign
initialTextAlign() { return TASTART
; }
1657 static TextAlignLast
initialTextAlignLast() { return TextAlignLastAuto
; }
1658 static TextJustify
initialTextJustify() { return TextJustifyAuto
; }
1659 static TextDecoration
initialTextDecoration() { return TextDecorationNone
; }
1660 static TextUnderlinePosition
initialTextUnderlinePosition() { return TextUnderlinePositionAuto
; }
1661 static TextDecorationStyle
initialTextDecorationStyle() { return TextDecorationStyleSolid
; }
1662 static float initialZoom() { return 1.0f
; }
1663 static int initialOutlineOffset() { return 0; }
1664 static float initialOpacity() { return 1.0f
; }
1665 static EBoxAlignment
initialBoxAlign() { return BSTRETCH
; }
1666 static EBoxDecorationBreak
initialBoxDecorationBreak() { return DSLICE
; }
1667 static EBoxDirection
initialBoxDirection() { return BNORMAL
; }
1668 static EBoxLines
initialBoxLines() { return SINGLE
; }
1669 static EBoxOrient
initialBoxOrient() { return HORIZONTAL
; }
1670 static EBoxPack
initialBoxPack() { return Start
; }
1671 static float initialBoxFlex() { return 0.0f
; }
1672 static unsigned initialBoxFlexGroup() { return 1; }
1673 static unsigned initialBoxOrdinalGroup() { return 1; }
1674 static EBoxSizing
initialBoxSizing() { return CONTENT_BOX
; }
1675 static StyleReflection
* initialBoxReflect() { return 0; }
1676 static float initialFlexGrow() { return 0; }
1677 static float initialFlexShrink() { return 1; }
1678 static Length
initialFlexBasis() { return Length(Auto
); }
1679 static int initialOrder() { return 0; }
1680 static StyleContentAlignmentData
initialContentAlignment() { return StyleContentAlignmentData(ContentPositionAuto
, ContentDistributionDefault
, OverflowAlignmentDefault
); }
1681 static StyleSelfAlignmentData
initialSelfAlignment() { return StyleSelfAlignmentData(ItemPositionAuto
, OverflowAlignmentDefault
); }
1682 static EFlexDirection
initialFlexDirection() { return FlowRow
; }
1683 static EFlexWrap
initialFlexWrap() { return FlexNoWrap
; }
1684 static EUserModify
initialUserModify() { return READ_ONLY
; }
1685 static EUserDrag
initialUserDrag() { return DRAG_AUTO
; }
1686 static EUserSelect
initialUserSelect() { return SELECT_TEXT
; }
1687 static TextOverflow
initialTextOverflow() { return TextOverflowClip
; }
1688 static EMarginCollapse
initialMarginBeforeCollapse() { return MCOLLAPSE
; }
1689 static EMarginCollapse
initialMarginAfterCollapse() { return MCOLLAPSE
; }
1690 static EWordBreak
initialWordBreak() { return NormalWordBreak
; }
1691 static EOverflowWrap
initialOverflowWrap() { return NormalOverflowWrap
; }
1692 static LineBreak
initialLineBreak() { return LineBreakAuto
; }
1693 static const AtomicString
& initialHighlight() { return nullAtom
; }
1694 static ESpeak
initialSpeak() { return SpeakNormal
; }
1695 static const AtomicString
& initialHyphenationString() { return nullAtom
; }
1696 static const AtomicString
& initialLocale() { return nullAtom
; }
1697 static EResize
initialResize() { return RESIZE_NONE
; }
1698 static ControlPart
initialAppearance() { return NoControlPart
; }
1699 static Order
initialRTLOrdering() { return LogicalOrder
; }
1700 static float initialTextStrokeWidth() { return 0; }
1701 static unsigned short initialColumnCount() { return 1; }
1702 static ColumnFill
initialColumnFill() { return ColumnFillBalance
; }
1703 static ColumnSpan
initialColumnSpan() { return ColumnSpanNone
; }
1704 static const TransformOperations
& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations
, ops
, ()); return ops
; }
1705 static PassRefPtr
<TranslateTransformOperation
> initialTranslate() { return TranslateTransformOperation::create(Length(0, Fixed
), Length(0, Fixed
), 0, TransformOperation::Translate3D
); }
1706 static PassRefPtr
<RotateTransformOperation
> initialRotate() { return RotateTransformOperation::create(0, 0, 1, 0, TransformOperation::Rotate3D
); }
1707 static PassRefPtr
<ScaleTransformOperation
> initialScale() { return ScaleTransformOperation::create(1, 1, 1, TransformOperation::Scale3D
); }
1708 static Length
initialTransformOriginX() { return Length(50.0, Percent
); }
1709 static Length
initialTransformOriginY() { return Length(50.0, Percent
); }
1710 static float initialTransformOriginZ() { return 0; }
1711 static TransformOrigin
initialTransformOrigin() { return TransformOrigin(Length(50.0, Percent
), Length(50.0, Percent
), 0); }
1712 static EPointerEvents
initialPointerEvents() { return PE_AUTO
; }
1713 static ETransformStyle3D
initialTransformStyle3D() { return TransformStyle3DFlat
; }
1714 static const StyleMotionPath
* initialMotionPath() { return nullptr; }
1715 static Length
initialMotionOffset() { return Length(0, Fixed
); }
1716 static float initialMotionRotation() { return 0; }
1717 static MotionRotationType
initialMotionRotationType() { return MotionRotationAuto
; }
1718 static EBackfaceVisibility
initialBackfaceVisibility() { return BackfaceVisibilityVisible
; }
1719 static float initialPerspective() { return 0; }
1720 static Length
initialPerspectiveOriginX() { return Length(50.0, Percent
); }
1721 static Length
initialPerspectiveOriginY() { return Length(50.0, Percent
); }
1722 static LengthPoint
initialPerspectiveOrigin() { return LengthPoint(Length(50.0, Percent
), Length(50.0, Percent
)); }
1723 static Color
initialBackgroundColor() { return Color::transparent
; }
1724 static TextEmphasisFill
initialTextEmphasisFill() { return TextEmphasisFillFilled
; }
1725 static TextEmphasisMark
initialTextEmphasisMark() { return TextEmphasisMarkNone
; }
1726 static const AtomicString
& initialTextEmphasisCustomMark() { return nullAtom
; }
1727 static TextEmphasisPosition
initialTextEmphasisPosition() { return TextEmphasisPositionOver
; }
1728 static RubyPosition
initialRubyPosition() { return RubyPositionBefore
; }
1729 static ImageOrientationEnum
initialImageOrientation() { return OriginTopLeft
; }
1730 static RespectImageOrientationEnum
initialRespectImageOrientation() { return DoNotRespectImageOrientation
; }
1731 static EImageRendering
initialImageRendering() { return ImageRenderingAuto
; }
1732 static ImageResolutionSource
initialImageResolutionSource() { return ImageResolutionSpecified
; }
1733 static ImageResolutionSnap
initialImageResolutionSnap() { return ImageResolutionNoSnap
; }
1734 static float initialImageResolution() { return 1; }
1735 static StyleImage
* initialBorderImageSource() { return 0; }
1736 static StyleImage
* initialMaskBoxImageSource() { return 0; }
1737 static PrintColorAdjust
initialPrintColorAdjust() { return PrintColorAdjustEconomy
; }
1738 static TouchAction
initialTouchAction() { return TouchActionAuto
; }
1739 static ShadowList
* initialBoxShadow() { return 0; }
1740 static ShadowList
* initialTextShadow() { return 0; }
1741 static ScrollBehavior
initialScrollBehavior() { return ScrollBehaviorAuto
; }
1742 static ScrollSnapType
initialScrollSnapType() { return ScrollSnapTypeNone
; }
1743 static ScrollSnapPoints
initialScrollSnapPointsX() { return ScrollSnapPoints(); }
1744 static ScrollSnapPoints
initialScrollSnapPointsY() { return ScrollSnapPoints(); }
1745 static LengthPoint
initialScrollSnapDestination() { return LengthPoint(Length(0, Fixed
), Length(0, Fixed
)); }
1746 static Vector
<LengthPoint
> initialScrollSnapCoordinate() { return Vector
<LengthPoint
>(); }
1748 // The initial value is 'none' for grid tracks.
1749 static Vector
<GridTrackSize
> initialGridTemplateColumns() { return Vector
<GridTrackSize
>(); }
1750 static Vector
<GridTrackSize
> initialGridTemplateRows() { return Vector
<GridTrackSize
>(); }
1752 static GridAutoFlow
initialGridAutoFlow() { return AutoFlowRow
; }
1754 static GridTrackSize
initialGridAutoColumns() { return GridTrackSize(Length(Auto
)); }
1755 static GridTrackSize
initialGridAutoRows() { return GridTrackSize(Length(Auto
)); }
1757 static NamedGridLinesMap
initialNamedGridColumnLines() { return NamedGridLinesMap(); }
1758 static NamedGridLinesMap
initialNamedGridRowLines() { return NamedGridLinesMap(); }
1760 static OrderedNamedGridLines
initialOrderedNamedGridColumnLines() { return OrderedNamedGridLines(); }
1761 static OrderedNamedGridLines
initialOrderedNamedGridRowLines() { return OrderedNamedGridLines(); }
1763 static NamedGridAreaMap
initialNamedGridArea() { return NamedGridAreaMap(); }
1764 static size_t initialNamedGridAreaCount() { return 0; }
1766 // 'auto' is the default.
1767 static GridPosition
initialGridColumnStart() { return GridPosition(); }
1768 static GridPosition
initialGridColumnEnd() { return GridPosition(); }
1769 static GridPosition
initialGridRowStart() { return GridPosition(); }
1770 static GridPosition
initialGridRowEnd() { return GridPosition(); }
1772 static TabSize
initialTabSize() { return TabSize(8); }
1774 static WrapFlow
initialWrapFlow() { return WrapFlowAuto
; }
1775 static WrapThrough
initialWrapThrough() { return WrapThroughWrap
; }
1777 static QuotesData
* initialQuotes() { return 0; }
1779 // Keep these at the end.
1780 // FIXME: Why? Seems these should all be one big sorted list.
1781 static LineClampValue
initialLineClamp() { return LineClampValue(); }
1782 static ETextSecurity
initialTextSecurity() { return TSNONE
; }
1783 static Color
initialTapHighlightColor();
1785 static const FilterOperations
& initialFilter();
1786 static const FilterOperations
& initialBackdropFilter();
1788 static const FilterOperations
& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations
, ops
, ()); return ops
; }
1789 static const FilterOperations
& initialBackdropFilter() { DEFINE_STATIC_LOCAL(FilterOperations
, ops
, ()); return ops
; }
1791 static WebBlendMode
initialBlendMode() { return WebBlendModeNormal
; }
1792 static EIsolation
initialIsolation() { return IsolationAuto
; }
1794 void setVisitedLinkColor(const Color
&);
1795 void setVisitedLinkBackgroundColor(const StyleColor
& v
) { SET_VAR(rareNonInheritedData
, m_visitedLinkBackgroundColor
, v
); }
1796 void setVisitedLinkBorderLeftColor(const StyleColor
& v
) { SET_VAR(rareNonInheritedData
, m_visitedLinkBorderLeftColor
, v
); }
1797 void setVisitedLinkBorderRightColor(const StyleColor
& v
) { SET_VAR(rareNonInheritedData
, m_visitedLinkBorderRightColor
, v
); }
1798 void setVisitedLinkBorderBottomColor(const StyleColor
& v
) { SET_VAR(rareNonInheritedData
, m_visitedLinkBorderBottomColor
, v
); }
1799 void setVisitedLinkBorderTopColor(const StyleColor
& v
) { SET_VAR(rareNonInheritedData
, m_visitedLinkBorderTopColor
, v
); }
1800 void setVisitedLinkOutlineColor(const StyleColor
& v
) { SET_VAR(rareNonInheritedData
, m_visitedLinkOutlineColor
, v
); }
1801 void setVisitedLinkColumnRuleColor(const StyleColor
& v
) { SET_VAR(rareNonInheritedData
.access()->m_multiCol
, m_visitedLinkColumnRuleColor
, v
); }
1802 void setVisitedLinkTextDecorationColor(const StyleColor
& v
) { SET_VAR(rareNonInheritedData
, m_visitedLinkTextDecorationColor
, v
); }
1803 void setVisitedLinkTextEmphasisColor(const StyleColor
& v
) { SET_VAR_WITH_SETTER(rareInheritedData
, visitedLinkTextEmphasisColor
, setVisitedLinkTextEmphasisColor
, v
); }
1804 void setVisitedLinkTextFillColor(const StyleColor
& v
) { SET_VAR_WITH_SETTER(rareInheritedData
, visitedLinkTextFillColor
, setVisitedLinkTextFillColor
, v
); }
1805 void setVisitedLinkTextStrokeColor(const StyleColor
& v
) { SET_VAR_WITH_SETTER(rareInheritedData
, visitedLinkTextStrokeColor
, setVisitedLinkTextStrokeColor
, v
); }
1807 void inheritUnicodeBidiFrom(const ComputedStyle
& parent
) { noninherited_flags
.unicodeBidi
= parent
.noninherited_flags
.unicodeBidi
; }
1809 bool isDisplayFlexibleBox(EDisplay display
) const
1811 return display
== FLEX
|| display
== INLINE_FLEX
;
1814 bool isDisplayGridBox(EDisplay display
) const
1816 return display
== GRID
|| display
== INLINE_GRID
;
1819 bool isDisplayReplacedType(EDisplay display
) const
1821 return display
== INLINE_BLOCK
|| display
== INLINE_BOX
|| display
== INLINE_FLEX
1822 || display
== INLINE_TABLE
|| display
== INLINE_GRID
;
1825 bool isDisplayInlineType(EDisplay display
) const
1827 return display
== INLINE
|| isDisplayReplacedType(display
);
1830 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
1831 StyleColor
borderLeftColor() const { return surround
->border
.left().color(); }
1832 StyleColor
borderRightColor() const { return surround
->border
.right().color(); }
1833 StyleColor
borderTopColor() const { return surround
->border
.top().color(); }
1834 StyleColor
borderBottomColor() const { return surround
->border
.bottom().color(); }
1835 StyleColor
backgroundColor() const { return m_background
->color(); }
1836 Color
color() const;
1837 StyleColor
columnRuleColor() const { return rareNonInheritedData
->m_multiCol
->m_rule
.color(); }
1838 StyleColor
outlineColor() const { return m_background
->outline().color(); }
1839 StyleColor
textEmphasisColor() const { return rareInheritedData
->textEmphasisColor(); }
1840 StyleColor
textFillColor() const { return rareInheritedData
->textFillColor(); }
1841 StyleColor
textStrokeColor() const { return rareInheritedData
->textStrokeColor(); }
1842 Color
visitedLinkColor() const;
1843 StyleColor
visitedLinkBackgroundColor() const { return rareNonInheritedData
->m_visitedLinkBackgroundColor
; }
1844 StyleColor
visitedLinkBorderLeftColor() const { return rareNonInheritedData
->m_visitedLinkBorderLeftColor
; }
1845 StyleColor
visitedLinkBorderRightColor() const { return rareNonInheritedData
->m_visitedLinkBorderRightColor
; }
1846 StyleColor
visitedLinkBorderBottomColor() const { return rareNonInheritedData
->m_visitedLinkBorderBottomColor
; }
1847 StyleColor
visitedLinkBorderTopColor() const { return rareNonInheritedData
->m_visitedLinkBorderTopColor
; }
1848 StyleColor
visitedLinkOutlineColor() const { return rareNonInheritedData
->m_visitedLinkOutlineColor
; }
1849 StyleColor
visitedLinkColumnRuleColor() const { return rareNonInheritedData
->m_multiCol
->m_visitedLinkColumnRuleColor
; }
1850 StyleColor
textDecorationColor() const { return rareNonInheritedData
->m_textDecorationColor
; }
1851 StyleColor
visitedLinkTextDecorationColor() const { return rareNonInheritedData
->m_visitedLinkTextDecorationColor
; }
1852 StyleColor
visitedLinkTextEmphasisColor() const { return rareInheritedData
->visitedLinkTextEmphasisColor(); }
1853 StyleColor
visitedLinkTextFillColor() const { return rareInheritedData
->visitedLinkTextFillColor(); }
1854 StyleColor
visitedLinkTextStrokeColor() const { return rareInheritedData
->visitedLinkTextStrokeColor(); }
1856 StyleColor
decorationColorIncludingFallback(bool visitedLink
) const;
1857 Color
colorIncludingFallback(int colorProperty
, bool visitedLink
) const;
1859 Color
stopColor() const { return svgStyle().stopColor(); }
1860 Color
floodColor() const { return svgStyle().floodColor(); }
1861 Color
lightingColor() const { return svgStyle().lightingColor(); }
1863 void appendContent(PassOwnPtrWillBeRawPtr
<ContentData
>);
1864 void addAppliedTextDecoration(const AppliedTextDecoration
&);
1865 void applyMotionPathTransform(float originX
, float originY
, TransformationMatrix
&) const;
1867 bool diffNeedsFullLayoutAndPaintInvalidation(const ComputedStyle
& other
) const;
1868 bool diffNeedsFullLayout(const ComputedStyle
& other
) const;
1869 bool diffNeedsPaintInvalidationLayer(const ComputedStyle
& other
) const;
1870 bool diffNeedsPaintInvalidationObject(const ComputedStyle
& other
) const;
1871 void updatePropertySpecificDifferences(const ComputedStyle
& other
, StyleDifference
&) const;
1873 bool requireTransformOrigin(ApplyTransformOrigin applyOrigin
, ApplyMotionPath
) const;
1876 // FIXME: Reduce/remove the dependency on zoom adjusted int values.
1877 // The float or LayoutUnit versions of layout values should be used.
1878 inline int adjustForAbsoluteZoom(int value
, float zoomFactor
)
1880 if (zoomFactor
== 1)
1882 // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
1883 float fvalue
= value
;
1884 if (zoomFactor
> 1) {
1891 return roundForImpreciseConversion
<int>(fvalue
/ zoomFactor
);
1894 inline int adjustForAbsoluteZoom(int value
, const ComputedStyle
* style
)
1896 return adjustForAbsoluteZoom(value
, style
->effectiveZoom());
1899 inline float adjustFloatForAbsoluteZoom(float value
, const ComputedStyle
& style
)
1901 return value
/ style
.effectiveZoom();
1904 inline double adjustDoubleForAbsoluteZoom(double value
, const ComputedStyle
& style
)
1906 return value
/ style
.effectiveZoom();
1909 inline LayoutUnit
adjustLayoutUnitForAbsoluteZoom(LayoutUnit value
, const ComputedStyle
& style
)
1911 return value
/ style
.effectiveZoom();
1914 inline double adjustScrollForAbsoluteZoom(double scrollOffset
, float zoomFactor
)
1916 return scrollOffset
/ zoomFactor
;
1919 inline double adjustScrollForAbsoluteZoom(double scrollOffset
, const ComputedStyle
& style
)
1921 return adjustScrollForAbsoluteZoom(scrollOffset
, style
.effectiveZoom());
1924 inline bool ComputedStyle::setZoom(float f
)
1926 if (compareEqual(visual
->m_zoom
, f
))
1928 visual
.access()->m_zoom
= f
;
1929 setEffectiveZoom(effectiveZoom() * zoom());
1933 inline bool ComputedStyle::setEffectiveZoom(float f
)
1935 // Clamp the effective zoom value to a smaller (but hopeful still large
1936 // enough) range, to avoid overflow in derived computations.
1937 float clampedEffectiveZoom
= clampTo
<float>(f
, 1e-6, 1e6
);
1938 if (compareEqual(rareInheritedData
->m_effectiveZoom
, clampedEffectiveZoom
))
1940 rareInheritedData
.access()->m_effectiveZoom
= clampedEffectiveZoom
;
1944 inline bool ComputedStyle::isSharable() const
1948 if (hasUniquePseudoStyle())
1953 inline bool ComputedStyle::setTextOrientation(TextOrientation textOrientation
)
1955 if (compareEqual(rareInheritedData
->m_textOrientation
, textOrientation
))
1958 rareInheritedData
.access()->m_textOrientation
= textOrientation
;
1962 inline bool ComputedStyle::hasAnyPublicPseudoStyles() const
1964 return PUBLIC_PSEUDOID_MASK
& noninherited_flags
.pseudoBits
;
1967 inline bool ComputedStyle::hasPseudoStyle(PseudoId pseudo
) const
1969 ASSERT(pseudo
> NOPSEUDO
);
1970 ASSERT(pseudo
< FIRST_INTERNAL_PSEUDOID
);
1971 return (1 << (pseudo
- 1)) & noninherited_flags
.pseudoBits
;
1974 inline void ComputedStyle::setHasPseudoStyle(PseudoId pseudo
)
1976 ASSERT(pseudo
> NOPSEUDO
);
1977 ASSERT(pseudo
< FIRST_INTERNAL_PSEUDOID
);
1978 noninherited_flags
.pseudoBits
|= 1 << (pseudo
- 1);
1981 inline bool ComputedStyle::hasPseudoElementStyle() const
1983 return noninherited_flags
.pseudoBits
& PSEUDO_ELEMENT_MASK
;
1986 } // namespace blink
1988 #endif // ComputedStyle_h