Commit ad981b04 authored by vsevik@chromium.org's avatar vsevik@chromium.org

Web Inspector: Protocol Extension: Add "regionLayoutUpdate" event

https://bugs.webkit.org/show_bug.cgi?id=93443

Patch by Andrei Poenaru <poenaru@adobe.com> on 2012-09-04
Reviewed by Pavel Feldman.

Source/WebCore:

Added "regionLayoutUpdate" event to the protocol.

Removed "getFlowByName" from protocol.

The front-end keeps in sync the requested Named Flow Collections.

Modified existing test: inspector/styles/protocol-css-regions-commands.html

* dom/NamedFlowCollection.cpp:
(WebCore::NamedFlowCollection::ensureFlowWithName):
(WebCore::NamedFlowCollection::discardNamedFlow):
* inspector/Inspector.json:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::didCreateNamedFlow):
(WebCore::InspectorCSSAgent::willRemoveNamedFlow):
(WebCore):
(WebCore::InspectorCSSAgent::didUpdateRegionLayout):
(WebCore::InspectorCSSAgent::getNamedFlowCollection):
(WebCore::InspectorCSSAgent::documentNodeWithRequestedFlowsId):
* inspector/InspectorCSSAgent.h:
(InspectorCSSAgent):
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::didCreateNamedFlowImpl):
(WebCore::InspectorInstrumentation::willRemoveNamedFlowImpl):
(WebCore::InspectorInstrumentation::didUpdateRegionLayoutImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::didCreateNamedFlow):
(WebCore::InspectorInstrumentation::willRemoveNamedFlow):
(WebCore):
(WebCore::InspectorInstrumentation::didUpdateRegionLayout):
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel):
(WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync.callback):
(WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync):
(WebInspector.CSSStyleModel.prototype.getFlowByNameAsync.callback):
(WebInspector.CSSStyleModel.prototype.getFlowByNameAsync):
(WebInspector.CSSStyleModel.prototype._namedFlowCreated):
(WebInspector.CSSStyleModel.prototype._namedFlowRemoved):
(WebInspector.CSSStyleModel.prototype._regionLayoutUpdated):
(WebInspector.CSSStyleModel.prototype._resetNamedFlowCollections):
(WebInspector.CSSDispatcher.prototype.namedFlowCreated):
(WebInspector.CSSDispatcher.prototype.namedFlowRemoved):
(WebInspector.CSSDispatcher.prototype.regionLayoutUpdated):
(WebInspector.NamedFlow):
(WebInspector.NamedFlowCollection):
(WebInspector.NamedFlowCollection.prototype.appendNamedFlow):
(WebInspector.NamedFlowCollection.prototype.removeNamedFlow):
(WebInspector.NamedFlowCollection.prototype.flowByName):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent):

LayoutTests:

Validate "regionLayoutUpdate" event.

