Changeset 288610 in webkit


Ignore:
Timestamp:
Jan 26, 2022 1:25:24 AM (6 months ago)
Author:
graouts@webkit.org
Message:

[Model] Mouse interaction for <model> is flipped in the y-axis
https://bugs.webkit.org/show_bug.cgi?id=235363
<rdar://problem/87772557>

Reviewed by Dean Jackson.

Source/WebCore:

The mouse coordinates we should send up to the ARQL APIs are in the coordinates
of the <model> element with the y-axis flipped.

  • Modules/model-element/HTMLModelElement.cpp:

(WebCore::HTMLModelElement::flippedLocationInElementForMouseEvent):
(WebCore::HTMLModelElement::dragDidStart):
(WebCore::HTMLModelElement::dragDidChange):
(WebCore::HTMLModelElement::dragDidEnd):

  • Modules/model-element/HTMLModelElement.h:

Source/WebKit:

The mouse coordinates consumed by the ARQL APIs are in the coordinates
of the <model> element with the y-axis flipped, so let's label them
as such.

  • UIProcess/Cocoa/ModelElementControllerCocoa.mm:

(WebKit::ModelElementController::handleMouseDownForModelElement):
(WebKit::ModelElementController::handleMouseMoveForModelElement):
(WebKit::ModelElementController::handleMouseUpForModelElement):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::handleMouseDownForModelElement):
(WebKit::WebPageProxy::handleMouseMoveForModelElement):
(WebKit::WebPageProxy::handleMouseUpForModelElement):

  • UIProcess/WebPageProxy.messages.in:
  • WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm:

