Changeset 127867 in webkit


Ignore:
Timestamp:
Sep 7, 2012 7:00:11 AM (12 years ago)
Author:
apavlov@chromium.org
Message:

Unreviewed, rolling out r127780 and r127859.
http://trac.webkit.org/changeset/127780
http://trac.webkit.org/changeset/127859
https://bugs.webkit.org/show_bug.cgi?id=96102

"inspector/styles/protocol-css-regions-commands.html crashing
on Chromium Linux Debug and timing out flakily on Release"
(Requested by apavlov on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-09-07

Source/WebCore:

  • dom/NamedFlowCollection.cpp:

(WebCore::NamedFlowCollection::ensureFlowWithName):
(WebCore::NamedFlowCollection::discardNamedFlow):

  • inspector/Inspector.json:
  • inspector/InspectorCSSAgent.cpp:

(WebCore::InspectorCSSAgent::reset):
(WebCore::InspectorCSSAgent::didCreateNamedFlow):
(WebCore::InspectorCSSAgent::didRemoveNamedFlow):
(WebCore::InspectorCSSAgent::getNamedFlowCollection):
(WebCore::InspectorCSSAgent::getFlowByName):
(WebCore):

  • inspector/InspectorCSSAgent.h:

(WebCore):
(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

    r127866 r127867  
     12012-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
    1152012-09-07  Zan Dobersek  <zandobersek@gmail.com>
    216
  • trunk/LayoutTests/inspector/styles/protocol-css-regions-commands-expected.txt

    r127780 r127867  
    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

    r127780 r127867  
    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

    r127865 r127867  
     12012-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
    1492012-09-07  Sami Kyostila  <skyostil@google.com>
    250
  • trunk/Source/WebCore/dom/NamedFlowCollection.cpp

    r127780 r127867  
    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

    r127861 r127867  
    23402340                "description": "Returns the Named Flows from the document.",
    23412341                "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
    23422354            }
    23432355        ],
     
    23572369                "name": "namedFlowCreated",
    23582370                "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." }
    23602373                ],
    23612374                "description": "Fires when a Named Flow is created.",
     
    23662379                "parameters": [
    23672380                    { "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." }
    23692382                ],
    23702383                "description": "Fires when a Named Flow is removed: has no associated content nodes and regions.",
    2371                 "hidden": true
    2372             },
    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.",
    23792384                "hidden": true
    23802385            }
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp

    r127780 r127867  
    227227}
    228228
    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 
    265229class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action {
    266230    WTF_MAKE_NONCOPYABLE(StyleSheetAction);
     
    555519    m_documentToInspectorStyleSheet.clear();
    556520    m_namedFlowCollectionsRequested.clear();
    557     if (m_updateRegionLayoutTask)
    558         m_updateRegionLayoutTask->reset();
    559521    resetPseudoStates();
    560522}
     
    576538}
    577539
    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));
     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());
    615556}
    616557
     
    888829
    889830    m_namedFlowCollectionsRequested.add(documentNodeId);
    890 
    891831    Vector<RefPtr<WebKitNamedFlow> > namedFlowsVector = document->namedFlows()->namedFlows();
    892832    RefPtr<TypeBuilder::Array<TypeBuilder::CSS::NamedFlow> > namedFlows = TypeBuilder::Array<TypeBuilder::CSS::NamedFlow>::create();
    893833
     834
    894835    for (Vector<RefPtr<WebKitNamedFlow> >::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it)
    895836        namedFlows->addItem(buildObjectForNamedFlow(errorString, it->get(), documentNodeId));
    896837
    897838    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);
    898855}
    899856
     
    975932    }
    976933    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;
    986934}
    987935
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.h

    r127780 r127867  
    5656class SelectorProfile;
    5757class StyleResolver;
    58 class UpdateRegionLayoutTask;
    5958
    6059#if ENABLE(INSPECTOR)
     
    101100    void reset();
    102101    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);
    107104
    108105    virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&);
     
    120117    virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr<InspectorArray>& forcedPseudoClasses);
    121118    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);
    122120
    123121    virtual void startSelectorProfiler(ErrorString*);
     
    148146    InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element);
    149147    Element* elementForId(ErrorString*, int nodeId);
    150     int documentNodeWithRequestedFlowsId(Document*);
    151148    void collectStyleSheets(CSSStyleSheet*, TypeBuilder::Array<WebCore::TypeBuilder::CSS::CSSStyleSheetHeader>*);
    152149
     
    180177    NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState;
    181178    HashSet<int> m_namedFlowCollectionsRequested;
    182     OwnPtr<UpdateRegionLayoutTask> m_updateRegionLayoutTask;
    183179
    184180    int m_lastStyleSheetId;
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r127780 r127867  
    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

    r127780 r127867  
    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

    r127859 r127867  
    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
     
    175172
    176173    /**
    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
    190181         * @param {?Protocol.Error} error
    191182         * @param {?Array.<CSSAgent.NamedFlow>=} namedFlowPayload
     
    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));
    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
    209197     * @param {string} flowName
    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 {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)
    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     /** @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 */
     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
    14401384/**
    14411385 * @type {WebInspector.CSSStyleModel}
  • trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp

    r127780 r127867  
    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.