New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 280709 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Sep 2013
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

paragraphs with different directionality in textarea with unicode-bidi: plaintext are aligned the same

Reported by igo...@sisa.samsung.com, Aug 28 2013

Issue description

Migrated from WebKit Bugzilla: https://bugs.webkit.org/show_bug.cgi?id=71194
Originally reported 2011-10-30 14:24 PST by Amir E. Aharoni (amir.aharoni@mail.huji.ac.il).


Description:
In a <textarea> with style="unicode-bidi: plaintext" the direction of each paragraph is supposed to be detected automatically. Currently all the paragraphs are aligned to the same side, even if their directionality is identified is different from that of the other paragraphs. It would make more sense to align RTL paragraphs to the right and LTR paragraphs to the left. This is how it is rendered in some Linux plain text editors that support RTL text and in Mozilla - currently "unicode-bidi: plaintext" is implemented in Firefox 10, which is the nightly test release.


Blocks:
[http://wkb.ug/50910] NEW - Master bug for HTML5 Bidi




Comments:
================================

Comment #1
Posted on 2011-12-05 13:37:45 PST by Ryosuke Niwa (rniwa@webkit.org)

(In reply to comment #0 [https://bugs.webkit.org/show_bug.cgi?id=71194#c0])
> In a <textarea> with style="unicode-bidi: plaintext" the direction of each paragraph is supposed to be detected automatically. Currently all the paragraphs are aligned to the same side, even if their directionality is identified is different from that of the other paragraphs. It would make more sense to align RTL paragraphs to the right and LTR paragraphs to the left. This is how it is rendered in some Linux plain text editors that support RTL text and in Mozilla - currently "unicode-bidi: plaintext" is implemented in Firefox 10, which is the nightly test release.

Should this happen on any element that doesn't specify text-align or direction? Are there relevant specs that specifiy this behavior?

================================

Comment #2
Posted on 2011-12-05 23:59:06 PST by Aharon (Vladimir) Lanin (aharon@google.com)

(In reply to comment #1 [https://bugs.webkit.org/show_bug.cgi?id=71194#c1])
> Are there relevant specs that specifiy this behavior?

That's the way it was imagined when plaintext was first suggested, and that meeting's notes have the following formulation:

If the element's text-align or text-align-last is start or end, for every line box contained completely within the element, the alignment is determined by the paragraph level of the containing UBA paragraph that got its paragraph level from this element.

However, this is not a spec and has no actual standing. No mention of this behavior was ever made in the plaintext spec in CSS Writing Modes Level 3. That spec's editor, who also made the formulation above, is unsure why it was dropped from the spec. There has not yet been any guidance from the CSS WG on whether the spec is likely to be changed in this respect.

> Should this happen on any element that doesn't specify text-align or direction?

It should happen when the element's text-align (or text-align-last) is "start" or (in reverse) if it's "end". Please note that "start" is the default value of text-align for the root element, but from there on it is determined by inheritance when not explicitly specified. The start and end values normally work on the basis of the element's direction property, but the very nature of the suggestion is that in a unicode-bidi:plaintext element, the start and end values should work off the paragraph direction instead (and thus ignore the element's direction).

================================

Comment #3
Posted on 2012-02-12 04:06:58 PST by Aharon (Vladimir) Lanin (aharon@google.com)

1. Please note that the paragraph direction sets alignment not only for "text-align:start" and "text-align:end", but also for "text-align:start end", as well as for "text-align-last:start" and "text-align-last:end".

2. I think that while the direction of a non-empty all-neutral paragraph should remain LTR as it is currently implemented, I think that there is room for "fudging" a little and making the direction of a completely empty (not just all-neutral) paragraph match the direction of the preceding paragraph, and if there is none, then the element's computed direction. The purpose of this would be just to set the alignment such that when typing a sequence of RTL paragraphs in a unicode-bidi:plaintext textarea, one will not initially start off with the caret on the left for each new paragraph. Other than alignment in a textarea, the direction of an empty paragraph is (I think) a moot point.
 
Labels: OS-All Cr-Blink Cr-Blink-RTL

Comment 2 by le...@chromium.org, Sep 3 2013

Cc: aharon.l...@gmail.com le...@chromium.org
Igor Oliveira uploaded a patch that changes our behavior here (https://codereview.chromium.org/23567004/). The code change looks okay, but I'd love some final guidance from Aharon that this is a change we should make. Ideally, we'd try to get this cleared up in the spec.
I have not looked at the patch, but the basic idea of adjusting the alignment of each bidi paragraph in a unicode-bidi:plaintext block (it certainly is not limited to a textarea) to the directionality of that bidi paragraph is good, and in fact is now specified, see http://dev.w3.org/csswg/css-text/#bidi-linebox. (The somewhat older version currently in http://www.w3.org/TR/css3-text/ is not materially different, it just has a typo or two.)

Please do read the spec: it has a lot of interesting detail and a bunch of nice examples. Note that it also deals with empty paragraphs and makes their alignment (not directionality, as I suggested above) match the preceding paragraph, if any, and if not, the unicode-bidi:plaintext element's direction style. The purpose of that is to give a better default caret location at the start of a new paragraph in a textarea or contentEditable.

Project Member

Comment 4 by bugdroid1@chromium.org, Sep 5 2013

The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=157263

------------------------------------------------------------------------
r157263 | igor.o@sisa.samsung.com | 2013-09-05T02:27:05.155955Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-expected.txt?r1=157263&r2=157262&pathrev=157263
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/text/international/unicode-bidi-plaintext-expected.html?r1=157263&r2=157262&pathrev=157263
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt?r1=157263&r2=157262&pathrev=157263
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/RenderBlock.h?r1=157263&r2=157262&pathrev=157263
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/TestExpectations?r1=157263&r2=157262&pathrev=157263
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt?r1=157263&r2=157262&pathrev=157263
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/RenderBlockLineLayout.cpp?r1=157263&r2=157262&pathrev=157263
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt?r1=157263&r2=157262&pathrev=157263

In the css3-text spec:

The start and end edges of a line box are determined by the inline base
direction of the line box. In most cases, this is given by its
containing block's computed ‘direction’. However if its containing block
has ‘unicode-bidi: plaintext’, the inline base direction the line box must
be determined by the base direction of the bidi paragraph to which it
belongs: that is, the bidi paragraph for which the line box holds content.

This patch just implements the behavior described above modifying
updateLogicalWidthForAlignment and setting the bidi level of the
RootInlineBox.

Additionally, modify two layout tests to make it conforming to the spec.

BUG= 280709 

Review URL: https://chromiumcodereview.appspot.com/23567004
------------------------------------------------------------------------

Comment 5 by le...@chromium.org, Sep 5 2013

Status: Fixed
Thanks for the clarification, Aharon!
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 5 2013

The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=157327

------------------------------------------------------------------------
r157327 | chrome-bot@google.com | 2013-09-05T23:00:23.164832Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/invalid/019-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac-snowleopard/fast/multicol/span/span-as-immediate-child-generated-content-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.png?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/forms/textarea-scrollbar-expected.txt?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/dynamic/011-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-s-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-ne-expected.png?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/invalid/004-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/multicol/span/span-as-nested-columns-child-dynamic-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-w-expected.png?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/textarea-scrollbar-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dynamic/011-expected.txt?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/tables/mozilla/bugs/bug647-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/invalid/004-expected.txt?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac-lion/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-child-generated-content-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/linux/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/linux/svg/custom/getsvgdocument-expected.png?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/tables/mozilla/bugs/bug647-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/fast/multicol/span/span-as-immediate-child-generated-content-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/http/tests/navigation/javascriptlink-frames-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/linux/fast/multicol/span/span-as-immediate-child-generated-content-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-sw-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac-lion/fast/multicol/span/span-as-immediate-child-generated-content-expected.png?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/forms/textarea-width-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-size-change-expected.png?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/invalid/001-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/textarea-width-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/fast/forms/formmove3-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/invalid/001-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/tables/mozilla/other/wa_table_tr_align-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/fast/forms/select/listbox-appearance-basic-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-e-expected.png?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/linux/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-child-generated-content-expected.png?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/forms/preserveFormDuringResidualStyle-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/parser/open-comment-in-textarea-expected.txt?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/forms/input-align-image-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-se-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/forms/formmove3-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/textarea-scrolled-type-expected.txt?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/TestExpectations?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/input-align-image-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-nw-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/win/svg/custom/getsvgdocument-expected.png?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/tables/mozilla/bugs/bug113235-1-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/textarea-scroll-height-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/http/tests/navigation/javascriptlink-frames-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/compositing/rubberbanding/transform-overhang-n-expected.png?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/dynamic/002-expected.txt?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/invalid/003-expected.txt?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/invalid/007-expected.txt?r1=157327&r2=157326&pathrev=157327
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac/fast/invalid/019-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dynamic/002-expected.txt?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/invalid/003-expected.txt?r1=157327&r2=157326&pathrev=157327
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/platform/mac-snowleopard/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.png?r1=157327&r2=157326&pathrev=157327
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/invalid/007-expected.txt?r1=157327&r2=157326&pathrev=157327

Auto-rebaseline for r157319

http://src.chromium.org/viewvc/blink?view=revision&revision=157319

BUG= 280709 
TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/24013002
------------------------------------------------------------------------

Sign in to add a comment