1 | /* |
2 | * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Library General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this library; see the file COPYING.LIB. If not, write to |
16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | * Boston, MA 02110-1301, USA. |
18 | * |
19 | */ |
20 | |
21 | #pragma once |
22 | |
23 | #if ENABLE(METER_ELEMENT) |
24 | |
25 | #include "LabelableElement.h" |
26 | |
27 | namespace WebCore { |
28 | |
29 | class MeterValueElement; |
30 | class RenderMeter; |
31 | |
32 | class HTMLMeterElement final : public LabelableElement { |
33 | WTF_MAKE_ISO_ALLOCATED(HTMLMeterElement); |
34 | public: |
35 | static Ref<HTMLMeterElement> create(const QualifiedName&, Document&); |
36 | |
37 | enum GaugeRegion { |
38 | GaugeRegionOptimum, |
39 | GaugeRegionSuboptimal, |
40 | GaugeRegionEvenLessGood |
41 | }; |
42 | |
43 | double min() const; |
44 | void setMin(double); |
45 | |
46 | double max() const; |
47 | void setMax(double); |
48 | |
49 | double value() const; |
50 | void setValue(double); |
51 | |
52 | double low() const; |
53 | void setLow(double); |
54 | |
55 | double high() const; |
56 | void setHigh(double); |
57 | |
58 | double optimum() const; |
59 | void setOptimum(double); |
60 | |
61 | double valueRatio() const; |
62 | GaugeRegion gaugeRegion() const; |
63 | |
64 | bool canContainRangeEndPoint() const final { return false; } |
65 | |
66 | private: |
67 | HTMLMeterElement(const QualifiedName&, Document&); |
68 | virtual ~HTMLMeterElement(); |
69 | |
70 | RenderMeter* renderMeter() const; |
71 | |
72 | bool supportLabels() const final { return true; } |
73 | |
74 | RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; |
75 | bool childShouldCreateRenderer(const Node&) const final; |
76 | void parseAttribute(const QualifiedName&, const AtomicString&) final; |
77 | |
78 | void didElementStateChange(); |
79 | void didAddUserAgentShadowRoot(ShadowRoot&) final; |
80 | |
81 | RefPtr<HTMLElement> m_value; |
82 | }; |
83 | |
84 | } // namespace WebCore |
85 | |
86 | #endif // ENABLE(METER_ELEMENT) |
87 | |