Commit c368bef0366f153125e57a69a0ba042743276985

Authored by samuel thibault
1 parent 454cdc26
Exists in master

Backport more patches to thunderbird 52

thunderbird-patches/patches-52/entry-empty 0 โ†’ 100644
... ... @@ -0,0 +1,29 @@
  1 +Fix bogus zoom movement when entry is empty
  2 +
  3 +Integrated in firefox 62
  4 +
  5 +# HG changeset patch
  6 +# User Samuel Thibault <samuel.thibault@ens-lyon.org>
  7 +# Date 1527087753 -7200
  8 +# Wed May 23 17:02:33 2018 +0200
  9 +# Branch 0-0-text-empty
  10 +# Node ID 671db2eaa822daab7d15c25d4aab3b793a0a457f
  11 +# Parent d36cd8bdbc5c0df1d1d7a167f5fedb95c3a3648e
  12 +Bug 1319273 Accessible: Make TextBounds return rect of whole frame if content is empty r=asurkov
  13 +
  14 +diff --git a/mozilla/accessible/generic/HyperTextAccessible.cpp b/mozilla/accessible/generic/HyperTextAccessible.cpp
  15 +--- a/mozilla/accessible/generic/HyperTextAccessible.cpp
  16 ++++ b/mozilla/accessible/generic/HyperTextAccessible.cpp
  17 +@@ -1178,6 +1178,12 @@ HyperTextAccessible::TextBounds(int32_t
  18 + return nsIntRect();
  19 + }
  20 +
  21 ++ if (CharacterCount() == 0) {
  22 ++ nsPresContext* presContext = mDoc->PresContext();
  23 ++ // Empty content, use our own bound to at least get x,y coordinates
  24 ++ return GetFrame()->GetScreenRectInAppUnits().
  25 ++ ToNearestPixels(presContext->AppUnitsPerDevPixel());
  26 ++ }
  27 +
  28 + int32_t childIdx = GetChildIndexAtOffset(startOffset);
  29 + if (childIdx == -1)
