Changeset 251683 in webkit
- Timestamp:
- Oct 28, 2019 4:29:25 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r251680 r251683 1 2019-10-28 Chris Dumez <cdumez@apple.com> 2 3 editing/firstPositionInNode-crash.html in crashing in Debug 4 https://bugs.webkit.org/show_bug.cgi?id=203520 5 6 Reviewed by Ryosuke Niwa. 7 8 If positionInParentBeforeNode / positionInParentAfterNode on a node and editingIgnoresContent() 9 returns true for this node's parent, keep traversing ancestors until we find one for which 10 editingIgnoresContent() returns false. 11 12 No new tests, covered by editing/firstPositionInNode-crash.html. 13 14 * dom/Position.cpp: 15 (WebCore::positionInParentBeforeNode): 16 (WebCore::positionInParentAfterNode): 17 * dom/Position.h: 18 1 19 2019-10-28 Zalan Bujtas <zalan@apple.com> 2 20 -
trunk/Source/WebCore/dom/Position.cpp
r251041 r251683 1570 1570 } 1571 1571 1572 Position positionInParentBeforeNode(Node* node) 1573 { 1574 auto* ancestor = node->parentNode(); 1575 while (ancestor && editingIgnoresContent(*ancestor)) { 1576 node = ancestor; 1577 ancestor = ancestor->parentNode(); 1578 } 1579 ASSERT(ancestor); 1580 return Position(ancestor, node->computeNodeIndex(), Position::PositionIsOffsetInAnchor); 1581 } 1582 1583 Position positionInParentAfterNode(Node* node) 1584 { 1585 auto* ancestor = node->parentNode(); 1586 while (ancestor && editingIgnoresContent(*ancestor)) { 1587 node = ancestor; 1588 ancestor = ancestor->parentNode(); 1589 } 1590 ASSERT(ancestor); 1591 return Position(ancestor, node->computeNodeIndex() + 1, Position::PositionIsOffsetInAnchor); 1592 } 1593 1572 1594 } // namespace WebCore 1573 1595 -
trunk/Source/WebCore/dom/Position.h
r239190 r251683 264 264 } 265 265 266 inline Position positionInParentBeforeNode(const Node* node) 267 { 268 ASSERT(node->parentNode()); 269 return Position(node->parentNode(), node->computeNodeIndex(), Position::PositionIsOffsetInAnchor); 270 } 271 272 inline Position positionInParentAfterNode(const Node* node) 273 { 274 ASSERT(node->parentNode()); 275 return Position(node->parentNode(), node->computeNodeIndex() + 1, Position::PositionIsOffsetInAnchor); 276 } 266 Position positionInParentBeforeNode(Node*); 267 Position positionInParentAfterNode(Node*); 277 268 278 269 // positionBeforeNode and positionAfterNode return neighbor-anchored positions, construction is O(1)
Note: See TracChangeset
for help on using the changeset viewer.