Changeset 19811 in webkit
- Timestamp:
- Feb 22, 2007 3:51:47 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r19806 r19811 1 2007-02-22 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by darin 4 5 <rdar://problem/5007143> 6 REGRESSION: WebKit doesn't remember horizontal position of caret when moving forward by line 7 8 Added, tests the removal of the use of the 9 recalc bool from xPosForVerticalArrowNavigation(...): 10 * editing/selection/5007143-2-expected.checksum: Added. 11 * editing/selection/5007143-2-expected.png: Added. 12 * editing/selection/5007143-2-expected.txt: Added. 13 * editing/selection/5007143-2.html: Added. 14 Added, demonstrate the changes to modify: 15 * editing/selection/5007143-expected.checksum: Added. 16 * editing/selection/5007143-expected.png: Added. 17 * editing/selection/5007143-expected.txt: Added. 18 * editing/selection/5007143.html: Added. 19 Demonstrates a bug (filed 5017312): 20 * editing/style/block-style-004-expected.txt: 21 * editing/style/block-style-005-expected.txt: 22 * editing/style/block-style-006-expected.txt: 23 Fixed: 24 * editing/selection/3690703-2-expected.checksum: 25 * editing/selection/3690703-2-expected.png: 26 * editing/selection/3690703-2-expected.txt: 27 * editing/style/create-block-for-style-009-expected.checksum: 28 * editing/style/create-block-for-style-009-expected.png: 29 * editing/style/create-block-for-style-009-expected.txt: 30 * editing/style/create-block-for-style-011-expected.checksum: 31 * editing/style/create-block-for-style-011-expected.png: 32 * editing/style/create-block-for-style-011-expected.txt: 33 1 34 2007-02-22 Adele Peterson <adele@apple.com> 2 35 -
trunk/LayoutTests/editing/selection/3690703-2-expected.checksum
r14777 r19811 1 452b613a30dd16c4dc466d6a7c26d8e6 1 2670a8da12f9a73062439bd90375c24d -
trunk/LayoutTests/editing/selection/3690703-2-expected.txt
r19605 r19811 148 148 layer at (206,88) size 385x13 149 149 RenderBlock {DIV} at (3,3) size 385x13 150 selection start: position 0 of child 4{INPUT} of child 1 {TD} of child 0 {TR} of child 0 {TBODY} of child 2 {TABLE} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document150 selection start: position 0 of child 3 {INPUT} of child 1 {TD} of child 0 {TR} of child 0 {TBODY} of child 2 {TABLE} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document 151 151 selection end: position 1 of child 2 {BR} of child 0 {FONT} of child 2 {TD} of child 0 {TR} of child 0 {TBODY} of child 2 {TABLE} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/style/block-style-004-expected.txt
r19605 r19811 12 12 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 13 13 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 14 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 14 15 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 15 16 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -
trunk/LayoutTests/editing/style/block-style-005-expected.txt
r19605 r19811 12 12 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 13 13 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 14 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 14 15 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 15 16 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -
trunk/LayoutTests/editing/style/block-style-006-expected.txt
r19605 r19811 12 12 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 13 13 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 14 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 14 15 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 15 16 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -
trunk/LayoutTests/editing/style/create-block-for-style-009-expected.checksum
r12711 r19811 1 e7b924dbdde9acccf847881eafab9aed 1 9f6f3cef5f3215cca9f6557f89cacf1a -
trunk/LayoutTests/editing/style/create-block-for-style-009-expected.txt
r19605 r19811 4 4 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 5 5 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 6 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 2 of #text > DIV > DIV > DIV > BODY > HTML > #document to 2 of #text >DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE6 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 7 7 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 8 8 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 28 28 text run at (361,0) width 34: "baz" 29 29 RenderBlock (anonymous) at (14,126) size 756x0 30 caret: position 2of child 0 {#text} of child 2 {DIV} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document30 caret: position 1 of child 0 {#text} of child 2 {DIV} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/style/create-block-for-style-011-expected.checksum
r12711 r19811 1 13699ca76620e54ff95b441919cea70d 1 3c9f840fe96eb5903f08fdced33ac2e0 -
trunk/LayoutTests/editing/style/create-block-for-style-011-expected.txt
r19605 r19811 5 5 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 6 6 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 7 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 3of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE7 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 8 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 9 9 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 30 30 RenderBlock (anonymous) at (14,126) size 756x0 31 31 selection start: position 1 of child 0 {#text} of child 1 {DIV} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document 32 selection end: position 3of child 0 {#text} of child 2 {DIV} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document32 selection end: position 2 of child 0 {#text} of child 2 {DIV} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/WebCore/ChangeLog
r19810 r19811 1 2007-02-22 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by darin 4 5 <rdar://problem/5007143> 6 REGRESSION: WebKit doesn't remember horizontal position of caret when moving forward by line 7 8 * editing/SelectionController.cpp: 9 (WebCore::SelectionController::SelectionController): Initialize 10 m_xPosForVerticalArrowNavigation. 11 (WebCore::SelectionController::setSelection): Call the new setter. 12 (WebCore::SelectionController::modifyMovingRightForward): For line 13 and paragraph granularities, use the saved xPosForVerticalArrowNavigation 14 even if the old selection was a range. Use the x position of the 15 *start*, not the end of the selection if there is no saved 16 xPosForVerticalArrowNavigation. This matches TextEdit's behavior. 17 (WebCore::SelectionController::modifyMovingLeftBackward): For line 18 and paragraph granularities, use the saved xPosForVerticalArrowNavigation 19 even if the old selection was a range. 20 (WebCore::SelectionController::modify): Preserve the xPosForVerticalArrowNavigation 21 for line and paragraph granularities. 22 (WebCore::SelectionController::xPosForVerticalArrowNavigation): Removed 23 the recalc bool because it is now always false. 24 (WebCore::SelectionController::setXPosForVerticalArrowNavigation): Added. 25 * editing/SelectionController.h: Moved m_xPosForVerticalArrowNavigation 26 from Frame. 27 * page/Frame.cpp: Moved m_xPosForVerticalArrowNavigation to SelectionController. 28 * page/Frame.h: Ditto. 29 * page/FramePrivate.h: Ditto. 30 1 31 2007-02-22 Beth Dakin <bdakin@apple.com> 2 32 -
trunk/WebCore/editing/SelectionController.cpp
r19785 r19811 64 64 , m_isDragCaretController(isDragCaretController) 65 65 , m_isCaretBlinkingSuspended(false) 66 , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation) 66 67 { 67 68 } … … 134 135 // Always clear the x position used for vertical arrow navigation. 135 136 // It will be restored by the vertical arrow navigation code if necessary. 136 m_ frame->setXPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation);137 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation; 137 138 selectFrameElementInParentIfFullySelected(); 138 139 m_frame->notifyRendererOfSelectionChange(userTriggered); … … 289 290 pos = VisiblePosition(m_sel.end(), m_sel.affinity()); 290 291 if (!isRange() || !isStartOfLine(pos)) 291 pos = nextLinePosition(pos, xPosForVerticalArrowNavigation( END, isRange()));292 pos = nextLinePosition(pos, xPosForVerticalArrowNavigation(START)); 292 293 break; 293 294 } 294 295 case ParagraphGranularity: 295 pos = nextParagraphPosition(VisiblePosition(m_sel.end(), m_sel.affinity()), xPosForVerticalArrowNavigation( END, isRange()));296 pos = nextParagraphPosition(VisiblePosition(m_sel.end(), m_sel.affinity()), xPosForVerticalArrowNavigation(START)); 296 297 break; 297 298 case SentenceBoundary: … … 384 385 break; 385 386 case LineGranularity: 386 pos = previousLinePosition(VisiblePosition(m_sel.start(), m_sel.affinity()), xPosForVerticalArrowNavigation(START , isRange()));387 pos = previousLinePosition(VisiblePosition(m_sel.start(), m_sel.affinity()), xPosForVerticalArrowNavigation(START)); 387 388 break; 388 389 case ParagraphGranularity: 389 pos = previousParagraphPosition(VisiblePosition(m_sel.start(), m_sel.affinity()), xPosForVerticalArrowNavigation(START , isRange()));390 pos = previousParagraphPosition(VisiblePosition(m_sel.start(), m_sel.affinity()), xPosForVerticalArrowNavigation(START)); 390 391 break; 391 392 case SentenceBoundary: … … 495 496 if (pos.isNull()) 496 497 return false; 498 499 // Some of the above operations set an xPosForVerticalArrowNavigation. 500 // Setting a selection will clear it, so save it to possibly restore later. 501 // Note: the START position type is arbitrary because it is unused, it would be 502 // the requested position type if there were no xPosForVerticalArrowNavigation set. 503 int x = xPosForVerticalArrowNavigation(START); 497 504 498 505 switch (alter) { … … 504 511 break; 505 512 } 513 514 if (granularity == LineGranularity || granularity == ParagraphGranularity) 515 m_xPosForVerticalArrowNavigation = x; 506 516 507 517 if (userTriggered) { … … 562 572 case MOVE: 563 573 pos = VisiblePosition(up ? m_sel.start() : m_sel.end(), m_sel.affinity()); 564 xPos = xPosForVerticalArrowNavigation(up ? START : END , isRange());574 xPos = xPosForVerticalArrowNavigation(up ? START : END); 565 575 m_sel.setAffinity(up ? UPSTREAM : DOWNSTREAM); 566 576 break; … … 626 636 } 627 637 628 int SelectionController::xPosForVerticalArrowNavigation(EPositionType type , bool recalc) const638 int SelectionController::xPosForVerticalArrowNavigation(EPositionType type) 629 639 { 630 640 int x = 0; … … 653 663 return x; 654 664 655 if ( recalc || frame->xPosForVerticalArrowNavigation()== NoXPosForVerticalArrowNavigation) {665 if (m_xPosForVerticalArrowNavigation == NoXPosForVerticalArrowNavigation) { 656 666 pos = VisiblePosition(pos, m_sel.affinity()).deepEquivalent(); 657 667 // VisiblePosition creation can fail here if a node containing the selection becomes visibility:hidden 658 668 // after the selection is created and before this function is called. 659 669 x = pos.isNotNull() ? pos.node()->renderer()->caretRect(pos.offset(), m_sel.affinity()).x() : 0; 660 frame->setXPosForVerticalArrowNavigation(x);661 } 662 else {663 x = frame->xPosForVerticalArrowNavigation();664 }670 m_xPosForVerticalArrowNavigation = x; 671 } 672 else 673 x = m_xPosForVerticalArrowNavigation; 674 665 675 return x; 666 676 } -
trunk/WebCore/editing/SelectionController.h
r19785 r19811 167 167 IntRect caretRepaintRect() const; 168 168 169 int xPosForVerticalArrowNavigation(EPositionType , bool recalc = false) const;169 int xPosForVerticalArrowNavigation(EPositionType); 170 170 171 171 Selection m_sel; … … 185 185 186 186 bool m_isCaretBlinkingSuspended; 187 188 int m_xPosForVerticalArrowNavigation; 187 189 }; 188 190 -
trunk/WebCore/page/Frame.cpp
r19702 r19811 641 641 } 642 642 643 void Frame::setXPosForVerticalArrowNavigation(int x)644 {645 d->m_xPosForVerticalArrowNavigation = x;646 }647 648 int Frame::xPosForVerticalArrowNavigation() const649 {650 return d->m_xPosForVerticalArrowNavigation;651 }652 653 643 void Frame::caretBlinkTimerFired(Timer<Frame>*) 654 644 { -
trunk/WebCore/page/Frame.h
r19702 r19811 320 320 void paintDragCaret(GraphicsContext*, const IntRect&) const; 321 321 322 void setXPosForVerticalArrowNavigation(int);323 int xPosForVerticalArrowNavigation() const;324 325 322 bool isContentEditable() const; // if true, everything in frame is editable 326 323 -
trunk/WebCore/page/FramePrivate.h
r19702 r19811 99 99 bool m_isActive : 1; 100 100 101 int m_xPosForVerticalArrowNavigation;102 101 RefPtr<CSSMutableStyleDeclaration> m_typingStyle; 103 102
Note: See TracChangeset
for help on using the changeset viewer.