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 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 | 1690 |
1690 // right | 1691 // right |
1691 radiiSum = radii.topRight().height() + radii.bottomRight().height(); | 1692 radiiSum = radii.topRight().height() + radii.bottomRight().height(); |
1692 if (radiiSum > rect.height()) | 1693 if (radiiSum > rect.height()) |
1693 factor = std::min(rect.height() / radiiSum, factor); | 1694 factor = std::min(rect.height() / radiiSum, factor); |
1694 | 1695 |
1695 ASSERT(factor <= 1); | 1696 ASSERT(factor <= 1); |
1696 return factor; | 1697 return factor; |
1697 } | 1698 } |
1698 | 1699 |
| 1700 bool RenderStyle::borderObscuresBackground() const |
| 1701 { |
| 1702 if (!hasBorder()) |
| 1703 return false; |
| 1704 |
| 1705 // Bail if we have any border-image for now. We could look at the image alph
a to improve this. |
| 1706 if (borderImage().image()) |
| 1707 return false; |
| 1708 |
| 1709 BorderEdge edges[4]; |
| 1710 getBorderEdgeInfo(edges); |
| 1711 |
| 1712 for (int i = BSTop; i <= BSLeft; ++i) { |
| 1713 const BorderEdge& currEdge = edges[i]; |
| 1714 if (!currEdge.obscuresBackground()) |
| 1715 return false; |
| 1716 } |
| 1717 |
| 1718 return true; |
| 1719 } |
| 1720 |
| 1721 void RenderStyle::getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftE
dge, bool includeLogicalRightEdge) const |
| 1722 { |
| 1723 bool horizontal = isHorizontalWritingMode(); |
| 1724 |
| 1725 edges[BSTop] = BorderEdge(borderTopWidth(), |
| 1726 visitedDependentColor(CSSPropertyBorderTopColor), |
| 1727 borderTopStyle(), |
| 1728 borderTopIsTransparent(), |
| 1729 horizontal || includeLogicalLeftEdge); |
| 1730 |
| 1731 edges[BSRight] = BorderEdge(borderRightWidth(), |
| 1732 visitedDependentColor(CSSPropertyBorderRightColor), |
| 1733 borderRightStyle(), |
| 1734 borderRightIsTransparent(), |
| 1735 !horizontal || includeLogicalRightEdge); |
| 1736 |
| 1737 edges[BSBottom] = BorderEdge(borderBottomWidth(), |
| 1738 visitedDependentColor(CSSPropertyBorderBottomColor), |
| 1739 borderBottomStyle(), |
| 1740 borderBottomIsTransparent(), |
| 1741 horizontal || includeLogicalRightEdge); |
| 1742 |
| 1743 edges[BSLeft] = BorderEdge(borderLeftWidth(), |
| 1744 visitedDependentColor(CSSPropertyBorderLeftColor), |
| 1745 borderLeftStyle(), |
| 1746 borderLeftIsTransparent(), |
| 1747 !horizontal || includeLogicalLeftEdge); |
| 1748 } |
| 1749 |
1699 } // namespace blink | 1750 } // namespace blink |
OLD | NEW |