Bug 31397

Summary: Inline Containing Only Collapsed Whitespace Not Getting a Linebox
Product: WebKit Reporter: Hanrui <hanrui.gao>
Component: DOMAssignee: Robert Hogan <robert>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ap, dglazkov, eric, gyuyoung.kim, hongxu, ian, jochen, johnnyding.webkit, ojan.autocc, rakuco, rniwa, robert, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
URL: http://fedex.com/cn/contact/
Bug Depends on: 95772    
Bug Blocks:    
Attachments:
Description Flags
Screenshot for your reference.
none
Testcase of quirks mode.
none
Testcase of standards mode.
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch hyatt: review+, webkit.review.bot: commit-queue-

Description Hanrui 2009-11-12 02:25:28 PST
Created attachment 43048 [details]
Screenshot for your reference.

Other browsers tested:
 Safari 4: Fail
 Firefox 3.x: Fail
 IE 6/7/8: OK (In IE8, the page runs in IE7 standards mode by page default)


What steps will reproduce the problem?
1. Load http://fedex.com/cn/contact/

What is the expected result?
"客户服务" should on the right side of the purple arrow icon and there should be one entry of "写信给FedEx" below that.

What happens instead?
"写信给FedEx" and "客户服务" is below the purple arrow icon.

Console Output:
<a> misnested or not properly closed. Cloning <a> in order to preserve the styles applied by it.

Please provide any additional information below. Attach a screenshot if
possible.
The problem is HTML tags write error.
This page has a tag:
<a name="top" />
This is wrong way to write, element "<a>" is not an empty tag, can not be written like this.
The correct way is:
<a name="top"></a>

Just as the console output says, browsers cloned the unclosed tag in order to preserve the styles applied by it.
But different browsers have their different ways to make that.
In non-IE, they clone the <a> tag into many <a> tags and insert each of them into every block elements.
But in IE, the <a> is containing all contents before another <a> tag which has id="i1" (the <a> tag of "客户服务").
That's why page layout confusion.

In IE8, the page by default runs in IE 7 standards mode, and when switching to IE 8 mandatorily, the page layout is even more confused.

In such cases all browsers will do a similar treatment, this page looks good in IE is just a coincidence.
Comment 1 Hanrui 2009-11-12 02:26:02 PST
Created attachment 43049 [details]
Testcase of quirks mode.
Comment 2 Hanrui 2009-11-12 02:26:20 PST
Created attachment 43050 [details]
Testcase of standards mode.
Comment 3 Hanrui 2009-11-12 02:30:30 PST
Another case of unclosed tag <a> is: http://www.meilid.com/News/4405/
The page has code as below:
   <div class="header">
        <span style="float:left"><a href="/" target="_blank"><img src="/templets/lady/images/logo.gif" border="0" alt="魅力伊人网" /></span><span style="float:right"><script src="/AID/76090.js" type="text/javascript"></script></span>
        <div class="clear"></div>
    </div>

And the expected behavior is:
The advertisement div is just at the right bottom of the browser window. And when you scoll, the ad div is also at the right bottom.

But we see that in non-IE, the ad is cannot move if you scroll up and down.
Comment 4 Adam Barth 2012-11-08 19:00:01 PST
Unfortunately, it's going to be very difficult to emulate all the parser quirks of old versions of IE.  I understand that this is a problem for locales like cn where IE is heavily used.
Comment 5 Robert Hogan 2012-12-06 10:39:45 PST
Created attachment 178030 [details]
Patch
Comment 6 Robert Hogan 2012-12-07 11:53:02 PST
Created attachment 178246 [details]
Patch
Comment 7 Build Bot 2012-12-07 12:23:38 PST
Comment on attachment 178246 [details]
Patch

Attachment 178246 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15188395

New failing tests:
svg/batik/text/xmlSpace.svg
fast/css/first-letter-capitalized-edit-select-crash.html
fast/text/capitalize-empty-generated-string.html
fast/text/whitespace/007.html
fast/text/whitespace/006.html
fast/inline/drawStyledEmptyInlinesWithWS.html
tables/mozilla/bugs/bug1318.html
fast/inline/drawStyledEmptyInlines.html
tables/mozilla/bugs/bug113235-3.html
css2.1/t0505-c16-descendant-01-e.html
tables/mozilla/bugs/bug1188.html
editing/selection/extend-by-sentence-001.html
svg/carto.net/combobox.svg
Comment 8 WebKit Review Bot 2012-12-07 12:39:29 PST
Comment on attachment 178246 [details]
Patch

Attachment 178246 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15191347

