RESOLVED INVALID 27841
Fix box shadow painting: should pass shadow's color
https://bugs.webkit.org/show_bug.cgi?id=27841
Summary Fix box shadow painting: should pass shadow's color
Crystal Zhang
Reported 2009-07-30 09:59:40 PDT
In WebCore::RenderBoxModelObject::paintBoxShadow, should pass shadow's color when painting, not color::black.
Attachments
patch to fix box shadow painting (1.81 KB, patch)
2009-07-30 10:00 PDT, Crystal Zhang
mitz: review-
Crystal Zhang
Comment 1 2009-07-30 10:00:34 PDT
Created attachment 33791 [details] patch to fix box shadow painting
George Staikos
Comment 2 2009-07-30 10:37:33 PDT
You can remove the "Written by" part of the changelog and you should use your @torchmobile.com address probably.
mitz
Comment 3 2009-07-30 10:58:57 PDT
Comment on attachment 33791 [details] patch to fix box shadow painting I think this is wrong. What is the issue this is supposed to address?
Crystal Zhang
Comment 4 2009-07-30 11:45:17 PDT
(In reply to comment #3) > (From update of attachment 33791 [details]) > I think this is wrong. What is the issue this is supposed to address? It always uses Color::black to paint box shadow regardless shadow style, which is wrong.
mitz
Comment 5 2009-07-30 12:06:37 PDT
(In reply to comment #4) > (In reply to comment #3) > > (From update of attachment 33791 [details] [details]) > > I think this is wrong. What is the issue this is supposed to address? > > It always uses Color::black to paint box shadow regardless shadow style, which > is wrong. The code uses a black fill for the shape casting the shadow. The shadow properties, including its color, are based on the ShadowData structure from the style: for (ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next) { […] Color& shadowColor = shadow->color; […] context->setShadow(shadowOffset, shadowBlur, shadowColor);
Crystal Zhang
Comment 6 2009-07-30 12:57:05 PDT
(In reply to comment #5) > (In reply to comment #4) > > (In reply to comment #3) > > > (From update of attachment 33791 [details] [details] [details]) > > > I think this is wrong. What is the issue this is supposed to address? > > > > It always uses Color::black to paint box shadow regardless shadow style, which > > is wrong. > > The code uses a black fill for the shape casting the shadow. The shadow > properties, including its color, are based on the ShadowData structure from the > style: > > for (ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next) { > […] > Color& shadowColor = shadow->color; > […] > context->setShadow(shadowOffset, shadowBlur, shadowColor); Thanks for your explain. Probably I misunderstood. One thing still confusing: can I know the reason that it uses shadow color later in that function?
mitz
Comment 7 2009-07-30 12:58:48 PDT
(In reply to comment #6) > (In reply to comment #5) > > (In reply to comment #4) > > > (In reply to comment #3) > > > > (From update of attachment 33791 [details] [details] [details] [details]) > > > > I think this is wrong. What is the issue this is supposed to address? > > > > > > It always uses Color::black to paint box shadow regardless shadow style, which > > > is wrong. > > > > The code uses a black fill for the shape casting the shadow. The shadow > > properties, including its color, are based on the ShadowData structure from the > > style: > > > > for (ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next) { > > […] > > Color& shadowColor = shadow->color; > > […] > > context->setShadow(shadowOffset, shadowBlur, shadowColor); > > Thanks for your explain. Probably I misunderstood. One thing still confusing: > can I know the reason that it uses shadow color later in that function? I am not sure which use of shadow color you are asking about. There are two branches, one for “normal” shadows and one for inset shadows, and each branch has its own call to setShadow() where it passes the shadow color.
Crystal Zhang
Comment 8 2009-07-30 13:03:16 PDT
(In reply to comment #7) > (In reply to comment #6) > > (In reply to comment #5) > > > (In reply to comment #4) > > > > (In reply to comment #3) > > > > > (From update of attachment 33791 [details] [details] [details] [details] [details]) > > > > > I think this is wrong. What is the issue this is supposed to address? > > > > > > > > It always uses Color::black to paint box shadow regardless shadow style, which > > > > is wrong. > > > > > > The code uses a black fill for the shape casting the shadow. The shadow > > > properties, including its color, are based on the ShadowData structure from the > > > style: > > > > > > for (ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next) { > > > […] > > > Color& shadowColor = shadow->color; > > > […] > > > context->setShadow(shadowOffset, shadowBlur, shadowColor); > > > > Thanks for your explain. Probably I misunderstood. One thing still confusing: > > can I know the reason that it uses shadow color later in that function? > > I am not sure which use of shadow color you are asking about. There are two > branches, one for “normal” shadows and one for inset shadows, and each branch > has its own call to setShadow() where it passes the shadow color. The branch for inset shadows, it calls fillRoundedRect and fillRect with shadow color.
mitz
Comment 9 2009-07-30 13:08:57 PDT
(In reply to comment #8) > (In reply to comment #7) > > (In reply to comment #6) > > > (In reply to comment #5) > > > > (In reply to comment #4) > > > > > (In reply to comment #3) > > > > > > (From update of attachment 33791 [details] [details] [details] [details] [details] [details]) > > > > > > I think this is wrong. What is the issue this is supposed to address? > > > > > > > > > > It always uses Color::black to paint box shadow regardless shadow style, which > > > > > is wrong. > > > > > > > > The code uses a black fill for the shape casting the shadow. The shadow > > > > properties, including its color, are based on the ShadowData structure from the > > > > style: > > > > > > > > for (ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next) { > > > > […] > > > > Color& shadowColor = shadow->color; > > > > […] > > > > context->setShadow(shadowOffset, shadowBlur, shadowColor); > > > > > > Thanks for your explain. Probably I misunderstood. One thing still confusing: > > > can I know the reason that it uses shadow color later in that function? > > > > I am not sure which use of shadow color you are asking about. There are two > > branches, one for “normal” shadows and one for inset shadows, and each branch > > has its own call to setShadow() where it passes the shadow color. > > The branch for inset shadows, it calls fillRoundedRect and fillRect with shadow > color. If the hole rect is empty then the shadow is cast uniformly on the entire content box. In the case, instead of using a separate shape to cast the shadow, the code just applies a uniform fill with the shadow color.
Crystal Zhang
Comment 10 2009-07-30 13:12:41 PDT
(In reply to comment #9) > (In reply to comment #8) > > (In reply to comment #7) > > > (In reply to comment #6) > > > > (In reply to comment #5) > > > > > (In reply to comment #4) > > > > > > (In reply to comment #3) > > > > > > > (From update of attachment 33791 [details] [details] [details] [details] [details] [details] [details]) > > > > > > > I think this is wrong. What is the issue this is supposed to address? > > > > > > > > > > > > It always uses Color::black to paint box shadow regardless shadow style, which > > > > > > is wrong. > > > > > > > > > > The code uses a black fill for the shape casting the shadow. The shadow > > > > > properties, including its color, are based on the ShadowData structure from the > > > > > style: > > > > > > > > > > for (ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next) { > > > > > […] > > > > > Color& shadowColor = shadow->color; > > > > > […] > > > > > context->setShadow(shadowOffset, shadowBlur, shadowColor); > > > > > > > > Thanks for your explain. Probably I misunderstood. One thing still confusing: > > > > can I know the reason that it uses shadow color later in that function? > > > > > > I am not sure which use of shadow color you are asking about. There are two > > > branches, one for “normal” shadows and one for inset shadows, and each branch > > > has its own call to setShadow() where it passes the shadow color. > > > > The branch for inset shadows, it calls fillRoundedRect and fillRect with shadow > > color. > > If the hole rect is empty then the shadow is cast uniformly on the entire > content box. In the case, instead of using a separate shape to cast the shadow, > the code just applies a uniform fill with the shadow color. Got it. Thank you very much!
Note You need to log in before you can comment on or make changes to this bug.