WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
177521
big padding should push float elements on a new line
https://bugs.webkit.org/show_bug.cgi?id=177521
Summary
big padding should push float elements on a new line
karl
Reported
2017-09-26 20:37:26 PDT
Created
attachment 321933
[details]
issue on Safari Initially a behavior creating a Web compat issue for Edge and Firefox. Chrome fixed it recently
https://bugs.chromium.org/p/chromium/issues/detail?id=754136
and aligned with Firefox and Edge. Safari is the only one with this issue. Daniel Holbert provided a reduced test case
https://jsfiddle.net/doy5okmz/
https://jsfiddle.net/doy5okmz/2/
HTML: <div class="container"> <span class="padded"> a <span class="float">Float CSS: .container { width: 300px; border: 3px solid black; } .padded { padding-right: 260px; border: 2px dotted lime; } .float { float: right; width: 50px; border: 2px dotted red; }
Attachments
issue on Safari
(8.38 KB, image/png)
2017-09-26 20:37 PDT
,
karl
no flags
Details
Safari vs Other browsers
(170.50 KB, image/png)
2023-10-29 07:10 PDT
,
Ahmad Saleem
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2017-09-26 21:45:18 PDT
<
rdar://problem/34676410
>
Ahmad Saleem
Comment 2
2023-10-29 07:10:25 PDT
Created
attachment 468398
[details]
Safari vs Other browsers Still reproducible in Safari / WebKit ToT.
zalan
Comment 3
2023-11-23 09:21:07 PST
This happens because we stop looking for soft wrap opportunities when we see a float box. There's a FIXME on this exact issue here:
https://github.com/WebKit/WebKit/blob/c7578c8aa8bf5e14ebebbc1f531f4001fd7d1327/Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp#L452
also while Chrome indeed fixed this particular case with decorations present, it still fails when the inline box has some content _after_ the float box (i.e. it looks like Chrome also injects a soft wrap opportunity at the float box) <style> .container { width: 300px; border: 3px solid black; } .padded { padding-right: 260px; border: 1px solid red; } .float { float: right; width: 50px; border: 1px solid blue; } </style> <div class="container"><span class="padded">a<span class="float">Float</span>b</span></div>
Karl Dubost
Comment 4
2025-01-19 18:22:30 PST
https://searchfox.org/wubkat/rev/0160d3a767ad8fff76bf95f1e7ba0cb325cc6c2d/Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp#494-503
```cpp ASSERT(currentItem.isText() || currentItem.isAtomicInlineBox() || currentItem.isFloat() || currentItem.layoutBox().isRubyInlineBox()); if (currentItem.isFloat()) { // While floats are not part of the inline content and they are not supposed to introduce soft wrap opportunities, // e.g. [text][float box][float box][text][float box][text] is essentially just [text][text][text] // figuring out whether a float (or set of floats) should stay on the line or not (and handle potentially out of order inline items) // brings in unnecessary complexity. // For now let's always treat a float as a soft wrap opportunity. auto wrappingPosition = index == startIndex ? std::min(index + 1, layoutRange.endIndex()) : index; return wrappingPosition; } ```
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