Diff
Modified: trunk/Source/WebCore/ChangeLog (208838 => 208839)
--- trunk/Source/WebCore/ChangeLog 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/ChangeLog 2016-11-17 06:24:13 UTC (rev 208839)
@@ -1,3 +1,74 @@
+2016-11-16 Chris Dumez <[email protected]>
+
+ Add Node::isDescendantOf() overload that takes in a reference
+ https://bugs.webkit.org/show_bug.cgi?id=164854
+
+ Reviewed by Ryosuke Niwa.
+
+ Add Node::isDescendantOf() overload that takes in a reference as a lot
+ of call sites have a reference or a pointer they know is not null.
+
+ No new tests, no Web-exposed behavior change.
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::press):
+ * dom/Document.cpp:
+ (WebCore::isNodeInSubtree):
+ (WebCore::Document::removeFullScreenElementOfSubtree):
+ (WebCore::Document::setAnimatingFullScreen):
+ * dom/Node.cpp:
+ (WebCore::Node::isDescendantOf):
+ (WebCore::Node::isDescendantOrShadowDescendantOf):
+ (WebCore::Node::contains):
+ * dom/Node.h:
+ (WebCore::Node::isDescendantOf):
+ * dom/NodeIterator.cpp:
+ (WebCore::NodeIterator::updateForNodeRemoval):
+ * dom/SelectorQuery.cpp:
+ (WebCore::SelectorDataList::executeFastPathForIdSelector):
+ (WebCore::filterRootById):
+ * dom/TypedElementDescendantIterator.h:
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::beginAt):
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::from):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::beginAt):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::from):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
+ (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
+ * editing/BreakBlockquoteCommand.cpp:
+ (WebCore::BreakBlockquoteCommand::doApply):
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::handleGeneralDelete):
+ (WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows):
+ (WebCore::DeleteSelectionCommand::doApply):
+ * editing/EditingStyle.cpp:
+ (WebCore::EditingStyle::textDirectionForSelection):
+ * editing/FormatBlockCommand.cpp:
+ (WebCore::FormatBlockCommand::formatRange):
+ * editing/TextIterator.cpp:
+ (WebCore::TextIterator::advance):
+ * editing/VisiblePosition.cpp:
+ (WebCore::VisiblePosition::honorEditingBoundaryAtOrBefore):
+ (WebCore::VisiblePosition::honorEditingBoundaryAtOrAfter):
+ * editing/htmlediting.cpp:
+ (WebCore::firstEditablePositionAfterPositionInRoot):
+ (WebCore::lastEditablePositionBeforePositionInRoot):
+ (WebCore::selectionForParagraphIteration):
+ * editing/markup.cpp:
+ (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
+ * html/CachedHTMLCollection.h:
+ (WebCore::traversalType>::namedItem):
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::formElementIndex):
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::selectClosestContextualWordOrLinkFromMouseEvent):
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::getElementById):
+
2016-11-16 Ryosuke Niwa <[email protected]>
Fix build on macOS Sierra when WEB_PLAYBACK_CONTROLS_MANAGER is enabled
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (208838 => 208839)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -911,11 +911,12 @@
// Prefer the actionElement instead of this node, if the actionElement is inside this node.
Element* pressElement = this->element();
- if (!pressElement || actionElem->isDescendantOf(pressElement))
+ if (!pressElement || actionElem->isDescendantOf(*pressElement))
pressElement = actionElem;
+ ASSERT(pressElement);
// Prefer the hit test element, if it is inside the target element.
- if (hitTestElement && hitTestElement->isDescendantOf(pressElement))
+ if (hitTestElement && hitTestElement->isDescendantOf(*pressElement))
pressElement = hitTestElement;
UserGestureIndicator gestureIndicator(ProcessingUserGesture, document);
Modified: trunk/Source/WebCore/dom/Document.cpp (208838 => 208839)
--- trunk/Source/WebCore/dom/Document.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -3534,9 +3534,9 @@
static bool isNodeInSubtree(Node& node, Node& container, bool amongChildrenOnly)
{
if (amongChildrenOnly)
- return node.isDescendantOf(&container);
+ return node.isDescendantOf(container);
else
- return &node == &container || node.isDescendantOf(&container);
+ return &node == &container || node.isDescendantOf(container);
}
void Document::removeFocusedNodeOfSubtree(Node& node, bool amongChildrenOnly)
@@ -5963,9 +5963,9 @@
bool elementInSubtree = false;
if (amongChildrenOnly)
- elementInSubtree = m_fullScreenElement->isDescendantOf(&node);
+ elementInSubtree = m_fullScreenElement->isDescendantOf(node);
else
- elementInSubtree = (m_fullScreenElement == &node) || m_fullScreenElement->isDescendantOf(&node);
+ elementInSubtree = (m_fullScreenElement == &node) || m_fullScreenElement->isDescendantOf(node);
if (elementInSubtree)
fullScreenElementRemoved();
@@ -5982,7 +5982,7 @@
return;
m_isAnimatingFullScreen = flag;
- if (m_fullScreenElement && m_fullScreenElement->isDescendantOf(this)) {
+ if (m_fullScreenElement && m_fullScreenElement->isDescendantOf(*this)) {
m_fullScreenElement->invalidateStyleForSubtree();
scheduleForcedStyleRecalc();
}
Modified: trunk/Source/WebCore/dom/Node.cpp (208838 => 208839)
--- trunk/Source/WebCore/dom/Node.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/dom/Node.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -912,15 +912,15 @@
return { };
}
-bool Node::isDescendantOf(const Node* other) const
+bool Node::isDescendantOf(const Node& other) const
{
// Return true if other is an ancestor of this, otherwise false
- if (!other || !other->hasChildNodes() || inDocument() != other->inDocument())
+ if (!other.hasChildNodes() || inDocument() != other.inDocument())
return false;
- if (other->isDocumentNode())
- return &document() == other && !isDocumentNode() && inDocument();
- for (const ContainerNode* n = parentNode(); n; n = n->parentNode()) {
- if (n == other)
+ if (other.isDocumentNode())
+ return &document() == &other && !isDocumentNode() && inDocument();
+ for (const auto* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
+ if (ancestor == &other)
return true;
}
return false;
@@ -930,12 +930,12 @@
{
if (!other)
return false;
- if (isDescendantOf(other))
+ if (isDescendantOf(*other))
return true;
const Node* shadowAncestorNode = deprecatedShadowAncestorNode();
if (!shadowAncestorNode)
return false;
- return shadowAncestorNode == other || shadowAncestorNode->isDescendantOf(other);
+ return shadowAncestorNode == other || shadowAncestorNode->isDescendantOf(*other);
}
bool Node::contains(const Node* node) const
@@ -942,7 +942,7 @@
{
if (!node)
return false;
- return this == node || node->isDescendantOf(this);
+ return this == node || node->isDescendantOf(*this);
}
bool Node::containsIncludingShadowDOM(const Node* node) const
Modified: trunk/Source/WebCore/dom/Node.h (208838 => 208839)
--- trunk/Source/WebCore/dom/Node.h 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/dom/Node.h 2016-11-17 06:24:13 UTC (rev 208839)
@@ -386,7 +386,9 @@
ExceptionOr<void> checkSetPrefix(const AtomicString& prefix);
- WEBCORE_EXPORT bool isDescendantOf(const Node*) const;
+ WEBCORE_EXPORT bool isDescendantOf(const Node&) const;
+ WEBCORE_EXPORT bool isDescendantOf(const Node* other) const { return other && isDescendantOf(*other); }
+
bool isDescendantOrShadowDescendantOf(const Node*) const;
WEBCORE_EXPORT bool contains(const Node*) const;
bool containsIncludingShadowDOM(const Node*) const;
Modified: trunk/Source/WebCore/dom/NodeIterator.cpp (208838 => 208839)
--- trunk/Source/WebCore/dom/NodeIterator.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/dom/NodeIterator.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -143,10 +143,10 @@
// Iterator is not affected if the removed node is the reference node and is the root.
// or if removed node is not the reference node, or the ancestor of the reference node.
- if (!removedNode.isDescendantOf(&root()))
+ if (!removedNode.isDescendantOf(root()))
return;
bool willRemoveReferenceNode = &removedNode == referenceNode.node;
- bool willRemoveReferenceNodeAncestor = referenceNode.node && referenceNode.node->isDescendantOf(&removedNode);
+ bool willRemoveReferenceNodeAncestor = referenceNode.node && referenceNode.node->isDescendantOf(removedNode);
if (!willRemoveReferenceNode && !willRemoveReferenceNodeAncestor)
return;
@@ -155,7 +155,7 @@
if (node) {
// Move out from under the node being removed if the new reference
// node is a descendant of the node being removed.
- while (node && node->isDescendantOf(&removedNode))
+ while (node && node->isDescendantOf(removedNode))
node = NodeTraversal::next(*node, &root());
if (node)
referenceNode.node = node;
@@ -183,7 +183,7 @@
// Move out from under the node being removed if the reference node is
// a descendant of the node being removed.
if (willRemoveReferenceNodeAncestor) {
- while (node && node->isDescendantOf(&removedNode))
+ while (node && node->isDescendantOf(removedNode))
node = NodeTraversal::previous(*node);
}
if (node)
@@ -194,7 +194,7 @@
// Move out from under the node being removed if the reference node is
// a descendant of the node being removed.
if (willRemoveReferenceNodeAncestor) {
- while (node && node->isDescendantOf(&removedNode))
+ while (node && node->isDescendantOf(removedNode))
node = NodeTraversal::previous(*node);
}
if (node)
Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (208838 => 208839)
--- trunk/Source/WebCore/dom/SelectorQuery.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -228,7 +228,7 @@
ASSERT(elements);
bool rootNodeIsTreeScopeRoot = isTreeScopeRoot(rootNode);
for (auto& element : *elements) {
- if ((rootNodeIsTreeScopeRoot || element->isDescendantOf(&rootNode)) && selectorMatches(selectorData, *element, rootNode)) {
+ if ((rootNodeIsTreeScopeRoot || element->isDescendantOf(rootNode)) && selectorMatches(selectorData, *element, rootNode)) {
SelectorQueryTrait::appendOutputForElement(output, element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
return;
@@ -238,7 +238,7 @@
}
Element* element = rootNode.treeScope().getElementById(idToMatch);
- if (!element || !(isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode)))
+ if (!element || !(isTreeScopeRoot(rootNode) || element->isDescendantOf(rootNode)))
return;
if (selectorMatches(selectorData, *element, rootNode))
SelectorQueryTrait::appendOutputForElement(output, element);
@@ -269,7 +269,7 @@
if (LIKELY(!rootNode.treeScope().containsMultipleElementsWithId(idToMatch))) {
if (inAdjacentChain)
searchRoot = searchRoot->parentNode();
- if (searchRoot && (isTreeScopeRoot(rootNode) || searchRoot == &rootNode || searchRoot->isDescendantOf(&rootNode)))
+ if (searchRoot && (isTreeScopeRoot(rootNode) || searchRoot == &rootNode || searchRoot->isDescendantOf(rootNode)))
return *searchRoot;
}
}
Modified: trunk/Source/WebCore/dom/TypedElementDescendantIterator.h (208838 => 208839)
--- trunk/Source/WebCore/dom/TypedElementDescendantIterator.h 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/dom/TypedElementDescendantIterator.h 2016-11-17 06:24:13 UTC (rev 208839)
@@ -178,7 +178,7 @@
template <typename ElementType>
inline TypedElementDescendantIterator<ElementType> TypedElementDescendantIteratorAdapter<ElementType>::beginAt(ElementType& descendant)
{
- ASSERT(descendant.isDescendantOf(&m_root));
+ ASSERT(descendant.isDescendantOf(m_root));
return TypedElementDescendantIterator<ElementType>(m_root, &descendant);
}
@@ -185,7 +185,7 @@
template <typename ElementType>
inline TypedElementDescendantIterator<ElementType> TypedElementDescendantIteratorAdapter<ElementType>::from(Element& descendant)
{
- ASSERT(descendant.isDescendantOf(&m_root));
+ ASSERT(descendant.isDescendantOf(m_root));
if (is<ElementType>(descendant))
return TypedElementDescendantIterator<ElementType>(m_root, downcast<ElementType>(&descendant));
ElementType* next = Traversal<ElementType>::next(descendant, &m_root);
@@ -227,7 +227,7 @@
template <typename ElementType>
inline TypedElementDescendantConstIterator<ElementType> TypedElementDescendantConstIteratorAdapter<ElementType>::beginAt(const ElementType& descendant) const
{
- ASSERT(descendant.isDescendantOf(&m_root));
+ ASSERT(descendant.isDescendantOf(m_root));
return TypedElementDescendantConstIterator<ElementType>(m_root, &descendant);
}
@@ -234,7 +234,7 @@
template <typename ElementType>
inline TypedElementDescendantConstIterator<ElementType> TypedElementDescendantConstIteratorAdapter<ElementType>::from(const Element& descendant) const
{
- ASSERT(descendant.isDescendantOf(&m_root));
+ ASSERT(descendant.isDescendantOf(m_root));
if (is<ElementType>(descendant))
return TypedElementDescendantConstIterator<ElementType>(m_root, downcast<ElementType>(&descendant));
const ElementType* next = Traversal<ElementType>::next(descendant, &m_root);
Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -356,7 +356,7 @@
Node* beyondEnd;
ASSERT(start.deprecatedNode());
ASSERT(end.deprecatedNode());
- if (start.deprecatedNode()->isDescendantOf(end.deprecatedNode()))
+ if (start.deprecatedNode()->isDescendantOf(*end.deprecatedNode()))
beyondEnd = NodeTraversal::nextSkippingChildren(*end.deprecatedNode());
else
beyondEnd = NodeTraversal::next(*end.deprecatedNode());
@@ -785,7 +785,7 @@
// This is a plaintext-only region. Only proceed if it's fully selected.
// pastEndNode is the node after the last fully selected node, so if it's inside node then
// node isn't fully selected.
- if (pastEndNode && pastEndNode->isDescendantOf(node.get()))
+ if (pastEndNode && pastEndNode->isDescendantOf(*node))
break;
// Add to this element's inline style and skip over its contents.
HTMLElement& element = downcast<HTMLElement>(*node);
Modified: trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -120,7 +120,7 @@
}
// If there's nothing inside topBlockquote to move, we're finished.
- if (!startNode->isDescendantOf(topBlockquote)) {
+ if (!startNode->isDescendantOf(*topBlockquote)) {
setEndingSelection(VisibleSelection(VisiblePosition(firstPositionInOrBeforeNode(startNode)), endingSelection().isDirectional()));
return;
}
Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -1301,7 +1301,7 @@
auto clonedNode = node->cloneNode(true);
insertNodeAfter(clonedNode.ptr(), lastNode);
lastNode = WTFMove(clonedNode);
- if (node == end.deprecatedNode() || end.deprecatedNode()->isDescendantOf(node.get()))
+ if (node == end.deprecatedNode() || end.deprecatedNode()->isDescendantOf(*node))
break;
}
}
Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -519,7 +519,7 @@
if (comparePositions(firstPositionInOrBeforeNode(node.get()), m_downstreamEnd) >= 0) {
// NodeTraversal::nextSkippingChildren just blew past the end position, so stop deleting
node = nullptr;
- } else if (!m_downstreamEnd.deprecatedNode()->isDescendantOf(node.get())) {
+ } else if (!m_downstreamEnd.deprecatedNode()->isDescendantOf(*node)) {
RefPtr<Node> nextNode = NodeTraversal::nextSkippingChildren(*node);
// if we just removed a node from the end container, update end position so the
// check above will work
@@ -702,7 +702,7 @@
if (m_endTableRow && m_endTableRow->inDocument() && m_endTableRow != m_startTableRow)
if (isTableRowEmpty(m_endTableRow.get())) {
// Don't remove m_endTableRow if it's where we're putting the ending selection.
- if (!m_endingPosition.deprecatedNode()->isDescendantOf(m_endTableRow.get())) {
+ if (!m_endingPosition.deprecatedNode()->isDescendantOf(*m_endTableRow)) {
// FIXME: We probably shouldn't remove m_endTableRow unless it's fully selected, even if it is empty.
// We'll need to start adjusting the selection endpoints during deletion to know whether or not m_endTableRow
// was fully selected here.
@@ -820,9 +820,10 @@
// Don't need a placeholder when deleting a selection that starts just before a table
// and ends inside it (we do need placeholders to hold open empty cells, but that's
// handled elsewhere).
- if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleStart()))
- if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table))
+ if (auto* table = isLastPositionBeforeTable(m_selectionToDelete.visibleStart())) {
+ if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(*table))
m_needPlaceholder = false;
+ }
}
Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/EditingStyle.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -1531,7 +1531,7 @@
return NaturalWritingDirection;
// In the range case, make sure that the embedding element persists until the end of the range.
- if (selection.isRange() && !end.deprecatedNode()->isDescendantOf(node))
+ if (selection.isRange() && !end.deprecatedNode()->isDescendantOf(*node))
return NaturalWritingDirection;
foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirection : RightToLeftWritingDirection;
Modified: trunk/Source/WebCore/editing/FormatBlockCommand.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/FormatBlockCommand.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/FormatBlockCommand.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -75,7 +75,7 @@
return;
if (isElementForFormatBlock(refNode->tagQName()) && start == startOfBlock(start)
&& (end == endOfBlock(end) || isNodeVisiblyContainedWithin(*refNode, *range))
- && refNode != root && !root->isDescendantOf(refNode)) {
+ && refNode != root && !root->isDescendantOf(*refNode)) {
// Already in a block element that only contains the current paragraph
if (refNode->hasTagName(tagName()))
return;
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -472,7 +472,7 @@
bool pastEnd = NodeTraversal::next(*m_node) == m_pastEndNode;
Node* parentNode = m_node->parentOrShadowHostNode();
while (!next && parentNode) {
- if ((pastEnd && parentNode == m_endContainer) || m_endContainer->isDescendantOf(parentNode))
+ if ((pastEnd && parentNode == m_endContainer) || m_endContainer->isDescendantOf(*parentNode))
return;
bool haveRenderer = m_node->renderer();
m_node = parentNode;
Modified: trunk/Source/WebCore/editing/VisiblePosition.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/VisiblePosition.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/VisiblePosition.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -466,7 +466,7 @@
auto* highestRoot = highestEditableRoot(deepEquivalent());
// Return empty position if pos is not somewhere inside the editable region containing this position
- if (highestRoot && !position.deepEquivalent().deprecatedNode()->isDescendantOf(highestRoot)) {
+ if (highestRoot && !position.deepEquivalent().deprecatedNode()->isDescendantOf(*highestRoot)) {
if (reachedBoundary)
*reachedBoundary = true;
return VisiblePosition();
@@ -503,7 +503,7 @@
auto* highestRoot = highestEditableRoot(deepEquivalent());
// Return empty position if pos is not somewhere inside the editable region containing this position
- if (highestRoot && !pos.deepEquivalent().deprecatedNode()->isDescendantOf(highestRoot)) {
+ if (highestRoot && !pos.deepEquivalent().deprecatedNode()->isDescendantOf(*highestRoot)) {
if (reachedBoundary)
*reachedBoundary = true;
return VisiblePosition();
Modified: trunk/Source/WebCore/editing/htmlediting.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/htmlediting.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/htmlediting.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -299,10 +299,10 @@
candidate = positionAfterNode(shadowAncestor);
}
- while (candidate.deprecatedNode() && !isEditablePosition(candidate) && candidate.deprecatedNode()->isDescendantOf(highestRoot))
+ while (candidate.deprecatedNode() && !isEditablePosition(candidate) && candidate.deprecatedNode()->isDescendantOf(*highestRoot))
candidate = isAtomicNode(candidate.deprecatedNode()) ? positionInParentAfterNode(candidate.deprecatedNode()) : nextVisuallyDistinctCandidate(candidate);
- if (candidate.deprecatedNode() && candidate.deprecatedNode() != highestRoot && !candidate.deprecatedNode()->isDescendantOf(highestRoot))
+ if (candidate.deprecatedNode() && candidate.deprecatedNode() != highestRoot && !candidate.deprecatedNode()->isDescendantOf(*highestRoot))
return { };
return candidate;
@@ -327,10 +327,10 @@
candidate = firstPositionInOrBeforeNode(shadowAncestor);
}
- while (candidate.deprecatedNode() && !isEditablePosition(candidate) && candidate.deprecatedNode()->isDescendantOf(highestRoot))
+ while (candidate.deprecatedNode() && !isEditablePosition(candidate) && candidate.deprecatedNode()->isDescendantOf(*highestRoot))
candidate = isAtomicNode(candidate.deprecatedNode()) ? positionInParentBeforeNode(candidate.deprecatedNode()) : previousVisuallyDistinctCandidate(candidate);
- if (candidate.deprecatedNode() && candidate.deprecatedNode() != highestRoot && !candidate.deprecatedNode()->isDescendantOf(highestRoot))
+ if (candidate.deprecatedNode() && candidate.deprecatedNode() != highestRoot && !candidate.deprecatedNode()->isDescendantOf(*highestRoot))
return { };
return candidate;
@@ -1060,7 +1060,7 @@
// that we'll want modify is the last one inside the table, not the table itself
// (a table is itself a paragraph).
if (auto* table = isFirstPositionAfterTable(endOfSelection)) {
- if (startOfSelection.deepEquivalent().deprecatedNode()->isDescendantOf(table))
+ if (startOfSelection.deepEquivalent().deprecatedNode()->isDescendantOf(*table))
newSelection = VisibleSelection(startOfSelection, endOfSelection.previous(CannotCrossEditingBoundary));
}
@@ -1069,7 +1069,7 @@
// we'll want to modify is the first one inside the table, not the paragraph
// containing the table itself.
if (auto* table = isLastPositionBeforeTable(startOfSelection)) {
- if (endOfSelection.deepEquivalent().deprecatedNode()->isDescendantOf(table))
+ if (endOfSelection.deepEquivalent().deprecatedNode()->isDescendantOf(*table))
newSelection = VisibleSelection(startOfSelection.next(CannotCrossEditingBoundary), endOfSelection);
}
Modified: trunk/Source/WebCore/editing/markup.cpp (208838 => 208839)
--- trunk/Source/WebCore/editing/markup.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/editing/markup.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -410,7 +410,7 @@
if (!n->renderer() && !enclosingElementWithTag(firstPositionInOrBeforeNode(n), selectTag)) {
next = NodeTraversal::nextSkippingChildren(*n);
// Don't skip over pastEnd.
- if (pastEnd && pastEnd->isDescendantOf(n))
+ if (pastEnd && pastEnd->isDescendantOf(*n))
next = pastEnd;
} else {
// Add the node to the markup if we're not skipping the descendants
@@ -452,7 +452,7 @@
if (!parent->renderer())
continue;
// or b) ancestors that we never encountered during a pre-order traversal starting at startNode:
- ASSERT(startNode->isDescendantOf(parent));
+ ASSERT(startNode->isDescendantOf(*parent));
if (shouldEmit)
wrapWithNode(*parent);
lastClosed = parent;
Modified: trunk/Source/WebCore/html/CachedHTMLCollection.h (208838 => 208839)
--- trunk/Source/WebCore/html/CachedHTMLCollection.h 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/html/CachedHTMLCollection.h 2016-11-17 06:24:13 UTC (rev 208839)
@@ -146,7 +146,7 @@
return nullptr;
if (candidate && collection().elementMatches(*candidate)) {
- if (traversalType == CollectionTraversalType::ChildrenOnly ? candidate->parentNode() == &root : candidate->isDescendantOf(&root))
+ if (traversalType == CollectionTraversalType::ChildrenOnly ? candidate->parentNode() == &root : candidate->isDescendantOf(root))
return candidate;
}
}
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (208838 => 208839)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -537,7 +537,7 @@
unsigned currentAssociatedElementsAfterIndex = m_associatedElementsAfterIndex;
++m_associatedElementsAfterIndex;
- if (!associatedHTMLElement.isDescendantOf(this))
+ if (!associatedHTMLElement.isDescendantOf(*this))
return currentAssociatedElementsAfterIndex;
// Check for the special case where this element is the very last thing in
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (208838 => 208839)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -2051,7 +2051,7 @@
{
GraphicsContext* context = drawingContext();
- if (!element.focused() || !state().hasInvertibleTransform || path.isEmpty() || !element.isDescendantOf(&canvas()) || !context)
+ if (!element.focused() || !state().hasInvertibleTransform || path.isEmpty() || !element.isDescendantOf(canvas()) || !context)
return;
context->drawFocusRing(path, 1, 1, RenderTheme::focusRingColor());
Modified: trunk/Source/WebCore/page/EventHandler.cpp (208838 => 208839)
--- trunk/Source/WebCore/page/EventHandler.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -608,7 +608,7 @@
if (targetNode && targetNode->renderer() && m_mouseDownMayStartSelect) {
VisibleSelection newSelection;
VisiblePosition pos(targetNode->renderer()->positionForPoint(result.localPoint(), nullptr));
- if (pos.isNotNull() && pos.deepEquivalent().deprecatedNode()->isDescendantOf(urlElement))
+ if (pos.isNotNull() && pos.deepEquivalent().deprecatedNode()->isDescendantOf(*urlElement))
newSelection = VisibleSelection::selectionFromContentsOfNode(urlElement);
updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectSelectOnMouseDown(*targetNode, newSelection), WordGranularity);
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (208838 => 208839)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2016-11-17 05:46:32 UTC (rev 208838)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2016-11-17 06:24:13 UTC (rev 208839)
@@ -694,11 +694,11 @@
return nullptr;
Element* element = treeScope().getElementById(id);
- if (element && element->isDescendantOf(this))
+ if (element && element->isDescendantOf(*this))
return element;
if (treeScope().containsMultipleElementsWithId(id)) {
for (auto* element : *treeScope().getAllElementsById(id)) {
- if (element->isDescendantOf(this))
+ if (element->isDescendantOf(*this))
return element;
}
}