Bug 113292 - Move box-shadow/webkit-box-shadow/text-shadow code to StyleBuilder
Summary: Move box-shadow/webkit-box-shadow/text-shadow code to StyleBuilder
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Emil A Eklund
URL:
Keywords:
Depends on:
Blocks: 89879
  Show dependency treegraph
 
Reported: 2013-03-26 03:46 PDT by Emil A Eklund
Modified: 2022-07-13 14:29 PDT (History)
9 users (show)

See Also:


Attachments
Patch (11.51 KB, patch)
2013-03-26 03:51 PDT, Emil A Eklund
koivisto: review-
koivisto: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emil A Eklund 2013-03-26 03:46:29 PDT
Move the CSSPropertyBoxShadow, CSSPropertyTextShadow and CSSPropertyWebkitBoxShadow applying logic out of StyleResolver::applyProperty.
Comment 1 Emil A Eklund 2013-03-26 03:51:54 PDT
Created attachment 195053 [details]
Patch
Comment 2 Antti Koivisto 2013-03-27 05:46:08 PDT
The refactored code is less understandable than the current one. It would be nice to refactor StyleBuilder to be more sane before moving anything more there.
Comment 3 Emil A Eklund 2013-03-27 06:23:58 PDT
(In reply to comment #2)
> The refactored code is less understandable than the current one. It would be nice to refactor StyleBuilder to be more sane before moving anything more there.

Is there anything in particular you find harder to understand or just the general concept of using templates this way? I'll gladly change it to make it easier to understand but knowing what you find hard to follow would makes that a lot easier.
Thanks.
Comment 4 Antti Koivisto 2013-03-29 07:16:42 PDT
This factors a relatively straightforward switch branch into something that involves templates and function pointers without any obvious gain. How is this a progression?
Comment 5 Antti Koivisto 2013-03-29 07:21:24 PDT
An obvious first step for cleaning this up would be to move StyleResolver::applyProperty and pals to StyleBuilder. Then we could start figuring out how to have a one sane path of doing this.
Comment 6 Allan Sandfeld Jensen 2013-04-04 05:50:13 PDT
Comment on attachment 195053 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=195053&action=review

> Source/WebCore/css/StyleBuilder.cpp:1274
> +    static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
> +    {
> +        const ShadowData* shadowData = (styleResolver->parentStyle()->*getterFunction)();
> +        (styleResolver->style()->*setterFunction)(shadowData ? adoptPtr(new ShadowData(*shadowData)) : nullptr, 0 /* add */);
> +    }

I agree with antti. High order functions are cool and all, but it doesn't really make it any cleaner here. These methods all already have the CSSPropertyID, so you could use that to select the methods like the original code.
Comment 7 Brent Fulgham 2022-07-13 14:29:34 PDT
This code has been significantly refactored since this patch was proposed. There doesn't seem to be any action we can take here.