Changeset 117392 in webkit


Ignore:
Timestamp:
May 16, 2012 9:09:47 PM (12 years ago)
Author:
rniwa@webkit.org
Message:

Moving caret up or down skips lines when there's a non-editable line
https://bugs.webkit.org/show_bug.cgi?id=81490

Reviewed by Eric Seidel.

Source/WebCore:

The bug was caused by previousRootInlineBoxCandidatePosition and nextRootInlineBoxCandidatePosition
skipping leaf nodes that constitute a new line and belong to the same editable region because block elements
that separate lines are not editable so it looked as if all editable lines belong to a single line as far as
those two functions are concerned.

Fixed the bug by using the first leaf node that belongs to the same editable region but does not belong in
the same as the start node.

This patch is based on a patch authored by Yi Shen (Nokia).

Test: editing/selection/move-between-lines-of-different-editabilities.html

  • editing/visible_units.cpp:

(WebCore::previousRootInlineBoxCandidatePosition):
(WebCore::nextRootInlineBoxCandidatePosition):

LayoutTests:

Added a regression test.

  • editing/selection/move-between-lines-of-different-editabilities.html: Added.
  • editing/selection/move-by-word-visually-mac-expected.txt: Rebaselined a test case. It failed

before this change and still fails after this change.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117390 r117392  
     12012-05-16  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Moving caret up or down skips lines when there's a non-editable line
     4        https://bugs.webkit.org/show_bug.cgi?id=81490
     5
     6        Reviewed by Eric Seidel.
     7
     8        Added a regression test.
     9
     10        * editing/selection/move-between-lines-of-different-editabilities.html: Added.
     11        * editing/selection/move-by-word-visually-mac-expected.txt: Rebaselined a test case. It failed
     12        before this change and still fails after this change.
     13
    1142012-05-16  Luke Macpherson  <macpherson@chromium.org>
    215
  • trunk/LayoutTests/editing/selection/move-by-word-visually-mac-expected.txt

    r115788 r117392  
    8888Test 18, RTL:
    8989Move left by one word
    90 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 8, 12, 16, 20, 24, 28, 32, 36], <DIV>[0], "AAA kj AAA mn opq AAA AAA"[3, 6, 10, 13, 17, 21, 25]    FAIL expected: [" abc def AAA AAA hij AAA AAA uvw xyz "[ 1,  5,  8,  12,  16,  20,  24,  28,  32,  36, ]"AAA kj AAA mn opq AAA AAA"[ 3,  6,  10,  13,  17,  21,  25]
     90" abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 8, 12, 16, 20, 24, 28, 32, 36], <DIV>[0], <DIV>[0], "AAA kj AAA mn opq AAA AAA"[3, 6, 10, 13, 17, 21, 25]    FAIL expected: [" abc def AAA AAA hij AAA AAA uvw xyz "[ 1,  5,  8,  12,  16,  20,  24,  28,  32,  36, ]"AAA kj AAA mn opq AAA AAA"[ 3,  6,  10,  13,  17,  21,  25]
    9191" abc def AAA AAA hij AAA AAA uvw xyz "[36], <DIV>[0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 3]
     92<DIV>[0], <DIV>[0]   FAIL expected "AAA kj AAA mn opq AAA AAA"[ 3]
    9293Move right by one word
    9394"AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 13, 9, 4, 1]
  • trunk/Source/WebCore/ChangeLog

    r117391 r117392  
     12012-05-16  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Moving caret up or down skips lines when there's a non-editable line
     4        https://bugs.webkit.org/show_bug.cgi?id=81490
     5
     6        Reviewed by Eric Seidel.
     7
     8        The bug was caused by previousRootInlineBoxCandidatePosition and nextRootInlineBoxCandidatePosition
     9        skipping leaf nodes that constitute a new line and belong to the same editable region because block elements
     10        that separate lines are not editable so it looked as if all editable lines belong to a single line as far as
     11        those two functions are concerned.
     12
     13        Fixed the bug by using the first leaf node that belongs to the same editable region but does not belong in
     14        the same as the start node.
     15
     16        This patch is based on a patch authored by Yi Shen (Nokia).
     17
     18        Test: editing/selection/move-between-lines-of-different-editabilities.html
     19
     20        * editing/visible_units.cpp:
     21        (WebCore::previousRootInlineBoxCandidatePosition):
     22        (WebCore::nextRootInlineBoxCandidatePosition):
     23
    1242012-05-16  MORITA Hajime <morrita@google.com>
    225
  • trunk/Source/WebCore/editing/visible_units.cpp

    r117359 r117392  
    6161}
    6262
    63 static Node* enclosingNodeWithNonInlineRenderer(Node* node)
    64 {
    65     for (; node; node = node->parentNode()) {
    66         if (node->renderer() && !node->renderer()->isInline())
    67             return node;
    68     }
    69     return 0;
    70 }
    71 
    7263static Node* nextLeafWithSameEditability(Node* node, EditableType editableType = ContentIsEditable)
    7364{
     
    8980{
    9081    Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), editableType);
    91     Node* enclosingBlockNode = enclosingNodeWithNonInlineRenderer(node);
    9282    Node* previousNode = previousLeafWithSameEditability(node, editableType);
    9383
    94     while (previousNode && enclosingBlockNode == enclosingNodeWithNonInlineRenderer(previousNode))
     84    while (previousNode && inSameLine(firstPositionInOrBeforeNode(previousNode), visiblePosition))
    9585        previousNode = previousLeafWithSameEditability(previousNode, editableType);
    9686 
     
    113103{
    114104    Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), editableType);
    115     Node* enclosingBlockNode = enclosingNodeWithNonInlineRenderer(node);
    116105    Node* nextNode = nextLeafWithSameEditability(node, editableType);
    117     while (nextNode && enclosingBlockNode == enclosingNodeWithNonInlineRenderer(nextNode))
     106    while (nextNode && inSameLine(firstPositionInOrBeforeNode(nextNode), visiblePosition))
    118107        nextNode = nextLeafWithSameEditability(nextNode, ContentIsEditable);
    119108 
Note: See TracChangeset for help on using the changeset viewer.