Changeset 72284 in webkit
- Timestamp:
- Nov 18, 2010 4:42:08 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r72282 r72284 1 2010-11-18 Mario Sanchez Prada <msanchez@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [Gtk] atk_text_get_selection returns the wrong offsets after a link 6 https://bugs.webkit.org/show_bug.cgi?id=49514 7 8 Consider possible embedded objects to calculate startOffset. 9 10 So far we were using offsetInContainerNode() to calculate the 11 value of startOffset when checking the offsets for the current 12 selection, which was wrong because that wouldn't work ok if any 13 embedded object was present in the paragraph before the 14 selection. Thus, we need to consider this fact when calculating 15 the startOffset from the point of view of the object this function 16 is called on, in order to return the right and actual values. 17 18 * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: 19 (getSelectionOffsetsForObject): Check range length from the first 20 position in the object the function is called on until the first 21 position of current selection, and use it as startOffset. 22 1 23 2010-11-12 Stephen White <senorblanco@chromium.org> 2 24 -
trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
r71026 r72284 1434 1434 return; 1435 1435 1436 // Early return if the selection doesn't affect the selected node 1436 // Early return if the selection doesn't affect the selected node. 1437 1437 if (!selectionBelongsToObject(coreObject, selection)) 1438 1438 return; … … 1440 1440 // We need to find the exact start and end positions in the 1441 1441 // selected node that intersects the selection, to later on get 1442 // the right values for the effective start and end offsets 1442 // the right values for the effective start and end offsets. 1443 1443 ExceptionCode ec = 0; 1444 1444 Position nodeRangeStart; … … 1450 1450 // possible position is also in the selection, we must set 1451 1451 // nodeRangeStart to that position, otherwise to the selection's 1452 // start position (it would belong to the node anyway) 1452 // start position (it would belong to the node anyway). 1453 1453 Node* firstLeafNode = node->firstDescendant(); 1454 1454 if (selRange->isPointInRange(firstLeafNode, 0, ec)) … … 1460 1460 // possible position is also in the selection, we must set 1461 1461 // nodeRangeEnd to that position, otherwise to the selection's 1462 // end position (it would belong to the node anyway) 1462 // end position (it would belong to the node anyway). 1463 1463 Node* lastLeafNode = node->lastDescendant(); 1464 1464 if (selRange->isPointInRange(lastLeafNode, lastOffsetInNode(lastLeafNode), ec)) … … 1467 1467 nodeRangeEnd = selRange->endPosition(); 1468 1468 1469 // Set values for start and end offsets 1469 // Calculate position of the selected range inside the object. 1470 Position parentFirstPosition = firstPositionInNode(node); 1471 RefPtr<Range> rangeInParent = Range::create(node->document(), parentFirstPosition, nodeRangeStart); 1472 1473 // Set values for start and end offsets. 1474 startOffset = TextIterator::rangeLength(rangeInParent.get()); 1470 1475 RefPtr<Range> nodeRange = Range::create(node->document(), nodeRangeStart, nodeRangeEnd); 1471 startOffset = nodeRangeStart.offsetInContainerNode();1472 1476 endOffset = startOffset + TextIterator::rangeLength(nodeRange.get()); 1473 1477 } -
trunk/WebKit/gtk/ChangeLog
r72275 r72284 1 2010-11-18 Mario Sanchez Prada <msanchez@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [Gtk] atk_text_get_selection returns the wrong offsets after a link 6 https://bugs.webkit.org/show_bug.cgi?id=49514 7 8 Updated test case to also chech this specific subcase. 9 10 We need to explicitly check the case of having a selection in a 11 paragraph after an embedded object (i.e. a link) to make sure the 12 right calculations are being done when the paragraph is composed 13 of more than just one text object, and the current selection is 14 made only in one of them. 15 16 * tests/testatk.c: 17 (testWebkitAtkTextSelections): Make sure that a selection after a 18 link in a paragraph is working ok when asking for the text 19 selection from the point of view of the paragraph. 20 1 21 2010-11-17 Martin Robinson <mrobinson@igalia.com> 2 22 -
trunk/WebKit/gtk/tests/testatk.c
r71052 r72284 775 775 g_assert_cmpint(endOffset, ==, 4); 776 776 g_assert_cmpstr(selectedText, ==, "a li"); 777 g_free (selectedText); 778 779 /* Make a selection after the link and check selection for the whole paragraph. */ 780 result = atk_text_set_selection(paragraph2, 0, 27, 37); 781 g_assert(result); 782 g_assert_cmpint(atk_text_get_n_selections(paragraph2), ==, 1); 783 selectedText = atk_text_get_selection(paragraph2, 0, &startOffset, &endOffset); 784 g_assert_cmpint(startOffset, ==, 27); 785 g_assert_cmpint(endOffset, ==, 37); 786 g_assert_cmpstr(selectedText, ==, "the middle"); 777 787 g_free (selectedText); 778 788
Note: See TracChangeset
for help on using the changeset viewer.