Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 2345543002: debugging for crbug.com/646539
Patch Set: 3 TUs, 2 .h Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 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 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, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 #ifndef ComputedStyle_h 25 #ifndef ComputedStyle_h
26 #define ComputedStyle_h 26 #define ComputedStyle_h
27 27
28 #include "core/CSSPropertyNames.h"
29 #include "core/CoreExport.h"
30 #include "core/style/BorderValue.h"
31 #include "core/style/ComputedStyleConstants.h"
32 #include "core/style/CounterDirectives.h"
33 #include "core/style/DataRef.h"
34 #include "core/style/LineClampValue.h"
35 #include "core/style/NinePieceImage.h"
36 #include "core/style/SVGComputedStyle.h"
37 #include "core/style/StyleBackgroundData.h"
38 #include "core/style/StyleBoxData.h"
39 #include "core/style/StyleContentAlignmentData.h"
40 #include "core/style/StyleDeprecatedFlexibleBoxData.h"
41 #include "core/style/StyleDifference.h"
42 #include "core/style/StyleFilterData.h"
43 #include "core/style/StyleFlexibleBoxData.h"
44 #include "core/style/StyleGridData.h"
45 #include "core/style/StyleGridItemData.h"
46 #include "core/style/StyleInheritedData.h"
47 #include "core/style/StyleMotionRotation.h"
48 #include "core/style/StyleMultiColData.h"
49 #include "core/style/StyleRareInheritedData.h" 28 #include "core/style/StyleRareInheritedData.h"
50 #include "core/style/StyleRareNonInheritedData.h"
51 #include "core/style/StyleReflection.h"
52 #include "core/style/StyleSelfAlignmentData.h"
53 #include "core/style/StyleSurroundData.h"
54 #include "core/style/StyleTransformData.h"
55 #include "core/style/StyleVisualData.h"
56 #include "core/style/StyleWillChangeData.h"
57 #include "core/style/TransformOrigin.h"
58 #include "platform/Length.h"
59 #include "platform/LengthBox.h"
60 #include "platform/LengthPoint.h"
61 #include "platform/LengthSize.h"
62 #include "platform/RuntimeEnabledFeatures.h"
63 #include "platform/ThemeTypes.h"
64 #include "platform/fonts/FontDescription.h"
65 #include "platform/geometry/FloatRoundedRect.h"
66 #include "platform/geometry/LayoutRectOutsets.h"
67 #include "platform/graphics/Color.h"
68 #include "platform/scroll/ScrollTypes.h"
69 #include "platform/text/TextDirection.h"
70 #include "platform/text/UnicodeBidi.h"
71 #include "platform/transforms/TransformOperations.h"
72 #include "wtf/Forward.h"
73 #include "wtf/LeakAnnotations.h"
74 #include "wtf/RefCounted.h"
75 #include "wtf/Vector.h"
76 #include <memory>
77
78 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u ) { return t == static_cast<T>(u); }
79
80 #define SET_VAR(group, variable, value) \
81 if (!compareEqual(group->variable, value)) \
82 group.access()->variable = value
83
84 #define SET_NESTED_VAR(group, base, variable, value) \
85 if (!compareEqual(group->base->variable, value)) \
86 group.access()->base.access()->variable = value
87
88 #define SET_VAR_WITH_SETTER(group, getter, setter, value) \
89 if (!compareEqual(group->getter(), value)) \
90 group.access()->setter(value)
91
92 #define SET_BORDERVALUE_COLOR(group, variable, value) \
93 if (!compareEqual(group->variable.color(), value)) \
94 group.access()->variable.setColor(value)
95 29
96 namespace blink { 30 namespace blink {
97 31
98 using std::max; 32 class ComputedStyle {
33 public:
34 StyleRareInheritedData m_rareInheritedData;
99 35
100 class FilterOperations; 36 ComputedStyle();
101 37
102 class AppliedTextDecoration; 38 float textStrokeWidth() const { return 1; }
103 class BorderData;
104 struct BorderEdge;
105 class CSSAnimationData;
106 class CSSTransitionData;
107 class CSSVariableData;
108 class Font;
109 class FontMetrics;
110 class Hyphenation;
111 class RotateTransformOperation;
112 class ScaleTransformOperation;
113 class ShadowList;
114 class ShapeValue;
115 class StyleImage;
116 class StyleInheritedData;
117 class StylePath;
118 class StyleResolver;
119 class TransformationMatrix;
120 class TranslateTransformOperation;
121 39
122 class ContentData; 40 void setVisitedLinkTextFillColor(const StyleColor& v)
123
124 typedef Vector<RefPtr<ComputedStyle>, 4> PseudoStyleCache;
125
126 class CORE_EXPORT ComputedStyle: public RefCounted<ComputedStyle> {
127 friend class AnimatedStyleBuilder; // Used by Web Animations CSS. Sets the c olor styles
128 friend class CSSAnimatableValueFactory; // Used by Web Animations CSS. Gets visited and unvisited colors separately.
129 friend class CSSPropertyEquality; // Used by CSS animations. We can't allow them to animate based off visited colors.
130 friend class ApplyStyleCommand; // Editing has to only reveal unvisited info .
131 friend class EditingStyle; // Editing has to only reveal unvisited info.
132 friend class ComputedStyleCSSValueMapping; // Needs to be able to see visite d and unvisited colors for devtools.
133 friend class StyleBuilderFunctions; // Sets color styles
134 friend class CachedUAStyle; // Saves Border/Background information for later comparison.
135 friend class ColorPropertyFunctions; // Accesses visited and unvisited color s.
136
137 // FIXME: When we stop resolving currentColor at style time, these can be re moved.
138 friend class CSSToStyleMap;
139 friend class FilterOperationResolver;
140 friend class StyleBuilderConverter;
141 friend class StyleResolverState;
142 friend class StyleResolver;
143 protected:
144
145 // non-inherited attributes
146 DataRef<StyleBoxData> m_box;
147 DataRef<StyleVisualData> m_visual;
148 DataRef<StyleBackgroundData> m_background;
149 DataRef<StyleSurroundData> m_surround;
150 DataRef<StyleRareNonInheritedData> m_rareNonInheritedData;
151
152 // inherited attributes
153 DataRef<StyleRareInheritedData> m_rareInheritedData;
154 DataRef<StyleInheritedData> m_styleInheritedData;
155
156 // list of associated pseudo styles
157 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles;
158
159 DataRef<SVGComputedStyle> m_svgStyle;
160
161 // !START SYNC!: Keep this in sync with the copy constructor in ComputedStyle.cp p and implicitlyInherited() in StyleResolver.cpp
162
163 // inherit
164 struct InheritedData {
165 bool operator==(const InheritedData& other) const
166 {
167 return compareEqualIndependent(other)
168 && compareEqualNonIndependent(other);
169 }
170
171 bool operator!=(const InheritedData& other) const { return !(*this == ot her); }
172
173 inline bool compareEqualIndependent(const InheritedData& other) const
174 {
175 // These must match the properties tagged 'independent' in
176 // CSSProperties.in.
177 // TODO(sashab): Generate this function.
178 return (m_visibility == other.m_visibility)
179 && (m_pointerEvents == other.m_pointerEvents);
180 }
181
182 inline bool compareEqualNonIndependent(const InheritedData& other) const
183 {
184 return (m_emptyCells == other.m_emptyCells)
185 && (m_captionSide == other.m_captionSide)
186 && (m_listStyleType == other.m_listStyleType)
187 && (m_listStylePosition == other.m_listStylePosition)
188 && (m_textAlign == other.m_textAlign)
189 && (m_textTransform == other.m_textTransform)
190 && (m_textUnderline == other.m_textUnderline)
191 && (m_cursorStyle == other.m_cursorStyle)
192 && (m_direction == other.m_direction)
193 && (m_whiteSpace == other.m_whiteSpace)
194 && (m_borderCollapse == other.m_borderCollapse)
195 && (m_boxDirection == other.m_boxDirection)
196 && (m_rtlOrdering == other.m_rtlOrdering)
197 && (m_printColorAdjust == other.m_printColorAdjust)
198 && (m_insideLink == other.m_insideLink)
199 && (m_writingMode == other.m_writingMode);
200 }
201
202 unsigned m_emptyCells : 1; // EEmptyCells
203 unsigned m_captionSide : 2; // ECaptionSide
204 unsigned m_listStyleType : 7; // EListStyleType
205 unsigned m_listStylePosition : 1; // EListStylePosition
206 unsigned m_visibility : 2; // EVisibility
207 unsigned m_textAlign : 4; // ETextAlign
208 unsigned m_textTransform : 2; // ETextTransform
209 unsigned m_textUnderline : 1;
210 unsigned m_cursorStyle : 6; // ECursor
211 unsigned m_direction : 1; // TextDirection
212 unsigned m_whiteSpace : 3; // EWhiteSpace
213 unsigned m_borderCollapse : 1; // EBorderCollapse
214 unsigned m_boxDirection : 1; // EBoxDirection (CSS3 box_direction proper ty, flexible box layout module)
215 // 32 bits
216
217 // non CSS2 inherited
218 unsigned m_rtlOrdering : 1; // Order
219 unsigned m_printColorAdjust : PrintColorAdjustBits;
220 unsigned m_pointerEvents : 4; // EPointerEvents
221 unsigned m_insideLink : 2; // EInsideLink
222
223 // CSS Text Layout Module Level 3: Vertical writing support
224 unsigned m_writingMode : 2; // WritingMode
225 // 42 bits
226 } m_inheritedData;
227
228 // don't inherit
229 struct NonInheritedData {
230 // Compare computed styles, differences in inherited bits or other flags
231 // should not cause an inequality.
232 bool operator==(const NonInheritedData& other) const
233 {
234 return m_effectiveDisplay == other.m_effectiveDisplay
235 && m_originalDisplay == other.m_originalDisplay
236 && m_overflowAnchor == other.m_overflowAnchor
237 && m_overflowX == other.m_overflowX
238 && m_overflowY == other.m_overflowY
239 && m_verticalAlign == other.m_verticalAlign
240 && m_clear == other.m_clear
241 && m_position == other.m_position
242 && m_floating == other.m_floating
243 && m_tableLayout == other.m_tableLayout
244 && m_unicodeBidi == other.m_unicodeBidi
245 // hasViewportUnits
246 && m_breakBefore == other.m_breakBefore
247 && m_breakAfter == other.m_breakAfter
248 && m_breakInside == other.m_breakInside;
249 // styleType
250 // pseudoBits
251 // explicitInheritance
252 // unique
253 // emptyState
254 // affectedByFocus
255 // affectedByHover
256 // affectedByActive
257 // affectedByDrag
258 // isLink
259 // isInherited flags
260 }
261
262 bool operator!=(const NonInheritedData& other) const { return !(*this == other); }
263
264 unsigned m_effectiveDisplay : 5; // EDisplay
265 unsigned m_originalDisplay : 5; // EDisplay
266 unsigned m_overflowAnchor : 2; // EOverflowAnchor
267 unsigned m_overflowX : 3; // EOverflow
268 unsigned m_overflowY : 3; // EOverflow
269 unsigned m_verticalAlign : 4; // EVerticalAlign
270 unsigned m_clear : 2; // EClear
271 unsigned m_position : 3; // EPosition
272 unsigned m_floating : 2; // EFloat
273 unsigned m_tableLayout : 1; // ETableLayout
274 unsigned m_unicodeBidi : 3; // EUnicodeBidi
275
276 // This is set if we used viewport units when resolving a length.
277 // It is mutable so we can pass around const ComputedStyles to resolve l engths.
278 mutable unsigned m_hasViewportUnits : 1;
279
280 // 32 bits
281
282 unsigned m_breakBefore : 4; // EBreak
283 unsigned m_breakAfter : 4; // EBreak
284 unsigned m_breakInside : 2; // EBreak
285
286 unsigned m_styleType : 6; // PseudoId
287 unsigned m_pseudoBits : 8;
288 unsigned m_explicitInheritance : 1; // Explicitly inherits a non-inherit ed property
289 unsigned m_variableReference : 1; // A non-inherited property references a variable or @apply is used.
290 unsigned m_unique : 1; // Style can not be shared.
291
292 unsigned m_emptyState : 1;
293
294 unsigned m_affectedByFocus : 1;
295 unsigned m_affectedByHover : 1;
296 unsigned m_affectedByActive : 1;
297 unsigned m_affectedByDrag : 1;
298
299 // 64 bits
300
301 unsigned m_isLink : 1;
302
303 mutable unsigned m_hasRemUnits : 1;
304
305
306 // For each independent inherited property, store a 1 if the stored
307 // value was inherited from its parent, or 0 if it is explicitly set on
308 // this element.
309 // Eventually, all properties will have a bit in here to store whether
310 // they were inherited from their parent or not.
311 // Although two ComputedStyles are equal if their nonInheritedData is
312 // equal regardless of the isInherited flags, this struct is stored next
313 // to the existing flags to take advantage of packing as much as possibl e.
314 // TODO(sashab): Move these flags closer to inheritedData so that it's
315 // clear which inherited properties have a flag stored and which don't.
316 // Keep this list of fields in sync with:
317 // - setBitDefaults()
318 // - The ComputedStyle setter, which must take an extra boolean paramete r and set this
319 // - propagateIndependentInheritedProperties() in ComputedStyle.cpp
320 // - The compareEqual() methods in the corresponding class
321 // InheritedFlags
322 unsigned m_isPointerEventsInherited : 1;
323 unsigned m_isVisibilityInherited : 1;
324
325 // If you add more style bits here, you will also need to update Compute dStyle::copyNonInheritedFromCached()
326 // 68 bits
327 } m_nonInheritedData;
328
329 // !END SYNC!
330
331 void setBitDefaults()
332 { 41 {
333 m_inheritedData.m_emptyCells = initialEmptyCells(); 42 if (m_rareInheritedData.visitedLinkTextFillColor() != v)
334 m_inheritedData.m_captionSide = initialCaptionSide(); 43 m_rareInheritedData.setVisitedLinkTextFillColor(v);
335 m_inheritedData.m_listStyleType = initialListStyleType();
336 m_inheritedData.m_listStylePosition = initialListStylePosition();
337 m_inheritedData.m_visibility = static_cast<unsigned>(initialVisibility() );
338 m_inheritedData.m_textAlign = initialTextAlign();
339 m_inheritedData.m_textTransform = initialTextTransform();
340 m_inheritedData.m_textUnderline = false;
341 m_inheritedData.m_cursorStyle = initialCursor();
342 m_inheritedData.m_direction = initialDirection();
343 m_inheritedData.m_whiteSpace = initialWhiteSpace();
344 m_inheritedData.m_borderCollapse = initialBorderCollapse();
345 m_inheritedData.m_rtlOrdering = initialRTLOrdering();
346 m_inheritedData.m_boxDirection = initialBoxDirection();
347 m_inheritedData.m_printColorAdjust = initialPrintColorAdjust();
348 m_inheritedData.m_pointerEvents = initialPointerEvents();
349 m_inheritedData.m_insideLink = NotInsideLink;
350 m_inheritedData.m_writingMode = initialWritingMode();
351
352 m_nonInheritedData.m_effectiveDisplay = m_nonInheritedData.m_originalDis play = initialDisplay();
353 m_nonInheritedData.m_overflowAnchor = initialOverflowAnchor();
354 m_nonInheritedData.m_overflowX = initialOverflowX();
355 m_nonInheritedData.m_overflowY = initialOverflowY();
356 m_nonInheritedData.m_verticalAlign = initialVerticalAlign();
357 m_nonInheritedData.m_clear = initialClear();
358 m_nonInheritedData.m_position = initialPosition();
359 m_nonInheritedData.m_floating = initialFloating();
360 m_nonInheritedData.m_tableLayout = initialTableLayout();
361 m_nonInheritedData.m_unicodeBidi = initialUnicodeBidi();
362 m_nonInheritedData.m_breakBefore = initialBreakBefore();
363 m_nonInheritedData.m_breakAfter = initialBreakAfter();
364 m_nonInheritedData.m_breakInside = initialBreakInside();
365 m_nonInheritedData.m_styleType = PseudoIdNone;
366 m_nonInheritedData.m_pseudoBits = 0;
367 m_nonInheritedData.m_explicitInheritance = false;
368 m_nonInheritedData.m_variableReference = false;
369 m_nonInheritedData.m_unique = false;
370 m_nonInheritedData.m_emptyState = false;
371 m_nonInheritedData.m_hasViewportUnits = false;
372 m_nonInheritedData.m_affectedByFocus = false;
373 m_nonInheritedData.m_affectedByHover = false;
374 m_nonInheritedData.m_affectedByActive = false;
375 m_nonInheritedData.m_affectedByDrag = false;
376 m_nonInheritedData.m_isLink = false;
377 m_nonInheritedData.m_hasRemUnits = false;
378
379 // All independently inherited properties default to being inherited.
380 m_nonInheritedData.m_isPointerEventsInherited = true;
381 m_nonInheritedData.m_isVisibilityInherited = true;
382 }
383
384 private:
385 // TODO(sashab): Move these to the bottom of ComputedStyle.
386 ALWAYS_INLINE ComputedStyle();
387
388 enum InitialStyleTag {
389 InitialStyle
390 };
391 ALWAYS_INLINE explicit ComputedStyle(InitialStyleTag);
392 ALWAYS_INLINE ComputedStyle(const ComputedStyle&);
393
394 static PassRefPtr<ComputedStyle> createInitialStyle();
395 static inline ComputedStyle& mutableInitialStyle()
396 {
397 LEAK_SANITIZER_DISABLED_SCOPE;
398 DEFINE_STATIC_REF(ComputedStyle, s_initialStyle, (ComputedStyle::createI nitialStyle()));
399 return *s_initialStyle;
400 }
401
402 public:
403 static PassRefPtr<ComputedStyle> create();
404 static PassRefPtr<ComputedStyle> createAnonymousStyleWithDisplay(const Compu tedStyle& parentStyle, EDisplay);
405 static PassRefPtr<ComputedStyle> clone(const ComputedStyle&);
406 static const ComputedStyle& initialStyle() { return mutableInitialStyle(); }
407 static void invalidateInitialStyle();
408
409 // Computes how the style change should be propagated down the tree.
410 static StyleRecalcChange stylePropagationDiff(const ComputedStyle* oldStyle, const ComputedStyle* newStyle);
411
412 // Copies the values of any independent inherited properties from the parent
413 // that are not explicitly set in this style.
414 void propagateIndependentInheritedProperties(const ComputedStyle& parentStyl e);
415
416 ContentPosition resolvedJustifyContentPosition(const StyleContentAlignmentDa ta& normalValueBehavior) const;
417 ContentDistributionType resolvedJustifyContentDistribution(const StyleConten tAlignmentData& normalValueBehavior) const;
418 ContentPosition resolvedAlignContentPosition(const StyleContentAlignmentData & normalValueBehavior) const;
419 ContentDistributionType resolvedAlignContentDistribution(const StyleContentA lignmentData& normalValueBehavior) const;
420 StyleSelfAlignmentData resolvedAlignItems(ItemPosition normalValueBehaviour) const;
421 StyleSelfAlignmentData resolvedAlignSelf(ItemPosition normalValueBehaviour, const ComputedStyle* parentStyle = nullptr) const;
422 StyleSelfAlignmentData resolvedJustifyItems(ItemPosition normalValueBehaviou r) const;
423 StyleSelfAlignmentData resolvedJustifySelf(ItemPosition normalValueBehaviour , const ComputedStyle* parentStyle = nullptr) const;
424
425 StyleDifference visualInvalidationDiff(const ComputedStyle&) const;
426
427 enum IsAtShadowBoundary {
428 AtShadowBoundary,
429 NotAtShadowBoundary,
430 };
431
432 void inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBoundary = No tAtShadowBoundary);
433 void copyNonInheritedFromCached(const ComputedStyle&);
434
435 PseudoId styleType() const { return static_cast<PseudoId>(m_nonInheritedData .m_styleType); }
436 void setStyleType(PseudoId styleType) { m_nonInheritedData.m_styleType = sty leType; }
437
438 ComputedStyle* getCachedPseudoStyle(PseudoId) const;
439 ComputedStyle* addCachedPseudoStyle(PassRefPtr<ComputedStyle>);
440 void removeCachedPseudoStyle(PseudoId);
441
442 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoSt yles.get(); }
443
444 /**
445 * ComputedStyle properties
446 *
447 * Each property stored in ComputedStyle is made up of fields. Fields have
448 * initial value functions, getters and setters. A field is preferably a
449 * basic data type or enum, but can be any type. A set of fields should be
450 * preceded by the property the field is stored for.
451 *
452 * Field method naming should be done like so:
453 * // name-of-property
454 * static int initialNameOfProperty();
455 * int nameOfProperty() const;
456 * void setNameOfProperty(int);
457 * If the property has multiple fields, add the field name to the end of the
458 * method name.
459 *
460 * Avoid nested types by splitting up fields where possible, e.g.:
461 * int getBorderTopWidth();
462 * int getBorderBottomWidth();
463 * int getBorderLeftWidth();
464 * int getBorderRightWidth();
465 * is preferable to:
466 * BorderWidths getBorderWidths();
467 *
468 * Utility functions should go in a separate section at the end of the
469 * class, and be kept to a minimum.
470 */
471
472 // Non-Inherited properties.
473
474 // Content alignment properties.
475 static StyleContentAlignmentData initialContentAlignment() { return StyleCon tentAlignmentData(RuntimeEnabledFeatures::cssGridLayoutEnabled() ? ContentPositi onNormal : ContentPositionFlexStart, ContentDistributionDefault, OverflowAlignme ntDefault); }
476
477 // align-content (aka -webkit-align-content)
478 const StyleContentAlignmentData& alignContent() const { return m_rareNonInhe ritedData->m_alignContent; }
479 void setAlignContent(const StyleContentAlignmentData& data) { SET_VAR(m_rare NonInheritedData, m_alignContent, data); }
480
481 // justify-content (aka -webkit-justify-content)
482 const StyleContentAlignmentData& justifyContent() const { return m_rareNonIn heritedData->m_justifyContent; }
483 void setJustifyContent(const StyleContentAlignmentData& data) { SET_VAR(m_ra reNonInheritedData, m_justifyContent, data); }
484
485 // Default-Alignment properties.
486 static StyleSelfAlignmentData initialDefaultAlignment() { return StyleSelfAl ignmentData(RuntimeEnabledFeatures::cssGridLayoutEnabled() ? ItemPositionNormal : ItemPositionStretch, OverflowAlignmentDefault); }
487
488 // align-items (aka -webkit-align-items)
489 const StyleSelfAlignmentData& alignItems() const { return m_rareNonInherited Data->m_alignItems; }
490 void setAlignItems(const StyleSelfAlignmentData& data) { SET_VAR(m_rareNonIn heritedData, m_alignItems, data); }
491
492 // justify-items
493 const StyleSelfAlignmentData& justifyItems() const { return m_rareNonInherit edData->m_justifyItems; }
494 void setJustifyItems(const StyleSelfAlignmentData& data) { SET_VAR(m_rareNon InheritedData, m_justifyItems, data); }
495
496 // Self-Alignment properties.
497 static StyleSelfAlignmentData initialSelfAlignment() { return StyleSelfAlign mentData(ItemPositionAuto, OverflowAlignmentDefault); }
498
499 // align-self (aka -webkit-align-self)
500 const StyleSelfAlignmentData& alignSelf() const { return m_rareNonInheritedD ata->m_alignSelf; }
501 void setAlignSelf(const StyleSelfAlignmentData& data) { SET_VAR(m_rareNonInh eritedData, m_alignSelf, data); }
502
503 // justify-self
504 const StyleSelfAlignmentData& justifySelf() const { return m_rareNonInherite dData->m_justifySelf; }
505 void setJustifySelf(const StyleSelfAlignmentData& data) { SET_VAR(m_rareNonI nheritedData, m_justifySelf, data); }
506
507 // Filter properties.
508
509 // backdrop-filter
510 static const FilterOperations& initialBackdropFilter();
511 const FilterOperations& backdropFilter() const { return m_rareNonInheritedDa ta->m_backdropFilter->m_operations; }
512 FilterOperations& mutableBackdropFilter() { return m_rareNonInheritedData.ac cess()->m_backdropFilter.access()->m_operations; }
513 bool hasBackdropFilter() const { return !m_rareNonInheritedData->m_backdropF ilter->m_operations.operations().isEmpty(); }
514 void setBackdropFilter(const FilterOperations& ops) { SET_NESTED_VAR(m_rareN onInheritedData, m_backdropFilter, m_operations, ops); }
515
516 // filter (aka -webkit-filter)
517 static const FilterOperations& initialFilter();
518 FilterOperations& mutableFilter() { return m_rareNonInheritedData.access()-> m_filter.access()->m_operations; }
519 const FilterOperations& filter() const { return m_rareNonInheritedData->m_fi lter->m_operations; }
520 bool hasFilter() const { return !m_rareNonInheritedData->m_filter->m_operati ons.operations().isEmpty(); }
521 void setFilter(const FilterOperations& ops) { SET_NESTED_VAR(m_rareNonInheri tedData, m_filter, m_operations, ops); }
522
523 // backface-visibility (aka -webkit-backface-visibility)
524 static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisi bilityVisible; }
525 EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfac eVisibility>(m_rareNonInheritedData->m_backfaceVisibility); }
526 void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(m_rareNonInherit edData, m_backfaceVisibility, b); }
527
528 // Background properties.
529 // background-color
530 static Color initialBackgroundColor() { return Color::transparent; }
531 void setBackgroundColor(const StyleColor& v) { SET_VAR(m_background, m_color , v); }
532
533 // background-image
534 bool hasBackgroundImage() const { return m_background->background().hasImage (); }
535 bool hasFixedBackgroundImage() const { return m_background->background().has FixedImage(); }
536 bool hasEntirelyFixedBackground() const;
537
538 // background-clip
539 EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background- >background().clip()); }
540
541 // Border properties.
542 // -webkit-border-image
543 static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
544 const NinePieceImage& borderImage() const { return m_surround->border.image( ); }
545 void setBorderImage(const NinePieceImage& b) { SET_VAR(m_surround, border.m_ image, b); }
546
547 // border-image-slice
548 const LengthBox& borderImageSlices() const { return m_surround->border.image ().imageSlices(); }
549 void setBorderImageSlices(const LengthBox&);
550
551 // border-image-source
552 static StyleImage* initialBorderImageSource() { return 0; }
553 StyleImage* borderImageSource() const { return m_surround->border.image().im age(); }
554 void setBorderImageSource(StyleImage*);
555
556 // border-image-width
557 const BorderImageLengthBox& borderImageWidth() const { return m_surround->bo rder.image().borderSlices(); }
558 void setBorderImageWidth(const BorderImageLengthBox&);
559
560 // border-image-outset
561 const BorderImageLengthBox& borderImageOutset() const { return m_surround->b order.image().outset(); }
562 void setBorderImageOutset(const BorderImageLengthBox&);
563
564 // Border width properties.
565 static unsigned initialBorderWidth() { return 3; }
566
567 // border-top-width
568 int borderTopWidth() const { return m_surround->border.borderTopWidth(); }
569 void setBorderTopWidth(unsigned v) { SET_VAR(m_surround, border.m_top.m_widt h, v); }
570
571 // border-bottom-width
572 int borderBottomWidth() const { return m_surround->border.borderBottomWidth( ); }
573 void setBorderBottomWidth(unsigned v) { SET_VAR(m_surround, border.m_bottom. m_width, v); }
574
575 // border-left-width
576 int borderLeftWidth() const { return m_surround->border.borderLeftWidth(); }
577 void setBorderLeftWidth(unsigned v) { SET_VAR(m_surround, border.m_left.m_wi dth, v); }
578
579 // border-right-width
580 int borderRightWidth() const { return m_surround->border.borderRightWidth(); }
581 void setBorderRightWidth(unsigned v) { SET_VAR(m_surround, border.m_right.m_ width, v); }
582
583 // Border style properties.
584 static EBorderStyle initialBorderStyle() { return BorderStyleNone; }
585
586 // border-top-style
587 EBorderStyle borderTopStyle() const { return m_surround->border.top().style( ); }
588 void setBorderTopStyle(EBorderStyle v) { SET_VAR(m_surround, border.m_top.m_ style, v); }
589
590 // border-right-style
591 EBorderStyle borderRightStyle() const { return m_surround->border.right().st yle(); }
592 void setBorderRightStyle(EBorderStyle v) { SET_VAR(m_surround, border.m_righ t.m_style, v); }
593
594 // border-left-style
595 EBorderStyle borderLeftStyle() const { return m_surround->border.left().styl e(); }
596 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(m_surround, border.m_left. m_style, v); }
597
598 // border-bottom-style
599 EBorderStyle borderBottomStyle() const { return m_surround->border.bottom(). style(); }
600 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(m_surround, border.m_bot tom.m_style, v); }
601
602 // Border color properties.
603 // border-left-color
604 void setBorderLeftColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_surro und, border.m_left, v); }
605
606 // border-right-color
607 void setBorderRightColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_surr ound, border.m_right, v); }
608
609 // border-top-color
610 void setBorderTopColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_surrou nd, border.m_top, v); }
611
612 // border-bottom-color
613 void setBorderBottomColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_sur round, border.m_bottom, v); }
614
615 // Border radius properties.
616 static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed) , Length(0, Fixed)); }
617
618 // border-top-left-radius (aka -webkit-border-top-left-radius)
619 const LengthSize& borderTopLeftRadius() const { return m_surround->border.to pLeft(); }
620 void setBorderTopLeftRadius(const LengthSize& s) { SET_VAR(m_surround, borde r.m_topLeft, s); }
621
622 // border-top-right-radius (aka -webkit-border-top-right-radius)
623 const LengthSize& borderTopRightRadius() const { return m_surround->border.t opRight(); }
624 void setBorderTopRightRadius(const LengthSize& s) { SET_VAR(m_surround, bord er.m_topRight, s); }
625
626 // border-bottom-left-radius (aka -webkit-border-bottom-left-radius)
627 const LengthSize& borderBottomLeftRadius() const { return m_surround->border .bottomLeft(); }
628 void setBorderBottomLeftRadius(const LengthSize& s) { SET_VAR(m_surround, bo rder.m_bottomLeft, s); }
629
630 // border-bottom-right-radius (aka -webkit-border-bottom-right-radius)
631 const LengthSize& borderBottomRightRadius() const { return m_surround->borde r.bottomRight(); }
632 void setBorderBottomRightRadius(const LengthSize& s) { SET_VAR(m_surround, b order.m_bottomRight, s); }
633
634 // Offset properties.
635 static Length initialOffset() { return Length(); }
636
637 // left
638 const Length& left() const { return m_surround->offset.left(); }
639 void setLeft(const Length& v) { SET_VAR(m_surround, offset.m_left, v); }
640
641 // right
642 const Length& right() const { return m_surround->offset.right(); }
643 void setRight(const Length& v) { SET_VAR(m_surround, offset.m_right, v); }
644
645 // top
646 const Length& top() const { return m_surround->offset.top(); }
647 void setTop(const Length& v) { SET_VAR(m_surround, offset.m_top, v); }
648
649 // bottom
650 const Length& bottom() const { return m_surround->offset.bottom(); }
651 void setBottom(const Length& v) { SET_VAR(m_surround, offset.m_bottom, v); }
652
653 // box-shadow (aka -webkit-box-shadow)
654 static ShadowList* initialBoxShadow() { return 0; }
655 ShadowList* boxShadow() const { return m_rareNonInheritedData->m_boxShadow.g et(); }
656 void setBoxShadow(PassRefPtr<ShadowList>);
657
658 // box-sizing (aka -webkit-box-sizing)
659 static EBoxSizing initialBoxSizing() { return BoxSizingContentBox; }
660 EBoxSizing boxSizing() const { return m_box->boxSizing(); }
661 void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
662
663 // clear
664 static EClear initialClear() { return ClearNone; }
665 EClear clear() const { return static_cast<EClear>(m_nonInheritedData.m_clear ); }
666 void setClear(EClear v) { m_nonInheritedData.m_clear = v; }
667
668 // Page break properties.
669 // break-after (shorthand for page-break-after and -webkit-column-break-afte r)
670 static EBreak initialBreakAfter() { return BreakAuto; }
671 EBreak breakAfter() const { return static_cast<EBreak>(m_nonInheritedData.m_ breakAfter); }
672 void setBreakAfter(EBreak b) { DCHECK_LE(b, BreakValueLastAllowedForBreakAft erAndBefore); m_nonInheritedData.m_breakAfter = b; }
673
674 // break-before (shorthand for page-break-before and -webkit-column-break-be fore)
675 static EBreak initialBreakBefore() { return BreakAuto; }
676 EBreak breakBefore() const { return static_cast<EBreak>(m_nonInheritedData.m _breakBefore); }
677 void setBreakBefore(EBreak b) { DCHECK_LE(b, BreakValueLastAllowedForBreakAf terAndBefore); m_nonInheritedData.m_breakBefore = b; }
678
679 // break-inside (shorthand for page-break-inside and -webkit-column-break-in side)
680 static EBreak initialBreakInside() { return BreakAuto; }
681 EBreak breakInside() const { return static_cast<EBreak>(m_nonInheritedData.m _breakInside); }
682 void setBreakInside(EBreak b) { DCHECK_LE(b, BreakValueLastAllowedForBreakIn side); m_nonInheritedData.m_breakInside = b; }
683
684 // clip
685 static LengthBox initialClip() { return LengthBox(); }
686 const LengthBox& clip() const { return m_visual->clip; }
687 void setClip(const LengthBox& box) { SET_VAR(m_visual, hasAutoClip, false); SET_VAR(m_visual, clip, box); }
688 bool hasAutoClip() const { return m_visual->hasAutoClip; }
689 void setHasAutoClip() { SET_VAR(m_visual, hasAutoClip, true); SET_VAR(m_visu al, clip, ComputedStyle::initialClip()); }
690
691 // Column properties.
692 // column-count (aka -webkit-column-count)
693 static unsigned short initialColumnCount() { return 1; }
694 unsigned short columnCount() const { return m_rareNonInheritedData->m_multiC ol->m_count; }
695 void setColumnCount(unsigned short c) { SET_NESTED_VAR(m_rareNonInheritedDat a, m_multiCol, m_autoCount, false); SET_NESTED_VAR(m_rareNonInheritedData, m_mul tiCol, m_count, c); }
696 bool hasAutoColumnCount() const { return m_rareNonInheritedData->m_multiCol- >m_autoCount; }
697 void setHasAutoColumnCount() { SET_NESTED_VAR(m_rareNonInheritedData, m_mult iCol, m_autoCount, true); SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_c ount, initialColumnCount()); }
698
699 // column-fill
700 static ColumnFill initialColumnFill() { return ColumnFillBalance; }
701 ColumnFill getColumnFill() const { return static_cast<ColumnFill>(m_rareNonI nheritedData->m_multiCol->m_fill); }
702 void setColumnFill(ColumnFill columnFill) { SET_NESTED_VAR(m_rareNonInherite dData, m_multiCol, m_fill, columnFill); }
703
704 // column-gap (aka -webkit-column-gap)
705 float columnGap() const { return m_rareNonInheritedData->m_multiCol->m_gap; }
706 void setColumnGap(float f) { SET_NESTED_VAR(m_rareNonInheritedData, m_multiC ol, m_normalGap, false); SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_ga p, f); }
707 bool hasNormalColumnGap() const { return m_rareNonInheritedData->m_multiCol- >m_normalGap; }
708 void setHasNormalColumnGap() { SET_NESTED_VAR(m_rareNonInheritedData, m_mult iCol, m_normalGap, true); SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_g ap, 0); }
709
710 // column-rule-color (aka -webkit-column-rule-color)
711 void setColumnRuleColor(const StyleColor& c) { SET_BORDERVALUE_COLOR(m_rareN onInheritedData.access()->m_multiCol, m_rule, c); }
712
713 // column-rule-style (aka -webkit-column-rule-style)
714 EBorderStyle columnRuleStyle() const { return m_rareNonInheritedData->m_mult iCol->m_rule.style(); }
715 void setColumnRuleStyle(EBorderStyle b) { SET_NESTED_VAR(m_rareNonInheritedD ata, m_multiCol, m_rule.m_style, b); }
716
717 // column-rule-width (aka -webkit-column-rule-width)
718 static unsigned short initialColumnRuleWidth() { return 3; }
719 unsigned short columnRuleWidth() const { return m_rareNonInheritedData->m_mu ltiCol->ruleWidth(); }
720 void setColumnRuleWidth(unsigned short w) { SET_NESTED_VAR(m_rareNonInherite dData, m_multiCol, m_rule.m_width, w); }
721
722 // column-span (aka -webkit-column-span)
723 static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
724 ColumnSpan getColumnSpan() const { return static_cast<ColumnSpan>(m_rareNonI nheritedData->m_multiCol->m_columnSpan); }
725 void setColumnSpan(ColumnSpan columnSpan) { SET_NESTED_VAR(m_rareNonInherite dData, m_multiCol, m_columnSpan, columnSpan); }
726
727 // column-width (aka -webkit-column-width)
728 float columnWidth() const { return m_rareNonInheritedData->m_multiCol->m_wid th; }
729 void setColumnWidth(float f) { SET_NESTED_VAR(m_rareNonInheritedData, m_mult iCol, m_autoWidth, false); SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_ width, f); }
730 bool hasAutoColumnWidth() const { return m_rareNonInheritedData->m_multiCol- >m_autoWidth; }
731 void setHasAutoColumnWidth() { SET_NESTED_VAR(m_rareNonInheritedData, m_mult iCol, m_autoWidth, true); SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_w idth, 0); }
732
733 // contain
734 static Containment initialContain() { return ContainsNone; }
735 Containment contain() const { return static_cast<Containment>(m_rareNonInher itedData->m_contain); }
736 void setContain(Containment contain) { SET_VAR(m_rareNonInheritedData, m_con tain, contain); }
737
738 // content
739 ContentData* contentData() const { return m_rareNonInheritedData->m_content. get(); }
740 void setContent(ContentData*);
741
742 // display
743 static EDisplay initialDisplay() { return INLINE; }
744 EDisplay display() const { return static_cast<EDisplay>(m_nonInheritedData.m _effectiveDisplay); }
745 EDisplay originalDisplay() const { return static_cast<EDisplay>(m_nonInherit edData.m_originalDisplay); }
746 void setDisplay(EDisplay v) { m_nonInheritedData.m_effectiveDisplay = v; }
747 void setOriginalDisplay(EDisplay v) { m_nonInheritedData.m_originalDisplay = v; }
748
749 // Flex properties.
750 // flex-basis (aka -webkit-flex-basis)
751 static Length initialFlexBasis() { return Length(Auto); }
752 const Length& flexBasis() const { return m_rareNonInheritedData->m_flexibleB ox->m_flexBasis; }
753 void setFlexBasis(const Length& length) { SET_NESTED_VAR(m_rareNonInheritedD ata, m_flexibleBox, m_flexBasis, length); }
754
755 // flex-direction (aka -webkit-flex-direction)
756 static EFlexDirection initialFlexDirection() { return FlowRow; }
757 EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(m_ rareNonInheritedData->m_flexibleBox->m_flexDirection); }
758 void setFlexDirection(EFlexDirection direction) { SET_NESTED_VAR(m_rareNonIn heritedData, m_flexibleBox, m_flexDirection, direction); }
759
760 // flex-grow (aka -webkit-flex-grow)
761 static float initialFlexGrow() { return 0; }
762 float flexGrow() const { return m_rareNonInheritedData->m_flexibleBox->m_fle xGrow; }
763 void setFlexGrow(float f) { SET_NESTED_VAR(m_rareNonInheritedData, m_flexibl eBox, m_flexGrow, f); }
764
765 // flex-shrink (aka -webkit-flex-shrink)
766 static float initialFlexShrink() { return 1; }
767 float flexShrink() const { return m_rareNonInheritedData->m_flexibleBox->m_f lexShrink; }
768 void setFlexShrink(float f) { SET_NESTED_VAR(m_rareNonInheritedData, m_flexi bleBox, m_flexShrink, f); }
769
770 // flex-wrap (aka -webkit-flex-wrap)
771 static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
772 EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(m_rareNonInherite dData->m_flexibleBox->m_flexWrap); }
773 void setFlexWrap(EFlexWrap w) { SET_NESTED_VAR(m_rareNonInheritedData, m_fle xibleBox, m_flexWrap, w); }
774
775 // -webkit-box-flex
776 static float initialBoxFlex() { return 0.0f; }
777 float boxFlex() const { return m_rareNonInheritedData->m_deprecatedFlexibleB ox->flex; }
778 void setBoxFlex(float f) { SET_NESTED_VAR(m_rareNonInheritedData, m_deprecat edFlexibleBox, flex, f); }
779
780 // -webkit-box-flex-group
781 static unsigned initialBoxFlexGroup() { return 1; }
782 unsigned boxFlexGroup() const { return m_rareNonInheritedData->m_deprecatedF lexibleBox->flexGroup; }
783 void setBoxFlexGroup(unsigned fg) { SET_NESTED_VAR(m_rareNonInheritedData, m _deprecatedFlexibleBox, flexGroup, fg); }
784
785 // -webkit-box-align
786 // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexb ox-20090723/#alignment
787 static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
788 EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(m_rareNon InheritedData->m_deprecatedFlexibleBox->align); }
789 void setBoxAlign(EBoxAlignment a) { SET_NESTED_VAR(m_rareNonInheritedData, m _deprecatedFlexibleBox, align, a); }
790
791 // -webkit-box-decoration-break
792 static EBoxDecorationBreak initialBoxDecorationBreak() { return BoxDecoratio nBreakSlice; }
793 EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecoration Break(); }
794 void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_box, m_boxDeco rationBreak, b); }
795
796 // -webkit-box-lines
797 static EBoxLines initialBoxLines() { return SINGLE; }
798 EBoxLines boxLines() const { return static_cast<EBoxLines>(m_rareNonInherite dData->m_deprecatedFlexibleBox->lines); }
799 void setBoxLines(EBoxLines lines) { SET_NESTED_VAR(m_rareNonInheritedData, m _deprecatedFlexibleBox, lines, lines); }
800
801 // -webkit-box-ordinal-group
802 static unsigned initialBoxOrdinalGroup() { return 1; }
803 unsigned boxOrdinalGroup() const { return m_rareNonInheritedData->m_deprecat edFlexibleBox->ordinalGroup; }
804 void setBoxOrdinalGroup(unsigned og) { SET_NESTED_VAR(m_rareNonInheritedData , m_deprecatedFlexibleBox, ordinalGroup, og); }
805
806 // -webkit-box-orient
807 static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
808 EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(m_rareNonInher itedData->m_deprecatedFlexibleBox->orient); }
809 void setBoxOrient(EBoxOrient o) { SET_NESTED_VAR(m_rareNonInheritedData, m_d eprecatedFlexibleBox, orient, o); }
810
811 // -webkit-box-pack
812 static EBoxPack initialBoxPack() { return BoxPackStart; }
813 EBoxPack boxPack() const { return static_cast<EBoxPack>(m_rareNonInheritedDa ta->m_deprecatedFlexibleBox->pack); }
814 void setBoxPack(EBoxPack p) { SET_NESTED_VAR(m_rareNonInheritedData, m_depre catedFlexibleBox, pack, p); }
815
816 // -webkit-box-reflect
817 static StyleReflection* initialBoxReflect() { return 0; }
818 StyleReflection* boxReflect() const { return m_rareNonInheritedData->m_boxRe flect.get(); }
819 void setBoxReflect(PassRefPtr<StyleReflection> reflect)
820 {
821 if (m_rareNonInheritedData->m_boxReflect != reflect)
822 m_rareNonInheritedData.access()->m_boxReflect = reflect;
823 }
824
825 // float
826 static EFloat initialFloating() { return NoFloat; }
827 EFloat floating() const { return static_cast<EFloat>(m_nonInheritedData.m_fl oating); }
828 void setFloating(EFloat v) { m_nonInheritedData.m_floating = v; }
829
830 // Grid properties.
831 static Vector<GridTrackSize> initialGridAutoRepeatTracks() { return Vector<G ridTrackSize>(); /* none */ }
832 static size_t initialGridAutoRepeatInsertionPoint() { return 0; }
833 static AutoRepeatType initialGridAutoRepeatType() { return NoAutoRepeat; }
834 static NamedGridLinesMap initialNamedGridColumnLines() { return NamedGridLin esMap(); }
835 static NamedGridLinesMap initialNamedGridRowLines() { return NamedGridLinesM ap(); }
836 static OrderedNamedGridLines initialOrderedNamedGridColumnLines() { return O rderedNamedGridLines(); }
837 static OrderedNamedGridLines initialOrderedNamedGridRowLines() { return Orde redNamedGridLines(); }
838 static NamedGridAreaMap initialNamedGridArea() { return NamedGridAreaMap(); }
839 static size_t initialNamedGridAreaCount() { return 0; }
840
841 // grid-auto-columns
842 static Vector<GridTrackSize> initialGridAutoColumns();
843 const Vector<GridTrackSize>& gridAutoColumns() const { return m_rareNonInher itedData->m_grid->m_gridAutoColumns; }
844 void setGridAutoColumns(const Vector<GridTrackSize>& trackSizeList) { SET_NE STED_VAR(m_rareNonInheritedData, m_grid, m_gridAutoColumns, trackSizeList); }
845
846 // grid-auto-flow
847 static GridAutoFlow initialGridAutoFlow() { return AutoFlowRow; }
848 void setGridAutoFlow(GridAutoFlow flow) { SET_NESTED_VAR(m_rareNonInheritedD ata, m_grid, m_gridAutoFlow, flow); }
849
850 // grid-auto-rows
851 static Vector<GridTrackSize> initialGridAutoRows();
852 const Vector<GridTrackSize>& gridAutoRows() const { return m_rareNonInherite dData->m_grid->m_gridAutoRows; }
853 void setGridAutoRows(const Vector<GridTrackSize>& trackSizeList) { SET_NESTE D_VAR(m_rareNonInheritedData, m_grid, m_gridAutoRows, trackSizeList); }
854
855 // grid-column-gap
856 static Length initialGridColumnGap() { return Length(Fixed); }
857 const Length& gridColumnGap() const { return m_rareNonInheritedData->m_grid- >m_gridColumnGap; }
858 void setGridColumnGap(const Length& v) { SET_NESTED_VAR(m_rareNonInheritedDa ta, m_grid, m_gridColumnGap, v); }
859
860 // grid-column-start
861 static GridPosition initialGridColumnStart() { return GridPosition(); /* aut o */ }
862 const GridPosition& gridColumnStart() const { return m_rareNonInheritedData- >m_gridItem->m_gridColumnStart; }
863 void setGridColumnStart(const GridPosition& columnStartPosition) { SET_NESTE D_VAR(m_rareNonInheritedData, m_gridItem, m_gridColumnStart, columnStartPosition ); }
864
865 // grid-column-end
866 static GridPosition initialGridColumnEnd() { return GridPosition(); /* auto */ }
867 const GridPosition& gridColumnEnd() const { return m_rareNonInheritedData->m _gridItem->m_gridColumnEnd; }
868 void setGridColumnEnd(const GridPosition& columnEndPosition) { SET_NESTED_VA R(m_rareNonInheritedData, m_gridItem, m_gridColumnEnd, columnEndPosition); }
869
870 // grid-row-gap
871 static Length initialGridRowGap() { return Length(Fixed); }
872 const Length& gridRowGap() const { return m_rareNonInheritedData->m_grid->m_ gridRowGap; }
873 void setGridRowGap(const Length& v) { SET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_gridRowGap, v); }
874
875 // grid-row-start
876 static GridPosition initialGridRowStart() { return GridPosition(); /* auto */ }
877 const GridPosition& gridRowStart() const { return m_rareNonInheritedData->m_ gridItem->m_gridRowStart; }
878 void setGridRowStart(const GridPosition& rowStartPosition) { SET_NESTED_VAR( m_rareNonInheritedData, m_gridItem, m_gridRowStart, rowStartPosition); }
879
880 // grid-row-end
881 static GridPosition initialGridRowEnd() { return GridPosition(); /* auto */ }
882 const GridPosition& gridRowEnd() const { return m_rareNonInheritedData->m_gr idItem->m_gridRowEnd; }
883 void setGridRowEnd(const GridPosition& rowEndPosition) { SET_NESTED_VAR(m_ra reNonInheritedData, m_gridItem, m_gridRowEnd, rowEndPosition); }
884
885 // grid-template-columns
886 static Vector<GridTrackSize> initialGridTemplateColumns() { return Vector<Gr idTrackSize>(); /* none */ }
887 const Vector<GridTrackSize>& gridTemplateColumns() const { return m_rareNonI nheritedData->m_grid->m_gridTemplateColumns; }
888 void setGridTemplateColumns(const Vector<GridTrackSize>& lengths) { SET_NEST ED_VAR(m_rareNonInheritedData, m_grid, m_gridTemplateColumns, lengths); }
889
890 // grid-template-rows
891 static Vector<GridTrackSize> initialGridTemplateRows() { return Vector<GridT rackSize>(); /* none */ }
892 const Vector<GridTrackSize>& gridTemplateRows() const { return m_rareNonInhe ritedData->m_grid->m_gridTemplateRows; }
893 void setGridTemplateRows(const Vector<GridTrackSize>& lengths) { SET_NESTED_ VAR(m_rareNonInheritedData, m_grid, m_gridTemplateRows, lengths); }
894
895 // Width/height properties.
896 static Length initialSize() { return Length(); }
897 static Length initialMaxSize() { return Length(MaxSizeNone); }
898 static Length initialMinSize() { return Length(); }
899
900 // width
901 const Length& width() const { return m_box->width(); }
902 void setWidth(const Length& v) { SET_VAR(m_box, m_width, v); }
903
904 // height
905 const Length& height() const { return m_box->height(); }
906 void setHeight(const Length& v) { SET_VAR(m_box, m_height, v); }
907
908 // max-width
909 const Length& maxWidth() const { return m_box->maxWidth(); }
910 void setMaxWidth(const Length& v) { SET_VAR(m_box, m_maxWidth, v); }
911
912 // max-height
913 const Length& maxHeight() const { return m_box->maxHeight(); }
914 void setMaxHeight(const Length& v) { SET_VAR(m_box, m_maxHeight, v); }
915
916 // min-width
917 const Length& minWidth() const { return m_box->minWidth(); }
918 void setMinWidth(const Length& v) { SET_VAR(m_box, m_minWidth, v); }
919
920 // min-height
921 const Length& minHeight() const { return m_box->minHeight(); }
922 void setMinHeight(const Length& v) { SET_VAR(m_box, m_minHeight, v); }
923
924 // image-orientation
925 static RespectImageOrientationEnum initialRespectImageOrientation() { return DoNotRespectImageOrientation; }
926 RespectImageOrientationEnum respectImageOrientation() const { return static_ cast<RespectImageOrientationEnum>(m_rareInheritedData->m_respectImageOrientation ); }
927 void setRespectImageOrientation(RespectImageOrientationEnum v) { SET_VAR(m_r areInheritedData, m_respectImageOrientation, v); }
928
929 // image-rendering
930 static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
931 EImageRendering imageRendering() const { return static_cast<EImageRendering> (m_rareInheritedData->m_imageRendering); }
932 void setImageRendering(EImageRendering v) { SET_VAR(m_rareInheritedData, m_i mageRendering, v); }
933
934 // isolation
935 static EIsolation initialIsolation() { return IsolationAuto; }
936 EIsolation isolation() const { return static_cast<EIsolation>(m_rareNonInher itedData->m_isolation); }
937 void setIsolation(EIsolation v) { m_rareNonInheritedData.access()->m_isolati on = v; }
938
939 // Margin properties.
940 static Length initialMargin() { return Length(Fixed); }
941
942 // margin-top
943 const Length& marginTop() const { return m_surround->margin.top(); }
944 void setMarginTop(const Length& v) { SET_VAR(m_surround, margin.m_top, v); }
945
946 // margin-bottom
947 const Length& marginBottom() const { return m_surround->margin.bottom(); }
948 void setMarginBottom(const Length& v) { SET_VAR(m_surround, margin.m_bottom, v); }
949
950 // margin-left
951 const Length& marginLeft() const { return m_surround->margin.left(); }
952 void setMarginLeft(const Length& v) { SET_VAR(m_surround, margin.m_left, v); }
953
954 // margin-right
955 const Length& marginRight() const { return m_surround->margin.right(); }
956 void setMarginRight(const Length& v) { SET_VAR(m_surround, margin.m_right, v ); }
957
958 // -webkit-margin-before-collapse (aka -webkit-margin-top-collapse)
959 static EMarginCollapse initialMarginBeforeCollapse() { return MarginCollapse Collapse; }
960 EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginColl apse>(m_rareNonInheritedData->marginAfterCollapse); }
961 void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(m_rareNonInherited Data, marginBeforeCollapse, c); }
962
963 // -webkit-margin-after-collapse (aka -webkit-margin-bottom-collapse)
964 static EMarginCollapse initialMarginAfterCollapse() { return MarginCollapseC ollapse; }
965 EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCol lapse>(m_rareNonInheritedData->marginBeforeCollapse); }
966 void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(m_rareNonInheritedD ata, marginAfterCollapse, c); }
967
968 // mix-blend-mode
969 static WebBlendMode initialBlendMode() { return WebBlendModeNormal; }
970 WebBlendMode blendMode() const { return static_cast<WebBlendMode>(m_rareNonI nheritedData->m_effectiveBlendMode); }
971 void setBlendMode(WebBlendMode v) { m_rareNonInheritedData.access()->m_effec tiveBlendMode = v; }
972
973 // motion-path
974 static StylePath* initialMotionPath() { return nullptr; }
975 StylePath* motionPath() const { return m_rareNonInheritedData->m_transform-> m_motion.m_path.get(); }
976 void setMotionPath(PassRefPtr<StylePath>);
977
978 // motion-offset
979 static Length initialMotionOffset() { return Length(0, Fixed); }
980 const Length& motionOffset() const { return m_rareNonInheritedData->m_transf orm->m_motion.m_offset; }
981 void setMotionOffset(const Length& motionOffset) { SET_NESTED_VAR(m_rareNonI nheritedData, m_transform, m_motion.m_offset, motionOffset); }
982
983 // motion-rotation
984 static StyleMotionRotation initialMotionRotation() { return StyleMotionRotat ion(0, MotionRotationAuto); }
985 const StyleMotionRotation& motionRotation() const { return m_rareNonInherite dData->m_transform->m_motion.m_rotation; }
986 void setMotionRotation(const StyleMotionRotation& motionRotation) { SET_NEST ED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_rotation, motionRotation) ; }
987
988 // object-fit
989 static ObjectFit initialObjectFit() { return ObjectFitFill; }
990 ObjectFit getObjectFit() const { return static_cast<ObjectFit>(m_rareNonInhe ritedData->m_objectFit); }
991 void setObjectFit(ObjectFit f) { SET_VAR(m_rareNonInheritedData, m_objectFit , f); }
992
993 // object-position
994 static LengthPoint initialObjectPosition() { return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); }
995 LengthPoint objectPosition() const { return m_rareNonInheritedData->m_object Position; }
996 void setObjectPosition(LengthPoint position) { SET_VAR(m_rareNonInheritedDat a, m_objectPosition, position); }
997
998 // opacity (aka -webkit-opacity)
999 static float initialOpacity() { return 1.0f; }
1000 float opacity() const { return m_rareNonInheritedData->opacity; }
1001 void setOpacity(float f) { float v = clampTo<float>(f, 0, 1); SET_VAR(m_rare NonInheritedData, opacity, v); }
1002
1003 // order (aka -webkit-order)
1004 static int initialOrder() { return 0; }
1005 int order() const { return m_rareNonInheritedData->m_order; }
1006 // 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.
1007 void setOrder(int o) { SET_VAR(m_rareNonInheritedData, m_order, max(std::num eric_limits<int>::min() + 2, o)); }
1008
1009 // Outline properties.
1010 // outline-color
1011 void setOutlineColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_backgrou nd, m_outline, v); }
1012
1013 // outline-style
1014 EBorderStyle outlineStyle() const { return m_background->outline().style(); }
1015 void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_sty le, v); }
1016 static OutlineIsAuto initialOutlineStyleIsAuto() { return OutlineIsAutoOff; }
1017 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto> (m_background->outline().isAuto()); }
1018 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_o utline.m_isAuto, isAuto); }
1019
1020 // outline-width
1021 static unsigned short initialOutlineWidth() { return 3; }
1022 int outlineWidth() const
1023 {
1024 if (m_background->outline().style() == BorderStyleNone)
1025 return 0;
1026 return m_background->outline().width();
1027 }
1028 void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_w idth, v); }
1029
1030 // outline-offset
1031 static int initialOutlineOffset() { return 0; }
1032 int outlineOffset() const
1033 {
1034 if (m_background->outline().style() == BorderStyleNone)
1035 return 0;
1036 return m_background->outline().offset();
1037 }
1038 void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); }
1039
1040 // Overflow properties.
1041 // overflow-anchor
1042 static EOverflowAnchor initialOverflowAnchor() { return AnchorAuto; }
1043 EOverflowAnchor overflowAnchor() const { return static_cast<EOverflowAnchor> (m_nonInheritedData.m_overflowAnchor); }
1044 void setOverflowAnchor(EOverflowAnchor v) { m_nonInheritedData.m_overflowAnc hor = v; }
1045
1046 // overflow-x
1047 static EOverflow initialOverflowX() { return OverflowVisible; }
1048 EOverflow overflowX() const { return static_cast<EOverflow>(m_nonInheritedDa ta.m_overflowX); }
1049 void setOverflowX(EOverflow v) { m_nonInheritedData.m_overflowX = v; }
1050
1051 // overflow-y
1052 static EOverflow initialOverflowY() { return OverflowVisible; }
1053 EOverflow overflowY() const { return static_cast<EOverflow>(m_nonInheritedDa ta.m_overflowY); }
1054 void setOverflowY(EOverflow v) { m_nonInheritedData.m_overflowY = v; }
1055
1056 // Padding properties.
1057 static Length initialPadding() { return Length(Fixed); }
1058
1059 // padding-bottom
1060 const Length& paddingBottom() const { return m_surround->padding.bottom(); }
1061 void setPaddingBottom(const Length& v) { SET_VAR(m_surround, padding.m_botto m, v); }
1062
1063 // padding-left
1064 const Length& paddingLeft() const { return m_surround->padding.left(); }
1065 void setPaddingLeft(const Length& v) { SET_VAR(m_surround, padding.m_left, v ); }
1066
1067 // padding-right
1068 const Length& paddingRight() const { return m_surround->padding.right(); }
1069 void setPaddingRight(const Length& v) { SET_VAR(m_surround, padding.m_right, v); }
1070
1071 // padding-top
1072 const Length& paddingTop() const { return m_surround->padding.top(); }
1073 void setPaddingTop(const Length& v) { SET_VAR(m_surround, padding.m_top, v); }
1074
1075 // perspective (aka -webkit-perspective)
1076 static float initialPerspective() { return 0; }
1077 float perspective() const { return m_rareNonInheritedData->m_perspective; }
1078 void setPerspective(float p) { SET_VAR(m_rareNonInheritedData, m_perspective , p); }
1079
1080 // perspective-origin (aka -webkit-perspective-origin)
1081 static LengthPoint initialPerspectiveOrigin() { return LengthPoint(Length(50 .0, Percent), Length(50.0, Percent)); }
1082 const LengthPoint& perspectiveOrigin() const { return m_rareNonInheritedData ->m_perspectiveOrigin; }
1083 void setPerspectiveOrigin(const LengthPoint& p) { SET_VAR(m_rareNonInherited Data, m_perspectiveOrigin, p); }
1084
1085 // -webkit-perspective-origin-x
1086 static Length initialPerspectiveOriginX() { return Length(50.0, Percent); }
1087 const Length& perspectiveOriginX() const { return perspectiveOrigin().x(); }
1088 void setPerspectiveOriginX(const Length& v) { setPerspectiveOrigin(LengthPoi nt(v, perspectiveOriginY())); }
1089
1090 // -webkit-perspective-origin-y
1091 static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
1092 const Length& perspectiveOriginY() const { return perspectiveOrigin().y(); }
1093 void setPerspectiveOriginY(const Length& v) { setPerspectiveOrigin(LengthPoi nt(perspectiveOriginX(), v)); }
1094
1095 // position
1096 static EPosition initialPosition() { return StaticPosition; }
1097 EPosition position() const { return static_cast<EPosition>(m_nonInheritedDat a.m_position); }
1098 void setPosition(EPosition v) { m_nonInheritedData.m_position = v; }
1099
1100 // resize
1101 static EResize initialResize() { return RESIZE_NONE; }
1102 EResize resize() const { return static_cast<EResize>(m_rareNonInheritedData- >m_resize); }
1103 void setResize(EResize r) { SET_VAR(m_rareNonInheritedData, m_resize, r); }
1104
1105 // Transform properties.
1106 // transform (aka -webkit-transform)
1107 static EmptyTransformOperations initialTransform() { return EmptyTransformOp erations(); }
1108 const TransformOperations& transform() const { return m_rareNonInheritedData ->m_transform->m_operations; }
1109 void setTransform(const TransformOperations& ops) { SET_NESTED_VAR(m_rareNon InheritedData, m_transform, m_operations, ops); }
1110
1111 // transform-origin (aka -webkit-transform-origin)
1112 static TransformOrigin initialTransformOrigin() { return TransformOrigin(Len gth(50.0, Percent), Length(50.0, Percent), 0); }
1113 const TransformOrigin& transformOrigin() const { return m_rareNonInheritedDa ta->m_transform->m_origin; }
1114 void setTransformOrigin(const TransformOrigin& o) { SET_NESTED_VAR(m_rareNon InheritedData, m_transform, m_origin, o); }
1115
1116 // transform-style (aka -webkit-transform-style)
1117 static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3D Flat; }
1118 ETransformStyle3D transformStyle3D() const { return static_cast<ETransformSt yle3D>(m_rareNonInheritedData->m_transformStyle3D); }
1119 void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(m_rareNonInheritedDa ta, m_transformStyle3D, b); }
1120
1121 // -webkit-transform-origin-x
1122 static Length initialTransformOriginX() { return Length(50.0, Percent); }
1123 const Length& transformOriginX() const { return transformOrigin().x(); }
1124 void setTransformOriginX(const Length& v) { setTransformOrigin(TransformOrig in(v, transformOriginY(), transformOriginZ())); }
1125
1126 // -webkit-transform-origin-y
1127 static Length initialTransformOriginY() { return Length(50.0, Percent); }
1128 const Length& transformOriginY() const { return transformOrigin().y(); }
1129 void setTransformOriginY(const Length& v) { setTransformOrigin(TransformOrig in(transformOriginX(), v, transformOriginZ())); }
1130
1131 // -webkit-transform-origin-z
1132 static float initialTransformOriginZ() { return 0; }
1133 float transformOriginZ() const { return transformOrigin().z(); }
1134 void setTransformOriginZ(float f) { setTransformOrigin(TransformOrigin(trans formOriginX(), transformOriginY(), f)); }
1135
1136 // Independent transform properties.
1137 // translate
1138 static PassRefPtr<TranslateTransformOperation> initialTranslate() { return T ranslateTransformOperation::create(Length(0, Fixed), Length(0, Fixed), 0, Transf ormOperation::Translate3D); }
1139 TranslateTransformOperation* translate() const { return m_rareNonInheritedDa ta->m_transform->m_translate.get(); }
1140 void setTranslate(PassRefPtr<TranslateTransformOperation> v) { m_rareNonInhe ritedData.access()->m_transform.access()->m_translate = v; }
1141
1142 // rotate
1143 static PassRefPtr<RotateTransformOperation> initialRotate() { return RotateT ransformOperation::create(0, 0, 1, 0, TransformOperation::Rotate3D); }
1144 RotateTransformOperation* rotate() const { return m_rareNonInheritedData->m_ transform->m_rotate.get(); }
1145 void setRotate(PassRefPtr<RotateTransformOperation> v) { m_rareNonInheritedD ata.access()->m_transform.access()->m_rotate = v; }
1146
1147 // scale
1148 static PassRefPtr<ScaleTransformOperation> initialScale() { return ScaleTran sformOperation::create(1, 1, 1, TransformOperation::Scale3D); }
1149 ScaleTransformOperation* scale() const { return m_rareNonInheritedData->m_tr ansform->m_scale.get(); }
1150 void setScale(PassRefPtr<ScaleTransformOperation> v) { m_rareNonInheritedDat a.access()->m_transform.access()->m_scale = v; }
1151
1152 // Scroll properties.
1153 // scroll-behavior
1154 static ScrollBehavior initialScrollBehavior() { return ScrollBehaviorAuto; }
1155 ScrollBehavior getScrollBehavior() const { return static_cast<ScrollBehavior >(m_rareNonInheritedData->m_scrollBehavior); }
1156 void setScrollBehavior(ScrollBehavior b) { SET_VAR(m_rareNonInheritedData, m _scrollBehavior, b); }
1157
1158 // scroll-snap-coordinate
1159 static Vector<LengthPoint> initialScrollSnapCoordinate() { return Vector<Len gthPoint>(); }
1160 const Vector<LengthPoint>& scrollSnapCoordinate() const { return m_rareNonIn heritedData->m_scrollSnap->m_coordinates; }
1161 void setScrollSnapCoordinate(const Vector<LengthPoint>& b) { SET_NESTED_VAR( m_rareNonInheritedData, m_scrollSnap, m_coordinates, b); }
1162
1163 // scroll-snap-destination
1164 static LengthPoint initialScrollSnapDestination() { return LengthPoint(Lengt h(0, Fixed), Length(0, Fixed)); }
1165 const LengthPoint& scrollSnapDestination() const { return m_rareNonInherited Data->m_scrollSnap->m_destination; }
1166 void setScrollSnapDestination(const LengthPoint& b) { SET_NESTED_VAR(m_rareN onInheritedData, m_scrollSnap, m_destination, b); }
1167
1168 // scroll-snap-points-x
1169 static ScrollSnapPoints initialScrollSnapPointsX() { return ScrollSnapPoints (); }
1170 const ScrollSnapPoints& scrollSnapPointsX() const { return m_rareNonInherite dData->m_scrollSnap->m_xPoints; }
1171 void setScrollSnapPointsX(const ScrollSnapPoints& b) { SET_NESTED_VAR(m_rare NonInheritedData, m_scrollSnap, m_xPoints, b); }
1172
1173 // scroll-snap-points-y
1174 static ScrollSnapPoints initialScrollSnapPointsY() { return ScrollSnapPoints (); }
1175 const ScrollSnapPoints& scrollSnapPointsY() const { return m_rareNonInherite dData->m_scrollSnap->m_yPoints; }
1176 void setScrollSnapPointsY(const ScrollSnapPoints& b) { SET_NESTED_VAR(m_rare NonInheritedData, m_scrollSnap, m_yPoints, b); }
1177
1178 // scroll-snap-type
1179 static ScrollSnapType initialScrollSnapType() { return ScrollSnapTypeNone; }
1180 ScrollSnapType getScrollSnapType() const { return static_cast<ScrollSnapType >(m_rareNonInheritedData->m_scrollSnapType); }
1181 void setScrollSnapType(ScrollSnapType b) { SET_VAR(m_rareNonInheritedData, m _scrollSnapType, b); }
1182
1183 // shape-image-threshold (aka -webkit-shape-image-threshold)
1184 static float initialShapeImageThreshold() { return 0; }
1185 float shapeImageThreshold() const { return m_rareNonInheritedData->m_shapeIm ageThreshold; }
1186 void setShapeImageThreshold(float shapeImageThreshold)
1187 {
1188 float clampedShapeImageThreshold = clampTo<float>(shapeImageThreshold, 0 , 1);
1189 SET_VAR(m_rareNonInheritedData, m_shapeImageThreshold, clampedShapeImage Threshold);
1190 }
1191
1192 // shape-margin (aka -webkit-shape-margin)
1193 static Length initialShapeMargin() { return Length(0, Fixed); }
1194 const Length& shapeMargin() const { return m_rareNonInheritedData->m_shapeMa rgin; }
1195 void setShapeMargin(const Length& shapeMargin) { SET_VAR(m_rareNonInheritedD ata, m_shapeMargin, shapeMargin); }
1196
1197 // shape-outside (aka -webkit-shape-outside)
1198 static ShapeValue* initialShapeOutside() { return 0; }
1199 ShapeValue* shapeOutside() const { return m_rareNonInheritedData->m_shapeOut side.get(); }
1200 void setShapeOutside(ShapeValue* value)
1201 {
1202 if (m_rareNonInheritedData->m_shapeOutside == value)
1203 return;
1204 m_rareNonInheritedData.access()->m_shapeOutside = value;
1205 }
1206
1207 // size
1208 const FloatSize& pageSize() const { return m_rareNonInheritedData->m_pageSiz e; }
1209 PageSizeType getPageSizeType() const { return static_cast<PageSizeType>(m_ra reNonInheritedData->m_pageSizeType); }
1210 void setPageSize(const FloatSize& s) { SET_VAR(m_rareNonInheritedData, m_pag eSize, s); }
1211 void setPageSizeType(PageSizeType t) { SET_VAR(m_rareNonInheritedData, m_pag eSizeType, t); }
1212 // table-layout
1213 static ETableLayout initialTableLayout() { return TableLayoutAuto; }
1214 ETableLayout tableLayout() const { return static_cast<ETableLayout>(m_nonInh eritedData.m_tableLayout); }
1215 void setTableLayout(ETableLayout v) { m_nonInheritedData.m_tableLayout = v; }
1216
1217 // Text decoration properties.
1218 // text-decoration-line
1219 static TextDecoration initialTextDecoration() { return TextDecorationNone; }
1220 TextDecoration getTextDecoration() const { return static_cast<TextDecoration >(m_visual->textDecoration); }
1221 void setTextDecoration(TextDecoration v) { SET_VAR(m_visual, textDecoration, v); }
1222
1223 // text-decoration-color
1224 void setTextDecorationColor(const StyleColor& c) { SET_VAR(m_rareNonInherite dData, m_textDecorationColor, c); }
1225
1226 // text-decoration-style
1227 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorat ionStyleSolid; }
1228 TextDecorationStyle getTextDecorationStyle() const { return static_cast<Text DecorationStyle>(m_rareNonInheritedData->m_textDecorationStyle); }
1229 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(m_rareNonInheri tedData, m_textDecorationStyle, v); }
1230
1231 // text-underline-position
1232 static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnd erlinePositionAuto; }
1233 TextUnderlinePosition getTextUnderlinePosition() const { return static_cast< TextUnderlinePosition>(m_rareInheritedData->m_textUnderlinePosition); }
1234 void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(m_rareInher itedData, m_textUnderlinePosition, v); }
1235
1236 // text-overflow
1237 static TextOverflow initialTextOverflow() { return TextOverflowClip; }
1238 TextOverflow getTextOverflow() const { return static_cast<TextOverflow>(m_ra reNonInheritedData->textOverflow); }
1239 void setTextOverflow(TextOverflow overflow) { SET_VAR(m_rareNonInheritedData , textOverflow, overflow); }
1240
1241 // touch-action
1242 static TouchAction initialTouchAction() { return TouchActionAuto; }
1243 TouchAction getTouchAction() const { return static_cast<TouchAction>(m_rareN onInheritedData->m_touchAction); }
1244 void setTouchAction(TouchAction t) { SET_VAR(m_rareNonInheritedData, m_touch Action, t); }
1245
1246 // unicode-bidi
1247 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
1248 EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(m_nonInh eritedData.m_unicodeBidi); }
1249 void setUnicodeBidi(EUnicodeBidi b) { m_nonInheritedData.m_unicodeBidi = b; }
1250
1251 // vertical-align
1252 static EVerticalAlign initialVerticalAlign() { return VerticalAlignBaseline; }
1253 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(m_ nonInheritedData.m_verticalAlign); }
1254 const Length& getVerticalAlignLength() const { return m_box->verticalAlign() ; }
1255 void setVerticalAlign(EVerticalAlign v) { m_nonInheritedData.m_verticalAlign = v; }
1256 void setVerticalAlignLength(const Length& length) { setVerticalAlign(Vertica lAlignLength); SET_VAR(m_box, m_verticalAlign, length); }
1257
1258 // will-change
1259 const Vector<CSSPropertyID>& willChangeProperties() const { return m_rareNon InheritedData->m_willChange->m_properties; }
1260 bool willChangeContents() const { return m_rareNonInheritedData->m_willChang e->m_contents; }
1261 bool willChangeScrollPosition() const { return m_rareNonInheritedData->m_wil lChange->m_scrollPosition; }
1262 bool subtreeWillChangeContents() const { return m_rareInheritedData->m_subtr eeWillChangeContents; }
1263 void setWillChangeProperties(const Vector<CSSPropertyID>& properties) { SET_ NESTED_VAR(m_rareNonInheritedData, m_willChange, m_properties, properties); }
1264 void setWillChangeContents(bool b) { SET_NESTED_VAR(m_rareNonInheritedData, m_willChange, m_contents, b); }
1265 void setWillChangeScrollPosition(bool b) { SET_NESTED_VAR(m_rareNonInherited Data, m_willChange, m_scrollPosition, b); }
1266 void setSubtreeWillChangeContents(bool b) { SET_VAR(m_rareInheritedData, m_s ubtreeWillChangeContents, b); }
1267
1268 // z-index
1269 int zIndex() const { return m_box->zIndex(); }
1270 bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
1271 void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_bo x, m_zIndex, v); }
1272 void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_b ox, m_zIndex, 0); }
1273
1274 // zoom
1275 static float initialZoom() { return 1.0f; }
1276 float zoom() const { return m_visual->m_zoom; }
1277 float effectiveZoom() const { return m_rareInheritedData->m_effectiveZoom; }
1278 bool setZoom(float);
1279 bool setEffectiveZoom(float);
1280
1281 // -webkit-app-region
1282 DraggableRegionMode getDraggableRegionMode() const { return m_rareNonInherit edData->m_draggableRegionMode; }
1283 void setDraggableRegionMode(DraggableRegionMode v) { SET_VAR(m_rareNonInheri tedData, m_draggableRegionMode, v); }
1284
1285 // -webkit-appearance
1286 static ControlPart initialAppearance() { return NoControlPart; }
1287 ControlPart appearance() const { return static_cast<ControlPart>(m_rareNonIn heritedData->m_appearance); }
1288 void setAppearance(ControlPart a) { SET_VAR(m_rareNonInheritedData, m_appear ance, a); }
1289
1290 // -webkit-clip-path
1291 static ClipPathOperation* initialClipPath() { return 0; }
1292 ClipPathOperation* clipPath() const { return m_rareNonInheritedData->m_clipP ath.get(); }
1293 void setClipPath(PassRefPtr<ClipPathOperation> operation)
1294 {
1295 if (m_rareNonInheritedData->m_clipPath != operation)
1296 m_rareNonInheritedData.access()->m_clipPath = operation;
1297 }
1298
1299 // Mask properties.
1300 // -webkit-mask-box-image-outset
1301 const BorderImageLengthBox& maskBoxImageOutset() const { return m_rareNonInh eritedData->m_maskBoxImage.outset(); }
1302 void setMaskBoxImageOutset(const BorderImageLengthBox& outset)
1303 {
1304 m_rareNonInheritedData.access()->m_maskBoxImage.setOutset(outset);
1305 }
1306
1307 // -webkit-mask-box-image-slice
1308 const LengthBox& maskBoxImageSlices() const { return m_rareNonInheritedData- >m_maskBoxImage.imageSlices(); }
1309 void setMaskBoxImageSlices(const LengthBox& slices)
1310 {
1311 m_rareNonInheritedData.access()->m_maskBoxImage.setImageSlices(slices);
1312 }
1313
1314 // -webkit-mask-box-image-source
1315 static StyleImage* initialMaskBoxImageSource() { return 0; }
1316 StyleImage* maskBoxImageSource() const { return m_rareNonInheritedData->m_ma skBoxImage.image(); }
1317 void setMaskBoxImageSource(StyleImage* v) { m_rareNonInheritedData.access()- >m_maskBoxImage.setImage(v); }
1318
1319 // -webkit-mask-box-image-width
1320 const BorderImageLengthBox& maskBoxImageWidth() const { return m_rareNonInhe ritedData->m_maskBoxImage.borderSlices(); }
1321 void setMaskBoxImageWidth(const BorderImageLengthBox& slices)
1322 {
1323 m_rareNonInheritedData.access()->m_maskBoxImage.setBorderSlices(slices);
1324 }
1325
1326 // Inherited properties.
1327
1328 // border-collapse
1329 static EBorderCollapse initialBorderCollapse() { return BorderCollapseSepara te; }
1330 EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse> (m_inheritedData.m_borderCollapse); }
1331 void setBorderCollapse(EBorderCollapse collapse) { m_inheritedData.m_borderC ollapse = collapse; }
1332
1333 // Border-spacing properties.
1334 // -webkit-border-horizontal-spacing
1335 static short initialHorizontalBorderSpacing() { return 0; }
1336 short horizontalBorderSpacing() const;
1337 void setHorizontalBorderSpacing(short);
1338
1339 // -webkit-border-vertical-spacing
1340 static short initialVerticalBorderSpacing() { return 0; }
1341 short verticalBorderSpacing() const;
1342 void setVerticalBorderSpacing(short);
1343
1344 // caption-side (aka -epub-caption-side)
1345 static ECaptionSide initialCaptionSide() { return CaptionSideTop; }
1346 ECaptionSide captionSide() const { return static_cast<ECaptionSide>(m_inheri tedData.m_captionSide); }
1347 void setCaptionSide(ECaptionSide v) { m_inheritedData.m_captionSide = v; }
1348
1349 // cursor
1350 static ECursor initialCursor() { return CURSOR_AUTO; }
1351 ECursor cursor() const { return static_cast<ECursor>(m_inheritedData.m_curso rStyle); }
1352 void setCursor(ECursor c) { m_inheritedData.m_cursorStyle = c; }
1353
1354 // direction
1355 static TextDirection initialDirection() { return LTR; }
1356 TextDirection direction() const { return static_cast<TextDirection>(m_inheri tedData.m_direction); }
1357 void setDirection(TextDirection v) { m_inheritedData.m_direction = v; }
1358
1359 // empty-cells
1360 static EEmptyCells initialEmptyCells() { return EmptyCellsShow; }
1361 EEmptyCells emptyCells() const { return static_cast<EEmptyCells>(m_inherited Data.m_emptyCells); }
1362 void setEmptyCells(EEmptyCells v) { m_inheritedData.m_emptyCells = v; }
1363
1364 // color
1365 static Color initialColor() { return Color::black; }
1366 void setColor(const Color&);
1367
1368 // hyphens
1369 static Hyphens initialHyphens() { return HyphensManual; }
1370 Hyphens getHyphens() const { return static_cast<Hyphens>(m_rareInheritedData ->hyphens); }
1371 void setHyphens(Hyphens h) { SET_VAR(m_rareInheritedData, hyphens, h); }
1372
1373 // -webkit-hyphenate-character
1374 static const AtomicString& initialHyphenationString() { return nullAtom; }
1375 const AtomicString& hyphenationString() const { return m_rareInheritedData-> hyphenationString; }
1376 void setHyphenationString(const AtomicString& h) { SET_VAR(m_rareInheritedDa ta, hyphenationString, h); }
1377
1378 // line-height
1379 static Length initialLineHeight() { return Length(-100.0, Percent); }
1380 Length lineHeight() const;
1381 void setLineHeight(const Length& specifiedLineHeight);
1382
1383 // List style properties.
1384 // list-style-type
1385 static EListStyleType initialListStyleType() { return Disc; }
1386 EListStyleType listStyleType() const { return static_cast<EListStyleType>(m_ inheritedData.m_listStyleType); }
1387 void setListStyleType(EListStyleType v) { m_inheritedData.m_listStyleType = v; }
1388
1389 // list-style-position
1390 static EListStylePosition initialListStylePosition() { return ListStylePosit ionOutside; }
1391 EListStylePosition listStylePosition() const { return static_cast<EListStyle Position>(m_inheritedData.m_listStylePosition); }
1392 void setListStylePosition(EListStylePosition v) { m_inheritedData.m_listStyl ePosition = v; }
1393
1394 // list-style-image
1395 static StyleImage* initialListStyleImage() { return 0; }
1396 StyleImage* listStyleImage() const;
1397 void setListStyleImage(StyleImage*);
1398
1399 // orphans
1400 static short initialOrphans() { return 2; }
1401 short orphans() const { return m_rareInheritedData->orphans; }
1402 void setOrphans(short o) { SET_VAR(m_rareInheritedData, orphans, o); }
1403
1404 // widows
1405 static short initialWidows() { return 2; }
1406 short widows() const { return m_rareInheritedData->widows; }
1407 void setWidows(short w) { SET_VAR(m_rareInheritedData, widows, w); }
1408
1409 // overflow-wrap (aka word-wrap)
1410 static EOverflowWrap initialOverflowWrap() { return NormalOverflowWrap; }
1411 EOverflowWrap overflowWrap() const { return static_cast<EOverflowWrap>(m_rar eInheritedData->overflowWrap); }
1412 void setOverflowWrap(EOverflowWrap b) { SET_VAR(m_rareInheritedData, overflo wWrap, b); }
1413
1414 // pointer-events
1415 static EPointerEvents initialPointerEvents() { return PE_AUTO; }
1416 EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(m_ inheritedData.m_pointerEvents); }
1417 void setPointerEvents(EPointerEvents p) { m_inheritedData.m_pointerEvents = p; }
1418 void setPointerEventsIsInherited(bool isInherited) { m_nonInheritedData.m_is PointerEventsInherited = isInherited; }
1419
1420 // quotes
1421 static QuotesData* initialQuotes() { return 0; }
1422 QuotesData* quotes() const { return m_rareInheritedData->quotes.get(); }
1423 void setQuotes(PassRefPtr<QuotesData>);
1424
1425 // snap-height
1426 uint8_t snapHeightPosition() const { return m_rareInheritedData->m_snapHeigh tPosition; }
1427 uint8_t snapHeightUnit() const { return m_rareInheritedData->m_snapHeightUni t; }
1428 void setSnapHeightPosition(uint8_t position) { SET_VAR(m_rareInheritedData, m_snapHeightPosition, position); }
1429 void setSnapHeightUnit(uint8_t unit) { SET_VAR(m_rareInheritedData, m_snapHe ightUnit, unit); }
1430
1431 // speak
1432 static ESpeak initialSpeak() { return SpeakNormal; }
1433 ESpeak speak() const { return static_cast<ESpeak>(m_rareInheritedData->speak ); }
1434 void setSpeak(ESpeak s) { SET_VAR(m_rareInheritedData, speak, s); }
1435
1436 // tab-size
1437 static TabSize initialTabSize() { return TabSize(8); }
1438 TabSize getTabSize() const { return m_rareInheritedData->m_tabSize; }
1439 void setTabSize(TabSize size) { SET_VAR(m_rareInheritedData, m_tabSize, size ); }
1440
1441 // text-align
1442 static ETextAlign initialTextAlign() { return TASTART; }
1443 ETextAlign textAlign() const { return static_cast<ETextAlign>(m_inheritedDat a.m_textAlign); }
1444 void setTextAlign(ETextAlign v) { m_inheritedData.m_textAlign = v; }
1445
1446 // text-align-last
1447 static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
1448 TextAlignLast getTextAlignLast() const { return static_cast<TextAlignLast>(m _rareInheritedData->m_textAlignLast); }
1449 void setTextAlignLast(TextAlignLast v) { SET_VAR(m_rareInheritedData, m_text AlignLast, v); }
1450
1451 // text-combine-upright (aka -webkit-text-combine, -epub-text-combine)
1452 static TextCombine initialTextCombine() { return TextCombineNone; }
1453 TextCombine getTextCombine() const { return static_cast<TextCombine>(m_rareI nheritedData->m_textCombine); }
1454 void setTextCombine(TextCombine v) { SET_VAR(m_rareInheritedData, m_textComb ine, v); }
1455
1456 // text-indent
1457 static Length initialTextIndent() { return Length(Fixed); }
1458 static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; }
1459 static TextIndentType initialTextIndentType() { return TextIndentNormal; }
1460 const Length& textIndent() const { return m_rareInheritedData->indent; }
1461 TextIndentLine getTextIndentLine() const { return static_cast<TextIndentLine >(m_rareInheritedData->m_textIndentLine); }
1462 TextIndentType getTextIndentType() const { return static_cast<TextIndentType >(m_rareInheritedData->m_textIndentType); }
1463 void setTextIndent(const Length& v) { SET_VAR(m_rareInheritedData, indent, v ); }
1464 void setTextIndentLine(TextIndentLine v) { SET_VAR(m_rareInheritedData, m_te xtIndentLine, v); }
1465 void setTextIndentType(TextIndentType v) { SET_VAR(m_rareInheritedData, m_te xtIndentType, v); }
1466
1467 // text-justify
1468 static TextJustify initialTextJustify() { return TextJustifyAuto; }
1469 TextJustify getTextJustify() const { return static_cast<TextJustify>(m_rareI nheritedData->m_textJustify); }
1470 void setTextJustify(TextJustify v) { SET_VAR(m_rareInheritedData, m_textJust ify, v); }
1471
1472 // text-orientation (aka -webkit-text-orientation, -epub-text-orientation)
1473 static TextOrientation initialTextOrientation() { return TextOrientationMixe d; }
1474 TextOrientation getTextOrientation() const { return static_cast<TextOrientat ion>(m_rareInheritedData->m_textOrientation); }
1475 bool setTextOrientation(TextOrientation);
1476
1477 // text-shadow
1478 static ShadowList* initialTextShadow() { return 0; }
1479 ShadowList* textShadow() const { return m_rareInheritedData->textShadow.get( ); }
1480 void setTextShadow(PassRefPtr<ShadowList>);
1481
1482 // text-size-adjust (aka -webkit-text-size-adjust)
1483 static TextSizeAdjust initialTextSizeAdjust() { return TextSizeAdjust::adjus tAuto(); }
1484 TextSizeAdjust getTextSizeAdjust() const { return m_rareInheritedData->m_tex tSizeAdjust; }
1485 void setTextSizeAdjust(TextSizeAdjust sizeAdjust) { SET_VAR(m_rareInheritedD ata, m_textSizeAdjust, sizeAdjust); }
1486
1487 // text-transform (aka -epub-text-transform)
1488 static ETextTransform initialTextTransform() { return TTNONE; }
1489 ETextTransform textTransform() const { return static_cast<ETextTransform>(m_ inheritedData.m_textTransform); }
1490 void setTextTransform(ETextTransform v) { m_inheritedData.m_textTransform = v; }
1491
1492 // visibility
1493 static EVisibility initialVisibility() { return EVisibility::Visible; }
1494 EVisibility visibility() const { return static_cast<EVisibility>(m_inherited Data.m_visibility); }
1495 void setVisibility(EVisibility v) { m_inheritedData.m_visibility = static_ca st<unsigned>(v); }
1496 void setVisibilityIsInherited(bool isInherited) { m_nonInheritedData.m_isVis ibilityInherited = isInherited; }
1497
1498 // white-space inherited
1499 static EWhiteSpace initialWhiteSpace() { return NORMAL; }
1500 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(m_inherited Data.m_whiteSpace); }
1501 void setWhiteSpace(EWhiteSpace v) { m_inheritedData.m_whiteSpace = v; }
1502
1503 // word-break inherited (aka -epub-word-break)
1504 static EWordBreak initialWordBreak() { return NormalWordBreak; }
1505 EWordBreak wordBreak() const { return static_cast<EWordBreak>(m_rareInherite dData->wordBreak); }
1506 void setWordBreak(EWordBreak b) { SET_VAR(m_rareInheritedData, wordBreak, b) ; }
1507
1508 // -webkit-line-break
1509 static LineBreak initialLineBreak() { return LineBreakAuto; }
1510 LineBreak getLineBreak() const { return static_cast<LineBreak>(m_rareInherit edData->lineBreak); }
1511 void setLineBreak(LineBreak b) { SET_VAR(m_rareInheritedData, lineBreak, b); }
1512
1513 // writing-mode (aka -webkit-writing-mode, -epub-writing-mode)
1514 static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
1515 WritingMode getWritingMode() const { return static_cast<WritingMode>(m_inher itedData.m_writingMode); }
1516 bool setWritingMode(WritingMode v)
1517 {
1518 if (v == getWritingMode())
1519 return false;
1520
1521 m_inheritedData.m_writingMode = v;
1522 return true;
1523 }
1524
1525 // Text emphasis properties.
1526 static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillF illed; }
1527 static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkN one; }
1528 static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom ; }
1529 TextEmphasisFill getTextEmphasisFill() const { return static_cast<TextEmphas isFill>(m_rareInheritedData->textEmphasisFill); }
1530 TextEmphasisMark getTextEmphasisMark() const;
1531 const AtomicString& textEmphasisCustomMark() const { return m_rareInheritedD ata->textEmphasisCustomMark; }
1532 const AtomicString& textEmphasisMarkString() const;
1533 void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(m_rareInheritedDat a, textEmphasisFill, fill); }
1534 void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(m_rareInheritedDat a, textEmphasisMark, mark); }
1535 void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(m_rareInh eritedData, textEmphasisCustomMark, mark); }
1536
1537 // -webkit-text-emphasis-color (aka -epub-text-emphasis-color)
1538 void setTextEmphasisColor(const StyleColor& c) { SET_VAR_WITH_SETTER(m_rareI nheritedData, textEmphasisColor, setTextEmphasisColor, c); }
1539
1540 // -webkit-text-emphasis-position
1541 static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmpha sisPositionOver; }
1542 TextEmphasisPosition getTextEmphasisPosition() const { return static_cast<Te xtEmphasisPosition>(m_rareInheritedData->textEmphasisPosition); }
1543 void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(m_rare InheritedData, textEmphasisPosition, position); }
1544
1545 // -webkit-box-direction
1546 static EBoxDirection initialBoxDirection() { return BNORMAL; }
1547 EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(m_inh eritedData.m_boxDirection); }
1548 void setBoxDirection(EBoxDirection d) { m_inheritedData.m_boxDirection = d; }
1549
1550 // -webkit-highlight
1551 static const AtomicString& initialHighlight() { return nullAtom; }
1552 const AtomicString& highlight() const { return m_rareInheritedData->highligh t; }
1553 void setHighlight(const AtomicString& h) { SET_VAR(m_rareInheritedData, high light, h); }
1554
1555 // -webkit-line-clamp
1556 static LineClampValue initialLineClamp() { return LineClampValue(); }
1557 const LineClampValue& lineClamp() const { return m_rareNonInheritedData->lin eClamp; }
1558 void setLineClamp(LineClampValue c) { SET_VAR(m_rareNonInheritedData, lineCl amp, c); }
1559
1560 // -webkit-print-color-adjust
1561 static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustE conomy; }
1562 PrintColorAdjust getPrintColorAdjust() const { return static_cast<PrintColor Adjust>(m_inheritedData.m_printColorAdjust); }
1563 void setPrintColorAdjust(PrintColorAdjust value) { m_inheritedData.m_printCo lorAdjust = value; }
1564
1565 // -webkit-rtl-ordering
1566 static Order initialRTLOrdering() { return LogicalOrder; }
1567 Order rtlOrdering() const { return static_cast<Order>(m_inheritedData.m_rtlO rdering); }
1568 void setRTLOrdering(Order o) { m_inheritedData.m_rtlOrdering = o; }
1569
1570 // -webkit-ruby-position
1571 static RubyPosition initialRubyPosition() { return RubyPositionBefore; }
1572 RubyPosition getRubyPosition() const { return static_cast<RubyPosition>(m_ra reInheritedData->m_rubyPosition); }
1573 void setRubyPosition(RubyPosition position) { SET_VAR(m_rareInheritedData, m _rubyPosition, position); }
1574
1575 // -webkit-tap-highlight-color
1576 static Color initialTapHighlightColor();
1577 Color tapHighlightColor() const { return m_rareInheritedData->tapHighlightCo lor; }
1578 void setTapHighlightColor(const Color& c) { SET_VAR(m_rareInheritedData, tap HighlightColor, c); }
1579
1580 // -webkit-text-fill-color
1581 void setTextFillColor(const StyleColor& c) { SET_VAR_WITH_SETTER(m_rareInher itedData, textFillColor, setTextFillColor, c); }
1582
1583 // -webkit-text-security
1584 static ETextSecurity initialTextSecurity() { return TSNONE; }
1585 ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(m_rar eInheritedData->textSecurity); }
1586 void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(m_rareInheritedD ata, textSecurity, aTextSecurity); }
1587
1588 // -webkit-text-stroke-color
1589 void setTextStrokeColor(const StyleColor& c) { SET_VAR_WITH_SETTER(m_rareInh eritedData, textStrokeColor, setTextStrokeColor, c); }
1590
1591 // -webkit-text-stroke-width
1592 static float initialTextStrokeWidth() { return 0; }
1593 float textStrokeWidth() const { return m_rareInheritedData->textStrokeWidth; }
1594 void setTextStrokeWidth(float w) { SET_VAR(m_rareInheritedData, textStrokeWi dth, w); }
1595
1596 // -webkit-user-drag
1597 static EUserDrag initialUserDrag() { return DRAG_AUTO; }
1598 EUserDrag userDrag() const { return static_cast<EUserDrag>(m_rareNonInherite dData->userDrag); }
1599 void setUserDrag(EUserDrag d) { SET_VAR(m_rareNonInheritedData, userDrag, d) ; }
1600
1601 // -webkit-user-modify
1602 static EUserModify initialUserModify() { return READ_ONLY; }
1603 EUserModify userModify() const { return static_cast<EUserModify>(m_rareInher itedData->userModify); }
1604 void setUserModify(EUserModify u) { SET_VAR(m_rareInheritedData, userModify, u); }
1605
1606 // -webkit-user-select
1607 static EUserSelect initialUserSelect() { return SELECT_TEXT; }
1608 EUserSelect userSelect() const { return static_cast<EUserSelect>(m_rareInher itedData->userSelect); }
1609 void setUserSelect(EUserSelect s) { SET_VAR(m_rareInheritedData, userSelect, s); }
1610
1611 // Font properties.
1612 const Font& font() const;
1613 void setFont(const Font&);
1614 const FontMetrics& getFontMetrics() const;
1615 const FontDescription& getFontDescription() const;
1616 bool setFontDescription(const FontDescription&);
1617
1618 // font-size
1619 int fontSize() const;
1620 float specifiedFontSize() const;
1621 float computedFontSize() const;
1622
1623 // font-size-adjust
1624 float fontSizeAdjust() const;
1625 bool hasFontSizeAdjust() const;
1626
1627 // font-weight
1628 FontWeight fontWeight() const;
1629
1630 // font-stretch
1631 FontStretch fontStretch() const;
1632
1633 // -webkit-locale
1634 const AtomicString& locale() const { return LayoutLocale::localeString(getFo ntDescription().locale()); }
1635
1636 // FIXME: Remove letter-spacing/word-spacing and replace them with respectiv e FontBuilder calls.
1637 // letter-spacing
1638 static float initialLetterWordSpacing() { return 0.0f; }
1639 float letterSpacing() const;
1640 void setLetterSpacing(float);
1641
1642 // word-spacing
1643 float wordSpacing() const;
1644 void setWordSpacing(float);
1645
1646 // SVG properties.
1647 const SVGComputedStyle& svgStyle() const { return *m_svgStyle.get(); }
1648 SVGComputedStyle& accessSVGStyle() { return *m_svgStyle.access(); }
1649
1650 // baseline-shift
1651 EBaselineShift baselineShift() const { return svgStyle().baselineShift(); }
1652 const Length& baselineShiftValue() const { return svgStyle().baselineShiftVa lue(); }
1653 void setBaselineShiftValue(const Length& value)
1654 {
1655 SVGComputedStyle& svgStyle = accessSVGStyle();
1656 svgStyle.setBaselineShift(BS_LENGTH);
1657 svgStyle.setBaselineShiftValue(value);
1658 }
1659
1660 // cx
1661 void setCx(const Length& cx) { accessSVGStyle().setCx(cx); }
1662
1663 // cy
1664 void setCy(const Length& cy) { accessSVGStyle().setCy(cy); }
1665
1666 // d
1667 void setD(PassRefPtr<StylePath> d) { accessSVGStyle().setD(std::move(d)); }
1668
1669 // x
1670 void setX(const Length& x) { accessSVGStyle().setX(x); }
1671
1672 // y
1673 void setY(const Length& y) { accessSVGStyle().setY(y); }
1674
1675 // r
1676 void setR(const Length& r) { accessSVGStyle().setR(r); }
1677
1678 // rx
1679 void setRx(const Length& rx) { accessSVGStyle().setRx(rx); }
1680
1681 // ry
1682 void setRy(const Length& ry) { accessSVGStyle().setRy(ry); }
1683
1684 // fill-opacity
1685 float fillOpacity() const { return svgStyle().fillOpacity(); }
1686 void setFillOpacity(float f) { accessSVGStyle().setFillOpacity(f); }
1687
1688 // Fill utiltiy functions.
1689 const SVGPaintType& fillPaintType() const { return svgStyle().fillPaintType( ); }
1690 Color fillPaintColor() const { return svgStyle().fillPaintColor(); }
1691
1692 // stop-color
1693 void setStopColor(const Color& c) { accessSVGStyle().setStopColor(c); }
1694
1695 // flood-color
1696 void setFloodColor(const Color& c) { accessSVGStyle().setFloodColor(c); }
1697
1698 // lighting-color
1699 void setLightingColor(const Color& c) { accessSVGStyle().setLightingColor(c) ; }
1700
1701 // flood-opacity
1702 float floodOpacity() const { return svgStyle().floodOpacity(); }
1703 void setFloodOpacity(float f) { accessSVGStyle().setFloodOpacity(f); }
1704
1705 // stop-opacity
1706 float stopOpacity() const { return svgStyle().stopOpacity(); }
1707 void setStopOpacity(float f) { accessSVGStyle().setStopOpacity(f); }
1708
1709 // stroke
1710 const SVGPaintType& strokePaintType() const { return svgStyle().strokePaintT ype(); }
1711 Color strokePaintColor() const { return svgStyle().strokePaintColor(); }
1712
1713 // stroke-dasharray
1714 SVGDashArray* strokeDashArray() const { return svgStyle().strokeDashArray(); }
1715 void setStrokeDashArray(PassRefPtr<SVGDashArray> array) { accessSVGStyle().s etStrokeDashArray(std::move(array)); }
1716
1717 // stroke-dashoffset
1718 const Length& strokeDashOffset() const { return svgStyle().strokeDashOffset( ); }
1719 void setStrokeDashOffset(const Length& d) { accessSVGStyle().setStrokeDashOf fset(d); }
1720
1721 // stroke-miterlimit
1722 float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); }
1723 void setStrokeMiterLimit(float f) { accessSVGStyle().setStrokeMiterLimit(f); }
1724
1725 // stroke-opacity
1726 float strokeOpacity() const { return svgStyle().strokeOpacity(); }
1727 void setStrokeOpacity(float f) { accessSVGStyle().setStrokeOpacity(f); }
1728
1729 // stroke-width
1730 const UnzoomedLength& strokeWidth() const { return svgStyle().strokeWidth(); }
1731 void setStrokeWidth(const UnzoomedLength& w) { accessSVGStyle().setStrokeWid th(w); }
1732
1733 // Comparison operators
1734 bool operator==(const ComputedStyle& other) const;
1735 bool operator!=(const ComputedStyle& other) const { return !(*this == other) ; }
1736
1737 bool inheritedEqual(const ComputedStyle&) const;
1738 bool nonInheritedEqual(const ComputedStyle&) const;
1739 inline bool independentInheritedEqual(const ComputedStyle&) const;
1740 inline bool nonIndependentInheritedEqual(const ComputedStyle&) const;
1741 bool loadingCustomFontsEqual(const ComputedStyle&) const;
1742 bool inheritedDataShared(const ComputedStyle&) const;
1743
1744 bool hasChildDependentFlags() const { return emptyState() || hasExplicitlyIn heritedProperties(); }
1745 void copyChildDependentFlagsFrom(const ComputedStyle&);
1746
1747 // Counters.
1748 const CounterDirectiveMap* counterDirectives() const;
1749 CounterDirectiveMap& accessCounterDirectives();
1750 const CounterDirectives getCounterDirectives(const AtomicString& identifier) const;
1751 void clearIncrementDirectives();
1752 void clearResetDirectives();
1753
1754 // Variables.
1755 static StyleVariableData* initialVariables() { return nullptr; }
1756 StyleVariableData* variables() const;
1757 void setVariable(const AtomicString&, PassRefPtr<CSSVariableData>);
1758 void removeVariable(const AtomicString&);
1759 void setHasVariableReferenceFromNonInheritedProperty() { m_nonInheritedData. m_variableReference = true; }
1760 bool hasVariableReferenceFromNonInheritedProperty() const { return m_nonInhe ritedData.m_variableReference; }
1761
1762 // Call these after setting the CSSVariableData
1763 void setRegisteredInheritedProperty(const AtomicString&, const CSSValue*);
1764
1765 // Animations.
1766 CSSAnimationData& accessAnimations();
1767 const CSSAnimationData* animations() const { return m_rareNonInheritedData-> m_animations.get(); }
1768
1769 // Transitions.
1770 const CSSTransitionData* transitions() const { return m_rareNonInheritedData ->m_transitions.get(); }
1771 CSSTransitionData& accessTransitions();
1772
1773 // Callback selectors.
1774 const Vector<String>& callbackSelectors() const { return m_rareNonInheritedD ata->m_callbackSelectors; }
1775 void addCallbackSelector(const String& selector);
1776
1777 // Non-property flags.
1778 bool hasViewportUnits() const { return m_nonInheritedData.m_hasViewportUnits ; }
1779 void setHasViewportUnits(bool hasViewportUnits = true) const { m_nonInherite dData.m_hasViewportUnits = hasViewportUnits; }
1780
1781 bool hasRemUnits() const { return m_nonInheritedData.m_hasRemUnits; }
1782 void setHasRemUnits() const { m_nonInheritedData.m_hasRemUnits = true; }
1783
1784 bool affectedByFocus() const { return m_nonInheritedData.m_affectedByFocus; }
1785 void setAffectedByFocus() { m_nonInheritedData.m_affectedByFocus = true; }
1786
1787 bool affectedByHover() const { return m_nonInheritedData.m_affectedByHover; }
1788 void setAffectedByHover() { m_nonInheritedData.m_affectedByHover = true; }
1789
1790 bool affectedByActive() const { return m_nonInheritedData.m_affectedByActive ; }
1791 void setAffectedByActive() { m_nonInheritedData.m_affectedByActive = true; }
1792
1793 bool affectedByDrag() const { return m_nonInheritedData.m_affectedByDrag; }
1794 void setAffectedByDrag() { m_nonInheritedData.m_affectedByDrag = true; }
1795
1796 bool emptyState() const { return m_nonInheritedData.m_emptyState; }
1797 void setEmptyState(bool b) { setUnique(); m_nonInheritedData.m_emptyState = b; }
1798
1799 bool hasInlineTransform() const { return m_rareNonInheritedData->m_hasInline Transform; }
1800 void setHasInlineTransform(bool b) { SET_VAR(m_rareNonInheritedData, m_hasIn lineTransform, b); }
1801
1802 bool hasCompositorProxy() const { return m_rareNonInheritedData->m_hasCompos itorProxy; }
1803 void setHasCompositorProxy(bool b) { SET_VAR(m_rareNonInheritedData, m_hasCo mpositorProxy, b); }
1804
1805 bool isLink() const { return m_nonInheritedData.m_isLink; }
1806 void setIsLink(bool b) { m_nonInheritedData.m_isLink = b; }
1807
1808 EInsideLink insideLink() const { return static_cast<EInsideLink>(m_inherited Data.m_insideLink); }
1809 void setInsideLink(EInsideLink insideLink) { m_inheritedData.m_insideLink = insideLink; }
1810
1811 bool hasExplicitlyInheritedProperties() const { return m_nonInheritedData.m_ explicitInheritance; }
1812 void setHasExplicitlyInheritedProperties() { m_nonInheritedData.m_explicitIn heritance = true; }
1813
1814 bool requiresAcceleratedCompositingForExternalReasons(bool b) { return m_rar eNonInheritedData->m_requiresAcceleratedCompositingForExternalReasons; }
1815 void setRequiresAcceleratedCompositingForExternalReasons(bool b) { SET_VAR(m _rareNonInheritedData, m_requiresAcceleratedCompositingForExternalReasons, b); }
1816
1817 bool hasAuthorBackground() const { return m_rareNonInheritedData->m_hasAutho rBackground; };
1818 void setHasAuthorBackground(bool authorBackground) { SET_VAR(m_rareNonInheri tedData, m_hasAuthorBackground, authorBackground); }
1819
1820 bool hasAuthorBorder() const { return m_rareNonInheritedData->m_hasAuthorBor der; };
1821 void setHasAuthorBorder(bool authorBorder) { SET_VAR(m_rareNonInheritedData, m_hasAuthorBorder, authorBorder); }
1822
1823 // A stacking context is painted atomically and defines a stacking order, wh ereas
1824 // a containing stacking context defines in which order the stacking context s
1825 // below are painted.
1826 // See CSS 2.1, Appendix E (https://www.w3.org/TR/CSS21/zindex.html) for mor e details.
1827 bool isStackingContext() const { return m_rareNonInheritedData->m_isStacking Context; }
1828 void setIsStackingContext(bool b) { SET_VAR(m_rareNonInheritedData, m_isStac kingContext, b); }
1829
1830 // A unique style is one that has matches something that makes it impossible to share.
1831 bool unique() const { return m_nonInheritedData.m_unique; }
1832 void setUnique() { m_nonInheritedData.m_unique = true; }
1833
1834 float textAutosizingMultiplier() const { return m_styleInheritedData->textAu tosizingMultiplier; }
1835 void setTextAutosizingMultiplier(float);
1836
1837 bool selfOrAncestorHasDirAutoAttribute() const { return m_rareInheritedData- >m_selfOrAncestorHasDirAutoAttribute; }
1838 void setSelfOrAncestorHasDirAutoAttribute(bool v) { SET_VAR(m_rareInheritedD ata, m_selfOrAncestorHasDirAutoAttribute, v); }
1839
1840 // Animation flags.
1841 bool hasCurrentOpacityAnimation() const { return m_rareNonInheritedData->m_h asCurrentOpacityAnimation; }
1842 void setHasCurrentOpacityAnimation(bool b = true) { SET_VAR(m_rareNonInherit edData, m_hasCurrentOpacityAnimation, b); }
1843
1844 bool hasCurrentTransformAnimation() const { return m_rareNonInheritedData->m _hasCurrentTransformAnimation; }
1845 void setHasCurrentTransformAnimation(bool b = true) { SET_VAR(m_rareNonInher itedData, m_hasCurrentTransformAnimation, b); }
1846
1847 bool hasCurrentFilterAnimation() const { return m_rareNonInheritedData->m_ha sCurrentFilterAnimation; }
1848 void setHasCurrentFilterAnimation(bool b = true) { SET_VAR(m_rareNonInherite dData, m_hasCurrentFilterAnimation, b); }
1849
1850 bool hasCurrentBackdropFilterAnimation() const { return m_rareNonInheritedDa ta->m_hasCurrentBackdropFilterAnimation; }
1851 void setHasCurrentBackdropFilterAnimation(bool b = true) { SET_VAR(m_rareNon InheritedData, m_hasCurrentBackdropFilterAnimation, b); }
1852
1853 bool isRunningOpacityAnimationOnCompositor() const { return m_rareNonInherit edData->m_runningOpacityAnimationOnCompositor; }
1854 void setIsRunningOpacityAnimationOnCompositor(bool b = true) { SET_VAR(m_rar eNonInheritedData, m_runningOpacityAnimationOnCompositor, b); }
1855
1856 bool isRunningTransformAnimationOnCompositor() const { return m_rareNonInher itedData->m_runningTransformAnimationOnCompositor; }
1857 void setIsRunningTransformAnimationOnCompositor(bool b = true) { SET_VAR(m_r areNonInheritedData, m_runningTransformAnimationOnCompositor, b); }
1858
1859 bool isRunningFilterAnimationOnCompositor() const { return m_rareNonInherite dData->m_runningFilterAnimationOnCompositor; }
1860 void setIsRunningFilterAnimationOnCompositor(bool b = true) { SET_VAR(m_rare NonInheritedData, m_runningFilterAnimationOnCompositor, b); }
1861
1862 bool isRunningBackdropFilterAnimationOnCompositor() const { return m_rareNon InheritedData->m_runningBackdropFilterAnimationOnCompositor; }
1863 void setIsRunningBackdropFilterAnimationOnCompositor(bool b = true) { SET_VA R(m_rareNonInheritedData, m_runningBackdropFilterAnimationOnCompositor, b); }
1864
1865 // Column utility functions.
1866 void clearMultiCol();
1867 bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColu mnWidth(); }
1868 bool columnRuleIsTransparent() const { return m_rareNonInheritedData->m_mult iCol->m_rule.isTransparent(); }
1869 bool columnRuleEquivalent(const ComputedStyle* otherStyle) const;
1870 void inheritColumnPropertiesFrom(const ComputedStyle& parent) { m_rareNonInh eritedData.access()->m_multiCol = parent.m_rareNonInheritedData->m_multiCol; }
1871
1872 // Flex utility functions.
1873 bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
1874 bool isReverseFlexDirection() const { return flexDirection() == FlowRowRever se || flexDirection() == FlowColumnReverse; }
1875 bool hasBoxReflect() const { return boxReflect(); }
1876 bool reflectionDataEquivalent(const ComputedStyle* otherStyle) const { retur n m_rareNonInheritedData->reflectionDataEquivalent(*otherStyle->m_rareNonInherit edData); }
1877
1878 // Mask utility functions.
1879 bool hasMask() const { return m_rareNonInheritedData->m_mask.hasImage() || m _rareNonInheritedData->m_maskBoxImage.hasImage(); }
1880 StyleImage* maskImage() const { return m_rareNonInheritedData->m_mask.image( ); }
1881 FillLayer& accessMaskLayers() { return m_rareNonInheritedData.access()->m_ma sk; }
1882 const FillLayer& maskLayers() const { return m_rareNonInheritedData->m_mask; }
1883 const NinePieceImage& maskBoxImage() const { return m_rareNonInheritedData-> m_maskBoxImage; }
1884 bool maskBoxImageSlicesFill() const { return m_rareNonInheritedData->m_maskB oxImage.fill(); }
1885 void adjustMaskLayers()
1886 {
1887 if (maskLayers().next()) {
1888 accessMaskLayers().cullEmptyLayers();
1889 accessMaskLayers().fillUnsetProperties();
1890 }
1891 }
1892 void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(m_rareNonInheritedDa ta, m_maskBoxImage, b); }
1893 void setMaskBoxImageSlicesFill(bool fill)
1894 {
1895 m_rareNonInheritedData.access()->m_maskBoxImage.setFill(fill);
1896 }
1897
1898 // Text-combine utility functions.
1899 bool hasTextCombine() const { return getTextCombine() != TextCombineNone; }
1900
1901 // Grid utility functions.
1902 const Vector<GridTrackSize>& gridAutoRepeatColumns() const { return m_rareNo nInheritedData->m_grid->m_gridAutoRepeatColumns; }
1903 const Vector<GridTrackSize>& gridAutoRepeatRows() const { return m_rareNonIn heritedData->m_grid->m_gridAutoRepeatRows; }
1904 size_t gridAutoRepeatColumnsInsertionPoint() const { return m_rareNonInherit edData->m_grid->m_autoRepeatColumnsInsertionPoint; }
1905 size_t gridAutoRepeatRowsInsertionPoint() const { return m_rareNonInheritedD ata->m_grid->m_autoRepeatRowsInsertionPoint; }
1906 AutoRepeatType gridAutoRepeatColumnsType() const { return m_rareNonInherite dData->m_grid->m_autoRepeatColumnsType; }
1907 AutoRepeatType gridAutoRepeatRowsType() const { return m_rareNonInheritedDa ta->m_grid->m_autoRepeatRowsType; }
1908 const NamedGridLinesMap& namedGridColumnLines() const { return m_rareNonInhe ritedData->m_grid->m_namedGridColumnLines; }
1909 const NamedGridLinesMap& namedGridRowLines() const { return m_rareNonInherit edData->m_grid->m_namedGridRowLines; }
1910 const OrderedNamedGridLines& orderedNamedGridColumnLines() const { return m_ rareNonInheritedData->m_grid->m_orderedNamedGridColumnLines; }
1911 const OrderedNamedGridLines& orderedNamedGridRowLines() const { return m_rar eNonInheritedData->m_grid->m_orderedNamedGridRowLines; }
1912 const NamedGridLinesMap& autoRepeatNamedGridColumnLines() const { return m_r areNonInheritedData->m_grid->m_autoRepeatNamedGridColumnLines; }
1913 const NamedGridLinesMap& autoRepeatNamedGridRowLines() const { return m_rare NonInheritedData->m_grid->m_autoRepeatNamedGridRowLines; }
1914 const OrderedNamedGridLines& autoRepeatOrderedNamedGridColumnLines() const { return m_rareNonInheritedData->m_grid->m_autoRepeatOrderedNamedGridColumnLines; }
1915 const OrderedNamedGridLines& autoRepeatOrderedNamedGridRowLines() const { re turn m_rareNonInheritedData->m_grid->m_autoRepeatOrderedNamedGridRowLines; }
1916 const NamedGridAreaMap& namedGridArea() const { return m_rareNonInheritedDat a->m_grid->m_namedGridArea; }
1917 size_t namedGridAreaRowCount() const { return m_rareNonInheritedData->m_grid ->m_namedGridAreaRowCount; }
1918 size_t namedGridAreaColumnCount() const { return m_rareNonInheritedData->m_g rid->m_namedGridAreaColumnCount; }
1919 GridAutoFlow getGridAutoFlow() const { return static_cast<GridAutoFlow>(m_ra reNonInheritedData->m_grid->m_gridAutoFlow); }
1920 bool isGridAutoFlowDirectionRow() const { return (m_rareNonInheritedData->m_ grid->m_gridAutoFlow & InternalAutoFlowDirectionRow) == InternalAutoFlowDirectio nRow; }
1921 bool isGridAutoFlowDirectionColumn() const { return (m_rareNonInheritedData- >m_grid->m_gridAutoFlow & InternalAutoFlowDirectionColumn) == InternalAutoFlowDi rectionColumn; }
1922 bool isGridAutoFlowAlgorithmSparse() const { return (m_rareNonInheritedData- >m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmSparse) == InternalAutoFlowAl gorithmSparse; }
1923 bool isGridAutoFlowAlgorithmDense() const { return (m_rareNonInheritedData-> m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmDense) == InternalAutoFlowAlgo rithmDense; }
1924 void setGridAutoRepeatColumns(const Vector<GridTrackSize>& trackSizes) { SET _NESTED_VAR(m_rareNonInheritedData, m_grid, m_gridAutoRepeatColumns, trackSizes) ; }
1925 void setGridAutoRepeatRows(const Vector<GridTrackSize>& trackSizes) { SET_NE STED_VAR(m_rareNonInheritedData, m_grid, m_gridAutoRepeatRows, trackSizes); }
1926 void setGridAutoRepeatColumnsInsertionPoint(const size_t insertionPoint) { S ET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_autoRepeatColumnsInsertionPoint, insertionPoint); }
1927 void setGridAutoRepeatRowsInsertionPoint(const size_t insertionPoint) { SET_ NESTED_VAR(m_rareNonInheritedData, m_grid, m_autoRepeatRowsInsertionPoint, inser tionPoint); }
1928 void setGridAutoRepeatColumnsType(const AutoRepeatType autoRepeatType) { SET _NESTED_VAR(m_rareNonInheritedData, m_grid, m_autoRepeatColumnsType, autoRepeatT ype); }
1929 void setGridAutoRepeatRowsType(const AutoRepeatType autoRepeatType) { SET_NE STED_VAR(m_rareNonInheritedData, m_grid, m_autoRepeatRowsType, autoRepeatType); }
1930 void setNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_namedGridColumnLines, namedGr idColumnLines); }
1931 void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_ NESTED_VAR(m_rareNonInheritedData, m_grid, m_namedGridRowLines, namedGridRowLine s); }
1932 void setOrderedNamedGridColumnLines(const OrderedNamedGridLines& orderedName dGridColumnLines) { SET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_orderedName dGridColumnLines, orderedNamedGridColumnLines); }
1933 void setOrderedNamedGridRowLines(const OrderedNamedGridLines& orderedNamedGr idRowLines) { SET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_orderedNamedGridR owLines, orderedNamedGridRowLines); }
1934 void setAutoRepeatNamedGridColumnLines(const NamedGridLinesMap& namedGridCol umnLines) { SET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_autoRepeatNamedGrid ColumnLines, namedGridColumnLines); }
1935 void setAutoRepeatNamedGridRowLines(const NamedGridLinesMap& namedGridRowLin es) { SET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_autoRepeatNamedGridRowLin es, namedGridRowLines); }
1936 void setAutoRepeatOrderedNamedGridColumnLines(const OrderedNamedGridLines& o rderedNamedGridColumnLines) { SET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_a utoRepeatOrderedNamedGridColumnLines, orderedNamedGridColumnLines); }
1937 void setAutoRepeatOrderedNamedGridRowLines(const OrderedNamedGridLines& orde redNamedGridRowLines) { SET_NESTED_VAR(m_rareNonInheritedData, m_grid, m_autoRep eatOrderedNamedGridRowLines, orderedNamedGridRowLines); }
1938 void setNamedGridArea(const NamedGridAreaMap& namedGridArea) { SET_NESTED_VA R(m_rareNonInheritedData, m_grid, m_namedGridArea, namedGridArea); }
1939 void setNamedGridAreaRowCount(size_t rowCount) { SET_NESTED_VAR(m_rareNonInh eritedData, m_grid, m_namedGridAreaRowCount, rowCount); }
1940 void setNamedGridAreaColumnCount(size_t columnCount) { SET_NESTED_VAR(m_rare NonInheritedData, m_grid, m_namedGridAreaColumnCount, columnCount); }
1941
1942 // align-content utility functions.
1943 ContentPosition alignContentPosition() const { return m_rareNonInheritedData ->m_alignContent.position(); }
1944 ContentDistributionType alignContentDistribution() const { return m_rareNonI nheritedData->m_alignContent.distribution(); }
1945 OverflowAlignment alignContentOverflowAlignment() const { return m_rareNonIn heritedData->m_alignContent.overflow(); }
1946 void setAlignContentPosition(ContentPosition position) { m_rareNonInheritedD ata.access()->m_alignContent.setPosition(position); }
1947 void setAlignContentDistribution(ContentDistributionType distribution) { m_r areNonInheritedData.access()->m_alignContent.setDistribution(distribution); }
1948 void setAlignContentOverflow(OverflowAlignment overflow) { m_rareNonInherite dData.access()->m_alignContent.setOverflow(overflow); }
1949
1950 // justify-content utility functions.
1951 ContentPosition justifyContentPosition() const { return m_rareNonInheritedDa ta->m_justifyContent.position(); }
1952 ContentDistributionType justifyContentDistribution() const { return m_rareNo nInheritedData->m_justifyContent.distribution(); }
1953 OverflowAlignment justifyContentOverflowAlignment() const { return m_rareNon InheritedData->m_justifyContent.overflow(); }
1954 void setJustifyContentPosition(ContentPosition position) { m_rareNonInherite dData.access()->m_justifyContent.setPosition(position); }
1955 void setJustifyContentDistribution(ContentDistributionType distribution) { m _rareNonInheritedData.access()->m_justifyContent.setDistribution(distribution); }
1956 void setJustifyContentOverflow(OverflowAlignment overflow) { m_rareNonInheri tedData.access()->m_justifyContent.setOverflow(overflow); }
1957
1958 // align-items utility functions.
1959 ItemPosition alignItemsPosition() const { return m_rareNonInheritedData->m_a lignItems.position(); }
1960 OverflowAlignment alignItemsOverflowAlignment() const { return m_rareNonInhe ritedData->m_alignItems.overflow(); }
1961 void setAlignItemsPosition(ItemPosition position) { m_rareNonInheritedData.a ccess()->m_alignItems.setPosition(position); }
1962 void setAlignItemsOverflow(OverflowAlignment overflow) { m_rareNonInheritedD ata.access()->m_alignItems.setOverflow(overflow); }
1963
1964 // justify-items utility functions.
1965 ItemPosition justifyItemsPosition() const { return m_rareNonInheritedData->m _justifyItems.position(); }
1966 OverflowAlignment justifyItemsOverflowAlignment() const { return m_rareNonIn heritedData->m_justifyItems.overflow(); }
1967 ItemPositionType justifyItemsPositionType() const { return m_rareNonInherite dData->m_justifyItems.positionType(); }
1968 void setJustifyItemsPosition(ItemPosition position) { m_rareNonInheritedData .access()->m_justifyItems.setPosition(position); }
1969 void setJustifyItemsOverflow(OverflowAlignment overflow) { m_rareNonInherite dData.access()->m_justifyItems.setOverflow(overflow); }
1970 void setJustifyItemsPositionType(ItemPositionType positionType) { m_rareNonI nheritedData.access()->m_justifyItems.setPositionType(positionType); }
1971
1972 // align-self utility functions.
1973 ItemPosition alignSelfPosition() const { return m_rareNonInheritedData->m_al ignSelf.position(); }
1974 OverflowAlignment alignSelfOverflowAlignment() const { return m_rareNonInher itedData->m_alignSelf.overflow(); }
1975 void setAlignSelfPosition(ItemPosition position) { m_rareNonInheritedData.ac cess()->m_alignSelf.setPosition(position); }
1976 void setAlignSelfOverflow(OverflowAlignment overflow) { m_rareNonInheritedDa ta.access()->m_alignSelf.setOverflow(overflow); }
1977
1978 // justify-self utility functions.
1979 ItemPosition justifySelfPosition() const { return m_rareNonInheritedData->m_ justifySelf.position(); }
1980 OverflowAlignment justifySelfOverflowAlignment() const { return m_rareNonInh eritedData->m_justifySelf.overflow(); }
1981 void setJustifySelfPosition(ItemPosition position) { m_rareNonInheritedData. access()->m_justifySelf.setPosition(position); }
1982 void setJustifySelfOverflow(OverflowAlignment overflow) { m_rareNonInherited Data.access()->m_justifySelf.setOverflow(overflow); }
1983
1984 // Writing mode utility functions.
1985 bool isHorizontalWritingMode() const { return blink::isHorizontalWritingMode (getWritingMode()); }
1986 bool isFlippedLinesWritingMode() const { return blink::isFlippedLinesWriting Mode(getWritingMode()); }
1987 bool isFlippedBlocksWritingMode() const { return blink::isFlippedBlocksWriti ngMode(getWritingMode()); }
1988
1989 // Will-change utility functions.
1990 bool hasWillChangeCompositingHint() const;
1991 bool hasWillChangeOpacityHint() const { return willChangeProperties().contai ns(CSSPropertyOpacity); }
1992 bool hasWillChangeTransformHint() const;
1993
1994 // Hyphen utility functions.
1995 Hyphenation* getHyphenation() const;
1996 const AtomicString& hyphenString() const;
1997
1998 // Line-height utility functions.
1999 const Length& specifiedLineHeight() const;
2000 int computedLineHeight() const;
2001
2002 // Width/height utility functions.
2003 const Length& logicalWidth() const { return isHorizontalWritingMode() ? widt h() : height(); }
2004 const Length& logicalHeight() const { return isHorizontalWritingMode() ? hei ght() : width(); }
2005 void setLogicalWidth(const Length& v)
2006 {
2007 if (isHorizontalWritingMode()) {
2008 SET_VAR(m_box, m_width, v);
2009 } else {
2010 SET_VAR(m_box, m_height, v);
2011 }
2012 }
2013
2014 void setLogicalHeight(const Length& v)
2015 {
2016 if (isHorizontalWritingMode()) {
2017 SET_VAR(m_box, m_height, v);
2018 } else {
2019 SET_VAR(m_box, m_width, v);
2020 }
2021 }
2022 const Length& logicalMaxWidth() const { return isHorizontalWritingMode() ? m axWidth() : maxHeight(); }
2023 const Length& logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
2024 const Length& logicalMinWidth() const { return isHorizontalWritingMode() ? m inWidth() : minHeight(); }
2025 const Length& logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
2026
2027 // Margin utility functions.
2028 bool hasMargin() const { return m_surround->margin.nonZero(); }
2029 bool hasMarginBeforeQuirk() const { return marginBefore().quirk(); }
2030 bool hasMarginAfterQuirk() const { return marginAfter().quirk(); }
2031 const Length& marginBefore() const { return m_surround->margin.before(getWri tingMode()); }
2032 const Length& marginAfter() const { return m_surround->margin.after(getWriti ngMode()); }
2033 const Length& marginStart() const { return m_surround->margin.start(getWriti ngMode(), direction()); }
2034 const Length& marginEnd() const { return m_surround->margin.end(getWritingMo de(), direction()); }
2035 const Length& marginOver() const { return m_surround->margin.over(getWriting Mode()); }
2036 const Length& marginUnder() const { return m_surround->margin.under(getWriti ngMode()); }
2037 const Length& marginStartUsing(const ComputedStyle* otherStyle) const { retu rn m_surround->margin.start(otherStyle->getWritingMode(), otherStyle->direction( )); }
2038 const Length& marginEndUsing(const ComputedStyle* otherStyle) const { return m_surround->margin.end(otherStyle->getWritingMode(), otherStyle->direction()); }
2039 const Length& marginBeforeUsing(const ComputedStyle* otherStyle) const { ret urn m_surround->margin.before(otherStyle->getWritingMode()); }
2040 const Length& marginAfterUsing(const ComputedStyle* otherStyle) const { retu rn m_surround->margin.after(otherStyle->getWritingMode()); }
2041 void setMarginStart(const Length&);
2042 void setMarginEnd(const Length&);
2043
2044 // Padding utility functions.
2045 const LengthBox& paddingBox() const { return m_surround->padding; }
2046 const Length& paddingBefore() const { return m_surround->padding.before(getW ritingMode()); }
2047 const Length& paddingAfter() const { return m_surround->padding.after(getWri tingMode()); }
2048 const Length& paddingStart() const { return m_surround->padding.start(getWri tingMode(), direction()); }
2049 const Length& paddingEnd() const { return m_surround->padding.end(getWriting Mode(), direction()); }
2050 const Length& paddingOver() const { return m_surround->padding.over(getWriti ngMode()); }
2051 const Length& paddingUnder() const { return m_surround->padding.under(getWri tingMode()); }
2052 bool hasPadding() const { return m_surround->padding.nonZero(); }
2053 void resetPadding() { SET_VAR(m_surround, padding, LengthBox(Fixed)); }
2054 void setPaddingBox(const LengthBox& b) { SET_VAR(m_surround, padding, b); }
2055
2056 // Border utility functions
2057 LayoutRectOutsets imageOutsets(const NinePieceImage&) const;
2058 bool hasBorderImageOutsets() const
2059 {
2060 return borderImage().hasImage() && borderImage().outset().nonZero();
2061 }
2062 LayoutRectOutsets borderImageOutsets() const
2063 {
2064 return imageOutsets(borderImage());
2065 }
2066 bool borderImageSlicesFill() const { return m_surround->border.image().fill( ); }
2067
2068 void setBorderImageSlicesFill(bool);
2069 const BorderData& border() const { return m_surround->border; }
2070 const BorderValue& borderLeft() const { return m_surround->border.left(); }
2071 const BorderValue& borderRight() const { return m_surround->border.right(); }
2072 const BorderValue& borderTop() const { return m_surround->border.top(); }
2073 const BorderValue& borderBottom() const { return m_surround->border.bottom() ; }
2074 const BorderValue& borderBefore() const;
2075 const BorderValue& borderAfter() const;
2076 const BorderValue& borderStart() const;
2077 const BorderValue& borderEnd() const;
2078 int borderAfterWidth() const;
2079 int borderBeforeWidth() const;
2080 int borderEndWidth() const;
2081 int borderStartWidth() const;
2082 int borderOverWidth() const;
2083 int borderUnderWidth() const;
2084
2085 bool hasBorderFill() const { return m_surround->border.hasBorderFill(); }
2086 bool hasBorder() const { return m_surround->border.hasBorder(); }
2087 bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); }
2088 bool hasBorderRadius() const { return m_surround->border.hasBorderRadius(); }
2089
2090 void resetBorder()
2091 {
2092 resetBorderImage();
2093 resetBorderTop();
2094 resetBorderRight();
2095 resetBorderBottom();
2096 resetBorderLeft();
2097 resetBorderTopLeftRadius();
2098 resetBorderTopRightRadius();
2099 resetBorderBottomLeftRadius();
2100 resetBorderBottomRightRadius();
2101 }
2102 void resetBorderTop() { SET_VAR(m_surround, border.m_top, BorderValue()); }
2103 void resetBorderRight() { SET_VAR(m_surround, border.m_right, BorderValue()) ; }
2104 void resetBorderBottom() { SET_VAR(m_surround, border.m_bottom, BorderValue( )); }
2105 void resetBorderLeft() { SET_VAR(m_surround, border.m_left, BorderValue()); }
2106 void resetBorderImage() { SET_VAR(m_surround, border.m_image, NinePieceImage ()); }
2107 void resetBorderTopLeftRadius() { SET_VAR(m_surround, border.m_topLeft, init ialBorderRadius()); }
2108 void resetBorderTopRightRadius() { SET_VAR(m_surround, border.m_topRight, in itialBorderRadius()); }
2109 void resetBorderBottomLeftRadius() { SET_VAR(m_surround, border.m_bottomLeft , initialBorderRadius()); }
2110 void resetBorderBottomRightRadius() { SET_VAR(m_surround, border.m_bottomRig ht, initialBorderRadius()); }
2111
2112 void setBorderRadius(const LengthSize& s)
2113 {
2114 setBorderTopLeftRadius(s);
2115 setBorderTopRightRadius(s);
2116 setBorderBottomLeftRadius(s);
2117 setBorderBottomRightRadius(s);
2118 }
2119 void setBorderRadius(const IntSize& s)
2120 {
2121 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
2122 }
2123
2124 FloatRoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool incl udeLogicalLeftEdge = true,
2125 bool includeLogicalRightEdge = true) const;
2126 FloatRoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
2127 FloatRoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
2128 const LayoutRectOutsets insets, bool includeLogicalLeftEdge, bool includ eLogicalRightEdge) const;
2129
2130 // Float utility functions.
2131 bool isFloating() const { return m_nonInheritedData.m_floating != NoFloat; }
2132
2133 // Mix-blend-mode utility functions.
2134 bool hasBlendMode() const { return blendMode() != WebBlendModeNormal; }
2135
2136 // Motion utility functions.
2137 bool hasMotionPath() const { return motionPath(); }
2138
2139 // Direction utility functions.
2140 bool isLeftToRightDirection() const { return direction() == LTR; }
2141
2142 // Perspective utility functions.
2143 bool hasPerspective() const { return m_rareNonInheritedData->m_perspective > 0; }
2144
2145 // Page size utility functions.
2146 void resetPageSizeType() { SET_VAR(m_rareNonInheritedData, m_pageSizeType, P AGE_SIZE_AUTO); }
2147
2148 // Outline utility functions.
2149 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > Bord erStyleHidden; }
2150 int outlineOutsetExtent() const;
2151 bool isOutlineEquivalent(const ComputedStyle* otherStyle) const
2152 {
2153 // No other style, so we don't have an outline then we consider them to be the same.
2154 if (!otherStyle)
2155 return !hasOutline();
2156 return m_background->outline().visuallyEqual(otherStyle->m_background->o utline());
2157 }
2158 void setOutlineFromStyle(const ComputedStyle& o)
2159 {
2160 DCHECK(!isOutlineEquivalent(&o));
2161 m_background.access()->m_outline = o.m_background->m_outline;
2162 }
2163
2164 // Position utility functions.
2165 bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; }
2166 bool hasInFlowPosition() const { return position() == RelativePosition || po sition() == StickyPosition; }
2167 bool hasViewportConstrainedPosition() const { return position() == FixedPosi tion || position() == StickyPosition; }
2168
2169 // Clip utility functions.
2170 const Length& clipLeft() const { return m_visual->clip.left(); }
2171 const Length& clipRight() const { return m_visual->clip.right(); }
2172 const Length& clipTop() const { return m_visual->clip.top(); }
2173 const Length& clipBottom() const { return m_visual->clip.bottom(); }
2174
2175 // Offset utility functions.
2176 // Accessors for positioned object edges that take into account writing mode .
2177 const Length& logicalLeft() const { return m_surround->offset.logicalLeft(ge tWritingMode()); }
2178 const Length& logicalRight() const { return m_surround->offset.logicalRight( getWritingMode()); }
2179 const Length& logicalTop() const { return m_surround->offset.before(getWriti ngMode()); }
2180 const Length& logicalBottom() const { return m_surround->offset.after(getWri tingMode()); }
2181
2182 // Whether or not a positioned element requires normal flow x/y to be comput ed
2183 // to determine its position.
2184 bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto( ); }
2185 bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto( ); }
2186 bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? ha sAutoLeftAndRight() : hasAutoTopAndBottom(); }
2187 bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? has AutoTopAndBottom() : hasAutoLeftAndRight(); }
2188
2189 // Content utility functions.
2190 bool contentDataEquivalent(const ComputedStyle* otherStyle) const { return c onst_cast<ComputedStyle*>(this)->m_rareNonInheritedData->contentDataEquivalent(* const_cast<ComputedStyle*>(otherStyle)->m_rareNonInheritedData); }
2191
2192 // Contain utility functions.
2193 bool containsPaint() const { return m_rareNonInheritedData->m_contain & Cont ainsPaint; }
2194 bool containsStyle() const { return m_rareNonInheritedData->m_contain & Cont ainsStyle; }
2195 bool containsLayout() const { return m_rareNonInheritedData->m_contain & Con tainsLayout; }
2196 bool containsSize() const { return m_rareNonInheritedData->m_contain & Conta insSize; }
2197
2198 // Display utility functions.
2199 bool isDisplayReplacedType() const { return isDisplayReplacedType(display()) ; }
2200 bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
2201 bool isOriginalDisplayInlineType() const { return isDisplayInlineType(origin alDisplay()); }
2202 bool isDisplayFlexibleOrGridBox() const { return isDisplayFlexibleBox(displa y()) || isDisplayGridBox(display()); }
2203 bool isDisplayFlexibleBox() const { return isDisplayFlexibleBox(display()); }
2204
2205 // Isolation utility functions.
2206 bool hasIsolation() const { return isolation() != IsolationAuto; }
2207
2208 // Content utility functions.
2209 bool hasContent() const { return contentData(); }
2210
2211 // Cursor utility functions.
2212 CursorList* cursors() const { return m_rareInheritedData->cursorData.get(); }
2213 void addCursor(StyleImage*, bool hotSpotSpecified, const IntPoint& hotSpot = IntPoint());
2214 void setCursorList(CursorList*);
2215 void clearCursorList();
2216
2217 // Text decoration utility functions.
2218 void applyTextDecorations();
2219 void clearAppliedTextDecorations();
2220 void restoreParentTextDecorations(const ComputedStyle& parentStyle);
2221 const Vector<AppliedTextDecoration>& appliedTextDecorations() const;
2222 TextDecoration textDecorationsInEffect() const;
2223
2224 // Overflow utility functions.
2225
2226 EOverflow overflowInlineDirection() const { return isHorizontalWritingMode() ? overflowX() : overflowY(); }
2227 EOverflow overflowBlockDirection() const { return isHorizontalWritingMode() ? overflowY() : overflowX(); }
2228
2229 // It's sufficient to just check one direction, since it's illegal to have v isible on only one overflow value.
2230 bool isOverflowVisible() const { DCHECK(overflowX() != OverflowVisible || ov erflowX() == overflowY()); return overflowX() == OverflowVisible; }
2231 bool isOverflowPaged() const { return overflowY() == OverflowPagedX || overf lowY() == OverflowPagedY; }
2232
2233 // Animation utility functions.
2234 bool shouldCompositeForCurrentAnimations() const { return hasCurrentOpacityA nimation() || hasCurrentTransformAnimation() || hasCurrentFilterAnimation() || h asCurrentBackdropFilterAnimation(); }
2235 bool isRunningAnimationOnCompositor() const { return isRunningOpacityAnimati onOnCompositor() || isRunningTransformAnimationOnCompositor() || isRunningFilter AnimationOnCompositor() || isRunningBackdropFilterAnimationOnCompositor(); }
2236
2237 // Opacity utility functions.
2238 bool hasOpacity() const { return opacity() < 1.0f; }
2239
2240 // Table layout utility functions.
2241 bool isFixedTableLayout() const { return tableLayout() == TableLayoutFixed & & !logicalWidth().isAuto(); }
2242
2243 // Filter/transform utility functions.
2244 bool has3DTransform() const { return m_rareNonInheritedData->m_transform->ha s3DTransform(); }
2245 bool hasTransform() const { return hasTransformOperations() || hasMotionPath () || hasCurrentTransformAnimation() || translate() || rotate() || scale(); }
2246 bool hasTransformOperations() const { return !m_rareNonInheritedData->m_tran sform->m_operations.operations().isEmpty(); }
2247 ETransformStyle3D usedTransformStyle3D() const { return hasGroupingProperty( ) ? TransformStyle3DFlat : transformStyle3D(); }
2248 bool transformDataEquivalent(const ComputedStyle& otherStyle) const { return m_rareNonInheritedData->m_transform == otherStyle.m_rareNonInheritedData->m_tra nsform; }
2249 bool preserves3D() const { return usedTransformStyle3D() != TransformStyle3D Flat; }
2250 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin } ;
2251 enum ApplyMotionPath { IncludeMotionPath, ExcludeMotionPath };
2252 enum ApplyIndependentTransformProperties { IncludeIndependentTransformProper ties , ExcludeIndependentTransformProperties };
2253 void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin, ApplyMotionPath, ApplyIndependentTransformProperties) cons t;
2254 void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, App lyTransformOrigin, ApplyMotionPath, ApplyIndependentTransformProperties) const;
2255
2256 // Returns |true| if any property that renders using filter operations is
2257 // used (including, but not limited to, 'filter').
2258 bool hasFilterInducingProperty() const { return hasFilter() || (RuntimeEnabl edFeatures::cssBoxReflectFilterEnabled() && hasBoxReflect()); }
2259
2260 // Returns |true| if opacity should be considered to have non-initial value for the purpose
2261 // of creating stacking contexts.
2262 bool hasNonInitialOpacity() const { return hasOpacity() || hasWillChangeOpac ityHint() || hasCurrentOpacityAnimation(); }
2263
2264 // Returns whether this style contains any grouping property as defined by [ css-transforms].
2265 // The main purpose of this is to adjust the used value of transform-style p roperty.
2266 // Note: We currently don't include every grouping property on the spec to m aintain
2267 // backward compatibility.
2268 // [css-transforms] https://drafts.csswg.org/css-transforms/#grouping-proper ty-values
2269 bool hasGroupingProperty() const { return !isOverflowVisible() || hasFilterI nducingProperty() || hasNonInitialOpacity(); }
2270
2271 // Return true if any transform related property (currently transform/motion Path, transformStyle3D, perspective,
2272 // or will-change:transform) indicates that we are transforming. will-change :transform should result in
2273 // the same rendering behavior as having a transform, including the creation of a containing block
2274 // for fixed position descendants.
2275 bool hasTransformRelatedProperty() const { return hasTransform() || preserve s3D() || hasPerspective() || hasWillChangeTransformHint(); }
2276
2277 // Paint utility functions.
2278 void addPaintImage(StyleImage*);
2279
2280 // FIXME: reflections should belong to this helper function but they are cur rently handled
2281 // through their self-painting layers. So the layout code doesn't account fo r them.
2282 bool hasVisualOverflowingEffect() const { return boxShadow() || hasBorderIma geOutsets() || hasOutline(); }
2283
2284 // Stacking contexts and positioned elements[1] are stacked (sorted in negZO rderList
2285 // and posZOrderList) in their enclosing stacking contexts.
2286 //
2287 // [1] According to CSS2.1, Appendix E.2.8 (https://www.w3.org/TR/CSS21/zind ex.html),
2288 // positioned elements with 'z-index: auto' are "treated as if it created a new
2289 // stacking context" and z-ordered together with other elements with 'z-inde x: 0'.
2290 // The difference of them from normal stacking contexts is that they don't d etermine
2291 // the stacking of the elements underneath them.
2292 // (Note: There are also other elements treated as stacking context during p ainting,
2293 // but not managed in stacks. See ObjectPainter::paintAllPhasesAtomically(). )
2294 void updateIsStackingContext(bool isDocumentElement, bool isInTopLayer);
2295 bool isStacked() const { return isStackingContext() || position() != StaticP osition; }
2296
2297 // Pseudo-styles
2298 bool hasAnyPublicPseudoStyles() const;
2299 bool hasPseudoStyle(PseudoId) const;
2300 void setHasPseudoStyle(PseudoId);
2301 bool hasUniquePseudoStyle() const;
2302 bool hasPseudoElementStyle() const;
2303
2304 // Note: canContainAbsolutePositionObjects should return true if canContainF ixedPositionObjects.
2305 // We currently never use this value directly, always OR'ing it with canCont ainFixedPositionObjects.
2306 bool canContainAbsolutePositionObjects() const { return position() != Static Position; }
2307 bool canContainFixedPositionObjects() const { return hasTransformRelatedProp erty() || containsPaint();}
2308
2309 // Whitespace utility functions.
2310 static bool autoWrap(EWhiteSpace ws)
2311 {
2312 // Nowrap and pre don't automatically wrap.
2313 return ws != NOWRAP && ws != PRE;
2314 }
2315
2316 bool autoWrap() const
2317 {
2318 return autoWrap(whiteSpace());
2319 }
2320
2321 static bool preserveNewline(EWhiteSpace ws)
2322 {
2323 // Normal and nowrap do not preserve newlines.
2324 return ws != NORMAL && ws != NOWRAP;
2325 }
2326
2327 bool preserveNewline() const
2328 {
2329 return preserveNewline(whiteSpace());
2330 }
2331
2332 static bool collapseWhiteSpace(EWhiteSpace ws)
2333 {
2334 // Pre and prewrap do not collapse whitespace.
2335 return ws != PRE && ws != PRE_WRAP;
2336 }
2337
2338 bool collapseWhiteSpace() const
2339 {
2340 return collapseWhiteSpace(whiteSpace());
2341 }
2342
2343 bool isCollapsibleWhiteSpace(UChar c) const
2344 {
2345 switch (c) {
2346 case ' ':
2347 case '\t':
2348 return collapseWhiteSpace();
2349 case '\n':
2350 return !preserveNewline();
2351 }
2352 return false;
2353 }
2354 bool breakOnlyAfterWhiteSpace() const
2355 {
2356 return whiteSpace() == PRE_WRAP || getLineBreak() == LineBreakAfterWhite Space;
2357 }
2358
2359 bool breakWords() const
2360 {
2361 return (wordBreak() == BreakWordBreak || overflowWrap() == BreakOverflow Wrap)
2362 && whiteSpace() != PRE && whiteSpace() != NOWRAP;
2363 }
2364
2365 // Text direction utility functions.
2366 bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLef tToRightDirection() && isHorizontalWritingMode(); }
2367 bool hasInlinePaginationAxis() const
2368 {
2369 // If the pagination axis is parallel with the writing mode inline axis, columns may be laid
2370 // out along the inline axis, just like for regular multicol. Otherwise, we need to lay out
2371 // along the block axis.
2372 if (isOverflowPaged())
2373 return (overflowY() == OverflowPagedX) == isHorizontalWritingMode();
2374 return false;
2375 }
2376
2377 // Border utility functions.
2378 bool borderObscuresBackground() const;
2379 void getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftEdge = tru e, bool includeLogicalRightEdge = true) const;
2380
2381 bool hasBoxDecorations() const
2382 {
2383 return hasBorderDecoration()
2384 || hasBorderRadius()
2385 || hasOutline()
2386 || hasAppearance()
2387 || boxShadow()
2388 || hasFilterInducingProperty()
2389 || hasBackdropFilter()
2390 || resize() != RESIZE_NONE;
2391 }
2392
2393 // "Box decoration background" includes all box decorations and backgrounds
2394 // that are painted as the background of the object. It includes borders,
2395 // box-shadows, background-color and background-image, etc.
2396 bool hasBoxDecorationBackground() const
2397 {
2398 return hasBackground() || hasBorderDecoration() || hasAppearance() || bo xShadow();
2399 }
2400
2401 // Background utility functions.
2402 FillLayer& accessBackgroundLayers() { return m_background.access()->m_backgr ound; }
2403 const FillLayer& backgroundLayers() const { return m_background->background( ); }
2404 void adjustBackgroundLayers()
2405 {
2406 if (backgroundLayers().next()) {
2407 accessBackgroundLayers().cullEmptyLayers();
2408 accessBackgroundLayers().fillUnsetProperties();
2409 }
2410 }
2411 bool hasBackgroundRelatedColorReferencingCurrentColor() const
2412 {
2413 if (backgroundColor().isCurrentColor() || visitedLinkBackgroundColor().i sCurrentColor())
2414 return true;
2415 if (!boxShadow())
2416 return false;
2417 return shadowListHasCurrentColor(boxShadow());
2418 }
2419 bool hasBackground() const
2420 {
2421 Color color = visitedDependentColor(CSSPropertyBackgroundColor);
2422 if (color.alpha())
2423 return true;
2424 return hasBackgroundImage();
2425 }
2426
2427
2428 // Color utility functions.
2429 // TODO(sashab): Rename this to just getColor(), and add a comment explainin g how it works.
2430 Color visitedDependentColor(int colorProperty) const;
2431
2432 // -webkit-appearance utility functions.
2433 bool hasAppearance() const { return appearance() != NoControlPart; }
2434
2435 // Other utility functions.
2436 bool isStyleAvailable() const;
2437 bool isSharable() const;
2438
2439 private:
2440 void setVisitedLinkColor(const Color&);
2441 void setVisitedLinkBackgroundColor(const StyleColor& v) { SET_VAR(m_rareNonI nheritedData, m_visitedLinkBackgroundColor, v); }
2442 void setVisitedLinkBorderLeftColor(const StyleColor& v) { SET_VAR(m_rareNonI nheritedData, m_visitedLinkBorderLeftColor, v); }
2443 void setVisitedLinkBorderRightColor(const StyleColor& v) { SET_VAR(m_rareNon InheritedData, m_visitedLinkBorderRightColor, v); }
2444 void setVisitedLinkBorderBottomColor(const StyleColor& v) { SET_VAR(m_rareNo nInheritedData, m_visitedLinkBorderBottomColor, v); }
2445 void setVisitedLinkBorderTopColor(const StyleColor& v) { SET_VAR(m_rareNonIn heritedData, m_visitedLinkBorderTopColor, v); }
2446 void setVisitedLinkOutlineColor(const StyleColor& v) { SET_VAR(m_rareNonInhe ritedData, m_visitedLinkOutlineColor, v); }
2447 void setVisitedLinkColumnRuleColor(const StyleColor& v) { SET_NESTED_VAR(m_r areNonInheritedData, m_multiCol, m_visitedLinkColumnRuleColor, v); }
2448 void setVisitedLinkTextDecorationColor(const StyleColor& v) { SET_VAR(m_rare NonInheritedData, m_visitedLinkTextDecorationColor, v); }
2449 void setVisitedLinkTextEmphasisColor(const StyleColor& v) { SET_VAR_WITH_SET TER(m_rareInheritedData, visitedLinkTextEmphasisColor, setVisitedLinkTextEmphasi sColor, v); }
2450 void setVisitedLinkTextFillColor(const StyleColor& v) { SET_VAR_WITH_SETTER( m_rareInheritedData, visitedLinkTextFillColor, setVisitedLinkTextFillColor, v); }
2451 void setVisitedLinkTextStrokeColor(const StyleColor& v) { SET_VAR_WITH_SETTE R(m_rareInheritedData, visitedLinkTextStrokeColor, setVisitedLinkTextStrokeColor , v); }
2452
2453 void inheritUnicodeBidiFrom(const ComputedStyle& parent) { m_nonInheritedDat a.m_unicodeBidi = parent.m_nonInheritedData.m_unicodeBidi; }
2454
2455 bool isDisplayFlexibleBox(EDisplay display) const
2456 {
2457 return display == FLEX || display == INLINE_FLEX;
2458 }
2459
2460 bool isDisplayGridBox(EDisplay display) const
2461 {
2462 return display == GRID || display == INLINE_GRID;
2463 }
2464
2465 bool isDisplayReplacedType(EDisplay display) const
2466 {
2467 return display == INLINE_BLOCK || display == INLINE_BOX || display == IN LINE_FLEX
2468 || display == INLINE_TABLE || display == INLINE_GRID;
2469 }
2470
2471 bool isDisplayInlineType(EDisplay display) const
2472 {
2473 return display == INLINE || isDisplayReplacedType(display);
2474 } 44 }
2475 45
2476 // Color accessors are all private to make sure callers use visitedDependent Color instead to access them. 46 // Color accessors are all private to make sure callers use visitedDependent Color instead to access them.
2477 StyleColor borderLeftColor() const { return m_surround->border.left().color( ); } 47 StyleColor textFillColor() const { return StyleColor(0xffff0000); }
2478 StyleColor borderRightColor() const { return m_surround->border.right().colo r(); } 48 StyleColor textStrokeColor() const { return m_rareInheritedData.textStrokeCo lor(); }
2479 StyleColor borderTopColor() const { return m_surround->border.top().color(); } 49 StyleColor textDecorationColor() const { return m_rareInheritedData.m_textDe corationColor; }
2480 StyleColor borderBottomColor() const { return m_surround->border.bottom().co lor(); } 50 StyleColor visitedLinkTextDecorationColor() const { return m_rareInheritedDa ta.m_visitedLinkTextDecorationColor; }
2481 StyleColor backgroundColor() const { return m_background->color(); } 51 StyleColor visitedLinkTextFillColor() const { return m_rareInheritedData.vis itedLinkTextFillColor(); }
2482 Color color() const;
2483 StyleColor columnRuleColor() const { return m_rareNonInheritedData->m_multiC ol->m_rule.color(); }
2484 StyleColor outlineColor() const { return m_background->outline().color(); }
2485 StyleColor textEmphasisColor() const { return m_rareInheritedData->textEmpha sisColor(); }
2486 StyleColor textFillColor() const { return m_rareInheritedData->textFillColor (); }
2487 StyleColor textStrokeColor() const { return m_rareInheritedData->textStrokeC olor(); }
2488 Color visitedLinkColor() const;
2489 StyleColor visitedLinkBackgroundColor() const { return m_rareNonInheritedDat a->m_visitedLinkBackgroundColor; }
2490 StyleColor visitedLinkBorderLeftColor() const { return m_rareNonInheritedDat a->m_visitedLinkBorderLeftColor; }
2491 StyleColor visitedLinkBorderRightColor() const { return m_rareNonInheritedDa ta->m_visitedLinkBorderRightColor; }
2492 StyleColor visitedLinkBorderBottomColor() const { return m_rareNonInheritedD ata->m_visitedLinkBorderBottomColor; }
2493 StyleColor visitedLinkBorderTopColor() const { return m_rareNonInheritedData ->m_visitedLinkBorderTopColor; }
2494 StyleColor visitedLinkOutlineColor() const { return m_rareNonInheritedData-> m_visitedLinkOutlineColor; }
2495 StyleColor visitedLinkColumnRuleColor() const { return m_rareNonInheritedDat a->m_multiCol->m_visitedLinkColumnRuleColor; }
2496 StyleColor textDecorationColor() const { return m_rareNonInheritedData->m_te xtDecorationColor; }
2497 StyleColor visitedLinkTextDecorationColor() const { return m_rareNonInherite dData->m_visitedLinkTextDecorationColor; }
2498 StyleColor visitedLinkTextEmphasisColor() const { return m_rareInheritedData ->visitedLinkTextEmphasisColor(); }
2499 StyleColor visitedLinkTextFillColor() const { return m_rareInheritedData->vi sitedLinkTextFillColor(); }
2500 StyleColor visitedLinkTextStrokeColor() const { return m_rareInheritedData-> visitedLinkTextStrokeColor(); }
2501 52
2502 StyleColor decorationColorIncludingFallback(bool visitedLink) const; 53 StyleColor decorationColorIncludingFallback(bool visitedLink) const;
2503 Color colorIncludingFallback(int colorProperty, bool visitedLink) const; 54 Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
2504
2505 Color stopColor() const { return svgStyle().stopColor(); }
2506 Color floodColor() const { return svgStyle().floodColor(); }
2507 Color lightingColor() const { return svgStyle().lightingColor(); }
2508
2509 void addAppliedTextDecoration(const AppliedTextDecoration&);
2510 void applyMotionPathTransform(float originX, float originY, TransformationMa trix&) const;
2511
2512 bool diffNeedsFullLayoutAndPaintInvalidation(const ComputedStyle& other) con st;
2513 bool diffNeedsFullLayout(const ComputedStyle& other) const;
2514 bool diffNeedsPaintInvalidationSubtree(const ComputedStyle& other) const;
2515 bool diffNeedsPaintInvalidationObject(const ComputedStyle& other) const;
2516 bool diffNeedsPaintInvalidationObjectForPaintImage(const StyleImage*, const ComputedStyle& other) const;
2517 void updatePropertySpecificDifferences(const ComputedStyle& other, StyleDiff erence&) const;
2518
2519 bool requireTransformOrigin(ApplyTransformOrigin applyOrigin, ApplyMotionPat h) const;
2520 static bool shadowListHasCurrentColor(const ShadowList*);
2521 }; 55 };
2522 56
2523 // FIXME: Reduce/remove the dependency on zoom adjusted int values.
2524 // The float or LayoutUnit versions of layout values should be used.
2525 int adjustForAbsoluteZoom(int value, float zoomFactor);
2526
2527 inline int adjustForAbsoluteZoom(int value, const ComputedStyle* style)
2528 {
2529 float zoomFactor = style->effectiveZoom();
2530 if (zoomFactor == 1)
2531 return value;
2532 return adjustForAbsoluteZoom(value, zoomFactor);
2533 }
2534
2535 inline float adjustFloatForAbsoluteZoom(float value, const ComputedStyle& style)
2536 {
2537 return value / style.effectiveZoom();
2538 }
2539
2540 inline double adjustDoubleForAbsoluteZoom(double value, const ComputedStyle& sty le)
2541 {
2542 return value / style.effectiveZoom();
2543 }
2544
2545 inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const Comput edStyle& style)
2546 {
2547 return LayoutUnit(value / style.effectiveZoom());
2548 }
2549
2550 inline double adjustScrollForAbsoluteZoom(double scrollOffset, float zoomFactor)
2551 {
2552 return scrollOffset / zoomFactor;
2553 }
2554
2555 inline double adjustScrollForAbsoluteZoom(double scrollOffset, const ComputedSty le& style)
2556 {
2557 return adjustScrollForAbsoluteZoom(scrollOffset, style.effectiveZoom());
2558 }
2559
2560 inline bool ComputedStyle::setZoom(float f)
2561 {
2562 if (compareEqual(m_visual->m_zoom, f))
2563 return false;
2564 m_visual.access()->m_zoom = f;
2565 setEffectiveZoom(effectiveZoom() * zoom());
2566 return true;
2567 }
2568
2569 inline bool ComputedStyle::setEffectiveZoom(float f)
2570 {
2571 // Clamp the effective zoom value to a smaller (but hopeful still large
2572 // enough) range, to avoid overflow in derived computations.
2573 float clampedEffectiveZoom = clampTo<float>(f, 1e-6, 1e6);
2574 if (compareEqual(m_rareInheritedData->m_effectiveZoom, clampedEffectiveZoom) )
2575 return false;
2576 m_rareInheritedData.access()->m_effectiveZoom = clampedEffectiveZoom;
2577 return true;
2578 }
2579
2580 inline bool ComputedStyle::isSharable() const
2581 {
2582 if (unique())
2583 return false;
2584 if (hasUniquePseudoStyle())
2585 return false;
2586 return true;
2587 }
2588
2589 inline bool ComputedStyle::setTextOrientation(TextOrientation textOrientation)
2590 {
2591 if (compareEqual(m_rareInheritedData->m_textOrientation, textOrientation))
2592 return false;
2593
2594 m_rareInheritedData.access()->m_textOrientation = textOrientation;
2595 return true;
2596 }
2597
2598 inline bool ComputedStyle::hasAnyPublicPseudoStyles() const
2599 {
2600 return PublicPseudoIdMask & m_nonInheritedData.m_pseudoBits;
2601 }
2602
2603 inline bool ComputedStyle::hasPseudoStyle(PseudoId pseudo) const
2604 {
2605 ASSERT(pseudo > PseudoIdNone);
2606 ASSERT(pseudo < FirstInternalPseudoId);
2607 return (1 << (pseudo - 1)) & m_nonInheritedData.m_pseudoBits;
2608 }
2609
2610 inline void ComputedStyle::setHasPseudoStyle(PseudoId pseudo)
2611 {
2612 ASSERT(pseudo > PseudoIdNone);
2613 ASSERT(pseudo < FirstInternalPseudoId);
2614 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1);
2615 }
2616
2617 inline bool ComputedStyle::hasPseudoElementStyle() const
2618 {
2619 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask;
2620 }
2621
2622 } // namespace blink 57 } // namespace blink
2623 58
2624 #endif // ComputedStyle_h 59 #endif // ComputedStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/CachedUAStyle.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698