Bug 11857 - Regression (r132935): WebKit breaks between <nobr> tags
Summary: Regression (r132935): WebKit breaks between <nobr> tags
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Robert Hogan
URL: http://technet2.microsoft.com/Windows...
Keywords:
: 17595 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-12-17 02:08 PST by Rosyna
Modified: 2013-01-02 12:19 PST (History)
7 users (show)

See Also:


Attachments
Simple nobr test (682 bytes, text/html)
2006-12-17 02:14 PST, Rosyna
no flags Details
Patch (4.77 KB, patch)
2012-12-27 10:23 PST, Robert Hogan
no flags Details | Formatted Diff | Diff
Patch (4.74 KB, patch)
2012-12-27 14:45 PST, 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 Rosyna 2006-12-17 02:08:08 PST
This Microsoft page has a bunch of adjacent <nobr></nobr> tags in their breadcrumb view. WebKit should wrap inbetween the nobr tags. This may be related to bug 10145.
Comment 1 Dave Hyatt 2006-12-17 02:10:15 PST
Maybe in quirks mode.  I'm not convinced it should in strict mode.

Comment 2 Rosyna 2006-12-17 02:14:23 PST
Created attachment 11892 [details]
Simple nobr test
Comment 3 Rosyna 2006-12-17 02:16:06 PST
Why should it not be in strict mode? I thought the point of <nobr> was to prevent content inside the tag from word breaking. However, between the <nobr> tags is an opportunity for breaking. Or rather, is it documented it shouldn't break? Other browsers break in strict mode.
Comment 4 Dave Hyatt 2006-12-17 02:44:25 PST
Break opportunities don't automatically exist in between inline elements.  Consider this:

<span>A</span>pp<span>l</span>le

This is all one word, "Apple", despite having multiple inlines wrapping some of the letters.  Whether or not a break opportunity exists depends on the prevailing white-space mode (in this example "normal") and whether or not there's a break opportunity between two characters.

In the case of <nobr>, the white-space mode is "nowrap", meaning that everything inside a <nobr> is considered to be unbreakable.  When two of these elements are contiguous, the break opportunity between the two characters at the edges of the <nobr>s does not exist.

Comment 5 Dave Hyatt 2006-12-17 02:45:12 PST
If a space or newline is in between the <nobr>s then we would break.

Comment 6 Dave Hyatt 2006-12-17 02:46:51 PST
Our whitespace handling when mixing modes is way more advanced than other browsers.  Take, for example:

http://hixie.ch/tests/adhoc/css/text/white-space/mixed/001.html

Comment 7 mitz 2006-12-17 03:17:59 PST
Note that in Firefox for a line break to occur between adjacent <nobr>s, either the first one must end with whitespace or the second one must begin with whitespace, i.e.
<nobr>No</nobr><nobr>break</nobr>
won't wrap, but the following will
<nobr>No </nobr><nobr>break</nobr>
<nobr>No</nobr><nobr> break</nobr>
Comment 8 Rosyna 2006-12-17 04:37:47 PST
In this case, there is whitespace before the closing tag, as mitz says.
Comment 9 Darin Fisher (:fishd, Google) 2008-02-29 13:21:28 PST
I think this bug (or maybe a variant of it) exists on http://login.live.com/?id=2.  (Depending on your font settings, you might need to increase font sizes to see it.)

Notice that in WebKit the "Account Services  |  Privacy Statement  |  Terms of Use" line doesn't break, whereas in all other browsers it does.
Comment 10 mitz 2008-02-29 13:31:58 PST
(In reply to comment #9)
> I think this bug (or maybe a variant of it) exists on
> http://login.live.com/?id=2.  (Depending on your font settings, you might need
> to increase font sizes to see it.)
> 
> Notice that in WebKit the "Account Services  |  Privacy Statement  |  Terms of
> Use" line doesn't break, whereas in all other browsers it does.
> 

Yup, I think bug 17595 is a duplicate of this bug.
Comment 11 Shane Stephens 2011-07-06 20:38:04 PDT
*** Bug 17595 has been marked as a duplicate of this bug. ***
Comment 12 Robert Hogan 2012-12-26 12:57:59 PST
WebKit's old behaviour was correct but has now regressed and 'passes' the reduction in this bug; it breaks between the <nobr> tags.
Comment 13 Robert Hogan 2012-12-26 15:28:10 PST
(In reply to comment #12)
> WebKit's old behaviour was correct but has now regressed and 'passes' the reduction in this bug; it breaks between the <nobr> tags.

Turns out I'm the culprit: https://bugs.webkit.org/show_bug.cgi?id=29648.

This bug seems like the right place to fix it.
Comment 14 Robert Hogan 2012-12-27 10:23:24 PST
Created attachment 180809 [details]
Patch
Comment 15 Eric Seidel (no email) 2012-12-27 10:38:48 PST
Comment on attachment 180809 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=180809&action=review

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:3085
> +        } else if (blockStyle->autoWrap() && !width.fitsOnLine() && !width.committedWidth())
> +            // If the container autowraps but the current child does not then we still need to ensure that it
> +            // wraps and moves below any floats.
> +            width.fitBelowFloats();

I believe the "official" style is to wrap such blocks in {}, even though some of the lines are only comments.  Sad that check-webkit-style doesn't enforce this.
Comment 16 Robert Hogan 2012-12-27 14:45:09 PST
Created attachment 180822 [details]
Patch
Comment 17 Dave Hyatt 2013-01-02 11:08:42 PST
Comment on attachment 180822 [details]
Patch

r=me
Comment 18 WebKit Review Bot 2013-01-02 12:19:35 PST
Comment on attachment 180822 [details]
Patch

Clearing flags on attachment: 180822

Committed r138630: <http://trac.webkit.org/changeset/138630>
Comment 19 WebKit Review Bot 2013-01-02 12:19:39 PST
All reviewed patches have been landed.  Closing bug.