Changeset 127500 in webkit


Ignore:
Timestamp:
Sep 4, 2012 1:58:54 PM (12 years ago)
Author:
mitz@apple.com
Message:

Reverted r127468 (the fix for <http://webkit.org/b/93443>) 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:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r127497 r127500  
     12012-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
    192012-09-04  Simon Fraser  <simon.fraser@apple.com>
    210
  • trunk/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt

    r127468 r127500  
    55namedFlowCreated Bug 92739
    66namedFlowRemoved Bug 92739
    7 regionLayoutUpdated Bug 93443
    8 This text is from CSS Named Flow "flow3".
    97
    108
    11 Running: testGetNamedFlowCollection
     9Running: testGetNamedFlowCollection1
    1210=== CSS Named Flows in main document ===
    1311* Named Flow "flow1"
     
    2119Regions: 1
    2220
    23 Running: testGetNamedFlowCollectionWithInvalidDocument
     21Running: testGetNamedFlowCollection2
    2422=== CSS Named Flows in #fake-document ===
    2523#fake-document is not a document
    2624
    27 Running: testGetFlowByName
     25Running: testGetFlowByName1
    2826=== Named Flow "flow2" from main document ===
    2927* Named Flow "flow2"
     
    3129Regions: 2
    3230
    33 Running: testGetFlowByNameWithInvalidName
     31Running: testGetFlowByName2
    3432=== Name Flow "flow4" from main document ===
    3533There is no Named Flow "flow4" in the main document
     
    3836NamedFlowCreated: "tmpNamedFlow"
    3937
    40 Running: testRegionLayoutUpdated
    41 RegionLayoutUpdated: "flow3"
    42 
    4338Running: testNamedFlowRemoved
    4439NamedFlowRemoved: "tmpNamedFlow"
  • trunk/LayoutTests/inspector/styles/protocol-css-regions-commands.html

    r127468 r127500  
    2222{
    2323    var article = document.createElement("article");
    24     var div = document.createElement("div");
    25 
    2624    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";
    3426
    3527    document.body.appendChild(article);
    36     document.body.appendChild(div);
    3728}
    3829
    3930function removeNamedFlow()
    4031{
    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);
    4335}
    4436
     
    4739    WebInspector.showPanel("elements");
    4840    InspectorTest.runTestSuite([
    49         function testGetNamedFlowCollection(next)
     41        function testGetNamedFlowCollection1(next)
    5042        {
    5143            WebInspector.domAgent.requestDocument(documentCallback);
     
    5648            }
    5749
    58             function namedFlowCallback(namedFlowMap)
     50            function namedFlowCallback(namedFlows)
    5951            {
    6052                InspectorTest.addResult("=== CSS Named Flows in main document ===");
    6153
    62                 if (!namedFlowMap) {
     54                if (!namedFlows) {
    6355                    InspectorTest.addResult("[!] Failed to get Named Flows");
    6456                    InspectorTest.completeTest();
    6557                    return;
    6658                }
    67 
    68                 namedFlows = [];
    69                 for (var flowName in namedFlowMap)
    70                     namedFlows.push(namedFlowMap[flowName]);
    7159
    7260                namedFlows.sort(function (nf1, nf2) {
     
    8169        },
    8270
    83         function testGetNamedFlowCollectionWithInvalidDocument(next)
     71        function testGetNamedFlowCollection2(next)
    8472        {
    8573            WebInspector.domAgent.requestDocument(documentCallback);
     
    9583            }
    9684
    97             function namedFlowCallback(namedFlowMap)
     85            function namedFlowCallback(namedFlows)
    9886            {
    9987                InspectorTest.addResult("=== CSS Named Flows in #fake-document ===");
    10088
    101                 if (namedFlowMap) {
     89                if (namedFlows) {
    10290                    InspectorTest.addResult("[!] Failed");
    10391                    InspectorTest.completeTest();
     
    11098        },
    11199
    112         function testGetFlowByName(next)
     100        function testGetFlowByName1(next)
    113101        {
    114102            WebInspector.domAgent.requestDocument(documentCallback);
     
    135123        },
    136124
    137         function testGetFlowByNameWithInvalidName(next)
     125        function testGetFlowByName2(next)
    138126        {
    139127            WebInspector.domAgent.requestDocument(documentCallback);
     
    166154            function callback(event)
    167155            {
    168                 if (event.data.name !== "tmpNamedFlow")
    169                     return;
    170 
    171156                WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, callback, this);
    172157
     158                if (event.data.name !== "tmpNamedFlow") {
     159                    Inspector.addResult("[!] Failed");
     160                    InspectorTest.completeTest();
     161                    return;
     162                }
     163
    173164                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\"");
    191165                next();
    192166            }
     
    200174            function callback(event)
    201175            {
    202                 if (event.data.flowName !== "tmpNamedFlow")
    203                     return;
    204 
    205176                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                }
    206182
    207183                InspectorTest.addResult("NamedFlowRemoved: \"tmpNamedFlow\"");
     
    229205    <li>namedFlowCreated <a href="https://bugs.webkit.org/show_bug.cgi?id=92739">Bug 92739</a></li>
    230206    <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>
    232207</ul>
    233208</p>
     
    242217<div style="-webkit-flow-from: flow2"></div>
    243218
    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>
    248221
    249222<div id="fake-document"></div>
  • trunk/Source/WebCore/ChangeLog

    r127497 r127500  
     12012-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
    1412012-09-04  Simon Fraser  <simon.fraser@apple.com>
    242
  • trunk/Source/WebCore/dom/NamedFlowCollection.cpp

    r127468 r127500  
    8282    m_namedFlows.add(newFlow.get());
    8383
    84     InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow.get());
     84    InspectorInstrumentation::didCreateNamedFlow(m_document, newFlow->name());
    8585
    8686    return newFlow.release();
     
    9696    ASSERT(m_namedFlows.contains(namedFlow));
    9797
    98     InspectorInstrumentation::willRemoveNamedFlow(m_document, namedFlow);
     98    m_namedFlows.remove(namedFlow);
    9999
    100     m_namedFlows.remove(namedFlow);
     100    InspectorInstrumentation::didRemoveNamedFlow(m_document, namedFlow->name());
    101101}
    102102
  • trunk/Source/WebCore/inspector/Inspector.json

    r127468 r127500  
    24132413                "description": "Returns the Named Flows from the document.",
    24142414                "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
    24152427            }
    24162428        ],
     
    24302442                "name": "namedFlowCreated",
    24312443                "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." }
    24332446                ],
    24342447                "description": "Fires when a Named Flow is created.",
     
    24392452                "parameters": [
    24402453                    { "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." }
    24422455                ],
    24432456                "description": "Fires when a Named Flow is removed: has no associated content nodes and regions.",
    2444                 "hidden": true
    2445             },
    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.",
    24522457                "hidden": true
    24532458            }
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp

    r127468 r127500  
    538538}
    539539
    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));
     540void 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
     549void 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());
    567556}
    568557
     
    840829
    841830    m_namedFlowCollectionsRequested.add(documentNodeId);
    842 
    843831    Vector<RefPtr<WebKitNamedFlow> > namedFlowsVector = document->namedFlows()->namedFlows();
    844832    RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> > namedFlows = TypeBuilder::Array<TypeBuilder::CSS::NamedFlow>::create();
    845833
     834
    846835    for (Vector<RefPtr<WebKitNamedFlow> >::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it)
    847836        namedFlows->addItem(buildObjectForNamedFlow(errorString, it->get(), documentNodeId));
    848837
    849838    result = namedFlows.release();
     839}
     840
     841void 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);
    850855}
    851856
     
    927932    }
    928933    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;
    938934}
    939935
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.h

    r127468 r127500  
    100100    void reset();
    101101    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);
    105104
    106105    virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&);
     
    118117    virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr<InspectorArray>& forcedPseudoClasses);
    119118    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);
    120120
    121121    virtual void startSelectorProfiler(ErrorString*);
     
    146146    InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element);
    147147    Element* elementForId(ErrorString*, int nodeId);
    148     int documentNodeWithRequestedFlowsId(Document*);
    149148    void collectStyleSheets(CSSStyleSheet*, TypeBuilder::Array<WebCore::TypeBuilder::CSS::CSSStyleSheetHeader>*);
    150149
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r127468 r127500  
    232232}
    233233
    234 void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
     234void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name)
    235235{
    236236    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    237         cssAgent->didCreateNamedFlow(document, namedFlow);
    238 }
    239 
    240 void InspectorInstrumentation::willRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
     237        cssAgent->didCreateNamedFlow(document, name);
     238}
     239
     240void InspectorInstrumentation::didRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, const AtomicString& name)
    241241{
    242242    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);
    250244}
    251245
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r127468 r127500  
    114114    static void didPushShadowRoot(Element* host, ShadowRoot*);
    115115    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);
    119118
    120119    static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
     
    292291    static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
    293292    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);
    297295
    298296    static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
     
    564562}
    565563
    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);
     564inline 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
     573inline 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);
    590579#endif
    591580}
  • trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js

    r127468 r127500  
    4040    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this);
    4141    this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding(this);
    42     this._namedFlowCollections = {};
    43     WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._resetNamedFlowCollections, this);
    4442    InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));
    4543    CSSAgent.enable();
     
    6159    MediaQueryResultChanged: "MediaQueryResultChanged",
    6260    NamedFlowCreated: "NamedFlowCreated",
    63     NamedFlowRemoved: "NamedFlowRemoved",
    64     RegionLayoutUpdated: "RegionLayoutUpdated"
     61    NamedFlowRemoved: "NamedFlowRemoved"
    6562}
    6663
     
    176173    /**
    177174     * @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    {
    188179        /**
    189180         * @param {function(?Array.<WebInspector.NamedFlow>)} userCallback
     
    195186            if (error || !namedFlowPayload)
    196187                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));
    205193    },
    206194
     
    210198     * @param {function(?WebInspector.NamedFlow)} userCallback
    211199     */
    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    {
    220202        /**
    221203         * @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)
    227210                userCallback(null);
    228211            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));
    233216    },
    234217
     
    368351
    369352    /**
    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))
    378359            return;
    379360
    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));
    382374    },
    383375
    384376    /**
    385377     * @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))
    393383            return;
    394384
    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));
    412398    },
    413399
     
    476462    {
    477463        this._sourceMappings = {};
    478     },
    479 
    480     _resetNamedFlowCollections: function()
    481     {
    482         this._namedFlowCollections = {};
    483464    },
    484465
     
    13461327
    13471328    /**
    1348      * @param {CSSAgent.NamedFlow} namedFlowPayload
    1349      */
    1350     namedFlowCreated: function(namedFlowPayload)
    1351     {
    1352         this._cssModel._namedFlowCreated(namedFlowPayload);
    1353     },
    1354 
    1355     /**
    13561329     * @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);
    13701344    }
    13711345}
     
    13771351WebInspector.NamedFlow = function(payload)
    13781352{
    1379     this.documentNodeId = payload.documentNodeId;
     1353    this.nodeId = payload.documentNodeId;
    13801354    this.name = payload.name;
    13811355    this.overset = payload.overset;
     
    13941368
    13951369/**
    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 */
     1373WebInspector.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
    14391384/**
    14401385 * @type {WebInspector.CSSStyleModel}
  • trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp

    r127472 r127500  
    2828
    2929#include "FlowThreadController.h"
    30 #include "InspectorInstrumentation.h"
    3130#include "RenderRegion.h"
    3231#include "RenderView.h"
     
    359358{
    360359    RenderFlowThread::dispatchRegionLayoutUpdateEvent();
    361     InspectorInstrumentation::didUpdateRegionLayout(document(), m_namedFlow.get());
    362360
    363361    if (!m_regionLayoutUpdateEventTimer.isActive() && m_namedFlow->hasEventListeners())
Note: See TracChangeset for help on using the changeset viewer.