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 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
28 #include "AnimationList.h"
29 #include "BorderValue.h"
30 #include "CSSLineBoxContainValue.h"
31 #include "CSSPrimitiveValue.h"
32 #include "CSSPropertyNames.h"
34 #include "ColorSpace.h"
35 #include "CounterDirectives.h"
37 #include "FillLayer.h"
39 #include "GraphicsTypes.h"
41 #include "LengthBox.h"
42 #include "LengthSize.h"
43 #include "LineClampValue.h"
44 #include "NinePieceImage.h"
45 #include "OutlineValue.h"
46 #include "RenderStyleConstants.h"
47 #include "RoundedRect.h"
48 #include "ShadowData.h"
49 #include "StyleBackgroundData.h"
50 #include "StyleBoxData.h"
51 #include "StyleDeprecatedFlexibleBoxData.h"
52 #include "StyleFlexibleBoxData.h"
53 #include "StyleInheritedData.h"
54 #include "StyleMarqueeData.h"
55 #include "StyleMultiColData.h"
56 #include "StyleRareInheritedData.h"
57 #include "StyleRareNonInheritedData.h"
58 #include "StyleReflection.h"
59 #include "StyleSurroundData.h"
60 #include "StyleTransformData.h"
61 #include "StyleVisualData.h"
62 #include "TextDirection.h"
63 #include "TextOrientation.h"
64 #include "ThemeTypes.h"
65 #include "TransformOperations.h"
66 #include "UnicodeBidi.h"
67 #include <wtf/Forward.h>
68 #include <wtf/OwnPtr.h>
69 #include <wtf/RefCounted.h>
70 #include <wtf/StdLibExtras.h>
71 #include <wtf/Vector.h>
73 #if ENABLE(DASHBOARD_SUPPORT)
74 #include "StyleDashboardRegion.h"
79 #include "SVGRenderStyle.h"
83 #define compareEqual(t, u) ((t) == (u))
85 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
88 #define SET_VAR(group, variable, value) \
89 if (!compareEqual(group->variable, value)) \
90 group.access()->variable = value;
97 class CSSStyleSelector;
104 class TransformationMatrix;
108 typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
110 class RenderStyle: public RefCounted<RenderStyle> {
111 friend class AnimationBase; // Used by CSS animations. We can't allow them to animate based off visited colors.
112 friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
113 friend class EditingStyle; // Editing has to only reveal unvisited info.
114 friend class CSSStyleApplyProperty; // Sets members directly.
115 friend class CSSStyleSelector; // Sets members directly.
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 RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
119 friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors. Rebaselining would allow this to be yanked.
122 // The following bitfield is 32-bits long, which optimizes padding with the
123 // int refCount in the base class. Beware when adding more bits.
124 bool m_affectedByAttributeSelectors : 1;
127 // Bits for dynamic child matching.
128 bool m_affectedByEmpty : 1;
129 bool m_emptyState : 1;
131 // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or
132 // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
133 bool m_childrenAffectedByFirstChildRules : 1;
134 bool m_childrenAffectedByLastChildRules : 1;
135 bool m_childrenAffectedByForwardPositionalRules : 1;
136 bool m_childrenAffectedByBackwardPositionalRules : 1;
137 bool m_firstChildState : 1;
138 bool m_lastChildState : 1;
139 bool m_affectedByDirectAdjacentRules : 1;
140 unsigned m_childIndex : 21; // Plenty of bits to cache an index.
142 // non-inherited attributes
143 DataRef<StyleBoxData> m_box;
144 DataRef<StyleVisualData> visual;
145 DataRef<StyleBackgroundData> m_background;
146 DataRef<StyleSurroundData> surround;
147 DataRef<StyleRareNonInheritedData> rareNonInheritedData;
149 // inherited attributes
150 DataRef<StyleRareInheritedData> rareInheritedData;
151 DataRef<StyleInheritedData> inherited;
153 // list of associated pseudo styles
154 OwnPtr<PseudoStyleCache> m_cachedPseudoStyles;
157 DataRef<SVGRenderStyle> m_svgStyle;
160 // !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp
163 struct InheritedFlags {
164 bool operator==(const InheritedFlags& other) const
166 return (_empty_cells == other._empty_cells)
167 && (_caption_side == other._caption_side)
168 && (_list_style_type == other._list_style_type)
169 && (_list_style_position == other._list_style_position)
170 && (_visibility == other._visibility)
171 && (_text_align == other._text_align)
172 && (_text_transform == other._text_transform)
173 && (_text_decorations == other._text_decorations)
174 && (_cursor_style == other._cursor_style)
175 && (_direction == other._direction)
176 && (_border_collapse == other._border_collapse)
177 && (_white_space == other._white_space)
178 && (_box_direction == other._box_direction)
179 && (m_rtlOrdering == other.m_rtlOrdering)
180 && (_force_backgrounds_to_white == other._force_backgrounds_to_white)
181 && (_pointerEvents == other._pointerEvents)
182 && (_insideLink == other._insideLink)
183 && (m_writingMode == other.m_writingMode);
186 bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
188 unsigned _empty_cells : 1; // EEmptyCell
189 unsigned _caption_side : 2; // ECaptionSide
190 unsigned _list_style_type : 7; // EListStyleType
191 unsigned _list_style_position : 1; // EListStylePosition
192 unsigned _visibility : 2; // EVisibility
193 unsigned _text_align : 4; // ETextAlign
194 unsigned _text_transform : 2; // ETextTransform
195 unsigned _text_decorations : 4;
196 unsigned _cursor_style : 6; // ECursor
197 unsigned _direction : 1; // TextDirection
198 unsigned _border_collapse : 1; // EBorderCollapse
199 unsigned _white_space : 3; // EWhiteSpace
200 unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
203 // non CSS2 inherited
204 unsigned m_rtlOrdering : 1; // Order
205 bool _force_backgrounds_to_white : 1;
206 unsigned _pointerEvents : 4; // EPointerEvents
207 unsigned _insideLink : 2; // EInsideLink
210 // CSS Text Layout Module Level 3: Vertical writing support
211 unsigned m_writingMode : 2; // WritingMode
216 struct NonInheritedFlags {
217 bool operator==(const NonInheritedFlags& other) const
219 return _effectiveDisplay == other._effectiveDisplay
220 && _originalDisplay == other._originalDisplay
221 && _overflowX == other._overflowX
222 && _overflowY == other._overflowY
223 && _vertical_align == other._vertical_align
224 && _clear == other._clear
225 && _position == other._position
226 && _floating == other._floating
227 && _table_layout == other._table_layout
228 && _page_break_before == other._page_break_before
229 && _page_break_after == other._page_break_after
230 && _page_break_inside == other._page_break_inside
231 && _styleType == other._styleType
232 && _affectedByHover == other._affectedByHover
233 && _affectedByActive == other._affectedByActive
234 && _affectedByDrag == other._affectedByDrag
235 && _pseudoBits == other._pseudoBits
236 && _unicodeBidi == other._unicodeBidi
237 && _isLink == other._isLink;
240 bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
242 unsigned _effectiveDisplay : 5; // EDisplay
243 unsigned _originalDisplay : 5; // EDisplay
244 unsigned _overflowX : 3; // EOverflow
245 unsigned _overflowY : 3; // EOverflow
246 unsigned _vertical_align : 4; // EVerticalAlign
247 unsigned _clear : 2; // EClear
248 unsigned _position : 2; // EPosition
249 unsigned _floating : 2; // EFloat
250 unsigned _table_layout : 1; // ETableLayout
252 unsigned _page_break_before : 2; // EPageBreak
253 unsigned _page_break_after : 2; // EPageBreak
254 unsigned _page_break_inside : 2; // EPageBreak
256 unsigned _styleType : 6; // PseudoId
257 bool _affectedByHover : 1;
258 bool _affectedByActive : 1;
259 bool _affectedByDrag : 1;
260 unsigned _pseudoBits : 7;
261 unsigned _unicodeBidi : 3; // EUnicodeBidi
264 } noninherited_flags;
269 void setBitDefaults()
271 inherited_flags._empty_cells = initialEmptyCells();
272 inherited_flags._caption_side = initialCaptionSide();
273 inherited_flags._list_style_type = initialListStyleType();
274 inherited_flags._list_style_position = initialListStylePosition();
275 inherited_flags._visibility = initialVisibility();
276 inherited_flags._text_align = initialTextAlign();
277 inherited_flags._text_transform = initialTextTransform();
278 inherited_flags._text_decorations = initialTextDecoration();
279 inherited_flags._cursor_style = initialCursor();
280 inherited_flags._direction = initialDirection();
281 inherited_flags._border_collapse = initialBorderCollapse();
282 inherited_flags._white_space = initialWhiteSpace();
283 inherited_flags.m_rtlOrdering = initialRTLOrdering();
284 inherited_flags._box_direction = initialBoxDirection();
285 inherited_flags._force_backgrounds_to_white = false;
286 inherited_flags._pointerEvents = initialPointerEvents();
287 inherited_flags._insideLink = NotInsideLink;
288 inherited_flags.m_writingMode = initialWritingMode();
290 noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
291 noninherited_flags._overflowX = initialOverflowX();
292 noninherited_flags._overflowY = initialOverflowY();
293 noninherited_flags._vertical_align = initialVerticalAlign();
294 noninherited_flags._clear = initialClear();
295 noninherited_flags._position = initialPosition();
296 noninherited_flags._floating = initialFloating();
297 noninherited_flags._table_layout = initialTableLayout();
298 noninherited_flags._page_break_before = initialPageBreak();
299 noninherited_flags._page_break_after = initialPageBreak();
300 noninherited_flags._page_break_inside = initialPageBreak();
301 noninherited_flags._styleType = NOPSEUDO;
302 noninherited_flags._affectedByHover = false;
303 noninherited_flags._affectedByActive = false;
304 noninherited_flags._affectedByDrag = false;
305 noninherited_flags._pseudoBits = 0;
306 noninherited_flags._unicodeBidi = initialUnicodeBidi();
307 noninherited_flags._isLink = false;
311 ALWAYS_INLINE RenderStyle();
312 // used to create the default style.
313 ALWAYS_INLINE RenderStyle(bool);
314 ALWAYS_INLINE RenderStyle(const RenderStyle&);
317 static PassRefPtr<RenderStyle> create();
318 static PassRefPtr<RenderStyle> createDefaultStyle();
319 static PassRefPtr<RenderStyle> createAnonymousStyle(const RenderStyle* parentStyle);
320 static PassRefPtr<RenderStyle> clone(const RenderStyle*);
324 void inheritFrom(const RenderStyle* inheritParent);
326 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags._styleType); }
327 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; }
329 RenderStyle* getCachedPseudoStyle(PseudoId) const;
330 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
331 void removeCachedPseudoStyle(PseudoId);
333 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
335 bool affectedByHoverRules() const { return noninherited_flags._affectedByHover; }
336 bool affectedByActiveRules() const { return noninherited_flags._affectedByActive; }
337 bool affectedByDragRules() const { return noninherited_flags._affectedByDrag; }
339 void setAffectedByHoverRules(bool b) { noninherited_flags._affectedByHover = b; }
340 void setAffectedByActiveRules(bool b) { noninherited_flags._affectedByActive = b; }
341 void setAffectedByDragRules(bool b) { noninherited_flags._affectedByDrag = b; }
343 bool operator==(const RenderStyle& other) const;
344 bool operator!=(const RenderStyle& other) const { return !(*this == other); }
345 bool isFloating() const { return noninherited_flags._floating != NoFloat; }
346 bool hasMargin() const { return surround->margin.nonZero(); }
347 bool hasBorder() const { return surround->border.hasBorder(); }
348 bool hasPadding() const { return surround->padding.nonZero(); }
349 bool hasOffset() const { return surround->offset.nonZero(); }
351 bool hasBackgroundImage() const { return m_background->background().hasImage(); }
352 bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
353 bool hasAppearance() const { return appearance() != NoControlPart; }
355 bool hasBackground() const
357 Color color = visitedDependentColor(CSSPropertyBackgroundColor);
358 if (color.isValid() && color.alpha() > 0)
360 return hasBackgroundImage();
363 void getImageOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
364 bool hasBorderImageOutsets() const
366 return borderImage().hasImage() && borderImage().outset().nonZero();
368 void getBorderImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
370 return getImageOutsets(borderImage(), top, right, bottom, left);
372 void getBorderImageHorizontalOutsets(LayoutUnit& left, LayoutUnit& right) const
374 return getImageHorizontalOutsets(borderImage(), left, right);
376 void getBorderImageVerticalOutsets(LayoutUnit& top, LayoutUnit& bottom) const
378 return getImageVerticalOutsets(borderImage(), top, bottom);
380 void getBorderImageInlineDirectionOutsets(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
382 return getImageInlineDirectionOutsets(borderImage(), logicalLeft, logicalRight);
384 void getBorderImageBlockDirectionOutsets(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
386 return getImageBlockDirectionOutsets(borderImage(), logicalTop, logicalBottom);
389 void getMaskBoxImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
391 return getImageOutsets(maskBoxImage(), top, right, bottom, left);
394 Order rtlOrdering() const { return static_cast<Order>(inherited_flags.m_rtlOrdering); }
395 void setRTLOrdering(Order o) { inherited_flags.m_rtlOrdering = o; }
397 bool isStyleAvailable() const;
399 bool hasAnyPublicPseudoStyles() const;
400 bool hasPseudoStyle(PseudoId pseudo) const;
401 void setHasPseudoStyle(PseudoId pseudo);
403 // attribute getter methods
405 EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
406 EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
408 Length left() const { return surround->offset.left(); }
409 Length right() const { return surround->offset.right(); }
410 Length top() const { return surround->offset.top(); }
411 Length bottom() const { return surround->offset.bottom(); }
413 // Accessors for positioned object edges that take into account writing mode.
414 Length logicalLeft() const { return isHorizontalWritingMode() ? left() : top(); }
415 Length logicalRight() const { return isHorizontalWritingMode() ? right() : bottom(); }
416 Length logicalTop() const { return isHorizontalWritingMode() ? (isFlippedBlocksWritingMode() ? bottom() : top()) : (isFlippedBlocksWritingMode() ? right() : left()); }
417 Length logicalBottom() const { return isHorizontalWritingMode() ? (isFlippedBlocksWritingMode() ? top() : bottom()) : (isFlippedBlocksWritingMode() ? left() : right()); }
419 // Whether or not a positioned element requires normal flow x/y to be computed
420 // to determine its position.
421 bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); }
422 bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); }
423 bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
424 bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
426 EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
427 EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
429 Length width() const { return m_box->width(); }
430 Length height() const { return m_box->height(); }
431 Length minWidth() const { return m_box->minWidth(); }
432 Length maxWidth() const { return m_box->maxWidth(); }
433 Length minHeight() const { return m_box->minHeight(); }
434 Length maxHeight() const { return m_box->maxHeight(); }
436 Length logicalWidth() const;
437 Length logicalHeight() const;
438 Length logicalMinWidth() const;
439 Length logicalMaxWidth() const;
440 Length logicalMinHeight() const;
441 Length logicalMaxHeight() const;
443 const BorderData& border() const { return surround->border; }
444 const BorderValue& borderLeft() const { return surround->border.left(); }
445 const BorderValue& borderRight() const { return surround->border.right(); }
446 const BorderValue& borderTop() const { return surround->border.top(); }
447 const BorderValue& borderBottom() const { return surround->border.bottom(); }
449 const BorderValue& borderBefore() const;
450 const BorderValue& borderAfter() const;
451 const BorderValue& borderStart() const;
452 const BorderValue& borderEnd() const;
454 const NinePieceImage& borderImage() const { return surround->border.image(); }
455 StyleImage* borderImageSource() const { return surround->border.image().image(); }
457 LengthSize borderTopLeftRadius() const { return surround->border.topLeft(); }
458 LengthSize borderTopRightRadius() const { return surround->border.topRight(); }
459 LengthSize borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
460 LengthSize borderBottomRightRadius() const { return surround->border.bottomRight(); }
461 bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
463 unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); }
464 EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
465 bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
466 unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); }
467 EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
468 bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
469 unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); }
470 EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
471 bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
472 unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); }
473 EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
474 bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
476 unsigned short borderBeforeWidth() const;
477 unsigned short borderAfterWidth() const;
478 unsigned short borderStartWidth() const;
479 unsigned short borderEndWidth() const;
481 unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
482 unsigned short outlineWidth() const
484 if (m_background->outline().style() == BNONE)
486 return m_background->outline().width();
488 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
489 EBorderStyle outlineStyle() const { return m_background->outline().style(); }
490 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_background->outline().isAuto()); }
492 EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
493 EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
495 EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
496 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
497 Length verticalAlignLength() const { return m_box->verticalAlign(); }
499 Length clipLeft() const { return visual->clip.left(); }
500 Length clipRight() const { return visual->clip.right(); }
501 Length clipTop() const { return visual->clip.top(); }
502 Length clipBottom() const { return visual->clip.bottom(); }
503 LengthBox clip() const { return visual->clip; }
504 bool hasClip() const { return visual->hasClip; }
506 EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
508 EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); }
509 ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); }
511 const Font& font() const { return inherited->font; }
512 const FontMetrics& fontMetrics() const { return inherited->font.fontMetrics(); }
513 const FontDescription& fontDescription() const { return inherited->font.fontDescription(); }
514 int fontSize() const { return inherited->font.pixelSize(); }
516 Length textIndent() const { return rareInheritedData->indent; }
517 ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
518 ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
519 int textDecorationsInEffect() const { return inherited_flags._text_decorations; }
520 int textDecoration() const { return visual->textDecoration; }
521 int wordSpacing() const { return inherited->font.wordSpacing(); }
522 int letterSpacing() const { return inherited->font.letterSpacing(); }
524 float zoom() const { return visual->m_zoom; }
525 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
527 TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
528 bool isLeftToRightDirection() const { return direction() == LTR; }
530 Length lineHeight() const { return inherited->line_height; }
531 int computedLineHeight() const
533 Length lh = lineHeight();
535 // Negative value means the line height is not set. Use the font's built-in spacing.
537 return fontMetrics().lineSpacing();
540 return lh.calcMinValue(fontSize());
545 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
546 static bool autoWrap(EWhiteSpace ws)
548 // Nowrap and pre don't automatically wrap.
549 return ws != NOWRAP && ws != PRE;
552 bool autoWrap() const
554 return autoWrap(whiteSpace());
557 static bool preserveNewline(EWhiteSpace ws)
559 // Normal and nowrap do not preserve newlines.
560 return ws != NORMAL && ws != NOWRAP;
563 bool preserveNewline() const
565 return preserveNewline(whiteSpace());
568 static bool collapseWhiteSpace(EWhiteSpace ws)
570 // Pre and prewrap do not collapse whitespace.
571 return ws != PRE && ws != PRE_WRAP;
574 bool collapseWhiteSpace() const
576 return collapseWhiteSpace(whiteSpace());
579 bool isCollapsibleWhiteSpace(UChar c) const
584 return collapseWhiteSpace();
586 return !preserveNewline();
591 bool breakOnlyAfterWhiteSpace() const
593 return whiteSpace() == PRE_WRAP || khtmlLineBreak() == AFTER_WHITE_SPACE;
596 bool breakWords() const
598 return wordBreak() == BreakWordBreak || wordWrap() == BreakWordWrap;
601 EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
602 EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
603 CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); }
604 EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
605 EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
606 EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
607 Length backgroundXPosition() const { return m_background->background().xPosition(); }
608 Length backgroundYPosition() const { return m_background->background().yPosition(); }
609 EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
610 LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); }
611 FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
612 const FillLayer* backgroundLayers() const { return &(m_background->background()); }
614 StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
615 EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); }
616 EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); }
617 CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
618 EFillAttachment maskAttachment() const { return static_cast<EFillAttachment>(rareNonInheritedData->m_mask.attachment()); }
619 EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
620 EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
621 Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
622 Length maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
623 EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
624 LengthSize maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
625 FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
626 const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
627 const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
628 StyleImage* maskBoxImageSource() const { return rareNonInheritedData->m_maskBoxImage.image(); }
630 EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse>(inherited_flags._border_collapse); }
631 short horizontalBorderSpacing() const { return inherited->horizontal_border_spacing; }
632 short verticalBorderSpacing() const { return inherited->vertical_border_spacing; }
633 EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); }
634 ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); }
636 short counterIncrement() const { return rareNonInheritedData->m_counterIncrement; }
637 short counterReset() const { return rareNonInheritedData->m_counterReset; }
639 EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); }
640 StyleImage* listStyleImage() const { return inherited->list_style_image.get(); }
641 EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
643 Length marginTop() const { return surround->margin.top(); }
644 Length marginBottom() const { return surround->margin.bottom(); }
645 Length marginLeft() const { return surround->margin.left(); }
646 Length marginRight() const { return surround->margin.right(); }
647 Length marginBefore() const;
648 Length marginAfter() const;
649 Length marginStart() const;
650 Length marginEnd() const;
651 Length marginStartUsing(const RenderStyle* otherStyle) const;
652 Length marginEndUsing(const RenderStyle* otherStyle) const;
653 Length marginBeforeUsing(const RenderStyle* otherStyle) const;
654 Length marginAfterUsing(const RenderStyle* otherStyle) const;
656 LengthBox paddingBox() const { return surround->padding; }
657 Length paddingTop() const { return surround->padding.top(); }
658 Length paddingBottom() const { return surround->padding.bottom(); }
659 Length paddingLeft() const { return surround->padding.left(); }
660 Length paddingRight() const { return surround->padding.right(); }
661 Length paddingBefore() const;
662 Length paddingAfter() const;
663 Length paddingStart() const;
664 Length paddingEnd() const;
666 ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
668 CursorList* cursors() const { return rareInheritedData->cursorData.get(); }
670 EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
671 bool isLink() const { return noninherited_flags._isLink; }
673 short widows() const { return rareInheritedData->widows; }
674 short orphans() const { return rareInheritedData->orphans; }
675 EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); }
676 EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); }
677 EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); }
679 // CSS3 Getter Methods
681 int outlineOffset() const
683 if (m_background->outline().style() == BNONE)
685 return m_background->outline().offset();
688 const ShadowData* textShadow() const { return rareInheritedData->textShadow.get(); }
689 void getTextShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }
690 void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
691 void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
692 void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }
693 void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }
695 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
696 ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
697 float opacity() const { return rareNonInheritedData->opacity; }
698 ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
699 EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->align); }
700 EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
701 float boxFlex() { return rareNonInheritedData->m_deprecatedFlexibleBox->flex; }
702 unsigned int boxFlexGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex_group; }
703 EBoxLines boxLines() { return static_cast<EBoxLines>(rareNonInheritedData->m_deprecatedFlexibleBox->lines); }
704 unsigned int boxOrdinalGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->ordinal_group; }
705 EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->m_deprecatedFlexibleBox->orient); }
706 EBoxAlignment boxPack() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); }
708 #if ENABLE(CSS3_FLEXBOX)
709 float flexboxWidthPositiveFlex() const { return rareNonInheritedData->m_flexibleBox->m_widthPositiveFlex; }
710 float flexboxWidthNegativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_widthNegativeFlex; }
711 float flexboxHeightPositiveFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightPositiveFlex; }
712 float flexboxHeightNegativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightNegativeFlex; }
713 int flexOrder() const { return rareNonInheritedData->m_flexibleBox->m_flexOrder; }
714 EFlexPack flexPack() const { return static_cast<EFlexPack>(rareNonInheritedData->m_flexibleBox->m_flexPack); }
715 EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); }
716 EFlexFlow flexFlow() const { return static_cast<EFlexFlow>(rareNonInheritedData->m_flexibleBox->m_flexFlow); }
719 const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
720 void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
721 void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
722 void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }
723 void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); }
724 void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); }
726 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
727 EBoxSizing boxSizing() const { return m_box->boxSizing(); }
728 Length marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; }
729 int marqueeSpeed() const { return rareNonInheritedData->m_marquee->speed; }
730 int marqueeLoopCount() const { return rareNonInheritedData->m_marquee->loops; }
731 EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->m_marquee->behavior); }
732 EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(rareNonInheritedData->m_marquee->direction); }
733 EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
734 EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
735 EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
736 TextOverflow textOverflow() const { return static_cast<TextOverflow>(rareNonInheritedData->textOverflow); }
737 EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); }
738 EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); }
739 EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
740 EWordWrap wordWrap() const { return static_cast<EWordWrap>(rareInheritedData->wordWrap); }
741 ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
742 EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(rareInheritedData->khtmlLineBreak); }
743 EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); }
744 const AtomicString& highlight() const { return rareInheritedData->highlight; }
745 Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
746 short hyphenationLimitBefore() const { return rareInheritedData->hyphenationLimitBefore; }
747 short hyphenationLimitAfter() const { return rareInheritedData->hyphenationLimitAfter; }
748 short hyphenationLimitLines() const { return rareInheritedData->hyphenationLimitLines; }
749 const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
750 const AtomicString& locale() const { return rareInheritedData->locale; }
751 EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
752 EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
753 float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
754 bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
755 unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
756 bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
757 bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth(); }
758 float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
759 bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
760 EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
761 unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
762 bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
763 bool columnSpan() const { return rareNonInheritedData->m_multiCol->m_columnSpan; }
764 EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
765 EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
766 EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
767 EPageBreak regionBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakBefore); }
768 EPageBreak regionBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakInside); }
769 EPageBreak regionBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakAfter); }
770 const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
771 Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
772 Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
773 float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
774 bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
776 TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(rareInheritedData->textEmphasisFill); }
777 TextEmphasisMark textEmphasisMark() const;
778 const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; }
779 TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); }
780 const AtomicString& textEmphasisMarkString() const;
782 // Return true if any transform related property (currently transform, transformStyle3D or perspective)
783 // indicates that we are transforming
784 bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
786 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
787 void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
788 void setPageScaleTransform(float);
790 bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
792 TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInheritedData->m_textCombine); }
793 bool hasTextCombine() const { return textCombine() != TextCombineNone; }
796 const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
797 const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
798 int regionIndex() const { return rareNonInheritedData->m_regionIndex; }
799 RegionOverflow regionOverflow() const { return rareNonInheritedData->m_regionOverflow; }
801 // Apple-specific property getter methods
802 EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
803 const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
804 const AnimationList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
806 AnimationList* accessAnimations();
807 AnimationList* accessTransitions();
809 bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
810 bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; }
812 // return the first found Animation (including 'all' transitions)
813 const Animation* transitionForProperty(int property) const;
815 ETransformStyle3D transformStyle3D() const { return rareNonInheritedData->m_transformStyle3D; }
816 bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
818 EBackfaceVisibility backfaceVisibility() const { return rareNonInheritedData->m_backfaceVisibility; }
819 float perspective() const { return rareNonInheritedData->m_perspective; }
820 bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
821 Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
822 Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
823 LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; }
824 PageSizeType pageSizeType() const { return rareNonInheritedData->m_pageSizeType; }
826 #if USE(ACCELERATED_COMPOSITING)
827 // When set, this ensures that styles compare as different. Used during accelerated animations.
828 bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
831 LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
832 const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
833 bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
834 ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
836 WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); }
837 bool isHorizontalWritingMode() const { return writingMode() == TopToBottomWritingMode || writingMode() == BottomToTopWritingMode; }
838 bool isFlippedLinesWritingMode() const { return writingMode() == LeftToRightWritingMode || writingMode() == BottomToTopWritingMode; }
839 bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; }
841 EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
843 ESpeak speak() { return static_cast<ESpeak>(rareInheritedData->speak); }
845 // attribute setter methods
847 void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; }
848 void setOriginalDisplay(EDisplay v) { noninherited_flags._originalDisplay = v; }
849 void setPosition(EPosition v) { noninherited_flags._position = v; }
850 void setFloating(EFloat v) { noninherited_flags._floating = v; }
852 void setLeft(Length v) { SET_VAR(surround, offset.m_left, v) }
853 void setRight(Length v) { SET_VAR(surround, offset.m_right, v) }
854 void setTop(Length v) { SET_VAR(surround, offset.m_top, v) }
855 void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v) }
857 void setWidth(Length v) { SET_VAR(m_box, m_width, v) }
858 void setHeight(Length v) { SET_VAR(m_box, m_height, v) }
860 void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, v) }
861 void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, v) }
862 void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, v) }
863 void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, v) }
865 #if ENABLE(DASHBOARD_SUPPORT)
866 Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
867 void setDashboardRegions(Vector<StyleDashboardRegion> regions) { SET_VAR(rareNonInheritedData, m_dashboardRegions, regions); }
869 void setDashboardRegion(int type, const String& label, Length t, Length r, Length b, Length l, bool append)
871 StyleDashboardRegion region;
872 region.label = label;
873 region.offset.m_top = t;
874 region.offset.m_right = r;
875 region.offset.m_bottom = b;
876 region.offset.m_left = l;
879 rareNonInheritedData.access()->m_dashboardRegions.clear();
880 rareNonInheritedData.access()->m_dashboardRegions.append(region);
884 void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
885 void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()) }
886 void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()) }
887 void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()) }
888 void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()) }
889 void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()) }
890 void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
891 void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()) }
892 void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()) }
893 void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()) }
894 void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()) }
896 void resetOutline() { SET_VAR(m_background, m_outline, OutlineValue()) }
898 void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v) }
900 void setBackgroundXPosition(Length l) { SET_VAR(m_background, m_background.m_xPosition, l) }
901 void setBackgroundYPosition(Length l) { SET_VAR(m_background, m_background.m_yPosition, l) }
902 void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b) }
903 void setBackgroundSizeLength(LengthSize l) { SET_VAR(m_background, m_background.m_sizeLength, l) }
905 void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b) }
906 void setBorderImageSource(PassRefPtr<StyleImage> v) { surround.access()->border.m_image.setImage(v); }
908 void setBorderTopLeftRadius(LengthSize s) { SET_VAR(surround, border.m_topLeft, s) }
909 void setBorderTopRightRadius(LengthSize s) { SET_VAR(surround, border.m_topRight, s) }
910 void setBorderBottomLeftRadius(LengthSize s) { SET_VAR(surround, border.m_bottomLeft, s) }
911 void setBorderBottomRightRadius(LengthSize s) { SET_VAR(surround, border.m_bottomRight, s) }
913 void setBorderRadius(LengthSize s)
915 setBorderTopLeftRadius(s);
916 setBorderTopRightRadius(s);
917 setBorderBottomLeftRadius(s);
918 setBorderBottomRightRadius(s);
920 void setBorderRadius(const IntSize& s)
922 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
925 RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
926 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
928 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
929 LayoutUnit topWidth, LayoutUnit bottomWidth, LayoutUnit leftWidth, LayoutUnit rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
931 void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) }
932 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) }
933 void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.m_left.m_color, v) }
934 void setBorderRightWidth(unsigned short v) { SET_VAR(surround, border.m_right.m_width, v) }
935 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v) }
936 void setBorderRightColor(const Color& v) { SET_VAR(surround, border.m_right.m_color, v) }
937 void setBorderTopWidth(unsigned short v) { SET_VAR(surround, border.m_top.m_width, v) }
938 void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v) }
939 void setBorderTopColor(const Color& v) { SET_VAR(surround, border.m_top.m_color, v) }
940 void setBorderBottomWidth(unsigned short v) { SET_VAR(surround, border.m_bottom.m_width, v) }
941 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v) }
942 void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.m_bottom.m_color, v) }
944 void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v) }
945 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto) }
946 void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v) }
947 void setOutlineColor(const Color& v) { SET_VAR(m_background, m_outline.m_color, v) }
949 void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
950 void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
951 void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
952 void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
953 void setVerticalAlignLength(Length l) { SET_VAR(m_box, m_verticalAlign, l) }
955 void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b) }
956 void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v) }
957 void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v) }
958 void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v) }
959 void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v) }
960 void setClip(Length top, Length right, Length bottom, Length left);
961 void setClip(LengthBox box) { SET_VAR(visual, clip, box) }
963 void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
965 void setClear(EClear v) { noninherited_flags._clear = v; }
966 void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; }
968 bool setFontDescription(const FontDescription& v)
970 if (inherited->font.fontDescription() != v) {
971 inherited.access()->font = Font(v, inherited->font.letterSpacing(), inherited->font.wordSpacing());
977 // Only used for blending font sizes when animating.
978 void setBlendedFontSize(int);
980 void setColor(const Color& v) { SET_VAR(inherited, color, v) }
981 void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v) }
982 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
983 void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
984 void addToTextDecorationsInEffect(int v) { inherited_flags._text_decorations |= v; }
985 void setTextDecorationsInEffect(int v) { inherited_flags._text_decorations = v; }
986 void setTextDecoration(int v) { SET_VAR(visual, textDecoration, v); }
987 void setDirection(TextDirection v) { inherited_flags._direction = v; }
988 void setLineHeight(Length v) { SET_VAR(inherited, line_height, v) }
990 void setZoomWithoutReturnValue(float f) { setZoom(f); }
991 bool setEffectiveZoom(float);
992 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v) }
994 void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
996 void setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }
997 void setLetterSpacing(int v) { inherited.access()->font.setLetterSpacing(v); }
999 void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
1000 void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
1002 void adjustBackgroundLayers()
1004 if (backgroundLayers()->next()) {
1005 accessBackgroundLayers()->cullEmptyLayers();
1006 accessBackgroundLayers()->fillUnsetProperties();
1010 void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); }
1011 void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; }
1013 void adjustMaskLayers()
1015 if (maskLayers()->next()) {
1016 accessMaskLayers()->cullEmptyLayers();
1017 accessMaskLayers()->fillUnsetProperties();
1021 void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b) }
1022 void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
1023 void setMaskXPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, l) }
1024 void setMaskYPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, l) }
1025 void setMaskSize(LengthSize l) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, l) }
1027 void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
1028 void setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v) }
1029 void setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v) }
1030 void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
1031 void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
1033 void setCounterIncrement(short v) { SET_VAR(rareNonInheritedData, m_counterIncrement, v) }
1034 void setCounterReset(short v) { SET_VAR(rareNonInheritedData, m_counterReset, v) }
1036 void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
1037 void setListStyleImage(PassRefPtr<StyleImage> v) { if (inherited->list_style_image != v) inherited.access()->list_style_image = v; }
1038 void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
1040 void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)) }
1041 void setMarginTop(Length v) { SET_VAR(surround, margin.m_top, v) }
1042 void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v) }
1043 void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v) }
1044 void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v) }
1045 void setMarginStart(Length);
1046 void setMarginEnd(Length);
1048 void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)) }
1049 void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b) }
1050 void setPaddingTop(Length v) { SET_VAR(surround, padding.m_top, v) }
1051 void setPaddingBottom(Length v) { SET_VAR(surround, padding.m_bottom, v) }
1052 void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v) }
1053 void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v) }
1055 void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
1056 void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
1057 void setCursorList(PassRefPtr<CursorList>);
1058 void clearCursorList();
1060 void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
1061 void setIsLink(bool b) { noninherited_flags._isLink = b; }
1063 bool forceBackgroundsToWhite() const { return inherited_flags._force_backgrounds_to_white; }
1064 void setForceBackgroundsToWhite(bool b=true) { inherited_flags._force_backgrounds_to_white = b; }
1066 bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
1067 void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_box, m_zIndex, 0) }
1068 int zIndex() const { return m_box->zIndex(); }
1069 void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v) }
1071 void setWidows(short w) { SET_VAR(rareInheritedData, widows, w); }
1072 void setOrphans(short o) { SET_VAR(rareInheritedData, orphans, o); }
1073 // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
1074 void setPageBreakInside(EPageBreak b) { ASSERT(b == PBAUTO || b == PBAVOID); noninherited_flags._page_break_inside = b; }
1075 void setPageBreakBefore(EPageBreak b) { noninherited_flags._page_break_before = b; }
1076 void setPageBreakAfter(EPageBreak b) { noninherited_flags._page_break_after = b; }
1079 void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v) }
1080 void setTextShadow(PassOwnPtr<ShadowData>, bool add = false);
1081 void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
1082 void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w) }
1083 void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c) }
1084 void setColorSpace(ColorSpace space) { SET_VAR(rareInheritedData, colorSpace, space) }
1085 void setOpacity(float f) { SET_VAR(rareNonInheritedData, opacity, f); }
1086 void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
1087 // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
1088 void setBoxAlign(EBoxAlignment a) { ASSERT(a == BSTRETCH || a == BSTART || a == BCENTER || a == BEND || a == BBASELINE); SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, align, a); }
1089 void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
1090 void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex, f); }
1091 void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex_group, fg); }
1092 void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, lines, l); }
1093 void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, ordinal_group, og); }
1094 void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, orient, o); }
1095 void setBoxPack(EBoxAlignment p) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, pack, p); }
1096 void setBoxShadow(PassOwnPtr<ShadowData>, bool add = false);
1097 void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
1098 void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
1099 #if ENABLE(CSS3_FLEXBOX)
1100 void setFlexboxWidthPositiveFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_widthPositiveFlex, f); }
1101 void setFlexboxWidthNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_widthNegativeFlex, f); }
1102 void setFlexboxHeightPositiveFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightPositiveFlex, f); }
1103 void setFlexboxHeightNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightNegativeFlex, f); }
1104 void setFlexOrder(int o) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexOrder, o); }
1105 void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); }
1106 void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); }
1107 void setFlexFlow(EFlexFlow flow) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexFlow, flow); }
1109 void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
1110 void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
1111 void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
1112 void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->m_marquee, behavior, b); }
1113 void setMarqueeLoopCount(int i) { SET_VAR(rareNonInheritedData.access()->m_marquee, loops, i); }
1114 void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
1115 void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
1116 void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
1117 void setTextOverflow(TextOverflow overflow) { SET_VAR(rareNonInheritedData, textOverflow, overflow); }
1118 void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); }
1119 void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); }
1120 void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
1121 void setWordWrap(EWordWrap b) { SET_VAR(rareInheritedData, wordWrap, b); }
1122 void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
1123 void setKHTMLLineBreak(EKHTMLLineBreak b) { SET_VAR(rareInheritedData, khtmlLineBreak, b); }
1124 void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(rareNonInheritedData, matchNearestMailBlockquoteColor, c); }
1125 void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
1126 void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
1127 void setHyphenationLimitBefore(short limit) { SET_VAR(rareInheritedData, hyphenationLimitBefore, limit); }
1128 void setHyphenationLimitAfter(short limit) { SET_VAR(rareInheritedData, hyphenationLimitAfter, limit); }
1129 void setHyphenationLimitLines(short limit) { SET_VAR(rareInheritedData, hyphenationLimitLines, limit); }
1130 void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
1131 void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); }
1132 void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
1133 void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
1134 void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
1135 void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
1136 void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
1137 void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
1138 void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
1139 void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
1140 void setColumnRuleColor(const Color& c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_color, c); }
1141 void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
1142 void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
1143 void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
1144 void setColumnSpan(bool b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, b); }
1145 void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
1146 // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
1147 void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
1148 void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
1149 void setRegionBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakBefore, p); }
1150 void setRegionBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData, m_regionBreakInside, p); }
1151 void setRegionBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakAfter, p); }
1152 void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
1153 void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
1154 void setTransformOriginX(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); }
1155 void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
1156 void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
1157 void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
1158 void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
1159 void setTextEmphasisColor(const Color& c) { SET_VAR(rareInheritedData, textEmphasisColor, c) }
1160 void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); }
1161 void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); }
1162 void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); }
1163 void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); }
1166 void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); }
1167 void setRegionThread(const AtomicString& regionThread) { SET_VAR(rareNonInheritedData, m_regionThread, regionThread); }
1168 void setRegionIndex(int regionIndex) { SET_VAR(rareNonInheritedData, m_regionIndex, regionIndex); }
1169 void setRegionOverflow(RegionOverflow regionOverflow) { SET_VAR(rareNonInheritedData, m_regionOverflow, regionOverflow); }
1171 // Apple-specific property setters
1172 void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
1174 void clearAnimations()
1176 rareNonInheritedData.access()->m_animations.clear();
1179 void clearTransitions()
1181 rareNonInheritedData.access()->m_transitions.clear();
1184 void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; }
1185 void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; }
1186 void adjustAnimations();
1187 void adjustTransitions();
1189 void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
1190 void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
1191 void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
1192 void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
1193 void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
1194 void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
1195 void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
1196 void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
1198 #if USE(ACCELERATED_COMPOSITING)
1199 void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
1202 void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
1203 void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
1204 bool setTextSizeAdjust(bool);
1205 void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
1208 const SVGRenderStyle* svgStyle() const { return m_svgStyle.get(); }
1209 SVGRenderStyle* accessSVGStyle() { return m_svgStyle.access(); }
1211 const SVGPaint::SVGPaintType& fillPaintType() const { return svgStyle()->fillPaintType(); }
1212 const Color& fillPaintColor() const { return svgStyle()->fillPaintColor(); }
1213 void setFillPaintColor(const Color& c) { accessSVGStyle()->setFillPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
1214 float fillOpacity() const { return svgStyle()->fillOpacity(); }
1215 void setFillOpacity(float f) { accessSVGStyle()->setFillOpacity(f); }
1217 const SVGPaint::SVGPaintType& strokePaintType() const { return svgStyle()->strokePaintType(); }
1218 const Color& strokePaintColor() const { return svgStyle()->strokePaintColor(); }
1219 void setStrokePaintColor(const Color& c) { accessSVGStyle()->setStrokePaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
1220 float strokeOpacity() const { return svgStyle()->strokeOpacity(); }
1221 void setStrokeOpacity(float f) { accessSVGStyle()->setStrokeOpacity(f); }
1222 SVGLength strokeWidth() const { return svgStyle()->strokeWidth(); }
1223 void setStrokeWidth(SVGLength w) { accessSVGStyle()->setStrokeWidth(w); }
1224 SVGLength strokeDashOffset() const { return svgStyle()->strokeDashOffset(); }
1225 void setStrokeDashOffset(SVGLength d) { accessSVGStyle()->setStrokeDashOffset(d); }
1226 float strokeMiterLimit() const { return svgStyle()->strokeMiterLimit(); }
1227 void setStrokeMiterLimit(float f) { accessSVGStyle()->setStrokeMiterLimit(f); }
1229 float floodOpacity() const { return svgStyle()->floodOpacity(); }
1230 void setFloodOpacity(float f) { accessSVGStyle()->setFloodOpacity(f); }
1232 float stopOpacity() const { return svgStyle()->stopOpacity(); }
1233 void setStopOpacity(float f) { accessSVGStyle()->setStopOpacity(f); }
1235 void setStopColor(const Color& c) { accessSVGStyle()->setStopColor(c); }
1236 void setFloodColor(const Color& c) { accessSVGStyle()->setFloodColor(c); }
1237 void setLightingColor(const Color& c) { accessSVGStyle()->setLightingColor(c); }
1239 SVGLength baselineShiftValue() const { return svgStyle()->baselineShiftValue(); }
1240 void setBaselineShiftValue(SVGLength s) { accessSVGStyle()->setBaselineShiftValue(s); }
1241 SVGLength kerning() const { return svgStyle()->kerning(); }
1242 void setKerning(SVGLength k) { accessSVGStyle()->setKerning(k); }
1245 void setWrapShape(PassRefPtr<CSSWrapShape> shape)
1247 if (rareNonInheritedData->m_wrapShape != shape)
1248 rareNonInheritedData.access()->m_wrapShape = shape;
1250 CSSWrapShape* wrapShape() const { return rareNonInheritedData->m_wrapShape.get(); }
1251 static CSSWrapShape* initialWrapShape() { return 0; }
1253 bool hasContent() const { return contentData(); }
1254 const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
1255 bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
1256 void clearContent();
1257 void setContent(const String&, bool add = false);
1258 void setContent(PassRefPtr<StyleImage>, bool add = false);
1259 void setContent(PassOwnPtr<CounterContent>, bool add = false);
1260 void setContent(QuoteType, bool add = false);
1262 const CounterDirectiveMap* counterDirectives() const;
1263 CounterDirectiveMap& accessCounterDirectives();
1265 QuotesData* quotes() const { return rareInheritedData->quotes.get(); }
1266 void setQuotes(PassRefPtr<QuotesData>);
1268 const AtomicString& hyphenString() const;
1270 bool inheritedNotEqual(const RenderStyle*) const;
1272 StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
1274 bool isDisplayReplacedType() const
1276 return display() == INLINE_BLOCK || display() == INLINE_BOX || display() == INLINE_TABLE;
1279 bool isDisplayInlineType() const
1281 return display() == INLINE || isDisplayReplacedType();
1284 bool isOriginalDisplayInlineType() const
1286 return originalDisplay() == INLINE || originalDisplay() == INLINE_BLOCK
1287 || originalDisplay() == INLINE_BOX || originalDisplay() == INLINE_TABLE;
1290 void setWritingMode(WritingMode v) { inherited_flags.m_writingMode = v; }
1292 // To tell if this style matched attribute selectors. This makes it impossible to share.
1293 bool affectedByAttributeSelectors() const { return m_affectedByAttributeSelectors; }
1294 void setAffectedByAttributeSelectors() { m_affectedByAttributeSelectors = true; }
1296 bool affectedByDirectAdjacentRules() const { return m_affectedByDirectAdjacentRules; }
1297 void setAffectedByDirectAdjacentRules() { m_affectedByDirectAdjacentRules = true; }
1299 bool unique() const { return m_unique; }
1300 void setUnique() { m_unique = true; }
1302 // Methods for indicating the style is affected by dynamic updates (e.g., children changing, our position changing in our sibling list, etc.)
1303 bool affectedByEmpty() const { return m_affectedByEmpty; }
1304 bool emptyState() const { return m_emptyState; }
1305 void setEmptyState(bool b) { m_affectedByEmpty = true; m_unique = true; m_emptyState = b; }
1306 bool childrenAffectedByPositionalRules() const { return childrenAffectedByForwardPositionalRules() || childrenAffectedByBackwardPositionalRules(); }
1307 bool childrenAffectedByFirstChildRules() const { return m_childrenAffectedByFirstChildRules; }
1308 void setChildrenAffectedByFirstChildRules() { m_childrenAffectedByFirstChildRules = true; }
1309 bool childrenAffectedByLastChildRules() const { return m_childrenAffectedByLastChildRules; }
1310 void setChildrenAffectedByLastChildRules() { m_childrenAffectedByLastChildRules = true; }
1311 bool childrenAffectedByForwardPositionalRules() const { return m_childrenAffectedByForwardPositionalRules; }
1312 void setChildrenAffectedByForwardPositionalRules() { m_childrenAffectedByForwardPositionalRules = true; }
1313 bool childrenAffectedByBackwardPositionalRules() const { return m_childrenAffectedByBackwardPositionalRules; }
1314 void setChildrenAffectedByBackwardPositionalRules() { m_childrenAffectedByBackwardPositionalRules = true; }
1315 bool firstChildState() const { return m_firstChildState; }
1316 void setFirstChildState() { m_unique = true; m_firstChildState = true; }
1317 bool lastChildState() const { return m_lastChildState; }
1318 void setLastChildState() { m_unique = true; m_lastChildState = true; }
1319 unsigned childIndex() const { return m_childIndex; }
1320 void setChildIndex(unsigned index) { m_unique = true; m_childIndex = index; }
1322 const Color visitedDependentColor(int colorProperty) const;
1324 // Initial values for all the properties
1325 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1326 static EBorderStyle initialBorderStyle() { return BNONE; }
1327 static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
1328 static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
1329 static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
1330 static ECaptionSide initialCaptionSide() { return CAPTOP; }
1331 static EClear initialClear() { return CNONE; }
1332 static ColorSpace initialColorSpace() { return ColorSpaceDeviceRGB; }
1333 static TextDirection initialDirection() { return LTR; }
1334 static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
1335 static TextCombine initialTextCombine() { return TextCombineNone; }
1336 static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
1337 static EDisplay initialDisplay() { return INLINE; }
1338 static EEmptyCell initialEmptyCells() { return SHOW; }
1339 static EFloat initialFloating() { return NoFloat; }
1340 static EListStylePosition initialListStylePosition() { return OUTSIDE; }
1341 static EListStyleType initialListStyleType() { return Disc; }
1342 static EOverflow initialOverflowX() { return OVISIBLE; }
1343 static EOverflow initialOverflowY() { return OVISIBLE; }
1344 static EPageBreak initialPageBreak() { return PBAUTO; }
1345 static EPosition initialPosition() { return StaticPosition; }
1346 static ETableLayout initialTableLayout() { return TAUTO; }
1347 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
1348 static ETextTransform initialTextTransform() { return TTNONE; }
1349 static EVisibility initialVisibility() { return VISIBLE; }
1350 static EWhiteSpace initialWhiteSpace() { return NORMAL; }
1351 static short initialHorizontalBorderSpacing() { return 0; }
1352 static short initialVerticalBorderSpacing() { return 0; }
1353 static ECursor initialCursor() { return CURSOR_AUTO; }
1354 static Color initialColor() { return Color::black; }
1355 static StyleImage* initialListStyleImage() { return 0; }
1356 static unsigned short initialBorderWidth() { return 3; }
1357 static int initialLetterWordSpacing() { return 0; }
1358 static Length initialSize() { return Length(); }
1359 static Length initialMinSize() { return Length(0, Fixed); }
1360 static Length initialMaxSize() { return Length(undefinedLength, Fixed); }
1361 static Length initialOffset() { return Length(); }
1362 static Length initialMargin() { return Length(Fixed); }
1363 static Length initialPadding() { return Length(Fixed); }
1364 static Length initialTextIndent() { return Length(Fixed); }
1365 static EVerticalAlign initialVerticalAlign() { return BASELINE; }
1366 static int initialWidows() { return 2; }
1367 static int initialOrphans() { return 2; }
1368 static Length initialLineHeight() { return Length(-100.0, Percent); }
1369 static ETextAlign initialTextAlign() { return TAAUTO; }
1370 static ETextDecoration initialTextDecoration() { return TDNONE; }
1371 static float initialZoom() { return 1.0f; }
1372 static int initialOutlineOffset() { return 0; }
1373 static float initialOpacity() { return 1.0f; }
1374 static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
1375 static EBoxDirection initialBoxDirection() { return BNORMAL; }
1376 static EBoxLines initialBoxLines() { return SINGLE; }
1377 static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
1378 static EBoxAlignment initialBoxPack() { return BSTART; }
1379 static float initialBoxFlex() { return 0.0f; }
1380 static int initialBoxFlexGroup() { return 1; }
1381 static int initialBoxOrdinalGroup() { return 1; }
1382 static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
1383 static StyleReflection* initialBoxReflect() { return 0; }
1384 static float initialFlexboxWidthPositiveFlex() { return 0; }
1385 static float initialFlexboxWidthNegativeFlex() { return 0; }
1386 static float initialFlexboxHeightPositiveFlex() { return 0; }
1387 static float initialFlexboxHeightNegativeFlex() { return 0; }
1388 static int initialFlexOrder() { return 1; }
1389 static EFlexPack initialFlexPack() { return PackStart; }
1390 static EFlexAlign initialFlexAlign() { return AlignStretch; }
1391 static EFlexFlow initialFlexFlow() { return FlowRow; }
1392 static int initialMarqueeLoopCount() { return -1; }
1393 static int initialMarqueeSpeed() { return 85; }
1394 static Length initialMarqueeIncrement() { return Length(6, Fixed); }
1395 static EMarqueeBehavior initialMarqueeBehavior() { return MSCROLL; }
1396 static EMarqueeDirection initialMarqueeDirection() { return MAUTO; }
1397 static EUserModify initialUserModify() { return READ_ONLY; }
1398 static EUserDrag initialUserDrag() { return DRAG_AUTO; }
1399 static EUserSelect initialUserSelect() { return SELECT_TEXT; }
1400 static TextOverflow initialTextOverflow() { return TextOverflowClip; }
1401 static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; }
1402 static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; }
1403 static EWordBreak initialWordBreak() { return NormalWordBreak; }
1404 static EWordWrap initialWordWrap() { return NormalWordWrap; }
1405 static ENBSPMode initialNBSPMode() { return NBNORMAL; }
1406 static EKHTMLLineBreak initialKHTMLLineBreak() { return LBNORMAL; }
1407 static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; }
1408 static const AtomicString& initialHighlight() { return nullAtom; }
1409 static ESpeak initialSpeak() { return SpeakNormal; }
1410 static Hyphens initialHyphens() { return HyphensManual; }
1411 static short initialHyphenationLimitBefore() { return -1; }
1412 static short initialHyphenationLimitAfter() { return -1; }
1413 static short initialHyphenationLimitLines() { return -1; }
1414 static const AtomicString& initialHyphenationString() { return nullAtom; }
1415 static const AtomicString& initialLocale() { return nullAtom; }
1416 static EBorderFit initialBorderFit() { return BorderFitBorder; }
1417 static EResize initialResize() { return RESIZE_NONE; }
1418 static ControlPart initialAppearance() { return NoControlPart; }
1419 static Order initialRTLOrdering() { return LogicalOrder; }
1420 static float initialTextStrokeWidth() { return 0; }
1421 static unsigned short initialColumnCount() { return 1; }
1422 static bool initialColumnSpan() { return false; }
1423 static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
1424 static Length initialTransformOriginX() { return Length(50.0, Percent); }
1425 static Length initialTransformOriginY() { return Length(50.0, Percent); }
1426 static EPointerEvents initialPointerEvents() { return PE_AUTO; }
1427 static float initialTransformOriginZ() { return 0; }
1428 static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
1429 static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
1430 static float initialPerspective() { return 0; }
1431 static Length initialPerspectiveOriginX() { return Length(50.0, Percent); }
1432 static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
1433 static Color initialBackgroundColor() { return Color::transparent; }
1434 static Color initialTextEmphasisColor() { return TextEmphasisFillFilled; }
1435 static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; }
1436 static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
1437 static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
1438 static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
1439 static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
1440 static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
1441 static StyleImage* initialBorderImageSource() { return 0; }
1442 static StyleImage* initialMaskBoxImageSource() { return 0; }
1444 static const AtomicString& initialFlowThread() { return nullAtom; }
1445 static const AtomicString& initialRegionThread() { return nullAtom; }
1446 static int initialRegionIndex() { return 0; }
1447 static RegionOverflow initialRegionOverflow() { return AutoRegionOverflow; }
1449 // Keep these at the end.
1450 static LineClampValue initialLineClamp() { return LineClampValue(); }
1451 static bool initialTextSizeAdjust() { return true; }
1452 static ETextSecurity initialTextSecurity() { return TSNONE; }
1453 #if ENABLE(DASHBOARD_SUPPORT)
1454 static const Vector<StyleDashboardRegion>& initialDashboardRegions();
1455 static const Vector<StyleDashboardRegion>& noneDashboardRegions();
1459 void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
1460 void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
1461 void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const;
1462 void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom) const;
1463 void getShadowInlineDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
1465 return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight);
1467 void getShadowBlockDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
1469 return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom);
1472 // Helpers for obtaining border image outsets for overflow.
1473 void getImageHorizontalOutsets(const NinePieceImage&, LayoutUnit& left, LayoutUnit& right) const;
1474 void getImageVerticalOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& bottom) const;
1475 void getImageInlineDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
1477 return isHorizontalWritingMode() ? getImageHorizontalOutsets(image, logicalLeft, logicalRight) : getImageVerticalOutsets(image, logicalLeft, logicalRight);
1479 void getImageBlockDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
1481 return isHorizontalWritingMode() ? getImageVerticalOutsets(image, logicalTop, logicalBottom) : getImageHorizontalOutsets(image, logicalTop, logicalBottom);
1484 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
1485 const Color& borderLeftColor() const { return surround->border.left().color(); }
1486 const Color& borderRightColor() const { return surround->border.right().color(); }
1487 const Color& borderTopColor() const { return surround->border.top().color(); }
1488 const Color& borderBottomColor() const { return surround->border.bottom().color(); }
1489 const Color& backgroundColor() const { return m_background->color(); }
1490 const Color& color() const { return inherited->color; }
1491 const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
1492 const Color& outlineColor() const { return m_background->outline().color(); }
1493 const Color& textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
1494 const Color& textFillColor() const { return rareInheritedData->textFillColor; }
1495 const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
1497 const Color colorIncludingFallback(int colorProperty) const;
1500 const Color& stopColor() const { return svgStyle()->stopColor(); }
1501 const Color& floodColor() const { return svgStyle()->floodColor(); }
1502 const Color& lightingColor() const { return svgStyle()->lightingColor(); }
1505 void appendContent(PassOwnPtr<ContentData>);
1508 inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
1510 double zoomFactor = style->effectiveZoom();
1511 if (zoomFactor == 1)
1513 // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
1514 if (zoomFactor > 1) {
1521 return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(value / zoomFactor);
1524 inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)
1526 return value / style->effectiveZoom();
1529 inline bool RenderStyle::setZoom(float f)
1531 if (compareEqual(visual->m_zoom, f))
1533 visual.access()->m_zoom = f;
1534 setEffectiveZoom(effectiveZoom() * zoom());
1538 inline bool RenderStyle::setEffectiveZoom(float f)
1540 if (compareEqual(rareInheritedData->m_effectiveZoom, f))
1542 rareInheritedData.access()->m_effectiveZoom = f;
1546 inline bool RenderStyle::setTextSizeAdjust(bool b)
1548 if (compareEqual(rareInheritedData->textSizeAdjust, b))
1550 rareInheritedData.access()->textSizeAdjust = b;
1554 } // namespace WebCore
1556 #endif // RenderStyle_h