Changeset 83747 in webkit


Ignore:
Timestamp:
Apr 13, 2011 9:33:02 AM (13 years ago)
Author:
mario@webkit.org
Message:

2011-04-13 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[GTK] Consider editable and non editable nodes when calculating selection offsets
https://bugs.webkit.org/show_bug.cgi?id=58431

Use firstPositionInOrBeforeNode() and lastPositionInOrAfterNode().

This is needed to ensure that getSelectionOffsetsForObject() works
well when non editable nodes are present in the selection, since
firstPositionInNode() and lastPositionInNode() don't work in those
cases (they assume the node is editable).

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (getSelectionOffsetsForObject): Updated calls.
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83746 r83747  
     12011-04-13  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Consider editable and non editable nodes when calculating selection offsets
     6        https://bugs.webkit.org/show_bug.cgi?id=58431
     7
     8        Use firstPositionInOrBeforeNode() and lastPositionInOrAfterNode().
     9
     10        This is needed to ensure that getSelectionOffsetsForObject() works
     11        well when non editable nodes are present in the selection, since
     12        firstPositionInNode() and lastPositionInNode() don't work in those
     13        cases (they assume the node is editable).
     14
     15        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     16        (getSelectionOffsetsForObject): Updated calls.
     17
    1182011-04-13  Mario Sanchez Prada  <msanchez@igalia.com>
    219
  • trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r83746 r83747  
    6464#include "TextIterator.h"
    6565#include "WebKitAccessibleHyperlink.h"
     66#include "htmlediting.h"
    6667#include "visible_units.h"
    6768
     
    16211622    Node* firstLeafNode = node->firstDescendant();
    16221623    if (selRange->isPointInRange(firstLeafNode, 0, ec))
    1623         nodeRangeStart = firstPositionInNode(firstLeafNode);
     1624        nodeRangeStart = firstPositionInOrBeforeNode(firstLeafNode);
    16241625    else
    16251626        nodeRangeStart = selRange->startPosition();
     
    16311632    Node* lastLeafNode = node->lastDescendant();
    16321633    if (selRange->isPointInRange(lastLeafNode, lastOffsetInNode(lastLeafNode), ec))
    1633         nodeRangeEnd = lastPositionInNode(lastLeafNode);
     1634        nodeRangeEnd = lastPositionInOrAfterNode(lastLeafNode);
    16341635    else
    16351636        nodeRangeEnd = selRange->endPosition();
    16361637
    16371638    // Calculate position of the selected range inside the object.
    1638     Position parentFirstPosition = firstPositionInNode(node);
     1639    Position parentFirstPosition = firstPositionInOrBeforeNode(node);
    16391640    RefPtr<Range> rangeInParent = Range::create(node->document(), parentFirstPosition, nodeRangeStart);
    16401641
Note: See TracChangeset for help on using the changeset viewer.