... ...
thunderbird-patches/patches-52/scrollsubstringto 0 โ†’ 100644
... ... @@ -0,0 +1,244 @@
  1 +Support scrollsubstringto ATK API
  2 +
  3 +Integrated in firefox 66
  4 +
  5 +# HG changeset patch
  6 +# User Samuel Thibault <samuel.thibault@ens-lyon.org>
  7 +# Date 1548531533 -3600
  8 +# Sat Jan 26 20:38:53 2019 +0100
  9 +# Branch scrollsubstringto
  10 +# Node ID c6aab123f3f358d5a74ecbd457e59bf5cd279cbd
  11 +# Parent b08b9f22ad06e55aa83e9c85c74db82c50552094
  12 +Bug 1523118 atk: Implement scrollsubstringto ATK API r=surkov
  13 +
  14 +diff --git a/mozilla/accessible/atk/nsMaiInterfaceText.cpp b/mozilla/accessible/atk/nsMaiInterfaceText.cpp
  15 +--- a/mozilla/accessible/atk/nsMaiInterfaceText.cpp
  16 ++++ b/mozilla/accessible/atk/nsMaiInterfaceText.cpp
  17 +@@ -585,16 +585,65 @@ static gboolean setCaretOffsetCB(AtkText
  18 +
  19 + if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
  20 + proxy->SetCaretOffset(aOffset);
  21 + return TRUE;
  22 + }
  23 +
  24 + return FALSE;
  25 + }
  26 ++
  27 ++static gboolean scrollSubstringToCB(AtkText* aText,
  28 ++ gint aStartOffset, gint aEndOffset,
  29 ++ AtkScrollType aType) {
  30 ++ AtkObject* atkObject = ATK_OBJECT(aText);
  31 ++ AccessibleWrap* accWrap = GetAccessibleWrap(atkObject);
  32 ++ if (accWrap) {
  33 ++ HyperTextAccessible* text = accWrap->AsHyperText();
  34 ++ if (!text || !text->IsTextRole() ||
  35 ++ !text->IsValidRange(aStartOffset, aEndOffset)) {
  36 ++ return FALSE;
  37 ++ }
  38 ++ text->ScrollSubstringTo(aStartOffset, aEndOffset, aType);
  39 ++ return TRUE;
  40 ++ }
  41 ++
  42 ++ ProxyAccessible* proxy = GetProxy(atkObject);
  43 ++ if (proxy) {
  44 ++ proxy->ScrollSubstringTo(aStartOffset, aEndOffset, aType);
  45 ++ return TRUE;
  46 ++ }
  47 ++
  48 ++ return FALSE;
  49 ++}
  50 ++
  51 ++static gboolean scrollSubstringToPointCB(AtkText* aText,
  52 ++ gint aStartOffset, gint aEndOffset,
  53 ++ AtkCoordType aCoords,
  54 ++ gint aX, gint aY) {
  55 ++ AtkObject* atkObject = ATK_OBJECT(aText);
  56 ++ AccessibleWrap* accWrap = GetAccessibleWrap(atkObject);
  57 ++ if (accWrap) {
  58 ++ HyperTextAccessible* text = accWrap->AsHyperText();
  59 ++ if (!text || !text->IsTextRole() ||
  60 ++ !text->IsValidRange(aStartOffset, aEndOffset)) {
  61 ++ return FALSE;
  62 ++ }
  63 ++ text->ScrollSubstringToPoint(aStartOffset, aEndOffset, aCoords, aX, aY);
  64 ++ return TRUE;
  65 ++ }
  66 ++
  67 ++ ProxyAccessible* proxy = GetProxy(atkObject);
  68 ++ if (proxy) {
  69 ++ proxy->ScrollSubstringToPoint(aStartOffset, aEndOffset, aCoords, aX, aY);
  70 ++ return TRUE;
  71 ++ }
  72 ++
  73 ++ return FALSE;
  74 ++}
  75 + }
  76 +
  77 + void
  78 + textInterfaceInitCB(AtkTextIface* aIface)
  79 + {
  80 + NS_ASSERTION(aIface, "Invalid aIface");
  81 + if (MOZ_UNLIKELY(!aIface))
  82 + return;
  83 +@@ -612,13 +661,18 @@ void textInterfaceInitCB(AtkTextIface* a
  84 + aIface->get_selection = getTextSelectionCB;
  85 +
  86 + // set methods
  87 + aIface->add_selection = addTextSelectionCB;
  88 + aIface->remove_selection = removeTextSelectionCB;
  89 + aIface->set_selection = setTextSelectionCB;
  90 + aIface->set_caret_offset = setCaretOffsetCB;
  91 +
  92 ++ if (IsAtkVersionAtLeast(2, 32)) {
  93 ++ aIface->scroll_substring_to = scrollSubstringToCB;
  94 ++ aIface->scroll_substring_to_point = scrollSubstringToPointCB;
  95 ++ }
  96 ++
  97 + // Cache the string values of the atk text attribute names.
  98 + for (uint32_t i = 0; i < ArrayLength(sAtkTextAttrNames); i++)
  99 + sAtkTextAttrNames[i] =
  100 + atk_text_attribute_get_name(static_cast<AtkTextAttribute>(i));
  101 + }
  102 +diff --git a/mozilla/other-licenses/atk-1.0/atk/atktext.h b/mozilla/other-licenses/atk-1.0/atk/atktext.h
  103 +--- a/mozilla/other-licenses/atk-1.0/atk/atktext.h
  104 ++++ b/mozilla/other-licenses/atk-1.0/atk/atktext.h
  105 +@@ -132,16 +132,44 @@ typedef enum {
  106 + ATK_TEXT_BOUNDARY_WORD_END,
  107 + ATK_TEXT_BOUNDARY_SENTENCE_START,
  108 + ATK_TEXT_BOUNDARY_SENTENCE_END,
  109 + ATK_TEXT_BOUNDARY_LINE_START,
  110 + ATK_TEXT_BOUNDARY_LINE_END
  111 + } AtkTextBoundary;
  112 +
  113 + /**
  114 ++ *AtkTextGranularity:
  115 ++ *@ATK_TEXT_GRANULARITY_CHAR: Granularity is defined by the boundaries between characters
  116 ++ * (including non-printing characters)
  117 ++ *@ATK_TEXT_GRANULARITY_WORD: Granularity is defined by the boundaries of a word,
  118 ++ * starting at the beginning of the current word and finishing at the beginning of
  119 ++ * the following one, if present.
  120 ++ *@ATK_TEXT_GRANULARITY_SENTENCE: Granularity is defined by the boundaries of a sentence,
  121 ++ * starting at the beginning of the current sentence and finishing at the beginning of
  122 ++ * the following one, if present.
  123 ++ *@ATK_TEXT_GRANULARITY_LINE: Granularity is defined by the boundaries of a line,
  124 ++ * starting at the beginning of the current line and finishing at the beginning of
  125 ++ * the following one, if present.
  126 ++ *@ATK_TEXT_GRANULARITY_PARAGRAPH: Granularity is defined by the boundaries of a paragraph,
  127 ++ * starting at the beginning of the current paragraph and finishing at the beginning of
  128 ++ * the following one, if present.
  129 ++ *
  130 ++ * Text granularity types used for specifying the granularity of the region of
  131 ++ * text we are interested in.
  132 ++ **/
  133 ++typedef enum {
  134 ++ ATK_TEXT_GRANULARITY_CHAR,
  135 ++ ATK_TEXT_GRANULARITY_WORD,
  136 ++ ATK_TEXT_GRANULARITY_SENTENCE,
  137 ++ ATK_TEXT_GRANULARITY_LINE,
  138 ++ ATK_TEXT_GRANULARITY_PARAGRAPH
  139 ++} AtkTextGranularity;
  140 ++
  141 ++/**
  142 + * AtkTextRectangle:
  143 + * @x: The horizontal coordinate of a rectangle
  144 + * @y: The vertical coordinate of a rectangle
  145 + * @width: The width of a rectangle
  146 + * @height: The height of a rectangle
  147 + *
  148 + * A structure used to store a rectangle used by AtkText.
  149 + **/
  150 +@@ -267,19 +295,43 @@ struct _AtkTextIface
  151 + AtkCoordType coord_type,
  152 + AtkTextRectangle *rect);
  153 +
  154 + AtkTextRange** (* get_bounded_ranges) (AtkText *text,
  155 + AtkTextRectangle *rect,
  156 + AtkCoordType coord_type,
  157 + AtkTextClipType x_clip_type,
  158 + AtkTextClipType y_clip_type);
  159 +-
  160 +
  161 +- AtkFunction pad4;
  162 ++ gchar* (* get_string_at_offset) (AtkText *text,
  163 ++ gint offset,
  164 ++ AtkTextGranularity granularity,
  165 ++ gint *start_offset,
  166 ++ gint *end_offset);
  167 ++ /*
  168 ++ * Scrolls this text range so it becomes visible on the screen.
  169 ++ *
  170 ++ * scroll_substring_to lets the implementation compute an appropriate target
  171 ++ * position on the screen, with type used as a positioning hint.
  172 ++ *
  173 ++ * scroll_substring_to_point lets the client specify a precise target position
  174 ++ * on the screen.
  175 ++ *
  176 ++ * Since ATK 2.32
  177 ++ */
  178 ++ gboolean (* scroll_substring_to) (AtkText *text,
  179 ++ gint start_offset,
  180 ++ gint end_offset,
  181 ++ AtkScrollType type);
  182 ++ gboolean (* scroll_substring_to_point) (AtkText *text,
  183 ++ gint start_offset,
  184 ++ gint end_offset,
  185 ++ AtkCoordType coords,
  186 ++ gint x,
  187 ++ gint y);
  188 + };
  189 +
  190 + GType atk_text_get_type (void);
  191 +
  192 +
  193 + /*
  194 + * Additional AtkObject properties used by AtkText:
  195 + * "accessible_text" (accessible text has changed)
  196 +@@ -302,16 +354,21 @@ gchar* atk_text_get_text_at_offse
  197 + AtkTextBoundary boundary_type,
  198 + gint *start_offset,
  199 + gint *end_offset);
  200 + gchar* atk_text_get_text_before_offset (AtkText *text,
  201 + gint offset,
  202 + AtkTextBoundary boundary_type,
  203 + gint *start_offset,
  204 + gint *end_offset);
  205 ++gchar* atk_text_get_string_at_offset (AtkText *text,
  206 ++ gint offset,
  207 ++ AtkTextGranularity granularity,
  208 ++ gint *start_offset,
  209 ++ gint *end_offset);
  210 + gint atk_text_get_caret_offset (AtkText *text);
  211 + void atk_text_get_character_extents (AtkText *text,
  212 + gint offset,
  213 + gint *x,
  214 + gint *y,
  215 + gint *width,
  216 + gint *height,
  217 + AtkCoordType coords);
  218 +@@ -354,14 +411,26 @@ AtkTextRange** atk_text_get_bounded_ran
  219 + AtkTextClipType y_clip_type);
  220 + void atk_text_free_ranges (AtkTextRange **ranges);
  221 + void atk_attribute_set_free (AtkAttributeSet *attrib_set);
  222 + G_CONST_RETURN gchar* atk_text_attribute_get_name (AtkTextAttribute attr);
  223 + AtkTextAttribute atk_text_attribute_for_name (const gchar *name);
  224 + G_CONST_RETURN gchar* atk_text_attribute_get_value (AtkTextAttribute attr,
  225 + gint index_);
  226 +
  227 ++gboolean atk_text_scroll_substring_to (AtkText *text,
  228 ++ gint start_offset,
  229 ++ gint end_offset,
  230 ++ AtkScrollType type);
  231 ++
  232 ++gboolean atk_text_scroll_substring_to_point (AtkText *text,
  233 ++ gint start_offset,
  234 ++ gint end_offset,
  235 ++ AtkCoordType coords,
  236 ++ gint x,
  237 ++ gint y);
  238 ++
  239 + #ifdef __cplusplus
  240 + }
  241 + #endif /* __cplusplus */
  242 +
  243 +
  244 + #endif /* __ATK_TEXT_H__ */
