Title: [130926] trunk
Revision
130926
Author
shin...@chromium.org
Date
2012-10-10 10:47:54 -0700 (Wed, 10 Oct 2012)

Log Message

Needs internal API to return distributed nodes for InsertionPoint
https://bugs.webkit.org/show_bug.cgi?id=98868

Reviewed by Hajime Morita.

.:

* Source/autotools/symbols.filter:

Source/WebCore:

When testing insertion points, we would like to have an internal API which returns a node list
distributed to an insertion point.

We've added the API in Internals.

Test: fast/dom/shadow/distributed-nodes.html

* WebCore.exp.in:
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::distributedNodes): Returns the distributed nodes. When InsertionPoint is not
attached, the result will be null, since the distribution is not calculated correctly.
(WebCore):
* html/shadow/InsertionPoint.h:
(InsertionPoint):
* testing/Internals.cpp:
(WebCore::Internals::distributedNodes):
(WebCore):
* testing/Internals.h:
(Internals):
* testing/Internals.idl:

Source/WebKit2:

* win/WebKit2.def:
* win/WebKit2CFLite.def:

LayoutTests:

* fast/dom/shadow/distributed-nodes-expected.txt: Added.
* fast/dom/shadow/distributed-nodes.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (130925 => 130926)


--- trunk/ChangeLog	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/ChangeLog	2012-10-10 17:47:54 UTC (rev 130926)
@@ -1,3 +1,12 @@
+2012-10-10  Shinya Kawanaka  <shin...@chromium.org>
+
+        Needs internal API to return distributed nodes for InsertionPoint
+        https://bugs.webkit.org/show_bug.cgi?id=98868
+
+        Reviewed by Hajime Morita.
+
+        * Source/autotools/symbols.filter:
+
 2012-10-10  Yong Li  <y...@rim.com>
 
         [BlackBerry] Define WTF_USE_EXTRA_MACROS in cmake rather than Platform.h

Modified: trunk/LayoutTests/ChangeLog (130925 => 130926)


--- trunk/LayoutTests/ChangeLog	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/LayoutTests/ChangeLog	2012-10-10 17:47:54 UTC (rev 130926)
@@ -1,3 +1,13 @@
+2012-10-10  Shinya Kawanaka  <shin...@chromium.org>
+
+        Needs internal API to return distributed nodes for InsertionPoint
+        https://bugs.webkit.org/show_bug.cgi?id=98868
+
+        Reviewed by Hajime Morita.
+
+        * fast/dom/shadow/distributed-nodes-expected.txt: Added.
+        * fast/dom/shadow/distributed-nodes.html: Added.
+
 2012-10-10  Peter Beverloo  <pe...@chromium.org>
 
         Update more baselines and some entries in TestExpectations for Android.

Added: trunk/LayoutTests/fast/dom/shadow/distributed-nodes-expected.txt (0 => 130926)


--- trunk/LayoutTests/fast/dom/shadow/distributed-nodes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/distributed-nodes-expected.txt	2012-10-10 17:47:54 UTC (rev 130926)
@@ -0,0 +1,12 @@
+PASS nodeList.length is 3
+PASS nodeList.item(0) is a
+PASS nodeList.item(1) is b
+PASS nodeList.item(2) is c
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This test checks internals.distributedNodes(insertionPoint) returns the node distributed to the insertion point.
+
+A
+B
+C

Added: trunk/LayoutTests/fast/dom/shadow/distributed-nodes.html (0 => 130926)


--- trunk/LayoutTests/fast/dom/shadow/distributed-nodes.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/distributed-nodes.html	2012-10-10 17:47:54 UTC (rev 130926)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script src=""
+
+<p>This test checks internals.distributedNodes(insertionPoint) returns the node distributed to the insertion point.</p>
+
+<div id="host">
+    <div id="a">A</div>
+    <div id="b">B</div>
+    <div id="c">C</div>
+</div>
+
+<script>
+jsTestIsAsync = true;
+
+var shadowRoot = new WebKitShadowRoot(host);
+var shadow = document.createElement('content');
+shadow.setAttribute('select', 'div');
+shadowRoot.appendChild(shadow);
+
+var nodeList;
+setTimeout(function() {
+    nodeList = internals.distributedNodes(shadow);
+
+    shouldBe('nodeList.length', "3");
+    shouldBe('nodeList.item(0)', 'a');
+    shouldBe('nodeList.item(1)', 'b');
+    shouldBe('nodeList.item(2)', 'c');
+
+    finishJSTest();
+}, 0);
+
+</script>
+
+<script src=""
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (130925 => 130926)


--- trunk/Source/WebCore/ChangeLog	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebCore/ChangeLog	2012-10-10 17:47:54 UTC (rev 130926)
@@ -1,3 +1,31 @@
+2012-10-10  Shinya Kawanaka  <shin...@chromium.org>
+
+        Needs internal API to return distributed nodes for InsertionPoint
+        https://bugs.webkit.org/show_bug.cgi?id=98868
+
+        Reviewed by Hajime Morita.
+
+        When testing insertion points, we would like to have an internal API which returns a node list
+        distributed to an insertion point.
+
+        We've added the API in Internals.
+
+        Test: fast/dom/shadow/distributed-nodes.html
+
+        * WebCore.exp.in:
+        * html/shadow/InsertionPoint.cpp:
+        (WebCore::InsertionPoint::distributedNodes): Returns the distributed nodes. When InsertionPoint is not
+        attached, the result will be null, since the distribution is not calculated correctly.
+        (WebCore):
+        * html/shadow/InsertionPoint.h:
+        (InsertionPoint):
+        * testing/Internals.cpp:
+        (WebCore::Internals::distributedNodes):
+        (WebCore):
+        * testing/Internals.h:
+        (Internals):
+        * testing/Internals.idl:
+
 2012-10-10  Wei James  <james....@intel.com>
 
         [Chromium]Android x86 content shell debug build warning for uninitialized value used as error with gcc 4.6

Modified: trunk/Source/WebCore/WebCore.exp.in (130925 => 130926)


--- trunk/Source/WebCore/WebCore.exp.in	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-10-10 17:47:54 UTC (rev 130926)
@@ -1180,6 +1180,7 @@
 __ZNK7WebCore14FrameSelection31getClippedVisibleTextRectanglesERN3WTF6VectorINS_9FloatRectELm0EEE
 __ZNK7WebCore14FrameSelection36rootEditableElementOrDocumentElementEv
 __ZNK7WebCore14FrameSelection6boundsEb
+__ZNK7WebCore14InsertionPoint16distributedNodesEv
 __ZNK7WebCore14InsertionPoint8isActiveEv
 __ZNK7WebCore14RenderListItem10markerTextEv
 __ZNK7WebCore14ResourceHandle10connectionEv

Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (130925 => 130926)


--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp	2012-10-10 17:47:54 UTC (rev 130926)
@@ -33,6 +33,7 @@
 
 #include "ElementShadow.h"
 #include "ShadowRoot.h"
+#include "StaticNodeList.h"
 
 namespace WebCore {
 
@@ -86,6 +87,19 @@
     return true;
 }
 
+PassRefPtr<NodeList> InsertionPoint::distributedNodes() const
+{
+    if (!attached())
+        return 0;
+
+    Vector<RefPtr<Node> > nodes;
+
+    for (size_t i = 0; i < m_distribution.size(); ++i)
+        nodes.append(m_distribution.at(i));
+
+    return StaticNodeList::adopt(nodes);
+}
+
 bool InsertionPoint::rendererIsNeeded(const NodeRenderingContext& context)
 {
     return !isShadowBoundary() && HTMLElement::rendererIsNeeded(context);

Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (130925 => 130926)


--- trunk/Source/WebCore/html/shadow/InsertionPoint.h	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h	2012-10-10 17:47:54 UTC (rev 130926)
@@ -49,6 +49,8 @@
     bool isShadowBoundary() const;
     bool isActive() const;
 
+    PassRefPtr<NodeList> distributedNodes() const;
+
     virtual const AtomicString& select() const = 0;
     virtual bool isSelectValid() const = 0;
     virtual bool doesSelectFromHostChildren() const = 0;

Modified: trunk/Source/WebCore/testing/Internals.cpp (130925 => 130926)


--- trunk/Source/WebCore/testing/Internals.cpp	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebCore/testing/Internals.cpp	2012-10-10 17:47:54 UTC (rev 130926)
@@ -297,6 +297,16 @@
     return parentTreeScope ? parentTreeScope->rootNode() : 0;
 }
 
+PassRefPtr<NodeList> Internals::distributedNodes(Element* insertionPoint, ExceptionCode& ec)
+{
+    if (!insertionPoint || !isInsertionPoint(insertionPoint)) {
+        ec = INVALID_ACCESS_ERR;
+        return 0;
+    }
+
+    return toInsertionPoint(insertionPoint)->distributedNodes();
+}
+
 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionCode& ec) const
 {
     if (root && root->isShadowRoot())

Modified: trunk/Source/WebCore/testing/Internals.h (130925 => 130926)


--- trunk/Source/WebCore/testing/Internals.h	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebCore/testing/Internals.h	2012-10-10 17:47:54 UTC (rev 130926)
@@ -90,6 +90,7 @@
     bool isValidContentSelect(Element* insertionPoint, ExceptionCode&);
     Node* treeScopeRootNode(Node*, ExceptionCode&);
     Node* parentTreeScope(Node*, ExceptionCode&);
+    PassRefPtr<NodeList> distributedNodes(Element* insertionPoint, ExceptionCode&);
 
     bool attached(Node*, ExceptionCode&);
 

Modified: trunk/Source/WebCore/testing/Internals.idl (130925 => 130926)


--- trunk/Source/WebCore/testing/Internals.idl	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebCore/testing/Internals.idl	2012-10-10 17:47:54 UTC (rev 130926)
@@ -57,6 +57,7 @@
         boolean isValidContentSelect(in Element contentElement) raises(DOMException);
         Node treeScopeRootNode(in Node node) raises (DOMException);
         Node parentTreeScope(in Node node) raises (DOMException);
+        NodeList distributedNodes(in Element insertionPoint) raises(DOMException);
 
         Node nextSiblingByWalker(in Node node) raises(DOMException);
         Node firstChildByWalker(in Node node) raises(DOMException);

Modified: trunk/Source/WebKit2/ChangeLog (130925 => 130926)


--- trunk/Source/WebKit2/ChangeLog	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-10 17:47:54 UTC (rev 130926)
@@ -1,3 +1,13 @@
+2012-10-10  Shinya Kawanaka  <shin...@chromium.org>
+
+        Needs internal API to return distributed nodes for InsertionPoint
+        https://bugs.webkit.org/show_bug.cgi?id=98868
+
+        Reviewed by Hajime Morita.
+
+        * win/WebKit2.def:
+        * win/WebKit2CFLite.def:
+
 2012-10-10  Jocelyn Turcotte  <jocelyn.turco...@digia.com>
 
         [Qt][WK2] REGRESSION(r130879): It made fast/events/touch/* tests crash

Modified: trunk/Source/WebKit2/win/WebKit2.def (130925 => 130926)


--- trunk/Source/WebKit2/win/WebKit2.def	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebKit2/win/WebKit2.def	2012-10-10 17:47:54 UTC (rev 130926)
@@ -167,6 +167,7 @@
         ?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
         ?create@ShadowRoot@WebCore@@SA?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@PAVElement@2@AAH@Z
         ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
+        ?distributedNodes@InsertionPoint@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@XZ
         ?documentState@HistoryItem@WebCore@@QBEABV?$Vector@VString@WTF@@$0A@@WTF@@XZ
         ?equal@WTF@@YA_NPBVStringImpl@1@PBE@Z
         ?equal@WTF@@YA_NPBVStringImpl@1@0@Z

Modified: trunk/Source/WebKit2/win/WebKit2CFLite.def (130925 => 130926)


--- trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-10-10 17:47:54 UTC (rev 130926)
@@ -118,6 +118,7 @@
         ?detachThread@WTF@@YAXI@Z
         ?didBeginFrameImpl@InspectorInstrumentation@WebCore@@CAXPAVInstrumentingAgents@2@@Z
         ?didCancelFrameImpl@InspectorInstrumentation@WebCore@@CAXPAVInstrumentingAgents@2@@Z
+        ?distributedNodes@InsertionPoint@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@XZ
         ?initializeMainThread@WTF@@YAXXZ
         ?initializeThreading@WTF@@YAXXZ
         ?instrumentationForPage@WebCore@@YAPAVInstrumentingAgents@1@PAVPage@1@@Z

Modified: trunk/Source/autotools/symbols.filter (130925 => 130926)


--- trunk/Source/autotools/symbols.filter	2012-10-10 17:42:50 UTC (rev 130925)
+++ trunk/Source/autotools/symbols.filter	2012-10-10 17:47:54 UTC (rev 130926)
@@ -195,6 +195,7 @@
 _ZN7WebCore8Document35webkitWillEnterFullScreenForElementEPNS_7ElementE;
 _ZN7WebCore17JSDOMGlobalObject6s_infoE;
 _ZN7WebCore7TextRun22setAllowsRoundingHacksEb;
+_ZNK7WebCore14InsertionPoint16distributedNodesEv;
 _ZNK7WebCore14InsertionPoint8isActiveEv;
 _ZN7WebCore26ContextDestructionObserverD2Ev;
 _ZN7WebCore26ContextDestructionObserverC2EPNS_22ScriptExecutionContextE;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to