Commit d30f3b82 authored by George Steel's avatar George Steel Committed by Commit Bot

Update pseudo-element tag names to follow standard (::before etc).

Currently this only effects devTools logs.
This change is intended to be used by an upcoming patch to the animations
code, where KeyframeEffect will use PseudoElementTagName.

Bug: 981894
Change-Id: Iddde38c575a1769bf00f53c82a056bf1a029c6d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1928307Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Commit-Queue: George Steel <gtsteel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720274}
parent 61c0298e
......@@ -45,6 +45,8 @@ namespace blink {
PseudoElement* PseudoElement::Create(Element* parent, PseudoId pseudo_id) {
if (pseudo_id == kPseudoIdFirstLetter)
return MakeGarbageCollected<FirstLetterPseudoElement>(parent);
DCHECK(pseudo_id == kPseudoIdAfter || pseudo_id == kPseudoIdBefore ||
pseudo_id == kPseudoIdBackdrop || pseudo_id == kPseudoIdMarker);
return MakeGarbageCollected<PseudoElement>(parent, pseudo_id);
}
......@@ -52,51 +54,43 @@ const QualifiedName& PseudoElementTagName(PseudoId pseudo_id) {
switch (pseudo_id) {
case kPseudoIdAfter: {
DEFINE_STATIC_LOCAL(QualifiedName, after,
(g_null_atom, "<pseudo:after>", g_null_atom));
(g_null_atom, "::after", g_null_atom));
return after;
}
case kPseudoIdBefore: {
DEFINE_STATIC_LOCAL(QualifiedName, before,
(g_null_atom, "<pseudo:before>", g_null_atom));
(g_null_atom, "::before", g_null_atom));
return before;
}
case kPseudoIdBackdrop: {
DEFINE_STATIC_LOCAL(QualifiedName, backdrop,
(g_null_atom, "<pseudo:backdrop>", g_null_atom));
(g_null_atom, "::backdrop", g_null_atom));
return backdrop;
}
case kPseudoIdFirstLetter: {
DEFINE_STATIC_LOCAL(QualifiedName, first_letter,
(g_null_atom, "<pseudo:first-letter>", g_null_atom));
(g_null_atom, "::first-letter", g_null_atom));
return first_letter;
}
case kPseudoIdMarker: {
DEFINE_STATIC_LOCAL(QualifiedName, marker,
(g_null_atom, "<pseudo:marker>", g_null_atom));
(g_null_atom, "::marker", g_null_atom));
return marker;
}
default:
NOTREACHED();
}
DEFINE_STATIC_LOCAL(QualifiedName, name,
(g_null_atom, "<pseudo>", g_null_atom));
(g_null_atom, "::unknown", g_null_atom));
return name;
}
String PseudoElement::PseudoElementNameForEvents(PseudoId pseudo_id) {
DEFINE_STATIC_LOCAL(const String, after, ("::after"));
DEFINE_STATIC_LOCAL(const String, before, ("::before"));
DEFINE_STATIC_LOCAL(const String, marker, ("::marker"));
switch (pseudo_id) {
case kPseudoIdAfter:
return after;
case kPseudoIdBefore:
return before;
case kPseudoIdMarker:
return marker;
default:
return g_empty_string;
}
const AtomicString& PseudoElement::PseudoElementNameForEvents(
PseudoId pseudo_id) {
if (pseudo_id == kPseudoIdNone)
return g_null_atom;
else
return PseudoElementTagName(pseudo_id).LocalName();
}
PseudoElement::PseudoElement(Element* parent, PseudoId pseudo_id)
......
......@@ -51,7 +51,7 @@ class CORE_EXPORT PseudoElement : public Element {
scoped_refptr<ComputedStyle> LayoutStyleForDisplayContents(
const ComputedStyle&);
static String PseudoElementNameForEvents(PseudoId);
static const AtomicString& PseudoElementNameForEvents(PseudoId);
// Pseudo element are not allowed to be the inner node for hit testing. Find
// the closest ancestor which is a real dom node.
......@@ -75,7 +75,7 @@ class CORE_EXPORT PseudoElement : public Element {
PseudoId pseudo_id_;
};
const QualifiedName& PseudoElementTagName();
const QualifiedName& PseudoElementTagName(PseudoId);
bool PseudoElementLayoutObjectIsNeeded(const ComputedStyle*);
......
......@@ -662,7 +662,7 @@ Tests DOMSnapshot.getSnapshot exports layout tree nodes associated with pseudo e
[17] : P
[18] : class
[19] : c1
[20] : <pseudo:first-letter>
[20] : ::first-letter
[21] : 100
[22] : rgb(0, 128, 0)
[23] : I
......@@ -676,7 +676,7 @@ Tests DOMSnapshot.getSnapshot exports layout tree nodes associated with pseudo e
[31] : 700
[32] : rgb(0, 0, 255)
[33] : s
[34] : <pseudo:before>
[34] : ::before
[35] : quare:
[36] : 1
[37] : !
......
......@@ -123,7 +123,7 @@ Tests DOMSnapshot.getSnapshot exports layout tree nodes associated with pseudo e
},
{
"nodeType": 1,
"nodeName": "<pseudo:first-letter>",
"nodeName": "::first-letter",
"nodeValue": "",
"backendNodeId": "<number>",
"layoutNodeIndex": 5,
......@@ -163,7 +163,7 @@ Tests DOMSnapshot.getSnapshot exports layout tree nodes associated with pseudo e
},
{
"nodeType": 1,
"nodeName": "<pseudo:first-letter>",
"nodeName": "::first-letter",
"nodeValue": "",
"backendNodeId": "<number>",
"layoutNodeIndex": 9,
......@@ -214,7 +214,7 @@ Tests DOMSnapshot.getSnapshot exports layout tree nodes associated with pseudo e
},
{
"nodeType": 1,
"nodeName": "<pseudo:first-letter>",
"nodeName": "::first-letter",
"nodeValue": "",
"backendNodeId": "<number>",
"layoutNodeIndex": 14,
......@@ -222,7 +222,7 @@ Tests DOMSnapshot.getSnapshot exports layout tree nodes associated with pseudo e
},
{
"nodeType": 1,
"nodeName": "<pseudo:before>",
"nodeName": "::before",
"nodeValue": "",
"backendNodeId": "<number>",
"layoutNodeIndex": 19,
......
......@@ -7,7 +7,7 @@
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "NGPhysicalBoxFragment LayoutNGBlockFlow (positioned) \u003Cpseudo:after\u003E",
"object": "NGPhysicalBoxFragment LayoutNGBlockFlow (positioned) ::after",
"rect": [138, 8, 100, 100],
"reason": "style change"
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment