Changeset 127867 in webkit
- Timestamp:
- Sep 7, 2012 7:00:11 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127866 r127867 1 2012-09-07 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r127780 and r127859. 4 http://trac.webkit.org/changeset/127780 5 http://trac.webkit.org/changeset/127859 6 https://bugs.webkit.org/show_bug.cgi?id=96102 7 8 "inspector/styles/protocol-css-regions-commands.html crashing 9 on Chromium Linux Debug and timing out flakily on Release" 10 (Requested by apavlov on #webkit). 11 12 * inspector/styles/protocol-css-regions-commands-expected.txt: 13 * inspector/styles/protocol-css-regions-commands.html: 14 1 15 2012-09-07 Zan Dobersek <zandobersek@gmail.com> 2 16 -
trunk/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt
r127780 r127867 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
r127780 r127867 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
r127865 r127867 1 2012-09-07 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r127780 and r127859. 4 http://trac.webkit.org/changeset/127780 5 http://trac.webkit.org/changeset/127859 6 https://bugs.webkit.org/show_bug.cgi?id=96102 7 8 "inspector/styles/protocol-css-regions-commands.html crashing 9 on Chromium Linux Debug and timing out flakily on Release" 10 (Requested by apavlov on #webkit). 11 12 * dom/NamedFlowCollection.cpp: 13 (WebCore::NamedFlowCollection::ensureFlowWithName): 14 (WebCore::NamedFlowCollection::discardNamedFlow): 15 * inspector/Inspector.json: 16 * inspector/InspectorCSSAgent.cpp: 17 (WebCore::InspectorCSSAgent::reset): 18 (WebCore::InspectorCSSAgent::didCreateNamedFlow): 19 (WebCore::InspectorCSSAgent::didRemoveNamedFlow): 20 (WebCore::InspectorCSSAgent::getNamedFlowCollection): 21 (WebCore::InspectorCSSAgent::getFlowByName): 22 (WebCore): 23 * inspector/InspectorCSSAgent.h: 24 (WebCore): 25 (InspectorCSSAgent): 26 * inspector/InspectorInstrumentation.cpp: 27 (WebCore): 28 (WebCore::InspectorInstrumentation::didCreateNamedFlowImpl): 29 (WebCore::InspectorInstrumentation::didRemoveNamedFlowImpl): 30 * inspector/InspectorInstrumentation.h: 31 (InspectorInstrumentation): 32 (WebCore::InspectorInstrumentation::didCreateNamedFlow): 33 (WebCore::InspectorInstrumentation::didRemoveNamedFlow): 34 * inspector/front-end/CSSStyleModel.js: 35 (WebInspector.CSSStyleModel): 36 (WebInspector.CSSStyleModel.prototype.getNamedFlowCollectionAsync): 37 (WebInspector.CSSStyleModel.prototype.getFlowByNameAsync): 38 (WebInspector.CSSStyleModel.prototype._namedFlowCreated.callback): 39 (WebInspector.CSSStyleModel.prototype._namedFlowCreated): 40 (WebInspector.CSSStyleModel.prototype._namedFlowRemoved.callback): 41 (WebInspector.CSSStyleModel.prototype._namedFlowRemoved): 42 (WebInspector.CSSDispatcher.prototype.namedFlowCreated): 43 (WebInspector.CSSDispatcher.prototype.namedFlowRemoved): 44 (WebInspector.NamedFlow): 45 (WebInspector.NamedFlow.parsePayloadArray): 46 * rendering/RenderNamedFlowThread.cpp: 47 (WebCore::RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent): 48 1 49 2012-09-07 Sami Kyostila <skyostil@google.com> 2 50 -
trunk/Source/WebCore/dom/NamedFlowCollection.cpp
r127780 r127867 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
r127861 r127867 2340 2340 "description": "Returns the Named Flows from the document.", 2341 2341 "hidden": true 2342 }, 2343 { 2344 "name": "getFlowByName", 2345 "parameters": [ 2346 { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, 2347 { "name": "name", "type": "string", "description": "Named Flow identifier." } 2348 ], 2349 "returns": [ 2350 { "name": "namedFlow", "$ref": "NamedFlow", "description": "A Named Flow." } 2351 ], 2352 "description": "Returns the Named Flow identified by the given name", 2353 "hidden": true 2342 2354 } 2343 2355 ], … … 2357 2369 "name": "namedFlowCreated", 2358 2370 "parameters": [ 2359 { "name": "namedFlow", "$ref": "NamedFlow", "description": "The new Named Flow." } 2371 { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, 2372 { "name": "namedFlow", "type": "string", "description": "Identifier of the new Named Flow." } 2360 2373 ], 2361 2374 "description": "Fires when a Named Flow is created.", … … 2366 2379 "parameters": [ 2367 2380 { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." }, 2368 { "name": " flowName", "type": "string", "description": "Identifier of the removed Named Flow." }2381 { "name": "namedFlow", "type": "string", "description": "Identifier of the removed Named Flow." } 2369 2382 ], 2370 2383 "description": "Fires when a Named Flow is removed: has no associated content nodes and regions.", 2371 "hidden": true2372 },2373 {2374 "name": "regionLayoutUpdated",2375 "parameters": [2376 { "name": "namedFlow", "$ref": "NamedFlow", "description": "The Named Flow whose layout may have changed." }2377 ],2378 "description": "Fires when a Named Flow's layout may have changed.",2379 2384 "hidden": true 2380 2385 } -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r127780 r127867 227 227 } 228 228 229 class UpdateRegionLayoutTask {230 public:231 UpdateRegionLayoutTask(InspectorCSSAgent*);232 void scheduleFor(WebKitNamedFlow*, int documentNodeId);233 void reset() { m_timer.stop(); }234 void onTimer(Timer<UpdateRegionLayoutTask>*);235 236 private:237 InspectorCSSAgent* m_cssAgent;238 Timer<UpdateRegionLayoutTask> m_timer;239 HashMap<WebKitNamedFlow*, int> m_namedFlows;240 };241 242 UpdateRegionLayoutTask::UpdateRegionLayoutTask(InspectorCSSAgent* cssAgent)243 : m_cssAgent(cssAgent)244 , m_timer(this, &UpdateRegionLayoutTask::onTimer)245 {246 }247 248 void UpdateRegionLayoutTask::scheduleFor(WebKitNamedFlow* namedFlow, int documentNodeId)249 {250 m_namedFlows.add(namedFlow, documentNodeId);251 252 if (!m_timer.isActive())253 m_timer.startOneShot(0);254 }255 256 void UpdateRegionLayoutTask::onTimer(Timer<UpdateRegionLayoutTask>*)257 {258 // The timer is stopped on m_cssAgent destruction, so this method will never be called after m_cssAgent has been destroyed.259 for (HashMap<WebKitNamedFlow*, int>::iterator it = m_namedFlows.begin(), end = m_namedFlows.end(); it != end; ++it)260 m_cssAgent->regionLayoutUpdated(it->first, it->second);261 262 m_namedFlows.clear();263 }264 265 229 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { 266 230 WTF_MAKE_NONCOPYABLE(StyleSheetAction); … … 555 519 m_documentToInspectorStyleSheet.clear(); 556 520 m_namedFlowCollectionsRequested.clear(); 557 if (m_updateRegionLayoutTask)558 m_updateRegionLayoutTask->reset();559 521 resetPseudoStates(); 560 522 } … … 576 538 } 577 539 578 void InspectorCSSAgent::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow) 579 { 580 int documentNodeId = documentNodeWithRequestedFlowsId(document); 581 if (!documentNodeId) 582 return; 583 584 ErrorString errorString; 585 m_frontend->namedFlowCreated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId)); 586 } 587 588 void InspectorCSSAgent::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow) 589 { 590 int documentNodeId = documentNodeWithRequestedFlowsId(document); 591 if (!documentNodeId) 592 return; 593 594 m_frontend->namedFlowRemoved(documentNodeId, namedFlow->name().string()); 595 } 596 597 void InspectorCSSAgent::didUpdateRegionLayout(Document* document, WebKitNamedFlow* namedFlow) 598 { 599 int documentNodeId = documentNodeWithRequestedFlowsId(document); 600 if (!documentNodeId) 601 return; 602 603 if (!m_updateRegionLayoutTask) 604 m_updateRegionLayoutTask = adoptPtr(new UpdateRegionLayoutTask(this)); 605 m_updateRegionLayoutTask->scheduleFor(namedFlow, documentNodeId); 606 } 607 608 void InspectorCSSAgent::regionLayoutUpdated(WebKitNamedFlow* namedFlow, int documentNodeId) 609 { 610 if (namedFlow->flowState() == WebKitNamedFlow::FlowStateNull) 611 return; 612 613 ErrorString errorString; 614 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()); 615 556 } 616 557 … … 888 829 889 830 m_namedFlowCollectionsRequested.add(documentNodeId); 890 891 831 Vector<RefPtr<WebKitNamedFlow> > namedFlowsVector = document->namedFlows()->namedFlows(); 892 832 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> > namedFlows = TypeBuilder::Array<TypeBuilder::CSS::NamedFlow>::create(); 893 833 834 894 835 for (Vector<RefPtr<WebKitNamedFlow> >::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it) 895 836 namedFlows->addItem(buildObjectForNamedFlow(errorString, it->get(), documentNodeId)); 896 837 897 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); 898 855 } 899 856 … … 975 932 } 976 933 return toElement(node); 977 }978 979 int InspectorCSSAgent::documentNodeWithRequestedFlowsId(Document* document)980 {981 int documentNodeId = m_domAgent->boundNodeId(document);982 if (!documentNodeId || !m_namedFlowCollectionsRequested.contains(documentNodeId))983 return 0;984 985 return documentNodeId;986 934 } 987 935 -
trunk/Source/WebCore/inspector/InspectorCSSAgent.h
r127780 r127867 56 56 class SelectorProfile; 57 57 class StyleResolver; 58 class UpdateRegionLayoutTask;59 58 60 59 #if ENABLE(INSPECTOR) … … 101 100 void reset(); 102 101 void mediaQueryResultChanged(); 103 void didCreateNamedFlow(Document*, WebKitNamedFlow*); 104 void willRemoveNamedFlow(Document*, WebKitNamedFlow*); 105 void didUpdateRegionLayout(Document*, WebKitNamedFlow*); 106 void regionLayoutUpdated(WebKitNamedFlow*, int documentNodeId); 102 void didCreateNamedFlow(Document*, const AtomicString& name); 103 void didRemoveNamedFlow(Document*, const AtomicString& name); 107 104 108 105 virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&); … … 120 117 virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr<InspectorArray>& forcedPseudoClasses); 121 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); 122 120 123 121 virtual void startSelectorProfiler(ErrorString*); … … 148 146 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); 149 147 Element* elementForId(ErrorString*, int nodeId); 150 int documentNodeWithRequestedFlowsId(Document*);151 148 void collectStyleSheets(CSSStyleSheet*, TypeBuilder::Array<WebCore::TypeBuilder::CSS::CSSStyleSheetHeader>*); 152 149 … … 180 177 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; 181 178 HashSet<int> m_namedFlowCollectionsRequested; 182 OwnPtr<UpdateRegionLayoutTask> m_updateRegionLayoutTask;183 179 184 180 int m_lastStyleSheetId; -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r127780 r127867 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
r127780 r127867 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
r127859 r127867 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 … … 175 172 176 173 /** 177 * @param {DOMAgent.NodeId} documentNodeId 178 * @param {function(Object.<string, WebInspector.NamedFlow>)} 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 188 /** 189 * @param {function(Object.<string, WebInspector.NamedFlow>)} userCallback 174 * @param {DOMAgent.NodeId} nodeId 175 * @param {function(?Array.<WebInspector.NamedFlow>)} userCallback 176 */ 177 getNamedFlowCollectionAsync: function(nodeId, userCallback) 178 { 179 /** 180 * @param {function(?Array.<WebInspector.NamedFlow>)} userCallback 190 181 * @param {?Protocol.Error} error 191 182 * @param {?Array.<CSSAgent.NamedFlow>=} namedFlowPayload … … 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)); 205 }, 206 207 /** 208 * @param {DOMAgent.NodeId} documentNodeId 188 else 189 userCallback(WebInspector.NamedFlow.parsePayloadArray(namedFlowPayload)); 190 } 191 192 CSSAgent.getNamedFlowCollection(nodeId, callback.bind(this, userCallback)); 193 }, 194 195 /** 196 * @param {DOMAgent.NodeId} nodeId 209 197 * @param {string} flowName 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 {Object.<string, WebInspector.NamedFlow>} namedFlowMap 223 */ 224 function callback(userCallback, namedFlowMap) 225 { 226 if (!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 /** @type {Object.<string, WebInspector.NamedFlow>} */ 1402 this.namedFlowMap = {}; 1403 1404 for (var i = 0; i < payload.length; ++i) { 1405 var namedFlow = WebInspector.NamedFlow.parsePayload(payload[i]); 1406 this.namedFlowMap[namedFlow.name] = namedFlow; 1407 } 1408 } 1409 1410 WebInspector.NamedFlowCollection.prototype = { 1411 /** 1412 * @param {WebInspector.NamedFlow} namedFlow 1413 */ 1414 appendNamedFlow: function(namedFlow) 1415 { 1416 this.namedFlowMap[namedFlow.name] = namedFlow; 1417 }, 1418 1419 /** 1420 * @param {string} flowName 1421 */ 1422 removeNamedFlow: function(flowName) 1423 { 1424 delete this.namedFlowMap[flowName]; 1425 }, 1426 1427 /** 1428 * @param {string} flowName 1429 * @return {WebInspector.NamedFlow} 1430 */ 1431 flowByName: function(flowName) 1432 { 1433 var namedFlow = this.namedFlowMap[flowName]; 1434 1435 if (!namedFlow) 1436 return null; 1437 return namedFlow; 1438 } 1439 } 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 1440 1384 /** 1441 1385 * @type {WebInspector.CSSStyleModel} -
trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp
r127780 r127867 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.