OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 friend class StyleBuilderConverter; | 174 friend class StyleBuilderConverter; |
175 friend class StyleResolverState; | 175 friend class StyleResolverState; |
176 friend class StyleResolver; | 176 friend class StyleResolver; |
177 | 177 |
178 protected: | 178 protected: |
179 // non-inherited attributes | 179 // non-inherited attributes |
180 DataRef<StyleBoxData> m_box; | 180 DataRef<StyleBoxData> m_box; |
181 DataRef<StyleVisualData> m_visual; | 181 DataRef<StyleVisualData> m_visual; |
182 DataRef<StyleBackgroundData> m_background; | 182 DataRef<StyleBackgroundData> m_background; |
183 DataRef<StyleSurroundData> m_surround; | 183 DataRef<StyleSurroundData> m_surround; |
| 184 DataRef<StyleTransformData> |
| 185 m_transform; // Transform properties (rotate, scale, skew, etc.) |
184 DataRef<StyleRareNonInheritedData> m_rareNonInheritedData; | 186 DataRef<StyleRareNonInheritedData> m_rareNonInheritedData; |
185 | 187 |
186 // inherited attributes | 188 // inherited attributes |
187 DataRef<StyleRareInheritedData> m_rareInheritedData; | 189 DataRef<StyleRareInheritedData> m_rareInheritedData; |
188 DataRef<StyleInheritedData> m_styleInheritedData; | 190 DataRef<StyleInheritedData> m_styleInheritedData; |
189 | 191 |
190 // list of associated pseudo styles | 192 // list of associated pseudo styles |
191 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; | 193 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; |
192 | 194 |
193 DataRef<SVGComputedStyle> m_svgStyle; | 195 DataRef<SVGComputedStyle> m_svgStyle; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 unsigned m_emptyState : 1; | 321 unsigned m_emptyState : 1; |
320 | 322 |
321 unsigned m_affectedByFocus : 1; | 323 unsigned m_affectedByFocus : 1; |
322 unsigned m_affectedByHover : 1; | 324 unsigned m_affectedByHover : 1; |
323 unsigned m_affectedByActive : 1; | 325 unsigned m_affectedByActive : 1; |
324 unsigned m_affectedByDrag : 1; | 326 unsigned m_affectedByDrag : 1; |
325 | 327 |
326 // 64 bits | 328 // 64 bits |
327 | 329 |
328 unsigned m_isLink : 1; | 330 unsigned m_isLink : 1; |
| 331 unsigned m_isStackingContext : 1; |
329 | 332 |
330 mutable unsigned m_hasRemUnits : 1; | 333 mutable unsigned m_hasRemUnits : 1; |
331 | 334 |
332 // For each independent inherited property, store a 1 if the stored | 335 // For each independent inherited property, store a 1 if the stored |
333 // value was inherited from its parent, or 0 if it is explicitly set on | 336 // value was inherited from its parent, or 0 if it is explicitly set on |
334 // this element. | 337 // this element. |
335 // Eventually, all properties will have a bit in here to store whether | 338 // Eventually, all properties will have a bit in here to store whether |
336 // they were inherited from their parent or not. | 339 // they were inherited from their parent or not. |
337 // Although two ComputedStyles are equal if their nonInheritedData is | 340 // Although two ComputedStyles are equal if their nonInheritedData is |
338 // equal regardless of the isInherited flags, this struct is stored next | 341 // equal regardless of the isInherited flags, this struct is stored next |
339 // to the existing flags to take advantage of packing as much as possible. | 342 // to the existing flags to take advantage of packing as much as possible. |
340 // TODO(sashab): Move these flags closer to inheritedData so that it's | 343 // TODO(sashab): Move these flags closer to inheritedData so that it's |
341 // clear which inherited properties have a flag stored and which don't. | 344 // clear which inherited properties have a flag stored and which don't. |
342 // Keep this list of fields in sync with: | 345 // Keep this list of fields in sync with: |
343 // - setBitDefaults() | 346 // - setBitDefaults() |
344 // - The ComputedStyle setter, which must take an extra boolean parameter | 347 // - The ComputedStyle setter, which must take an extra boolean parameter |
345 // and set this - propagateIndependentInheritedProperties() in | 348 // and set this - propagateIndependentInheritedProperties() in |
346 // ComputedStyle.cpp | 349 // ComputedStyle.cpp |
347 // - The compareEqual() methods in the corresponding class | 350 // - The compareEqual() methods in the corresponding class |
348 // InheritedFlags | 351 // InheritedFlags |
349 unsigned m_isPointerEventsInherited : 1; | 352 unsigned m_isPointerEventsInherited : 1; |
350 unsigned m_isVisibilityInherited : 1; | 353 unsigned m_isVisibilityInherited : 1; |
351 unsigned m_isWhiteSpaceInherited : 1; | 354 unsigned m_isWhiteSpaceInherited : 1; |
352 | 355 |
353 // If you add more style bits here, you will also need to update | 356 // If you add more style bits here, you will also need to update |
354 // ComputedStyle::copyNonInheritedFromCached() 68 bits | 357 // ComputedStyle::copyNonInheritedFromCached() |
| 358 |
| 359 // 69 bits |
355 } m_nonInheritedData; | 360 } m_nonInheritedData; |
356 | 361 |
357 // !END SYNC! | 362 // !END SYNC! |
358 | 363 |
359 void setBitDefaults() { | 364 void setBitDefaults() { |
360 ComputedStyleBase::setBitDefaults(); | 365 ComputedStyleBase::setBitDefaults(); |
361 m_inheritedData.m_listStyleType = | 366 m_inheritedData.m_listStyleType = |
362 static_cast<unsigned>(initialListStyleType()); | 367 static_cast<unsigned>(initialListStyleType()); |
363 m_inheritedData.m_textAlign = static_cast<unsigned>(initialTextAlign()); | 368 m_inheritedData.m_textAlign = static_cast<unsigned>(initialTextAlign()); |
364 m_inheritedData.m_hasSimpleUnderline = false; | 369 m_inheritedData.m_hasSimpleUnderline = false; |
(...skipping 30 matching lines...) Expand all Loading... |
395 m_nonInheritedData.m_explicitInheritance = false; | 400 m_nonInheritedData.m_explicitInheritance = false; |
396 m_nonInheritedData.m_variableReference = false; | 401 m_nonInheritedData.m_variableReference = false; |
397 m_nonInheritedData.m_unique = false; | 402 m_nonInheritedData.m_unique = false; |
398 m_nonInheritedData.m_emptyState = false; | 403 m_nonInheritedData.m_emptyState = false; |
399 m_nonInheritedData.m_hasViewportUnits = false; | 404 m_nonInheritedData.m_hasViewportUnits = false; |
400 m_nonInheritedData.m_affectedByFocus = false; | 405 m_nonInheritedData.m_affectedByFocus = false; |
401 m_nonInheritedData.m_affectedByHover = false; | 406 m_nonInheritedData.m_affectedByHover = false; |
402 m_nonInheritedData.m_affectedByActive = false; | 407 m_nonInheritedData.m_affectedByActive = false; |
403 m_nonInheritedData.m_affectedByDrag = false; | 408 m_nonInheritedData.m_affectedByDrag = false; |
404 m_nonInheritedData.m_isLink = false; | 409 m_nonInheritedData.m_isLink = false; |
| 410 m_nonInheritedData.m_isStackingContext = false; |
405 m_nonInheritedData.m_hasRemUnits = false; | 411 m_nonInheritedData.m_hasRemUnits = false; |
406 | 412 |
407 // All independently inherited properties default to being inherited. | 413 // All independently inherited properties default to being inherited. |
408 m_nonInheritedData.m_isPointerEventsInherited = true; | 414 m_nonInheritedData.m_isPointerEventsInherited = true; |
409 m_nonInheritedData.m_isVisibilityInherited = true; | 415 m_nonInheritedData.m_isVisibilityInherited = true; |
410 m_nonInheritedData.m_isWhiteSpaceInherited = true; | 416 m_nonInheritedData.m_isWhiteSpaceInherited = true; |
411 } | 417 } |
412 | 418 |
413 private: | 419 private: |
414 // TODO(sashab): Move these to the bottom of ComputedStyle. | 420 // TODO(sashab): Move these to the bottom of ComputedStyle. |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 } | 622 } |
617 void setFilter(const FilterOperations& ops) { | 623 void setFilter(const FilterOperations& ops) { |
618 SET_NESTED_VAR(m_rareNonInheritedData, m_filter, m_operations, ops); | 624 SET_NESTED_VAR(m_rareNonInheritedData, m_filter, m_operations, ops); |
619 } | 625 } |
620 | 626 |
621 // backface-visibility (aka -webkit-backface-visibility) | 627 // backface-visibility (aka -webkit-backface-visibility) |
622 static EBackfaceVisibility initialBackfaceVisibility() { | 628 static EBackfaceVisibility initialBackfaceVisibility() { |
623 return BackfaceVisibilityVisible; | 629 return BackfaceVisibilityVisible; |
624 } | 630 } |
625 EBackfaceVisibility backfaceVisibility() const { | 631 EBackfaceVisibility backfaceVisibility() const { |
626 return static_cast<EBackfaceVisibility>( | 632 return static_cast<EBackfaceVisibility>(m_transform->m_backfaceVisibility); |
627 m_rareNonInheritedData->m_backfaceVisibility); | |
628 } | 633 } |
629 void setBackfaceVisibility(EBackfaceVisibility b) { | 634 void setBackfaceVisibility(EBackfaceVisibility b) { |
630 SET_VAR(m_rareNonInheritedData, m_backfaceVisibility, b); | 635 SET_VAR(m_transform, m_backfaceVisibility, b); |
631 } | 636 } |
632 | 637 |
633 // Background properties. | 638 // Background properties. |
634 // background-color | 639 // background-color |
635 static Color initialBackgroundColor() { return Color::transparent; } | 640 static Color initialBackgroundColor() { return Color::transparent; } |
636 void setBackgroundColor(const StyleColor& v) { | 641 void setBackgroundColor(const StyleColor& v) { |
637 SET_VAR(m_background, m_color, v); | 642 SET_VAR(m_background, m_color, v); |
638 } | 643 } |
639 | 644 |
640 // background-image | 645 // background-image |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 } | 1429 } |
1425 void setObjectPosition(LengthPoint position) { | 1430 void setObjectPosition(LengthPoint position) { |
1426 SET_VAR(m_rareNonInheritedData, m_objectPosition, position); | 1431 SET_VAR(m_rareNonInheritedData, m_objectPosition, position); |
1427 } | 1432 } |
1428 | 1433 |
1429 // offset-anchor | 1434 // offset-anchor |
1430 static LengthPoint initialOffsetAnchor() { | 1435 static LengthPoint initialOffsetAnchor() { |
1431 return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); | 1436 return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); |
1432 } | 1437 } |
1433 const LengthPoint& offsetAnchor() const { | 1438 const LengthPoint& offsetAnchor() const { |
1434 return m_rareNonInheritedData->m_transform->m_motion.m_anchor; | 1439 return m_transform->m_motion.m_anchor; |
1435 } | 1440 } |
1436 void setOffsetAnchor(const LengthPoint& offsetAnchor) { | 1441 void setOffsetAnchor(const LengthPoint& offsetAnchor) { |
1437 SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_anchor, | 1442 SET_VAR(m_transform, m_motion.m_anchor, offsetAnchor); |
1438 offsetAnchor); | |
1439 } | 1443 } |
1440 | 1444 |
1441 // offset-distance | 1445 // offset-distance |
1442 static Length initialOffsetDistance() { return Length(0, Fixed); } | 1446 static Length initialOffsetDistance() { return Length(0, Fixed); } |
1443 const Length& offsetDistance() const { | 1447 const Length& offsetDistance() const { |
1444 return m_rareNonInheritedData->m_transform->m_motion.m_distance; | 1448 return m_transform->m_motion.m_distance; |
1445 } | 1449 } |
1446 void setOffsetDistance(const Length& offsetDistance) { | 1450 void setOffsetDistance(const Length& offsetDistance) { |
1447 SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_distance, | 1451 SET_VAR(m_transform, m_motion.m_distance, offsetDistance); |
1448 offsetDistance); | |
1449 } | 1452 } |
1450 | 1453 |
1451 // offset-path | 1454 // offset-path |
1452 static StylePath* initialOffsetPath() { return nullptr; } | 1455 static StylePath* initialOffsetPath() { return nullptr; } |
1453 StylePath* offsetPath() const { | 1456 StylePath* offsetPath() const { return m_transform->m_motion.m_path.get(); } |
1454 return m_rareNonInheritedData->m_transform->m_motion.m_path.get(); | |
1455 } | |
1456 void setOffsetPath(PassRefPtr<StylePath>); | 1457 void setOffsetPath(PassRefPtr<StylePath>); |
1457 | 1458 |
1458 // offset-position | 1459 // offset-position |
1459 static LengthPoint initialOffsetPosition() { | 1460 static LengthPoint initialOffsetPosition() { |
1460 return LengthPoint(Length(Auto), Length(Auto)); | 1461 return LengthPoint(Length(Auto), Length(Auto)); |
1461 } | 1462 } |
1462 const LengthPoint& offsetPosition() const { | 1463 const LengthPoint& offsetPosition() const { |
1463 return m_rareNonInheritedData->m_transform->m_motion.m_position; | 1464 return m_transform->m_motion.m_position; |
1464 } | 1465 } |
1465 void setOffsetPosition(const LengthPoint& offsetPosition) { | 1466 void setOffsetPosition(const LengthPoint& offsetPosition) { |
1466 SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_position, | 1467 SET_VAR(m_transform, m_motion.m_position, offsetPosition); |
1467 offsetPosition); | |
1468 } | 1468 } |
1469 | 1469 |
1470 // offset-rotation | 1470 // offset-rotation |
1471 static StyleOffsetRotation initialOffsetRotation() { | 1471 static StyleOffsetRotation initialOffsetRotation() { |
1472 return StyleOffsetRotation(0, OffsetRotationAuto); | 1472 return StyleOffsetRotation(0, OffsetRotationAuto); |
1473 } | 1473 } |
1474 const StyleOffsetRotation& offsetRotation() const { | 1474 const StyleOffsetRotation& offsetRotation() const { |
1475 return m_rareNonInheritedData->m_transform->m_motion.m_rotation; | 1475 return m_transform->m_motion.m_rotation; |
1476 } | 1476 } |
1477 void setOffsetRotation(const StyleOffsetRotation& offsetRotation) { | 1477 void setOffsetRotation(const StyleOffsetRotation& offsetRotation) { |
1478 SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_rotation, | 1478 SET_VAR(m_transform, m_motion.m_rotation, offsetRotation); |
1479 offsetRotation); | |
1480 } | 1479 } |
1481 | 1480 |
1482 // opacity (aka -webkit-opacity) | 1481 // opacity (aka -webkit-opacity) |
1483 static float initialOpacity() { return 1.0f; } | 1482 static float initialOpacity() { return 1.0f; } |
1484 float opacity() const { return m_rareNonInheritedData->opacity; } | 1483 float opacity() const { return m_rareNonInheritedData->opacity; } |
1485 void setOpacity(float f) { | 1484 void setOpacity(float f) { |
1486 float v = clampTo<float>(f, 0, 1); | 1485 float v = clampTo<float>(f, 0, 1); |
1487 SET_VAR(m_rareNonInheritedData, opacity, v); | 1486 SET_VAR(m_rareNonInheritedData, opacity, v); |
1488 } | 1487 } |
1489 | 1488 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 void setPaddingRight(const Length& v) { | 1584 void setPaddingRight(const Length& v) { |
1586 SET_VAR(m_surround, padding.m_right, v); | 1585 SET_VAR(m_surround, padding.m_right, v); |
1587 } | 1586 } |
1588 | 1587 |
1589 // padding-top | 1588 // padding-top |
1590 const Length& paddingTop() const { return m_surround->padding.top(); } | 1589 const Length& paddingTop() const { return m_surround->padding.top(); } |
1591 void setPaddingTop(const Length& v) { SET_VAR(m_surround, padding.m_top, v); } | 1590 void setPaddingTop(const Length& v) { SET_VAR(m_surround, padding.m_top, v); } |
1592 | 1591 |
1593 // perspective (aka -webkit-perspective) | 1592 // perspective (aka -webkit-perspective) |
1594 static float initialPerspective() { return 0; } | 1593 static float initialPerspective() { return 0; } |
1595 float perspective() const { return m_rareNonInheritedData->m_perspective; } | 1594 float perspective() const { return m_transform->m_perspective; } |
1596 void setPerspective(float p) { | 1595 void setPerspective(float p) { SET_VAR(m_transform, m_perspective, p); } |
1597 SET_VAR(m_rareNonInheritedData, m_perspective, p); | |
1598 } | |
1599 | 1596 |
1600 // perspective-origin (aka -webkit-perspective-origin) | 1597 // perspective-origin (aka -webkit-perspective-origin) |
1601 static LengthPoint initialPerspectiveOrigin() { | 1598 static LengthPoint initialPerspectiveOrigin() { |
1602 return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); | 1599 return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); |
1603 } | 1600 } |
1604 const LengthPoint& perspectiveOrigin() const { | 1601 const LengthPoint& perspectiveOrigin() const { |
1605 return m_rareNonInheritedData->m_perspectiveOrigin; | 1602 return m_transform->m_perspectiveOrigin; |
1606 } | 1603 } |
1607 void setPerspectiveOrigin(const LengthPoint& p) { | 1604 void setPerspectiveOrigin(const LengthPoint& p) { |
1608 SET_VAR(m_rareNonInheritedData, m_perspectiveOrigin, p); | 1605 SET_VAR(m_transform, m_perspectiveOrigin, p); |
1609 } | 1606 } |
1610 | 1607 |
1611 // -webkit-perspective-origin-x | 1608 // -webkit-perspective-origin-x |
1612 static Length initialPerspectiveOriginX() { return Length(50.0, Percent); } | 1609 static Length initialPerspectiveOriginX() { return Length(50.0, Percent); } |
1613 const Length& perspectiveOriginX() const { return perspectiveOrigin().x(); } | 1610 const Length& perspectiveOriginX() const { return perspectiveOrigin().x(); } |
1614 void setPerspectiveOriginX(const Length& v) { | 1611 void setPerspectiveOriginX(const Length& v) { |
1615 setPerspectiveOrigin(LengthPoint(v, perspectiveOriginY())); | 1612 setPerspectiveOrigin(LengthPoint(v, perspectiveOriginY())); |
1616 } | 1613 } |
1617 | 1614 |
1618 // -webkit-perspective-origin-y | 1615 // -webkit-perspective-origin-y |
(...skipping 16 matching lines...) Expand all Loading... |
1635 return static_cast<EResize>(m_rareNonInheritedData->m_resize); | 1632 return static_cast<EResize>(m_rareNonInheritedData->m_resize); |
1636 } | 1633 } |
1637 void setResize(EResize r) { SET_VAR(m_rareNonInheritedData, m_resize, r); } | 1634 void setResize(EResize r) { SET_VAR(m_rareNonInheritedData, m_resize, r); } |
1638 | 1635 |
1639 // Transform properties. | 1636 // Transform properties. |
1640 // transform (aka -webkit-transform) | 1637 // transform (aka -webkit-transform) |
1641 static EmptyTransformOperations initialTransform() { | 1638 static EmptyTransformOperations initialTransform() { |
1642 return EmptyTransformOperations(); | 1639 return EmptyTransformOperations(); |
1643 } | 1640 } |
1644 const TransformOperations& transform() const { | 1641 const TransformOperations& transform() const { |
1645 return m_rareNonInheritedData->m_transform->m_operations; | 1642 return m_transform->m_operations; |
1646 } | 1643 } |
1647 void setTransform(const TransformOperations& ops) { | 1644 void setTransform(const TransformOperations& ops) { |
1648 SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_operations, ops); | 1645 SET_VAR(m_transform, m_operations, ops); |
1649 } | 1646 } |
1650 | 1647 |
1651 // transform-origin (aka -webkit-transform-origin) | 1648 // transform-origin (aka -webkit-transform-origin) |
1652 static TransformOrigin initialTransformOrigin() { | 1649 static TransformOrigin initialTransformOrigin() { |
1653 return TransformOrigin(Length(50.0, Percent), Length(50.0, Percent), 0); | 1650 return TransformOrigin(Length(50.0, Percent), Length(50.0, Percent), 0); |
1654 } | 1651 } |
1655 const TransformOrigin& transformOrigin() const { | 1652 const TransformOrigin& transformOrigin() const { |
1656 return m_rareNonInheritedData->m_transform->m_origin; | 1653 return m_transform->m_origin; |
1657 } | 1654 } |
1658 void setTransformOrigin(const TransformOrigin& o) { | 1655 void setTransformOrigin(const TransformOrigin& o) { |
1659 SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_origin, o); | 1656 SET_VAR(m_transform, m_origin, o); |
1660 } | 1657 } |
1661 | 1658 |
1662 // transform-style (aka -webkit-transform-style) | 1659 // transform-style (aka -webkit-transform-style) |
1663 static ETransformStyle3D initialTransformStyle3D() { | 1660 static ETransformStyle3D initialTransformStyle3D() { |
1664 return TransformStyle3DFlat; | 1661 return TransformStyle3DFlat; |
1665 } | 1662 } |
1666 ETransformStyle3D transformStyle3D() const { | 1663 ETransformStyle3D transformStyle3D() const { |
1667 return static_cast<ETransformStyle3D>( | 1664 return static_cast<ETransformStyle3D>(m_transform->m_transformStyle3D); |
1668 m_rareNonInheritedData->m_transformStyle3D); | |
1669 } | 1665 } |
1670 void setTransformStyle3D(ETransformStyle3D b) { | 1666 void setTransformStyle3D(ETransformStyle3D b) { |
1671 SET_VAR(m_rareNonInheritedData, m_transformStyle3D, b); | 1667 SET_VAR(m_transform, m_transformStyle3D, b); |
1672 } | 1668 } |
1673 | 1669 |
1674 // -webkit-transform-origin-x | 1670 // -webkit-transform-origin-x |
1675 static Length initialTransformOriginX() { return Length(50.0, Percent); } | 1671 static Length initialTransformOriginX() { return Length(50.0, Percent); } |
1676 const Length& transformOriginX() const { return transformOrigin().x(); } | 1672 const Length& transformOriginX() const { return transformOrigin().x(); } |
1677 void setTransformOriginX(const Length& v) { | 1673 void setTransformOriginX(const Length& v) { |
1678 setTransformOrigin( | 1674 setTransformOrigin( |
1679 TransformOrigin(v, transformOriginY(), transformOriginZ())); | 1675 TransformOrigin(v, transformOriginY(), transformOriginZ())); |
1680 } | 1676 } |
1681 | 1677 |
(...skipping 12 matching lines...) Expand all Loading... |
1694 setTransformOrigin( | 1690 setTransformOrigin( |
1695 TransformOrigin(transformOriginX(), transformOriginY(), f)); | 1691 TransformOrigin(transformOriginX(), transformOriginY(), f)); |
1696 } | 1692 } |
1697 | 1693 |
1698 // Independent transform properties. | 1694 // Independent transform properties. |
1699 // translate | 1695 // translate |
1700 static PassRefPtr<TranslateTransformOperation> initialTranslate() { | 1696 static PassRefPtr<TranslateTransformOperation> initialTranslate() { |
1701 return nullptr; | 1697 return nullptr; |
1702 } | 1698 } |
1703 TranslateTransformOperation* translate() const { | 1699 TranslateTransformOperation* translate() const { |
1704 return m_rareNonInheritedData->m_transform->m_translate.get(); | 1700 return m_transform->m_translate.get(); |
1705 } | 1701 } |
1706 void setTranslate(PassRefPtr<TranslateTransformOperation> v) { | 1702 void setTranslate(PassRefPtr<TranslateTransformOperation> v) { |
1707 m_rareNonInheritedData.access()->m_transform.access()->m_translate = v; | 1703 m_transform.access()->m_translate = v; |
1708 } | 1704 } |
1709 | 1705 |
1710 // rotate | 1706 // rotate |
1711 static PassRefPtr<RotateTransformOperation> initialRotate() { | 1707 static PassRefPtr<RotateTransformOperation> initialRotate() { |
1712 return nullptr; | 1708 return nullptr; |
1713 } | 1709 } |
1714 RotateTransformOperation* rotate() const { | 1710 RotateTransformOperation* rotate() const { |
1715 return m_rareNonInheritedData->m_transform->m_rotate.get(); | 1711 return m_transform->m_rotate.get(); |
1716 } | 1712 } |
1717 void setRotate(PassRefPtr<RotateTransformOperation> v) { | 1713 void setRotate(PassRefPtr<RotateTransformOperation> v) { |
1718 m_rareNonInheritedData.access()->m_transform.access()->m_rotate = v; | 1714 m_transform.access()->m_rotate = v; |
1719 } | 1715 } |
1720 | 1716 |
1721 // scale | 1717 // scale |
1722 static PassRefPtr<ScaleTransformOperation> initialScale() { return nullptr; } | 1718 static PassRefPtr<ScaleTransformOperation> initialScale() { return nullptr; } |
1723 ScaleTransformOperation* scale() const { | 1719 ScaleTransformOperation* scale() const { return m_transform->m_scale.get(); } |
1724 return m_rareNonInheritedData->m_transform->m_scale.get(); | |
1725 } | |
1726 void setScale(PassRefPtr<ScaleTransformOperation> v) { | 1720 void setScale(PassRefPtr<ScaleTransformOperation> v) { |
1727 m_rareNonInheritedData.access()->m_transform.access()->m_scale = v; | 1721 m_transform.access()->m_scale = v; |
1728 } | 1722 } |
1729 | 1723 |
1730 // Scroll properties. | 1724 // Scroll properties. |
1731 // scroll-behavior | 1725 // scroll-behavior |
1732 static ScrollBehavior initialScrollBehavior() { return ScrollBehaviorAuto; } | 1726 static ScrollBehavior initialScrollBehavior() { return ScrollBehaviorAuto; } |
1733 ScrollBehavior getScrollBehavior() const { | 1727 ScrollBehavior getScrollBehavior() const { |
1734 return static_cast<ScrollBehavior>( | 1728 return static_cast<ScrollBehavior>( |
1735 m_rareNonInheritedData->m_scrollBehavior); | 1729 m_rareNonInheritedData->m_scrollBehavior); |
1736 } | 1730 } |
1737 void setScrollBehavior(ScrollBehavior b) { | 1731 void setScrollBehavior(ScrollBehavior b) { |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2732 | 2726 |
2733 bool affectedByDrag() const { return m_nonInheritedData.m_affectedByDrag; } | 2727 bool affectedByDrag() const { return m_nonInheritedData.m_affectedByDrag; } |
2734 void setAffectedByDrag() { m_nonInheritedData.m_affectedByDrag = true; } | 2728 void setAffectedByDrag() { m_nonInheritedData.m_affectedByDrag = true; } |
2735 | 2729 |
2736 bool emptyState() const { return m_nonInheritedData.m_emptyState; } | 2730 bool emptyState() const { return m_nonInheritedData.m_emptyState; } |
2737 void setEmptyState(bool b) { | 2731 void setEmptyState(bool b) { |
2738 setUnique(); | 2732 setUnique(); |
2739 m_nonInheritedData.m_emptyState = b; | 2733 m_nonInheritedData.m_emptyState = b; |
2740 } | 2734 } |
2741 | 2735 |
2742 bool hasInlineTransform() const { | 2736 bool hasInlineTransform() const { return m_transform->m_hasInlineTransform; } |
2743 return m_rareNonInheritedData->m_hasInlineTransform; | |
2744 } | |
2745 void setHasInlineTransform(bool b) { | 2737 void setHasInlineTransform(bool b) { |
2746 SET_VAR(m_rareNonInheritedData, m_hasInlineTransform, b); | 2738 SET_VAR(m_transform, m_hasInlineTransform, b); |
2747 } | 2739 } |
2748 | 2740 |
2749 bool hasCompositorProxy() const { | 2741 bool hasCompositorProxy() const { |
2750 return m_rareNonInheritedData->m_hasCompositorProxy; | 2742 return m_rareNonInheritedData->m_hasCompositorProxy; |
2751 } | 2743 } |
2752 void setHasCompositorProxy(bool b) { | 2744 void setHasCompositorProxy(bool b) { |
2753 SET_VAR(m_rareNonInheritedData, m_hasCompositorProxy, b); | 2745 SET_VAR(m_rareNonInheritedData, m_hasCompositorProxy, b); |
2754 } | 2746 } |
2755 | 2747 |
2756 bool isLink() const { return m_nonInheritedData.m_isLink; } | 2748 bool isLink() const { return m_nonInheritedData.m_isLink; } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 void setHasAuthorBorder(bool authorBorder) { | 2784 void setHasAuthorBorder(bool authorBorder) { |
2793 SET_VAR(m_rareNonInheritedData, m_hasAuthorBorder, authorBorder); | 2785 SET_VAR(m_rareNonInheritedData, m_hasAuthorBorder, authorBorder); |
2794 } | 2786 } |
2795 | 2787 |
2796 // A stacking context is painted atomically and defines a stacking order, | 2788 // A stacking context is painted atomically and defines a stacking order, |
2797 // whereas a containing stacking context defines in which order the stacking | 2789 // whereas a containing stacking context defines in which order the stacking |
2798 // contexts below are painted. | 2790 // contexts below are painted. |
2799 // See CSS 2.1, Appendix E (https://www.w3.org/TR/CSS21/zindex.html) for more | 2791 // See CSS 2.1, Appendix E (https://www.w3.org/TR/CSS21/zindex.html) for more |
2800 // details. | 2792 // details. |
2801 bool isStackingContext() const { | 2793 bool isStackingContext() const { |
2802 return m_rareNonInheritedData->m_isStackingContext; | 2794 return m_nonInheritedData.m_isStackingContext; |
2803 } | 2795 } |
2804 void setIsStackingContext(bool b) { | 2796 void setIsStackingContext(bool b) { |
2805 SET_VAR(m_rareNonInheritedData, m_isStackingContext, b); | 2797 m_nonInheritedData.m_isStackingContext = b; |
2806 } | 2798 } |
2807 | 2799 |
2808 // A unique style is one that has matches something that makes it impossible | 2800 // A unique style is one that has matches something that makes it impossible |
2809 // to share. | 2801 // to share. |
2810 bool unique() const { return m_nonInheritedData.m_unique; } | 2802 bool unique() const { return m_nonInheritedData.m_unique; } |
2811 void setUnique() { m_nonInheritedData.m_unique = true; } | 2803 void setUnique() { m_nonInheritedData.m_unique = true; } |
2812 | 2804 |
2813 float textAutosizingMultiplier() const { | 2805 float textAutosizingMultiplier() const { |
2814 return m_styleInheritedData->textAutosizingMultiplier; | 2806 return m_styleInheritedData->textAutosizingMultiplier; |
2815 } | 2807 } |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3425 | 3417 |
3426 // Motion utility functions. | 3418 // Motion utility functions. |
3427 bool hasOffset() const { | 3419 bool hasOffset() const { |
3428 return (offsetPosition().x() != Length(Auto)) || offsetPath(); | 3420 return (offsetPosition().x() != Length(Auto)) || offsetPath(); |
3429 } | 3421 } |
3430 | 3422 |
3431 // Direction utility functions. | 3423 // Direction utility functions. |
3432 bool isLeftToRightDirection() const { return direction() == LTR; } | 3424 bool isLeftToRightDirection() const { return direction() == LTR; } |
3433 | 3425 |
3434 // Perspective utility functions. | 3426 // Perspective utility functions. |
3435 bool hasPerspective() const { | 3427 bool hasPerspective() const { return m_transform->m_perspective > 0; } |
3436 return m_rareNonInheritedData->m_perspective > 0; | |
3437 } | |
3438 | 3428 |
3439 // Page size utility functions. | 3429 // Page size utility functions. |
3440 void resetPageSizeType() { | 3430 void resetPageSizeType() { |
3441 SET_VAR(m_rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); | 3431 SET_VAR(m_rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); |
3442 } | 3432 } |
3443 | 3433 |
3444 // Outline utility functions. | 3434 // Outline utility functions. |
3445 bool hasOutline() const { | 3435 bool hasOutline() const { |
3446 return outlineWidth() > 0 && outlineStyle() > BorderStyleHidden; | 3436 return outlineWidth() > 0 && outlineStyle() > BorderStyleHidden; |
3447 } | 3437 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3589 | 3579 |
3590 // Opacity utility functions. | 3580 // Opacity utility functions. |
3591 bool hasOpacity() const { return opacity() < 1.0f; } | 3581 bool hasOpacity() const { return opacity() < 1.0f; } |
3592 | 3582 |
3593 // Table layout utility functions. | 3583 // Table layout utility functions. |
3594 bool isFixedTableLayout() const { | 3584 bool isFixedTableLayout() const { |
3595 return tableLayout() == TableLayoutFixed && !logicalWidth().isAuto(); | 3585 return tableLayout() == TableLayoutFixed && !logicalWidth().isAuto(); |
3596 } | 3586 } |
3597 | 3587 |
3598 // Filter/transform utility functions. | 3588 // Filter/transform utility functions. |
3599 bool has3DTransform() const { | 3589 bool has3DTransform() const { return m_transform->has3DTransform(); } |
3600 return m_rareNonInheritedData->m_transform->has3DTransform(); | |
3601 } | |
3602 bool hasTransform() const { | 3590 bool hasTransform() const { |
3603 return hasTransformOperations() || hasOffset() || | 3591 return hasTransformOperations() || hasOffset() || |
3604 hasCurrentTransformAnimation() || translate() || rotate() || scale(); | 3592 hasCurrentTransformAnimation() || translate() || rotate() || scale(); |
3605 } | 3593 } |
3606 bool hasTransformOperations() const { | 3594 bool hasTransformOperations() const { |
3607 return !m_rareNonInheritedData->m_transform->m_operations.operations() | 3595 return !m_transform->m_operations.operations().isEmpty(); |
3608 .isEmpty(); | |
3609 } | 3596 } |
3610 ETransformStyle3D usedTransformStyle3D() const { | 3597 ETransformStyle3D usedTransformStyle3D() const { |
3611 return hasGroupingProperty() ? TransformStyle3DFlat : transformStyle3D(); | 3598 return hasGroupingProperty() ? TransformStyle3DFlat : transformStyle3D(); |
3612 } | 3599 } |
3613 bool transformDataEquivalent(const ComputedStyle& otherStyle) const { | 3600 bool transformDataEquivalent(const ComputedStyle& otherStyle) const { |
3614 return m_rareNonInheritedData->m_transform == | 3601 return m_transform.get() == otherStyle.m_transform.get() || |
3615 otherStyle.m_rareNonInheritedData->m_transform; | 3602 m_transform->transformDataEquivalent(*otherStyle.m_transform); |
3616 } | 3603 } |
3617 bool preserves3D() const { | 3604 bool preserves3D() const { |
3618 return usedTransformStyle3D() != TransformStyle3DFlat; | 3605 return usedTransformStyle3D() != TransformStyle3DFlat; |
3619 } | 3606 } |
3620 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin }; | 3607 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin }; |
3621 enum ApplyMotionPath { IncludeMotionPath, ExcludeMotionPath }; | 3608 enum ApplyMotionPath { IncludeMotionPath, ExcludeMotionPath }; |
3622 enum ApplyIndependentTransformProperties { | 3609 enum ApplyIndependentTransformProperties { |
3623 IncludeIndependentTransformProperties, | 3610 IncludeIndependentTransformProperties, |
3624 ExcludeIndependentTransformProperties | 3611 ExcludeIndependentTransformProperties |
3625 }; | 3612 }; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4101 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); | 4088 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); |
4102 } | 4089 } |
4103 | 4090 |
4104 inline bool ComputedStyle::hasPseudoElementStyle() const { | 4091 inline bool ComputedStyle::hasPseudoElementStyle() const { |
4105 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 4092 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
4106 } | 4093 } |
4107 | 4094 |
4108 } // namespace blink | 4095 } // namespace blink |
4109 | 4096 |
4110 #endif // ComputedStyle_h | 4097 #endif // ComputedStyle_h |
OLD | NEW |