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#include "LabelableElement.h"
24
25namespace WebCore {
26
27class ProgressValueElement;
28class RenderProgress;
29
30class HTMLProgressElement final : public LabelableElement {
31 WTF_MAKE_ISO_ALLOCATED(HTMLProgressElement);
32public:
33 static const double IndeterminatePosition;
34 static const double InvalidPosition;
35
36 static Ref<HTMLProgressElement> create(const QualifiedName&, Document&);
37
38 double value() const;
39 void setValue(double);
40
41 double max() const;
42 void setMax(double);
43
44 double position() const;
45
46private:
47 HTMLProgressElement(const QualifiedName&, Document&);
48 virtual ~HTMLProgressElement();
49
50 bool shouldAppearIndeterminate() const final;
51 bool supportLabels() const final { return true; }
52
53 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
54 bool childShouldCreateRenderer(const Node&) const final;
55 RenderProgress* renderProgress() const;
56
57 void parseAttribute(const QualifiedName&, const AtomicString&) final;
58
59 void didAttachRenderers() final;
60
61 void didElementStateChange();
62 void didAddUserAgentShadowRoot(ShadowRoot&) final;
63 bool isDeterminate() const;
64
65 bool canContainRangeEndPoint() const final { return false; }
66
67 ProgressValueElement* m_value;
68};
69
70} // namespace
71