Changeset 77233 in webkit


Ignore:
Timestamp:
Feb 1, 2011 1:49:25 AM (13 years ago)
Author:
mario@webkit.org
Message:

2011-02-01 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[GTK] Caret Offset is one off at the end of wrapped lines
https://bugs.webkit.org/show_bug.cgi?id=53300

Consider linebreaks as special cases.

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (objectAndOffsetUnignored): In order to avoid getting wrong values when around linebreaks, we need to workaround this by explicitly avoiding those '\n' text nodes from affecting the result of calling to TextIterator:rangeLength().

2011-02-01 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[GTK] Caret Offset is one off at the end of wrapped lines
https://bugs.webkit.org/show_bug.cgi?id=53300

Update unit test to check the fix for this bug.

  • tests/testatk.c: (testWebkitAtkCaretOffsetsAndExtranousWhiteSpaces): Set and get the caret offset at the edge of the line.
Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r77231 r77233  
     12011-02-01  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Caret Offset is one off at the end of wrapped lines
     6        https://bugs.webkit.org/show_bug.cgi?id=53300
     7
     8        Consider linebreaks as special cases.
     9
     10        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     11        (objectAndOffsetUnignored): In order to avoid getting wrong values
     12        when around linebreaks, we need to workaround this by explicitly
     13        avoiding those '\n' text nodes from affecting the result of
     14        calling to TextIterator:rangeLength().
     15
    1162011-02-01  Roland Steiner  <rolandsteiner@chromium.org>
    217
  • trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r77137 r77233  
    6464#include "TextIterator.h"
    6565#include "WebKitAccessibleHyperlink.h"
     66#include "visible_units.h"
    6667
    6768#include <atk/atk.h>
     
    24902491    Node* node = realObject->node();
    24912492    if (node) {
    2492         RefPtr<Range> range = Range::create(node->document(), firstPositionInNode(node), realObject->selection().end());
    2493         offset = TextIterator::rangeLength(range.get());
     2493        VisiblePosition startPosition = VisiblePosition(node, 0, DOWNSTREAM);
     2494        VisiblePosition endPosition = realObject->selection().visibleEnd();
     2495
     2496        if (startPosition == endPosition)
     2497            offset = 0;
     2498        else if (!isStartOfLine(endPosition)) {
     2499            RefPtr<Range> range = makeRange(startPosition, endPosition.previous());
     2500            offset = TextIterator::rangeLength(range.get()) + 1;
     2501        } else {
     2502            RefPtr<Range> range = makeRange(startPosition, endPosition);
     2503            offset = TextIterator::rangeLength(range.get());
     2504        }
     2505
    24942506    }
    24952507
  • trunk/Source/WebKit/gtk/ChangeLog

    r77137 r77233  
     12011-02-01  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Caret Offset is one off at the end of wrapped lines
     6        https://bugs.webkit.org/show_bug.cgi?id=53300
     7
     8        Update unit test to check the fix for this bug.
     9
     10        * tests/testatk.c:
     11        (testWebkitAtkCaretOffsetsAndExtranousWhiteSpaces): Set and get
     12        the caret offset at the edge of the line.
     13
    1142011-01-31  Mario Sanchez Prada  <msanchez@igalia.com>
    215
  • trunk/Source/WebKit/gtk/tests/testatk.c

    r77137 r77233  
    368368    gint caretOffset = atk_text_get_caret_offset(textObject);
    369369    g_assert_cmpint(caretOffset, ==, characterCount - 1);
     370
     371    result = atk_text_set_caret_offset(textObject, characterCount);
     372    g_assert_cmpint(result, ==, TRUE);
     373
     374    caretOffset = atk_text_get_caret_offset(textObject);
     375    g_assert_cmpint(caretOffset, ==, characterCount);
    370376
    371377    g_object_unref(webView);
Note: See TracChangeset for help on using the changeset viewer.