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)
Core
Layout: Text and Fonts
Tracking
()
RESOLVED
FIXED
mozilla48
| Tracking | Status | |
|---|---|---|
| firefox48 | --- | fixed |
People
(Reporter: chenpighead, Assigned: chenpighead)
Details
Attachments
(4 files, 3 obsolete files)
|
304 bytes,
text/html
|
Details | |
|
2.39 KB,
patch
|
jgraham
:
review+
|
Details | Diff | Splinter Review |
|
3.47 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
|
4.78 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
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)
| Assignee | ||
Comment 1•9 years ago
|
||
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 | ||
Updated•9 years ago
|
Assignee: nobody → jeremychen
Comment 2•9 years ago
|
||
That sounds like a different problem. You may want to check nsTextFrame::GetSelectionTextColors() and its callsites, which may relate to that.
Flags: needinfo?(quanxunzhen)
| Assignee | ||
Comment 3•9 years ago
|
||
(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.
| Assignee | ||
Comment 4•9 years ago
|
||
Comment 5•9 years ago
|
||
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.
| Assignee | ||
Updated•9 years ago
|
Attachment #8737501 -
Flags: review?(quanxunzhen)
Comment 6•9 years ago
|
||
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)
| Assignee | ||
Comment 7•9 years ago
|
||
Address xidorn's comments.
Attachment #8737510 -
Flags: review?(jfkthame)
| Assignee | ||
Updated•9 years ago
|
Attachment #8737501 -
Attachment is obsolete: true
| Assignee | ||
Comment 8•9 years ago
|
||
This is just for reviewer's convenience.
All part2 will be landed as a single commit after review process.
Attachment #8737512 -
Flags: review?(jfkthame)
| Assignee | ||
Comment 9•9 years ago
|
||
Attachment #8737513 -
Flags: review?(jfkthame)
| Assignee | ||
Updated•9 years ago
|
Attachment #8737512 -
Attachment description: part2.1: update manifest before adding test. r?jfkthame → part2.1: update manifest before adding test.
| Assignee | ||
Updated•9 years ago
|
Attachment #8737513 -
Attachment description: part2.2: add reftest. r?jfkthame → part2.2: add reftest.
| Assignee | ||
Updated•9 years ago
|
Status: NEW → ASSIGNED
Comment 10•9 years ago
|
||
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 11•9 years ago
|
||
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)
Updated•9 years ago
|
Attachment #8737513 -
Flags: review?(jfkthame) → review+
Comment 12•9 years ago
|
||
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+
Comment 13•9 years ago
|
||
(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.
Comment 14•9 years ago
|
||
True -- I guess I was imagining it as a heavier struct, but for a uint32, returning by value is simplest and safest.
| Assignee | ||
Comment 15•9 years ago
|
||
Add a helper method to get text color in nsStyleContext.h
Attachment #8737806 -
Flags: review?(jfkthame)
| Assignee | ||
Updated•9 years ago
|
Attachment #8737510 -
Attachment is obsolete: true
Attachment #8737510 -
Flags: review?(jfkthame)
Comment 16•9 years ago
|
||
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.
| Assignee | ||
Comment 17•9 years ago
|
||
Address reviewer's comment.
Attachment #8737827 -
Flags: review?(jfkthame)
| Assignee | ||
Updated•9 years ago
|
Attachment #8737806 -
Attachment is obsolete: true
Attachment #8737806 -
Flags: review?(jfkthame)
Updated•9 years ago
|
Attachment #8737827 -
Flags: review?(jfkthame) → review+
| Assignee | ||
Comment 18•9 years ago
|
||
jfkthame, thank you for the review. :)
Comment 19•9 years ago
|
||
Comment 20•9 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/066926557b77
https://hg.mozilla.org/mozilla-central/rev/8a00403cb58f
https://hg.mozilla.org/mozilla-central/rev/d7d928b340e5
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in
before you can comment on or make changes to this bug.
Description
•