WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Proposed patch
bug-73121.diff (text/plain), 25.66 KB, created by
Andreas Kling
on 2011-11-25 04:42:18 PST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Andreas Kling
Created:
2011-11-25 04:42:18 PST
Size:
25.66 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9ca47a1..9e50f07 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,83 @@ >+2011-11-25 Andreas Kling <kling@webkit.org> >+ >+ Factor element pointer out of CSSMutableStyleDeclaration. >+ <http://webkit.org/b/73121> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Move the StyledElement pointer out of CSSMutableStyleDeclaration and into a subclass >+ for the cases where it's needed. This reduces the size of vanilla style declarations >+ by one CPU word (4 or 8 bytes, depending on architecture.) >+ >+ * css/CSSMutableStyleDeclaration.h: >+ (WebCore::CSSElementStyleDeclaration::element): >+ (WebCore::CSSElementStyleDeclaration::setElement): >+ (WebCore::CSSElementStyleDeclaration::CSSElementStyleDeclaration): >+ (WebCore::CSSElementStyleDeclaration::~CSSElementStyleDeclaration): >+ >+ Added CSSElementStyleDeclaration, a common parent class for inline styles >+ and mapped attributes. It extends CSSMutableStyleDeclaration by adding a backpointer >+ to the StyledElement that owns it. >+ >+ * GNUmakefile.list.am: >+ * Target.pri: >+ * WebCore.gypi: >+ * WebCore.vcproj/WebCore.vcproj: >+ * WebCore.xcodeproj/project.pbxproj: >+ * css/CSSInlineStyleDeclaration.h: Added. >+ (WebCore::CSSInlineStyleDeclaration::~CSSInlineStyleDeclaration): >+ (WebCore::CSSInlineStyleDeclaration::create): >+ (WebCore::CSSInlineStyleDeclaration::CSSInlineStyleDeclaration): >+ >+ Added CSSInlineStyleDeclaration. >+ >+ * bindings/js/JSDOMBinding.h: >+ (WebCore::root): >+ * css/CSSMutableStyleDeclaration.cpp: >+ (WebCore::CSSMutableStyleDeclaration::setNeedsStyleRecalc): >+ * css/CSSStyleRule.cpp: >+ (WebCore::CSSStyleRule::setSelectorText): >+ >+ Only follow the associated element on CSSElementStyleDeclarations. >+ >+ * css/CSSMutableStyleDeclaration.cpp: >+ (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration): >+ (WebCore::CSSMutableStyleDeclaration::operator=): >+ >+ Remove comment about m_element since the field was moved to a subclass. >+ >+ * css/CSSStyleDeclaration.cpp: >+ (WebCore::CSSStyleDeclaration::CSSStyleDeclaration): >+ * css/CSSStyleDeclaration.h: >+ (WebCore::CSSStyleDeclaration::isElementStyleDeclaration): >+ (WebCore::CSSStyleDeclaration::isInlineStyleDeclaration): >+ >+ We no longer need to track whether a style declaration is mutable or not, >+ so the constructors are slightly simplified. >+ Added two bits (isElementStyleDeclaration and isInlineStyleDeclaration) for >+ runtime type checking. These are protected and set by the CSSElementStyleDeclaration >+ constructor. >+ >+ * dom/CSSMappedAttributeDeclaration.h: >+ (WebCore::CSSMappedAttributeDeclaration::create): >+ (WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration): >+ >+ Remove pointless CSSRule* argument to constructor since we always passed 0. >+ >+ * dom/StyledElement.h: >+ (WebCore::StyledElement::inlineStyleDecl): >+ * dom/StyledElement.cpp: >+ (WebCore::StyledElement::createInlineStyleDecl): >+ (WebCore::StyledElement::getInlineStyleDecl): >+ (WebCore::StyledElement::addSubresourceAttributeURLs): >+ >+ Make the inline style on StyledElement a CSSInlineStyleDeclaration. >+ >+ * inspector/InspectorCSSAgent.cpp: >+ (WebCore::InspectorCSSAgent::inlineStyleElement): >+ >+ Slightly simplified by having CSSInlineStyleDeclaration. >+ > 2011-11-23 Yury Semikhatsky <yurys@chromium.org> > > Web Inspector: exceptions in shared workers should be logged to web inspector console >diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am >index cb2f9a2..d6757b5 100644 >--- a/Source/WebCore/GNUmakefile.list.am >+++ b/Source/WebCore/GNUmakefile.list.am >@@ -1009,6 +1009,7 @@ webcore_sources += \ > Source/WebCore/css/CSSInheritedValue.h \ > Source/WebCore/css/CSSInitialValue.cpp \ > Source/WebCore/css/CSSInitialValue.h \ >+ Source/WebCore/css/CSSInlineStyleDeclaration.h \ > Source/WebCore/css/CSSLineBoxContainValue.cpp \ > Source/WebCore/css/CSSLineBoxContainValue.h \ > Source/WebCore/css/CSSMediaRule.cpp \ >diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri >index eeb7f80..27f8459 100644 >--- a/Source/WebCore/Target.pri >+++ b/Source/WebCore/Target.pri >@@ -1510,6 +1510,7 @@ HEADERS += \ > css/CSSImportRule.h \ > css/CSSInheritedValue.h \ > css/CSSInitialValue.h \ >+ css/CSSInlineStyleDeclaration.h \ > css/CSSMediaRule.h \ > css/CSSMutableStyleDeclaration.h \ > css/CSSOMUtils.h \ >diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi >index b9c7aff..2853c0f 100644 >--- a/Source/WebCore/WebCore.gypi >+++ b/Source/WebCore/WebCore.gypi >@@ -488,6 +488,7 @@ > 'css/CSSHelper.h', > 'css/CSSImageGeneratorValue.h', > 'css/CSSImageValue.h', >+ 'css/CSSInlineStyleDeclaration.h', > 'css/CSSLineBoxContainValue.h', > 'css/CSSMutableStyleDeclaration.h', > 'css/CSSParserValues.h', >diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >index a1eb666..382de97 100755 >--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj >+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >@@ -32514,6 +32514,10 @@ > > > </File> > <File >+ RelativePath="..\css\CSSInlineStyleDeclaration.h" >+ > >+ </File> >+ <File > RelativePath="..\css\CSSLineBoxContainValue.cpp" > > > </File> >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index fe47406..10d2696 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -2948,6 +2948,7 @@ > 8CADF2AB135C7B36009EF43F /* LevelDBDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CADF2A5135C7B36009EF43F /* LevelDBDatabase.h */; }; > 8CADF2AD135C7B36009EF43F /* LevelDBIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CADF2A7135C7B36009EF43F /* LevelDBIterator.h */; }; > 8CADF2AE135C7B36009EF43F /* LevelDBSlice.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CADF2A8135C7B36009EF43F /* LevelDBSlice.h */; }; >+ 8CF7DDE4147ECF940041A6F2 /* CSSInlineStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CF7DDE1147E432D0041A6F2 /* CSSInlineStyleDeclaration.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F6756191288B17B0047ACA3 /* EventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */; }; > 9001774012E0347800648462 /* OESStandardDerivatives.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9001773D12E0347800648462 /* OESStandardDerivatives.cpp */; }; >@@ -10153,6 +10154,7 @@ > 8CADF2A5135C7B36009EF43F /* LevelDBDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LevelDBDatabase.h; sourceTree = "<group>"; }; > 8CADF2A7135C7B36009EF43F /* LevelDBIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LevelDBIterator.h; sourceTree = "<group>"; }; > 8CADF2A8135C7B36009EF43F /* LevelDBSlice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LevelDBSlice.h; sourceTree = "<group>"; }; >+ 8CF7DDE1147E432D0041A6F2 /* CSSInlineStyleDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSInlineStyleDeclaration.h; sourceTree = "<group>"; }; > 8F6756191288B17B0047ACA3 /* EventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventQueue.h; sourceTree = "<group>"; }; > 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecState.h; sourceTree = "<group>"; }; > 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMainThreadExecState.cpp; sourceTree = "<group>"; }; >@@ -20618,6 +20620,7 @@ > F523D18402DE42E8018635CA /* css */ = { > isa = PBXGroup; > children = ( >+ 8CF7DDE1147E432D0041A6F2 /* CSSInlineStyleDeclaration.h */, > 5038BC0614711CDB0095E0D1 /* WebKitCSSShaderValue.cpp */, > 50B42157146976960087E604 /* WebKitCSSShaderValue.h */, > AD03AAF81468453900A39B5B /* CSSValue.cpp */, >@@ -21691,6 +21694,7 @@ > isa = PBXHeadersBuildPhase; > buildActionMask = 2147483647; > files = ( >+ 8CF7DDE4147ECF940041A6F2 /* CSSInlineStyleDeclaration.h in Headers */, > A3BB59F41457A40D00AC56FE /* DocumentEventQueue.h in Headers */, > 3106037014327D2E00ABF4BA /* WebKitCSSFilterValue.h in Headers */, > A8EA800C0A19516E00A8EF5F /* StyleSheet.h in Headers */, >diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h >index d913813..12ab9f1 100644 >--- a/Source/WebCore/bindings/js/JSDOMBinding.h >+++ b/Source/WebCore/bindings/js/JSDOMBinding.h >@@ -22,6 +22,7 @@ > #ifndef JSDOMBinding_h > #define JSDOMBinding_h > >+#include "CSSMutableStyleDeclaration.h" > #include "CSSRule.h" > #include "CSSStyleSheet.h" > #include "JSDOMGlobalObject.h" >@@ -206,9 +207,9 @@ enum ParameterMissingPolicy { > return root(parentRule); > if (CSSStyleSheet* styleSheet = style->parentStyleSheet()) > return root(styleSheet); >- if (style->isMutableStyleDeclaration()) { >- if (Node* node = static_cast<CSSMutableStyleDeclaration*>(style)->element()) >- return root(node); >+ if (style->isElementStyleDeclaration()) { >+ if (StyledElement* element = static_cast<CSSElementStyleDeclaration*>(style)->element()) >+ return root(element); > } > return style; > } >diff --git a/Source/WebCore/css/CSSInlineStyleDeclaration.h b/Source/WebCore/css/CSSInlineStyleDeclaration.h >new file mode 100644 >index 0000000..d22c552 >--- /dev/null >+++ b/Source/WebCore/css/CSSInlineStyleDeclaration.h >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. >+ * Copyright (C) 2011 Andreas Kling (kling@webkit.org) >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef CSSInlineStyleDeclaration_h >+#define CSSInlineStyleDeclaration_h >+ >+#include "CSSMutableStyleDeclaration.h" >+ >+namespace WebCore { >+ >+class CSSInlineStyleDeclaration : public CSSElementStyleDeclaration { >+public: >+ virtual ~CSSInlineStyleDeclaration() { } >+ >+ static PassRefPtr<CSSInlineStyleDeclaration> create() >+ { >+ return adoptRef(new CSSInlineStyleDeclaration); >+ } >+ >+private: >+ CSSInlineStyleDeclaration() >+ : CSSElementStyleDeclaration(/* isInline */ true) >+ { >+ } >+}; >+ >+} // namespace WebCore >+ >+#endif // CSSInlineStyleDeclaration_h >diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp >index b79ead9..ebfd082 100644 >--- a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp >@@ -107,31 +107,27 @@ CSSMutableStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0; > #endif // ENABLE(MUTATION_OBSERVERS) > > CSSMutableStyleDeclaration::CSSMutableStyleDeclaration() >- : CSSStyleDeclaration(0, /* isMutable */ true) >- , m_element(0) >+ : CSSStyleDeclaration(0) > { > // This constructor is used for various inline style declarations, so disable strict parsing. > m_strictParsing = false; > } > > CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent) >- : CSSStyleDeclaration(parent, /* isMutable */ true) >- , m_element(0) >+ : CSSStyleDeclaration(parent) > { > } > > CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const Vector<CSSProperty>& properties) >- : CSSStyleDeclaration(parent, /* isMutable */ true) >+ : CSSStyleDeclaration(parent) > , m_properties(properties) >- , m_element(0) > { > m_properties.shrinkToFit(); > // FIXME: This allows duplicate properties. > } > > CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CSSProperty* const * properties, int numProperties) >- : CSSStyleDeclaration(parent, /* isMutable */ true) >- , m_element(0) >+ : CSSStyleDeclaration(parent) > { > m_properties.reserveInitialCapacity(numProperties); > HashMap<int, bool> candidates; >@@ -156,7 +152,6 @@ CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration() > CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutableStyleDeclaration& other) > { > ASSERT(!m_iteratorCount); >- // don't attach it to the same element, just leave the current m_element value > m_properties = other.m_properties; > m_strictParsing = other.m_strictParsing; > return *this; >@@ -614,24 +609,18 @@ String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyCha > return value; > } > >-bool CSSMutableStyleDeclaration::isInlineStyleDeclaration() >-{ >- // FIXME: Ideally, this should be factored better and there >- // should be a subclass of CSSMutableStyleDeclaration just >- // for inline style declarations that handles this >- return m_element && m_element->inlineStyleDecl() == this; >-} >- > void CSSMutableStyleDeclaration::setNeedsStyleRecalc() > { >- if (m_element) { >- if (isInlineStyleDeclaration()) { >- m_element->setNeedsStyleRecalc(InlineStyleChange); >- m_element->invalidateStyleAttribute(); >- if (m_element->document()) >- InspectorInstrumentation::didInvalidateStyleAttr(m_element->document(), m_element); >- } else >- m_element->setNeedsStyleRecalc(FullStyleChange); >+ if (isElementStyleDeclaration() && static_cast<CSSElementStyleDeclaration*>(this)->element()) { >+ StyledElement* element = static_cast<CSSElementStyleDeclaration*>(this)->element(); >+ if (!isInlineStyleDeclaration()) >+ element->setNeedsStyleRecalc(FullStyleChange); >+ else { >+ element->setNeedsStyleRecalc(InlineStyleChange); >+ element->invalidateStyleAttribute(); >+ if (Document* document = element->document()) >+ InspectorInstrumentation::didInvalidateStyleAttr(document, element); >+ } > return; > } > >diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.h b/Source/WebCore/css/CSSMutableStyleDeclaration.h >index 717b21f..32fa239 100644 >--- a/Source/WebCore/css/CSSMutableStyleDeclaration.h >+++ b/Source/WebCore/css/CSSMutableStyleDeclaration.h >@@ -83,10 +83,6 @@ public: > const_iterator begin() { return const_iterator(this, m_properties.begin()); } > const_iterator end() { return const_iterator(this, m_properties.end()); } > >- void setElement(StyledElement* element) { m_element = element; } >- >- StyledElement* element() const { return m_element; } >- > virtual String cssText() const; > virtual void setCssText(const String&, ExceptionCode&); > >@@ -139,13 +135,11 @@ public: > > bool propertiesEqual(const CSSMutableStyleDeclaration* o) const { return m_properties == o->m_properties; } > >- bool isInlineStyleDeclaration(); >- > protected: > CSSMutableStyleDeclaration(CSSRule* parentRule); >+ CSSMutableStyleDeclaration(); > > private: >- CSSMutableStyleDeclaration(); > CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>&); > CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties); > >@@ -178,11 +172,29 @@ private: > > Vector<CSSProperty, 4> m_properties; > >- StyledElement* m_element; >- > friend class CSSMutableStyleDeclarationConstIterator; > }; > >+class CSSElementStyleDeclaration : public CSSMutableStyleDeclaration { >+public: >+ StyledElement* element() const { return m_element; } >+ void setElement(StyledElement* element) { m_element = element; } >+ >+protected: >+ CSSElementStyleDeclaration(bool isInline) >+ : CSSMutableStyleDeclaration() >+ , m_element(0) >+ { >+ m_isElementStyleDeclaration = true; >+ m_isInlineStyleDeclaration = isInline; >+ } >+ >+ virtual ~CSSElementStyleDeclaration() { } >+ >+private: >+ StyledElement* m_element; >+}; >+ > inline CSSMutableStyleDeclarationConstIterator::CSSMutableStyleDeclarationConstIterator(const CSSMutableStyleDeclaration* decl, CSSProperty* current) > : m_decl(decl) > , m_current(current) >diff --git a/Source/WebCore/css/CSSStyleDeclaration.cpp b/Source/WebCore/css/CSSStyleDeclaration.cpp >index 228bda2..84a8322 100644 >--- a/Source/WebCore/css/CSSStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSStyleDeclaration.cpp >@@ -38,12 +38,13 @@ using namespace WTF; > > namespace WebCore { > >-CSSStyleDeclaration::CSSStyleDeclaration(CSSRule* parent, bool isMutable) >+CSSStyleDeclaration::CSSStyleDeclaration(CSSRule* parent) > : m_strictParsing(!parent || parent->useStrictParsing()) > #ifndef NDEBUG > , m_iteratorCount(0) > #endif >- , m_isMutableStyleDeclaration(isMutable) >+ , m_isElementStyleDeclaration(false) >+ , m_isInlineStyleDeclaration(false) > , m_parentIsRule(true) > , m_parentRule(parent) > { >diff --git a/Source/WebCore/css/CSSStyleDeclaration.h b/Source/WebCore/css/CSSStyleDeclaration.h >index 267bacd..33edc74 100644 >--- a/Source/WebCore/css/CSSStyleDeclaration.h >+++ b/Source/WebCore/css/CSSStyleDeclaration.h >@@ -102,22 +102,28 @@ public: > void showStyle(); > #endif > >- bool isMutableStyleDeclaration() const { return m_isMutableStyleDeclaration; } >+ bool isElementStyleDeclaration() const { return m_isElementStyleDeclaration; } >+ bool isInlineStyleDeclaration() const { return m_isInlineStyleDeclaration; } > > protected: >- CSSStyleDeclaration(CSSRule* parentRule = 0, bool isMutable = false); >+ CSSStyleDeclaration(CSSRule* parentRule = 0); > > virtual bool cssPropertyMatches(const CSSProperty*) const; > >- // These bits are only used by CSSMutableStyleDeclaration but kept here >+ // The bits in this section are only used by specific subclasses but kept here > // to maximize struct packing. >+ >+ // CSSMutableStyleDeclaration bits: > bool m_strictParsing : 1; > #ifndef NDEBUG > unsigned m_iteratorCount : 4; > #endif > >+ // CSSElementStyleDeclaration bits: >+ bool m_isElementStyleDeclaration : 1; >+ bool m_isInlineStyleDeclaration : 1; >+ > private: >- bool m_isMutableStyleDeclaration : 1; > bool m_parentIsRule : 1; > union { > CSSRule* m_parentRule; >diff --git a/Source/WebCore/css/CSSStyleRule.cpp b/Source/WebCore/css/CSSStyleRule.cpp >index 3916f26..ab12cbc 100644 >--- a/Source/WebCore/css/CSSStyleRule.cpp >+++ b/Source/WebCore/css/CSSStyleRule.cpp >@@ -66,8 +66,10 @@ void CSSStyleRule::setSelectorText(const String& selectorText) > if (CSSStyleSheet* styleSheet = m_style->parentStyleSheet()) > doc = styleSheet->findDocument(); > >- if (!doc) >- doc = m_style->element() ? m_style->element()->document() : 0; >+ if (!doc && m_style->isElementStyleDeclaration()) { >+ if (StyledElement* element = static_cast<CSSElementStyleDeclaration*>(m_style.get())->element()) >+ doc = element->document(); >+ } > > if (!doc) > return; >diff --git a/Source/WebCore/dom/CSSMappedAttributeDeclaration.h b/Source/WebCore/dom/CSSMappedAttributeDeclaration.h >index 19ba5a0..d397866 100644 >--- a/Source/WebCore/dom/CSSMappedAttributeDeclaration.h >+++ b/Source/WebCore/dom/CSSMappedAttributeDeclaration.h >@@ -31,11 +31,11 @@ > > namespace WebCore { > >-class CSSMappedAttributeDeclaration : public CSSMutableStyleDeclaration { >+class CSSMappedAttributeDeclaration : public CSSElementStyleDeclaration { > public: > static PassRefPtr<CSSMappedAttributeDeclaration> create() > { >- return adoptRef(new CSSMappedAttributeDeclaration(0)); >+ return adoptRef(new CSSMappedAttributeDeclaration); > } > > virtual ~CSSMappedAttributeDeclaration(); >@@ -48,13 +48,13 @@ public: > } > > private: >- CSSMappedAttributeDeclaration(CSSRule* parentRule) >- : CSSMutableStyleDeclaration(parentRule) >+ CSSMappedAttributeDeclaration() >+ : CSSElementStyleDeclaration(/* isInline */ false) > , m_entryType(eNone) > , m_attrName(anyQName()) > { > } >- >+ > MappedAttributeEntry m_entryType; > QualifiedName m_attrName; > AtomicString m_attrValue; >diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp >index c9fe19a..7bde0e8 100644 >--- a/Source/WebCore/dom/StyledElement.cpp >+++ b/Source/WebCore/dom/StyledElement.cpp >@@ -25,7 +25,7 @@ > #include "StyledElement.h" > > #include "Attribute.h" >-#include "CSSMutableStyleDeclaration.h" >+#include "CSSInlineStyleDeclaration.h" > #include "CSSStyleSelector.h" > #include "CSSStyleSheet.h" > #include "CSSValueKeywords.h" >@@ -129,7 +129,7 @@ PassRefPtr<Attribute> StyledElement::createAttribute(const QualifiedName& name, > > void StyledElement::createInlineStyleDecl() > { >- m_inlineStyleDecl = CSSMutableStyleDeclaration::create(); >+ m_inlineStyleDecl = CSSInlineStyleDeclaration::create(); > m_inlineStyleDecl->setParentStyleSheet(document()->elementSheet()); > m_inlineStyleDecl->setElement(this); > m_inlineStyleDecl->setStrictParsing(isHTMLElement() && !document()->inQuirksMode()); >@@ -249,7 +249,7 @@ void StyledElement::parseMappedAttribute(Attribute* attr) > } > } > >-CSSMutableStyleDeclaration* StyledElement::getInlineStyleDecl() >+CSSInlineStyleDeclaration* StyledElement::getInlineStyleDecl() > { > if (!m_inlineStyleDecl) > createInlineStyleDecl(); >@@ -446,7 +446,7 @@ void StyledElement::copyNonAttributeProperties(const Element *sourceElement) > > void StyledElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const > { >- if (CSSMutableStyleDeclaration* style = inlineStyleDecl()) >+ if (CSSInlineStyleDeclaration* style = inlineStyleDecl()) > style->addSubresourceStyleURLs(urls); > } > >diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h >index 32fc4c2..8282c29 100644 >--- a/Source/WebCore/dom/StyledElement.h >+++ b/Source/WebCore/dom/StyledElement.h >@@ -25,6 +25,7 @@ > #ifndef StyledElement_h > #define StyledElement_h > >+#include "CSSInlineStyleDeclaration.h" > #include "Element.h" > #include "MappedAttributeEntry.h" > >@@ -32,7 +33,6 @@ namespace WebCore { > > class Attribute; > class CSSMappedAttributeDeclaration; >-class CSSMutableStyleDeclaration; > > class StyledElement : public Element { > public: >@@ -54,10 +54,10 @@ public: > static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*); > static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*); > >- CSSMutableStyleDeclaration* inlineStyleDecl() const { return m_inlineStyleDecl.get(); } >+ CSSInlineStyleDeclaration* inlineStyleDecl() const { return m_inlineStyleDecl.get(); } > virtual bool canHaveAdditionalAttributeStyleDecls() const { return false; } > virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&) { } >- CSSMutableStyleDeclaration* getInlineStyleDecl(); >+ CSSInlineStyleDeclaration* getInlineStyleDecl(); > CSSStyleDeclaration* style(); > void invalidateStyleAttribute(); > >@@ -93,7 +93,7 @@ private: > void destroyInlineStyleDecl(); > virtual void updateStyleAttribute() const; > >- RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl; >+ RefPtr<CSSInlineStyleDeclaration> m_inlineStyleDecl; > }; > > inline const SpaceSplitString& StyledElement::classNames() const >diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp >index ca1d275..aef34a5 100644 >--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp >+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp >@@ -442,12 +442,9 @@ void InspectorCSSAgent::getSupportedCSSProperties(ErrorString*, RefPtr<Inspector > // static > Element* InspectorCSSAgent::inlineStyleElement(CSSStyleDeclaration* style) > { >- if (!style || !style->isMutableStyleDeclaration()) >+ if (!style || !style->isInlineStyleDeclaration()) > return 0; >- CSSMutableStyleDeclaration* mutableStyle = static_cast<CSSMutableStyleDeclaration*>(style); >- if (!mutableStyle->isInlineStyleDeclaration()) >- return 0; >- return mutableStyle->element(); >+ return static_cast<CSSInlineStyleDeclaration*>(style)->element(); > } > > InspectorStyleSheetForInlineStyle* InspectorCSSAgent::asInspectorStyleSheet(Element* element)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 73121
: 116599