• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXCRT_CSS_CFX_CSSNUMBERVALUE_H_
8 #define CORE_FXCRT_CSS_CFX_CSSNUMBERVALUE_H_
9 
10 #include "core/fxcrt/css/cfx_cssvalue.h"
11 
12 struct CFX_CSSNumber {
13   enum class Unit {
14     kNumber,
15     kPercent,
16     kEMS,
17     kEXS,
18     kPixels,
19     kCentiMeters,
20     kMilliMeters,
21     kInches,
22     kPoints,
23     kPicas,
24   };
25 
26   Unit unit;
27   float value;
28 };
29 
30 class CFX_CSSNumberValue final : public CFX_CSSValue {
31  public:
32   explicit CFX_CSSNumberValue(CFX_CSSNumber number);
33   ~CFX_CSSNumberValue() override;
34 
unit()35   CFX_CSSNumber::Unit unit() const { return number_.unit; }
value()36   float value() const { return number_.value; }
37   float Apply(float percentBase) const;
38 
39  private:
40   CFX_CSSNumber number_;
41 };
42 
43 #endif  // CORE_FXCRT_CSS_CFX_CSSNUMBERVALUE_H_
44