Changeset 284792 in webkit
- Timestamp:
- Oct 25, 2021, 10:48:24 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/editing/apply-relative-font-style-change-crash-003-expected.txt (added)
-
LayoutTests/fast/editing/apply-relative-font-style-change-crash-003.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/editing/ApplyStyleCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/CompositeEditCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/CompositeEditCommand.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r284790 r284792 1 2021-10-25 Gabriel Nava Marino <gnavamarino@apple.com> 2 3 ASSERT(node) triggered after surroundNodeRangeWithElement for node without editable style 4 https://bugs.webkit.org/show_bug.cgi?id=232133 5 6 Reviewed by Wenson Hsieh. 7 8 * fast/editing/apply-relative-font-style-change-crash-003-expected.txt: Added. 9 * fast/editing/apply-relative-font-style-change-crash-003.html: Added. 10 1 11 2021-10-25 Ayumi Kojima <ayumi_kojima@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r284789 r284792 1 2021-10-25 Gabriel Nava Marino <gnavamarino@apple.com> 2 3 ASSERT(node) triggered after surroundNodeRangeWithElement for node without editable style 4 https://bugs.webkit.org/show_bug.cgi?id=232133 5 6 Reviewed by Wenson Hsieh. 7 8 If the last styled node was not parent node of a current text node, but we 9 wish to style the text node, we will add a style span to surround the text node. 10 However, this requires the parent to have an editable style, or 11 we will not properly insert the span in the right location, which 12 later leads to a traversal into an invalid node. This change 13 makes it so we return early if the parent node does not have an 14 editable style, but modifying the existing 15 CompositeEditCommand::insertNodeBefore to return a boolean in the 16 early return case. 17 18 Test: fast/editing/apply-relative-font-style-change-crash-003.html 19 20 * editing/ApplyStyleCommand.cpp: 21 (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement): 22 * editing/CompositeEditCommand.cpp: 23 (WebCore::CompositeEditCommand::insertNodeBefore): 24 * editing/CompositeEditCommand.h: 25 1 26 2021-10-25 Darin Adler <darin@apple.com> 2 27 -
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r284739 r284792 1320 1320 Ref<Element> element = WTFMove(elementToInsert); 1321 1321 1322 insertNodeBefore(element.copyRef(), startNode); 1323 if (!element->isContentRichlyEditable()) { 1322 if (!insertNodeBefore(element.copyRef(), startNode) || !element->isContentRichlyEditable()) { 1324 1323 removeNode(element); 1325 1324 return false; -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r284269 r284792 553 553 } 554 554 555 voidCompositeEditCommand::insertNodeBefore(Ref<Node>&& insertChild, Node& refChild, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)555 bool CompositeEditCommand::insertNodeBefore(Ref<Node>&& insertChild, Node& refChild, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable) 556 556 { 557 557 RefPtr parent { refChild.parentNode() }; 558 558 if (!parent || (!parent->hasEditableStyle() && parent->renderer())) 559 return ;559 return false; 560 560 applyCommandToComposite(InsertNodeBeforeCommand::create(WTFMove(insertChild), refChild, shouldAssumeContentIsAlwaysEditable, editingAction())); 561 return true; 561 562 } 562 563 -
trunk/Source/WebCore/editing/CompositeEditCommand.h
r281795 r284792 155 155 void insertNodeAt(Ref<Node>&&, const Position&); 156 156 void insertNodeAtTabSpanPosition(Ref<Node>&&, const Position&); 157 voidinsertNodeBefore(Ref<Node>&&, Node& refChild, ShouldAssumeContentIsAlwaysEditable = DoNotAssumeContentIsAlwaysEditable);157 bool insertNodeBefore(Ref<Node>&&, Node& refChild, ShouldAssumeContentIsAlwaysEditable = DoNotAssumeContentIsAlwaysEditable); 158 158 void insertParagraphSeparatorAtPosition(const Position&, bool useDefaultParagraphElement = false, bool pasteBlockqutoeIntoUnquotedArea = false); 159 159 void insertParagraphSeparator(bool useDefaultParagraphElement = false, bool pasteBlockqutoeIntoUnquotedArea = false);
Note:
See TracChangeset
for help on using the changeset viewer.