WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
189918
Refactor Editor::fontAttributesForSelectionStart to be platform-agnostic
https://bugs.webkit.org/show_bug.cgi?id=189918
Summary
Refactor Editor::fontAttributesForSelectionStart to be platform-agnostic
Wenson Hsieh
Reported
2018-09-24 09:18:35 PDT
Work towards <
rdar://problem/44648705
>
Attachments
Patch
(37.04 KB, patch)
2018-09-24 09:37 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Rebase on trunk
(36.81 KB, patch)
2018-09-24 10:17 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Fix 32-bit macOS build
(36.82 KB, patch)
2018-09-24 10:42 PDT
,
Wenson Hsieh
thorton
: review+
Details
Formatted Diff
Diff
Patch for EWS
(49.46 KB, patch)
2018-09-24 14:11 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Patch for EWS #2
(51.19 KB, patch)
2018-09-24 14:48 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Patch for EWS #2.1
(50.93 KB, patch)
2018-09-24 14:49 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Patch for EWS #2.1 (rebase on trunk)
(49.02 KB, patch)
2018-09-24 14:54 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Wenson Hsieh
Comment 1
2018-09-24 09:37:41 PDT
Created
attachment 350646
[details]
Patch
Wenson Hsieh
Comment 2
2018-09-24 10:17:20 PDT
Created
attachment 350651
[details]
Rebase on trunk
Wenson Hsieh
Comment 3
2018-09-24 10:42:39 PDT
Created
attachment 350653
[details]
Fix 32-bit macOS build
Tim Horton
Comment 4
2018-09-24 11:52:10 PDT
Comment on
attachment 350653
[details]
Fix 32-bit macOS build View in context:
https://bugs.webkit.org/attachment.cgi?id=350653&action=review
> Source/WebCore/editing/Editor.cpp:3895 > + if (verticalAlign == VerticalAlign::Sub) > + attributes.subscriptOrSuperscript = SubscriptOrSuperscript::Subscript; > + > + if (verticalAlign == VerticalAlign::Super) > + attributes.subscriptOrSuperscript = SubscriptOrSuperscript::Superscript;
Should this be a switch? Or do we elsewhere have a function that translates between the two? (coming back to this, we don't, because it's new)
> Source/WebCore/editing/FontAttributes.h:39 > +#if PLATFORM(COCOA) > +OBJC_CLASS NSDictionary; > +#endif > + > +#if PLATFORM(MAC) > +OBJC_CLASS NSFont; > +#elif PLATFORM(IOS) > +OBJC_CLASS UIFont; > +#endif
None of these #ifs are really necessary.
> Source/WebCore/editing/FontShadow.h:47 > + double width { 0 }; > + double height { 0 };
FloatSize offset; ?
> Source/WebCore/editing/cocoa/FontAttributesCocoa.mm:54 > + [attributes setObject:font.get() forKey:NSFontAttributeName];
Modern dictionary syntax?
> Source/WebCore/editing/cocoa/FontShadowCocoa.mm:42 > + [shadow setShadowColor:nsColor(color)];
Wouldn't it be nice if you had your platformColor thing here. I feel like we must have something similar somewhere.
Wenson Hsieh
Comment 5
2018-09-24 12:33:15 PDT
Comment on
attachment 350653
[details]
Fix 32-bit macOS build View in context:
https://bugs.webkit.org/attachment.cgi?id=350653&action=review
>> Source/WebCore/editing/Editor.cpp:3895 >> + attributes.subscriptOrSuperscript = SubscriptOrSuperscript::Superscript; > > Should this be a switch? Or do we elsewhere have a function that translates between the two? > > (coming back to this, we don't, because it's new)
Interestingly enough, it was a switch before the move! I made this just use if statements instead because I thought it make it clearer that it's just these two alignment types that make their way into FontAttributes — I'll turn this back into a switch statement.
>> Source/WebCore/editing/FontAttributes.h:39 >> +#endif > > None of these #ifs are really necessary.
Good point — removed.
>> Source/WebCore/editing/FontShadow.h:47 >> + double height { 0 }; > > FloatSize offset; ?
👍
>> Source/WebCore/editing/cocoa/FontAttributesCocoa.mm:54 >> + [attributes setObject:font.get() forKey:NSFontAttributeName]; > > Modern dictionary syntax?
👍 (Also, I made attributes a NSMutableDictionary * instead of a RetainPtr<NSMutableDictionary>, since RetainPtr doesn't support operator[])
>> Source/WebCore/editing/cocoa/FontShadowCocoa.mm:42 >> + [shadow setShadowColor:nsColor(color)]; > > Wouldn't it be nice if you had your platformColor thing here. I feel like we must have something similar somewhere.
Now that you mention it, HTMLConverter does a similar dance, but uses _disambiguated_due_to_CIImage_colorWithCGColor instead (which behaves identically to colorWithCGColor, and as its name suggests, seems to exist to avoid a name conflict with CIColor). Funny enough, the helper there is also called "_platformColor". I think we should abstract this out into a separate helper so we can use it from these call sites, but I'm not sure where to put it. Perhaps a new ColorCocoa.h?
Wenson Hsieh
Comment 6
2018-09-24 14:11:08 PDT
Created
attachment 350681
[details]
Patch for EWS
Wenson Hsieh
Comment 7
2018-09-24 14:48:11 PDT
Created
attachment 350692
[details]
Patch for EWS #2
Wenson Hsieh
Comment 8
2018-09-24 14:49:41 PDT
Created
attachment 350693
[details]
Patch for EWS #2.1
Wenson Hsieh
Comment 9
2018-09-24 14:54:26 PDT
Created
attachment 350697
[details]
Patch for EWS #2.1 (rebase on trunk)
WebKit Commit Bot
Comment 10
2018-09-24 17:17:36 PDT
Comment on
attachment 350697
[details]
Patch for EWS #2.1 (rebase on trunk) Clearing flags on attachment: 350697 Committed
r236445
: <
https://trac.webkit.org/changeset/236445
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug