Web Inspector: Protocol Extension: Add "regionLayoutUpdate" event
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2012 12:07:24 +0000 (12:07 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2012 12:07:24 +0000 (12:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=93443

Patch by Andrei Poenaru <poenaru@adobe.com> on 2012-09-12
Reviewed by Alexander Pavlov.

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:
(UpdateRegionLayoutTask):
(WebCore):
(WebCore::UpdateRegionLayoutTask::UpdateRegionLayoutTask):
(WebCore::UpdateRegionLayoutTask::scheduleFor):
(WebCore::UpdateRegionLayoutTask::unschedule):
(WebCore::UpdateRegionLayoutTask::reset):
(WebCore::UpdateRegionLayoutTask::onTimer):
(WebCore::InspectorCSSAgent::reset):
(WebCore::InspectorCSSAgent::didCreateNamedFlow):
(WebCore::InspectorCSSAgent::willRemoveNamedFlow):
(WebCore::InspectorCSSAgent::didUpdateRegionLayout):
(WebCore::InspectorCSSAgent::regionLayoutUpdated):
(WebCore::InspectorCSSAgent::getNamedFlowCollection):
(WebCore::InspectorCSSAgent::documentNodeWithRequestedFlowsId):
* inspector/InspectorCSSAgent.h:
(WebCore):
(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: https://svn.webkit.org/repository/webkit/trunk@128293 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt
LayoutTests/inspector/styles/protocol-css-regions-commands.html
Source/WebCore/ChangeLog
Source/WebCore/dom/NamedFlowCollection.cpp
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorCSSAgent.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/front-end/CSSStyleModel.js
Source/WebCore/rendering/RenderNamedFlowThread.cpp

index a6ebcee..c5895d6 100644 (file)
@@ -1,3 +1,15 @@
+2012-09-12  Andrei Poenaru  <poenaru@adobe.com>
+
+        Web Inspector: Protocol Extension: Add "regionLayoutUpdate" event
+        https://bugs.webkit.org/show_bug.cgi?id=93443
+
+        Reviewed by Alexander Pavlov.
+
+        Validate "regionLayoutUpdate" event.
+
+        * inspector/styles/protocol-css-regions-commands-expected.txt:
+        * inspector/styles/protocol-css-regions-commands.html:
+
 2012-09-12  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: [Elements] Sidebar panes not updated on style changes due to "class" attribute modifications
index 7c82b48..9fe9cf3 100644 (file)
@@ -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"
 
index d834c2a..6fc3f57 100644 (file)
@@ -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,21 @@ function test()
                 WebInspector.cssModel.getNamedFlowCollectionAsync(document.id, namedFlowCallback);
             }
 
-            function namedFlowCallback(namedFlows)
+            function namedFlowCallback(namedFlowCollection)
             {
                 InspectorTest.addResult("=== CSS Named Flows in main document ===");
 
-                if (!namedFlows) {
+                if (!namedFlowCollection) {
                     InspectorTest.addResult("[!] Failed to get Named Flows");
                     InspectorTest.completeTest();
                     return;
                 }
 
+                var namedFlowMap = namedFlowCollection.namedFlowMap;
+                var 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 +81,7 @@ function test()
             }
         },
 
-        function testGetNamedFlowCollection2(next)
+        function testGetNamedFlowCollectionWithInvalidDocument(next)
         {
             WebInspector.domAgent.requestDocument(documentCallback);
 
@@ -82,11 +95,11 @@ function test()
                 WebInspector.cssModel.getNamedFlowCollectionAsync(nodeId, namedFlowCallback);
             }
 
-            function namedFlowCallback(namedFlows)
+            function namedFlowCallback(namedFlowCollection)
             {
                 InspectorTest.addResult("=== CSS Named Flows in #fake-document ===");
 
-                if (namedFlows) {
+                if (namedFlowCollection) {
                     InspectorTest.addResult("[!] Failed");
                     InspectorTest.completeTest();
                     return;
@@ -97,7 +110,7 @@ function test()
             }
         },
 
-        function testGetFlowByName1(next)
+        function testGetFlowByName(next)
         {
             WebInspector.domAgent.requestDocument(documentCallback);
 
@@ -122,7 +135,7 @@ function test()
             }
         },
 
-        function testGetFlowByName2(next)
+        function testGetFlowByNameWithInvalidName(next)
         {
             WebInspector.domAgent.requestDocument(documentCallback);
 
@@ -153,15 +166,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("window.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 +200,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 +229,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 +242,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>
 
index 069b900..f386c44 100644 (file)
@@ -1,3 +1,72 @@
+2012-09-12  Andrei Poenaru  <poenaru@adobe.com>
+
+        Web Inspector: Protocol Extension: Add "regionLayoutUpdate" event
+        https://bugs.webkit.org/show_bug.cgi?id=93443
+
+        Reviewed by Alexander Pavlov.
+
+        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:
+        (UpdateRegionLayoutTask):
+        (WebCore):
+        (WebCore::UpdateRegionLayoutTask::UpdateRegionLayoutTask):
+        (WebCore::UpdateRegionLayoutTask::scheduleFor):
+        (WebCore::UpdateRegionLayoutTask::unschedule):
+        (WebCore::UpdateRegionLayoutTask::reset):
+        (WebCore::UpdateRegionLayoutTask::onTimer):
+        (WebCore::InspectorCSSAgent::reset):
+        (WebCore::InspectorCSSAgent::didCreateNamedFlow):
+        (WebCore::InspectorCSSAgent::willRemoveNamedFlow):
+        (WebCore::InspectorCSSAgent::didUpdateRegionLayout):
+        (WebCore::InspectorCSSAgent::regionLayoutUpdated):
+        (WebCore::InspectorCSSAgent::getNamedFlowCollection):
+        (WebCore::InspectorCSSAgent::documentNodeWithRequestedFlowsId):
+        * inspector/InspectorCSSAgent.h:
+        (WebCore):
+        (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-12  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: [Elements] Sidebar panes not updated on style changes due to "class" attribute modifications
index 1588fc6..5547506 100644 (file)
@@ -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()
index 8184cc0..f98ea33 100644 (file)
                 ],
                 "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": [
             {
                 "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
                 "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
             }
         ]
     },
index 24c7197..08425c6 100644 (file)
@@ -226,6 +226,67 @@ PassRefPtr<TypeBuilder::CSS::SelectorProfile> SelectorProfile::toInspectorObject
     return result.release();
 }
 
+class UpdateRegionLayoutTask {
+public:
+    UpdateRegionLayoutTask(InspectorCSSAgent*);
+    void scheduleFor(WebKitNamedFlow*, int documentNodeId);
+    void unschedule(WebKitNamedFlow*);
+    void reset();
+    void onTimer(Timer<UpdateRegionLayoutTask>*);
+
+private:
+    InspectorCSSAgent* m_cssAgent;
+    Timer<UpdateRegionLayoutTask> m_timer;
+    HashMap<WebKitNamedFlow*, int> m_namedFlows;
+};
+
+UpdateRegionLayoutTask::UpdateRegionLayoutTask(InspectorCSSAgent* cssAgent)
+    : m_cssAgent(cssAgent)
+    , m_timer(this, &UpdateRegionLayoutTask::onTimer)
+{
+}
+
+void UpdateRegionLayoutTask::scheduleFor(WebKitNamedFlow* namedFlow, int documentNodeId)
+{
+    m_namedFlows.add(namedFlow, documentNodeId);
+
+    if (!m_timer.isActive())
+        m_timer.startOneShot(0);
+}
+
+void UpdateRegionLayoutTask::unschedule(WebKitNamedFlow* namedFlow)
+{
+    m_namedFlows.remove(namedFlow);
+}
+
+void UpdateRegionLayoutTask::reset()
+{
+    m_timer.stop();
+    m_namedFlows.clear();
+}
+
+void UpdateRegionLayoutTask::onTimer(Timer<UpdateRegionLayoutTask>*)
+{
+    // The timer is stopped on m_cssAgent destruction, so this method will never be called after m_cssAgent has been destroyed.
+    Vector<std::pair<WebKitNamedFlow*, int> > namedFlows;
+
+    for (HashMap<WebKitNamedFlow*, int>::iterator it = m_namedFlows.begin(), end = m_namedFlows.end(); it != end; ++it)
+        namedFlows.append(std::make_pair(it->first, it->second));
+
+    for (unsigned i = 0, size = namedFlows.size(); i < size; ++i) {
+        WebKitNamedFlow* namedFlow = namedFlows.at(i).first;
+        int documentNodeId = namedFlows.at(i).second;
+
+        if (m_namedFlows.contains(namedFlow)) {
+            m_cssAgent->regionLayoutUpdated(namedFlow, documentNodeId);
+            m_namedFlows.remove(namedFlow);
+        }
+    }
+
+    if (!m_namedFlows.isEmpty() && !m_timer.isActive())
+        m_timer.startOneShot(0);
+}
+
 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action {
     WTF_MAKE_NONCOPYABLE(StyleSheetAction);
 public:
@@ -518,6 +579,8 @@ void InspectorCSSAgent::reset()
     m_nodeToInspectorStyleSheet.clear();
     m_documentToInspectorStyleSheet.clear();
     m_namedFlowCollectionsRequested.clear();
+    if (m_updateRegionLayoutTask)
+        m_updateRegionLayoutTask->reset();
     resetPseudoStates();
 }
 
@@ -537,22 +600,48 @@ void InspectorCSSAgent::mediaQueryResultChanged()
         m_frontend->mediaQueryResultChanged();
 }
 
-void InspectorCSSAgent::didCreateNamedFlow(Document* document, const AtomicString& name)
+void InspectorCSSAgent::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+{
+    int documentNodeId = documentNodeWithRequestedFlowsId(document);
+    if (!documentNodeId)
+        return;
+
+    ErrorString errorString;
+    m_frontend->namedFlowCreated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId));
+}
+
+void InspectorCSSAgent::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+{
+    int documentNodeId = documentNodeWithRequestedFlowsId(document);
+    if (!documentNodeId)
+        return;
+
+    if (m_updateRegionLayoutTask)
+        m_updateRegionLayoutTask->unschedule(namedFlow);
+
+    m_frontend->namedFlowRemoved(documentNodeId, namedFlow->name().string());
+}
+
+void InspectorCSSAgent::didUpdateRegionLayout(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());
+    if (!m_updateRegionLayoutTask)
+        m_updateRegionLayoutTask = adoptPtr(new UpdateRegionLayoutTask(this));
+    m_updateRegionLayoutTask->scheduleFor(namedFlow, documentNodeId);
 }
 
