Changeset 155520 in webkit


Ignore:
Timestamp:
Sep 11, 2013 5:05:10 AM (11 years ago)
Author:
mario@webkit.org
Message:

[GTK] Get rid of Pango/Gail dependencies in accessibility for ATK
https://bugs.webkit.org/show_bug.cgi?id=114867

Reviewed by Martin Robinson.

Removed all trace of Gail and Pango specific code from the AtkText
implementation, now everything has been reimplemented.

  • accessibility/atk/WebKitAccessibleInterfaceText.cpp:

(webkitAccessibleTextGetTextForOffset): Removed fallback code
relying in Gail/Pango, now all the related code has been
removed. Also, replaced the collection of if statements with a
switch, for better readability of the code.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r155519 r155520  
     12013-09-11  Mario Sanchez Prada  <mario.prada@samsung.com>
     2
     3        [GTK] Get rid of Pango/Gail dependencies in accessibility for ATK
     4        https://bugs.webkit.org/show_bug.cgi?id=114867
     5
     6        Reviewed by Martin Robinson.
     7
     8        Removed all trace of Gail and Pango specific code from the AtkText
     9        implementation, now everything has been reimplemented.
     10
     11        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
     12        (webkitAccessibleTextGetTextForOffset): Removed fallback code
     13        relying in Gail/Pango, now all the related code has been
     14        removed. Also, replaced the collection of if statements with a
     15        switch, for better readability of the code.
     16
    1172013-09-11  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    218
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp

    r155516 r155520  
    5555#include <wtf/text/CString.h>
    5656
    57 #if PLATFORM(GTK)
    58 #include <libgail-util/gail-util.h>
    59 #include <pango/pango.h>
    60 #endif
    61 
    6257using namespace WebCore;
    6358
     
    165160}
    166161
    167 static gchar* webkitAccessibleTextGetText(AtkText*, gint startOffset, gint endOffset);
    168 
    169 #if PLATFORM(GTK)
    170 static GailTextUtil* getGailTextUtilForAtk(AtkText* textObject)
    171 {
    172     GailTextUtil* gailTextUtil = gail_text_util_new();
    173     GOwnPtr<char> text(webkitAccessibleTextGetText(textObject, 0, -1));
    174     gail_text_util_text_setup(gailTextUtil, text.get());
    175     return gailTextUtil;
    176 }
    177 
    178 static PangoLayout* getPangoLayoutForAtk(AtkText* textObject)
    179 {
    180     AccessibilityObject* coreObject = core(textObject);
    181 
    182     Document* document = coreObject->document();
    183     if (!document)
    184         return 0;
    185 
    186     HostWindow* hostWindow = document->view()->hostWindow();
    187     if (!hostWindow)
    188         return 0;
    189     PlatformPageClient webView = hostWindow->platformPageClient();
    190     if (!webView)
    191         return 0;
    192 
    193     // Create a string with the layout as it appears on the screen
    194     GOwnPtr<char> objectText(textForObject(coreObject));
    195     PangoLayout* layout = gtk_widget_create_pango_layout(static_cast<GtkWidget*>(webView), objectText.get());
    196     return layout;
    197 }
    198 #endif
    199 
    200162static int baselinePositionForRenderObject(RenderObject* renderObject)
    201163{
     
    368330    return attributeSet1;
    369331}
     332
     333static gchar* webkitAccessibleTextGetText(AtkText*, gint startOffset, gint endOffset);
    370334
    371335static guint accessibilityObjectLength(const AccessibilityObject* object)
     
    10871051        return emptyTextSelectionAtOffset(0, startOffset, endOffset);
    10881052
    1089     if (boundaryType == ATK_TEXT_BOUNDARY_CHAR)
     1053    switch (boundaryType) {
     1054    case ATK_TEXT_BOUNDARY_CHAR:
    10901055        return webkitAccessibleTextGetChar(text, offset, textPosition, startOffset, endOffset);
    10911056
    1092     if (boundaryType == ATK_TEXT_BOUNDARY_WORD_START || boundaryType == ATK_TEXT_BOUNDARY_WORD_END)
     1057    case ATK_TEXT_BOUNDARY_WORD_START:
     1058    case ATK_TEXT_BOUNDARY_WORD_END:
    10931059        return webkitAccessibleTextWordForBoundary(text, offset, boundaryType, textPosition, startOffset, endOffset);
    10941060
    1095     if (boundaryType == ATK_TEXT_BOUNDARY_SENTENCE_START || boundaryType == ATK_TEXT_BOUNDARY_SENTENCE_END)
     1061    case ATK_TEXT_BOUNDARY_LINE_START:
     1062    case ATK_TEXT_BOUNDARY_LINE_END:
     1063        return webkitAccessibleTextLineForBoundary(text, offset, boundaryType, textPosition, startOffset, endOffset);
     1064
     1065    case ATK_TEXT_BOUNDARY_SENTENCE_START:
     1066    case ATK_TEXT_BOUNDARY_SENTENCE_END:
    10961067        return webkitAccessibleTextSentenceForBoundary(text, offset, boundaryType, textPosition, startOffset, endOffset);
    1097 
    1098     if (boundaryType == ATK_TEXT_BOUNDARY_LINE_START || boundaryType == ATK_TEXT_BOUNDARY_LINE_END)
    1099         return webkitAccessibleTextLineForBoundary(text, offset, boundaryType, textPosition, startOffset, endOffset);
    1100 
    1101 #if PLATFORM(GTK)
    1102     // FIXME: Get rid of the code below once every single part above
    1103     // has been properly implemented without using Pango/Cairo.
    1104     GailOffsetType offsetType = GAIL_AT_OFFSET;
    1105     switch (textPosition) {
    1106     case GetTextPositionBefore:
    1107         offsetType = GAIL_BEFORE_OFFSET;
    1108         break;
    1109 
    1110     case GetTextPositionAt:
    1111         break;
    1112 
    1113     case GetTextPositionAfter:
    1114         offsetType = GAIL_AFTER_OFFSET;
    1115         break;
    11161068
    11171069    default:
     
    11191071    }
    11201072
    1121     // Make sure we always return valid valid values for offsets.
    1122     *startOffset = 0;
    1123     *endOffset = 0;
    1124 
    1125     return gail_text_util_get_text(getGailTextUtilForAtk(text), getPangoLayoutForAtk(text), offsetType, boundaryType, offset, startOffset, endOffset);
    1126 #endif
    1127 
    1128     notImplemented();
     1073    // This should never be reached.
    11291074    return 0;
    11301075}
Note: See TracChangeset for help on using the changeset viewer.