Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wide-layout attachments: Fix baseline computation #15680

Conversation

squelart
Copy link
Contributor

@squelart squelart commented Jul 10, 2023

28021b9

Wide-layout attachments: Fix baseline computation
https://bugs.webkit.org/show_bug.cgi?id=259039
rdar://problem/111991128

Reviewed by Tim Nguyen.

The previous computation used `renderRect`s, which relied on the baseline, modifying the baseline again
and again.
Instead, assume that the image is vertically centred, so it's just a matter of adding half-heights to find
the bottom of that image. (Fallback to the full attachment height alone in case the inner element doesn't
have its height yet.)

* LayoutTests/fast/attachment/mac/wide-attachment-image-controls-basic-expected.txt:
* LayoutTests/platform/ios-wk2/fast/attachment/cocoa/wide-attachment-rendering-expected.txt:
* LayoutTests/platform/mac-wk2/fast/attachment/cocoa/wide-attachment-rendering-expected.txt:
* Source/WebCore/rendering/RenderAttachment.cpp:
(WebCore::RenderAttachment::baselinePosition const):

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

ab36b2f

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@squelart squelart self-assigned this Jul 10, 2023
@squelart squelart added the HTML Editing For bugs in HTML editing support (including designMode and contentEditable). label Jul 10, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jul 10, 2023
@squelart squelart removed the merging-blocked Applied to prevent a change from being merged label Jul 10, 2023
@squelart squelart force-pushed the eng/fixed-wide-layout-attachment-baseline branch from 389da92 to 978f0ff Compare July 10, 2023 03:38
@squelart squelart force-pushed the eng/fixed-wide-layout-attachment-baseline branch from 978f0ff to ab36b2f Compare July 10, 2023 04:46
@squelart squelart added the merge-queue Applied to send a pull request to merge-queue label Jul 10, 2023
https://bugs.webkit.org/show_bug.cgi?id=259039
rdar://problem/111991128

Reviewed by Tim Nguyen.

The previous computation used `renderRect`s, which relied on the baseline, modifying the baseline again
and again.
Instead, assume that the image is vertically centred, so it's just a matter of adding half-heights to find
the bottom of that image. (Fallback to the full attachment height alone in case the inner element doesn't
have its height yet.)

* LayoutTests/fast/attachment/mac/wide-attachment-image-controls-basic-expected.txt:
* LayoutTests/platform/ios-wk2/fast/attachment/cocoa/wide-attachment-rendering-expected.txt:
* LayoutTests/platform/mac-wk2/fast/attachment/cocoa/wide-attachment-rendering-expected.txt:
* Source/WebCore/rendering/RenderAttachment.cpp:
(WebCore::RenderAttachment::baselinePosition const):

Canonical link: https://commits.webkit.org/265894@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/fixed-wide-layout-attachment-baseline branch from ab36b2f to 28021b9 Compare July 10, 2023 06:57
@webkit-commit-queue
Copy link
Collaborator

Committed 265894@main (28021b9): https://commits.webkit.org/265894@main

Reviewed commits have been landed. Closing PR #15680 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 28021b9 into WebKit:main Jul 10, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jul 10, 2023
Comment on lines +103 to +105
if (auto* baselineElementRenderBox = baselineElement->renderBox()) {
// This is the bottom of the image assuming it is vertically centered.
return (height() + baselineElementRenderBox->height()) / 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does wide-attachment support vertical writing mode in general?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at this time, no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HTML Editing For bugs in HTML editing support (including designMode and contentEditable).
Projects
None yet
6 participants