[Webkit-unassigned] [Bug 62092] setting innerText to an empty string on editable div loses focus

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 27 18:23:52 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=62092





--- Comment #34 from Ryosuke Niwa <rniwa at webkit.org>  2011-06-27 18:23:52 PST ---
(From update of attachment 98459)
View in context: https://bugs.webkit.org/attachment.cgi?id=98459&action=review

> Source/WebCore/dom/Position.cpp:228
> +void Position::updateForNodeRemoval(Node* node)

Following naming conventions in FrameSelection and others, willRemoveNode seems like a better name.  The function name should reflect the fact it should be called before the node is actually removed.

> Source/WebCore/dom/Position.cpp:246
> +    case Position::PositionIsAfterAnchor:
> +        if (node->contains(anchorNode()) || node->contains(anchorNode()->shadowAncestorNode()))
> +            *this = positionInParentAfterNode(node);
> +        break;
> +    case Position::PositionIsBeforeAnchor:
> +        if (node->contains(anchorNode()) || node->contains(anchorNode()->shadowAncestorNode()))
> +            *this = positionInParentBeforeNode(node);
> +        break;

I've recently added PositionIsBeforeChildren and PositionIsAfterChildren.  I've modified updatePositionForNodeRemoval in DeleteSelectionCommand accordingly so please update it.

> Source/WebCore/editing/FrameSelection.cpp:285
> +            if (m_selection.isBaseFirst())
> +                m_selection.setWithoutValidation(start, end);
> +            else
> +                m_selection.setWithoutValidation(end, start);

Can we share code with the code below?

> Source/WebCore/editing/FrameSelection.cpp:333
> +    if (positionOffset > offset && positionOffset < offset + oldLength) {
> +        // Shrink selection so that it doesn't include inserted text
> +        if (type == EndPointIsStart)
> +            position.moveToOffset(offset + newLength);
> +        else
> +            position.moveToOffset(offset);
> +    }

So I wasn't aware of this when I initially wrote this code and commented on this bug but DOM Range spec has a section that specifies how Range should be updated upon DOM mutation: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Mutation

Maybe we want to match our selection behavior to that.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list