Changeset 127500 in webkit
- Timestamp:
- Sep 4, 2012, 1:58:54 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127497 r127500 1 2012-09-04 Dan Bernstein <mitz@apple.com> 2 3 Reverted r127468 (the fix for <http://webkit.org/b/93443>) because the test it included caused 4 an assertion failure in Document::updateStyleIfNeeded(). 5 6 * inspector/styles/protocol-css-regions-commands-expected.txt: 7 * inspector/styles/protocol-css-regions-commands.html: 8 1 9 2012-09-04 Simon Fraser <simon.fraser@apple.com> 2 10 -
trunk/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt
r127468 r127500 5 5 namedFlowCreated Bug 92739 6 6 namedFlowRemoved Bug 92739 7 regionLayoutUpdated Bug 934438 This text is from CSS Named Flow "flow3".9 7 10 8 11 Running: testGetNamedFlowCollection 9 Running: testGetNamedFlowCollection1 12 10 === CSS Named Flows in main document === 13 11 * Named Flow "flow1" … … 21 19 Regions: 1 22 20 23 Running: testGetNamedFlowCollection WithInvalidDocument21 Running: testGetNamedFlowCollection2 24 22 === CSS Named Flows in #fake-document === 25 23 #fake-document is not a document 26 24 27 Running: testGetFlowByName 25 Running: testGetFlowByName1 28 26 === Named Flow "flow2" from main document === 29 27 * Named Flow "flow2" … … 31 29 Regions: 2 32 30 33 Running: testGetFlowByName WithInvalidName31 Running: testGetFlowByName2 34 32 === Name Flow "flow4" from main document === 35 33 There is no Named Flow "flow4" in the main document … … 38 36 NamedFlowCreated: "tmpNamedFlow" 39 37 40 Running: testRegionLayoutUpdated41 RegionLayoutUpdated: "flow3"42 43 38 Running: testNamedFlowRemoved 44 39 NamedFlowRemoved: "tmpNamedFlow" -
trunk/LayoutTests/inspector/styles/protocol-css-regions-commands.html
r127468 r127500 22 22 { 23 23 var article = document.createElement("article"); 24 var div = document.createElement("div");25 26 24 article.id = "tmpArticle"; 27 article.style["-webkit-flow-into"] = "tmpNamedFlow"; 28 article.textContent = "This text is from CSS Named Flow \"tmpNamedFlow\""; 29 30 div.id = "tmpDiv"; 31 div.style["-webkit-flow-from"] = "tmpNamedFlow"; 32 div.style["height"] = "5px"; 33 div.style["width"] = "20px"; 25 article.style.webkitFlowInto = "tmpNamedFlow"; 34 26 35 27 document.body.appendChild(article); 36 document.body.appendChild(div);37 28 } 38 29 39 30 function removeNamedFlow() 40 31 { 41 document.body.removeChild(document.getElementById("tmpArticle")); 42 document.body.removeChild(document.getElementById("tmpDiv")); 32 var article = document.getElementById("tmpArticle"); 33 34 document.body.removeChild(article); 43 35 } 44 36 … … 47 39 WebInspector.showPanel("elements"); 48 40 InspectorTest.runTestSuite([ 49 function testGetNamedFlowCollection (next)41 function testGetNamedFlowCollection1(next) 50 42 { 51 43 WebInspector.domAgent.requestDocument(documentCallback); … … 56 48 } 57 49 58 function namedFlowCallback(namedFlow Map)50 function namedFlowCallback(namedFlows) 59 51 { 60 52 InspectorTest.addResult("=== CSS Named Flows in main document ==="); 61 53 62 if (!namedFlow Map) {54 if (!namedFlows) { 63 55 InspectorTest.addResult("[!] Failed to get Named Flows"); 64 56 InspectorTest.completeTest(); 65 57 return; 66 58 } 67 68 namedFlows = [];69 for (var flowName in namedFlowMap)70 namedFlows.push(namedFlowMap[flowName]);71 59 72 60 namedFlows.sort(function (nf1, nf2) { … … 81 69 }, 82 70 83 function testGetNamedFlowCollection WithInvalidDocument(next)71 function testGetNamedFlowCollection2(next) 84 72 { 85 73 WebInspector.domAgent.requestDocument(documentCallback); … … 95 83 } 96 84 97 function namedFlowCallback(namedFlow Map)85 function namedFlowCallback(namedFlows) 98 86 { 99 87 InspectorTest.addResult("=== CSS Named Flows in #fake-document ==="); 100 88 101 if (namedFlow Map) {89 if (namedFlows) { 102 90 InspectorTest.addResult("[!] Failed"); 103 91 InspectorTest.completeTest(); … … 110 98 }, 111 99 112 function testGetFlowByName (next)100 function testGetFlowByName1(next) 113 101 { 114 102 WebInspector.domAgent.requestDocument(documentCallback); … … 135 123 }, 136 124 137 function testGetFlowByName WithInvalidName(next)125 function testGetFlowByName2(next) 138 126 { 139 127 WebInspector.domAgent.requestDocument(documentCallback); … … 166 154 function callback(event) 167 155 { 168 if (event.data.name !== "tmpNamedFlow")169 return;170 171 156 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, callback, this); 172 157 158 if (event.data.name !== "tmpNamedFlow") { 159 Inspector.addResult("[!] Failed"); 160 InspectorTest.completeTest(); 161 return; 162 } 163 173 164 InspectorTest.addResult("NamedFlowCreated: \"tmpNamedFlow\""); 174 next();175 }176 },177 178 function testRegionLayoutUpdated(next)179 {180 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, callback, this);181 InspectorTest.evaluateInPage("document.getElementById(\"region3\").style[\"width\"] = \"200px\"");182 183 function callback(event)184 {185 if (event.data.name !== "flow3")186 return;187 188 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, callback, this);189 190 InspectorTest.addResult("RegionLayoutUpdated: \"flow3\"");191 165 next(); 192 166 } … … 200 174 function callback(event) 201 175 { 202 if (event.data.flowName !== "tmpNamedFlow")203 return;204 205 176 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, callback, this); 177 if (event.data.name !== "tmpNamedFlow") { 178 Inspector.addResult("[!] Failed"); 179 InspectorTest.completeTest(); 180 return; 181 } 206 182 207 183 InspectorTest.addResult("NamedFlowRemoved: \"tmpNamedFlow\""); … … 229 205 <li>namedFlowCreated <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li> 230 206 <li>namedFlowRemoved <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li> 231 <li>regionLayoutUpdated <a href="https://bugs.webkit.org/show_bug.cgi?id=93443">Bug 93443</a></li>232 207 </ul> 233 208 </p> … … 242 217 <div style="-webkit-flow-from: flow2"></div> 243 218 244 <article style="-webkit-flow-into: flow3"> 245 This text is from CSS Named Flow "flow3". 246 </article> 247 <div id="region3" style="-webkit-flow-from: flow3; height: 20px; width: 5px"></div> 219 <article style="-webkit-flow-into: flow3"></article> 220 <div style="-webkit-flow-from: flow3"></div> 248 221 249 222 <div id="fake-document"></div> -
trunk/Source/WebCore/ChangeLog
r127497 r127500 1 2012-09-04 Dan Bernstein <mitz@apple.com> 2 3 Reverted r127468 (the fix for <http://webkit.org/b/93443>) because the test it included caused 4 an assertion failure in Document::updateStyleIfNeeded(). 5 6 * dom/NamedFlowCollection.cpp: 7 (WebCore::NamedFlowCollection::ensureFlowWithName): 8 (WebCore::NamedFlowCollection::discardNamedFlow): 9 * inspector/Inspector.json: 10 * inspector/InspectorCSSAgent.cpp: 11 (WebCore::InspectorCSSAgent::didCreateNamedFlow): 12 (WebCore::InspectorCSSAgent::didRemoveNamedFlow): 13 (WebCore::InspectorCSSAgent::getNamedFlowCollection): 14 (WebCore::InspectorCSSAgent::getFlowByName): 15 (WebCore): 16 * inspector/InspectorCSSAgent.h: 17 (InspectorCSSAgent): 18 * inspector/InspectorInstrumentation.cpp: 19 (WebCore): 20 (WebCore::InspectorInstrumentation::didCreateNamedFlowImpl): 21 (WebCore::InspectorInstrumentation::didRemoveNamedFlowImpl): 22 * inspector/InspectorInstrumentation.h: 23 (InspectorInstrumentation): 24 (WebCore::InspectorInstrumentation::didCreateNamedFlow): 25 (WebCore::InspectorInstrumentation::didRemoveNamedFlow): 26 * inspector/front-end/CSSStyleModel.js: 27 (WebInspector.CSSStyleModel): 28 (WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync): 29 (WebInspector.CSSStyleModel.prototype.getFlowByNameAsync): 30 (WebInspector.CSSStyleModel.prototype._namedFlowCreated.callback): 31 (WebInspector.CSSStyleModel.prototype._namedFlowCreated): 32 (WebInspector.CSSStyleModel.prototype._namedFlowRemoved.callback): 33 (WebInspector.CSSStyleModel.prototype._namedFlowRemoved): 34 (WebInspector.CSSDispatcher.prototype.namedFlowCreated): 35 (WebInspector.CSSDispatcher.prototype.namedFlowRemoved): 36 (WebInspector.NamedFlow): 37 (WebInspector.NamedFlow.parsePayloadArray): 38 * rendering/RenderNamedFlowThread.cpp: 39 (WebCore::RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent): 40 1 41 2012-09-04 Simon Fraser <simon.fraser@apple.com> 2 42 -
trunk/Source/WebCore/dom/NamedFlowCollection.cpp
r127468 r127500 82 82 m_namedFlows.add(newFlow.get()); 83 83 84 InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow .get());84 InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow->name()); 85 85 86 86 return newFlow.release(); … … 96 96 ASSERT(m_namedFlows.contains(namedFlow)); 97 97 98 InspectorInstrumentation::willRemoveNamedFlow(m_document,namedFlow);98 m_namedFlows.remove(namedFlow); 99 99 100 m_namedFlows.remove(namedFlow);100 InspectorInstrumentation::didRemoveNamedFlow(m_document, namedFlow->name()); 101 101 } 102 102 -
trunk/Source/WebCore/inspector/Inspector.json
r127468 r127500 2413 2413 "description": "Returns the Named Flows from the document.", 2414 2414 "hidden": true 2415 }, 2416 { 2417 "name": "getFlowByName", 2418 "parameters": [ 2419 { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, 2420 { "name": "name", "type": "string", "description": "Named Flow identifier." } 2421 ], 2422 "returns": [ 2423 { "name": "namedFlow", "$ref": "NamedFlow", "description": "A Named Flow." } 2424 ], 2425 "description": "Returns the Named Flow identified by the given name", 2426 "hidden": true 2415 2427 } 2416 2428 ], … … 2430 2442 "name": "namedFlowCreated", 2431 2443 "parameters": [ 2432 { "name": "namedFlow", "$ref": "NamedFlow", "description": "The new Named Flow." } 2444 { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, 2445 { "name": "namedFlow", "type": "string", "description": "Identifier of the new Named Flow." } 2433 2446 ], 2434 2447 "description": "Fires when a Named Flow is created.", … … 2439 2452 "parameters": [ 2440 2453 { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, 2441 { "name": " flowName", "type": "string", "description": "Identifier of the removed Named Flow." }2454 { "name": "namedFlow", "type": "string", "description": "Identifier of the removed Named Flow." } 2442 2455 ], 2443 2456 "description": "Fires when a Named Flow is removed: has no associated content nodes and regions.", 2444 "hidden": true2445 },2446 {2447 "name": "regionLayoutUpdated",2448 "parameters": [2449 { "name": "namedFlow", "$ref": "NamedFlow", "description": "The Named Flow whose layout may have changed." }2450 ],2451 "description": "Fires when a Named Flow's layout may have changed.",2452 2457 "hidden": true 2453 2458 } -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r127468 r127500 538 538 } 539 539 540 void InspectorCSSAgent::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow) 541 { 542 int documentNodeId = documentNodeWithRequestedFlowsId(document); 543 if (!documentNodeId) 544 return; 545 546 ErrorString errorString; 547 m_frontend->namedFlowCreated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId)); 548 } 549 550 void InspectorCSSAgent::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow) 551 { 552 int documentNodeId = documentNodeWithRequestedFlowsId(document); 553 if (!documentNodeId) 554 return; 555 556 m_frontend->namedFlowRemoved(documentNodeId, namedFlow->name().string()); 557 } 558 559 void InspectorCSSAgent::didUpdateRegionLayout(Document* document, WebKitNamedFlow* namedFlow) 560 { 561 int documentNodeId = documentNodeWithRequestedFlowsId(document); 562 if (!documentNodeId) 563 return; 564 565 ErrorString errorString; 566 m_frontend->regionLayoutUpdated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId)); 540 void InspectorCSSAgent::didCreateNamedFlow(Document* document, const AtomicString& name) 541 { 542 int nodeId = m_domAgent->boundNodeId(document); 543 if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId)) 544 return; 545 546 m_frontend->namedFlowCreated(nodeId, name.string()); 547 } 548 549 void InspectorCSSAgent::didRemoveNamedFlow(Document* document, const AtomicString& name) 550 { 551 int nodeId = m_domAgent->boundNodeId(document); 552 if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId)) 553 return; 554 555 m_frontend->namedFlowRemoved(nodeId, name.string()); 567 556 } 568 557 … … 840 829 841 830 m_namedFlowCollectionsRequested.add(documentNodeId); 842 843 831 Vector<RefPtr<WebKitNamedFlow> > namedFlowsVector = document->namedFlows()->namedFlows(); 844 832 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> > namedFlows = TypeBuilder::Array<TypeBuilder::CSS::NamedFlow>::create(); 845 833 834 846 835 for (Vector<RefPtr<WebKitNamedFlow> >::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it) 847 836 namedFlows->addItem(buildObjectForNamedFlow(errorString, it->get(), documentNodeId)); 848 837 849 838 result = namedFlows.release(); 839 } 840 841 void InspectorCSSAgent::getFlowByName(ErrorString* errorString, int documentNodeId, const String& flowName, RefPtr<TypeBuilder::CSS::NamedFlow>& result) 842 { 843 Document* document = m_domAgent->assertDocument(errorString, documentNodeId); 844 if (!document) 845 return; 846 847 WebKitNamedFlow* webkitNamedFlow = document->namedFlows()->flowByName(flowName); 848 if (!webkitNamedFlow) { 849 *errorString = "No target CSS Named Flow found"; 850 return; 851 } 852 853 RefPtr<WebKitNamedFlow> protector(webkitNamedFlow); 854 result = buildObjectForNamedFlow(errorString, webkitNamedFlow, documentNodeId); 850 855 } 851 856 … … 927 932 } 928 933 return toElement(node); 929 }930 931 int InspectorCSSAgent::documentNodeWithRequestedFlowsId(Document* document)932 {933 int documentNodeId = m_domAgent->boundNodeId(document);934 if (!documentNodeId || !m_namedFlowCollectionsRequested.contains(documentNodeId))935 return 0;936 937 return documentNodeId;938 934 } 939 935 -
trunk/Source/WebCore/inspector/InspectorCSSAgent.h
r127468 r127500 100 100 void reset(); 101 101 void mediaQueryResultChanged(); 102 void didCreateNamedFlow(Document*, WebKitNamedFlow*); 103 void willRemoveNamedFlow(Document*, WebKitNamedFlow*); 104 void didUpdateRegionLayout(Document*, WebKitNamedFlow*); 102 void didCreateNamedFlow(Document*, const AtomicString& name); 103 void didRemoveNamedFlow(Document*, const AtomicString& name); 105 104 106 105 virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&); … … 118 117 virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr<InspectorArray>& forcedPseudoClasses); 119 118 virtual void getNamedFlowCollection(ErrorString*, int documentNodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> >& result); 119 virtual void getFlowByName(ErrorString*, int documentNodeId, const String& flowName, RefPtr<TypeBuilder::CSS::NamedFlow>& result); 120 120 121 121 virtual void startSelectorProfiler(ErrorString*); … … 146 146 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); 147 147 Element* elementForId(ErrorString*, int nodeId); 148 int documentNodeWithRequestedFlowsId(Document*);149 148 void collectStyleSheets(CSSStyleSheet*, TypeBuilder::Array<WebCore::TypeBuilder::CSS::CSSStyleSheetHeader>*); 150 149 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r127468 r127500 232 232 } 233 233 234 void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)234 void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name) 235 235 { 236 236 if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent()) 237 cssAgent->didCreateNamedFlow(document, name dFlow);238 } 239 240 void InspectorInstrumentation:: willRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)237 cssAgent->didCreateNamedFlow(document, name); 238 } 239 240 void InspectorInstrumentation::didRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name) 241 241 { 242 242 if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent()) 243 cssAgent->willRemoveNamedFlow(document, namedFlow); 244 } 245 246 void InspectorInstrumentation::didUpdateRegionLayoutImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow) 247 { 248 if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent()) 249 cssAgent->didUpdateRegionLayout(document, namedFlow); 243 cssAgent->didRemoveNamedFlow(document, name); 250 244 } 251 245 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r127468 r127500 114 114 static void didPushShadowRoot(Element* host, ShadowRoot*); 115 115 static void willPopShadowRoot(Element* host, ShadowRoot*); 116 static void didCreateNamedFlow(Document*, WebKitNamedFlow*); 117 static void willRemoveNamedFlow(Document*, WebKitNamedFlow*); 118 static void didUpdateRegionLayout(Document*, WebKitNamedFlow*); 116 static void didCreateNamedFlow(Document*, const AtomicString& name); 117 static void didRemoveNamedFlow(Document*, const AtomicString& name); 119 118 120 119 static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags); … … 292 291 static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*); 293 292 static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*); 294 static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*); 295 static void willRemoveNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*); 296 static void didUpdateRegionLayoutImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*); 293 static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, const AtomicString& name); 294 static void didRemoveNamedFlowImpl(InstrumentingAgents*, Document*, const AtomicString& name); 297 295 298 296 static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags); … … 564 562 } 565 563 566 inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow) 567 { 568 #if ENABLE(INSPECTOR) 569 FAST_RETURN_IF_NO_FRONTENDS(void()); 570 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) 571 didCreateNamedFlowImpl(instrumentingAgents, document, namedFlow); 572 #endif 573 } 574 575 inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow) 576 { 577 #if ENABLE(INSPECTOR) 578 FAST_RETURN_IF_NO_FRONTENDS(void()); 579 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) 580 willRemoveNamedFlowImpl(instrumentingAgents, document, namedFlow); 581 #endif 582 } 583 584 inline void InspectorInstrumentation::didUpdateRegionLayout(Document* document, WebKitNamedFlow* namedFlow) 585 { 586 #if ENABLE(INSPECTOR) 587 FAST_RETURN_IF_NO_FRONTENDS(void()); 588 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) 589 didUpdateRegionLayoutImpl(instrumentingAgents, document, namedFlow); 564 inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, const AtomicString& name) 565 { 566 #if ENABLE(INSPECTOR) 567 FAST_RETURN_IF_NO_FRONTENDS(void()); 568 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) 569 didCreateNamedFlowImpl(instrumentingAgents, document, name); 570 #endif 571 } 572 573 inline void InspectorInstrumentation::didRemoveNamedFlow(Document* document, const AtomicString& name) 574 { 575 #if ENABLE(INSPECTOR) 576 FAST_RETURN_IF_NO_FRONTENDS(void()); 577 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) 578 didRemoveNamedFlowImpl(instrumentingAgents, document, name); 590 579 #endif 591 580 } -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r127468 r127500 40 40 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this); 41 41 this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding(this); 42 this._namedFlowCollections = {};43 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._resetNamedFlowCollections, this);44 42 InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this)); 45 43 CSSAgent.enable(); … … 61 59 MediaQueryResultChanged: "MediaQueryResultChanged", 62 60 NamedFlowCreated: "NamedFlowCreated", 63 NamedFlowRemoved: "NamedFlowRemoved", 64 RegionLayoutUpdated: "RegionLayoutUpdated" 61 NamedFlowRemoved: "NamedFlowRemoved" 65 62 } 66 63 … … 176 173 /** 177 174 * @param {DOMAgent.NodeId} nodeId 178 * @param {function(Object)} userCallback 179 */ 180 getNamedFlowCollectionAsync: function(documentNodeId, userCallback) 181 { 182 var namedFlowCollection = this._namedFlowCollections[documentNodeId]; 183 if (namedFlowCollection) { 184 userCallback(namedFlowCollection.namedFlowMap); 185 return; 186 } 187 175 * @param {function(?Array.<WebInspector.NamedFlow>)} userCallback 176 */ 177 getNamedFlowCollectionAsync: function(nodeId, userCallback) 178 { 188 179 /** 189 180 * @param {function(?Array.<WebInspector.NamedFlow>)} userCallback … … 195 186 if (error || !namedFlowPayload) 196 187 userCallback(null); 197 else { 198 var namedFlowCollection = new WebInspector.NamedFlowCollection(namedFlowPayload); 199 this._namedFlowCollections[documentNodeId] = namedFlowCollection; 200 userCallback(namedFlowCollection.namedFlowMap); 201 } 202 } 203 204 CSSAgent.getNamedFlowCollection(documentNodeId, callback.bind(this, userCallback)); 188 else 189 userCallback(WebInspector.NamedFlow.parsePayloadArray(namedFlowPayload)); 190 } 191 192 CSSAgent.getNamedFlowCollection(nodeId, callback.bind(this, userCallback)); 205 193 }, 206 194 … … 210 198 * @param {function(?WebInspector.NamedFlow)} userCallback 211 199 */ 212 getFlowByNameAsync: function(documentNodeId, flowName, userCallback) 213 { 214 var namedFlowCollection = this._namedFlowCollections[documentNodeId]; 215 if (namedFlowCollection) { 216 userCallback(namedFlowCollection.flowByName(flowName)); 217 return; 218 } 219 200 getFlowByNameAsync: function(nodeId, flowName, userCallback) 201 { 220 202 /** 221 203 * @param {function(?WebInspector.NamedFlow)} userCallback 222 * @param {?CSSAgent.NamedFlow=} namedFlowMap 223 */ 224 function callback(userCallback, namedFlowMap) 225 { 226 if (error || !namedFlowMap) 204 * @param {?Protocol.Error} error 205 * @param {?CSSAgent.NamedFlow=} namedFlowPayload 206 */ 207 function callback(userCallback, error, namedFlowPayload) 208 { 209 if (error || !namedFlowPayload) 227 210 userCallback(null); 228 211 else 229 userCallback( this._namedFlowCollections[documentNodeId].flowByName(flowName));230 } 231 232 this.getNamedFlowCollectionAsync(documentNodeId, callback.bind(this, userCallback));212 userCallback(WebInspector.NamedFlow.parsePayload(namedFlowPayload)); 213 } 214 215 CSSAgent.getFlowByName(nodeId, flowName, callback.bind(this, userCallback)); 233 216 }, 234 217 … … 368 351 369 352 /** 370 * @param {CSSAgent.NamedFlow} namedFlowPayload 371 */ 372 _namedFlowCreated: function(namedFlowPayload) 373 { 374 var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload); 375 var namedFlowCollection = this._namedFlowCollections[namedFlow.documentNodeId]; 376 377 if (!namedFlowCollection) 353 * @param {DOMAgent.NodeId} documentNodeId 354 * @param {string} name 355 */ 356 _namedFlowCreated: function(documentNodeId, name) 357 { 358 if (!this.hasEventListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated)) 378 359 return; 379 360 380 namedFlowCollection.appendNamedFlow(namedFlow); 381 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated, namedFlow); 361 /** 362 * @param {WebInspector.DOMDocument} root 363 */ 364 function callback(root) 365 { 366 // FIXME: At the moment we only want support for NamedFlows in the main document 367 if (documentNodeId !== root.id) 368 return; 369 370 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated, { documentNodeId: documentNodeId, name: name }); 371 } 372 373 WebInspector.domAgent.requestDocument(callback.bind(this)); 382 374 }, 383 375 384 376 /** 385 377 * @param {DOMAgent.NodeId} documentNodeId 386 * @param {string} flowName 387 */ 388 _namedFlowRemoved: function(documentNodeId, flowName) 389 { 390 var namedFlowCollection = this._namedFlowCollections[documentNodeId]; 391 392 if (!namedFlowCollection) 378 * @param {string} name 379 */ 380 _namedFlowRemoved: function(documentNodeId, name) 381 { 382 if (!this.hasEventListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved)) 393 383 return; 394 384 395 namedFlowCollection.removeNamedFlow(flowName); 396 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, flowName: flowName }); 397 }, 398 399 /** 400 * @param {CSSAgent.NamedFlow} namedFlowPayload 401 */ 402 _regionLayoutUpdated: function(namedFlowPayload) 403 { 404 var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload); 405 var namedFlowCollection = this._namedFlowCollections[namedFlow.documentNodeId]; 406 407 if (!namedFlowCollection) 408 return; 409 410 namedFlowCollection.appendNamedFlow(namedFlow); 411 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, namedFlow); 385 /** 386 * @param {WebInspector.DOMDocument} root 387 */ 388 function callback(root) 389 { 390 // FIXME: At the moment we only want support for NamedFlows in the main document 391 if (documentNodeId !== root.id) 392 return; 393 394 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, name: name }); 395 } 396 397 WebInspector.domAgent.requestDocument(callback.bind(this)); 412 398 }, 413 399 … … 476 462 { 477 463 this._sourceMappings = {}; 478 },479 480 _resetNamedFlowCollections: function()481 {482 this._namedFlowCollections = {};483 464 }, 484 465 … … 1346 1327 1347 1328 /** 1348 * @param {CSSAgent.NamedFlow} namedFlowPayload1349 */1350 namedFlowCreated: function(namedFlowPayload)1351 {1352 this._cssModel._namedFlowCreated(namedFlowPayload);1353 },1354 1355 /**1356 1329 * @param {DOMAgent.NodeId} documentNodeId 1357 * @param {string} flowName 1358 */ 1359 namedFlowRemoved: function(documentNodeId, flowName) 1360 { 1361 this._cssModel._namedFlowRemoved(documentNodeId, flowName); 1362 }, 1363 1364 /** 1365 * @param {CSSAgent.NamedFlow} namedFlowPayload 1366 */ 1367 regionLayoutUpdated: function(namedFlowPayload) 1368 { 1369 this._cssModel._regionLayoutUpdated(namedFlowPayload); 1330 * @param {string} name 1331 */ 1332 namedFlowCreated: function(documentNodeId, name) 1333 { 1334 this._cssModel._namedFlowCreated(documentNodeId, name); 1335 }, 1336 1337 /** 1338 * @param {DOMAgent.NodeId} documentNodeId 1339 * @param {string} name 1340 */ 1341 namedFlowRemoved: function(documentNodeId, name) 1342 { 1343 this._cssModel._namedFlowRemoved(documentNodeId, name); 1370 1344 } 1371 1345 } … … 1377 1351 WebInspector.NamedFlow = function(payload) 1378 1352 { 1379 this. documentNodeId = payload.documentNodeId;1353 this.nodeId = payload.documentNodeId; 1380 1354 this.name = payload.name; 1381 1355 this.overset = payload.overset; … … 1394 1368 1395 1369 /** 1396 * @constructor 1397 * @param {?Array.<CSSAgent.NamedFlow>=} payload 1398 */ 1399 WebInspector.NamedFlowCollection = function(payload) 1400 { 1401 this.namedFlowMap = {}; 1402 1403 for (var i = 0; i < payload.length; ++i) { 1404 var namedFlow = WebInspector.NamedFlow.parsePayload(payload[i]); 1405 this.namedFlowMap[namedFlow.name] = namedFlow; 1406 } 1407 } 1408 1409 WebInspector.NamedFlowCollection.prototype = { 1410 /** 1411 * @param {WebInspector.NamedFlow} namedFlow 1412 */ 1413 appendNamedFlow: function(namedFlow) 1414 { 1415 this.namedFlowMap[namedFlow.name] = namedFlow; 1416 }, 1417 1418 /** 1419 * @param {string} flowName 1420 */ 1421 removeNamedFlow: function(flowName) 1422 { 1423 delete this.namedFlowMap[flowName]; 1424 }, 1425 1426 /** 1427 * @param {string} flowName 1428 * @return {WebInspector.NamedFlow} 1429 */ 1430 flowByName: function(flowName) 1431 { 1432 var namedFlow = this.namedFlowMap[flowName]; 1433 1434 if (namedFlow === undefined) 1435 return null; 1436 return namedFlow; 1437 } 1438 } 1370 * @param {?Array.<CSSAgent.NamedFlow>=} namedFlowPayload 1371 * @return {?Array.<WebInspector.NamedFlow>} 1372 */ 1373 WebInspector.NamedFlow.parsePayloadArray = function(namedFlowPayload) 1374 { 1375 if (!namedFlowPayload) 1376 return null; 1377 1378 var parsedArray = []; 1379 for (var i = 0; i < namedFlowPayload.length; ++i) 1380 parsedArray[i] = WebInspector.NamedFlow.parsePayload(namedFlowPayload[i]); 1381 return parsedArray; 1382 } 1383 1439 1384 /** 1440 1385 * @type {WebInspector.CSSStyleModel} -
trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp
r127472 r127500 28 28 29 29 #include "FlowThreadController.h" 30 #include "InspectorInstrumentation.h"31 30 #include "RenderRegion.h" 32 31 #include "RenderView.h" … … 359 358 { 360 359 RenderFlowThread::dispatchRegionLayoutUpdateEvent(); 361 InspectorInstrumentation::didUpdateRegionLayout(document(), m_namedFlow.get());362 360 363 361 if (!m_regionLayoutUpdateEventTimer.isActive() && m_namedFlow->hasEventListeners())
Note:
See TracChangeset
for help on using the changeset viewer.