WebKit Bugzilla
Attachment 341033 Details for
Bug 185883
: Optimized path zoom animation needs a valid UIImage and CGRect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185883-20180523075408.patch (text/plain), 27.12 KB, created by
Dean Jackson
on 2018-05-22 14:54:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Dean Jackson
Created:
2018-05-22 14:54:10 PDT
Size:
27.12 KB
patch
obsolete
>Subversion Revision: 231578 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 051a2d771a57ff06899c9974f29711389ba9780c..6f18135541074ebd29edf32a08827acd94c57d02 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,37 @@ >+2018-05-22 Dean Jackson <dino@apple.com> >+ >+ Optimized path zoom animation needs a valid UIImage and CGRect >+ https://bugs.webkit.org/show_bug.cgi?id=185883 >+ <rdar://problem/40306056> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Pass the bounding box of the element that was clicked onto >+ the UI process, so it can perform an animation from that spot. >+ >+ This involved adding an IntRect to the ResourceRequest, and passing >+ that info into it from the HTMLAnchorElement, using a new struct >+ called SystemPreviewInfo. >+ >+ * html/HTMLAnchorElement.cpp: >+ (WebCore::HTMLAnchorElement::handleClick): >+ * loader/FrameLoadRequest.cpp: >+ (WebCore::FrameLoadRequest::FrameLoadRequest): >+ * loader/FrameLoadRequest.h: >+ (WebCore::FrameLoadRequest::FrameLoadRequest): >+ (WebCore::FrameLoadRequest::isSystemPreview const): >+ (WebCore::FrameLoadRequest::systemPreviewRect const): >+ * loader/FrameLoader.cpp: >+ (WebCore::FrameLoader::urlSelected): >+ (WebCore::FrameLoader::loadURL): >+ * loader/FrameLoader.h: >+ (WebCore::FrameLoader::urlSelected): >+ * loader/FrameLoaderTypes.h: >+ * platform/network/ResourceRequestBase.cpp: >+ (WebCore::ResourceRequestBase::systemPreviewRect const): >+ (WebCore::ResourceRequestBase::setSystemPreviewRect): >+ * platform/network/ResourceRequestBase.h: >+ > 2018-05-09 Tim Horton <timothy_horton@apple.com> > > Fix the build by ignoring some deprecation warnings >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 434ccf4390ff6946acc1106f9be0353c150edc23..1058531c634d507349386ff4a954b895162a2f6a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,33 @@ >+2018-05-22 Dean Jackson <dino@apple.com> >+ >+ Optimized path zoom animation needs a valid UIImage and CGRect >+ https://bugs.webkit.org/show_bug.cgi?id=185883 >+ <rdar://problem/40306056> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Take the rectangle that was passed into the ResourceRequest and >+ use it for the origin of an animation into QuickLook. >+ >+ * Shared/WebCoreArgumentCoders.cpp: >+ (IPC::ArgumentCoder<ResourceRequest>::encode): >+ (IPC::ArgumentCoder<ResourceRequest>::decode): >+ * UIProcess/Cocoa/DownloadClient.mm: >+ (WebKit::DownloadClient::didStart): >+ * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: >+ (-[_WKPreviewControllerDelegate initWithSystemPreviewController:fromRect:]): >+ (-[_WKPreviewControllerDelegate presentingViewController]): >+ (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]): >+ (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]): >+ (WebKit::SystemPreviewController::start): >+ (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]): Deleted. >+ * UIProcess/Downloads/DownloadProxy.h: >+ (WebKit::DownloadProxy::systemPreviewDownloadRect const): >+ * UIProcess/SystemPreviewController.h: >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::syncRootViewToScreen): >+ * UIProcess/WebPageProxy.h: >+ > 2018-05-17 Dean Jackson <dino@apple.com> > > Safari optimized flow should be releasing viewer to prevent memory growth with subsequent launches/closes >diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp >index 89a38c1782c38c3b3b12a2fe10db730640ec95f6..c6d57eea394d72d9965030c19b5d6033ad50b4d0 100644 >--- a/Source/WebCore/html/HTMLAnchorElement.cpp >+++ b/Source/WebCore/html/HTMLAnchorElement.cpp >@@ -417,14 +417,19 @@ void HTMLAnchorElement::handleClick(Event& event) > } > #endif > >- bool isSystemPreview = false; >+ SystemPreviewInfo systemPreviewInfo; > #if USE(SYSTEM_PREVIEW) >- isSystemPreview = isSystemPreviewLink(); >+ systemPreviewInfo.isSystemPreview = isSystemPreviewLink(); >+ >+ if (systemPreviewInfo.isSystemPreview) { >+ if (auto* child = firstElementChild()) >+ systemPreviewInfo.systemPreviewRect = child->boundsInRootViewSpace(); >+ } > #endif > > ShouldSendReferrer shouldSendReferrer = hasRel(Relation::NoReferrer) ? NeverSendReferrer : MaybeSendReferrer; > auto newFrameOpenerPolicy = hasRel(Relation::NoOpener) ? std::make_optional(NewFrameOpenerPolicy::Suppress) : std::nullopt; >- frame->loader().urlSelected(completedURL, target(), &event, LockHistory::No, LockBackForwardList::No, shouldSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate(), newFrameOpenerPolicy, downloadAttribute, isSystemPreview); >+ frame->loader().urlSelected(completedURL, target(), &event, LockHistory::No, LockBackForwardList::No, shouldSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate(), newFrameOpenerPolicy, downloadAttribute, systemPreviewInfo); > > sendPings(completedURL); > } >diff --git a/Source/WebCore/loader/FrameLoadRequest.cpp b/Source/WebCore/loader/FrameLoadRequest.cpp >index c154772813dee436a8221260f00c4fe2be6e87f2..aaacbaccc1fc9263984f649369dd159673cf2d91 100644 >--- a/Source/WebCore/loader/FrameLoadRequest.cpp >+++ b/Source/WebCore/loader/FrameLoadRequest.cpp >@@ -37,7 +37,7 @@ > > namespace WebCore { > >-FrameLoadRequest::FrameLoadRequest(Document& requester, SecurityOrigin& requesterSecurityOrigin, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, InitiatedByMainFrame initiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL, const AtomicString& downloadAttribute, bool isSystemPreview) >+FrameLoadRequest::FrameLoadRequest(Document& requester, SecurityOrigin& requesterSecurityOrigin, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, InitiatedByMainFrame initiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL, const AtomicString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo) > : m_requester { makeRef(requester) } > , m_requesterSecurityOrigin { makeRef(requesterSecurityOrigin) } > , m_resourceRequest { resourceRequest } >@@ -51,7 +51,7 @@ FrameLoadRequest::FrameLoadRequest(Document& requester, SecurityOrigin& requeste > , m_shouldOpenExternalURLsPolicy { shouldOpenExternalURLsPolicy } > , m_downloadAttribute { downloadAttribute } > , m_initiatedByMainFrame { initiatedByMainFrame } >- , m_isSystemPreview { isSystemPreview } >+ , m_systemPreviewInfo { systemPreviewInfo } > { > } > >diff --git a/Source/WebCore/loader/FrameLoadRequest.h b/Source/WebCore/loader/FrameLoadRequest.h >index d6f10ed7d900d460e1920d54df47c5df6804facd..da01eb765495be55365ca0a80214509fd3bc23e3 100644 >--- a/Source/WebCore/loader/FrameLoadRequest.h >+++ b/Source/WebCore/loader/FrameLoadRequest.h >@@ -38,7 +38,7 @@ class SecurityOrigin; > > class FrameLoadRequest { > public: >- WEBCORE_EXPORT FrameLoadRequest(Document&, SecurityOrigin&, const ResourceRequest&, const String& frameName, LockHistory, LockBackForwardList, ShouldSendReferrer, AllowNavigationToInvalidURL, NewFrameOpenerPolicy, ShouldOpenExternalURLsPolicy, InitiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL, const AtomicString& downloadAttribute = { }, bool isSystemPreview = false); >+ WEBCORE_EXPORT FrameLoadRequest(Document&, SecurityOrigin&, const ResourceRequest&, const String& frameName, LockHistory, LockBackForwardList, ShouldSendReferrer, AllowNavigationToInvalidURL, NewFrameOpenerPolicy, ShouldOpenExternalURLsPolicy, InitiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL, const AtomicString& downloadAttribute = { }, const SystemPreviewInfo& = { }); > WEBCORE_EXPORT FrameLoadRequest(Frame&, const ResourceRequest&, ShouldOpenExternalURLsPolicy, const SubstituteData& = SubstituteData()); > > WEBCORE_EXPORT ~FrameLoadRequest(); >@@ -87,7 +87,8 @@ public: > void setIsCrossOriginWindowOpenNavigation(bool value) { m_isCrossOriginWindowOpenNavigation = value; } > bool isCrossOriginWindowOpenNavigation() const { return m_isCrossOriginWindowOpenNavigation; } > >- bool isSystemPreview() const { return m_isSystemPreview; } >+ bool isSystemPreview() const { return m_systemPreviewInfo.isSystemPreview; } >+ const IntRect& systemPreviewRect() const { return m_systemPreviewInfo.systemPreviewRect; } > > private: > Ref<Document> m_requester; >@@ -109,6 +110,7 @@ private: > InitiatedByMainFrame m_initiatedByMainFrame { InitiatedByMainFrame::Unknown }; > bool m_isCrossOriginWindowOpenNavigation { false }; > bool m_isSystemPreview { false }; >+ SystemPreviewInfo m_systemPreviewInfo; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp >index 729f25389c64690f08eb60d56215349e84881b53..5d6a22dc9991d8ee35e9606b06fb81bc0c2d208e 100644 >--- a/Source/WebCore/loader/FrameLoader.cpp >+++ b/Source/WebCore/loader/FrameLoader.cpp >@@ -370,13 +370,13 @@ void FrameLoader::changeLocation(FrameLoadRequest&& request) > urlSelected(WTFMove(request), nullptr); > } > >-void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> openerPolicy, const AtomicString& downloadAttribute, bool isSystemPreview) >+void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> openerPolicy, const AtomicString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo) > { > auto* frame = lexicalFrameFromCommonVM(); > auto initiatedByMainFrame = frame && frame->isMainFrame() ? InitiatedByMainFrame::Yes : InitiatedByMainFrame::Unknown; > > NewFrameOpenerPolicy newFrameOpenerPolicy = openerPolicy.value_or(shouldSendReferrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerPolicy::Allow); >- urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securityOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute, isSystemPreview), triggeringEvent); >+ urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securityOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute, systemPreviewInfo), triggeringEvent); > } > > void FrameLoader::urlSelected(FrameLoadRequest&& frameRequest, Event* triggeringEvent) >@@ -1362,7 +1362,12 @@ void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& ref > > // Must grab this now, since this load may stop the previous load and clear this flag. > bool isRedirect = m_quickRedirectComing; >- request.setSystemPreview(frameLoadRequest.isSystemPreview()); >+#if USE(SYSTEM_PREVIEW) >+ bool isSystemPreview = frameLoadRequest.isSystemPreview(); >+ request.setSystemPreview(isSystemPreview); >+ if (isSystemPreview) >+ request.setSystemPreviewRect(frameLoadRequest.systemPreviewRect()); >+#endif > loadWithNavigationAction(request, action, lockHistory, newLoadType, formState, allowNavigationToInvalidURL, [this, isRedirect, sameURL, newLoadType, protectedFrame = makeRef(m_frame), completionHandler = completionHandlerCaller.release()] { > if (isRedirect) { > m_quickRedirectComing = false; >diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h >index 95e170a92ce5e55ef5ca1ef11ed80d8b3eb8f9bd..fbc72ec124ac500e76bebef01a8b0d0626d42afa 100644 >--- a/Source/WebCore/loader/FrameLoader.h >+++ b/Source/WebCore/loader/FrameLoader.h >@@ -121,7 +121,7 @@ public: > unsigned long loadResourceSynchronously(const ResourceRequest&, ClientCredentialPolicy, const FetchOptions&, const HTTPHeaderMap&, ResourceError&, ResourceResponse&, RefPtr<SharedBuffer>& data); > > void changeLocation(FrameLoadRequest&&); >- WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> = std::nullopt, const AtomicString& downloadAttribute = nullAtom(), bool isSystemPreview = false); >+ WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> = std::nullopt, const AtomicString& downloadAttribute = nullAtom(), const SystemPreviewInfo& = { }); > void submitForm(Ref<FormSubmission>&&); > > WEBCORE_EXPORT void reload(OptionSet<ReloadOption> = { }); >diff --git a/Source/WebCore/loader/FrameLoaderTypes.h b/Source/WebCore/loader/FrameLoaderTypes.h >index 6de1b6faafe2e9ad354e6992cb74ec8ad3c29311..5d6abf1c5f7412cb72b1382a1c4aeb184ca6844b 100644 >--- a/Source/WebCore/loader/FrameLoaderTypes.h >+++ b/Source/WebCore/loader/FrameLoaderTypes.h >@@ -28,6 +28,8 @@ > > #pragma once > >+#include "IntRect.h" >+ > namespace WebCore { > > enum FrameState { >@@ -147,6 +149,12 @@ enum class HasInsecureContent { > No, > }; > >+ >+struct SystemPreviewInfo { >+ IntRect systemPreviewRect; >+ bool isSystemPreview { false }; >+}; >+ > } // namespace WebCore > > namespace WTF { >diff --git a/Source/WebCore/platform/network/ResourceRequestBase.cpp b/Source/WebCore/platform/network/ResourceRequestBase.cpp >index 3cb156987e3ef5f7ff8d922eecdd933bcea02fe6..49bd82e05a4498881e41c3241d5d6d2c7d37cb80 100644 >--- a/Source/WebCore/platform/network/ResourceRequestBase.cpp >+++ b/Source/WebCore/platform/network/ResourceRequestBase.cpp >@@ -576,6 +576,7 @@ void ResourceRequestBase::setHTTPHeaderFields(HTTPHeaderMap headerFields) > m_platformRequestUpdated = false; > } > >+#if USE(SYSTEM_PREVIEW) > bool ResourceRequestBase::isSystemPreview() const > { > return m_isSystemPreview; >@@ -586,6 +587,17 @@ void ResourceRequestBase::setSystemPreview(bool s) > m_isSystemPreview = s; > } > >+const IntRect& ResourceRequestBase::systemPreviewRect() const >+{ >+ return m_systemPreviewRect; >+} >+ >+void ResourceRequestBase::setSystemPreviewRect(const IntRect& rect) >+{ >+ m_systemPreviewRect = rect; >+} >+#endif >+ > bool equalIgnoringHeaderFields(const ResourceRequestBase& a, const ResourceRequestBase& b) > { > if (a.url() != b.url()) >diff --git a/Source/WebCore/platform/network/ResourceRequestBase.h b/Source/WebCore/platform/network/ResourceRequestBase.h >index 030a0bb825034a4c9bfaad7ac787adce373a4901..b931cf4e302547f5497c0ff64cb9798b4299b79b 100644 >--- a/Source/WebCore/platform/network/ResourceRequestBase.h >+++ b/Source/WebCore/platform/network/ResourceRequestBase.h >@@ -30,6 +30,7 @@ > > #include "FormData.h" > #include "HTTPHeaderMap.h" >+#include "IntRect.h" > #include "URL.h" > #include "ResourceLoadPriority.h" > >@@ -171,9 +172,14 @@ public: > String initiatorIdentifier() const { return m_initiatorIdentifier; } > void setInitiatorIdentifier(const String& identifier) { m_initiatorIdentifier = identifier; } > >+#if USE(SYSTEM_PREVIEW) > WEBCORE_EXPORT bool isSystemPreview() const; > WEBCORE_EXPORT void setSystemPreview(bool); > >+ WEBCORE_EXPORT const IntRect& systemPreviewRect() const; >+ WEBCORE_EXPORT void setSystemPreviewRect(const IntRect&); >+#endif >+ > #if !PLATFORM(COCOA) > bool encodingRequiresPlatformData() const { return true; } > #endif >@@ -233,7 +239,10 @@ protected: > Requester m_requester { Requester::Unspecified }; > String m_initiatorIdentifier; > String m_cachePartition { emptyString() }; >+#if USE(SYSTEM_PREVIEW) > bool m_isSystemPreview { false }; >+ IntRect m_systemPreviewRect; >+#endif > > private: > const ResourceRequest& asResourceRequest() const; >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >index e76ff64f2a0dc90ef0ddd694f350a4d676fefb89..94d3591b7eb899d1a341fa3ef59f319c491fa6ea 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >@@ -1237,7 +1237,14 @@ void ArgumentCoder<ResourceRequest>::encode(Encoder& encoder, const ResourceRequ > { > encoder << resourceRequest.cachePartition(); > encoder << resourceRequest.hiddenFromInspector(); >- encoder << resourceRequest.isSystemPreview(); >+ >+#if USE(SYSTEM_PREVIEW) >+ if (resourceRequest.isSystemPreview()) { >+ encoder << true; >+ encoder << resourceRequest.systemPreviewRect(); >+ } else >+ encoder << false; >+#endif > > if (resourceRequest.encodingRequiresPlatformData()) { > encoder << true; >@@ -1260,11 +1267,20 @@ bool ArgumentCoder<ResourceRequest>::decode(Decoder& decoder, ResourceRequest& r > return false; > resourceRequest.setHiddenFromInspector(isHiddenFromInspector); > >+#if USE(SYSTEM_PREVIEW) > bool isSystemPreview; > if (!decoder.decode(isSystemPreview)) > return false; > resourceRequest.setSystemPreview(isSystemPreview); > >+ if (isSystemPreview) { >+ IntRect systemPreviewRect; >+ if (!decoder.decode(systemPreviewRect)) >+ return false; >+ resourceRequest.setSystemPreviewRect(systemPreviewRect); >+ } >+#endif >+ > bool hasPlatformData; > if (!decoder.decode(hasPlatformData)) > return false; >diff --git a/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm b/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >index f44542cbf98568278ad75c9c72222cc56b89ce71..9eeabe10479a574893574d2957021c423ef7f983 100644 >--- a/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >@@ -78,7 +78,7 @@ void DownloadClient::didStart(WebProcessPool&, DownloadProxy& downloadProxy) > if (downloadProxy.isSystemPreviewDownload()) { > if (auto* webPage = downloadProxy.originatingPage()) { > // FIXME: Update the MIME-type once it is known in the ResourceResponse. >- webPage->systemPreviewController()->start(ASCIILiteral { "application/octet-stream" }); >+ webPage->systemPreviewController()->start(ASCIILiteral { "application/octet-stream" }, downloadProxy.systemPreviewDownloadRect()); > } > takeActivityToken(downloadProxy); > return; >diff --git a/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm b/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm >index 3f4e9d54bcd7663fd4480d1653f150910e8d362a..d80e6b0a9cd1b36a5fd0005ea7bea7e0ee283aa3 100644 >--- a/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm >@@ -111,17 +111,19 @@ SOFT_LINK_CLASS(QuickLook, QLItem); > > @interface _WKPreviewControllerDelegate : NSObject <QLPreviewControllerDelegate> { > WebKit::SystemPreviewController* _previewController; >+ WebCore::IntRect _linkRect; > }; > @end > > @implementation _WKPreviewControllerDelegate > >-- (id)initWithSystemPreviewController:(WebKit::SystemPreviewController*)previewController >+- (id)initWithSystemPreviewController:(WebKit::SystemPreviewController*)previewController fromRect:(WebCore::IntRect)rect > { > if (!(self = [super init])) > return nil; > > _previewController = previewController; >+ _linkRect = rect; > return self; > } > >@@ -131,35 +133,57 @@ SOFT_LINK_CLASS(QuickLook, QLItem); > _previewController->cancel(); > } > >-- (CGRect)previewController:(QLPreviewController *)controller frameForPreviewItem:(id <QLPreviewItem>)item inSourceView:(UIView * *)view >+- (UIViewController *)presentingViewController > { > if (!_previewController) >- return CGRectZero; >+ return nil; > >- UIViewController *presentingViewController = _previewController->page().uiClient().presentingViewController(); >+ return _previewController->page().uiClient().presentingViewController(); >+} >+ >+- (CGRect)previewController:(QLPreviewController *)controller frameForPreviewItem:(id <QLPreviewItem>)item inSourceView:(UIView * *)view >+{ >+ UIViewController *presentingViewController = [self presentingViewController]; > > if (!presentingViewController) > return CGRectZero; > > *view = presentingViewController.view; >- CGRect frame = presentingViewController.view.frame; >- // Create a smaller rectangle centered in the frame. >- CGFloat halfWidth = frame.size.width / 2; >- CGFloat halfHeight = frame.size.height / 2; >- frame = CGRectMake(CGRectGetMidX(frame) - halfWidth / 2, CGRectGetMidY(frame) - halfHeight / 2, halfWidth, halfHeight); >- return frame; >+ >+ if (_linkRect.isEmpty()) { >+ CGRect frame; >+ frame.size.width = presentingViewController.view.frame.size.width / 2.0; >+ frame.size.height = presentingViewController.view.frame.size.height / 2.0; >+ frame.origin.x = (presentingViewController.view.frame.size.width - frame.size.width) / 2.0; >+ frame.origin.y = (presentingViewController.view.frame.size.height - frame.size.height) / 2.0; >+ return frame; >+ } >+ >+ return _previewController->page().syncRootViewToScreen(_linkRect); > } > > - (UIImage *)previewController:(QLPreviewController *)controller transitionImageForPreviewItem:(id <QLPreviewItem>)item contentRect:(CGRect *)contentRect > { >- return nil; >+ *contentRect = CGRectZero; >+ >+ UIViewController *presentingViewController = [self presentingViewController]; >+ if (presentingViewController) { >+ if (_linkRect.isEmpty()) >+ *contentRect = {CGPointZero, {presentingViewController.view.frame.size.width / 2.0, presentingViewController.view.frame.size.height / 2.0}}; >+ else { >+ WebCore::IntRect screenRect = _previewController->page().syncRootViewToScreen(_linkRect); >+ *contentRect = { CGPointZero, { static_cast<CGFloat>(screenRect.width()), static_cast<CGFloat>(screenRect.height()) } }; >+ } >+ } >+ >+ return [UIImage new]; > } > > @end > > namespace WebKit { > >-void SystemPreviewController::start(const String& mimeType) >+void SystemPreviewController::start(const String& mimeType, const WebCore::IntRect& fromRect) > { > ASSERT(!m_qlPreviewController); > if (m_qlPreviewController) >@@ -172,7 +196,7 @@ void SystemPreviewController::start(const String& mimeType) > > m_qlPreviewController = adoptNS([allocQLPreviewControllerInstance() init]); > >- m_qlPreviewControllerDelegate = adoptNS([[_WKPreviewControllerDelegate alloc] initWithSystemPreviewController:this]); >+ m_qlPreviewControllerDelegate = adoptNS([[_WKPreviewControllerDelegate alloc] initWithSystemPreviewController:this fromRect:fromRect]); > [m_qlPreviewController setDelegate:m_qlPreviewControllerDelegate.get()]; > > m_qlPreviewControllerDataSource = adoptNS([[_WKPreviewControllerDataSource alloc] initWithMIMEType:mimeType]); >diff --git a/Source/WebKit/UIProcess/Downloads/DownloadProxy.h b/Source/WebKit/UIProcess/Downloads/DownloadProxy.h >index 903bc5634b74f5199a34f16212f7f4cefe7f64e7..e07aac8960381561a72ca54b75573927985e340c 100644 >--- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.h >+++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.h >@@ -41,6 +41,7 @@ class Data; > > namespace WebCore { > class AuthenticationChallenge; >+class IntRect; > class ProtectionSpace; > class ResourceError; > class ResourceResponse; >@@ -91,6 +92,7 @@ public: > > #if USE(SYSTEM_PREVIEW) > bool isSystemPreviewDownload() const { return request().isSystemPreview(); } >+ const WebCore::IntRect& systemPreviewDownloadRect() const { return request().systemPreviewRect(); } > #endif > > private: >diff --git a/Source/WebKit/UIProcess/SystemPreviewController.h b/Source/WebKit/UIProcess/SystemPreviewController.h >index 804b228bcc2141583408ad6918650e99940241c6..b8a68499f4909035bd696ed43fa299b0c0dce293 100644 >--- a/Source/WebKit/UIProcess/SystemPreviewController.h >+++ b/Source/WebKit/UIProcess/SystemPreviewController.h >@@ -27,6 +27,7 @@ > > #if USE(SYSTEM_PREVIEW) > >+#include <WebCore/IntRect.h> > #include <WebCore/URL.h> > #include <wtf/RetainPtr.h> > >@@ -46,7 +47,7 @@ public: > > bool canPreview(const String& mimeType) const; > >- void start(const String& mimeType); >+ void start(const String& mimeType, const WebCore::IntRect&); > void updateProgress(float); > void finish(WebCore::URL); > void cancel(); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 9b568259d43a9f1a63531920c65d5e4a80e657ed..4caae28910bfbc2f8ae0a5a4cd9335f0297a9707 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -3973,7 +3973,11 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const Secur > > uint64_t newNavigationID = navigation->navigationID(); > navigation->setWasUserInitiated(!!navigationActionData.userGestureTokenIdentifier); >+#if USE(SYSTEM_PREVIEW) > navigation->setShouldForceDownload(!navigationActionData.downloadAttribute.isNull() || request.isSystemPreview()); >+#else >+ navigation->setShouldForceDownload(!navigationActionData.downloadAttribute.isNull()); >+#endif > navigation->setCurrentRequest(ResourceRequest(request), m_process->coreProcessIdentifier()); > navigation->setCurrentRequestIsRedirect(navigationActionData.isRedirect); > navigation->setTreatAsSameOriginNavigation(navigationActionData.treatAsSameOriginNavigation); >@@ -4439,7 +4443,12 @@ void WebPageProxy::rootViewToScreen(const IntRect& viewRect, Ref<Messages::WebPa > { > reply->send(m_pageClient.rootViewToScreen(viewRect)); > } >- >+ >+IntRect WebPageProxy::syncRootViewToScreen(const IntRect& viewRect) >+{ >+ return m_pageClient.rootViewToScreen(viewRect); >+} >+ > #if PLATFORM(IOS) > void WebPageProxy::accessibilityScreenToRootView(const IntPoint& screenPoint, IntPoint& windowPoint) > { >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index f59d58d5173ef662cc74c4912b385c294a968356..392085dde5ed1e71c1ae53f4167da0e0319ec793 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1309,6 +1309,8 @@ public: > SuspendedPageProxy* suspendedPage() const { return m_suspendedPage.get(); } > void suspendedPageClosed(SuspendedPageProxy&); > >+ WebCore::IntRect syncRootViewToScreen(const WebCore::IntRect& viewRect); >+ > private: > WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&); > void platformInitialize();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
jonlee
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185883
:
341018
|
341031
| 341033