[webkit-reviews] review requested: [Bug 49514] [Gtk] atk_text_get_selection returns the wrong offsets after a link : [Attachment 73892] Patch proposal
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Nov 15 07:09:12 PST 2010
Mario Sanchez Prada <msanchez at igalia.com> has asked for review:
Bug 49514: [Gtk] atk_text_get_selection returns the wrong offsets after a link
https://bugs.webkit.org/show_bug.cgi?id=49514
Attachment 73892: Patch proposal
https://bugs.webkit.org/attachment.cgi?id=73892&action=review
------- Additional Comments from Mario Sanchez Prada <msanchez at igalia.com>
It looks we were not calculating the startOffset value properly, by taking into
account the possibility of some embedded objects being present in the
paragraph, previous to the currently selected text (my fault).
The attached patch would fix this by checking the startOffset value more
carefully. As the patch also fixes a bunch of not-properl-ended-comments
(without '.'), I'm pasting here the so simple diff for simplicity of review:
In getSelectionOffsetsForObject(), at AccessibilityObjectWrapperAtk.cpp:
[...]
Node* lastLeafNode = node->lastDescendant();
if (selRange->isPointInRange(lastLeafNode,
lastOffsetInNode(lastLeafNode), ec))
nodeRangeEnd = lastPositionInNode(lastLeafNode);
else
nodeRangeEnd = selRange->endPosition();
- // Set values for start and end offsets
+ // Calculate position of the selected range inside the object.
+ Position parentFirstPosition = firstPositionInNode(node);
+ RefPtr<Range> rangeInParent = Range::create(node->document(),
parentFirstPosition, nodeRangeStart);
+
+ // Set values for start and end offsets.
+ startOffset = TextIterator::rangeLength(rangeInParent.get());
RefPtr<Range> nodeRange = Range::create(node->document(),
nodeRangeStart, nodeRangeEnd);
- startOffset = nodeRangeStart.offsetInContainerNode();
endOffset = startOffset + TextIterator::rangeLength(nodeRange.get());
[...]
More information about the webkit-reviews
mailing list