Changeset 201823 in webkit
- Timestamp:
- Jun 8, 2016, 12:19:22 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/editing/selection/selection-in-iframe-removed-crash-expected.txt (modified) (1 diff)
-
LayoutTests/editing/selection/selection-in-iframe-removed-crash.html (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/editing/EditorCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/FrameSelection.cpp (modified) (1 diff)
-
Source/WebCore/editing/InsertLineBreakCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/InsertListCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/InsertTextCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/RemoveFormatCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/ReplaceSelectionCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/SetSelectionCommand.cpp (modified) (2 diffs)
-
Source/WebCore/editing/TypingCommand.cpp (modified) (1 diff)
-
Source/WebCore/editing/VisibleSelection.cpp (modified) (3 diffs)
-
Source/WebCore/editing/VisibleSelection.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201820 r201823 1 2016-06-07 Ryosuke Niwa <rniwa@webkit.org> 2 3 REGRESSION (r201667): ASSERTION FAILED: !m_anchorNode || !editingIgnoresContent(*m_anchorNode) 4 https://bugs.webkit.org/show_bug.cgi?id=158373 5 6 Reviewed by Brent Fulgham. 7 8 Fixed a test so that the assertion failure happens within the test instead of affecting the subsequent test. 9 10 * editing/selection/selection-in-iframe-removed-crash-expected.txt: 11 * editing/selection/selection-in-iframe-removed-crash.html: 12 1 13 2016-06-08 Ryan Haddad <ryanhaddad@apple.com> 2 14 -
trunk/LayoutTests/editing/selection/selection-in-iframe-removed-crash-expected.txt
r144400 r201823 1 Test passes if it does not crash. 1 Test passes if it does not crash. -
trunk/LayoutTests/editing/selection/selection-in-iframe-removed-crash.html
r144400 r201823 3 3 Test passes if it does not crash. 4 4 <script> 5 if (window.testRunner) 5 if (window.testRunner) { 6 6 testRunner.dumpAsText(); 7 testRunner.waitUntilDone(); 8 } 7 9 8 10 var docElement = document.documentElement; … … 22 24 range1.selectNodeContents(iframe1.contentDocument); 23 25 window.getSelection().addRange(range1); 26 if (window.testRunner) 27 testRunner.notifyDone(); 24 28 } 25 29 -
trunk/Source/WebCore/ChangeLog
r201818 r201823 1 2016-06-07 Ryosuke Niwa <rniwa@webkit.org> 2 3 REGRESSION (r201667): ASSERTION FAILED: !m_anchorNode || !editingIgnoresContent(*m_anchorNode) 4 https://bugs.webkit.org/show_bug.cgi?id=158373 5 <rdar://problem/26690795> 6 7 Reviewed by Brent Fulgham. 8 9 The bug was caused by VisibleSelection::toNormalizedRange calling parentAnchoredEquivalent on an orphaned Position. 10 Fixed it by checking that condition and exiting early since we can't create a Range with a detached node anyway. 11 12 Also renamed isNonOrphanedCaretOrRange to isNoneOrOrphaned after negating the semantics for clarity. 13 14 Test: editing/selection/selection-in-iframe-removed-crash.html 15 16 * editing/EditorCommand.cpp: 17 (WebCore::valueFormatBlock): 18 * editing/FrameSelection.cpp: 19 (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): 20 * editing/InsertLineBreakCommand.cpp: 21 (WebCore::InsertLineBreakCommand::doApply): 22 * editing/InsertListCommand.cpp: 23 (WebCore::InsertListCommand::doApply): 24 * editing/InsertParagraphSeparatorCommand.cpp: 25 (WebCore::InsertParagraphSeparatorCommand::doApply): 26 * editing/InsertTextCommand.cpp: 27 (WebCore::InsertTextCommand::doApply): 28 * editing/RemoveFormatCommand.cpp: 29 (WebCore::RemoveFormatCommand::doApply): 30 * editing/ReplaceSelectionCommand.cpp: 31 (WebCore::ReplaceSelectionCommand::doApply): 32 * editing/SetSelectionCommand.cpp: 33 (WebCore::SetSelectionCommand::doApply): 34 (WebCore::SetSelectionCommand::doUnapply): 35 * editing/TypingCommand.cpp: 36 (WebCore::TypingCommand::doApply): 37 * editing/VisibleSelection.cpp: 38 (WebCore::VisibleSelection::firstRange): Also added a check for isNoneOrOrphaned since this function can hit the same 39 assertion when the selection end points are orphaned. 40 (WebCore::VisibleSelection::toNormalizedRange): Fixed the bug. 41 * editing/VisibleSelection.h: 42 (WebCore::VisibleSelection::isNoneOrOrphaned): Renamed from isNonOrphanedCaretOrRange and negated the semantics. 43 1 44 2016-06-08 Dean Jackson <dino@apple.com> 2 45 -
trunk/Source/WebCore/editing/EditorCommand.cpp
r200696 r201823 1485 1485 { 1486 1486 const VisibleSelection& selection = frame.selection().selection(); 1487 if ( !selection.isNonOrphanedCaretOrRange() || !selection.isContentEditable())1487 if (selection.isNoneOrOrphaned() || !selection.isContentEditable()) 1488 1488 return emptyString(); 1489 1489 Element* formatBlockElement = FormatBlockCommand::elementForFormatBlockCommand(selection.firstRange().get()); -
trunk/Source/WebCore/editing/FrameSelection.cpp
r201205 r201823 291 291 // selectFrameElementInParentIfFullySelected, but that the selection is no longer valid since 292 292 // the frame is about to be destroyed. If this is the case, clear our selection. 293 if (newSelectionFrame->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange())293 if (newSelectionFrame->hasOneRef() && m_selection.isNoneOrOrphaned()) 294 294 clear(); 295 295 return false; -
trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp
r200922 r201823 92 92 deleteSelection(); 93 93 VisibleSelection selection = endingSelection(); 94 if ( !selection.isNonOrphanedCaretOrRange())94 if (selection.isNoneOrOrphaned()) 95 95 return; 96 96 -
trunk/Source/WebCore/editing/InsertListCommand.cpp
r200922 r201823 113 113 void InsertListCommand::doApply() 114 114 { 115 if ( !endingSelection().isNonOrphanedCaretOrRange())115 if (endingSelection().isNoneOrOrphaned() || !endingSelection().isContentRichlyEditable()) 116 116 return; 117 117 118 if (!endingSelection().rootEditableElement())119 return;120 121 118 VisiblePosition visibleEnd = endingSelection().visibleEnd(); 122 119 VisiblePosition visibleStart = endingSelection().visibleStart(); -
trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp
r200931 r201823 149 149 void InsertParagraphSeparatorCommand::doApply() 150 150 { 151 if ( !endingSelection().isNonOrphanedCaretOrRange())151 if (endingSelection().isNoneOrOrphaned()) 152 152 return; 153 153 -
trunk/Source/WebCore/editing/InsertTextCommand.cpp
r200922 r201823 133 133 ASSERT(m_text.find('\n') == notFound); 134 134 135 if ( !endingSelection().isNonOrphanedCaretOrRange())135 if (endingSelection().isNoneOrOrphaned()) 136 136 return; 137 137 -
trunk/Source/WebCore/editing/RemoveFormatCommand.cpp
r166294 r201823 79 79 void RemoveFormatCommand::doApply() 80 80 { 81 if ( !endingSelection().isNonOrphanedCaretOrRange())81 if (endingSelection().isNoneOrOrphaned()) 82 82 return; 83 83 -
trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp
r201205 r201823 915 915 ASSERT(selection.isCaretOrRange()); 916 916 ASSERT(selection.start().deprecatedNode()); 917 if (!selection.isNonOrphanedCaretOrRange() || !selection.start().deprecatedNode()) 918 return; 919 920 if (!selection.rootEditableElement()) 917 if (selection.isNoneOrOrphaned() || !selection.start().deprecatedNode() || !selection.isContentEditable()) 921 918 return; 922 919 -
trunk/Source/WebCore/editing/SetSelectionCommand.cpp
r165676 r201823 43 43 FrameSelection& selection = frame().selection(); 44 44 45 if (selection.shouldChangeSelection(m_selectionToSet) && m_selectionToSet.isNonOrphanedCaretOrRange()) {45 if (selection.shouldChangeSelection(m_selectionToSet) && !m_selectionToSet.isNoneOrOrphaned()) { 46 46 selection.setSelection(m_selectionToSet, m_options); 47 47 setEndingSelection(m_selectionToSet); … … 53 53 FrameSelection& selection = frame().selection(); 54 54 55 if (selection.shouldChangeSelection(startingSelection()) && startingSelection().isNonOrphanedCaretOrRange())55 if (selection.shouldChangeSelection(startingSelection()) && !startingSelection().isNoneOrOrphaned()) 56 56 selection.setSelection(startingSelection(), m_options); 57 57 } -
trunk/Source/WebCore/editing/TypingCommand.cpp
r200922 r201823 262 262 void TypingCommand::doApply() 263 263 { 264 if ( !endingSelection().isNonOrphanedCaretOrRange())265 return; 266 264 if (endingSelection().isNoneOrOrphaned()) 265 return; 266 267 267 if (m_commandType == DeleteKey) 268 268 if (m_commands.isEmpty()) -
trunk/Source/WebCore/editing/VisibleSelection.cpp
r201667 r201823 126 126 RefPtr<Range> VisibleSelection::firstRange() const 127 127 { 128 if (isNone ())128 if (isNoneOrOrphaned()) 129 129 return nullptr; 130 130 Position start = m_start.parentAnchoredEquivalent(); 131 131 Position end = m_end.parentAnchoredEquivalent(); 132 if (start.isNull() || end.isNull())132 if (start.isNull() || start.isOrphan() || end.isNull() || end.isOrphan()) 133 133 return nullptr; 134 134 return Range::create(start.anchorNode()->document(), start, end); … … 137 137 RefPtr<Range> VisibleSelection::toNormalizedRange() const 138 138 { 139 if (isNone ())139 if (isNoneOrOrphaned()) 140 140 return nullptr; 141 141 … … 147 147 148 148 // Check again, because updating layout can clear the selection. 149 if (isNone ())149 if (isNoneOrOrphaned()) 150 150 return nullptr; 151 151 -
trunk/Source/WebCore/editing/VisibleSelection.h
r198583 r201823 78 78 bool isCaretOrRange() const { return selectionType() != NoSelection; } 79 79 bool isNonOrphanedRange() const { return isRange() && !start().isOrphan() && !end().isOrphan(); } 80 bool isNon OrphanedCaretOrRange() const { return isCaretOrRange() && !start().isOrphan() && !end().isOrphan(); }80 bool isNoneOrOrphaned() const { return isNone() || start().isOrphan() || end().isOrphan(); } 81 81 82 82 bool isBaseFirst() const { return m_baseIsFirst; }
Note:
See TracChangeset
for help on using the changeset viewer.