Changeset 93221 in webkit
- Timestamp:
- Aug 17, 2011, 11:07:33 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/editing/selection/collapse-selection-in-bidi-expected.txt (added)
-
LayoutTests/editing/selection/collapse-selection-in-bidi.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/editing/FrameSelection.cpp (modified) (5 diffs)
-
Source/WebCore/editing/FrameSelection.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r93217 r93221 1 2011-08-17 Ryosuke Niwa <rniwa@webkit.org> 2 3 An arrow key collapses directionless selection range in the wrong direction in BiDi 4 https://bugs.webkit.org/show_bug.cgi?id=64626 5 6 Reviewed by Darin Adler. 7 8 Added a test to ensure collapsing directionless selection respects the direction of text around 9 the selection's end points. 10 11 * editing/selection/collapse-selection-in-bidi-expected.txt: Added. 12 * editing/selection/collapse-selection-in-bidi.html: Added. 13 1 14 2011-08-17 Steve Block <steveblock@google.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r93219 r93221 1 2011-08-17 Ryosuke Niwa <rniwa@webkit.org> 2 3 An arrow key collapses directionless selection range in the wrong direction in BiDi 4 https://bugs.webkit.org/show_bug.cgi?id=64626 5 6 Reviewed by Darin Adler. 7 8 The bug was caused by willBeModified's always using block direction to determine 9 the direction to which the selection is collapsed. Fixed the bug by calling directionOfSelection 10 in willBeModified, which will return the text direction of the surrounding context when 11 the start and the end have the same direction. When the text directions at the start and at the end 12 of selection do not match, it uses the block's text direction. 13 14 Test: editing/selection/collapse-selection-in-bidi.html 15 16 * editing/FrameSelection.cpp: 17 (WebCore::FrameSelection::directionOfSelection): Added. 18 (WebCore::FrameSelection::willBeModified): Calls directionOfSelection. 19 (WebCore::FrameSelection::modifyMovingRight): Ditto. 20 (WebCore::FrameSelection::modifyMovingLeft): Ditto. 21 * editing/FrameSelection.h: 22 1 23 2011-08-17 Jeff Miller <jeffm@apple.com> 2 24 -
trunk/Source/WebCore/editing/FrameSelection.cpp
r93134 r93221 391 391 } 392 392 393 TextDirection FrameSelection::directionOfSelection() 394 { 395 InlineBox* startBox = 0; 396 InlineBox* endBox = 0; 397 int unusedOffset; 398 if (m_selection.start().isNotNull()) 399 m_selection.visibleStart().getInlineBoxAndOffset(startBox, unusedOffset); 400 if (m_selection.end().isNotNull()) 401 m_selection.visibleEnd().getInlineBoxAndOffset(endBox, unusedOffset); 402 if (startBox && endBox && startBox->direction() == endBox->direction()) 403 return startBox->direction(); 404 405 return directionOfEnclosingBlock(); 406 } 407 393 408 void FrameSelection::willBeModified(EAlteration alter, SelectionDirection direction) 394 409 { … … 412 427 switch (direction) { 413 428 case DirectionRight: 414 if (directionOf EnclosingBlock() == LTR)429 if (directionOfSelection() == LTR) 415 430 baseIsStart = true; 416 431 else … … 421 436 break; 422 437 case DirectionLeft: 423 if (directionOf EnclosingBlock() == LTR)438 if (directionOfSelection() == LTR) 424 439 baseIsStart = false; 425 440 else … … 554 569 case CharacterGranularity: 555 570 if (isRange()) { 556 if (directionOf EnclosingBlock() == LTR)571 if (directionOfSelection() == LTR) 557 572 pos = VisiblePosition(m_selection.end(), m_selection.affinity()); 558 573 else … … 725 740 case CharacterGranularity: 726 741 if (isRange()) 727 if (directionOf EnclosingBlock() == LTR)742 if (directionOfSelection() == LTR) 728 743 pos = VisiblePosition(m_selection.start(), m_selection.affinity()); 729 744 else -
trunk/Source/WebCore/editing/FrameSelection.h
r93134 r93221 249 249 void respondToNodeModification(Node*, bool baseRemoved, bool extentRemoved, bool startRemoved, bool endRemoved); 250 250 TextDirection directionOfEnclosingBlock(); 251 TextDirection directionOfSelection(); 251 252 252 253 VisiblePosition positionForPlatform(bool isGetStart) const;
Note:
See TracChangeset
for help on using the changeset viewer.