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

Unified Diff: third_party/WebKit/Source/core/style/BorderEdge.cpp

Issue 2640143005: Support subpixel layout for borders. (Closed)
Patch Set: Rebaselined tests. Created 3 years, 10 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
Index: third_party/WebKit/Source/core/style/BorderEdge.cpp
diff --git a/third_party/WebKit/Source/core/style/BorderEdge.cpp b/third_party/WebKit/Source/core/style/BorderEdge.cpp
index 3335f5a8c7a908162abcdcbe8aa6b326ed2910d7..e7fdb031efcaf5891b4f299a126aef5dafd28899 100644
--- a/third_party/WebKit/Source/core/style/BorderEdge.cpp
+++ b/third_party/WebKit/Source/core/style/BorderEdge.cpp
@@ -6,27 +6,26 @@
namespace blink {
-BorderEdge::BorderEdge(int edgeWidth,
+BorderEdge::BorderEdge(float edgeWidth,
const Color& edgeColor,
EBorderStyle edgeStyle,
bool edgeIsPresent)
- : width(edgeWidth),
- color(edgeColor),
+ : color(edgeColor),
isPresent(edgeIsPresent),
- style(edgeStyle) {
+ style(edgeStyle),
+ m_width(edgeWidth) {
if (style == BorderStyleDouble && edgeWidth < 3)
style = BorderStyleSolid;
}
-BorderEdge::BorderEdge()
- : width(0), isPresent(false), style(BorderStyleHidden) {}
+BorderEdge::BorderEdge() : isPresent(false), style(BorderStyleHidden) {}
bool BorderEdge::hasVisibleColorAndStyle() const {
return style > BorderStyleHidden && color.alpha() > 0;
}
bool BorderEdge::shouldRender() const {
- return isPresent && width && hasVisibleColorAndStyle();
+ return isPresent && m_width && hasVisibleColorAndStyle();
}
bool BorderEdge::presentButInvisible() const {
@@ -54,17 +53,16 @@ bool BorderEdge::obscuresBackground() const {
return true;
}
-int BorderEdge::usedWidth() const {
- return isPresent ? width : 0;
+float BorderEdge::usedWidth() const {
+ return isPresent ? m_width : 0;
}
-int BorderEdge::getDoubleBorderStripeWidth(DoubleBorderStripe stripe) const {
+float BorderEdge::getDoubleBorderStripeWidth(DoubleBorderStripe stripe) const {
ASSERT(stripe == DoubleBorderStripeOuter ||
stripe == DoubleBorderStripeInner);
- // We need certain integer rounding results.
- return stripe == DoubleBorderStripeOuter ? (usedWidth() + 1) / 3
- : (usedWidth() * 2 + 1) / 3;
+ return roundf(stripe == DoubleBorderStripeOuter ? usedWidth() / 3
+ : (usedWidth() * 2) / 3);
}
bool BorderEdge::sharesColorWith(const BorderEdge& other) const {
« no previous file with comments | « third_party/WebKit/Source/core/style/BorderEdge.h ('k') | third_party/WebKit/Source/core/style/BorderValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698