vcl/inc/salvtables.hxx           |    4 +++-
 vcl/jsdialog/jsdialogbuilder.cxx |    6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 12d0317070bce527e64980aa5596d1a284544fd1
Author:     Szymon Kłos <[email protected]>
AuthorDate: Mon Aug 22 18:27:27 2022 +0200
Commit:     Szymon Kłos <[email protected]>
CommitDate: Wed Aug 31 09:14:31 2022 +0200

    jsdialog: send action not update for spin button value
    
    This will help us to reduce payload and fix bug where
    in Chrome regenerated spin field always focused "arrow
    down" button after click on the "arrow up".
    
    Use value from formatter - the same as generated in
    widget update JSON.
    
    Change-Id: I6ace90eb532e894daacb563bc9fb93332fd755ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138700
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Rashesh Padia <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>

diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 46937c161f24..f93407dae8a9 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -615,10 +615,12 @@ public:
 
 class SalInstanceSpinButton : public SalInstanceEntry, public virtual 
weld::SpinButton
 {
-private:
     VclPtr<FormattedField> m_xButton;
+
+protected:
     Formatter& m_rFormatter;
 
+private:
     DECL_LINK(UpDownHdl, SpinField&, void);
     DECL_LINK(LoseFocusHdl, Control&, void);
     DECL_LINK(OutputHdl, LinkParamNone*, bool);
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 5c62face9769..e28a4e5d9aee 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1370,7 +1370,11 @@ JSSpinButton::JSSpinButton(JSDialogSender* pSender, 
::FormattedField* pSpin,
 void JSSpinButton::set_value(int value)
 {
     SalInstanceSpinButton::set_value(value);
-    sendUpdate(true); // if input is limited we can receive the same JSON
+
+    std::unique_ptr<jsdialog::ActionDataMap> pMap = 
std::make_unique<jsdialog::ActionDataMap>();
+    (*pMap)[ACTION_TYPE] = "setText";
+    (*pMap)["text"] = OUString::number(m_rFormatter.GetValue());
+    sendAction(std::move(pMap));
 }
 
 JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* 
pDialog,

Reply via email to