1/* 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) 7 * 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. 12 * 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. 17 * 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. 22 * 23 */ 24 25#ifndef RenderStyle_h 26#define RenderStyle_h 27 28#include "AnimationList.h" 29#include "BorderValue.h" 30#include "CSSLineBoxContainValue.h" 31#include "CSSPrimitiveValue.h" 32#include "CSSPropertyNames.h" 33#include "Color.h" 34#include "ColorSpace.h" 35#include "CounterDirectives.h" 36#include "DataRef.h" 37#include "FontBaseline.h" 38#include "FontDescription.h" 39#include "GraphicsTypes.h" 40#include "LayoutBoxExtent.h" 41#include "Length.h" 42#include "LengthBox.h" 43#include "LengthFunctions.h" 44#include "LengthSize.h" 45#include "LineClampValue.h" 46#include "NinePieceImage.h" 47#include "OutlineValue.h" 48#include "Pagination.h" 49#include "RenderStyleConstants.h" 50#include "RoundedRect.h" 51#include "ShadowData.h" 52#include "ShapeValue.h" 53#include "StyleBackgroundData.h" 54#include "StyleBoxData.h" 55#include "StyleDeprecatedFlexibleBoxData.h" 56#include "StyleFlexibleBoxData.h" 57#include "StyleGridData.h" 58#include "StyleGridItemData.h" 59#include "StyleMarqueeData.h" 60#include "StyleMultiColData.h" 61#include "StyleRareInheritedData.h" 62#include "StyleRareNonInheritedData.h" 63#include "StyleReflection.h" 64#include "StyleSurroundData.h" 65#include "StyleTransformData.h" 66#include "StyleVisualData.h" 67#include "TextDirection.h" 68#include "ThemeTypes.h" 69#include "TransformOperations.h" 70#include "UnicodeBidi.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> 76 77#if ENABLE(CSS_FILTERS) 78#include "StyleFilterData.h" 79#endif 80 81#if ENABLE(DASHBOARD_SUPPORT) 82#include "StyleDashboardRegion.h" 83#endif 84 85#if ENABLE(SVG) 86#include "SVGPaint.h" 87#include "SVGRenderStyle.h" 88#endif 89 90template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); } 91 92#define SET_VAR(group, variable, value) \ 93 if (!compareEqual(group->variable, value)) \ 94 group.access()->variable = value 95 96#define SET_BORDERVALUE_COLOR(group, variable, value) \ 97 if (!compareEqual(group->variable.color(), value)) \ 98 group.access()->variable.setColor(value) 99 100namespace WebCore { 101 102using std::max; 103 104#if ENABLE(CSS_FILTERS) 105class FilterOperations; 106#endif 107 108class BorderData; 109class CounterContent; 110class CursorList; 111class Font; 112class FontMetrics; 113class IntRect; 114class Pair; 115class ShadowData; 116class StyleImage; 117class StyleInheritedData; 118class StyleResolver; 119class TransformationMatrix; 120 121class ContentData; 122 123typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache; 124 125class RenderStyle: public RefCounted<RenderStyle> { 126 friend class CSSPropertyAnimation; // Used by CSS animations. We can't allow them to animate based off visited colors. 127 friend class ApplyStyleCommand; // Editing has to only reveal unvisited info. 128 friend class DeprecatedStyleBuilder; // Sets members directly. 129 friend class EditingStyle; // Editing has to only reveal unvisited info. 130 friend class ComputedStyleExtractor; // Ignores visited styles, so needs to be able to see unvisited info. 131 friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors. 132 friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps. 133 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. 134 friend class StyleResolver; // Sets members directly. 135protected: 136 137 // non-inherited attributes 138 DataRef<StyleBoxData> m_box; 139 DataRef<StyleVisualData> visual; 140 DataRef<StyleBackgroundData> m_background; 141 DataRef<StyleSurroundData> surround; 142 DataRef<StyleRareNonInheritedData> rareNonInheritedData; 143 144 // inherited attributes 145 DataRef<StyleRareInheritedData> rareInheritedData; 146 DataRef<StyleInheritedData> inherited; 147 148 // list of associated pseudo styles 149 OwnPtr<PseudoStyleCache> m_cachedPseudoStyles; 150 151#if ENABLE(SVG) 152 DataRef<SVGRenderStyle> m_svgStyle; 153#endif 154 155// !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp and implicitlyInherited() in StyleResolver.cpp 156 157 // inherit 158 struct InheritedFlags { 159 bool operator==(const InheritedFlags& other) const 160 { 161 return (_empty_cells == other._empty_cells) 162 && (_caption_side == other._caption_side) 163 && (_list_style_type == other._list_style_type) 164 && (_list_style_position == other._list_style_position) 165 && (_visibility == other._visibility) 166 && (_text_align == other._text_align) 167 && (_text_transform == other._text_transform) 168 && (_text_decorations == other._text_decorations) 169 && (_cursor_style == other._cursor_style) 170#if ENABLE(CURSOR_VISIBILITY) 171 && (m_cursorVisibility == other.m_cursorVisibility) 172#endif 173 && (_direction == other._direction) 174 && (_white_space == other._white_space) 175 && (_border_collapse == other._border_collapse) 176 && (_box_direction == other._box_direction) 177 && (m_rtlOrdering == other.m_rtlOrdering) 178 && (m_printColorAdjust == other.m_printColorAdjust) 179 && (_pointerEvents == other._pointerEvents) 180 && (_insideLink == other._insideLink) 181 && (m_writingMode == other.m_writingMode); 182 } 183 184 bool operator!=(const InheritedFlags& other) const { return !(*this == other); } 185 186 unsigned _empty_cells : 1; // EEmptyCell 187 unsigned _caption_side : 2; // ECaptionSide 188 unsigned _list_style_type : 7; // EListStyleType 189 unsigned _list_style_position : 1; // EListStylePosition 190 unsigned _visibility : 2; // EVisibility 191 unsigned _text_align : 4; // ETextAlign 192 unsigned _text_transform : 2; // ETextTransform 193 unsigned _text_decorations : TextDecorationBits; 194 unsigned _cursor_style : 6; // ECursor 195#if ENABLE(CURSOR_VISIBILITY) 196 unsigned m_cursorVisibility : 1; // CursorVisibility 197#endif 198 unsigned _direction : 1; // TextDirection 199 unsigned _white_space : 3; // EWhiteSpace 200 // 32 bits 201 unsigned _border_collapse : 1; // EBorderCollapse 202 unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module) 203 204 // non CSS2 inherited 205 unsigned m_rtlOrdering : 1; // Order 206 unsigned m_printColorAdjust : PrintColorAdjustBits; 207 unsigned _pointerEvents : 4; // EPointerEvents 208 unsigned _insideLink : 2; // EInsideLink 209 // 43 bits 210 211 // CSS Text Layout Module Level 3: Vertical writing support 212 unsigned m_writingMode : 2; // WritingMode 213 // 45 bits 214 } inherited_flags; 215 216// don't inherit 217 struct NonInheritedFlags { 218 bool operator==(const NonInheritedFlags& other) const 219 { 220 return _effectiveDisplay == other._effectiveDisplay 221 && _originalDisplay == other._originalDisplay 222 && _overflowX == other._overflowX 223 && _overflowY == other._overflowY 224 && _vertical_align == other._vertical_align 225 && _clear == other._clear 226 && _position == other._position 227 && _floating == other._floating 228 && _table_layout == other._table_layout 229 && _page_break_before == other._page_break_before 230 && _page_break_after == other._page_break_after 231 && _page_break_inside == other._page_break_inside 232 && _styleType == other._styleType 233 && _affectedByHover == other._affectedByHover 234 && _affectedByActive == other._affectedByActive 235 && _affectedByDrag == other._affectedByDrag 236 && _pseudoBits == other._pseudoBits 237 && _unicodeBidi == other._unicodeBidi 238 && explicitInheritance == other.explicitInheritance 239 && unique == other.unique 240 && emptyState == other.emptyState 241 && firstChildState == other.firstChildState 242 && lastChildState == other.lastChildState 243 && _isLink == other._isLink; 244 } 245 246 bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); } 247 248 unsigned _effectiveDisplay : 5; // EDisplay 249 unsigned _originalDisplay : 5; // EDisplay 250 unsigned _overflowX : 3; // EOverflow 251 unsigned _overflowY : 3; // EOverflow 252 unsigned _vertical_align : 4; // EVerticalAlign 253 unsigned _clear : 2; // EClear 254 unsigned _position : 3; // EPosition 255 unsigned _floating : 2; // EFloat 256 unsigned _table_layout : 1; // ETableLayout 257 258 unsigned _unicodeBidi : 3; // EUnicodeBidi 259 // 31 bits 260 unsigned _page_break_before : 2; // EPageBreak 261 unsigned _page_break_after : 2; // EPageBreak 262 unsigned _page_break_inside : 2; // EPageBreak 263 264 unsigned _styleType : 6; // PseudoId 265 unsigned _pseudoBits : 7; 266 unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property 267 unsigned unique : 1; // Style can not be shared. 268 unsigned emptyState : 1; 269 unsigned firstChildState : 1; 270 unsigned lastChildState : 1; 271 272 bool affectedByHover() const { return _affectedByHover; } 273 void setAffectedByHover(bool value) { _affectedByHover = value; } 274 bool affectedByActive() const { return _affectedByActive; } 275 void setAffectedByActive(bool value) { _affectedByActive = value; } 276 bool affectedByDrag() const { return _affectedByDrag; } 277 void setAffectedByDrag(bool value) { _affectedByDrag = value; } 278 bool isLink() const { return _isLink; } 279 void setIsLink(bool value) { _isLink = value; } 280 private: 281 unsigned _affectedByHover : 1; 282 unsigned _affectedByActive : 1; 283 unsigned _affectedByDrag : 1; 284 unsigned _isLink : 1; 285 // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom() 286 // 59 bits 287 } noninherited_flags; 288 289// !END SYNC! 290 291protected: 292 void setBitDefaults() 293 { 294 inherited_flags._empty_cells = initialEmptyCells(); 295 inherited_flags._caption_side = initialCaptionSide(); 296 inherited_flags._list_style_type = initialListStyleType(); 297 inherited_flags._list_style_position = initialListStylePosition(); 298 inherited_flags._visibility = initialVisibility(); 299 inherited_flags._text_align = initialTextAlign(); 300 inherited_flags._text_transform = initialTextTransform(); 301 inherited_flags._text_decorations = initialTextDecoration(); 302 inherited_flags._cursor_style = initialCursor(); 303#if ENABLE(CURSOR_VISIBILITY) 304 inherited_flags.m_cursorVisibility = initialCursorVisibility(); 305#endif 306 inherited_flags._direction = initialDirection(); 307 inherited_flags._white_space = initialWhiteSpace(); 308 inherited_flags._border_collapse = initialBorderCollapse(); 309 inherited_flags.m_rtlOrdering = initialRTLOrdering(); 310 inherited_flags._box_direction = initialBoxDirection(); 311 inherited_flags.m_printColorAdjust = initialPrintColorAdjust(); 312 inherited_flags._pointerEvents = initialPointerEvents(); 313 inherited_flags._insideLink = NotInsideLink; 314 inherited_flags.m_writingMode = initialWritingMode(); 315 316 noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay(); 317 noninherited_flags._overflowX = initialOverflowX(); 318 noninherited_flags._overflowY = initialOverflowY(); 319 noninherited_flags._vertical_align = initialVerticalAlign(); 320 noninherited_flags._clear = initialClear(); 321 noninherited_flags._position = initialPosition(); 322 noninherited_flags._floating = initialFloating(); 323 noninherited_flags._table_layout = initialTableLayout(); 324 noninherited_flags._unicodeBidi = initialUnicodeBidi(); 325 noninherited_flags._page_break_before = initialPageBreak(); 326 noninherited_flags._page_break_after = initialPageBreak(); 327 noninherited_flags._page_break_inside = initialPageBreak(); 328 noninherited_flags._styleType = NOPSEUDO; 329 noninherited_flags._pseudoBits = 0; 330 noninherited_flags.explicitInheritance = false; 331 noninherited_flags.unique = false; 332 noninherited_flags.emptyState = false; 333 noninherited_flags.firstChildState = false; 334 noninherited_flags.lastChildState = false; 335 noninherited_flags.setAffectedByHover(false); 336 noninherited_flags.setAffectedByActive(false); 337 noninherited_flags.setAffectedByDrag(false); 338 noninherited_flags.setIsLink(false); 339 } 340 341private: 342 ALWAYS_INLINE RenderStyle(); 343 // used to create the default style. 344 ALWAYS_INLINE RenderStyle(bool); 345 ALWAYS_INLINE RenderStyle(const RenderStyle&); 346 347public: 348 static PassRefPtr<RenderStyle> create(); 349 static PassRefPtr<RenderStyle> createDefaultStyle(); 350 static PassRefPtr<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay); 351 static PassRefPtr<RenderStyle> clone(const RenderStyle*); 352 353 // Create a RenderStyle for generated content by inheriting from a pseudo style. 354 static PassRefPtr<RenderStyle> createStyleInheritingFromPseudoStyle(const RenderStyle* pseudoStyle); 355 356 enum IsAtShadowBoundary { 357 AtShadowBoundary, 358 NotAtShadowBoundary, 359 }; 360 361 void inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary = NotAtShadowBoundary); 362 void copyNonInheritedFrom(const RenderStyle*); 363 364 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags._styleType); } 365 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; } 366 367 RenderStyle* getCachedPseudoStyle(PseudoId) const; 368 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>); 369 void removeCachedPseudoStyle(PseudoId); 370 371 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); } 372 373#if ENABLE(CSS_VARIABLES) 374 void setVariable(const AtomicString& name, const String& value) { rareInheritedData.access()->m_variables.access()->setVariable(name, value); } 375 const HashMap<AtomicString, String>* variables() { return &(rareInheritedData->m_variables->m_data); } 376#endif 377 378 bool affectedByHover() const { return noninherited_flags.affectedByHover(); } 379 bool affectedByActive() const { return noninherited_flags.affectedByActive(); } 380 bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); } 381 382 void setAffectedByHover() { noninherited_flags.setAffectedByHover(true); } 383 void setAffectedByActive() { noninherited_flags.setAffectedByActive(true); } 384 void setAffectedByDrag() { noninherited_flags.setAffectedByDrag(true); } 385 386 void setColumnStylesFromPaginationMode(const Pagination::Mode&); 387 388 bool operator==(const RenderStyle& other) const; 389 bool operator!=(const RenderStyle& other) const { return !(*this == other); } 390 bool isFloating() const { return noninherited_flags._floating != NoFloat; } 391 bool hasMargin() const { return surround->margin.nonZero(); } 392 bool hasBorder() const { return surround->border.hasBorder(); } 393 bool hasPadding() const { return surround->padding.nonZero(); } 394 bool hasOffset() const { return surround->offset.nonZero(); } 395 bool hasMarginBeforeQuirk() const { return marginBefore().quirk(); } 396 bool hasMarginAfterQuirk() const { return marginAfter().quirk(); } 397 398 bool hasBackgroundImage() const { return m_background->background().hasImage(); } 399 bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); } 400 401 bool hasEntirelyFixedBackground() const; 402 403 bool hasAppearance() const { return appearance() != NoControlPart; } 404 405 bool hasBackground() const 406 { 407 Color color = visitedDependentColor(CSSPropertyBackgroundColor); 408 if (color.isValid() && color.alpha()) 409 return true; 410 return hasBackgroundImage(); 411 } 412 413 LayoutBoxExtent imageOutsets(const NinePieceImage&) const; 414 bool hasBorderImageOutsets() const 415 { 416 return borderImage().hasImage() && borderImage().outset().nonZero(); 417 } 418 LayoutBoxExtent borderImageOutsets() const 419 { 420 return imageOutsets(borderImage()); 421 } 422 423 LayoutBoxExtent maskBoxImageOutsets() const 424 { 425 return imageOutsets(maskBoxImage()); 426 } 427 428#if ENABLE(CSS_FILTERS) 429 bool hasFilterOutsets() const { return hasFilter() && filter().hasOutsets(); } 430 FilterOutsets filterOutsets() const { return hasFilter() ? filter().outsets() : FilterOutsets(); } 431#endif 432 433 Order rtlOrdering() const { return static_cast<Order>(inherited_flags.m_rtlOrdering); } 434 void setRTLOrdering(Order o) { inherited_flags.m_rtlOrdering = o; } 435 436 bool isStyleAvailable() const; 437 438 bool hasAnyPublicPseudoStyles() const; 439 bool hasPseudoStyle(PseudoId pseudo) const; 440 void setHasPseudoStyle(PseudoId pseudo); 441 bool hasUniquePseudoStyle() const; 442 443 // attribute getter methods 444 445 EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); } 446 EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); } 447 448 Length left() const { return surround->offset.left(); } 449 Length right() const { return surround->offset.right(); } 450 Length top() const { return surround->offset.top(); } 451 Length bottom() const { return surround->offset.bottom(); } 452 453 // Accessors for positioned object edges that take into account writing mode. 454 Length logicalLeft() const { return surround->offset.logicalLeft(writingMode()); } 455 Length logicalRight() const { return surround->offset.logicalRight(writingMode()); } 456 Length logicalTop() const { return surround->offset.before(writingMode()); } 457 Length logicalBottom() const { return surround->offset.after(writingMode()); } 458 459 // Whether or not a positioned element requires normal flow x/y to be computed 460 // to determine its position. 461 bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); } 462 bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); } 463 bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); } 464 bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); } 465 466 EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); } 467 bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; } 468 bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; } 469 bool hasPaintOffset() const 470 { 471 bool paintOffset = hasInFlowPosition(); 472#if ENABLE(CSS_SHAPES) 473 paintOffset = paintOffset || (isFloating() && shapeOutside()); 474#endif 475 return paintOffset; 476 } 477 bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; } 478 EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); } 479 480 Length width() const { return m_box->width(); } 481 Length height() const { return m_box->height(); } 482 Length minWidth() const { return m_box->minWidth(); } 483 Length maxWidth() const { return m_box->maxWidth(); } 484 Length minHeight() const { return m_box->minHeight(); } 485 Length maxHeight() const { return m_box->maxHeight(); } 486 487 Length logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); } 488 Length logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); } 489 Length logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); } 490 Length logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); } 491 Length logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); } 492 Length logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); } 493 494 const BorderData& border() const { return surround->border; } 495 const BorderValue& borderLeft() const { return surround->border.left(); } 496 const BorderValue& borderRight() const { return surround->border.right(); } 497 const BorderValue& borderTop() const { return surround->border.top(); } 498 const BorderValue& borderBottom() const { return surround->border.bottom(); } 499 500 const BorderValue& borderBefore() const; 501 const BorderValue& borderAfter() const; 502 const BorderValue& borderStart() const; 503 const BorderValue& borderEnd() const; 504 505 const NinePieceImage& borderImage() const { return surround->border.image(); } 506 StyleImage* borderImageSource() const { return surround->border.image().image(); } 507 LengthBox borderImageSlices() const { return surround->border.image().imageSlices(); } 508 LengthBox borderImageWidth() const { return surround->border.image().borderSlices(); } 509 LengthBox borderImageOutset() const { return surround->border.image().outset(); } 510 511 LengthSize borderTopLeftRadius() const { return surround->border.topLeft(); } 512 LengthSize borderTopRightRadius() const { return surround->border.topRight(); } 513 LengthSize borderBottomLeftRadius() const { return surround->border.bottomLeft(); } 514 LengthSize borderBottomRightRadius() const { return surround->border.bottomRight(); } 515 bool hasBorderRadius() const { return surround->border.hasBorderRadius(); } 516 517 unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); } 518 EBorderStyle borderLeftStyle() const { return surround->border.left().style(); } 519 bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); } 520 unsigned borderRightWidth() const { return surround->border.borderRightWidth(); } 521 EBorderStyle borderRightStyle() const { return surround->border.right().style(); } 522 bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); } 523 unsigned borderTopWidth() const { return surround->border.borderTopWidth(); } 524 EBorderStyle borderTopStyle() const { return surround->border.top().style(); } 525 bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); } 526 unsigned borderBottomWidth() const { return surround->border.borderBottomWidth(); } 527 EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); } 528 bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); } 529 530 unsigned short borderBeforeWidth() const; 531 unsigned short borderAfterWidth() const; 532 unsigned short borderStartWidth() const; 533 unsigned short borderEndWidth() const; 534 535 unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); } 536 unsigned short outlineWidth() const 537 { 538 if (m_background->outline().style() == BNONE) 539 return 0; 540 return m_background->outline().width(); 541 } 542 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; } 543 EBorderStyle outlineStyle() const { return m_background->outline().style(); } 544 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_background->outline().isAuto()); } 545 546 EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); } 547 EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); } 548 549 EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); } 550 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); } 551 Length verticalAlignLength() const { return m_box->verticalAlign(); } 552 553 Length clipLeft() const { return visual->clip.left(); } 554 Length clipRight() const { return visual->clip.right(); } 555 Length clipTop() const { return visual->clip.top(); } 556 Length clipBottom() const { return visual->clip.bottom(); } 557 LengthBox clip() const { return visual->clip; } 558 bool hasClip() const { return visual->hasClip; } 559 560 EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); } 561 562 EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); } 563 ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); } 564 565 const Font& font() const; 566 const FontMetrics& fontMetrics() const; 567 const FontDescription& fontDescription() const; 568 float specifiedFontSize() const; 569 float computedFontSize() const; 570 int fontSize() const; 571 572#if ENABLE(TEXT_AUTOSIZING) 573 float textAutosizingMultiplier() const { return visual->m_textAutosizingMultiplier; } 574#endif 575 576 Length textIndent() const { return rareInheritedData->indent; } 577#if ENABLE(CSS3_TEXT) 578 TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(rareInheritedData->m_textIndentLine); } 579 TextIndentType textIndentType() const { return static_cast<TextIndentType>(rareInheritedData->m_textIndentType); } 580#endif 581 ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); } 582 ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); } 583 TextDecoration textDecorationsInEffect() const { return static_cast<TextDecoration>(inherited_flags._text_decorations); } 584 TextDecoration textDecoration() const { return static_cast<TextDecoration>(visual->textDecoration); } 585#if ENABLE(CSS3_TEXT) 586 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); } 587 TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); } 588 TextJustify textJustify() const { return static_cast<TextJustify>(rareInheritedData->m_textJustify); } 589 TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); } 590#else 591 TextDecorationStyle textDecorationStyle() const { return TextDecorationStyleSolid; } 592#endif // CSS3_TEXT 593 int wordSpacing() const; 594 int letterSpacing() const; 595 596 float zoom() const { return visual->m_zoom; } 597 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; } 598 599 TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); } 600 bool isLeftToRightDirection() const { return direction() == LTR; } 601 602 Length specifiedLineHeight() const; 603 Length lineHeight() const; 604 int computedLineHeight(RenderView* = 0) const; 605 606 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); } 607 static bool autoWrap(EWhiteSpace ws) 608 { 609 // Nowrap and pre don't automatically wrap. 610 return ws != NOWRAP && ws != PRE; 611 } 612 613 bool autoWrap() const 614 { 615 return autoWrap(whiteSpace()); 616 } 617 618 static bool preserveNewline(EWhiteSpace ws) 619 { 620 // Normal and nowrap do not preserve newlines. 621 return ws != NORMAL && ws != NOWRAP; 622 } 623 624 bool preserveNewline() const 625 { 626 return preserveNewline(whiteSpace()); 627 } 628 629 static bool collapseWhiteSpace(EWhiteSpace ws) 630 { 631 // Pre and prewrap do not collapse whitespace. 632 return ws != PRE && ws != PRE_WRAP; 633 } 634 635 bool collapseWhiteSpace() const 636 { 637 return collapseWhiteSpace(whiteSpace()); 638 } 639 640 bool isCollapsibleWhiteSpace(UChar c) const 641 { 642 switch (c) { 643 case ' ': 644 case '\t': 645 return collapseWhiteSpace(); 646 case '\n': 647 return !preserveNewline(); 648 } 649 return false; 650 } 651 652 bool breakOnlyAfterWhiteSpace() const 653 { 654 return whiteSpace() == PRE_WRAP || lineBreak() == LineBreakAfterWhiteSpace; 655 } 656 657 bool breakWords() const 658 { 659 return wordBreak() == BreakWordBreak || overflowWrap() == BreakOverflowWrap; 660 } 661 662 EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); } 663 EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); } 664 CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); } 665 EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); } 666 EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); } 667 EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); } 668 Length backgroundXPosition() const { return m_background->background().xPosition(); } 669 Length backgroundYPosition() const { return m_background->background().yPosition(); } 670 EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); } 671 LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); } 672 FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); } 673 const FillLayer* backgroundLayers() const { return &(m_background->background()); } 674 675 StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); } 676 EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); } 677 EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); } 678 CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); } 679 EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); } 680 EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); } 681 Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); } 682 Length maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); } 683 EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); } 684 LengthSize maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); } 685 FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); } 686 const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); } 687 const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; } 688 StyleImage* maskBoxImageSource() const { return rareNonInheritedData->m_maskBoxImage.image(); } 689 690 EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse>(inherited_flags._border_collapse); } 691 short horizontalBorderSpacing() const; 692 short verticalBorderSpacing() const; 693 EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); } 694 ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); } 695 696 EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); } 697 StyleImage* listStyleImage() const; 698 EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); } 699 700 Length marginTop() const { return surround->margin.top(); } 701 Length marginBottom() const { return surround->margin.bottom(); } 702 Length marginLeft() const { return surround->margin.left(); } 703 Length marginRight() const { return surround->margin.right(); } 704 Length marginBefore() const { return surround->margin.before(writingMode()); } 705 Length marginAfter() const { return surround->margin.after(writingMode()); } 706 Length marginStart() const { return surround->margin.start(writingMode(), direction()); } 707 Length marginEnd() const { return surround->margin.end(writingMode(), direction()); } 708 Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); } 709 Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); } 710 Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); } 711 Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); } 712 713 LengthBox paddingBox() const { return surround->padding; } 714 Length paddingTop() const { return surround->padding.top(); } 715 Length paddingBottom() const { return surround->padding.bottom(); } 716 Length paddingLeft() const { return surround->padding.left(); } 717 Length paddingRight() const { return surround->padding.right(); } 718 Length paddingBefore() const { return surround->padding.before(writingMode()); } 719 Length paddingAfter() const { return surround->padding.after(writingMode()); } 720 Length paddingStart() const { return surround->padding.start(writingMode(), direction()); } 721 Length paddingEnd() const { return surround->padding.end(writingMode(), direction()); } 722 723 ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); } 724#if ENABLE(CURSOR_VISIBILITY) 725 CursorVisibility cursorVisibility() const { return static_cast<CursorVisibility>(inherited_flags.m_cursorVisibility); } 726#endif 727 728 CursorList* cursors() const { return rareInheritedData->cursorData.get(); } 729 730 EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); } 731 bool isLink() const { return noninherited_flags.isLink(); } 732 733 short widows() const { return rareInheritedData->widows; } 734 short orphans() const { return rareInheritedData->orphans; } 735 bool hasAutoWidows() const { return rareInheritedData->m_hasAutoWidows; } 736 bool hasAutoOrphans() const { return rareInheritedData->m_hasAutoOrphans; } 737 EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); } 738 EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); } 739 EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); } 740 741 // CSS3 Getter Methods 742 743 int outlineOffset() const 744 { 745 if (m_background->outline().style() == BNONE) 746 return 0; 747 return m_background->outline().offset(); 748 } 749 750 const ShadowData* textShadow() const { return rareInheritedData->textShadow.get(); } 751 void getTextShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(textShadow(), top, right, bottom, left); } 752 void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); } 753 void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); } 754 void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); } 755 void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); } 756 757 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; } 758 ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); } 759 float opacity() const { return rareNonInheritedData->opacity; } 760 ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); } 761 // aspect ratio convenience method 762 bool hasAspectRatio() const { return rareNonInheritedData->m_hasAspectRatio; } 763 float aspectRatio() const { return aspectRatioNumerator() / aspectRatioDenominator(); } 764 float aspectRatioDenominator() const { return rareNonInheritedData->m_aspectRatioDenominator; } 765 float aspectRatioNumerator() const { return rareNonInheritedData->m_aspectRatioNumerator; } 766 EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->align); } 767 EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); } 768 float boxFlex() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex; } 769 unsigned int boxFlexGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex_group; } 770 EBoxLines boxLines() const { return static_cast<EBoxLines>(rareNonInheritedData->m_deprecatedFlexibleBox->lines); } 771 unsigned int boxOrdinalGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->ordinal_group; } 772 EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->m_deprecatedFlexibleBox->orient); } 773 EBoxPack boxPack() const { return static_cast<EBoxPack>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); } 774 775 int order() const { return rareNonInheritedData->m_order; } 776 float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; } 777 float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; } 778 Length flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; } 779 EAlignContent alignContent() const { return static_cast<EAlignContent>(rareNonInheritedData->m_alignContent); } 780 EAlignItems alignItems() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignItems); } 781 EAlignItems alignSelf() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignSelf); } 782 EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); } 783 bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; } 784 bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; } 785 EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); } 786 EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); } 787 788 const Vector<GridTrackSize>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; } 789 const Vector<GridTrackSize>& gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; } 790 GridAutoFlow gridAutoFlow() const { return rareNonInheritedData->m_grid->m_gridAutoFlow; } 791 const GridTrackSize& gridAutoColumns() const { return rareNonInheritedData->m_grid->m_gridAutoColumns; } 792 const GridTrackSize& gridAutoRows() const { return rareNonInheritedData->m_grid->m_gridAutoRows; } 793 794 const GridPosition& gridItemStart() const { return rareNonInheritedData->m_gridItem->m_gridStart; } 795 const GridPosition& gridItemEnd() const { return rareNonInheritedData->m_gridItem->m_gridEnd; } 796 const GridPosition& gridItemBefore() const { return rareNonInheritedData->m_gridItem->m_gridBefore; } 797 const GridPosition& gridItemAfter() const { return rareNonInheritedData->m_gridItem->m_gridAfter; } 798 799 const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); } 800 void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); } 801 LayoutBoxExtent getBoxShadowInsetExtent() const { return getShadowInsetExtent(boxShadow()); } 802 void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); } 803 void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); } 804 void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); } 805 void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); } 806 807#if ENABLE(CSS_BOX_DECORATION_BREAK) 808 EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecorationBreak(); } 809#endif 810 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); } 811 EBoxSizing boxSizing() const { return m_box->boxSizing(); } 812 Length marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; } 813 int marqueeSpeed() const { return rareNonInheritedData->m_marquee->speed; } 814 int marqueeLoopCount() const { return rareNonInheritedData->m_marquee->loops; } 815 EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->m_marquee->behavior); } 816 EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(rareNonInheritedData->m_marquee->direction); } 817 EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); } 818 EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); } 819 EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); } 820 TextOverflow textOverflow() const { return static_cast<TextOverflow>(rareNonInheritedData->textOverflow); } 821 EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); } 822 EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); } 823 EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); } 824 EOverflowWrap overflowWrap() const { return static_cast<EOverflowWrap>(rareInheritedData->overflowWrap); } 825 ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); } 826 LineBreak lineBreak() const { return static_cast<LineBreak>(rareInheritedData->lineBreak); } 827 const AtomicString& highlight() const { return rareInheritedData->highlight; } 828 Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); } 829 short hyphenationLimitBefore() const { return rareInheritedData->hyphenationLimitBefore; } 830 short hyphenationLimitAfter() const { return rareInheritedData->hyphenationLimitAfter; } 831 short hyphenationLimitLines() const { return rareInheritedData->hyphenationLimitLines; } 832 const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; } 833 const AtomicString& locale() const { return rareInheritedData->locale; } 834 EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); } 835 EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); } 836 ColumnAxis columnAxis() const { return static_cast<ColumnAxis>(rareNonInheritedData->m_multiCol->m_axis); } 837 bool hasInlineColumnAxis() const { 838 ColumnAxis axis = columnAxis(); 839 return axis == AutoColumnAxis || isHorizontalWritingMode() == (axis == HorizontalColumnAxis); 840 } 841 ColumnProgression columnProgression() const { return static_cast<ColumnProgression>(rareNonInheritedData->m_multiCol->m_progression); } 842 float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; } 843 bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; } 844 unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; } 845 bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; } 846 bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth() || !hasInlineColumnAxis(); } 847 float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; } 848 bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; } 849 EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); } 850 unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); } 851 bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); } 852 ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheritedData->m_multiCol->m_columnSpan); } 853 EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); } 854 EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); } 855 EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); } 856 EPageBreak regionBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakBefore); } 857 EPageBreak regionBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakInside); } 858 EPageBreak regionBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakAfter); } 859 const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; } 860 Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; } 861 Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; } 862 float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; } 863 bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); } 864 865 TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(rareInheritedData->textEmphasisFill); } 866 TextEmphasisMark textEmphasisMark() const; 867 const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; } 868 TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); } 869 const AtomicString& textEmphasisMarkString() const; 870 871 RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInheritedData->m_rubyPosition); } 872 873 TextOrientation textOrientation() const { return static_cast<TextOrientation>(rareInheritedData->m_textOrientation); } 874 875 // Return true if any transform related property (currently transform, transformStyle3D or perspective) 876 // indicates that we are transforming 877 bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); } 878 879 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin }; 880 void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const; 881 void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin = IncludeTransformOrigin) const; 882 void setPageScaleTransform(float); 883 884 bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); } 885 886 TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInheritedData->m_textCombine); } 887 bool hasTextCombine() const { return textCombine() != TextCombineNone; } 888 889 unsigned tabSize() const { return rareInheritedData->m_tabSize; } 890 891 // End CSS3 Getters 892 893 const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; } 894 const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; } 895 RegionFragment regionFragment() const { return static_cast<RegionFragment>(rareNonInheritedData->m_regionFragment); } 896 897 const AtomicString& lineGrid() const { return rareInheritedData->m_lineGrid; } 898 LineSnap lineSnap() const { return static_cast<LineSnap>(rareInheritedData->m_lineSnap); } 899 LineAlign lineAlign() const { return static_cast<LineAlign>(rareInheritedData->m_lineAlign); } 900 901 WrapFlow wrapFlow() const { return static_cast<WrapFlow>(rareNonInheritedData->m_wrapFlow); } 902 WrapThrough wrapThrough() const { return static_cast<WrapThrough>(rareNonInheritedData->m_wrapThrough); } 903 904 // Apple-specific property getter methods 905 EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); } 906 const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); } 907 const AnimationList* transitions() const { return rareNonInheritedData->m_transitions.get(); } 908 909 AnimationList* accessAnimations(); 910 AnimationList* accessTransitions(); 911 912 bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; } 913 bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; } 914 915 // return the first found Animation (including 'all' transitions) 916 const Animation* transitionForProperty(CSSPropertyID) const; 917 918 ETransformStyle3D transformStyle3D() const { return static_cast<ETransformStyle3D>(rareNonInheritedData->m_transformStyle3D); } 919 bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; } 920 921 EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfaceVisibility>(rareNonInheritedData->m_backfaceVisibility); } 922 float perspective() const { return rareNonInheritedData->m_perspective; } 923 bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; } 924 Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; } 925 Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; } 926 LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; } 927 PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNonInheritedData->m_pageSizeType); } 928 929#if USE(ACCELERATED_COMPOSITING) 930 // When set, this ensures that styles compare as different. Used during accelerated animations. 931 bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; } 932#endif 933 934 LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; } 935 const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; } 936#if ENABLE(TOUCH_EVENTS) 937 Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; } 938#endif 939#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) 940 bool useTouchOverflowScrolling() const { return rareInheritedData->useTouchOverflowScrolling; } 941#endif 942 ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); } 943 944 WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); } 945 bool isHorizontalWritingMode() const { return WebCore::isHorizontalWritingMode(writingMode()); } 946 bool isFlippedLinesWritingMode() const { return WebCore::isFlippedLinesWritingMode(writingMode()); } 947 bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedBlocksWritingMode(writingMode()); } 948 949#if ENABLE(CSS_IMAGE_ORIENTATION) 950 ImageOrientationEnum imageOrientation() const { return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation); } 951#endif 952 953 EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); } 954 955#if ENABLE(CSS_IMAGE_RESOLUTION) 956 ImageResolutionSource imageResolutionSource() const { return static_cast<ImageResolutionSource>(rareInheritedData->m_imageResolutionSource); } 957 ImageResolutionSnap imageResolutionSnap() const { return static_cast<ImageResolutionSnap>(rareInheritedData->m_imageResolutionSnap); } 958 float imageResolution() const { return rareInheritedData->m_imageResolution; } 959#endif 960 961 ESpeak speak() const { return static_cast<ESpeak>(rareInheritedData->speak); } 962 963#if ENABLE(CSS_FILTERS) 964 FilterOperations& mutableFilter() { return rareNonInheritedData.access()->m_filter.access()->m_operations; } 965 const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; } 966 bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); } 967#else 968 bool hasFilter() const { return false; } 969#endif 970 971#if ENABLE(CSS_COMPOSITING) 972 BlendMode blendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode); } 973 void setBlendMode(BlendMode v) { rareNonInheritedData.access()->m_effectiveBlendMode = v; } 974 bool hasBlendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode) != BlendModeNormal; } 975#else 976 bool hasBlendMode() const { return false; } 977#endif 978 979#if USE(RTL_SCROLLBAR) 980 bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); } 981#else 982 bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return false; } 983#endif 984 985// attribute setter methods 986 987 void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; } 988 void setOriginalDisplay(EDisplay v) { noninherited_flags._originalDisplay = v; } 989 void setPosition(EPosition v) { noninherited_flags._position = v; } 990 void setFloating(EFloat v) { noninherited_flags._floating = v; } 991 992 void setLeft(Length v) { SET_VAR(surround, offset.m_left, v); } 993 void setRight(Length v) { SET_VAR(surround, offset.m_right, v); } 994 void setTop(Length v) { SET_VAR(surround, offset.m_top, v); } 995 void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v); } 996 997 void setWidth(Length v) { SET_VAR(m_box, m_width, v); } 998 void setHeight(Length v) { SET_VAR(m_box, m_height, v); } 999 1000 void setLogicalWidth(Length v) 1001 { 1002 if (isHorizontalWritingMode()) { 1003 SET_VAR(m_box, m_width, v); 1004 } else { 1005 SET_VAR(m_box, m_height, v); 1006 } 1007 } 1008 1009 void setLogicalHeight(Length v) 1010 { 1011 if (isHorizontalWritingMode()) { 1012 SET_VAR(m_box, m_height, v); 1013 } else { 1014 SET_VAR(m_box, m_width, v); 1015 } 1016 } 1017 1018 void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, v); } 1019 void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, v); } 1020 void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, v); } 1021 void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, v); } 1022 1023#if ENABLE(DASHBOARD_SUPPORT) 1024 Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; } 1025 void setDashboardRegions(Vector<StyleDashboardRegion> regions) { SET_VAR(rareNonInheritedData, m_dashboardRegions, regions); } 1026 1027 void setDashboardRegion(int type, const String& label, Length t, Length r, Length b, Length l, bool append) 1028 { 1029 StyleDashboardRegion region; 1030 region.label = label; 1031 region.offset.m_top = t; 1032 region.offset.m_right = r; 1033 region.offset.m_bottom = b; 1034 region.offset.m_left = l; 1035 region.type = type; 1036 if (!append) 1037 rareNonInheritedData.access()->m_dashboardRegions.clear(); 1038 rareNonInheritedData.access()->m_dashboardRegions.append(region); 1039 } 1040#endif 1041 1042#if ENABLE(DRAGGABLE_REGION) 1043 DraggableRegionMode getDraggableRegionMode() const { return rareNonInheritedData->m_draggableRegionMode; } 1044 void setDraggableRegionMode(DraggableRegionMode v) { SET_VAR(rareNonInheritedData, m_draggableRegionMode, v); } 1045#endif 1046 1047 void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); } 1048 void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()); } 1049 void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()); } 1050 void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()); } 1051 void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()); } 1052 void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()); } 1053 void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); } 1054 void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()); } 1055 void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()); } 1056 void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()); } 1057 void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()); } 1058 1059 void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v); } 1060 1061 void setBackgroundXPosition(Length length) { SET_VAR(m_background, m_background.m_xPosition, length); } 1062 void setBackgroundYPosition(Length length) { SET_VAR(m_background, m_background.m_yPosition, length); } 1063 void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b); } 1064 void setBackgroundSizeLength(LengthSize s) { SET_VAR(m_background, m_background.m_sizeLength, s); } 1065 1066 void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b); } 1067 void setBorderImageSource(PassRefPtr<StyleImage>); 1068 void setBorderImageSlices(LengthBox); 1069 void setBorderImageWidth(LengthBox); 1070 void setBorderImageOutset(LengthBox); 1071 1072 void setBorderTopLeftRadius(LengthSize s) { SET_VAR(surround, border.m_topLeft, s); } 1073 void setBorderTopRightRadius(LengthSize s) { SET_VAR(surround, border.m_topRight, s); } 1074 void setBorderBottomLeftRadius(LengthSize s) { SET_VAR(surround, border.m_bottomLeft, s); } 1075 void setBorderBottomRightRadius(LengthSize s) { SET_VAR(surround, border.m_bottomRight, s); } 1076 1077 void setBorderRadius(LengthSize s) 1078 { 1079 setBorderTopLeftRadius(s); 1080 setBorderTopRightRadius(s); 1081 setBorderBottomLeftRadius(s); 1082 setBorderBottomRightRadius(s); 1083 } 1084 void setBorderRadius(const IntSize& s) 1085 { 1086 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed))); 1087 } 1088 1089 RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; 1090 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; 1091 1092 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, 1093 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; 1094 1095 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v); } 1096 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v); } 1097 void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, v); } 1098 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_width, v); } 1099 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v); } 1100 void setBorderRightColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, v); } 1101 void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v); } 1102 void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v); } 1103 void setBorderTopColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, v); } 1104 void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_width, v); } 1105 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v); } 1106 void setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v); } 1107 1108 void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v); } 1109 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto); } 1110 void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v); } 1111 void setOutlineColor(const Color& v) { SET_BORDERVALUE_COLOR(m_background, m_outline, v); } 1112 1113 void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; } 1114 void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; } 1115 void setVisibility(EVisibility v) { inherited_flags._visibility = v; } 1116 void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; } 1117 void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, length); } 1118 1119 void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b); } 1120 void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v); } 1121 void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v); } 1122 void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v); } 1123 void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v); } 1124 void setClip(Length top, Length right, Length bottom, Length left); 1125 void setClip(LengthBox box) { SET_VAR(visual, clip, box); } 1126 1127 void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; } 1128 1129 void setClear(EClear v) { noninherited_flags._clear = v; } 1130 void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; } 1131 1132 bool setFontDescription(const FontDescription&); 1133 // Only used for blending font sizes when animating, for MathML anonymous blocks, and for text autosizing. 1134 void setFontSize(float); 1135 1136#if ENABLE(TEXT_AUTOSIZING) 1137 void setTextAutosizingMultiplier(float v) 1138 { 1139 SET_VAR(visual, m_textAutosizingMultiplier, v); 1140 setFontSize(fontDescription().specifiedSize()); 1141 } 1142#endif 1143 1144 void setColor(const Color&); 1145 void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v); } 1146#if ENABLE(CSS3_TEXT) 1147 void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); } 1148 void setTextIndentType(TextIndentType v) { SET_VAR(rareInheritedData, m_textIndentType, v); } 1149#endif 1150 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; } 1151 void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; } 1152 void addToTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations |= v; } 1153 void setTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations = v; } 1154 void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v); } 1155#if ENABLE(CSS3_TEXT) 1156 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); } 1157 void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); } 1158 void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); } 1159 void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); } 1160#endif // CSS3_TEXT 1161 void setDirection(TextDirection v) { inherited_flags._direction = v; } 1162 void setLineHeight(Length specifiedLineHeight); 1163 bool setZoom(float); 1164 void setZoomWithoutReturnValue(float f) { setZoom(f); } 1165 bool setEffectiveZoom(float); 1166 1167#if ENABLE(CSS_IMAGE_ORIENTATION) 1168 void setImageOrientation(ImageOrientationEnum v) { SET_VAR(rareInheritedData, m_imageOrientation, static_cast<int>(v)); } 1169#endif 1170 1171 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v); } 1172 1173#if ENABLE(CSS_IMAGE_RESOLUTION) 1174 void setImageResolutionSource(ImageResolutionSource v) { SET_VAR(rareInheritedData, m_imageResolutionSource, v); } 1175 void setImageResolutionSnap(ImageResolutionSnap v) { SET_VAR(rareInheritedData, m_imageResolutionSnap, v); } 1176 void setImageResolution(float f) { SET_VAR(rareInheritedData, m_imageResolution, f); } 1177#endif 1178 1179 void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; } 1180 1181 void setWordSpacing(int); 1182 void setLetterSpacing(int); 1183 1184 void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); } 1185 void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; } 1186 1187 void adjustBackgroundLayers() 1188 { 1189 if (backgroundLayers()->next()) { 1190 accessBackgroundLayers()->cullEmptyLayers(); 1191 accessBackgroundLayers()->fillUnsetProperties(); 1192 } 1193 } 1194 1195 void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); } 1196 void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; } 1197 1198 void adjustMaskLayers() 1199 { 1200 if (maskLayers()->next()) { 1201 accessMaskLayers()->cullEmptyLayers(); 1202 accessMaskLayers()->fillUnsetProperties(); 1203 } 1204 } 1205 1206 void setMaskImage(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_mask.setImage(v); } 1207 1208 void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); } 1209 void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); } 1210 void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, length); } 1211 void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, length); } 1212 void setMaskSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, s); } 1213 1214 void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; } 1215 void setHorizontalBorderSpacing(short); 1216 void setVerticalBorderSpacing(short); 1217 void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; } 1218 void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; } 1219 1220 void setHasAspectRatio(bool b) { SET_VAR(rareNonInheritedData, m_hasAspectRatio, b); } 1221 void setAspectRatioDenominator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioDenominator, v); } 1222 void setAspectRatioNumerator(float v) { SET_VAR(rareNonInheritedData, m_aspectRatioNumerator, v); } 1223 1224 void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; } 1225 void setListStyleImage(PassRefPtr<StyleImage>); 1226 void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; } 1227 1228 void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)); } 1229 void setMarginTop(Length v) { SET_VAR(surround, margin.m_top, v); } 1230 void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v); } 1231 void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v); } 1232 void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v); } 1233 void setMarginStart(Length); 1234 void setMarginEnd(Length); 1235 1236 void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)); } 1237 void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b); } 1238 void setPaddingTop(Length v) { SET_VAR(surround, padding.m_top, v); } 1239 void setPaddingBottom(Length v) { SET_VAR(surround, padding.m_bottom, v); } 1240 void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v); } 1241 void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v); } 1242 1243 void setCursor(ECursor c) { inherited_flags._cursor_style = c; } 1244 void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint()); 1245 void setCursorList(PassRefPtr<CursorList>); 1246 void clearCursorList(); 1247 1248#if ENABLE(CURSOR_VISIBILITY) 1249 void setCursorVisibility(CursorVisibility c) { inherited_flags.m_cursorVisibility = c; } 1250#endif 1251 1252 void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; } 1253 void setIsLink(bool b) { noninherited_flags.setIsLink(b); } 1254 1255 PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(inherited_flags.m_printColorAdjust); } 1256 void setPrintColorAdjust(PrintColorAdjust value) { inherited_flags.m_printColorAdjust = value; } 1257 1258 bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); } 1259 void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_box, m_zIndex, 0); } 1260 int zIndex() const { return m_box->zIndex(); } 1261 void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v); } 1262 1263 void setHasAutoWidows() { SET_VAR(rareInheritedData, m_hasAutoWidows, true); SET_VAR(rareInheritedData, widows, initialWidows()); } 1264 void setWidows(short w) { SET_VAR(rareInheritedData, m_hasAutoWidows, false); SET_VAR(rareInheritedData, widows, w); } 1265 1266 void setHasAutoOrphans() { SET_VAR(rareInheritedData, m_hasAutoOrphans, true); SET_VAR(rareInheritedData, orphans, initialOrphans()); } 1267 void setOrphans(short o) { SET_VAR(rareInheritedData, m_hasAutoOrphans, false); SET_VAR(rareInheritedData, orphans, o); } 1268 1269 // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props 1270 void setPageBreakInside(EPageBreak b) { ASSERT(b == PBAUTO || b == PBAVOID); noninherited_flags._page_break_inside = b; } 1271 void setPageBreakBefore(EPageBreak b) { noninherited_flags._page_break_before = b; } 1272 void setPageBreakAfter(EPageBreak b) { noninherited_flags._page_break_after = b; } 1273 1274 // CSS3 Setters 1275 void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); } 1276 void setTextShadow(PassOwnPtr<ShadowData>, bool add = false); 1277 void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c); } 1278 void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w); } 1279 void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c); } 1280 void setColorSpace(ColorSpace space) { SET_VAR(rareInheritedData, colorSpace, space); } 1281 void setOpacity(float f) { float v = clampTo<float>(f, 0, 1); SET_VAR(rareNonInheritedData, opacity, v); } 1282 void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); } 1283 // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment 1284 void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, align, a); } 1285#if ENABLE(CSS_BOX_DECORATION_BREAK) 1286 void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_box, m_boxDecorationBreak, b); } 1287#endif 1288 void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; } 1289 void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex, f); } 1290 void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex_group, fg); } 1291 void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, lines, l); } 1292 void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, ordinal_group, og); } 1293 void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, orient, o); } 1294 void setBoxPack(EBoxPack p) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, pack, p); } 1295 void setBoxShadow(PassOwnPtr<ShadowData>, bool add = false); 1296 void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; } 1297 void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); } 1298 void setFlexGrow(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexGrow, f); } 1299 void setFlexShrink(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexShrink, f); } 1300 void setFlexBasis(Length length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, length); } 1301 void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); } 1302 void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); } 1303 void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); } 1304 void setAlignSelf(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); } 1305 void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); } 1306 void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); } 1307 void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); } 1308 void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); } 1309 void setGridAutoRows(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoRows, length); } 1310 void setGridColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); } 1311 void setGridRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, lengths); } 1312 void setGridAutoFlow(GridAutoFlow flow) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoFlow, flow); } 1313 void setGridItemStart(const GridPosition& startPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridStart, startPosition); } 1314 void setGridItemEnd(const GridPosition& endPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridEnd, endPosition); } 1315 void setGridItemBefore(const GridPosition& beforePosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridBefore, beforePosition); } 1316 void setGridItemAfter(const GridPosition& afterPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridAfter, afterPosition); } 1317 1318 void setMarqueeIncrement(Length f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); } 1319 void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); } 1320 void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); } 1321 void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->m_marquee, behavior, b); } 1322 void setMarqueeLoopCount(int i) { SET_VAR(rareNonInheritedData.access()->m_marquee, loops, i); } 1323 void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); } 1324 void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); } 1325 void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); } 1326 void setTextOverflow(TextOverflow overflow) { SET_VAR(rareNonInheritedData, textOverflow, overflow); } 1327 void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); } 1328 void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); } 1329 void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); } 1330 void setOverflowWrap(EOverflowWrap b) { SET_VAR(rareInheritedData, overflowWrap, b); } 1331 void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); } 1332 void setLineBreak(LineBreak b) { SET_VAR(rareInheritedData, lineBreak, b); } 1333 void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); } 1334 void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); } 1335 void setHyphenationLimitBefore(short limit) { SET_VAR(rareInheritedData, hyphenationLimitBefore, limit); } 1336 void setHyphenationLimitAfter(short limit) { SET_VAR(rareInheritedData, hyphenationLimitAfter, limit); } 1337 void setHyphenationLimitLines(short limit) { SET_VAR(rareInheritedData, hyphenationLimitLines, limit); } 1338 void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); } 1339 void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); } 1340 void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); } 1341 void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); } 1342 void setColumnAxis(ColumnAxis axis) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_axis, axis); } 1343 void setColumnProgression(ColumnProgression progression) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_progression, progression); } 1344 void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); } 1345 void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); } 1346 void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); } 1347 void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); } 1348 void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); } 1349 void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); } 1350 void setColumnRuleColor(const Color& c) { SET_BORDERVALUE_COLOR(rareNonInheritedData.access()->m_multiCol, m_rule, c); } 1351 void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); } 1352 void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); } 1353 void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()); } 1354 void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, columnSpan); } 1355 void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); } 1356 // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside 1357 void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); } 1358 void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); } 1359 void setRegionBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakBefore, p); } 1360 void setRegionBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData, m_regionBreakInside, p); } 1361 void setRegionBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakAfter, p); } 1362 void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; } 1363 void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); } 1364 void setTransformOriginX(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); } 1365 void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); } 1366 void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); } 1367 void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); } 1368 void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); } 1369#if ENABLE(CSS3_TEXT) 1370 void setTextDecorationColor(const Color& c) { SET_VAR(rareNonInheritedData, m_textDecorationColor, c); } 1371#endif // CSS3_TEXT 1372 void setTextEmphasisColor(const Color& c) { SET_VAR(rareInheritedData, textEmphasisColor, c); } 1373 void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); } 1374 void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); } 1375 void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); } 1376 void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); } 1377 bool setTextOrientation(TextOrientation); 1378 1379 void setRubyPosition(RubyPosition position) { SET_VAR(rareInheritedData, m_rubyPosition, position); } 1380 1381#if ENABLE(CSS_FILTERS) 1382 void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); } 1383#endif 1384 1385 void setTabSize(unsigned size) { SET_VAR(rareInheritedData, m_tabSize, size); } 1386 1387 // End CSS3 Setters 1388 1389 void setLineGrid(const AtomicString& lineGrid) { SET_VAR(rareInheritedData, m_lineGrid, lineGrid); } 1390 void setLineSnap(LineSnap lineSnap) { SET_VAR(rareInheritedData, m_lineSnap, lineSnap); } 1391 void setLineAlign(LineAlign lineAlign) { SET_VAR(rareInheritedData, m_lineAlign, lineAlign); } 1392 1393 void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); } 1394 void setRegionThread(const AtomicString& regionThread) { SET_VAR(rareNonInheritedData, m_regionThread, regionThread); } 1395 void setRegionFragment(RegionFragment regionFragment) { SET_VAR(rareNonInheritedData, m_regionFragment, regionFragment); } 1396 1397 void setWrapFlow(WrapFlow wrapFlow) { SET_VAR(rareNonInheritedData, m_wrapFlow, wrapFlow); } 1398 void setWrapThrough(WrapThrough wrapThrough) { SET_VAR(rareNonInheritedData, m_wrapThrough, wrapThrough); } 1399 1400 // Apple-specific property setters 1401 void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; } 1402 1403 void clearAnimations() 1404 { 1405 rareNonInheritedData.access()->m_animations.clear(); 1406 } 1407 1408 void clearTransitions() 1409 { 1410 rareNonInheritedData.access()->m_transitions.clear(); 1411 } 1412 1413 void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; } 1414 void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; } 1415 void adjustAnimations(); 1416 void adjustTransitions(); 1417 1418 void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); } 1419 void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); } 1420 void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); } 1421 void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); } 1422 void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); } 1423 void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); } 1424 void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); } 1425 void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); } 1426 1427#if USE(ACCELERATED_COMPOSITING) 1428 void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); } 1429#endif 1430 1431 void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); } 1432 void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); } 1433#if ENABLE(TOUCH_EVENTS) 1434 void setTapHighlightColor(const Color& c) { SET_VAR(rareInheritedData, tapHighlightColor, c); } 1435#endif 1436#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) 1437 void setUseTouchOverflowScrolling(bool v) { SET_VAR(rareInheritedData, useTouchOverflowScrolling, v); } 1438#endif 1439 void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); } 1440 1441#if ENABLE(SVG) 1442 const SVGRenderStyle* svgStyle() const { return m_svgStyle.get(); } 1443 SVGRenderStyle* accessSVGStyle() { return m_svgStyle.access(); } 1444 1445 const SVGPaint::SVGPaintType& fillPaintType() const { return svgStyle()->fillPaintType(); } 1446 Color fillPaintColor() const { return svgStyle()->fillPaintColor(); } 1447 void setFillPaintColor(const Color& c) { accessSVGStyle()->setFillPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); } 1448 float fillOpacity() const { return svgStyle()->fillOpacity(); } 1449 void setFillOpacity(float f) { accessSVGStyle()->setFillOpacity(f); } 1450 1451 const SVGPaint::SVGPaintType& strokePaintType() const { return svgStyle()->strokePaintType(); } 1452 Color strokePaintColor() const { return svgStyle()->strokePaintColor(); } 1453 void setStrokePaintColor(const Color& c) { accessSVGStyle()->setStrokePaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); } 1454 float strokeOpacity() const { return svgStyle()->strokeOpacity(); } 1455 void setStrokeOpacity(float f) { accessSVGStyle()->setStrokeOpacity(f); } 1456 SVGLength strokeWidth() const { return svgStyle()->strokeWidth(); } 1457 void setStrokeWidth(SVGLength w) { accessSVGStyle()->setStrokeWidth(w); } 1458 SVGLength strokeDashOffset() const { return svgStyle()->strokeDashOffset(); } 1459 void setStrokeDashOffset(SVGLength d) { accessSVGStyle()->setStrokeDashOffset(d); } 1460 float strokeMiterLimit() const { return svgStyle()->strokeMiterLimit(); } 1461 void setStrokeMiterLimit(float f) { accessSVGStyle()->setStrokeMiterLimit(f); } 1462 1463 float floodOpacity() const { return svgStyle()->floodOpacity(); } 1464 void setFloodOpacity(float f) { accessSVGStyle()->setFloodOpacity(f); } 1465 1466 float stopOpacity() const { return svgStyle()->stopOpacity(); } 1467 void setStopOpacity(float f) { accessSVGStyle()->setStopOpacity(f); } 1468 1469 void setStopColor(const Color& c) { accessSVGStyle()->setStopColor(c); } 1470 void setFloodColor(const Color& c) { accessSVGStyle()->setFloodColor(c); } 1471 void setLightingColor(const Color& c) { accessSVGStyle()->setLightingColor(c); } 1472 1473 SVGLength baselineShiftValue() const { return svgStyle()->baselineShiftValue(); } 1474 void setBaselineShiftValue(SVGLength s) { accessSVGStyle()->setBaselineShiftValue(s); } 1475 SVGLength kerning() const { return svgStyle()->kerning(); } 1476 void setKerning(SVGLength k) { accessSVGStyle()->setKerning(k); } 1477#endif 1478 1479 void setShapeInside(PassRefPtr<ShapeValue> value) 1480 { 1481 if (rareNonInheritedData->m_shapeInside == value) 1482 return; 1483 rareNonInheritedData.access()->m_shapeInside = value; 1484 } 1485 ShapeValue* shapeInside() const { return rareNonInheritedData->m_shapeInside.get(); } 1486 ShapeValue* resolvedShapeInside() const 1487 { 1488 ShapeValue* shapeInside = this->shapeInside(); 1489 if (shapeInside && shapeInside->type() == ShapeValue::Outside) 1490 return shapeOutside(); 1491 return shapeInside; 1492 } 1493 1494 void setShapeOutside(PassRefPtr<ShapeValue> value) 1495 { 1496 if (rareNonInheritedData->m_shapeOutside == value) 1497 return; 1498 rareNonInheritedData.access()->m_shapeOutside = value; 1499 } 1500 ShapeValue* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); } 1501 1502 static ShapeValue* initialShapeInside(); 1503 static ShapeValue* initialShapeOutside() { return 0; } 1504 1505 void setClipPath(PassRefPtr<ClipPathOperation> operation) 1506 { 1507 if (rareNonInheritedData->m_clipPath != operation) 1508 rareNonInheritedData.access()->m_clipPath = operation; 1509 } 1510 ClipPathOperation* clipPath() const { return rareNonInheritedData->m_clipPath.get(); } 1511 1512 static ClipPathOperation* initialClipPath() { return 0; } 1513 1514 Length shapePadding() const { return rareNonInheritedData->m_shapePadding; } 1515 void setShapePadding(Length shapePadding) { SET_VAR(rareNonInheritedData, m_shapePadding, shapePadding); } 1516 static Length initialShapePadding() { return Length(0, Fixed); } 1517 1518 Length shapeMargin() const { return rareNonInheritedData->m_shapeMargin; } 1519 void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, shapeMargin); } 1520 static Length initialShapeMargin() { return Length(0, Fixed); } 1521 1522 bool hasContent() const { return contentData(); } 1523 const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); } 1524 bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); } 1525 void clearContent(); 1526 void setContent(const String&, bool add = false); 1527 void setContent(PassRefPtr<StyleImage>, bool add = false); 1528 void setContent(PassOwnPtr<CounterContent>, bool add = false); 1529 void setContent(QuoteType, bool add = false); 1530 1531 const CounterDirectiveMap* counterDirectives() const; 1532 CounterDirectiveMap& accessCounterDirectives(); 1533 const CounterDirectives getCounterDirectives(const AtomicString& identifier) const; 1534 1535 QuotesData* quotes() const { return rareInheritedData->quotes.get(); } 1536 void setQuotes(PassRefPtr<QuotesData>); 1537 1538 const AtomicString& hyphenString() const; 1539 1540 bool inheritedNotEqual(const RenderStyle*) const; 1541 bool inheritedDataShared(const RenderStyle*) const; 1542 1543 StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const; 1544 bool diffRequiresRepaint(const RenderStyle*) const; 1545 1546 bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); } 1547 bool isDisplayInlineType() const { return isDisplayInlineType(display()); } 1548 bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); } 1549 bool isDisplayRegionType() const 1550 { 1551 return display() == BLOCK || display() == INLINE_BLOCK 1552 || display() == TABLE_CELL || display() == TABLE_CAPTION 1553 || display() == LIST_ITEM; 1554 } 1555 1556 bool setWritingMode(WritingMode v) 1557 { 1558 if (v == writingMode()) 1559 return false; 1560 1561 inherited_flags.m_writingMode = v; 1562 return true; 1563 } 1564 1565 // A unique style is one that has matches something that makes it impossible to share. 1566 bool unique() const { return noninherited_flags.unique; } 1567 void setUnique() { noninherited_flags.unique = true; } 1568 1569 bool emptyState() const { return noninherited_flags.emptyState; } 1570 void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; } 1571 bool firstChildState() const { return noninherited_flags.firstChildState; } 1572 void setFirstChildState() { setUnique(); noninherited_flags.firstChildState = true; } 1573 bool lastChildState() const { return noninherited_flags.lastChildState; } 1574 void setLastChildState() { setUnique(); noninherited_flags.lastChildState = true; } 1575 1576 Color visitedDependentColor(int colorProperty) const; 1577 1578 void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInheritance = true; } 1579 bool hasExplicitlyInheritedProperties() const { return noninherited_flags.explicitInheritance; } 1580 1581 // Initial values for all the properties 1582 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; } 1583 static EBorderStyle initialBorderStyle() { return BNONE; } 1584 static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; } 1585 static NinePieceImage initialNinePieceImage() { return NinePieceImage(); } 1586 static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); } 1587 static ECaptionSide initialCaptionSide() { return CAPTOP; } 1588 static EClear initialClear() { return CNONE; } 1589 static ColorSpace initialColorSpace() { return ColorSpaceDeviceRGB; } 1590 static ColumnAxis initialColumnAxis() { return AutoColumnAxis; } 1591 static ColumnProgression initialColumnProgression() { return NormalColumnProgression; } 1592 static TextDirection initialDirection() { return LTR; } 1593 static WritingMode initialWritingMode() { return TopToBottomWritingMode; } 1594 static TextCombine initialTextCombine() { return TextCombineNone; } 1595 static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; } 1596 static EDisplay initialDisplay() { return INLINE; } 1597 static EEmptyCell initialEmptyCells() { return SHOW; } 1598 static EFloat initialFloating() { return NoFloat; } 1599 static EListStylePosition initialListStylePosition() { return OUTSIDE; } 1600 static EListStyleType initialListStyleType() { return Disc; } 1601 static EOverflow initialOverflowX() { return OVISIBLE; } 1602 static EOverflow initialOverflowY() { return OVISIBLE; } 1603 static EPageBreak initialPageBreak() { return PBAUTO; } 1604 static EPosition initialPosition() { return StaticPosition; } 1605 static ETableLayout initialTableLayout() { return TAUTO; } 1606 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; } 1607 static ETextTransform initialTextTransform() { return TTNONE; } 1608 static EVisibility initialVisibility() { return VISIBLE; } 1609 static EWhiteSpace initialWhiteSpace() { return NORMAL; } 1610 static short initialHorizontalBorderSpacing() { return 0; } 1611 static short initialVerticalBorderSpacing() { return 0; } 1612 static ECursor initialCursor() { return CURSOR_AUTO; } 1613#if ENABLE(CURSOR_VISIBILITY) 1614 static CursorVisibility initialCursorVisibility() { return CursorVisibilityAuto; } 1615#endif 1616 static Color initialColor() { return Color::black; } 1617 static StyleImage* initialListStyleImage() { return 0; } 1618 static unsigned initialBorderWidth() { return 3; } 1619 static unsigned short initialColumnRuleWidth() { return 3; } 1620 static unsigned short initialOutlineWidth() { return 3; } 1621 static int initialLetterWordSpacing() { return 0; } 1622 static Length initialSize() { return Length(); } 1623 static Length initialMinSize() { return Length(Fixed); } 1624 static Length initialMaxSize() { return Length(Undefined); } 1625 static Length initialOffset() { return Length(); } 1626 static Length initialMargin() { return Length(Fixed); } 1627 static Length initialPadding() { return Length(Fixed); } 1628 static Length initialTextIndent() { return Length(Fixed); } 1629#if ENABLE(CSS3_TEXT) 1630 static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; } 1631 static TextIndentType initialTextIndentType() { return TextIndentNormal; } 1632#endif 1633 static EVerticalAlign initialVerticalAlign() { return BASELINE; } 1634 static short initialWidows() { return 2; } 1635 static short initialOrphans() { return 2; } 1636 static Length initialLineHeight() { return Length(-100.0, Percent); } 1637 static ETextAlign initialTextAlign() { return TASTART; } 1638 static TextDecoration initialTextDecoration() { return TextDecorationNone; } 1639#if ENABLE(CSS3_TEXT) 1640 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; } 1641 static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; } 1642 static TextJustify initialTextJustify() { return TextJustifyAuto; } 1643 static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; } 1644#endif // CSS3_TEXT 1645 static float initialZoom() { return 1.0f; } 1646 static int initialOutlineOffset() { return 0; } 1647 static float initialOpacity() { return 1.0f; } 1648 static EBoxAlignment initialBoxAlign() { return BSTRETCH; } 1649 static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; } 1650 static EBoxDirection initialBoxDirection() { return BNORMAL; } 1651 static EBoxLines initialBoxLines() { return SINGLE; } 1652 static EBoxOrient initialBoxOrient() { return HORIZONTAL; } 1653 static EBoxPack initialBoxPack() { return Start; } 1654 static float initialBoxFlex() { return 0.0f; } 1655 static unsigned int initialBoxFlexGroup() { return 1; } 1656 static unsigned int initialBoxOrdinalGroup() { return 1; } 1657 static EBoxSizing initialBoxSizing() { return CONTENT_BOX; } 1658 static StyleReflection* initialBoxReflect() { return 0; } 1659 static float initialFlexGrow() { return 0; } 1660 static float initialFlexShrink() { return 1; } 1661 static Length initialFlexBasis() { return Length(Auto); } 1662 static int initialOrder() { return 0; } 1663 static EAlignContent initialAlignContent() { return AlignContentStretch; } 1664 static EAlignItems initialAlignItems() { return AlignStretch; } 1665 static EAlignItems initialAlignSelf() { return AlignAuto; } 1666 static EFlexDirection initialFlexDirection() { return FlowRow; } 1667 static EFlexWrap initialFlexWrap() { return FlexNoWrap; } 1668 static EJustifyContent initialJustifyContent() { return JustifyFlexStart; } 1669 static int initialMarqueeLoopCount() { return -1; } 1670 static int initialMarqueeSpeed() { return 85; } 1671 static Length initialMarqueeIncrement() { return Length(6, Fixed); } 1672 static EMarqueeBehavior initialMarqueeBehavior() { return MSCROLL; } 1673 static EMarqueeDirection initialMarqueeDirection() { return MAUTO; } 1674 static EUserModify initialUserModify() { return READ_ONLY; } 1675 static EUserDrag initialUserDrag() { return DRAG_AUTO; } 1676 static EUserSelect initialUserSelect() { return SELECT_TEXT; } 1677 static TextOverflow initialTextOverflow() { return TextOverflowClip; } 1678 static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; } 1679 static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; } 1680 static EWordBreak initialWordBreak() { return NormalWordBreak; } 1681 static EOverflowWrap initialOverflowWrap() { return NormalOverflowWrap; } 1682 static ENBSPMode initialNBSPMode() { return NBNORMAL; } 1683 static LineBreak initialLineBreak() { return LineBreakAuto; } 1684 static const AtomicString& initialHighlight() { return nullAtom; } 1685 static ESpeak initialSpeak() { return SpeakNormal; } 1686 static Hyphens initialHyphens() { return HyphensManual; } 1687 static short initialHyphenationLimitBefore() { return -1; } 1688 static short initialHyphenationLimitAfter() { return -1; } 1689 static short initialHyphenationLimitLines() { return -1; } 1690 static const AtomicString& initialHyphenationString() { return nullAtom; } 1691 static const AtomicString& initialLocale() { return nullAtom; } 1692 static EBorderFit initialBorderFit() { return BorderFitBorder; } 1693 static EResize initialResize() { return RESIZE_NONE; } 1694 static ControlPart initialAppearance() { return NoControlPart; } 1695 static bool initialHasAspectRatio() { return false; } 1696 static float initialAspectRatioDenominator() { return 1; } 1697 static float initialAspectRatioNumerator() { return 1; } 1698 static Order initialRTLOrdering() { return LogicalOrder; } 1699 static float initialTextStrokeWidth() { return 0; } 1700 static unsigned short initialColumnCount() { return 1; } 1701 static ColumnSpan initialColumnSpan() { return ColumnSpanNone; } 1702 static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; } 1703 static Length initialTransformOriginX() { return Length(50.0, Percent); } 1704 static Length initialTransformOriginY() { return Length(50.0, Percent); } 1705 static EPointerEvents initialPointerEvents() { return PE_AUTO; } 1706 static float initialTransformOriginZ() { return 0; } 1707 static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; } 1708 static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; } 1709 static float initialPerspective() { return 0; } 1710 static Length initialPerspectiveOriginX() { return Length(50.0, Percent); } 1711 static Length initialPerspectiveOriginY() { return Length(50.0, Percent); } 1712 static Color initialBackgroundColor() { return Color::transparent; } 1713 static Color initialTextEmphasisColor() { return TextEmphasisFillFilled; } 1714 static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; } 1715 static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; } 1716 static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; } 1717 static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; } 1718 static RubyPosition initialRubyPosition() { return RubyPositionBefore; } 1719 static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; } 1720 static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; } 1721 static EImageRendering initialImageRendering() { return ImageRenderingAuto; } 1722 static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; } 1723 static ImageResolutionSnap initialImageResolutionSnap() { return ImageResolutionNoSnap; } 1724 static float initialImageResolution() { return 1; } 1725 static StyleImage* initialBorderImageSource() { return 0; } 1726 static StyleImage* initialMaskBoxImageSource() { return 0; } 1727 static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; } 1728 1729 // The initial value is 'none' for grid tracks. 1730 static Vector<GridTrackSize> initialGridColumns() { return Vector<GridTrackSize>(); } 1731 static Vector<GridTrackSize> initialGridRows() { return Vector<GridTrackSize>(); } 1732 1733 static GridAutoFlow initialGridAutoFlow() { return AutoFlowNone; } 1734 1735 static GridTrackSize initialGridAutoColumns() { return GridTrackSize(Auto); } 1736 static GridTrackSize initialGridAutoRows() { return GridTrackSize(Auto); } 1737 1738 // 'auto' is the default. 1739 static GridPosition initialGridPosition() { return GridPosition(); } 1740 1741 static unsigned initialTabSize() { return 8; } 1742 1743 static const AtomicString& initialLineGrid() { return nullAtom; } 1744 static LineSnap initialLineSnap() { return LineSnapNone; } 1745 static LineAlign initialLineAlign() { return LineAlignNone; } 1746 1747 static const AtomicString& initialFlowThread() { return nullAtom; } 1748 static const AtomicString& initialRegionThread() { return nullAtom; } 1749 static RegionFragment initialRegionFragment() { return AutoRegionFragment; } 1750 1751 static WrapFlow initialWrapFlow() { return WrapFlowAuto; } 1752 static WrapThrough initialWrapThrough() { return WrapThroughWrap; } 1753 1754 // Keep these at the end. 1755 static LineClampValue initialLineClamp() { return LineClampValue(); } 1756 static ETextSecurity initialTextSecurity() { return TSNONE; } 1757#if ENABLE(TOUCH_EVENTS) 1758 static Color initialTapHighlightColor(); 1759#endif 1760#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) 1761 static bool initialUseTouchOverflowScrolling() { return false; } 1762#endif 1763#if ENABLE(DASHBOARD_SUPPORT) 1764 static const Vector<StyleDashboardRegion>& initialDashboardRegions(); 1765 static const Vector<StyleDashboardRegion>& noneDashboardRegions(); 1766#endif 1767#if ENABLE(CSS_FILTERS) 1768 static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; } 1769#endif 1770#if ENABLE(CSS_COMPOSITING) 1771 static BlendMode initialBlendMode() { return BlendModeNormal; } 1772#endif 1773 1774private: 1775 bool changeRequiresLayout(const RenderStyle*, unsigned& changedContextSensitiveProperties) const; 1776 bool changeRequiresPositionedLayoutOnly(const RenderStyle*, unsigned& changedContextSensitiveProperties) const; 1777 bool changeRequiresLayerRepaint(const RenderStyle*, unsigned& changedContextSensitiveProperties) const; 1778 bool changeRequiresRepaint(const RenderStyle*, unsigned& changedContextSensitiveProperties) const; 1779 bool changeRequiresRepaintIfText(const RenderStyle*, unsigned& changedContextSensitiveProperties) const; 1780 bool changeRequiresRecompositeLayer(const RenderStyle*, unsigned& changedContextSensitiveProperties) const; 1781 1782 void setVisitedLinkColor(const Color&); 1783 void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v); } 1784 void setVisitedLinkBorderLeftColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v); } 1785 void setVisitedLinkBorderRightColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v); } 1786 void setVisitedLinkBorderBottomColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v); } 1787 void setVisitedLinkBorderTopColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v); } 1788 void setVisitedLinkOutlineColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v); } 1789 void setVisitedLinkColumnRuleColor(const Color& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v); } 1790#if ENABLE(CSS3_TEXT) 1791 void setVisitedLinkTextDecorationColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkTextDecorationColor, v); } 1792#endif // CSS3_TEXT 1793 void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextEmphasisColor, v); } 1794 void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextFillColor, v); } 1795 void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextStrokeColor, v); } 1796 1797 void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; } 1798 void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const; 1799 LayoutBoxExtent getShadowInsetExtent(const ShadowData*) const; 1800 void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const; 1801 void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom) const; 1802 void getShadowInlineDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const 1803 { 1804 return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight); 1805 } 1806 void getShadowBlockDirectionExtent(const ShadowData* shadow, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const 1807 { 1808 return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom); 1809 } 1810 1811 bool isDisplayReplacedType(EDisplay display) const 1812 { 1813 return display == INLINE_BLOCK || display == INLINE_BOX || display == INLINE_FLEX 1814 || display == INLINE_TABLE || display == INLINE_GRID; 1815 } 1816 1817 bool isDisplayInlineType(EDisplay display) const 1818 { 1819 return display == INLINE || isDisplayReplacedType(display); 1820 } 1821 1822 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them. 1823 Color invalidColor() const { static Color invalid; return invalid; } 1824 Color borderLeftColor() const { return surround->border.left().color(); } 1825 Color borderRightColor() const { return surround->border.right().color(); } 1826 Color borderTopColor() const { return surround->border.top().color(); } 1827 Color borderBottomColor() const { return surround->border.bottom().color(); } 1828 Color backgroundColor() const { return m_background->color(); } 1829 Color color() const; 1830 Color columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); } 1831 Color outlineColor() const { return m_background->outline().color(); } 1832 Color textEmphasisColor() const { return rareInheritedData->textEmphasisColor; } 1833 Color textFillColor() const { return rareInheritedData->textFillColor; } 1834 Color textStrokeColor() const { return rareInheritedData->textStrokeColor; } 1835 Color visitedLinkColor() const; 1836 Color visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; } 1837 Color visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; } 1838 Color visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; } 1839 Color visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; } 1840 Color visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; } 1841 Color visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; } 1842 Color visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; } 1843#if ENABLE(CSS3_TEXT) 1844 Color textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; } 1845 Color visitedLinkTextDecorationColor() const { return rareNonInheritedData->m_visitedLinkTextDecorationColor; } 1846#endif // CSS3_TEXT 1847 Color visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor; } 1848 Color visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor; } 1849 Color visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor; } 1850 1851 Color colorIncludingFallback(int colorProperty, bool visitedLink) const; 1852 1853#if ENABLE(SVG) 1854 Color stopColor() const { return svgStyle()->stopColor(); } 1855 Color floodColor() const { return svgStyle()->floodColor(); } 1856 Color lightingColor() const { return svgStyle()->lightingColor(); } 1857#endif 1858 1859 void appendContent(PassOwnPtr<ContentData>); 1860}; 1861 1862inline int adjustForAbsoluteZoom(int value, const RenderStyle* style) 1863{ 1864 double zoomFactor = style->effectiveZoom(); 1865 if (zoomFactor == 1) 1866 return value; 1867 // Needed because computeLengthInt truncates (rather than rounds) when scaling up. 1868 if (zoomFactor > 1) { 1869 if (value < 0) 1870 value--; 1871 else 1872 value++; 1873 } 1874 1875 return roundForImpreciseConversion<int>(value / zoomFactor); 1876} 1877 1878inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style) 1879{ 1880 return value / style->effectiveZoom(); 1881} 1882 1883#if ENABLE(SUBPIXEL_LAYOUT) 1884inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const RenderStyle* style) 1885{ 1886 return value / style->effectiveZoom(); 1887} 1888#endif 1889 1890inline bool RenderStyle::setZoom(float f) 1891{ 1892 if (compareEqual(visual->m_zoom, f)) 1893 return false; 1894 visual.access()->m_zoom = f; 1895 setEffectiveZoom(effectiveZoom() * zoom()); 1896 return true; 1897} 1898 1899inline bool RenderStyle::setEffectiveZoom(float f) 1900{ 1901 if (compareEqual(rareInheritedData->m_effectiveZoom, f)) 1902 return false; 1903 rareInheritedData.access()->m_effectiveZoom = f; 1904 return true; 1905} 1906 1907inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation) 1908{ 1909 if (compareEqual(rareInheritedData->m_textOrientation, textOrientation)) 1910 return false; 1911 1912 rareInheritedData.access()->m_textOrientation = textOrientation; 1913 return true; 1914} 1915 1916} // namespace WebCore 1917 1918#endif // RenderStyle_h 1919