Chromium Code Reviews| 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) { |
|
pdr.
2017/01/27 20:28:44
Can width be negative? If not, can you DCHECK that
Karl Øygard
2017/02/10 12:53:18
Done.
|
| 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 { |