Changeset 146867 in webkit


Ignore:
Timestamp:
Mar 26, 2013 4:37:33 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Unable to insert a paragraph in between some text whose previous sibling is a non-editable block.
https://bugs.webkit.org/show_bug.cgi?id=113007

Patch by Arpita Bahuguna <a.bah@samsung.com> on 2013-03-26
Reviewed by Ryosuke Niwa.

Source/WebCore:

Unable to insert a line break in between a text that follows a
non-editable block but is itself contained within an editable
block.

While comparing the positions from the start block till the
insertion position, we should ignore the nodes that do not
generate a visiblePosition for the position before the node.
This ultimately results in an assert within comparePositions().

For this case, the firstChild of the start block is a text
node with no renderer which would thus not generate a candidate
position for itself.
There is also no candidate previous to it, and since
the position after it lies within a different editable element (root),
no candidate after it as well.
Such a point will thus return a null visiblePosition.

Test: editing/inserting/insert-paragraph-between-text.html

  • editing/InsertParagraphSeparatorCommand.cpp:

(WebCore::InsertParagraphSeparatorCommand::doApply):
Added a check to verify the generated visiblePosition (for the
position before the node) prior to carrying out a comparison with
the insertion point.

LayoutTests:

  • editing/inserting/insert-paragraph-between-text-expected.txt: Added.
  • editing/inserting/insert-paragraph-between-text.html: Added.

Added a layout test case for verifying the behavior when trying
to insert a line break between an editable text with a non-editable
block as it's previous sibling.

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r146864 r146867  
     12013-03-26  Arpita Bahuguna  <a.bah@samsung.com>
     2
     3        Unable to insert a paragraph in between some text whose previous sibling is a non-editable block.
     4        https://bugs.webkit.org/show_bug.cgi?id=113007
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * editing/inserting/insert-paragraph-between-text-expected.txt: Added.
     9        * editing/inserting/insert-paragraph-between-text.html: Added.
     10        Added a layout test case for verifying the behavior when trying
     11        to insert a line break between an editable text with a non-editable
     12        block as it's previous sibling.
     13
    1142013-03-26  Rijubrata Bhaumik  <rijubrata.bhaumik@intel.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r146866 r146867  
     12013-03-26  Arpita Bahuguna  <a.bah@samsung.com>
     2
     3        Unable to insert a paragraph in between some text whose previous sibling is a non-editable block.
     4        https://bugs.webkit.org/show_bug.cgi?id=113007
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Unable to insert a line break in between a text that follows a
     9        non-editable block but is itself contained within an editable
     10        block.
     11
     12        While comparing the positions from the start block till the
     13        insertion position, we should ignore the nodes that do not
     14        generate a visiblePosition for the position before the node.
     15        This ultimately results in an assert within comparePositions().
     16
     17        For this case, the firstChild of the start block is a text
     18        node with no renderer which would thus not generate a candidate
     19        position for itself.
     20        There is also no candidate previous to it, and since
     21        the position after it lies within a different editable element (root),
     22        no candidate after it as well.
     23        Such a point will thus return a null visiblePosition.
     24
     25        Test: editing/inserting/insert-paragraph-between-text.html
     26
     27        * editing/InsertParagraphSeparatorCommand.cpp:
     28        (WebCore::InsertParagraphSeparatorCommand::doApply):
     29        Added a check to verify the generated visiblePosition (for the
     30        position before the node) prior to carrying out a comparison with
     31        the insertion point.
     32
    1332013-03-26  Ilya Tikhonovsky  <loislo@chromium.org>
    234
  • trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp

    r145444 r146867  
    373373
    374374            for (n = startBlock->firstChild(); n; n = n->nextSibling()) {
    375                 if (comparePositions(VisiblePosition(insertionPosition), positionBeforeNode(n)) <= 0)
     375                VisiblePosition beforeNodePosition = positionBeforeNode(n);
     376                if (!beforeNodePosition.isNull() && comparePositions(VisiblePosition(insertionPosition), beforeNodePosition) <= 0)
    376377                    break;
    377378            }
Note: See TracChangeset for help on using the changeset viewer.