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

Unified 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 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/style/RenderStyle.cpp
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp
index ccc95d937e163495893c0d48fffbd0af1417a956..b6db98ebcf328be94f64c9ecfebe286c9a719587 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -28,6 +28,7 @@
#include "core/rendering/RenderTheme.h"
#include "core/rendering/TextAutosizer.h"
#include "core/rendering/style/AppliedTextDecoration.h"
+#include "core/rendering/style/BorderEdge.h"
#include "core/rendering/style/ContentData.h"
#include "core/rendering/style/DataEquivalency.h"
#include "core/rendering/style/QuotesData.h"
@@ -1695,4 +1696,54 @@ float calcBorderRadiiConstraintScaleFor(const FloatRect& rect, const FloatRounde
return factor;
}
+bool RenderStyle::borderObscuresBackground() const
+{
+ if (!hasBorder())
+ return false;
+
+ // Bail if we have any border-image for now. We could look at the image alpha to improve this.
+ if (borderImage().image())
+ return false;
+
+ BorderEdge edges[4];
+ getBorderEdgeInfo(edges);
+
+ for (int i = BSTop; i <= BSLeft; ++i) {
+ const BorderEdge& currEdge = edges[i];
+ if (!currEdge.obscuresBackground())
+ return false;
+ }
+
+ return true;
+}
+
+void RenderStyle::getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
+{
+ bool horizontal = isHorizontalWritingMode();
+
+ edges[BSTop] = BorderEdge(borderTopWidth(),
+ visitedDependentColor(CSSPropertyBorderTopColor),
+ borderTopStyle(),
+ borderTopIsTransparent(),
+ horizontal || includeLogicalLeftEdge);
+
+ edges[BSRight] = BorderEdge(borderRightWidth(),
+ visitedDependentColor(CSSPropertyBorderRightColor),
+ borderRightStyle(),
+ borderRightIsTransparent(),
+ !horizontal || includeLogicalRightEdge);
+
+ edges[BSBottom] = BorderEdge(borderBottomWidth(),
+ visitedDependentColor(CSSPropertyBorderBottomColor),
+ borderBottomStyle(),
+ borderBottomIsTransparent(),
+ horizontal || includeLogicalRightEdge);
+
+ edges[BSLeft] = BorderEdge(borderLeftWidth(),
+ visitedDependentColor(CSSPropertyBorderLeftColor),
+ borderLeftStyle(),
+ borderLeftIsTransparent(),
+ !horizontal || includeLogicalLeftEdge);
+}
+
} // namespace blink
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698