[Webkit-unassigned] [Bug 69680] Dir attribute is converted into direction property when merging paragraphs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 10 15:50:30 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=69680





--- Comment #2 from Ryosuke Niwa <rniwa at webkit.org>  2011-10-10 15:50:30 PST ---
Thanks for the response, Aharon!

(In reply to comment #1)
> > should we generate <div dir="ltr">XY</div>
> > or <div dir="ltr">X<span dir="rtl">Y</div>?
> 
> IMO, the former. The problem with the latter is that you are converting paragraph direction style to inline direction style. While paragraph direction is usually indicated by alignment, and most editors provide buttons to see it and control it, neither is the case for inline direction.

Right. It's really hard for users to figure out that the latter is happening.

>Thus, later on, the user has no way of knowing that the <span dir=rtl> is there, and thus will be surprised when things work differently than they do normally. And even if the user figures out what's going on, he has no way of removing the inline direction style, and can not tell whether the caret is inside it or just next to it.

Safari provides a context menu to do this but I agree that it's not so user-friendly if the user had to use it very often after copy-paste.

> > WebKit currently adds direction property when copying content
> > inside an element with dir property. But this wouldn't work if
> > the copied content was wrapped by span (need to add
> > unicode-bidi: embed as well). I don't even know what the correct
> > behavior is.
> 
> First, about the dir attribute vs direction & unicode-embded styles: stay true to what the source has. If it has mark-up like the dir attribute, use that mark-up. Only use CSS if it has something beyond the mark-up. 

This issue is a little tangential in my opinion. It's same problem as WebKit converting b to <span style="font-weight: bold"> in some cases. We can probably tackle this in some other bug.

> Now regarding copying directional information on the copy command. Here too, I think the guiding principle should be to avoid creating inline direction. Thus, if you are going to be creating a <div> or <p>, I think it is very good to put a dir on it in accordance with the source's computed style (even if the source did not have it explicitly on that element). And if the source already has a <span dir=...>, then by all means copy it verbatim. But I do not think that it is good to create a span with direction when the source did not have it.

Here's a tricky case what if an user selected a part of block? e.g. ([ and ] indicate the start and the end of selection below)
<div dir="rtl">hello [world<p>WebKit</p>]</div>

In this case, p is a block element and it has RTL directionality inherited from the parent div. Which one of the following markups should we generate?
1. world<p>WebKit</p>
2. world<p dir="rtl">WebKit</p>
3. <div dir="rtl">world<p>WebKit</p></div>

I'd cross-out option 2 because "world" and "WebKit" would have different directionalities after paste and behave differently for <div dir="rtl">hello [world<br>WebKit]</div>

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list