-void InspectorCSSAgent::didRemoveNamedFlow(Document* document, const AtomicString& name)
+void InspectorCSSAgent::regionLayoutUpdated(WebKitNamedFlow* namedFlow, int documentNodeId)
 {
-    int nodeId = m_domAgent->boundNodeId(document);
-    if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId))
+    if (namedFlow->flowState() == WebKitNamedFlow::FlowStateNull)
         return;
 
-    m_frontend->namedFlowRemoved(nodeId, name.string());
+    ErrorString errorString;
+    RefPtr<WebKitNamedFlow> protector(namedFlow);
+
+    m_frontend->regionLayoutUpdated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId));
 }
 
 bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoType pseudoType)
@@ -828,32 +917,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 +1006,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));
index 931ed3d..c190612 100644 (file)
@@ -55,6 +55,7 @@ class Node;
 class NodeList;
 class SelectorProfile;
 class StyleResolver;
+class UpdateRegionLayoutTask;
 
 #if ENABLE(INSPECTOR)
 
@@ -99,8 +100,10 @@ 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*);
+    void regionLayoutUpdated(WebKitNamedFlow*, int documentNodeId);
 
     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 +119,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 +147,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*);
@@ -176,6 +179,7 @@ private:
     DocumentToViaInspectorStyleSheet m_documentToInspectorStyleSheet;
     NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState;
     HashSet<int> m_namedFlowCollectionsRequested;
+    OwnPtr<UpdateRegionLayoutTask> m_updateRegionLayoutTask;
 
     int m_lastStyleSheetId;
 
index cef3f6c..bfa3f30 100644 (file)
@@ -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)
index 89ebe0e..2dec220 100644 (file)
@@ -114,8 +114,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*);
@@ -291,8 +292,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*);
@@ -562,21 +564,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
 }
 
index 820695b..6e99dac 100644 (file)
@@ -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 = {
@@ -171,48 +174,62 @@ WebInspector.CSSStyleModel.prototype = {
     },
 
     /**
-     * @param {DOMAgent.NodeId} nodeId
-     * @param {function(?Array.<WebInspector.NamedFlow>)} userCallback
+     * @param {DOMAgent.NodeId} documentNodeId
+     * @param {function(?WebInspector.NamedFlowCollection)} userCallback
      */
-    getNamedFlowCollectionAsync: function(nodeId, userCallback)
+    getNamedFlowCollectionAsync: function(documentNodeId, userCallback)
     {
+        var namedFlowCollection = this._namedFlowCollections[documentNodeId];
+        if (namedFlowCollection) {
+            userCallback(namedFlowCollection);
+            return;
+        }
+
         /**
-         * @param {function(?Array.<WebInspector.NamedFlow>)} userCallback
+         * @param {function(?WebInspector.NamedFlowCollection)} userCallback
          * @param {?Protocol.Error} error
-         * @param {?Array.<CSSAgent.NamedFlow>=} namedFlowPayload
+         * @param {?Array.<CSSAgent.NamedFlow>} namedFlowPayload
          */
         function callback(userCallback, error, namedFlowPayload)
         {
             if (error || !namedFlowPayload)
                 userCallback(null);
-            else
-                userCallback(WebInspector.NamedFlow.parsePayloadArray(namedFlowPayload));
+            else {
+                var namedFlowCollection = new WebInspector.NamedFlowCollection(namedFlowPayload);
+                this._namedFlowCollections[documentNodeId] = namedFlowCollection;
+                userCallback(namedFlowCollection);
+            }
         }
 
-        CSSAgent.getNamedFlowCollection(nodeId, callback.bind(this, userCallback));
+        CSSAgent.getNamedFlowCollection(documentNodeId, callback.bind(this, userCallback));
     },
 
     /**
-     * @param {DOMAgent.NodeId} nodeId
+     * @param {DOMAgent.NodeId} documentNodeId
      * @param {string} flowName
      * @param {function(?WebInspector.NamedFlow)} userCallback
      */
-    getFlowByNameAsync: function(nodeId, flowName, userCallback)
+    getFlowByNameAsync: function(documentNodeId, flowName, userCallback)
     {
+        var namedFlowCollection = this._namedFlowCollections[documentNodeId];
+        if (namedFlowCollection) {
+            userCallback(namedFlowCollection.flowByName(flowName));
+            return;
+        }
+
         /**
          * @param {function(?WebInspector.NamedFlow)} userCallback
-         * @param {?Protocol.Error} error
-         * @param {?CSSAgent.NamedFlow=} namedFlowPayload
+         * @param {?WebInspector.NamedFlowCollection} namedFlowCollection
          */
-        function callback(userCallback, error, namedFlowPayload)
+        function callback(userCallback, namedFlowCollection)
         {
-            if (error || !namedFlowPayload)
+            if (!namedFlowCollection)
                 userCallback(null);
             else
-                userCallback(WebInspector.NamedFlow.parsePayload(namedFlowPayload));
+                userCallback(namedFlowCollection.flowByName(flowName));
         }
 
-        CSSAgent.getFlowByName(nodeId, flowName, callback.bind(this, userCallback));
+        this.getNamedFlowCollectionAsync(documentNodeId, callback.bind(this, userCallback));
     },
 
     /**
@@ -350,51 +367,48 @@ WebInspector.CSSStyleModel.prototype = {
     },
 
     /**
-     * @param {DOMAgent.NodeId} documentNodeId
-     * @param {string} name
+     * @param {CSSAgent.NamedFlow} namedFlowPayload
      */
-    _namedFlowCreated: function(documentNodeId, name)
+    _namedFlowCreated: function(namedFlowPayload)
     {
-        if (!this.hasEventListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated))
-            return;
-
-        /**
-        * @param {WebInspector.DOMDocument} root
-        */
-        function callback(root)
-        {
-            // FIXME: At the moment we only want support for NamedFlows in the main document
-            if (documentNodeId !== root.id)
-                return;
+        var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
+        var namedFlowCollection = this._namedFlowCollections[namedFlow.documentNodeId];
 
-            this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated, { documentNodeId: documentNodeId, name: name });
-        }
+        if (!namedFlowCollection)
+            return;
 
-        WebInspector.domAgent.requestDocument(callback.bind(this));
+        namedFlowCollection._appendNamedFlow(namedFlow);
+        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated, namedFlow);
     },
 
     /**
      * @param {DOMAgent.NodeId} documentNodeId
-     * @param {string} name
+     * @param {string} flowName
      */
-    _namedFlowRemoved: function(documentNodeId, name)
+    _namedFlowRemoved: function(documentNodeId, flowName)
     {
-        if (!this.hasEventListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved))
+        var namedFlowCollection = this._namedFlowCollections[documentNodeId];
+
+        if (!namedFlowCollection)
             return;
 
-        /**
-        * @param {WebInspector.DOMDocument} root
-        */
-        function callback(root)
-        {
-            // FIXME: At the moment we only want support for NamedFlows in the main document
-            if (documentNodeId !== root.id)
-                return;
+        namedFlowCollection._removeNamedFlow(flowName);
+        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, flowName: flowName });
+    },
 
-            this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, name: name });
-        }
+    /**
+     * @param {CSSAgent.NamedFlow} namedFlowPayload
+     */
+    _regionLayoutUpdated: function(namedFlowPayload)
+    {
+        var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
+        var namedFlowCollection = this._namedFlowCollections[namedFlow.documentNodeId];
 
-        WebInspector.domAgent.requestDocument(callback.bind(this));
+        if (!namedFlowCollection)
+            return;
+
+        namedFlowCollection._appendNamedFlow(namedFlow);
+        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, namedFlow);
     },
 
     /**
@@ -463,6 +477,11 @@ WebInspector.CSSStyleModel.prototype = {
         this._sourceMappings = {};
     },
 
+    _resetNamedFlowCollections: function()
+    {
+        this._namedFlowCollections = {};
+    },
+
     /**
      * @param {WebInspector.CSSLocation} rawLocation
      * @return {?WebInspector.UILocation}
@@ -1326,21 +1345,28 @@ WebInspector.CSSDispatcher.prototype = {
     },
 
     /**
-     * @param {DOMAgent.NodeId} documentNodeId
-     * @param {string} name
+     * @param {CSSAgent.NamedFlow} namedFlowPayload
      */
