Closed Bug 591341 Opened 14 years ago Closed 13 years ago
Add color keywords for default text and background colors
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+
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.
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-
This deosn't apply cleanly any more.
Whiteboard: not-ready → fixed-in-cedar
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
No longer depends on: post2.0
Resolution: --- → FIXED
"-moz-default-color" and "-moz-default-background-color" added here: https://developer.mozilla.org/en/CSS/color_value https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions
You need to log in before you can comment on or make changes to this bug.