Changeset 83039 in webkit


Ignore:
Timestamp:
Apr 6, 2011 5:59:24 AM (13 years ago)
Author:
rniwa@webkit.org
Message:

2011-04-06 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Eric Seidel.

REGRESSION (r46914, r48764): When typing in Mail, line wrapping frequently occurs in the middle of words
https://bugs.webkit.org/show_bug.cgi?id=57872

r46914 initially introduced a regression by replacing calls to styleAtPosition by editingStyleAtPosition
because editingStyleAtPosition did not avoid tab span to obtain the computed style unlike styleAtPosition.

r46914 also introduced a regression by cloning hierarchy under new block at the insertion position without
avoiding the tab span.

Fixed the both regressions by avoiding tab spans when computing the editing style and when cloning hierarchy.

Test: editing/inserting/insert-paragraph-separator-tab-span.html

  • editing/EditingStyle.cpp: (WebCore::EditingStyle::init): Always avoid a tab span when computing the editing style.
  • editing/InsertParagraphSeparatorCommand.cpp: (WebCore::InsertParagraphSeparatorCommand::doApply): Avoid cloning tab spans and inserting a paragraph separator into a paragraph separator.

2011-04-06 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Eric Seidel.

REGRESSION (r46914, r48764): When typing in Mail, line wrapping frequently occurs in the middle of words
https://bugs.webkit.org/show_bug.cgi?id=57872

Added a test insert a paragraph separator and text around tab spans. WebKit should not apply the tab span's
style to the paragraph separator or the text.

  • editing/inserting/insert-paragraph-separator-tab-span-expected.txt: Added.
  • editing/inserting/insert-paragraph-separator-tab-span.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83037 r83039  
     12011-04-06  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        REGRESSION (r46914, r48764): When typing in Mail, line wrapping frequently occurs in the middle of words
     6        https://bugs.webkit.org/show_bug.cgi?id=57872
     7
     8        Added a test insert a paragraph separator and text around tab spans. WebKit should not apply the tab span's
     9        style to the paragraph separator or the text.
     10
     11        * editing/inserting/insert-paragraph-separator-tab-span-expected.txt: Added.
     12        * editing/inserting/insert-paragraph-separator-tab-span.html: Added.
     13
    1142011-04-05  Alexander Pavlov  <apavlov@chromium.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r83038 r83039  
     12011-04-06  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        REGRESSION (r46914, r48764): When typing in Mail, line wrapping frequently occurs in the middle of words
     6        https://bugs.webkit.org/show_bug.cgi?id=57872
     7
     8        r46914 initially introduced a regression by replacing calls to styleAtPosition by editingStyleAtPosition
     9        because editingStyleAtPosition did not avoid tab span to obtain the computed style unlike styleAtPosition.
     10
     11        r46914 also introduced a regression by cloning hierarchy under new block at the insertion position without
     12        avoiding the tab span.
     13
     14        Fixed the both regressions by avoiding tab spans when computing the editing style and when cloning hierarchy.
     15
     16        Test: editing/inserting/insert-paragraph-separator-tab-span.html
     17
     18        * editing/EditingStyle.cpp:
     19        (WebCore::EditingStyle::init): Always avoid a tab span when computing the editing style.
     20        * editing/InsertParagraphSeparatorCommand.cpp:
     21        (WebCore::InsertParagraphSeparatorCommand::doApply): Avoid cloning tab spans and inserting a paragraph
     22        separator into a paragraph separator.
     23
    1242011-04-06  Levi Weintraub  <leviw@chromium.org>
    225
  • trunk/Source/WebCore/editing/EditingStyle.cpp

    r82503 r83039  
    301301void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude)
    302302{
     303    if (isTabSpanTextNode(node))
     304        node = tabSpanNode(node)->parentNode();
     305    else if (isTabSpanNode(node))
     306        node = node->parentNode();
     307
    303308    RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = computedStyle(node);
    304309    m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosition ? computedStyleAtPosition->copy() : editingStyleFromComputedStyle(computedStyleAtPosition);
  • trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp

    r79398 r83039  
    240240       
    241241        Vector<Element*> ancestors;
    242         getAncestorsInsideBlock(insertionPosition.deprecatedNode(), startBlock, ancestors);     
     242        getAncestorsInsideBlock(positionBeforeTabSpan(insertionPosition).deprecatedNode(), startBlock, ancestors);     
    243243        RefPtr<Element> parent = cloneHierarchyUnderNewBlock(ancestors, blockToInsert);
    244244       
     
    255255    if (isFirstInBlock || !inSameBlock(visiblePos, visiblePos.previous())) {
    256256        Node *refNode;
     257       
     258        insertionPosition = positionBeforeTabSpan(insertionPosition);
     259
    257260        if (isFirstInBlock && !nestNewBlock)
    258261            refNode = startBlock;
     
    271274
    272275        Vector<Element*> ancestors;
    273         getAncestorsInsideBlock(positionAvoidingSpecialElementBoundary(insertionPosition).deprecatedNode(), startBlock, ancestors);
     276        getAncestorsInsideBlock(positionAvoidingSpecialElementBoundary(positionBeforeTabSpan(insertionPosition)).deprecatedNode(), startBlock, ancestors);
    274277       
    275278        appendBlockPlaceholder(cloneHierarchyUnderNewBlock(ancestors, blockToInsert));
     
    304307    // Build up list of ancestors in between the start node and the start block.
    305308    Vector<Element*> ancestors;
    306     getAncestorsInsideBlock(insertionPosition.deprecatedNode(), startBlock, ancestors);
     309    getAncestorsInsideBlock(positionBeforeTabSpan(insertionPosition).deprecatedNode(), startBlock, ancestors);
    307310
    308311    // Make sure we do not cause a rendered space to become unrendered.
Note: See TracChangeset for help on using the changeset viewer.