WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
33503
REGRESSION: LayoutTests/editing/selection/caret-rtl-2.html fails
https://bugs.webkit.org/show_bug.cgi?id=33503
Summary
REGRESSION: LayoutTests/editing/selection/caret-rtl-2.html fails
Dimitri Glazkov (Google)
Reported
2010-01-11 16:41:00 PST
This is only evident when run with --pixel-tests --tolerance 0. The caret is between the first and second character. Is this what is supposed to be happening?
Attachments
Actual result.
(23.01 KB, image/png)
2010-01-11 16:42 PST
,
Dimitri Glazkov (Google)
no flags
Details
fixes the bug
(305.62 KB, patch)
2010-12-08 00:50 PST
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed per Dan's comment
(305.76 KB, patch)
2010-12-08 11:51 PST
,
Ryosuke Niwa
mitz: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Dimitri Glazkov (Google)
Comment 1
2010-01-11 16:42:24 PST
Created
attachment 46319
[details]
Actual result.
mitz
Comment 2
2010-01-11 16:50:23 PST
<
rdar://problem/7531574
>
mitz
Comment 3
2010-01-11 17:00:21 PST
Good:
http://trac.webkit.org/browser/trunk/LayoutTests/platform/mac/editing/selection/caret-rtl-2-expected.png?rev=35404
Bad:
http://trac.webkit.org/browser/trunk/LayoutTests/platform/mac/editing/selection/caret-rtl-2-expected.png?rev=38122
Worse: TOT
mitz
Comment 4
2010-01-11 18:55:18 PST
The change from Bad to Worse probably happened in
http://trac.webkit.org/changeset/42685
and
http://trac.webkit.org/changeset/42686
.
Tony Chang
Comment 5
2010-03-11 16:44:10 PST
***
Bug 34692
has been marked as a duplicate of this bug. ***
Xiaomei Ji
Comment 6
2010-04-16 16:31:58 PDT
(In reply to
comment #3
)
> Good: >
http://trac.webkit.org/browser/trunk/LayoutTests/platform/mac/editing/selection/caret-rtl-2-expected.png?rev=35404
> Bad: >
http://trac.webkit.org/browser/trunk/LayoutTests/platform/mac/editing/selection/caret-rtl-2-expected.png?rev=38122
> Worse: TOT
Looks like the patch for
https://bugs.webkit.org/show_bug.cgi?id=25319
will change the result from Worse to Bad. Is from bad to good related to your
comment #3
in
https://bugs.webkit.org/show_bug.cgi?id=24278
?
Ryosuke Niwa
Comment 7
2010-10-27 09:57:21 PDT
We should make this use dump-as-markup.js. We can then detect failure without using --tolerance 0.
Ryosuke Niwa
Comment 8
2010-11-18 14:26:00 PST
The problem is that when I click to the right of "שדה בור", InlineTextBox::offsetForPosition returns offset 0 but it's ambiguous whether this is wrong or not. This is correct if this inline text box was in a RTL context but it's wrong if this inline text box was inside a LTR context. This bug is related to the
bug 24278
.
Ryosuke Niwa
Comment 9
2010-12-07 19:11:28 PST
With a lot of help from jamesr, I think I have a fix for this bug: Index: WebCore/rendering/InlineTextBox.cpp =================================================================== --- WebCore/rendering/InlineTextBox.cpp (revision 73467) +++ WebCore/rendering/InlineTextBox.cpp (working copy) @@ -1100,8 +1100,14 @@ RenderText* text = toRenderText(renderer()); RenderStyle* style = text->style(m_firstLine); const Font* f = &style->font(); + if (renderer()->containingBlock()->style()->isLeftToRightDirection() != isLeftToRightDirection()) { + if (lineOffset - logicalLeft() > logicalWidth()) + return isLeftToRightDirection() ? 0 : m_len; + else if (lineOffset - logicalLeft() < 0) + return isLeftToRightDirection() ? m_len : 0; + } return f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()), - lineOffset - logicalLeft(), includePartialGlyphs); + lineOffset - logicalLeft(), includePartialGlyphs); } I'll test this code a little more and post a patch tomorrow.
Ryosuke Niwa
Comment 10
2010-12-08 00:50:33 PST
Created
attachment 75880
[details]
fixes the bug
Ryosuke Niwa
Comment 11
2010-12-08 00:52:15 PST
(In reply to
comment #10
)
> Created an attachment (id=75880) [details] > fixes the bug
This patch is massive only because I added a lot of tests. The code change in WebCore is just 6 lines. I just verified that WebKit, with my patch, does the right thing in the middle of LTR / RTL boundary: <div>hello<span style="padding-left: 20px;">בור</span> webkit</div> I rather add this test as a separate patch though since this patch is already 300KB+.
Darin Adler
Comment 12
2010-12-08 08:31:26 PST
Comment on
attachment 75880
[details]
fixes the bug This seems related to the notion of a “split caret”. Have we decided what to do about that case? Dan, I think you are the best reviewer for this patch; code change looks fine to me, but I want to make sure we are headed in the right direction on this.
Ryosuke Niwa
Comment 13
2010-12-08 10:08:14 PST
(In reply to
comment #12
)
> (From update of
attachment 75880
[details]
) > This seems related to the notion of a “split caret”. Have we decided what to do about that case?
Right. On Mac, at least, this is the case where we show a split caret (the
bug 3710
). However, there is a heated discussion about whether or not Chromium port should support split caret internally at Google, and a group of engineers in Israel are discussing the most intuitive behavior for users. We may conduct some UX research as well. Because of this, Chromium port can't adopt the split caret at the moment. We'll get back to you once reached some consensus. Furthermore, regardless of whether or not we adopt split caret, the
bug 3710
seems to require significant amount of work given that your patch posted in 2005 is 50KB. Since this bug (33503) is a regression and affects a large amount of users, I wanted to fix it before we can reach consensus for the
bug 3710
.
mitz
Comment 14
2010-12-08 10:50:33 PST
Comment on
attachment 75880
[details]
fixes the bug View in context:
https://bugs.webkit.org/attachment.cgi?id=75880&action=review
> WebCore/ChangeLog:10 > + adn the offset at the end of RTL text is on the right of RTL text. For example, if we had RTL text CBA,
Typo: adn
> WebCore/ChangeLog:22 > + The bug was caused by WebKit's not considering case 2. The same bug also existe for LTR text in a RTL block.
Typo: existe
> WebCore/rendering/InlineTextBox.cpp:1107 > + if (lineOffset - logicalLeft() > logicalWidth()) > + return isLeftToRightDirection() ? 0 : m_len; > + if (lineOffset - logicalLeft() < 0) > + return isLeftToRightDirection() ? m_len : 0;
Can the call to Font::offsetForPosition() always be skipped in these cases (not only when the directions differ)?
Ryosuke Niwa
Comment 15
2010-12-08 11:00:15 PST
Thanks for the review, Dan! (In reply to
comment #14
)
> (From update of
attachment 75880
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=75880&action=review
> > > WebCore/ChangeLog:10 > > + adn the offset at the end of RTL text is on the right of RTL text. For example, if we had RTL text CBA, > > Typo: adn
Will fix.
> > WebCore/ChangeLog:22 > > + The bug was caused by WebKit's not considering case 2. The same bug also existe for LTR text in a RTL block. > > Typo: existe
Will fix.
> > WebCore/rendering/InlineTextBox.cpp:1107 > > + if (lineOffset - logicalLeft() > logicalWidth()) > > + return isLeftToRightDirection() ? 0 : m_len; > > + if (lineOffset - logicalLeft() < 0) > > + return isLeftToRightDirection() ? m_len : 0; > > Can the call to Font::offsetForPosition() always be skipped in these cases (not only when the directions differ)?
That's a good point. We need to reverse the values in that case though. I'll try & see.
Ryosuke Niwa
Comment 16
2010-12-08 11:51:58 PST
Created
attachment 75940
[details]
Fixed per Dan's comment
Ryosuke Niwa
Comment 17
2010-12-08 13:56:09 PST
Committed
r73548
: <
http://trac.webkit.org/changeset/73548
>
Ryosuke Niwa
Comment 18
2010-12-08 14:35:18 PST
Oops, I forgot to fix those typos in my commit. Fixed in
http://trac.webkit.org/changeset/73553
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug