Changeset 232090 in webkit
- Timestamp:
- May 22, 2018 4:56:01 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r232088 r232090 1 2018-05-22 Dean Jackson <dino@apple.com> 2 3 Optimized path zoom animation needs a valid UIImage and CGRect 4 https://bugs.webkit.org/show_bug.cgi?id=185883 5 <rdar://problem/40306056> 6 7 Reviewed by Jon Lee. 8 9 Pass the bounding box of the element that was clicked onto 10 the UI process, so it can perform an animation from that spot. 11 12 This involved adding an IntRect to the ResourceRequest, and passing 13 that info into it from the HTMLAnchorElement, using a new struct 14 called SystemPreviewInfo. 15 16 * html/HTMLAnchorElement.cpp: 17 (WebCore::HTMLAnchorElement::handleClick): 18 * loader/FrameLoadRequest.cpp: 19 (WebCore::FrameLoadRequest::FrameLoadRequest): 20 * loader/FrameLoadRequest.h: 21 (WebCore::FrameLoadRequest::FrameLoadRequest): 22 (WebCore::FrameLoadRequest::isSystemPreview const): 23 (WebCore::FrameLoadRequest::systemPreviewRect const): 24 * loader/FrameLoader.cpp: 25 (WebCore::FrameLoader::urlSelected): 26 (WebCore::FrameLoader::loadURL): 27 * loader/FrameLoader.h: 28 (WebCore::FrameLoader::urlSelected): 29 * loader/FrameLoaderTypes.h: 30 * platform/network/ResourceRequestBase.cpp: 31 (WebCore::ResourceRequestBase::systemPreviewRect const): 32 (WebCore::ResourceRequestBase::setSystemPreviewRect): 33 * platform/network/ResourceRequestBase.h: 34 1 35 2018-05-22 Chris Dumez <cdumez@apple.com> 2 36 -
trunk/Source/WebCore/html/HTMLAnchorElement.cpp
r231795 r232090 418 418 #endif 419 419 420 bool isSystemPreview = false;420 SystemPreviewInfo systemPreviewInfo; 421 421 #if USE(SYSTEM_PREVIEW) 422 isSystemPreview = isSystemPreviewLink(); 422 systemPreviewInfo.isSystemPreview = isSystemPreviewLink(); 423 424 if (systemPreviewInfo.isSystemPreview) { 425 if (auto* child = firstElementChild()) 426 systemPreviewInfo.systemPreviewRect = child->boundsInRootViewSpace(); 427 } 423 428 #endif 424 429 425 430 ShouldSendReferrer shouldSendReferrer = hasRel(Relation::NoReferrer) ? NeverSendReferrer : MaybeSendReferrer; 426 431 auto newFrameOpenerPolicy = hasRel(Relation::NoOpener) ? std::make_optional(NewFrameOpenerPolicy::Suppress) : std::nullopt; 427 frame->loader().urlSelected(completedURL, target(), &event, LockHistory::No, LockBackForwardList::No, shouldSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate(), newFrameOpenerPolicy, downloadAttribute, isSystemPreview);432 frame->loader().urlSelected(completedURL, target(), &event, LockHistory::No, LockBackForwardList::No, shouldSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate(), newFrameOpenerPolicy, downloadAttribute, systemPreviewInfo); 428 433 429 434 sendPings(completedURL); -
trunk/Source/WebCore/loader/FrameLoadRequest.cpp
r231507 r232090 38 38 namespace WebCore { 39 39 40 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)40 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) 41 41 : m_requester { makeRef(requester) } 42 42 , m_requesterSecurityOrigin { makeRef(requesterSecurityOrigin) } … … 52 52 , m_downloadAttribute { downloadAttribute } 53 53 , m_initiatedByMainFrame { initiatedByMainFrame } 54 , m_ isSystemPreview { isSystemPreview}54 , m_systemPreviewInfo { systemPreviewInfo } 55 55 { 56 56 } -
trunk/Source/WebCore/loader/FrameLoadRequest.h
r231507 r232090 39 39 class FrameLoadRequest { 40 40 public: 41 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);41 WEBCORE_EXPORT FrameLoadRequest(Document&, SecurityOrigin&, const ResourceRequest&, const String& frameName, LockHistory, LockBackForwardList, ShouldSendReferrer, AllowNavigationToInvalidURL, NewFrameOpenerPolicy, ShouldOpenExternalURLsPolicy, InitiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL, const AtomicString& downloadAttribute = { }, const SystemPreviewInfo& = { }); 42 42 WEBCORE_EXPORT FrameLoadRequest(Frame&, const ResourceRequest&, ShouldOpenExternalURLsPolicy, const SubstituteData& = SubstituteData()); 43 43 … … 88 88 bool isCrossOriginWindowOpenNavigation() const { return m_isCrossOriginWindowOpenNavigation; } 89 89 90 bool isSystemPreview() const { return m_isSystemPreview; } 90 bool isSystemPreview() const { return m_systemPreviewInfo.isSystemPreview; } 91 const IntRect& systemPreviewRect() const { return m_systemPreviewInfo.systemPreviewRect; } 91 92 92 93 private: … … 110 111 bool m_isCrossOriginWindowOpenNavigation { false }; 111 112 bool m_isSystemPreview { false }; 113 SystemPreviewInfo m_systemPreviewInfo; 112 114 }; 113 115 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r232081 r232090 371 371 } 372 372 373 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)373 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) 374 374 { 375 375 auto* frame = lexicalFrameFromCommonVM(); … … 377 377 378 378 NewFrameOpenerPolicy newFrameOpenerPolicy = openerPolicy.value_or(shouldSendReferrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerPolicy::Allow); 379 urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securityOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute, isSystemPreview), triggeringEvent);379 urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securityOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute, systemPreviewInfo), triggeringEvent); 380 380 } 381 381 … … 1367 1367 // Must grab this now, since this load may stop the previous load and clear this flag. 1368 1368 bool isRedirect = m_quickRedirectComing; 1369 request.setSystemPreview(frameLoadRequest.isSystemPreview()); 1369 #if USE(SYSTEM_PREVIEW) 1370 bool isSystemPreview = frameLoadRequest.isSystemPreview(); 1371 request.setSystemPreview(isSystemPreview); 1372 if (isSystemPreview) 1373 request.setSystemPreviewRect(frameLoadRequest.systemPreviewRect()); 1374 #endif 1370 1375 loadWithNavigationAction(request, action, lockHistory, newLoadType, formState, allowNavigationToInvalidURL, [this, isRedirect, sameURL, newLoadType, protectedFrame = makeRef(m_frame), completionHandler = completionHandlerCaller.release()] { 1371 1376 if (isRedirect) { -
trunk/Source/WebCore/loader/FrameLoader.h
r231507 r232090 122 122 123 123 void changeLocation(FrameLoadRequest&&); 124 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);124 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& = { }); 125 125 void submitForm(Ref<FormSubmission>&&); 126 126 -
trunk/Source/WebCore/loader/FrameLoaderTypes.h
r229926 r232090 28 28 29 29 #pragma once 30 31 #include "IntRect.h" 30 32 31 33 namespace WebCore { … … 148 150 }; 149 151 152 153 struct SystemPreviewInfo { 154 IntRect systemPreviewRect; 155 bool isSystemPreview { false }; 156 }; 157 150 158 } // namespace WebCore 151 159 -
trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp
r231507 r232090 577 577 } 578 578 579 #if USE(SYSTEM_PREVIEW) 579 580 bool ResourceRequestBase::isSystemPreview() const 580 581 { … … 586 587 m_isSystemPreview = s; 587 588 } 589 590 const IntRect& ResourceRequestBase::systemPreviewRect() const 591 { 592 return m_systemPreviewRect; 593 } 594 595 void ResourceRequestBase::setSystemPreviewRect(const IntRect& rect) 596 { 597 m_systemPreviewRect = rect; 598 } 599 #endif 588 600 589 601 bool equalIgnoringHeaderFields(const ResourceRequestBase& a, const ResourceRequestBase& b) -
trunk/Source/WebCore/platform/network/ResourceRequestBase.h
r232032 r232090 31 31 #include "FormData.h" 32 32 #include "HTTPHeaderMap.h" 33 #include "IntRect.h" 33 34 #include "URL.h" 34 35 #include "ResourceLoadPriority.h" … … 172 173 void setInitiatorIdentifier(const String& identifier) { m_initiatorIdentifier = identifier; } 173 174 175 #if USE(SYSTEM_PREVIEW) 174 176 WEBCORE_EXPORT bool isSystemPreview() const; 175 177 WEBCORE_EXPORT void setSystemPreview(bool); 178 179 WEBCORE_EXPORT const IntRect& systemPreviewRect() const; 180 WEBCORE_EXPORT void setSystemPreviewRect(const IntRect&); 181 #endif 176 182 177 183 #if !PLATFORM(COCOA) … … 234 240 String m_initiatorIdentifier; 235 241 String m_cachePartition { emptyString() }; 242 #if USE(SYSTEM_PREVIEW) 236 243 bool m_isSystemPreview { false }; 244 IntRect m_systemPreviewRect; 245 #endif 237 246 238 247 private: -
trunk/Source/WebKit/ChangeLog
r232083 r232090 1 2018-05-22 Dean Jackson <dino@apple.com> 2 3 Optimized path zoom animation needs a valid UIImage and CGRect 4 https://bugs.webkit.org/show_bug.cgi?id=185883 5 <rdar://problem/40306056> 6 7 Reviewed by Jon Lee. 8 9 Take the rectangle that was passed into the ResourceRequest and 10 use it for the origin of an animation into QuickLook. 11 12 * Shared/WebCoreArgumentCoders.cpp: 13 (IPC::ArgumentCoder<ResourceRequest>::encode): 14 (IPC::ArgumentCoder<ResourceRequest>::decode): 15 * UIProcess/Cocoa/DownloadClient.mm: 16 (WebKit::DownloadClient::didStart): 17 * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: 18 (-[_WKPreviewControllerDelegate initWithSystemPreviewController:fromRect:]): 19 (-[_WKPreviewControllerDelegate presentingViewController]): 20 (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]): 21 (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]): 22 (WebKit::SystemPreviewController::start): 23 (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]): Deleted. 24 * UIProcess/Downloads/DownloadProxy.h: 25 (WebKit::DownloadProxy::systemPreviewDownloadRect const): 26 * UIProcess/SystemPreviewController.h: 27 * UIProcess/WebPageProxy.cpp: 28 (WebKit::WebPageProxy::syncRootViewToScreen): 29 * UIProcess/WebPageProxy.h: 30 1 31 2018-05-22 Sihui Liu <sihui_liu@apple.com> 2 32 -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r231507 r232090 1238 1238 encoder << resourceRequest.cachePartition(); 1239 1239 encoder << resourceRequest.hiddenFromInspector(); 1240 encoder << resourceRequest.isSystemPreview(); 1240 1241 #if USE(SYSTEM_PREVIEW) 1242 if (resourceRequest.isSystemPreview()) { 1243 encoder << true; 1244 encoder << resourceRequest.systemPreviewRect(); 1245 } else 1246 encoder << false; 1247 #endif 1241 1248 1242 1249 if (resourceRequest.encodingRequiresPlatformData()) { … … 1261 1268 resourceRequest.setHiddenFromInspector(isHiddenFromInspector); 1262 1269 1270 #if USE(SYSTEM_PREVIEW) 1263 1271 bool isSystemPreview; 1264 1272 if (!decoder.decode(isSystemPreview)) 1265 1273 return false; 1266 1274 resourceRequest.setSystemPreview(isSystemPreview); 1275 1276 if (isSystemPreview) { 1277 IntRect systemPreviewRect; 1278 if (!decoder.decode(systemPreviewRect)) 1279 return false; 1280 resourceRequest.setSystemPreviewRect(systemPreviewRect); 1281 } 1282 #endif 1267 1283 1268 1284 bool hasPlatformData; -
trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm
r231825 r232090 79 79 if (auto* webPage = downloadProxy.originatingPage()) { 80 80 // FIXME: Update the MIME-type once it is known in the ResourceResponse. 81 webPage->systemPreviewController()->start(ASCIILiteral { "application/octet-stream" } );81 webPage->systemPreviewController()->start(ASCIILiteral { "application/octet-stream" }, downloadProxy.systemPreviewDownloadRect()); 82 82 } 83 83 takeActivityToken(downloadProxy); -
trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm
r232082 r232090 112 112 @interface _WKPreviewControllerDelegate : NSObject <QLPreviewControllerDelegate> { 113 113 WebKit::SystemPreviewController* _previewController; 114 WebCore::IntRect _linkRect; 114 115 }; 115 116 @end … … 117 118 @implementation _WKPreviewControllerDelegate 118 119 119 - (id)initWithSystemPreviewController:(WebKit::SystemPreviewController*)previewController 120 - (id)initWithSystemPreviewController:(WebKit::SystemPreviewController*)previewController fromRect:(WebCore::IntRect)rect 120 121 { 121 122 if (!(self = [super init])) … … 123 124 124 125 _previewController = previewController; 126 _linkRect = rect; 125 127 return self; 126 128 } … … 132 134 } 133 135 136 - (UIViewController *)presentingViewController 137 { 138 if (!_previewController) 139 return nil; 140 141 return _previewController->page().uiClient().presentingViewController(); 142 } 143 134 144 - (CGRect)previewController:(QLPreviewController *)controller frameForPreviewItem:(id <QLPreviewItem>)item inSourceView:(UIView * *)view 135 145 { 136 if (!_previewController) 137 return CGRectZero; 138 139 UIViewController *presentingViewController = _previewController->page().uiClient().presentingViewController(); 146 UIViewController *presentingViewController = [self presentingViewController]; 140 147 141 148 if (!presentingViewController) … … 143 150 144 151 *view = presentingViewController.view; 145 CGRect frame = presentingViewController.view.frame; 146 // Create a smaller rectangle centered in the frame. 147 CGFloat halfWidth = frame.size.width / 2; 148 CGFloat halfHeight = frame.size.height / 2; 149 frame = CGRectMake(CGRectGetMidX(frame) - halfWidth / 2, CGRectGetMidY(frame) - halfHeight / 2, halfWidth, halfHeight); 150 return frame; 152 153 if (_linkRect.isEmpty()) { 154 CGRect frame; 155 frame.size.width = presentingViewController.view.frame.size.width / 2.0; 156 frame.size.height = presentingViewController.view.frame.size.height / 2.0; 157 frame.origin.x = (presentingViewController.view.frame.size.width - frame.size.width) / 2.0; 158 frame.origin.y = (presentingViewController.view.frame.size.height - frame.size.height) / 2.0; 159 return frame; 160 } 161 162 return _previewController->page().syncRootViewToScreen(_linkRect); 151 163 } 152 164 153 165 - (UIImage *)previewController:(QLPreviewController *)controller transitionImageForPreviewItem:(id <QLPreviewItem>)item contentRect:(CGRect *)contentRect 154 166 { 155 return nil; 167 *contentRect = CGRectZero; 168 169 UIViewController *presentingViewController = [self presentingViewController]; 170 if (presentingViewController) { 171 if (_linkRect.isEmpty()) 172 *contentRect = {CGPointZero, {presentingViewController.view.frame.size.width / 2.0, presentingViewController.view.frame.size.height / 2.0}}; 173 else { 174 WebCore::IntRect screenRect = _previewController->page().syncRootViewToScreen(_linkRect); 175 *contentRect = { CGPointZero, { static_cast<CGFloat>(screenRect.width()), static_cast<CGFloat>(screenRect.height()) } }; 176 } 177 } 178 179 return [UIImage new]; 156 180 } 157 181 … … 160 184 namespace WebKit { 161 185 162 void SystemPreviewController::start(const String& mimeType )186 void SystemPreviewController::start(const String& mimeType, const WebCore::IntRect& fromRect) 163 187 { 164 188 ASSERT(!m_qlPreviewController); … … 173 197 m_qlPreviewController = adoptNS([allocQLPreviewControllerInstance() init]); 174 198 175 m_qlPreviewControllerDelegate = adoptNS([[_WKPreviewControllerDelegate alloc] initWithSystemPreviewController:this ]);199 m_qlPreviewControllerDelegate = adoptNS([[_WKPreviewControllerDelegate alloc] initWithSystemPreviewController:this fromRect:fromRect]); 176 200 [m_qlPreviewController setDelegate:m_qlPreviewControllerDelegate.get()]; 177 201 -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.h
r231795 r232090 42 42 namespace WebCore { 43 43 class AuthenticationChallenge; 44 class IntRect; 44 45 class ProtectionSpace; 45 46 class ResourceError; … … 92 93 #if USE(SYSTEM_PREVIEW) 93 94 bool isSystemPreviewDownload() const { return request().isSystemPreview(); } 95 const WebCore::IntRect& systemPreviewDownloadRect() const { return request().systemPreviewRect(); } 94 96 #endif 95 97 -
trunk/Source/WebKit/UIProcess/SystemPreviewController.h
r231797 r232090 28 28 #if USE(SYSTEM_PREVIEW) 29 29 30 #include <WebCore/IntRect.h> 30 31 #include <WebCore/URL.h> 31 32 #include <wtf/RetainPtr.h> … … 47 48 bool canPreview(const String& mimeType) const; 48 49 49 void start(const String& mimeType );50 void start(const String& mimeType, const WebCore::IntRect&); 50 51 void updateProgress(float); 51 52 void finish(WebCore::URL); -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r231931 r232090 3995 3995 uint64_t newNavigationID = navigation->navigationID(); 3996 3996 navigation->setWasUserInitiated(!!navigationActionData.userGestureTokenIdentifier); 3997 #if USE(SYSTEM_PREVIEW) 3997 3998 navigation->setShouldForceDownload(!navigationActionData.downloadAttribute.isNull() || request.isSystemPreview()); 3999 #else 4000 navigation->setShouldForceDownload(!navigationActionData.downloadAttribute.isNull()); 4001 #endif 3998 4002 navigation->setCurrentRequest(ResourceRequest(request), m_process->coreProcessIdentifier()); 3999 4003 navigation->setCurrentRequestIsRedirect(navigationActionData.isRedirect); … … 4451 4455 reply(m_pageClient.rootViewToScreen(viewRect)); 4452 4456 } 4453 4457 4458 IntRect WebPageProxy::syncRootViewToScreen(const IntRect& viewRect) 4459 { 4460 return m_pageClient.rootViewToScreen(viewRect); 4461 } 4462 4454 4463 #if PLATFORM(IOS) 4455 4464 void WebPageProxy::accessibilityScreenToRootView(const IntPoint& screenPoint, IntPoint& windowPoint) -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r231931 r232090 1312 1312 void setDefersLoadingForTesting(bool); 1313 1313 1314 WebCore::IntRect syncRootViewToScreen(const WebCore::IntRect& viewRect); 1315 1314 1316 private: 1315 1317 WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
Note: See TracChangeset
for help on using the changeset viewer.