- Revision
- 118111
- Author
- [email protected]
- Date
- 2012-05-22 20:36:39 -0700 (Tue, 22 May 2012)
Log Message
Make ComposedShadowTreeWalker traverse inactive insertion points correctly.
https://bugs.webkit.org/show_bug.cgi?id=86830
Reviewed by Dimitri Glazkov.
Source/WebCore:
Fixed InsertionPoint::isActive() issue, which may return true
wrongly even if the insertion point is not in Shadow DOM subtree.
Now ComposedShadowTreeWalker can traverse inactive insertion
points correctly using InsertionPoint::isActive().
Test: fast/dom/shadow/composed-shadow-tree-walker.html
* dom/ComposedShadowTreeWalker.cpp:
(WebCore::ComposedShadowTreeWalker::traverseNode):
(WebCore::ComposedShadowTreeWalker::escapeFallbackContentElement):
(WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents):
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::isActive):
* html/shadow/InsertionPoint.h:
(WebCore::isActiveInsertionPoint):
(WebCore):
LayoutTests:
* fast/dom/shadow/composed-shadow-tree-walker-expected.txt:
* fast/dom/shadow/composed-shadow-tree-walker.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (118110 => 118111)
--- trunk/LayoutTests/ChangeLog 2012-05-23 03:23:22 UTC (rev 118110)
+++ trunk/LayoutTests/ChangeLog 2012-05-23 03:36:39 UTC (rev 118111)
@@ -1,3 +1,13 @@
+2012-05-22 Hayato Ito <[email protected]>
+
+ Make ComposedShadowTreeWalker traverse inactive insertion points correctly.
+ https://bugs.webkit.org/show_bug.cgi?id=86830
+
+ Reviewed by Dimitri Glazkov.
+
+ * fast/dom/shadow/composed-shadow-tree-walker-expected.txt:
+ * fast/dom/shadow/composed-shadow-tree-walker.html:
+
2012-05-22 Stephanie Lewis <[email protected]>
See https://bugs.webkit.org/show_bug.cgi?id=87199
Modified: trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt (118110 => 118111)
--- trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt 2012-05-23 03:23:22 UTC (rev 118110)
+++ trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker-expected.txt 2012-05-23 03:36:39 UTC (rev 118111)
@@ -150,6 +150,21 @@
DIV id=d
DIV id=a
+Test for inactive insertion points.
+Composed Shadow Tree:
+DIV id=a
+ CONTENT id=b
+ CONTENT id=c
+
+Traverse in forward.
+DIV id=a
+CONTENT id=b
+CONTENT id=c
+Traverse in backward.
+CONTENT id=c
+CONTENT id=b
+DIV id=a
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html (118110 => 118111)
--- trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html 2012-05-23 03:23:22 UTC (rev 118110)
+++ trunk/LayoutTests/fast/dom/shadow/composed-shadow-tree-walker.html 2012-05-23 03:36:39 UTC (rev 118111)
@@ -156,6 +156,12 @@
createDOM('div', {'id': 'e'})),
createDOM('div', {'id': 'f'})));
+debug('Test for inactive insertion points.');
+showComposedShadowTree(
+ createDOM('div', {'id': 'a'},
+ createDOM('content', {'id': 'b'},
+ createDOM('content', {'id': 'c'}))));
+
</script>
<script src=""
</body>
Modified: trunk/Source/WebCore/ChangeLog (118110 => 118111)
--- trunk/Source/WebCore/ChangeLog 2012-05-23 03:23:22 UTC (rev 118110)
+++ trunk/Source/WebCore/ChangeLog 2012-05-23 03:36:39 UTC (rev 118111)
@@ -1,3 +1,27 @@
+2012-05-22 Hayato Ito <[email protected]>
+
+ Make ComposedShadowTreeWalker traverse inactive insertion points correctly.
+ https://bugs.webkit.org/show_bug.cgi?id=86830
+
+ Reviewed by Dimitri Glazkov.
+
+ Fixed InsertionPoint::isActive() issue, which may return true
+ wrongly even if the insertion point is not in Shadow DOM subtree.
+ Now ComposedShadowTreeWalker can traverse inactive insertion
+ points correctly using InsertionPoint::isActive().
+
+ Test: fast/dom/shadow/composed-shadow-tree-walker.html
+
+ * dom/ComposedShadowTreeWalker.cpp:
+ (WebCore::ComposedShadowTreeWalker::traverseNode):
+ (WebCore::ComposedShadowTreeWalker::escapeFallbackContentElement):
+ (WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents):
+ * html/shadow/InsertionPoint.cpp:
+ (WebCore::InsertionPoint::isActive):
+ * html/shadow/InsertionPoint.h:
+ (WebCore::isActiveInsertionPoint):
+ (WebCore):
+
2012-05-22 Mark Pilgrim <[email protected]>
[Chromium] Call canAccelerate2dCanvas directly
Modified: trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp (118110 => 118111)
--- trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp 2012-05-23 03:23:22 UTC (rev 118110)
+++ trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp 2012-05-23 03:36:39 UTC (rev 118111)
@@ -112,13 +112,14 @@
Node* ComposedShadowTreeWalker::traverseNode(const Node* node, TraversalDirection direction)
{
ASSERT(node);
- if (isInsertionPoint(node)) {
- const InsertionPoint* insertionPoint = toInsertionPoint(node);
- if (Node* next = (direction == TraversalDirectionForward ? insertionPoint->first() : insertionPoint->last()))
- return traverseNode(next, direction);
- return traverseLightChildren(node, direction);
- }
- return const_cast<Node*>(node);
+ if (!isInsertionPoint(node))
+ return const_cast<Node*>(node);
+ const InsertionPoint* insertionPoint = toInsertionPoint(node);
+ if (!insertionPoint->isActive())
+ return const_cast<Node*>(node);
+ if (Node* next = (direction == TraversalDirectionForward ? insertionPoint->first() : insertionPoint->last()))
+ return traverseNode(next, direction);
+ return traverseLightChildren(node, direction);
}
void ComposedShadowTreeWalker::nextSibling()
@@ -176,7 +177,7 @@
Node* ComposedShadowTreeWalker::escapeFallbackContentElement(const Node* node, TraversalDirection direction)
{
ASSERT(node);
- if (node->parentNode() && isInsertionPoint(node->parentNode()))
+ if (node->parentNode() && isActiveInsertionPoint(node->parentNode()))
return traverseSiblingOrBackToInsertionPoint(node->parentNode(), direction);
return 0;
}
@@ -184,7 +185,7 @@
Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node) const
{
ASSERT(node);
- if (isInsertionPoint(node))
+ if (isActiveInsertionPoint(node))
return traverseParent(node);
return const_cast<Node*>(node);
}
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (118110 => 118111)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-05-23 03:23:22 UTC (rev 118110)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-05-23 03:36:39 UTC (rev 118111)
@@ -101,6 +101,8 @@
bool InsertionPoint::isActive() const
{
+ if (!shadowRoot())
+ return false;
const Node* node = parentNode();
while (node) {
if (WebCore::isInsertionPoint(node))
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (118110 => 118111)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-05-23 03:23:22 UTC (rev 118110)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-05-23 03:36:39 UTC (rev 118111)
@@ -102,6 +102,11 @@
return static_cast<const InsertionPoint*>(node);
}
+inline bool isActiveInsertionPoint(const Node* node)
+{
+ return isInsertionPoint(node) && toInsertionPoint(node)->isActive();
+}
+
inline bool isShadowBoundary(Node* node)
{
if (!isInsertionPoint(node))