Closed Bug 1261568 Opened 9 years ago Closed 9 years ago

-webkit-text-fill-color is not working if setting color to be transparent

Categories

(Core :: Layout: Text and Fonts, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: chenpighead, Assigned: chenpighead)

Details

Attachments

(4 files, 3 obsolete files)

Attached file testcase 1
Looks like Bug 1216001 causing this. STR: Open a web page w/ text's style as follows: { color: transparent; -webkit-text-fill-color: black;} Expect: Texts are showed w/ black color Actual: Texts are not showed (transparent color)
I also found that texts under selection would be showed w/ color instead of -webkit-text-fill-color. xidorn, do you think this is the same problem in this bug? Or should I file another one?
Flags: needinfo?(quanxunzhen)
Assignee: nobody → jeremychen
That sounds like a different problem. You may want to check nsTextFrame::GetSelectionTextColors() and its callsites, which may relate to that.
Flags: needinfo?(quanxunzhen)
(In reply to Xidorn Quan [:xidorn] (UTC+10) from comment #2) > That sounds like a different problem. You may want to check > nsTextFrame::GetSelectionTextColors() and its callsites, which may relate to > that. Thanks. File Bug 1261578 for that.
Comment on attachment 8737501 [details] [diff] [review] part1: take -webkit-text-fill-color into consideration while building displaylist for text frame. Review of attachment 8737501 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsTextFrame.cpp @@ +4828,3 @@ > Maybe<bool> isSelected; > if (((GetStateBits() & TEXT_NO_RENDERED_GLYPHS) || > + (isTextTransparent && !StyleText()->HasTextShadow())) && There are two StyleText() here. You may want to use a variable to store it rather than calling it twice.
Attachment #8737501 - Flags: review?(quanxunzhen)
Comment on attachment 8737501 [details] [diff] [review] part1: take -webkit-text-fill-color into consideration while building displaylist for text frame. Review of attachment 8737501 [details] [diff] [review]: ----------------------------------------------------------------- Discussed with Jeremy in IRC.
Attachment #8737501 - Flags: review?(quanxunzhen)
Attachment #8737501 - Attachment is obsolete: true
This is just for reviewer's convenience. All part2 will be landed as a single commit after review process.
Attachment #8737512 - Flags: review?(jfkthame)
Attachment #8737513 - Flags: review?(jfkthame)
Attachment #8737512 - Attachment description: part2.1: update manifest before adding test. r?jfkthame → part2.1: update manifest before adding test.
Attachment #8737513 - Attachment description: part2.2: add reftest. r?jfkthame → part2.2: add reftest.
Status: NEW → ASSIGNED
Comment on attachment 8737510 [details] [diff] [review] part1: take -webkit-text-fill-color into consideration while building displaylist for text frame. (v2) Review of attachment 8737510 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsTextFrame.cpp @@ +4825,5 @@ > > + const nsStyleText* textStyle = StyleText(); > + bool isTextTransparent = NS_GET_A(textStyle->mWebkitTextFillColorForeground > + ? StyleColor()->mColor > + : textStyle->mWebkitTextFillColor) == 0; How about adding a helper method to nsStyleContext.h, something like this: /** * Get a reference to the color that should be used to fill text: either * the current foreground color, or a separately-specified text fill color. */ const nscolor& GetTextFillColor() { const nsStyleText* textStyle = StyleText(); return textStyle->mWebkitTextFillColorForeground ? StyleColor()->mColor : textStyle->mWebkitTextFillColor; } Then the code here would simplify to: bool isTextTransparent = NS_GET_A(StyleContext()->GetTextFillColor()) == 0; There must be other places we'd want the same thing, no? Looks like at least nsComputedDOMStyle::DoGetWebkitTextFillColor and StyleAnimationValue::ExtractComputedValue have versions of the same conditional expression already.
Comment on attachment 8737512 [details] [diff] [review] part2.1: update manifest before adding test. I'd assume this is fine, but I don't actually know anything about this test runner & manifests. I wonder why they're currently out of order? Accident? jgraham, I think you know about these things, yes? Is the ordering at all important here?
Attachment #8737512 - Flags: review?(jfkthame) → review?(james)
Attachment #8737513 - Flags: review?(jfkthame) → review+
Comment on attachment 8737512 [details] [diff] [review] part2.1: update manifest before adding test. Review of attachment 8737512 [details] [diff] [review]: ----------------------------------------------------------------- The order is not important at all, but the autogeneration script keeps things in alphabetical order to minimise diffs. However, it seems that sometimes patches get checked in that have edited this file by hand and do not preserve order. Filed bug 1261788 on that.
Attachment #8737512 - Flags: review?(james) → review+
(In reply to Jonathan Kew (:jfkthame) from comment #10) > Comment on attachment 8737510 [details] [diff] [review] > part1: take -webkit-text-fill-color into consideration while building > displaylist for text frame. (v2) > > Review of attachment 8737510 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: layout/generic/nsTextFrame.cpp > @@ +4825,5 @@ > > > > + const nsStyleText* textStyle = StyleText(); > > + bool isTextTransparent = NS_GET_A(textStyle->mWebkitTextFillColorForeground > > + ? StyleColor()->mColor > > + : textStyle->mWebkitTextFillColor) == 0; > > How about adding a helper method to nsStyleContext.h, something like this: > > /** > * Get a reference to the color that should be used to fill text: either > * the current foreground color, or a separately-specified text fill color. > */ > const nscolor& GetTextFillColor() { > const nsStyleText* textStyle = StyleText(); > return textStyle->mWebkitTextFillColorForeground > ? StyleColor()->mColor : textStyle->mWebkitTextFillColor; > } It doesn't seem to make much sense here to return a const reference. nscolor is currently just an uint32_t, which is cheap to be passed by value.
True -- I guess I was imagining it as a heavier struct, but for a uint32, returning by value is simplest and safest.
Add a helper method to get text color in nsStyleContext.h
Attachment #8737806 - Flags: review?(jfkthame)
Attachment #8737510 - Attachment is obsolete: true
Attachment #8737510 - Flags: review?(jfkthame)
Comment on attachment 8737806 [details] [diff] [review] part1: take -webkit-text-fill-color into consideration while building displaylist for text frame. (v3) Review of attachment 8737806 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsTextFrame.cpp @@ +3599,5 @@ > return NS_RGBA(0, 0, 0, 255); > } > } > > + return mFrame->StyleContext()->GetTextFillColor(); This isn't equivalent to the existing code: nsLayoutUtils::GetColor does more than simply reading the field from the style struct.
Attachment #8737806 - Attachment is obsolete: true
Attachment #8737806 - Flags: review?(jfkthame)
Attachment #8737827 - Flags: review?(jfkthame) → review+
jfkthame, thank you for the review. :)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: