Title: [251683] trunk/Source/WebCore
- Revision
- 251683
- Author
- cdu...@apple.com
- Date
- 2019-10-28 16:29:25 -0700 (Mon, 28 Oct 2019)
Log Message
editing/firstPositionInNode-crash.html in crashing in Debug
https://bugs.webkit.org/show_bug.cgi?id=203520
Reviewed by Ryosuke Niwa.
If positionInParentBeforeNode / positionInParentAfterNode on a node and editingIgnoresContent()
returns true for this node's parent, keep traversing ancestors until we find one for which
editingIgnoresContent() returns false.
No new tests, covered by editing/firstPositionInNode-crash.html.
* dom/Position.cpp:
(WebCore::positionInParentBeforeNode):
(WebCore::positionInParentAfterNode):
* dom/Position.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (251682 => 251683)
--- trunk/Source/WebCore/ChangeLog 2019-10-28 23:24:48 UTC (rev 251682)
+++ trunk/Source/WebCore/ChangeLog 2019-10-28 23:29:25 UTC (rev 251683)
@@ -1,3 +1,21 @@
+2019-10-28 Chris Dumez <cdu...@apple.com>
+
+ editing/firstPositionInNode-crash.html in crashing in Debug
+ https://bugs.webkit.org/show_bug.cgi?id=203520
+
+ Reviewed by Ryosuke Niwa.
+
+ If positionInParentBeforeNode / positionInParentAfterNode on a node and editingIgnoresContent()
+ returns true for this node's parent, keep traversing ancestors until we find one for which
+ editingIgnoresContent() returns false.
+
+ No new tests, covered by editing/firstPositionInNode-crash.html.
+
+ * dom/Position.cpp:
+ (WebCore::positionInParentBeforeNode):
+ (WebCore::positionInParentAfterNode):
+ * dom/Position.h:
+
2019-10-28 Zalan Bujtas <za...@apple.com>
Hidden framesets should provide default edgeInfo value
Modified: trunk/Source/WebCore/dom/Position.cpp (251682 => 251683)
--- trunk/Source/WebCore/dom/Position.cpp 2019-10-28 23:24:48 UTC (rev 251682)
+++ trunk/Source/WebCore/dom/Position.cpp 2019-10-28 23:29:25 UTC (rev 251683)
@@ -1569,6 +1569,28 @@
return Range::commonAncestorContainer(nodeA, nodeB);
}
+Position positionInParentBeforeNode(Node* node)
+{
+ auto* ancestor = node->parentNode();
+ while (ancestor && editingIgnoresContent(*ancestor)) {
+ node = ancestor;
+ ancestor = ancestor->parentNode();
+ }
+ ASSERT(ancestor);
+ return Position(ancestor, node->computeNodeIndex(), Position::PositionIsOffsetInAnchor);
+}
+
+Position positionInParentAfterNode(Node* node)
+{
+ auto* ancestor = node->parentNode();
+ while (ancestor && editingIgnoresContent(*ancestor)) {
+ node = ancestor;
+ ancestor = ancestor->parentNode();
+ }
+ ASSERT(ancestor);
+ return Position(ancestor, node->computeNodeIndex() + 1, Position::PositionIsOffsetInAnchor);
+}
+
} // namespace WebCore
#if ENABLE(TREE_DEBUGGING)
Modified: trunk/Source/WebCore/dom/Position.h (251682 => 251683)
--- trunk/Source/WebCore/dom/Position.h 2019-10-28 23:24:48 UTC (rev 251682)
+++ trunk/Source/WebCore/dom/Position.h 2019-10-28 23:29:25 UTC (rev 251683)
@@ -263,18 +263,9 @@
return !a.isNull() && !b.isNull() && (a == b || a < b);
}
-inline Position positionInParentBeforeNode(const Node* node)
-{
- ASSERT(node->parentNode());
- return Position(node->parentNode(), node->computeNodeIndex(), Position::PositionIsOffsetInAnchor);
-}
+Position positionInParentBeforeNode(Node*);
+Position positionInParentAfterNode(Node*);
-inline Position positionInParentAfterNode(const Node* node)
-{
- ASSERT(node->parentNode());
- return Position(node->parentNode(), node->computeNodeIndex() + 1, Position::PositionIsOffsetInAnchor);
-}
-
// positionBeforeNode and positionAfterNode return neighbor-anchored positions, construction is O(1)
inline Position positionBeforeNode(Node* anchorNode)
{
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes