Changeset 148749 in webkit


Ignore:
Timestamp:
Apr 19, 2013 9:03:46 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Minimize calls to GailTextUtil in AtkText implementation
https://bugs.webkit.org/show_bug.cgi?id=114868

Patch by Mario Sanchez Prada <mario.prada@samsung.com> on 2013-04-19
Reviewed by Martin Robinson.

Create a new helper function to concentrate inside of it the calls to
gail_text_util_get_text(), so we can get rid of it later more easily.

  • accessibility/atk/WebKitAccessibleInterfaceText.cpp:

(webkitAccessibleTextGetTextForOffset): New helper function.
(webkitAccessibleTextGetTextAfterOffset): Rely on the new function.
(webkitAccessibleTextGetTextAtOffset): Ditto.
(webkitAccessibleTextGetTextBeforeOffset): Ditto.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148748 r148749  
     12013-04-19  Mario Sanchez Prada  <mario.prada@samsung.com>
     2
     3        [GTK] Minimize calls to GailTextUtil in AtkText implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=114868
     5
     6        Reviewed by Martin Robinson.
     7
     8        Create a new helper function to concentrate inside of it the calls to
     9        gail_text_util_get_text(), so we can get rid of it later more easily.
     10
     11        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
     12        (webkitAccessibleTextGetTextForOffset): New helper function.
     13        (webkitAccessibleTextGetTextAfterOffset): Rely on the new function.
     14        (webkitAccessibleTextGetTextAtOffset): Ditto.
     15        (webkitAccessibleTextGetTextBeforeOffset): Ditto.
     16
    1172013-04-19  Noam Rosenthal  <noam@webkit.org>
    218
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp

    r142375 r148749  
    568568}
    569569
    570 static gchar* webkitAccessibleTextGetTextAfterOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset)
     570enum GetTextRelativePosition {
     571    GetTextPositionAt,
     572    GetTextPositionBefore,
     573    GetTextPositionAfter
     574};
     575
     576static gchar* webkitAccessibleTextGetTextForOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, GetTextRelativePosition textPosition, gint* startOffset, gint* endOffset)
    571577{
    572578#if PLATFORM(GTK)
    573     return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), GAIL_AFTER_OFFSET, boundaryType, offset, startOffset, endOffset);
    574 #else
     579    // FIXME: Get rid of the code below once every single get_text_*_offset
     580    // function has been properly implemented without using Pango/Cairo.
     581    GailOffsetType offsetType;
     582    switch (textPosition) {
     583    case GetTextPositionBefore:
     584        offsetType = GAIL_BEFORE_OFFSET;
     585        break;
     586
     587    case GetTextPositionAt:
     588        offsetType = GAIL_AT_OFFSET;
     589        break;
     590
     591    case GetTextPositionAfter:
     592        offsetType = GAIL_AFTER_OFFSET;
     593        break;
     594
     595    default:
     596        ASSERT_NOT_REACHED();
     597    }
     598
     599    return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), offsetType, boundaryType, offset, startOffset, endOffset);
     600#endif
     601
    575602    UNUSED_PARAM(text);
    576603    UNUSED_PARAM(offset);
     
    581608    notImplemented();
    582609    return 0;
    583 #endif
     610}
     611
     612static gchar* webkitAccessibleTextGetTextAfterOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset)
     613{
     614    return webkitAccessibleTextGetTextForOffset(text, offset, boundaryType, GetTextPositionAfter, startOffset, endOffset);
    584615}
    585616
    586617static gchar* webkitAccessibleTextGetTextAtOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset)
    587618{
    588 #if PLATFORM(GTK)
    589     return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), GAIL_AT_OFFSET, boundaryType, offset, startOffset, endOffset);
    590 #else
    591     UNUSED_PARAM(text);
    592     UNUSED_PARAM(offset);
    593     UNUSED_PARAM(boundaryType);
    594     UNUSED_PARAM(startOffset);
    595     UNUSED_PARAM(endOffset);
    596 
    597     notImplemented();
    598     return 0;
    599 #endif
     619    return webkitAccessibleTextGetTextForOffset(text, offset, boundaryType, GetTextPositionAt, startOffset, endOffset);
    600620}
    601621
    602622static gchar* webkitAccessibleTextGetTextBeforeOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset)
    603623{
    604 #if PLATFORM(GTK)
    605     return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), GAIL_BEFORE_OFFSET, boundaryType, offset, startOffset, endOffset);
    606 #else
    607     UNUSED_PARAM(text);
    608     UNUSED_PARAM(offset);
    609     UNUSED_PARAM(boundaryType);
    610     UNUSED_PARAM(startOffset);
    611     UNUSED_PARAM(endOffset);
    612 
    613     notImplemented();
    614     return 0;
    615 #endif
     624    return webkitAccessibleTextGetTextForOffset(text, offset, boundaryType, GetTextPositionBefore, startOffset, endOffset);
    616625}
    617626
Note: See TracChangeset for help on using the changeset viewer.