[webkit-changes] [WebKit/WebKit] d5fba3: MouseClick offsetX/offsetY different between Safar...

Richard Robinson noreply at github.com
Mon Nov 14 16:24:57 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d5fba35fb6c5b86be5e46c41f7bd33df4a019745
      https://github.com/WebKit/WebKit/commit/d5fba35fb6c5b86be5e46c41f7bd33df4a019745
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2022-11-14 (Mon, 14 Nov 2022)

  Changed paths:
    A LayoutTests/fast/svg/foreign-object-offset-position-expected.txt
    A LayoutTests/fast/svg/foreign-object-offset-position.html
    M Source/WebCore/rendering/svg/LegacyRenderSVGForeignObject.cpp
    M Source/WebCore/rendering/svg/LegacyRenderSVGForeignObject.h

  Log Message:
  -----------
  MouseClick offsetX/offsetY different between Safari 15.5 and Safari 16
https://bugs.webkit.org/show_bug.cgi?id=247829
rdar://100517677

Reviewed by Simon Fraser.

When a foreign object is inside an SVG, any click event that occurs on the
object has it's offsetX and offsetY relative to the SVG container rather than
the element, which is incorrect behavior.

This is a regression from https://bugs.webkit.org/show_bug.cgi?id=234524,
which overrode `offsetFromContainer` in `RenderSVGBlock`, causing the `RenderSVGForeignObject`
to use this override and return an offset of `(0, 0)` instead of its proper offset.
This value was then propogated within the calculation of the event's offset.

This PR fixes this by creating an override of `offsetFromContainer` in `RenderSVGForeignObject`,
which returns the correct offset of the foreign object, and so the event's
offset location is now relative to the foreign object.

* LayoutTests/fast/svg/foreign-object-offset-position-expected.txt: Added.
* LayoutTests/fast/svg/foreign-object-offset-position.html: Added.
* Source/WebCore/rendering/svg/LegacyRenderSVGForeignObject.cpp:
(WebCore::LegacyRenderSVGForeignObject::offsetFromContainer const):
* Source/WebCore/rendering/svg/LegacyRenderSVGForeignObject.h:

Canonical link: https://commits.webkit.org/256679@main




More information about the webkit-changes mailing list