Changeset 55613 in webkit


Ignore:
Timestamp:
Mar 5, 2010 11:28:29 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-05 Tony Chang <tony@chromium.org>

Reviewed by Eric Seidel.

https://bugs.webkit.org/show_bug.cgi?id=33247
Backwards cursor movement incorrect when previous block ends with <br>.

If the cursor is trying to move into a node that has a height of 0,
skip over it.

  • editing/execCommand/move-selection-back-line-expected.txt: Added.
  • editing/execCommand/move-selection-back-line.html: Added.

2010-03-05 Tony Chang <tony@chromium.org>

Reviewed by Eric Seidel.

https://bugs.webkit.org/show_bug.cgi?id=33247
Backwards cursor movement incorrect when previous block ends with <br>.

If the cursor is trying to move into a node that has a height of 0,
skip over it.

Test: editing/execCommand/move-selection-back-line.html

  • editing/visible_units.cpp: (WebCore::previousLinePosition):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55611 r55613  
     12010-03-05  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=33247
     6        Backwards cursor movement incorrect when previous block ends with <br>.
     7
     8        If the cursor is trying to move into a node that has a height of 0,
     9        skip over it.
     10
     11        * editing/execCommand/move-selection-back-line-expected.txt: Added.
     12        * editing/execCommand/move-selection-back-line.html: Added.
     13
    1142010-03-05  Chris Fleizach  <cfleizach@apple.com>
    215
  • trunk/WebCore/ChangeLog

    r55612 r55613  
     12010-03-05  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=33247
     6        Backwards cursor movement incorrect when previous block ends with <br>.
     7
     8        If the cursor is trying to move into a node that has a height of 0,
     9        skip over it.
     10
     11        Test: editing/execCommand/move-selection-back-line.html
     12
     13        * editing/visible_units.cpp:
     14        (WebCore::previousLinePosition):
     15
    1162010-03-05  Andrey Kosyakov  <caseq@chromium.org>
    217
  • trunk/WebCore/editing/visible_units.cpp

    r55098 r55613  
    3232#include "RenderBlock.h"
    3333#include "RenderLayer.h"
     34#include "RenderObject.h"
    3435#include "TextBoundaries.h"
    3536#include "TextBreakIterator.h"
     
    254255}
    255256
     257static bool canHaveCursor(RenderObject* o)
     258{
     259    return (o->isText() && toRenderText(o)->linesBoundingBox().height())
     260        || (o->isBox() && toRenderBox(o)->borderBoundingBox().height());
     261}
     262
    256263// ---------
    257264
     
    591598            Position pos(n, caretMinOffset(n));
    592599            if (pos.isCandidate()) {
    593                 ASSERT(n->renderer());
    594                 Position maxPos(n, caretMaxOffset(n));
    595                 maxPos.getInlineBoxAndOffset(DOWNSTREAM, box, ignoredCaretOffset);
    596                 if (box) {
    597                     // previous root line box found
    598                     root = box->root();
    599                     containingBlock = n->renderer()->containingBlock();
    600                     break;
     600                RenderObject* o = n->renderer();
     601                ASSERT(o);
     602                if (canHaveCursor(o)) {
     603                    Position maxPos(n, caretMaxOffset(n));
     604                    maxPos.getInlineBoxAndOffset(DOWNSTREAM, box, ignoredCaretOffset);
     605                    if (box) {
     606                        // previous root line box found
     607                        root = box->root();
     608                        containingBlock = n->renderer()->containingBlock();
     609                        break;
     610                    }
     611
     612                    return VisiblePosition(pos, DOWNSTREAM);
    601613                }
    602 
    603                 return VisiblePosition(pos, DOWNSTREAM);
    604614            }
    605615            n = previousLeafWithSameEditability(n);
Note: See TracChangeset for help on using the changeset viewer.