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 10 matching lines...) Expand all Loading... |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/rendering/style/RenderStyle.h" | 24 #include "core/rendering/style/RenderStyle.h" |
25 | 25 |
26 #include <algorithm> | 26 #include <algorithm> |
27 #include "core/css/resolver/StyleResolver.h" | 27 #include "core/css/resolver/StyleResolver.h" |
28 #include "core/rendering/RenderTheme.h" | 28 #include "core/rendering/RenderTheme.h" |
29 #include "core/rendering/TextAutosizer.h" | 29 #include "core/rendering/TextAutosizer.h" |
30 #include "core/rendering/style/AppliedTextDecoration.h" | 30 #include "core/rendering/style/AppliedTextDecoration.h" |
| 31 #include "core/rendering/style/BorderEdge.h" |
31 #include "core/rendering/style/ContentData.h" | 32 #include "core/rendering/style/ContentData.h" |
32 #include "core/rendering/style/DataEquivalency.h" | 33 #include "core/rendering/style/DataEquivalency.h" |
33 #include "core/rendering/style/QuotesData.h" | 34 #include "core/rendering/style/QuotesData.h" |
34 #include "core/rendering/style/ShadowList.h" | 35 #include "core/rendering/style/ShadowList.h" |
35 #include "core/rendering/style/StyleImage.h" | 36 #include "core/rendering/style/StyleImage.h" |
36 #include "core/rendering/style/StyleInheritedData.h" | 37 #include "core/rendering/style/StyleInheritedData.h" |
37 #include "platform/LengthFunctions.h" | 38 #include "platform/LengthFunctions.h" |
38 #include "platform/RuntimeEnabledFeatures.h" | 39 #include "platform/RuntimeEnabledFeatures.h" |
39 #include "platform/fonts/Font.h" | 40 #include "platform/fonts/Font.h" |
40 #include "platform/fonts/FontSelector.h" | 41 #include "platform/fonts/FontSelector.h" |
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 | 1689 |
1689 // right | 1690 // right |
1690 radiiSum = radii.topRight().height() + radii.bottomRight().height(); | 1691 radiiSum = radii.topRight().height() + radii.bottomRight().height(); |
1691 if (radiiSum > rect.height()) | 1692 if (radiiSum > rect.height()) |
1692 factor = std::min(rect.height() / radiiSum, factor); | 1693 factor = std::min(rect.height() / radiiSum, factor); |
1693 | 1694 |
1694 ASSERT(factor <= 1); | 1695 ASSERT(factor <= 1); |
1695 return factor; | 1696 return factor; |
1696 } | 1697 } |
1697 | 1698 |
| 1699 bool RenderStyle::borderObscuresBackground() const |
| 1700 { |
| 1701 if (!hasBorder()) |
| 1702 return false; |
| 1703 |
| 1704 // Bail if we have any border-image for now. We could look at the image alph
a to improve this. |
| 1705 if (borderImage().image()) |
| 1706 return false; |
| 1707 |
| 1708 BorderEdge edges[4]; |
| 1709 getBorderEdgeInfo(edges); |
| 1710 |
| 1711 for (int i = BSTop; i <= BSLeft; ++i) { |
| 1712 const BorderEdge& currEdge = edges[i]; |
| 1713 if (!currEdge.obscuresBackground()) |
| 1714 return false; |
| 1715 } |
| 1716 |
| 1717 return true; |
| 1718 } |
| 1719 |
| 1720 void RenderStyle::getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftE
dge, bool includeLogicalRightEdge) const |
| 1721 { |
| 1722 bool horizontal = isHorizontalWritingMode(); |
| 1723 |
| 1724 edges[BSTop] = BorderEdge(borderTopWidth(), |
| 1725 visitedDependentColor(CSSPropertyBorderTopColor), |
| 1726 borderTopStyle(), |
| 1727 borderTopIsTransparent(), |
| 1728 horizontal || includeLogicalLeftEdge); |
| 1729 |
| 1730 edges[BSRight] = BorderEdge(borderRightWidth(), |
| 1731 visitedDependentColor(CSSPropertyBorderRightColor), |
| 1732 borderRightStyle(), |
| 1733 borderRightIsTransparent(), |
| 1734 !horizontal || includeLogicalRightEdge); |
| 1735 |
| 1736 edges[BSBottom] = BorderEdge(borderBottomWidth(), |
| 1737 visitedDependentColor(CSSPropertyBorderBottomColor), |
| 1738 borderBottomStyle(), |
| 1739 borderBottomIsTransparent(), |
| 1740 horizontal || includeLogicalRightEdge); |
| 1741 |
| 1742 edges[BSLeft] = BorderEdge(borderLeftWidth(), |
| 1743 visitedDependentColor(CSSPropertyBorderLeftColor), |
| 1744 borderLeftStyle(), |
| 1745 borderLeftIsTransparent(), |
| 1746 !horizontal || includeLogicalLeftEdge); |
| 1747 } |
| 1748 |
1698 } // namespace blink | 1749 } // namespace blink |
OLD | NEW |