Add color keywords for default text and background colors

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
9 years ago
8 years ago

People

(Reporter: florian, Assigned: florian)

Tracking

({dev-doc-complete})

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Assignee

Description

9 years ago
Posted patch Patch v1 (obsolete) — Splinter Review
There are 4 colors that can be set from the preferences dialog (Text, Background, Unvisited Links and Visited Links) but only 2 of them have CSS keywords to use them: -moz-hyperlinktext and -moz-visitedhyperlinktext.

The attached patch adds -moz-color and -moz-background-color keywords for the default user-set value of the color and background-color properties.

Example of use case:
In Instantbird conversations, the -moz-background-color keyword is used to create a gradient between the user-set background color and the background color of a <textbox>.
We have tried using the "transparent" keyword instead, but it didn't work as it's just an alias for the rgba(0, 0, 0, 0) value and there was a gray area in the middle of the gradient.
In some specific cases, the -moz-initial keyword can be used to get the default color, but it didn't work inside a gradient.

I added the -moz-color keyword too for consistency, even though I only have an immediate use for -moz-background-color.

I would really appreciate if this could be fixed (either with this patch, or with a simpler solution using existing CSS syntax if anybody can suggest one) because it's one of the only 2 issues that currently make Instantbird need a patched Mozilla engine.
Attachment #469864 - Flags: review?(dbaron)
(In reply to comment #0)
> We have tried using the "transparent" keyword instead, but it didn't work as
> it's just an alias for the rgba(0, 0, 0, 0) value and there was a gray area in
> the middle of the gradient.

I filed bug 591600 on this problem.

> In some specific cases, the -moz-initial keyword can be used to get the default
> color, but it didn't work inside a gradient.

No, it only works as the entire value of a property, as intended.

> I added the -moz-color keyword too for consistency, even though I only have an
> immediate use for -moz-background-color.

The idea sounds fine, but I need to think about the names a bit more.
Comment on attachment 469864 [details] [diff] [review]
Patch v1

Could you rename these to -moz-default-color and -moz-default-background-color, change the constants to match (add _DEFAULT), reorder the constants in nsStyleConsts.h to list CURRENTCOLOR as -1, MOZ_DEFAULT_COLOR as -2, MOZ_DEFAULT_BACKGROUND_COLOR as -3, and then the three anchor colors as -4 to -6, and align the order in nsRuleNode.cpp to match that ?

r=dbaron with that
Attachment #469864 - Flags: review?(dbaron) → review+
Assignee

Comment 3

9 years ago
Posted patch Patch v2Splinter Review
Updated patch based on comment 2;  carrying forward the review flag.

Thanks for the early feedback, the quick review and for investigating the problem of the transparent keyword in bug 591600!

I'm requesting approval2.0 because I believe the risk of regression caused by this patch is very low (API addition only), and as I explained at the end of comment 0, it would be helpful for the Instantbird project if this could be fixed soon.
Assignee: nobody → florian
Attachment #469864 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #470597 - Flags: review+
Attachment #470597 - Flags: approval2.0?

Comment 4

9 years ago
Too late for FF4, we're cutting back on optional bits so we can actually ship and avoid regressions.
Attachment #470597 - Flags: approval2.0? → approval2.0-
Depends on: post2.0
This deosn't apply cleanly any more.
Keywords: checkin-needed
Whiteboard: not-ready
Blocks: 558585
http://hg.mozilla.org/projects/cedar/rev/e83560952624
Whiteboard: not-ready → fixed-in-cedar
http://hg.mozilla.org/mozilla-central/rev/e83560952624
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
No longer depends on: post2.0
Resolution: --- → FIXED
Whiteboard: fixed-in-cedar

Updated

8 years ago
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.