| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "platform/transforms/ScaleTransformOperation.h" | 45 #include "platform/transforms/ScaleTransformOperation.h" |
| 46 #include "platform/transforms/TranslateTransformOperation.h" | 46 #include "platform/transforms/TranslateTransformOperation.h" |
| 47 #include "wtf/MathExtras.h" | 47 #include "wtf/MathExtras.h" |
| 48 | 48 |
| 49 #include <algorithm> | 49 #include <algorithm> |
| 50 | 50 |
| 51 namespace blink { | 51 namespace blink { |
| 52 | 52 |
| 53 struct SameSizeAsBorderValue { | 53 struct SameSizeAsBorderValue { |
| 54 RGBA32 m_color; | 54 RGBA32 m_color; |
| 55 unsigned m_width; | 55 float m_width; |
| 56 unsigned m_style; |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 static_assert(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), "BorderValue
should stay small"); | 59 static_assert(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), "BorderValue
should stay small"); |
| 59 | 60 |
| 60 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { | 61 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { |
| 61 void* dataRefs[7]; | 62 void* dataRefs[7]; |
| 62 void* ownPtrs[1]; | 63 void* ownPtrs[1]; |
| 63 void* dataRefSvgStyle; | 64 void* dataRefSvgStyle; |
| 64 | 65 |
| 65 struct InheritedFlags { | 66 struct InheritedFlags { |
| (...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 return isLeftToRightDirection() ? borderTop() : borderBottom(); | 1592 return isLeftToRightDirection() ? borderTop() : borderBottom(); |
| 1592 } | 1593 } |
| 1593 | 1594 |
| 1594 const BorderValue& ComputedStyle::borderEnd() const | 1595 const BorderValue& ComputedStyle::borderEnd() const |
| 1595 { | 1596 { |
| 1596 if (isHorizontalWritingMode()) | 1597 if (isHorizontalWritingMode()) |
| 1597 return isLeftToRightDirection() ? borderRight() : borderLeft(); | 1598 return isLeftToRightDirection() ? borderRight() : borderLeft(); |
| 1598 return isLeftToRightDirection() ? borderBottom() : borderTop(); | 1599 return isLeftToRightDirection() ? borderBottom() : borderTop(); |
| 1599 } | 1600 } |
| 1600 | 1601 |
| 1601 int ComputedStyle::borderBeforeWidth() const | 1602 float ComputedStyle::borderBeforeWidth() const |
| 1602 { | 1603 { |
| 1603 switch (writingMode()) { | 1604 switch (writingMode()) { |
| 1604 case TopToBottomWritingMode: | 1605 case TopToBottomWritingMode: |
| 1605 return borderTopWidth(); | 1606 return borderTopWidth(); |
| 1606 case LeftToRightWritingMode: | 1607 case LeftToRightWritingMode: |
| 1607 return borderLeftWidth(); | 1608 return borderLeftWidth(); |
| 1608 case RightToLeftWritingMode: | 1609 case RightToLeftWritingMode: |
| 1609 return borderRightWidth(); | 1610 return borderRightWidth(); |
| 1610 } | 1611 } |
| 1611 ASSERT_NOT_REACHED(); | 1612 ASSERT_NOT_REACHED(); |
| 1612 return borderTopWidth(); | 1613 return borderTopWidth(); |
| 1613 } | 1614 } |
| 1614 | 1615 |
| 1615 int ComputedStyle::borderAfterWidth() const | 1616 float ComputedStyle::borderAfterWidth() const |
| 1616 { | 1617 { |
| 1617 switch (writingMode()) { | 1618 switch (writingMode()) { |
| 1618 case TopToBottomWritingMode: | 1619 case TopToBottomWritingMode: |
| 1619 return borderBottomWidth(); | 1620 return borderBottomWidth(); |
| 1620 case LeftToRightWritingMode: | 1621 case LeftToRightWritingMode: |
| 1621 return borderRightWidth(); | 1622 return borderRightWidth(); |
| 1622 case RightToLeftWritingMode: | 1623 case RightToLeftWritingMode: |
| 1623 return borderLeftWidth(); | 1624 return borderLeftWidth(); |
| 1624 } | 1625 } |
| 1625 ASSERT_NOT_REACHED(); | 1626 ASSERT_NOT_REACHED(); |
| 1626 return borderBottomWidth(); | 1627 return borderBottomWidth(); |
| 1627 } | 1628 } |
| 1628 | 1629 |
| 1629 int ComputedStyle::borderStartWidth() const | 1630 float ComputedStyle::borderStartWidth() const |
| 1630 { | 1631 { |
| 1631 if (isHorizontalWritingMode()) | 1632 if (isHorizontalWritingMode()) |
| 1632 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth()
; | 1633 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth()
; |
| 1633 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth(); | 1634 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth(); |
| 1634 } | 1635 } |
| 1635 | 1636 |
| 1636 int ComputedStyle::borderEndWidth() const | 1637 float ComputedStyle::borderEndWidth() const |
| 1637 { | 1638 { |
| 1638 if (isHorizontalWritingMode()) | 1639 if (isHorizontalWritingMode()) |
| 1639 return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth()
; | 1640 return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth()
; |
| 1640 return isLeftToRightDirection() ? borderBottomWidth() : borderTopWidth(); | 1641 return isLeftToRightDirection() ? borderBottomWidth() : borderTopWidth(); |
| 1641 } | 1642 } |
| 1642 | 1643 |
| 1643 int ComputedStyle::borderOverWidth() const | 1644 float ComputedStyle::borderOverWidth() const |
| 1644 { | 1645 { |
| 1645 return isHorizontalWritingMode() ? borderTopWidth() : borderRightWidth(); | 1646 return isHorizontalWritingMode() ? borderTopWidth() : borderRightWidth(); |
| 1646 } | 1647 } |
| 1647 | 1648 |
| 1648 int ComputedStyle::borderUnderWidth() const | 1649 float ComputedStyle::borderUnderWidth() const |
| 1649 { | 1650 { |
| 1650 return isHorizontalWritingMode() ? borderBottomWidth() : borderLeftWidth(); | 1651 return isHorizontalWritingMode() ? borderBottomWidth() : borderLeftWidth(); |
| 1651 } | 1652 } |
| 1652 | 1653 |
| 1653 void ComputedStyle::setMarginStart(const Length& margin) | 1654 void ComputedStyle::setMarginStart(const Length& margin) |
| 1654 { | 1655 { |
| 1655 if (isHorizontalWritingMode()) { | 1656 if (isHorizontalWritingMode()) { |
| 1656 if (isLeftToRightDirection()) | 1657 if (isLeftToRightDirection()) |
| 1657 setMarginLeft(margin); | 1658 setMarginLeft(margin); |
| 1658 else | 1659 else |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1684 { | 1685 { |
| 1685 ASSERT(path); | 1686 ASSERT(path); |
| 1686 rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path; | 1687 rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path; |
| 1687 } | 1688 } |
| 1688 | 1689 |
| 1689 void ComputedStyle::resetMotionPath() | 1690 void ComputedStyle::resetMotionPath() |
| 1690 { | 1691 { |
| 1691 rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = nullp
tr; | 1692 rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = nullp
tr; |
| 1692 } | 1693 } |
| 1693 | 1694 |
| 1695 // TODO(bugsnash): change return value to float when outline is changed to float |
| 1694 int ComputedStyle::outlineOutsetExtent() const | 1696 int ComputedStyle::outlineOutsetExtent() const |
| 1695 { | 1697 { |
| 1696 if (!hasOutline()) | 1698 if (!hasOutline()) |
| 1697 return 0; | 1699 return 0; |
| 1698 if (outlineStyleIsAuto()) | 1700 if (outlineStyleIsAuto()) |
| 1699 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi
dth()); | 1701 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi
dth()); |
| 1700 return std::max(0, outlineWidth() + outlineOffset()); | 1702 return std::max(0, outlineWidth() + outlineOffset()); |
| 1701 } | 1703 } |
| 1702 | 1704 |
| 1703 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const | 1705 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 } | 1831 } |
| 1830 | 1832 |
| 1831 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) | 1833 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) |
| 1832 { | 1834 { |
| 1833 setEmptyState(other.emptyState()); | 1835 setEmptyState(other.emptyState()); |
| 1834 if (other.hasExplicitlyInheritedProperties()) | 1836 if (other.hasExplicitlyInheritedProperties()) |
| 1835 setHasExplicitlyInheritedProperties(); | 1837 setHasExplicitlyInheritedProperties(); |
| 1836 } | 1838 } |
| 1837 | 1839 |
| 1838 } // namespace blink | 1840 } // namespace blink |
| OLD | NEW |