Chromium Code Reviews| Index: third_party/WebKit/Source/core/style/BorderValue.h |
| diff --git a/third_party/WebKit/Source/core/style/BorderValue.h b/third_party/WebKit/Source/core/style/BorderValue.h |
| index 58a261674f0b5133cd2eef50d88548f40e2a7c16..ec128ce3c60abb0c6db2a6af0dcc6c6114e551e5 100644 |
| --- a/third_party/WebKit/Source/core/style/BorderValue.h |
| +++ b/third_party/WebKit/Source/core/style/BorderValue.h |
| @@ -26,24 +26,14 @@ |
| #define BorderValue_h |
| #include "core/css/StyleColor.h" |
| +#include "core/style/BorderColorAndStyle.h" |
| #include "core/style/ComputedStyleConstants.h" |
| #include "platform/graphics/Color.h" |
| #include "platform/wtf/Allocator.h" |
| namespace blink { |
| -// In order to conserve memory, the border width uses fixed point, |
|
nainar
2017/05/05 07:16:50
Since this is needed by both this and ComputedStyl
shend
2017/05/07 23:08:30
If you moved WidthToFixedPoint to this file, would
nainar
2017/05/08 00:59:57
Nope. Unless we include the BorderValue file in Co
|
| -// which can be bitpacked. This fixed point implementation is |
| -// essentially the same as in LayoutUnit. Six bits are used for the |
| -// fraction, which leaves 20 bits for the integer part, making 1048575 |
| -// the largest number. |
| - |
| -static const int kBorderWidthFractionalBits = 6; |
| -static const int kBorderWidthDenominator = 1 << kBorderWidthFractionalBits; |
| -static const int kMaxForBorderWidth = ((1 << 26) - 1) / kBorderWidthDenominator; |
| - |
| class BorderValue { |
| - DISALLOW_NEW(); |
| friend class ComputedStyle; |
| public: |
| @@ -55,6 +45,14 @@ class BorderValue { |
| SetWidth(3); |
| } |
| + BorderValue(const BorderColorAndStyle& data, const float width) { |
|
shend
2017/05/07 23:08:30
nit: probably don't need the const on the 'width'
nainar
2017/05/08 00:59:57
Done.
|
| + SetColor(data.GetColor()); |
| + SetColorIsCurrentColor(ColorIsCurrentColor()); |
| + SetStyle(data.Style()); |
| + SetIsAuto(data.IsAuto()); |
| + SetWidth(width); |
| + } |
| + |
| bool NonZero() const { return Width() && (style_ != kBorderStyleNone); } |
| bool IsTransparent() const { |
| @@ -102,6 +100,14 @@ class BorderValue { |
| EBorderStyle Style() const { return static_cast<EBorderStyle>(style_); } |
| void SetStyle(EBorderStyle style) { style_ = style; } |
| + OutlineIsAuto IsAuto() const { return static_cast<OutlineIsAuto>(is_auto_); } |
| + void SetIsAuto(OutlineIsAuto is_auto) { is_auto_ = is_auto; } |
| + |
| + bool ColorIsCurrentColor() const { return color_is_current_color_; } |
| + void SetColorIsCurrentColor(bool color_is_current_color) { |
| + color_is_current_color_ = static_cast<unsigned>(color_is_current_color); |
| + } |
| + |
| protected: |
| static unsigned WidthToFixedPoint(float width) { |
| DCHECK_GE(width, 0); |