HTMLProgressElement.h 2.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#ifndef HTMLProgressElement_h
#define HTMLProgressElement_h

24
#if ENABLE(PROGRESS_ELEMENT)
25
#include "LabelableElement.h"
26
27
28

namespace WebCore {

29
class ProgressValueElement;
30
class RenderProgress;
31

32
class HTMLProgressElement : public LabelableElement {
33
public:
34
35
36
    static const double IndeterminatePosition;
    static const double InvalidPosition;

37
    static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*);
38
39

    double value() const;
40
    void setValue(double, ExceptionCode&);
41
42

    double max() const;
43
    void setMax(double, ExceptionCode&);
44
45
46

    double position() const;

47
48
    virtual bool canContainRangeEndPoint() const { return false; }

49
private:
50
    HTMLProgressElement(const QualifiedName&, Document*);
51
    virtual ~HTMLProgressElement();
52

53
    virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
54
    virtual bool shouldAppearIndeterminate() const OVERRIDE;
55
    virtual bool supportLabels() const OVERRIDE { return true; }
56

57
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
58
    virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
59
    RenderProgress* renderProgress() const;
60

61
    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
62
63

    virtual void attach();
64
65

    void didElementStateChange();
66
    virtual void didAddUserAgentShadowRoot(ShadowRoot*) OVERRIDE;
67
    bool isDeterminate() const;
68

69
    ProgressValueElement* m_value;
70
71
};

72
73
74
75
76
77
78
79
inline bool isHTMLProgressElement(Node* node)
{
    ASSERT(node);
    return node->hasTagName(HTMLNames::progressTag);
}

inline HTMLProgressElement* toHTMLProgressElement(Node* node)
{
80
    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLProgressElement(node));
81
82
83
    return static_cast<HTMLProgressElement*>(node);
}

84
85
86
87
} // namespace

#endif
#endif