(WebKit::ARKitInlinePreviewModelPlayerMac::handleMouseDown):
(WebKit::ARKitInlinePreviewModelPlayerMac::handleMouseMove):
(WebKit::ARKitInlinePreviewModelPlayerMac::handleMouseUp):

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r288605 r288610  
     12022-01-26  Antoine Quint  <graouts@webkit.org>
     2
     3        [Model] Mouse interaction for <model> is flipped in the y-axis
     4        https://bugs.webkit.org/show_bug.cgi?id=235363
     5        <rdar://problem/87772557>
     6
     7        Reviewed by Dean Jackson.
     8
     9        The mouse coordinates we should send up to the ARQL APIs are in the coordinates
     10        of the <model> element with the y-axis flipped.
     11
     12        * Modules/model-element/HTMLModelElement.cpp:
     13        (WebCore::HTMLModelElement::flippedLocationInElementForMouseEvent):
     14        (WebCore::HTMLModelElement::dragDidStart):
     15        (WebCore::HTMLModelElement::dragDidChange):
     16        (WebCore::HTMLModelElement::dragDidEnd):
     17        * Modules/model-element/HTMLModelElement.h:
     18
    1192022-01-25  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp

    r288440 r288610  
    345345}
    346346
     347LayoutPoint HTMLModelElement::flippedLocationInElementForMouseEvent(MouseEvent& event)
     348{
     349    LayoutUnit flippedY { event.offsetY() };
     350    if (auto* renderModel = dynamicDowncast<RenderModel>(renderer()))
     351        flippedY = renderModel->paddingBoxHeight() - flippedY;
     352    return { LayoutUnit(event.offsetX()), flippedY };
     353}
     354
    347355void HTMLModelElement::dragDidStart(MouseEvent& event)
    348356{
     
    358366
    359367    if (m_modelPlayer)
    360         m_modelPlayer->handleMouseDown(event.pageLocation(), event.timeStamp());
     368        m_modelPlayer->handleMouseDown(flippedLocationInElementForMouseEvent(event), event.timeStamp());
    361369}
    362370
     
    368376
    369377    if (m_modelPlayer)
    370         m_modelPlayer->handleMouseMove(event.pageLocation(), event.timeStamp());
     378        m_modelPlayer->handleMouseMove(flippedLocationInElementForMouseEvent(event), event.timeStamp());
    371379}
    372380
     
    384392
    385393    if (m_modelPlayer)
    386         m_modelPlayer->handleMouseUp(event.pageLocation(), event.timeStamp());
     394        m_modelPlayer->handleMouseUp(flippedLocationInElementForMouseEvent(event), event.timeStamp());
    387395}
    388396
  • trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h

    r288424 r288610  
    138138    void dragDidEnd(MouseEvent&);
    139139
     140    LayoutPoint flippedLocationInElementForMouseEvent(MouseEvent&);
     141
    140142    void setAnimationIsPlaying(bool, DOMPromiseDeferred<void>&&);
    141143
  • trunk/Source/WebKit/ChangeLog

    r288609 r288610  
     12022-01-26  Antoine Quint  <graouts@webkit.org>
     2
     3        [Model] Mouse interaction for <model> is flipped in the y-axis
     4        https://bugs.webkit.org/show_bug.cgi?id=235363
     5        <rdar://problem/87772557>
     6
     7        Reviewed by Dean Jackson.
     8
     9        The mouse coordinates consumed by the ARQL APIs are in the coordinates
     10        of the <model> element with the y-axis flipped, so let's label them
     11        as such.
     12
     13        * UIProcess/Cocoa/ModelElementControllerCocoa.mm:
     14        (WebKit::ModelElementController::handleMouseDownForModelElement):
     15        (WebKit::ModelElementController::handleMouseMoveForModelElement):
     16        (WebKit::ModelElementController::handleMouseUpForModelElement):
     17        * UIProcess/WebPageProxy.cpp:
     18        (WebKit::WebPageProxy::handleMouseDownForModelElement):
     19        (WebKit::WebPageProxy::handleMouseMoveForModelElement):
     20        (WebKit::WebPageProxy::handleMouseUpForModelElement):
     21        * UIProcess/WebPageProxy.messages.in:
     22        * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm:
     23        (WebKit::ARKitInlinePreviewModelPlayerMac::handleMouseDown):
     24        (WebKit::ARKitInlinePreviewModelPlayerMac::handleMouseMove):
     25        (WebKit::ARKitInlinePreviewModelPlayerMac::handleMouseUp):
     26
    1272022-01-26  Alexander Mikhaylenko  <alexm@gnome.org>
    228
  • trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm

    r288424 r288610  
    216216}
    217217
    218 void ModelElementController::handleMouseDownForModelElement(const String& uuid, const WebCore::LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
     218void ModelElementController::handleMouseDownForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    219219{
    220220    if (auto preview = previewForUUID(uuid))
    221         [preview mouseDownAtLocation:CGPointMake(locationInPageCoordinates.x().toFloat(), locationInPageCoordinates.y().toFloat()) timestamp:timestamp.secondsSinceEpoch().value()];
    222 }
    223 
    224 void ModelElementController::handleMouseMoveForModelElement(const String& uuid, const WebCore::LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
     221        [preview mouseDownAtLocation:CGPointMake(flippedLocationInElement.x().toFloat(), flippedLocationInElement.y().toFloat()) timestamp:timestamp.secondsSinceEpoch().value()];
     222}
     223
     224void ModelElementController::handleMouseMoveForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    225225{
    226226    if (auto preview = previewForUUID(uuid))
    227         [preview mouseDraggedAtLocation:CGPointMake(locationInPageCoordinates.x().toFloat(), locationInPageCoordinates.y().toFloat()) timestamp:timestamp.secondsSinceEpoch().value()];
    228 }
    229 
    230 void ModelElementController::handleMouseUpForModelElement(const String& uuid, const WebCore::LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
     227        [preview mouseDraggedAtLocation:CGPointMake(flippedLocationInElement.x().toFloat(), flippedLocationInElement.y().toFloat()) timestamp:timestamp.secondsSinceEpoch().value()];
     228}
     229
     230void ModelElementController::handleMouseUpForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    231231{
    232232    if (auto preview = previewForUUID(uuid))
    233         [preview mouseUpAtLocation:CGPointMake(locationInPageCoordinates.x().toFloat(), locationInPageCoordinates.y().toFloat()) timestamp:timestamp.secondsSinceEpoch().value()];
     233        [preview mouseUpAtLocation:CGPointMake(flippedLocationInElement.x().toFloat(), flippedLocationInElement.y().toFloat()) timestamp:timestamp.secondsSinceEpoch().value()];
    234234}
    235235
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r288605 r288610  
    1101211012}
    1101311013
    11014 void WebPageProxy::handleMouseDownForModelElement(const String& uuid, const WebCore::LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
    11015 {
    11016     modelElementController()->handleMouseDownForModelElement(uuid, locationInPageCoordinates, timestamp);
    11017 }
    11018 
    11019 void WebPageProxy::handleMouseMoveForModelElement(const String& uuid, const WebCore::LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
    11020 {
    11021     modelElementController()->handleMouseMoveForModelElement(uuid, locationInPageCoordinates, timestamp);
    11022 }
    11023 
    11024 void WebPageProxy::handleMouseUpForModelElement(const String& uuid, const WebCore::LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
    11025 {
    11026     modelElementController()->handleMouseUpForModelElement(uuid, locationInPageCoordinates, timestamp);
     11014void WebPageProxy::handleMouseDownForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
     11015{
     11016    modelElementController()->handleMouseDownForModelElement(uuid, flippedLocationInElement, timestamp);
     11017}
     11018
     11019void WebPageProxy::handleMouseMoveForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
     11020{
     11021    modelElementController()->handleMouseMoveForModelElement(uuid, flippedLocationInElement, timestamp);
     11022}
     11023
     11024void WebPageProxy::handleMouseUpForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
     11025{
     11026    modelElementController()->handleMouseUpForModelElement(uuid, flippedLocationInElement, timestamp);
    1102711027}
    1102811028#endif
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r288104 r288610  
    589589#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
    590590    ModelElementDidCreatePreview(URL url, String uuid, WebCore::FloatSize size) -> (Expected<std::pair<String, uint32_t>, WebCore::ResourceError> result) Async
    591     HandleMouseDownForModelElement(String uuid, WebCore::LayoutPoint locationInPageCoordinates, MonotonicTime timestamp)
    592     HandleMouseMoveForModelElement(String uuid, WebCore::LayoutPoint locationInPageCoordinates, MonotonicTime timestamp)
    593     HandleMouseUpForModelElement(String uuid, WebCore::LayoutPoint locationInPageCoordinates, MonotonicTime timestamp)
     591    HandleMouseDownForModelElement(String uuid, WebCore::LayoutPoint flippedLocationInElement, MonotonicTime timestamp)
     592    HandleMouseMoveForModelElement(String uuid, WebCore::LayoutPoint flippedLocationInElement, MonotonicTime timestamp)
     593    HandleMouseUpForModelElement(String uuid, WebCore::LayoutPoint flippedLocationInElement, MonotonicTime timestamp)
    594594#endif
    595595#if ENABLE(ARKIT_INLINE_PREVIEW)
  • trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm

    r286937 r288610  
    186186}
    187187
    188 void ARKitInlinePreviewModelPlayerMac::handleMouseDown(const LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
     188void ARKitInlinePreviewModelPlayerMac::handleMouseDown(const LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    189189{
    190190    if (auto* page = this->page())
    191         page->send(Messages::WebPageProxy::HandleMouseDownForModelElement([m_inlinePreview uuid].UUIDString, locationInPageCoordinates, timestamp));
    192 }
    193 
    194 void ARKitInlinePreviewModelPlayerMac::handleMouseMove(const LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
     191        page->send(Messages::WebPageProxy::HandleMouseDownForModelElement([m_inlinePreview uuid].UUIDString, flippedLocationInElement, timestamp));
     192}
     193
     194void ARKitInlinePreviewModelPlayerMac::handleMouseMove(const LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    195195{
    196196    if (auto* page = this->page())
    197         page->send(Messages::WebPageProxy::HandleMouseMoveForModelElement([m_inlinePreview uuid].UUIDString, locationInPageCoordinates, timestamp));
    198 }
    199 
    200 void ARKitInlinePreviewModelPlayerMac::handleMouseUp(const LayoutPoint& locationInPageCoordinates, MonotonicTime timestamp)
     197        page->send(Messages::WebPageProxy::HandleMouseMoveForModelElement([m_inlinePreview uuid].UUIDString, flippedLocationInElement, timestamp));
     198}
     199
     200void ARKitInlinePreviewModelPlayerMac::handleMouseUp(const LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    201201{
    202202    if (auto* page = this->page())
    203         page->send(Messages::WebPageProxy::HandleMouseUpForModelElement([m_inlinePreview uuid].UUIDString, locationInPageCoordinates, timestamp));
     203        page->send(Messages::WebPageProxy::HandleMouseUpForModelElement([m_inlinePreview uuid].UUIDString, flippedLocationInElement, timestamp));
    204204}
    205205
Note: See TracChangeset for help on using the changeset viewer.