Changeset 81185 in webkit
- Timestamp:
- Mar 15, 2011 3:37:47 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r81184 r81185 1 2011-03-15 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Tony Chang. 4 5 Crash in ReplaceSelectionCommand::doApply when inserting a node under a document node 6 https://bugs.webkit.org/show_bug.cgi?id=56372 7 8 Added a test to ensure WebKit does not crash when appending a node to a document 9 that has only two nested iframes. 10 11 * editing/execCommand/append-node-under-document-expected.txt: Added. 12 * editing/execCommand/append-node-under-document.html: Added. 13 1 14 2011-03-15 David Levin <levin@chromium.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r81181 r81185 1 2011-03-15 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Tony Chang. 4 5 Crash in ReplaceSelectionCommand::doApply when inserting a node under a document node 6 https://bugs.webkit.org/show_bug.cgi?id=56372 7 8 The bug was caused by insertNodeAfter's calling parentElement on document's child. 9 Fixed this by changing the node that AppendNodeCommand takes. 10 11 There was also a bug that document node always returned false for isContentEditable 12 and isContentRichlyEditable because they never overrode Node's default implementation. 13 Fixed this by overriding them in Document. 14 15 Test: editing/execCommand/append-node-under-document.html 16 17 * dom/Document.cpp: 18 (WebCore::Document::isContentEditable): Added. 19 (WebCore::Document::isContentRichlyEditable): Added. 20 * dom/Document.h: 21 * editing/AppendNodeCommand.cpp: 22 (WebCore::AppendNodeCommand::AppendNodeCommand): Takes ContainerNode instead of Element. 23 * editing/AppendNodeCommand.h: 24 (WebCore::AppendNodeCommand::create): Ditto. 25 * editing/CompositeEditCommand.cpp: 26 (WebCore::CompositeEditCommand::appendNode): Ditto. 27 (WebCore::CompositeEditCommand::insertNodeAfter): Calls parentNode instead of parentElement. 28 * editing/CompositeEditCommand.h: 29 1 30 2011-03-15 David Grogan <dgrogan@chromium.org> 2 31 -
trunk/Source/WebCore/dom/Document.cpp
r81038 r81185 4118 4118 } 4119 4119 4120 bool Document::isContentEditable() const 4121 { 4122 if (inDesignMode()) 4123 return true; 4124 4125 return renderer() && (renderer()->style()->userModify() == READ_WRITE || renderer()->style()->userModify() == READ_WRITE_PLAINTEXT_ONLY); 4126 } 4127 4128 bool Document::isContentRichlyEditable() const 4129 { 4130 if (inDesignMode()) 4131 return true; 4132 4133 return renderer() && renderer()->style()->userModify() == READ_WRITE; 4134 } 4135 4120 4136 Document* Document::parentDocument() const 4121 4137 { -
trunk/Source/WebCore/dom/Document.h
r81038 r81185 895 895 InheritedBool getDesignMode() const; 896 896 bool inDesignMode() const; 897 virtual bool isContentEditable() const; 898 virtual bool isContentRichlyEditable() const; 897 899 898 900 Document* parentDocument() const; -
trunk/Source/WebCore/editing/AppendNodeCommand.cpp
r72259 r81185 32 32 namespace WebCore { 33 33 34 AppendNodeCommand::AppendNodeCommand(PassRefPtr< Element> parent, PassRefPtr<Node> node)34 AppendNodeCommand::AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node) 35 35 : SimpleEditCommand(parent->document()) 36 36 , m_parent(parent) -
trunk/Source/WebCore/editing/AppendNodeCommand.h
r39456 r81185 33 33 class AppendNodeCommand : public SimpleEditCommand { 34 34 public: 35 static PassRefPtr<AppendNodeCommand> create(PassRefPtr< Element> parent, PassRefPtr<Node> node)35 static PassRefPtr<AppendNodeCommand> create(PassRefPtr<ContainerNode> parent, PassRefPtr<Node> node) 36 36 { 37 37 return adoptRef(new AppendNodeCommand(parent, node)); … … 39 39 40 40 private: 41 AppendNodeCommand(PassRefPtr< Element> parent, PassRefPtr<Node> node);41 AppendNodeCommand(PassRefPtr<ContainerNode> parent, PassRefPtr<Node>); 42 42 43 43 virtual void doApply(); 44 44 virtual void doUnapply(); 45 45 46 RefPtr< Element> m_parent;46 RefPtr<ContainerNode> m_parent; 47 47 RefPtr<Node> m_node; 48 48 }; -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r81165 r81185 145 145 ASSERT(refChild); 146 146 ASSERT(!refChild->hasTagName(bodyTag)); 147 Element* parent = refChild->parentElement();147 ContainerNode* parent = refChild->parentNode(); 148 148 ASSERT(parent); 149 149 if (parent->lastChild() == refChild) … … 185 185 } 186 186 187 void CompositeEditCommand::appendNode(PassRefPtr<Node> node, PassRefPtr< Element> parent)187 void CompositeEditCommand::appendNode(PassRefPtr<Node> node, PassRefPtr<ContainerNode> parent) 188 188 { 189 189 ASSERT(canHaveChildrenForEditing(parent.get())); -
trunk/Source/WebCore/editing/CompositeEditCommand.h
r80780 r81185 50 50 // sugary-sweet convenience functions to help create and apply edit commands in composite commands 51 51 // 52 void appendNode(PassRefPtr<Node>, PassRefPtr< Element> parent);52 void appendNode(PassRefPtr<Node>, PassRefPtr<ContainerNode> parent); 53 53 void applyCommandToComposite(PassRefPtr<EditCommand>); 54 54 void applyStyle(const EditingStyle*, EditAction = EditActionChangeAttributes);
Note: See TracChangeset
for help on using the changeset viewer.