2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
28 #include "AnimationList.h"
29 #include "BorderValue.h"
30 #include "CSSLineBoxContainValue.h"
31 #include "CSSPrimitiveValue.h"
32 #include "CSSPropertyNames.h"
34 #include "ColorSpace.h"
35 #include "CounterDirectives.h"
37 #include "FillLayer.h"
39 #include "GraphicsTypes.h"
41 #include "LengthBox.h"
42 #include "LengthSize.h"
43 #include "LineClampValue.h"
44 #include "NinePieceImage.h"
45 #include "OutlineValue.h"
46 #include "RenderStyleConstants.h"
47 #include "RoundedRect.h"
48 #include "ShadowData.h"
49 #include "StyleBackgroundData.h"
50 #include "StyleBoxData.h"
51 #include "StyleDeprecatedFlexibleBoxData.h"
52 #include "StyleFlexibleBoxData.h"
53 #include "StyleInheritedData.h"
54 #include "StyleMarqueeData.h"
55 #include "StyleMultiColData.h"
56 #include "StyleRareInheritedData.h"
57 #include "StyleRareNonInheritedData.h"
58 #include "StyleReflection.h"
59 #include "StyleSurroundData.h"
60 #include "StyleTransformData.h"
61 #include "StyleVisualData.h"
62 #include "TextDirection.h"
63 #include "TextOrientation.h"
64 #include "ThemeTypes.h"
65 #include "TransformOperations.h"
66 #include "UnicodeBidi.h"
67 #include <wtf/Forward.h>
68 #include <wtf/OwnPtr.h>
69 #include <wtf/RefCounted.h>
70 #include <wtf/StdLibExtras.h>
71 #include <wtf/Vector.h>
73 #if ENABLE(CSS_FILTERS)
74 #include "FilterOperations.h"
75 #include "StyleFilterData.h"
78 #if ENABLE(CSS_GRID_LAYOUT)
79 #include "StyleGridData.h"
80 #include "StyleGridItemData.h"
83 #if ENABLE(DASHBOARD_SUPPORT)
84 #include "StyleDashboardRegion.h"
89 #include "SVGRenderStyle.h"
92 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
94 #define SET_VAR(group, variable, value) \
95 if (!compareEqual(group->variable, value)) \
96 group.access()->variable = value;
103 class CSSStyleSelector;
104 class CounterContent;
110 class TransformationMatrix;
114 typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
116 class RenderStyle: public RefCounted<RenderStyle> {
117 friend class AnimationBase; // Used by CSS animations. We can't allow them to animate based off visited colors.
118 friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
119 friend class EditingStyle; // Editing has to only reveal unvisited info.
120 friend class CSSStyleApplyProperty; // Sets members directly.
121 friend class CSSStyleSelector; // Sets members directly.
122 friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info.
123 friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
124 friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
125 friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors. Rebaselining would allow this to be yanked.
128 class RenderStyleBitfields {
130 RenderStyleBitfields()
131 : m_affectedByUncommonAttributeSelectors(false)
133 , m_affectedByEmpty(false)
134 , m_emptyState(false)
135 , m_childrenAffectedByFirstChildRules(false)
136 , m_childrenAffectedByLastChildRules(false)
137 , m_childrenAffectedByDirectAdjacentRules(false)
138 , m_childrenAffectedByForwardPositionalRules(false)
139 , m_childrenAffectedByBackwardPositionalRules(false)
140 , m_firstChildState(false)
141 , m_lastChildState(false)
142 , m_explicitInheritance(false)
147 bool affectedByUncommonAttributeSelectors() const { return m_affectedByUncommonAttributeSelectors; }
148 void setAffectedByUncommonAttributeSelectors(bool value) { m_affectedByUncommonAttributeSelectors = value; }
149 bool unique() const { return m_unique; }
150 void setUnique(bool value) { m_unique = value; }
151 bool affectedByEmpty() const { return m_affectedByEmpty; }
152 void setAffectedByEmpty(bool value) { m_affectedByEmpty = value; }
153 bool emptyState() const { return m_emptyState; }
154 void setEmptyState(bool value) { m_emptyState = value; }
155 bool childrenAffectedByFirstChildRules() const { return m_childrenAffectedByFirstChildRules; }
156 void setChildrenAffectedByFirstChildRules(bool value) { m_childrenAffectedByFirstChildRules = value; }
157 bool childrenAffectedByLastChildRules() const { return m_childrenAffectedByLastChildRules; }
158 void setChildrenAffectedByLastChildRules(bool value) { m_childrenAffectedByLastChildRules = value; }
159 bool childrenAffectedByDirectAdjacentRules() const { return m_childrenAffectedByDirectAdjacentRules; }
160 void setChildrenAffectedByDirectAdjacentRules(bool value) { m_childrenAffectedByDirectAdjacentRules = value; }
161 bool childrenAffectedByForwardPositionalRules() const { return m_childrenAffectedByForwardPositionalRules; }
162 void setChildrenAffectedByForwardPositionalRules(bool value) { m_childrenAffectedByForwardPositionalRules = value; }
163 bool childrenAffectedByBackwardPositionalRules() const { return m_childrenAffectedByBackwardPositionalRules; }
164 void setChildrenAffectedByBackwardPositionalRules(bool value) { m_childrenAffectedByBackwardPositionalRules = value; }
165 bool firstChildState() const { return m_firstChildState; }
166 void setFirstChildState(bool value) { m_firstChildState = value; }
167 bool lastChildState() const { return m_lastChildState; }
168 void setLastChildState(bool value) { m_lastChildState = value; }
169 bool explicitInheritance() const { return m_explicitInheritance; }
170 void setExplicitInheritance(bool value) { m_explicitInheritance = value; }
172 unsigned childIndex() const { return m_childIndex; }
173 void setChildIndex(unsigned index) { m_childIndex = index; }
176 // The following bitfield is 32-bits long, which optimizes padding with the
177 // int refCount in the base class. Beware when adding more bits.
178 unsigned m_affectedByUncommonAttributeSelectors : 1;
179 unsigned m_unique : 1;
181 // Bits for dynamic child matching.
182 unsigned m_affectedByEmpty : 1;
183 unsigned m_emptyState : 1;
185 // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or
186 // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
187 unsigned m_childrenAffectedByFirstChildRules : 1;
188 unsigned m_childrenAffectedByLastChildRules : 1;
189 unsigned m_childrenAffectedByDirectAdjacentRules : 1;
190 unsigned m_childrenAffectedByForwardPositionalRules : 1;
191 unsigned m_childrenAffectedByBackwardPositionalRules : 1;
192 unsigned m_firstChildState : 1;
193 unsigned m_lastChildState : 1;
194 unsigned m_explicitInheritance : 1;
195 unsigned m_childIndex : 20; // Plenty of bits to cache an index.
197 RenderStyleBitfields m_bitfields;
199 // non-inherited attributes
200 DataRef<StyleBoxData> m_box;
201 DataRef<StyleVisualData> visual;
202 DataRef<StyleBackgroundData> m_background;
203 DataRef<StyleSurroundData> surround;
204 DataRef<StyleRareNonInheritedData> rareNonInheritedData;
206 // inherited attributes
207 DataRef<StyleRareInheritedData> rareInheritedData;
208 DataRef<StyleInheritedData> inherited;
210 // list of associated pseudo styles
211 OwnPtr<PseudoStyleCache> m_cachedPseudoStyles;
214 DataRef<SVGRenderStyle> m_svgStyle;
217 // !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp and implicitlyInherited() in CSSStyleSelector.cpp
220 struct InheritedFlags {
221 bool operator==(const InheritedFlags& other) const
223 return (_empty_cells == other._empty_cells)
224 && (_caption_side == other._caption_side)
225 && (_list_style_type == other._list_style_type)
226 && (_list_style_position == other._list_style_position)
227 && (_visibility == other._visibility)
228 && (_text_align == other._text_align)
229 && (_text_transform == other._text_transform)
230 && (_text_decorations == other._text_decorations)
231 && (_cursor_style == other._cursor_style)
232 && (_direction == other._direction)
233 && (_white_space == other._white_space)
234 && (_border_collapse == other._border_collapse)
235 && (_box_direction == other._box_direction)
236 && (m_rtlOrdering == other.m_rtlOrdering)
237 && (m_printColorAdjust == other.m_printColorAdjust)
238 && (_pointerEvents == other._pointerEvents)
239 && (_insideLink == other._insideLink)
240 && (m_writingMode == other.m_writingMode);
243 bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
245 unsigned _empty_cells : 1; // EEmptyCell
246 unsigned _caption_side : 2; // ECaptionSide
247 unsigned _list_style_type : 7; // EListStyleType
248 unsigned _list_style_position : 1; // EListStylePosition
249 unsigned _visibility : 2; // EVisibility
250 unsigned _text_align : 4; // ETextAlign
251 unsigned _text_transform : 2; // ETextTransform
252 unsigned _text_decorations : ETextDecorationBits;
253 unsigned _cursor_style : 6; // ECursor
254 unsigned _direction : 1; // TextDirection
255 unsigned _white_space : 3; // EWhiteSpace
257 unsigned _border_collapse : 1; // EBorderCollapse
258 unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
260 // non CSS2 inherited
261 unsigned m_rtlOrdering : 1; // Order
262 unsigned m_printColorAdjust : PrintColorAdjustBits;
263 unsigned _pointerEvents : 4; // EPointerEvents
264 unsigned _insideLink : 2; // EInsideLink
267 // CSS Text Layout Module Level 3: Vertical writing support
268 unsigned m_writingMode : 2; // WritingMode
273 struct NonInheritedFlags {
274 bool operator==(const NonInheritedFlags& other) const
276 return _effectiveDisplay == other._effectiveDisplay
277 && _originalDisplay == other._originalDisplay
278 && _overflowX == other._overflowX
279 && _overflowY == other._overflowY
280 && _vertical_align == other._vertical_align
281 && _clear == other._clear
282 && _position == other._position
283 && _floating == other._floating
284 && _table_layout == other._table_layout
285 && _page_break_before == other._page_break_before
286 && _page_break_after == other._page_break_after
287 && _page_break_inside == other._page_break_inside
288 && _styleType == other._styleType
289 && _affectedByHover == other._affectedByHover
290 && _affectedByActive == other._affectedByActive
291 && _affectedByDrag == other._affectedByDrag
292 && _pseudoBits == other._pseudoBits
293 && _unicodeBidi == other._unicodeBidi
294 && _isLink == other._isLink;
297 bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
299 unsigned _effectiveDisplay : 5; // EDisplay
300 unsigned _originalDisplay : 5; // EDisplay
301 unsigned _overflowX : 3; // EOverflow
302 unsigned _overflowY : 3; // EOverflow
303 unsigned _vertical_align : 4; // EVerticalAlign
304 unsigned _clear : 2; // EClear
305 unsigned _position : 2; // EPosition
306 unsigned _floating : 2; // EFloat
307 unsigned _table_layout : 1; // ETableLayout
309 unsigned _unicodeBidi : 3; // EUnicodeBidi
310 unsigned _page_break_before : 2; // EPageBreak
312 unsigned _page_break_after : 2; // EPageBreak
313 unsigned _page_break_inside : 2; // EPageBreak
315 unsigned _styleType : 6; // PseudoId
316 unsigned _pseudoBits : 7;
318 bool affectedByHover() const { return _affectedByHover; }
319 void setAffectedByHover(bool value) { _affectedByHover = value; }
320 bool affectedByActive() const { return _affectedByActive; }
321 void setAffectedByActive(bool value) { _affectedByActive = value; }
322 bool affectedByDrag() const { return _affectedByDrag; }
323 void setAffectedByDrag(bool value) { _affectedByDrag = value; }
324 bool isLink() const { return _isLink; }
325 void setIsLink(bool value) { _isLink = value; }
327 unsigned _affectedByHover : 1;
328 unsigned _affectedByActive : 1;
329 unsigned _affectedByDrag : 1;
330 unsigned _isLink : 1;
331 // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom()
333 } noninherited_flags;
338 void setBitDefaults()
340 inherited_flags._empty_cells = initialEmptyCells();
341 inherited_flags._caption_side = initialCaptionSide();
342 inherited_flags._list_style_type = initialListStyleType();
343 inherited_flags._list_style_position = initialListStylePosition();
344 inherited_flags._visibility = initialVisibility();
345 inherited_flags._text_align = initialTextAlign();
346 inherited_flags._text_transform = initialTextTransform();
347 inherited_flags._text_decorations = initialTextDecoration();
348 inherited_flags._cursor_style = initialCursor();
349 inherited_flags._direction = initialDirection();
350 inherited_flags._white_space = initialWhiteSpace();
351 inherited_flags._border_collapse = initialBorderCollapse();
352 inherited_flags.m_rtlOrdering = initialRTLOrdering();
353 inherited_flags._box_direction = initialBoxDirection();
354 inherited_flags.m_printColorAdjust = initialPrintColorAdjust();
355 inherited_flags._pointerEvents = initialPointerEvents();
356 inherited_flags._insideLink = NotInsideLink;
357 inherited_flags.m_writingMode = initialWritingMode();
359 noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
360 noninherited_flags._overflowX = initialOverflowX();
361 noninherited_flags._overflowY = initialOverflowY();
362 noninherited_flags._vertical_align = initialVerticalAlign();
363 noninherited_flags._clear = initialClear();
364 noninherited_flags._position = initialPosition();
365 noninherited_flags._floating = initialFloating();
366 noninherited_flags._table_layout = initialTableLayout();
367 noninherited_flags._unicodeBidi = initialUnicodeBidi();
368 noninherited_flags._page_break_before = initialPageBreak();
369 noninherited_flags._page_break_after = initialPageBreak();
370 noninherited_flags._page_break_inside = initialPageBreak();
371 noninherited_flags._styleType = NOPSEUDO;
372 noninherited_flags._pseudoBits = 0;
373 noninherited_flags.setAffectedByHover(false);
374 noninherited_flags.setAffectedByActive(false);
375 noninherited_flags.setAffectedByDrag(false);
376 noninherited_flags.setIsLink(false);
380 ALWAYS_INLINE RenderStyle();
381 // used to create the default style.
382 ALWAYS_INLINE RenderStyle(bool);
383 ALWAYS_INLINE RenderStyle(const RenderStyle&);
386 static PassRefPtr<RenderStyle> create();
387 static PassRefPtr<RenderStyle> createDefaultStyle();
388 static PassRefPtr<RenderStyle> createAnonymousStyle(const RenderStyle* parentStyle);
389 static PassRefPtr<RenderStyle> clone(const RenderStyle*);
391 void inheritFrom(const RenderStyle* inheritParent);
392 void copyNonInheritedFrom(const RenderStyle*);
394 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags._styleType); }
395 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; }
397 RenderStyle* getCachedPseudoStyle(PseudoId) const;
398 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
399 void removeCachedPseudoStyle(PseudoId);
401 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
403 bool affectedByHoverRules() const { return noninherited_flags.affectedByHover(); }
404 bool affectedByActiveRules() const { return noninherited_flags.affectedByActive(); }
405 bool affectedByDragRules() const { return noninherited_flags.affectedByDrag(); }
407 void setAffectedByHoverRules(bool b) { noninherited_flags.setAffectedByHover(b); }
408 void setAffectedByActiveRules(bool b) { noninherited_flags.setAffectedByActive(b); }
409 void setAffectedByDragRules(bool b) { noninherited_flags.setAffectedByDrag(b); }
411 bool operator==(const RenderStyle& other) const;
412 bool operator!=(const RenderStyle& other) const { return !(*this == other); }
413 bool isFloating() const { return noninherited_flags._floating != NoFloat; }
414 bool hasMargin() const { return surround->margin.nonZero(); }
415 bool hasBorder() const { return surround->border.hasBorder(); }
416 bool hasPadding() const { return surround->padding.nonZero(); }
417 bool hasOffset() const { return surround->offset.nonZero(); }
419 bool hasBackgroundImage() const { return m_background->background().hasImage(); }
420 bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
421 bool hasAppearance() const { return appearance() != NoControlPart; }
423 bool hasBackground() const
425 Color color = visitedDependentColor(CSSPropertyBackgroundColor);
426 if (color.isValid() && color.alpha() > 0)
428 return hasBackgroundImage();
431 void getImageOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
432 bool hasBorderImageOutsets() const
434 return borderImage().hasImage() && borderImage().outset().nonZero();
436 void getBorderImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
438 return getImageOutsets(borderImage(), top, right, bottom, left);
440 void getBorderImageHorizontalOutsets(LayoutUnit& left, LayoutUnit& right) const
442 return getImageHorizontalOutsets(borderImage(), left, right);
444 void getBorderImageVerticalOutsets(LayoutUnit& top, LayoutUnit& bottom) const
446 return getImageVerticalOutsets(borderImage(), top, bottom);
448 void getBorderImageInlineDirectionOutsets(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
450 return getImageInlineDirectionOutsets(borderImage(), logicalLeft, logicalRight);
452 void getBorderImageBlockDirectionOutsets(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
454 return getImageBlockDirectionOutsets(borderImage(), logicalTop, logicalBottom);
457 void getMaskBoxImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
459 return getImageOutsets(maskBoxImage(), top, right, bottom, left);
462 #if ENABLE(CSS_FILTERS)
463 void getFilterOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
466 filter().getOutsets(top, right, bottom, left);
474 bool hasFilterOutsets() const { return hasFilter() && filter().hasOutsets(); }
476 bool hasFilterOutsets() const { return false; }
479 Order rtlOrdering() const { return static_cast<Order>(inherited_flags.m_rtlOrdering); }
480 void setRTLOrdering(Order o) { inherited_flags.m_rtlOrdering = o; }
482 bool isStyleAvailable() const;
484 bool hasAnyPublicPseudoStyles() const;
485 bool hasPseudoStyle(PseudoId pseudo) const;
486 void setHasPseudoStyle(PseudoId pseudo);
488 // attribute getter methods
490 EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
491 EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
493 Length left() const { return surround->offset.left(); }
494 Length right() const { return surround->offset.right(); }
495 Length top() const { return surround->offset.top(); }
496 Length bottom() const { return surround->offset.bottom(); }
498 // Accessors for positioned object edges that take into account writing mode.
499 Length logicalLeft() const { return isHorizontalWritingMode() ? left() : top(); }
500 Length logicalRight() const { return isHorizontalWritingMode() ? right() : bottom(); }
501 Length logicalTop() const { return isHorizontalWritingMode() ? (isFlippedBlocksWritingMode() ? bottom() : top()) : (isFlippedBlocksWritingMode() ? right() : left()); }
502 Length logicalBottom() const { return isHorizontalWritingMode() ? (isFlippedBlocksWritingMode() ? top() : bottom()) : (isFlippedBlocksWritingMode() ? left() : right()); }
504 // Whether or not a positioned element requires normal flow x/y to be computed
505 // to determine its position.
506 bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); }
507 bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); }
508 bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
509 bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
511 EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
512 bool isPositioned() const { return position() == AbsolutePosition || position() == FixedPosition; }
513 EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
515 Length width() const { return m_box->width(); }
516 Length height() const { return m_box->height(); }
517 Length minWidth() const { return m_box->minWidth(); }
518 Length maxWidth() const { return m_box->maxWidth(); }
519 Length minHeight() const { return m_box->minHeight(); }
520 Length maxHeight() const { return m_box->maxHeight(); }
522 Length logicalWidth() const;
523 Length logicalHeight() const;
524 Length logicalMinWidth() const;
525 Length logicalMaxWidth() const;
526 Length logicalMinHeight() const;
527 Length logicalMaxHeight() const;
529 const BorderData& border() const { return surround->border; }
530 const BorderValue& borderLeft() const { return surround->border.left(); }
531 const BorderValue& borderRight() const { return surround->border.right(); }
532 const BorderValue& borderTop() const { return surround->border.top(); }
533 const BorderValue& borderBottom() const { return surround->border.bottom(); }
535 const BorderValue& borderBefore() const;
536 const BorderValue& borderAfter() const;
537 const BorderValue& borderStart() const;
538 const BorderValue& borderEnd() const;
540 const NinePieceImage& borderImage() const { return surround->border.image(); }
541 StyleImage* borderImageSource() const { return surround->border.image().image(); }
542 LengthBox borderImageSlices() const { return surround->border.image().imageSlices(); }
543 LengthBox borderImageWidth() const { return surround->border.image().borderSlices(); }
544 LengthBox borderImageOutset() const { return surround->border.image().outset(); }
546 LengthSize borderTopLeftRadius() const { return surround->border.topLeft(); }
547 LengthSize borderTopRightRadius() const { return surround->border.topRight(); }
548 LengthSize borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
549 LengthSize borderBottomRightRadius() const { return surround->border.bottomRight(); }
550 bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
552 unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); }
553 EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
554 bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
555 unsigned borderRightWidth() const { return surround->border.borderRightWidth(); }
556 EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
557 bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
558 unsigned borderTopWidth() const { return surround->border.borderTopWidth(); }
559 EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
560 bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
561 unsigned borderBottomWidth() const { return surround->border.borderBottomWidth(); }
562 EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
563 bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
565 unsigned short borderBeforeWidth() const;
566 unsigned short borderAfterWidth() const;
567 unsigned short borderStartWidth() const;
568 unsigned short borderEndWidth() const;
570 unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
571 unsigned short outlineWidth() const
573 if (m_background->outline().style() == BNONE)
575 return m_background->outline().width();
577 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
578 EBorderStyle outlineStyle() const { return m_background->outline().style(); }
579 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_background->outline().isAuto()); }
581 EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
582 EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
584 EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
585 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
586 Length verticalAlignLength() const { return m_box->verticalAlign(); }
588 Length clipLeft() const { return visual->clip.left(); }
589 Length clipRight() const { return visual->clip.right(); }
590 Length clipTop() const { return visual->clip.top(); }
591 Length clipBottom() const { return visual->clip.bottom(); }
592 LengthBox clip() const { return visual->clip; }
593 bool hasClip() const { return visual->hasClip; }
595 EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
597 EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); }
598 ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); }
600 const Font& font() const { return inherited->font; }
601 const FontMetrics& fontMetrics() const { return inherited->font.fontMetrics(); }
602 const FontDescription& fontDescription() const { return inherited->font.fontDescription(); }
603 int fontSize() const { return inherited->font.pixelSize(); }
605 Length textIndent() const { return rareInheritedData->indent; }
606 ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
607 ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
608 ETextDecoration textDecorationsInEffect() const { return static_cast<ETextDecoration>(inherited_flags._text_decorations); }
609 ETextDecoration textDecoration() const { return static_cast<ETextDecoration>(visual->textDecoration); }
610 int wordSpacing() const { return inherited->font.wordSpacing(); }
611 int letterSpacing() const { return inherited->font.letterSpacing(); }
613 float zoom() const { return visual->m_zoom; }
614 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
616 TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
617 bool isLeftToRightDirection() const { return direction() == LTR; }
619 Length lineHeight() const { return inherited->line_height; }
620 int computedLineHeight() const
622 const Length& lh = inherited->line_height;
624 // Negative value means the line height is not set. Use the font's built-in spacing.
626 return fontMetrics().lineSpacing();
629 return lh.calcMinValue(fontSize());
634 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
635 static bool autoWrap(EWhiteSpace ws)
637 // Nowrap and pre don't automatically wrap.
638 return ws != NOWRAP && ws != PRE;
641 bool autoWrap() const
643 return autoWrap(whiteSpace());
646 static bool preserveNewline(EWhiteSpace ws)
648 // Normal and nowrap do not preserve newlines.
649 return ws != NORMAL && ws != NOWRAP;
652 bool preserveNewline() const
654 return preserveNewline(whiteSpace());
657 static bool collapseWhiteSpace(EWhiteSpace ws)
659 // Pre and prewrap do not collapse whitespace.
660 return ws != PRE && ws != PRE_WRAP;
663 bool collapseWhiteSpace() const
665 return collapseWhiteSpace(whiteSpace());
668 bool isCollapsibleWhiteSpace(UChar c) const
673 return collapseWhiteSpace();
675 return !preserveNewline();
680 bool breakOnlyAfterWhiteSpace() const
682 return whiteSpace() == PRE_WRAP || khtmlLineBreak() == AFTER_WHITE_SPACE;
685 bool breakWords() const
687 return wordBreak() == BreakWordBreak || wordWrap() == BreakWordWrap;
690 EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
691 EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
692 CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); }
693 EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
694 EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
695 EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
696 Length backgroundXPosition() const { return m_background->background().xPosition(); }
697 Length backgroundYPosition() const { return m_background->background().yPosition(); }
698 EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
699 LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); }
700 FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
701 const FillLayer* backgroundLayers() const { return &(m_background->background()); }
703 StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
704 EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); }
705 EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); }
706 CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
707 EFillAttachment maskAttachment() const { return static_cast<EFillAttachment>(rareNonInheritedData->m_mask.attachment()); }
708 EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
709 EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
710 Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
711 Length maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
712 EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
713 LengthSize maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
714 FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
715 const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
716 const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
717 StyleImage* maskBoxImageSource() const { return rareNonInheritedData->m_maskBoxImage.image(); }
719 EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse>(inherited_flags._border_collapse); }
720 short horizontalBorderSpacing() const { return inherited->horizontal_border_spacing; }
721 short verticalBorderSpacing() const { return inherited->vertical_border_spacing; }
722 EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); }
723 ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); }
725 short counterIncrement() const { return rareNonInheritedData->m_counterIncrement; }
726 short counterReset() const { return rareNonInheritedData->m_counterReset; }
728 EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); }
729 StyleImage* listStyleImage() const { return inherited->list_style_image.get(); }
730 EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
732 Length marginTop() const { return surround->margin.top(); }
733 Length marginBottom() const { return surround->margin.bottom(); }
734 Length marginLeft() const { return surround->margin.left(); }
735 Length marginRight() const { return surround->margin.right(); }
736 Length marginBefore() const;
737 Length marginAfter() const;
738 Length marginStart() const;
739 Length marginEnd() const;
740 Length marginStartUsing(const RenderStyle* otherStyle) const;
741 Length marginEndUsing(const RenderStyle* otherStyle) const;
742 Length marginBeforeUsing(const RenderStyle* otherStyle) const;
743 Length marginAfterUsing(const RenderStyle* otherStyle) const;
745 LengthBox paddingBox() const { return surround->padding; }
746 Length paddingTop() const { return surround->padding.top(); }
747 Length paddingBottom() const { return surround->padding.bottom(); }
748 Length paddingLeft() const { return surround->padding.left(); }
749 Length paddingRight() const { return surround->padding.right(); }
750 Length paddingBefore() const;
751 Length paddingAfter() const;
752 Length paddingStart() const;
753 Length paddingEnd() const;
755 ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
757 CursorList* cursors() const { return rareInheritedData->cursorData.get(); }
759 EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
760 bool isLink() const { return noninherited_flags.isLink(); }
762 short widows() const { return rareInheritedData->widows; }
763 short orphans() const { return rareInheritedData->orphans; }
764 EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); }
765 EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); }
766 EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); }
768 // CSS3 Getter Methods
770 int outlineOffset() const
772 if (m_background->outline().style() == BNONE)
774 return m_background->outline().offset();
777 const ShadowData* textShadow() const { return rareInheritedData->textShadow.get(); }
778 void getTextShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }
779 void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
780 void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
781 void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }
782 void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }
784 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
785 ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
786 float opacity() const { return rareNonInheritedData->opacity; }
787 ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
788 // aspect ratio convenience method
789 bool hasAspectRatio() const { return rareNonInheritedData->m_hasAspectRatio; }
790 float aspectRatio() const { return aspectRatioNumerator() / aspectRatioDenominator(); }
791 float aspectRatioDenominator() const { return rareNonInheritedData->m_aspectRatioDenominator; }
792 float aspectRatioNumerator() const { return rareNonInheritedData->m_aspectRatioNumerator; }
793 EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->align); }
794 EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
795 float boxFlex() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex; }
796 unsigned int boxFlexGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex_group; }
797 EBoxLines boxLines() const { return static_cast<EBoxLines>(rareNonInheritedData->m_deprecatedFlexibleBox->lines); }
798 unsigned int boxOrdinalGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->ordinal_group; }
799 EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->m_deprecatedFlexibleBox->orient); }
800 EBoxPack boxPack() const { return static_cast<EBoxPack>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); }
802 float flexboxWidthPositiveFlex() const { return rareNonInheritedData->m_flexibleBox->m_widthPositiveFlex; }
803 float flexboxWidthNegativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_widthNegativeFlex; }
804 float flexboxHeightPositiveFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightPositiveFlex; }
805 float flexboxHeightNegativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightNegativeFlex; }
806 int flexOrder() const { return rareNonInheritedData->m_flexibleBox->m_flexOrder; }
807 EFlexPack flexPack() const { return static_cast<EFlexPack>(rareNonInheritedData->m_flexibleBox->m_flexPack); }
808 EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); }
809 EFlexAlign flexItemAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexItemAlign); }
810 EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
811 bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
812 bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
813 EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
815 #if ENABLE(CSS_GRID_LAYOUT)
816 const Vector<Length>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; }
817 const Vector<Length>& gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; }
819 const Length& gridItemColumn() const { return rareNonInheritedData->m_gridItem->m_gridColumn; }
820 const Length& gridItemRow() const { return rareNonInheritedData->m_gridItem->m_gridRow; }
823 const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
824 void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
825 void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
826 void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }
827 void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); }
828 void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); }
830 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
831 EBoxSizing boxSizing() const { return m_box->boxSizing(); }
832 Length marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; }
833 int marqueeSpeed() const { return rareNonInheritedData->m_marquee->speed; }
834 int marqueeLoopCount() const { return rareNonInheritedData->m_marquee->loops; }
835 EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->m_marquee->behavior); }
836 EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(rareNonInheritedData->m_marquee->direction); }
837 EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
838 EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
839 EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
840 TextOverflow textOverflow() const { return static_cast<TextOverflow>(rareNonInheritedData->textOverflow); }
841 EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); }
842 EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); }
843 EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
844 EWordWrap wordWrap() const { return static_cast<EWordWrap>(rareInheritedData->wordWrap); }
845 ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
846 EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(rareInheritedData->khtmlLineBreak); }
847 EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); }
848 const AtomicString& highlight() const { return rareInheritedData->highlight; }
849 Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
850 short hyphenationLimitBefore() const { return rareInheritedData->hyphenationLimitBefore; }
851 short hyphenationLimitAfter() const { return rareInheritedData->hyphenationLimitAfter; }
852 short hyphenationLimitLines() const { return rareInheritedData->hyphenationLimitLines; }
853 const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
854 const AtomicString& locale() const { return rareInheritedData->locale; }
855 EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
856 EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
857 ColumnAxis columnAxis() const { return static_cast<ColumnAxis>(rareNonInheritedData->m_multiCol->m_axis); }
858 bool hasInlineColumnAxis() const {
859 ColumnAxis axis = columnAxis();
860 return axis == AutoColumnAxis || isHorizontalWritingMode() == (axis == HorizontalColumnAxis);
862 float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
863 bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
864 unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
865 bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
866 bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth() || !hasInlineColumnAxis(); }
867 float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
868 bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
869 EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
870 unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
871 bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
872 ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheritedData->m_multiCol->m_columnSpan); }
873 EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
874 EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
875 EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
876 EPageBreak regionBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakBefore); }
877 EPageBreak regionBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakInside); }
878 EPageBreak regionBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakAfter); }
879 const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
880 Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
881 Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
882 float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
883 bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
885 TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(rareInheritedData->textEmphasisFill); }
886 TextEmphasisMark textEmphasisMark() const;
887 const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; }
888 TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); }
889 const AtomicString& textEmphasisMarkString() const;
891 // Return true if any transform related property (currently transform, transformStyle3D or perspective)
892 // indicates that we are transforming
893 bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
895 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
896 void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
897 void setPageScaleTransform(float);
899 bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
901 TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInheritedData->m_textCombine); }
902 bool hasTextCombine() const { return textCombine() != TextCombineNone; }
905 const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
906 const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
907 RegionOverflow regionOverflow() const { return static_cast<RegionOverflow>(rareNonInheritedData->m_regionOverflow); }
909 const AtomicString& lineGrid() const { return rareInheritedData->m_lineGrid; }
910 LineSnap lineSnap() const { return static_cast<LineSnap>(rareInheritedData->m_lineSnap); }
911 LineAlign lineAlign() const { return static_cast<LineAlign>(rareInheritedData->m_lineAlign); }
913 WrapFlow wrapFlow() const { return static_cast<WrapFlow>(rareNonInheritedData->m_wrapFlow); }
914 WrapThrough wrapThrough() const { return static_cast<WrapThrough>(rareNonInheritedData->m_wrapThrough); }
916 // Apple-specific property getter methods
917 EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
918 const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
919 const AnimationList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
921 AnimationList* accessAnimations();
922 AnimationList* accessTransitions();
924 bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
925 bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; }
927 // return the first found Animation (including 'all' transitions)
928 const Animation* transitionForProperty(int property) const;
930 ETransformStyle3D transformStyle3D() const { return static_cast<ETransformStyle3D>(rareNonInheritedData->m_transformStyle3D); }
931 bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
933 EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfaceVisibility>(rareNonInheritedData->m_backfaceVisibility); }
934 float perspective() const { return rareNonInheritedData->m_perspective; }
935 bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
936 Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
937 Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
938 LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; }
939 PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNonInheritedData->m_pageSizeType); }
941 #if USE(ACCELERATED_COMPOSITING)
942 // When set, this ensures that styles compare as different. Used during accelerated animations.
943 bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
946 LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
947 const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
948 #if ENABLE(TOUCH_EVENTS)
949 Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; }
951 #if ENABLE(OVERFLOW_SCROLLING)
952 bool useTouchOverflowScrolling() const { return rareInheritedData->useTouchOverflowScrolling; }
954 bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
955 ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
957 WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); }
958 bool isHorizontalWritingMode() const { return writingMode() == TopToBottomWritingMode || writingMode() == BottomToTopWritingMode; }
959 bool isFlippedLinesWritingMode() const { return writingMode() == LeftToRightWritingMode || writingMode() == BottomToTopWritingMode; }
960 bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; }
962 EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
964 ESpeak speak() { return static_cast<ESpeak>(rareInheritedData->speak); }
966 #if ENABLE(CSS_FILTERS)
967 FilterOperations& filter() { return rareNonInheritedData.access()->m_filter.access()->m_operations; }
968 const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; }
969 bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); }
971 bool hasFilter() const { return false; }
974 // attribute setter methods
976 void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; }
977 void setOriginalDisplay(EDisplay v) { noninherited_flags._originalDisplay = v; }
978 void setPosition(EPosition v) { noninherited_flags._position = v; }
979 void setFloating(EFloat v) { noninherited_flags._floating = v; }
981 void setLeft(Length v) { SET_VAR(surround, offset.m_left, v) }
982 void setRight(Length v) { SET_VAR(surround, offset.m_right, v) }
983 void setTop(Length v) { SET_VAR(surround, offset.m_top, v) }
984 void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v) }
986 void setWidth(Length v) { SET_VAR(m_box, m_width, v) }
987 void setHeight(Length v) { SET_VAR(m_box, m_height, v) }
989 void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, v) }
990 void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, v) }
991 void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, v) }
992 void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, v) }
994 #if ENABLE(DASHBOARD_SUPPORT)
995 Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
996 void setDashboardRegions(Vector<StyleDashboardRegion> regions) { SET_VAR(rareNonInheritedData, m_dashboardRegions, regions); }
998 void setDashboardRegion(int type, const String& label, Length t, Length r, Length b, Length l, bool append)
1000 StyleDashboardRegion region;
1001 region.label = label;
1002 region.offset.m_top = t;
1003 region.offset.m_right = r;
1004 region.offset.m_bottom = b;
1005 region.offset.m_left = l;
1008 rareNonInheritedData.access()->m_dashboardRegions.clear();
1009 rareNonInheritedData.access()->m_dashboardRegions.append(region);
1013 void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
1014 void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()) }
1015 void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()) }
1016 void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()) }
1017 void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()) }
1018 void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()) }
1019 void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
1020 void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()) }
1021 void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()) }
1022 void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()) }
1023 void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()) }
1025 void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v) }
1027 void setBackgroundXPosition(Length l) { SET_VAR(m_background, m_background.m_xPosition, l) }
1028 void setBackgroundYPosition(Length l) { SET_VAR(m_background, m_background.m_yPosition, l) }
1029 void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b) }
1030 void setBackgroundSizeLength(LengthSize l) { SET_VAR(m_background, m_background.m_sizeLength, l) }
1032 void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b) }
1033 void setBorderImageSource(PassRefPtr<StyleImage> v) { surround.access()->border.m_image.setImage(v); }
1034 void setBorderImageSlices(LengthBox slices) { surround.access()->border.m_image.setImageSlices(slices); }
1035 void setBorderImageWidth(LengthBox slices) { surround.access()->border.m_image.setBorderSlices(slices); }
1036 void setBorderImageOutset(LengthBox outset) { surround.access()->border.m_image.setOutset(outset); }
1038 void setBorderTopLeftRadius(LengthSize s) { SET_VAR(surround, border.m_topLeft, s) }
1039 void setBorderTopRightRadius(LengthSize s) { SET_VAR(surround, border.m_topRight, s) }
1040 void setBorderBottomLeftRadius(LengthSize s) { SET_VAR(surround, border.m_bottomLeft, s) }
1041 void setBorderBottomRightRadius(LengthSize s) { SET_VAR(surround, border.m_bottomRight, s) }
1043 void setBorderRadius(LengthSize s)
1045 setBorderTopLeftRadius(s);
1046 setBorderTopRightRadius(s);
1047 setBorderBottomLeftRadius(s);
1048 setBorderBottomRightRadius(s);
1050 void setBorderRadius(const IntSize& s)
1052 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
1055 RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1056 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1058 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
1059 LayoutUnit topWidth, LayoutUnit bottomWidth, LayoutUnit leftWidth, LayoutUnit rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
1061 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v) }
1062 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) }
1063 void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.m_left.m_color, v) }
1064 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_width, v) }
1065 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v) }
1066 void setBorderRightColor(const Color& v) { SET_VAR(surround, border.m_right.m_color, v) }
1067 void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v) }
1068 void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v) }
1069 void setBorderTopColor(const Color& v) { SET_VAR(surround, border.m_top.m_color, v) }
1070 void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_width, v) }
1071 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v) }
1072 void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.m_bottom.m_color, v) }
1074 void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v) }
1075 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto) }
1076 void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v) }
1077 void setOutlineColor(const Color& v) { SET_VAR(m_background, m_outline.m_color, v) }
1079 void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
1080 void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
1081 void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
1082 void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
1083 void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, length) }
1085 void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b) }
1086 void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v) }
1087 void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v) }
1088 void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v) }
1089 void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v) }
1090 void setClip(Length top, Length right, Length bottom, Length left);
1091 void setClip(LengthBox box) { SET_VAR(visual, clip, box) }
1093 void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
1095 void setClear(EClear v) { noninherited_flags._clear = v; }
1096 void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; }
1098 bool setFontDescription(const FontDescription& v)
1100 if (inherited->font.fontDescription() != v) {
1101 inherited.access()->font = Font(v, inherited->font.letterSpacing(), inherited->font.wordSpacing());
1107 // Only used for blending font sizes when animating.
1108 void setBlendedFontSize(int);
1110 void setColor(const Color& v) { SET_VAR(inherited, color, v) }
1111 void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v) }
1112 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
1113 void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
1114 void addToTextDecorationsInEffect(ETextDecoration v) { inherited_flags._text_decorations |= v; }
1115 void setTextDecorationsInEffect(ETextDecoration v) { inherited_flags._text_decorations = v; }
1116 void setTextDecoration(ETextDecoration v) { SET_VAR(visual, textDecoration, v); }
1117 void setDirection(TextDirection v) { inherited_flags._direction = v; }
1118 void setLineHeight(Length v) { SET_VAR(inherited, line_height, v) }
1119 bool setZoom(float);
1120 void setZoomWithoutReturnValue(float f) { setZoom(f); }
1121 bool setEffectiveZoom(float);
1122 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v) }
1124 void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
1126 void setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }
1127 void setLetterSpacing(int v) { inherited.access()->font.setLetterSpacing(v); }
1129 void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
1130 void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
1132 void adjustBackgroundLayers()
1134 if (backgroundLayers()->next()) {
1135 accessBackgroundLayers()->cullEmptyLayers();
1136 accessBackgroundLayers()->fillUnsetProperties();
1140 void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); }
1141 void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; }
1143 void adjustMaskLayers()
1145 if (maskLayers()->next()) {
1146 accessMaskLayers()->cullEmptyLayers();
1147 accessMaskLayers()->fillUnsetProperties();
1151 void setMaskImage(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_mask.setImage(v); }
1153 void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b) }
1154 void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
1155 void setMaskXPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, l) }
1156 void setMaskYPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, l) }
1157 void setMaskSize(LengthSize l) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, l) }
1159 void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
1160 void setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v) }
1161 void setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v) }
1162 void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
1163 void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
1165 void setHasAspectRatio(bool b) { SET_VAR(rareNonInheritedData, m_hasAspectRatio, b); }
1166 void setAspectRatioDenominator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioDenominator, v); }
1167 void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); }
1168 void setCounterIncrement(short v) { SET_VAR(rareNonInheritedData, m_counterIncrement, v) }
1169 void setCounterReset(short v) { SET_VAR(rareNonInheritedData, m_counterReset, v) }
1171 void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
1172 void setListStyleImage(PassRefPtr<StyleImage> v) { if (inherited->list_style_image != v) inherited.access()->list_style_image = v; }
1173 void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
1175 void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)) }
1176 void setMarginTop(Length v) { SET_VAR(surround, margin.m_top, v) }
1177 void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v) }
1178 void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v) }
1179 void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v) }
1180 void setMarginStart(Length);
1181 void setMarginEnd(Length);
1183 void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)) }
1184 void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b) }
1185 void setPaddingTop(Length v) { SET_VAR(surround, padding.m_top, v) }
1186 void setPaddingBottom(Length v) { SET_VAR(surround, padding.m_bottom, v) }
1187 void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v) }
1188 void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v) }
1190 void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
1191 void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
1192 void setCursorList(PassRefPtr<CursorList>);
1193 void clearCursorList();
1195 void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
1196 void setIsLink(bool b) { noninherited_flags.setIsLink(b); }
1198 PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(inherited_flags.m_printColorAdjust); }
1199 void setPrintColorAdjust(PrintColorAdjust value) { inherited_flags.m_printColorAdjust = value; }
1201 bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
1202 void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_box, m_zIndex, 0) }
1203 int zIndex() const { return m_box->zIndex(); }
1204 void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v) }
1206 void setWidows(short w) { SET_VAR(rareInheritedData, widows, w); }
1207 void setOrphans(short o) { SET_VAR(rareInheritedData, orphans, o); }
1208 // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
1209 void setPageBreakInside(EPageBreak b) { ASSERT(b == PBAUTO || b == PBAVOID); noninherited_flags._page_break_inside = b; }
1210 void setPageBreakBefore(EPageBreak b) { noninherited_flags._page_break_before = b; }
1211 void setPageBreakAfter(EPageBreak b) { noninherited_flags._page_break_after = b; }
1214 void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v) }
1215 void setTextShadow(PassOwnPtr<ShadowData>, bool add = false);
1216 void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
1217 void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w) }
1218 void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c) }
1219 void setColorSpace(ColorSpace space) { SET_VAR(rareInheritedData, colorSpace, space) }
1220 void setOpacity(float f) { SET_VAR(rareNonInheritedData, opacity, f); }
1221 void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
1222 // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
1223 void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, align, a); }
1224 void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
1225 void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex, f); }
1226 void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex_group, fg); }
1227 void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, lines, l); }
1228 void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, ordinal_group, og); }
1229 void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, orient, o); }
1230 void setBoxPack(EBoxPack p) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, pack, p); }
1231 void setBoxShadow(PassOwnPtr<ShadowData>, bool add = false);
1232 void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
1233 void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
1234 void setFlexboxWidthPositiveFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_widthPositiveFlex, f); }
1235 void setFlexboxWidthNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_widthNegativeFlex, f); }
1236 void setFlexboxHeightPositiveFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightPositiveFlex, f); }
1237 void setFlexboxHeightNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightNegativeFlex, f); }
1238 void setFlexOrder(int o) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexOrder, o); }
1239 void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); }
1240 void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); }
1241 void setFlexItemAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexItemAlign, a); }
1242 void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
1243 void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
1244 #if ENABLE(CSS_GRID_LAYOUT)
1245 void setGridColumns(const Vector<Length>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); }
1246 void setGridRows(const Vector<Length>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, lengths); }
1248 void setGridItemColumn(const Length& columnPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumn, columnPosition); }
1249 void setGridItemRow(const Length& rowPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRow, rowPosition); }
1252 void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
1253 void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
1254 void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
1255 void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->m_marquee, behavior, b); }
1256 void setMarqueeLoopCount(int i) { SET_VAR(rareNonInheritedData.access()->m_marquee, loops, i); }
1257 void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
1258 void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
1259 void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
1260 void setTextOverflow(TextOverflow overflow) { SET_VAR(rareNonInheritedData, textOverflow, overflow); }
1261 void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); }
1262 void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); }
1263 void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
1264 void setWordWrap(EWordWrap b) { SET_VAR(rareInheritedData, wordWrap, b); }
1265 void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
1266 void setKHTMLLineBreak(EKHTMLLineBreak b) { SET_VAR(rareInheritedData, khtmlLineBreak, b); }
1267 void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(rareNonInheritedData, matchNearestMailBlockquoteColor, c); }
1268 void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
1269 void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
1270 void setHyphenationLimitBefore(short limit) { SET_VAR(rareInheritedData, hyphenationLimitBefore, limit); }
1271 void setHyphenationLimitAfter(short limit) { SET_VAR(rareInheritedData, hyphenationLimitAfter, limit); }
1272 void setHyphenationLimitLines(short limit) { SET_VAR(rareInheritedData, hyphenationLimitLines, limit); }
1273 void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
1274 void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); }
1275 void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
1276 void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
1277 void setColumnAxis(ColumnAxis axis) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_axis, axis); }
1278 void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
1279 void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
1280 void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
1281 void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
1282 void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
1283 void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
1284 void setColumnRuleColor(const Color& c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_color, c); }
1285 void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
1286 void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
1287 void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
1288 void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, columnSpan); }
1289 void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
1290 // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
1291 void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
1292 void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
1293 void setRegionBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakBefore, p); }
1294 void setRegionBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData, m_regionBreakInside, p); }
1295 void setRegionBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakAfter, p); }
1296 void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
1297 void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
1298 void setTransformOriginX(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); }
1299 void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
1300 void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
1301 void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
1302 void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
1303 void setTextEmphasisColor(const Color& c) { SET_VAR(rareInheritedData, textEmphasisColor, c) }
1304 void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); }
1305 void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); }
1306 void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); }
1307 void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); }
1309 #if ENABLE(CSS_FILTERS)
1310 void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); }
1315 void setLineGrid(const AtomicString& lineGrid) { SET_VAR(rareInheritedData, m_lineGrid, lineGrid); }
1316 void setLineSnap(LineSnap lineSnap) { SET_VAR(rareInheritedData, m_lineSnap, lineSnap); }
1317 void setLineAlign(LineAlign lineAlign) { SET_VAR(rareInheritedData, m_lineAlign, lineAlign); }
1319 void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); }
1320 void setRegionThread(const AtomicString& regionThread) { SET_VAR(rareNonInheritedData, m_regionThread, regionThread); }
1321 void setRegionOverflow(RegionOverflow regionOverflow) { SET_VAR(rareNonInheritedData, m_regionOverflow, regionOverflow); }
1323 void setWrapFlow(WrapFlow wrapFlow) { SET_VAR(rareNonInheritedData, m_wrapFlow, wrapFlow); }
1324 void setWrapThrough(WrapThrough wrapThrough) { SET_VAR(rareNonInheritedData, m_wrapThrough, wrapThrough); }
1326 // Apple-specific property setters
1327 void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
1329 void clearAnimations()
1331 rareNonInheritedData.access()->m_animations.clear();
1334 void clearTransitions()
1336 rareNonInheritedData.access()->m_transitions.clear();
1339 void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; }
1340 void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; }
1341 void adjustAnimations();
1342 void adjustTransitions();
1344 void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
1345 void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
1346 void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
1347 void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
1348 void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
1349 void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
1350 void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
1351 void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
1353 #if USE(ACCELERATED_COMPOSITING)
1354 void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
1357 void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
1358 void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
1359 #if ENABLE(TOUCH_EVENTS)
1360 void setTapHighlightColor(const Color& c) { SET_VAR(rareInheritedData, tapHighlightColor, c); }
1362 #if ENABLE(OVERFLOW_SCROLLING)
1363 void setUseTouchOverflowScrolling(bool v) { SET_VAR(rareInheritedData, useTouchOverflowScrolling, v); }
1365 bool setTextSizeAdjust(bool);
1366 void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
1369 const SVGRenderStyle* svgStyle() const { return m_svgStyle.get(); }
1370 SVGRenderStyle* accessSVGStyle() { return m_svgStyle.access(); }
1372 const SVGPaint::SVGPaintType& fillPaintType() const { return svgStyle()->fillPaintType(); }
1373 const Color& fillPaintColor() const { return svgStyle()->fillPaintColor(); }
1374 void setFillPaintColor(const Color& c) { accessSVGStyle()->setFillPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
1375 float fillOpacity() const { return svgStyle()->fillOpacity(); }
1376 void setFillOpacity(float f) { accessSVGStyle()->setFillOpacity(f); }
1378 const SVGPaint::SVGPaintType& strokePaintType() const { return svgStyle()->strokePaintType(); }
1379 const Color& strokePaintColor() const { return svgStyle()->strokePaintColor(); }
1380 void setStrokePaintColor(const Color& c) { accessSVGStyle()->setStrokePaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
1381 float strokeOpacity() const { return svgStyle()->strokeOpacity(); }
1382 void setStrokeOpacity(float f) { accessSVGStyle()->setStrokeOpacity(f); }
1383 SVGLength strokeWidth() const { return svgStyle()->strokeWidth(); }
1384 void setStrokeWidth(SVGLength w) { accessSVGStyle()->setStrokeWidth(w); }
1385 SVGLength strokeDashOffset() const { return svgStyle()->strokeDashOffset(); }
1386 void setStrokeDashOffset(SVGLength d) { accessSVGStyle()->setStrokeDashOffset(d); }
1387 float strokeMiterLimit() const { return svgStyle()->strokeMiterLimit(); }
1388 void setStrokeMiterLimit(float f) { accessSVGStyle()->setStrokeMiterLimit(f); }
1390 float floodOpacity() const { return svgStyle()->floodOpacity(); }
1391 void setFloodOpacity(float f) { accessSVGStyle()->setFloodOpacity(f); }
1393 float stopOpacity() const { return svgStyle()->stopOpacity(); }
1394 void setStopOpacity(float f) { accessSVGStyle()->setStopOpacity(f); }
1396 void setStopColor(const Color& c) { accessSVGStyle()->setStopColor(c); }
1397 void setFloodColor(const Color& c) { accessSVGStyle()->setFloodColor(c); }
1398 void setLightingColor(const Color& c) { accessSVGStyle()->setLightingColor(c); }
1400 SVGLength baselineShiftValue() const { return svgStyle()->baselineShiftValue(); }
1401 void setBaselineShiftValue(SVGLength s) { accessSVGStyle()->setBaselineShiftValue(s); }
1402 SVGLength kerning() const { return svgStyle()->kerning(); }
1403 void setKerning(SVGLength k) { accessSVGStyle()->setKerning(k); }
1406 void setWrapShapeInside(PassRefPtr<CSSWrapShape> shape)
1408 if (rareNonInheritedData->m_wrapShapeInside != shape)
1409 rareNonInheritedData.access()->m_wrapShapeInside = shape;
1411 CSSWrapShape* wrapShapeInside() const { return rareNonInheritedData->m_wrapShapeInside.get(); }
1413 void setWrapShapeOutside(PassRefPtr<CSSWrapShape> shape)
1415 if (rareNonInheritedData->m_wrapShapeOutside != shape)
1416 rareNonInheritedData.access()->m_wrapShapeOutside = shape;
1418 CSSWrapShape* wrapShapeOutside() const { return rareNonInheritedData->m_wrapShapeOutside.get(); }
1420 static CSSWrapShape* initialWrapShapeInside() { return 0; }
1421 static CSSWrapShape* initialWrapShapeOutside() { return 0; }
1423 Length wrapPadding() const { return rareNonInheritedData->m_wrapPadding; }
1424 void setWrapPadding(Length wrapPadding) { SET_VAR(rareNonInheritedData, m_wrapPadding, wrapPadding); }
1425 static Length initialWrapPadding() { return Length(0, Fixed); }
1427 Length wrapMargin() const { return rareNonInheritedData->m_wrapMargin; }
1428 void setWrapMargin(Length wrapMargin) { SET_VAR(rareNonInheritedData, m_wrapMargin, wrapMargin); }
1429 static Length initialWrapMargin() { return Length(0, Fixed); }
1431 bool hasContent() const { return contentData(); }
1432 const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
1433 bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
1434 void clearContent();
1435 void setContent(const String&, bool add = false);
1436 void setContent(PassRefPtr<StyleImage>, bool add = false);
1437 void setContent(PassOwnPtr<CounterContent>, bool add = false);
1438 void setContent(QuoteType, bool add = false);
1440 const CounterDirectiveMap* counterDirectives() const;
1441 CounterDirectiveMap& accessCounterDirectives();
1443 QuotesData* quotes() const { return rareInheritedData->quotes.get(); }
1444 void setQuotes(PassRefPtr<QuotesData>);
1446 const AtomicString& hyphenString() const;
1448 bool inheritedNotEqual(const RenderStyle*) const;
1449 bool inheritedDataShared(const RenderStyle*) const;
1451 StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1453 bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); }
1454 bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
1455 bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
1457 void setWritingMode(WritingMode v) { inherited_flags.m_writingMode = v; }
1459 // To tell if this style matched attribute selectors. This makes it impossible to share.
1460 bool affectedByUncommonAttributeSelectors() const { return m_bitfields.affectedByUncommonAttributeSelectors(); }
1461 void setAffectedByUncommonAttributeSelectors() { m_bitfields.setAffectedByUncommonAttributeSelectors(true); }
1463 bool unique() const { return m_bitfields.unique(); }
1464 void setUnique() { m_bitfields.setUnique(true); }
1466 // Methods for indicating the style is affected by dynamic updates (e.g., children changing, our position changing in our sibling list, etc.)
1467 bool affectedByEmpty() const { return m_bitfields.affectedByEmpty(); }
1468 bool emptyState() const { return m_bitfields.emptyState(); }
1469 void setEmptyState(bool b) { m_bitfields.setAffectedByEmpty(true); m_bitfields.setUnique(true); m_bitfields.setEmptyState(b); }
1470 bool childrenAffectedByPositionalRules() const { return childrenAffectedByForwardPositionalRules() || childrenAffectedByBackwardPositionalRules(); }
1471 bool childrenAffectedByFirstChildRules() const { return m_bitfields.childrenAffectedByFirstChildRules(); }
1472 void setChildrenAffectedByFirstChildRules() { m_bitfields.setChildrenAffectedByFirstChildRules(true); }
1473 bool childrenAffectedByLastChildRules() const { return m_bitfields.childrenAffectedByLastChildRules(); }
1474 void setChildrenAffectedByLastChildRules() { m_bitfields.setChildrenAffectedByLastChildRules(true); }
1475 bool childrenAffectedByDirectAdjacentRules() const { return m_bitfields.childrenAffectedByDirectAdjacentRules(); }
1476 void setChildrenAffectedByDirectAdjacentRules() { m_bitfields.setChildrenAffectedByDirectAdjacentRules(true); }
1477 bool childrenAffectedByForwardPositionalRules() const { return m_bitfields.childrenAffectedByForwardPositionalRules(); }
1478 void setChildrenAffectedByForwardPositionalRules() { m_bitfields.setChildrenAffectedByForwardPositionalRules(true); }
1479 bool childrenAffectedByBackwardPositionalRules() const { return m_bitfields.childrenAffectedByBackwardPositionalRules(); }
1480 void setChildrenAffectedByBackwardPositionalRules() { m_bitfields.setChildrenAffectedByBackwardPositionalRules(true); }
1481 bool firstChildState() const { return m_bitfields.firstChildState(); }
1482 void setFirstChildState() { m_bitfields.setUnique(true); m_bitfields.setFirstChildState(true); }
1483 bool lastChildState() const { return m_bitfields.lastChildState(); }
1484 void setLastChildState() { m_bitfields.setUnique(true); m_bitfields.setLastChildState(true); }
1485 unsigned childIndex() const { return m_bitfields.childIndex(); }
1486 void setChildIndex(unsigned index) { m_bitfields.setUnique(true); m_bitfields.setChildIndex(index); }
1488 Color visitedDependentColor(int colorProperty) const;
1490 void setHasExplicitlyInheritedProperties() { m_bitfields.setExplicitInheritance(true); }
1491 bool hasExplicitlyInheritedProperties() const { return m_bitfields.explicitInheritance(); }
1493 // Initial values for all the properties
1494 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1495 static EBorderStyle initialBorderStyle() { return BNONE; }
1496 static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
1497 static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
1498 static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
1499 static ECaptionSide initialCaptionSide() { return CAPTOP; }
1500 static EClear initialClear() { return CNONE; }
1501 static ColorSpace initialColorSpace() { return ColorSpaceDeviceRGB; }
1502 static ColumnAxis initialColumnAxis() { return AutoColumnAxis; }
1503 static TextDirection initialDirection() { return LTR; }
1504 static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
1505 static TextCombine initialTextCombine() { return TextCombineNone; }
1506 static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
1507 static EDisplay initialDisplay() { return INLINE; }
1508 static EEmptyCell initialEmptyCells() { return SHOW; }
1509 static EFloat initialFloating() { return NoFloat; }
1510 static EListStylePosition initialListStylePosition() { return OUTSIDE; }
1511 static EListStyleType initialListStyleType() { return Disc; }
1512 static EOverflow initialOverflowX() { return OVISIBLE; }
1513 static EOverflow initialOverflowY() { return OVISIBLE; }
1514 static EPageBreak initialPageBreak() { return PBAUTO; }
1515 static EPosition initialPosition() { return StaticPosition; }
1516 static ETableLayout initialTableLayout() { return TAUTO; }
1517 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
1518 static ETextTransform initialTextTransform() { return TTNONE; }
1519 static EVisibility initialVisibility() { return VISIBLE; }
1520 static EWhiteSpace initialWhiteSpace() { return NORMAL; }
1521 static short initialHorizontalBorderSpacing() { return 0; }
1522 static short initialVerticalBorderSpacing() { return 0; }
1523 static ECursor initialCursor() { return CURSOR_AUTO; }
1524 static Color initialColor() { return Color::black; }
1525 static StyleImage* initialListStyleImage() { return 0; }
1526 static unsigned initialBorderWidth() { return 3; }
1527 static unsigned short initialColumnRuleWidth() { return 3; }
1528 static unsigned short initialOutlineWidth() { return 3; }
1529 static int initialLetterWordSpacing() { return 0; }
1530 static Length initialSize() { return Length(); }
1531 static Length initialMinSize() { return Length(0, Fixed); }
1532 static Length initialMaxSize() { return Length(Undefined); }
1533 static Length initialOffset() { return Length(); }
1534 static Length initialMargin() { return Length(Fixed); }
1535 static Length initialPadding() { return Length(Fixed); }
1536 static Length initialTextIndent() { return Length(Fixed); }
1537 static EVerticalAlign initialVerticalAlign() { return BASELINE; }
1538 static short initialWidows() { return 2; }
1539 static short initialOrphans() { return 2; }
1540 static Length initialLineHeight() { return Length(-100.0, Percent); }
1541 static ETextAlign initialTextAlign() { return TAAUTO; }
1542 static ETextDecoration initialTextDecoration() { return TDNONE; }
1543 static float initialZoom() { return 1.0f; }
1544 static int initialOutlineOffset() { return 0; }
1545 static float initialOpacity() { return 1.0f; }
1546 static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
1547 static EBoxDirection initialBoxDirection() { return BNORMAL; }
1548 static EBoxLines initialBoxLines() { return SINGLE; }
1549 static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
1550 static EBoxPack initialBoxPack() { return Start; }
1551 static float initialBoxFlex() { return 0.0f; }
1552 static unsigned int initialBoxFlexGroup() { return 1; }
1553 static unsigned int initialBoxOrdinalGroup() { return 1; }
1554 static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
1555 static StyleReflection* initialBoxReflect() { return 0; }
1556 static float initialFlexboxWidthPositiveFlex() { return 0; }
1557 static float initialFlexboxWidthNegativeFlex() { return 0; }
1558 static float initialFlexboxHeightPositiveFlex() { return 0; }
1559 static float initialFlexboxHeightNegativeFlex() { return 0; }
1560 static int initialFlexOrder() { return 0; }
1561 static EFlexPack initialFlexPack() { return PackStart; }
1562 static EFlexAlign initialFlexAlign() { return AlignStretch; }
1563 static EFlexAlign initialFlexItemAlign() { return AlignAuto; }
1564 static EFlexDirection initialFlexDirection() { return FlowRow; }
1565 static EFlexWrap initialFlexWrap() { return FlexWrapNone; }
1566 static int initialMarqueeLoopCount() { return -1; }
1567 static int initialMarqueeSpeed() { return 85; }
1568 static Length initialMarqueeIncrement() { return Length(6, Fixed); }
1569 static EMarqueeBehavior initialMarqueeBehavior() { return MSCROLL; }
1570 static EMarqueeDirection initialMarqueeDirection() { return MAUTO; }
1571 static EUserModify initialUserModify() { return READ_ONLY; }
1572 static EUserDrag initialUserDrag() { return DRAG_AUTO; }
1573 static EUserSelect initialUserSelect() { return SELECT_TEXT; }
1574 static TextOverflow initialTextOverflow() { return TextOverflowClip; }
1575 static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; }
1576 static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; }
1577 static EWordBreak initialWordBreak() { return NormalWordBreak; }
1578 static EWordWrap initialWordWrap() { return NormalWordWrap; }
1579 static ENBSPMode initialNBSPMode() { return NBNORMAL; }
1580 static EKHTMLLineBreak initialKHTMLLineBreak() { return LBNORMAL; }
1581 static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; }
1582 static const AtomicString& initialHighlight() { return nullAtom; }
1583 static ESpeak initialSpeak() { return SpeakNormal; }
1584 static Hyphens initialHyphens() { return HyphensManual; }
1585 static short initialHyphenationLimitBefore() { return -1; }
1586 static short initialHyphenationLimitAfter() { return -1; }
1587 static short initialHyphenationLimitLines() { return -1; }
1588 static const AtomicString& initialHyphenationString() { return nullAtom; }
1589 static const AtomicString& initialLocale() { return nullAtom; }
1590 static EBorderFit initialBorderFit() { return BorderFitBorder; }
1591 static EResize initialResize() { return RESIZE_NONE; }
1592 static ControlPart initialAppearance() { return NoControlPart; }
1593 static bool initialHasAspectRatio() { return false; }
1594 static float initialAspectRatioDenominator() { return 1; }
1595 static float initialAspectRatioNumerator() { return 1; }
1596 static Order initialRTLOrdering() { return LogicalOrder; }
1597 static float initialTextStrokeWidth() { return 0; }
1598 static unsigned short initialColumnCount() { return 1; }
1599 static ColumnSpan initialColumnSpan() { return ColumnSpanOne; }
1600 static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
1601 static Length initialTransformOriginX() { return Length(50.0, Percent); }
1602 static Length initialTransformOriginY() { return Length(50.0, Percent); }
1603 static EPointerEvents initialPointerEvents() { return PE_AUTO; }
1604 static float initialTransformOriginZ() { return 0; }
1605 static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
1606 static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
1607 static float initialPerspective() { return 0; }
1608 static Length initialPerspectiveOriginX() { return Length(50.0, Percent); }
1609 static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
1610 static Color initialBackgroundColor() { return Color::transparent; }
1611 static Color initialTextEmphasisColor() { return TextEmphasisFillFilled; }
1612 static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; }
1613 static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
1614 static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
1615 static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
1616 static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
1617 static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
1618 static StyleImage* initialBorderImageSource() { return 0; }
1619 static StyleImage* initialMaskBoxImageSource() { return 0; }
1620 static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
1622 #if ENABLE(CSS_GRID_LAYOUT)
1623 // The initial value is 'none' for grid tracks.
1624 static Vector<Length> initialGridTrackValue()
1626 DEFINE_STATIC_LOCAL(Vector<Length>, defaultLength, ());
1627 // We need to manually add the Length here as the Length(0) is 'auto'.
1628 if (!defaultLength.size())
1629 defaultLength.append(Length(Undefined));
1630 return defaultLength;
1632 static Vector<Length> initialGridColumns() { return initialGridTrackValue(); }
1633 static Vector<Length> initialGridRows() { return initialGridTrackValue(); }
1635 // 'auto' is the default.
1636 static Length initialGridItemColumn() { return Length(); }
1637 static Length initialGridItemRow() { return Length(); }
1640 static const AtomicString& initialLineGrid() { return nullAtom; }
1641 static LineSnap initialLineSnap() { return LineSnapNone; }
1642 static LineAlign initialLineAlign() { return LineAlignNone; }
1644 static const AtomicString& initialFlowThread() { return nullAtom; }
1645 static const AtomicString& initialRegionThread() { return nullAtom; }
1646 static RegionOverflow initialRegionOverflow() { return AutoRegionOverflow; }
1648 static WrapFlow initialWrapFlow() { return WrapFlowAuto; }
1649 static WrapThrough initialWrapThrough() { return WrapThroughWrap; }
1651 // Keep these at the end.
1652 static LineClampValue initialLineClamp() { return LineClampValue(); }
1653 static bool initialTextSizeAdjust() { return true; }
1654 static ETextSecurity initialTextSecurity() { return TSNONE; }
1655 #if ENABLE(TOUCH_EVENTS)
1656 static Color initialTapHighlightColor();
1658 #if ENABLE(OVERFLOW_SCROLLING)
1659 static bool initialUseTouchOverflowScrolling() { return false; }
1661 #if ENABLE(DASHBOARD_SUPPORT)
1662 static const Vector<StyleDashboardRegion>& initialDashboardRegions();
1663 static const Vector<StyleDashboardRegion>& noneDashboardRegions();
1665 #if ENABLE(CSS_FILTERS)
1666 static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
1669 void setVisitedLinkColor(const Color& v) { SET_VAR(inherited, visitedLinkColor, v) }
1670 void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v) }
1671 void setVisitedLinkBorderLeftColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v) }
1672 void setVisitedLinkBorderRightColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v) }
1673 void setVisitedLinkBorderBottomColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v) }
1674 void setVisitedLinkBorderTopColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v) }
1675 void setVisitedLinkOutlineColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v) }
1676 void setVisitedLinkColumnRuleColor(const Color& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v) }
1677 void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextEmphasisColor, v) }
1678 void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextFillColor, v) }
1679 void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextStrokeColor, v) }
1681 void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
1682 void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
1683 void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const;
1684 void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom) const;
1685 void getShadowInlineDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
1687 return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight);
1689 void getShadowBlockDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
1691 return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom);
1694 // Helpers for obtaining border image outsets for overflow.
1695 void getImageHorizontalOutsets(const NinePieceImage&, LayoutUnit& left, LayoutUnit& right) const;
1696 void getImageVerticalOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& bottom) const;
1697 void getImageInlineDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
1699 return isHorizontalWritingMode() ? getImageHorizontalOutsets(image, logicalLeft, logicalRight) : getImageVerticalOutsets(image, logicalLeft, logicalRight);
1701 void getImageBlockDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
1703 return isHorizontalWritingMode() ? getImageVerticalOutsets(image, logicalTop, logicalBottom) : getImageHorizontalOutsets(image, logicalTop, logicalBottom);
1706 bool isDisplayReplacedType(EDisplay display) const
1708 return display == INLINE_BLOCK || display == INLINE_BOX || display == INLINE_FLEXBOX || display == INLINE_TABLE;
1710 bool isDisplayInlineType(EDisplay display) const { return display == INLINE || isDisplayReplacedType(display); }
1712 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
1713 const Color& invalidColor() const { static Color invalid; return invalid; }
1714 const Color& borderLeftColor() const { return surround->border.left().color(); }
1715 const Color& borderRightColor() const { return surround->border.right().color(); }
1716 const Color& borderTopColor() const { return surround->border.top().color(); }
1717 const Color& borderBottomColor() const { return surround->border.bottom().color(); }
1718 const Color& backgroundColor() const { return m_background->color(); }
1719 const Color& color() const { return inherited->color; }
1720 const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
1721 const Color& outlineColor() const { return m_background->outline().color(); }
1722 const Color& textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
1723 const Color& textFillColor() const { return rareInheritedData->textFillColor; }
1724 const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
1725 const Color& visitedLinkColor() const { return inherited->visitedLinkColor; }
1726 const Color& visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
1727 const Color& visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
1728 const Color& visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
1729 const Color& visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
1730 const Color& visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
1731 const Color& visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
1732 const Color& visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
1733 const Color& visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor; }
1734 const Color& visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor; }
1735 const Color& visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor; }
1737 Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
1740 const Color& stopColor() const { return svgStyle()->stopColor(); }
1741 const Color& floodColor() const { return svgStyle()->floodColor(); }
1742 const Color& lightingColor() const { return svgStyle()->lightingColor(); }
1745 void appendContent(PassOwnPtr<ContentData>);
1748 inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
1750 double zoomFactor = style->effectiveZoom();
1751 if (zoomFactor == 1)
1753 // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
1754 if (zoomFactor > 1) {
1761 return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(value / zoomFactor);
1764 inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)
1766 return value / style->effectiveZoom();
1769 inline bool RenderStyle::setZoom(float f)
1771 if (compareEqual(visual->m_zoom, f))
1773 visual.access()->m_zoom = f;
1774 setEffectiveZoom(effectiveZoom() * zoom());
1778 inline bool RenderStyle::setEffectiveZoom(float f)
1780 if (compareEqual(rareInheritedData->m_effectiveZoom, f))
1782 rareInheritedData.access()->m_effectiveZoom = f;
1786 inline bool RenderStyle::setTextSizeAdjust(bool b)
1788 if (compareEqual(rareInheritedData->textSizeAdjust, b))
1790 rareInheritedData.access()->textSizeAdjust = b;
1794 } // namespace WebCore
1796 #endif // RenderStyle_h