Changeset 65014 in webkit
- Timestamp:
- Aug 9, 2010 4:25:15 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r65006 r65014 1 2010-08-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Justin Garcia. 4 5 Undo fails in RemoveCSSPropertyCommand when the corresponding style attribute is removed 6 https://bugs.webkit.org/show_bug.cgi?id=43639 7 8 Added a test to remove style attribute after removing a CSS property from the style. 9 Undo should restore both style attribute and the removed CSS property. 10 11 * editing/undo/remove-css-property-and-remove-style-expected.txt: Added. 12 * editing/undo/remove-css-property-and-remove-style.html: Added. 13 1 14 2010-08-09 Eric Seidel <eric@webkit.org> 2 15 -
trunk/WebCore/ChangeLog
r65013 r65014 1 2010-08-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Justin Garcia. 4 5 Undo fails in RemoveCSSPropertyCommand when the corresponding style attribute is removed 6 https://bugs.webkit.org/show_bug.cgi?id=43639 7 8 The bug was caused when RemoveCSSPropertyCommand is called with CSSMutableStyleDeclaration of some styled element, 9 and the style attribute of the element is removed subsequently. When the attribute removal is undone, new instance of 10 CSSMutableStyleDeclaration is created and RemoveCSSPropertyCommand's m_style became detached from the element. 11 12 Modified RemoveCSSPropertyCommand to store the styled element directly instead of its CSSMutableStyleDeclaration. 13 14 Test: editing/undo/remove-css-property-and-remove-style.html 15 16 * WebCore.order: 17 * editing/ApplyStyleCommand.cpp: 18 (WebCore::ApplyStyleCommand::removeCSSStyle): Calls removeCSSProperty. 19 (WebCore::ApplyStyleCommand::extractTextDecorationStyle): Calls removeCSSProperty. 20 * editing/CompositeEditCommand.cpp: 21 (WebCore::CompositeEditCommand::removeCSSProperty): Takes StyledElement instead of CSSMutableStyleDeclaration. 22 * editing/CompositeEditCommand.h: 23 * editing/RemoveCSSPropertyCommand.cpp: 24 (WebCore::RemoveCSSPropertyCommand::RemoveCSSPropertyCommand): Takes StyledElement instead of CSSMutableStyleDeclaration. 25 (WebCore::RemoveCSSPropertyCommand::doApply): See above. 26 (WebCore::RemoveCSSPropertyCommand::doUnapply): See above. 27 * editing/RemoveCSSPropertyCommand.h: 28 (WebCore::RemoveCSSPropertyCommand::create): See above. 29 1 30 2010-08-09 Ryosuke Niwa <rniwa@webkit.org> 2 31 -
trunk/WebCore/WebCore.order
r63888 r65014 17636 17636 __ZN7WebCore17ApplyStyleCommandC1EPNS_8DocumentEPNS_19CSSStyleDeclarationERKNS_8PositionES7_NS_10EditActionENS0_14EPropertyLeve 17637 17637 __ZN7WebCore17ApplyStyleCommandC2EPNS_8DocumentEPNS_19CSSStyleDeclarationERKNS_8PositionES7_NS_10EditActionENS0_14EPropertyLeve 17638 __ZN7WebCore20CompositeEditCommand17removeCSSPropertyEN3WTF10PassRefPtrINS_ 26CSSMutableStyleDeclarationEEE13CSSPropertyID17639 __ZN7WebCore24RemoveCSSPropertyCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_ 26CSSMutableStyleDeclarationEEE13CSSPropertyID17640 __ZN7WebCore24RemoveCSSPropertyCommandC2EPNS_8DocumentEN3WTF10PassRefPtrINS_ 26CSSMutableStyleDeclarationEEE13CSSPropertyID17638 __ZN7WebCore20CompositeEditCommand17removeCSSPropertyEN3WTF10PassRefPtrINS_13StyledElementEEE13CSSPropertyID 17639 __ZN7WebCore24RemoveCSSPropertyCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_13StyledElementEEE13CSSPropertyID 17640 __ZN7WebCore24RemoveCSSPropertyCommandC2EPNS_8DocumentEN3WTF10PassRefPtrINS_13StyledElementEEE13CSSPropertyID 17641 17641 __ZN7WebCore24RemoveCSSPropertyCommand7doApplyEv 17642 17642 __ZN7WebCore20CompositeEditCommand19removeNodeAttributeEN3WTF10PassRefPtrINS_7ElementEEERKNS_13QualifiedNameE -
trunk/WebCore/editing/ApplyStyleCommand.cpp
r65013 r65014 1292 1292 if (mode == RemoveNone) 1293 1293 return true; 1294 removeCSSProperty( decl, propertyID);1294 removeCSSProperty(elem, propertyID); 1295 1295 if (propertyID == CSSPropertyUnicodeBidi && !decl->getPropertyValue(CSSPropertyDirection).isEmpty()) 1296 removeCSSProperty( decl, CSSPropertyDirection);1296 removeCSSProperty(elem, CSSPropertyDirection); 1297 1297 } 1298 1298 } … … 1354 1354 RefPtr<CSSValue> property = style->getPropertyCSSValue(CSSPropertyTextDecoration); 1355 1355 if (property && !equalIgnoringCase(property->cssText(), "none")) 1356 removeCSSProperty( style.get(), CSSPropertyTextDecoration);1356 removeCSSProperty(element, CSSPropertyTextDecoration); 1357 1357 1358 1358 return textDecorationStyle.release(); -
trunk/WebCore/editing/CompositeEditCommand.cpp
r64056 r65014 371 371 } 372 372 373 void CompositeEditCommand::removeCSSProperty(PassRefPtr< CSSMutableStyleDeclaration> style, CSSPropertyID property)374 { 375 applyCommandToComposite(RemoveCSSPropertyCommand::create(document(), style, property));373 void CompositeEditCommand::removeCSSProperty(PassRefPtr<StyledElement> element, CSSPropertyID property) 374 { 375 applyCommandToComposite(RemoveCSSPropertyCommand::create(document(), element, property)); 376 376 } 377 377 -
trunk/WebCore/editing/CompositeEditCommand.h
r49985 r65014 35 35 class CSSStyleDeclaration; 36 36 class HTMLElement; 37 class StyledElement; 37 38 class Text; 38 39 … … 69 70 void rebalanceWhitespaceAt(const Position&); 70 71 void prepareWhitespaceAtPositionForSplit(Position&); 71 void removeCSSProperty(PassRefPtr< CSSMutableStyleDeclaration>, CSSPropertyID);72 void removeCSSProperty(PassRefPtr<StyledElement>, CSSPropertyID); 72 73 void removeNodeAttribute(PassRefPtr<Element>, const QualifiedName& attribute); 73 74 void removeChildrenInRange(PassRefPtr<Node>, unsigned from, unsigned to); -
trunk/WebCore/editing/RemoveCSSPropertyCommand.cpp
r39456 r65014 32 32 namespace WebCore { 33 33 34 RemoveCSSPropertyCommand::RemoveCSSPropertyCommand(Document* document, PassRefPtr< CSSMutableStyleDeclaration> style, CSSPropertyID property)34 RemoveCSSPropertyCommand::RemoveCSSPropertyCommand(Document* document, PassRefPtr<StyledElement> element, CSSPropertyID property) 35 35 : SimpleEditCommand(document) 36 , m_ style(style)36 , m_element(element) 37 37 , m_property(property) 38 38 , m_important(false) 39 39 { 40 ASSERT(m_ style);40 ASSERT(m_element); 41 41 } 42 42 43 43 void RemoveCSSPropertyCommand::doApply() 44 44 { 45 m_oldValue = m_style->getPropertyValue(m_property); 46 m_important = m_style->getPropertyPriority(m_property); 47 m_style->removeProperty(m_property); 45 CSSMutableStyleDeclaration* style = m_element->inlineStyleDecl(); 46 m_oldValue = style->getPropertyValue(m_property); 47 m_important = style->getPropertyPriority(m_property); 48 style->removeProperty(m_property); 48 49 } 49 50 50 51 void RemoveCSSPropertyCommand::doUnapply() 51 52 { 52 m_style->setProperty(m_property, m_oldValue, m_important); 53 CSSMutableStyleDeclaration* style = m_element->inlineStyleDecl(); 54 style->setProperty(m_property, m_oldValue, m_important); 53 55 } 54 56 -
trunk/WebCore/editing/RemoveCSSPropertyCommand.h
r43523 r65014 30 30 #include "CSSMutableStyleDeclaration.h" 31 31 #include "CSSPropertyNames.h" 32 #include "StyledElement.h" 32 33 33 34 namespace WebCore { … … 35 36 class RemoveCSSPropertyCommand : public SimpleEditCommand { 36 37 public: 37 static PassRefPtr<RemoveCSSPropertyCommand> create(Document* document, PassRefPtr< CSSMutableStyleDeclaration> style, CSSPropertyID property)38 static PassRefPtr<RemoveCSSPropertyCommand> create(Document* document, PassRefPtr<StyledElement> element, CSSPropertyID property) 38 39 { 39 return adoptRef(new RemoveCSSPropertyCommand(document, style, property));40 return adoptRef(new RemoveCSSPropertyCommand(document, element, property)); 40 41 } 41 42 42 43 private: 43 RemoveCSSPropertyCommand(Document*, PassRefPtr< CSSMutableStyleDeclaration>, CSSPropertyID property);44 RemoveCSSPropertyCommand(Document*, PassRefPtr<StyledElement>, CSSPropertyID property); 44 45 45 46 virtual void doApply(); 46 47 virtual void doUnapply(); 47 48 48 RefPtr< CSSMutableStyleDeclaration> m_style;49 RefPtr<StyledElement> m_element; 49 50 CSSPropertyID m_property; 50 51 String m_oldValue;
Note: See TracChangeset
for help on using the changeset viewer.