Bug 134843 - Implement textStylingAtPosition in WK2
Summary: Implement textStylingAtPosition in WK2
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Enrica Casucci
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-07-11 14:04 PDT by Enrica Casucci
Modified: 2014-07-11 16:24 PDT (History)
1 user (show)

See Also:


Attachments
Patch (10.86 KB, patch)
2014-07-11 14:09 PDT, Enrica Casucci
no flags Details | Formatted Diff | Diff
Patch2 (10.81 KB, patch)
2014-07-11 15:57 PDT, Enrica Casucci
benjamin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enrica Casucci 2014-07-11 14:04:04 PDT
Provide the same support we have in WebKit on iOS.

<rdar://problem/17614981>
Comment 1 Enrica Casucci 2014-07-11 14:09:17 PDT
Created attachment 234779 [details]
Patch
Comment 2 Enrica Casucci 2014-07-11 15:57:19 PDT
Created attachment 234787 [details]
Patch2

Fixes the OS X build.
Comment 3 Benjamin Poulain 2014-07-11 16:01:41 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=234779&action=review

I don't know much about this code but the patch looks reasonable.

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:1198
> +    RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithNameAndSize(CFSTR("Helvetica"), 10));

This could be defined closer to where it is used.

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:1205
> +        fontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(fontDescriptor.get(), symbolicTraits, symbolicTraits));

Is there no way to create the font descriptor directly with the traits? It is a little ugly to create a font then copy it.

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:1207
> +    RetainPtr<CTFontRef> font = CTFontCreateWithFontDescriptor(fontDescriptor.get(), 10, nullptr);

Shouldn't this use adoptCF?

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:752
> +        if (style) {

WebKit style: if (RenderStyle* ...)
Comment 4 Enrica Casucci 2014-07-11 16:24:53 PDT
Committed revision 171015.