Closed
Bug 1249230
Opened 9 years ago
Closed 9 years ago
Fix the returned string of CSSPseudoElement::GetType()
Categories
(Core :: DOM: Animation, defect)
Core
DOM: Animation
Tracking
()
RESOLVED
FIXED
mozilla47
Tracking | Status | |
---|---|---|
firefox47 | --- | fixed |
People
(Reporter: boris, Assigned: boris)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
boris
:
review+
|
Details | Diff | Splinter Review |
According to Bug 1234403 Comment 14, the returned string of pseudoType is not correct. It should be "::after" or "::before", instead of ":after" or ":before". We have to prepend an extra ':' to the pseudoType returned from nsCSSPseudoElements::GetPseudoAtom().
Assignee | ||
Updated•9 years ago
|
Summary: Fix CSSPseudoElement::mPseudoType return string → Fix the returned string of CSSPseudoElement::GetType()
Assignee | ||
Comment 1•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8720725 -
Flags: review?(bbirtles)
Assignee | ||
Comment 2•9 years ago
|
||
Assignee | ||
Comment 3•9 years ago
|
||
Comment on attachment 8720725 [details] [diff] [review]
Prepend an extra colon to the pseudo type string
Review of attachment 8720725 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/animation/CSSPseudoElement.h
@@ +44,5 @@
> "All pseudo-types allowed by this class should have a"
> " corresponding atom");
> + aRetVal.Assign(char16_t(':'));
> + aRetVal.Append(
> + nsCSSPseudoElements::GetPseudoAtom(mPseudoType)->GetUTF16String());
I will add a comment for this part after the review:
// Our atoms use one colon and we would like to return two colons syntax for
// the returned pseudo type string, so serialize this to the non-deprecated
// two colon syntax.
Comment 4•9 years ago
|
||
Comment on attachment 8720725 [details] [diff] [review]
Prepend an extra colon to the pseudo type string
Review of attachment 8720725 [details] [diff] [review]:
-----------------------------------------------------------------
r=birtles with comments addressed.
::: dom/animation/CSSPseudoElement.h
@@ +44,5 @@
> "All pseudo-types allowed by this class should have a"
> " corresponding atom");
> + aRetVal.Assign(char16_t(':'));
> + aRetVal.Append(
> + nsCSSPseudoElements::GetPseudoAtom(mPseudoType)->GetUTF16String());
This is a bit expensive. GetUTF16String() returns a char16ptr_t.[1] Then we pass that to Append without specifying a length.[2] As a result we end up in Replace with aLength == -1 [3] so we'll call nsCharTraits<char16_t>::length(aData)[4] which will make us iterate through the whole string to get its length even though the atom already knows its length.
At very least we could call:
nsIAtom* pseudoAtom = nsCSSPseudoElement::GetPseudoAtom(mPseudoType);
aRetVal.Append(pseudoAtom->GetUTF16String(), pseudoAtom()->GetLength());
Better still, we should do:
aRetVal.Append(
nsDependentAtomString(nsCSSPseudoElements::GetPseudoAtom(mPseudoType)));
[1] https://dxr.mozilla.org/mozilla-central/rev/0629918a09ae87808efdda432d7852371ba37db6/xpcom/ds/nsIAtom.idl#47
[2] https://dxr.mozilla.org/mozilla-central/rev/0629918a09ae87808efdda432d7852371ba37db6/xpcom/string/nsTSubstring.h#535
[3] https://dxr.mozilla.org/mozilla-central/rev/0629918a09ae87808efdda432d7852371ba37db6/xpcom/string/nsTSubstring.cpp#535
[4] https://dxr.mozilla.org/mozilla-central/rev/0629918a09ae87808efdda432d7852371ba37db6/xpcom/string/nsCharTraits.h#292
Attachment #8720725 -
Flags: review?(bbirtles) → review+
Assignee | ||
Comment 5•9 years ago
|
||
(In reply to Brian Birtles (:birtles) from comment #4)
> Better still, we should do:
>
> aRetVal.Append(
> nsDependentAtomString(nsCSSPseudoElements::GetPseudoAtom(mPseudoType)));
>
Thanks for explaining the performance problem. Using nsDependentAtomString() is more concise.
Assignee | ||
Comment 6•9 years ago
|
||
Attachment #8721139 -
Flags: review+
Assignee | ||
Updated•9 years ago
|
Attachment #8720725 -
Attachment is obsolete: true
Assignee | ||
Comment 7•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Keywords: checkin-needed
Comment 9•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in
before you can comment on or make changes to this bug.
Description
•