Changeset 81384 in webkit


Ignore:
Timestamp:
Mar 17, 2011 1:49:11 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

2011-03-17 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Adele Peterson and Enrica Casucci.

Assert that editing does not ignore position's anchorNode if position is an offset in anchor
https://bugs.webkit.org/show_bug.cgi?id=56027

Debug build fix.

  • dom/Element.cpp: (WebCore::Element::updateFocusAppearance): "this" can be an input element so can't always instantiate a position inside the node. Call firstPositionInOrBeforeNode instead.
  • editing/ReplaceSelectionCommand.cpp: (WebCore::positionAvoidingPrecedingNodes): Exit early when a node's content is ignored by editing instead of just when the node is br.
  • editing/htmlediting.cpp: (WebCore::lastEditablePositionBeforePositionInRoot): The shadow ancestor node is usually an input element so don't instantiate a position inside it. Call firstPositionInOrBeforeNode instead.
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r81375 r81384  
     12011-03-17  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Adele Peterson and Enrica Casucci.
     4
     5        Assert that editing does not ignore position's anchorNode if position is an offset in anchor
     6        https://bugs.webkit.org/show_bug.cgi?id=56027
     7
     8        Debug build fix.
     9
     10        * dom/Element.cpp:
     11        (WebCore::Element::updateFocusAppearance): "this" can be an input element so can't always instantiate
     12        a position inside the node. Call firstPositionInOrBeforeNode instead.
     13        * editing/ReplaceSelectionCommand.cpp:
     14        (WebCore::positionAvoidingPrecedingNodes): Exit early when a node's content is ignored by editing instead
     15        of just when the node is br.
     16        * editing/htmlediting.cpp:
     17        (WebCore::lastEditablePositionBeforePositionInRoot): The shadow ancestor node is usually an input element
     18        so don't instantiate a position inside it. Call firstPositionInOrBeforeNode instead.
     19
    1202011-03-17  Sheriff Bot  <webkit.review.bot@gmail.com>
    221
  • trunk/Source/WebCore/dom/Element.cpp

    r80846 r81384  
    5858#include "WebKitAnimationList.h"
    5959#include "XMLNames.h"
     60#include "htmlediting.h"
    6061#include <wtf/text/CString.h>
    6162
     
    15551556
    15561557        // FIXME: We should restore the previous selection if there is one.
    1557         VisibleSelection newSelection = VisibleSelection(firstPositionInNode(this), DOWNSTREAM);
     1558        VisibleSelection newSelection = VisibleSelection(firstPositionInOrBeforeNode(this), DOWNSTREAM);
    15581559       
    15591560        if (frame->selection()->shouldChangeSelection(newSelection)) {
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r81295 r81384  
    111111{
    112112    // If we're already on a break, it's probably a placeholder and we shouldn't change our position.
    113     if (pos.deprecatedNode()->hasTagName(brTag))
     113    if (editingIgnoresContent(pos.deprecatedNode()))
    114114        return pos;
    115115
  • trunk/Source/WebCore/editing/htmlediting.cpp

    r81374 r81384  
    301301
    302302    Position p = position;
    303    
    304     if (Node* shadowAncestor = p.deprecatedNode()->shadowAncestorNode())
     303
     304    if (Node* shadowAncestor = p.deprecatedNode()->shadowAncestorNode()) {
    305305        if (shadowAncestor != p.deprecatedNode())
    306             p = firstPositionInNode(shadowAncestor);
     306            p = firstPositionInOrBeforeNode(shadowAncestor);
     307    }
    307308   
    308309    while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot))
Note: See TracChangeset for help on using the changeset viewer.