From 6cb577efa35db147ef18c6160570719c50eb71c1 Mon Sep 17 00:00:00 2001
From: "mitz@apple.com"
Date: Tue, 4 Sep 2012 20:58:54 +0000
Subject: [PATCH] Reverted r127468 (the fix for )
because the test it included caused an assertion failure in
Document::updateStyleIfNeeded().
Source/WebCore:
* dom/NamedFlowCollection.cpp:
(WebCore::NamedFlowCollection::ensureFlowWithName):
(WebCore::NamedFlowCollection::discardNamedFlow):
* inspector/Inspector.json:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::didCreateNamedFlow):
(WebCore::InspectorCSSAgent::didRemoveNamedFlow):
(WebCore::InspectorCSSAgent::getNamedFlowCollection):
(WebCore::InspectorCSSAgent::getFlowByName):
(WebCore):
* inspector/InspectorCSSAgent.h:
(InspectorCSSAgent):
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::didCreateNamedFlowImpl):
(WebCore::InspectorInstrumentation::didRemoveNamedFlowImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::didCreateNamedFlow):
(WebCore::InspectorInstrumentation::didRemoveNamedFlow):
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel):
(WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync):
(WebInspector.CSSStyleModel.prototype.getFlowByNameAsync):
(WebInspector.CSSStyleModel.prototype._namedFlowCreated.callback):
(WebInspector.CSSStyleModel.prototype._namedFlowCreated):
(WebInspector.CSSStyleModel.prototype._namedFlowRemoved.callback):
(WebInspector.CSSStyleModel.prototype._namedFlowRemoved):
(WebInspector.CSSDispatcher.prototype.namedFlowCreated):
(WebInspector.CSSDispatcher.prototype.namedFlowRemoved):
(WebInspector.NamedFlow):
(WebInspector.NamedFlow.parsePayloadArray):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent):
LayoutTests:
* 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@127500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
---
LayoutTests/ChangeLog | 8 +
...protocol-css-regions-commands-expected.txt | 13 +-
.../styles/protocol-css-regions-commands.html | 75 +++-----
Source/WebCore/ChangeLog | 40 ++++
Source/WebCore/dom/NamedFlowCollection.cpp | 6 +-
Source/WebCore/inspector/Inspector.json | 25 ++-
.../WebCore/inspector/InspectorCSSAgent.cpp | 54 +++---
Source/WebCore/inspector/InspectorCSSAgent.h | 7 +-
.../inspector/InspectorInstrumentation.cpp | 14 +-
.../inspector/InspectorInstrumentation.h | 27 +--
.../inspector/front-end/CSSStyleModel.js | 177 ++++++------------
.../rendering/RenderNamedFlowThread.cpp | 2 -
12 files changed, 195 insertions(+), 253 deletions(-)
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 80c9f8e803b..e632a981310 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,11 @@
+2012-09-04 Dan Bernstein
+
+ Reverted r127468 (the fix for ) because the test it included caused
+ an assertion failure in Document::updateStyleIfNeeded().
+
+ * inspector/styles/protocol-css-regions-commands-expected.txt:
+ * inspector/styles/protocol-css-regions-commands.html:
+
2012-09-04 Simon Fraser
Regression: Heap-use-after-free in WebCore::FrameView::scrollContentsFastPath
diff --git a/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt b/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt
index 9fe9cf36722..7c82b48e753 100644
--- a/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt
+++ b/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt
@@ -4,11 +4,9 @@ getNamedFlowCollection Bug 91607
getFlowByName Bug 91855
namedFlowCreated Bug 92739
namedFlowRemoved Bug 92739
-regionLayoutUpdated Bug 93443
-This text is from CSS Named Flow "flow3".
-Running: testGetNamedFlowCollection
+Running: testGetNamedFlowCollection1
=== CSS Named Flows in main document ===
* Named Flow "flow1"
Content Elements: 1
@@ -20,26 +18,23 @@ Regions: 2
Content Elements: 1
Regions: 1
-Running: testGetNamedFlowCollectionWithInvalidDocument
+Running: testGetNamedFlowCollection2
=== CSS Named Flows in #fake-document ===
#fake-document is not a document
-Running: testGetFlowByName
+Running: testGetFlowByName1
=== Named Flow "flow2" from main document ===
* Named Flow "flow2"
Content Elements: 1
Regions: 2
-Running: testGetFlowByNameWithInvalidName
+Running: testGetFlowByName2
=== 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"
diff --git a/LayoutTests/inspector/styles/protocol-css-regions-commands.html b/LayoutTests/inspector/styles/protocol-css-regions-commands.html
index 40ef691fada..d834c2a7fcf 100644
--- a/LayoutTests/inspector/styles/protocol-css-regions-commands.html
+++ b/LayoutTests/inspector/styles/protocol-css-regions-commands.html
@@ -21,32 +21,24 @@ function createDynamicElements()
function createNamedFlow()
{
var article = document.createElement("article");
- var div = document.createElement("div");
-
article.id = "tmpArticle";
- 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";
+ article.style.webkitFlowInto = "tmpNamedFlow";
document.body.appendChild(article);
- document.body.appendChild(div);
}
function removeNamedFlow()
{
- document.body.removeChild(document.getElementById("tmpArticle"));
- document.body.removeChild(document.getElementById("tmpDiv"));
+ var article = document.getElementById("tmpArticle");
+
+ document.body.removeChild(article);
}
function test()
{
WebInspector.showPanel("elements");
InspectorTest.runTestSuite([
- function testGetNamedFlowCollection(next)
+ function testGetNamedFlowCollection1(next)
{
WebInspector.domAgent.requestDocument(documentCallback);
@@ -55,20 +47,16 @@ function test()
WebInspector.cssModel.getNamedFlowCollectionAsync(document.id, namedFlowCallback);
}
- function namedFlowCallback(namedFlowMap)
+ function namedFlowCallback(namedFlows)
{
InspectorTest.addResult("=== CSS Named Flows in main document ===");
- if (!namedFlowMap) {
+ if (!namedFlows) {
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));
});
@@ -80,7 +68,7 @@ function test()
}
},
- function testGetNamedFlowCollectionWithInvalidDocument(next)
+ function testGetNamedFlowCollection2(next)
{
WebInspector.domAgent.requestDocument(documentCallback);
@@ -94,11 +82,11 @@ function test()
WebInspector.cssModel.getNamedFlowCollectionAsync(nodeId, namedFlowCallback);
}
- function namedFlowCallback(namedFlowMap)
+ function namedFlowCallback(namedFlows)
{
InspectorTest.addResult("=== CSS Named Flows in #fake-document ===");
- if (namedFlowMap) {
+ if (namedFlows) {
InspectorTest.addResult("[!] Failed");
InspectorTest.completeTest();
return;
@@ -109,7 +97,7 @@ function test()
}
},
- function testGetFlowByName(next)
+ function testGetFlowByName1(next)
{
WebInspector.domAgent.requestDocument(documentCallback);
@@ -134,7 +122,7 @@ function test()
}
},
- function testGetFlowByNameWithInvalidName(next)
+ function testGetFlowByName2(next)
{
WebInspector.domAgent.requestDocument(documentCallback);
@@ -165,29 +153,15 @@ function test()
function callback(event)
{
- if (event.data.name !== "tmpNamedFlow")
- return;
-
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, callback, this);
- 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")
+ if (event.data.name !== "tmpNamedFlow") {
+ Inspector.addResult("[!] Failed");
+ InspectorTest.completeTest();
return;
+ }
- WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, callback, this);
-
- InspectorTest.addResult("RegionLayoutUpdated: \"flow3\"");
+ InspectorTest.addResult("NamedFlowCreated: \"tmpNamedFlow\"");
next();
}
},
@@ -199,10 +173,12 @@ function test()
function callback(event)
{
- if (event.data.flowName !== "tmpNamedFlow")
- return;
-
WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, callback, this);
+ if (event.data.name !== "tmpNamedFlow") {
+ Inspector.addResult("[!] Failed");
+ InspectorTest.completeTest();
+ return;
+ }
InspectorTest.addResult("NamedFlowRemoved: \"tmpNamedFlow\"");
next();
@@ -228,7 +204,6 @@ Tests the following commands and events:
getFlowByName Bug 91855
namedFlowCreated Bug 92739
namedFlowRemoved Bug 92739
- regionLayoutUpdated Bug 93443
@@ -241,10 +216,8 @@ Tests the following commands and events:
-
- This text is from CSS Named Flow "flow3".
-
-
+
+
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 4478c3c2483..a14ba017b63 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,43 @@
+2012-09-04 Dan Bernstein
+
+ Reverted r127468 (the fix for ) because the test it included caused
+ an assertion failure in Document::updateStyleIfNeeded().
+
+ * dom/NamedFlowCollection.cpp:
+ (WebCore::NamedFlowCollection::ensureFlowWithName):
+ (WebCore::NamedFlowCollection::discardNamedFlow):
+ * inspector/Inspector.json:
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::didCreateNamedFlow):
+ (WebCore::InspectorCSSAgent::didRemoveNamedFlow):
+ (WebCore::InspectorCSSAgent::getNamedFlowCollection):
+ (WebCore::InspectorCSSAgent::getFlowByName):
+ (WebCore):
+ * inspector/InspectorCSSAgent.h:
+ (InspectorCSSAgent):
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore):
+ (WebCore::InspectorInstrumentation::didCreateNamedFlowImpl):
+ (WebCore::InspectorInstrumentation::didRemoveNamedFlowImpl):
+ * inspector/InspectorInstrumentation.h:
+ (InspectorInstrumentation):
+ (WebCore::InspectorInstrumentation::didCreateNamedFlow):
+ (WebCore::InspectorInstrumentation::didRemoveNamedFlow):
+ * inspector/front-end/CSSStyleModel.js:
+ (WebInspector.CSSStyleModel):
+ (WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync):
+ (WebInspector.CSSStyleModel.prototype.getFlowByNameAsync):
+ (WebInspector.CSSStyleModel.prototype._namedFlowCreated.callback):
+ (WebInspector.CSSStyleModel.prototype._namedFlowCreated):
+ (WebInspector.CSSStyleModel.prototype._namedFlowRemoved.callback):
+ (WebInspector.CSSStyleModel.prototype._namedFlowRemoved):
+ (WebInspector.CSSDispatcher.prototype.namedFlowCreated):
+ (WebInspector.CSSDispatcher.prototype.namedFlowRemoved):
+ (WebInspector.NamedFlow):
+ (WebInspector.NamedFlow.parsePayloadArray):
+ * rendering/RenderNamedFlowThread.cpp:
+ (WebCore::RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent):
+
2012-09-04 Simon Fraser
Regression: Heap-use-after-free in WebCore::FrameView::scrollContentsFastPath
diff --git a/Source/WebCore/dom/NamedFlowCollection.cpp b/Source/WebCore/dom/NamedFlowCollection.cpp
index 554750626d0..1588fc6c037 100644
--- a/Source/WebCore/dom/NamedFlowCollection.cpp
+++ b/Source/WebCore/dom/NamedFlowCollection.cpp
@@ -81,7 +81,7 @@ PassRefPtr NamedFlowCollection::ensureFlowWithName(const String
RefPtr newFlow = WebKitNamedFlow::create(this, flowName);
m_namedFlows.add(newFlow.get());
- InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow.get());
+ InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow->name());
return newFlow.release();
}
@@ -95,9 +95,9 @@ void NamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow)
ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull);
ASSERT(m_namedFlows.contains(namedFlow));
- InspectorInstrumentation::willRemoveNamedFlow(m_document, namedFlow);
-
m_namedFlows.remove(namedFlow);
+
+ InspectorInstrumentation::didRemoveNamedFlow(m_document, namedFlow->name());
}
void NamedFlowCollection::documentDestroyed()
diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json
index c1e265c4b14..e2de3301ac8 100644
--- a/Source/WebCore/inspector/Inspector.json
+++ b/Source/WebCore/inspector/Inspector.json
@@ -2412,6 +2412,18 @@
],
"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": [
@@ -2429,7 +2441,8 @@
{
"name": "namedFlowCreated",
"parameters": [
- { "name": "namedFlow", "$ref": "NamedFlow", "description": "The new Named Flow." }
+ { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
+ { "name": "namedFlow", "type": "string", "description": "Identifier of the new Named Flow." }
],
"description": "Fires when a Named Flow is created.",
"hidden": true
@@ -2438,18 +2451,10 @@
"name": "namedFlowRemoved",
"parameters": [
{ "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
- { "name": "flowName", "type": "string", "description": "Identifier of the removed Named Flow." }
+ { "name": "namedFlow", "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
}
]
},
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp
index edcd39734a6..24c7197b6ee 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp
+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp
@@ -537,33 +537,22 @@ void InspectorCSSAgent::mediaQueryResultChanged()
m_frontend->mediaQueryResultChanged();
}
-void InspectorCSSAgent::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+void InspectorCSSAgent::didCreateNamedFlow(Document* document, const AtomicString& name)
{
- int documentNodeId = documentNodeWithRequestedFlowsId(document);
- if (!documentNodeId)
+ int nodeId = m_domAgent->boundNodeId(document);
+ if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId))
return;
- ErrorString errorString;
- m_frontend->namedFlowCreated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId));
+ m_frontend->namedFlowCreated(nodeId, name.string());
}
-void InspectorCSSAgent::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+void InspectorCSSAgent::didRemoveNamedFlow(Document* document, const AtomicString& name)
{
- int documentNodeId = documentNodeWithRequestedFlowsId(document);
- if (!documentNodeId)
+ int nodeId = m_domAgent->boundNodeId(document);
+ if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId))
return;
- 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));
+ m_frontend->namedFlowRemoved(nodeId, name.string());
}
bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoType pseudoType)
@@ -839,16 +828,32 @@ void InspectorCSSAgent::getNamedFlowCollection(ErrorString* errorString, int doc
return;
m_namedFlowCollectionsRequested.add(documentNodeId);
-
Vector > namedFlowsVector = document->namedFlows()->namedFlows();
RefPtr > namedFlows = TypeBuilder::Array::create();
+
for (Vector >::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& 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 protector(webkitNamedFlow);
+ result = buildObjectForNamedFlow(errorString, webkitNamedFlow, documentNodeId);
+}
+
void InspectorCSSAgent::startSelectorProfiler(ErrorString*)
{
m_currentSelectorProfile = adoptPtr(new SelectorProfile());
@@ -928,15 +933,6 @@ 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* result)
{
InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(static_cast(styleSheet));
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.h b/Source/WebCore/inspector/InspectorCSSAgent.h
index 71b827b2087..fe1a3b10940 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.h
+++ b/Source/WebCore/inspector/InspectorCSSAgent.h
@@ -99,9 +99,8 @@ public:
virtual void disable(ErrorString*);
void reset();
void mediaQueryResultChanged();
- void didCreateNamedFlow(Document*, WebKitNamedFlow*);
- void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
- void didUpdateRegionLayout(Document*, WebKitNamedFlow*);
+ void didCreateNamedFlow(Document*, const AtomicString& name);
+ void didRemoveNamedFlow(Document*, const AtomicString& name);
virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr >&);
virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr& inlineStyle, RefPtr& attributes);
@@ -117,6 +116,7 @@ public:
virtual void getSupportedCSSProperties(ErrorString*, RefPtr >& result);
virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr& forcedPseudoClasses);
virtual void getNamedFlowCollection(ErrorString*, int documentNodeId, RefPtr >& result);
+ virtual void getFlowByName(ErrorString*, int documentNodeId, const String& flowName, RefPtr& result);
virtual void startSelectorProfiler(ErrorString*);
virtual void stopSelectorProfiler(ErrorString*, RefPtr&);
@@ -145,7 +145,6 @@ private:
InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element);
Element* elementForId(ErrorString*, int nodeId);
- int documentNodeWithRequestedFlowsId(Document*);
void collectStyleSheets(CSSStyleSheet*, TypeBuilder::Array*);
InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*);
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp
index 141c29a05fe..41b7bc81ade 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp
+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp
@@ -231,22 +231,16 @@ void InspectorInstrumentation::willPopShadowRootImpl(InstrumentingAgents* instru
domAgent->willPopShadowRoot(host, root);
}
-void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
+void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name)
{
if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
- cssAgent->didCreateNamedFlow(document, namedFlow);
+ cssAgent->didCreateNamedFlow(document, name);
}
-void InspectorInstrumentation::willRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
+void InspectorInstrumentation::didRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name)
{
if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
- cssAgent->willRemoveNamedFlow(document, namedFlow);
-}
-
-void InspectorInstrumentation::didUpdateRegionLayoutImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
-{
- if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
- cssAgent->didUpdateRegionLayout(document, namedFlow);
+ cssAgent->didRemoveNamedFlow(document, name);
}
void InspectorInstrumentation::mouseDidMoveOverElementImpl(InstrumentingAgents* instrumentingAgents, const HitTestResult& result, unsigned modifierFlags)
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
index 2373673b311..c25d3722b9a 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
@@ -113,9 +113,8 @@ public:
static void mediaQueryResultChanged(Document*);
static void didPushShadowRoot(Element* host, ShadowRoot*);
static void willPopShadowRoot(Element* host, ShadowRoot*);
- static void didCreateNamedFlow(Document*, WebKitNamedFlow*);
- static void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
- static void didUpdateRegionLayout(Document*, WebKitNamedFlow*);
+ static void didCreateNamedFlow(Document*, const AtomicString& name);
+ static void didRemoveNamedFlow(Document*, const AtomicString& name);
static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
static bool handleMousePress(Page*);
@@ -291,9 +290,8 @@ private:
static void mediaQueryResultChangedImpl(InstrumentingAgents*);
static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
- static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
- static void willRemoveNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
- static void didUpdateRegionLayoutImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
+ static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, const AtomicString& name);
+ static void didRemoveNamedFlowImpl(InstrumentingAgents*, Document*, const AtomicString& name);
static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
static bool handleMousePressImpl(InstrumentingAgents*);
@@ -563,30 +561,21 @@ inline void InspectorInstrumentation::willPopShadowRoot(Element* host, ShadowRoo
#endif
}
-inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, const AtomicString& name)
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
- didCreateNamedFlowImpl(instrumentingAgents, document, namedFlow);
+ didCreateNamedFlowImpl(instrumentingAgents, document, name);
#endif
}
-inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+inline void InspectorInstrumentation::didRemoveNamedFlow(Document* document, const AtomicString& name)
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
- 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);
+ didRemoveNamedFlowImpl(instrumentingAgents, document, name);
#endif
}
diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js
index 1701930f992..820695bf8d6 100644
--- a/Source/WebCore/inspector/front-end/CSSStyleModel.js
+++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js
@@ -39,8 +39,6 @@ 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();
}
@@ -60,8 +58,7 @@ WebInspector.CSSStyleModel.Events = {
StyleSheetChanged: "StyleSheetChanged",
MediaQueryResultChanged: "MediaQueryResultChanged",
NamedFlowCreated: "NamedFlowCreated",
- NamedFlowRemoved: "NamedFlowRemoved",
- RegionLayoutUpdated: "RegionLayoutUpdated"
+ NamedFlowRemoved: "NamedFlowRemoved"
}
WebInspector.CSSStyleModel.prototype = {
@@ -175,16 +172,10 @@ WebInspector.CSSStyleModel.prototype = {
/**
* @param {DOMAgent.NodeId} nodeId
- * @param {function(Object)} userCallback
+ * @param {function(?Array.)} userCallback
*/
- getNamedFlowCollectionAsync: function(documentNodeId, userCallback)
+ getNamedFlowCollectionAsync: function(nodeId, userCallback)
{
- var namedFlowCollection = this._namedFlowCollections[documentNodeId];
- if (namedFlowCollection) {
- userCallback(namedFlowCollection.namedFlowMap);
- return;
- }
-
/**
* @param {function(?Array.)} userCallback
* @param {?Protocol.Error} error
@@ -194,14 +185,11 @@ WebInspector.CSSStyleModel.prototype = {
{
if (error || !namedFlowPayload)
userCallback(null);
- else {
- var namedFlowCollection = new WebInspector.NamedFlowCollection(namedFlowPayload);
- this._namedFlowCollections[documentNodeId] = namedFlowCollection;
- userCallback(namedFlowCollection.namedFlowMap);
- }
+ else
+ userCallback(WebInspector.NamedFlow.parsePayloadArray(namedFlowPayload));
}
- CSSAgent.getNamedFlowCollection(documentNodeId, callback.bind(this, userCallback));
+ CSSAgent.getNamedFlowCollection(nodeId, callback.bind(this, userCallback));
},
/**
@@ -209,27 +197,22 @@ WebInspector.CSSStyleModel.prototype = {
* @param {string} flowName
* @param {function(?WebInspector.NamedFlow)} userCallback
*/
- getFlowByNameAsync: function(documentNodeId, flowName, userCallback)
+ getFlowByNameAsync: function(nodeId, flowName, userCallback)
{
- var namedFlowCollection = this._namedFlowCollections[documentNodeId];
- if (namedFlowCollection) {
- userCallback(namedFlowCollection.flowByName(flowName));
- return;
- }
-
/**
* @param {function(?WebInspector.NamedFlow)} userCallback
- * @param {?CSSAgent.NamedFlow=} namedFlowMap
+ * @param {?Protocol.Error} error
+ * @param {?CSSAgent.NamedFlow=} namedFlowPayload
*/
- function callback(userCallback, namedFlowMap)
+ function callback(userCallback, error, namedFlowPayload)
{
- if (error || !namedFlowMap)
+ if (error || !namedFlowPayload)
userCallback(null);
else
- userCallback(this._namedFlowCollections[documentNodeId].flowByName(flowName));
+ userCallback(WebInspector.NamedFlow.parsePayload(namedFlowPayload));
}
- this.getNamedFlowCollectionAsync(documentNodeId, callback.bind(this, userCallback));
+ CSSAgent.getFlowByName(nodeId, flowName, callback.bind(this, userCallback));
},
/**
@@ -367,48 +350,51 @@ WebInspector.CSSStyleModel.prototype = {
},
/**
- * @param {CSSAgent.NamedFlow} namedFlowPayload
+ * @param {DOMAgent.NodeId} documentNodeId
+ * @param {string} name
*/
- _namedFlowCreated: function(namedFlowPayload)
+ _namedFlowCreated: function(documentNodeId, name)
{
- var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
- var namedFlowCollection = this._namedFlowCollections[namedFlow.documentNodeId];
-
- if (!namedFlowCollection)
+ if (!this.hasEventListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated))
return;
- namedFlowCollection.appendNamedFlow(namedFlow);
- this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated, namedFlow);
+ /**
+ * @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;
+
+ this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated, { documentNodeId: documentNodeId, name: name });
+ }
+
+ WebInspector.domAgent.requestDocument(callback.bind(this));
},
/**
* @param {DOMAgent.NodeId} documentNodeId
- * @param {string} flowName
+ * @param {string} name
*/
- _namedFlowRemoved: function(documentNodeId, flowName)
+ _namedFlowRemoved: function(documentNodeId, name)
{
- var namedFlowCollection = this._namedFlowCollections[documentNodeId];
-
- if (!namedFlowCollection)
+ if (!this.hasEventListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved))
return;
- namedFlowCollection.removeNamedFlow(flowName);
- this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, flowName: flowName });
- },
-
- /**
- * @param {CSSAgent.NamedFlow} namedFlowPayload
- */
- _regionLayoutUpdated: function(namedFlowPayload)
- {
- var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
- var namedFlowCollection = this._namedFlowCollections[namedFlow.documentNodeId];
+ /**
+ * @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;
- if (!namedFlowCollection)
- return;
+ this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, name: name });
+ }
- namedFlowCollection.appendNamedFlow(namedFlow);
- this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, namedFlow);
+ WebInspector.domAgent.requestDocument(callback.bind(this));
},
/**
@@ -477,11 +463,6 @@ WebInspector.CSSStyleModel.prototype = {
this._sourceMappings = {};
},
- _resetNamedFlowCollections: function()
- {
- this._namedFlowCollections = {};
- },
-
/**
* @param {WebInspector.CSSLocation} rawLocation
* @return {?WebInspector.UILocation}
@@ -1344,29 +1325,22 @@ WebInspector.CSSDispatcher.prototype = {
this._cssModel._fireStyleSheetChanged(styleSheetId);
},
- /**
- * @param {CSSAgent.NamedFlow} namedFlowPayload
- */
- namedFlowCreated: function(namedFlowPayload)
- {
- this._cssModel._namedFlowCreated(namedFlowPayload);
- },
-
/**
* @param {DOMAgent.NodeId} documentNodeId
- * @param {string} flowName
+ * @param {string} name
*/
- namedFlowRemoved: function(documentNodeId, flowName)
+ namedFlowCreated: function(documentNodeId, name)
{
- this._cssModel._namedFlowRemoved(documentNodeId, flowName);
+ this._cssModel._namedFlowCreated(documentNodeId, name);
},
/**
- * @param {CSSAgent.NamedFlow} namedFlowPayload
+ * @param {DOMAgent.NodeId} documentNodeId
+ * @param {string} name
*/
- regionLayoutUpdated: function(namedFlowPayload)
+ namedFlowRemoved: function(documentNodeId, name)
{
- this._cssModel._regionLayoutUpdated(namedFlowPayload);
+ this._cssModel._namedFlowRemoved(documentNodeId, name);
}
}
@@ -1376,7 +1350,7 @@ WebInspector.CSSDispatcher.prototype = {
*/
WebInspector.NamedFlow = function(payload)
{
- this.documentNodeId = payload.documentNodeId;
+ this.nodeId = payload.documentNodeId;
this.name = payload.name;
this.overset = payload.overset;
this.content = payload.content;
@@ -1393,49 +1367,20 @@ WebInspector.NamedFlow.parsePayload = function(payload)
}
/**
- * @constructor
- * @param {?Array.=} payload
+ * @param {?Array.=} namedFlowPayload
+ * @return {?Array.}
*/
-WebInspector.NamedFlowCollection = function(payload)
+WebInspector.NamedFlow.parsePayloadArray = function(namedFlowPayload)
{
- this.namedFlowMap = {};
+ if (!namedFlowPayload)
+ return null;
- for (var i = 0; i < payload.length; ++i) {
- var namedFlow = WebInspector.NamedFlow.parsePayload(payload[i]);
- this.namedFlowMap[namedFlow.name] = namedFlow;
- }
+ var parsedArray = [];
+ for (var i = 0; i < namedFlowPayload.length; ++i)
+ parsedArray[i] = WebInspector.NamedFlow.parsePayload(namedFlowPayload[i]);
+ return parsedArray;
}
-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 === undefined)
- return null;
- return namedFlow;
- }
-}
/**
* @type {WebInspector.CSSStyleModel}
*/
diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.cpp b/Source/WebCore/rendering/RenderNamedFlowThread.cpp
index 7461f42c22a..4e83cca9e62 100644
--- a/Source/WebCore/rendering/RenderNamedFlowThread.cpp
+++ b/Source/WebCore/rendering/RenderNamedFlowThread.cpp
@@ -27,7 +27,6 @@
#include "RenderNamedFlowThread.h"
#include "FlowThreadController.h"
-#include "InspectorInstrumentation.h"
#include "RenderRegion.h"
#include "RenderView.h"
#include "WebKitNamedFlow.h"
@@ -358,7 +357,6 @@ 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);
--
GitLab