New failing tests:
svg/batik/text/xmlSpace.svg
fast/css/first-letter-capitalized-edit-select-crash.html
Comment 9 Robert Hogan 2012-12-19 10:44:27 PST
Created attachment 180194 [details]
Patch
Comment 10 Robert Hogan 2012-12-20 10:19:22 PST
Created attachment 180361 [details]
Patch
Comment 11 WebKit Review Bot 2012-12-20 11:33:00 PST
Comment on attachment 180361 [details]
Patch

Attachment 180361 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15437005

New failing tests:
css2.1/t0505-c16-descendant-01-e.html
Comment 12 Robert Hogan 2012-12-20 11:57:43 PST
Created attachment 180382 [details]
Patch
Comment 13 Dave Hyatt 2012-12-20 14:08:24 PST
Comment on attachment 180382 [details]
Patch

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

MOstly looks ok. One line stands out.

> Source/WebCore/dom/Position.cpp:852
> +                || (o->isRenderInline() && toRenderInline(o)->linesBoundingBox().height()))

I don't really understand this addition. It seems like you only want to do this if the inline is empty. This code already recurs into the inline's children, so isn't this a case where the inline needs to be empty also, or otherwise you're O(n^2)?
Comment 14 Robert Hogan 2012-12-20 15:05:22 PST
Created attachment 180420 [details]
Patch
Comment 15 Robert Hogan 2012-12-21 00:28:52 PST
Created attachment 180488 [details]
Patch
Comment 16 Build Bot 2012-12-21 03:30:52 PST
Comment on attachment 180488 [details]
Patch

Attachment 180488 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15450401

New failing tests:
editing/style/remove-underline-across-paragraph.html
editing/deleting/delete-3775172-fix.html
editing/style/remove-underline-after-paragraph-in-bold.html
editing/style/remove-underline.html
editing/style/underline.html
svg/as-image/img-relative-height.html
editing/style/remove-underline-from-stylesheet.html
editing/style/remove-underline-after-paragraph.html
editing/style/typing-style-003.html
editing/inserting/typing-003.html
editing/style/unbold-in-bold.html
editing/style/remove-underline-in-bold.html
editing/style/remove-underline-across-paragraph-in-bold.html
platform/mac/editing/spelling/removing-underline-after-accepting-autocorrection-using-punctuation.html
Comment 17 WebKit Review Bot 2012-12-21 03:39:00 PST
Comment on attachment 180488 [details]
Patch

Attachment 180488 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15461278

New failing tests:
editing/style/remove-underline-in-bold.html
editing/style/remove-underline-across-paragraph.html
editing/deleting/delete-3775172-fix.html
editing/style/remove-underline-after-paragraph.html
editing/style/remove-underline.html
editing/style/remove-underline-after-paragraph-in-bold.html
editing/style/remove-underline-from-stylesheet.html
editing/style/typing-style-003.html
editing/inserting/typing-003.html
editing/style/underline.html
editing/style/remove-underline-across-paragraph-in-bold.html
editing/style/unbold-in-bold.html
Comment 18 WebKit Review Bot 2012-12-21 04:42:13 PST
Comment on attachment 180488 [details]
Patch

Attachment 180488 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15457390

New failing tests:
editing/style/remove-underline-in-bold.html
editing/style/remove-underline-across-paragraph.html
editing/deleting/delete-3775172-fix.html
editing/style/remove-underline-after-paragraph.html
editing/style/remove-underline.html
editing/style/remove-underline-after-paragraph-in-bold.html
editing/style/remove-underline-from-stylesheet.html
editing/style/typing-style-003.html
editing/inserting/typing-003.html
editing/style/underline.html
editing/style/remove-underline-across-paragraph-in-bold.html
editing/style/unbold-in-bold.html
Comment 19 Robert Hogan 2012-12-21 09:03:22 PST
Created attachment 180527 [details]
Patch
Comment 20 Dave Hyatt 2013-01-15 12:46:42 PST
Comment on attachment 180527 [details]
Patch

r=me
Comment 21 Robert Hogan 2013-01-22 11:56:57 PST
Created attachment 184030 [details]
Patch
Comment 22 WebKit Review Bot 2013-01-22 12:44:38 PST
Comment on attachment 184030 [details]
Patch

Attachment 184030 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/16040753

New failing tests:
inspector-protocol/debugger-terminate-dedicated-worker-while-paused.html
Comment 23 Dave Hyatt 2013-01-23 11:18:56 PST
Comment on attachment 184030 [details]
Patch

r=me
Comment 24 Robert Hogan 2013-01-24 10:47:55 PST
Committed r140693: <http://trac.webkit.org/changeset/140693>
Comment 25 Ryosuke Niwa 2013-03-20 15:55:56 PDT
Rebaselined tests in http://trac.webkit.org/changeset/146404.