Bug 117833 - Web Inspector: Integrate new regionOversetChange event into inspector
Summary: Web Inspector: Integrate new regionOversetChange event into inspector
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Radu Stavila
URL:
Keywords: InRadar
Depends on:
Blocks: 117508
  Show dependency treegraph
 
Reported: 2013-06-20 06:50 PDT by Radu Stavila
Modified: 2022-03-01 02:59 PST (History)
9 users (show)

See Also:


Attachments
Patch (21.05 KB, patch)
2013-06-20 09:54 PDT, Radu Stavila
joepeck: review+
Details | Formatted Diff | Diff
Patch (20.49 KB, patch)
2013-06-21 07:00 PDT, Radu Stavila
abucur: commit-queue+
Details | Formatted Diff | Diff
Patch (implemented changes requested by JoePeck) (20.49 KB, patch)
2013-06-21 07:08 PDT, Radu Stavila
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Radu Stavila 2013-06-20 06:50:43 PDT
Integrate new regionOversetChange event into inspector
Comment 1 Radar WebKit Bug Importer 2013-06-20 06:51:07 PDT
<rdar://problem/14215914>
Comment 2 Radu Stavila 2013-06-20 09:54:31 PDT
Created attachment 205100 [details]
Patch
Comment 3 Joseph Pecoraro 2013-06-20 18:16:26 PDT
Comment on attachment 205100 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=205100&action=review

Change looks good to me, but could you explain the extra complexity in ChangeRegionOversetTask? That matches existing behavior, but seems unnecessary.

> Source/WebCore/inspector/InspectorCSSAgent.cpp:310
> +: m_cssAgent(cssAgent)
> +, m_timer(this, &ChangeRegionOversetTask::onTimer)

Style: These lines should be indented.

> Source/WebCore/inspector/InspectorCSSAgent.cpp:352
> +    Vector<std::pair<WebKitNamedFlow*, int> > namedFlows;
> +    
> +    for (HashMap<WebKitNamedFlow*, int>::iterator it = m_namedFlows.begin(), end = m_namedFlows.end(); it != end; ++it)
> +        namedFlows.append(std::make_pair(it->key, it->value));
> +    
> +    for (unsigned i = 0, size = namedFlows.size(); i < size; ++i) {
> +        WebKitNamedFlow* namedFlow = namedFlows.at(i).first;
> +        int documentNodeId = namedFlows.at(i).second;
> +        
> +        if (m_namedFlows.contains(namedFlow)) {
> +            m_cssAgent->regionOversetChanged(namedFlow, documentNodeId);
> +            m_namedFlows.remove(namedFlow);
> +        }
> +    }
> +    
> +    if (!m_namedFlows.isEmpty() && !m_timer.isActive())
> +        m_timer.startOneShot(0);

Why the extra copy to a vector first? Under what circumstances would m_namedFlow be non-empty at the end?

Could this be simplified to just the following, or is there something I'm missing:

    for (HashMap<WebKitNamedFlow*, int>::iterator it = m_namedFlows.begin(), end = m_namedFlows.end(); it != end; ++it)
        m_cssAgent->regionOversetChanged(it->key, it->value);
    m_namedFlows.clear();

I see you are copying the style of UpdateRegionLayoutTest, but I'd have the same question for that.
Comment 4 Radu Stavila 2013-06-21 07:00:26 PDT
Created attachment 205181 [details]
Patch
Comment 5 Radu Stavila 2013-06-21 07:08:11 PDT
Created attachment 205182 [details]
Patch (implemented changes requested by JoePeck)
Comment 6 WebKit Commit Bot 2013-06-21 07:31:52 PDT
Comment on attachment 205182 [details]
Patch (implemented changes requested by JoePeck)

Clearing flags on attachment: 205182

Committed r151835: <http://trac.webkit.org/changeset/151835>