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>
[Stable] [GTK] Crash in WebCore::HTMLSelectElement::selectedIndex
......@@ -4,9 +4,11 @@ getNamedFlowCollection Bug 91607
getFlowByName Bug 91855
namedFlowCreated 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 ===
* Named Flow "flow1"
Content Elements: 1
......@@ -18,23 +20,26 @@ Regions: 2
Content Elements: 1
Regions: 1
Running: testGetNamedFlowCollection2
Running: testGetNamedFlowCollectionWithInvalidDocument
=== CSS Named Flows in #fake-document ===
#fake-document is not a document
Running: testGetFlowByName1
Running: testGetFlowByName
=== Named Flow "flow2" from main document ===
* Named Flow "flow2"
Content Elements: 1
Regions: 2
Running: testGetFlowByName2
Running: testGetFlowByNameWithInvalidName
=== Name Flow "flow4" from main document ===
There is no Named Flow "flow4" in the main document
Running: testNamedFlowCreated
NamedFlowCreated: "tmpNamedFlow"
Running: testRegionLayoutUpdated
RegionLayoutUpdated: "flow3"
Running: testNamedFlowRemoved
NamedFlowRemoved: "tmpNamedFlow"
......@@ -21,24 +21,32 @@ function createDynamicElements()
function createNamedFlow()
{
var article = document.createElement("article");
var div = document.createElement("div");
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(div);
}
function removeNamedFlow()
{
var article = document.getElementById("tmpArticle");
document.body.removeChild(article);
document.body.removeChild(document.getElementById("tmpArticle"));
document.body.removeChild(document.getElementById("tmpDiv"));
}
function test()
{
WebInspector.showPanel("elements");
InspectorTest.runTestSuite([
function testGetNamedFlowCollection1(next)
function testGetNamedFlowCollection(next)
{
WebInspector.domAgent.requestDocument(documentCallback);
......@@ -47,16 +55,20 @@ function test()
WebInspector.cssModel.getNamedFlowCollectionAsync(document.id, namedFlowCallback);
}
function namedFlowCallback(namedFlows)
function namedFlowCallback(namedFlowMap)
{
InspectorTest.addResult("=== CSS Named Flows in main document ===");
if (!namedFlows) {
if (!namedFlowMap) {
InspectorTest.addResult("[!] Failed to get Named Flows");
InspectorTest.completeTest();
return;
}
namedFlows = [];
for (var flowName in namedFlowMap)
namedFlows.push(namedFlowMap[flowName]);
namedFlows.sort(function (nf1, nf2) {
return ((nf1.name == nf2.name) ? 0 : ((nf1.name > nf2.name) ? 1 : -1));
});
......@@ -68,7 +80,7 @@ function test()
}
},
function testGetNamedFlowCollection2(next)
function testGetNamedFlowCollectionWithInvalidDocument(next)
{
WebInspector.domAgent.requestDocument(documentCallback);
......@@ -82,11 +94,11 @@ function test()
WebInspector.cssModel.getNamedFlowCollectionAsync(nodeId, namedFlowCallback);
}
function namedFlowCallback(namedFlows)
function namedFlowCallback(namedFlowMap)
{
InspectorTest.addResult("=== CSS Named Flows in #fake-document ===");
if (namedFlows) {
if (namedFlowMap) {
InspectorTest.addResult("[!] Failed");
InspectorTest.completeTest();
return;
......@@ -97,7 +109,7 @@ function test()
}
},
function testGetFlowByName1(next)
function testGetFlowByName(next)
{
WebInspector.domAgent.requestDocument(documentCallback);
......@@ -122,7 +134,7 @@ function test()
}
},
function testGetFlowByName2(next)
function testGetFlowByNameWithInvalidName(next)
{
WebInspector.domAgent.requestDocument(documentCallback);
......@@ -153,15 +165,29 @@ function test()
function callback(event)
{
if (event.data.name !== "tmpNamedFlow")
return;
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, callback, this);
if (event.data.name !== "tmpNamedFlow") {
Inspector.addResult("[!] Failed");
InspectorTest.completeTest();
InspectorTest.addResult("NamedFlowCreated: \"tmpNamedFlow\"");
next();
}
},
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;
}
InspectorTest.addResult("NamedFlowCreated: \"tmpNamedFlow\"");
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, callback, this);
InspectorTest.addResult("RegionLayoutUpdated: \"flow3\"");
next();
}
},
......@@ -173,12 +199,10 @@ function test()
function callback(event)
{
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, callback, this);
if (event.data.name !== "tmpNamedFlow") {
Inspector.addResult("[!] Failed");
InspectorTest.completeTest();
if (event.data.flowName !== "tmpNamedFlow")
return;
}
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, callback, this);
InspectorTest.addResult("NamedFlowRemoved: \"tmpNamedFlow\"");
next();
......@@ -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>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>regionLayoutUpdated <a href="https://bugs.webkit.org/show_bug.cgi?id=93443">Bug 93443</a></li>
</ul>
</p>
......@@ -216,8 +241,10 @@ Tests the following commands and events:
<div style="-webkit-flow-from: flow2"></div>
<div style="-webkit-flow-from: flow2"></div>
<article style="-webkit-flow-into: flow3"></article>
<div style="-webkit-flow-from: flow3"></div>
<article style="-webkit-flow-into: flow3">
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>
......
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>
Fix IDL dependency generation correctly
......@@ -81,7 +81,7 @@ PassRefPtr<WebKitNamedFlow> NamedFlowCollection::ensureFlowWithName(const String
RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName);
m_namedFlows.add(newFlow.get());
InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow->name());
InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow.get());
return newFlow.release();
}
......@@ -95,9 +95,9 @@ void NamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow)
ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull);
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()
......
......@@ -2412,18 +2412,6 @@
],
"description": "Returns the Named Flows from the document.",
"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": [
......@@ -2441,8 +2429,7 @@
{
"name": "namedFlowCreated",
"parameters": [
{ "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
{ "name": "namedFlow", "type": "string", "description": "Identifier of the new Named Flow." }
{ "name": "namedFlow", "$ref": "NamedFlow", "description": "The new Named Flow." }
],
"description": "Fires when a Named Flow is created.",
"hidden": true
......@@ -2451,10 +2438,18 @@
"name": "namedFlowRemoved",
"parameters": [
{ "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.",
"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()
m_frontend->mediaQueryResultChanged();
}
void InspectorCSSAgent::didCreateNamedFlow(Document* document, const AtomicString& name)
void InspectorCSSAgent::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
{
int nodeId = m_domAgent->boundNodeId(document);
if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId))
int documentNodeId = documentNodeWithRequestedFlowsId(document);
if (!documentNodeId)
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);
if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId))
int documentNodeId = documentNodeWithRequestedFlowsId(document);
if (!documentNodeId)
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)
......@@ -828,32 +839,16 @@ void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int doc
return;
m_namedFlowCollectionsRequested.add(documentNodeId);
Vector<RefPtr<WebKitNamedFlow> > namedFlowsVector = document->namedFlows()->namedFlows();
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)
namedFlows->addItem(buildObjectForNamedFlow(errorString, it->get(), documentNodeId));
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*)
{
m_currentSelectorProfile = adoptPtr(new SelectorProfile());
......@@ -933,6 +928,15 @@ Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId)
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)
{
InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(static_cast<CSSStyleSheet*>(styleSheet));
......
......@@ -99,8 +99,9 @@ public:
virtual void disable(ErrorString*);
void reset();
void mediaQueryResultChanged();
void didCreateNamedFlow(Document*, const AtomicString& name);
void didRemoveNamedFlow(Document*, const AtomicString& name);
void didCreateNamedFlow(Document*, WebKitNamedFlow*);
void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
void didUpdateRegionLayout(Document*, WebKitNamedFlow*);
virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&);
virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::CSSStyle>& attributes);
......@@ -116,7 +117,6 @@ public:
virtual void getSupportedCSSProperties(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSPropertyInfo> >& result);
virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr<InspectorArray>& forcedPseudoClasses);
virtual void getNamedFlowCollection(ErrorString*, int documentNodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> >& result);
virtual void getFlowByName(ErrorString*, int documentNodeId, const String& flowName, RefPtr<TypeBuilder::CSS::NamedFlow>& result);
virtual void startSelectorProfiler(ErrorString*);
virtual void stopSelectorProfiler(ErrorString*, RefPtr<TypeBuilder::CSS::SelectorProfile>&);
......@@ -145,6 +145,7 @@ private:
InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element);
Element* elementForId(ErrorString*, int nodeId);
int documentNodeWithRequestedFlowsId(Document*);
void collectStyleSheets(CSSStyleSheet*, TypeBuilder::Array<WebCore::TypeBuilder::CSS::CSSStyleSheetHeader>*);
InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*);
......
......@@ -231,16 +231,22 @@ void InspectorInstrumentation::willPopShadowRootImpl(InstrumentingAgents* instru
domAgent->willPopShadowRoot(host, root);
}
void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name)
void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
{
if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
cssAgent->didCreateNamedFlow(document, name);
cssAgent->didCreateNamedFlow(document, namedFlow);
}
void InspectorInstrumentation::didRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name)
void InspectorInstrumentation::willRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
{
if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
cssAgent->didRemoveNamedFlow(document, name);
cssAgent->willRemoveNamedFlow(document, namedFlow);
}
void InspectorInstrumentation::didUpdateRegionLayoutImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
{
if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
cssAgent->didUpdateRegionLayout(document, namedFlow);
}
void InspectorInstrumentation::mouseDidMoveOverElementImpl(InstrumentingAgents* instrumentingAgents, const HitTestResult& result, unsigned modifierFlags)
......
......@@ -113,8 +113,9 @@ public:
static void mediaQueryResultChanged(Document*);
static void didPushShadowRoot(Element* host, ShadowRoot*);
static void willPopShadowRoot(Element* host, ShadowRoot*);
static void didCreateNamedFlow(Document*, const AtomicString& name);
static void didRemoveNamedFlow(Document*, const AtomicString& name);
static void didCreateNamedFlow(Document*, WebKitNamedFlow*);
static void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
static void didUpdateRegionLayout(Document*, WebKitNamedFlow*);
static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
static bool handleMousePress(Page*);
......@@ -290,8 +291,9 @@ private:
static void mediaQueryResultChangedImpl(InstrumentingAgents*);
static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, const AtomicString& name);
static void didRemoveNamedFlowImpl(InstrumentingAgents*, Document*, const AtomicString& name);
static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
static void willRemoveNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
static void didUpdateRegionLayoutImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
static bool handleMousePressImpl(InstrumentingAgents*);
......@@ -561,21 +563,30 @@ inline void InspectorInstrumentation::willPopShadowRoot(Element* host, ShadowRoo
#endif
}
inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, const AtomicString& name)
inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
didCreateNamedFlowImpl(instrumentingAgents, document, name);
didCreateNamedFlowImpl(instrumentingAgents, document, namedFlow);
#endif
}
inline void InspectorInstrumentation::didRemoveNamedFlow(Document* document, const AtomicString& name)
inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
didRemoveNamedFlowImpl(instrumentingAgents, document, name);
willRemoveNamedFlowImpl(instrumentingAgents, document, namedFlow);
#endif
}
inline void InspectorInstrumentation::didUpdateRegionLayout(Document* document, WebKitNamedFlow* namedFlow)
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
didUpdateRegionLayoutImpl(instrumentingAgents, document, namedFlow);
#endif
}
......
......@@ -39,6 +39,8 @@ WebInspector.CSSStyleModel = function()
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoRequested, this._undoRedoRequested, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this);
this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding(this);
this._namedFlowCollections = {};
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._resetNamedFlowCollections, this);
InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));
CSSAgent.enable();
}
......@@ -58,7 +60,8 @@ WebInspector.CSSStyleModel.Events = {
StyleSheetChanged: "StyleSheetChanged",
MediaQueryResultChanged: "MediaQueryResultChanged",
NamedFlowCreated: "NamedFlowCreated",
NamedFlowRemoved: "NamedFlowRemoved"
NamedFlowRemoved: "NamedFlowRemoved",
RegionLayoutUpdated: "RegionLayoutUpdated"
}
WebInspector.CSSStyleModel.prototype = {
......@@ -172,10 +175,16 @@ WebInspector.CSSStyleModel.prototype = {
/**
* @param {DOMAgent.NodeId} nodeId
* @param {function(?Array.<WebInspector.NamedFlow>)} userCallback
* @param {function(Object)} userCallback
*/
getNamedFlowCollectionAsync: function(nodeId, userCallback)
getNamedFlowCollectionAsync: function(documentNodeId, userCallback)
{
var namedFlowCollection = this._namedFlowCollections[documentNodeId];
if (namedFlowCollection) {
userCallback(namedFlowCollection.namedFlowMap);
return;
}
/**
* @param {function(?Array.<WebInspector.NamedFlow>)} userCallback
* @param {?Protocol.Error} error
......@@ -185,11 +194,14 @@ WebInspector.CSSStyleModel.prototype = {
{
if (error || !namedFlowPayload)
userCallback(null);
else