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 "CSSPropertyNames.h"
29 #include "core/css/CSSLengthFunctions.h"
30 #include "core/css/CSSLineBoxContainValue.h"
31 #include "core/css/CSSPrimitiveValue.h"
32 #include "core/platform/ThemeTypes.h"
33 #include "core/platform/animation/CSSAnimationDataList.h"
34 #include "core/rendering/style/BorderValue.h"
35 #include "core/rendering/style/CounterDirectives.h"
36 #include "core/rendering/style/DataRef.h"
37 #include "core/rendering/style/LineClampValue.h"
38 #include "core/rendering/style/NinePieceImage.h"
39 #include "core/rendering/style/OutlineValue.h"
40 #include "core/rendering/style/RenderStyleConstants.h"
41 #include "core/rendering/style/SVGRenderStyle.h"
42 #include "core/rendering/style/ShapeValue.h"
43 #include "core/rendering/style/StyleBackgroundData.h"
44 #include "core/rendering/style/StyleBoxData.h"
45 #include "core/rendering/style/StyleDeprecatedFlexibleBoxData.h"
46 #include "core/rendering/style/StyleFilterData.h"
47 #include "core/rendering/style/StyleFlexibleBoxData.h"
48 #include "core/rendering/style/StyleGridData.h"
49 #include "core/rendering/style/StyleGridItemData.h"
50 #include "core/rendering/style/StyleMarqueeData.h"
51 #include "core/rendering/style/StyleMultiColData.h"
52 #include "core/rendering/style/StyleRareInheritedData.h"
53 #include "core/rendering/style/StyleRareNonInheritedData.h"
54 #include "core/rendering/style/StyleReflection.h"
55 #include "core/rendering/style/StyleSurroundData.h"
56 #include "core/rendering/style/StyleTransformData.h"
57 #include "core/rendering/style/StyleVisualData.h"
58 #include "core/svg/SVGPaint.h"
59 #include "platform/Length.h"
60 #include "platform/LengthBox.h"
61 #include "platform/LengthSize.h"
62 #include "platform/fonts/FontBaseline.h"
63 #include "platform/fonts/FontDescription.h"
64 #include "platform/geometry/LayoutBoxExtent.h"
65 #include "platform/geometry/RoundedRect.h"
66 #include "platform/graphics/Color.h"
67 #include "platform/graphics/GraphicsTypes.h"
68 #include "platform/text/TextDirection.h"
69 #include "platform/text/UnicodeBidi.h"
70 #include "platform/transforms/TransformOperations.h"
71 #include "wtf/Forward.h"
72 #include "wtf/OwnPtr.h"
73 #include "wtf/RefCounted.h"
74 #include "wtf/StdLibExtras.h"
75 #include "wtf/Vector.h"
77 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
79 #define SET_VAR(group, variable, value) \
80 if (!compareEqual(group->variable, value)) \
81 group.access()->variable = value
83 #define SET_BORDERVALUE_COLOR(group, variable, value) \
84 if (!compareEqual(group->variable.color(), value)) \
85 group.access()->variable.setColor(value)
91 class FilterOperations;
102 class StyleInheritedData;
104 class TransformationMatrix;
108 typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
110 class RenderStyle: public RefCounted<RenderStyle> {
111 friend class AnimatedStyleBuilder; // Used by Web Animations CSS. Sets the color styles
112 friend class CSSAnimatableValueFactory; // Used by Web Animations CSS. Gets visited and unvisited colors separately.
113 friend class CSSPropertyAnimation; // Used by CSS animations. We can't allow them to animate based off visited colors.
114 friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
115 friend class EditingStyle; // Editing has to only reveal unvisited info.
116 friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info.
117 friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
118 friend class StyleBuilderFunctions; // Sets color styles
119 friend class StyleBuilderConverter; // Reads unvisited color style for shadow currentColor
120 friend class StyleBuilder; // FIXME: Revove this! StyleBuilder::oldApplyProperty reads color().
121 friend class StyleResolver; // Sets members directly.
122 friend class CachedUAStyle; // Saves Border/Background information for later comparison.
125 // non-inherited attributes
126 DataRef<StyleBoxData> m_box;
127 DataRef<StyleVisualData> visual;
128 DataRef<StyleBackgroundData> m_background;
129 DataRef<StyleSurroundData> surround;
130 DataRef<StyleRareNonInheritedData> rareNonInheritedData;
132 // inherited attributes
133 DataRef<StyleRareInheritedData> rareInheritedData;
134 DataRef<StyleInheritedData> inherited;
136 // list of associated pseudo styles
137 OwnPtr<PseudoStyleCache> m_cachedPseudoStyles;
139 DataRef<SVGRenderStyle> m_svgStyle;
141 // !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp and implicitlyInherited() in StyleResolver.cpp
144 struct InheritedFlags {
145 bool operator==(const InheritedFlags& other) const
147 return (_empty_cells == other._empty_cells)
148 && (_caption_side == other._caption_side)
149 && (_list_style_type == other._list_style_type)
150 && (_list_style_position == other._list_style_position)
151 && (_visibility == other._visibility)
152 && (_text_align == other._text_align)
153 && (_text_transform == other._text_transform)
154 && (_text_decorations == other._text_decorations)
155 && (_cursor_style == other._cursor_style)
156 && (_direction == other._direction)
157 && (_white_space == other._white_space)
158 && (_border_collapse == other._border_collapse)
159 && (_box_direction == other._box_direction)
160 && (m_rtlOrdering == other.m_rtlOrdering)
161 && (m_printColorAdjust == other.m_printColorAdjust)
162 && (_pointerEvents == other._pointerEvents)
163 && (_insideLink == other._insideLink)
164 && (m_writingMode == other.m_writingMode);
167 bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
169 unsigned _empty_cells : 1; // EEmptyCell
170 unsigned _caption_side : 2; // ECaptionSide
171 unsigned _list_style_type : 7; // EListStyleType
172 unsigned _list_style_position : 1; // EListStylePosition
173 unsigned _visibility : 2; // EVisibility
174 unsigned _text_align : 4; // ETextAlign
175 unsigned _text_transform : 2; // ETextTransform
176 unsigned _text_decorations : TextDecorationBits;
177 unsigned _cursor_style : 6; // ECursor
178 unsigned _direction : 1; // TextDirection
179 unsigned _white_space : 3; // EWhiteSpace
181 unsigned _border_collapse : 1; // EBorderCollapse
182 unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
184 // non CSS2 inherited
185 unsigned m_rtlOrdering : 1; // Order
186 unsigned m_printColorAdjust : PrintColorAdjustBits;
187 unsigned _pointerEvents : 4; // EPointerEvents
188 unsigned _insideLink : 2; // EInsideLink
191 // CSS Text Layout Module Level 3: Vertical writing support
192 unsigned m_writingMode : 2; // WritingMode
197 struct NonInheritedFlags {
198 bool operator==(const NonInheritedFlags& other) const
200 return _effectiveDisplay == other._effectiveDisplay
201 && _originalDisplay == other._originalDisplay
202 && _overflowX == other._overflowX
203 && _overflowY == other._overflowY
204 && _vertical_align == other._vertical_align
205 && _clear == other._clear
206 && _position == other._position
207 && _floating == other._floating
208 && _table_layout == other._table_layout
209 && _page_break_before == other._page_break_before
210 && _page_break_after == other._page_break_after
211 && _page_break_inside == other._page_break_inside
212 && _styleType == other._styleType
213 && _affectedByHover == other._affectedByHover
214 && _affectedByActive == other._affectedByActive
215 && _affectedByDrag == other._affectedByDrag
216 && _pseudoBits == other._pseudoBits
217 && _unicodeBidi == other._unicodeBidi
218 && explicitInheritance == other.explicitInheritance
219 && currentColor == other.currentColor
220 && unique == other.unique
221 && emptyState == other.emptyState
222 && firstChildState == other.firstChildState
223 && lastChildState == other.lastChildState
224 && _isLink == other._isLink;
227 bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
229 unsigned _effectiveDisplay : 5; // EDisplay
230 unsigned _originalDisplay : 5; // EDisplay
231 unsigned _overflowX : 3; // EOverflow
232 unsigned _overflowY : 3; // EOverflow
233 unsigned _vertical_align : 4; // EVerticalAlign
234 unsigned _clear : 2; // EClear
235 unsigned _position : 3; // EPosition
236 unsigned _floating : 2; // EFloat
237 unsigned _table_layout : 1; // ETableLayout
239 unsigned _unicodeBidi : 3; // EUnicodeBidi
241 unsigned _page_break_before : 2; // EPageBreak
242 unsigned _page_break_after : 2; // EPageBreak
243 unsigned _page_break_inside : 2; // EPageBreak
245 unsigned _styleType : 6; // PseudoId
246 unsigned _pseudoBits : 8;
247 unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property
248 unsigned currentColor : 1; // At least one color has the value 'currentColor'
249 unsigned unique : 1; // Style can not be shared.
250 unsigned emptyState : 1;
251 unsigned firstChildState : 1;
252 unsigned lastChildState : 1;
254 bool affectedByHover() const { return _affectedByHover; }
255 void setAffectedByHover(bool value) { _affectedByHover = value; }
256 bool affectedByActive() const { return _affectedByActive; }
257 void setAffectedByActive(bool value) { _affectedByActive = value; }
258 bool affectedByDrag() const { return _affectedByDrag; }
259 void setAffectedByDrag(bool value) { _affectedByDrag = value; }
260 bool isLink() const { return _isLink; }
261 void setIsLink(bool value) { _isLink = value; }
263 unsigned _affectedByHover : 1;
264 unsigned _affectedByActive : 1;
265 unsigned _affectedByDrag : 1;
266 unsigned _isLink : 1;
267 // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom()
269 } noninherited_flags;
274 void setBitDefaults()
276 inherited_flags._empty_cells = initialEmptyCells();
277 inherited_flags._caption_side = initialCaptionSide();
278 inherited_flags._list_style_type = initialListStyleType();
279 inherited_flags._list_style_position = initialListStylePosition();
280 inherited_flags._visibility = initialVisibility();
281 inherited_flags._text_align = initialTextAlign();
282 inherited_flags._text_transform = initialTextTransform();
283 inherited_flags._text_decorations = initialTextDecoration();
284 inherited_flags._cursor_style = initialCursor();
285 inherited_flags._direction = initialDirection();
286 inherited_flags._white_space = initialWhiteSpace();
287 inherited_flags._border_collapse = initialBorderCollapse();
288 inherited_flags.m_rtlOrdering = initialRTLOrdering();
289 inherited_flags._box_direction = initialBoxDirection();
290 inherited_flags.m_printColorAdjust = initialPrintColorAdjust();
291 inherited_flags._pointerEvents = initialPointerEvents();
292 inherited_flags._insideLink = NotInsideLink;
293 inherited_flags.m_writingMode = initialWritingMode();
295 noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
296 noninherited_flags._overflowX = initialOverflowX();
297 noninherited_flags._overflowY = initialOverflowY();
298 noninherited_flags._vertical_align = initialVerticalAlign();
299 noninherited_flags._clear = initialClear();
300 noninherited_flags._position = initialPosition();
301 noninherited_flags._floating = initialFloating();
302 noninherited_flags._table_layout = initialTableLayout();
303 noninherited_flags._unicodeBidi = initialUnicodeBidi();
304 noninherited_flags._page_break_before = initialPageBreak();
305 noninherited_flags._page_break_after = initialPageBreak();
306 noninherited_flags._page_break_inside = initialPageBreak();
307 noninherited_flags._styleType = NOPSEUDO;
308 noninherited_flags._pseudoBits = 0;
309 noninherited_flags.explicitInheritance = false;
310 noninherited_flags.currentColor = false;
311 noninherited_flags.unique = false;
312 noninherited_flags.emptyState = false;
313 noninherited_flags.firstChildState = false;
314 noninherited_flags.lastChildState = false;
315 noninherited_flags.setAffectedByHover(false);
316 noninherited_flags.setAffectedByActive(false);
317 noninherited_flags.setAffectedByDrag(false);
318 noninherited_flags.setIsLink(false);
322 ALWAYS_INLINE RenderStyle();
324 enum DefaultStyleTag {
327 ALWAYS_INLINE explicit RenderStyle(DefaultStyleTag);
328 ALWAYS_INLINE RenderStyle(const RenderStyle&);
331 static PassRefPtr<RenderStyle> create();
332 static PassRefPtr<RenderStyle> createDefaultStyle();
333 static PassRefPtr<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay);
334 static PassRefPtr<RenderStyle> clone(const RenderStyle*);
336 static StyleRecalcChange compare(const RenderStyle* oldStyle, const RenderStyle* newStyle);
338 enum IsAtShadowBoundary {
343 void inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary = NotAtShadowBoundary);
344 void copyNonInheritedFrom(const RenderStyle*);
346 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags._styleType); }
347 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; }
349 RenderStyle* getCachedPseudoStyle(PseudoId) const;
350 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
351 void removeCachedPseudoStyle(PseudoId);
353 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
355 void setVariable(const AtomicString& name, const String& value) { rareInheritedData.access()->m_variables.access()->setVariable(name, value); }
356 const HashMap<AtomicString, String>* variables() { return &(rareInheritedData->m_variables->m_data); }
358 bool affectedByHover() const { return noninherited_flags.affectedByHover(); }
359 bool affectedByActive() const { return noninherited_flags.affectedByActive(); }
360 bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); }
362 void setAffectedByHover() { noninherited_flags.setAffectedByHover(true); }
363 void setAffectedByActive() { noninherited_flags.setAffectedByActive(true); }
364 void setAffectedByDrag() { noninherited_flags.setAffectedByDrag(true); }
366 bool operator==(const RenderStyle& other) const;
367 bool operator!=(const RenderStyle& other) const { return !(*this == other); }
368 bool isFloating() const { return noninherited_flags._floating != NoFloat; }
369 bool hasMargin() const { return surround->margin.nonZero(); }
370 bool hasBorder() const { return surround->border.hasBorder(); }
371 bool hasPadding() const { return surround->padding.nonZero(); }
372 bool hasOffset() const { return surround->offset.nonZero(); }
373 bool hasMarginBeforeQuirk() const { return marginBefore().quirk(); }
374 bool hasMarginAfterQuirk() const { return marginAfter().quirk(); }
376 bool hasBackgroundImage() const { return m_background->background().hasImage(); }
377 bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
379 bool hasEntirelyFixedBackground() const;
381 bool hasAppearance() const { return appearance() != NoControlPart; }
383 bool hasBackground() const
385 Color color = visitedDependentColor(CSSPropertyBackgroundColor);
386 if (color.isValid() && color.alpha())
388 return hasBackgroundImage();
391 LayoutBoxExtent imageOutsets(const NinePieceImage&) const;
392 bool hasBorderImageOutsets() const
394 return borderImage().hasImage() && borderImage().outset().nonZero();
396 LayoutBoxExtent borderImageOutsets() const
398 return imageOutsets(borderImage());
401 LayoutBoxExtent maskBoxImageOutsets() const
403 return imageOutsets(maskBoxImage());
406 bool hasFilterOutsets() const { return hasFilter() && filter().hasOutsets(); }
407 FilterOutsets filterOutsets() const { return hasFilter() ? filter().outsets() : FilterOutsets(); }
409 Order rtlOrdering() const { return static_cast<Order>(inherited_flags.m_rtlOrdering); }
410 void setRTLOrdering(Order o) { inherited_flags.m_rtlOrdering = o; }
412 bool isStyleAvailable() const;
414 bool hasAnyPublicPseudoStyles() const;
415 bool hasPseudoStyle(PseudoId pseudo) const;
416 void setHasPseudoStyle(PseudoId pseudo);
417 bool hasUniquePseudoStyle() const;
419 // attribute getter methods
421 EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
422 EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
424 Length left() const { return surround->offset.left(); }
425 Length right() const { return surround->offset.right(); }
426 Length top() const { return surround->offset.top(); }
427 Length bottom() const { return surround->offset.bottom(); }
429 // Accessors for positioned object edges that take into account writing mode.
430 Length logicalLeft() const { return surround->offset.logicalLeft(writingMode()); }
431 Length logicalRight() const { return surround->offset.logicalRight(writingMode()); }
432 Length logicalTop() const { return surround->offset.before(writingMode()); }
433 Length logicalBottom() const { return surround->offset.after(writingMode()); }
435 // Whether or not a positioned element requires normal flow x/y to be computed
436 // to determine its position.
437 bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); }
438 bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); }
439 bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
440 bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
442 EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
443 bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; }
444 bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; }
445 bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; }
446 EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
448 Length width() const { return m_box->width(); }
449 Length height() const { return m_box->height(); }
450 Length minWidth() const { return m_box->minWidth(); }
451 Length maxWidth() const { return m_box->maxWidth(); }
452 Length minHeight() const { return m_box->minHeight(); }
453 Length maxHeight() const { return m_box->maxHeight(); }
455 Length logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); }
456 Length logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); }
457 Length logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); }
458 Length logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); }
459 Length logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
460 Length logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
462 const BorderData& border() const { return surround->border; }
463 const BorderValue& borderLeft() const { return surround->border.left(); }
464 const BorderValue& borderRight() const { return surround->border.right(); }
465 const BorderValue& borderTop() const { return surround->border.top(); }
466 const BorderValue& borderBottom() const { return surround->border.bottom(); }
468 const BorderValue& borderBefore() const;
469 const BorderValue& borderAfter() const;
470 const BorderValue& borderStart() const;
471 const BorderValue& borderEnd() const;
473 const NinePieceImage& borderImage() const { return surround->border.image(); }
474 StyleImage* borderImageSource() const { return surround->border.image().image(); }
475 LengthBox borderImageSlices() const { return surround->border.image().imageSlices(); }
476 LengthBox borderImageWidth() const { return surround->border.image().borderSlices(); }
477 LengthBox borderImageOutset() const { return surround->border.image().outset(); }
479 LengthSize borderTopLeftRadius() const { return surround->border.topLeft(); }
480 LengthSize borderTopRightRadius() const { return surround->border.topRight(); }
481 LengthSize borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
482 LengthSize borderBottomRightRadius() const { return surround->border.bottomRight(); }
483 bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
485 unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); }
486 EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
487 bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
488 unsigned borderRightWidth() const { return surround->border.borderRightWidth(); }
489 EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
490 bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
491 unsigned borderTopWidth() const { return surround->border.borderTopWidth(); }
492 EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
493 bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
494 unsigned borderBottomWidth() const { return surround->border.borderBottomWidth(); }
495 EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
496 bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
498 unsigned short borderBeforeWidth() const;
499 unsigned short borderAfterWidth() const;
500 unsigned short borderStartWidth() const;
501 unsigned short borderEndWidth() const;
503 unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
504 unsigned short outlineWidth() const
506 if (m_background->outline().style() == BNONE)
508 return m_background->outline().width();
510 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
511 EBorderStyle outlineStyle() const { return m_background->outline().style(); }
512 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_background->outline().isAuto()); }
514 EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
515 EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
517 EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
518 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
519 Length verticalAlignLength() const { return m_box->verticalAlign(); }
521 Length clipLeft() const { return visual->clip.left(); }
522 Length clipRight() const { return visual->clip.right(); }
523 Length clipTop() const { return visual->clip.top(); }
524 Length clipBottom() const { return visual->clip.bottom(); }
525 LengthBox clip() const { return visual->clip; }
526 bool hasClip() const { return visual->hasClip; }
528 EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
530 EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); }
531 ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); }
533 const Font& font() const;
534 const FontMetrics& fontMetrics() const;
535 const FontDescription& fontDescription() const;
536 float specifiedFontSize() const;
537 float computedFontSize() const;
538 int fontSize() const;
540 float textAutosizingMultiplier() const { return visual->m_textAutosizingMultiplier; }
542 Length textIndent() const { return rareInheritedData->indent; }
543 TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(rareInheritedData->m_textIndentLine); }
544 ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
545 TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
546 TextJustify textJustify() const { return static_cast<TextJustify>(rareInheritedData->m_textJustify); }
547 ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
548 TextDecoration textDecorationsInEffect() const { return static_cast<TextDecoration>(inherited_flags._text_decorations); }
549 TextDecoration textDecoration() const { return static_cast<TextDecoration>(visual->textDecoration); }
550 TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
551 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
552 float wordSpacing() const;
553 float letterSpacing() const;
555 float zoom() const { return visual->m_zoom; }
556 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
558 TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
559 bool isLeftToRightDirection() const { return direction() == LTR; }
561 Length specifiedLineHeight() const;
562 Length lineHeight() const;
563 int computedLineHeight(RenderView* = 0) const;
565 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
566 static bool autoWrap(EWhiteSpace ws)
568 // Nowrap and pre don't automatically wrap.
569 return ws != NOWRAP && ws != PRE;
572 bool autoWrap() const
574 return autoWrap(whiteSpace());
577 static bool preserveNewline(EWhiteSpace ws)
579 // Normal and nowrap do not preserve newlines.
580 return ws != NORMAL && ws != NOWRAP;
583 bool preserveNewline() const
585 return preserveNewline(whiteSpace());
588 static bool collapseWhiteSpace(EWhiteSpace ws)
590 // Pre and prewrap do not collapse whitespace.
591 return ws != PRE && ws != PRE_WRAP;
594 bool collapseWhiteSpace() const
596 return collapseWhiteSpace(whiteSpace());
599 bool isCollapsibleWhiteSpace(UChar c) const
604 return collapseWhiteSpace();
606 return !preserveNewline();
611 bool breakOnlyAfterWhiteSpace() const
613 return whiteSpace() == PRE_WRAP || lineBreak() == LineBreakAfterWhiteSpace;
616 bool breakWords() const
618 return wordBreak() == BreakWordBreak || overflowWrap() == BreakOverflowWrap;
621 EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
622 EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
623 CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); }
624 EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
625 EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
626 EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
627 Length backgroundXPosition() const { return m_background->background().xPosition(); }
628 Length backgroundYPosition() const { return m_background->background().yPosition(); }
629 EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
630 LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); }
631 FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
632 const FillLayer* backgroundLayers() const { return &(m_background->background()); }
634 StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
635 EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); }
636 EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); }
637 CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
638 EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
639 EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
640 Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
641 Length maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
642 EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
643 LengthSize maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
644 FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
645 const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
647 const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
648 StyleImage* maskBoxImageSource() const { return rareNonInheritedData->m_maskBoxImage.image(); }
649 LengthBox maskBoxImageSlices() const { return rareNonInheritedData->m_maskBoxImage.imageSlices(); }
650 bool maskBoxImageSlicesFill() const { return rareNonInheritedData->m_maskBoxImage.fill(); }
651 LengthBox maskBoxImageWidth() const { return rareNonInheritedData->m_maskBoxImage.borderSlices(); }
652 LengthBox maskBoxImageOutset() const { return rareNonInheritedData->m_maskBoxImage.outset(); }
654 EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse>(inherited_flags._border_collapse); }
655 short horizontalBorderSpacing() const;
656 short verticalBorderSpacing() const;
657 EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); }
658 ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); }
660 EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); }
661 StyleImage* listStyleImage() const;
662 EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
664 Length marginTop() const { return surround->margin.top(); }
665 Length marginBottom() const { return surround->margin.bottom(); }
666 Length marginLeft() const { return surround->margin.left(); }
667 Length marginRight() const { return surround->margin.right(); }
668 Length marginBefore() const { return surround->margin.before(writingMode()); }
669 Length marginAfter() const { return surround->margin.after(writingMode()); }
670 Length marginStart() const { return surround->margin.start(writingMode(), direction()); }
671 Length marginEnd() const { return surround->margin.end(writingMode(), direction()); }
672 Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
673 Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
674 Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); }
675 Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); }
677 LengthBox paddingBox() const { return surround->padding; }
678 Length paddingTop() const { return surround->padding.top(); }
679 Length paddingBottom() const { return surround->padding.bottom(); }
680 Length paddingLeft() const { return surround->padding.left(); }
681 Length paddingRight() const { return surround->padding.right(); }
682 Length paddingBefore() const { return surround->padding.before(writingMode()); }
683 Length paddingAfter() const { return surround->padding.after(writingMode()); }
684 Length paddingStart() const { return surround->padding.start(writingMode(), direction()); }
685 Length paddingEnd() const { return surround->padding.end(writingMode(), direction()); }
687 ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
688 CursorList* cursors() const { return rareInheritedData->cursorData.get(); }
690 EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
691 bool isLink() const { return noninherited_flags.isLink(); }
693 short widows() const { return rareInheritedData->widows; }
694 short orphans() const { return rareInheritedData->orphans; }
695 bool hasAutoWidows() const { return rareInheritedData->m_hasAutoWidows; }
696 bool hasAutoOrphans() const { return rareInheritedData->m_hasAutoOrphans; }
697 EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); }
698 EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); }
699 EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); }
701 // CSS3 Getter Methods
703 int outlineOffset() const
705 if (m_background->outline().style() == BNONE)
707 return m_background->outline().offset();
710 ShadowList* textShadow() const { return rareInheritedData->textShadow.get(); }
711 void getTextShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }
712 void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
713 void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
714 void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }
715 void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }
717 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
718 float opacity() const { return rareNonInheritedData->opacity; }
719 ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
720 // aspect ratio convenience method
721 bool hasAspectRatio() const { return rareNonInheritedData->m_hasAspectRatio; }
722 float aspectRatio() const { return aspectRatioNumerator() / aspectRatioDenominator(); }
723 float aspectRatioDenominator() const { return rareNonInheritedData->m_aspectRatioDenominator; }
724 float aspectRatioNumerator() const { return rareNonInheritedData->m_aspectRatioNumerator; }
725 EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->align); }
726 EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
727 float boxFlex() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex; }
728 unsigned int boxFlexGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex_group; }
729 EBoxLines boxLines() const { return static_cast<EBoxLines>(rareNonInheritedData->m_deprecatedFlexibleBox->lines); }
730 unsigned int boxOrdinalGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->ordinal_group; }
731 EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->m_deprecatedFlexibleBox->orient); }
732 EBoxPack boxPack() const { return static_cast<EBoxPack>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); }
734 int order() const { return rareNonInheritedData->m_order; }
735 const Vector<String>& callbackSelectors() const { return rareNonInheritedData->m_callbackSelectors; }
736 float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; }
737 float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
738 Length flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
739 EAlignContent alignContent() const { return static_cast<EAlignContent>(rareNonInheritedData->m_alignContent); }
740 EAlignItems alignItems() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignItems); }
741 EAlignItems alignSelf() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignSelf); }
742 EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
743 bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
744 bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
745 EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
746 EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); }
748 const Vector<GridTrackSize>& gridDefinitionColumns() const { return rareNonInheritedData->m_grid->m_gridDefinitionColumns; }
749 const Vector<GridTrackSize>& gridDefinitionRows() const { return rareNonInheritedData->m_grid->m_gridDefinitionRows; }
750 const NamedGridLinesMap& namedGridColumnLines() const { return rareNonInheritedData->m_grid->m_namedGridColumnLines; }
751 const NamedGridLinesMap& namedGridRowLines() const { return rareNonInheritedData->m_grid->m_namedGridRowLines; }
752 const OrderedNamedGridLines& orderedNamedGridColumnLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridColumnLines; }
753 const OrderedNamedGridLines& orderedNamedGridRowLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridRowLines; }
754 const NamedGridAreaMap& namedGridArea() const { return rareNonInheritedData->m_grid->m_namedGridArea; }
755 size_t namedGridAreaRowCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaRowCount; }
756 size_t namedGridAreaColumnCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaColumnCount; }
757 GridAutoFlow gridAutoFlow() const { return rareNonInheritedData->m_grid->m_gridAutoFlow; }
758 const GridTrackSize& gridAutoColumns() const { return rareNonInheritedData->m_grid->m_gridAutoColumns; }
759 const GridTrackSize& gridAutoRows() const { return rareNonInheritedData->m_grid->m_gridAutoRows; }
761 const GridPosition& gridColumnStart() const { return rareNonInheritedData->m_gridItem->m_gridColumnStart; }
762 const GridPosition& gridColumnEnd() const { return rareNonInheritedData->m_gridItem->m_gridColumnEnd; }
763 const GridPosition& gridRowStart() const { return rareNonInheritedData->m_gridItem->m_gridRowStart; }
764 const GridPosition& gridRowEnd() const { return rareNonInheritedData->m_gridItem->m_gridRowEnd; }
766 ShadowList* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
767 void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
768 LayoutBoxExtent getBoxShadowInsetExtent() const { return getShadowInsetExtent(boxShadow()); }
769 void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
770 void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }
771 void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); }
772 void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); }
774 EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecorationBreak(); }
775 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
776 EBoxSizing boxSizing() const { return m_box->boxSizing(); }
777 Length marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; }
778 int marqueeSpeed() const { return rareNonInheritedData->m_marquee->speed; }
779 int marqueeLoopCount() const { return rareNonInheritedData->m_marquee->loops; }
780 EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->m_marquee->behavior); }
781 EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(rareNonInheritedData->m_marquee->direction); }
782 EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
783 EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
784 EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
785 TextOverflow textOverflow() const { return static_cast<TextOverflow>(rareNonInheritedData->textOverflow); }
786 EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); }
787 EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); }
788 EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
789 EOverflowWrap overflowWrap() const { return static_cast<EOverflowWrap>(rareInheritedData->overflowWrap); }
790 LineBreak lineBreak() const { return static_cast<LineBreak>(rareInheritedData->lineBreak); }
791 const AtomicString& highlight() const { return rareInheritedData->highlight; }
792 const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
793 const AtomicString& locale() const { return rareInheritedData->locale; }
794 EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
795 EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
796 ColumnAxis columnAxis() const { return static_cast<ColumnAxis>(rareNonInheritedData->m_multiCol->m_axis); }
797 bool hasInlineColumnAxis() const {
798 ColumnAxis axis = columnAxis();
799 return axis == AutoColumnAxis || isHorizontalWritingMode() == (axis == HorizontalColumnAxis);
801 ColumnProgression columnProgression() const { return static_cast<ColumnProgression>(rareNonInheritedData->m_multiCol->m_progression); }
802 float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
803 bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
804 unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
805 bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
806 bool specifiesAutoColumns() const { return hasAutoColumnCount() && hasAutoColumnWidth(); }
807 bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth() || !hasInlineColumnAxis(); }
808 ColumnFill columnFill() const { return static_cast<ColumnFill>(rareNonInheritedData->m_multiCol->m_fill); }
809 float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
810 bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
811 EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
812 unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
813 bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
814 ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheritedData->m_multiCol->m_columnSpan); }
815 EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
816 EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
817 EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
818 EPageBreak regionBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakBefore); }
819 EPageBreak regionBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakInside); }
820 EPageBreak regionBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakAfter); }
821 const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
822 Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
823 Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
824 float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
825 bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
827 TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(rareInheritedData->textEmphasisFill); }
828 TextEmphasisMark textEmphasisMark() const;
829 const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; }
830 TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); }
831 const AtomicString& textEmphasisMarkString() const;
833 RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInheritedData->m_rubyPosition); }
835 TextOrientation textOrientation() const { return static_cast<TextOrientation>(rareInheritedData->m_textOrientation); }
837 ObjectFit objectFit() const { return static_cast<ObjectFit>(rareNonInheritedData->m_objectFit); }
838 LengthPoint objectPosition() const { return rareNonInheritedData->m_objectPosition; }
840 // Return true if any transform related property (currently transform, transformStyle3D or perspective)
841 // indicates that we are transforming
842 bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
844 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
845 void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
846 void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin = IncludeTransformOrigin) const;
848 bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
850 TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInheritedData->m_textCombine); }
851 bool hasTextCombine() const { return textCombine() != TextCombineNone; }
853 unsigned tabSize() const { return rareInheritedData->m_tabSize; }
857 const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
858 bool hasFlowFrom() const { return !rareNonInheritedData->m_regionThread.isNull(); }
859 const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
860 RegionFragment regionFragment() const { return static_cast<RegionFragment>(rareNonInheritedData->m_regionFragment); }
862 const AtomicString& lineGrid() const { return rareInheritedData->m_lineGrid; }
863 LineSnap lineSnap() const { return static_cast<LineSnap>(rareInheritedData->m_lineSnap); }
864 LineAlign lineAlign() const { return static_cast<LineAlign>(rareInheritedData->m_lineAlign); }
866 WrapFlow wrapFlow() const { return static_cast<WrapFlow>(rareNonInheritedData->m_wrapFlow); }
867 WrapThrough wrapThrough() const { return static_cast<WrapThrough>(rareNonInheritedData->m_wrapThrough); }
869 // Apple-specific property getter methods
870 EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
871 const CSSAnimationDataList* animations() const { return rareNonInheritedData->m_animations.get(); }
872 const CSSAnimationDataList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
874 CSSAnimationDataList* accessAnimations();
875 CSSAnimationDataList* accessTransitions();
877 bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
879 // return the first found Animation (including 'all' transitions)
880 const CSSAnimationData* transitionForProperty(CSSPropertyID) const;
882 ETransformStyle3D transformStyle3D() const { return static_cast<ETransformStyle3D>(rareNonInheritedData->m_transformStyle3D); }
883 bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
885 EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfaceVisibility>(rareNonInheritedData->m_backfaceVisibility); }
886 float perspective() const { return rareNonInheritedData->m_perspective; }
887 bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
888 Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
889 Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
890 LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; }
891 PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNonInheritedData->m_pageSizeType); }
893 // When set, this ensures that styles compare as different. Used during accelerated animations.
894 bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
896 LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
897 const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
898 Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; }
899 ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
901 WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); }
902 bool isHorizontalWritingMode() const { return WebCore::isHorizontalWritingMode(writingMode()); }
903 bool isFlippedLinesWritingMode() const { return WebCore::isFlippedLinesWritingMode(writingMode()); }
904 bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedBlocksWritingMode(writingMode()); }
906 EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
908 ESpeak speak() const { return static_cast<ESpeak>(rareInheritedData->speak); }
910 FilterOperations& mutableFilter() { return rareNonInheritedData.access()->m_filter.access()->m_operations; }
911 const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; }
912 bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); }
914 BlendMode blendMode() const;
915 void setBlendMode(BlendMode v);
916 bool hasBlendMode() const;
918 EIsolation isolation() const;
919 void setIsolation(EIsolation v);
921 bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
923 TouchAction touchAction() const { return static_cast<TouchAction>(rareNonInheritedData->m_touchAction); }
924 TouchActionDelay touchActionDelay() const { return static_cast<TouchActionDelay>(rareInheritedData->m_touchActionDelay); }
926 // attribute setter methods
928 void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; }
929 void setOriginalDisplay(EDisplay v) { noninherited_flags._originalDisplay = v; }
930 void setPosition(EPosition v) { noninherited_flags._position = v; }
931 void setFloating(EFloat v) { noninherited_flags._floating = v; }
933 void setLeft(Length v) { SET_VAR(surround, offset.m_left, v); }
934 void setRight(Length v) { SET_VAR(surround, offset.m_right, v); }
935 void setTop(Length v) { SET_VAR(surround, offset.m_top, v); }
936 void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v); }
938 void setWidth(Length v) { SET_VAR(m_box, m_width, v); }
939 void setHeight(Length v) { SET_VAR(m_box, m_height, v); }
941 void setLogicalWidth(Length v)
943 if (isHorizontalWritingMode()) {
944 SET_VAR(m_box, m_width, v);
946 SET_VAR(m_box, m_height, v);
950 void setLogicalHeight(Length v)
952 if (isHorizontalWritingMode()) {
953 SET_VAR(m_box, m_height, v);
955 SET_VAR(m_box, m_width, v);
959 void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, v); }
960 void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, v); }
961 void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, v); }
962 void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, v); }
964 DraggableRegionMode getDraggableRegionMode() const { return rareNonInheritedData->m_draggableRegionMode; }
965 void setDraggableRegionMode(DraggableRegionMode v) { SET_VAR(rareNonInheritedData, m_draggableRegionMode, v); }
967 void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
968 void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()); }
969 void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()); }
970 void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()); }
971 void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()); }
972 void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()); }
973 void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
974 void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()); }
975 void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()); }
976 void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()); }
977 void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()); }
979 void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v); }
981 void setBackgroundXPosition(Length length) { SET_VAR(m_background, m_background.m_xPosition, length); }
982 void setBackgroundYPosition(Length length) { SET_VAR(m_background, m_background.m_yPosition, length); }
983 void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b); }
984 void setBackgroundSizeLength(LengthSize s) { SET_VAR(m_background, m_background.m_sizeLength, s); }
986 void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b); }
987 void setBorderImageSource(PassRefPtr<StyleImage>);
988 void setBorderImageSlices(LengthBox);
989 void setBorderImageWidth(LengthBox);
990 void setBorderImageOutset(LengthBox);
992 void setBorderTopLeftRadius(LengthSize s) { SET_VAR(surround, border.m_topLeft, s); }
993 void setBorderTopRightRadius(LengthSize s) { SET_VAR(surround, border.m_topRight, s); }
994 void setBorderBottomLeftRadius(LengthSize s) { SET_VAR(surround, border.m_bottomLeft, s); }
995 void setBorderBottomRightRadius(LengthSize s) { SET_VAR(surround, border.m_bottomRight, s); }
997 void setBorderRadius(LengthSize s)
999 setBorderTopLeftRadius(s);
1000 setBorderTopRightRadius(s);
1001 setBorderBottomLeftRadius(s);
1002 setBorderBottomRightRadius(s);
1004 void setBorderRadius(const IntSize& s)
1006 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
1009 RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1010 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1012 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
1013 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
1015 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v); }
1016 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v); }
1017 void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, v); }
1018 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_width, v); }
1019 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v); }
1020 void setBorderRightColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, v); }
1021 void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v); }
1022 void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v); }
1023 void setBorderTopColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, v); }
1024 void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_width, v); }
1025 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v); }
1026 void setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v); }
1028 void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v); }
1029 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto); }
1030 void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v); }
1031 void setOutlineColor(const Color& v) { SET_BORDERVALUE_COLOR(m_background, m_outline, v); }
1033 void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
1034 void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
1035 void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
1036 void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
1037 void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, length); }
1039 void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b); }
1040 void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v); }
1041 void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v); }
1042 void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v); }
1043 void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v); }
1044 void setClip(Length top, Length right, Length bottom, Length left);
1045 void setClip(LengthBox box) { SET_VAR(visual, clip, box); }
1047 void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
1049 void setClear(EClear v) { noninherited_flags._clear = v; }
1050 void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; }
1052 bool setFontDescription(const FontDescription&);
1053 // Only used for blending font sizes when animating and for text autosizing.
1054 void setFontSize(float);
1056 void setTextAutosizingMultiplier(float v)
1058 SET_VAR(visual, m_textAutosizingMultiplier, v);
1059 setFontSize(fontDescription().specifiedSize());
1062 void setColor(const Color&);
1063 void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v); }
1064 void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); }
1065 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
1066 void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
1067 void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); }
1068 void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
1069 void addToTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations |= v; }
1070 void setTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations = v; }
1071 void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v); }
1072 void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); }
1073 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
1074 void setDirection(TextDirection v) { inherited_flags._direction = v; }
1075 void setLineHeight(Length specifiedLineHeight);
1076 bool setZoom(float);
1077 void setZoomWithoutReturnValue(float f) { setZoom(f); }
1078 bool setEffectiveZoom(float);
1080 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v); }
1082 void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
1084 void setWordSpacing(float);
1085 void setLetterSpacing(float);
1087 void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
1088 void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
1090 void adjustBackgroundLayers()
1092 if (backgroundLayers()->next()) {
1093 accessBackgroundLayers()->cullEmptyLayers();
1094 accessBackgroundLayers()->fillUnsetProperties();
1098 void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); }
1099 void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; }
1101 void adjustMaskLayers()
1103 if (maskLayers()->next()) {
1104 accessMaskLayers()->cullEmptyLayers();
1105 accessMaskLayers()->fillUnsetProperties();
1109 void setMaskImage(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_mask.setImage(v); }
1111 void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); }
1112 void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
1113 void setMaskBoxImageSlices(LengthBox slices)
1115 rareNonInheritedData.access()->m_maskBoxImage.setImageSlices(slices);
1117 void setMaskBoxImageSlicesFill(bool fill)
1119 rareNonInheritedData.access()->m_maskBoxImage.setFill(fill);
1121 void setMaskBoxImageWidth(LengthBox slices)
1123 rareNonInheritedData.access()->m_maskBoxImage.setBorderSlices(slices);
1125 void setMaskBoxImageOutset(LengthBox outset)
1127 rareNonInheritedData.access()->m_maskBoxImage.setOutset(outset);
1129 void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, length); }
1130 void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, length); }
1131 void setMaskSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, s); }
1133 void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
1134 void setHorizontalBorderSpacing(short);
1135 void setVerticalBorderSpacing(short);
1136 void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
1137 void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
1139 void setHasAspectRatio(bool b) { SET_VAR(rareNonInheritedData, m_hasAspectRatio, b); }
1140 void setAspectRatioDenominator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioDenominator, v); }
1141 void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); }
1143 void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
1144 void setListStyleImage(PassRefPtr<StyleImage>);
1145 void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
1147 void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)); }
1148 void setMarginTop(Length v) { SET_VAR(surround, margin.m_top, v); }
1149 void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v); }
1150 void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v); }
1151 void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v); }
1152 void setMarginStart(Length);
1153 void setMarginEnd(Length);
1155 void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)); }
1156 void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b); }
1157 void setPaddingTop(Length v) { SET_VAR(surround, padding.m_top, v); }
1158 void setPaddingBottom(Length v) { SET_VAR(surround, padding.m_bottom, v); }
1159 void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v); }
1160 void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v); }
1162 void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
1163 void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
1164 void setCursorList(PassRefPtr<CursorList>);
1165 void clearCursorList();
1167 void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
1168 void setIsLink(bool b) { noninherited_flags.setIsLink(b); }
1170 PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(inherited_flags.m_printColorAdjust); }
1171 void setPrintColorAdjust(PrintColorAdjust value) { inherited_flags.m_printColorAdjust = value; }
1173 bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
1174 void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_box, m_zIndex, 0); }
1175 int zIndex() const { return m_box->zIndex(); }
1176 void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v); }
1178 void setHasAutoWidows() { SET_VAR(rareInheritedData, m_hasAutoWidows, true); SET_VAR(rareInheritedData, widows, initialWidows()); }
1179 void setWidows(short w) { SET_VAR(rareInheritedData, m_hasAutoWidows, false); SET_VAR(rareInheritedData, widows, w); }
1181 void setHasAutoOrphans() { SET_VAR(rareInheritedData, m_hasAutoOrphans, true); SET_VAR(rareInheritedData, orphans, initialOrphans()); }
1182 void setOrphans(short o) { SET_VAR(rareInheritedData, m_hasAutoOrphans, false); SET_VAR(rareInheritedData, orphans, o); }
1184 // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
1185 void setPageBreakInside(EPageBreak b) { ASSERT(b == PBAUTO || b == PBAVOID); noninherited_flags._page_break_inside = b; }
1186 void setPageBreakBefore(EPageBreak b) { noninherited_flags._page_break_before = b; }
1187 void setPageBreakAfter(EPageBreak b) { noninherited_flags._page_break_after = b; }
1190 void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); }
1191 void setTextShadow(PassRefPtr<ShadowList>);
1192 void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c); }
1193 void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w); }
1194 void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c); }
1195 void setOpacity(float f) { float v = clampTo<float>(f, 0, 1); SET_VAR(rareNonInheritedData, opacity, v); }
1196 void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
1197 // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
1198 void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, align, a); }
1199 void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_box, m_boxDecorationBreak, b); }
1200 void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
1201 void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex, f); }
1202 void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex_group, fg); }
1203 void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, lines, l); }
1204 void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, ordinal_group, og); }
1205 void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, orient, o); }
1206 void setBoxPack(EBoxPack p) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, pack, p); }
1207 void setBoxShadow(PassRefPtr<ShadowList>);
1208 void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
1209 void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
1210 void setFlexGrow(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexGrow, f); }
1211 void setFlexShrink(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexShrink, f); }
1212 void setFlexBasis(Length length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, length); }
1213 void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); }
1214 void addCallbackSelector(const String& selector);
1215 void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); }
1216 void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
1217 void setAlignSelf(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); }
1218 void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
1219 void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
1220 void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); }
1221 void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); }
1222 void setGridAutoRows(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoRows, length); }
1223 void setGridDefinitionColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridDefinitionColumns, lengths); }
1224 void setGridDefinitionRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridDefinitionRows, lengths); }
1225 void setNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridColumnLines, namedGridColumnLines); }
1226 void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridRowLines, namedGridRowLines); }
1227 void setOrderedNamedGridColumnLines(const OrderedNamedGridLines& orderedNamedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_orderedNamedGridColumnLines, orderedNamedGridColumnLines); }
1228 void setOrderedNamedGridRowLines(const OrderedNamedGridLines& orderedNamedGridRowLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_orderedNamedGridRowLines, orderedNamedGridRowLines); }
1229 void setNamedGridArea(const NamedGridAreaMap& namedGridArea) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridArea, namedGridArea); }
1230 void setNamedGridAreaRowCount(size_t rowCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaRowCount, rowCount); }
1231 void setNamedGridAreaColumnCount(size_t columnCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaColumnCount, columnCount); }
1232 void setGridAutoFlow(GridAutoFlow flow) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoFlow, flow); }
1234 void setGridColumnStart(const GridPosition& columnStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnStart, columnStartPosition); }
1235 void setGridColumnEnd(const GridPosition& columnEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnEnd, columnEndPosition); }
1236 void setGridRowStart(const GridPosition& rowStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowStart, rowStartPosition); }
1237 void setGridRowEnd(const GridPosition& rowEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowEnd, rowEndPosition); }
1239 void setMarqueeIncrement(Length f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
1240 void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
1241 void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
1242 void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->m_marquee, behavior, b); }
1243 void setMarqueeLoopCount(int i) { SET_VAR(rareNonInheritedData.access()->m_marquee, loops, i); }
1244 void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
1245 void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
1246 void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
1247 void setTextOverflow(TextOverflow overflow) { SET_VAR(rareNonInheritedData, textOverflow, overflow); }
1248 void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); }
1249 void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); }
1250 void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
1251 void setOverflowWrap(EOverflowWrap b) { SET_VAR(rareInheritedData, overflowWrap, b); }
1252 void setLineBreak(LineBreak b) { SET_VAR(rareInheritedData, lineBreak, b); }
1253 void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
1254 void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
1255 void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
1256 void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); }
1257 void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
1258 void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
1259 void setColumnAxis(ColumnAxis axis) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_axis, axis); }
1260 void setColumnProgression(ColumnProgression progression) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_progression, progression); }
1261 void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
1262 void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
1263 void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
1264 void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
1265 void setColumnFill(ColumnFill columnFill) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_fill, columnFill); }
1266 void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
1267 void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
1268 void setColumnRuleColor(const Color& c) { SET_BORDERVALUE_COLOR(rareNonInheritedData.access()->m_multiCol, m_rule, c); }
1269 void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
1270 void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
1271 void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()); }
1272 void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, columnSpan); }
1273 void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
1274 // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
1275 void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
1276 void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
1277 void setRegionBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakBefore, p); }
1278 void setRegionBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData, m_regionBreakInside, p); }
1279 void setRegionBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakAfter, p); }
1280 void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
1281 void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
1282 void setTransformOriginX(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); }
1283 void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
1284 void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
1285 void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
1286 void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
1287 void setTextDecorationColor(const Color& c) { SET_VAR(rareNonInheritedData, m_textDecorationColor, c); }
1288 void setTextEmphasisColor(const Color& c) { SET_VAR(rareInheritedData, textEmphasisColor, c); }
1289 void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); }
1290 void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); }
1291 void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); }
1292 void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); }
1293 bool setTextOrientation(TextOrientation);
1295 void setObjectFit(ObjectFit f) { SET_VAR(rareNonInheritedData, m_objectFit, f); }
1296 void setObjectPosition(LengthPoint position) { SET_VAR(rareNonInheritedData, m_objectPosition, position); }
1298 void setRubyPosition(RubyPosition position) { SET_VAR(rareInheritedData, m_rubyPosition, position); }
1300 void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); }
1302 void setTabSize(unsigned size) { SET_VAR(rareInheritedData, m_tabSize, size); }
1306 void setLineGrid(const AtomicString& lineGrid) { SET_VAR(rareInheritedData, m_lineGrid, lineGrid); }
1307 void setLineSnap(LineSnap lineSnap) { SET_VAR(rareInheritedData, m_lineSnap, lineSnap); }
1308 void setLineAlign(LineAlign lineAlign) { SET_VAR(rareInheritedData, m_lineAlign, lineAlign); }
1310 void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); }
1311 void setRegionThread(const AtomicString& regionThread) { SET_VAR(rareNonInheritedData, m_regionThread, regionThread); }
1312 void setRegionFragment(RegionFragment regionFragment) { SET_VAR(rareNonInheritedData, m_regionFragment, regionFragment); }
1314 void setWrapFlow(WrapFlow wrapFlow) { SET_VAR(rareNonInheritedData, m_wrapFlow, wrapFlow); }
1315 void setWrapThrough(WrapThrough wrapThrough) { SET_VAR(rareNonInheritedData, m_wrapThrough, wrapThrough); }
1317 // Apple-specific property setters
1318 void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
1320 void clearAnimations()
1322 rareNonInheritedData.access()->m_animations.clear();
1325 void clearTransitions()
1327 rareNonInheritedData.access()->m_transitions.clear();
1330 void adjustAnimations();
1331 void adjustTransitions();
1333 void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
1334 void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
1335 void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
1336 void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
1337 void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
1338 void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
1339 void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
1340 void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
1342 void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
1344 void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
1345 void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
1346 void setTapHighlightColor(const Color& c) { SET_VAR(rareInheritedData, tapHighlightColor, c); }
1347 void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
1348 void setTouchAction(TouchAction t) { SET_VAR(rareNonInheritedData, m_touchAction, t); }
1349 void setTouchActionDelay(TouchActionDelay t) { SET_VAR(rareInheritedData, m_touchActionDelay, t); }
1351 const SVGRenderStyle* svgStyle() const { return m_svgStyle.get(); }
1352 SVGRenderStyle* accessSVGStyle() { return m_svgStyle.access(); }
1354 const SVGPaint::SVGPaintType& fillPaintType() const { return svgStyle()->fillPaintType(); }
1355 Color fillPaintColor() const { return svgStyle()->fillPaintColor(); }
1356 void setFillPaintColor(const Color& c) { accessSVGStyle()->setFillPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
1357 float fillOpacity() const { return svgStyle()->fillOpacity(); }
1358 void setFillOpacity(float f) { accessSVGStyle()->setFillOpacity(f); }
1360 const SVGPaint::SVGPaintType& strokePaintType() const { return svgStyle()->strokePaintType(); }
1361 Color strokePaintColor() const { return svgStyle()->strokePaintColor(); }
1362 void setStrokePaintColor(const Color& c) { accessSVGStyle()->setStrokePaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
1363 float strokeOpacity() const { return svgStyle()->strokeOpacity(); }
1364 void setStrokeOpacity(float f) { accessSVGStyle()->setStrokeOpacity(f); }
1365 SVGLength strokeWidth() const { return svgStyle()->strokeWidth(); }
1366 void setStrokeWidth(SVGLength w) { accessSVGStyle()->setStrokeWidth(w); }
1367 Vector<SVGLength> strokeDashArray() const { return svgStyle()->strokeDashArray(); }
1368 void setStrokeDashArray(Vector<SVGLength> array) { accessSVGStyle()->setStrokeDashArray(array); }
1369 SVGLength strokeDashOffset() const { return svgStyle()->strokeDashOffset(); }
1370 void setStrokeDashOffset(SVGLength d) { accessSVGStyle()->setStrokeDashOffset(d); }
1371 float strokeMiterLimit() const { return svgStyle()->strokeMiterLimit(); }
1372 void setStrokeMiterLimit(float f) { accessSVGStyle()->setStrokeMiterLimit(f); }
1374 float floodOpacity() const { return svgStyle()->floodOpacity(); }
1375 void setFloodOpacity(float f) { accessSVGStyle()->setFloodOpacity(f); }
1377 float stopOpacity() const { return svgStyle()->stopOpacity(); }
1378 void setStopOpacity(float f) { accessSVGStyle()->setStopOpacity(f); }
1380 void setStopColor(const Color& c) { accessSVGStyle()->setStopColor(c); }
1381 void setFloodColor(const Color& c) { accessSVGStyle()->setFloodColor(c); }
1382 void setLightingColor(const Color& c) { accessSVGStyle()->setLightingColor(c); }
1384 SVGLength baselineShiftValue() const { return svgStyle()->baselineShiftValue(); }
1385 void setBaselineShiftValue(SVGLength s) { accessSVGStyle()->setBaselineShiftValue(s); }
1386 SVGLength kerning() const { return svgStyle()->kerning(); }
1387 void setKerning(SVGLength k) { accessSVGStyle()->setKerning(k); }
1389 void setShapeInside(PassRefPtr<ShapeValue> value)
1391 if (rareNonInheritedData->m_shapeInside == value)
1393 rareNonInheritedData.access()->m_shapeInside = value;
1395 ShapeValue* shapeInside() const { return rareNonInheritedData->m_shapeInside.get(); }
1396 ShapeValue* resolvedShapeInside() const
1398 ShapeValue* shapeInside = this->shapeInside();
1399 if (shapeInside && shapeInside->type() == ShapeValue::Outside)
1400 return shapeOutside();
1404 void setShapeOutside(PassRefPtr<ShapeValue> value)
1406 if (rareNonInheritedData->m_shapeOutside == value)
1408 rareNonInheritedData.access()->m_shapeOutside = value;
1410 ShapeValue* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); }
1412 static ShapeValue* initialShapeInside();
1413 static ShapeValue* initialShapeOutside() { return 0; }
1415 void setClipPath(PassRefPtr<ClipPathOperation> operation)
1417 if (rareNonInheritedData->m_clipPath != operation)
1418 rareNonInheritedData.access()->m_clipPath = operation;
1420 ClipPathOperation* clipPath() const { return rareNonInheritedData->m_clipPath.get(); }
1422 static ClipPathOperation* initialClipPath() { return 0; }
1424 Length shapePadding() const { return rareNonInheritedData->m_shapePadding; }
1425 void setShapePadding(Length shapePadding) { SET_VAR(rareNonInheritedData, m_shapePadding, shapePadding); }
1426 static Length initialShapePadding() { return Length(0, Fixed); }
1428 Length shapeMargin() const { return rareNonInheritedData->m_shapeMargin; }
1429 void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, shapeMargin); }
1430 static Length initialShapeMargin() { return Length(0, Fixed); }
1432 float shapeImageThreshold() const { return rareNonInheritedData->m_shapeImageThreshold; }
1433 void setShapeImageThreshold(float shapeImageThreshold)
1435 float clampedShapeImageThreshold = clampTo<float>(shapeImageThreshold, 0, 1);
1436 SET_VAR(rareNonInheritedData, m_shapeImageThreshold, clampedShapeImageThreshold);
1438 static float initialShapeImageThreshold() { return 0; }
1440 bool hasContent() const { return contentData(); }
1441 const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
1442 bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
1443 void clearContent();
1444 void setContent(const String&, bool add = false);
1445 void setContent(PassRefPtr<StyleImage>, bool add = false);
1446 void setContent(PassOwnPtr<CounterContent>, bool add = false);
1447 void setContent(QuoteType, bool add = false);
1449 const CounterDirectiveMap* counterDirectives() const;
1450 CounterDirectiveMap& accessCounterDirectives();
1451 const CounterDirectives getCounterDirectives(const AtomicString& identifier) const;
1453 QuotesData* quotes() const { return rareInheritedData->quotes.get(); }
1454 void setQuotes(PassRefPtr<QuotesData>);
1456 const AtomicString& hyphenString() const;
1458 bool inheritedNotEqual(const RenderStyle*) const;
1459 bool inheritedDataShared(const RenderStyle*) const;
1461 StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1463 bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); }
1464 bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
1465 bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
1466 bool isDisplayRegionType() const
1468 return display() == BLOCK || display() == INLINE_BLOCK
1469 || display() == TABLE_CELL || display() == TABLE_CAPTION
1470 || display() == LIST_ITEM;
1473 bool setWritingMode(WritingMode v)
1475 if (v == writingMode())
1478 inherited_flags.m_writingMode = v;
1482 // A unique style is one that has matches something that makes it impossible to share.
1483 bool unique() const { return noninherited_flags.unique; }
1484 void setUnique() { noninherited_flags.unique = true; }
1486 bool isSharable() const;
1488 bool emptyState() const { return noninherited_flags.emptyState; }
1489 void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; }
1490 bool firstChildState() const { return noninherited_flags.firstChildState; }
1491 void setFirstChildState() { setUnique(); noninherited_flags.firstChildState = true; }
1492 bool lastChildState() const { return noninherited_flags.lastChildState; }
1493 void setLastChildState() { setUnique(); noninherited_flags.lastChildState = true; }
1495 Color visitedDependentColor(int colorProperty) const;
1497 void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInheritance = true; }
1498 bool hasExplicitlyInheritedProperties() const { return noninherited_flags.explicitInheritance; }
1500 void setHasCurrentColor() { noninherited_flags.currentColor = true; }
1501 bool hasCurrentColor() const { return noninherited_flags.currentColor; }
1503 // Initial values for all the properties
1504 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1505 static EBorderStyle initialBorderStyle() { return BNONE; }
1506 static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
1507 static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
1508 static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
1509 static ECaptionSide initialCaptionSide() { return CAPTOP; }
1510 static EClear initialClear() { return CNONE; }
1511 static ColumnAxis initialColumnAxis() { return AutoColumnAxis; }
1512 static ColumnProgression initialColumnProgression() { return NormalColumnProgression; }
1513 static TextDirection initialDirection() { return LTR; }
1514 static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
1515 static TextCombine initialTextCombine() { return TextCombineNone; }
1516 static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
1517 static ObjectFit initialObjectFit() { return ObjectFitFill; }
1518 static LengthPoint initialObjectPosition() { return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); }
1519 static EDisplay initialDisplay() { return INLINE; }
1520 static EEmptyCell initialEmptyCells() { return SHOW; }
1521 static EFloat initialFloating() { return NoFloat; }
1522 static EListStylePosition initialListStylePosition() { return OUTSIDE; }
1523 static EListStyleType initialListStyleType() { return Disc; }
1524 static EOverflow initialOverflowX() { return OVISIBLE; }
1525 static EOverflow initialOverflowY() { return OVISIBLE; }
1526 static EPageBreak initialPageBreak() { return PBAUTO; }
1527 static EPosition initialPosition() { return StaticPosition; }
1528 static ETableLayout initialTableLayout() { return TAUTO; }
1529 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
1530 static ETextTransform initialTextTransform() { return TTNONE; }
1531 static EVisibility initialVisibility() { return VISIBLE; }
1532 static EWhiteSpace initialWhiteSpace() { return NORMAL; }
1533 static short initialHorizontalBorderSpacing() { return 0; }
1534 static short initialVerticalBorderSpacing() { return 0; }
1535 static ECursor initialCursor() { return CURSOR_AUTO; }
1536 static Color initialColor() { return Color::black; }
1537 static StyleImage* initialListStyleImage() { return 0; }
1538 static unsigned initialBorderWidth() { return 3; }
1539 static unsigned short initialColumnRuleWidth() { return 3; }
1540 static unsigned short initialOutlineWidth() { return 3; }
1541 static float initialLetterWordSpacing() { return 0.0f; }
1542 static Length initialSize() { return Length(); }
1543 static Length initialMinSize() { return Length(Fixed); }
1544 static Length initialMaxSize() { return Length(Undefined); }
1545 static Length initialOffset() { return Length(); }
1546 static Length initialMargin() { return Length(Fixed); }
1547 static Length initialPadding() { return Length(Fixed); }
1548 static Length initialTextIndent() { return Length(Fixed); }
1549 static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; }
1550 static EVerticalAlign initialVerticalAlign() { return BASELINE; }
1551 static short initialWidows() { return 2; }
1552 static short initialOrphans() { return 2; }
1553 static Length initialLineHeight() { return Length(-100.0, Percent); }
1554 static ETextAlign initialTextAlign() { return TASTART; }
1555 static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
1556 static TextJustify initialTextJustify() { return TextJustifyAuto; }
1557 static TextDecoration initialTextDecoration() { return TextDecorationNone; }
1558 static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
1559 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
1560 static float initialZoom() { return 1.0f; }
1561 static int initialOutlineOffset() { return 0; }
1562 static float initialOpacity() { return 1.0f; }
1563 static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
1564 static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; }
1565 static EBoxDirection initialBoxDirection() { return BNORMAL; }
1566 static EBoxLines initialBoxLines() { return SINGLE; }
1567 static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
1568 static EBoxPack initialBoxPack() { return Start; }
1569 static float initialBoxFlex() { return 0.0f; }
1570 static unsigned int initialBoxFlexGroup() { return 1; }
1571 static unsigned int initialBoxOrdinalGroup() { return 1; }
1572 static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
1573 static StyleReflection* initialBoxReflect() { return 0; }
1574 static float initialFlexGrow() { return 0; }
1575 static float initialFlexShrink() { return 1; }
1576 static Length initialFlexBasis() { return Length(Auto); }
1577 static int initialOrder() { return 0; }
1578 static EAlignContent initialAlignContent() { return AlignContentStretch; }
1579 static EAlignItems initialAlignItems() { return AlignStretch; }
1580 static EAlignItems initialAlignSelf() { return AlignAuto; }
1581 static EFlexDirection initialFlexDirection() { return FlowRow; }
1582 static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
1583 static EJustifyContent initialJustifyContent() { return JustifyFlexStart; }
1584 static int initialMarqueeLoopCount() { return -1; }
1585 static int initialMarqueeSpeed() { return 85; }
1586 static Length initialMarqueeIncrement() { return Length(6, Fixed); }
1587 static EMarqueeBehavior initialMarqueeBehavior() { return MSCROLL; }
1588 static EMarqueeDirection initialMarqueeDirection() { return MAUTO; }
1589 static EUserModify initialUserModify() { return READ_ONLY; }
1590 static EUserDrag initialUserDrag() { return DRAG_AUTO; }
1591 static EUserSelect initialUserSelect() { return SELECT_TEXT; }
1592 static TextOverflow initialTextOverflow() { return TextOverflowClip; }
1593 static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; }
1594 static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; }
1595 static EWordBreak initialWordBreak() { return NormalWordBreak; }
1596 static EOverflowWrap initialOverflowWrap() { return NormalOverflowWrap; }
1597 static LineBreak initialLineBreak() { return LineBreakAuto; }
1598 static const AtomicString& initialHighlight() { return nullAtom; }
1599 static ESpeak initialSpeak() { return SpeakNormal; }
1600 static const AtomicString& initialHyphenationString() { return nullAtom; }
1601 static const AtomicString& initialLocale() { return nullAtom; }
1602 static EBorderFit initialBorderFit() { return BorderFitBorder; }
1603 static EResize initialResize() { return RESIZE_NONE; }
1604 static ControlPart initialAppearance() { return NoControlPart; }
1605 static bool initialHasAspectRatio() { return false; }
1606 static float initialAspectRatioDenominator() { return 1; }
1607 static float initialAspectRatioNumerator() { return 1; }
1608 static Order initialRTLOrdering() { return LogicalOrder; }
1609 static float initialTextStrokeWidth() { return 0; }
1610 static unsigned short initialColumnCount() { return 1; }
1611 static ColumnFill initialColumnFill() { return ColumnFillBalance; }
1612 static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
1613 static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
1614 static Length initialTransformOriginX() { return Length(50.0, Percent); }
1615 static Length initialTransformOriginY() { return Length(50.0, Percent); }
1616 static EPointerEvents initialPointerEvents() { return PE_AUTO; }
1617 static float initialTransformOriginZ() { return 0; }
1618 static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
1619 static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
1620 static float initialPerspective() { return 0; }
1621 static Length initialPerspectiveOriginX() { return Length(50.0, Percent); }
1622 static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
1623 static Color initialBackgroundColor() { return Color::transparent; }
1624 static Color initialTextEmphasisColor() { return TextEmphasisFillFilled; }
1625 static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; }
1626 static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
1627 static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
1628 static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
1629 static RubyPosition initialRubyPosition() { return RubyPositionBefore; }
1630 static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
1631 static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; }
1632 static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
1633 static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; }
1634 static ImageResolutionSnap initialImageResolutionSnap() { return ImageResolutionNoSnap; }
1635 static float initialImageResolution() { return 1; }
1636 static StyleImage* initialBorderImageSource() { return 0; }
1637 static StyleImage* initialMaskBoxImageSource() { return 0; }
1638 static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
1639 static TouchAction initialTouchAction() { return TouchActionAuto; }
1640 static TouchActionDelay initialTouchActionDelay() { return TouchActionDelayScript; }
1641 static ShadowList* initialBoxShadow() { return 0; }
1642 static ShadowList* initialTextShadow() { return 0; }
1644 // The initial value is 'none' for grid tracks.
1645 static Vector<GridTrackSize> initialGridDefinitionColumns() { return Vector<GridTrackSize>(); }
1646 static Vector<GridTrackSize> initialGridDefinitionRows() { return Vector<GridTrackSize>(); }
1648 static GridAutoFlow initialGridAutoFlow() { return AutoFlowNone; }
1650 static GridTrackSize initialGridAutoColumns() { return GridTrackSize(Auto); }
1651 static GridTrackSize initialGridAutoRows() { return GridTrackSize(Auto); }
1653 static NamedGridLinesMap initialNamedGridColumnLines() { return NamedGridLinesMap(); }
1654 static NamedGridLinesMap initialNamedGridRowLines() { return NamedGridLinesMap(); }
1656 static OrderedNamedGridLines initialOrderedNamedGridColumnLines() { return OrderedNamedGridLines(); }
1657 static OrderedNamedGridLines initialOrderedNamedGridRowLines() { return OrderedNamedGridLines(); }
1659 static NamedGridAreaMap initialNamedGridArea() { return NamedGridAreaMap(); }
1660 static size_t initialNamedGridAreaCount() { return 0; }
1662 // 'auto' is the default.
1663 static GridPosition initialGridColumnStart() { return GridPosition(); }
1664 static GridPosition initialGridColumnEnd() { return GridPosition(); }
1665 static GridPosition initialGridRowStart() { return GridPosition(); }
1666 static GridPosition initialGridRowEnd() { return GridPosition(); }
1668 static unsigned initialTabSize() { return 8; }
1670 static const AtomicString& initialLineGrid() { return nullAtom; }
1671 static LineSnap initialLineSnap() { return LineSnapNone; }
1672 static LineAlign initialLineAlign() { return LineAlignNone; }
1674 static const AtomicString& initialFlowThread() { return nullAtom; }
1675 static const AtomicString& initialRegionThread() { return nullAtom; }
1676 static RegionFragment initialRegionFragment() { return AutoRegionFragment; }
1678 static WrapFlow initialWrapFlow() { return WrapFlowAuto; }
1679 static WrapThrough initialWrapThrough() { return WrapThroughWrap; }
1681 static QuotesData* initialQuotes() { return 0; }
1683 // Keep these at the end.
1684 // FIXME: Why? Seems these should all be one big sorted list.
1685 static LineClampValue initialLineClamp() { return LineClampValue(); }
1686 static ETextSecurity initialTextSecurity() { return TSNONE; }
1687 static Color initialTapHighlightColor();
1688 static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
1689 static BlendMode initialBlendMode() { return BlendModeNormal; }
1690 static EIsolation initialIsolation() { return IsolationAuto; }
1692 void setVisitedLinkColor(const Color&);
1693 void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v); }
1694 void setVisitedLinkBorderLeftColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v); }
1695 void setVisitedLinkBorderRightColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v); }
1696 void setVisitedLinkBorderBottomColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v); }
1697 void setVisitedLinkBorderTopColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v); }
1698 void setVisitedLinkOutlineColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v); }
1699 void setVisitedLinkColumnRuleColor(const Color& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v); }
1700 void setVisitedLinkTextDecorationColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkTextDecorationColor, v); }
1701 void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextEmphasisColor, v); }
1702 void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextFillColor, v); }
1703 void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextStrokeColor, v); }
1705 void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
1706 void getShadowExtent(const ShadowList*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
1707 LayoutBoxExtent getShadowInsetExtent(const ShadowList*) const;
1708 void getShadowHorizontalExtent(const ShadowList*, LayoutUnit& left, LayoutUnit& right) const;
1709 void getShadowVerticalExtent(const ShadowList*, LayoutUnit& top, LayoutUnit& bottom) const;
1710 void getShadowInlineDirectionExtent(const ShadowList* shadow, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
1712 return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight);
1714 void getShadowBlockDirectionExtent(const ShadowList* shadow, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
1716 return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom);
1719 bool isDisplayReplacedType(EDisplay display) const
1721 return display == INLINE_BLOCK || display == INLINE_BOX || display == INLINE_FLEX
1722 || display == INLINE_TABLE || display == INLINE_GRID;
1725 bool isDisplayInlineType(EDisplay display) const
1727 return display == INLINE || isDisplayReplacedType(display);
1730 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
1731 Color invalidColor() const { static Color invalid; return invalid; }
1732 Color borderLeftColor() const { return surround->border.left().color(); }
1733 Color borderRightColor() const { return surround->border.right().color(); }
1734 Color borderTopColor() const { return surround->border.top().color(); }
1735 Color borderBottomColor() const { return surround->border.bottom().color(); }
1736 Color backgroundColor() const { return m_background->color(); }
1737 Color color() const;
1738 Color columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
1739 Color outlineColor() const { return m_background->outline().color(); }
1740 Color textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
1741 Color textFillColor() const { return rareInheritedData->textFillColor; }
1742 Color textStrokeColor() const { return rareInheritedData->textStrokeColor; }
1743 Color visitedLinkColor() const;
1744 Color visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
1745 Color visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
1746 Color visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
1747 Color visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
1748 Color visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
1749 Color visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
1750 Color visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
1751 Color textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; }
1752 Color visitedLinkTextDecorationColor() const { return rareNonInheritedData->m_visitedLinkTextDecorationColor; }
1753 Color visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor; }
1754 Color visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor; }
1755 Color visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor; }
1757 Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
1759 Color stopColor() const { return svgStyle()->stopColor(); }
1760 Color floodColor() const { return svgStyle()->floodColor(); }
1761 Color lightingColor() const { return svgStyle()->lightingColor(); }
1763 void appendContent(PassOwnPtr<ContentData>);
1766 inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
1768 double zoomFactor = style->effectiveZoom();
1769 if (zoomFactor == 1)
1771 // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
1772 if (zoomFactor > 1) {
1779 return roundForImpreciseConversion<int>(value / zoomFactor);
1782 inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)
1784 return value / style->effectiveZoom();
1787 inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const RenderStyle* style)
1789 return value / style->effectiveZoom();
1792 inline bool RenderStyle::setZoom(float f)
1794 if (compareEqual(visual->m_zoom, f))
1796 visual.access()->m_zoom = f;
1797 setEffectiveZoom(effectiveZoom() * zoom());
1801 inline bool RenderStyle::setEffectiveZoom(float f)
1803 if (compareEqual(rareInheritedData->m_effectiveZoom, f))
1805 rareInheritedData.access()->m_effectiveZoom = f;
1809 inline bool RenderStyle::isSharable() const
1813 if (hasUniquePseudoStyle())
1815 if (transitions() || animations())
1820 inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation)
1822 if (compareEqual(rareInheritedData->m_textOrientation, textOrientation))
1825 rareInheritedData.access()->m_textOrientation = textOrientation;
1829 } // namespace WebCore
1831 #endif // RenderStyle_h