-    namedFlowCreated: function(documentNodeId, name)
+    namedFlowCreated: function(namedFlowPayload)
     {
-        this._cssModel._namedFlowCreated(documentNodeId, name);
+        this._cssModel._namedFlowCreated(namedFlowPayload);
     },
 
     /**
      * @param {DOMAgent.NodeId} documentNodeId
-     * @param {string} name
+     * @param {string} flowName
      */
-    namedFlowRemoved: function(documentNodeId, name)
+    namedFlowRemoved: function(documentNodeId, flowName)
     {
-        this._cssModel._namedFlowRemoved(documentNodeId, name);
+        this._cssModel._namedFlowRemoved(documentNodeId, flowName);
+    },
+
+    /**
+     * @param {CSSAgent.NamedFlow} namedFlowPayload
+     */
+    regionLayoutUpdated: function(namedFlowPayload)
+    {
+        this._cssModel._regionLayoutUpdated(namedFlowPayload);
     }
 }
 
@@ -1350,7 +1376,7 @@ WebInspector.CSSDispatcher.prototype = {
  */
 WebInspector.NamedFlow = function(payload)
 {
-    this.nodeId = payload.documentNodeId;
+    this.documentNodeId = payload.documentNodeId;
     this.name = payload.name;
     this.overset = payload.overset;
     this.content = payload.content;
@@ -1367,20 +1393,50 @@ WebInspector.NamedFlow.parsePayload = function(payload)
 }
 
 /**
- * @param {?Array.<CSSAgent.NamedFlow>=} namedFlowPayload
- * @return {?Array.<WebInspector.NamedFlow>}
+ * @constructor
+ * @param {Array.<CSSAgent.NamedFlow>} payload
  */
-WebInspector.NamedFlow.parsePayloadArray = function(namedFlowPayload)
+WebInspector.NamedFlowCollection = function(payload)
 {
-    if (!namedFlowPayload)
-        return null;
+    /** @type {Object.<string, WebInspector.NamedFlow>} */
+    this.namedFlowMap = {};
 
-    var parsedArray = [];
-    for (var i = 0; i < namedFlowPayload.length; ++i)
-        parsedArray[i] = WebInspector.NamedFlow.parsePayload(namedFlowPayload[i]);
-    return parsedArray;
+    for (var i = 0; i < payload.length; ++i) {
+        var namedFlow = WebInspector.NamedFlow.parsePayload(payload[i]);
+        this.namedFlowMap[namedFlow.name] = namedFlow;
+    }
 }
 
+WebInspector.NamedFlowCollection.prototype = {
+    /**
+     * @param {WebInspector.NamedFlow} namedFlow
+     */
+    _appendNamedFlow: function(namedFlow)
+    {
+        this.namedFlowMap[namedFlow.name] = namedFlow;
+    },
+
+    /**
+     * @param {string} flowName
+     */
+    _removeNamedFlow: function(flowName)
+    {
+        delete this.namedFlowMap[flowName];
+    },
+
+    /**
+     * @param {string} flowName
+     * @return {WebInspector.NamedFlow}
+     */
+    flowByName: function(flowName)
+    {
+        var namedFlow = this.namedFlowMap[flowName];
+
+        if (!namedFlow)
+            return null;
+        return namedFlow;
+    }
+}
 /**
  * @type {WebInspector.CSSStyleModel}
  */
index 4e83cca..7461f42 100644 (file)
@@ -27,6 +27,7 @@
 #include "RenderNamedFlowThread.h"
 
 #include "FlowThreadController.h"
+#include "InspectorInstrumentation.h"
 #include "RenderRegion.h"
 #include "RenderView.h"
 #include "WebKitNamedFlow.h"
@@ -357,6 +358,7 @@ const AtomicString& RenderNamedFlowThread::flowThreadName() const
 void RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent()
 {
     RenderFlowThread::dispatchRegionLayoutUpdateEvent();
+    InspectorInstrumentation::didUpdateRegionLayout(document(), m_namedFlow.get());
 
     if (!m_regionLayoutUpdateEventTimer.isActive() && m_namedFlow->hasEventListeners())
         m_regionLayoutUpdateEventTimer.startOneShot(0);