| 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 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 return isLeftToRightDirection() ? borderTop() : borderBottom(); | 1602 return isLeftToRightDirection() ? borderTop() : borderBottom(); |
| 1602 } | 1603 } |
| 1603 | 1604 |
| 1604 const BorderValue& ComputedStyle::borderEnd() const | 1605 const BorderValue& ComputedStyle::borderEnd() const |
| 1605 { | 1606 { |
| 1606 if (isHorizontalWritingMode()) | 1607 if (isHorizontalWritingMode()) |
| 1607 return isLeftToRightDirection() ? borderRight() : borderLeft(); | 1608 return isLeftToRightDirection() ? borderRight() : borderLeft(); |
| 1608 return isLeftToRightDirection() ? borderBottom() : borderTop(); | 1609 return isLeftToRightDirection() ? borderBottom() : borderTop(); |
| 1609 } | 1610 } |
| 1610 | 1611 |
| 1611 int ComputedStyle::borderBeforeWidth() const | 1612 float ComputedStyle::borderBeforeWidth() const |
| 1612 { | 1613 { |
| 1613 switch (writingMode()) { | 1614 switch (writingMode()) { |
| 1614 case TopToBottomWritingMode: | 1615 case TopToBottomWritingMode: |
| 1615 return borderTopWidth(); | 1616 return borderTopWidth(); |
| 1616 case LeftToRightWritingMode: | 1617 case LeftToRightWritingMode: |
| 1617 return borderLeftWidth(); | 1618 return borderLeftWidth(); |
| 1618 case RightToLeftWritingMode: | 1619 case RightToLeftWritingMode: |
| 1619 return borderRightWidth(); | 1620 return borderRightWidth(); |
| 1620 } | 1621 } |
| 1621 ASSERT_NOT_REACHED(); | 1622 ASSERT_NOT_REACHED(); |
| 1622 return borderTopWidth(); | 1623 return borderTopWidth(); |
| 1623 } | 1624 } |
| 1624 | 1625 |
| 1625 int ComputedStyle::borderAfterWidth() const | 1626 float ComputedStyle::borderAfterWidth() const |
| 1626 { | 1627 { |
| 1627 switch (writingMode()) { | 1628 switch (writingMode()) { |
| 1628 case TopToBottomWritingMode: | 1629 case TopToBottomWritingMode: |
| 1629 return borderBottomWidth(); | 1630 return borderBottomWidth(); |
| 1630 case LeftToRightWritingMode: | 1631 case LeftToRightWritingMode: |
| 1631 return borderRightWidth(); | 1632 return borderRightWidth(); |
| 1632 case RightToLeftWritingMode: | 1633 case RightToLeftWritingMode: |
| 1633 return borderLeftWidth(); | 1634 return borderLeftWidth(); |
| 1634 } | 1635 } |
| 1635 ASSERT_NOT_REACHED(); | 1636 ASSERT_NOT_REACHED(); |
| 1636 return borderBottomWidth(); | 1637 return borderBottomWidth(); |
| 1637 } | 1638 } |
| 1638 | 1639 |
| 1639 int ComputedStyle::borderStartWidth() const | 1640 float ComputedStyle::borderStartWidth() const |
| 1640 { | 1641 { |
| 1641 if (isHorizontalWritingMode()) | 1642 if (isHorizontalWritingMode()) |
| 1642 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth()
; | 1643 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth()
; |
| 1643 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth(); | 1644 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth(); |
| 1644 } | 1645 } |
| 1645 | 1646 |
| 1646 int ComputedStyle::borderEndWidth() const | 1647 float ComputedStyle::borderEndWidth() const |
| 1647 { | 1648 { |
| 1648 if (isHorizontalWritingMode()) | 1649 if (isHorizontalWritingMode()) |
| 1649 return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth()
; | 1650 return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth()
; |
| 1650 return isLeftToRightDirection() ? borderBottomWidth() : borderTopWidth(); | 1651 return isLeftToRightDirection() ? borderBottomWidth() : borderTopWidth(); |
| 1651 } | 1652 } |
| 1652 | 1653 |
| 1653 int ComputedStyle::borderOverWidth() const | 1654 float ComputedStyle::borderOverWidth() const |
| 1654 { | 1655 { |
| 1655 return isHorizontalWritingMode() ? borderTopWidth() : borderRightWidth(); | 1656 return isHorizontalWritingMode() ? borderTopWidth() : borderRightWidth(); |
| 1656 } | 1657 } |
| 1657 | 1658 |
| 1658 int ComputedStyle::borderUnderWidth() const | 1659 float ComputedStyle::borderUnderWidth() const |
| 1659 { | 1660 { |
| 1660 return isHorizontalWritingMode() ? borderBottomWidth() : borderLeftWidth(); | 1661 return isHorizontalWritingMode() ? borderBottomWidth() : borderLeftWidth(); |
| 1661 } | 1662 } |
| 1662 | 1663 |
| 1663 void ComputedStyle::setMarginStart(const Length& margin) | 1664 void ComputedStyle::setMarginStart(const Length& margin) |
| 1664 { | 1665 { |
| 1665 if (isHorizontalWritingMode()) { | 1666 if (isHorizontalWritingMode()) { |
| 1666 if (isLeftToRightDirection()) | 1667 if (isLeftToRightDirection()) |
| 1667 setMarginLeft(margin); | 1668 setMarginLeft(margin); |
| 1668 else | 1669 else |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1688 else | 1689 else |
| 1689 setMarginTop(margin); | 1690 setMarginTop(margin); |
| 1690 } | 1691 } |
| 1691 } | 1692 } |
| 1692 | 1693 |
| 1693 void ComputedStyle::setMotionPath(PassRefPtr<StylePath> path) | 1694 void ComputedStyle::setMotionPath(PassRefPtr<StylePath> path) |
| 1694 { | 1695 { |
| 1695 rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path; | 1696 rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path; |
| 1696 } | 1697 } |
| 1697 | 1698 |
| 1699 // TODO(bugsnash): change return value to float when outline is changed to float |
| 1698 int ComputedStyle::outlineOutsetExtent() const | 1700 int ComputedStyle::outlineOutsetExtent() const |
| 1699 { | 1701 { |
| 1700 if (!hasOutline()) | 1702 if (!hasOutline()) |
| 1701 return 0; | 1703 return 0; |
| 1702 if (outlineStyleIsAuto()) | 1704 if (outlineStyleIsAuto()) |
| 1703 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi
dth()); | 1705 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi
dth()); |
| 1704 return std::max(0, outlineWidth() + outlineOffset()); | 1706 return std::max(0, outlineWidth() + outlineOffset()); |
| 1705 } | 1707 } |
| 1706 | 1708 |
| 1707 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const | 1709 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 if (!shadowList) | 1846 if (!shadowList) |
| 1845 return false; | 1847 return false; |
| 1846 for (size_t i = shadowList->shadows().size(); i--; ) { | 1848 for (size_t i = shadowList->shadows().size(); i--; ) { |
| 1847 if (shadowList->shadows()[i].color().isCurrentColor()) | 1849 if (shadowList->shadows()[i].color().isCurrentColor()) |
| 1848 return true; | 1850 return true; |
| 1849 } | 1851 } |
| 1850 return false; | 1852 return false; |
| 1851 } | 1853 } |
| 1852 | 1854 |
| 1853 } // namespace blink | 1855 } // namespace blink |
| OLD | NEW |