WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-243197-20220725221437.patch (text/plain), 4.26 KB, created by
alan
on 2022-07-25 22:14:37 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
alan
Created:
2022-07-25 22:14:37 PDT
Size:
4.26 KB
patch
obsolete
>From 124101aee5cb49454cb3ad737c1cfc954fae7185 Mon Sep 17 00:00:00 2001 >From: Alan Bujtas <zalan@apple.com> >Date: Mon, 25 Jul 2022 21:52:09 -0700 >Subject: [PATCH] [LFC][IFC] Inconsistent integral rounding of baseline > relative logical top values https://bugs.webkit.org/show_bug.cgi?id=243197 > >Reviewed by NOBODY (OOPS!). > >Inline level box's logical top is relative to the parent inline box (mostly root inline box) baseline position. In most cases this translate to a negative top value. It later gets resolved to a value relative to the line box (turns the negative value to a positive one). > >The simplest case (assume a font metric with 16px ascent) > <div><span>baseline aligned content</span></div> >produces a -16px 'top' for the <span>, relative to the root's baseline, which gets resolved to 0px relative to the line box (-> 16px (root's baseline value) + (-16px) (nested inline box's top) = 0px). > >This patches fixes the cases when (soon-to-be-removed) integral rounding produces incorrect top values by rounding 0.5 values to 1 while -0.5 to 0. Such (correct) rounding produces off-by-one resolved top values (e.g. root's baseline is at 10.5px. Nested inline box, in flush with the root, top computes to -10.5px. 10.5 rounds to 11 while -10.5 rounds to -10 and we end up resolving the inline box's top to 11 + (-10) -> 1 instead of 0. > >* LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align-expected.html: Added. >* LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align.html: Added. >* Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h: >(WebCore::Layout::InlineLevelBox::setLogicalTop): >--- > .../formattingContexts/inline/InlineLevelBox.h | 2 +- > ...ral-top-value-with-baseline-align-expected.html | 8 ++++++++ > ...ect-integral-top-value-with-baseline-align.html | 14 ++++++++++++++ > 3 files changed, 23 insertions(+), 1 deletion(-) > create mode 100644 LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align-expected.html > create mode 100644 LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align.html > >diff --git a/Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h b/Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h >index 4e9219c990c2..4f3d89920c2f 100644 >--- a/Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h >+++ b/Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h >@@ -124,7 +124,7 @@ private: > // FIXME: Remove legacy rounding. > void setLogicalWidth(InlineLayoutUnit logicalWidth) { m_logicalRect.setWidth(logicalWidth); } > void setLogicalHeight(InlineLayoutUnit logicalHeight) { m_logicalRect.setHeight(roundToInt(logicalHeight)); } >- void setLogicalTop(InlineLayoutUnit logicalTop) { m_logicalRect.setTop(roundToInt(logicalTop)); } >+ void setLogicalTop(InlineLayoutUnit logicalTop) { logicalTop >= 0 ? m_logicalRect.setTop(roundToInt(logicalTop)) : m_logicalRect.setTop(-roundToInt(-logicalTop)); } > void setAscent(InlineLayoutUnit ascent) { m_ascent = roundToInt(ascent); } > void setDescent(InlineLayoutUnit descent) { m_descent = roundToInt(descent); } > void setLayoutBounds(const LayoutBounds& layoutBounds) { m_layoutBounds = { InlineLayoutUnit(roundToInt(layoutBounds.ascent)), InlineLayoutUnit(roundToInt(layoutBounds.descent)) }; } >diff --git a/LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align-expected.html b/LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align-expected.html >new file mode 100644 >index 000000000000..80f4718baa0b >--- /dev/null >+++ b/LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align-expected.html >@@ -0,0 +1,8 @@ >+<style> >+div { >+ background-color: green; >+ height: 50px; >+ width: 50px; >+} >+</style> >+<div></div> >diff --git a/LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align.html b/LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align.html >new file mode 100644 >index 000000000000..b3a0f7a88324 >--- /dev/null >+++ b/LayoutTests/fast/inline/incorrect-integral-top-value-with-baseline-align.html >@@ -0,0 +1,14 @@ >+<style> >+div { >+ background-color: red; >+ float: left; >+} >+span { >+ display: inline-block; >+ background-color: green; >+ height: 50px; >+ width: 50px; >+ vertical-align: 0.5; >+} >+</style> >+<div><span></span></div>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 243197
:
461212
|
461222
|
461223