Changeset 121570 in webkit
- Timestamp:
- Jun 29, 2012 10:20:19 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r121569 r121570 1 2012-06-29 Andreas Kling <kling@webkit.org> 2 3 Unreviewed, rolling out r121562. 4 http://trac.webkit.org/changeset/121562 5 https://bugs.webkit.org/show_bug.cgi?id=89945 6 7 Broke a couple of editing/pasteboard tests. 8 9 * css/PropertySetCSSStyleDeclaration.cpp: 10 (WebCore::PropertySetCSSStyleDeclaration::length): 11 (WebCore::PropertySetCSSStyleDeclaration::item): 12 (WebCore::PropertySetCSSStyleDeclaration::cssText): 13 (WebCore::PropertySetCSSStyleDeclaration::setCssText): 14 (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue): 15 (WebCore::PropertySetCSSStyleDeclaration::getPropertyValue): 16 (WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority): 17 (WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand): 18 (WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit): 19 (WebCore::PropertySetCSSStyleDeclaration::setProperty): 20 (WebCore::PropertySetCSSStyleDeclaration::removeProperty): 21 (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal): 22 (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal): 23 (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal): 24 (WebCore::PropertySetCSSStyleDeclaration::copy): 25 (WebCore::PropertySetCSSStyleDeclaration::makeMutable): 26 (WebCore::PropertySetCSSStyleDeclaration::cssPropertyMatches): 27 (WebCore::InlineCSSStyleDeclaration::didMutate): 28 (WebCore::InlineCSSStyleDeclaration::parentStyleSheet): 29 * css/PropertySetCSSStyleDeclaration.h: 30 (WebCore::PropertySetCSSStyleDeclaration::clearParentElement): 31 (PropertySetCSSStyleDeclaration): 32 (WebCore::InlineCSSStyleDeclaration::InlineCSSStyleDeclaration): 33 * css/StylePropertySet.cpp: 34 (WebCore::StylePropertySet::ensureInlineCSSStyleDeclaration): 35 (WebCore::StylePropertySet::clearParentElement): 36 (WebCore): 37 * css/StylePropertySet.h: 38 (StylePropertySet): 39 * dom/ElementAttributeData.cpp: 40 (WebCore::ElementAttributeData::destroyInlineStyle): 41 (WebCore): 42 * dom/ElementAttributeData.h: 43 (ElementAttributeData): 44 * dom/StyledElement.cpp: 45 (WebCore::StyledElement::~StyledElement): 46 (WebCore): 47 (WebCore::StyledElement::styleAttributeChanged): 48 * dom/StyledElement.h: 49 (StyledElement): 50 (WebCore::StyledElement::destroyInlineStyle): 51 1 52 2012-06-29 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> 2 53 -
trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
r121562 r121570 133 133 unsigned PropertySetCSSStyleDeclaration::length() const 134 134 { 135 return propertySet()->propertyCount();135 return m_propertySet->propertyCount(); 136 136 } 137 137 138 138 String PropertySetCSSStyleDeclaration::item(unsigned i) const 139 139 { 140 if (i >= propertySet()->propertyCount())140 if (i >= m_propertySet->propertyCount()) 141 141 return ""; 142 return getPropertyName( propertySet()->propertyAt(i).id());142 return getPropertyName(m_propertySet->propertyAt(i).id()); 143 143 } 144 144 145 145 String PropertySetCSSStyleDeclaration::cssText() const 146 146 { 147 return propertySet()->asText();147 return m_propertySet->asText(); 148 148 } 149 149 … … 157 157 ec = 0; 158 158 // FIXME: Detect syntax errors and set ec. 159 ensureMutablePropertySet()->parseDeclaration(text, contextStyleSheet());159 m_propertySet->parseDeclaration(text, contextStyleSheet()); 160 160 161 161 didMutate(PropertyChanged); … … 171 171 if (!propertyID) 172 172 return 0; 173 return cloneAndCacheForCSSOM( propertySet()->getPropertyCSSValue(propertyID).get());173 return cloneAndCacheForCSSOM(m_propertySet->getPropertyCSSValue(propertyID).get()); 174 174 } 175 175 … … 179 179 if (!propertyID) 180 180 return String(); 181 return propertySet()->getPropertyValue(propertyID);181 return m_propertySet->getPropertyValue(propertyID); 182 182 } 183 183 … … 187 187 if (!propertyID) 188 188 return String(); 189 return propertySet()->propertyIsImportant(propertyID) ? "important" : "";189 return m_propertySet->propertyIsImportant(propertyID) ? "important" : ""; 190 190 } 191 191 … … 195 195 if (!propertyID) 196 196 return String(); 197 CSSPropertyID shorthandID = propertySet()->getPropertyShorthand(propertyID);197 CSSPropertyID shorthandID = m_propertySet->getPropertyShorthand(propertyID); 198 198 if (!shorthandID) 199 199 return String(); … … 206 206 if (!propertyID) 207 207 return false; 208 return propertySet()->isPropertyImplicit(propertyID);208 return m_propertySet->isPropertyImplicit(propertyID); 209 209 } 210 210 … … 223 223 224 224 ec = 0; 225 bool changed = ensureMutablePropertySet()->setProperty(propertyID, value, important, contextStyleSheet());225 bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet()); 226 226 227 227 didMutate(changed ? PropertyChanged : NoChanges); … … 249 249 ec = 0; 250 250 String result; 251 bool changed = ensureMutablePropertySet()->removeProperty(propertyID, &result);251 bool changed = m_propertySet->removeProperty(propertyID, &result); 252 252 253 253 didMutate(changed ? PropertyChanged : NoChanges); … … 263 263 PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID) 264 264 { 265 return propertySet()->getPropertyCSSValue(propertyID);265 return m_propertySet->getPropertyCSSValue(propertyID); 266 266 } 267 267 268 268 String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID) 269 269 { 270 return propertySet()->getPropertyValue(propertyID);270 return m_propertySet->getPropertyValue(propertyID); 271 271 } 272 272 … … 279 279 280 280 ec = 0; 281 bool changed = ensureMutablePropertySet()->setProperty(propertyID, value, important, contextStyleSheet());281 bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet()); 282 282 283 283 didMutate(changed ? PropertyChanged : NoChanges); … … 314 314 PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::copy() const 315 315 { 316 return propertySet()->copy();316 return m_propertySet->copy(); 317 317 } 318 318 319 319 PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::makeMutable() 320 320 { 321 return ensureMutablePropertySet();321 return m_propertySet; 322 322 } 323 323 324 324 bool PropertySetCSSStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const 325 325 { 326 return propertySet()->propertyMatches(property);326 return m_propertySet->propertyMatches(property); 327 327 } 328 328 … … 381 381 } 382 382 383 InlineCSSStyleDeclaration::InlineCSSStyleDeclaration(StyledElement* parentElement)384 : PropertySetCSSStyleDeclaration(const_cast<StylePropertySet*>(parentElement->inlineStyle()))385 , m_parentElement(parentElement)386 {387 }388 389 void InlineCSSStyleDeclaration::ref()390 {391 m_parentElement->ref();392 }393 394 void InlineCSSStyleDeclaration::deref()395 {396 m_parentElement->deref();397 }398 399 383 void InlineCSSStyleDeclaration::didMutate(MutationType type) 400 384 { … … 404 388 m_cssomCSSValueClones.clear(); 405 389 390 if (!m_parentElement) 391 return; 406 392 m_parentElement->setNeedsStyleRecalc(InlineStyleChange); 407 393 m_parentElement->invalidateStyleAttribute(); … … 411 397 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const 412 398 { 413 return m_parentElement->document()->elementSheet(); 414 } 415 416 StylePropertySet* InlineCSSStyleDeclaration::ensureMutablePropertySet() 417 { 418 ASSERT(m_propertySet); 419 ASSERT(m_propertySet == m_parentElement->inlineStyle()); 420 return m_propertySet; 399 return m_parentElement ? m_parentElement->document()->elementSheet() : 0; 421 400 } 422 401 -
trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h
r121562 r121570 43 43 44 44 virtual StyledElement* parentElement() const { return 0; } 45 virtual void clearParentElement() { ASSERT_NOT_REACHED(); } 45 46 StyleSheetContents* contextStyleSheet() const; 46 47 47 48 virtual void ref() OVERRIDE; 48 49 virtual void deref() OVERRIDE; 49 50 protected:51 const StylePropertySet* propertySet() const { return m_propertySet; }52 virtual StylePropertySet* ensureMutablePropertySet() { return m_propertySet; }53 50 54 51 private: … … 110 107 virtual void didMutate(MutationType) OVERRIDE; 111 108 112 virtual StylePropertySet* ensureMutablePropertySet() OVERRIDE { return m_propertySet; }113 114 109 unsigned m_refCount; 115 110 CSSRule* m_parentRule; … … 119 114 { 120 115 public: 121 InlineCSSStyleDeclaration(StyledElement*); 122 123 virtual void ref() OVERRIDE; 124 virtual void deref() OVERRIDE; 116 InlineCSSStyleDeclaration(StylePropertySet* propertySet, StyledElement* parentElement) 117 : PropertySetCSSStyleDeclaration(propertySet) 118 , m_parentElement(parentElement) 119 { 120 } 125 121 126 122 private: 127 123 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; 128 124 virtual StyledElement* parentElement() const OVERRIDE { return m_parentElement; } 125 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } 129 126 130 127 virtual void didMutate(MutationType) OVERRIDE; 131 132 virtual StylePropertySet* ensureMutablePropertySet() OVERRIDE;133 128 134 129 StyledElement* m_parentElement; -
trunk/Source/WebCore/css/StylePropertySet.cpp
r121562 r121570 1052 1052 } 1053 1053 m_ownsCSSOMWrapper = true; 1054 PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(const_cast<Style dElement*>(parentElement));1054 PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(const_cast<StylePropertySet*>(this), const_cast<StyledElement*>(parentElement)); 1055 1055 propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper)); 1056 1056 return cssomWrapper; 1057 } 1058 1059 void StylePropertySet::clearParentElement(StyledElement* element) 1060 { 1061 if (!m_ownsCSSOMWrapper) 1062 return; 1063 ASSERT_UNUSED(element, propertySetCSSOMWrapperMap().get(this)->parentElement() == element); 1064 propertySetCSSOMWrapperMap().get(this)->clearParentElement(); 1057 1065 } 1058 1066 -
trunk/Source/WebCore/css/StylePropertySet.h
r121562 r121570 104 104 String asText() const; 105 105 106 void clearParentElement(StyledElement*); 107 106 108 CSSStyleDeclaration* ensureCSSStyleDeclaration() const; 107 109 CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(const StyledElement* parentElement) const; -
trunk/Source/WebCore/dom/ElementAttributeData.cpp
r121562 r121570 162 162 } 163 163 164 void ElementAttributeData::destroyInlineStyle(StyledElement* element) 165 { 166 if (!m_inlineStyleDecl) 167 return; 168 m_inlineStyleDecl->clearParentElement(element); 169 m_inlineStyleDecl = 0; 170 } 171 164 172 void ElementAttributeData::addAttribute(const Attribute& attribute, Element* element, EInUpdateStyleAttribute inUpdateStyleAttribute) 165 173 { -
trunk/Source/WebCore/dom/ElementAttributeData.h
r121562 r121570 68 68 StylePropertySet* ensureMutableInlineStyle(StyledElement*); 69 69 void updateInlineStyleAvoidingMutation(StyledElement*, const String& text); 70 void destroyInlineStyle(StyledElement*); 70 71 71 72 StylePropertySet* attributeStyle() const { return m_attributeStyle.get(); } -
trunk/Source/WebCore/dom/StyledElement.cpp
r121562 r121570 136 136 } 137 137 138 StyledElement::~StyledElement() 139 { 140 destroyInlineStyle(); 141 } 142 138 143 CSSStyleDeclaration* StyledElement::style() 139 144 { … … 179 184 if (document() && document()->scriptableDocumentParser() && !document()->isInDocumentWrite()) 180 185 startLineNumber = document()->scriptableDocumentParser()->lineNumber(); 181 if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber)) 186 if (newStyleString.isNull()) 187 destroyInlineStyle(); 188 else if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber)) 182 189 ensureAttributeData()->updateInlineStyleAvoidingMutation(this, newStyleString); 183 190 setIsStyleAttributeValid(); -
trunk/Source/WebCore/dom/StyledElement.h
r121562 r121570 36 36 class StyledElement : public Element { 37 37 public: 38 virtual ~StyledElement() { }38 virtual ~StyledElement(); 39 39 40 40 virtual StylePropertySet* additionalAttributeStyle() { return 0; } … … 87 87 void makePresentationAttributeCacheKey(PresentationAttributeCacheKey&) const; 88 88 void updateAttributeStyle(); 89 90 void destroyInlineStyle() 91 { 92 if (attributeData()) 93 attributeData()->destroyInlineStyle(this); 94 } 89 95 }; 90 96
Note: See TracChangeset
for help on using the changeset viewer.