Diff
Modified: branches/safari-611.1.4-branch/LayoutTests/ChangeLog (269013 => 269014)
--- branches/safari-611.1.4-branch/LayoutTests/ChangeLog 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/LayoutTests/ChangeLog 2020-10-27 01:13:25 UTC (rev 269014)
@@ -1,5 +1,102 @@
2020-10-26 Alan Coon <[email protected]>
+ Cherry-pick r268940. rdar://problem/70702182
+
+ Source/WebCore:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ Test: editing/selection/selections-across-trees.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::linkClickPoint): Update for the new name of
+ isPointInRange, contains<ComposedTree>. We can return and change it from ComposedTree
+ to something else since that's likely not the tree we need here.
+ (WebCore::AccessibilityRenderObject::setSelectedTextRange): Ditto.
+ (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const): Ditto.
+ * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
+ (isWhiteSpaceBetweenSentences): Ditto.
+
+ * dom/BoundaryPoint.h: Update to use TreeType enumeration instead of classes.
+ * dom/Node.cpp:
+ (WebCore::depth): Ditto.
+ (WebCore::commonInclusiveAncestorAndChildren): Ditto.
+ (WebCore::treeOrder): Ditto.
+ * dom/Node.h: Ditto.
+
+ * dom/Range.cpp:
+ (WebCore::Range::isPointInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ * dom/SimpleRange.cpp:
+ (WebCore::treeOrder): Update to use TreeType enumeration instead of classes.
+ (WebCore::contains): Ditto. Also renamed isPointInRange to an overload of contains.
+ Also added converted the contains that takes two ranges to a function template.
+ (WebCore::intersects): Ditto.
+
+ * dom/SimpleRange.h: Reorganized the functions so all the deprecated functions
+ that silently use ComposedTree are grouped together. Updated the function templates
+ to use TreeType enumeration instead of classes. Added a couple more function
+ templates that we used to fix DOMSelection.
+
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::contains const): Update for the new name of sPointInRange,
+ contains<ComposedTree>. We can return and change it from ComposedTree to something
+ else since that's likely not the tree we need here.
+ * editing/mac/DictionaryLookupLegacy.mm:
+ (WebCore::selectionContainsPosition): Ditto.
+
+ * page/DOMSelection.cpp:
+ (WebCore::DOMSelection::addRange): Use intersects<Tree> because we don't want to
+ use the composed tree here.
+ (WebCore::DOMSelection::containsNode const): Use intersects<Tree> and contains<Tree>.
+ Evantually <Tree> will be the default and we can come back here and edit down these
+ calls for brevity, but first we have to make all the uses of ComposedTree explicit.
+
+ Source/WebKitLegacy/win:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * AccessibleTextImpl.cpp:
+ (AccessibleText::isInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ Tools:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * TestWebKitAPI/Tests/WebCore/DocumentOrder.cpp: Disabled the isPointInRange
+ test and added comments about how we will restore it in the future.
+
+ LayoutTests:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behaves incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * editing/selection/selections-across-trees-expected.txt: Added.
+ * editing/selection/selections-across-trees.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-10-22 Darin Adler <[email protected]>
+
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behaves incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * editing/selection/selections-across-trees-expected.txt: Added.
+ * editing/selection/selections-across-trees.html: Added.
+
+2020-10-26 Alan Coon <[email protected]>
+
Cherry-pick r268932. rdar://problem/70702224
REGRESSION(r268615): certain animations break when moving from one to display to another or resizing the window
Added: branches/safari-611.1.4-branch/LayoutTests/editing/selection/selections-across-trees-expected.txt (0 => 269014)
--- branches/safari-611.1.4-branch/LayoutTests/editing/selection/selections-across-trees-expected.txt (rev 0)
+++ branches/safari-611.1.4-branch/LayoutTests/editing/selection/selections-across-trees-expected.txt 2020-10-27 01:13:25 UTC (rev 269014)
@@ -0,0 +1,7 @@
+PASS getSelection().setBaseAndExtent(document.body, 0, nodeInSlot, 5); selectionAddRange(shadowNode, 0, shadowRoot, 1); getSelection().focusNode is nodeInSlot
+PASS getSelection().selectAllChildren(document.body); getSelection().containsNode(shadowNode) is false
+PASS getSelection().selectAllChildren(document.body); getSelection().containsNode(shadowNode, true) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-611.1.4-branch/LayoutTests/editing/selection/selections-across-trees.html (0 => 269014)
--- branches/safari-611.1.4-branch/LayoutTests/editing/selection/selections-across-trees.html (rev 0)
+++ branches/safari-611.1.4-branch/LayoutTests/editing/selection/selections-across-trees.html 2020-10-27 01:13:25 UTC (rev 269014)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+</head>
+<body>
+ <script>
+ const shadowHost = document.body.appendChild(document.createElement('div'));
+ const shadowRoot = shadowHost.attachShadow({mode: 'closed'});
+ shadowHost.innerHTML = '<b>hello</b><b slot="second">world</b>';
+ shadowRoot.innerHTML = '<span><slot></slot> <slot name="second"></slot></span>';
+ const shadowNode = shadowRoot.firstChild;
+ const nodeInSlot = document.querySelector('b[slot=second]').firstChild;
+
+ function selectionAddRange(startContainer, startOffset, endContainer, endOffset)
+ {
+ const range = document.createRange();
+ range.setStart(startContainer, startOffset);
+ range.setEnd(endContainer, endOffset);
+ getSelection().addRange(range);
+ }
+
+ shouldBe("getSelection().setBaseAndExtent(document.body, 0, nodeInSlot, 5); selectionAddRange(shadowNode, 0, shadowRoot, 1); getSelection().focusNode", "nodeInSlot");
+
+ shouldBeFalse("getSelection().selectAllChildren(document.body); getSelection().containsNode(shadowNode)");
+ shouldBeFalse("getSelection().selectAllChildren(document.body); getSelection().containsNode(shadowNode, true)");
+
+ getSelection().empty();
+ document.body.removeChild(shadowHost);
+
+ successfullyParsed = true;
+ </script>
+</html>
Modified: branches/safari-611.1.4-branch/Source/WebCore/ChangeLog (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/ChangeLog 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/ChangeLog 2020-10-27 01:13:25 UTC (rev 269014)
@@ -1,5 +1,146 @@
2020-10-26 Alan Coon <[email protected]>
+ Cherry-pick r268940. rdar://problem/70702182
+
+ Source/WebCore:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ Test: editing/selection/selections-across-trees.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::linkClickPoint): Update for the new name of
+ isPointInRange, contains<ComposedTree>. We can return and change it from ComposedTree
+ to something else since that's likely not the tree we need here.
+ (WebCore::AccessibilityRenderObject::setSelectedTextRange): Ditto.
+ (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const): Ditto.
+ * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
+ (isWhiteSpaceBetweenSentences): Ditto.
+
+ * dom/BoundaryPoint.h: Update to use TreeType enumeration instead of classes.
+ * dom/Node.cpp:
+ (WebCore::depth): Ditto.
+ (WebCore::commonInclusiveAncestorAndChildren): Ditto.
+ (WebCore::treeOrder): Ditto.
+ * dom/Node.h: Ditto.
+
+ * dom/Range.cpp:
+ (WebCore::Range::isPointInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ * dom/SimpleRange.cpp:
+ (WebCore::treeOrder): Update to use TreeType enumeration instead of classes.
+ (WebCore::contains): Ditto. Also renamed isPointInRange to an overload of contains.
+ Also added converted the contains that takes two ranges to a function template.
+ (WebCore::intersects): Ditto.
+
+ * dom/SimpleRange.h: Reorganized the functions so all the deprecated functions
+ that silently use ComposedTree are grouped together. Updated the function templates
+ to use TreeType enumeration instead of classes. Added a couple more function
+ templates that we used to fix DOMSelection.
+
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::contains const): Update for the new name of sPointInRange,
+ contains<ComposedTree>. We can return and change it from ComposedTree to something
+ else since that's likely not the tree we need here.
+ * editing/mac/DictionaryLookupLegacy.mm:
+ (WebCore::selectionContainsPosition): Ditto.
+
+ * page/DOMSelection.cpp:
+ (WebCore::DOMSelection::addRange): Use intersects<Tree> because we don't want to
+ use the composed tree here.
+ (WebCore::DOMSelection::containsNode const): Use intersects<Tree> and contains<Tree>.
+ Evantually <Tree> will be the default and we can come back here and edit down these
+ calls for brevity, but first we have to make all the uses of ComposedTree explicit.
+
+ Source/WebKitLegacy/win:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * AccessibleTextImpl.cpp:
+ (AccessibleText::isInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ Tools:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * TestWebKitAPI/Tests/WebCore/DocumentOrder.cpp: Disabled the isPointInRange
+ test and added comments about how we will restore it in the future.
+
+ LayoutTests:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behaves incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * editing/selection/selections-across-trees-expected.txt: Added.
+ * editing/selection/selections-across-trees.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-10-22 Darin Adler <[email protected]>
+
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ Test: editing/selection/selections-across-trees.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::linkClickPoint): Update for the new name of
+ isPointInRange, contains<ComposedTree>. We can return and change it from ComposedTree
+ to something else since that's likely not the tree we need here.
+ (WebCore::AccessibilityRenderObject::setSelectedTextRange): Ditto.
+ (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const): Ditto.
+ * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
+ (isWhiteSpaceBetweenSentences): Ditto.
+
+ * dom/BoundaryPoint.h: Update to use TreeType enumeration instead of classes.
+ * dom/Node.cpp:
+ (WebCore::depth): Ditto.
+ (WebCore::commonInclusiveAncestorAndChildren): Ditto.
+ (WebCore::treeOrder): Ditto.
+ * dom/Node.h: Ditto.
+
+ * dom/Range.cpp:
+ (WebCore::Range::isPointInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ * dom/SimpleRange.cpp:
+ (WebCore::treeOrder): Update to use TreeType enumeration instead of classes.
+ (WebCore::contains): Ditto. Also renamed isPointInRange to an overload of contains.
+ Also added converted the contains that takes two ranges to a function template.
+ (WebCore::intersects): Ditto.
+
+ * dom/SimpleRange.h: Reorganized the functions so all the deprecated functions
+ that silently use ComposedTree are grouped together. Updated the function templates
+ to use TreeType enumeration instead of classes. Added a couple more function
+ templates that we used to fix DOMSelection.
+
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::contains const): Update for the new name of sPointInRange,
+ contains<ComposedTree>. We can return and change it from ComposedTree to something
+ else since that's likely not the tree we need here.
+ * editing/mac/DictionaryLookupLegacy.mm:
+ (WebCore::selectionContainsPosition): Ditto.
+
+ * page/DOMSelection.cpp:
+ (WebCore::DOMSelection::addRange): Use intersects<Tree> because we don't want to
+ use the composed tree here.
+ (WebCore::DOMSelection::containsNode const): Use intersects<Tree> and contains<Tree>.
+ Evantually <Tree> will be the default and we can come back here and edit down these
+ calls for brevity, but first we have to make all the uses of ComposedTree explicit.
+
+2020-10-26 Alan Coon <[email protected]>
+
Cherry-pick r268932. rdar://problem/70702224
REGRESSION(r268615): certain animations break when moving from one to display to another or resizing the window
Modified: branches/safari-611.1.4-branch/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -962,7 +962,7 @@
if (auto range = elementRange()) {
auto start = VisiblePosition { makeContainerOffsetPosition(range->start) };
auto end = nextVisiblePosition(start);
- if (isPointInRange(*range, makeBoundaryPoint(end)))
+ if (contains<ComposedTree>(*range, makeBoundaryPoint(end)))
return { boundsForRange(*makeSimpleRange(start, end)).center() };
}
return AccessibilityObject::clickPoint();
@@ -1693,10 +1693,10 @@
auto& node = *this->node();
auto elementRange = this->elementRange();
auto start = visiblePositionForIndexUsingCharacterIterator(node, range.start);
- if (!isPointInRange(*elementRange, makeBoundaryPoint(start)))
+ if (!contains<ComposedTree>(*elementRange, makeBoundaryPoint(start)))
start = makeContainerOffsetPosition(elementRange->start);
auto end = visiblePositionForIndexUsingCharacterIterator(node, range.start + range.length);
- if (!isPointInRange(*elementRange, makeBoundaryPoint(end)))
+ if (!contains<ComposedTree>(*elementRange, makeBoundaryPoint(end)))
end = makeContainerOffsetPosition(elementRange->start);
m_renderer->frame().selection().setSelection(VisibleSelection(start, end), FrameSelection::defaultSetSelectionOptions(UserTriggered));
}
@@ -2247,7 +2247,7 @@
auto start = range.start;
if (auto elementRange = this->elementRange()) {
- if (!isPointInRange(*elementRange, makeBoundaryPoint(start)))
+ if (!contains<ComposedTree>(*elementRange, makeBoundaryPoint(start)))
start = makeContainerOffsetPosition(elementRange->start);
}
Modified: branches/safari-611.1.4-branch/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -704,7 +704,7 @@
return false;
auto range = makeSimpleRange(start, end);
- return range && isPointInRange(*range, makeBoundaryPoint(position));
+ return range && contains<ComposedTree>(*range, makeBoundaryPoint(position));
}
static VisibleSelection sentenceAtPositionForAtkBoundary(const AccessibilityObject*, const VisiblePosition& position, AtkTextBoundary boundaryType)
Modified: branches/safari-611.1.4-branch/Source/WebCore/dom/BoundaryPoint.h (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/dom/BoundaryPoint.h 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/BoundaryPoint.h 2020-10-27 01:13:25 UTC (rev 269014)
@@ -41,7 +41,7 @@
bool operator==(const BoundaryPoint&, const BoundaryPoint&);
bool operator!=(const BoundaryPoint&, const BoundaryPoint&);
-template<typename TreeType = Tree> PartialOrdering treeOrder(const BoundaryPoint&, const BoundaryPoint&);
+template<TreeType = Tree> PartialOrdering treeOrder(const BoundaryPoint&, const BoundaryPoint&);
WEBCORE_EXPORT PartialOrdering documentOrder(const BoundaryPoint&, const BoundaryPoint&);
WEBCORE_EXPORT Optional<BoundaryPoint> makeBoundaryPointBeforeNode(Node&);
Modified: branches/safari-611.1.4-branch/Source/WebCore/dom/Node.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/dom/Node.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/Node.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -2632,11 +2632,11 @@
return node.parentInComposedTree();
}
-template<typename TreeType> size_t depth(const Node& node)
+template<TreeType treeType> size_t depth(const Node& node)
{
size_t depth = 0;
auto ancestor = &node;
- while ((ancestor = parent<TreeType>(*ancestor)))
+ while ((ancestor = parent<treeType>(*ancestor)))
++depth;
return depth;
}
@@ -2647,7 +2647,7 @@
const Node* distinctAncestorB;
};
-template<typename TreeType> AncestorAndChildren commonInclusiveAncestorAndChildren(const Node& a, const Node& b)
+template<TreeType treeType> AncestorAndChildren commonInclusiveAncestorAndChildren(const Node& a, const Node& b)
{
// This check isn't needed for correctness, but it is cheap and likely to be
// common enough to be worth optimizing so we don't have to walk to the root.
@@ -2656,7 +2656,7 @@
// FIXME: Could optimize cases where nodes are both in the same shadow tree.
// FIXME: Could optimize cases where nodes are in different documents to quickly return false.
// FIXME: Could optimize cases where one node is connected and the other is not to quickly return false.
- auto [depthA, depthB] = std::make_tuple(depth<TreeType>(a), depth<TreeType>(b));
+ auto [depthA, depthB] = std::make_tuple(depth<treeType>(a), depth<treeType>(b));
auto [x, y, difference] = depthA >= depthB
? std::make_tuple(&a, &b, depthA - depthB)
: std::make_tuple(&b, &a, depthB - depthA);
@@ -2663,14 +2663,14 @@
decltype(x) distinctAncestorA = nullptr;
for (decltype(difference) i = 0; i < difference; ++i) {
distinctAncestorA = x;
- x = parent<TreeType>(*x);
+ x = parent<treeType>(*x);
}
decltype(y) distinctAncestorB = nullptr;
while (x != y) {
distinctAncestorA = x;
distinctAncestorB = y;
- x = parent<TreeType>(*x);
- y = parent<TreeType>(*y);
+ x = parent<treeType>(*x);
+ y = parent<treeType>(*y);
}
if (depthA < depthB)
std::swap(distinctAncestorA, distinctAncestorB);
@@ -2695,11 +2695,11 @@
return false;
}
-template<typename TreeType> PartialOrdering treeOrder(const Node& a, const Node& b)
+template<TreeType treeType> PartialOrdering treeOrder(const Node& a, const Node& b)
{
if (&a == &b)
return PartialOrdering::equivalent;
- auto result = commonInclusiveAncestorAndChildren<TreeType>(a, b);
+ auto result = commonInclusiveAncestorAndChildren<treeType>(a, b);
if (!result.commonAncestor)
return PartialOrdering::unordered;
if (!result.distinctAncestorA)
Modified: branches/safari-611.1.4-branch/Source/WebCore/dom/Node.h (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/dom/Node.h 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/Node.h 2020-10-27 01:13:25 UTC (rev 269014)
@@ -755,12 +755,11 @@
constexpr bool is_lteq(PartialOrdering);
constexpr bool is_gteq(PartialOrdering);
-struct Tree { };
-struct ShadowIncludingTree { };
-struct ComposedTree { };
-template<typename TreeType = Tree> ContainerNode* parent(const Node&);
-template<typename TreeType = Tree> PartialOrdering treeOrder(const Node&, const Node&);
+enum TreeType { Tree, ShadowIncludingTree, ComposedTree };
+template<TreeType = Tree> ContainerNode* parent(const Node&);
+template<TreeType = Tree> PartialOrdering treeOrder(const Node&, const Node&);
+// FIXME: Dprecated because this silently defaults to ComposedTree. Use treeOrder instead.
WEBCORE_EXPORT PartialOrdering documentOrder(const Node&, const Node&);
#if ASSERT_ENABLED
Modified: branches/safari-611.1.4-branch/Source/WebCore/dom/Range.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/dom/Range.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/Range.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -155,7 +155,7 @@
return false;
return checkResult.releaseException();
}
- return WebCore::isPointInRange<Tree>(makeSimpleRange(*this), { container, offset });
+ return contains<Tree>(makeSimpleRange(*this), { container, offset });
}
ExceptionOr<short> Range::comparePoint(Node& container, unsigned offset) const
Modified: branches/safari-611.1.4-branch/Source/WebCore/dom/SimpleRange.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/dom/SimpleRange.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/SimpleRange.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -95,13 +95,13 @@
return PartialOrdering::equivalent;
}
-template<typename TreeType> PartialOrdering treeOrder(const BoundaryPoint& a, const BoundaryPoint& b)
+template<TreeType treeType> PartialOrdering treeOrder(const BoundaryPoint& a, const BoundaryPoint& b)
{
if (a.container.ptr() == b.container.ptr())
return order(a.offset, b.offset);
for (auto ancestor = b.container.ptr(); ancestor; ) {
- auto nextAncestor = parent<TreeType>(*ancestor);
+ auto nextAncestor = parent<treeType>(*ancestor);
if (nextAncestor == a.container.ptr())
return isOffsetBeforeChild(*nextAncestor, a.offset, *ancestor) ? PartialOrdering::less : PartialOrdering::greater;
ancestor = nextAncestor;
@@ -108,13 +108,13 @@
}
for (auto ancestor = a.container.ptr(); ancestor; ) {
- auto nextAncestor = parent<TreeType>(*ancestor);
+ auto nextAncestor = parent<treeType>(*ancestor);
if (nextAncestor == b.container.ptr())
return isOffsetBeforeChild(*nextAncestor, b.offset, *ancestor) ? PartialOrdering::greater : PartialOrdering::less;
ancestor = nextAncestor;
}
- return treeOrder<TreeType>(a.container, b.container);
+ return treeOrder<treeType>(a.container, b.container);
}
PartialOrdering documentOrder(const BoundaryPoint& a, const BoundaryPoint& b)
@@ -212,42 +212,34 @@
return commonInclusiveAncestor(range.start.container, range.end.container);
}
-template<typename TreeType> bool isPointInRange(const SimpleRange& range, const BoundaryPoint& point)
+template<TreeType treeType> bool contains(const SimpleRange& range, const BoundaryPoint& point)
{
- return is_lteq(treeOrder<TreeType>(range.start, point)) && is_lteq(treeOrder<TreeType>(point, range.end));
+ return is_lteq(treeOrder<treeType>(range.start, point)) && is_lteq(treeOrder<treeType>(point, range.end));
}
-template bool isPointInRange<Tree>(const SimpleRange&, const BoundaryPoint&);
+template bool contains<Tree>(const SimpleRange&, const BoundaryPoint&);
-template<typename TreeType> bool isPointInRange(const SimpleRange& range, const Optional<BoundaryPoint>& point)
+template<TreeType treeType> bool contains(const SimpleRange& range, const Optional<BoundaryPoint>& point)
{
- return point && isPointInRange<TreeType>(range, *point);
+ return point && contains<treeType>(range, *point);
}
-bool isPointInRange(const SimpleRange& range, const BoundaryPoint& point)
-{
- return isPointInRange<ComposedTree>(range, point);
-}
+template bool contains<ComposedTree>(const SimpleRange&, const Optional<BoundaryPoint>&);
-bool isPointInRange(const SimpleRange& range, const Optional<BoundaryPoint>& point)
+template<TreeType treeType> PartialOrdering treeOrder(const SimpleRange& range, const BoundaryPoint& point)
{
- return isPointInRange<ComposedTree>(range, point);
-}
-
-template<typename TreeType> PartialOrdering treeOrder(const SimpleRange& range, const BoundaryPoint& point)
-{
- if (auto order = treeOrder<TreeType>(range.start, point); !is_lt(order))
+ if (auto order = treeOrder<treeType>(range.start, point); !is_lt(order))
return order;
- if (auto order = treeOrder<TreeType>(range.end, point); !is_gt(order))
+ if (auto order = treeOrder<treeType>(range.end, point); !is_gt(order))
return order;
return PartialOrdering::equivalent;
}
-template<typename TreeType> PartialOrdering treeOrder(const BoundaryPoint& point, const SimpleRange& range)
+template<TreeType treeType> PartialOrdering treeOrder(const BoundaryPoint& point, const SimpleRange& range)
{
- if (auto order = treeOrder<TreeType>(point, range.start); !is_gt(order))
+ if (auto order = treeOrder<treeType>(point, range.start); !is_gt(order))
return order;
- if (auto order = treeOrder<TreeType>(point, range.end); !is_lt(order))
+ if (auto order = treeOrder<treeType>(point, range.end); !is_lt(order))
return order;
return PartialOrdering::equivalent;
}
@@ -265,14 +257,21 @@
return treeOrder<ComposedTree>(point, range);
}
+template<TreeType treeType> bool contains(const SimpleRange& outerRange, const SimpleRange& innerRange)
+{
+ return is_lteq(treeOrder<treeType>(outerRange.start, innerRange.start)) && is_gteq(treeOrder<treeType>(outerRange.end, innerRange.end));
+}
+
+template bool contains<Tree>(const SimpleRange&, const SimpleRange&);
+
bool contains(const SimpleRange& outerRange, const SimpleRange& innerRange)
{
- return is_lteq(documentOrder(outerRange.start, innerRange.start)) && is_gteq(documentOrder(outerRange.end, innerRange.end));
+ return contains<ComposedTree>(outerRange, innerRange);
}
-template<typename TreeType> bool intersects(const SimpleRange& a, const SimpleRange& b)
+template<TreeType treeType> bool intersects(const SimpleRange& a, const SimpleRange& b)
{
- return is_lteq(treeOrder<TreeType>(a.start, b.end)) && is_lteq(treeOrder<TreeType>(b.start, a.end));
+ return is_lteq(treeOrder<treeType>(a.start, b.end)) && is_lteq(treeOrder<treeType>(b.start, a.end));
}
template bool intersects<Tree>(const SimpleRange&, const SimpleRange&);
@@ -300,16 +299,23 @@
return { { std::max(a->start, b->start, compareByDocumentOrder), std::min(a->end, b->end, compareByDocumentOrder) } };
}
-bool contains(const SimpleRange& range, const Node& node)
+template<TreeType treeType> bool contains(const SimpleRange& range, const Node& node)
{
// FIXME: Consider a more efficient algorithm that avoids always computing the node index.
// FIXME: Does this const_cast point to a design problem?
auto nodeRange = makeRangeSelectingNode(const_cast<Node&>(node));
- return nodeRange && contains(range, *nodeRange);
+ return nodeRange && contains<treeType>(range, *nodeRange);
}
-template<typename TreeType> bool contains(const Node& outer, const Node& inner);
+template bool contains<Tree>(const SimpleRange&, const Node&);
+bool contains(const SimpleRange& range, const Node& node)
+{
+ return contains<ComposedTree>(range, node);
+}
+
+template<TreeType treeType> bool contains(const Node& outer, const Node& inner);
+
template<> bool contains<Tree>(const Node& outer, const Node& inner)
{
return outer.contains(inner);
@@ -321,15 +327,14 @@
return outer.contains(inner);
}
-template<typename TreeType> bool intersects(const SimpleRange& range, const Node& node)
+template<TreeType treeType> bool intersects(const SimpleRange& range, const Node& node)
{
// FIXME: Consider a more efficient algorithm that avoids always computing the node index.
// FIXME: Does this const_cast point to a design problem?
auto nodeRange = makeRangeSelectingNode(const_cast<Node&>(node));
if (!nodeRange)
- return contains<TreeType>(node, range.start.container);
- return is_lt(treeOrder<TreeType>(nodeRange->start, range.end)) && is_lt(treeOrder<TreeType>(range.start, nodeRange->end));
-
+ return contains<treeType>(node, range.start.container);
+ return is_lt(treeOrder<treeType>(nodeRange->start, range.end)) && is_lt(treeOrder<treeType>(range.start, nodeRange->end));
}
template bool intersects<Tree>(const SimpleRange&, const Node&);
Modified: branches/safari-611.1.4-branch/Source/WebCore/dom/SimpleRange.h (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/dom/SimpleRange.h 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/dom/SimpleRange.h 2020-10-27 01:13:25 UTC (rev 269014)
@@ -57,22 +57,37 @@
template<typename ...T> auto makeSimpleRange(T&& ...arguments) -> decltype(makeSimpleRangeHelper(makeBoundaryPointHelper(std::forward<T>(arguments))...)) { return makeSimpleRangeHelper(makeBoundaryPointHelper(std::forward<T>(arguments))...); }
-// FIXME: Would like these to have shorter names; another option is to change prefix to makeSimpleRange.
+// FIXME: Would like these two functions to have shorter names; another option is to change prefix to makeSimpleRange.
WEBCORE_EXPORT Optional<SimpleRange> makeRangeSelectingNode(Node&);
WEBCORE_EXPORT SimpleRange makeRangeSelectingNodeContents(Node&);
-WEBCORE_EXPORT RefPtr<Node> commonInclusiveAncestor(const SimpleRange&);
-
bool operator==(const SimpleRange&, const SimpleRange&);
-template<typename TreeType> bool isPointInRange(const SimpleRange&, const BoundaryPoint&);
-template<typename TreeType> bool isPointInRange(const SimpleRange&, const Optional<BoundaryPoint>&);
-WEBCORE_EXPORT bool isPointInRange(const SimpleRange&, const BoundaryPoint&);
-bool isPointInRange(const SimpleRange&, const Optional<BoundaryPoint>&);
+template<TreeType = Tree> bool contains(const SimpleRange&, const BoundaryPoint&);
+template<TreeType = Tree> bool contains(const SimpleRange&, const Optional<BoundaryPoint>&);
+template<TreeType> bool contains(const SimpleRange& outerRange, const SimpleRange& innerRange);
+template<TreeType> bool contains(const SimpleRange&, const Node&);
+template<TreeType> bool intersects(const SimpleRange&, const SimpleRange&);
+template<TreeType> bool intersects(const SimpleRange&, const Node&);
+
+// Returns equivalent if point is in range.
+template<TreeType = Tree> PartialOrdering treeOrder(const SimpleRange&, const BoundaryPoint&);
+template<TreeType = Tree> PartialOrdering treeOrder(const BoundaryPoint&, const SimpleRange&);
+
+struct OffsetRange {
+ unsigned start { 0 };
+ unsigned end { 0 };
+};
+OffsetRange characterDataOffsetRange(const SimpleRange&, const Node&);
+
+// FIXME: Start of functions that are deprecated since they silently default to ComposedTree.
+
+WEBCORE_EXPORT RefPtr<Node> commonInclusiveAncestor(const SimpleRange&);
WEBCORE_EXPORT bool contains(const SimpleRange& outerRange, const SimpleRange& innerRange);
template<typename TreeType> bool intersects(const SimpleRange&, const SimpleRange&);
WEBCORE_EXPORT bool intersects(const SimpleRange&, const SimpleRange&);
+WEBCORE_EXPORT bool intersects(const SimpleRange&, const Node&);
WEBCORE_EXPORT SimpleRange unionRange(const SimpleRange&, const SimpleRange&);
WEBCORE_EXPORT Optional<SimpleRange> intersection(const Optional<SimpleRange>&, const Optional<SimpleRange>&);
@@ -80,9 +95,6 @@
template<typename TreeType> bool intersects(const SimpleRange&, const Node&);
WEBCORE_EXPORT bool intersects(const SimpleRange&, const Node&);
-// Returns equivalent if point is in range.
-template<typename TreeType = Tree> PartialOrdering treeOrder(const SimpleRange&, const BoundaryPoint&);
-template<typename TreeType = Tree> PartialOrdering treeOrder(const BoundaryPoint&, const SimpleRange&);
WEBCORE_EXPORT PartialOrdering documentOrder(const SimpleRange&, const BoundaryPoint&);
WEBCORE_EXPORT PartialOrdering documentOrder(const BoundaryPoint&, const SimpleRange&);
@@ -92,11 +104,7 @@
class IntersectingNodeRangeWithQuirk;
IntersectingNodeRangeWithQuirk intersectingNodesWithDeprecatedZeroOffsetStartQuirk(const SimpleRange&);
-struct OffsetRange {
- unsigned start { 0 };
- unsigned end { 0 };
-};
-OffsetRange characterDataOffsetRange(const SimpleRange&, const Node&);
+// FIXME: End of functions that are deprecated since they silently default to ComposedTree.
class IntersectingNodeIterator : public std::iterator<std::forward_iterator_tag, Node> {
public:
Modified: branches/safari-611.1.4-branch/Source/WebCore/editing/FrameSelection.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/editing/FrameSelection.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/editing/FrameSelection.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -1902,7 +1902,7 @@
if (!innerNode || !innerNode->renderer())
return false;
- return isPointInRange(*range, makeBoundaryPoint(innerNode->renderer()->positionForPoint(result.localPoint(), nullptr)));
+ return WebCore::contains<ComposedTree>(*range, makeBoundaryPoint(innerNode->renderer()->positionForPoint(result.localPoint(), nullptr)));
}
// Workaround for the fact that it's hard to delete a frame.
Modified: branches/safari-611.1.4-branch/Source/WebCore/editing/mac/DictionaryLookupLegacy.mm (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/editing/mac/DictionaryLookupLegacy.mm 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/editing/mac/DictionaryLookupLegacy.mm 2020-10-27 01:13:25 UTC (rev 269014)
@@ -69,7 +69,7 @@
return false;
auto selectedRange = selection.firstRange();
- return selectedRange && isPointInRange(*selectedRange, makeBoundaryPoint(position));
+ return selectedRange && contains<ComposedTree>(*selectedRange, makeBoundaryPoint(position));
}
Optional<std::tuple<SimpleRange, NSDictionary *>> DictionaryLookup::rangeForSelection(const VisibleSelection& selection)
Modified: branches/safari-611.1.4-branch/Source/WebCore/page/DOMSelection.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebCore/page/DOMSelection.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebCore/page/DOMSelection.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -391,7 +391,7 @@
}
auto range = makeSimpleRange(liveRange);
if (auto selectedRange = selection.selection().toNormalizedRange()) {
- if (!selectedRange->start.container->containingShadowRoot() && intersects(*selectedRange, range))
+ if (!selectedRange->start.container->containingShadowRoot() && intersects<Tree>(*selectedRange, range))
selection.setSelection(unionRange(*selectedRange, range));
return;
}
@@ -433,7 +433,7 @@
if (node.isTextNode() && !node.document().settings().liveRangeSelectionEnabled())
allowPartial = true;
auto range = this->range();
- return range && (allowPartial ? intersects(*range, node) : contains(*range, node));
+ return range && (allowPartial ? intersects<Tree>(*range, node) : contains<Tree>(*range, node));
}
ExceptionOr<void> DOMSelection::selectAllChildren(Node& node)
Modified: branches/safari-611.1.4-branch/Source/WebKitLegacy/win/AccessibleTextImpl.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebKitLegacy/win/AccessibleTextImpl.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebKitLegacy/win/AccessibleTextImpl.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -756,5 +756,5 @@
bool AccessibleText::isInRange(VisiblePosition& current, VisiblePositionRange& wordRange)
{
auto range = makeSimpleRange(wordRange);
- return range && isPointInRange(*range, makeBoundaryPoint(current));
+ return range && contains<ComposedTree>(*range, makeBoundaryPoint(current));
}
Modified: branches/safari-611.1.4-branch/Source/WebKitLegacy/win/ChangeLog (269013 => 269014)
--- branches/safari-611.1.4-branch/Source/WebKitLegacy/win/ChangeLog 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Source/WebKitLegacy/win/ChangeLog 2020-10-27 01:13:25 UTC (rev 269014)
@@ -1,3 +1,101 @@
+2020-10-26 Alan Coon <[email protected]>
+
+ Cherry-pick r268940. rdar://problem/70702182
+
+ Source/WebCore:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ Test: editing/selection/selections-across-trees.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::linkClickPoint): Update for the new name of
+ isPointInRange, contains<ComposedTree>. We can return and change it from ComposedTree
+ to something else since that's likely not the tree we need here.
+ (WebCore::AccessibilityRenderObject::setSelectedTextRange): Ditto.
+ (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const): Ditto.
+ * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
+ (isWhiteSpaceBetweenSentences): Ditto.
+
+ * dom/BoundaryPoint.h: Update to use TreeType enumeration instead of classes.
+ * dom/Node.cpp:
+ (WebCore::depth): Ditto.
+ (WebCore::commonInclusiveAncestorAndChildren): Ditto.
+ (WebCore::treeOrder): Ditto.
+ * dom/Node.h: Ditto.
+
+ * dom/Range.cpp:
+ (WebCore::Range::isPointInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ * dom/SimpleRange.cpp:
+ (WebCore::treeOrder): Update to use TreeType enumeration instead of classes.
+ (WebCore::contains): Ditto. Also renamed isPointInRange to an overload of contains.
+ Also added converted the contains that takes two ranges to a function template.
+ (WebCore::intersects): Ditto.
+
+ * dom/SimpleRange.h: Reorganized the functions so all the deprecated functions
+ that silently use ComposedTree are grouped together. Updated the function templates
+ to use TreeType enumeration instead of classes. Added a couple more function
+ templates that we used to fix DOMSelection.
+
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::contains const): Update for the new name of sPointInRange,
+ contains<ComposedTree>. We can return and change it from ComposedTree to something
+ else since that's likely not the tree we need here.
+ * editing/mac/DictionaryLookupLegacy.mm:
+ (WebCore::selectionContainsPosition): Ditto.
+
+ * page/DOMSelection.cpp:
+ (WebCore::DOMSelection::addRange): Use intersects<Tree> because we don't want to
+ use the composed tree here.
+ (WebCore::DOMSelection::containsNode const): Use intersects<Tree> and contains<Tree>.
+ Evantually <Tree> will be the default and we can come back here and edit down these
+ calls for brevity, but first we have to make all the uses of ComposedTree explicit.
+
+ Source/WebKitLegacy/win:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * AccessibleTextImpl.cpp:
+ (AccessibleText::isInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ Tools:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * TestWebKitAPI/Tests/WebCore/DocumentOrder.cpp: Disabled the isPointInRange
+ test and added comments about how we will restore it in the future.
+
+ LayoutTests:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behaves incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * editing/selection/selections-across-trees-expected.txt: Added.
+ * editing/selection/selections-across-trees.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-10-22 Darin Adler <[email protected]>
+
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * AccessibleTextImpl.cpp:
+ (AccessibleText::isInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
2020-10-22 Alan Coon <[email protected]>
Revert r268616. rdar://problem/70578639
Modified: branches/safari-611.1.4-branch/Tools/ChangeLog (269013 => 269014)
--- branches/safari-611.1.4-branch/Tools/ChangeLog 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Tools/ChangeLog 2020-10-27 01:13:25 UTC (rev 269014)
@@ -1,5 +1,102 @@
2020-10-26 Alan Coon <[email protected]>
+ Cherry-pick r268940. rdar://problem/70702182
+
+ Source/WebCore:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ Test: editing/selection/selections-across-trees.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::linkClickPoint): Update for the new name of
+ isPointInRange, contains<ComposedTree>. We can return and change it from ComposedTree
+ to something else since that's likely not the tree we need here.
+ (WebCore::AccessibilityRenderObject::setSelectedTextRange): Ditto.
+ (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const): Ditto.
+ * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
+ (isWhiteSpaceBetweenSentences): Ditto.
+
+ * dom/BoundaryPoint.h: Update to use TreeType enumeration instead of classes.
+ * dom/Node.cpp:
+ (WebCore::depth): Ditto.
+ (WebCore::commonInclusiveAncestorAndChildren): Ditto.
+ (WebCore::treeOrder): Ditto.
+ * dom/Node.h: Ditto.
+
+ * dom/Range.cpp:
+ (WebCore::Range::isPointInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ * dom/SimpleRange.cpp:
+ (WebCore::treeOrder): Update to use TreeType enumeration instead of classes.
+ (WebCore::contains): Ditto. Also renamed isPointInRange to an overload of contains.
+ Also added converted the contains that takes two ranges to a function template.
+ (WebCore::intersects): Ditto.
+
+ * dom/SimpleRange.h: Reorganized the functions so all the deprecated functions
+ that silently use ComposedTree are grouped together. Updated the function templates
+ to use TreeType enumeration instead of classes. Added a couple more function
+ templates that we used to fix DOMSelection.
+
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::contains const): Update for the new name of sPointInRange,
+ contains<ComposedTree>. We can return and change it from ComposedTree to something
+ else since that's likely not the tree we need here.
+ * editing/mac/DictionaryLookupLegacy.mm:
+ (WebCore::selectionContainsPosition): Ditto.
+
+ * page/DOMSelection.cpp:
+ (WebCore::DOMSelection::addRange): Use intersects<Tree> because we don't want to
+ use the composed tree here.
+ (WebCore::DOMSelection::containsNode const): Use intersects<Tree> and contains<Tree>.
+ Evantually <Tree> will be the default and we can come back here and edit down these
+ calls for brevity, but first we have to make all the uses of ComposedTree explicit.
+
+ Source/WebKitLegacy/win:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * AccessibleTextImpl.cpp:
+ (AccessibleText::isInRange): Updated since we renamed isPointInRange to be
+ an overload of contains.
+
+ Tools:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * TestWebKitAPI/Tests/WebCore/DocumentOrder.cpp: Disabled the isPointInRange
+ test and added comments about how we will restore it in the future.
+
+ LayoutTests:
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behaves incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * editing/selection/selections-across-trees-expected.txt: Added.
+ * editing/selection/selections-across-trees.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-10-22 Darin Adler <[email protected]>
+
+ REGRESSION(r266295): DOMSelection's addRange and containsNode behave incorrectly when selection crosses shadow boundaries
+ https://bugs.webkit.org/show_bug.cgi?id=218007
+
+ Reviewed by Ryosuke Niwa.
+
+ * TestWebKitAPI/Tests/WebCore/DocumentOrder.cpp: Disabled the isPointInRange
+ test and added comments about how we will restore it in the future.
+
+2020-10-26 Alan Coon <[email protected]>
+
Cherry-pick r268796. rdar://problem/70702309
Don't crash when deallocating WKWebView during TLS handshake
Modified: branches/safari-611.1.4-branch/Tools/TestWebKitAPI/Tests/WebCore/DocumentOrder.cpp (269013 => 269014)
--- branches/safari-611.1.4-branch/Tools/TestWebKitAPI/Tests/WebCore/DocumentOrder.cpp 2020-10-27 01:13:18 UTC (rev 269013)
+++ branches/safari-611.1.4-branch/Tools/TestWebKitAPI/Tests/WebCore/DocumentOrder.cpp 2020-10-27 01:13:25 UTC (rev 269014)
@@ -36,6 +36,9 @@
#include <WebCore/SimpleRange.h>
#include <WebCore/TextControlInnerElements.h>
+// FIXME: Expose the functions tested here in WebKit internals object, then replace this test with one written in _javascript_.
+// FIXME: When doing the above, don't forget to remove the many WEBCORE_EXPORT that were added so we could compile and link this test.
+
#define EXPECT_BOTH(a, b, forward, reversed) do { EXPECT_STREQ(string(documentOrder(a, b)), forward); EXPECT_STREQ(string(documentOrder(b, a)), reversed); } while (0)
#define EXPECT_EQUIVALENT(a, b) EXPECT_BOTH(a, b, "equivalent", "equivalent")
#define EXPECT_LESS(a, b) EXPECT_BOTH(a, b, "less", "greater")
@@ -477,6 +480,10 @@
// FIXME: Add tests that cover shadow trees.
}
+// Disabled this test since isPointInRange is now a template function named contains.
+// Keeping the code around to use as a reference when rewriting in _javascript_
+#if 0
+
TEST(DocumentOrder, IsPointInRange)
{
auto document = createDocument();
@@ -526,6 +533,8 @@
// FIXME: Add tests that cover shadow trees.
}
+#endif
+
TEST(DocumentOrder, RangeContainsRange)
{
auto document = createDocument();