Bug 111551 - Web Inspector: identify layers for CSS generated content in LayerTreeAgent
Summary: Web Inspector: identify layers for CSS generated content in LayerTreeAgent
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-03-06 02:54 PST by Antoine Quint
Modified: 2013-03-07 02:41 PST (History)
14 users (show)

See Also:


Attachments
Patch (22.93 KB, patch)
2013-03-06 03:14 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (24.07 KB, patch)
2013-03-07 01:58 PST, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2013-03-06 02:54:39 PST
Some layers are created for pseudo elements, content created by CSS via the ::before or ::after pseudo-classes. Since these layers' renderer are not directly associated to a Node in the DOM tree, we'll probably want to identify as such in the UI, we should clearly identify such layers as generated content.
Comment 1 Radar WebKit Bug Importer 2013-03-06 02:55:05 PST
<rdar://problem/13356715>
Comment 2 Antoine Quint 2013-03-06 03:14:47 PST
Created attachment 191703 [details]
Patch
Comment 3 Simon Fraser (smfr) 2013-03-06 14:30:45 PST
Comment on attachment 191703 [details]
Patch

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

> Source/WebCore/inspector/InspectorLayerTreeAgent.cpp:250
> +        return "";

It's better to use emptyString().

> Source/WebCore/inspector/InspectorLayerTreeAgent.cpp:268
> +    String identifier = m_pseudoElementToIdMap.get(pseudoElement);
> +    if (identifier.isNull())
> +        return;
> +
> +    m_pseudoElementToIdMap.remove(pseudoElement);
> +    m_idToPseudoElement.remove(identifier);

get() and remove() both do hash lookups. It would be better to find(), compare with != .end() to know if you found anything, then use remove(iterator);
Comment 4 Antoine Quint 2013-03-07 01:58:59 PST
Created attachment 191952 [details]
Patch for landing
Comment 5 Antoine Quint 2013-03-07 01:59:55 PST
(In reply to comment #3)
> (From update of attachment 191703 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=191703&action=review
> 
> > Source/WebCore/inspector/InspectorLayerTreeAgent.cpp:250
> > +        return "";
> 
> It's better to use emptyString().

Will fix in landing patch.

> > Source/WebCore/inspector/InspectorLayerTreeAgent.cpp:268
> > +    String identifier = m_pseudoElementToIdMap.get(pseudoElement);
> > +    if (identifier.isNull())
> > +        return;
> > +
> > +    m_pseudoElementToIdMap.remove(pseudoElement);
> > +    m_idToPseudoElement.remove(identifier);
> 
> get() and remove() both do hash lookups. It would be better to find(), compare with != .end() to know if you found anything, then use remove(iterator);

Good point. I rewrote the method as follows for landing:

void InspectorLayerTreeAgent::unbindPseudoElement(PseudoElement* pseudoElement)
{
    HashMap<PseudoElement*, String>::iterator iterator = m_pseudoElementToIdMap.find(pseudoElement);
    if (iterator == m_pseudoElementToIdMap.end())
        return;
    m_idToPseudoElement.remove(iterator->value);
    m_pseudoElementToIdMap.remove(iterator);
}
Comment 6 WebKit Review Bot 2013-03-07 02:41:23 PST
Comment on attachment 191952 [details]
Patch for landing

Clearing flags on attachment: 191952

Committed r145057: <http://trac.webkit.org/changeset/145057>
Comment 7 WebKit Review Bot 2013-03-07 02:41:27 PST
All reviewed patches have been landed.  Closing bug.