Closed Bug 1445599 Opened 6 years ago Closed 6 years ago

GetTemporaryStyleForFocusedPositionedElement is broken.

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file, 2 obsolete files)

I was looking at removing editor calls to GetPropertyCSSValue when I realized that this one is actually unreachable since bug 1339394.

I was going to rewrite it to use nsStyleContext or what not, but we may as well remove it.
(In reply to Emilio Cobos Álvarez [:emilio] from comment #1)
> Created attachment 8958773 [details] [diff] [review]
> Remove HTMLEditor::GetTemporaryStyleForFocusedPositionedElement

The commit message should also say something like:

    The background color won't serialize to transparent since bug 1339394 (FF 54).
    
    Since nobody has complained about this regression, it seems unlikely this is a
    useful feature. I can rewrite it to not use GetPropertyCSSValue instead, but
    nixing it is easier.
Comment on attachment 8958773 [details] [diff] [review]
Remove HTMLEditor::GetTemporaryStyleForFocusedPositionedElement

Review of attachment 8958773 [details] [diff] [review]:
-----------------------------------------------------------------

::: editor/libeditor/HTMLAbsPositionEditor.cpp
@@ -618,5 @@
> -  rv =
> -    CSSEditUtils::GetComputedProperty(aElement, *nsGkAtoms::backgroundColor,
> -                                      bgColorStr);
> -  NS_ENSURE_SUCCESS(rv, rv);
> -  if (!bgColorStr.EqualsLiteral("transparent")) {

I still don't understand the reason why you're trying to remove the feature yet.

Do you mean that this is always true, so, this method never returns "black" and "white" anymore?
Right, transparent serializes as rgba(0, 0, 0, 0) since the bug mentioned in comment 2.
(In reply to Emilio Cobos Álvarez [:emilio] from comment #4)
> Right, transparent serializes as rgba(0, 0, 0, 0) since the bug mentioned in
> comment 2.

Well, then, shouldn't you just change the check from "transparent" to "rgba(0, 0, 0, 0)"? This is a code to support absolute positioned boxes. That must be really rare case to edit it since most HTML editors in the real world is just rich text editors. So, it's not safe to remove the feature itself by the reason "no bugs are reported".
Flags: needinfo?(emilio)
Sure, I can do that if needed. I wanted to get rid of GetPropertyCSSValue and this was effectively dead code. If you think it's worth resurrecting the feature I can rewrite it to use other APIs indeed.
Flags: needinfo?(emilio)
Attached patch With comments. (obsolete) — Splinter Review
Attachment #8958773 - Attachment is obsolete: true
Attachment #8958773 - Flags: review?(masayuki)
Attachment #8959106 - Flags: review?(masayuki)
Whoops, the other patch should belong to other bug. This one belongs to this bug.
Attachment #8959106 - Attachment is obsolete: true
Attachment #8959106 - Flags: review?(masayuki)
Attachment #8959108 - Flags: review?(masayuki)
Comment on attachment 8959108 [details] [diff] [review]
Unbreak HTMLEditor::GetTemporaryStyleForFocusedPositionedElement

>-  if (r >= BLACK_BG_RGB_TRIGGER &&
>-      g >= BLACK_BG_RGB_TRIGGER &&
>-      b >= BLACK_BG_RGB_TRIGGER) {
>+  if (NS_GET_R(color) >= kBlackBgTrigger ||
>+      NS_GET_G(color) >= kBlackBgTrigger ||
>+      NS_GET_B(color) >= kBlackBgTrigger) {
>     aReturn.AssignLiteral("black");
>   } else {

Looks like you changed && to ||. It seems that it's not your intention. If so, please fix them before landing.  Otherwise, looks good.
Attachment #8959108 - Flags: review?(masayuki) → review+
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b96b1d081cdf
Unbreak HTMLEditor::GetTemporaryStyleForFocusedPositionedElement, and make it stop using GetPropertyCSSValue. r=masayuki
https://hg.mozilla.org/mozilla-central/rev/b96b1d081cdf
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: