⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 98408 in webkit


Ignore:
Timestamp:
Oct 25, 2011, 4:17:59 PM (15 years ago)
Author:
rniwa@webkit.org
Message:

Moving to the start of line should not place the caret outside of the table
https://bugs.webkit.org/show_bug.cgi?id=70757

Reviewed by Chang Shu.

Source/WebCore:

The bug was caused by positionAvoidingFirstPositionInTable. Get rid of the function.

Test: editing/selection/table-lineboundary.html

  • editing/visible_units.cpp:

(WebCore::startPositionForLine):

LayoutTests:

Added a test to move the caret to lineboundaries in the first and the last table cell.
The caret should remain inside a table cell.

  • editing/selection/table-lineboundary-expected.txt: Added.
  • editing/selection/table-lineboundary.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r98407 r98408  
     12011-10-25  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Moving to the start of line should not place the caret outside of the table
     4        https://bugs.webkit.org/show_bug.cgi?id=70757
     5
     6        Reviewed by Chang Shu.
     7
     8        Added a test to move the caret to lineboundaries in the first and the last table cell.
     9        The caret should remain inside a table cell.
     10
     11        * editing/selection/table-lineboundary-expected.txt: Added.
     12        * editing/selection/table-lineboundary.html: Added.
     13
    1142011-10-25  Erik Arvidsson  <arv@chromium.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r98406 r98408  
     12011-10-25  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Moving to the start of line should not place the caret outside of the table
     4        https://bugs.webkit.org/show_bug.cgi?id=70757
     5
     6        Reviewed by Chang Shu.
     7
     8        The bug was caused by positionAvoidingFirstPositionInTable. Get rid of the function.
     9
     10        Test: editing/selection/table-lineboundary.html
     11
     12        * editing/visible_units.cpp:
     13        (WebCore::startPositionForLine):
     14
    1152011-10-25  Beth Dakin  <bdakin@apple.com>
    216
  • trunk/Source/WebCore/editing/visible_units.cpp

    r98358 r98408  
    319319// ---------
    320320
    321 static VisiblePosition positionAvoidingFirstPositionInTable(const VisiblePosition& c)
    322 {
    323     // return table offset 0 instead of the first VisiblePosition inside the table
    324     VisiblePosition previous = c.previous();
    325     if (isLastPositionBeforeTable(previous) && isEditablePosition(previous.deepEquivalent()))
    326         return previous;
    327 
    328     return c;
    329 }
    330    
    331 
    332321enum LineEndpointComputationMode { UseLogicalOrdering, UseInlineBoxOrdering };
    333322static VisiblePosition startPositionForLine(const VisiblePosition& c, LineEndpointComputationMode mode)
     
    342331        Position p = c.deepEquivalent();
    343332        if (p.deprecatedNode()->renderer() && p.deprecatedNode()->renderer()->isRenderBlock() && !p.deprecatedEditingOffset())
    344             return positionAvoidingFirstPositionInTable(c);
    345        
     333            return c;
     334
    346335        return VisiblePosition();
    347336    }
     
    373362    }
    374363
    375     if (startNode->isTextNode())
    376         return positionAvoidingFirstPositionInTable(Position(static_cast<Text*>(startNode), toInlineTextBox(startBox)->start()));
    377     return positionAvoidingFirstPositionInTable(positionBeforeNode(startNode));
     364    return startNode->isTextNode() ? Position(static_cast<Text*>(startNode), toInlineTextBox(startBox)->start())
     365        : positionBeforeNode(startNode);
    378366}
    379367
Note: See TracChangeset for help on using the changeset viewer.