Changeset 97597 in webkit


Ignore:
Timestamp:
Oct 17, 2011 2:18:35 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

when CSS pseudo selectors are applied (:before and :after) the *-of-line keyboard navigation does not work
https://bugs.webkit.org/show_bug.cgi?id=10123

Patch by Rosen Dash <rosen.dash@motorola.com> on 2011-10-17
Reviewed by Ryosuke Niwa.

Source/WebCore:

This patch addresses folllowing two issues:

  1. When CSS pseudo elements are before or after is used with content attribute containing single character at the start/end of text and we try to move cursor by right navigation key, the page freezes falling into an infinite loop.
  2. When these elements try to insert some text between a text line, navigation by right/left arrow key is prohibited.

Tests: editing/selection/css-pseudo-element-hang.html

editing/selection/css-pseudo-element.html

  • editing/VisiblePosition.cpp:

(WebCore::VisiblePosition::leftVisuallyDistinctCandidate):
(WebCore::VisiblePosition::rightVisuallyDistinctCandidate):

LayoutTests:

  • editing/selection/css-pseudo-element-expected.txt: Added.
  • editing/selection/css-pseudo-element-hang-expected.txt: Added.
  • editing/selection/css-pseudo-element-hang.html: Added.
  • editing/selection/css-pseudo-element.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r97596 r97597  
     12011-10-17  Rosen Dash  <rosen.dash@motorola.com>
     2
     3        when CSS pseudo selectors are applied (:before and :after) the *-of-line keyboard navigation does not work
     4        https://bugs.webkit.org/show_bug.cgi?id=10123
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * editing/selection/css-pseudo-element-expected.txt: Added.
     9        * editing/selection/css-pseudo-element-hang-expected.txt: Added.
     10        * editing/selection/css-pseudo-element-hang.html: Added.
     11        * editing/selection/css-pseudo-element.html: Added.
     12
    1132011-10-15  Antti Koivisto  <antti@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r97596 r97597  
     12011-10-17  Rosen Dash  <rosen.dash@motorola.com>
     2
     3        when CSS pseudo selectors are applied (:before and :after) the *-of-line keyboard navigation does not work
     4        https://bugs.webkit.org/show_bug.cgi?id=10123
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        This patch addresses folllowing two issues:
     9        1. When CSS pseudo elements are before or after is used with content attribute containing single character
     10           at the start/end of text and we try to move cursor by right navigation key, the page freezes falling
     11           into an infinite loop.
     12        2. When these elements try to insert some text between a text line, navigation by right/left arrow key is prohibited.
     13
     14        Tests: editing/selection/css-pseudo-element-hang.html
     15               editing/selection/css-pseudo-element.html
     16
     17        * editing/VisiblePosition.cpp:
     18        (WebCore::VisiblePosition::leftVisuallyDistinctCandidate):
     19        (WebCore::VisiblePosition::rightVisuallyDistinctCandidate):
     20
    1212011-10-15  Antti Koivisto  <antti@apple.com>
    222
  • trunk/Source/WebCore/editing/VisiblePosition.cpp

    r96868 r97597  
    11/*
    22 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     3 * Portions Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    126127                return box->isLeftToRightDirection() ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
    127128
     129            if (!renderer->node()) {
     130                box = box->prevLeafChild();
     131                if (!box)
     132                    return primaryDirection == LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
     133                renderer = box->renderer();
     134                offset = box->caretRightmostOffset();
     135                continue;
     136            }
     137
    128138            offset = box->isLeftToRightDirection() ? renderer->previousOffset(offset) : renderer->nextOffset(offset);
    129139
     
    192202                continue;
    193203            }
     204
     205            while (prevBox && !prevBox->renderer()->node())
     206                prevBox = prevBox->prevLeafChild();
    194207
    195208            if (prevBox) {
     
    235248        if ((p.isCandidate() && p.downstream() != downstreamStart) || p.atStartOfTree() || p.atEndOfTree())
    236249            return p;
     250
     251        ASSERT(p != m_deepPosition);
    237252    }
    238253}
     
    276291            if ((renderer->isReplaced() || renderer->isBR()) && offset == box->caretLeftmostOffset())
    277292                return box->isLeftToRightDirection() ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
     293
     294            if (!renderer->node()) {
     295                box = box->nextLeafChild();
     296                if (!box)
     297                    return primaryDirection == LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
     298                renderer = box->renderer();
     299                offset = box->caretLeftmostOffset();
     300                continue;
     301            }
    278302
    279303            offset = box->isLeftToRightDirection() ? renderer->nextOffset(offset) : renderer->previousOffset(offset);
     
    323347                    break;
    324348                }
     349
    325350                if (nextBox->bidiLevel() >= level)
    326351                    break;
     
    345370            }
    346371
     372            while (nextBox && !nextBox->renderer()->node())
     373                nextBox = nextBox->nextLeafChild();
     374
    347375            if (nextBox) {
    348376                box = nextBox;
    349377                renderer = box->renderer();
    350378                offset = box->caretLeftmostOffset();
     379
    351380                if (box->bidiLevel() > level) {
    352381                    do {
     
    387416        if ((p.isCandidate() && p.downstream() != downstreamStart) || p.atStartOfTree() || p.atEndOfTree())
    388417            return p;
     418
     419        ASSERT(p != m_deepPosition);
    389420    }
    390421}
Note: See TracChangeset for help on using the changeset viewer.