Changeset 124778 in webkit
- Timestamp:
- Aug 6, 2012 9:39:56 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r124775 r124778 1 2012-08-06 Andrei Poenaru <poenaru@adobe.com> 2 3 Web Inspector: Protocol: Add "namedFlowCreated" and "namedFlowRemoved" events 4 https://bugs.webkit.org/show_bug.cgi?id=92739 5 6 Reviewed by Pavel Feldman. 7 8 Modified test so that it validates the implemented events. 9 10 * inspector/styles/protocol-css-regions-commands-expected.txt: 11 * inspector/styles/protocol-css-regions-commands.html: 12 1 13 2012-08-06 Zan Dobersek <zandobersek@gmail.com> 2 14 -
trunk/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt
r123459 r124778 1 Tests the following commands :1 Tests the following commands and events: 2 2 3 3 getNamedFlowCollection Bug 91607 4 4 getFlowByName Bug 91855 5 namedFlowCreated Bug 92739 6 namedFlowRemoved Bug 92739 5 7 6 8 … … 20 22 There is no Named Flow "flow4" in the main document 21 23 24 Running: testNamedFlowCreated 25 NamedFlowCreated: "tmpNamedFlow" 26 27 Running: testNamedFlowRemoved 28 NamedFlowRemoved: "tmpNamedFlow" 29 -
trunk/LayoutTests/inspector/styles/protocol-css-regions-commands.html
r123459 r124778 17 17 18 18 runTest(); 19 } 20 21 function createNamedFlow() 22 { 23 var article = document.createElement("article"); 24 article.id = "tmpArticle"; 25 article.style.webkitFlowInto = "tmpNamedFlow"; 26 27 document.body.appendChild(article); 28 } 29 30 function removeNamedFlow() 31 { 32 var article = document.getElementById("tmpArticle"); 33 34 document.body.removeChild(article); 19 35 } 20 36 … … 100 116 } 101 117 }, 118 119 function testNamedFlowCreated(next) 120 { 121 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, callback, this); 122 InspectorTest.evaluateInPage("createNamedFlow()"); 123 124 function callback(event) 125 { 126 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, callback, this); 127 128 if (event.data.name !== "tmpNamedFlow") { 129 Inspector.addResult("[!] Failed"); 130 InspectorTest.completeTest(); 131 return; 132 } 133 134 InspectorTest.addResult("NamedFlowCreated: \"tmpNamedFlow\""); 135 next(); 136 } 137 }, 138 139 function testNamedFlowRemoved(next) 140 { 141 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, callback, this); 142 InspectorTest.evaluateInPage("removeNamedFlow()"); 143 144 function callback(event) 145 { 146 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, callback, this); 147 if (event.data.name !== "tmpNamedFlow") { 148 Inspector.addResult("[!] Failed"); 149 InspectorTest.completeTest(); 150 return; 151 } 152 153 InspectorTest.addResult("NamedFlowRemoved: \"tmpNamedFlow\""); 154 next(); 155 } 156 } 102 157 ]); 103 158 } … … 107 162 <body onload="createDynamicElements()"> 108 163 <p> 109 Tests the following commands :164 Tests the following commands and events: 110 165 <ul> 111 166 <li>getNamedFlowCollection <a href="https://bugs.webkit.org/show_bug.cgi?id=91607">Bug 91607</a></li> 112 167 <li>getFlowByName <a href="https://bugs.webkit.org/show_bug.cgi?id=91855">Bug 91855</a></li> 168 <li>namedFlowCreated <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li> 169 <li>namedFlowRemoved <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li> 113 170 </ul> 114 171 </p> -
trunk/Source/WebCore/ChangeLog
r124776 r124778 1 2012-08-06 Andrei Poenaru <poenaru@adobe.com> 2 3 Web Inspector: Protocol: Add "namedFlowCreated" and "namedFlowRemoved" events 4 https://bugs.webkit.org/show_bug.cgi?id=92739 5 6 Reviewed by Pavel Feldman. 7 8 Implemented "namedFlowCreated" and "namedFlowRemoved" events. 9 10 Modified test: inspector/styles/protocol-css-regions-commands.html. 11 12 * dom/WebKitNamedFlowCollection.cpp: 13 (WebCore::WebKitNamedFlowCollection::ensureFlowWithName): 14 (WebCore::WebKitNamedFlowCollection::discardNamedFlow): 15 * inspector/Inspector.json: 16 * inspector/InspectorCSSAgent.cpp: 17 (WebCore::InspectorCSSAgent::reset): 18 (WebCore::InspectorCSSAgent::didCreateNamedFlow): 19 (WebCore): 20 (WebCore::InspectorCSSAgent::didRemoveNamedFlow): 21 (WebCore::InspectorCSSAgent::getNamedFlowCollection): 22 * inspector/InspectorCSSAgent.h: 23 (InspectorCSSAgent): 24 * inspector/InspectorInstrumentation.cpp: 25 (WebCore): 26 (WebCore::InspectorInstrumentation::didCreateNamedFlowImpl): 27 (WebCore::InspectorInstrumentation::didRemoveNamedFlowImpl): 28 * inspector/InspectorInstrumentation.h: 29 (InspectorInstrumentation): 30 (WebCore::InspectorInstrumentation::didCreateNamedFlow): 31 (WebCore): 32 (WebCore::InspectorInstrumentation::didRemoveNamedFlow): 33 * inspector/front-end/CSSStyleModel.js: 34 (WebInspector.CSSStyleModel.prototype._namedFlowCreated.callback): 35 (WebInspector.CSSStyleModel.prototype._namedFlowCreated): 36 (WebInspector.CSSStyleModel.prototype._namedFlowRemoved.callback): 37 (WebInspector.CSSStyleModel.prototype._namedFlowRemoved): 38 (WebInspector.CSSDispatcher.prototype.styleSheetChanged): 39 (WebInspector.CSSDispatcher.prototype.namedFlowCreated): 40 (WebInspector.CSSDispatcher.prototype.namedFlowRemoved): 41 1 42 2012-08-06 Abhishek Arya <inferno@chromium.org> 2 43 -
trunk/Source/WebCore/dom/WebKitNamedFlowCollection.cpp
r123205 r124778 32 32 33 33 #include "Document.h" 34 #include "InspectorInstrumentation.h" 34 35 #include "WebKitNamedFlow.h" 35 36 … … 80 81 m_namedFlows.add(newFlow.get()); 81 82 83 InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow->name()); 84 82 85 return newFlow.release(); 83 86 } … … 93 96 94 97 m_namedFlows.remove(namedFlow); 98 99 InspectorInstrumentation::didRemoveNamedFlow(m_document, namedFlow->name()); 95 100 } 96 101 -
trunk/Source/WebCore/inspector/Inspector.json
r124765 r124778 2374 2374 ], 2375 2375 "description": "Fired whenever a stylesheet is changed as a result of the client operation." 2376 }, 2377 { 2378 "name": "namedFlowCreated", 2379 "parameters": [ 2380 { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, 2381 { "name": "namedFlow", "type": "string", "description": "Identifier of the new Named Flow." } 2382 ], 2383 "description": "Fires when a Named Flow is created.", 2384 "hidden": true 2385 }, 2386 { 2387 "name": "namedFlowRemoved", 2388 "parameters": [ 2389 { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, 2390 { "name": "namedFlow", "type": "string", "description": "Identifier of the removed Named Flow." } 2391 ], 2392 "description": "Fires when a Named Flow is removed: has no associated content nodes and regions.", 2393 "hidden": true 2376 2394 } 2377 2395 ] -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r124760 r124778 517 517 m_nodeToInspectorStyleSheet.clear(); 518 518 m_documentToInspectorStyleSheet.clear(); 519 m_namedFlowCollectionsRequested.clear(); 519 520 resetPseudoStates(); 520 521 } … … 534 535 if (m_frontend) 535 536 m_frontend->mediaQueryResultChanged(); 537 } 538 539 void InspectorCSSAgent::didCreateNamedFlow(Document* document, const AtomicString& name) 540 { 541 int nodeId = m_domAgent->boundNodeId(document); 542 if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId)) 543 return; 544 545 m_frontend->namedFlowCreated(nodeId, name.string()); 546 } 547 548 void InspectorCSSAgent::didRemoveNamedFlow(Document* document, const AtomicString& name) 549 { 550 int nodeId = m_domAgent->boundNodeId(document); 551 if (!nodeId || !m_namedFlowCollectionsRequested.contains(nodeId)) 552 return; 553 554 m_frontend->namedFlowRemoved(nodeId, name.string()); 536 555 } 537 556 … … 812 831 return; 813 832 833 m_namedFlowCollectionsRequested.add(nodeId); 834 814 835 Vector<String> namedFlowsVector = document->namedFlows()->namedFlowsNames(); 815 836 RefPtr<TypeBuilder::Array<String> > namedFlows = TypeBuilder::Array<String>::create(); -
trunk/Source/WebCore/inspector/InspectorCSSAgent.h
r123612 r124778 37 37 38 38 #include <wtf/HashMap.h> 39 #include <wtf/HashSet.h> 39 40 #include <wtf/PassRefPtr.h> 40 41 #include <wtf/RefPtr.h> … … 98 99 void reset(); 99 100 void mediaQueryResultChanged(); 101 void didCreateNamedFlow(Document*, const AtomicString& name); 102 void didRemoveNamedFlow(Document*, const AtomicString& name); 100 103 101 104 virtual void getComputedStyleForNode(ErrorString*, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&); … … 170 173 DocumentToViaInspectorStyleSheet m_documentToInspectorStyleSheet; 171 174 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; 175 HashSet<int> m_namedFlowCollectionsRequested; 172 176 173 177 int m_lastStyleSheetId; -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r124484 r124778 233 233 } 234 234 235 void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name) 236 { 237 if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent()) 238 cssAgent->didCreateNamedFlow(document, name); 239 } 240 241 void InspectorInstrumentation::didRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name) 242 { 243 if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent()) 244 cssAgent->didRemoveNamedFlow(document, name); 245 } 246 235 247 void InspectorInstrumentation::mouseDidMoveOverElementImpl(InstrumentingAgents* instrumentingAgents, const HitTestResult& result, unsigned modifierFlags) 236 248 { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r124484 r124778 114 114 static void didPushShadowRoot(Element* host, ShadowRoot*); 115 115 static void willPopShadowRoot(Element* host, ShadowRoot*); 116 static void didCreateNamedFlow(Document*, const AtomicString& name); 117 static void didRemoveNamedFlow(Document*, const AtomicString& name); 116 118 117 119 static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags); … … 291 293 static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*); 292 294 static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*); 295 static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, const AtomicString& name); 296 static void didRemoveNamedFlowImpl(InstrumentingAgents*, Document*, const AtomicString& name); 293 297 294 298 static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags); … … 558 562 } 559 563 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); 579 #endif 580 } 581 560 582 inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags) 561 583 { -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r123768 r124778 57 57 WebInspector.CSSStyleModel.Events = { 58 58 StyleSheetChanged: "StyleSheetChanged", 59 MediaQueryResultChanged: "MediaQueryResultChanged" 59 MediaQueryResultChanged: "MediaQueryResultChanged", 60 NamedFlowCreated: "NamedFlowCreated", 61 NamedFlowRemoved: "NamedFlowRemoved" 60 62 } 61 63 … … 338 340 339 341 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged, { styleSheetId: styleSheetId, majorChange: majorChange }); 342 }, 343 344 /** 345 * @param {DOMAgent.NodeId} documentNodeId 346 * @param {string} name 347 */ 348 _namedFlowCreated: function(documentNodeId, name) 349 { 350 if (!this.hasEventListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated)) 351 return; 352 353 /** 354 * @param {WebInspector.DOMDocument} root 355 */ 356 function callback(root) 357 { 358 // FIXME: At the moment we only want support for NamedFlows in the main document 359 if (documentNodeId !== root.id) 360 return; 361 362 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated, { documentNodeId: documentNodeId, name: name }); 363 } 364 365 WebInspector.domAgent.requestDocument(callback.bind(this)); 366 }, 367 368 /** 369 * @param {DOMAgent.NodeId} documentNodeId 370 * @param {string} name 371 */ 372 _namedFlowRemoved: function(documentNodeId, name) 373 { 374 if (!this.hasEventListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved)) 375 return; 376 377 /** 378 * @param {WebInspector.DOMDocument} root 379 */ 380 function callback(root) 381 { 382 // FIXME: At the moment we only want support for NamedFlows in the main document 383 if (documentNodeId !== root.id) 384 return; 385 386 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, name: name }); 387 } 388 389 WebInspector.domAgent.requestDocument(callback.bind(this)); 340 390 }, 341 391 … … 1266 1316 { 1267 1317 this._cssModel._fireStyleSheetChanged(styleSheetId); 1318 }, 1319 1320 /** 1321 * @param {DOMAgent.NodeId} documentNodeId 1322 * @param {string} name 1323 */ 1324 namedFlowCreated: function(documentNodeId, name) 1325 { 1326 this._cssModel._namedFlowCreated(documentNodeId, name); 1327 }, 1328 1329 /** 1330 * @param {DOMAgent.NodeId} documentNodeId 1331 * @param {string} name 1332 */ 1333 namedFlowRemoved: function(documentNodeId, name) 1334 { 1335 this._cssModel._namedFlowRemoved(documentNodeId, name); 1268 1336 } 1269 1337 }
Note: See TracChangeset
for help on using the changeset viewer.