Title: [209661] trunk/Source/WebCore
- Revision
- 209661
- Author
- [email protected]
- Date
- 2016-12-10 02:19:00 -0800 (Sat, 10 Dec 2016)
Log Message
Replace isUnclosedNode by isClosedShadowHidden
https://bugs.webkit.org/show_bug.cgi?id=165722
Reviewed by Antti Koivisto.
Replaced Node::isUnclosedNode by Node::isClosedShadowHidden and negated the semantics as done in the spec:
https://dom.spec.whatwg.org/#concept-closed-shadow-hidden
https://github.com/whatwg/dom/pull/306
Also added a version which follows the spec text for a debug assertion.
No new tests since this has no behavioral change.
* dom/EventContext.h:
(WebCore::EventContext::isUnreachableNode):
* dom/EventPath.cpp:
(WebCore::EventPath::computePathUnclosedToTarget):
(WebCore::RelatedNodeRetargeter::checkConsistency):
* dom/Node.cpp:
(WebCore::isClosedShadowHiddenUsingSpecDefinition): Added to assert our implementation matches the spec text.
(WebCore::Node::isClosedShadowHidden): Renamed from Node::isUnclosedNode and negated the return value.
* dom/Node.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (209660 => 209661)
--- trunk/Source/WebCore/ChangeLog 2016-12-10 10:00:33 UTC (rev 209660)
+++ trunk/Source/WebCore/ChangeLog 2016-12-10 10:19:00 UTC (rev 209661)
@@ -1,3 +1,28 @@
+2016-12-10 Ryosuke Niwa <[email protected]>
+
+ Replace isUnclosedNode by isClosedShadowHidden
+ https://bugs.webkit.org/show_bug.cgi?id=165722
+
+ Reviewed by Antti Koivisto.
+
+ Replaced Node::isUnclosedNode by Node::isClosedShadowHidden and negated the semantics as done in the spec:
+ https://dom.spec.whatwg.org/#concept-closed-shadow-hidden
+ https://github.com/whatwg/dom/pull/306
+
+ Also added a version which follows the spec text for a debug assertion.
+
+ No new tests since this has no behavioral change.
+
+ * dom/EventContext.h:
+ (WebCore::EventContext::isUnreachableNode):
+ * dom/EventPath.cpp:
+ (WebCore::EventPath::computePathUnclosedToTarget):
+ (WebCore::RelatedNodeRetargeter::checkConsistency):
+ * dom/Node.cpp:
+ (WebCore::isClosedShadowHiddenUsingSpecDefinition): Added to assert our implementation matches the spec text.
+ (WebCore::Node::isClosedShadowHidden): Renamed from Node::isUnclosedNode and negated the return value.
+ * dom/Node.h:
+
2016-12-10 Antti Koivisto <[email protected]>
CrashTracer: com.apple.WebKit.WebContent.Development at com.apple.WebCore: WTF::match_constness<WebCore::CSSValue, WebCore::CSSContentDistributionValue>::type& WTF::downcast<WebCore::CSSContentDistributionValue, WebCore::CSSValue> + 65
Modified: trunk/Source/WebCore/dom/EventContext.h (209660 => 209661)
--- trunk/Source/WebCore/dom/EventContext.h 2016-12-10 10:00:33 UTC (rev 209660)
+++ trunk/Source/WebCore/dom/EventContext.h 2016-12-10 10:19:00 UTC (rev 209661)
@@ -132,7 +132,7 @@
inline bool EventContext::isUnreachableNode(EventTarget* target) const
{
// FIXME: Checks also for SVG elements.
- return target && target->toNode() && !target->toNode()->isSVGElement() && !m_node->isUnclosedNode(*target->toNode());
+ return target && target->toNode() && !target->toNode()->isSVGElement() && m_node->isClosedShadowHidden(*target->toNode());
}
#endif
Modified: trunk/Source/WebCore/dom/EventPath.cpp (209660 => 209661)
--- trunk/Source/WebCore/dom/EventPath.cpp 2016-12-10 10:00:33 UTC (rev 209660)
+++ trunk/Source/WebCore/dom/EventPath.cpp 2016-12-10 10:19:00 UTC (rev 209661)
@@ -269,7 +269,7 @@
for (auto& context : m_path) {
if (Node* nodeInPath = context->currentTarget()->toNode()) {
- if (targetNode->isUnclosedNode(*nodeInPath))
+ if (!targetNode->isClosedShadowHidden(*nodeInPath))
path.append(context->currentTarget());
} else
path.append(context->currentTarget());
@@ -400,7 +400,7 @@
{
if (!m_retargetedRelatedNode)
return;
- ASSERT(currentTarget.isUnclosedNode(*m_retargetedRelatedNode));
+ ASSERT(!currentTarget.isClosedShadowHidden(*m_retargetedRelatedNode));
ASSERT(m_retargetedRelatedNode == ¤tTarget.treeScope().retargetToScope(m_relatedNode));
}
#endif
Modified: trunk/Source/WebCore/dom/Node.cpp (209660 => 209661)
--- trunk/Source/WebCore/dom/Node.cpp 2016-12-10 10:00:33 UTC (rev 209660)
+++ trunk/Source/WebCore/dom/Node.cpp 2016-12-10 10:19:00 UTC (rev 209661)
@@ -1073,8 +1073,18 @@
return is<ShadowRoot>(root) ? downcast<ShadowRoot>(&root) : nullptr;
}
+#if !ASSERT_DISABLED
+// https://dom.spec.whatwg.org/#concept-closed-shadow-hidden
+static bool isClosedShadowHiddenUsingSpecDefinition(const Node& A, const Node& B)
+{
+ return A.isInShadowTree()
+ && !A.rootNode().containsIncludingShadowDOM(&B)
+ && (A.containingShadowRoot()->mode() != ShadowRootMode::Open || isClosedShadowHiddenUsingSpecDefinition(*A.shadowHost(), B));
+}
+#endif
+
// http://w3c.github.io/webcomponents/spec/shadow/#dfn-unclosed-node
-bool Node::isUnclosedNode(const Node& otherNode) const
+bool Node::isClosedShadowHidden(const Node& otherNode) const
{
// Use Vector instead of HashSet since we expect the number of ancestor tree scopes to be small.
Vector<TreeScope*, 8> ancestorScopesOfThisNode;
@@ -1084,8 +1094,10 @@
for (auto* treeScopeThatCanAccessOtherNode = &otherNode.treeScope(); treeScopeThatCanAccessOtherNode; treeScopeThatCanAccessOtherNode = treeScopeThatCanAccessOtherNode->parentTreeScope()) {
for (auto* scope : ancestorScopesOfThisNode) {
- if (scope == treeScopeThatCanAccessOtherNode)
- return true; // treeScopeThatCanAccessOtherNode is a shadow-including inclusive ancestor of this node.
+ if (scope == treeScopeThatCanAccessOtherNode) {
+ ASSERT(!isClosedShadowHiddenUsingSpecDefinition(otherNode, *this));
+ return false; // treeScopeThatCanAccessOtherNode is a shadow-including inclusive ancestor of this node.
+ }
}
auto& root = treeScopeThatCanAccessOtherNode->rootNode();
if (is<ShadowRoot>(root) && downcast<ShadowRoot>(root).mode() != ShadowRootMode::Open)
@@ -1092,7 +1104,8 @@
break;
}
- return false;
+ ASSERT(isClosedShadowHiddenUsingSpecDefinition(otherNode, *this));
+ return true;
}
static inline ShadowRoot* parentShadowRoot(const Node& node)
Modified: trunk/Source/WebCore/dom/Node.h (209660 => 209661)
--- trunk/Source/WebCore/dom/Node.h 2016-12-10 10:00:33 UTC (rev 209660)
+++ trunk/Source/WebCore/dom/Node.h 2016-12-10 10:19:00 UTC (rev 209661)
@@ -241,7 +241,7 @@
WEBCORE_EXPORT Node* deprecatedShadowAncestorNode() const;
ShadowRoot* containingShadowRoot() const;
ShadowRoot* shadowRoot() const;
- bool isUnclosedNode(const Node&) const;
+ bool isClosedShadowHidden(const Node&) const;
HTMLSlotElement* assignedSlot() const;
HTMLSlotElement* assignedSlotForBindings() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes