Diff
Modified: trunk/LayoutTests/ChangeLog (123204 => 123205)
--- trunk/LayoutTests/ChangeLog 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/LayoutTests/ChangeLog 2012-07-20 12:34:58 UTC (rev 123205)
@@ -1,3 +1,17 @@
+2012-07-20 Andrei Poenaru <[email protected]>
+
+ Web Inspector: Protocol Extension: add getNamedFlowCollection command
+ https://bugs.webkit.org/show_bug.cgi?id=91607
+
+ Reviewed by Pavel Feldman.
+
+ The test builds a webpage with 3 Named Flows in the main frame and 1 Named Flow in an iframe.
+ Because the getNamedFlowCollection command is executed with the main document node id as an argument,
+ it should return only the first 3 Named Flows.
+
+ * inspector/styles/protocol-getNamedFlowCollection-command-expected.txt: Added.
+ * inspector/styles/protocol-getNamedFlowCollection-command.html: Added.
+
2012-07-20 Sudarsana Nagineni <[email protected]>
[EFL] Gardening of failing tests
Added: trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command-expected.txt (0 => 123205)
--- trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command-expected.txt 2012-07-20 12:34:58 UTC (rev 123205)
@@ -0,0 +1,11 @@
+Tests that the "getNamedFlowCollection" command returns the CSS Named Flows in the page. Bug 91607
+
+flow1
+flow2
+flow3
+
+=== CSS Named Flows ===
+flow1
+flow2
+flow3
+
Added: trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html (0 => 123205)
--- trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html (rev 0)
+++ trunk/LayoutTests/inspector/styles/protocol-getNamedFlowCollection-command.html 2012-07-20 12:34:58 UTC (rev 123205)
@@ -0,0 +1,75 @@
+<html>
+<head>
+<script src=""
+<script>
+
+function createDynamicElements()
+{
+ var frameDoc = window.frames[0].document;
+
+ var el = frameDoc.createElement("article");
+ el.innerText = "flow4";
+ el.style.webkitFlowInto = "flow4";
+ frameDoc.body.appendChild(el);
+
+ el = frameDoc.createElement("div");
+ el.style.webkitFlowFrom = "flow4";
+ frameDoc.body.appendChild(el);
+}
+
+function test()
+{
+ WebInspector.showPanel("elements");
+ InspectorTest.evaluateInPage("createDynamicElements()", testStep);
+
+ function testStep()
+ {
+ function namedFlowCallback(namedFlows)
+ {
+ InspectorTest.addResult("=== CSS Named Flows ===");
+
+ if (!namedFlows)
+ {
+ InspectorTest.addResult("[!] Failed to get Named Flows");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ namedFlows.sort();
+
+ for (var i = 0; i < namedFlows.length; ++i)
+ InspectorTest.addResult(namedFlows[i]);
+
+ InspectorTest.completeTest();
+ }
+
+ function documentCallback(document)
+ {
+ WebInspector.cssModel.getNamedFlowCollectionAsync(document.id, namedFlowCallback);
+ }
+
+ WebInspector.domAgent.requestDocument(documentCallback);
+ }
+}
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that the "getNamedFlowCollection" command returns the CSS Named Flows in the page.
+<a href="" 91607</a>
+</p>
+
+<article style="-webkit-flow-into: flow1">flow1</article>
+<div style="-webkit-flow-from: flow1"></div>
+
+<article style="-webkit-flow-into: flow2">flow2</article>
+<div style="-webkit-flow-from: flow2"></div>
+
+<article style="-webkit-flow-into: flow3">flow3</article>
+<div style="-webkit-flow-from: flow3"></div>
+
+<iframe></iframe>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (123204 => 123205)
--- trunk/Source/WebCore/ChangeLog 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/ChangeLog 2012-07-20 12:34:58 UTC (rev 123205)
@@ -1,3 +1,34 @@
+2012-07-20 Andrei Poenaru <[email protected]>
+
+ Web Inspector: Protocol Extension: add getNamedFlowCollection command
+ https://bugs.webkit.org/show_bug.cgi?id=91607
+
+ Reviewed by Pavel Feldman.
+
+ Extended the protocol with "getNamedFlowCollection" command.
+ This command returns the CSS Named Flows from the document.
+
+ Test: inspector/styles/protocol-getNamedFlowCollection-command.html
+
+ * dom/WebKitNamedFlowCollection.cpp:
+ (WebCore::WebKitNamedFlowCollection::namedFlowsNames):
+ (WebCore):
+ * dom/WebKitNamedFlowCollection.h:
+ (WebKitNamedFlowCollection):
+ * inspector/Inspector.json:
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::getNamedFlowCollection):
+ (WebCore):
+ * inspector/InspectorCSSAgent.h:
+ (InspectorCSSAgent):
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::assertDocument):
+ (WebCore):
+ * inspector/InspectorDOMAgent.h:
+ (InspectorDOMAgent):
+ * inspector/front-end/CSSStyleModel.js:
+ (WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync):
+
2012-07-20 Eugene Klyuchnikov <[email protected]>
Web Inspector: Timeline: forward compatibility for load.
Modified: trunk/Source/WebCore/dom/WebKitNamedFlowCollection.cpp (123204 => 123205)
--- trunk/Source/WebCore/dom/WebKitNamedFlowCollection.cpp 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/dom/WebKitNamedFlowCollection.cpp 2012-07-20 12:34:58 UTC (rev 123205)
@@ -43,6 +43,20 @@
{
}
+Vector<String> WebKitNamedFlowCollection::namedFlowsNames()
+{
+ Vector<String> namedFlows;
+
+ for (NamedFlowSet::iterator it = m_namedFlows.begin(); it != m_namedFlows.end(); ++it) {
+ if ((*it)->flowState() == WebKitNamedFlow::FlowStateNull)
+ continue;
+
+ namedFlows.append((*it)->name().string());
+ }
+
+ return namedFlows;
+}
+
WebKitNamedFlow* WebKitNamedFlowCollection::flowByName(const String& flowName)
{
NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName);
Modified: trunk/Source/WebCore/dom/WebKitNamedFlowCollection.h (123204 => 123205)
--- trunk/Source/WebCore/dom/WebKitNamedFlowCollection.h 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/dom/WebKitNamedFlowCollection.h 2012-07-20 12:34:58 UTC (rev 123205)
@@ -34,6 +34,7 @@
#include <wtf/ListHashSet.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
namespace WebCore {
@@ -44,6 +45,7 @@
public:
static PassRefPtr<WebKitNamedFlowCollection> create(Document* doc) { return adoptRef(new WebKitNamedFlowCollection(doc)); }
+ Vector<String> namedFlowsNames();
WebKitNamedFlow* flowByName(const String&);
PassRefPtr<WebKitNamedFlow> ensureFlowWithName(const String&);
Modified: trunk/Source/WebCore/inspector/Inspector.json (123204 => 123205)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-07-20 12:34:58 UTC (rev 123205)
@@ -2287,6 +2287,17 @@
"returns": [
{ "name": "profile", "$ref": "SelectorProfile" }
]
+ },
+ {
+ "name": "getNamedFlowCollection",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id for which to get the Named Flow Collection."}
+ ],
+ "returns": [
+ { "name": "namedFlows", "type": "array", "items": { "type": "string" }, "description": "An array containing the Named Flows in the document." }
+ ],
+ "description": "Returns the Named Flows from the document.",
+ "hidden": true
}
],
"events": [
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (123204 => 123205)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2012-07-20 12:34:58 UTC (rev 123205)
@@ -51,6 +51,7 @@
#include "StyleResolver.h"
#include "StyleRule.h"
#include "StyleSheetList.h"
+#include "WebKitNamedFlowCollection.h"
#include <wtf/CurrentTime.h>
#include <wtf/HashSet.h>
@@ -787,6 +788,21 @@
cssProperties = properties.release();
}
+void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int nodeId, RefPtr<TypeBuilder::Array<String> >& result)
+{
+ Document* document = m_domAgent->assertDocument(errorString, nodeId);
+ if (!document)
+ return;
+
+ Vector<String> namedFlowsVector = document->namedFlows()->namedFlowsNames();
+ RefPtr<TypeBuilder::Array<String> > namedFlows = TypeBuilder::Array<String>::create();
+
+ for (Vector<String>::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it)
+ namedFlows->addItem(*it);
+
+ result = namedFlows.release();
+}
+
void InspectorCSSAgent::startSelectorProfiler(ErrorString*)
{
m_currentSelectorProfile = adoptPtr(new SelectorProfile());
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.h (123204 => 123205)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.h 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.h 2012-07-20 12:34:58 UTC (rev 123205)
@@ -110,6 +110,7 @@
virtual void setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result);
virtual void addRule(ErrorString*, int contextNodeId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result);
virtual void getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<String> >& result);
+ virtual void getNamedFlowCollection(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<String> >& result);
virtual void startSelectorProfiler(ErrorString*);
virtual void stopSelectorProfiler(ErrorString*, RefPtr<TypeBuilder::CSS::SelectorProfile>&);
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (123204 => 123205)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2012-07-20 12:34:58 UTC (rev 123205)
@@ -368,6 +368,19 @@
return node;
}
+Document* InspectorDOMAgent::assertDocument(ErrorString* errorString, int nodeId)
+{
+ Node* node = assertNode(errorString, nodeId);
+ if (!node)
+ return 0;
+
+ if (!(node->isDocumentNode())) {
+ *errorString = "Document is not available";
+ return 0;
+ }
+ return static_cast<Document*>(node);
+}
+
Element* InspectorDOMAgent::assertElement(ErrorString* errorString, int nodeId)
{
Node* node = assertNode(errorString, nodeId);
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (123204 => 123205)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h 2012-07-20 12:34:58 UTC (rev 123205)
@@ -190,6 +190,7 @@
static bool isWhitespace(Node*);
Node* assertNode(ErrorString*, int nodeId);
+ Document* assertDocument(ErrorString*, int nodeId);
// Methods called from other agents.
InspectorPageAgent* pageAgent() { return m_pageAgent; }
Modified: trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js (123204 => 123205)
--- trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js 2012-07-20 12:29:40 UTC (rev 123204)
+++ trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js 2012-07-20 12:34:58 UTC (rev 123205)
@@ -160,6 +160,28 @@
},
/**
+ * @param {DOMAgent.NodeId} nodeId
+ * @param {function(?Array.<string>)} userCallback
+ */
+ getNamedFlowCollectionAsync: function(nodeId, userCallback)
+ {
+ /**
+ * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback
+ * @param {?Protocol.Error} error
+ * @param {?Array.<string>=} namedFlowPayload
+ */
+ function callback(userCallback, error, namedFlowPayload)
+ {
+ if (error || !namedFlowPayload)
+ userCallback(null);
+ else
+ userCallback(namedFlowPayload);
+ }
+
+ CSSAgent.getNamedFlowCollection(nodeId, callback.bind(null, userCallback));
+ },
+
+ /**
* @param {CSSAgent.CSSRuleId} ruleId
* @param {DOMAgent.NodeId} nodeId
* @param {string} newSelector