Changeset 286812 in webkit
- Timestamp:
- Dec 9, 2021, 3:25:50 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/mac/ImageControlsMac.cpp (modified) (1 diff)
-
WebCore/page/ChromeClient.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/ContextMenuContextData.cpp (modified) (3 diffs)
-
WebKit/Shared/ContextMenuContextData.h (modified) (3 diffs)
-
WebKit/UIProcess/mac/WKSharingServicePickerDelegate.h (modified) (2 diffs)
-
WebKit/UIProcess/mac/WKSharingServicePickerDelegate.mm (modified) (2 diffs)
-
WebKit/UIProcess/mac/WebContextMenuProxyMac.mm (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
WebKit/WebProcess/WebPage/WebPage.h (modified) (1 diff)
-
WebKit/WebProcess/WebPage/mac/WebPageMac.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286811 r286812 1 2021-12-09 Megan Gardner <megan_gardner@apple.com> 2 3 Markup Pane not displaying. 4 https://bugs.webkit.org/show_bug.cgi?id=234089 5 6 Reviewed by Tim Horton. 7 8 Vend the image location so that the Markup Pane knows where to 9 present from. 10 11 * dom/mac/ImageControlsMac.cpp: 12 (WebCore::ImageControlsMac::handleEvent): 13 * page/ChromeClient.h: 14 (WebCore::ChromeClient::handleImageServiceClick): 15 1 16 2021-12-09 Tyler Wilcock <tyler_w@apple.com> 2 17 -
trunk/Source/WebCore/dom/mac/ImageControlsMac.cpp
r286762 r286812 131 131 return false; 132 132 if (auto* image = imageFromImageElementNode(*imageElement)) { 133 page->chrome().client().handleImageServiceClick(roundedIntPoint(mouseEvent.absoluteLocation()), *image, imageElement->isContentEditable() );133 page->chrome().client().handleImageServiceClick(roundedIntPoint(mouseEvent.absoluteLocation()), *image, imageElement->isContentEditable(), imageElement->renderBox()->absoluteContentQuad().enclosingBoundingBox()); 134 134 event.setDefaultHandled(); 135 135 return true; -
trunk/Source/WebCore/page/ChromeClient.h
r286762 r286812 533 533 virtual void handleSelectionServiceClick(FrameSelection&, const Vector<String>&, const IntPoint&) { } 534 534 virtual bool hasRelevantSelectionServices(bool /*isTextOnly*/) const { return false; } 535 virtual void handleImageServiceClick(const IntPoint&, Image&, bool /*isEditable*/ ) { }535 virtual void handleImageServiceClick(const IntPoint&, Image&, bool /*isEditable*/, const IntRect&) { } 536 536 #endif 537 537 -
trunk/Source/WebKit/ChangeLog
r286805 r286812 1 2021-12-09 Megan Gardner <megan_gardner@apple.com> 2 3 Markup Pane not displaying. 4 https://bugs.webkit.org/show_bug.cgi?id=234089 5 6 Reviewed by Tim Horton. 7 8 An optional method on NSSharingServiceDelegate was not implemented, meaning 9 that the markup pane did not know where to present, and would assert and fail to 10 show up. Make sure this is implemented for the image controls menu and also 11 give it the correct location to present form. 12 13 * Shared/ContextMenuContextData.cpp: 14 (WebKit::ContextMenuContextData::ContextMenuContextData): 15 (WebKit::ContextMenuContextData::encode const): 16 (WebKit::ContextMenuContextData::decode): 17 * Shared/ContextMenuContextData.h: 18 (WebKit::ContextMenuContextData::controlledImageFrame const): 19 * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: 20 (-[WKWebViewConfiguration init]): 21 * UIProcess/mac/WKSharingServicePickerDelegate.h: 22 * UIProcess/mac/WKSharingServicePickerDelegate.mm: 23 (-[WKSharingServicePickerDelegate setSourceFrame:]): 24 (-[WKSharingServicePickerDelegate sharingService:sourceFrameOnScreenForShareItem:]): 25 * UIProcess/mac/WebContextMenuProxyMac.mm: 26 (WebKit::WebContextMenuProxyMac::setupServicesMenu): 27 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 28 (WebKit::WebChromeClient::handleImageServiceClick): 29 * WebProcess/WebCoreSupport/WebChromeClient.h: 30 * WebProcess/WebPage/WebPage.h: 31 * WebProcess/WebPage/mac/WebPageMac.mm: 32 (WebKit::WebPage::handleImageServiceClick): 33 1 34 2021-12-09 Tim Horton <timothy_horton@apple.com> 2 35 -
trunk/Source/WebKit/Shared/ContextMenuContextData.cpp
r286762 r286812 68 68 69 69 #if ENABLE(SERVICE_CONTROLS) 70 ContextMenuContextData::ContextMenuContextData(const WebCore::IntPoint& menuLocation, WebCore::Image& image, bool isEditable )70 ContextMenuContextData::ContextMenuContextData(const WebCore::IntPoint& menuLocation, WebCore::Image& image, bool isEditable, const WebCore::IntRect& imageRect) 71 71 : m_type(Type::ServicesMenu) 72 72 , m_menuLocation(menuLocation) 73 73 , m_selectionIsEditable(isEditable) 74 , m_controlledImageBounds(imageRect) 74 75 { 75 76 setImage(&image); … … 103 104 encoder << m_selectedTelephoneNumbers; 104 105 encoder << m_selectionIsEditable; 106 encoder << m_controlledImageBounds; 105 107 #endif 106 108 } … … 137 139 if (!decoder.decode(result.m_selectionIsEditable)) 138 140 return false; 141 if (!decoder.decode(result.m_controlledImageBounds)) 142 return false; 139 143 #endif 140 144 -
trunk/Source/WebKit/Shared/ContextMenuContextData.h
r286762 r286812 65 65 } 66 66 67 ContextMenuContextData(const WebCore::IntPoint& menuLocation, WebCore::Image&, bool isEditable );67 ContextMenuContextData(const WebCore::IntPoint& menuLocation, WebCore::Image&, bool isEditable, const WebCore::IntRect& imageRect); 68 68 69 69 ShareableBitmap* controlledImage() const { return m_controlledImage.get(); } … … 73 73 bool isServicesMenu() const { return m_type == ContextMenuContextData::Type::ServicesMenu; } 74 74 bool controlledDataIsEditable() const; 75 WebCore::IntRect controlledImageBounds() const { return m_controlledImageBounds; }; 75 76 #endif 76 77 … … 94 95 Vector<String> m_selectedTelephoneNumbers; 95 96 bool m_selectionIsEditable; 97 WebCore::IntRect m_controlledImageBounds; 96 98 #endif 97 99 }; -
trunk/Source/WebKit/UIProcess/mac/WKSharingServicePickerDelegate.h
r260366 r286812 39 39 BOOL _filterEditingServices; 40 40 BOOL _handleEditingReplacement; 41 NSRect _sourceFrame; 41 42 } 42 43 … … 47 48 - (void)setFiltersEditingServices:(BOOL)filtersEditingServices; 48 49 - (void)setHandlesEditingReplacement:(BOOL)handlesEditingReplacement; 50 - (void)setSourceFrame:(NSRect)sourceFrame; 51 49 52 @end 50 53 -
trunk/Source/WebKit/UIProcess/mac/WKSharingServicePickerDelegate.mm
r266607 r286812 71 71 } 72 72 73 - (void)setSourceFrame:(NSRect)sourceFrame 74 { 75 _sourceFrame = sourceFrame; 76 } 77 73 78 - (NSArray *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items mask:(NSSharingServiceMask)mask proposedSharingServices:(NSArray *)proposedServices 74 79 { … … 89 94 { 90 95 return self; 96 } 97 98 - (NSRect)sharingService:(NSSharingService *)sharingService sourceFrameOnScreenForShareItem:(id <NSPasteboardWriting>)item 99 { 100 return _sourceFrame; 91 101 } 92 102 -
trunk/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm
r286762 r286812 239 239 [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setFiltersEditingServices:!includeEditorServices]; 240 240 [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setHandlesEditingReplacement:includeEditorServices]; 241 242 NSRect imageRect = m_context.controlledImageBounds(); 243 imageRect = [m_webView convertRect:imageRect toView:nil]; 244 imageRect = [[m_webView window] convertRectToScreen:imageRect]; 245 [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setSourceFrame:imageRect]; 241 246 242 247 m_menu = adoptNS([[picker menu] copy]); -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r286762 r286812 1348 1348 } 1349 1349 1350 void WebChromeClient::handleImageServiceClick(const IntPoint& point, Image& image, bool isEditable )1351 { 1352 m_page.handleImageServiceClick(point, image, isEditable );1350 void WebChromeClient::handleImageServiceClick(const IntPoint& point, Image& image, bool isEditable, const IntRect& imageRect) 1351 { 1352 m_page.handleImageServiceClick(point, image, isEditable, imageRect); 1353 1353 } 1354 1354 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r286762 r286812 382 382 void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&) final; 383 383 bool hasRelevantSelectionServices(bool isTextOnly) const final; 384 void handleImageServiceClick(const WebCore::IntPoint&, WebCore::Image&, bool isEditable ) final;384 void handleImageServiceClick(const WebCore::IntPoint&, WebCore::Image&, bool isEditable, const WebCore::IntRect&) final; 385 385 #endif 386 386 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r286767 r286812 1204 1204 void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&); 1205 1205 void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&); 1206 void handleImageServiceClick(const WebCore::IntPoint&, WebCore::Image&, bool isEditable );1206 void handleImageServiceClick(const WebCore::IntPoint&, WebCore::Image&, bool isEditable, const WebCore::IntRect&); 1207 1207 #endif 1208 1208 -
trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
r286762 r286812 829 829 } 830 830 831 void WebPage::handleImageServiceClick(const IntPoint& point, Image& image, bool isEditable )832 { 833 send(Messages::WebPageProxy::ShowContextMenu(ContextMenuContextData(point, image, isEditable ), UserData()));831 void WebPage::handleImageServiceClick(const IntPoint& point, Image& image, bool isEditable, const IntRect& imageRect) 832 { 833 send(Messages::WebPageProxy::ShowContextMenu(ContextMenuContextData(point, image, isEditable, imageRect), UserData())); 834 834 } 835 835
Note:
See TracChangeset
for help on using the changeset viewer.