* inspector/styles/protocol-css-regions-commands-expected.txt:
* inspector/styles/protocol-css-regions-commands.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 533412d7
2012-09-04 Andrei Poenaru <poenaru@adobe.com>
Web Inspector: Protocol Extension: Add "regionLayoutUpdate" event
https://bugs.webkit.org/show_bug.cgi?id=93443
Reviewed by Pavel Feldman.
Validate "regionLayoutUpdate" event.
* inspector/styles/protocol-css-regions-commands-expected.txt:
* inspector/styles/protocol-css-regions-commands.html:
2012-09-04 Mario Sanchez Prada <msanchez@igalia.com> 2012-09-04 Mario Sanchez Prada <msanchez@igalia.com>
[Stable] [GTK] Crash in WebCore::HTMLSelectElement::selectedIndex [Stable] [GTK] Crash in WebCore::HTMLSelectElement::selectedIndex
...@@ -4,9 +4,11 @@ getNamedFlowCollection Bug 91607 ...@@ -4,9 +4,11 @@ getNamedFlowCollection Bug 91607
getFlowByName Bug 91855 getFlowByName Bug 91855
namedFlowCreated Bug 92739 namedFlowCreated Bug 92739
namedFlowRemoved Bug 92739 namedFlowRemoved Bug 92739
regionLayoutUpdated Bug 93443
This text is from CSS Named Flow "flow3".
Running: testGetNamedFlowCollection1 Running: testGetNamedFlowCollection
=== CSS Named Flows in main document === === CSS Named Flows in main document ===
* Named Flow "flow1" * Named Flow "flow1"
Content Elements: 1 Content Elements: 1
...@@ -18,23 +20,26 @@ Regions: 2 ...@@ -18,23 +20,26 @@ Regions: 2
Content Elements: 1 Content Elements: 1
Regions: 1 Regions: 1
Running: testGetNamedFlowCollection2 Running: testGetNamedFlowCollectionWithInvalidDocument
=== CSS Named Flows in #fake-document === === CSS Named Flows in #fake-document ===
#fake-document is not a document #fake-document is not a document
Running: testGetFlowByName1 Running: testGetFlowByName
=== Named Flow "flow2" from main document === === Named Flow "flow2" from main document ===
* Named Flow "flow2" * Named Flow "flow2"
Content Elements: 1 Content Elements: 1
Regions: 2 Regions: 2
Running: testGetFlowByName2 Running: testGetFlowByNameWithInvalidName
=== Name Flow "flow4" from main document === === Name Flow "flow4" from main document ===
There is no Named Flow "flow4" in the main document There is no Named Flow "flow4" in the main document
Running: testNamedFlowCreated Running: testNamedFlowCreated
NamedFlowCreated: "tmpNamedFlow" NamedFlowCreated: "tmpNamedFlow"
Running: testRegionLayoutUpdated
RegionLayoutUpdated: "flow3"
Running: testNamedFlowRemoved Running: testNamedFlowRemoved
NamedFlowRemoved: "tmpNamedFlow" NamedFlowRemoved: "tmpNamedFlow"
...@@ -21,24 +21,32 @@ function createDynamicElements() ...@@ -21,24 +21,32 @@ function createDynamicElements()
function createNamedFlow() function createNamedFlow()
{ {
var article = document.createElement("article"); var article = document.createElement("article");
var div = document.createElement("div");
article.id = "tmpArticle"; article.id = "tmpArticle";
article.style.webkitFlowInto = "tmpNamedFlow"; article.style["-webkit-flow-into"] = "tmpNamedFlow";
article.textContent = "This text is from CSS Named Flow \"tmpNamedFlow\"";
div.id = "tmpDiv";
div.style["-webkit-flow-from"] = "tmpNamedFlow";
div.style["height"] = "5px";
div.style["width"] = "20px";
document.body.appendChild(article); document.body.appendChild(article);
document.body.appendChild(div);
} }
function removeNamedFlow() function removeNamedFlow()
{ {
var article = document.getElementById("tmpArticle"); document.body.removeChild(document.getElementById("tmpArticle"));
document.body.removeChild(document.getElementById("tmpDiv"));
document.body.removeChild(article);
} }
function test() function test()
{ {
WebInspector.showPanel("elements"); WebInspector.showPanel("elements");
InspectorTest.runTestSuite([ InspectorTest.runTestSuite([
function testGetNamedFlowCollection1(next) function testGetNamedFlowCollection(next)
{ {
WebInspector.domAgent.requestDocument(documentCallback); WebInspector.domAgent.requestDocument(documentCallback);
...@@ -47,16 +55,20 @@ function test() ...@@ -47,16 +55,20 @@ function test()
WebInspector.cssModel.getNamedFlowCollectionAsync(document.id, namedFlowCallback); WebInspector.cssModel.getNamedFlowCollectionAsync(document.id, namedFlowCallback);
} }
function namedFlowCallback(namedFlows) function namedFlowCallback(namedFlowMap)
{ {
InspectorTest.addResult("=== CSS Named Flows in main document ==="); InspectorTest.addResult("=== CSS Named Flows in main document ===");
if (!namedFlows) { if (!namedFlowMap) {
InspectorTest.addResult("[!] Failed to get Named Flows"); InspectorTest.addResult("[!] Failed to get Named Flows");
InspectorTest.completeTest(); InspectorTest.completeTest();
return; return;
} }
namedFlows = [];
for (var flowName in namedFlowMap)
namedFlows.push(namedFlowMap[flowName]);
namedFlows.sort(function (nf1, nf2) { namedFlows.sort(function (nf1, nf2) {
return ((nf1.name == nf2.name) ? 0 : ((nf1.name > nf2.name) ? 1 : -1)); return ((nf1.name == nf2.name) ? 0 : ((nf1.name > nf2.name) ? 1 : -1));
}); });
...@@ -68,7 +80,7 @@ function test() ...@@ -68,7 +80,7 @@ function test()
} }
}, },
function testGetNamedFlowCollection2(next) function testGetNamedFlowCollectionWithInvalidDocument(next)
{ {
WebInspector.domAgent.requestDocument(documentCallback); WebInspector.domAgent.requestDocument(documentCallback);
...@@ -82,11 +94,11 @@ function test() ...@@ -82,11 +94,11 @@ function test()
WebInspector.cssModel.getNamedFlowCollectionAsync(nodeId, namedFlowCallback); WebInspector.cssModel.getNamedFlowCollectionAsync(nodeId, namedFlowCallback);
} }
function namedFlowCallback(namedFlows) function namedFlowCallback(namedFlowMap)
{ {
InspectorTest.addResult("=== CSS Named Flows in #fake-document ==="); InspectorTest.addResult("=== CSS Named Flows in #fake-document ===");
if (namedFlows) { if (namedFlowMap) {
InspectorTest.addResult("[!] Failed"); InspectorTest.addResult("[!] Failed");
InspectorTest.completeTest(); InspectorTest.completeTest();
return; return;
...@@ -97,7 +109,7 @@ function test() ...@@ -97,7 +109,7 @@ function test()
} }
}, },
function testGetFlowByName1(next) function testGetFlowByName(next)
{ {
WebInspector.domAgent.requestDocument(documentCallback); WebInspector.domAgent.requestDocument(documentCallback);
...@@ -122,7 +134,7 @@ function test() ...@@ -122,7 +134,7 @@ function test()
} }
}, },
function testGetFlowByName2(next) function testGetFlowByNameWithInvalidName(next)
{ {
WebInspector.domAgent.requestDocument(documentCallback); WebInspector.domAgent.requestDocument(documentCallback);
...@@ -153,15 +165,29 @@ function test() ...@@ -153,15 +165,29 @@ function test()
function callback(event) function callback(event)
{ {
if (event.data.name !== "tmpNamedFlow")
return;
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, callback, this); WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, callback, this);
if (event.data.name !== "tmpNamedFlow") { InspectorTest.addResult("NamedFlowCreated: \"tmpNamedFlow\"");
Inspector.addResult("[!] Failed"); next();
InspectorTest.completeTest(); }
},
function testRegionLayoutUpdated(next)
{
WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, callback, this);
InspectorTest.evaluateInPage("document.getElementById(\"region3\").style[\"width\"] = \"200px\"");
function callback(event)
{
if (event.data.name !== "flow3")
return; return;
}
InspectorTest.addResult("NamedFlowCreated: \"tmpNamedFlow\""); WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, callback, this);
InspectorTest.addResult("RegionLayoutUpdated: \"flow3\"");
next(); next();
} }
}, },
...@@ -173,12 +199,10 @@ function test() ...@@ -173,12 +199,10 @@ function test()
function callback(event) function callback(event)
{ {
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, callback, this); if (event.data.flowName !== "tmpNamedFlow")
if (event.data.name !== "tmpNamedFlow") {
Inspector.addResult("[!] Failed");
InspectorTest.completeTest();
return; return;
}
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, callback, this);
InspectorTest.addResult("NamedFlowRemoved: \"tmpNamedFlow\""); InspectorTest.addResult("NamedFlowRemoved: \"tmpNamedFlow\"");
next(); next();
...@@ -204,6 +228,7 @@ Tests the following commands and events: ...@@ -204,6 +228,7 @@ Tests the following commands and events:
<li>getFlowByName <a href="https://bugs.webkit.org/show_bug.cgi?id=91855">Bug 91855</a></li> <li>getFlowByName <a href="https://bugs.webkit.org/show_bug.cgi?id=91855">Bug 91855</a></li>
<li>namedFlowCreated <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li> <li>namedFlowCreated <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li>
<li>namedFlowRemoved <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li> <li>namedFlowRemoved <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li>
<li>regionLayoutUpdated <a href="https://bugs.webkit.org/show_bug.cgi?id=93443">Bug 93443</a></li>
</ul> </ul>
</p> </p>
...@@ -216,8 +241,10 @@ Tests the following commands and events: ...@@ -216,8 +241,10 @@ Tests the following commands and events:
<div style="-webkit-flow-from: flow2"></div> <div style="-webkit-flow-from: flow2"></div>
<div style="-webkit-flow-from: flow2"></div> <div style="-webkit-flow-from: flow2"></div>
<article style="-webkit-flow-into: flow3"></article> <article style="-webkit-flow-into: flow3">
<div style="-webkit-flow-from: flow3"></div> This text is from CSS Named Flow "flow3".
</article>
<div id="region3" style="-webkit-flow-from: flow3; height: 20px; width: 5px"></div>
<div id="fake-document"></div> <div id="fake-document"></div>
......
2012-09-04 Andrei Poenaru <poenaru@adobe.com>
Web Inspector: Protocol Extension: Add "regionLayoutUpdate" event
https://bugs.webkit.org/show_bug.cgi?id=93443
Reviewed by Pavel Feldman.
Added "regionLayoutUpdate" event to the protocol.
Removed "getFlowByName" from protocol.
The front-end keeps in sync the requested Named Flow Collections.
Modified existing test: inspector/styles/protocol-css-regions-commands.html
* dom/NamedFlowCollection.cpp:
(WebCore::NamedFlowCollection::ensureFlowWithName):
(WebCore::NamedFlowCollection::discardNamedFlow):
* inspector/Inspector.json:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::didCreateNamedFlow):
(WebCore::InspectorCSSAgent::willRemoveNamedFlow):
(WebCore):
(WebCore::InspectorCSSAgent::didUpdateRegionLayout):
(WebCore::InspectorCSSAgent::getNamedFlowCollection):
(WebCore::InspectorCSSAgent::documentNodeWithRequestedFlowsId):
* inspector/InspectorCSSAgent.h:
(InspectorCSSAgent):
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::didCreateNamedFlowImpl):
(WebCore::InspectorInstrumentation::willRemoveNamedFlowImpl):
(WebCore::InspectorInstrumentation::didUpdateRegionLayoutImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::didCreateNamedFlow):
(WebCore::InspectorInstrumentation::willRemoveNamedFlow):
(WebCore):
(WebCore::InspectorInstrumentation::didUpdateRegionLayout):
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel):
(WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync.callback):
(WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync):
(WebInspector.CSSStyleModel.prototype.getFlowByNameAsync.callback):
(WebInspector.CSSStyleModel.prototype.getFlowByNameAsync):
(WebInspector.CSSStyleModel.prototype._namedFlowCreated):
(WebInspector.CSSStyleModel.prototype._namedFlowRemoved):
(WebInspector.CSSStyleModel.prototype._regionLayoutUpdated):
(WebInspector.CSSStyleModel.prototype._resetNamedFlowCollections):
(WebInspector.CSSDispatcher.prototype.namedFlowCreated):
(WebInspector.CSSDispatcher.prototype.namedFlowRemoved):
(WebInspector.CSSDispatcher.prototype.regionLayoutUpdated):
(WebInspector.NamedFlow):
(WebInspector.NamedFlowCollection):
(WebInspector.NamedFlowCollection.prototype.appendNamedFlow):
(WebInspector.NamedFlowCollection.prototype.removeNamedFlow):
(WebInspector.NamedFlowCollection.prototype.flowByName):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent):
2012-09-04 Jonathan Liu <net147@gmail.com> 2012-09-04 Jonathan Liu <net147@gmail.com>
Fix IDL dependency generation correctly Fix IDL dependency generation correctly
...@@ -81,7 +81,7 @@ PassRefPtr<WebKitNamedFlow> NamedFlowCollection::ensureFlowWithName(const String ...@@ -81,7 +81,7 @@ PassRefPtr<WebKitNamedFlow> NamedFlowCollection::ensureFlowWithName(const String
RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName); RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName);
m_namedFlows.add(newFlow.get()); m_namedFlows.add(newFlow.get());
InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow->name()); InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow.get());
return newFlow.release(); return newFlow.release();
} }
...@@ -95,9 +95,9 @@ void NamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow) ...@@ -95,9 +95,9 @@ void NamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow)
ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull); ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull);
ASSERT(m_namedFlows.contains(namedFlow)); ASSERT(m_namedFlows.contains(namedFlow));
m_namedFlows.remove(namedFlow); InspectorInstrumentation::willRemoveNamedFlow(m_document, namedFlow);
InspectorInstrumentation::didRemoveNamedFlow(m_document, namedFlow->name()); m_namedFlows.remove(namedFlow);
} }
void NamedFlowCollection::documentDestroyed() void NamedFlowCollection::documentDestroyed()
......
...@@ -2412,18 +2412,6 @@ ...@@ -2412,18 +2412,6 @@
], ],
"description": "Returns the Named Flows from the document.", "description": "Returns the Named Flows from the document.",
"hidden": true "hidden": true
},
{
"name": "getFlowByName",
"parameters": [
{ "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
{ "name": "name", "type": "string", "description": "Named Flow identifier." }
],
"returns": [
{ "name": "namedFlow", "$ref": "NamedFlow", "description": "A Named Flow." }
],
"description": "Returns the Named Flow identified by the given name",
"hidden": true
} }
], ],
"events": [ "events": [
...@@ -2441,8 +2429,7 @@ ...@@ -2441,8 +2429,7 @@
{ {
"name": "namedFlowCreated", "name": "namedFlowCreated",
"parameters": [ "parameters": [
{ "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, { "name": "namedFlow", "$ref": "NamedFlow", "description": "The new Named Flow." }
{ "name": "namedFlow", "type": "string", "description": "Identifier of the new Named Flow." }
], ],
"description": "Fires when a Named Flow is created.", "description": "Fires when a Named Flow is created.",
"hidden": true "hidden": true
...@@ -2451,10 +2438,18 @@ ...@@ -2451,10 +2438,18 @@
"name": "namedFlowRemoved", "name": "namedFlowRemoved",
"parameters": [ "parameters": [
{ "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
{ "name": "namedFlow", "type": "string", "description": "Identifier of the removed Named Flow." } { "name": "flowName", "type": "string", "description": "Identifier of the removed Named Flow." }
], ],
"description": "Fires when a Named Flow is removed: has no associated content nodes and regions.", "description": "Fires when a Named Flow is removed: has no associated content nodes and regions.",
"hidden": true "hidden": true
},
{
"name": "regionLayoutUpdated",
"parameters": [
{ "name": "namedFlow", "$ref": "NamedFlow", "description": "The Named Flow whose layout may have changed." }
],
"description": "Fires when a Named Flow's layout may have changed.",
"hidden": true
} }
] ]
}, },
......
...@@ -537,22 +537,33 @@ void InspectorCSSAgent::mediaQueryResultChanged() ...@@ -537,22 +537,33 @@ void InspectorCSSAgent::mediaQueryResultChanged()
m_frontend->mediaQueryResultChanged(); m_frontend->mediaQueryResultChanged();
} }
void InspectorCSSAgent::didCreateNamedFlow(Document* document, const AtomicString& name) void InspectorCSSAgent::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
{ {
int nodeId = m_domAgent->boundNodeId(document); int documentNodeId = documentNodeWithRequestedFlowsId(document);
if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId)) if (!documentNodeId)
return; return;
m_frontend->namedFlowCreated(nodeId, name.string()); ErrorString errorString;
m_frontend->namedFlowCreated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId));
} }
void InspectorCSSAgent::didRemoveNamedFlow(Document* document, const AtomicString& name) void InspectorCSSAgent::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
{ {
int nodeId = m_domAgent->boundNodeId(document); int documentNodeId = documentNodeWithRequestedFlowsId(document);
if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId)) if (!documentNodeId)
return; return;
m_frontend->namedFlowRemoved(nodeId, name.string()); m_frontend->namedFlowRemoved(documentNodeId, namedFlow->name().string());
}
void InspectorCSSAgent::didUpdateRegionLayout(Document* document, WebKitNamedFlow* namedFlow)
{
int documentNodeId = documentNodeWithRequestedFlowsId(document);
if (!documentNodeId)
return;
ErrorString errorString;
m_frontend->regionLayoutUpdated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId));
} }
bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoType pseudoType) bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoType pseudoType)
...@@ -828,32 +839,16 @@ void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int doc ...@@ -828,32 +839,16 @@ void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int doc
return; return;
m_namedFlowCollectionsRequested.add(documentNodeId); m_namedFlowCollectionsRequested.add(documentNodeId);
Vector<RefPtr<WebKitNamedFlow> > namedFlowsVector = document->namedFlows()->namedFlows(); Vector<RefPtr<WebKitNamedFlow> > namedFlowsVector = document->namedFlows()->namedFlows();
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> > namedFlows = TypeBuilder::Array<TypeBuilder::CSS::NamedFlow>::create(); RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> > namedFlows = TypeBuilder::Array<TypeBuilder::CSS::NamedFlow>::create();
for (Vector<RefPtr<WebKitNamedFlow> >::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it) for (Vector<RefPtr<WebKitNamedFlow> >::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it)
namedFlows->addItem(buildObjectForNamedFlow(errorString, it->get(), documentNodeId)); namedFlows->addItem(buildObjectForNamedFlow(errorString, it->get(), documentNodeId));
result = namedFlows.release(); result = namedFlows.release();
} }
void InspectorCSSAgent::getFlowByName(ErrorString* errorString, int documentNodeId, const String& flowName, RefPtr<TypeBuilder::CSS::NamedFlow>& result)
{
Document* document = m_domAgent->assertDocument(errorString, documentNodeId);
if (!document)
return;
WebKitNamedFlow* webkitNamedFlow = document->namedFlows()->flowByName(flowName);
if (!webkitNamedFlow) {
*errorString = "No target CSS Named Flow found";
return;
}
RefPtr<WebKitNamedFlow> protector(webkitNamedFlow);
result = buildObjectForNamedFlow(errorString, webkitNamedFlow, documentNodeId);
}
void InspectorCSSAgent::startSelectorProfiler(ErrorString*) void InspectorCSSAgent::startSelectorProfiler(ErrorString*)
{ {
m_currentSelectorProfile = adoptPtr(new SelectorProfile()); m_currentSelectorProfile = adoptPtr(new SelectorProfile());
...@@ -933,6 +928,15 @@ Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId) ...@@ -933,6 +928,15 @@ Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId)
return toElement(node); return toElement(node);
} }
int InspectorCSSAgent::documentNodeWithRequestedFlowsId(Document* document)
{
int documentNodeId = m_domAgent->boundNodeId(document);
if (!documentNodeId || !m_namedFlowCollectionsRequested.contains(documentNodeId))
return 0;
return documentNodeId;
}
void InspectorCSSAgent::collectStyleSheets(CSSStyleSheet* styleSheet, TypeBuilder::Array<TypeBuilder::CSS::CSSStyleSheetHeader>* result) void InspectorCSSAgent::collectStyleSheets(CSSStyleSheet* styleSheet, TypeBuilder::Array<TypeBuilder::CSS::CSSStyleSheetHeader>* result)
{ {
InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(static_cast<CSSStyleSheet*>(styleSheet)); InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(static_cast<CSSStyleSheet*>(styleSheet));
......
...@@ -99,8 +99,9 @@ public: ...@@ -99,8 +99,9 @@ public:
virtual void disable(ErrorString*); virtual void disable(ErrorString*);
void reset(); void reset();
void mediaQueryResultChanged(); void mediaQueryResultChanged();
void didCreateNamedFlow(Document*, const AtomicString& name); void didCreateNamedFlow(Document*, WebKitNamedFlow*);
void didRemoveNamedFlow(Document*, const AtomicString& name); void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
void didUpdateRegionLayout(Document*, WebKitNamedFlow*);