Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 550363004: Factor painting code out of RenderBox into a new class called BoxPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix debug build. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« Source/core/rendering/style/BorderEdge.h ('K') | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698