Bug 50641

Summary: ApplyStyleCommand::applyRelativeFontStyleChange should take EditingStyle*
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Enhancement CC: buildbot, darin, dglazkov, enrica, eric, ojan, tkent, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 49956    
Attachments:
Description Flags
refactoring
none
Don't initialize float in class declaration
none
Removed #include changes eric: review+

Description Ryosuke Niwa 2010-12-07 12:12:55 PST
This is a part of the effort to deploy EditingStyle in ApplyStyleCommand.
Comment 1 Ryosuke Niwa 2010-12-07 12:35:01 PST
Created attachment 75836 [details]
refactoring
Comment 2 Ryosuke Niwa 2010-12-07 14:02:28 PST
(In reply to comment #1)
> Created an attachment (id=75836) [details]
> refactoring

Once this patch is in, we can get rid of -webkit-font-size-delta entirely in the next step.
Comment 3 Darin Adler 2010-12-07 14:04:20 PST
(In reply to comment #2)
> Once this patch is in, we can get rid of -webkit-font-size-delta entirely in the next step.

How will you determine if Mac OS X WebKit clients are using -webkit-font-size-delta with the -[WbeView applyStyle:] method?
Comment 4 Ryosuke Niwa 2010-12-07 14:12:31 PST
(In reply to comment #3)
> (In reply to comment #2)
> > Once this patch is in, we can get rid of -webkit-font-size-delta entirely in the next step.
> 
> How will you determine if Mac OS X WebKit clients are using -webkit-font-size-delta with the -[WbeView applyStyle:] method?

Mn... that's a good point.  But we've never exposed font-size-delta to the Web.  Unless people have looked at how we implemented executeFontSizeDelta, they will never know that property.  Also, CSSParser doesn't parse -webkit-font-size-delta, so they must be using CSSWebKitFontSizeDelta directly with px CSS primitive value.  Should we really worry about people digging into WebCore that deep?  I feel like any other changes we make to WebCore will cause a similar compatibility problems.
Comment 5 Darin Adler 2010-12-07 15:06:04 PST
(In reply to comment #4)
> But we've never exposed font-size-delta to the Web.

True, but not completely relevant. This is about applications making direct use of WebKit, not the web.

> Also, CSSParser doesn't parse -webkit-font-size-delta, so they must be using CSSWebKitFontSizeDelta directly with px CSS primitive value.

CSSParser is not relevant. To use -[WebView applyStyle:], programmers use the Objective-C DOM API to create a CSSStyleDeclaration object, not the CSS parser.

> Unless people have looked at how we implemented executeFontSizeDelta, they will never know that property.

You may be overlooking some Mac-specific things. This is also used to make text smaller in response to the Smaller menu item in the Style submenu in the Format menu in the Mail application, for example, but not by using -[WebView applyStyle:] directly.

> Should we really worry about people digging into WebCore that deep?

You may be right. We can probably cross our fingers and hope nobody does this. It’s not really about “digging deep” into WebCore, but it’s true that discovering this does require knowing about an internal CSS property name.

> I feel like any other changes we make to WebCore will cause a similar compatibility problems.

I don’t agree. Most other changes don’t remove a publicly accessible feature as this one does.
Comment 6 Build Bot 2010-12-07 15:56:41 PST
Attachment 75836 [details] did not build on win:
Build output: http://queues.webkit.org/results/6824084
Comment 7 Ryosuke Niwa 2010-12-07 17:08:42 PST
(In reply to comment #5)
> (In reply to comment #4)
> > Unless people have looked at how we implemented executeFontSizeDelta, they will never know that property.
> 
> You may be overlooking some Mac-specific things. This is also used to make text smaller in response to the Smaller menu item in the Style submenu in the Format menu in the Mail application, for example, but not by using -[WebView applyStyle:] directly.

Oh, I didn't know that.  I was wondering what kind of web pages / App uses this feature.

> > Should we really worry about people digging into WebCore that deep?
> 
> You may be right. We can probably cross our fingers and hope nobody does this. It’s not really about “digging deep” into WebCore, but it’s true that discovering this does require knowing about an internal CSS property name.

We could leave it there if you want.  I wanted to get rid of it in order to avoid web apps start depending on this feature in the future because I really think this is an implementation detail that we shouldn't have exposed in the first place.  If there's a way to prevent new apps from using it without breaking the backward compatibility, I'm more than happy to do it.

IMHO moving this property into EditingStyle is a good idea regardless of whether we're getting rid of this property or not because I want to isolate all editing code that touches CSSMutableStyleDeclaration into EditingStyle eventually.
Comment 8 WebKit Review Bot 2010-12-07 21:48:40 PST
Attachment 75836 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/update-webkit']" exit_code: 2
Updating OpenSource
Incomplete data: Delta source ended unexpectedly at /usr/lib/git-core/git-svn line 5061

Died at WebKitTools/Scripts/update-webkit line 132.


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Ryosuke Niwa 2010-12-15 16:43:55 PST
Created attachment 76709 [details]
Don't initialize float in class declaration
Comment 10 WebKit Review Bot 2010-12-15 17:09:08 PST
Attachment 76709 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/7091051
Comment 11 WebKit Review Bot 2010-12-15 18:45:16 PST
Attachment 76709 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/7110057
Comment 12 Ryosuke Niwa 2010-12-16 12:19:57 PST
(In reply to comment #11)
> Attachment 76709 [details] did not build on chromium:
> Build output: http://queues.webkit.org/results/7110057

I'm going to separate the #include change.
Comment 13 Ryosuke Niwa 2010-12-16 12:33:06 PST
Created attachment 76800 [details]
Removed #include changes
Comment 14 Ryosuke Niwa 2011-01-03 20:43:49 PST
Could someone review my patch?
Comment 15 Eric Seidel (no email) 2011-01-04 12:30:53 PST
Comment on attachment 76800 [details]
Removed #include changes

LGTM. Thanks.
Comment 16 Ryosuke Niwa 2011-01-05 10:32:45 PST
(In reply to comment #15)
> (From update of attachment 76800 [details])
> LGTM. Thanks.

Thanks for the review, Eric.  Landing it now.
Comment 17 Ryosuke Niwa 2011-01-05 10:33:03 PST
Committed r75080: <http://trac.webkit.org/changeset/75080>