WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
242057
REGRESSION(
r287922
): Incorrect inline-level box placement with negative horizontal margin when text-align has non-initial value.
https://bugs.webkit.org/show_bug.cgi?id=242057
Summary
REGRESSION(r287922): Incorrect inline-level box placement with negative horiz...
nayara
Reported
2022-06-28 01:27:43 PDT
Created
attachment 460515
[details]
sample of bug Safari 15.4 has a problem with negative margins, it was not present in 15.3. Here's the code: <style>.c1 {width:113px;height:158px;text-align:center} .pi {margin:0 -100%;} </style> <div class="c1"><img class="pi" src="
https://i.ibb.co/7R0NTRt/photo.jpg
"></div> As you can see, image is cut in half in Safari 15.4
Attachments
sample of bug
(168 bytes, text/html)
2022-06-28 01:27 PDT
,
nayara
no flags
Details
Test reduction
(266 bytes, text/html)
2022-06-28 08:03 PDT
,
alan
no flags
Details
Patch
(5.16 KB, patch)
2022-06-28 20:32 PDT
,
alan
no flags
Details
Formatted Diff
Diff
Patch
(5.19 KB, patch)
2022-06-29 08:15 PDT
,
alan
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2022-06-28 07:52:51 PDT
<
rdar://problem/96060962
>
alan
Comment 2
2022-06-28 08:03:38 PDT
Created
attachment 460517
[details]
Test reduction
alan
Comment 3
2022-06-28 10:43:19 PDT
it only fails when the negative margin is resolved to > border box width
alan
Comment 4
2022-06-28 11:50:45 PDT
Negative margin could create "negative content width" for the line which does not work very well with certain alignment values. LineBoxBuilder::horizontalAlignmentOffset may need to use the content right offset (can be negative) instead of the content width (can _not_ be negative) to compute the alignment offset.
alan
Comment 5
2022-06-28 20:32:48 PDT
Created
attachment 460526
[details]
Patch
Antti Koivisto
Comment 6
2022-06-29 06:44:24 PDT
Comment on
attachment 460526
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=460526&action=review
> Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:53 > + contentLogicalRight = std::min(contentLogicalRight, lineContent.lineLogicalWidth);
min(right, width) looks weird but I suppose they are in different coordinate spaces.
alan
Comment 7
2022-06-29 06:47:38 PDT
(In reply to Antti Koivisto from
comment #6
)
> Comment on
attachment 460526
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=460526&action=review
> > > Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:53 > > + contentLogicalRight = std::min(contentLogicalRight, lineContent.lineLogicalWidth); > > min(right, width) looks weird but I suppose they are in different coordinate > spaces.
Yeah good point, I may rename width to lineLogicalRight to avoid confusion.
alan
Comment 8
2022-06-29 08:15:51 PDT
Created
attachment 460540
[details]
Patch
EWS
Comment 9
2022-06-29 10:45:43 PDT
Committed
251954@main
(f1adc9c4985a): <
https://commits.webkit.org/251954@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 460540
[details]
.
alan
Comment 10
2022-06-29 10:50:08 PDT
(In reply to nayara from
comment #0
)
> Created
attachment 460515
[details]
> sample of bug > > Safari 15.4 has a problem with negative margins, it was not present in 15.3. > Here's the code: > > <style>.c1 {width:113px;height:158px;text-align:center} .pi {margin:0 > -100%;} </style> <div class="c1"><img class="pi" > src="
https://i.ibb.co/7R0NTRt/photo.jpg
"></div> > > As you can see, image is cut in half in Safari 15.4
Thank you for filing this issue!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug