Changeset 74971 in webkit
- Timestamp:
- Jan 4, 2011 9:21:13 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r74963 r74971 1 2011-01-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Dan Bernstein. 4 5 Clicking on the first or the last letter of LTR/RTL text in a RTL/LTR block puts caret on the opposite side. 6 https://bugs.webkit.org/show_bug.cgi?id=50992 7 8 Added a test to ensure WebKit places the caret on the side user clicked even when text's natural direction 9 and the containing block's direction do not match. 10 11 * editing/selection/caret-bidi-first-and-last-letters-expected.txt: Added. 12 * editing/selection/caret-bidi-first-and-last-letters.html: Added. 13 * editing/selection/resources/caret-edge-shared.js: Avoid calling verify() outside of DRT. 14 1 15 2011-01-04 Sheriff Bot <webkit.review.bot@gmail.com> 2 16 -
trunk/LayoutTests/editing/selection/resources/caret-edge-shared.js
r73548 r74971 3 3 var div = document.getElementsByTagName('div')[0]; 4 4 5 if (!window.layoutTestController) { 6 div.addEventListener('mouseup', verify); 5 if (!window.layoutTestController) 7 6 return; 8 }9 7 10 8 if (clickOn == 'left') -
trunk/WebCore/ChangeLog
r74969 r74971 1 2011-01-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Dan Bernstein. 4 5 Clicking on the first or the last letter of LTR/RTL text in a RTL/LTR block puts caret on the opposite side. 6 https://bugs.webkit.org/show_bug.cgi?id=50992 7 8 Fixed the bug by interchanging the offset when the direction of inline text box and the containing block 9 does not match. Reused the code added by http://trac.webkit.org/changeset/73553. 10 11 Test: editing/selection/caret-bidi-first-and-last-letters.html 12 13 * rendering/InlineTextBox.cpp: 14 (WebCore::InlineTextBox::offsetForPosition): 15 1 16 2010-12-29 Tony Gentilcore <tonyg@chromium.org> 2 17 -
trunk/WebCore/rendering/InlineTextBox.cpp
r74969 r74971 1148 1148 int leftOffset = isLeftToRightDirection() ? 0 : m_len; 1149 1149 int rightOffset = isLeftToRightDirection() ? m_len : 0; 1150 if (renderer()->containingBlock()->style()->isLeftToRightDirection() != isLeftToRightDirection()) 1150 bool blockIsInOppositeDirection = renderer()->containingBlock()->style()->isLeftToRightDirection() != isLeftToRightDirection(); 1151 if (blockIsInOppositeDirection) 1151 1152 swap(leftOffset, rightOffset); 1152 1153 … … 1159 1160 RenderStyle* style = text->style(m_firstLine); 1160 1161 const Font* f = &style->font(); 1161 return f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()), 1162 int offset = f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len, 1163 textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()), 1162 1164 lineOffset - logicalLeft(), includePartialGlyphs); 1165 if (blockIsInOppositeDirection && (!offset || offset == m_len)) 1166 return !offset ? m_len : 0; 1167 return offset; 1163 1168 } 1164 1169
Note: See TracChangeset
for help on using the changeset viewer.