From 2335b9e49d8d8ad804b8d19aa5974fd3cdff3b49 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 21 Feb 2019 17:13:17 +0100 Subject: [PATCH] Port firefox patches to thunderbird as well --- thunderbird-patches/patches-60/blur | 49 ++++ thunderbird-patches/patches-60/entry-empty | 30 +++ .../patches-60/scrollsubstringto | 244 ++++++++++++++++++ thunderbird-patches/patches-60/scrollto | 173 +++++++++++++ thunderbird-patches/series-60 | 7 + thunderbird-patches/version | 2 +- 6 files changed, 504 insertions(+), 1 deletion(-) create mode 100644 thunderbird-patches/patches-60/blur create mode 100644 thunderbird-patches/patches-60/entry-empty create mode 100644 thunderbird-patches/patches-60/scrollsubstringto create mode 100644 thunderbird-patches/patches-60/scrollto diff --git a/thunderbird-patches/patches-60/blur b/thunderbird-patches/patches-60/blur new file mode 100644 index 0000000..e643250 --- /dev/null +++ b/thunderbird-patches/patches-60/blur @@ -0,0 +1,49 @@ +Fix tab focus when tabbing through an element that refuses focus + +Fix pending commiting + +# HG changeset patch +# User Neil Deakin +# Parent 76376169669fbc390d1cd297d4a3412f15f68461 +Bug 422981, if the focused element is clear after focusing an element, still update the caret position. Additional fix when shift-tabbing from a caret position inside a focusable element to skip over that outer element. + +diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp +--- a/dom/base/nsFocusManager.cpp ++++ b/dom/base/nsFocusManager.cpp +@@ -2019,9 +2019,12 @@ nsFocusManager::Focus(nsPIDOMWindowOuter + // needed. If this is a different document than was focused before, also + // update the caret's visibility. If this is the same document, the caret + // visibility should be the same as before so there is no need to update it. +- if (mFocusedContent == aContent) ++ // As a special case when there is no focused element (implying that the ++ // element was likely blurred during focus), still update the caret position. ++ if (!mFocusedContent || mFocusedContent == aContent) { + UpdateCaret(aFocusChanged && !(aFlags & FLAG_BYMOUSE), aIsNewDocument, +- mFocusedContent); ++ aContent); ++ } + + if (clearFirstFocusEvent) mFirstFocusEvent = nullptr; + } +@@ -2810,6 +2813,21 @@ nsFocusManager::DetermineElementToMoveFo + nsCOMPtr endSelectionContent; + GetSelectionLocation(doc, presShell, getter_AddRefs(startContent), + getter_AddRefs(endSelectionContent)); ++ ++ // If we are going backwards from the caret point, locate an enclosing ++ // focusable element and use that instead. ++ if (startContent && !forward && !forDocumentNavigation) { ++ nsIContent* focusableContent = startContent; ++ while (focusableContent) { ++ if (focusableContent->GetPrimaryFrame() && ++ focusableContent->GetPrimaryFrame()->IsFocusable()) { ++ startContent = focusableContent; ++ break; ++ } ++ focusableContent = focusableContent->GetParent(); ++ } ++ } ++ + // If the selection is on the rootContent, then there is no selection + if (startContent == rootContent) { + startContent = nullptr; diff --git a/thunderbird-patches/patches-60/entry-empty b/thunderbird-patches/patches-60/entry-empty new file mode 100644 index 0000000..9cdfe63 --- /dev/null +++ b/thunderbird-patches/patches-60/entry-empty @@ -0,0 +1,30 @@ +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/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp +--- a/accessible/generic/HyperTextAccessible.cpp ++++ b/accessible/generic/HyperTextAccessible.cpp +@@ -1178,6 +1178,13 @@ 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) return nsIntRect(); + diff --git a/thunderbird-patches/patches-60/scrollsubstringto b/thunderbird-patches/patches-60/scrollsubstringto new file mode 100644 index 0000000..0e7d01b --- /dev/null +++ b/thunderbird-patches/patches-60/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/accessible/atk/nsMaiInterfaceText.cpp b/accessible/atk/nsMaiInterfaceText.cpp +--- a/accessible/atk/nsMaiInterfaceText.cpp ++++ b/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; + + aIface->get_text = getTextCB; + aIface->get_text_after_offset = getTextAfterOffsetCB; +@@ -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/other-licenses/atk-1.0/atk/atktext.h b/other-licenses/atk-1.0/atk/atktext.h +--- a/other-licenses/atk-1.0/atk/atktext.h ++++ b/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-60/scrollto b/thunderbird-patches/patches-60/scrollto new file mode 100644 index 0000000..3fa52d4 --- /dev/null +++ b/thunderbird-patches/patches-60/scrollto @@ -0,0 +1,173 @@ +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/accessible/atk/nsMaiInterfaceComponent.cpp +=================================================================== +--- firefox-esr-60.5.0esr-jessie.orig/accessible/atk/nsMaiInterfaceComponent.cpp ++++ firefox-esr-60.5.0esr-jessie/accessible/atk/nsMaiInterfaceComponent.cpp +@@ -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* refAccessibleAtPointHelper(AtkObject* aAtkObj, gint aX, gint aY, +@@ -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/other-licenses/atk-1.0/atk/atkcomponent.h +=================================================================== +--- firefox-esr-60.5.0esr-jessie.orig/other-licenses/atk-1.0/atk/atkcomponent.h ++++ firefox-esr-60.5.0esr-jessie/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/other-licenses/atk-1.0/atk/atkutil.h +=================================================================== +--- firefox-esr-60.5.0esr-jessie.orig/other-licenses/atk-1.0/atk/atkutil.h ++++ firefox-esr-60.5.0esr-jessie/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; + + /* diff --git a/thunderbird-patches/series-60 b/thunderbird-patches/series-60 index f54d72f..535f72c 100644 --- a/thunderbird-patches/series-60 +++ b/thunderbird-patches/series-60 @@ -1 +1,8 @@ +entry-empty +#twisties déjà appliqué +blur +#setcaret +scrollto +scrollsubstringto +#jumpedline control-enter diff --git a/thunderbird-patches/version b/thunderbird-patches/version index 0cfbf08..00750ed 100644 --- a/thunderbird-patches/version +++ b/thunderbird-patches/version @@ -1 +1 @@ -2 +3 -- GitLab