From c368bef0366f153125e57a69a0ba042743276985 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 22 Feb 2019 15:15:46 +0100 Subject: [PATCH] Backport more patches to thunderbird 52 --- thunderbird-patches/patches-52/entry-empty | 29 +++ .../patches-52/scrollsubstringto | 244 ++++++++++++++++++ thunderbird-patches/patches-52/scrollto | 181 +++++++++++++ 3 files changed, 454 insertions(+) create mode 100644 thunderbird-patches/patches-52/entry-empty create mode 100644 thunderbird-patches/patches-52/scrollsubstringto create mode 100644 thunderbird-patches/patches-52/scrollto diff --git a/thunderbird-patches/patches-52/entry-empty b/thunderbird-patches/patches-52/entry-empty new file mode 100644 index 0000000..1818fa2 --- /dev/null +++ b/thunderbird-patches/patches-52/entry-empty @@ -0,0 +1,29 @@ +Fix bogus zoom movement when entry is empty + +Integrated in firefox 62 + +# HG changeset patch +# User Samuel Thibault +# Date 1527087753 -7200 +# Wed May 23 17:02:33 2018 +0200 +# Branch 0-0-text-empty +# Node ID 671db2eaa822daab7d15c25d4aab3b793a0a457f +# Parent d36cd8bdbc5c0df1d1d7a167f5fedb95c3a3648e +Bug 1319273 Accessible: Make TextBounds return rect of whole frame if content is empty r=asurkov + +diff --git a/mozilla/accessible/generic/HyperTextAccessible.cpp b/mozilla/accessible/generic/HyperTextAccessible.cpp +--- a/mozilla/accessible/generic/HyperTextAccessible.cpp ++++ b/mozilla/accessible/generic/HyperTextAccessible.cpp +@@ -1178,6 +1178,12 @@ HyperTextAccessible::TextBounds(int32_t + return nsIntRect(); + } + ++ if (CharacterCount() == 0) { ++ nsPresContext* presContext = mDoc->PresContext(); ++ // Empty content, use our own bound to at least get x,y coordinates ++ return GetFrame()->GetScreenRectInAppUnits(). ++ ToNearestPixels(presContext->AppUnitsPerDevPixel()); ++ } + + int32_t childIdx = GetChildIndexAtOffset(startOffset); + if (childIdx == -1) diff --git a/thunderbird-patches/patches-52/scrollsubstringto b/thunderbird-patches/patches-52/scrollsubstringto new file mode 100644 index 0000000..2a71bc7 --- /dev/null +++ b/thunderbird-patches/patches-52/scrollsubstringto @@ -0,0 +1,244 @@ +Support scrollsubstringto ATK API + +Integrated in firefox 66 + +# HG changeset patch +# User Samuel Thibault +# Date 1548531533 -3600 +# Sat Jan 26 20:38:53 2019 +0100 +# Branch scrollsubstringto +# Node ID c6aab123f3f358d5a74ecbd457e59bf5cd279cbd +# Parent b08b9f22ad06e55aa83e9c85c74db82c50552094 +Bug 1523118 atk: Implement scrollsubstringto ATK API r=surkov + +diff --git a/mozilla/accessible/atk/nsMaiInterfaceText.cpp b/mozilla/accessible/atk/nsMaiInterfaceText.cpp +--- a/mozilla/accessible/atk/nsMaiInterfaceText.cpp ++++ b/mozilla/accessible/atk/nsMaiInterfaceText.cpp +@@ -585,16 +585,65 @@ static gboolean setCaretOffsetCB(AtkText + + if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) { + proxy->SetCaretOffset(aOffset); + return TRUE; + } + + return FALSE; + } ++ ++static gboolean scrollSubstringToCB(AtkText* aText, ++ gint aStartOffset, gint aEndOffset, ++ AtkScrollType aType) { ++ AtkObject* atkObject = ATK_OBJECT(aText); ++ AccessibleWrap* accWrap = GetAccessibleWrap(atkObject); ++ if (accWrap) { ++ HyperTextAccessible* text = accWrap->AsHyperText(); ++ if (!text || !text->IsTextRole() || ++ !text->IsValidRange(aStartOffset, aEndOffset)) { ++ return FALSE; ++ } ++ text->ScrollSubstringTo(aStartOffset, aEndOffset, aType); ++ return TRUE; ++ } ++ ++ ProxyAccessible* proxy = GetProxy(atkObject); ++ if (proxy) { ++ proxy->ScrollSubstringTo(aStartOffset, aEndOffset, aType); ++ return TRUE; ++ } ++ ++ return FALSE; ++} ++ ++static gboolean scrollSubstringToPointCB(AtkText* aText, ++ gint aStartOffset, gint aEndOffset, ++ AtkCoordType aCoords, ++ gint aX, gint aY) { ++ AtkObject* atkObject = ATK_OBJECT(aText); ++ AccessibleWrap* accWrap = GetAccessibleWrap(atkObject); ++ if (accWrap) { ++ HyperTextAccessible* text = accWrap->AsHyperText(); ++ if (!text || !text->IsTextRole() || ++ !text->IsValidRange(aStartOffset, aEndOffset)) { ++ return FALSE; ++ } ++ text->ScrollSubstringToPoint(aStartOffset, aEndOffset, aCoords, aX, aY); ++ return TRUE; ++ } ++ ++ ProxyAccessible* proxy = GetProxy(atkObject); ++ if (proxy) { ++ proxy->ScrollSubstringToPoint(aStartOffset, aEndOffset, aCoords, aX, aY); ++ return TRUE; ++ } ++ ++ return FALSE; ++} + } + + void + textInterfaceInitCB(AtkTextIface* aIface) + { + NS_ASSERTION(aIface, "Invalid aIface"); + if (MOZ_UNLIKELY(!aIface)) + return; +@@ -612,13 +661,18 @@ void textInterfaceInitCB(AtkTextIface* a + aIface->get_selection = getTextSelectionCB; + + // set methods + aIface->add_selection = addTextSelectionCB; + aIface->remove_selection = removeTextSelectionCB; + aIface->set_selection = setTextSelectionCB; + aIface->set_caret_offset = setCaretOffsetCB; + ++ if (IsAtkVersionAtLeast(2, 32)) { ++ aIface->scroll_substring_to = scrollSubstringToCB; ++ aIface->scroll_substring_to_point = scrollSubstringToPointCB; ++ } ++ + // Cache the string values of the atk text attribute names. + for (uint32_t i = 0; i < ArrayLength(sAtkTextAttrNames); i++) + sAtkTextAttrNames[i] = + atk_text_attribute_get_name(static_cast(i)); + } +diff --git a/mozilla/other-licenses/atk-1.0/atk/atktext.h b/mozilla/other-licenses/atk-1.0/atk/atktext.h +--- a/mozilla/other-licenses/atk-1.0/atk/atktext.h ++++ b/mozilla/other-licenses/atk-1.0/atk/atktext.h +@@ -132,16 +132,44 @@ typedef enum { + ATK_TEXT_BOUNDARY_WORD_END, + ATK_TEXT_BOUNDARY_SENTENCE_START, + ATK_TEXT_BOUNDARY_SENTENCE_END, + ATK_TEXT_BOUNDARY_LINE_START, + ATK_TEXT_BOUNDARY_LINE_END + } AtkTextBoundary; + + /** ++ *AtkTextGranularity: ++ *@ATK_TEXT_GRANULARITY_CHAR: Granularity is defined by the boundaries between characters ++ * (including non-printing characters) ++ *@ATK_TEXT_GRANULARITY_WORD: Granularity is defined by the boundaries of a word, ++ * starting at the beginning of the current word and finishing at the beginning of ++ * the following one, if present. ++ *@ATK_TEXT_GRANULARITY_SENTENCE: Granularity is defined by the boundaries of a sentence, ++ * starting at the beginning of the current sentence and finishing at the beginning of ++ * the following one, if present. ++ *@ATK_TEXT_GRANULARITY_LINE: Granularity is defined by the boundaries of a line, ++ * starting at the beginning of the current line and finishing at the beginning of ++ * the following one, if present. ++ *@ATK_TEXT_GRANULARITY_PARAGRAPH: Granularity is defined by the boundaries of a paragraph, ++ * starting at the beginning of the current paragraph and finishing at the beginning of ++ * the following one, if present. ++ * ++ * Text granularity types used for specifying the granularity of the region of ++ * text we are interested in. ++ **/ ++typedef enum { ++ ATK_TEXT_GRANULARITY_CHAR, ++ ATK_TEXT_GRANULARITY_WORD, ++ ATK_TEXT_GRANULARITY_SENTENCE, ++ ATK_TEXT_GRANULARITY_LINE, ++ ATK_TEXT_GRANULARITY_PARAGRAPH ++} AtkTextGranularity; ++ ++/** + * AtkTextRectangle: + * @x: The horizontal coordinate of a rectangle + * @y: The vertical coordinate of a rectangle + * @width: The width of a rectangle + * @height: The height of a rectangle + * + * A structure used to store a rectangle used by AtkText. + **/ +@@ -267,19 +295,43 @@ struct _AtkTextIface + AtkCoordType coord_type, + AtkTextRectangle *rect); + + AtkTextRange** (* get_bounded_ranges) (AtkText *text, + AtkTextRectangle *rect, + AtkCoordType coord_type, + AtkTextClipType x_clip_type, + AtkTextClipType y_clip_type); +- + +- AtkFunction pad4; ++ gchar* (* get_string_at_offset) (AtkText *text, ++ gint offset, ++ AtkTextGranularity granularity, ++ gint *start_offset, ++ gint *end_offset); ++ /* ++ * Scrolls this text range so it becomes visible on the screen. ++ * ++ * scroll_substring_to lets the implementation compute an appropriate target ++ * position on the screen, with type used as a positioning hint. ++ * ++ * scroll_substring_to_point lets the client specify a precise target position ++ * on the screen. ++ * ++ * Since ATK 2.32 ++ */ ++ gboolean (* scroll_substring_to) (AtkText *text, ++ gint start_offset, ++ gint end_offset, ++ AtkScrollType type); ++ gboolean (* scroll_substring_to_point) (AtkText *text, ++ gint start_offset, ++ gint end_offset, ++ AtkCoordType coords, ++ gint x, ++ gint y); + }; + + GType atk_text_get_type (void); + + + /* + * Additional AtkObject properties used by AtkText: + * "accessible_text" (accessible text has changed) +@@ -302,16 +354,21 @@ gchar* atk_text_get_text_at_offse + AtkTextBoundary boundary_type, + gint *start_offset, + gint *end_offset); + gchar* atk_text_get_text_before_offset (AtkText *text, + gint offset, + AtkTextBoundary boundary_type, + gint *start_offset, + gint *end_offset); ++gchar* atk_text_get_string_at_offset (AtkText *text, ++ gint offset, ++ AtkTextGranularity granularity, ++ gint *start_offset, ++ gint *end_offset); + gint atk_text_get_caret_offset (AtkText *text); + void atk_text_get_character_extents (AtkText *text, + gint offset, + gint *x, + gint *y, + gint *width, + gint *height, + AtkCoordType coords); +@@ -354,14 +411,26 @@ AtkTextRange** atk_text_get_bounded_ran + AtkTextClipType y_clip_type); + void atk_text_free_ranges (AtkTextRange **ranges); + void atk_attribute_set_free (AtkAttributeSet *attrib_set); + G_CONST_RETURN gchar* atk_text_attribute_get_name (AtkTextAttribute attr); + AtkTextAttribute atk_text_attribute_for_name (const gchar *name); + G_CONST_RETURN gchar* atk_text_attribute_get_value (AtkTextAttribute attr, + gint index_); + ++gboolean atk_text_scroll_substring_to (AtkText *text, ++ gint start_offset, ++ gint end_offset, ++ AtkScrollType type); ++ ++gboolean atk_text_scroll_substring_to_point (AtkText *text, ++ gint start_offset, ++ gint end_offset, ++ AtkCoordType coords, ++ gint x, ++ gint y); ++ + #ifdef __cplusplus + } + #endif /* __cplusplus */ + + + #endif /* __ATK_TEXT_H__ */ diff --git a/thunderbird-patches/patches-52/scrollto b/thunderbird-patches/patches-52/scrollto new file mode 100644 index 0000000..2c812d1 --- /dev/null +++ b/thunderbird-patches/patches-52/scrollto @@ -0,0 +1,181 @@ +Support scrollto ATK API + +Integrated in firefox 62 + +# HG changeset patch +# User Samuel Thibault +# Date 1525269333 -7200 +# Wed May 02 15:55:33 2018 +0200 +# Branch scrollto +# Node ID 66cabb17979cb117aa0d7e1927f8b0c0642c2a0f +# Parent 87bd488c19f620d726b8363d47c8a320bae9bb7c +Bug 1458548 atk: Implement scrollto ATK API r=surkov + +Index: firefox-esr-60.5.0esr-jessie/mozilla/accessible/atk/nsMaiInterfaceComponent.cpp +=================================================================== +--- firefox-esr-60.5.0esr-jessie.orig/mozilla/accessible/atk/nsMaiInterfaceComponent.cpp ++++ firefox-esr-60.5.0esr-jessie/mozilla/accessible/atk/nsMaiInterfaceComponent.cpp +@@ -6,6 +6,7 @@ + + #include "InterfaceInitFuncs.h" + ++#include "Accessible-inl.h" + #include "AccessibleWrap.h" + #include "nsAccUtils.h" + #include "nsCoreUtils.h" +@@ -45,6 +45,46 @@ static gboolean grabFocusCB(AtkComponent + + return FALSE; + } ++ ++// ScrollType is compatible ++static gboolean ++scrollToCB(AtkComponent* aComponent, AtkScrollType type) ++{ ++ AtkObject* atkObject = ATK_OBJECT(aComponent); ++ AccessibleWrap* accWrap = GetAccessibleWrap(atkObject); ++ if (accWrap) { ++ accWrap->ScrollTo(type); ++ return TRUE; ++ } ++ ++ ProxyAccessible* proxy = GetProxy(atkObject); ++ if (proxy) { ++ proxy->ScrollTo(type); ++ return TRUE; ++ } ++ ++ return FALSE; ++} ++ ++// CoordType is compatible ++static gboolean ++scrollToPointCB(AtkComponent* aComponent, AtkCoordType coords, gint x, gint y) ++{ ++ AtkObject* atkObject = ATK_OBJECT(aComponent); ++ AccessibleWrap* accWrap = GetAccessibleWrap(atkObject); ++ if (accWrap) { ++ accWrap->ScrollToPoint(coords, x, y); ++ return TRUE; ++ } ++ ++ ProxyAccessible* proxy = GetProxy(atkObject); ++ if (proxy) { ++ proxy->ScrollToPoint(coords, x, y); ++ return TRUE; ++ } ++ ++ return FALSE; ++} + } + + AtkObject* +@@ -133,4 +173,8 @@ void componentInterfaceInitCB(AtkCompone + aIface->ref_accessible_at_point = refAccessibleAtPointCB; + aIface->get_extents = getExtentsCB; + aIface->grab_focus = grabFocusCB; ++ if (IsAtkVersionAtLeast(2, 30)) { ++ aIface->scroll_to = scrollToCB; ++ aIface->scroll_to_point = scrollToPointCB; ++ } + } +Index: firefox-esr-60.5.0esr-jessie/mozilla/other-licenses/atk-1.0/atk/atkcomponent.h +=================================================================== +--- firefox-esr-60.5.0esr-jessie.orig/mozilla/other-licenses/atk-1.0/atk/atkcomponent.h ++++ firefox-esr-60.5.0esr-jessie/mozilla/other-licenses/atk-1.0/atk/atkcomponent.h +@@ -27,6 +27,36 @@ + extern "C" { + #endif /* __cplusplus */ + ++/** ++ *AtkScrollType: ++ *@ATK_SCROLL_TOP_LEFT: Scroll the object vertically and horizontally to the top ++ *left corner of the window. ++ *@ATK_SCROLL_BOTTOM_RIGHT: Scroll the object vertically and horizontally to the ++ *bottom right corner of the window. ++ *@ATK_SCROLL_TOP_EDGE: Scroll the object vertically to the top edge of the ++ window. ++ *@ATK_SCROLL_BOTTOM_EDGE: Scroll the object vertically to the bottom edge of ++ *the window. ++ *@ATK_SCROLL_LEFT_EDGE: Scroll the object vertically and horizontally to the ++ *left edge of the window. ++ *@ATK_SCROLL_RIGHT_EDGE: Scroll the object vertically and horizontally to the ++ *right edge of the window. ++ *@ATK_SCROLL_ANYWHERE: Scroll the object vertically and horizontally so that ++ *as much as possible of the object becomes visible. The exact placement is ++ *determined by the application. ++ * ++ * Specifies where an object should be placed on the screen when using scroll_to. ++ **/ ++typedef enum { ++ ATK_SCROLL_TOP_LEFT, ++ ATK_SCROLL_BOTTOM_RIGHT, ++ ATK_SCROLL_TOP_EDGE, ++ ATK_SCROLL_BOTTOM_EDGE, ++ ATK_SCROLL_LEFT_EDGE, ++ ATK_SCROLL_RIGHT_EDGE, ++ ATK_SCROLL_ANYWHERE ++} AtkScrollType; ++ + /* + * The AtkComponent interface should be supported by any object that is + * rendered on the screen. The interface provides the standard mechanism +@@ -115,6 +145,18 @@ struct _AtkComponentIface + void (* bounds_changed) (AtkComponent *component, + AtkRectangle *bounds); + gdouble (* get_alpha) (AtkComponent *component); ++ ++ /* ++ * Scrolls this object so it becomes visible on the screen. ++ * Since ATK 2.30 ++ */ ++ gboolean (*scroll_to) (AtkComponent *component, ++ AtkScrollType type); ++ ++ gboolean (*scroll_to_point) (AtkComponent *component, ++ AtkCoordType coords, ++ gint x, ++ gint y); + }; + + GType atk_component_get_type (void); +@@ -163,6 +205,14 @@ gboolean atk_component_set_ + gint width, + gint height); + gdouble atk_component_get_alpha (AtkComponent *component); ++gboolean atk_component_scroll_to (AtkComponent *component, ++ AtkScrollType type); ++ ++gboolean atk_component_scroll_to_point (AtkComponent *component, ++ AtkCoordType coords, ++ gint x, ++ gint y); ++ + #ifdef __cplusplus + } + #endif /* __cplusplus */ +Index: firefox-esr-60.5.0esr-jessie/mozilla/other-licenses/atk-1.0/atk/atkutil.h +=================================================================== +--- firefox-esr-60.5.0esr-jessie.orig/mozilla/other-licenses/atk-1.0/atk/atkutil.h ++++ firefox-esr-60.5.0esr-jessie/mozilla/other-licenses/atk-1.0/atk/atkutil.h +@@ -153,15 +153,18 @@ GType atk_util_get_type (void); + /** + *AtkCoordType: + *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen +- *@ATK_XY_WINDOW: specifies xy coordinates relative to the widget's ++ *@ATK_XY_WINDOW: specifies xy coordinates relative to the widget's + * top-level window ++ *@ATK_XY_PARENT: specifies xy coordinates relative to the widget's ++ * immediate parent. + * + *Specifies how xy coordinates are to be interpreted. Used by functions such + *as atk_component_get_position() and atk_text_get_character_extents() + **/ + typedef enum { + ATK_XY_SCREEN, +- ATK_XY_WINDOW ++ ATK_XY_WINDOW, ++ ATK_XY_PARENT + }AtkCoordType; + + /* -- GitLab