... ...
thunderbird-patches/patches-52/scrollto 0 โ†’ 100644
... ... @@ -0,0 +1,181 @@
  1 +Support scrollto ATK API
  2 +
  3 +Integrated in firefox 62
  4 +
  5 +# HG changeset patch
  6 +# User Samuel Thibault <samuel.thibault@ens-lyon.org>
  7 +# Date 1525269333 -7200
  8 +# Wed May 02 15:55:33 2018 +0200
  9 +# Branch scrollto
  10 +# Node ID 66cabb17979cb117aa0d7e1927f8b0c0642c2a0f
  11 +# Parent 87bd488c19f620d726b8363d47c8a320bae9bb7c
  12 +Bug 1458548 atk: Implement scrollto ATK API r=surkov
  13 +
  14 +Index: firefox-esr-60.5.0esr-jessie/mozilla/accessible/atk/nsMaiInterfaceComponent.cpp
  15 +===================================================================
  16 +--- firefox-esr-60.5.0esr-jessie.orig/mozilla/accessible/atk/nsMaiInterfaceComponent.cpp
  17 ++++ firefox-esr-60.5.0esr-jessie/mozilla/accessible/atk/nsMaiInterfaceComponent.cpp
  18 +@@ -6,6 +6,7 @@
  19 +
  20 + #include "InterfaceInitFuncs.h"
  21 +
  22 ++#include "Accessible-inl.h"
  23 + #include "AccessibleWrap.h"
  24 + #include "nsAccUtils.h"
  25 + #include "nsCoreUtils.h"
  26 +@@ -45,6 +45,46 @@ static gboolean grabFocusCB(AtkComponent
  27 +
  28 + return FALSE;
  29 + }
  30 ++
  31 ++// ScrollType is compatible
  32 ++static gboolean
  33 ++scrollToCB(AtkComponent* aComponent, AtkScrollType type)
  34 ++{
  35 ++ AtkObject* atkObject = ATK_OBJECT(aComponent);
  36 ++ AccessibleWrap* accWrap = GetAccessibleWrap(atkObject);
  37 ++ if (accWrap) {
  38 ++ accWrap->ScrollTo(type);
  39 ++ return TRUE;
  40 ++ }
  41 ++
  42 ++ ProxyAccessible* proxy = GetProxy(atkObject);
  43 ++ if (proxy) {
  44 ++ proxy->ScrollTo(type);
  45 ++ return TRUE;
  46 ++ }
  47 ++
  48 ++ return FALSE;
  49 ++}
  50 ++
  51 ++// CoordType is compatible
  52 ++static gboolean
  53 ++scrollToPointCB(AtkComponent* aComponent, AtkCoordType coords, gint x, gint y)
  54 ++{
  55 ++ AtkObject* atkObject = ATK_OBJECT(aComponent);
  56 ++ AccessibleWrap* accWrap = GetAccessibleWrap(atkObject);
  57 ++ if (accWrap) {
  58 ++ accWrap->ScrollToPoint(coords, x, y);
  59 ++ return TRUE;
  60 ++ }
  61 ++
  62 ++ ProxyAccessible* proxy = GetProxy(atkObject);
  63 ++ if (proxy) {
  64 ++ proxy->ScrollToPoint(coords, x, y);
  65 ++ return TRUE;
  66 ++ }
  67 ++
  68 ++ return FALSE;
  69 ++}
  70 + }
  71 +
  72 + AtkObject*
  73 +@@ -133,4 +173,8 @@ void componentInterfaceInitCB(AtkCompone
  74 + aIface->ref_accessible_at_point = refAccessibleAtPointCB;
  75 + aIface->get_extents = getExtentsCB;
  76 + aIface->grab_focus = grabFocusCB;
  77 ++ if (IsAtkVersionAtLeast(2, 30)) {
  78 ++ aIface->scroll_to = scrollToCB;
  79 ++ aIface->scroll_to_point = scrollToPointCB;
  80 ++ }
  81 + }
  82 +Index: firefox-esr-60.5.0esr-jessie/mozilla/other-licenses/atk-1.0/atk/atkcomponent.h
  83 +===================================================================
  84 +--- firefox-esr-60.5.0esr-jessie.orig/mozilla/other-licenses/atk-1.0/atk/atkcomponent.h
  85 ++++ firefox-esr-60.5.0esr-jessie/mozilla/other-licenses/atk-1.0/atk/atkcomponent.h
  86 +@@ -27,6 +27,36 @@
  87 + extern "C" {
  88 + #endif /* __cplusplus */
  89 +
  90 ++/**
  91 ++ *AtkScrollType:
  92 ++ *@ATK_SCROLL_TOP_LEFT: Scroll the object vertically and horizontally to the top
  93 ++ *left corner of the window.
  94 ++ *@ATK_SCROLL_BOTTOM_RIGHT: Scroll the object vertically and horizontally to the
  95 ++ *bottom right corner of the window.
  96 ++ *@ATK_SCROLL_TOP_EDGE: Scroll the object vertically to the top edge of the
  97 ++ window.
  98 ++ *@ATK_SCROLL_BOTTOM_EDGE: Scroll the object vertically to the bottom edge of
  99 ++ *the window.
  100 ++ *@ATK_SCROLL_LEFT_EDGE: Scroll the object vertically and horizontally to the
  101 ++ *left edge of the window.
  102 ++ *@ATK_SCROLL_RIGHT_EDGE: Scroll the object vertically and horizontally to the
  103 ++ *right edge of the window.
  104 ++ *@ATK_SCROLL_ANYWHERE: Scroll the object vertically and horizontally so that
  105 ++ *as much as possible of the object becomes visible. The exact placement is
  106 ++ *determined by the application.
  107 ++ *
  108 ++ * Specifies where an object should be placed on the screen when using scroll_to.
  109 ++ **/
  110 ++typedef enum {
  111 ++ ATK_SCROLL_TOP_LEFT,
  112 ++ ATK_SCROLL_BOTTOM_RIGHT,
  113 ++ ATK_SCROLL_TOP_EDGE,
  114 ++ ATK_SCROLL_BOTTOM_EDGE,
  115 ++ ATK_SCROLL_LEFT_EDGE,
  116 ++ ATK_SCROLL_RIGHT_EDGE,
  117 ++ ATK_SCROLL_ANYWHERE
  118 ++} AtkScrollType;
  119 ++
  120 + /*
  121 + * The AtkComponent interface should be supported by any object that is
  122 + * rendered on the screen. The interface provides the standard mechanism
  123 +@@ -115,6 +145,18 @@ struct _AtkComponentIface
  124 + void (* bounds_changed) (AtkComponent *component,
  125 + AtkRectangle *bounds);
  126 + gdouble (* get_alpha) (AtkComponent *component);
  127 ++
  128 ++ /*
  129 ++ * Scrolls this object so it becomes visible on the screen.
  130 ++ * Since ATK 2.30
  131 ++ */
  132 ++ gboolean (*scroll_to) (AtkComponent *component,
  133 ++ AtkScrollType type);
  134 ++
  135 ++ gboolean (*scroll_to_point) (AtkComponent *component,
  136 ++ AtkCoordType coords,
  137 ++ gint x,
  138 ++ gint y);
  139 + };
  140 +
  141 + GType atk_component_get_type (void);
  142 +@@ -163,6 +205,14 @@ gboolean atk_component_set_
  143 + gint width,
  144 + gint height);
  145 + gdouble atk_component_get_alpha (AtkComponent *component);
  146 ++gboolean atk_component_scroll_to (AtkComponent *component,
  147 ++ AtkScrollType type);
  148 ++
  149 ++gboolean atk_component_scroll_to_point (AtkComponent *component,
  150 ++ AtkCoordType coords,
  151 ++ gint x,
  152 ++ gint y);
  153 ++
  154 + #ifdef __cplusplus
  155 + }
  156 + #endif /* __cplusplus */
  157 +Index: firefox-esr-60.5.0esr-jessie/mozilla/other-licenses/atk-1.0/atk/atkutil.h
  158 +===================================================================
  159 +--- firefox-esr-60.5.0esr-jessie.orig/mozilla/other-licenses/atk-1.0/atk/atkutil.h
  160 ++++ firefox-esr-60.5.0esr-jessie/mozilla/other-licenses/atk-1.0/atk/atkutil.h
  161 +@@ -153,15 +153,18 @@ GType atk_util_get_type (void);
  162 + /**
  163 + *AtkCoordType:
  164 + *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen
  165 +- *@ATK_XY_WINDOW: specifies xy coordinates relative to the widget's
  166 ++ *@ATK_XY_WINDOW: specifies xy coordinates relative to the widget's
  167 + * top-level window
  168 ++ *@ATK_XY_PARENT: specifies xy coordinates relative to the widget's
  169 ++ * immediate parent.
  170 + *
  171 + *Specifies how xy coordinates are to be interpreted. Used by functions such
  172 + *as atk_component_get_position() and atk_text_get_character_extents()
  173 + **/
  174 + typedef enum {
  175 + ATK_XY_SCREEN,
  176 +- ATK_XY_WINDOW
  177 ++ ATK_XY_WINDOW,
  178 ++ ATK_XY_PARENT
  179 + }AtkCoordType;
  180 +
  181 + /*
... ...