Bug 185445 - Set colorspace in the PDF plugin.
Summary: Set colorspace in the PDF plugin.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-05-08 13:49 PDT by Per Arne Vollan
Modified: 2018-05-08 18:35 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.23 KB, patch)
2018-05-08 13:53 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (2.29 KB, patch)
2018-05-08 15:33 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2018-05-08 13:49:53 PDT
We should set the colorspace in the PDF plugin.
Comment 1 Per Arne Vollan 2018-05-08 13:50:44 PDT
<rdar://problem/40030981>
Comment 2 Per Arne Vollan 2018-05-08 13:53:00 PDT
Created attachment 339869 [details]
Patch
Comment 3 Brent Fulgham 2018-05-08 15:18:18 PDT
Comment on attachment 339869 [details]
Patch

r=me.
Comment 4 Tim Horton 2018-05-08 15:19:25 PDT
Comment on attachment 339869 [details]
Patch

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

> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:637
> +    if ([m_pdfLayerController.get() respondsToSelector:@selector(setDeviceColorSpace:)])

No need for the .get()s
Comment 5 Tim Horton 2018-05-08 15:20:19 PDT
Comment on attachment 339869 [details]
Patch

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

> Source/WebKit/WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:170
> +- (void) setDeviceColorSpace:(CGColorSpaceRef)colorSpace;

No space after the )

>> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:637
>> +    if ([m_pdfLayerController.get() respondsToSelector:@selector(setDeviceColorSpace:)])
> 
> No need for the .get()s

No need for the .get()s

> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:638
> +        [m_pdfLayerController.get() setDeviceColorSpace:screenColorSpace()];

What does screenColorSpace do? It seems like it will usually be wrong, and we should be getting it from the page/view, not the screen (because there are multiple screens).
Comment 6 Brent Fulgham 2018-05-08 15:30:42 PDT
Comment on attachment 339869 [details]
Patch

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

>> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:638
>> +        [m_pdfLayerController.get() setDeviceColorSpace:screenColorSpace()];
> 
> What does screenColorSpace do? It seems like it will usually be wrong, and we should be getting it from the page/view, not the screen (because there are multiple screens).

You could call screenColorSpace(this) maybe? The PDFPlugin's Widget will be tied to the correct screen, then 'screenColorSpace' can give you the right answer, tied to the display the PDF is being shown on.
Comment 7 Per Arne Vollan 2018-05-08 15:33:14 PDT
Created attachment 339889 [details]
Patch
Comment 8 Per Arne Vollan 2018-05-08 15:36:31 PDT
(In reply to Brent Fulgham from comment #6)
> Comment on attachment 339869 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=339869&action=review
> 
> >> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:638
> >> +        [m_pdfLayerController.get() setDeviceColorSpace:screenColorSpace()];
> > 
> > What does screenColorSpace do? It seems like it will usually be wrong, and we should be getting it from the page/view, not the screen (because there are multiple screens).
> 
> You could call screenColorSpace(this) maybe? The PDFPlugin's Widget will be
> tied to the correct screen, then 'screenColorSpace' can give you the right
> answer, tied to the display the PDF is being shown on.

I used the PDF frame's view in the latest patch.

Thanks for reviewing, all!
Comment 9 Simon Fraser (smfr) 2018-05-08 16:03:45 PDT
Comment on attachment 339889 [details]
Patch

How does this update if the screen colorspace changes?
Comment 10 Per Arne Vollan 2018-05-08 16:11:05 PDT
(In reply to Simon Fraser (smfr) from comment #9)
> Comment on attachment 339889 [details]
> Patch
> 
> How does this update if the screen colorspace changes?

That is a good point ... The current patch does not handle this, I believe.

Thanks for reviewing!
Comment 11 WebKit Commit Bot 2018-05-08 18:35:01 PDT
Comment on attachment 339889 [details]
Patch

Clearing flags on attachment: 339889

Committed r231535: <https://trac.webkit.org/changeset/231535>
Comment 12 WebKit Commit Bot 2018-05-08 18:35:03 PDT
All reviewed patches have been landed.  Closing bug.