Changeset 90275 in webkit


Ignore:
Timestamp:
Jul 1, 2011 2:07:39 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

2011-07-01 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Ojan Vafai.

Move m_isDirectional from FrameSelection to VisibleSelection
https://bugs.webkit.org/show_bug.cgi?id=63473

Added a test to ensure WebKit preserves non-directional selection after undo on Mac.

The directionality of selection is still lost after undoing DeleteSelectionCommand or TypingCommand
and this will be fixed in follow up patches.

  • editing/deleting/delete-br-011-expected.txt:
  • editing/selection/after-line-break-expected.txt:
  • editing/selection/anchor-focus2-expected.txt:
  • editing/selection/anchor-focus3-expected.txt:
  • editing/selection/directionality-after-undo-replace-expected.txt: Added.
  • editing/selection/directionality-after-undo-replace.html: Added.
  • platform/mac/editing/deleting/delete-br-002-expected.txt:
  • platform/mac/editing/deleting/delete-br-004-expected.txt:
  • platform/mac/editing/deleting/delete-br-005-expected.txt:
  • platform/mac/editing/deleting/delete-br-006-expected.txt:
  • platform/mac/editing/deleting/delete-br-009-expected.txt:
  • platform/mac/editing/deleting/delete-br-010-expected.txt:
  • platform/mac/editing/deleting/smart-delete-002-expected.txt:
  • platform/mac/editing/inserting/insert-3800346-fix-expected.txt:
  • platform/mac/editing/inserting/insert-at-end-01-expected.txt:
  • platform/mac/editing/inserting/insert-at-end-02-expected.txt:
  • platform/mac/editing/inserting/insert-div-010-expected.txt:
  • platform/mac/editing/inserting/insert-div-013-expected.txt:
  • platform/mac/editing/inserting/insert-div-015-expected.txt:
  • platform/mac/editing/inserting/insert-div-019-expected.txt:
  • platform/mac/editing/inserting/insert-paragraph-03-expected.txt:
  • platform/mac/editing/pasteboard/3976872-expected.txt:
  • platform/mac/editing/pasteboard/emacs-ctrl-a-k-y-expected.txt:
  • platform/mac/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt:
  • platform/mac/editing/pasteboard/paste-text-014-expected.txt:
  • platform/mac/editing/selection/4932260-1-expected.txt:
  • platform/mac/editing/selection/expanding-selections-expected.txt:
  • platform/mac/editing/selection/expanding-selections2-expected.txt:
  • platform/mac/editing/selection/fake-drag-expected.txt:
  • platform/mac/editing/selection/move-by-word-001-expected.txt:
  • platform/mac/editing/selection/triple-click-in-pre-expected.txt:
  • platform/mac/editing/style/create-block-for-style-008-expected.txt:
  • platform/mac/editing/undo/4063751-expected.txt:
  • platform/mac/editing/undo/undo-forward-delete-boundary-expected.txt:
  • platform/mac/editing/undo/undo-forward-delete-expected.txt:

2011-07-01 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Ojan Vafai.

Move m_isDirectional from FrameSelection to VisibleSelection
https://bugs.webkit.org/show_bug.cgi?id=63473

Don't pass MakeNonDirectionalSelection to setSelection since no other port does this.

  • src/WebFrameImpl.cpp: (WebKit::WebFrameImpl::selectRange):

2011-07-01 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Ojan Vafai.

Move m_isDirectional from FrameSelection to VisibleSelection
https://bugs.webkit.org/show_bug.cgi?id=63473

Move m_isDirectional from FrameSelection to VisibleSelection.

Also fixed a bug that WebKit does not preserve non-directional selection after undo.

Test: editing/selection/directionality-after-undo-replace.html

  • WebCore.exp.in: Updated the signature of setSelection.
  • editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): Removed the call to setIsDirectional. (WebCore::shouldAlwaysUseDirectionalSelection): Added. (WebCore::FrameSelection::setSelection): No longer takes DirectionalityPolicy. Calls setIsDirectional(true) when the platform doesn't support non-directional selection. Passes align and granularity to setSelection of the base end point as expected. No longer updates granularity when updating the selection of a different frame. (WebCore::FrameSelection::willBeModified): Calls VisibleSelection::isDirectional(). (WebCore::FrameSelection::modify): No longer calls trialFrameSelection.setIsDirectional because the directionality is passed from m_selection automatically. Also calls shouldAlwaysUseDirectionalSelection.
  • editing/FrameSelection.h: Remove m_isDirectional. Make all boolean bit fields. (WebCore::FrameSelection::setSelection): No longer takes DirectionalityPolicy.
  • editing/VisibleSelection.cpp: (WebCore::VisibleSelection::VisibleSelection): Initializes m_isDirectional to true. This should be changed to false to fix the bug 60529.
  • editing/VisibleSelection.h: (WebCore::VisibleSelection::isDirectional): Added. (WebCore::VisibleSelection::setIsDirectional): Added.
  • page/EventHandler.cpp: (WebCore::setNonDirectionalSelectionIfNeeded): Creates a non-directional selection instead of calling setSelection with MakeNonDirectionalSelection. (WebCore::EventHandler::handleMousePressEventSingleClick): Remove the call to setIsDirectional because it already calls setNonDirectionalSelectionIfNeeded.
Location:
trunk
Files:
2 added
43 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r90274 r90275  
     12011-07-01  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        Move m_isDirectional from FrameSelection to VisibleSelection
     6        https://bugs.webkit.org/show_bug.cgi?id=63473
     7
     8        Added a test to ensure WebKit preserves non-directional selection after undo on Mac.
     9
     10        The directionality of selection is still lost after undoing DeleteSelectionCommand or TypingCommand
     11        and this will be fixed in follow up patches.
     12
     13        * editing/deleting/delete-br-011-expected.txt:
     14        * editing/selection/after-line-break-expected.txt:
     15        * editing/selection/anchor-focus2-expected.txt:
     16        * editing/selection/anchor-focus3-expected.txt:
     17        * editing/selection/directionality-after-undo-replace-expected.txt: Added.
     18        * editing/selection/directionality-after-undo-replace.html: Added.
     19        * platform/mac/editing/deleting/delete-br-002-expected.txt:
     20        * platform/mac/editing/deleting/delete-br-004-expected.txt:
     21        * platform/mac/editing/deleting/delete-br-005-expected.txt:
     22        * platform/mac/editing/deleting/delete-br-006-expected.txt:
     23        * platform/mac/editing/deleting/delete-br-009-expected.txt:
     24        * platform/mac/editing/deleting/delete-br-010-expected.txt:
     25        * platform/mac/editing/deleting/smart-delete-002-expected.txt:
     26        * platform/mac/editing/inserting/insert-3800346-fix-expected.txt:
     27        * platform/mac/editing/inserting/insert-at-end-01-expected.txt:
     28        * platform/mac/editing/inserting/insert-at-end-02-expected.txt:
     29        * platform/mac/editing/inserting/insert-div-010-expected.txt:
     30        * platform/mac/editing/inserting/insert-div-013-expected.txt:
     31        * platform/mac/editing/inserting/insert-div-015-expected.txt:
     32        * platform/mac/editing/inserting/insert-div-019-expected.txt:
     33        * platform/mac/editing/inserting/insert-paragraph-03-expected.txt:
     34        * platform/mac/editing/pasteboard/3976872-expected.txt:
     35        * platform/mac/editing/pasteboard/emacs-ctrl-a-k-y-expected.txt:
     36        * platform/mac/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt:
     37        * platform/mac/editing/pasteboard/paste-text-014-expected.txt:
     38        * platform/mac/editing/selection/4932260-1-expected.txt:
     39        * platform/mac/editing/selection/expanding-selections-expected.txt:
     40        * platform/mac/editing/selection/expanding-selections2-expected.txt:
     41        * platform/mac/editing/selection/fake-drag-expected.txt:
     42        * platform/mac/editing/selection/move-by-word-001-expected.txt:
     43        * platform/mac/editing/selection/triple-click-in-pre-expected.txt:
     44        * platform/mac/editing/style/create-block-for-style-008-expected.txt:
     45        * platform/mac/editing/undo/4063751-expected.txt:
     46        * platform/mac/editing/undo/undo-forward-delete-boundary-expected.txt:
     47        * platform/mac/editing/undo/undo-forward-delete-expected.txt:
     48
    1492011-07-01  Mihai Parparita  <mihaip@chromium.org>
    250
  • trunk/LayoutTests/editing/deleting/delete-br-011-expected.txt

    r65208 r90275  
    11EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 4 of BODY > HTML > #document
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
     3EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     4EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     5EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     6EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    37EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    48EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/editing/selection/after-line-break-expected.txt

    r81095 r90275  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     6EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    67Test for rdar://problem/5973313 REGRESSION (r32508): Down arrow doesn't change caret with non-user entered newlines in textareas.
    78
  • trunk/LayoutTests/editing/selection/anchor-focus2-expected.txt

    r81095 r90275  
    11EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    22EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     3EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    34EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    45EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/editing/selection/anchor-focus3-expected.txt

    r81095 r90275  
    11EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    22EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     3EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    34EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    45EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-br-002-expected.txt

    r63291 r90275  
    2525EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2626EDITING DELEGATE: shouldDeleteDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document
     27EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 2 of SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 2 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    2728EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2829EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-br-004-expected.txt

    r63291 r90275  
    2626EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2727EDITING DELEGATE: shouldDeleteDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 4 of SPAN > DIV > BODY > HTML > #document
     28EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    2829EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2930EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-br-005-expected.txt

    r63291 r90275  
    2626EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2727EDITING DELEGATE: shouldDeleteDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 4 of SPAN > DIV > BODY > HTML > #document
     28EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    2829EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2930EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-br-006-expected.txt

    r63291 r90275  
    2626EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2727EDITING DELEGATE: shouldDeleteDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 4 of SPAN > DIV > BODY > HTML > #document
     28EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    2829EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2930EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-br-009-expected.txt

    r63291 r90275  
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: shouldDeleteDOMRange:range from 2 of BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
     10EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1011EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1112EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-br-010-expected.txt

    r63291 r90275  
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: shouldDeleteDOMRange:range from 2 of BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
     10EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1011EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1112EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/smart-delete-002-expected.txt

    r81095 r90275  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     6EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    67EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    78EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/inserting/insert-3800346-fix-expected.txt

    r63291 r90275  
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     14EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of DIV > DIV > BODY > HTML > #document to 3 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 3 of DIV > DIV > BODY > HTML > #document to 3 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1415EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1516EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/inserting/insert-at-end-01-expected.txt

    r63291 r90275  
    11EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 6 of DIV > BODY > HTML > #document
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
     3EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     4EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    35EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    46EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/inserting/insert-at-end-02-expected.txt

    r63291 r90275  
    11EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 7 of DIV > BODY > HTML > #document
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
     3EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     4EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    35EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    46EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/inserting/insert-div-010-expected.txt

    r63291 r90275  
    77EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     9EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    910EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1011EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/inserting/insert-div-013-expected.txt

    r63291 r90275  
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    77EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     8EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > BODY > HTML > #document to 0 of #text > BODY > HTML > #document toDOMRange:range from 0 of #text > BODY > HTML > #document to 0 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    89EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    910EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/inserting/insert-div-015-expected.txt

    r63291 r90275  
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1111EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     12EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1213EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1314EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/inserting/insert-div-019-expected.txt

    r63291 r90275  
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    77EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     8EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of BODY > HTML > #document to 5 of BODY > HTML > #document toDOMRange:range from 5 of BODY > HTML > #document to 5 of BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    89EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    910EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/inserting/insert-paragraph-03-expected.txt

    r63291 r90275  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     6EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document toDOMRange:range from 3 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    67EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    78EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/3976872-expected.txt

    r63291 r90275  
    88EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     10EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1011EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1112EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/emacs-ctrl-a-k-y-expected.txt

    r80121 r90275  
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    66EDITING DELEGATE: shouldDeleteDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 23 of #text > DIV > DIV > BODY > HTML > #document
     7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    78EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    89EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt

    r80121 r90275  
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    66EDITING DELEGATE: shouldDeleteDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document
     7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    78EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    89EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-text-014-expected.txt

    r63291 r90275  
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
     14EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1415EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1516EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/selection/4932260-1-expected.txt

    r63291 r90275  
    11EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
     3EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    34EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    45EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/selection/expanding-selections-expected.txt

    r81095 r90275  
    33EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     5EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    56layer at (0,0) size 800x600
    67  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/selection/expanding-selections2-expected.txt

    r81095 r90275  
    33EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     5EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    56layer at (0,0) size 800x600
    67  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/selection/fake-drag-expected.txt

    r81608 r90275  
    55EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    78EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 5 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    89EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/selection/move-by-word-001-expected.txt

    r63291 r90275  
    11EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
     3EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     4EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     5EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     6EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    37EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    48EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/selection/triple-click-in-pre-expected.txt

    r81095 r90275  
    55EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 30 of #text > PRE > DIV > DIV > BODY > HTML > #document to 30 of #text > PRE > DIV > DIV > BODY > HTML > #document toDOMRange:range from 16 of #text > PRE > DIV > DIV > BODY > HTML > #document to 30 of #text > PRE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 16 of #text > PRE > DIV > DIV > BODY > HTML > #document to 30 of #text > PRE > DIV > DIV > BODY > HTML > #document toDOMRange:range from 16 of #text > PRE > DIV > DIV > BODY > HTML > #document to 30 of #text > PRE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    78layer at (0,0) size 800x600
    89  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/style/create-block-for-style-008-expected.txt

    r78910 r90275  
    33EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     5EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    56EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    67EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/undo/4063751-expected.txt

    r80121 r90275  
    8484EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    8585EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     86EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    8687EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    8788EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    106107EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    107108EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     109EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    108110EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    109111EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/undo/undo-forward-delete-boundary-expected.txt

    r80121 r90275  
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    66EDITING DELEGATE: shouldDeleteDOMRange:range from 5 of #text > SPAN > DIV > BODY > HTML > #document to 6 of #text > SPAN > DIV > BODY > HTML > #document
     7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > SPAN > DIV > BODY > HTML > #document to 5 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > SPAN > DIV > BODY > HTML > #document to 5 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    78EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    89EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/undo/undo-forward-delete-expected.txt

    r80121 r90275  
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    66EDITING DELEGATE: shouldDeleteDOMRange:range from 5 of #text > SPAN > DIV > BODY > HTML > #document to 6 of #text > SPAN > DIV > BODY > HTML > #document
     7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > SPAN > DIV > BODY > HTML > #document to 5 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > SPAN > DIV > BODY > HTML > #document to 5 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    78EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    89EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/Source/WebCore/ChangeLog

    r90271 r90275  
     12011-07-01  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        Move m_isDirectional from FrameSelection to VisibleSelection
     6        https://bugs.webkit.org/show_bug.cgi?id=63473
     7
     8        Move m_isDirectional from FrameSelection to VisibleSelection.
     9
     10        Also fixed a bug that WebKit does not preserve non-directional selection after undo.
     11
     12        Test: editing/selection/directionality-after-undo-replace.html
     13
     14        * WebCore.exp.in: Updated the signature of setSelection.
     15        * editing/FrameSelection.cpp:
     16        (WebCore::FrameSelection::FrameSelection): Removed the call to setIsDirectional.
     17        (WebCore::shouldAlwaysUseDirectionalSelection): Added.
     18        (WebCore::FrameSelection::setSelection): No longer takes DirectionalityPolicy.
     19        Calls setIsDirectional(true) when the platform doesn't support non-directional selection.
     20        Passes align and granularity to setSelection of the base end point as expected.
     21        No longer updates granularity when updating the selection of a different frame.
     22        (WebCore::FrameSelection::willBeModified): Calls VisibleSelection::isDirectional().
     23        (WebCore::FrameSelection::modify): No longer calls trialFrameSelection.setIsDirectional
     24        because the directionality is passed from m_selection automatically.
     25        Also calls shouldAlwaysUseDirectionalSelection.
     26        * editing/FrameSelection.h: Remove m_isDirectional. Make all boolean bit fields.
     27        (WebCore::FrameSelection::setSelection): No longer takes DirectionalityPolicy.
     28        * editing/VisibleSelection.cpp:
     29        (WebCore::VisibleSelection::VisibleSelection): Initializes m_isDirectional to true.
     30        This should be changed to false to fix the bug 60529.
     31        * editing/VisibleSelection.h:
     32        (WebCore::VisibleSelection::isDirectional): Added.
     33        (WebCore::VisibleSelection::setIsDirectional): Added.
     34        * page/EventHandler.cpp:
     35        (WebCore::setNonDirectionalSelectionIfNeeded): Creates a non-directional selection instead of
     36        calling setSelection with MakeNonDirectionalSelection.
     37        (WebCore::EventHandler::handleMousePressEventSingleClick): Remove the call to setIsDirectional
     38        because it already calls setNonDirectionalSelectionIfNeeded.
     39
    1402011-07-01  Tony Chang  <tony@chromium.org>
    241
  • trunk/Source/WebCore/WebCore.exp.in

    r90259 r90275  
    350350__ZN7WebCore14FileIconLoader14notifyFinishedEN3WTF10PassRefPtrINS_4IconEEE
    351351__ZN7WebCore14FrameSelection10setFocusedEb
    352 __ZN7WebCore14FrameSelection12setSelectionERKNS_16VisibleSelectionEjNS0_19CursorAlignOnScrollENS_15TextGranularityENS_20DirectionalityPolicyE
     352__ZN7WebCore14FrameSelection12setSelectionERKNS_16VisibleSelectionEjNS0_19CursorAlignOnScrollENS_15TextGranularityE
    353353__ZN7WebCore14FrameSelection15revealSelectionERKNS_15ScrollAlignmentEb
    354354__ZN7WebCore14FrameSelection16setSelectedRangeEPNS_5RangeENS_9EAffinityEb
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r90098 r90275  
    101101    , m_focused(frame && frame->page() && frame->page()->focusController()->focusedFrame() == frame)
    102102{
    103     setIsDirectional(false);
    104103}
    105104
     
    152151}
    153152
    154 void FrameSelection::setSelection(const VisibleSelection& s, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity, DirectionalityPolicy directionalityPolicy)
    155 {
    156     m_granularity = granularity;
    157 
     153static inline bool shouldAlwaysUseDirectionalSelection(Frame* frame)
     154{
     155    return !frame || frame->editor()->behavior().shouldConsiderSelectionAsDirectional();
     156}
     157
     158void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity)
     159{
    158160    bool closeTyping = options & CloseTyping;
    159161    bool shouldClearTypingStyle = options & ClearTypingStyle;
    160162    EUserTriggered userTriggered = selectionOptionsToUserTriggered(options);
    161163
    162     setIsDirectional(directionalityPolicy == MakeDirectionalSelection);
     164    VisibleSelection s = newSelection;
     165    if (shouldAlwaysUseDirectionalSelection(m_frame))
     166        s.setIsDirectional(true);
    163167
    164168    if (!m_frame) {
     
    172176        Document* document = s.base().anchorNode()->document();
    173177        if (document && document->frame() && document->frame() != m_frame && document != m_frame->document()) {
    174             document->frame()->selection()->setSelection(s, options);
     178            document->frame()->selection()->setSelection(s, options, align, granularity);
    175179            return;
    176180        }
    177181    }
     182
     183    m_granularity = granularity;
    178184
    179185    if (closeTyping)
     
    358364}
    359365
    360 void FrameSelection::setIsDirectional(bool isDirectional)
    361 {
    362     m_isDirectional = !m_frame || m_frame->editor()->behavior().shouldConsiderSelectionAsDirectional() || isDirectional;
    363 }
    364 
    365366TextDirection FrameSelection::directionOfEnclosingBlock()
    366367{
     
    378379    bool baseIsStart = true;
    379380
    380     if (m_isDirectional) {
     381    if (m_selection.isDirectional()) {
    381382        // Make base and extent match start and end so we extend the user-visible selection.
    382383        // This only matters for cases where base and extend point to different positions than
     
    783784        FrameSelection trialFrameSelection;
    784785        trialFrameSelection.setSelection(m_selection);
    785         trialFrameSelection.setIsDirectional(m_isDirectional);
    786786        trialFrameSelection.modify(alter, direction, granularity, NotUserTriggered);
    787787
     
    864864    setCaretRectNeedsUpdate();
    865865
    866     setIsDirectional(alter == AlterationExtend);
     866    m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(m_frame) || alter == AlterationExtend);
    867867
    868868    return true;
     
    887887        FrameSelection trialFrameSelection;
    888888        trialFrameSelection.setSelection(m_selection);
    889         trialFrameSelection.setIsDirectional(m_isDirectional);
    890889        trialFrameSelection.modify(alter, verticalDistance, direction, NotUserTriggered);
    891890
     
    953952        m_granularity = CharacterGranularity;
    954953
    955     setIsDirectional(alter == AlterationExtend);
     954    m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(m_frame) || alter == AlterationExtend);
    956955
    957956    return true;
  • trunk/Source/WebCore/editing/FrameSelection.h

    r89299 r90275  
    4747class VisiblePosition;
    4848
    49 enum DirectionalityPolicy { MakeNonDirectionalSelection, MakeDirectionalSelection };
    5049enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 };
    5150
     
    136135
    137136    const VisibleSelection& selection() const { return m_selection; }
    138     void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity, DirectionalityPolicy = MakeDirectionalSelection);
    139     void setSelection(const VisibleSelection& selection, TextGranularity granularity, DirectionalityPolicy directionality = MakeDirectionalSelection) { setSelection(selection, CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, granularity, directionality); }
     137    void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
     138    void setSelection(const VisibleSelection& selection, TextGranularity granularity) { setSelection(selection, CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, granularity); }
    140139    bool setSelectedRange(Range*, EAffinity, bool closeTyping);
    141140    void selectAll();
     
    180179    void setCaretRectNeedsUpdate() { CaretBase::setCaretRectNeedsUpdate(); }
    181180
    182     void setIsDirectional(bool);
    183181    void willBeModified(EAlteration, SelectionDirection);
    184182
     
    287285    IntRect m_absCaretBounds; // absolute bounding rect for the caret
    288286    IntRect m_absoluteCaretRepaintBounds;
    289     bool m_absCaretBoundsDirty;
    290     bool m_caretPaint;
    291 
    292     bool m_isDirectional;
    293     bool m_isCaretBlinkingSuspended;
    294     bool m_focused;
     287    bool m_absCaretBoundsDirty : 1;
     288    bool m_caretPaint : 1;
     289    bool m_isCaretBlinkingSuspended : 1;
     290    bool m_focused : 1;
    295291};
    296292
  • trunk/Source/WebCore/editing/VisibleSelection.cpp

    r87067 r90275  
    4545    , m_selectionType(NoSelection)
    4646    , m_baseIsFirst(true)
     47    , m_isDirectional(true)
    4748{
    4849}
     
    5253    , m_extent(pos)
    5354    , m_affinity(affinity)
     55    , m_isDirectional(true)
    5456{
    5557    validate();
     
    6062    , m_extent(extent)
    6163    , m_affinity(affinity)
     64    , m_isDirectional(true)
    6265{
    6366    validate();
     
    6871    , m_extent(pos.deepEquivalent())
    6972    , m_affinity(pos.affinity())
     73    , m_isDirectional(true)
    7074{
    7175    validate();
     
    7680    , m_extent(extent.deepEquivalent())
    7781    , m_affinity(base.affinity())
     82    , m_isDirectional(true)
    7883{
    7984    validate();
     
    8489    , m_extent(range->endPosition())
    8590    , m_affinity(affinity)
     91    , m_isDirectional(true)
    8692{
    8793    validate();
  • trunk/Source/WebCore/editing/VisibleSelection.h

    r87067 r90275  
    7979
    8080    bool isBaseFirst() const { return m_baseIsFirst; }
     81    bool isDirectional() const { return m_isDirectional; }
     82    void setIsDirectional(bool isDirectional) { m_isDirectional = isDirectional; }
    8183
    8284    bool isAll(EditingBoundaryCrossingRule) const;
     
    123125    // undoing the command. We need to be able to create a selection that, while currently
    124126    // invalid, will be valid once the changes are undone.
    125    
     127
    126128    Position m_base;   // Where the first click happened
    127129    Position m_extent; // Where the end click happened
     
    132134
    133135    // these are cached, can be recalculated by validate()
    134     SelectionType m_selectionType;    // None, Caret, Range
    135     bool m_baseIsFirst;               // true if base is before the extent
     136    SelectionType m_selectionType; // None, Caret, Range
     137    bool m_baseIsFirst : 1; // True if base is before the extent
     138    bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selection always extends on shift + arrow key.
    136139};
    137140
    138141inline bool operator==(const VisibleSelection& a, const VisibleSelection& b)
    139142{
    140     return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst();
     143    return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst()
     144        && a.isDirectional() == b.isDirectional();
    141145}
    142146
  • trunk/Source/WebCore/page/EventHandler.cpp

    r89293 r90275  
    278278{
    279279    ASSERT(selection);
    280     if (selection->selection() != newSelection && selection->shouldChangeSelection(newSelection))
    281         selection->setSelection(newSelection, granularity, MakeNonDirectionalSelection);
     280    if (selection->selection() == newSelection || !selection->shouldChangeSelection(newSelection))
     281        return;
     282
     283    VisibleSelection newNonDirectionalSelection = newSelection;
     284    newNonDirectionalSelection.setIsDirectional(false);
     285
     286    selection->setSelection(newNonDirectionalSelection, granularity);
    282287}
    283288
     
    410415        visiblePos = VisiblePosition(firstPositionInOrBeforeNode(innerNode), DOWNSTREAM);
    411416    Position pos = visiblePos.deepEquivalent();
    412    
     417
    413418    VisibleSelection newSelection = m_frame->selection()->selection();
    414419    TextGranularity granularity = CharacterGranularity;
    415420
    416421    if (extendSelection && newSelection.isCaretOrRange()) {
    417         m_frame->selection()->setIsDirectional(false);
    418        
    419422        ASSERT(m_frame->settings());
    420423        if (m_frame->settings()->editingBehaviorType() == EditingMacBehavior) {
  • trunk/Source/WebKit/chromium/ChangeLog

    r90249 r90275  
     12011-07-01  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        Move m_isDirectional from FrameSelection to VisibleSelection
     6        https://bugs.webkit.org/show_bug.cgi?id=63473
     7
     8        Don't pass MakeNonDirectionalSelection to setSelection since no other port does this.
     9
     10        * src/WebFrameImpl.cpp:
     11        (WebKit::WebFrameImpl::selectRange):
     12
    1132011-07-01  Andrew Scherkus  <scherkus@chromium.org>
    214
  • trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp

    r90025 r90275  
    12871287
    12881288    if (frame()->selection()->shouldChangeSelection(selection))
    1289         frame()->selection()->setSelection(selection, CharacterGranularity,
    1290                                            MakeNonDirectionalSelection);
     1289        frame()->selection()->setSelection(selection, CharacterGranularity);
    12911290}
    12921291
Note: See TracChangeset for help on using the changeset viewer.