COMMIT_MESSAGE

 12013-05-09 Mario Sanchez Prada <mario.prada@samsung.com>
 2
 3 [GTK] Reimplement atk_text_get_text_*_offset for CHAR boundary
 4 https://bugs.webkit.org/show_bug.cgi?id=114870
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Re-implement this functions without using GailTextUtil nor Pango.
 9
 10 * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
 11 (webkitAccessibleTextGetChar): New function.
 12 (webkitAccessibleTextGetTextForOffset): Call the new function for CHAR.

Source/WebCore/ChangeLog

 12013-05-09 Mario Sanchez Prada <mario.prada@samsung.com>
 2
 3 [GTK] Reimplement atk_text_get_text_*_offset for CHAR boundary
 4 https://bugs.webkit.org/show_bug.cgi?id=114870
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Re-implement this functions without using GailTextUtil nor Pango.
 9
 10 * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
 11 (webkitAccessibleTextGetChar): New function.
 12 (webkitAccessibleTextGetTextForOffset): Call the new function for CHAR.
 13
1142013-05-21 Alberto Garcia <agarcia@igalia.com>
215
316 Add FloatRect::normalized() for BlackBerry

Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp

4545#include "RenderText.h"
4646#include "TextEncoding.h"
4747#include "TextIterator.h"
 48#include "VisibleUnits.h"
4849#include "WebKitAccessibleUtil.h"
4950#include "WebKitAccessibleWrapperAtk.h"
5051#include "htmlediting.h"

@@enum GetTextRelativePosition {
574575 GetTextPositionAfter
575576};
576577
 578static gchar* webkitAccessibleTextGetChar(AtkText* text, gint offset, GetTextRelativePosition textPosition, gint* startOffset, gint* endOffset)
 579{
 580 AccessibilityObject* coreObject = core(text);
 581 if (!coreObject || !coreObject->isAccessibilityRenderObject())
 582 return g_strdup("");
 583
 584 int actualOffset = offset;
 585 if (textPosition == GetTextPositionBefore)
 586 actualOffset--;
 587 else if (textPosition == GetTextPositionAfter)
 588 actualOffset++;
 589
 590 GOwnPtr<char> textData(webkitAccessibleTextGetText(text, 0, -1));
 591 int textLength = g_utf8_strlen(textData.get(), -1);
 592
 593 *startOffset = std::max(0, actualOffset);
 594 *startOffset = std::min(*startOffset, textLength);
 595
 596 *endOffset = std::max(0, actualOffset + 1);
 597 *endOffset = std::min(*endOffset, textLength);
 598
 599 if (*startOffset == *endOffset)
 600 return g_strdup("");
 601
 602 // Make sure we return the line break if we are at the visual end of a line.
 603 VisiblePosition visPos = coreObject->visiblePositionForIndex(actualOffset);
 604 if (isEndOfLine(visPos))
 605 return g_strdup("\n");
 606
 607 return g_utf8_substring(textData.get(), *startOffset, *endOffset);
 608}
 609
577610static gchar* webkitAccessibleTextGetTextForOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, GetTextRelativePosition textPosition, gint* startOffset, gint* endOffset)
578611{
 612 // Make sure we always return valid valid values for offsets.
 613 *startOffset = 0;
 614 *endOffset = 0;
 615
 616 if (boundaryType == ATK_TEXT_BOUNDARY_CHAR)
 617 return webkitAccessibleTextGetChar(text, offset, textPosition, startOffset, endOffset);
 618
579619#if PLATFORM(GTK)
580620 // FIXME: Get rid of the code below once every single get_text_*_offset
581621 // function has been properly implemented without using Pango/Cairo.

@@static gchar* webkitAccessibleTextGetTextForOffset(AtkText* text, gint offset, A
600640 return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), offsetType, boundaryType, offset, startOffset, endOffset);
601641#endif
602642
603  UNUSED_PARAM(text);
604  UNUSED_PARAM(offset);
605  UNUSED_PARAM(boundaryType);
606  UNUSED_PARAM(textPosition);
607  UNUSED_PARAM(startOffset);
608  UNUSED_PARAM(endOffset);
609 
610643 notImplemented();
611644 return 0;
612645}