Bug 48157 - Direction and writing-mode should propagate from the <body> to the <html> to the ICB
: Direction and writing-mode should propagate from the <body> to the <html> to ...
Status: RESOLVED FIXED
: WebKit
Layout and Rendering
: 528+ (Nightly build)
: PC Mac OS X 10.5
: P2 Normal
Assigned To:
:
:
:
: 46123
  Show dependency treegraph
 
Reported: 2010-10-22 15:39 PST by
Modified: 2010-10-27 10:50 PST (History)


Attachments
Patch (128.44 KB, patch)
2010-10-25 15:24 PST, Dave Hyatt
hyatt: review-
hyatt: commit‑queue-
Review Patch | Details | Formatted Diff | Diff
Patch (123.83 KB, patch)
2010-10-26 10:55 PST, Dave Hyatt
no flags Review Patch | Details | Formatted Diff | Diff
Patch (124.00 KB, patch)
2010-10-26 10:59 PST, Dave Hyatt
sam: review+
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2010-10-22 15:39:32 PST
Direction and writing-mode should propagate from the <body> to the <html> to the ICB as long as the <html> hasn't explicitly set the direction or writing-mode.  Right now we only propagate from the <html> to the ICB, but we need to propagate from the <body> as well.
------- Comment #1 From 2010-10-25 15:24:24 PST -------
Created an attachment (id=71802) [details]
Patch
------- Comment #2 From 2010-10-25 15:28:52 PST -------
Attachment 71802 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebCore/rendering/style/RenderStyle.cpp:444:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
WebCore/rendering/style/RenderStyle.cpp:450:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
WebCore/rendering/style/RenderStyle.h:174:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
WebCore/rendering/style/RenderStyle.h:182:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
Total errors found: 4 in 24 files


If any of these errors are false positives, please file a bug against check-webkit-style.
------- Comment #3 From 2010-10-25 15:46:05 PST -------
(From update of attachment 71802 [details])
Minusing after talking with Dan.
------- Comment #4 From 2010-10-25 16:19:12 PST -------
After testing in WinIE, I'm just going to match their behavior.  Propagate from the body, and only propagate from the root if the body is not present.
------- Comment #5 From 2010-10-26 10:49:59 PST -------
I decided I can't follow WinIE's behavior.  They completely ignore the direction on the <html> element and even replace it with the <body>'s direction.  I'm going to go with the original behavior in the first patch of propagating if the root doesn't specify an explicit direction.   This is consistent with how we handle background and overflow propagation.
------- Comment #6 From 2010-10-26 10:55:41 PST -------
Created an attachment (id=71908) [details]
Patch
------- Comment #7 From 2010-10-26 10:59:11 PST -------
Created an attachment (id=71910) [details]
Patch
------- Comment #8 From 2010-10-26 11:17:41 PST -------
(In reply to comment #5)
> I decided I can't follow WinIE's behavior.  They completely ignore the direction on the <html> element and even replace it with the <body>'s direction.  I'm going to go with the original behavior in the first patch of propagating if the root doesn't specify an explicit direction.   This is consistent with how we handle background and overflow propagation.


I just tested Firefox, IE, and Chrome (I assume Safari is the same as Chrome).

I tried to set direction combination in html and body, then check the direction of the <div> inside <body>. Look like the behavior in the 3 browsers are the same as following:
1. when the 'dir' is set in <body> element, it is always honored, disregarding the 'dir' setting in <html>.
2. when 'dir' is not set in <body> element, the 'dir' in <html> is propagated to <div>.


If you change the behavior, it will be different from IE and Firefox.
And I do not understand why the precedence of <html> and <body> should be different from other inheritance in parent/child relationship?

Is there HTML/W3C spec about the precedence of 'dir' in <html> and <body>?
------- Comment #9 From 2010-10-26 11:25:12 PST -------
(In reply to comment #8)
> 
> I tried to set direction combination in html and body, then check the direction of the <div> inside <body>. Look like the behavior in the 3 browsers are the same as following:
> 1. when the 'dir' is set in <body> element, it is always honored, disregarding the 'dir' setting in <html>.

This is in direct violation of CSS2.1 is the problem.  It states that the direction on the root element should be propagated to the initial containing block.  I don't think it makes sense to actually overwrite the direction specified on the <html> if it is there just because the <body> specified something different.

Keep in mind this is mostly just a theoretical distinction, since anyone setting RTL directions on the body isn't going to go explicitly put LTR on the html.  There shouldn't be a compatibility issue here.

> 2. when 'dir' is not set in <body> element, the 'dir' in <html> is propagated to <div>.
> 
> 
> If you change the behavior, it will be different from IE and Firefox.
> And I do not understand why the precedence of <html> and <body> should be different from other inheritance in parent/child relationship?
> 
> Is there HTML/W3C spec about the precedence of 'dir' in <html> and <body>?

The spec actually says nothing about body propagation.  I want to make sure we adhere to the root element portion of the spec, which means I don't want to allow body to propagate if it's going to violate what is stated in CSS2.1.

Anyway, this is slightly different from IE and Firefox, but in practice it should be a non-issue, since people specifying a direction on the body aren't going to go and explicitly specify the opposite direction on the root element.
------- Comment #10 From 2010-10-26 11:28:26 PST -------
Also, 

"1. when the 'dir' is set in <body> element, it is always honored, disregarding the 'dir' setting in <html>."

That is not WebKit's current behavior.  This patch actually brings WebKit's behavior closer to IE and Firefox.

It's hard to really understand what's going on without making the <html> have a small specified width.
------- Comment #11 From 2010-10-26 11:33:31 PST -------
Fixed in r70456.

I will bring up body propagation with the CSS WG to get a conversation going about standardizing it.
------- Comment #12 From 2010-10-26 12:05:38 PST -------
http://trac.webkit.org/changeset/70546 might have broken Qt Linux Release
The following tests are not passing:
fast/blockflow/floats-in-block-layout.html
fast/blockflow/self-collapsing-block.html
fast/multicol/nested-columns.html
------- Comment #13 From 2010-10-27 10:50:06 PST -------
(In reply to comment #12)
> http://trac.webkit.org/changeset/70546 might have broken Qt Linux Release
> The following tests are not passing:
> fast/blockflow/floats-in-block-layout.html
> fast/blockflow/self-collapsing-block.html
> fast/multicol/nested-columns.html

FYI: Qt specific expected files updated in http://trac.webkit.org/changeset/70670