Changeset 148378 in webkit


Ignore:
Timestamp:
Apr 13, 2013 8:55:35 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Selection direction is not preserved when applying styles
https://bugs.webkit.org/show_bug.cgi?id=110979

Patch by Sukolsak Sakshuwong <Sukolsak Sakshuwong> on 2013-04-13
Reviewed by Ryosuke Niwa.

Source/WebCore:

The patch is based on the one submitted by Shezan Baig.

If the starting selection was directional and its base was not first,
switch newStart and newEnd when setting the ending direction. Otherwise,
leave the order unchanged.

Test: editing/style/preserve-selection-direction.html

  • editing/ApplyStyleCommand.cpp:

(WebCore::ApplyStyleCommand::updateStartEnd):

LayoutTests:

Add a test, based on the work by Shezan Baig

  • editing/style/preserve-selection-direction-expected.txt: Added.
  • editing/style/preserve-selection-direction.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148367 r148378  
     12013-04-13  Sukolsak Sakshuwong  <sukolsak@gmail.com>
     2
     3        Selection direction is not preserved when applying styles
     4        https://bugs.webkit.org/show_bug.cgi?id=110979
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Add a test, based on the work by Shezan Baig
     9
     10        * editing/style/preserve-selection-direction-expected.txt: Added.
     11        * editing/style/preserve-selection-direction.html: Added.
     12
    1132013-03-04  Robert Hogan  <robert@webkit.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r148377 r148378  
     12013-04-13  Sukolsak Sakshuwong  <sukolsak@gmail.com>
     2
     3        Selection direction is not preserved when applying styles
     4        https://bugs.webkit.org/show_bug.cgi?id=110979
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        The patch is based on the one submitted by Shezan Baig.
     9
     10        If the starting selection was directional and its base was not first,
     11        switch newStart and newEnd when setting the ending direction. Otherwise,
     12        leave the order unchanged.
     13
     14        Test: editing/style/preserve-selection-direction.html
     15
     16        * editing/ApplyStyleCommand.cpp:
     17        (WebCore::ApplyStyleCommand::updateStartEnd):
     18
    1192013-04-13  Alexey Proskuryakov  <ap@apple.com>
    220
  • trunk/Source/WebCore/editing/ApplyStyleCommand.cpp

    r148365 r148378  
    185185        m_useEndingSelection = true;
    186186
    187     setEndingSelection(VisibleSelection(newStart, newEnd, VP_DEFAULT_AFFINITY, endingSelection().isDirectional()));
     187    bool wasBaseFirst = startingSelection().isBaseFirst() || !startingSelection().isDirectional();
     188    setEndingSelection(VisibleSelection(wasBaseFirst ? newStart : newEnd, wasBaseFirst ? newEnd : newStart, VP_DEFAULT_AFFINITY, endingSelection().isDirectional()));
    188189    m_start = newStart;
    189190    m_end = newEnd;
Note: See TracChangeset for help on using the changeset viewer.