~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/svg/SVGStyledElement.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
 
3
 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Library General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Library General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Library General Public License
 
16
 * along with this library; see the file COPYING.LIB.  If not, write to
 
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef SVGStyledElement_h
 
22
#define SVGStyledElement_h
 
23
 
 
24
#if ENABLE(SVG)
 
25
#include "CSSPropertyNames.h"
 
26
#include "SVGAnimatedString.h"
 
27
#include "SVGLocatable.h"
 
28
#include "SVGStylable.h"
 
29
#include <wtf/HashSet.h>
 
30
 
 
31
namespace WebCore {
 
32
 
 
33
void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName);
 
34
 
 
35
class SVGStyledElement : public SVGElement,
 
36
                         public SVGStylable {
 
37
public:
 
38
    virtual String title() const;
 
39
 
 
40
    bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); }
 
41
 
 
42
    virtual bool supportsMarkers() const { return false; }
 
43
 
 
44
    virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name);
 
45
 
 
46
    bool isKnownAttribute(const QualifiedName&);
 
47
 
 
48
    bool instanceUpdatesBlocked() const;
 
49
    void setInstanceUpdatesBlocked(bool);
 
50
 
 
51
    virtual void animatedPropertyTypeForAttribute(const QualifiedName&, Vector<AnimatedPropertyType>&);
 
52
    static bool isAnimatableCSSProperty(const QualifiedName&);
 
53
 
 
54
    virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
 
55
 
 
56
    virtual CSSStyleDeclaration* style() { return StyledElement::style(); }
 
57
    virtual bool needsPendingResourceHandling() const { return true; }
 
58
 
 
59
protected: 
 
60
    SVGStyledElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement);
 
61
    virtual bool rendererIsNeeded(const NodeRenderingContext&);
 
62
 
 
63
    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
 
64
    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
 
65
    virtual void collectStyleForPresentationAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
 
66
    virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
 
67
 
 
68
    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
 
69
    virtual void removedFrom(ContainerNode*) OVERRIDE;
 
70
    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
71
 
 
72
    static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName&);
 
73
    void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
 
74
    void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*);
 
75
 
 
76
    virtual bool selfHasRelativeLengths() const { return false; }
 
77
 
 
78
private:
 
79
    virtual bool isStyled() const { return true; }
 
80
 
 
81
    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
 
82
    virtual bool isMouseFocusable() const;
 
83
 
 
84
    void buildPendingResourcesIfNeeded();
 
85
 
 
86
    HashSet<SVGStyledElement*> m_elementsWithRelativeLengths;
 
87
 
 
88
    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGStyledElement)
 
89
        DECLARE_ANIMATED_STRING(ClassName, className)
 
90
    END_DECLARE_ANIMATED_PROPERTIES
 
91
};
 
92
 
 
93
inline SVGStyledElement* toSVGStyledElement(Node* node)
 
94
{
 
95
    ASSERT(!node || (node->isStyledElement() && node->isSVGElement()));
 
96
    return static_cast<SVGStyledElement*>(node);
 
97
}
 
98
 
 
99
} // namespace WebCore
 
100
 
 
101
#endif // ENABLE(SVG)
 
102
#endif // SVGStyledElement