WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
[fast-cq]Patch
bug-245209-20220915194439.patch (text/plain), 5.12 KB, created by
alan
on 2022-09-15 19:44:40 PDT
(
hide
)
Description:
[fast-cq]Patch
Filename:
MIME Type:
Creator:
alan
Created:
2022-09-15 19:44:40 PDT
Size:
5.12 KB
patch
obsolete
>From acc8b72ca478e6abae97a4ed1579d94bc5078a8d Mon Sep 17 00:00:00 2001 >From: Alan Bujtas <zalan@apple.com> >Date: Thu, 15 Sep 2022 15:49:16 -0700 >Subject: [PATCH] Incorrect inline box decoration position when content box is > vertically shifted https://bugs.webkit.org/show_bug.cgi?id=245209 > <rdar://problem/99950939> > >Reviewed by Simon Fraser. > >1. the logical top of an inline box points to the edge of the border box. >2. the logical top of an inline box is relative to its parent inline box. >3. the vertical padding/border on an inline box does not make it any taller (and does not stretch the line). > >It simply means that putting vertical padding/border on an inline box has no impact on its content box's vertical position. > <div><span style="padding-top: 200px">with padding</span></div> > and > <div><span style="padding-top: 0px">without padding</span></div> >produce the same layout. > >However the top value always includes both the border and the padding values (e.g. in the example above, the <span>'s logical top is resolved to -200px). > >In this patch we ensure that the content box's top is used when paining the underline/overline/etc foreground decorations. > >* LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding-expected.html: Added. >* LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding.html: Added. >* Source/WebCore/rendering/TextBoxPainter.cpp: >(WebCore::TextBoxPainter<TextBoxPath>::collectDecoratingBoxesForTextBox): >--- > Source/WebCore/rendering/TextBoxPainter.cpp | 3 ++- > ...ation-with-border-and-padding-expected.html | 17 +++++++++++++++++ > ...box-decoration-with-border-and-padding.html | 18 ++++++++++++++++++ > 3 files changed, 37 insertions(+), 1 deletion(-) > create mode 100644 LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding-expected.html > create mode 100644 LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding.html > >diff --git a/Source/WebCore/rendering/TextBoxPainter.cpp b/Source/WebCore/rendering/TextBoxPainter.cpp >index 901426db3958..bd69c8481c16 100644 >--- a/Source/WebCore/rendering/TextBoxPainter.cpp >+++ b/Source/WebCore/rendering/TextBoxPainter.cpp >@@ -497,11 +497,12 @@ void TextBoxPainter<TextBoxPath>::collectDecoratingBoxesForTextBox(DecoratingBox > return; > } > >+ auto borderAndPaddingBefore = !inlineBox->isRootInlineBox() ? inlineBox->renderer().borderAndPaddingBefore() : LayoutUnit(0_lu); > decoratingBoxList.append({ > inlineBox, > style, > useOverriderDecorationStyle == UseOverriderDecorationStyle::Yes ? overrideDecorationStyle : computedDecorationStyle(), >- { textBoxLocation.x(), m_paintOffset.y() + inlineBox->logicalTop() } >+ { textBoxLocation.x(), m_paintOffset.y() + inlineBox->logicalTop() + borderAndPaddingBefore } > }); > }; > >diff --git a/LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding-expected.html b/LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding-expected.html >new file mode 100644 >index 000000000000..abf21e9b163e >--- /dev/null >+++ b/LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding-expected.html >@@ -0,0 +1,17 @@ >+<style> >+div { >+ font-family: Monospace; >+ font-size: 10px; >+} >+span { >+ text-decoration: underline; >+} >+</style> >+<div>X</div> >+<div>X<span>X</span>X</div> >+<div>X<span style="padding: 0px 50px;">X</span>X</div> >+<div>X<span style="padding: 0px 100px;">X</span>X</div> >+<div>X<span style="padding: 0px 50px;">X<span style="padding: 0px 50px;">X</span>X</span>X</div> >+<div>X<span style="padding: 0px 100px;">X<span style="padding: 0px 100px;">X</span>X</span>X</div> >+<div style="line-height: 200px;">X<span style="padding: 0px 100px;">X<span style="padding: 0px 100px;">X</span>X</span>X</div> >+<div style="line-height: 0px;">X<span style="padding: 0px 100px;">X<span style="padding: 0px 100px;">X</span>X</span>X</div> >diff --git a/LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding.html b/LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding.html >new file mode 100644 >index 000000000000..22c3a09b45c1 >--- /dev/null >+++ b/LayoutTests/fast/inline/inline-box-decoration-with-border-and-padding.html >@@ -0,0 +1,18 @@ >+<style> >+div { >+ font-family: Monospace; >+ font-size: 10px; >+} >+span { >+ text-decoration: underline; >+} >+</style> >+<!-- test if underline is positioned properly when inline box's content box has non-zero vertical offset --> >+<div>X</div> >+<div>X<span>X</span>X</div> >+<div>X<span style="padding: 50px;">X</span>X</div> >+<div>X<span style="border: 50px solid transparent; padding: 50px;">X</span>X</div> >+<div>X<span style="padding: 50px;">X<span style="padding: 50px;">X</span>X</span>X</div> >+<div>X<span style="border: 50px solid transparent; padding: 50px;">X<span style="border: 50px solid transparent; padding: 50px;">X</span>X</span>X</div> >+<div style="line-height: 200px">X<span style="border: 50px solid transparent; padding: 50px;">X<span style="border: 50px solid transparent; padding: 50px;">X</span>X</span>X</div> >+<div style="line-height: 0px;">X<span style="padding: 0px 100px;">X<span style="padding: 0px 100px;">X</span>X</span>X</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 245209
:
462350
|
462370
| 462382