1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_TEXT_DECORATION_THICKNESS_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_TEXT_DECORATION_THICKNESS_H_ 7 8 #include "third_party/blink/renderer/core/core_export.h" 9 #include "third_party/blink/renderer/core/css_value_keywords.h" 10 #include "third_party/blink/renderer/platform/geometry/length.h" 11 12 namespace blink { 13 14 class TextDecorationThickness { 15 DISALLOW_NEW(); 16 17 public: 18 TextDecorationThickness(); 19 20 CORE_EXPORT explicit TextDecorationThickness(const Length& length); 21 22 explicit TextDecorationThickness(CSSValueID from_font_keyword); 23 IsFromFont()24 bool IsFromFont() const { return thickness_from_font_; } Thickness()25 const Length& Thickness() const { 26 DCHECK(!thickness_from_font_); 27 return thickness_; 28 } IsAuto()29 bool IsAuto() const { return !thickness_from_font_ && thickness_.IsAuto(); } 30 31 CORE_EXPORT bool operator==(const TextDecorationThickness&) const; 32 bool operator!=(const TextDecorationThickness& other) const { 33 return !(*this == other); 34 } 35 36 private: 37 Length thickness_; 38 bool thickness_from_font_{false}; 39 }; 40 41 } // namespace blink 42 43 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_TEXT_DECORATION_THICKNESS_H_ 44