Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSStyleDeclaration.h

Issue 2607403002: Disallow setting invalid values for registered properties via CSSOM (Closed)
Patch Set: fix comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 16 matching lines...) Expand all
27 #include "wtf/Forward.h" 27 #include "wtf/Forward.h"
28 #include "wtf/Noncopyable.h" 28 #include "wtf/Noncopyable.h"
29 #include "wtf/text/WTFString.h" 29 #include "wtf/text/WTFString.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 class CSSRule; 33 class CSSRule;
34 class CSSStyleSheet; 34 class CSSStyleSheet;
35 class CSSValue; 35 class CSSValue;
36 class ExceptionState; 36 class ExceptionState;
37 class ExecutionContext;
37 38
38 class CORE_EXPORT CSSStyleDeclaration 39 class CORE_EXPORT CSSStyleDeclaration
39 : public GarbageCollectedFinalized<CSSStyleDeclaration>, 40 : public GarbageCollectedFinalized<CSSStyleDeclaration>,
40 public ScriptWrappable { 41 public ScriptWrappable {
41 DEFINE_WRAPPERTYPEINFO(); 42 DEFINE_WRAPPERTYPEINFO();
42 WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration); 43 WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration);
43 44
44 public: 45 public:
45 virtual ~CSSStyleDeclaration() {} 46 virtual ~CSSStyleDeclaration() {}
46 47
47 virtual CSSRule* parentRule() const = 0; 48 virtual CSSRule* parentRule() const = 0;
48 String cssFloat() { return getPropertyValueInternal(CSSPropertyFloat); } 49 String cssFloat() { return getPropertyValueInternal(CSSPropertyFloat); }
49 void setCSSFloat(const String& value, ExceptionState& exceptionState) { 50 void setCSSFloat(const String& value, ExceptionState& exceptionState) {
50 setPropertyInternal(CSSPropertyFloat, String(), value, false, 51 setPropertyInternal(CSSPropertyFloat, String(), value, false, nullptr,
51 exceptionState); 52 exceptionState);
52 } 53 }
53 virtual String cssText() const = 0; 54 virtual String cssText() const = 0;
54 virtual void setCSSText(const String&, ExceptionState&) = 0; 55 virtual void setCSSText(const String&, ExceptionState&) = 0;
55 virtual unsigned length() const = 0; 56 virtual unsigned length() const = 0;
56 virtual String item(unsigned index) const = 0; 57 virtual String item(unsigned index) const = 0;
57 virtual String getPropertyValue(const String& propertyName) = 0; 58 virtual String getPropertyValue(const String& propertyName) = 0;
58 virtual String getPropertyPriority(const String& propertyName) = 0; 59 virtual String getPropertyPriority(const String& propertyName) = 0;
59 virtual String getPropertyShorthand(const String& propertyName) = 0; 60 virtual String getPropertyShorthand(const String& propertyName) = 0;
60 virtual bool isPropertyImplicit(const String& propertyName) = 0; 61 virtual bool isPropertyImplicit(const String& propertyName) = 0;
61 virtual void setProperty(const String& propertyName, 62 virtual void setProperty(const ExecutionContext*,
63 const String& propertyName,
62 const String& value, 64 const String& value,
63 const String& priority, 65 const String& priority,
64 ExceptionState&) = 0; 66 ExceptionState&) = 0;
65 virtual String removeProperty(const String& propertyName, 67 virtual String removeProperty(const String& propertyName,
66 ExceptionState&) = 0; 68 ExceptionState&) = 0;
67 69
68 // CSSPropertyID versions of the CSSOM functions to support bindings and 70 // CSSPropertyID versions of the CSSOM functions to support bindings and
69 // editing. 71 // editing.
70 // Use the non-virtual methods in the concrete subclasses when possible. 72 // Use the non-virtual methods in the concrete subclasses when possible.
71 // The CSSValue returned by this function should not be exposed to the web as 73 // The CSSValue returned by this function should not be exposed to the web as
72 // it may be used by multiple documents at the same time. 74 // it may be used by multiple documents at the same time.
73 virtual const CSSValue* getPropertyCSSValueInternal(CSSPropertyID) = 0; 75 virtual const CSSValue* getPropertyCSSValueInternal(CSSPropertyID) = 0;
74 virtual const CSSValue* getPropertyCSSValueInternal( 76 virtual const CSSValue* getPropertyCSSValueInternal(
75 AtomicString customPropertyName) = 0; 77 AtomicString customPropertyName) = 0;
76 virtual String getPropertyValueInternal(CSSPropertyID) = 0; 78 virtual String getPropertyValueInternal(CSSPropertyID) = 0;
77 virtual void setPropertyInternal(CSSPropertyID, 79 virtual void setPropertyInternal(CSSPropertyID,
78 const String& propertyValue, 80 const String& propertyValue,
79 const String& value, 81 const String& value,
80 bool important, 82 bool important,
83 const ExecutionContext*,
81 ExceptionState&) = 0; 84 ExceptionState&) = 0;
82 85
83 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const = 0; 86 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const = 0;
84 virtual CSSStyleSheet* parentStyleSheet() const { return 0; } 87 virtual CSSStyleSheet* parentStyleSheet() const { return 0; }
85 88
86 DEFINE_INLINE_VIRTUAL_TRACE() {} 89 DEFINE_INLINE_VIRTUAL_TRACE() {}
87 90
88 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 91 DECLARE_VIRTUAL_TRACE_WRAPPERS();
89 92
90 protected: 93 protected:
91 CSSStyleDeclaration() {} 94 CSSStyleDeclaration() {}
92 }; 95 };
93 96
94 } // namespace blink 97 } // namespace blink
95 98
96 #endif // CSSStyleDeclaration_h 99 #endif // CSSStyleDeclaration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698