Bug 29648 - white-space: nowrap inline element beside a floated element wraps incorrectly without trailing textnode/newline
Summary: white-space: nowrap inline element beside a floated element wraps incorrectly...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Robert Hogan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-22 11:39 PDT by Rob Retchless
Modified: 2012-10-30 12:13 PDT (History)
6 users (show)

See Also:


Attachments
Patch (5.96 KB, patch)
2012-10-27 01:39 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Retchless 2009-09-22 11:39:30 PDT
I've recently run into an issue with white-space: nowrap which is reproducible with the latest WebKit nightly.  

Broken:

<div style="width: 200px; overflow: hidden">
	<div style="float: left; width: 50px; height: 50px; background-color: red"></div>
	<span style="white-space: nowrap">Some long string that wraps</span></div><!-- </div> not on next line on purpose - triggers bug -->

Works:

<div style="width: 200px; overflow: hidden">
	<div style="float: left; width: 50px; height: 50px; background-color: red"></div>
	<span style="white-space: nowrap">Some long string that wraps</span><!-- text node (space or newline) here fixes the bug -->
</div>

Essentially, the white-space: nowrap span (or any inline element) should wrap below the float: left block if it doesn't fit, and should only spill out of its parent if it doesn't fit within the width of its parent after wrapping. Adding a space or newline after the white-space: nowrap span causes it to behave correctly.

Note: Overflow hidden on the parent is not necessary, but it makes this scenario clearer.
Comment 1 Patrick Mueller 2009-09-22 12:26:01 PDT
This appears to behave the same in Safari 4.0.3 as well.
Comment 2 Robert Hogan 2012-10-27 01:39:05 PDT
Created attachment 171084 [details]
Patch
Comment 3 Levi Weintraub 2012-10-27 01:51:38 PDT
Comment on attachment 171084 [details]
Patch

LGTM. A link to the bug in the ref test would be nice :)
Comment 4 WebKit Review Bot 2012-10-30 12:13:17 PDT
Comment on attachment 171084 [details]
Patch

Clearing flags on attachment: 171084

Committed r132935: <http://trac.webkit.org/changeset/132935>
Comment 5 WebKit Review Bot 2012-10-30 12:13:21 PDT
All reviewed patches have been landed.  Closing bug.