widget/nsBaseWidget.cpp
author Matt Woodrow <mwoodrow@mozilla.com>
Sun, 05 Sep 2021 22:36:45 +0000 (2021-09-05)
changeset 591057 1b49e7328ae43c6565d167f4c391430575097fd3
parent 591041 7a2a62de9bdbe94c206e05de785d47e0e3558de2
child 591931 33918b139eff008a9cb99b0b4fece919e5e556c8
permissions -rw-r--r--
Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D124433
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
341823
50dd0b8e139f152b7c3a7d68b70f139319035fd8 Bug 1317774 - Add non-gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322481
diff changeset
     1
273069
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
     2
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
     3
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
94475
Gervase Markham <gerv@gerv.net>
parents: 94077
diff changeset
     4
/* This Source Code Form is subject to the terms of the Mozilla Public
Gervase Markham <gerv@gerv.net>
parents: 94077
diff changeset
     5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
Gervase Markham <gerv@gerv.net>
parents: 94077
diff changeset
     6
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
     7
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
     8
#include "nsBaseWidget.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
     9
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    10
#include <utility>
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    11
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    12
#include "GLConsts.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    13
#include "InputData.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    14
#include "LiveResizeListener.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    15
#include "TouchEvents.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    16
#include "WritingModes.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    17
#include "X11UndefineNone.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    18
#include "base/thread.h"
159472
e0776db3b102510504fdcf57b7f65dfa1da3b46d Bug 713082 - Part 2: Rename Util.h to ArrayUtils.h. r=Waldo
Birunthan Mohanathas <birunthan@mohanathas.com>
parents: 158291
diff changeset
    19
#include "mozilla/ArrayUtils.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    20
#include "mozilla/Attributes.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    21
#include "mozilla/GlobalKeyListener.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    22
#include "mozilla/IMEStateManager.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    23
#include "mozilla/MouseEvents.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    24
#include "mozilla/Preferences.h"
469371
c1a9e74c1b4b3e8c0383cd5dfe1b6a3eff4e7ca2 Bug 1542506 - Make nsDocShell use mozilla::PresShell* directly rather than nsIPresShell* r=bzbarsky
Masayuki Nakano <masayuki@d-toybox.com>
parents: 465755
diff changeset
    25
#include "mozilla/PresShell.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    26
#include "mozilla/Sprintf.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    27
#include "mozilla/StaticPrefs_apz.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    28
#include "mozilla/StaticPrefs_dom.h"
568647
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
    29
#include "mozilla/StaticPrefs_gfx.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    30
#include "mozilla/StaticPrefs_layers.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    31
#include "mozilla/StaticPrefs_layout.h"
226207
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
    32
#include "mozilla/TextEventDispatcher.h"
288895
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
    33
#include "mozilla/TextEventDispatcherListener.h"
469371
c1a9e74c1b4b3e8c0383cd5dfe1b6a3eff4e7ca2 Bug 1542506 - Make nsDocShell use mozilla::PresShell* directly rather than nsIPresShell* r=bzbarsky
Masayuki Nakano <masayuki@d-toybox.com>
parents: 465755
diff changeset
    34
#include "mozilla/UniquePtr.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    35
#include "mozilla/Unused.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    36
#include "mozilla/VsyncDispatcher.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    37
#include "mozilla/dom/BrowserParent.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    38
#include "mozilla/dom/ContentChild.h"
452446
f0a91d36587266d7454a450c6044d573664fbed5 Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 449380
diff changeset
    39
#include "mozilla/dom/Document.h"
137807
9f542b4bfbfa80855d91bfb3db64168bf5c5bb67 Bug 882523 - Support OMTC on Mac in non-accelerated mode using OpenGL. r=nrc, r=mattwoodrow
Markus Stange <mstange@themasta.com>
parents: 137350
diff changeset
    40
#include "mozilla/gfx/2D.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    41
#include "mozilla/gfx/GPUProcessManager.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    42
#include "mozilla/gfx/gfxVars.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    43
#include "mozilla/layers/APZCCallbackHelper.h"
228806
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228801
diff changeset
    44
#include "mozilla/layers/APZEventState.h"
408580
c85a2550e02c680fad269f32098998d6df701b14 Bug 1441324 - Extract an APZInputBridge interface from IAPZCTreeManager. r=rhunt
Kartikaya Gupta <kgupta@mozilla.com>
parents: 408509
diff changeset
    45
#include "mozilla/layers/APZInputBridge.h"
228436
5a35ca7c0adce48b6e04e4002f6e4c8542855f24 Bug 930939 - Switch the B2G controller thread from the main thread to the compositor thread. r=botond,mwu
Kartikaya Gupta <kgupta@mozilla.com>
parents: 228378
diff changeset
    46
#include "mozilla/layers/APZThreadUtils.h"
219724
71b13c6e679a7436dfd3cd3ab6411f9358388f33 Create a common chrome-process GeckoContentController. (bug 1110540 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 219723
diff changeset
    47
#include "mozilla/layers/ChromeProcessController.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    48
#include "mozilla/layers/Compositor.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    49
#include "mozilla/layers/CompositorBridgeChild.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    50
#include "mozilla/layers/CompositorBridgeParent.h"
329203
3d27c7cbcafa48642e0368319c563c4e32895242 Bug 1330037 - Introduce a CompositorOptions struct that holds options on a per-compositor basis. r=dvander
Kartikaya Gupta <kgupta@mozilla.com>
parents: 329067
diff changeset
    51
#include "mozilla/layers/CompositorOptions.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    52
#include "mozilla/layers/IAPZCTreeManager.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    53
#include "mozilla/layers/ImageBridgeChild.h"
220508
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
    54
#include "mozilla/layers/InputAPZContext.h"
341823
50dd0b8e139f152b7c3a7d68b70f139319035fd8 Bug 1317774 - Add non-gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 322481
diff changeset
    55
#include "mozilla/layers/WebRenderLayerManager.h"
377666
919487ecd16f41a7e2251130d24e0dc2d959b4ae Bug 1394338 - Add WebRender error handling to RendererOGL r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 376996
diff changeset
    56
#include "mozilla/webrender/WebRenderTypes.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    57
#include "nsAppDirectoryServiceDefs.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    58
#include "nsCOMPtr.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    59
#include "nsContentUtils.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    60
#include "nsDeviceContext.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    61
#include "nsGfxCIID.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    62
#include "nsIAppWindow.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    63
#include "nsIBaseWindow.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    64
#include "nsIContent.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    65
#include "nsIScreenManager.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    66
#include "nsISimpleEnumerator.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    67
#include "nsIWidgetListener.h"
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
    68
#include "nsRefPtrHashtable.h"
510810
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    69
#include "nsServiceManagerUtils.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    70
#include "nsWidgetsCID.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    71
#include "nsXULPopupManager.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    72
#include "prdtoa.h"
81ae47660566a29c5395432886e4fd9a403eac97 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 510807
diff changeset
    73
#include "prenv.h"
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
    74
#ifdef ACCESSIBILITY
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
    75
#  include "nsAccessibilityService.h"
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
    76
#endif
295413
4dbe9e240867d9073d3e9a4529e15ed036f93852 Introduce gfxConfig, a manager for graphics feature settings. (bug 1254899 part 3, r=milan)
David Anderson <danderson@mozilla.com>
parents: 295370
diff changeset
    77
#include "gfxConfig.h"
517547
86eabc56f96399becabb7b87a5ad68250fe5af94 Bug 1618345 - Enforce proper color management by splitting gfx::Color into sRGBColor and DeviceColor types. r=jrmuizel
Andrew Osmond <aosmond@mozilla.com>
parents: 516446
diff changeset
    78
#include "gfxUtils.h"  // for ToDeviceColor
297876
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
    79
#include "mozilla/layers/CompositorSession.h"
309340
7b1349cb7487ce1b03a6f91c016315f9e8fdd0ec Bug 1250244 - Part 7: Implement WebVR 1.0 API,r=bz
Kearwood (Kip) Gilbert <kgilbert@mozilla.com>
parents: 308872
diff changeset
    80
#include "VRManagerChild.h"
366042
63d3975c2fad45fd35bf6e568ca2c17c2d00bc2b Add MLGPU feature bits and compositor initialization. (bug 1365879 part 21, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 365767
diff changeset
    81
#include "gfxConfig.h"
442586
33523dc590feb2d339e4722fdfe1222d341bead4 Bug 1493081 - Added nsIWidget::GetDesktopToDeviceScaleByScreen for scale factor lookup by window position; r=mattwoodrow
Jan Horak <jhorak@redhat.com>
parents: 438870
diff changeset
    82
#include "nsView.h"
33523dc590feb2d339e4722fdfe1222d341bead4 Bug 1493081 - Added nsIWidget::GetDesktopToDeviceScaleByScreen for scale factor lookup by window position; r=mattwoodrow
Jan Horak <jhorak@redhat.com>
parents: 438870
diff changeset
    83
#include "nsViewManager.h"
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
    84
33016
8013abd85baac8810ba5527b9255cd9cfe4ca933 Bug 513817 Switch scrolling to 6 lines in the default case for 3.6 on windows r=roc, ui=faaborg
Masayuki Nakano <masayuki@d-toybox.com>
parents: 32297
diff changeset
    85
#ifdef DEBUG
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
    86
#  include "nsIObserver.h"
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    87
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    88
static void debug_RegisterPrefCallbacks();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    89
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    90
#endif
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    91
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    92
#ifdef NOISY_WIDGET_LEAKS
102997
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 102656
diff changeset
    93
static int32_t gNumWidgets;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    94
#endif
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    95
161295
e0b09e6438060ec5facd2106cf866ea276e7afa6 Bug 676907 - Refactor (replace) calls to Gestalt because it is deprecated in OS X 10.8 and will not work in after 10.9. r=BenWa
Isura Edirisinghe <isurae@gmail.com>
parents: 160524
diff changeset
    96
#ifdef XP_MACOSX
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
    97
#  include "nsCocoaFeatures.h"
161295
e0b09e6438060ec5facd2106cf866ea276e7afa6 Bug 676907 - Refactor (replace) calls to Gestalt because it is deprecated in OS X 10.8 and will not work in after 10.9. r=BenWa
Isura Edirisinghe <isurae@gmail.com>
parents: 160524
diff changeset
    98
#endif
e0b09e6438060ec5facd2106cf866ea276e7afa6 Bug 676907 - Refactor (replace) calls to Gestalt because it is deprecated in OS X 10.8 and will not work in after 10.9. r=BenWa
Isura Edirisinghe <isurae@gmail.com>
parents: 160524
diff changeset
    99
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
   100
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
   101
static nsRefPtrHashtable<nsVoidPtrHashKey, nsIWidget>* sPluginWidgetList;
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
   102
#endif
245729
3dd4d2de214a96874c9927f1afd1ea708d930c6b Bug 1119980 - Use 'snprintf' instead of 'sprintf' to avoid a warning on Lollipop-based builds. r=froydnj
Botond Ballo <botond@mozilla.com>
parents: 245572
diff changeset
   103
111530
6a9691cfc118dc485a8df23c46738c55a4708401 Bug 701760, merge <select> and popup manager rollup handling, so that select elements don't cancel out any popup rollup listeners, r=mats
Neil Deakin <neil@mozilla.com>
parents: 110604
diff changeset
   104
nsIRollupListener* nsBaseWidget::gRollupListener = nullptr;
6a9691cfc118dc485a8df23c46738c55a4708401 Bug 701760, merge <select> and popup manager rollup handling, so that select elements don't cancel out any popup rollup listeners, r=mats
Neil Deakin <neil@mozilla.com>
parents: 110604
diff changeset
   105
276185
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
   106
using namespace mozilla::dom;
38805
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
   107
using namespace mozilla::layers;
149123
9cc90a4b64758375a2d77f0679fc547f21902f46 Combine AsyncChannel, SyncChannel, and RPCChannel into one class (bug 901789, r=cjones,bent).
David Anderson <danderson@mozilla.com>
parents: 148650
diff changeset
   108
using namespace mozilla::ipc;
226213
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
   109
using namespace mozilla::widget;
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
   110
using namespace mozilla;
38805
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
   111
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
   112
// Async pump timer during injected long touch taps
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
   113
#define TOUCH_INJECT_PUMP_TIMER_MSEC 50
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
   114
#define TOUCH_INJECT_LONG_TAP_DEFAULT_MSEC 1500
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
   115
int32_t nsIWidget::sPointerIdCounter = 0;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
   116
239022
371a7026a1dfe35089c8f91014b2eab3a20a18c3 Bug 1146349 - Wire up native event synthesization in child processes. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 239018
diff changeset
   117
// Some statics from nsIWidget.h
461907
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
   118
/*static*/
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
   119
uint64_t AutoObserverNotifier::sObserverId = 0;
570247
8936c72646ff682e6af2bc58050281687e74c41a Bug 1634281 - Use nsTHashMap for nsBaseHashtable/nsDataHashtable uses with nsCOMPtr data type. r=xpcom-reviewers,nika
Simon Giesecke <sgiesecke@mozilla.com>
parents: 569213
diff changeset
   120
/*static*/ nsTHashMap<uint64_t, nsCOMPtr<nsIObserver>>
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   121
    AutoObserverNotifier::sSavedObservers;
239022
371a7026a1dfe35089c8f91014b2eab3a20a18c3 Bug 1146349 - Wire up native event synthesization in child processes. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 239018
diff changeset
   122
379503
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 377945
diff changeset
   123
// The maximum amount of time to let the EnableDragDrop runnable wait in the
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 377945
diff changeset
   124
// idle queue before timing out and moving it to the regular queue. Value is in
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 377945
diff changeset
   125
// milliseconds.
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 377945
diff changeset
   126
const uint32_t kAsyncDragDropTimeout = 1000;
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 377945
diff changeset
   127
510655
Sylvestre Ledru <sledru@mozilla.com>
parents: 510654
diff changeset
   128
namespace mozilla::widget {
244012
7097594f13d4ed7bda8479fc97934019c771ad92 Bug 1130935 part.6 Selection change notification should have selection range and writing mode information r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 243453
diff changeset
   129
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   130
void IMENotification::SelectionChangeDataBase::SetWritingMode(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   131
    const WritingMode& aWritingMode) {
492176
623d63b7f9e0be34f67223f63770318464e23aa0 Bug 1578147 - Align the Rust and C++ representations of WritingMode. r=emilio,jfkthame
Cameron McCormack <cam@mcc.id.au>
parents: 492043
diff changeset
   132
  mWritingMode = aWritingMode.mWritingMode.bits;
244012
7097594f13d4ed7bda8479fc97934019c771ad92 Bug 1130935 part.6 Selection change notification should have selection range and writing mode information r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 243453
diff changeset
   133
}
7097594f13d4ed7bda8479fc97934019c771ad92 Bug 1130935 part.6 Selection change notification should have selection range and writing mode information r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 243453
diff changeset
   134
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   135
WritingMode IMENotification::SelectionChangeDataBase::GetWritingMode() const {
244012
7097594f13d4ed7bda8479fc97934019c771ad92 Bug 1130935 part.6 Selection change notification should have selection range and writing mode information r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 243453
diff changeset
   136
  return WritingMode(mWritingMode);
7097594f13d4ed7bda8479fc97934019c771ad92 Bug 1130935 part.6 Selection change notification should have selection range and writing mode information r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 243453
diff changeset
   137
}
7097594f13d4ed7bda8479fc97934019c771ad92 Bug 1130935 part.6 Selection change notification should have selection range and writing mode information r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 243453
diff changeset
   138
510655
Sylvestre Ledru <sledru@mozilla.com>
parents: 510654
diff changeset
   139
}  // namespace mozilla::widget
244012
7097594f13d4ed7bda8479fc97934019c771ad92 Bug 1130935 part.6 Selection change notification should have selection range and writing mode information r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 243453
diff changeset
   140
229677
71d030563b18097639ea2bcef8f4242ffa5864af Add weak reference support to nsBaseWidget. (bug 1133150, r=roc)
David Anderson <danderson@mozilla.com>
parents: 228807
diff changeset
   141
NS_IMPL_ISUPPORTS(nsBaseWidget, nsIWidget, nsISupportsWeakReference)
71d030563b18097639ea2bcef8f4242ffa5864af Add weak reference support to nsBaseWidget. (bug 1133150, r=roc)
David Anderson <danderson@mozilla.com>
parents: 228807
diff changeset
   142
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   143
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   144
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   145
// nsBaseWidget constructor
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   146
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   147
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   148
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   149
nsBaseWidget::nsBaseWidget()
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   150
    : mWidgetListener(nullptr),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   151
      mAttachedWidgetListener(nullptr),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   152
      mPreviouslyAttachedWidgetListener(nullptr),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   153
      mCompositorVsyncDispatcher(nullptr),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   154
      mBorderStyle(eBorderStyle_none),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   155
      mBounds(0, 0, 0, 0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   156
      mOriginalBounds(nullptr),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   157
      mClipRectCount(0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   158
      mSizeMode(nsSizeMode_Normal),
493554
3258db2cb365a1cb73748c36ee023edc8848d0f1 Bug 1550721 - Fix GTK title bar for tiled windows. r=stransky,dao
Marius Gedminas <marius@gedmin.as>
parents: 493453
diff changeset
   159
      mIsTiled(false),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   160
      mPopupLevel(ePopupLevelTop),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   161
      mPopupType(ePopupTypeAny),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   162
      mHasRemoteContent(false),
503596
2d0db7ddd092eed08468bfa23e6774cbee1ae21b Bug 1588484 - Disable Advanced Layers for now when using fission for the window. r=kmag
Matt Woodrow <mwoodrow@mozilla.com>
parents: 503594
diff changeset
   163
      mFissionWindow(false),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   164
      mUpdateCursor(true),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   165
      mUseAttachedEvents(false),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   166
      mIMEHasFocus(false),
479076
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   167
      mIMEHasQuit(false),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   168
      mIsFullyOccluded(false) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   169
#ifdef NOISY_WIDGET_LEAKS
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   170
  gNumWidgets++;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   171
  printf("WIDGETS+ = %d\n", gNumWidgets);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   172
#endif
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   173
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   174
#ifdef DEBUG
94601
b2673bce4ba17b3a73adb7078579f76f95beabb9 Bug 722012 - Added a call to XInitThreads before the first call to XOpenDisplay to fix OMTC crashes. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94475
diff changeset
   175
  debug_RegisterPrefCallbacks();
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   176
#endif
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   177
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
   178
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
   179
  if (!sPluginWidgetList) {
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
   180
    sPluginWidgetList = new nsRefPtrHashtable<nsVoidPtrHashKey, nsIWidget>();
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
   181
  }
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
   182
#endif
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   183
  mShutdownObserver = new WidgetShutdownObserver(this);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   184
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   185
180485
6c1c7e45c90289a0875b74f82f39e7ecf6a65af3 Bug 900908 - Part 3: Change uses of numbered macros in nsIClassInfoImpl.h/nsISupportsImpl.h to the variadic variants. r=froydnj
Birunthan Mohanathas <birunthan@mohanathas.com>
parents: 177924
diff changeset
   186
NS_IMPL_ISUPPORTS(WidgetShutdownObserver, nsIObserver)
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   187
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   188
WidgetShutdownObserver::WidgetShutdownObserver(nsBaseWidget* aWidget)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   189
    : mWidget(aWidget), mRegistered(false) {
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   190
  Register();
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   191
}
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   192
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   193
WidgetShutdownObserver::~WidgetShutdownObserver() {
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   194
  // No need to call Unregister(), we can't be destroyed until nsBaseWidget
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   195
  // gets torn down. The observer service and nsBaseWidget have a ref on us
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   196
  // so nsBaseWidget has to call Unregister and then clear its ref.
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   197
}
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   198
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   199
NS_IMETHODIMP
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   200
WidgetShutdownObserver::Observe(nsISupports* aSubject, const char* aTopic,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   201
                                const char16_t* aData) {
479076
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   202
  if (!mWidget) {
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   203
    return NS_OK;
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   204
  }
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   205
  if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
313042
b4d1a0890f4048ded5479b157b75f05138a34ade Bug 1018486 - Part 3: Changes in widget/cocoa/, r=mstange
Michael Layzell <michael@thelayzells.com>
parents: 311808
diff changeset
   206
    RefPtr<nsBaseWidget> widget(mWidget);
b4d1a0890f4048ded5479b157b75f05138a34ade Bug 1018486 - Part 3: Changes in widget/cocoa/, r=mstange
Michael Layzell <michael@thelayzells.com>
parents: 311808
diff changeset
   207
    widget->Shutdown();
479076
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   208
  } else if (!strcmp(aTopic, "quit-application")) {
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   209
    RefPtr<nsBaseWidget> widget(mWidget);
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   210
    widget->QuitIME();
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   211
  }
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   212
  return NS_OK;
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   213
}
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   214
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   215
void WidgetShutdownObserver::Register() {
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   216
  if (!mRegistered) {
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   217
    mRegistered = true;
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   218
    nsContentUtils::RegisterShutdownObserver(this);
479076
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   219
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   220
#ifndef MOZ_WIDGET_ANDROID
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   221
    // The primary purpose of observing quit-application is
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   222
    // to avoid leaking a widget on Windows when nothing else
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   223
    // breaks the circular reference between the widget and
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   224
    // TSFTextStore. However, our Android IME code crashes if
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   225
    // doing this on Android, so let's not do this on Android.
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   226
    // Doing this on Gtk and Mac just in case.
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   227
    nsCOMPtr<nsIObserverService> observerService =
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   228
        mozilla::services::GetObserverService();
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   229
    if (observerService) {
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   230
      observerService->AddObserver(this, "quit-application", false);
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   231
    }
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   232
#endif
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   233
  }
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   234
}
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   235
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   236
void WidgetShutdownObserver::Unregister() {
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   237
  if (mRegistered) {
240166
a81b76a677aff7273c0556eac273cf7e6b28a4cc Bug 1156283 - Avoid shutdown observer race when shutting down gfx on Mac. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239673
diff changeset
   238
    mWidget = nullptr;
479076
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   239
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   240
#ifndef MOZ_WIDGET_ANDROID
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   241
    nsCOMPtr<nsIObserverService> observerService =
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   242
        mozilla::services::GetObserverService();
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   243
    if (observerService) {
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   244
      observerService->RemoveObserver(this, "quit-application");
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   245
    }
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   246
#endif
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   247
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   248
    nsContentUtils::UnregisterShutdownObserver(this);
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   249
    mRegistered = false;
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   250
  }
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   251
}
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   252
583969
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   253
#define INTL_APP_LOCALES_CHANGED "intl:app-locales-changed"
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   254
#define L10N_PSEUDO_PREF "intl.l10n.pseudo"
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   255
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   256
static const char* kObservedPrefs[] = {L10N_PSEUDO_PREF, nullptr};
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   257
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   258
NS_IMPL_ISUPPORTS(LocalesChangedObserver, nsIObserver)
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   259
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   260
LocalesChangedObserver::LocalesChangedObserver(nsBaseWidget* aWidget)
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   261
    : mWidget(aWidget), mRegistered(false) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   262
  Register();
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   263
}
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   264
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   265
LocalesChangedObserver::~LocalesChangedObserver() {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   266
  // No need to call Unregister(), we can't be destroyed until nsBaseWidget
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   267
  // gets torn down. The observer service and nsBaseWidget have a ref on us
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   268
  // so nsBaseWidget has to call Unregister and then clear its ref.
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   269
}
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   270
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   271
NS_IMETHODIMP
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   272
LocalesChangedObserver::Observe(nsISupports* aSubject, const char* aTopic,
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   273
                                const char16_t* aData) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   274
  if (!mWidget) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   275
    return NS_OK;
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   276
  }
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   277
  if (!strcmp(aTopic, INTL_APP_LOCALES_CHANGED)) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   278
    RefPtr<nsBaseWidget> widget(mWidget);
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   279
    widget->LocalesChanged();
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   280
  } else {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   281
    MOZ_ASSERT(!strcmp("nsPref:changed", aTopic));
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   282
    nsDependentString pref(aData);
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   283
    if (pref.EqualsLiteral(L10N_PSEUDO_PREF)) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   284
      RefPtr<nsBaseWidget> widget(mWidget);
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   285
      widget->LocalesChanged();
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   286
    }
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   287
  }
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   288
  return NS_OK;
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   289
}
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   290
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   291
void LocalesChangedObserver::Register() {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   292
  if (mRegistered) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   293
    return;
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   294
  }
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   295
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   296
  DebugOnly<nsresult> rv =
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   297
      Preferences::AddStrongObservers(this, kObservedPrefs);
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   298
  MOZ_ASSERT(NS_SUCCEEDED(rv), "Adding observers failed.");
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   299
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   300
  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   301
  if (obs) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   302
    obs->AddObserver(this, INTL_APP_LOCALES_CHANGED, true);
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   303
  }
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   304
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   305
  // Locale might be update before registering
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   306
  RefPtr<nsBaseWidget> widget(mWidget);
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   307
  widget->LocalesChanged();
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   308
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   309
  mRegistered = true;
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   310
}
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   311
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   312
void LocalesChangedObserver::Unregister() {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   313
  if (!mRegistered) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   314
    return;
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   315
  }
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   316
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   317
  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   318
  if (obs) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   319
    obs->RemoveObserver(this, INTL_APP_LOCALES_CHANGED);
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   320
  }
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   321
  Preferences::RemoveObservers(this, kObservedPrefs);
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   322
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   323
  mWidget = nullptr;
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   324
  mRegistered = false;
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   325
}
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   326
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   327
void nsBaseWidget::Shutdown() {
332017
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
   328
  NotifyLiveResizeStopped();
323746
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 322481
diff changeset
   329
  RevokeTransactionIdAllocator();
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   330
  DestroyCompositor();
583969
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   331
  FreeLocalesChangedObserver();
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   332
  FreeShutdownObserver();
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   333
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   334
  if (sPluginWidgetList) {
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   335
    delete sPluginWidgetList;
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   336
    sPluginWidgetList = nullptr;
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   337
  }
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   338
#endif
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
   339
}
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   340
479076
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   341
void nsBaseWidget::QuitIME() {
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   342
  IMEStateManager::WidgetOnQuit(this);
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   343
  this->mIMEHasQuit = true;
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   344
}
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
   345
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   346
void nsBaseWidget::DestroyCompositor() {
316041
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   347
  // We release this before releasing the compositor, since it may hold the
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   348
  // last reference to our ClientLayerManager. ClientLayerManager's dtor can
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   349
  // trigger a paint, creating a new compositor, and we don't want to re-use
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   350
  // the old vsync dispatcher.
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   351
  if (mCompositorVsyncDispatcher) {
407017
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
   352
    MOZ_ASSERT(mCompositorVsyncDispatcherLock.get());
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
   353
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
   354
    MutexAutoLock lock(*mCompositorVsyncDispatcherLock.get());
316041
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   355
    mCompositorVsyncDispatcher->Shutdown();
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   356
    mCompositorVsyncDispatcher = nullptr;
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   357
  }
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 315838
diff changeset
   358
303040
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   359
  // The compositor shutdown sequence looks like this:
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   360
  //  1. CompositorSession calls CompositorBridgeChild::Destroy.
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   361
  //  2. CompositorBridgeChild synchronously sends WillClose.
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   362
  //  3. CompositorBridgeParent releases some resources (such as the layer
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   363
  //     manager, compositor, and widget).
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   364
  //  4. CompositorBridgeChild::Destroy returns.
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   365
  //  5. Asynchronously, CompositorBridgeParent::ActorDestroy will fire on the
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   366
  //     compositor thread when the I/O thread closes the IPC channel.
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   367
  //  6. Step 5 will schedule DeferredDestroy on the compositor thread, which
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   368
  //     releases the reference CompositorBridgeParent holds to itself.
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   369
  //
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   370
  // When CompositorSession::Shutdown returns, we assume the compositor is gone
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   371
  // or will be gone very soon.
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   372
  if (mCompositorSession) {
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   373
    ReleaseContentController();
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   374
    mAPZC = nullptr;
372798
db5a86cfd703c9bd245fd3bb26f2163c4b91b6ab Bug 1373739 - Make headless compositing Windows-compatible, in addition to Linux. r=dvander
Michael Smith <michael@spinda.net>
parents: 372036
diff changeset
   375
    SetCompositorWidgetDelegate(nullptr);
303040
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   376
    mCompositorBridgeChild = nullptr;
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   377
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   378
    // XXX CompositorBridgeChild and CompositorBridgeParent might be re-created
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   379
    // in ClientLayerManager destructor. See bug 1133426.
513762
49adcf9a70abc9df4f11a123d181aa7213a20615 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Simon Giesecke <sgiesecke@mozilla.com>
parents: 513586
diff changeset
   380
    RefPtr<CompositorSession> session = std::move(mCompositorSession);
303040
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   381
    session->Shutdown();
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   382
  }
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   383
}
94715
328f316179bd128156703ce66cf743f3b3721d62 Bug 722012 - Fixes crash on Gtk widget destruction when using OMTC on linux. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94632
diff changeset
   384
323746
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 322481
diff changeset
   385
// This prevents the layer manager from starting a new transaction during
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 322481
diff changeset
   386
// shutdown.
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   387
void nsBaseWidget::RevokeTransactionIdAllocator() {
591041
7a2a62de9bdbe94c206e05de785d47e0e3558de2 Bug 1728914 - Remove widget code references to AsLayerManager and access WebRender directly. r=gfx-reviewers,aosmond,jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 589971
diff changeset
   388
  if (!mWindowRenderer || !mWindowRenderer->AsWebRender()) {
323746
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 322481
diff changeset
   389
    return;
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 322481
diff changeset
   390
  }
591041
7a2a62de9bdbe94c206e05de785d47e0e3558de2 Bug 1728914 - Remove widget code references to AsLayerManager and access WebRender directly. r=gfx-reviewers,aosmond,jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 589971
diff changeset
   391
  mWindowRenderer->AsWebRender()->SetTransactionIdAllocator(nullptr);
323746
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 322481
diff changeset
   392
}
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 322481
diff changeset
   393
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   394
void nsBaseWidget::ReleaseContentController() {
303040
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   395
  if (mRootContentController) {
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   396
    mRootContentController->Destroy();
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   397
    mRootContentController = nullptr;
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   398
  }
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   399
}
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
   400
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   401
void nsBaseWidget::DestroyLayerManager() {
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
   402
  if (mWindowRenderer) {
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
   403
    mWindowRenderer->Destroy();
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
   404
    mWindowRenderer = nullptr;
94715
328f316179bd128156703ce66cf743f3b3721d62 Bug 722012 - Fixes crash on Gtk widget destruction when using OMTC on linux. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94632
diff changeset
   405
  }
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   406
  DestroyCompositor();
94715
328f316179bd128156703ce66cf743f3b3721d62 Bug 722012 - Fixes crash on Gtk widget destruction when using OMTC on linux. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94632
diff changeset
   407
}
90746
db7260efc9a774c4da1dc4e9df64125049666452 Bug 737437 - Post a task to handle compositor destruction. r=bgirard
Ali Juma <ajuma@mozilla.com>
parents: 90629
diff changeset
   408
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   409
void nsBaseWidget::OnRenderingDeviceReset() { DestroyLayerManager(); }
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   410
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   411
void nsBaseWidget::FreeShutdownObserver() {
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   412
  if (mShutdownObserver) {
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   413
    mShutdownObserver->Unregister();
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   414
  }
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   415
  mShutdownObserver = nullptr;
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   416
}
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   417
583969
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   418
void nsBaseWidget::FreeLocalesChangedObserver() {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   419
  if (mLocalesChangedObserver) {
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   420
    mLocalesChangedObserver->Unregister();
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   421
  }
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   422
  mLocalesChangedObserver = nullptr;
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   423
}
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   424
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   425
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   426
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   427
// nsBaseWidget destructor
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   428
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   429
//-------------------------------------------------------------------------
277570
a65ccabdef2edc82a80980ce00258c5e603f7121 Bug 1234210 - Restrict updates for accessibility.lastLoadDate to shutdown. r=trevor
Jim Mathies <jmathies@mozilla.com>
parents: 276209
diff changeset
   430
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   431
nsBaseWidget::~nsBaseWidget() {
272729
50657cb9988a3618b7db979b9f00e40a3c790a17 Bug 1222092. Don't let sFocusedIMEWidget keep an nsIWidget alive during shutdown. r=masayuki
Robert O'Callahan <robert@ocallahan.org>
parents: 272466
diff changeset
   432
  IMEStateManager::WidgetDestroyed(this);
50657cb9988a3618b7db979b9f00e40a3c790a17 Bug 1222092. Don't let sFocusedIMEWidget keep an nsIWidget alive during shutdown. r=masayuki
Robert O'Callahan <robert@ocallahan.org>
parents: 272466
diff changeset
   433
583969
064d1e04ff9f5ddac8fe0889f84106489e15ce13 Bug 1717182 - Make nsWindows::mIsRTL dynamic on Windows r=jrmuizel,gfx-reviewers
sotaro <sotaro.ikeda.g@gmail.com>
parents: 578903
diff changeset
   434
  FreeLocalesChangedObserver();
239650
c24fb4429029af2e88cd7db3a144802a113ccf0b Bug 1153939 - Avoid a race condition with setting nsBaseWidgets WidgetShutdownObserver widget pointer to null. Fixes a crash in nsBaseWidget::DestroyCompositor(). r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 239489
diff changeset
   435
  FreeShutdownObserver();
323746
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 322481
diff changeset
   436
  RevokeTransactionIdAllocator();
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
   437
  DestroyLayerManager();
58810
8e216406592f9228288fea5e78eb11b2319f093b Bug 595277 - Part 0: Clear out user data on destroy. r=roc
Bas Schouten <bschouten@mozilla.com>
parents: 58753
diff changeset
   438
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   439
#ifdef NOISY_WIDGET_LEAKS
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   440
  gNumWidgets--;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   441
  printf("WIDGETS- = %d\n", gNumWidgets);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   442
#endif
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   443
69660
c8d5469bed72c3141ef8fcbb149151bf8eeab5f1 Bug 316661 - Part A - Remove null-checks before delete. r=bsmedberg
Ed Morley <bmo@edmorley.co.uk>
parents: 69338
diff changeset
   444
  delete mOriginalBounds;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   445
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   446
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   447
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   448
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   449
// Basic create.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   450
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   451
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   452
void nsBaseWidget::BaseCreate(nsIWidget* aParent, nsWidgetInitData* aInitData) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   453
  // keep a reference to the device context
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
   454
  if (nullptr != aInitData) {
33357
f3c07913015f8a79464adb52186e4188374b720a Bug 509693. Remove eWindowType_java (unused) and actually use eWindowType_plugin. r=josh
Robert O'Callahan <robert@ocallahan.org>
parents: 33016
diff changeset
   455
    mWindowType = aInitData->mWindowType;
f3c07913015f8a79464adb52186e4188374b720a Bug 509693. Remove eWindowType_java (unused) and actually use eWindowType_plugin. r=josh
Robert O'Callahan <robert@ocallahan.org>
parents: 33016
diff changeset
   456
    mBorderStyle = aInitData->mBorderStyle;
48254
d8057f320d56b15669dc7ce5d4109e8c48cc09f0 Bug 552982, Part 3: support panel levels, r=mats
Neil Deakin <neil@mozilla.com>
parents: 47857
diff changeset
   457
    mPopupLevel = aInitData->mPopupLevel;
97343
e5fb5ad11849e6e52dd5bfa65f2958312ec2a5da Bug 758048 - Move PopupType from the Windows widget implementation to the cross platform base class and use it to determine when to accelerate windows. r=bbondy
Nicolas Silva <nsilva@mozilla.com>
parents: 97024
diff changeset
   458
    mPopupType = aInitData->mPopupHint;
359232
cfe30fc6158c4dcb6c9fe2bc9bff35674ed9b247 Bug 1365660: Part 2 - Add a HasRemoteContent flag to popup widgets that contain remote browsers. r=kats,bas
Kris Maglione <maglione.k@gmail.com>
parents: 358625
diff changeset
   459
    mHasRemoteContent = aInitData->mHasRemoteContent;
503596
2d0db7ddd092eed08468bfa23e6774cbee1ae21b Bug 1588484 - Disable Advanced Layers for now when using fission for the window. r=kmag
Matt Woodrow <mwoodrow@mozilla.com>
parents: 503594
diff changeset
   460
    mFissionWindow = aInitData->mFissionWindow;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   461
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   462
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   463
  if (aParent) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   464
    aParent->AddChild(this);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   465
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   466
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   467
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   468
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   469
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   470
// Accessor functions to get/set the client data
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   471
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   472
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   473
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   474
nsIWidgetListener* nsBaseWidget::GetWidgetListener() { return mWidgetListener; }
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   475
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   476
void nsBaseWidget::SetWidgetListener(nsIWidgetListener* aWidgetListener) {
102463
448410c2035ef7bce315bb6b3c46f60fb909145e Bug 743975 - use a widget listener interface instead of the remaining events that don't need an event, r=tn,jmathies,netzen,smichaud,karlt,blassey,chrisjones
Neil Deakin <neil@mozilla.com>
parents: 102462
diff changeset
   477
  mWidgetListener = aWidgetListener;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   478
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   479
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   480
already_AddRefed<nsIWidget> nsBaseWidget::CreateChild(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   481
    const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   482
    bool aForceUseIWidgetParent) {
51049
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   483
  nsIWidget* parent = this;
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
   484
  nsNativeWidget nativeParent = nullptr;
51049
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   485
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   486
  if (!aForceUseIWidgetParent) {
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   487
    // Use only either parent or nativeParent, not both, to match
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   488
    // existing code.  Eventually Create() should be divested of its
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   489
    // nativeWidget parameter.
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
   490
    nativeParent = parent ? parent->GetNativeData(NS_NATIVE_WIDGET) : nullptr;
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
   491
    parent = nativeParent ? nullptr : parent;
228378
20729b28eb1e1d7f0d9e9e6e2c61e7050f09884f Bug 1127201 (attempt 2, part 1) - Replace most NS_ABORT_IF_FALSE calls with MOZ_ASSERT. r=Waldo.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 227943
diff changeset
   492
    MOZ_ASSERT(!parent || !nativeParent, "messed up logic");
51049
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   493
  }
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   494
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   495
  nsCOMPtr<nsIWidget> widget;
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   496
  if (aInitData && aInitData->mWindowType == eWindowType_popup) {
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   497
    widget = AllocateChildPopupWidget();
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   498
  } else {
432687
c9a06dacc095cc7c9968eef179b36174d57c0260 Bug 1484848 - Remove the XPCOM component registrations for window and child window; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 432037
diff changeset
   499
    widget = nsIWidget::CreateChildWindow();
51049
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   500
  }
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   501
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   502
  if (widget &&
227809
28b5570caf8603291c518d04cd14e7bf92e64130 Bug 1129774. Part 5: Remove aContext parameter from nsIWidget::Create. r=jmathies
Robert O'Callahan <robert@ocallahan.org>
parents: 227808
diff changeset
   503
      NS_SUCCEEDED(widget->Create(parent, nativeParent, aRect, aInitData))) {
51049
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   504
    return widget.forget();
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   505
  }
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   506
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
   507
  return nullptr;
51049
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   508
}
2757103c7e890d4c7dc921c4f42343be9e31d4d3 Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 51040
diff changeset
   509
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
   510
// Attach a view to our widget which we'll send events to.
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   511
void nsBaseWidget::AttachViewToTopLevel(bool aUseAttachedEvents) {
52189
c45881749e3f804baa76c0b6bcaba418f6f41d99 Bug 593440 - Remove remaining child widgets on windows. r=roc, a=joe.
Jim Mathies <jmathies@mozilla.com>
parents: 51978
diff changeset
   512
  NS_ASSERTION((mWindowType == eWindowType_toplevel ||
c45881749e3f804baa76c0b6bcaba418f6f41d99 Bug 593440 - Remove remaining child widgets on windows. r=roc, a=joe.
Jim Mathies <jmathies@mozilla.com>
parents: 51978
diff changeset
   513
                mWindowType == eWindowType_dialog ||
62248
e71960b6957c068088d74ee3cd0f5e16a38f6eb3 Bug 610670 - Reuse a single puppet widget. r=bz,cjones a=blocking-fennec
Alon Zakai <azakai@mozilla.com>
parents: 61876
diff changeset
   514
                mWindowType == eWindowType_invisible ||
e71960b6957c068088d74ee3cd0f5e16a38f6eb3 Bug 610670 - Reuse a single puppet widget. r=bz,cjones a=blocking-fennec
Alon Zakai <azakai@mozilla.com>
parents: 61876
diff changeset
   515
                mWindowType == eWindowType_child),
e71960b6957c068088d74ee3cd0f5e16a38f6eb3 Bug 610670 - Reuse a single puppet widget. r=bz,cjones a=blocking-fennec
Alon Zakai <azakai@mozilla.com>
parents: 61876
diff changeset
   516
               "Can't attach to window of that type");
46192
30ecff316b34836ee80542f3fc732a10d185e497 Bug 513162 - Widget additions for recycling top level widgets as content containers. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 42226
diff changeset
   517
102466
e66c290ab9fcbb37b809fc5273ef54b0cbd14339 Bug 743975 - remove the event handler argument to widget creation methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102465
diff changeset
   518
  mUseAttachedEvents = aUseAttachedEvents;
46192
30ecff316b34836ee80542f3fc732a10d185e497 Bug 513162 - Widget additions for recycling top level widgets as content containers. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 42226
diff changeset
   519
}
30ecff316b34836ee80542f3fc732a10d185e497 Bug 513162 - Widget additions for recycling top level widgets as content containers. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 42226
diff changeset
   520
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   521
nsIWidgetListener* nsBaseWidget::GetAttachedWidgetListener() {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   522
  return mAttachedWidgetListener;
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   523
}
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   524
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   525
nsIWidgetListener* nsBaseWidget::GetPreviouslyAttachedWidgetListener() {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   526
  return mPreviouslyAttachedWidgetListener;
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   527
}
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   528
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   529
void nsBaseWidget::SetPreviouslyAttachedWidgetListener(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   530
    nsIWidgetListener* aListener) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   531
  mPreviouslyAttachedWidgetListener = aListener;
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   532
}
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   533
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   534
void nsBaseWidget::SetAttachedWidgetListener(nsIWidgetListener* aListener) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   535
  mAttachedWidgetListener = aListener;
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   536
}
46192
30ecff316b34836ee80542f3fc732a10d185e497 Bug 513162 - Widget additions for recycling top level widgets as content containers. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 42226
diff changeset
   537
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   538
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   539
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   540
// Close this nsBaseWidget
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   541
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   542
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   543
void nsBaseWidget::Destroy() {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   544
  // Just in case our parent is the only ref to us
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   545
  nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   546
  // disconnect from the parent
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   547
  nsIWidget* parent = GetParent();
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   548
  if (parent) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   549
    parent->RemoveChild(this);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   550
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   551
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
   552
#if defined(XP_WIN)
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
   553
  // Allow our scroll capture container to be cleaned up, if we have one.
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
   554
  mScrollCaptureContainer = nullptr;
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
   555
#endif
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   556
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   557
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   558
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   559
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   560
// Get this nsBaseWidget parent
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   561
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   562
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   563
nsIWidget* nsBaseWidget::GetParent(void) { return nullptr; }
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   564
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   565
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   566
//
19295
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   567
// Get this nsBaseWidget top level widget
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   568
//
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   569
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   570
nsIWidget* nsBaseWidget::GetTopLevelWidget() {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
   571
  nsIWidget *topLevelWidget = nullptr, *widget = this;
19295
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   572
  while (widget) {
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   573
    topLevelWidget = widget;
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   574
    widget = widget->GetParent();
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   575
  }
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   576
  return topLevelWidget;
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   577
}
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   578
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   579
//-------------------------------------------------------------------------
519540dd78807df8cf7d17906b5a4eccfa4888ba Bug 439354 - OS X toolbar background doesn't have a good gradient, part 1 / 3, r=hwaara sr=roc
Markus Stange <mstange@themasta.com>
parents: 18470
diff changeset
   580
//
14886
045b42a1da5616bfb3aaf54c8c9af065aebc5cde Bug 406730. Track window activation status and set an 'active' attribute on the XUL root so we can style window contents based on activation status. Also provide active+inactive colors to Cocoa chrome drawing and use them based on 'main' state. Patch by Markus Strange, r=josh,sr=roc,a=mconnor
roc+@cs.cmu.edu
parents: 9857
diff changeset
   581
// Get this nsBaseWidget's top (non-sheet) parent (if it's a sheet)
045b42a1da5616bfb3aaf54c8c9af065aebc5cde Bug 406730. Track window activation status and set an 'active' attribute on the XUL root so we can style window contents based on activation status. Also provide active+inactive colors to Cocoa chrome drawing and use them based on 'main' state. Patch by Markus Strange, r=josh,sr=roc,a=mconnor
roc+@cs.cmu.edu
parents: 9857
diff changeset
   582
//
045b42a1da5616bfb3aaf54c8c9af065aebc5cde Bug 406730. Track window activation status and set an 'active' attribute on the XUL root so we can style window contents based on activation status. Also provide active+inactive colors to Cocoa chrome drawing and use them based on 'main' state. Patch by Markus Strange, r=josh,sr=roc,a=mconnor
roc+@cs.cmu.edu
parents: 9857
diff changeset
   583
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   584
nsIWidget* nsBaseWidget::GetSheetWindowParent(void) { return nullptr; }
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   585
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   586
float nsBaseWidget::GetDPI() { return 96.0f; }
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   587
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   588
CSSToLayoutDeviceScale nsIWidget::GetDefaultScale() {
489971
0b5a8bc0d337dd503ae88fb58f6a5099f62e77ef Bug 1573992 - Convert layout.css.devPixelsPerPx to static pref. r=njn
kriswright <kwright@mozilla.com>
parents: 487080
diff changeset
   589
  double devPixelsPerCSSPixel = StaticPrefs::layout_css_devPixelsPerPx();
128136
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126962
diff changeset
   590
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126962
diff changeset
   591
  if (devPixelsPerCSSPixel <= 0.0) {
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126962
diff changeset
   592
    devPixelsPerCSSPixel = GetDefaultScaleInternal();
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126962
diff changeset
   593
  }
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126962
diff changeset
   594
147664
948b5997476a2b0e6c4a0c5a7e29550c1e8dd8a5 Bug 912166 - Make nsIWidget::GetDefaultScale return a typed scale value. r=roc
Mina Almasry <mina@mozilla.com>
parents: 145203
diff changeset
   595
  return CSSToLayoutDeviceScale(devPixelsPerCSSPixel);
128136
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126962
diff changeset
   596
}
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126962
diff changeset
   597
576741
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   598
nsIntSize nsIWidget::CustomCursorSize(const Cursor& aCursor) {
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   599
  MOZ_ASSERT(aCursor.IsCustom());
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   600
  int32_t width = 0;
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   601
  int32_t height = 0;
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   602
  aCursor.mContainer->GetWidth(&width);
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   603
  aCursor.mContainer->GetHeight(&height);
578564
4f74cdfb4fdc403cd75aeafddce3cb400f9c70ec Bug 1680387 - Apply intrinsic image resolution as appropriate in layout/style/dom, and update test expectations. r=tnikkel
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 578425
diff changeset
   604
  aCursor.mResolution.ApplyTo(width, height);
576741
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   605
  return {width, height};
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   606
}
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   607
14886
045b42a1da5616bfb3aaf54c8c9af065aebc5cde Bug 406730. Track window activation status and set an 'active' attribute on the XUL root so we can style window contents based on activation status. Also provide active+inactive colors to Cocoa chrome drawing and use them based on 'main' state. Patch by Markus Strange, r=josh,sr=roc,a=mconnor
roc+@cs.cmu.edu
parents: 9857
diff changeset
   608
//-------------------------------------------------------------------------
045b42a1da5616bfb3aaf54c8c9af065aebc5cde Bug 406730. Track window activation status and set an 'active' attribute on the XUL root so we can style window contents based on activation status. Also provide active+inactive colors to Cocoa chrome drawing and use them based on 'main' state. Patch by Markus Strange, r=josh,sr=roc,a=mconnor
roc+@cs.cmu.edu
parents: 9857
diff changeset
   609
//
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   610
// Add a child to the list of children
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   611
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   612
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   613
void nsBaseWidget::AddChild(nsIWidget* aChild) {
316898
b5c1c15e0a74879178f610a6e663271a52ed2adc Bug 1295596 - Remove release asserts from nsBaseWidget::AddChild associated with existing sibling checks. r=bsmedberg
Jim Mathies <jmathies@mozilla.com>
parents: 316820
diff changeset
   614
  MOZ_ASSERT(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
b5c1c15e0a74879178f610a6e663271a52ed2adc Bug 1295596 - Remove release asserts from nsBaseWidget::AddChild associated with existing sibling checks. r=bsmedberg
Jim Mathies <jmathies@mozilla.com>
parents: 316820
diff changeset
   615
             "aChild not properly removed from its old child list");
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
   616
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   617
  if (!mFirstChild) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   618
    mFirstChild = mLastChild = aChild;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   619
  } else {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   620
    // append to the list
316898
b5c1c15e0a74879178f610a6e663271a52ed2adc Bug 1295596 - Remove release asserts from nsBaseWidget::AddChild associated with existing sibling checks. r=bsmedberg
Jim Mathies <jmathies@mozilla.com>
parents: 316820
diff changeset
   621
    MOZ_ASSERT(mLastChild);
b5c1c15e0a74879178f610a6e663271a52ed2adc Bug 1295596 - Remove release asserts from nsBaseWidget::AddChild associated with existing sibling checks. r=bsmedberg
Jim Mathies <jmathies@mozilla.com>
parents: 316820
diff changeset
   622
    MOZ_ASSERT(!mLastChild->GetNextSibling());
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   623
    mLastChild->SetNextSibling(aChild);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   624
    aChild->SetPrevSibling(mLastChild);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   625
    mLastChild = aChild;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   626
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   627
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   628
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   629
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   630
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   631
// Remove a child from the list of children
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   632
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   633
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   634
void nsBaseWidget::RemoveChild(nsIWidget* aChild) {
137949
53104f8608a2d2bb8a31294bde0c91e7a4610711 Bug 891424. Directly remove nsCocoaWindow's from their parent in Destroy(). This allows us to stop implementing GetParent because the mac widget code has some assumptions about that always returning null. r=smichaud
Timothy Nikkel <tnikkel@gmail.com>
parents: 137807
diff changeset
   635
#ifdef DEBUG
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
   636
#  ifdef XP_MACOSX
137949
53104f8608a2d2bb8a31294bde0c91e7a4610711 Bug 891424. Directly remove nsCocoaWindow's from their parent in Destroy(). This allows us to stop implementing GetParent because the mac widget code has some assumptions about that always returning null. r=smichaud
Timothy Nikkel <tnikkel@gmail.com>
parents: 137807
diff changeset
   637
  // nsCocoaWindow doesn't implement GetParent, so in that case parent will be
53104f8608a2d2bb8a31294bde0c91e7a4610711 Bug 891424. Directly remove nsCocoaWindow's from their parent in Destroy(). This allows us to stop implementing GetParent because the mac widget code has some assumptions about that always returning null. r=smichaud
Timothy Nikkel <tnikkel@gmail.com>
parents: 137807
diff changeset
   638
  // null and we'll just have to do without this assertion.
53104f8608a2d2bb8a31294bde0c91e7a4610711 Bug 891424. Directly remove nsCocoaWindow's from their parent in Destroy(). This allows us to stop implementing GetParent because the mac widget code has some assumptions about that always returning null. r=smichaud
Timothy Nikkel <tnikkel@gmail.com>
parents: 137807
diff changeset
   639
  nsIWidget* parent = aChild->GetParent();
53104f8608a2d2bb8a31294bde0c91e7a4610711 Bug 891424. Directly remove nsCocoaWindow's from their parent in Destroy(). This allows us to stop implementing GetParent because the mac widget code has some assumptions about that always returning null. r=smichaud
Timothy Nikkel <tnikkel@gmail.com>
parents: 137807
diff changeset
   640
  NS_ASSERTION(!parent || parent == this, "Not one of our kids!");
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
   641
#  else
291042
da683f5c0a43b8ee64b604406d784667b474f6d1 Bug 1174461 - [e10s] Return a cached result from SendGetNativePluginPort (r=jimm) a=kwierso
Bill McCloskey <billm@mozilla.com>
parents: 291035
diff changeset
   642
  MOZ_RELEASE_ASSERT(aChild->GetParent() == this, "Not one of our kids!");
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
   643
#  endif
137949
53104f8608a2d2bb8a31294bde0c91e7a4610711 Bug 891424. Directly remove nsCocoaWindow's from their parent in Destroy(). This allows us to stop implementing GetParent because the mac widget code has some assumptions about that always returning null. r=smichaud
Timothy Nikkel <tnikkel@gmail.com>
parents: 137807
diff changeset
   644
#endif
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
   645
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   646
  if (mLastChild == aChild) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   647
    mLastChild = mLastChild->GetPrevSibling();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   648
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   649
  if (mFirstChild == aChild) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   650
    mFirstChild = mFirstChild->GetNextSibling();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   651
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   652
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   653
  // Now remove from the list.  Make sure that we pass ownership of the tail
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   654
  // of the list correctly before we have aChild let go of it.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   655
  nsIWidget* prev = aChild->GetPrevSibling();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   656
  nsIWidget* next = aChild->GetNextSibling();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   657
  if (prev) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   658
    prev->SetNextSibling(next);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   659
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   660
  if (next) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   661
    next->SetPrevSibling(prev);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   662
  }
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
   663
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
   664
  aChild->SetNextSibling(nullptr);
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
   665
  aChild->SetPrevSibling(nullptr);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   666
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   667
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   668
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   669
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   670
// Sets widget's position within its parent's child list.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   671
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   672
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   673
void nsBaseWidget::SetZIndex(int32_t aZIndex) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   674
  // Hold a ref to ourselves just in case, since we're going to remove
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   675
  // from our parent.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   676
  nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
   677
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   678
  mZIndex = aZIndex;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   679
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   680
  // reorder this child in its parent's list.
324883
9c229cf88ec224739f127082c1e8ec4c322bcd6f Bug 1317973 - Use auto type specifier for variable declarations to improve code readability and maintainability r=tnikkel
Sylvestre Ledru <sledru@mozilla.com>
parents: 323746
diff changeset
   681
  auto* parent = static_cast<nsBaseWidget*>(GetParent());
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   682
  if (parent) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   683
    parent->RemoveChild(this);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   684
    // Scope sib outside the for loop so we can check it afterward
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   685
    nsIWidget* sib = parent->GetFirstChild();
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   686
    for (; sib; sib = sib->GetNextSibling()) {
174336
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   687
      int32_t childZIndex = GetZIndex();
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   688
      if (aZIndex < childZIndex) {
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   689
        // Insert ourselves before sib
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   690
        nsIWidget* prev = sib->GetPrevSibling();
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   691
        mNextSibling = sib;
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   692
        mPrevSibling = prev;
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   693
        sib->SetPrevSibling(this);
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   694
        if (prev) {
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   695
          prev->SetNextSibling(this);
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   696
        } else {
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   697
          NS_ASSERTION(sib == parent->mFirstChild, "Broken child list");
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   698
          // We've taken ownership of sib, so it's safe to have parent let
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   699
          // go of it
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   700
          parent->mFirstChild = this;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   701
        }
174336
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   702
        PlaceBehind(eZPlacementBelow, sib, false);
cdf2a738bcc0088cf4581bc6856f5ac0876246b7 Bug 982734, make nsIWidget::GetWindowType and nsIWidget::GetZIndex return their values, remove some unused colour-related widget methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 173774
diff changeset
   703
        break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   704
      }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   705
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   706
    // were we added to the list?
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   707
    if (!sib) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   708
      parent->AddChild(this);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   709
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   710
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   711
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   712
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   713
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   714
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   715
// Maximize, minimize or restore the window. The BaseWidget implementation
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   716
// merely stores the state.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   717
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   718
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   719
void nsBaseWidget::SetSizeMode(nsSizeMode aMode) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   720
  MOZ_ASSERT(aMode == nsSizeMode_Normal || aMode == nsSizeMode_Minimized ||
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   721
             aMode == nsSizeMode_Maximized || aMode == nsSizeMode_Fullscreen);
259955
b8d3872064c7f369787c5097db9956ca99a5253c Bug 1196163 part 1 - Use nsSizeMode instead of int32_t for nsIWidget::{SizeMode,SetSizeMode}. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 259944
diff changeset
   722
  mSizeMode = aMode;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   723
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   724
522916
bd936bfc3a0f4c7ba2008de16d91aaba7626d1d9 Bug 890125 - Part 1 - Change Window widget base classes to return and use strings for workspace IDs, rather than integers. r=nika
Mike de Boer <mdeboer@mozilla.com>
parents: 522489
diff changeset
   725
void nsBaseWidget::GetWorkspaceID(nsAString& workspaceID) {
bd936bfc3a0f4c7ba2008de16d91aaba7626d1d9 Bug 890125 - Part 1 - Change Window widget base classes to return and use strings for workspace IDs, rather than integers. r=nika
Mike de Boer <mdeboer@mozilla.com>
parents: 522489
diff changeset
   726
  workspaceID.Truncate();
bd936bfc3a0f4c7ba2008de16d91aaba7626d1d9 Bug 890125 - Part 1 - Change Window widget base classes to return and use strings for workspace IDs, rather than integers. r=nika
Mike de Boer <mdeboer@mozilla.com>
parents: 522489
diff changeset
   727
}
bd936bfc3a0f4c7ba2008de16d91aaba7626d1d9 Bug 890125 - Part 1 - Change Window widget base classes to return and use strings for workspace IDs, rather than integers. r=nika
Mike de Boer <mdeboer@mozilla.com>
parents: 522489
diff changeset
   728
bd936bfc3a0f4c7ba2008de16d91aaba7626d1d9 Bug 890125 - Part 1 - Change Window widget base classes to return and use strings for workspace IDs, rather than integers. r=nika
Mike de Boer <mdeboer@mozilla.com>
parents: 522489
diff changeset
   729
void nsBaseWidget::MoveToWorkspace(const nsAString& workspaceID) {
516446
c3270629341670f948584dc15f68d64006ea737f Bug 440895 - Add support for Mac OSX spaces in session restore, which allows any window to be restored to their respective (work)space. r=mconley,mstange,nika
Mike de Boer <mdeboer@mozilla.com>
parents: 515950
diff changeset
   730
  // Noop.
c3270629341670f948584dc15f68d64006ea737f Bug 440895 - Add support for Mac OSX spaces in session restore, which allows any window to be restored to their respective (work)space. r=mconley,mstange,nika
Mike de Boer <mdeboer@mozilla.com>
parents: 515950
diff changeset
   731
}
c3270629341670f948584dc15f68d64006ea737f Bug 440895 - Add support for Mac OSX spaces in session restore, which allows any window to be restored to their respective (work)space. r=mconley,mstange,nika
Mike de Boer <mdeboer@mozilla.com>
parents: 515950
diff changeset
   732
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   733
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   734
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   735
// Get this component cursor
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   736
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   737
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   738
576741
9141b021cbeda90952fe2fffd11b0b7383ac696e Bug 1705877 - Introduce nsIWidget::Cursor. r=dholbert
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575979
diff changeset
   739
void nsBaseWidget::SetCursor(const Cursor& aCursor) { mCursor = aCursor; }
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
   740
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   741
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   742
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   743
// Window transparency methods
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   744
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   745
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   746
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   747
void nsBaseWidget::SetTransparencyMode(nsTransparencyMode aMode) {}
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   748
16601
460fce61ebc7230eecaa9719e83f12102d472373 Implement Aero Glass effect support - bug 418454 r=vlad r=roc
Rob Arnold <robarnold@mozilla.com>
parents: 16520
diff changeset
   749
nsTransparencyMode nsBaseWidget::GetTransparencyMode() {
460fce61ebc7230eecaa9719e83f12102d472373 Implement Aero Glass effect support - bug 418454 r=vlad r=roc
Rob Arnold <robarnold@mozilla.com>
parents: 16520
diff changeset
   750
  return eTransparencyOpaque;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   751
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   752
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   753
bool nsBaseWidget::IsWindowClipRegionEqual(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   754
    const nsTArray<LayoutDeviceIntRect>& aRects) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   755
  return mClipRects && mClipRectCount == aRects.Length() &&
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   756
         memcmp(mClipRects.get(), aRects.Elements(),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   757
                sizeof(LayoutDeviceIntRect) * mClipRectCount) == 0;
226463
c49c54cfb1d3b9974e88c3f5337f3ab2140533db Bug 1126164 - Avoid setting clip regions on plugin windows if the same clip region was already set. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 226225
diff changeset
   758
}
c49c54cfb1d3b9974e88c3f5337f3ab2140533db Bug 1126164 - Avoid setting clip regions on plugin windows if the same clip region was already set. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 226225
diff changeset
   759
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   760
void nsBaseWidget::StoreWindowClipRegion(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   761
    const nsTArray<LayoutDeviceIntRect>& aRects) {
30515
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   762
  mClipRectCount = aRects.Length();
275567
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275419
diff changeset
   763
  mClipRects = MakeUnique<LayoutDeviceIntRect[]>(mClipRectCount);
30515
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   764
  if (mClipRects) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   765
    memcpy(mClipRects.get(), aRects.Elements(),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   766
           sizeof(LayoutDeviceIntRect) * mClipRectCount);
30515
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   767
  }
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   768
}
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   769
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   770
void nsBaseWidget::GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects) {
30515
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   771
  if (mClipRects) {
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   772
    aRects->AppendElements(mClipRects.get(), mClipRectCount);
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   773
  } else {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   774
    aRects->AppendElement(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   775
        LayoutDeviceIntRect(0, 0, mBounds.Width(), mBounds.Height()));
30515
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   776
  }
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   777
}
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   778
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   779
const LayoutDeviceIntRegion nsBaseWidget::RegionFromArray(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   780
    const nsTArray<LayoutDeviceIntRect>& aRects) {
275567
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275419
diff changeset
   781
  LayoutDeviceIntRegion region;
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   782
  for (uint32_t i = 0; i < aRects.Length(); ++i) {
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   783
    region.Or(region, aRects[i]);
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   784
  }
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   785
  return region;
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   786
}
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   787
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   788
void nsBaseWidget::ArrayFromRegion(const LayoutDeviceIntRegion& aRegion,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   789
                                   nsTArray<LayoutDeviceIntRect>& aRects) {
281985
3b02ba9cfc4f686b6d485c729c31c02e2477b611 Bug 1239864 (part 10) - Use the new rect iterators in view/ and widget/. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 281869
diff changeset
   790
  for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) {
3b02ba9cfc4f686b6d485c729c31c02e2477b611 Bug 1239864 (part 10) - Use the new rect iterators in view/ and widget/. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 281869
diff changeset
   791
    aRects.AppendElement(iter.Get());
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   792
  }
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   793
}
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   794
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   795
nsresult nsBaseWidget::SetWindowClipRegion(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   796
    const nsTArray<LayoutDeviceIntRect>& aRects, bool aIntersectWithExisting) {
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   797
  if (!aIntersectWithExisting) {
226463
c49c54cfb1d3b9974e88c3f5337f3ab2140533db Bug 1126164 - Avoid setting clip regions on plugin windows if the same clip region was already set. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 226225
diff changeset
   798
    StoreWindowClipRegion(aRects);
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   799
  } else {
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   800
    // get current rects
275567
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275419
diff changeset
   801
    nsTArray<LayoutDeviceIntRect> currentRects;
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   802
    GetWindowClipRegion(&currentRects);
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   803
    // create region from them
275567
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275419
diff changeset
   804
    LayoutDeviceIntRegion currentRegion = RegionFromArray(currentRects);
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   805
    // create region from new rects
275567
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275419
diff changeset
   806
    LayoutDeviceIntRegion newRegion = RegionFromArray(aRects);
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   807
    // intersect regions
275567
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275419
diff changeset
   808
    LayoutDeviceIntRegion intersection;
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   809
    intersection.And(currentRegion, newRegion);
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   810
    // create int rect array from intersection
275567
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275419
diff changeset
   811
    nsTArray<LayoutDeviceIntRect> rects;
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   812
    ArrayFromRegion(intersection, rects);
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   813
    // store
226463
c49c54cfb1d3b9974e88c3f5337f3ab2140533db Bug 1126164 - Avoid setting clip regions on plugin windows if the same clip region was already set. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 226225
diff changeset
   814
    StoreWindowClipRegion(rects);
215360
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   815
  }
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   816
  return NS_OK;
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   817
}
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 212000
diff changeset
   818
461907
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
   819
/* virtual */
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
   820
void nsBaseWidget::PerformFullscreenTransition(FullscreenTransitionStage aStage,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
   821
                                               uint16_t aDuration,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
   822
                                               nsISupports* aData,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
   823
                                               nsIRunnable* aCallback) {
252604
5e2d116989a55b3db96e88864ea1fc89fd56a235 Bug 1160014 part 1 - Implement common part of fullscreen transition. r=roc,smaug,dao
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252477
diff changeset
   824
  MOZ_ASSERT_UNREACHABLE(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   825
      "Should never call PerformFullscreenTransition on nsBaseWidget");
252604
5e2d116989a55b3db96e88864ea1fc89fd56a235 Bug 1160014 part 1 - Implement common part of fullscreen transition. r=roc,smaug,dao
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252477
diff changeset
   826
}
5e2d116989a55b3db96e88864ea1fc89fd56a235 Bug 1160014 part 1 - Implement common part of fullscreen transition. r=roc,smaug,dao
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252477
diff changeset
   827
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   828
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   829
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   830
// Put the window into full-screen mode
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   831
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   832
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   833
void nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   834
                                            nsIScreen* aScreen) {
30004
Doug Turner <dougt@meer.net>
parents: 29975
diff changeset
   835
  HideWindowChrome(aFullScreen);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   836
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   837
  if (aFullScreen) {
272750
25836f531c30e3119d41d69b71e8c4daccb85f85 Bug 1224482 (part 7) - Make GetScaledScreenBounds() return a CSSIntRect. r=kats.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 272746
diff changeset
   838
    if (!mOriginalBounds) {
279792
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279790
diff changeset
   839
      mOriginalBounds = new LayoutDeviceIntRect();
272750
25836f531c30e3119d41d69b71e8c4daccb85f85 Bug 1224482 (part 7) - Make GetScaledScreenBounds() return a CSSIntRect. r=kats.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 272746
diff changeset
   840
    }
310240
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310239
diff changeset
   841
    *mOriginalBounds = GetScreenBounds();
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   842
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   843
    // Move to top-left corner of screen and size to the screen dimensions
444310
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   844
    nsCOMPtr<nsIScreen> screen = aScreen;
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   845
    if (!screen) {
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   846
      screen = GetWidgetScreen();
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   847
    }
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   848
    if (screen) {
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   849
      int32_t left, top, width, height;
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   850
      if (NS_SUCCEEDED(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   851
              screen->GetRectDisplayPix(&left, &top, &width, &height))) {
444310
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   852
        Resize(left, top, width, height, true);
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   853
      }
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   854
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   855
  } else if (mOriginalBounds) {
279792
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279790
diff changeset
   856
    if (BoundsUseDesktopPixels()) {
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279790
diff changeset
   857
      DesktopRect deskRect = *mOriginalBounds / GetDesktopToDeviceScale();
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   858
      Resize(deskRect.X(), deskRect.Y(), deskRect.Width(), deskRect.Height(),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   859
             true);
279792
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279790
diff changeset
   860
    } else {
444310
97db91af91fde137e9d56189e3edcd9c5a8aee27 Backed out changeset 64fa36b13e1a (bug 1473816)
Xidorn Quan <me@upsuper.org>
parents: 444295
diff changeset
   861
      Resize(mOriginalBounds->X(), mOriginalBounds->Y(),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   862
             mOriginalBounds->Width(), mOriginalBounds->Height(), true);
279792
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279790
diff changeset
   863
    }
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   864
  }
310243
581e898152d059ed2c2f9ba38c36f14291328e83 Bug 1293596 (part 5) - Tweak nsIWidget::MakeFullScreen{,WithNativeTransition}(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310241
diff changeset
   865
}
581e898152d059ed2c2f9ba38c36f14291328e83 Bug 1293596 (part 5) - Tweak nsIWidget::MakeFullScreen{,WithNativeTransition}(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310241
diff changeset
   866
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   867
nsresult nsBaseWidget::MakeFullScreen(bool aFullScreen, nsIScreen* aScreen) {
310243
581e898152d059ed2c2f9ba38c36f14291328e83 Bug 1293596 (part 5) - Tweak nsIWidget::MakeFullScreen{,WithNativeTransition}(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310241
diff changeset
   868
  InfallibleMakeFullScreen(aFullScreen, aScreen);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   869
  return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   870
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   871
38805
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
   872
nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup(
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
   873
    nsBaseWidget* aWidget, gfxContext* aTarget, BufferMode aDoubleBuffering)
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   874
    : mWidget(aWidget) {
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
   875
  WindowRenderer* renderer = mWidget->GetWindowRenderer();
587870
e505fffd43c3663a2ed608907ed17830cc526ec9 Bug 1722258 - Add FallbackRenderer to replace BasicLayerManager usage. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587869
diff changeset
   876
  if (renderer->AsFallback()) {
e505fffd43c3663a2ed608907ed17830cc526ec9 Bug 1722258 - Add FallbackRenderer to replace BasicLayerManager usage. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587869
diff changeset
   877
    mRenderer = renderer->AsFallback();
e505fffd43c3663a2ed608907ed17830cc526ec9 Bug 1722258 - Add FallbackRenderer to replace BasicLayerManager usage. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587869
diff changeset
   878
    mRenderer->SetTarget(aTarget, aDoubleBuffering);
38805
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
   879
  }
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
   880
}
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
   881
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   882
nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup() {
587870
e505fffd43c3663a2ed608907ed17830cc526ec9 Bug 1722258 - Add FallbackRenderer to replace BasicLayerManager usage. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587869
diff changeset
   883
  if (mRenderer) {
e505fffd43c3663a2ed608907ed17830cc526ec9 Bug 1722258 - Add FallbackRenderer to replace BasicLayerManager usage. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587869
diff changeset
   884
    mRenderer->SetTarget(nullptr, mozilla::layers::BufferMode::BUFFER_NONE);
e505fffd43c3663a2ed608907ed17830cc526ec9 Bug 1722258 - Add FallbackRenderer to replace BasicLayerManager usage. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587869
diff changeset
   885
  }
38805
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
   886
}
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
   887
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   888
bool nsBaseWidget::IsSmallPopup() const {
302074
e9723c6c6136e2311374e5e6d4ea9cdc9f42b6b3 Bug 1264365 - Disable hardware acceleration for small popup widgets. r=dvander
Nicolas Silva <nsilva@mozilla.com>
parents: 301531
diff changeset
   889
  return mWindowType == eWindowType_popup && mPopupType != ePopupTypePanel;
e9723c6c6136e2311374e5e6d4ea9cdc9f42b6b3 Bug 1264365 - Disable hardware acceleration for small popup widgets. r=dvander
Nicolas Silva <nsilva@mozilla.com>
parents: 301531
diff changeset
   890
}
e9723c6c6136e2311374e5e6d4ea9cdc9f42b6b3 Bug 1264365 - Disable hardware acceleration for small popup widgets. r=dvander
Nicolas Silva <nsilva@mozilla.com>
parents: 301531
diff changeset
   891
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   892
bool nsBaseWidget::ComputeShouldAccelerate() {
316942
72c643ed82ba38231f730a5995579e3606f43e9a Bug 1299860 - Don't use the compositor backend of a popup with ImageBridge and VRManager. r=Bas
Nicolas Silva <nsilva@mozilla.com>
parents: 316898
diff changeset
   893
  return gfx::gfxConfig::IsEnabled(gfx::Feature::HW_COMPOSITING) &&
72c643ed82ba38231f730a5995579e3606f43e9a Bug 1299860 - Don't use the compositor backend of a popup with ImageBridge and VRManager. r=Bas
Nicolas Silva <nsilva@mozilla.com>
parents: 316898
diff changeset
   894
         WidgetTypeSupportsAcceleration();
53686
350f09a18800bd0e01fffdbe03b5e081b4f96145 b=594553; correctly create gl layer manager on android; r=jrmuizel
Vladimir Vukicevic <vladimir@pobox.com>
parents: 52189
diff changeset
   895
}
350f09a18800bd0e01fffdbe03b5e081b4f96145 b=594553; correctly create gl layer manager on android; r=jrmuizel
Vladimir Vukicevic <vladimir@pobox.com>
parents: 52189
diff changeset
   896
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   897
bool nsBaseWidget::UseAPZ() {
295584
b45b6eca1e7b239197945e0966674979731834ba Use CompositorWidgetProxy in place of nsIWidget in CompositorBridgeParent. (bug 1264545 part 5, r=jimm,kats)
David Anderson <danderson@mozilla.com>
parents: 295443
diff changeset
   898
  return (gfxPlatform::AsyncPanZoomEnabled() &&
357868
63a1460c38043c88d9ff4556eed904aebeb333ce Bug 1353060: Allow APZ in popup window widgets. r=kats
Kris Maglione <maglione.k@gmail.com>
parents: 357446
diff changeset
   899
          (WindowType() == eWindowType_toplevel ||
63a1460c38043c88d9ff4556eed904aebeb333ce Bug 1353060: Allow APZ in popup window widgets. r=kats
Kris Maglione <maglione.k@gmail.com>
parents: 357446
diff changeset
   900
           WindowType() == eWindowType_child ||
369371
228602d59911f40a39c75841722be7c4b124c447 Bug 1381097: Part 1 - Add default-false pref to enable APZ in remote popups. r=kats
Kris Maglione <maglione.k@gmail.com>
parents: 367810
diff changeset
   901
           (WindowType() == eWindowType_popup && HasRemoteContent() &&
480115
fb0a0b7ac94c921338b3bdcda9f11de01f25408b Bug 1560837 - Make APZ static prefs follow the naming convention. r=froydnj
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 479791
diff changeset
   902
            StaticPrefs::apz_popups_enabled())));
295584
b45b6eca1e7b239197945e0966674979731834ba Use CompositorWidgetProxy in place of nsIWidget in CompositorBridgeParent. (bug 1264545 part 5, r=jimm,kats)
David Anderson <danderson@mozilla.com>
parents: 295443
diff changeset
   903
}
b45b6eca1e7b239197945e0966674979731834ba Use CompositorWidgetProxy in place of nsIWidget in CompositorBridgeParent. (bug 1264545 part 5, r=jimm,kats)
David Anderson <danderson@mozilla.com>
parents: 295443
diff changeset
   904
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   905
void nsBaseWidget::CreateCompositor() {
310240
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310239
diff changeset
   906
  LayoutDeviceIntRect rect = GetBounds();
398636
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 396793
diff changeset
   907
  CreateCompositor(rect.Width(), rect.Height());
125703
e70bea1fd1662ece0eb065c085bce689456b7fa0 Bug 852526 - Make sure the compositor starts unpaused and with a size. r=kats
Chris Lord <chrislord.net@gmail.com>
parents: 125453
diff changeset
   908
}
e70bea1fd1662ece0eb065c085bce689456b7fa0 Bug 852526 - Make sure the compositor starts unpaused and with a size. r=kats
Chris Lord <chrislord.net@gmail.com>
parents: 125453
diff changeset
   909
219723
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   910
already_AddRefed<GeckoContentController>
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   911
nsBaseWidget::CreateRootContentController() {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   912
  RefPtr<GeckoContentController> controller =
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   913
      new ChromeProcessController(this, mAPZEventState, mAPZC);
219724
71b13c6e679a7436dfd3cd3ab6411f9358388f33 Create a common chrome-process GeckoContentController. (bug 1110540 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 219723
diff changeset
   914
  return controller.forget();
219723
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   915
}
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   916
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   917
void nsBaseWidget::ConfigureAPZCTreeManager() {
408417
6c6b2501cc21457343fc8d87f1f5d9292ac75450 Merge mozilla-central to autoland a=merge on a CLOSED TREE
Coroiu Cristina <ccoroiu@mozilla.com>
parents: 408403
diff changeset
   918
  MOZ_ASSERT(NS_IsMainThread());
219723
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   919
  MOZ_ASSERT(mAPZC);
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   920
236042
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 235751
diff changeset
   921
  ConfigureAPZControllerThread();
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 235751
diff changeset
   922
408417
6c6b2501cc21457343fc8d87f1f5d9292ac75450 Merge mozilla-central to autoland a=merge on a CLOSED TREE
Coroiu Cristina <ccoroiu@mozilla.com>
parents: 408403
diff changeset
   923
  float dpi = GetDPI();
6c6b2501cc21457343fc8d87f1f5d9292ac75450 Merge mozilla-central to autoland a=merge on a CLOSED TREE
Coroiu Cristina <ccoroiu@mozilla.com>
parents: 408403
diff changeset
   924
  // On Android the main thread is not the controller thread
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   925
  APZThreadUtils::RunOnControllerThread(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   926
      NewRunnableMethod<float>("layers::IAPZCTreeManager::SetDPI", mAPZC,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   927
                               &IAPZCTreeManager::SetDPI, dpi));
366292
e37625d5695e96bbd554db809db07abbba56fe3e Bug 1351783 part 17 - Do less work when apz.keyboard.enabled is false. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 366281
diff changeset
   928
483647
2cb4ffa920c6ad8a4f9b500222dc41d929114646 Bug 1567329 - Append `_AtStartup` to `once` static pref getters. r=erahm
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 483506
diff changeset
   929
  if (StaticPrefs::apz_keyboard_enabled_AtStartup()) {
492043
454b9be1b61388183b0c5b55d780507d845858dd Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki
Dave Townsend <dtownsend@oxymoronical.com>
parents: 491884
diff changeset
   930
    KeyboardMap map = RootWindowGlobalKeyListener::CollectKeyboardShortcuts();
408417
6c6b2501cc21457343fc8d87f1f5d9292ac75450 Merge mozilla-central to autoland a=merge on a CLOSED TREE
Coroiu Cristina <ccoroiu@mozilla.com>
parents: 408403
diff changeset
   931
    // On Android the main thread is not the controller thread
6c6b2501cc21457343fc8d87f1f5d9292ac75450 Merge mozilla-central to autoland a=merge on a CLOSED TREE
Coroiu Cristina <ccoroiu@mozilla.com>
parents: 408403
diff changeset
   932
    APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   933
        "layers::IAPZCTreeManager::SetKeyboardMap", mAPZC,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   934
        &IAPZCTreeManager::SetKeyboardMap, map));
366292
e37625d5695e96bbd554db809db07abbba56fe3e Bug 1351783 part 17 - Do less work when apz.keyboard.enabled is false. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 366281
diff changeset
   935
  }
262101
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 262100
diff changeset
   936
306172
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 306008
diff changeset
   937
  RefPtr<IAPZCTreeManager> treeManager = mAPZC;  // for capture by the lambdas
262101
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 262100
diff changeset
   938
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 262100
diff changeset
   939
  ContentReceivedInputBlockCallback callback(
472824
7748746bf2feda8edd0cabfdaff88b7faf059ad5 Bug 1548568 - Cleanup to remove unused guid parameter in callback. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 472823
diff changeset
   940
      [treeManager](uint64_t aInputBlockId, bool aPreventDefault) {
262101
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 262100
diff changeset
   941
        MOZ_ASSERT(NS_IsMainThread());
366127
312f7a5a2c08d394a2403c837e5ee546dd4103d7 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
Bill McCloskey <billm@mozilla.com>
parents: 366042
diff changeset
   942
        APZThreadUtils::RunOnControllerThread(NewRunnableMethod<uint64_t, bool>(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   943
            "layers::IAPZCTreeManager::ContentReceivedInputBlock", treeManager,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   944
            &IAPZCTreeManager::ContentReceivedInputBlock, aInputBlockId,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   945
            aPreventDefault));
262101
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 262100
diff changeset
   946
      });
420862
b54db66223586b4e04f5cb926fccdacf8a176b91 Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 418195
diff changeset
   947
  mAPZEventState = new APZEventState(this, std::move(callback));
262101
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 262100
diff changeset
   948
528587
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   949
  mSetAllowedTouchBehaviorCallback =
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   950
      [treeManager](uint64_t aInputBlockId,
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   951
                    const nsTArray<TouchBehaviorFlags>& aFlags) {
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   952
        MOZ_ASSERT(NS_IsMainThread());
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   953
        APZThreadUtils::RunOnControllerThread(
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   954
            NewRunnableMethod<
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   955
                uint64_t, StoreCopyPassByLRef<nsTArray<TouchBehaviorFlags>>>(
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   956
                "layers::IAPZCTreeManager::SetAllowedTouchBehavior",
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   957
                treeManager, &IAPZCTreeManager::SetAllowedTouchBehavior,
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   958
                aInputBlockId, aFlags.Clone()));
b60235fc5d62a6e988e8fa5795f712f65a731892 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 528574
diff changeset
   959
      };
219723
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   960
294607
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 294284
diff changeset
   961
  mRootContentController = CreateRootContentController();
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 294284
diff changeset
   962
  if (mRootContentController) {
297876
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
   963
    mCompositorSession->SetContentController(mRootContentController);
219723
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   964
  }
268493
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 268372
diff changeset
   965
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 268372
diff changeset
   966
  // When APZ is enabled, we can actually enable raw touch events because we
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 268372
diff changeset
   967
  // have code that can deal with them properly. If APZ is not enabled, this
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 268372
diff changeset
   968
  // function doesn't get called.
564539
1c59701a68c9e52fcdc0bf02c02eb1dca962bc6f Bug 1688105 - Part 2: Get rid of dom.w3c_pointer_events.enabled; r=smaug
Edgar Chen <echen@mozilla.com>
parents: 563973
diff changeset
   969
  if (StaticPrefs::dom_w3c_touch_events_enabled()) {
268493
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 268372
diff changeset
   970
    RegisterTouchWindow();
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 268372
diff changeset
   971
  }
219723
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   972
}
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
   973
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   974
void nsBaseWidget::ConfigureAPZControllerThread() {
236042
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 235751
diff changeset
   975
  // By default the controller thread is the main thread.
528946
40c6722e7cdecb831aaf33579d8c8204e0435145 Bug 1635001 - P2. Don't use MessageLoop threads with APZ. r=kats,geckoview-reviewers,snorp
Jean-Yves Avenard <jyavenard@mozilla.com>
parents: 528905
diff changeset
   976
  APZThreadUtils::SetControllerThread(NS_GetCurrentThread());
236042
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 235751
diff changeset
   977
}
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 235751
diff changeset
   978
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   979
void nsBaseWidget::SetConfirmedTargetAPZC(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   980
    uint64_t aInputBlockId,
520787
5916b41d10e9c8e6731db02a1611a4b28c1c25ba Bug 1622360 - Remove SLGuidAndRenderRoot and convert remaining uses to ScrollableLayerGuid. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520061
diff changeset
   981
    const nsTArray<ScrollableLayerGuid>& aTargets) const {
366127
312f7a5a2c08d394a2403c837e5ee546dd4103d7 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
Bill McCloskey <billm@mozilla.com>
parents: 366042
diff changeset
   982
  APZThreadUtils::RunOnControllerThread(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   983
      NewRunnableMethod<uint64_t,
520787
5916b41d10e9c8e6731db02a1611a4b28c1c25ba Bug 1622360 - Remove SLGuidAndRenderRoot and convert remaining uses to ScrollableLayerGuid. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520061
diff changeset
   984
                        StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   985
          "layers::IAPZCTreeManager::SetTargetAPZC", mAPZC,
526904
ef52aacd0d0c72cbd8465b6f32f3477f2af3fbf1 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Simon Giesecke <sgiesecke@mozilla.com>
parents: 526429
diff changeset
   986
          &IAPZCTreeManager::SetTargetAPZC, aInputBlockId, aTargets.Clone()));
239044
879e74f2e74cc56c507c7784f05020462c7ad734 Fix APZ target confirmations arriving before dependent layer transactions. (bug 1154130, r=kats)
David Anderson <danderson@mozilla.com>
parents: 239022
diff changeset
   987
}
879e74f2e74cc56c507c7784f05020462c7ad734 Fix APZ target confirmations arriving before dependent layer transactions. (bug 1154130, r=kats)
David Anderson <danderson@mozilla.com>
parents: 239022
diff changeset
   988
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   989
void nsBaseWidget::UpdateZoomConstraints(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   990
    const uint32_t& aPresShellId, const ScrollableLayerGuid::ViewID& aViewId,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
   991
    const Maybe<ZoomConstraints>& aConstraints) {
297876
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
   992
  if (!mCompositorSession || !mAPZC) {
270087
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
   993
    if (mInitialZoomConstraints) {
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
   994
      MOZ_ASSERT(mInitialZoomConstraints->mPresShellID == aPresShellId);
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
   995
      MOZ_ASSERT(mInitialZoomConstraints->mViewID == aViewId);
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
   996
      if (!aConstraints) {
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
   997
        mInitialZoomConstraints.reset();
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
   998
      }
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
   999
    }
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1000
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1001
    if (aConstraints) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1002
      // We have some constraints, but the compositor and APZC aren't created
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1003
      // yet. Save these so we can use them later.
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1004
      mInitialZoomConstraints = Some(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1005
          InitialZoomConstraints(aPresShellId, aViewId, aConstraints.ref()));
270087
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1006
    }
249440
dc009c8ce7c31d516969ad9db32b24a395b78bc0 Bug 1055557 - Add a ZoomConstraintsClient class to manage pushing zoom constraints updates to the APZ code. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 248753
diff changeset
  1007
    return;
dc009c8ce7c31d516969ad9db32b24a395b78bc0 Bug 1055557 - Add a ZoomConstraintsClient class to manage pushing zoom constraints updates to the APZ code. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 248753
diff changeset
  1008
  }
409886
5d9f32557d7740c7c30f7bc6057c4de0c294d828 Bug 1448490 - Make the layers id a struct instead of a uint64_t. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 409757
diff changeset
  1009
  LayersId layersId = mCompositorSession->RootLayerTreeId();
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1010
  mAPZC->UpdateZoomConstraints(
520787
5916b41d10e9c8e6731db02a1611a4b28c1c25ba Bug 1622360 - Remove SLGuidAndRenderRoot and convert remaining uses to ScrollableLayerGuid. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520061
diff changeset
  1011
      ScrollableLayerGuid(layersId, aPresShellId, aViewId), aConstraints);
249440
dc009c8ce7c31d516969ad9db32b24a395b78bc0 Bug 1055557 - Add a ZoomConstraintsClient class to manage pushing zoom constraints updates to the APZ code. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 248753
diff changeset
  1012
}
dc009c8ce7c31d516969ad9db32b24a395b78bc0 Bug 1055557 - Add a ZoomConstraintsClient class to manage pushing zoom constraints updates to the APZ code. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 248753
diff changeset
  1013
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1014
bool nsBaseWidget::AsyncPanZoomEnabled() const { return !!mAPZC; }
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1015
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1016
nsEventStatus nsBaseWidget::ProcessUntransformedAPZEvent(
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1017
    WidgetInputEvent* aEvent, const APZEventResult& aApzResult) {
228436
5a35ca7c0adce48b6e04e4002f6e4c8542855f24 Bug 930939 - Switch the B2G controller thread from the main thread to the compositor thread. r=botond,mwu
Kartikaya Gupta <kgupta@mozilla.com>
parents: 228378
diff changeset
  1018
  MOZ_ASSERT(NS_IsMainThread());
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1019
  ScrollableLayerGuid targetGuid = aApzResult.mTargetGuid;
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1020
  uint64_t inputBlockId = aApzResult.mInputBlockId;
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1021
  InputAPZContext context(aApzResult.mTargetGuid, inputBlockId,
569213
6eccf14cecef959b41bcb4ddb48916bab792b59b Bug 1678505 - Make APZEventResult::mStatus and mHandledResult private. r=botond
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 568963
diff changeset
  1022
                          aApzResult.GetStatus());
220508
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1023
275108
aab1935c93207c752622d2b0d80e21648c7d5318 Bug 1229393 - Ensure that all the touch points from the original touch go to APZCCallbackHelper::SendSetTargetAPZCNotification. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 273914
diff changeset
  1024
  // Make a copy of the original event for the APZCCallbackHelper helpers that
aab1935c93207c752622d2b0d80e21648c7d5318 Bug 1229393 - Ensure that all the touch points from the original touch go to APZCCallbackHelper::SendSetTargetAPZCNotification. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 273914
diff changeset
  1025
  // we call later, because the event passed to DispatchEvent can get mutated in
aab1935c93207c752622d2b0d80e21648c7d5318 Bug 1229393 - Ensure that all the touch points from the original touch go to APZCCallbackHelper::SendSetTargetAPZCNotification. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 273914
diff changeset
  1026
  // ways that we don't want (i.e. touch points can get stripped out).
220508
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1027
  nsEventStatus status;
275108
aab1935c93207c752622d2b0d80e21648c7d5318 Bug 1229393 - Ensure that all the touch points from the original touch go to APZCCallbackHelper::SendSetTargetAPZCNotification. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 273914
diff changeset
  1028
  UniquePtr<WidgetEvent> original(aEvent->Duplicate());
220508
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1029
  DispatchEvent(aEvent, status);
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1030
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1031
  if (mAPZC && !InputAPZContext::WasRoutedToChildProcess() && inputBlockId) {
228801
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1032
    // EventStateManager did not route the event into the child process.
220508
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1033
    // It's safe to communicate to APZ that the event has been processed.
483506
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1034
    // Note that here aGuid.mLayersId might be different from
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1035
    // mCompositorSession->RootLayerTreeId() because the event might have gotten
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1036
    // hit-tested by APZ to be targeted at a child process, but a parent process
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1037
    // event listener called preventDefault on it. In that case aGuid.mLayersId
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1038
    // would still be the layers id for the child process, but the event would
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1039
    // not have actually gotten routed to the child process. The main-thread
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1040
    // hit-test result therefore needs to use the parent process layers id.
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1041
    LayersId rootLayersId = mCompositorSession->RootLayerTreeId();
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1042
575979
472077cb1e3827a16c4939ec5cb2dc207629b409 Bug 1699844 - Make promiseDocumentFlushed handle presshell destruction correctly. r=smaug,botond
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575822
diff changeset
  1043
    RefPtr<DisplayportSetListener> postLayerization;
228806
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228801
diff changeset
  1044
    if (WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent()) {
548036
ca7ab0e42f54fc527ed266c155a2a3724da17490 Bug 1648491 - Have the main thread double-check APZ's consumable state. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 547789
diff changeset
  1045
      nsTArray<TouchBehaviorFlags> allowedTouchBehaviors;
262345
a92cec9902d70d52289ee2205b3f5f925c332e3c Bug 895274 part.241 Rename NS_TOUCH_START to eTouchStart r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 262336
diff changeset
  1046
      if (touchEvent->mMessage == eTouchStart) {
478637
1091aed2035c378a1f70111dd1bab19c7a566847 Bug 1490044 - Move all prefs used in WebIDL to StaticPrefs. r=bzbarsky
Peter Van der Beken <peterv@propagandism.org>
parents: 476652
diff changeset
  1047
        if (StaticPrefs::layout_css_touch_action_enabled()) {
548036
ca7ab0e42f54fc527ed266c155a2a3724da17490 Bug 1648491 - Have the main thread double-check APZ's consumable state. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 547789
diff changeset
  1048
          allowedTouchBehaviors =
ca7ab0e42f54fc527ed266c155a2a3724da17490 Bug 1648491 - Have the main thread double-check APZ's consumable state. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 547789
diff changeset
  1049
              APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
ca7ab0e42f54fc527ed266c155a2a3724da17490 Bug 1648491 - Have the main thread double-check APZ's consumable state. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 547789
diff changeset
  1050
                  this, GetDocument(), *(original->AsTouchEvent()),
ca7ab0e42f54fc527ed266c155a2a3724da17490 Bug 1648491 - Have the main thread double-check APZ's consumable state. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 547789
diff changeset
  1051
                  inputBlockId, mSetAllowedTouchBehaviorCallback);
234458
01abf38a6a4db728f2603395fcbc2edffca1cc45 Bug 1122090 - Send the allowed behaviour notification to APZ for touch blocks when touch-action is enabled. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 233983
diff changeset
  1052
        }
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1053
        postLayerization = APZCCallbackHelper::SendSetTargetAPZCNotification(
483506
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1054
            this, GetDocument(), *(original->AsTouchEvent()), rootLayersId,
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1055
            inputBlockId);
228806
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228801
diff changeset
  1056
      }
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1057
      mAPZEventState->ProcessTouchEvent(*touchEvent, targetGuid, inputBlockId,
569213
6eccf14cecef959b41bcb4ddb48916bab792b59b Bug 1678505 - Make APZEventResult::mStatus and mHandledResult private. r=botond
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 568963
diff changeset
  1058
                                        aApzResult.GetStatus(), status,
548036
ca7ab0e42f54fc527ed266c155a2a3724da17490 Bug 1648491 - Have the main thread double-check APZ's consumable state. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 547789
diff changeset
  1059
                                        std::move(allowedTouchBehaviors));
228806
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228801
diff changeset
  1060
    } else if (WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent()) {
300956
b72ab182dd554343b504a771e535214de53b5d6f Bug 1273137 - Add the missing main-thread target confirmation for drag blocks. r=rbarker
Kartikaya Gupta <kgupta@mozilla.com>
parents: 300650
diff changeset
  1061
      MOZ_ASSERT(wheelEvent->mFlags.mHandledByAPZ);
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1062
      postLayerization = APZCCallbackHelper::SendSetTargetAPZCNotification(
483506
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1063
          this, GetDocument(), *(original->AsWheelEvent()), rootLayersId,
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1064
          inputBlockId);
300956
b72ab182dd554343b504a771e535214de53b5d6f Bug 1273137 - Add the missing main-thread target confirmation for drag blocks. r=rbarker
Kartikaya Gupta <kgupta@mozilla.com>
parents: 300650
diff changeset
  1065
      if (wheelEvent->mCanTriggerSwipe) {
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1066
        ReportSwipeStarted(inputBlockId, wheelEvent->TriggersSwipe());
259462
29850f2b5708117911eabe11d6fb6854468dcdc7 Bug 1193062 - Only send a content response for wheel events that have also been processed by APZ. r=kats
Markus Stange <mstange@themasta.com>
parents: 259053
diff changeset
  1067
      }
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1068
      mAPZEventState->ProcessWheelEvent(*wheelEvent, inputBlockId);
270493
0095ee7c07a34c940a30836704b5dff9107be686 Bug 1211612 - Add DragInputBlock for async scrollbars. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 270087
diff changeset
  1069
    } else if (WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent()) {
300956
b72ab182dd554343b504a771e535214de53b5d6f Bug 1273137 - Add the missing main-thread target confirmation for drag blocks. r=rbarker
Kartikaya Gupta <kgupta@mozilla.com>
parents: 300650
diff changeset
  1070
      MOZ_ASSERT(mouseEvent->mFlags.mHandledByAPZ);
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1071
      postLayerization = APZCCallbackHelper::SendSetTargetAPZCNotification(
483506
b41a0c8b4a694a77f6631e67ac49b43c5e223812 Bug 1563622 - Use the right layers id for events prevented by chrome. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 482872
diff changeset
  1072
          this, GetDocument(), *(original->AsMouseEvent()), rootLayersId,
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1073
          inputBlockId);
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1074
      mAPZEventState->ProcessMouseEvent(*mouseEvent, inputBlockId);
228801
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1075
    }
575979
472077cb1e3827a16c4939ec5cb2dc207629b409 Bug 1699844 - Make promiseDocumentFlushed handle presshell destruction correctly. r=smaug,botond
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 575822
diff changeset
  1076
    if (postLayerization) {
584317
9d23f785e755345c0c52242adc071d8bd7101e46 Bug 1716481 - Improve ManagedPostRefreshObserver. r=smaug
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 583969
diff changeset
  1077
      postLayerization->Register();
422758
1deb0d199abe9460a4882e855d14e8fb700774a5 Bug 1468545 - Ensure the drag metrics gets to APZ before the target APZC for inactive scrollframes. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 420862
diff changeset
  1078
    }
220508
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1079
  }
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1080
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1081
  return status;
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1082
}
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 220406
diff changeset
  1083
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1084
template <class InputType, class EventType>
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1085
class DispatchEventOnMainThread : public Runnable {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1086
 public:
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1087
  DispatchEventOnMainThread(const InputType& aInput, nsBaseWidget* aWidget,
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1088
                            const APZEventResult& aAPZResult)
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1089
      : mozilla::Runnable("DispatchEventOnMainThread"),
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1090
        mInput(aInput),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1091
        mWidget(aWidget),
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1092
        mAPZResult(aAPZResult) {}
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1093
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1094
  NS_IMETHOD Run() override {
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1095
    EventType event = mInput.ToWidgetEvent(mWidget);
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1096
    mWidget->ProcessUntransformedAPZEvent(&event, mAPZResult);
295208
30dcf34cfb753d94c79f40bd1af15d3b75e981a5 Bug 1266595: Replace Chromium Task with Runnable. r=froydnj
Kyle Huey <khuey@kylehuey.com>
parents: 294638
diff changeset
  1097
    return NS_OK;
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1098
  }
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1099
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1100
 private:
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1101
  InputType mInput;
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1102
  nsBaseWidget* mWidget;
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1103
  APZEventResult mAPZResult;
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1104
};
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1105
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1106
template <class InputType, class EventType>
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1107
class DispatchInputOnControllerThread : public Runnable {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1108
 public:
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1109
  DispatchInputOnControllerThread(const EventType& aEvent,
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1110
                                  IAPZCTreeManager* aAPZC,
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1111
                                  nsBaseWidget* aWidget)
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1112
      : mozilla::Runnable("DispatchInputOnControllerThread"),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1113
        mMainMessageLoop(MessageLoop::current()),
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1114
        mInput(aEvent),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1115
        mAPZC(aAPZC),
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1116
        mWidget(aWidget) {}
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1117
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1118
  NS_IMETHOD Run() override {
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1119
    APZEventResult result = mAPZC->InputBridge()->ReceiveInputEvent(mInput);
569213
6eccf14cecef959b41bcb4ddb48916bab792b59b Bug 1678505 - Make APZEventResult::mStatus and mHandledResult private. r=botond
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 568963
diff changeset
  1120
    if (result.GetStatus() == nsEventStatus_eConsumeNoDefault) {
295208
30dcf34cfb753d94c79f40bd1af15d3b75e981a5 Bug 1266595: Replace Chromium Task with Runnable. r=froydnj
Kyle Huey <khuey@kylehuey.com>
parents: 294638
diff changeset
  1121
      return NS_OK;
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1122
    }
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1123
    RefPtr<Runnable> r = new DispatchEventOnMainThread<InputType, EventType>(
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1124
        mInput, mWidget, result);
295208
30dcf34cfb753d94c79f40bd1af15d3b75e981a5 Bug 1266595: Replace Chromium Task with Runnable. r=froydnj
Kyle Huey <khuey@kylehuey.com>
parents: 294638
diff changeset
  1125
    mMainMessageLoop->PostTask(r.forget());
30dcf34cfb753d94c79f40bd1af15d3b75e981a5 Bug 1266595: Replace Chromium Task with Runnable. r=froydnj
Kyle Huey <khuey@kylehuey.com>
parents: 294638
diff changeset
  1126
    return NS_OK;
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1127
  }
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1128
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1129
 private:
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1130
  MessageLoop* mMainMessageLoop;
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1131
  InputType mInput;
306172
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 306008
diff changeset
  1132
  RefPtr<IAPZCTreeManager> mAPZC;
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1133
  nsBaseWidget* mWidget;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1134
};
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1135
578903
1555ee7b66503dafb841fff54317c0b99e6a7402 Bug 1706420 - Part 1: Add mInputSource to WidgetTouchEvent r=aklotz,edgar
Kagami Sascha Rosylight <krosylight@mozilla.com>
parents: 578564
diff changeset
  1136
void nsBaseWidget::DispatchTouchInput(MultiTouchInput& aInput,
1555ee7b66503dafb841fff54317c0b99e6a7402 Bug 1706420 - Part 1: Add mInputSource to WidgetTouchEvent r=aklotz,edgar
Kagami Sascha Rosylight <krosylight@mozilla.com>
parents: 578564
diff changeset
  1137
                                      uint16_t aInputSource) {
308084
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1138
  MOZ_ASSERT(NS_IsMainThread());
578903
1555ee7b66503dafb841fff54317c0b99e6a7402 Bug 1706420 - Part 1: Add mInputSource to WidgetTouchEvent r=aklotz,edgar
Kagami Sascha Rosylight <krosylight@mozilla.com>
parents: 578564
diff changeset
  1139
  MOZ_ASSERT(aInputSource ==
1555ee7b66503dafb841fff54317c0b99e6a7402 Bug 1706420 - Part 1: Add mInputSource to WidgetTouchEvent r=aklotz,edgar
Kagami Sascha Rosylight <krosylight@mozilla.com>
parents: 578564
diff changeset
  1140
                 mozilla::dom::MouseEvent_Binding::MOZ_SOURCE_TOUCH ||
1555ee7b66503dafb841fff54317c0b99e6a7402 Bug 1706420 - Part 1: Add mInputSource to WidgetTouchEvent r=aklotz,edgar
Kagami Sascha Rosylight <krosylight@mozilla.com>
parents: 578564
diff changeset
  1141
             aInputSource == mozilla::dom::MouseEvent_Binding::MOZ_SOURCE_PEN);
308084
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1142
  if (mAPZC) {
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1143
    MOZ_ASSERT(APZThreadUtils::IsControllerThread());
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1144
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1145
    APZEventResult result = mAPZC->InputBridge()->ReceiveInputEvent(aInput);
569213
6eccf14cecef959b41bcb4ddb48916bab792b59b Bug 1678505 - Make APZEventResult::mStatus and mHandledResult private. r=botond
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 568963
diff changeset
  1146
    if (result.GetStatus() == nsEventStatus_eConsumeNoDefault) {
308084
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1147
      return;
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1148
    }
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1149
578903
1555ee7b66503dafb841fff54317c0b99e6a7402 Bug 1706420 - Part 1: Add mInputSource to WidgetTouchEvent r=aklotz,edgar
Kagami Sascha Rosylight <krosylight@mozilla.com>
parents: 578564
diff changeset
  1150
    WidgetTouchEvent event = aInput.ToWidgetEvent(this, aInputSource);
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1151
    ProcessUntransformedAPZEvent(&event, result);
308084
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1152
  } else {
578903
1555ee7b66503dafb841fff54317c0b99e6a7402 Bug 1706420 - Part 1: Add mInputSource to WidgetTouchEvent r=aklotz,edgar
Kagami Sascha Rosylight <krosylight@mozilla.com>
parents: 578564
diff changeset
  1153
    WidgetTouchEvent event = aInput.ToWidgetEvent(this, aInputSource);
308084
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1154
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1155
    nsEventStatus status;
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1156
    DispatchEvent(&event, status);
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1157
  }
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1158
}
60baa125c3ab1e857eda4e6dc1bd6d40a89592b5 Bug 1289435 - Extract a helper function to dispatch MultiTouchInput to APZ if applicable and then to Gecko. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 308083
diff changeset
  1159
479791
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1160
void nsBaseWidget::DispatchPanGestureInput(PanGestureInput& aInput) {
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1161
  MOZ_ASSERT(NS_IsMainThread());
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1162
  if (mAPZC) {
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1163
    MOZ_ASSERT(APZThreadUtils::IsControllerThread());
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1164
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1165
    APZEventResult result = mAPZC->InputBridge()->ReceiveInputEvent(aInput);
569213
6eccf14cecef959b41bcb4ddb48916bab792b59b Bug 1678505 - Make APZEventResult::mStatus and mHandledResult private. r=botond
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 568963
diff changeset
  1166
    if (result.GetStatus() == nsEventStatus_eConsumeNoDefault) {
479791
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1167
      return;
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1168
    }
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1169
551064
c3b35d74c60c1d82f06ae7f3db977b8bafaaf32c Bug 1666201 - Part 1: Rename ToWidget{Wheel|Mouse}Event to ToWidgetEvent; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551002
diff changeset
  1170
    WidgetWheelEvent event = aInput.ToWidgetEvent(this);
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1171
    ProcessUntransformedAPZEvent(&event, result);
479791
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1172
  } else {
551064
c3b35d74c60c1d82f06ae7f3db977b8bafaaf32c Bug 1666201 - Part 1: Rename ToWidget{Wheel|Mouse}Event to ToWidgetEvent; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551002
diff changeset
  1173
    WidgetWheelEvent event = aInput.ToWidgetEvent(this);
563973
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1174
    nsEventStatus status;
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1175
    DispatchEvent(&event, status);
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1176
  }
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1177
}
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1178
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1179
void nsBaseWidget::DispatchPinchGestureInput(PinchGestureInput& aInput) {
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1180
  MOZ_ASSERT(NS_IsMainThread());
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1181
  if (mAPZC) {
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1182
    MOZ_ASSERT(APZThreadUtils::IsControllerThread());
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1183
    APZEventResult result = mAPZC->InputBridge()->ReceiveInputEvent(aInput);
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1184
569213
6eccf14cecef959b41bcb4ddb48916bab792b59b Bug 1678505 - Make APZEventResult::mStatus and mHandledResult private. r=botond
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 568963
diff changeset
  1185
    if (result.GetStatus() == nsEventStatus_eConsumeNoDefault) {
563973
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1186
      return;
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1187
    }
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1188
    WidgetWheelEvent event = aInput.ToWidgetEvent(this);
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1189
    ProcessUntransformedAPZEvent(&event, result);
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1190
  } else {
09d418b19d52dab3982d4ee73d6e35d149804422 Bug 1581126 - Hook up pinch gestures on Linux touchpads for APZ zooming r=botond,stransky
Alaa Emad <eng.alaaemad.ae@gmail.com>
parents: 554601
diff changeset
  1191
    WidgetWheelEvent event = aInput.ToWidgetEvent(this);
479791
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1192
    nsEventStatus status;
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1193
    DispatchEvent(&event, status);
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1194
  }
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1195
}
d9f7c87aa3b474e99c789b91708b35a288366f26 Bug 1213601 - implement kinetic/inertial scrolling (fling) for Gtk. r=botond
myfreeweb <greg@unrelenting.technology>
parents: 479076
diff changeset
  1196
575822
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1197
nsIWidget::ContentAndAPZEventStatus nsBaseWidget::DispatchInputEvent(
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1198
    WidgetInputEvent* aEvent) {
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1199
  nsIWidget::ContentAndAPZEventStatus status;
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1200
  MOZ_ASSERT(NS_IsMainThread());
232336
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 230263
diff changeset
  1201
  if (mAPZC) {
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1202
    if (APZThreadUtils::IsControllerThread()) {
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1203
      APZEventResult result = mAPZC->InputBridge()->ReceiveInputEvent(*aEvent);
575822
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1204
      status.mApzStatus = result.GetStatus();
569213
6eccf14cecef959b41bcb4ddb48916bab792b59b Bug 1678505 - Make APZEventResult::mStatus and mHandledResult private. r=botond
Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
parents: 568963
diff changeset
  1205
      if (result.GetStatus() == nsEventStatus_eConsumeNoDefault) {
575822
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1206
        return status;
273228
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 273069
diff changeset
  1207
      }
575822
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1208
      status.mContentStatus = ProcessUntransformedAPZEvent(aEvent, result);
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1209
      return status;
232336
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 230263
diff changeset
  1210
    }
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1211
    if (WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent()) {
343017
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 342202
diff changeset
  1212
      RefPtr<Runnable> r =
551065
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1213
          new DispatchInputOnControllerThread<ScrollWheelInput,
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1214
                                              WidgetWheelEvent>(*wheelEvent,
9bc6706e66dd59638aa1eb158fdac232de0cc314 Bug 1666201 - Part 2: Make Dispatch*Thread support multiple types of event; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551064
diff changeset
  1215
                                                                mAPZC, this);
550976
1688cdab3d483ce555a958cc3282bb926ae755ba Bug 1666201 - Part 3: Ensure synthesized mouse event is dispatched on correct thread; r=kats
Edgar Chen <echen@mozilla.com>
parents: 550975
diff changeset
  1216
      APZThreadUtils::RunOnControllerThread(std::move(r));
575822
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1217
      status.mContentStatus = nsEventStatus_eConsumeDoDefault;
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1218
      return status;
550976
1688cdab3d483ce555a958cc3282bb926ae755ba Bug 1666201 - Part 3: Ensure synthesized mouse event is dispatched on correct thread; r=kats
Edgar Chen <echen@mozilla.com>
parents: 550975
diff changeset
  1219
    }
551066
3d50251246b59b811e2c3b26009ba8f4aefeb159 Bug 1666201 - Part 3: Ensure synthesized mouse event is dispatched on correct thread; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551065
diff changeset
  1220
    if (WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent()) {
3d50251246b59b811e2c3b26009ba8f4aefeb159 Bug 1666201 - Part 3: Ensure synthesized mouse event is dispatched on correct thread; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551065
diff changeset
  1221
      RefPtr<Runnable> r =
3d50251246b59b811e2c3b26009ba8f4aefeb159 Bug 1666201 - Part 3: Ensure synthesized mouse event is dispatched on correct thread; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551065
diff changeset
  1222
          new DispatchInputOnControllerThread<MouseInput, WidgetMouseEvent>(
3d50251246b59b811e2c3b26009ba8f4aefeb159 Bug 1666201 - Part 3: Ensure synthesized mouse event is dispatched on correct thread; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551065
diff changeset
  1223
              *mouseEvent, mAPZC, this);
3d50251246b59b811e2c3b26009ba8f4aefeb159 Bug 1666201 - Part 3: Ensure synthesized mouse event is dispatched on correct thread; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551065
diff changeset
  1224
      APZThreadUtils::RunOnControllerThread(std::move(r));
575822
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1225
      status.mContentStatus = nsEventStatus_eConsumeDoDefault;
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1226
      return status;
551066
3d50251246b59b811e2c3b26009ba8f4aefeb159 Bug 1666201 - Part 3: Ensure synthesized mouse event is dispatched on correct thread; r=kats
Edgar Chen <echen@mozilla.com>
parents: 551065
diff changeset
  1227
    }
577108
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1228
    if (WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent()) {
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1229
      RefPtr<Runnable> r =
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1230
          new DispatchInputOnControllerThread<MultiTouchInput,
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1231
                                              WidgetTouchEvent>(*touchEvent,
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1232
                                                                mAPZC, this);
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1233
      APZThreadUtils::RunOnControllerThread(std::move(r));
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1234
      status.mContentStatus = nsEventStatus_eConsumeDoDefault;
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1235
      return status;
a5bf7e5c0c112ddf8d07a670a3281eb39d85a449 Bug 1672726 - Part 2: Support dispatching synthesized touch events through parent process; r=ipc-reviewers,botond,nika
Edgar Chen <echen@mozilla.com>
parents: 577107
diff changeset
  1236
    }
345521
4048d3a531078eb13aed019c5cc5f68da49967c5 Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp
Jim Chen <nchen@mozilla.com>
parents: 344911
diff changeset
  1237
    // Allow dispatching keyboard events on Gecko thread.
4048d3a531078eb13aed019c5cc5f68da49967c5 Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp
Jim Chen <nchen@mozilla.com>
parents: 344911
diff changeset
  1238
    MOZ_ASSERT(aEvent->AsKeyboardEvent());
232336
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 230263
diff changeset
  1239
  }
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 230263
diff changeset
  1240
575822
e11655b5fcb81999d2220444f1c3cc330cf8573c Bug 1704070 - Expose the APZ event status in the return value of DispatchInputEvent(). r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 575786
diff changeset
  1241
  DispatchEvent(aEvent, status.mContentStatus);
232336
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 230263
diff changeset
  1242
  return status;
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 230263
diff changeset
  1243
}
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 230263
diff changeset
  1244
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1245
void nsBaseWidget::DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) {
294052
746c21b668ac307976d6fb142f4b708146b58ee7 Bug 1260018 - Route drag events to APZ, so it can accurately detect the end of a drag. r=kats
Botond Ballo <botond@mozilla.com>
parents: 293957
diff changeset
  1246
  MOZ_ASSERT(NS_IsMainThread());
746c21b668ac307976d6fb142f4b708146b58ee7 Bug 1260018 - Route drag events to APZ, so it can accurately detect the end of a drag. r=kats
Botond Ballo <botond@mozilla.com>
parents: 293957
diff changeset
  1247
  if (mAPZC) {
746c21b668ac307976d6fb142f4b708146b58ee7 Bug 1260018 - Route drag events to APZ, so it can accurately detect the end of a drag. r=kats
Botond Ballo <botond@mozilla.com>
parents: 293957
diff changeset
  1248
    MOZ_ASSERT(APZThreadUtils::IsControllerThread());
494045
ffc0e1cd529761f99a74914150f84e2320cecb22 Bug 1564195 - Group the results of APZInputBridge::ReceiveInputEvent() into a struct. r=tnikkel
Botond Ballo <botond@mozilla.com>
parents: 493554
diff changeset
  1249
    mAPZC->InputBridge()->ReceiveInputEvent(*aEvent);
294052
746c21b668ac307976d6fb142f4b708146b58ee7 Bug 1260018 - Route drag events to APZ, so it can accurately detect the end of a drag. r=kats
Botond Ballo <botond@mozilla.com>
parents: 293957
diff changeset
  1250
  }
746c21b668ac307976d6fb142f4b708146b58ee7 Bug 1260018 - Route drag events to APZ, so it can accurately detect the end of a drag. r=kats
Botond Ballo <botond@mozilla.com>
parents: 293957
diff changeset
  1251
}
746c21b668ac307976d6fb142f4b708146b58ee7 Bug 1260018 - Route drag events to APZ, so it can accurately detect the end of a drag. r=kats
Botond Ballo <botond@mozilla.com>
parents: 293957
diff changeset
  1252
452446
f0a91d36587266d7454a450c6044d573664fbed5 Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 449380
diff changeset
  1253
Document* nsBaseWidget::GetDocument() const {
228801
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1254
  if (mWidgetListener) {
469384
7b63cad25d9b4081eedc4a4d65004c60ac0c9277 Bug 1542663 - Make nsViewManager and nsView (nsIWidgetListener) use mozilla::PresShell directly rather than via nsIPresShell r=tnikkel
Masayuki Nakano <masayuki@d-toybox.com>
parents: 469371
diff changeset
  1255
    if (PresShell* presShell = mWidgetListener->GetPresShell()) {
228801
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1256
      return presShell->GetDocument();
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1257
    }
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1258
  }
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1259
  return nullptr;
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1260
}
c55657471570a3a4d8afe11768d5e74670b1f6bd Bug 1127066 - Implement proper sending of target-apzc notification and creation of displayport in the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 228799
diff changeset
  1261
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1262
void nsBaseWidget::CreateCompositorVsyncDispatcher() {
259053
697f5d72aebe8d661e31424f328ffb1539d8e904 Bug 1197201. Delete hardware vsync and vsync compositor prefs. r=kats
Mason Chang <mchang@mozilla.com>
parents: 258905
diff changeset
  1263
  // Parent directly listens to the vsync source whereas
697f5d72aebe8d661e31424f328ffb1539d8e904 Bug 1197201. Delete hardware vsync and vsync compositor prefs. r=kats
Mason Chang <mchang@mozilla.com>
parents: 258905
diff changeset
  1264
  // child process communicate via IPC
697f5d72aebe8d661e31424f328ffb1539d8e904 Bug 1197201. Delete hardware vsync and vsync compositor prefs. r=kats
Mason Chang <mchang@mozilla.com>
parents: 258905
diff changeset
  1265
  // Should be called AFTER gfxPlatform is initialized
697f5d72aebe8d661e31424f328ffb1539d8e904 Bug 1197201. Delete hardware vsync and vsync compositor prefs. r=kats
Mason Chang <mchang@mozilla.com>
parents: 258905
diff changeset
  1266
  if (XRE_IsParentProcess()) {
407017
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
  1267
    if (!mCompositorVsyncDispatcherLock) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1268
      mCompositorVsyncDispatcherLock =
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1269
          MakeUnique<Mutex>("mCompositorVsyncDispatcherLock");
407017
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
  1270
    }
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
  1271
    MutexAutoLock lock(*mCompositorVsyncDispatcherLock.get());
503957
248d909386f55c57aaf622eed1d0425d96bb6ee8 Bug 1542808 - Implement widget-local VsyncSource for Wayland windows. r=stransky,lsalzman
Kenny Levinsen <kl@kl.wtf>
parents: 503596
diff changeset
  1272
    if (!mCompositorVsyncDispatcher) {
248d909386f55c57aaf622eed1d0425d96bb6ee8 Bug 1542808 - Implement widget-local VsyncSource for Wayland windows. r=stransky,lsalzman
Kenny Levinsen <kl@kl.wtf>
parents: 503596
diff changeset
  1273
      mCompositorVsyncDispatcher = new CompositorVsyncDispatcher();
248d909386f55c57aaf622eed1d0425d96bb6ee8 Bug 1542808 - Implement widget-local VsyncSource for Wayland windows. r=stransky,lsalzman
Kenny Levinsen <kl@kl.wtf>
parents: 503596
diff changeset
  1274
    }
220406
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 219724
diff changeset
  1275
  }
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 219724
diff changeset
  1276
}
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 219724
diff changeset
  1277
396793
4309d6abe27f88b9dcc90b59a69b469df6da959e Bug 1425878 - Don't expose raw pointers to refcounted vsync dispatcher object. r=sotaro
Kartikaya Gupta <kgupta@mozilla.com>
parents: 392781
diff changeset
  1278
already_AddRefed<CompositorVsyncDispatcher>
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1279
nsBaseWidget::GetCompositorVsyncDispatcher() {
407017
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
  1280
  MOZ_ASSERT(mCompositorVsyncDispatcherLock.get());
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
  1281
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 399688
diff changeset
  1282
  MutexAutoLock lock(*mCompositorVsyncDispatcherLock.get());
396793
4309d6abe27f88b9dcc90b59a69b469df6da959e Bug 1425878 - Don't expose raw pointers to refcounted vsync dispatcher object. r=sotaro
Kartikaya Gupta <kgupta@mozilla.com>
parents: 392781
diff changeset
  1283
  RefPtr<CompositorVsyncDispatcher> dispatcher = mCompositorVsyncDispatcher;
4309d6abe27f88b9dcc90b59a69b469df6da959e Bug 1425878 - Don't expose raw pointers to refcounted vsync dispatcher object. r=sotaro
Kartikaya Gupta <kgupta@mozilla.com>
parents: 392781
diff changeset
  1284
  return dispatcher.forget();
220406
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 219724
diff changeset
  1285
}
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 219724
diff changeset
  1286
591057
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1287
already_AddRefed<WebRenderLayerManager> nsBaseWidget::CreateCompositorSession(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1288
    int aWidth, int aHeight, CompositorOptions* aOptionsOut) {
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1289
  MOZ_ASSERT(aOptionsOut);
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1290
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1291
  do {
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1292
    CreateCompositorVsyncDispatcher();
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1293
438639
a94730ef300e11980098601d90b0f86d4ef87423 Bug 1494528 - Call GPUProcessManager::EnsureGPUReady() before accessing gfxVars::UseWebRender() r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 436784
diff changeset
  1294
    gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get();
a94730ef300e11980098601d90b0f86d4ef87423 Bug 1494528 - Call GPUProcessManager::EnsureGPUReady() before accessing gfxVars::UseWebRender() r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 436784
diff changeset
  1295
    // Make sure GPU process is ready for use.
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1296
    // If it failed to connect to GPU process, GPU process usage is disabled in
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1297
    // EnsureGPUReady(). It could update gfxVars and gfxConfigs.
438639
a94730ef300e11980098601d90b0f86d4ef87423 Bug 1494528 - Call GPUProcessManager::EnsureGPUReady() before accessing gfxVars::UseWebRender() r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 436784
diff changeset
  1298
    gpu->EnsureGPUReady();
a94730ef300e11980098601d90b0f86d4ef87423 Bug 1494528 - Call GPUProcessManager::EnsureGPUReady() before accessing gfxVars::UseWebRender() r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 436784
diff changeset
  1299
568647
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1300
    // If widget type does not supports acceleration, we may be allowed to use
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1301
    // software WebRender instead. If not, then we use ClientLayerManager even
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1302
    // when gfxVars::UseWebRender() is true. WebRender could coexist only with
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1303
    // BasicCompositor.
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1304
    bool supportsAcceleration = WidgetTypeSupportsAcceleration();
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1305
    bool enableWR;
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1306
    bool enableSWWR;
571452
7639e5920ad23e9c7793e2f8448ccfab38904ac8 Bug 1698869 - Add pref to force WebRender to be used with all widgets. r=jrmuizel
Andrew Osmond <aosmond@mozilla.com>
parents: 570470
diff changeset
  1307
    if (supportsAcceleration ||
7639e5920ad23e9c7793e2f8448ccfab38904ac8 Bug 1698869 - Add pref to force WebRender to be used with all widgets. r=jrmuizel
Andrew Osmond <aosmond@mozilla.com>
parents: 570470
diff changeset
  1308
        StaticPrefs::gfx_webrender_unaccelerated_widget_force()) {
568647
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1309
      enableWR = gfx::gfxVars::UseWebRender();
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1310
      enableSWWR = gfx::gfxVars::UseSoftwareWebRender();
589644
425313809206add668132f5653c0bba3a91e79d5 Bug 1726562 - Remove option to disable software webrender for popups. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 589520
diff changeset
  1311
    } else {
568647
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1312
      enableWR = enableSWWR = gfx::gfxVars::UseWebRender();
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1313
    }
589151
f37913e7cb9295617b7e5a7ac5f462f29df583b4 Bug 1726063 - Remove support for non-WR compositor initialization. r=jrmuizel,aosmond
Matt Woodrow <mwoodrow@mozilla.com>
parents: 589150
diff changeset
  1314
    MOZ_RELEASE_ASSERT(enableWR);
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1315
    bool enableAPZ = UseAPZ();
589151
f37913e7cb9295617b7e5a7ac5f462f29df583b4 Bug 1726063 - Remove support for non-WR compositor initialization. r=jrmuizel,aosmond
Matt Woodrow <mwoodrow@mozilla.com>
parents: 589150
diff changeset
  1316
    CompositorOptions options(enableAPZ, enableSWWR);
568647
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1317
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1318
#ifdef XP_WIN
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1319
    if (supportsAcceleration) {
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1320
      options.SetAllowSoftwareWebRenderD3D11(
570410
10ca32d83c66663d73c0600ff90022e85f52b92b Bug 1697335 - Fallback from WebRender (Software D3D11) to WebRender (Software) when ID3D11Texture2D allocation of tile fails r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570371
diff changeset
  1321
          gfx::gfxVars::AllowSoftwareWebRenderD3D11());
568647
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1322
    }
570371
86e1b98e7f08ad341cffdb8b3e486c7dad0752eb Bug 1697155 - Add AllowSoftwareWebRenderOGL() to CompositorOptions to allow Software WebRender with CompositorOGL on a per widget basis r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570247
diff changeset
  1323
#elif defined(MOZ_WIDGET_ANDROID)
86e1b98e7f08ad341cffdb8b3e486c7dad0752eb Bug 1697155 - Add AllowSoftwareWebRenderOGL() to CompositorOptions to allow Software WebRender with CompositorOGL on a per widget basis r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570247
diff changeset
  1324
    MOZ_ASSERT(supportsAcceleration);
86e1b98e7f08ad341cffdb8b3e486c7dad0752eb Bug 1697155 - Add AllowSoftwareWebRenderOGL() to CompositorOptions to allow Software WebRender with CompositorOGL on a per widget basis r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570247
diff changeset
  1325
    options.SetAllowSoftwareWebRenderOGL(
86e1b98e7f08ad341cffdb8b3e486c7dad0752eb Bug 1697155 - Add AllowSoftwareWebRenderOGL() to CompositorOptions to allow Software WebRender with CompositorOGL on a per widget basis r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570247
diff changeset
  1326
        StaticPrefs::gfx_webrender_software_opengl_AtStartup());
570470
cf09ffcb9a9eecf6b090447d3536967fe2464b8c Bug 1697443 - Re-add SoftwareWebRender with CompositorOGL capability on Linux r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570410
diff changeset
  1327
#elif defined(MOZ_WIDGET_GTK)
cf09ffcb9a9eecf6b090447d3536967fe2464b8c Bug 1697443 - Re-add SoftwareWebRender with CompositorOGL capability on Linux r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570410
diff changeset
  1328
    if (supportsAcceleration) {
cf09ffcb9a9eecf6b090447d3536967fe2464b8c Bug 1697443 - Re-add SoftwareWebRender with CompositorOGL capability on Linux r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570410
diff changeset
  1329
      options.SetAllowSoftwareWebRenderOGL(
cf09ffcb9a9eecf6b090447d3536967fe2464b8c Bug 1697443 - Re-add SoftwareWebRender with CompositorOGL capability on Linux r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570410
diff changeset
  1330
          StaticPrefs::gfx_webrender_software_opengl_AtStartup());
cf09ffcb9a9eecf6b090447d3536967fe2464b8c Bug 1697443 - Re-add SoftwareWebRender with CompositorOGL capability on Linux r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 570410
diff changeset
  1331
    }
568647
7e0fefcb981cbb1a506a3f42654e2de9ef9256ee Bug 1688096 - Part 2. Add flag to CompositorOptions to allow SW-WR on a per widget basis. r=mattwoodrow
Andrew Osmond <aosmond@mozilla.com>
parents: 568148
diff changeset
  1332
#endif
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1333
418195
fb1644bd5755bd8493d850285f4994fbe732a1fd Bug 1453501 - Allow the compositor to be created in a paused state r=kats
James Willcox <snorp@snorp.net>
parents: 418138
diff changeset
  1334
#ifdef MOZ_WIDGET_ANDROID
fb1644bd5755bd8493d850285f4994fbe732a1fd Bug 1453501 - Allow the compositor to be created in a paused state r=kats
James Willcox <snorp@snorp.net>
parents: 418138
diff changeset
  1335
    if (!GetNativeData(NS_JAVA_SURFACE)) {
fb1644bd5755bd8493d850285f4994fbe732a1fd Bug 1453501 - Allow the compositor to be created in a paused state r=kats
James Willcox <snorp@snorp.net>
parents: 418138
diff changeset
  1336
      options.SetInitiallyPaused(true);
fb1644bd5755bd8493d850285f4994fbe732a1fd Bug 1453501 - Allow the compositor to be created in a paused state r=kats
James Willcox <snorp@snorp.net>
parents: 418138
diff changeset
  1337
    }
482872
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
  1338
#else
840b6bd9e818d5982c4560c9c712abef3a5d0cfe Bug 1565785 - Skip WR rendering until window becomes ready to draw on Wayland r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 482867
diff changeset
  1339
    options.SetInitiallyPaused(CompositorInitiallyPaused());
418195
fb1644bd5755bd8493d850285f4994fbe732a1fd Bug 1453501 - Allow the compositor to be created in a paused state r=kats
James Willcox <snorp@snorp.net>
parents: 418138
diff changeset
  1340
#endif
fb1644bd5755bd8493d850285f4994fbe732a1fd Bug 1453501 - Allow the compositor to be created in a paused state r=kats
James Willcox <snorp@snorp.net>
parents: 418138
diff changeset
  1341
591057
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1342
    RefPtr<WebRenderLayerManager> lm = new WebRenderLayerManager(this);
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1343
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1344
    bool retry = false;
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1345
    mCompositorSession = gpu->CreateTopLevelCompositor(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1346
        this, lm, GetDefaultScale(), options, UseExternalCompositingSurface(),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1347
        gfx::IntSize(aWidth, aHeight), &retry);
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1348
589151
f37913e7cb9295617b7e5a7ac5f462f29df583b4 Bug 1726063 - Remove support for non-WR compositor initialization. r=jrmuizel,aosmond
Matt Woodrow <mwoodrow@mozilla.com>
parents: 589150
diff changeset
  1349
    if (mCompositorSession) {
371699
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 369982
diff changeset
  1350
      TextureFactoryIdentifier textureFactoryIdentifier;
547789
fe5a386982266a8cd44984bac1dd4565fad0384a Bug 1662836 - Expose detailed initialization failure reason for WebRender. r=kvark
Andrew Osmond <aosmond@mozilla.com>
parents: 538158
diff changeset
  1351
      nsCString error;
591057
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1352
      lm->Initialize(mCompositorSession->GetCompositorBridgeChild(),
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1353
                     wr::AsPipelineId(mCompositorSession->RootLayerTreeId()),
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1354
                     &textureFactoryIdentifier, error);
371699
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 369982
diff changeset
  1355
      if (textureFactoryIdentifier.mParentBackend != LayersBackend::LAYERS_WR) {
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 369982
diff changeset
  1356
        retry = true;
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 369982
diff changeset
  1357
        DestroyCompositor();
531887
8c637aeb40e08e99f5a1ab40c1589f2968dbce75 Bug 1632357 - Use compositor window only when it is necessary r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 528970
diff changeset
  1358
        // gfxVars::UseDoubleBufferingWithCompositor() is also disabled.
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1359
        gfx::GPUProcessManager::Get()->DisableWebRender(
547789
fe5a386982266a8cd44984bac1dd4565fad0384a Bug 1662836 - Expose detailed initialization failure reason for WebRender. r=kvark
Andrew Osmond <aosmond@mozilla.com>
parents: 538158
diff changeset
  1360
            wr::WebRenderError::INITIALIZE, error);
371699
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 369982
diff changeset
  1361
      }
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 369982
diff changeset
  1362
    }
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 369982
diff changeset
  1363
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1364
    // We need to retry in a loop because the act of failing to create the
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1365
    // compositor can change our state (e.g. disable WebRender).
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1366
    if (mCompositorSession || !retry) {
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1367
      *aOptionsOut = options;
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1368
      return lm.forget();
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1369
    }
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1370
  } while (true);
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1371
}
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1372
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1373
void nsBaseWidget::CreateCompositor(int aWidth, int aHeight) {
209844
5c6980f9caff1c87e94cce5e67d0ef28f7e7d49c Bug 1064107 - Ensure that gfxPlatform is initialized by the time we create the compositor. r=Bas
Nicolas Silva <nsilva@mozilla.com>
parents: 206051
diff changeset
  1374
  // This makes sure that gfxPlatforms gets initialized if it hasn't by now.
5c6980f9caff1c87e94cce5e67d0ef28f7e7d49c Bug 1064107 - Ensure that gfxPlatform is initialized by the time we create the compositor. r=Bas
Nicolas Silva <nsilva@mozilla.com>
parents: 206051
diff changeset
  1375
  gfxPlatform::GetPlatform();
5c6980f9caff1c87e94cce5e67d0ef28f7e7d49c Bug 1064107 - Ensure that gfxPlatform is initialized by the time we create the compositor. r=Bas
Nicolas Silva <nsilva@mozilla.com>
parents: 206051
diff changeset
  1376
188737
bb0c777636e93ce8720dae30b9d54aad857f5486 Bug 774388 - Patch 4: Flatten the way that we track whether we are using OMTC, and move Layers IPC shutdown code back to gfxPlatform (but still triggered by ShutdownXPCOM) - r=nical,sotaro
Benoit Jacob <bjacob@mozilla.com>
parents: 187848
diff changeset
  1377
  MOZ_ASSERT(gfxPlatform::UsesOffMainThreadCompositing(),
bb0c777636e93ce8720dae30b9d54aad857f5486 Bug 774388 - Patch 4: Flatten the way that we track whether we are using OMTC, and move Layers IPC shutdown code back to gfxPlatform (but still triggered by ShutdownXPCOM) - r=nical,sotaro
Benoit Jacob <bjacob@mozilla.com>
parents: 187848
diff changeset
  1378
             "This function assumes OMTC");
bb0c777636e93ce8720dae30b9d54aad857f5486 Bug 774388 - Patch 4: Flatten the way that we track whether we are using OMTC, and move Layers IPC shutdown code back to gfxPlatform (but still triggered by ShutdownXPCOM) - r=nical,sotaro
Benoit Jacob <bjacob@mozilla.com>
parents: 187848
diff changeset
  1379
297876
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
  1380
  MOZ_ASSERT(!mCompositorSession && !mCompositorBridgeChild,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1381
             "Should have properly cleaned up the previous PCompositor pair "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1382
             "beforehand");
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
  1383
289895
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289653
diff changeset
  1384
  if (mCompositorBridgeChild) {
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289653
diff changeset
  1385
    mCompositorBridgeChild->Destroy();
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
  1386
  }
232528
0556bae4c05e67cf951f60d4058768a6f057803e Bug 1125848 - Reduce the likelyhood of a CompositorParent being destroyed without the proper shutdown sequence. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 232336
diff changeset
  1387
131392
d5a2a23786f57b09c707e17ef29dcca9410d194e Bug 830347 - Part 3: Integrate new D3D compositor into widget. r=jmathies
Bas Schouten <bschouten@mozilla.com>
parents: 131293
diff changeset
  1388
  // Recreating this is tricky, as we may still have an old and we need
d5a2a23786f57b09c707e17ef29dcca9410d194e Bug 830347 - Part 3: Integrate new D3D compositor into widget. r=jmathies
Bas Schouten <bschouten@mozilla.com>
parents: 131293
diff changeset
  1389
  // to make sure it's properly destroyed by calling DestroyCompositor!
d5a2a23786f57b09c707e17ef29dcca9410d194e Bug 830347 - Part 3: Integrate new D3D compositor into widget. r=jmathies
Bas Schouten <bschouten@mozilla.com>
parents: 131293
diff changeset
  1390
135289
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
  1391
  // If we've already received a shutdown notification, don't try
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
  1392
  // create a new compositor.
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
  1393
  if (!mShutdownObserver) {
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
  1394
    return;
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
  1395
  }
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135282
diff changeset
  1396
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1397
  CompositorOptions options;
591057
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1398
  RefPtr<WebRenderLayerManager> lm =
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1399
      CreateCompositorSession(aWidth, aHeight, &options);
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1400
  if (!lm) {
367736
a67e2718b0c535d6f3f863559108001e24cc397a Bug 1378956 - Don't try starting WebRender on widgets that have transparency. r=jrmuizel
Kartikaya Gupta <kgupta@mozilla.com>
parents: 366292
diff changeset
  1401
    return;
a67e2718b0c535d6f3f863559108001e24cc397a Bug 1378956 - Don't try starting WebRender on widgets that have transparency. r=jrmuizel
Kartikaya Gupta <kgupta@mozilla.com>
parents: 366292
diff changeset
  1402
  }
369982
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1403
05e705204d3bced8e56631b0ef6fe2abe65710c7 Bug 1381095 - Fallback correctly to non-WebRender if the GPU process/WebRender are disabled when creating a remote compositor session. r=dvander
Andrew Osmond <aosmond@mozilla.com>
parents: 369371
diff changeset
  1404
  MOZ_ASSERT(mCompositorSession);
297876
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
  1405
  mCompositorBridgeChild = mCompositorSession->GetCompositorBridgeChild();
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1406
  SetCompositorWidgetDelegate(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1407
      mCompositorSession->GetCompositorWidgetDelegate());
297876
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
  1408
329203
3d27c7cbcafa48642e0368319c563c4e32895242 Bug 1330037 - Introduce a CompositorOptions struct that holds options on a per-compositor basis. r=dvander
Kartikaya Gupta <kgupta@mozilla.com>
parents: 329067
diff changeset
  1409
  if (options.UseAPZ()) {
306172
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 306008
diff changeset
  1410
    mAPZC = mCompositorSession->GetAPZCTreeManager();
219723
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
  1411
    ConfigureAPZCTreeManager();
306172
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 306008
diff changeset
  1412
  } else {
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 306008
diff changeset
  1413
    mAPZC = nullptr;
219723
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
  1414
  }
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 216938
diff changeset
  1415
270087
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1416
  if (mInitialZoomConstraints) {
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1417
    UpdateZoomConstraints(mInitialZoomConstraints->mPresShellID,
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1418
                          mInitialZoomConstraints->mViewID,
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1419
                          Some(mInitialZoomConstraints->mConstraints));
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1420
    mInitialZoomConstraints.reset();
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1421
  }
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 269643
diff changeset
  1422
591057
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1423
  TextureFactoryIdentifier textureFactoryIdentifier =
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1424
      lm->GetTextureFactoryIdentifier();
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1425
  MOZ_ASSERT(textureFactoryIdentifier.mParentBackend ==
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1426
             LayersBackend::LAYERS_WR);
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1427
  ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
1b49e7328ae43c6565d167f4c391430575097fd3 Bug 1727682 - Make WebRenderLayerManager not inherit LayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 591041
diff changeset
  1428
  gfx::VRManagerChild::IdentifyTextureHost(textureFactoryIdentifier);
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84517
diff changeset
  1429
237012
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
  1430
  WindowUsesOMTC();
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 236994
diff changeset
  1431
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1432
  mWindowRenderer = std::move(lm);
253675
5b4aec6951dd81465c423029768a1d4880e20729 Add compositor, layers, and rendering info to nsIGfxInfo. (bug 1179051 part 5, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 253642
diff changeset
  1433
315986
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1434
  // Only track compositors for top-level windows, since other window types
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1435
  // may use the basic compositor.  Except on the OS X - see bug 1306383
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1436
#if defined(XP_MACOSX)
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1437
  bool getCompositorFromThisWindow = true;
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1438
#else
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1439
  bool getCompositorFromThisWindow = (mWindowType == eWindowType_toplevel);
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1440
#endif
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1441
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 315838
diff changeset
  1442
  if (getCompositorFromThisWindow) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1443
    gfxPlatform::GetPlatform()->NotifyCompositorCreated(
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1444
        mWindowRenderer->GetCompositorBackendType());
266224
f6dfce68d9e6d67cdff0630cb90f31a8b40d5653 Allow top-level window changes to the remembered compositor type. (bug 1211109 part 3, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 266143
diff changeset
  1445
  }
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84517
diff changeset
  1446
}
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84517
diff changeset
  1447
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1448
void nsBaseWidget::NotifyCompositorSessionLost(CompositorSession* aSession) {
314601
5ac08fb77360da01e694dd3fb5fef07a64173298 Recreate widget compositors when the GPU process dies. (bug 1300936 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314359
diff changeset
  1449
  MOZ_ASSERT(aSession == mCompositorSession);
5ac08fb77360da01e694dd3fb5fef07a64173298 Recreate widget compositors when the GPU process dies. (bug 1300936 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314359
diff changeset
  1450
  DestroyLayerManager();
5ac08fb77360da01e694dd3fb5fef07a64173298 Recreate widget compositors when the GPU process dies. (bug 1300936 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314359
diff changeset
  1451
}
5ac08fb77360da01e694dd3fb5fef07a64173298 Recreate widget compositors when the GPU process dies. (bug 1300936 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314359
diff changeset
  1452
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1453
bool nsBaseWidget::ShouldUseOffMainThreadCompositing() {
188737
bb0c777636e93ce8720dae30b9d54aad857f5486 Bug 774388 - Patch 4: Flatten the way that we track whether we are using OMTC, and move Layers IPC shutdown code back to gfxPlatform (but still triggered by ShutdownXPCOM) - r=nical,sotaro
Benoit Jacob <bjacob@mozilla.com>
parents: 187848
diff changeset
  1454
  return gfxPlatform::UsesOffMainThreadCompositing();
94601
b2673bce4ba17b3a73adb7078579f76f95beabb9 Bug 722012 - Added a call to XInitThreads before the first call to XOpenDisplay to fix OMTC crashes. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94475
diff changeset
  1455
}
b2673bce4ba17b3a73adb7078579f76f95beabb9 Bug 722012 - Added a call to XInitThreads before the first call to XOpenDisplay to fix OMTC crashes. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94475
diff changeset
  1456
586492
76ccadcf74235eea28f88592488e3b908773c1b2 Bug 1721537 - Split out WindowRenderer base class from LayerManager. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 586491
diff changeset
  1457
WindowRenderer* nsBaseWidget::GetWindowRenderer() {
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1458
  if (!mWindowRenderer) {
263023
c6b0c072e68fd44eb1771e6fd481e20048cde301 Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 262345
diff changeset
  1459
    if (!mShutdownObserver) {
c6b0c072e68fd44eb1771e6fd481e20048cde301 Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 262345
diff changeset
  1460
      // We are shutting down, do not try to re-create a LayerManager
c6b0c072e68fd44eb1771e6fd481e20048cde301 Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 262345
diff changeset
  1461
      return nullptr;
c6b0c072e68fd44eb1771e6fd481e20048cde301 Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 262345
diff changeset
  1462
    }
95307
bea5301cf21fdd3f97fc407dda193edd7164bcc9 Bug 703484 - Part 1: Allow OMTC to be used with basic layers. r=bgirard
Marco Castelluccio <mar.castelluccio@studenti.unina.it>
parents: 94715
diff changeset
  1463
    // Try to use an async compositor first, if possible
123702
1473f6edfcad0377b376461adc7a01937a7e9609 Bug 839808 - Add support for omtc to winrt widget. r=bbondy
Jim Mathies <jmathies@mozilla.com>
parents: 122984
diff changeset
  1464
    if (ShouldUseOffMainThreadCompositing()) {
95307
bea5301cf21fdd3f97fc407dda193edd7164bcc9 Bug 703484 - Part 1: Allow OMTC to be used with basic layers. r=bgirard
Marco Castelluccio <mar.castelluccio@studenti.unina.it>
parents: 94715
diff changeset
  1465
      CreateCompositor();
bea5301cf21fdd3f97fc407dda193edd7164bcc9 Bug 703484 - Part 1: Allow OMTC to be used with basic layers. r=bgirard
Marco Castelluccio <mar.castelluccio@studenti.unina.it>
parents: 94715
diff changeset
  1466
    }
84910
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84517
diff changeset
  1467
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1468
    if (!mWindowRenderer) {
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1469
      mWindowRenderer = CreateBasicLayerManager();
40028
413031db087e8d0a2be0774bfa17e5a88b0e350e Bug 556027: Add the ability to enable accelerated layers backends for specific top-level widgets. r=roc
Bas Schouten <bschouten@mozilla.com>
parents: 39492
diff changeset
  1470
    }
38805
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
  1471
  }
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1472
  return mWindowRenderer;
38805
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
  1473
}
c85d57ea1d37fdfea1ba14d487df44bf66acad3a Bug 534425. Part 6: Let nsIWidgets expose a LayerManager to be used to render into the widget, instead of nsPaintEvent::renderingContext which is removed since it's no longer needed. Currently all widgets fall back to a default BasicLayerManager implementation. Also change nsPaintEvent::region to be an nsIntRegion, and get rid of nsPaintEvent::rect since it's redundant.
Robert O'Callahan <robert@ocallahan.org>
parents: 37815
diff changeset
  1474
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1475
WindowRenderer* nsBaseWidget::CreateBasicLayerManager() {
589150
7398bc391379a76e4bdde7dd13b0410ea7137ad7 Bug 1726063 - Remove option to use BasicLayerManager. r=jrmuizel
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587870
diff changeset
  1476
  return new FallbackRenderer;
54111
bd2a2bf17e5e583759494e617322d6886e360048 Bug 596410: Use BasicShadowLayerManager when there might be content processes. r=vlad
Chris Jones <jones.chris.g@gmail.com>
parents: 54097
diff changeset
  1477
}
bd2a2bf17e5e583759494e617322d6886e360048 Bug 596410: Use BasicShadowLayerManager when there might be content processes. r=vlad
Chris Jones <jones.chris.g@gmail.com>
parents: 54097
diff changeset
  1478
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1479
CompositorBridgeChild* nsBaseWidget::GetRemoteRenderer() {
289895
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 289653
diff changeset
  1480
  return mCompositorBridgeChild;
109218
abefcbf2f2ee3b3feefe42fcae7e8b142255e057 Bug 780920, part 2: Let clients query a widget's 'real' compositor, when the widget doesn't draw directly to its OS window. r=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 108849
diff changeset
  1481
}
abefcbf2f2ee3b3feefe42fcae7e8b142255e057 Bug 780920, part 2: Let clients query a widget's 'real' compositor, when the widget doesn't draw directly to its OS window. r=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 108849
diff changeset
  1482
528970
3dd35da1c8bee1353c935e045e7518bc01ea3e77 Bug 1635769 - Call WebRenderLayerManager::ClearCachedResources() during re-creating widget r=tnikkel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 528946
diff changeset
  1483
void nsBaseWidget::ClearCachedWebrenderResources() {
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1484
  if (!mWindowRenderer || !mWindowRenderer->AsWebRender()) {
528970
3dd35da1c8bee1353c935e045e7518bc01ea3e77 Bug 1635769 - Call WebRenderLayerManager::ClearCachedResources() during re-creating widget r=tnikkel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 528946
diff changeset
  1485
    return;
3dd35da1c8bee1353c935e045e7518bc01ea3e77 Bug 1635769 - Call WebRenderLayerManager::ClearCachedResources() during re-creating widget r=tnikkel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 528946
diff changeset
  1486
  }
587869
e8299f04430316b8ed5a73b8b9f0e824dfe84f38 Bug 1722258 - Convert more LayerManager usage to use WindowRenderer. r=miko
Matt Woodrow <mwoodrow@mozilla.com>
parents: 587301
diff changeset
  1487
  mWindowRenderer->AsWebRender()->ClearCachedResources();
528970
3dd35da1c8bee1353c935e045e7518bc01ea3e77 Bug 1635769 - Call WebRenderLayerManager::ClearCachedResources() during re-creating widget r=tnikkel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 528946
diff changeset
  1488
}
3dd35da1c8bee1353c935e045e7518bc01ea3e77 Bug 1635769 - Call WebRenderLayerManager::ClearCachedResources() during re-creating widget r=tnikkel
sotaro <sotaro.ikeda.g@gmail.com>
parents: 528946
diff changeset
  1489
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1490
already_AddRefed<gfx::DrawTarget> nsBaseWidget::StartRemoteDrawing() {
137807
9f542b4bfbfa80855d91bfb3db64168bf5c5bb67 Bug 882523 - Support OMTC on Mac in non-accelerated mode using OpenGL. r=nrc, r=mattwoodrow
Markus Stange <mstange@themasta.com>
parents: 137350
diff changeset
  1491
  return nullptr;
9f542b4bfbfa80855d91bfb3db64168bf5c5bb67 Bug 882523 - Support OMTC on Mac in non-accelerated mode using OpenGL. r=nrc, r=mattwoodrow
Markus Stange <mstange@themasta.com>
parents: 137350
diff changeset
  1492
}
9f542b4bfbfa80855d91bfb3db64168bf5c5bb67 Bug 882523 - Support OMTC on Mac in non-accelerated mode using OpenGL. r=nrc, r=mattwoodrow
Markus Stange <mstange@themasta.com>
parents: 137350
diff changeset
  1493
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1494
uint32_t nsBaseWidget::GetGLFrameBufferFormat() { return LOCAL_GL_RGBA; }
295585
304b1365d2d73af93e87322caaaca0ff148b31ef Move CompositorWidgetProxy inheritance out of nsIWidget. (bug 1264545 part 6, r=jimm)
David Anderson <danderson@mozilla.com>
parents: 295584
diff changeset
  1495
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1496
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1497
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1498
// Destroy the window
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1499
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1500
//-------------------------------------------------------------------------
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1501
void nsBaseWidget::OnDestroy() {
226207
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
  1502
  if (mTextEventDispatcher) {
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
  1503
    mTextEventDispatcher->OnDestroyWidget();
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
  1504
    // Don't release it until this widget actually released because after this
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
  1505
    // is called, TextEventDispatcher() may create it again.
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
  1506
  }
294607
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 294284
diff changeset
  1507
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 294284
diff changeset
  1508
  // If this widget is being destroyed, let the APZ code know to drop references
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 294284
diff changeset
  1509
  // to this widget. Callers of this function all should be holding a deathgrip
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 294284
diff changeset
  1510
  // on this widget already.
303040
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 302811
diff changeset
  1511
  ReleaseContentController();
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1512
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1513
521550
aeb210f9a9dab49522be8c0a07cd2bbd7eccd0ab Bug 1616245 - Change a few nsIWidget functions to take strongly-typed arguments. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520787
diff changeset
  1514
void nsBaseWidget::MoveClient(const DesktopPoint& aOffset) {
272459
cfde91a29f0357a661370fb2742b8d209856a76d Bug 1224403 (part 2) - Split GetClientOffset() into typed and untyped versions. r=kats.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 272066
diff changeset
  1515
  LayoutDeviceIntPoint clientOffset(GetClientOffset());
128792
deab88ac216ae3eda801a89821e4b00548a801ba bug 861403 - fix mixing of device pixels with global display pixels in MoveClient and ResizeClient calculations. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 128274
diff changeset
  1516
279789
b9c868d65f75d92d68a34c49ef326fb493ff0c59 Bug 890156 - patch 0.1 - Switch from 'display pixels' to 'desktop pixels' terminology in widget code. r=kats
Jonathan Kew <jkew@mozilla.com>
parents: 277570
diff changeset
  1517
  // GetClientOffset returns device pixels; scale back to desktop pixels
128792
deab88ac216ae3eda801a89821e4b00548a801ba bug 861403 - fix mixing of device pixels with global display pixels in MoveClient and ResizeClient calculations. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 128274
diff changeset
  1518
  // if that's what this widget uses for the Move/Resize APIs
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1519
  if (BoundsUseDesktopPixels()) {
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1520
    DesktopPoint desktopOffset = clientOffset / GetDesktopToDeviceScale();
521550
aeb210f9a9dab49522be8c0a07cd2bbd7eccd0ab Bug 1616245 - Change a few nsIWidget functions to take strongly-typed arguments. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520787
diff changeset
  1521
    Move(aOffset.x - desktopOffset.x, aOffset.y - desktopOffset.y);
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1522
  } else {
521551
1d7a69ff37936b99eed541ff81aedd1c9053bf28 Bug 1616245 - Fix unit mismatches by applying an appropriate scaling factor. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 521550
diff changeset
  1523
    LayoutDevicePoint layoutOffset = aOffset * GetDesktopToDeviceScale();
1d7a69ff37936b99eed541ff81aedd1c9053bf28 Bug 1616245 - Fix unit mismatches by applying an appropriate scaling factor. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 521550
diff changeset
  1524
    Move(layoutOffset.x - clientOffset.x, layoutOffset.y - clientOffset.y);
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1525
  }
81120
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81115
diff changeset
  1526
}
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81115
diff changeset
  1527
521550
aeb210f9a9dab49522be8c0a07cd2bbd7eccd0ab Bug 1616245 - Change a few nsIWidget functions to take strongly-typed arguments. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520787
diff changeset
  1528
void nsBaseWidget::ResizeClient(const DesktopSize& aSize, bool aRepaint) {
aeb210f9a9dab49522be8c0a07cd2bbd7eccd0ab Bug 1616245 - Change a few nsIWidget functions to take strongly-typed arguments. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520787
diff changeset
  1529
  NS_ASSERTION((aSize.width >= 0), "Negative width passed to ResizeClient");
aeb210f9a9dab49522be8c0a07cd2bbd7eccd0ab Bug 1616245 - Change a few nsIWidget functions to take strongly-typed arguments. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520787
diff changeset
  1530
  NS_ASSERTION((aSize.height >= 0), "Negative height passed to ResizeClient");
81120
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81115
diff changeset
  1531
310240
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310239
diff changeset
  1532
  LayoutDeviceIntRect clientBounds = GetClientBounds();
523054
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1533
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1534
  // GetClientBounds and mBounds are device pixels; scale back to desktop pixels
128792
deab88ac216ae3eda801a89821e4b00548a801ba bug 861403 - fix mixing of device pixels with global display pixels in MoveClient and ResizeClient calculations. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 128274
diff changeset
  1535
  // if that's what this widget uses for the Move/Resize APIs
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1536
  if (BoundsUseDesktopPixels()) {
523054
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1537
    DesktopSize desktopDelta =
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1538
        (LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()) -
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1539
         clientBounds.Size()) /
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1540
        GetDesktopToDeviceScale();
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1541
    Resize(aSize.width + desktopDelta.width, aSize.height + desktopDelta.height,
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1542
           aRepaint);
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1543
  } else {
521551
1d7a69ff37936b99eed541ff81aedd1c9053bf28 Bug 1616245 - Fix unit mismatches by applying an appropriate scaling factor. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 521550
diff changeset
  1544
    LayoutDeviceSize layoutSize = aSize * GetDesktopToDeviceScale();
523054
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1545
    Resize(mBounds.Width() + (layoutSize.width - clientBounds.Width()),
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1546
           mBounds.Height() + (layoutSize.height - clientBounds.Height()),
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1547
           aRepaint);
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1548
  }
81120
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81115
diff changeset
  1549
}
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81115
diff changeset
  1550
521550
aeb210f9a9dab49522be8c0a07cd2bbd7eccd0ab Bug 1616245 - Change a few nsIWidget functions to take strongly-typed arguments. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520787
diff changeset
  1551
void nsBaseWidget::ResizeClient(const DesktopRect& aRect, bool aRepaint) {
aeb210f9a9dab49522be8c0a07cd2bbd7eccd0ab Bug 1616245 - Change a few nsIWidget functions to take strongly-typed arguments. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520787
diff changeset
  1552
  NS_ASSERTION((aRect.Width() >= 0), "Negative width passed to ResizeClient");
aeb210f9a9dab49522be8c0a07cd2bbd7eccd0ab Bug 1616245 - Change a few nsIWidget functions to take strongly-typed arguments. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520787
diff changeset
  1553
  NS_ASSERTION((aRect.Height() >= 0), "Negative height passed to ResizeClient");
81120
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81115
diff changeset
  1554
310240
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310239
diff changeset
  1555
  LayoutDeviceIntRect clientBounds = GetClientBounds();
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310239
diff changeset
  1556
  LayoutDeviceIntPoint clientOffset = GetClientOffset();
521551
1d7a69ff37936b99eed541ff81aedd1c9053bf28 Bug 1616245 - Fix unit mismatches by applying an appropriate scaling factor. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 521550
diff changeset
  1557
  DesktopToLayoutDeviceScale scale = GetDesktopToDeviceScale();
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1558
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1559
  if (BoundsUseDesktopPixels()) {
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1560
    DesktopPoint desktopOffset = clientOffset / scale;
523054
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1561
    DesktopSize desktopDelta =
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1562
        (LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()) -
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1563
         clientBounds.Size()) /
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1564
        scale;
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1565
    Resize(aRect.X() - desktopOffset.x, aRect.Y() - desktopOffset.y,
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1566
           aRect.Width() + desktopDelta.width,
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1567
           aRect.Height() + desktopDelta.height, aRepaint);
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1568
  } else {
521551
1d7a69ff37936b99eed541ff81aedd1c9053bf28 Bug 1616245 - Fix unit mismatches by applying an appropriate scaling factor. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 521550
diff changeset
  1569
    LayoutDeviceRect layoutRect = aRect * scale;
523054
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1570
    Resize(layoutRect.X() - clientOffset.x, layoutRect.Y() - clientOffset.y,
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1571
           layoutRect.Width() + mBounds.Width() - clientBounds.Width(),
75323c5f1047c579989b6a0dabd8fa29c854c869 Backed out 2 changesets (bug 1616245) for causing a raise in browser chrome failures. CLOSED TREE
Cosmin Sabou <csabou@mozilla.com>
parents: 523007
diff changeset
  1572
           layoutRect.Height() + mBounds.Height() - clientBounds.Height(),
521551
1d7a69ff37936b99eed541ff81aedd1c9053bf28 Bug 1616245 - Fix unit mismatches by applying an appropriate scaling factor. r=jfkthame
Kartikaya Gupta <kgupta@mozilla.com>
parents: 521550
diff changeset
  1573
           aRepaint);
279795
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 279792
diff changeset
  1574
  }
81120
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81115
diff changeset
  1575
}
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81115
diff changeset
  1576
46198
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1577
//-------------------------------------------------------------------------
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1578
//
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1579
// Bounds
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1580
//
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1581
//-------------------------------------------------------------------------
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1582
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1583
/**
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1584
 * If the implementation of nsWindow supports borders this method MUST be
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1585
 * overridden
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1586
 *
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1587
 **/
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1588
LayoutDeviceIntRect nsBaseWidget::GetClientBounds() { return GetBounds(); }
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1589
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1590
/**
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1591
 * If the implementation of nsWindow supports borders this method MUST be
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1592
 * overridden
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1593
 *
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1594
 **/
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1595
LayoutDeviceIntRect nsBaseWidget::GetBounds() { return mBounds; }
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1596
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1597
/**
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1598
 * If the implementation of nsWindow uses a local coordinate system within the
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1599
 *window, this method must be overridden
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1600
 *
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1601
 **/
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1602
LayoutDeviceIntRect nsBaseWidget::GetScreenBounds() { return GetBounds(); }
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1603
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1604
nsresult nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect& aRect) {
183835
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 183697
diff changeset
  1605
  if (SizeMode() != nsSizeMode_Normal) {
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 183697
diff changeset
  1606
    return NS_ERROR_FAILURE;
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 183697
diff changeset
  1607
  }
310240
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310239
diff changeset
  1608
  aRect = GetScreenBounds();
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310239
diff changeset
  1609
  return NS_OK;
183835
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 183697
diff changeset
  1610
}
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 183697
diff changeset
  1611
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1612
LayoutDeviceIntPoint nsBaseWidget::GetClientOffset() {
272746
e49cd993ae2a456bdb2ad126dfccb7aa09d3d9ff Bug 1224482 (part 3) - Replace GetClientOffsetUntyped() with GetClientOffset(). r=kats.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 272744
diff changeset
  1613
  return LayoutDeviceIntPoint(0, 0);
46192
30ecff316b34836ee80542f3fc732a10d185e497 Bug 513162 - Widget additions for recycling top level widgets as content containers. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 42226
diff changeset
  1614
}
30ecff316b34836ee80542f3fc732a10d185e497 Bug 513162 - Widget additions for recycling top level widgets as content containers. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 42226
diff changeset
  1615
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1616
nsresult nsBaseWidget::SetNonClientMargins(LayoutDeviceIntMargin& margins) {
46198
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1617
  return NS_ERROR_NOT_IMPLEMENTED;
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1618
}
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1619
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1620
uint32_t nsBaseWidget::GetMaxTouchPoints() const { return 0; }
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1621
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1622
bool nsBaseWidget::HasPendingInputEvent() { return false; }
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1623
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1624
bool nsBaseWidget::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) {
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78821
diff changeset
  1625
  return false;
16520
ca7df626c426c53c4195f62038b69fef060f02da Bug 56488 - Down scroll arrow hidden, draws behind resize widget when neither Status Bar nor horizontal scrollbar are displayed. r+sr=roc.
Markus Stange <mstange@themasta.com>
parents: 14886
diff changeset
  1626
}
ca7df626c426c53c4195f62038b69fef060f02da Bug 56488 - Down scroll arrow hidden, draws behind resize widget when neither Status Bar nor horizontal scrollbar are displayed. r+sr=roc.
Markus Stange <mstange@themasta.com>
parents: 14886
diff changeset
  1627
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1628
/**
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1629
 * Modifies aFile to point at an icon file with the given name and suffix.  The
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1630
 * suffix may correspond to a file extension with leading '.' if appropriate.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1631
 * Returns true if the icon file exists and can be read.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1632
 */
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1633
static bool ResolveIconNameHelper(nsIFile* aFile, const nsAString& aIconName,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1634
                                  const nsAString& aIconSuffix) {
538158
3f8100fb74318f9e0b3b6351ade737994d13bcf8 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Simon Giesecke <sgiesecke@mozilla.com>
parents: 535009
diff changeset
  1635
  aFile->Append(u"icons"_ns);
3f8100fb74318f9e0b3b6351ade737994d13bcf8 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Simon Giesecke <sgiesecke@mozilla.com>
parents: 535009
diff changeset
  1636
  aFile->Append(u"default"_ns);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1637
  aFile->Append(aIconName + aIconSuffix);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1638
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77129
diff changeset
  1639
  bool readable;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1640
  return NS_SUCCEEDED(aFile->IsReadable(&readable)) && readable;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1641
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1642
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1643
/**
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1644
 * Resolve the given icon name into a local file object.  This method is
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1645
 * intended to be called by subclasses of nsBaseWidget.  aIconSuffix is a
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1646
 * platform specific icon file suffix (e.g., ".ico" under Win32).
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1647
 *
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1648
 * If no file is found matching the given parameters, then null is returned.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1649
 */
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1650
void nsBaseWidget::ResolveIconName(const nsAString& aIconName,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1651
                                   const nsAString& aIconSuffix,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1652
                                   nsIFile** aResult) {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100323
diff changeset
  1653
  *aResult = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1654
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1655
  nsCOMPtr<nsIProperties> dirSvc =
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1656
      do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1657
  if (!dirSvc) return;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1658
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1659
  // first check auxilary chrome directories
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1660
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1661
  nsCOMPtr<nsISimpleEnumerator> dirs;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1662
  dirSvc->Get(NS_APP_CHROME_DIR_LIST, NS_GET_IID(nsISimpleEnumerator),
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1663
              getter_AddRefs(dirs));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1664
  if (dirs) {
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77129
diff changeset
  1665
    bool hasMore;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1666
    while (NS_SUCCEEDED(dirs->HasMoreElements(&hasMore)) && hasMore) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1667
      nsCOMPtr<nsISupports> element;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1668
      dirs->GetNext(getter_AddRefs(element));
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1669
      if (!element) continue;
95826
a15d75939cd5d820507656f64edae9a18e10918e Bug 749930 - Replace uses of nsILocalFile with nsIFile (compiled code only); r=bsmedberg
Geoff Lankow <geoff@darktrojan.net>
parents: 95441
diff changeset
  1670
      nsCOMPtr<nsIFile> file = do_QueryInterface(element);
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1671
      if (!file) continue;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1672
      if (ResolveIconNameHelper(file, aIconName, aIconSuffix)) {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1673
        NS_ADDREF(*aResult = file);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1674
        return;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1675
      }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1676
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1677
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1678
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1679
  // then check the main app chrome directory
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1680
95826
a15d75939cd5d820507656f64edae9a18e10918e Bug 749930 - Replace uses of nsILocalFile with nsIFile (compiled code only); r=bsmedberg
Geoff Lankow <geoff@darktrojan.net>
parents: 95441
diff changeset
  1681
  nsCOMPtr<nsIFile> file;
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1682
  dirSvc->Get(NS_APP_CHROME_DIR, NS_GET_IID(nsIFile), getter_AddRefs(file));
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1683
  if (file && ResolveIconNameHelper(file, aIconName, aIconSuffix))
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1684
    NS_ADDREF(*aResult = file);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1685
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1686
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1687
void nsBaseWidget::SetSizeConstraints(const SizeConstraints& aConstraints) {
100929
b8a0228a10faac7d965155e15bd66ff8bf3ddb82 Bug 357725, support minimum and maximum size constraints on windows and popups, r=mats,jmathies,karlt,smichaud,sr=neil
Neil Deakin <neil@mozilla.com>
parents: 100920
diff changeset
  1688
  mSizeConstraints = aConstraints;
411813
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1689
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1690
  // Popups are constrained during layout, and we don't want to synchronously
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1691
  // paint from reflow, so bail out... This is not great, but it's no worse than
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1692
  // what we used to do.
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1693
  //
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1694
  // The right fix here is probably making constraint changes go through the
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1695
  // view manager and such.
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1696
  if (mWindowType == eWindowType_popup) {
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1697
    return;
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1698
  }
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1699
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1700
  // If the current size doesn't meet the new constraints, trigger a
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1701
  // resize to apply it. Note that, we don't want to invoke Resize if
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1702
  // the new constraints don't affect the current size, because Resize
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1703
  // implementation on some platforms may touch other geometry even if
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1704
  // the size don't need to change.
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1705
  LayoutDeviceIntSize curSize = mBounds.Size();
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1706
  LayoutDeviceIntSize clampedSize =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1707
      Max(aConstraints.mMinSize, Min(aConstraints.mMaxSize, curSize));
411813
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1708
  if (clampedSize != curSize) {
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1709
    gfx::Size size;
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1710
    if (BoundsUseDesktopPixels()) {
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1711
      DesktopSize desktopSize = clampedSize / GetDesktopToDeviceScale();
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1712
      size = desktopSize.ToUnknownSize();
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1713
    } else {
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1714
      size = gfx::Size(clampedSize.ToUnknownSize());
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1715
    }
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1716
    Resize(size.width, size.height, true);
150ed033741d5067c2d4fd242e43a13447869542 Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz
Xidorn Quan <me@upsuper.org>
parents: 409886
diff changeset
  1717
  }
100929
b8a0228a10faac7d965155e15bd66ff8bf3ddb82 Bug 357725, support minimum and maximum size constraints on windows and popups, r=mats,jmathies,karlt,smichaud,sr=neil
Neil Deakin <neil@mozilla.com>
parents: 100920
diff changeset
  1718
}
b8a0228a10faac7d965155e15bd66ff8bf3ddb82 Bug 357725, support minimum and maximum size constraints on windows and popups, r=mats,jmathies,karlt,smichaud,sr=neil
Neil Deakin <neil@mozilla.com>
parents: 100920
diff changeset
  1719
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1720
const widget::SizeConstraints nsBaseWidget::GetSizeConstraints() {
100929
b8a0228a10faac7d965155e15bd66ff8bf3ddb82 Bug 357725, support minimum and maximum size constraints on windows and popups, r=mats,jmathies,karlt,smichaud,sr=neil
Neil Deakin <neil@mozilla.com>
parents: 100920
diff changeset
  1721
  return mSizeConstraints;
b8a0228a10faac7d965155e15bd66ff8bf3ddb82 Bug 357725, support minimum and maximum size constraints on windows and popups, r=mats,jmathies,karlt,smichaud,sr=neil
Neil Deakin <neil@mozilla.com>
parents: 100920
diff changeset
  1722
}
b8a0228a10faac7d965155e15bd66ff8bf3ddb82 Bug 357725, support minimum and maximum size constraints on windows and popups, r=mats,jmathies,karlt,smichaud,sr=neil
Neil Deakin <neil@mozilla.com>
parents: 100920
diff changeset
  1723
111530
6a9691cfc118dc485a8df23c46738c55a4708401 Bug 701760, merge <select> and popup manager rollup handling, so that select elements don't cancel out any popup rollup listeners, r=mats
Neil Deakin <neil@mozilla.com>
parents: 110604
diff changeset
  1724
// static
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1725
nsIRollupListener* nsBaseWidget::GetActiveRollupListener() {
111530
6a9691cfc118dc485a8df23c46738c55a4708401 Bug 701760, merge <select> and popup manager rollup handling, so that select elements don't cancel out any popup rollup listeners, r=mats
Neil Deakin <neil@mozilla.com>
parents: 110604
diff changeset
  1726
  // If set, then this is likely an <html:select> dropdown.
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1727
  if (gRollupListener) return gRollupListener;
111530
6a9691cfc118dc485a8df23c46738c55a4708401 Bug 701760, merge <select> and popup manager rollup handling, so that select elements don't cancel out any popup rollup listeners, r=mats
Neil Deakin <neil@mozilla.com>
parents: 110604
diff changeset
  1728
6a9691cfc118dc485a8df23c46738c55a4708401 Bug 701760, merge <select> and popup manager rollup handling, so that select elements don't cancel out any popup rollup listeners, r=mats
Neil Deakin <neil@mozilla.com>
parents: 110604
diff changeset
  1729
  return nsXULPopupManager::GetInstance();
6a9691cfc118dc485a8df23c46738c55a4708401 Bug 701760, merge <select> and popup manager rollup handling, so that select elements don't cancel out any popup rollup listeners, r=mats
Neil Deakin <neil@mozilla.com>
parents: 110604
diff changeset
  1730
}
6a9691cfc118dc485a8df23c46738c55a4708401 Bug 701760, merge <select> and popup manager rollup handling, so that select elements don't cancel out any popup rollup listeners, r=mats
Neil Deakin <neil@mozilla.com>
parents: 110604
diff changeset
  1731
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1732
void nsBaseWidget::NotifyWindowDestroyed() {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1733
  if (!mWidgetListener) return;
102463
448410c2035ef7bce315bb6b3c46f60fb909145e Bug 743975 - use a widget listener interface instead of the remaining events that don't need an event, r=tn,jmathies,netzen,smichaud,karlt,blassey,chrisjones
Neil Deakin <neil@mozilla.com>
parents: 102462
diff changeset
  1734
500633
0e3e0d51aaf6eee8f95fde1dd93849ce732f96e1 Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug
Brendan Dahl <bdahl@mozilla.com>
parents: 500516
diff changeset
  1735
  nsCOMPtr<nsIAppWindow> window = mWidgetListener->GetAppWindow();
0e3e0d51aaf6eee8f95fde1dd93849ce732f96e1 Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug
Brendan Dahl <bdahl@mozilla.com>
parents: 500516
diff changeset
  1736
  nsCOMPtr<nsIBaseWindow> appWindow(do_QueryInterface(window));
0e3e0d51aaf6eee8f95fde1dd93849ce732f96e1 Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug
Brendan Dahl <bdahl@mozilla.com>
parents: 500516
diff changeset
  1737
  if (appWindow) {
0e3e0d51aaf6eee8f95fde1dd93849ce732f96e1 Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug
Brendan Dahl <bdahl@mozilla.com>
parents: 500516
diff changeset
  1738
    appWindow->Destroy();
102462
481e19da0409a2979bf4a17449ae6f1b066274f6 Bug 743975 - remove NS_DESTROY event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102461
diff changeset
  1739
  }
481e19da0409a2979bf4a17449ae6f1b066274f6 Bug 743975 - remove NS_DESTROY event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102461
diff changeset
  1740
}
481e19da0409a2979bf4a17449ae6f1b066274f6 Bug 743975 - remove NS_DESTROY event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102461
diff changeset
  1741
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1742
void nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY) {
171434
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 171425
diff changeset
  1743
  if (mWidgetListener) {
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 171425
diff changeset
  1744
    mWidgetListener->WindowMoved(this, aX, aY);
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 171425
diff changeset
  1745
  }
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 171425
diff changeset
  1746
354225
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 353235
diff changeset
  1747
  if (mIMEHasFocus && IMENotificationRequestsRef().WantPositionChanged()) {
171434
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 171425
diff changeset
  1748
    NotifyIME(IMENotification(IMEMessage::NOTIFY_IME_OF_POSITION_CHANGE));
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 171425
diff changeset
  1749
  }
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 171425
diff changeset
  1750
}
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 171425
diff changeset
  1751
472192
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1752
void nsBaseWidget::NotifySizeMoveDone() {
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1753
  if (!mWidgetListener) {
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1754
    return;
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1755
  }
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1756
  if (PresShell* presShell = mWidgetListener->GetPresShell()) {
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1757
    presShell->WindowSizeMoveDone();
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1758
  }
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1759
}
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1760
554601
a7080bae91c109472da36f0d197add5746b1be06 Bug 1668875 - Distinguish theme changes that can and cannot affect style/layout. r=tnikkel
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 551066
diff changeset
  1761
void nsBaseWidget::NotifyThemeChanged(ThemeChangeKind aKind) {
472192
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1762
  if (!mWidgetListener) {
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1763
    return;
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1764
  }
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1765
  if (PresShell* presShell = mWidgetListener->GetPresShell()) {
554601
a7080bae91c109472da36f0d197add5746b1be06 Bug 1668875 - Distinguish theme changes that can and cannot affect style/layout. r=tnikkel
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 551066
diff changeset
  1766
    presShell->ThemeChanged(aKind);
472192
81f1c693b2dd58da05c719269dfbde369ed127db Bug 1547422 - Make widget use mozilla::PresShell directly rather than via nsIPresShell r=jmathies
Masayuki Nakano <masayuki@d-toybox.com>
parents: 470938
diff changeset
  1767
  }
102458
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102354
diff changeset
  1768
}
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102354
diff changeset
  1769
476652
8d2dcfb9a9b65fefb90354d5208eef08df60a96d Bug 1545499 - Remove dead code for threading accelerator state. r=NeilDeakin
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 475635
diff changeset
  1770
void nsBaseWidget::NotifyUIStateChanged(UIStateChangeType aShowFocusRings) {
452446
f0a91d36587266d7454a450c6044d573664fbed5 Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 449380
diff changeset
  1771
  if (Document* doc = GetDocument()) {
476652
8d2dcfb9a9b65fefb90354d5208eef08df60a96d Bug 1545499 - Remove dead code for threading accelerator state. r=NeilDeakin
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 475635
diff changeset
  1772
    if (nsPIDOMWindowOuter* win = doc->GetWindow()) {
8d2dcfb9a9b65fefb90354d5208eef08df60a96d Bug 1545499 - Remove dead code for threading accelerator state. r=NeilDeakin
Emilio Cobos Álvarez <emilio@crisal.io>
parents: 475635
diff changeset
  1773
      win->SetKeyboardIndicators(aShowFocusRings);
102461
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102460
diff changeset
  1774
    }
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102460
diff changeset
  1775
  }
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102460
diff changeset
  1776
}
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102460
diff changeset
  1777
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1778
nsresult nsBaseWidget::NotifyIME(const IMENotification& aIMENotification) {
479076
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
  1779
  if (mIMEHasQuit) {
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
  1780
    return NS_OK;
164ae5b4ff067240721f51c4917961048de3a6d0 Bug 1549930 addendum - Notify widgets of IME blur on quit (on non-Android). r=masayuki
Henri Sivonen <hsivonen@hsivonen.fi>
parents: 478637
diff changeset
  1781
  }
226213
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1782
  switch (aIMENotification.mMessage) {
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1783
    case REQUEST_TO_COMMIT_COMPOSITION:
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1784
    case REQUEST_TO_CANCEL_COMPOSITION:
371640
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1785
      // We should send request to IME only when there is a TextEventDispatcher
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1786
      // instance (this means that this widget has dispatched at least one
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1787
      // composition event or keyboard event) and the it has composition.
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1788
      // Otherwise, there is nothing to do.
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1789
      // Note that if current input transaction is for native input events,
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1790
      // TextEventDispatcher::NotifyIME() will call
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1791
      // TextEventDispatcherListener::NotifyIME().
226213
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1792
      if (mTextEventDispatcher && mTextEventDispatcher->IsComposing()) {
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1793
        return mTextEventDispatcher->NotifyIME(aIMENotification);
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1794
      }
371640
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1795
      return NS_OK;
288895
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1796
    default: {
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1797
      if (aIMENotification.mMessage == NOTIFY_IME_OF_FOCUS) {
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1798
        mIMEHasFocus = true;
226225
62716b1991452c571272936eab7dde3f7042408a Bug 917322 part.19 Add nsITextInputProcessorCallback r=smaug+xyuan, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226213
diff changeset
  1799
      }
288895
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1800
      EnsureTextEventDispatcher();
371640
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1801
      // TextEventDispatcher::NotifyIME() will always call
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1802
      // TextEventDispatcherListener::NotifyIME().  I.e., even if current
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1803
      // input transaction is for synthesized events for automated tests,
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1804
      // notifications will be sent to native IME.
288895
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1805
      nsresult rv = mTextEventDispatcher->NotifyIME(aIMENotification);
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1806
      if (aIMENotification.mMessage == NOTIFY_IME_OF_BLUR) {
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1807
        mIMEHasFocus = false;
256515
5f3758c4704fa816e68aa86e1a254c46da064889 Bug 1191213 nsBaseWidget::NotifyWindowMoved() shouldn't notify IME when native IME handler doesn't have focus r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 254044
diff changeset
  1808
      }
371640
51919d68802ec622a8c24a5e839e046f57f66405 Bug 1384027 - part2: Move PuppetWidget::NotifyIMEInternal() implementation to PuppetWidget::NotifyIME() which is a method of TextEventDispatcherListener, not nsIWidget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 369982
diff changeset
  1809
      return rv;
256515
5f3758c4704fa816e68aa86e1a254c46da064889 Bug 1191213 nsBaseWidget::NotifyWindowMoved() shouldn't notify IME when native IME handler doesn't have focus r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 254044
diff changeset
  1810
    }
226213
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1811
  }
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1812
}
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 226207
diff changeset
  1813
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1814
void nsBaseWidget::EnsureTextEventDispatcher() {
288895
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1815
  if (mTextEventDispatcher) {
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1816
    return;
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1817
  }
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1818
  mTextEventDispatcher = new TextEventDispatcher(this);
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1819
}
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1820
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1821
nsIWidget::NativeIMEContext nsBaseWidget::GetNativeIMEContext() {
427211
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1822
  if (mTextEventDispatcher && mTextEventDispatcher->GetPseudoIMEContext()) {
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1823
    // If we already have a TextEventDispatcher and it's working with
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1824
    // a TextInputProcessor, we need to return pseudo IME context since
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1825
    // TextCompositionArray::IndexOf(nsIWidget*) should return a composition
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1826
    // on the pseudo IME context in such case.
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1827
    NativeIMEContext pseudoIMEContext;
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1828
    pseudoIMEContext.InitWithRawNativeIMEContext(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1829
        mTextEventDispatcher->GetPseudoIMEContext());
427211
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1830
    return pseudoIMEContext;
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1831
  }
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1832
  return NativeIMEContext(this);
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1833
}
bdf8618dc2c36ebbea502b9e2fb608eca4674cc8 Bug 1453629 - nsIWidget::GetNativeIMEContext() should return pseudo IME context if TextInputProcessor has a composition on the widget r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 425149
diff changeset
  1834
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1835
nsIWidget::TextEventDispatcher* nsBaseWidget::GetTextEventDispatcher() {
288895
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1836
  EnsureTextEventDispatcher();
226207
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
  1837
  return mTextEventDispatcher;
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
  1838
}
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 220712
diff changeset
  1839
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1840
void* nsBaseWidget::GetPseudoIMEContext() {
288896
a8dbb4e58e546843c0b0710f8aa2b453f5cfcadc Bug 1137572 part.3 Use pseudo IME context when TextEventDispatcher has input transaction which is not for native event handler r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288895
diff changeset
  1841
  TextEventDispatcher* dispatcher = GetTextEventDispatcher();
a8dbb4e58e546843c0b0710f8aa2b453f5cfcadc Bug 1137572 part.3 Use pseudo IME context when TextEventDispatcher has input transaction which is not for native event handler r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288895
diff changeset
  1842
  if (!dispatcher) {
a8dbb4e58e546843c0b0710f8aa2b453f5cfcadc Bug 1137572 part.3 Use pseudo IME context when TextEventDispatcher has input transaction which is not for native event handler r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288895
diff changeset
  1843
    return nullptr;
a8dbb4e58e546843c0b0710f8aa2b453f5cfcadc Bug 1137572 part.3 Use pseudo IME context when TextEventDispatcher has input transaction which is not for native event handler r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288895
diff changeset
  1844
  }
a8dbb4e58e546843c0b0710f8aa2b453f5cfcadc Bug 1137572 part.3 Use pseudo IME context when TextEventDispatcher has input transaction which is not for native event handler r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288895
diff changeset
  1845
  return dispatcher->GetPseudoIMEContext();
a8dbb4e58e546843c0b0710f8aa2b453f5cfcadc Bug 1137572 part.3 Use pseudo IME context when TextEventDispatcher has input transaction which is not for native event handler r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288895
diff changeset
  1846
}
a8dbb4e58e546843c0b0710f8aa2b453f5cfcadc Bug 1137572 part.3 Use pseudo IME context when TextEventDispatcher has input transaction which is not for native event handler r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288895
diff changeset
  1847
328507
1e51e167058e06429deb642480c0c5691715601e Bug 1325234 (part 9) - Remove remaining NS_IMETHOD_ occurrences from nsIWidget. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 328503
diff changeset
  1848
TextEventDispatcherListener*
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1849
nsBaseWidget::GetNativeTextEventDispatcherListener() {
288895
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1850
  // TODO: If all platforms supported use of TextEventDispatcher for handling
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1851
  //       native IME and keyboard events, this method should be removed since
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1852
  //       in such case, this is overridden by all the subclasses.
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1853
  return nullptr;
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1854
}
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 288178
diff changeset
  1855
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1856
void nsBaseWidget::ZoomToRect(const uint32_t& aPresShellId,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1857
                              const ScrollableLayerGuid::ViewID& aViewId,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1858
                              const CSSRect& aRect, const uint32_t& aFlags) {
297876
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
  1859
  if (!mCompositorSession || !mAPZC) {
280859
cfc568b890f8046d9b6828c1d277bc5a062bda35 Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats
Randall Barker <rbarker@mozilla.com>
parents: 280354
diff changeset
  1860
    return;
cfc568b890f8046d9b6828c1d277bc5a062bda35 Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats
Randall Barker <rbarker@mozilla.com>
parents: 280354
diff changeset
  1861
  }
409886
5d9f32557d7740c7c30f7bc6057c4de0c294d828 Bug 1448490 - Make the layers id a struct instead of a uint64_t. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 409757
diff changeset
  1862
  LayersId layerId = mCompositorSession->RootLayerTreeId();
408417
6c6b2501cc21457343fc8d87f1f5d9292ac75450 Merge mozilla-central to autoland a=merge on a CLOSED TREE
Coroiu Cristina <ccoroiu@mozilla.com>
parents: 408403
diff changeset
  1863
  APZThreadUtils::RunOnControllerThread(
575620
44f195ffc4de336b86e21ab4379e717c2ee7c11c Bug 1702467. Double tap zoom can make us zoom to a part of an element when we could fit the entire element at the same zoom. r=botond
Timothy Nikkel <tnikkel@gmail.com>
parents: 574599
diff changeset
  1864
      NewRunnableMethod<ScrollableLayerGuid, ZoomTarget, uint32_t>(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1865
          "layers::IAPZCTreeManager::ZoomToRect", mAPZC,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1866
          &IAPZCTreeManager::ZoomToRect,
575620
44f195ffc4de336b86e21ab4379e717c2ee7c11c Bug 1702467. Double tap zoom can make us zoom to a part of an element when we could fit the entire element at the same zoom. r=botond
Timothy Nikkel <tnikkel@gmail.com>
parents: 574599
diff changeset
  1867
          ScrollableLayerGuid(layerId, aPresShellId, aViewId),
44f195ffc4de336b86e21ab4379e717c2ee7c11c Bug 1702467. Double tap zoom can make us zoom to a part of an element when we could fit the entire element at the same zoom. r=botond
Timothy Nikkel <tnikkel@gmail.com>
parents: 574599
diff changeset
  1868
          ZoomTarget{aRect, Nothing()}, aFlags));
280859
cfc568b890f8046d9b6828c1d277bc5a062bda35 Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats
Randall Barker <rbarker@mozilla.com>
parents: 280354
diff changeset
  1869
}
cfc568b890f8046d9b6828c1d277bc5a062bda35 Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats
Randall Barker <rbarker@mozilla.com>
parents: 280354
diff changeset
  1870
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1871
#ifdef ACCESSIBILITY
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1872
568148
0df6a015e7c44653ff9cb114d25644c0515b0cc9 Bug 1693597 - P1: Rename Accessible to LocalAccessible. r=morgan
Eitan Isaacson <eitan@monotonous.org>
parents: 568006
diff changeset
  1873
a11y::LocalAccessible* nsBaseWidget::GetRootAccessible() {
102656
71dce48a6079b54228bb766ae6414b38a23d2b4f Bug 783383 - Add null-checks for nsBaseWidget::mWidgetListener r=tn
Andrew Quartey <andrew.quartey@gmail.com>
parents: 102467
diff changeset
  1874
  NS_ENSURE_TRUE(mWidgetListener, nullptr);
71dce48a6079b54228bb766ae6414b38a23d2b4f Bug 783383 - Add null-checks for nsBaseWidget::mWidgetListener r=tn
Andrew Quartey <andrew.quartey@gmail.com>
parents: 102467
diff changeset
  1875
472238
d1f9cf74a077fe71234115dafdee9c0723b58e93 Bug 253889 - part 4: Finally, get rid of nsIPresShell r=emilio
Masayuki Nakano <masayuki@d-toybox.com>
parents: 472192
diff changeset
  1876
  PresShell* presShell = mWidgetListener->GetPresShell();
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1877
  NS_ENSURE_TRUE(presShell, nullptr);
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1878
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1879
  // If container is null then the presshell is not active. This often happens
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1880
  // when a preshell is being held onto for fastback.
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1881
  nsPresContext* presContext = presShell->GetPresContext();
160261
4c67b63a52c28b10707d43de4cbc30df67fdd185 bug 947022 - type nsIPresShell::mForwardingContainer and nsPresContext::mContainer r=bz
Trevor Saunders <trev.saunders@gmail.com>
parents: 159472
diff changeset
  1882
  NS_ENSURE_TRUE(presContext->GetContainerWeak(), nullptr);
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1883
568148
0df6a015e7c44653ff9cb114d25644c0515b0cc9 Bug 1693597 - P1: Rename Accessible to LocalAccessible. r=morgan
Eitan Isaacson <eitan@monotonous.org>
parents: 568006
diff changeset
  1884
  // LocalAccessible creation might be not safe so use IsSafeToRunScript to
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1885
  // make sure it's not created at unsafe times.
308737
13c9ca2db92104b11bf1999c7ea05004d9e864e1 Bug 527003 - separating XPCOM parts from nsAccessibilityService. Removing a11y service in favour of using nsAccessibilityService directly. Adding support for a11y service shutdown. r=surkov
Yura Zenevich <yzenevich@mozilla.com>
parents: 308084
diff changeset
  1886
  nsAccessibilityService* accService = GetOrCreateAccService();
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1887
  if (accService) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1888
    return accService->GetRootDocumentAccessible(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1889
        presShell, nsContentUtils::IsSafeToRunScript());
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1890
  }
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1891
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1892
  return nullptr;
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1893
}
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  1894
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1895
#endif  // ACCESSIBILITY
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1896
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1897
void nsBaseWidget::StartAsyncScrollbarDrag(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1898
    const AsyncDragMetrics& aDragMetrics) {
266699
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 266224
diff changeset
  1899
  if (!AsyncPanZoomEnabled()) {
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 266224
diff changeset
  1900
    return;
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 266224
diff changeset
  1901
  }
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 266224
diff changeset
  1902
297876
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
  1903
  MOZ_ASSERT(XRE_IsParentProcess() && mCompositorSession);
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 297873
diff changeset
  1904
409886
5d9f32557d7740c7c30f7bc6057c4de0c294d828 Bug 1448490 - Make the layers id a struct instead of a uint64_t. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 409757
diff changeset
  1905
  LayersId layersId = mCompositorSession->RootLayerTreeId();
520787
5916b41d10e9c8e6731db02a1611a4b28c1c25ba Bug 1622360 - Remove SLGuidAndRenderRoot and convert remaining uses to ScrollableLayerGuid. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520061
diff changeset
  1906
  ScrollableLayerGuid guid(layersId, aDragMetrics.mPresShellId,
5916b41d10e9c8e6731db02a1611a4b28c1c25ba Bug 1622360 - Remove SLGuidAndRenderRoot and convert remaining uses to ScrollableLayerGuid. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520061
diff changeset
  1907
                           aDragMetrics.mViewId);
266699
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 266224
diff changeset
  1908
366127
312f7a5a2c08d394a2403c837e5ee546dd4103d7 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
Bill McCloskey <billm@mozilla.com>
parents: 366042
diff changeset
  1909
  APZThreadUtils::RunOnControllerThread(
520787
5916b41d10e9c8e6731db02a1611a4b28c1c25ba Bug 1622360 - Remove SLGuidAndRenderRoot and convert remaining uses to ScrollableLayerGuid. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520061
diff changeset
  1910
      NewRunnableMethod<ScrollableLayerGuid, AsyncDragMetrics>(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1911
          "layers::IAPZCTreeManager::StartScrollbarDrag", mAPZC,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1912
          &IAPZCTreeManager::StartScrollbarDrag, guid, aDragMetrics));
266699
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 266224
diff changeset
  1913
}
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 266224
diff changeset
  1914
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1915
bool nsBaseWidget::StartAsyncAutoscroll(const ScreenPoint& aAnchorLocation,
520787
5916b41d10e9c8e6731db02a1611a4b28c1c25ba Bug 1622360 - Remove SLGuidAndRenderRoot and convert remaining uses to ScrollableLayerGuid. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520061
diff changeset
  1916
                                        const ScrollableLayerGuid& aGuid) {
372036
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1917
  MOZ_ASSERT(XRE_IsParentProcess() && AsyncPanZoomEnabled());
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1918
387469
d6703dd120654a1a201a09d1870be9b9d27edf44 Bug 1340415 - Ensure main-thread and async autoscrolling do not happen at the same time. r=kats
Botond Ballo <botond@mozilla.com>
parents: 386548
diff changeset
  1919
  return mAPZC->StartAutoscroll(aGuid, aAnchorLocation);
372036
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1920
}
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1921
520787
5916b41d10e9c8e6731db02a1611a4b28c1c25ba Bug 1622360 - Remove SLGuidAndRenderRoot and convert remaining uses to ScrollableLayerGuid. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 520061
diff changeset
  1922
void nsBaseWidget::StopAsyncAutoscroll(const ScrollableLayerGuid& aGuid) {
372036
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1923
  MOZ_ASSERT(XRE_IsParentProcess() && AsyncPanZoomEnabled());
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1924
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1925
  mAPZC->StopAutoscroll(aGuid);
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1926
}
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 371743
diff changeset
  1927
587301
e02e9a1e0b154758dba67fbb06dfc0440da9277f Bug 1718761 - Move {Start,Stop}ApzAutoscroll to CanonicalBrowsingContext, r=Gijs,hiro
Kashav Madan <kshvmdn@gmail.com>
parents: 587299
diff changeset
  1928
LayersId nsBaseWidget::GetRootLayerTreeId() {
e02e9a1e0b154758dba67fbb06dfc0440da9277f Bug 1718761 - Move {Start,Stop}ApzAutoscroll to CanonicalBrowsingContext, r=Gijs,hiro
Kashav Madan <kshvmdn@gmail.com>
parents: 587299
diff changeset
  1929
  return mCompositorSession ? mCompositorSession->RootLayerTreeId()
e02e9a1e0b154758dba67fbb06dfc0440da9277f Bug 1718761 - Move {Start,Stop}ApzAutoscroll to CanonicalBrowsingContext, r=Gijs,hiro
Kashav Madan <kshvmdn@gmail.com>
parents: 587299
diff changeset
  1930
                            : LayersId{0};
e02e9a1e0b154758dba67fbb06dfc0440da9277f Bug 1718761 - Move {Start,Stop}ApzAutoscroll to CanonicalBrowsingContext, r=Gijs,hiro
Kashav Madan <kshvmdn@gmail.com>
parents: 587299
diff changeset
  1931
}
e02e9a1e0b154758dba67fbb06dfc0440da9277f Bug 1718761 - Move {Start,Stop}ApzAutoscroll to CanonicalBrowsingContext, r=Gijs,hiro
Kashav Madan <kshvmdn@gmail.com>
parents: 587299
diff changeset
  1932
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1933
already_AddRefed<nsIScreen> nsBaseWidget::GetWidgetScreen() {
252605
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1934
  nsCOMPtr<nsIScreenManager> screenManager;
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1935
  screenManager = do_GetService("@mozilla.org/gfx/screenmanager;1");
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1936
  if (!screenManager) {
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1937
    return nullptr;
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1938
  }
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1939
310240
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 310239
diff changeset
  1940
  LayoutDeviceIntRect bounds = GetScreenBounds();
301531
358018e43d8da2517c3600c6172f129c1e65ada0 Bug 1278818 - Convert window coordinates to desktop pixels before passing to ScreenForRect. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 300956
diff changeset
  1941
  DesktopIntRect deskBounds = RoundedToInt(bounds / GetDesktopToDeviceScale());
252605
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1942
  nsCOMPtr<nsIScreen> screen;
398636
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 396793
diff changeset
  1943
  screenManager->ScreenForRect(deskBounds.X(), deskBounds.Y(),
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 396793
diff changeset
  1944
                               deskBounds.Width(), deskBounds.Height(),
252605
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1945
                               getter_AddRefs(screen));
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1946
  return screen.forget();
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1947
}
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 252604
diff changeset
  1948
442586
33523dc590feb2d339e4722fdfe1222d341bead4 Bug 1493081 - Added nsIWidget::GetDesktopToDeviceScaleByScreen for scale factor lookup by window position; r=mattwoodrow
Jan Horak <jhorak@redhat.com>
parents: 438870
diff changeset
  1949
mozilla::DesktopToLayoutDeviceScale
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1950
nsBaseWidget::GetDesktopToDeviceScaleByScreen() {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1951
  return (nsView::GetViewFor(this)->GetViewManager()->GetDeviceContext())
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1952
      ->GetDesktopToDeviceScale();
442586
33523dc590feb2d339e4722fdfe1222d341bead4 Bug 1493081 - Added nsIWidget::GetDesktopToDeviceScaleByScreen for scale factor lookup by window position; r=mattwoodrow
Jan Horak <jhorak@redhat.com>
parents: 438870
diff changeset
  1953
}
33523dc590feb2d339e4722fdfe1222d341bead4 Bug 1493081 - Added nsIWidget::GetDesktopToDeviceScaleByScreen for scale factor lookup by window position; r=mattwoodrow
Jan Horak <jhorak@redhat.com>
parents: 438870
diff changeset
  1954
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1955
nsresult nsIWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1956
                                             bool aLongTap,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1957
                                             nsIObserver* aObserver) {
239018
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 237282
diff changeset
  1958
  AutoObserverNotifier notifier(aObserver, "touchtap");
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 237282
diff changeset
  1959
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1960
  if (sPointerIdCounter > TOUCH_INJECT_MAX_POINTS) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1961
    sPointerIdCounter = 0;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1962
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1963
  int pointerId = sPointerIdCounter;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1964
  sPointerIdCounter++;
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1965
  nsresult rv = SynthesizeNativeTouchPoint(pointerId, TOUCH_CONTACT, aPoint,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1966
                                           1.0, 90, nullptr);
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1967
  if (NS_FAILED(rv)) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1968
    return rv;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1969
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1970
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1971
  if (!aLongTap) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1972
    return SynthesizeNativeTouchPoint(pointerId, TOUCH_REMOVE, aPoint, 0, 0,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1973
                                      nullptr);
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1974
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1975
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1976
  // initiate a long tap
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1977
  int elapse = Preferences::GetInt("ui.click_hold_context_menus.delay",
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1978
                                   TOUCH_INJECT_LONG_TAP_DEFAULT_MSEC);
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1979
  if (!mLongTapTimer) {
386548
e7c3876d6d2f31f137dd9d62c870ed6320963770 Bug 1404198: Part 2d - Switch to NS_NewTimer* in widget. r=njn
Kris Maglione <maglione.k@gmail.com>
parents: 382859
diff changeset
  1980
    mLongTapTimer = NS_NewTimer();
e7c3876d6d2f31f137dd9d62c870ed6320963770 Bug 1404198: Part 2d - Switch to NS_NewTimer* in widget. r=njn
Kris Maglione <maglione.k@gmail.com>
parents: 382859
diff changeset
  1981
    if (!mLongTapTimer) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1982
      SynthesizeNativeTouchPoint(pointerId, TOUCH_CANCEL, aPoint, 0, 0,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1983
                                 nullptr);
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1984
      return NS_ERROR_UNEXPECTED;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1985
    }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1986
    // Windows requires recuring events, so we set this to a smaller window
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1987
    // than the pref value.
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1988
    int timeout = elapse;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1989
    if (timeout > TOUCH_INJECT_PUMP_TIMER_MSEC) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1990
      timeout = TOUCH_INJECT_PUMP_TIMER_MSEC;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1991
    }
366127
312f7a5a2c08d394a2403c837e5ee546dd4103d7 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
Bill McCloskey <billm@mozilla.com>
parents: 366042
diff changeset
  1992
    mLongTapTimer->InitWithNamedFuncCallback(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1993
        OnLongTapTimerCallback, this, timeout, nsITimer::TYPE_REPEATING_SLACK,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  1994
        "nsIWidget::SynthesizeNativeTouchTap");
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1995
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1996
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1997
  // If we already have a long tap pending, cancel it. We only allow one long
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1998
  // tap to be active at a time.
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  1999
  if (mLongTapTouchPoint) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2000
    SynthesizeNativeTouchPoint(mLongTapTouchPoint->mPointerId, TOUCH_CANCEL,
239018
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 237282
diff changeset
  2001
                               mLongTapTouchPoint->mPosition, 0, 0, nullptr);
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2002
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2003
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2004
  mLongTapTouchPoint = MakeUnique<LongTapInfo>(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2005
      pointerId, aPoint, TimeDuration::FromMilliseconds(elapse), aObserver);
239018
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 237282
diff changeset
  2006
  notifier.SkipNotification();  // we'll do it in the long-tap callback
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2007
  return NS_OK;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2008
}
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2009
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2010
// static
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2011
void nsIWidget::OnLongTapTimerCallback(nsITimer* aTimer, void* aClosure) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2012
  auto* self = static_cast<nsIWidget*>(aClosure);
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2013
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2014
  if ((self->mLongTapTouchPoint->mStamp + self->mLongTapTouchPoint->mDuration) >
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2015
      TimeStamp::Now()) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2016
#ifdef XP_WIN
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2017
    // Windows needs us to keep pumping feedback to the digitizer, so update
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2018
    // the pointer id with the same position.
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2019
    self->SynthesizeNativeTouchPoint(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2020
        self->mLongTapTouchPoint->mPointerId, TOUCH_CONTACT,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2021
        self->mLongTapTouchPoint->mPosition, 1.0, 90, nullptr);
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  2022
#endif
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2023
    return;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2024
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2025
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2026
  AutoObserverNotifier notifier(self->mLongTapTouchPoint->mObserver,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2027
                                "touchtap");
239018
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 237282
diff changeset
  2028
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2029
  // finished, remove the touch point
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2030
  self->mLongTapTimer->Cancel();
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2031
  self->mLongTapTimer = nullptr;
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2032
  self->SynthesizeNativeTouchPoint(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2033
      self->mLongTapTouchPoint->mPointerId, TOUCH_REMOVE,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2034
      self->mLongTapTouchPoint->mPosition, 0, 0, nullptr);
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2035
  self->mLongTapTouchPoint = nullptr;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2036
}
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2037
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2038
nsresult nsIWidget::ClearNativeTouchSequence(nsIObserver* aObserver) {
239018
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 237282
diff changeset
  2039
  AutoObserverNotifier notifier(aObserver, "cleartouch");
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 237282
diff changeset
  2040
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2041
  if (!mLongTapTimer) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2042
    return NS_OK;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2043
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2044
  mLongTapTimer->Cancel();
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2045
  mLongTapTimer = nullptr;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2046
  SynthesizeNativeTouchPoint(mLongTapTouchPoint->mPointerId, TOUCH_CANCEL,
239018
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 237282
diff changeset
  2047
                             mLongTapTouchPoint->mPosition, 0, 0, nullptr);
160524
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2048
  mLongTapTouchPoint = nullptr;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2049
  return NS_OK;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 160384
diff changeset
  2050
}
102460
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102459
diff changeset
  2051
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2052
MultiTouchInput nsBaseWidget::UpdateSynthesizedTouchState(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2053
    MultiTouchInput* aState, uint32_t aTime, mozilla::TimeStamp aTimeStamp,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2054
    uint32_t aPointerId, TouchPointerState aPointerState,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2055
    LayoutDeviceIntPoint aPoint, double aPointerPressure,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2056
    uint32_t aPointerOrientation) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2057
  ScreenIntPoint pointerScreenPoint = ViewAs<ScreenPixel>(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2058
      aPoint, PixelCastJustification::LayoutDeviceIsScreenForBounds);
306605
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2059
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2060
  // We can't dispatch *aState directly because (a) dispatching
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2061
  // it might inadvertently modify it and (b) in the case of touchend or
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2062
  // touchcancel events aState will hold the touches that are
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2063
  // still down whereas the input dispatched needs to hold the removed
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2064
  // touch(es). We use |inputToDispatch| for this purpose.
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2065
  MultiTouchInput inputToDispatch;
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2066
  inputToDispatch.mInputType = MULTITOUCH_INPUT;
308083
25aa60d92c63db75fbaae54cc8c89a17fdd3dd9d Bug 1289435 - Ensure that the synthesized native touch events have sane timestamps. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306849
diff changeset
  2067
  inputToDispatch.mTime = aTime;
25aa60d92c63db75fbaae54cc8c89a17fdd3dd9d Bug 1289435 - Ensure that the synthesized native touch events have sane timestamps. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306849
diff changeset
  2068
  inputToDispatch.mTimeStamp = aTimeStamp;
306605
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2069
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2070
  int32_t index = aState->IndexOfTouch((int32_t)aPointerId);
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2071
  if (aPointerState == TOUCH_CONTACT) {
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2072
    if (index >= 0) {
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2073
      // found an existing touch point, update it
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2074
      SingleTouchData& point = aState->mTouches[index];
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2075
      point.mScreenPoint = pointerScreenPoint;
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2076
      point.mRotationAngle = (float)aPointerOrientation;
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2077
      point.mForce = (float)aPointerPressure;
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2078
      inputToDispatch.mType = MultiTouchInput::MULTITOUCH_MOVE;
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2079
    } else {
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2080
      // new touch point, add it
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2081
      aState->mTouches.AppendElement(SingleTouchData(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2082
          (int32_t)aPointerId, pointerScreenPoint, ScreenSize(0, 0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2083
          (float)aPointerOrientation, (float)aPointerPressure));
306605
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2084
      inputToDispatch.mType = MultiTouchInput::MULTITOUCH_START;
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2085
    }
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2086
    inputToDispatch.mTouches = aState->mTouches;
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2087
  } else {
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2088
    MOZ_ASSERT(aPointerState == TOUCH_REMOVE || aPointerState == TOUCH_CANCEL);
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2089
    // a touch point is being lifted, so remove it from the stored list
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2090
    if (index >= 0) {
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2091
      aState->mTouches.RemoveElementAt(index);
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2092
    }
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2093
    inputToDispatch.mType =
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2094
        (aPointerState == TOUCH_REMOVE ? MultiTouchInput::MULTITOUCH_END
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2095
                                       : MultiTouchInput::MULTITOUCH_CANCEL);
306605
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2096
    inputToDispatch.mTouches.AppendElement(SingleTouchData(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2097
        (int32_t)aPointerId, pointerScreenPoint, ScreenSize(0, 0),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2098
        (float)aPointerOrientation, (float)aPointerPressure));
306605
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2099
  }
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2100
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2101
  return inputToDispatch;
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2102
}
d5ff28810cde1a3921f0129851574f07aba30690 Bug 1288187 - Extract a helper function to manage synthetic touch points for widgets that don't have more specific handling. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 306172
diff changeset
  2103
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2104
void nsBaseWidget::NotifyLiveResizeStarted() {
332017
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2105
  // If we have mLiveResizeListeners already non-empty, we should notify those
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2106
  // listeners that the resize stopped before starting anew. In theory this
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2107
  // should never happen because we shouldn't get nested live resize actions.
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2108
  NotifyLiveResizeStopped();
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2109
  MOZ_ASSERT(mLiveResizeListeners.IsEmpty());
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2110
470935
96a7836e16e26b55b2c653bda6d26dd9e86ba3dc Bug 1534395 - Rename nsITabParent to nsIRemoteTab. r=nika,mconley
Ryan Hunt <rhunt@eqrion.net>
parents: 469384
diff changeset
  2111
  // If we can get the active remote tab for the current widget, suppress
332017
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2112
  // the displayport on it during the live resize.
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2113
  if (!mWidgetListener) {
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2114
    return;
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2115
  }
500633
0e3e0d51aaf6eee8f95fde1dd93849ce732f96e1 Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug
Brendan Dahl <bdahl@mozilla.com>
parents: 500516
diff changeset
  2116
  nsCOMPtr<nsIAppWindow> appWindow = mWidgetListener->GetAppWindow();
0e3e0d51aaf6eee8f95fde1dd93849ce732f96e1 Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug
Brendan Dahl <bdahl@mozilla.com>
parents: 500516
diff changeset
  2117
  if (!appWindow) {
332017
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2118
    return;
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2119
  }
500633
0e3e0d51aaf6eee8f95fde1dd93849ce732f96e1 Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug
Brendan Dahl <bdahl@mozilla.com>
parents: 500516
diff changeset
  2120
  mLiveResizeListeners = appWindow->GetLiveResizeListeners();
332017
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2121
  for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) {
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2122
    mLiveResizeListeners[i]->LiveResizeStarted();
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2123
  }
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2124
}
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2125
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2126
void nsBaseWidget::NotifyLiveResizeStopped() {
332017
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2127
  if (!mLiveResizeListeners.IsEmpty()) {
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2128
    for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) {
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2129
      mLiveResizeListeners[i]->LiveResizeStopped();
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2130
    }
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2131
    mLiveResizeListeners.Clear();
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2132
  }
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2133
}
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 331747
diff changeset
  2134
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2135
void nsBaseWidget::RegisterPluginWindowForRemoteUpdates() {
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2136
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2137
  MOZ_ASSERT_UNREACHABLE(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2138
      "nsBaseWidget::RegisterPluginWindowForRemoteUpdates "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2139
      "not implemented!");
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2140
  return;
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2141
#else
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2142
  MOZ_ASSERT(NS_IsMainThread());
226596
0b7e58a519df02da97bd0041763664b873ae3539 Bug 1095754 - Add platform widget support for providing widget identifiers used in remote widget tracking and hookl this up on gtk and Windows. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 226581
diff changeset
  2143
  void* id = GetNativeData(NS_NATIVE_PLUGIN_ID);
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2144
  if (!id) {
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2145
    NS_WARNING("This is not a valid native widget!");
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2146
    return;
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2147
  }
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2148
  MOZ_ASSERT(sPluginWidgetList);
568882
ff46eda9cc314eb255bb17fccb9c052c1d2107a0 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
Simon Giesecke <sgiesecke@mozilla.com>
parents: 568865
diff changeset
  2149
  sPluginWidgetList->InsertOrUpdate(id, RefPtr{this});
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2150
#endif
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2151
}
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2152
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2153
void nsBaseWidget::UnregisterPluginWindowForRemoteUpdates() {
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2154
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2155
  MOZ_ASSERT_UNREACHABLE(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2156
      "nsBaseWidget::UnregisterPluginWindowForRemoteUpdates "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2157
      "not implemented!");
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2158
  return;
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2159
#else
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2160
  MOZ_ASSERT(NS_IsMainThread());
226596
0b7e58a519df02da97bd0041763664b873ae3539 Bug 1095754 - Add platform widget support for providing widget identifiers used in remote widget tracking and hookl this up on gtk and Windows. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 226581
diff changeset
  2161
  void* id = GetNativeData(NS_NATIVE_PLUGIN_ID);
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2162
  if (!id) {
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2163
    NS_WARNING("This is not a valid native widget!");
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2164
    return;
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2165
  }
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2166
  MOZ_ASSERT(sPluginWidgetList);
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2167
  sPluginWidgetList->Remove(id);
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2168
#endif
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2169
}
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2170
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2171
nsresult nsBaseWidget::AsyncEnableDragDrop(bool aEnable) {
379503
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 377945
diff changeset
  2172
  RefPtr<nsBaseWidget> kungFuDeathGrip = this;
455556
65cf08e33fe2b12a90a505462f3246df204c64ad Bug 1522150: Add a DeferredTimers queue ahead of the normal Idle EventQueue r=froyd
Randell Jesup <rjesup@jesup.org>
parents: 455520
diff changeset
  2173
  return NS_DispatchToCurrentThreadQueue(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2174
      NS_NewRunnableFunction(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2175
          "AsyncEnableDragDropFn",
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2176
          [this, aEnable, kungFuDeathGrip]() { EnableDragDrop(aEnable); }),
455556
65cf08e33fe2b12a90a505462f3246df204c64ad Bug 1522150: Add a DeferredTimers queue ahead of the normal Idle EventQueue r=froyd
Randell Jesup <rjesup@jesup.org>
parents: 455520
diff changeset
  2177
      kAsyncDragDropTimeout, EventQueuePriority::Idle);
379503
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 377945
diff changeset
  2178
}
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 377945
diff changeset
  2179
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2180
// static
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2181
nsIWidget* nsIWidget::LookupRegisteredPluginWindow(uintptr_t aWindowID) {
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2182
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2183
  MOZ_ASSERT_UNREACHABLE(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2184
      "nsBaseWidget::LookupRegisteredPluginWindow "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2185
      "not implemented!");
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2186
  return nullptr;
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2187
#else
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2188
  MOZ_ASSERT(NS_IsMainThread());
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2189
  MOZ_ASSERT(sPluginWidgetList);
266143
e54d330a1de68a83e3ccf65c75f0fc970f7d872c Bug 1210912 - fix widget leak in LookupRegisteredPluginWindow; r=roc
Nathan Froyd <froydnj@mozilla.com>
parents: 263023
diff changeset
  2190
  return sPluginWidgetList->GetWeak((void*)aWindowID);
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2191
#endif
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2192
}
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2193
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2194
// static
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2195
void nsIWidget::UpdateRegisteredPluginWindowVisibility(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2196
    uintptr_t aOwnerWidget, nsTArray<uintptr_t>& aPluginIds) {
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2197
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2198
  MOZ_ASSERT_UNREACHABLE(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2199
      "nsBaseWidget::UpdateRegisteredPluginWindowVisibility"
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2200
      " not implemented!");
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2201
  return;
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2202
#else
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2203
  MOZ_ASSERT(NS_IsMainThread());
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2204
  MOZ_ASSERT(sPluginWidgetList);
273069
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2205
249593
24c16a06692ed48865c887d2cb71cf347002f67a Bug 1152326 - When processing plugin updates only update the visibility of the set of plugins associated with the same compositor. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 249441
diff changeset
  2206
  // Our visible list is associated with a compositor which is associated with
273069
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2207
  // a specific top level window. We use the parent widget during iteration
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2208
  // to skip the plugin widgets owned by other top level windows.
571605
89f920c24959a06ba49bb4bade19456deff6e329 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Simon Giesecke <sgiesecke@mozilla.com>
parents: 571452
diff changeset
  2209
  for (const auto& entry : *sPluginWidgetList) {
89f920c24959a06ba49bb4bade19456deff6e329 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Simon Giesecke <sgiesecke@mozilla.com>
parents: 571452
diff changeset
  2210
    const void* windowId = entry.GetKey();
89f920c24959a06ba49bb4bade19456deff6e329 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Simon Giesecke <sgiesecke@mozilla.com>
parents: 571452
diff changeset
  2211
    nsIWidget* widget = entry.GetWeak();
273069
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2212
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2213
    MOZ_ASSERT(windowId);
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2214
    MOZ_ASSERT(widget);
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2215
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2216
    if (!widget->Destroyed()) {
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2217
      if ((uintptr_t)widget->GetParent() == aOwnerWidget) {
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2218
        widget->Show(aPluginIds.Contains((uintptr_t)windowId));
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2219
      }
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2220
    }
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 273063
diff changeset
  2221
  }
226581
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2222
#endif
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2223
}
c05f8b0ce6bb97b38d858ce60c23080fc34aa262 Bug 1095754 - Provide a way to track and access native plugin widgets so they can be accessed from global scope. r=aklotz
Jim Mathies <jmathies@mozilla.com>
parents: 226463
diff changeset
  2224
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2225
#if defined(XP_WIN)
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2226
// static
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2227
void nsIWidget::CaptureRegisteredPlugins(uintptr_t aOwnerWidget) {
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2228
  MOZ_ASSERT(NS_IsMainThread());
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2229
  MOZ_ASSERT(sPluginWidgetList);
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2230
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2231
  // Our visible list is associated with a compositor which is associated with
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2232
  // a specific top level window. We use the parent widget during iteration
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2233
  // to skip the plugin widgets owned by other top level windows.
571605
89f920c24959a06ba49bb4bade19456deff6e329 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Simon Giesecke <sgiesecke@mozilla.com>
parents: 571452
diff changeset
  2234
  for (const auto& entry : *sPluginWidgetList) {
89f920c24959a06ba49bb4bade19456deff6e329 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Simon Giesecke <sgiesecke@mozilla.com>
parents: 571452
diff changeset
  2235
    DebugOnly<const void*> windowId = entry.GetKey();
89f920c24959a06ba49bb4bade19456deff6e329 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Simon Giesecke <sgiesecke@mozilla.com>
parents: 571452
diff changeset
  2236
    nsIWidget* widget = entry.GetWeak();
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2237
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2238
    MOZ_ASSERT(windowId);
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2239
    MOZ_ASSERT(widget);
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2240
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2241
    if (!widget->Destroyed() && widget->IsVisible()) {
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2242
      if ((uintptr_t)widget->GetParent() == aOwnerWidget) {
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2243
        widget->UpdateScrollCapture();
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2244
      }
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2245
    }
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2246
  }
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2247
}
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2248
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2249
uint64_t nsBaseWidget::CreateScrollCaptureContainer() {
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2250
  mScrollCaptureContainer =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2251
      LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS);
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2252
  if (!mScrollCaptureContainer) {
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2253
    NS_WARNING("Failed to create ImageContainer for widget image capture.");
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2254
    return ImageContainer::sInvalidAsyncContainerId;
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2255
  }
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2256
329778
8205e8a9e7a33ed521fa5e0b2e947ca89448ff52 Replace async image container IDs with a typed struct. (bug 1323957 part 1, r=mattwoodrow)
David Anderson <dvander@alliedmods.net>
parents: 329203
diff changeset
  2257
  return mScrollCaptureContainer->GetAsyncContainerHandle().Value();
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2258
}
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2259
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2260
void nsBaseWidget::UpdateScrollCapture() {
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2261
  // Don't capture if no container or no size.
398636
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 396793
diff changeset
  2262
  if (!mScrollCaptureContainer || mBounds.IsEmpty()) {
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2263
    return;
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2264
  }
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2265
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2266
  // If the derived class cannot take a snapshot, for example due to clipping,
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2267
  // then it is responsible for creating a fallback. If null is returned, this
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2268
  // means that we want to keep the existing snapshot.
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2269
  RefPtr<gfx::SourceSurface> snapshot = CreateScrollSnapshot();
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2270
  if (!snapshot) {
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2271
    return;
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2272
  }
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2273
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2274
  ImageContainer::NonOwningImage holder(new SourceSurfaceImage(snapshot));
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2275
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2276
  AutoTArray<ImageContainer::NonOwningImage, 1> imageList;
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2277
  imageList.AppendElement(holder);
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2278
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2279
  mScrollCaptureContainer->SetCurrentImages(imageList);
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2280
}
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2281
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2282
void nsBaseWidget::DefaultFillScrollCapture(DrawTarget* aSnapshotDrawTarget) {
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2283
  gfx::IntSize dtSize = aSnapshotDrawTarget->GetSize();
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2284
  aSnapshotDrawTarget->FillRect(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2285
      gfx::Rect(0, 0, dtSize.width, dtSize.height),
517547
86eabc56f96399becabb7b87a5ad68250fe5af94 Bug 1618345 - Enforce proper color management by splitting gfx::Color into sRGBColor and DeviceColor types. r=jrmuizel
Andrew Osmond <aosmond@mozilla.com>
parents: 516446
diff changeset
  2286
      gfx::ColorPattern(gfx::ToDeviceColor(kScrollCaptureFillColor)),
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2287
      gfx::DrawOptions(1.f, gfx::CompositionOp::OP_SOURCE));
305384
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2288
  aSnapshotDrawTarget->Flush();
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2289
}
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2290
#endif
4010b27b7c25d9e2c844240464b4998f66d0e4af Bug 1252877 Part 2: On Windows capture an image for windowed plugins to be displayed during APZ scroll. r=jimm, r=mattwoodrow
Bob Owen <bobowencode@gmail.com>
parents: 304674
diff changeset
  2291
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2292
const IMENotificationRequests& nsIWidget::IMENotificationRequestsRef() {
354225
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 353235
diff changeset
  2293
  TextEventDispatcher* dispatcher = GetTextEventDispatcher();
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 353235
diff changeset
  2294
  return dispatcher->IMENotificationRequestsRef();
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 353235
diff changeset
  2295
}
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 353235
diff changeset
  2296
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2297
void nsIWidget::PostHandleKeyEvent(mozilla::WidgetKeyboardEvent* aEvent) {}
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2298
501307
fce96cf0927052cadd5e04f190fd7a6728fdc88a Bug 1594215 - Make `PuppetWidget::GetEditCommands()` check `mBrowserChild` before using it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 500633
diff changeset
  2299
bool nsIWidget::GetEditCommands(nsIWidget::NativeKeyBindingsType aType,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2300
                                const WidgetKeyboardEvent& aEvent,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2301
                                nsTArray<CommandInt>& aCommands) {
359282
b75c111837a802ceb953dba50a3c5a193d53ca22 Bug 1339543 part 4 Change nsIWidget::ExecuteNativeKeyBinding() to nsIWidget::GetEditCommands() which just retrieves edit commands for the type r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 358625
diff changeset
  2302
  MOZ_ASSERT(aEvent.IsTrusted());
b75c111837a802ceb953dba50a3c5a193d53ca22 Bug 1339543 part 4 Change nsIWidget::ExecuteNativeKeyBinding() to nsIWidget::GetEditCommands() which just retrieves edit commands for the type r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 358625
diff changeset
  2303
  MOZ_ASSERT(aCommands.IsEmpty());
501307
fce96cf0927052cadd5e04f190fd7a6728fdc88a Bug 1594215 - Make `PuppetWidget::GetEditCommands()` check `mBrowserChild` before using it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 500633
diff changeset
  2304
  return true;
359282
b75c111837a802ceb953dba50a3c5a193d53ca22 Bug 1339543 part 4 Change nsIWidget::ExecuteNativeKeyBinding() to nsIWidget::GetEditCommands() which just retrieves edit commands for the type r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 358625
diff changeset
  2305
}
b75c111837a802ceb953dba50a3c5a193d53ca22 Bug 1339543 part 4 Change nsIWidget::ExecuteNativeKeyBinding() to nsIWidget::GetEditCommands() which just retrieves edit commands for the type r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 358625
diff changeset
  2306
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2307
already_AddRefed<nsIBidiKeyboard> nsIWidget::CreateBidiKeyboard() {
436655
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2308
  if (XRE_IsContentProcess()) {
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2309
    return CreateBidiKeyboardContentProcess();
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2310
  }
436784
b2c1501970c68411422d2148e690760d85b35a8a Bug 1491595 follow-up: Address reviewbot nit: no else after return
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436655
diff changeset
  2311
  return CreateBidiKeyboardInner();
436655
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2312
}
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2313
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2314
#ifdef ANDROID
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2315
already_AddRefed<nsIBidiKeyboard> nsIWidget::CreateBidiKeyboardInner() {
436655
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2316
  // no bidi keyboard implementation
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2317
  return nullptr;
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2318
}
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2319
#endif
90e6823413de2d1f297a85c8b6364309bfc29a3e Bug 1491595 - Remove the XPCOM registration for the bidi keyboard; r=mstange
Ehsan Akhgari <ehsan@mozilla.com>
parents: 436648
diff changeset
  2320
510655
Sylvestre Ledru <sledru@mozilla.com>
parents: 510654
diff changeset
  2321
namespace mozilla::widget {
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2322
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2323
const char* ToChar(InputContext::Origin aOrigin) {
367810
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2324
  switch (aOrigin) {
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2325
    case InputContext::ORIGIN_MAIN:
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2326
      return "ORIGIN_MAIN";
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2327
    case InputContext::ORIGIN_CONTENT:
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2328
      return "ORIGIN_CONTENT";
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2329
    default:
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2330
      return "Unexpected value";
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2331
  }
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2332
}
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 367736
diff changeset
  2333
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2334
const char* ToChar(IMEMessage aIMEMessage) {
300299
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2335
  switch (aIMEMessage) {
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2336
    case NOTIFY_IME_OF_NOTHING:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2337
      return "NOTIFY_IME_OF_NOTHING";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2338
    case NOTIFY_IME_OF_FOCUS:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2339
      return "NOTIFY_IME_OF_FOCUS";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2340
    case NOTIFY_IME_OF_BLUR:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2341
      return "NOTIFY_IME_OF_BLUR";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2342
    case NOTIFY_IME_OF_SELECTION_CHANGE:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2343
      return "NOTIFY_IME_OF_SELECTION_CHANGE";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2344
    case NOTIFY_IME_OF_TEXT_CHANGE:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2345
      return "NOTIFY_IME_OF_TEXT_CHANGE";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2346
    case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2347
      return "NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2348
    case NOTIFY_IME_OF_POSITION_CHANGE:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2349
      return "NOTIFY_IME_OF_POSITION_CHANGE";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2350
    case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2351
      return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2352
    case REQUEST_TO_COMMIT_COMPOSITION:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2353
      return "REQUEST_TO_COMMIT_COMPOSITION";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2354
    case REQUEST_TO_CANCEL_COMPOSITION:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2355
      return "REQUEST_TO_CANCEL_COMPOSITION";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2356
    default:
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2357
      return "Unexpected value";
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2358
  }
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2359
}
1104c46a20f27b7014818ad26d9c80cc2fd473a3 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 298645
diff changeset
  2360
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2361
void NativeIMEContext::Init(nsIWidget* aWidget) {
276185
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2362
  if (!aWidget) {
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2363
    mRawNativeIMEContext = reinterpret_cast<uintptr_t>(nullptr);
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2364
    mOriginProcessID = static_cast<uint64_t>(-1);
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2365
    return;
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2366
  }
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2367
  if (!XRE_IsContentProcess()) {
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2368
    mRawNativeIMEContext = reinterpret_cast<uintptr_t>(
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2369
        aWidget->GetNativeData(NS_RAW_NATIVE_IME_CONTEXT));
276185
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2370
    mOriginProcessID = 0;
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2371
    return;
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2372
  }
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2373
  // If this is created in a child process, aWidget is an instance of
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2374
  // PuppetWidget which doesn't support NS_RAW_NATIVE_IME_CONTEXT.
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2375
  // Instead of that PuppetWidget::GetNativeIMEContext() returns cached
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2376
  // native IME context of the parent process.
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2377
  *this = aWidget->GetNativeIMEContext();
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2378
}
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2379
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2380
void NativeIMEContext::InitWithRawNativeIMEContext(void* aRawNativeIMEContext) {
276185
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2381
  if (NS_WARN_IF(!aRawNativeIMEContext)) {
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2382
    mRawNativeIMEContext = reinterpret_cast<uintptr_t>(nullptr);
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2383
    mOriginProcessID = static_cast<uint64_t>(-1);
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2384
    return;
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2385
  }
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2386
  mRawNativeIMEContext = reinterpret_cast<uintptr_t>(aRawNativeIMEContext);
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2387
  mOriginProcessID =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2388
      XRE_IsContentProcess() ? ContentChild::GetSingleton()->GetID() : 0;
276185
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2389
}
63101b99fa95195574c9eab5680b1f1acd4442ba Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 276109
diff changeset
  2390
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2391
void IMENotification::TextChangeDataBase::MergeWith(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2392
    const IMENotification::TextChangeDataBase& aOther) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2393
  MOZ_ASSERT(aOther.IsValid(), "Merging data must store valid data");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2394
  MOZ_ASSERT(aOther.mStartOffset <= aOther.mRemovedEndOffset,
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2395
             "end of removed text must be same or larger than start");
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2396
  MOZ_ASSERT(aOther.mStartOffset <= aOther.mAddedEndOffset,
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2397
             "end of added text must be same or larger than start");
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2398
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2399
  if (!IsValid()) {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2400
    *this = aOther;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2401
    return;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2402
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2403
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2404
  // |mStartOffset| and |mRemovedEndOffset| represent all replaced or removed
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2405
  // text ranges.  I.e., mStartOffset should be the smallest offset of all
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2406
  // modified text ranges in old text.  |mRemovedEndOffset| should be the
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2407
  // largest end offset in old text of all modified text ranges.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2408
  // |mAddedEndOffset| represents the end offset of all inserted text ranges.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2409
  // I.e., only this is an offset in new text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2410
  // In other words, between mStartOffset and |mRemovedEndOffset| of the
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2411
  // premodified text was already removed.  And some text whose length is
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2412
  // |mAddedEndOffset - mStartOffset| is inserted to |mStartOffset|.  I.e.,
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2413
  // this allows IME to mark dirty the modified text range with |mStartOffset|
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2414
  // and |mRemovedEndOffset| if IME stores all text of the focused editor and
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2415
  // to compute new text length with |mAddedEndOffset| and |mRemovedEndOffset|.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2416
  // Additionally, IME can retrieve only the text between |mStartOffset| and
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2417
  // |mAddedEndOffset| for updating stored text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2418
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2419
  // For comparing new and old |mStartOffset|/|mRemovedEndOffset| values, they
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2420
  // should be adjusted to be in same text. The |newData.mStartOffset| and
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2421
  // |newData.mRemovedEndOffset| should be computed as in old text because
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2422
  // |mStartOffset| and |mRemovedEndOffset| represent the modified text range
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2423
  // in the old text but even if some text before the values of the newData
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2424
  // has already been modified, the values don't include the changes.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2425
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2426
  // For comparing new and old |mAddedEndOffset| values, they should be
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2427
  // adjusted to be in same text.  The |oldData.mAddedEndOffset| should be
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2428
  // computed as in the new text because |mAddedEndOffset| indicates the end
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2429
  // offset of inserted text in the new text but |oldData.mAddedEndOffset|
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2430
  // doesn't include any changes of the text before |newData.mAddedEndOffset|.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2431
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2432
  const TextChangeDataBase& newData = aOther;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2433
  const TextChangeDataBase oldData = *this;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2434
282069
66b71325dfbf5cf32f2eb20a724d0dfcd805ccd0 Bug 1242331 part.2 Rename TextChangeDataBase::mCausedByComposition to mCausedOnlyByComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 281985
diff changeset
  2435
  // mCausedOnlyByComposition should be true only when all changes are caused
66b71325dfbf5cf32f2eb20a724d0dfcd805ccd0 Bug 1242331 part.2 Rename TextChangeDataBase::mCausedByComposition to mCausedOnlyByComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 281985
diff changeset
  2436
  // by composition.
66b71325dfbf5cf32f2eb20a724d0dfcd805ccd0 Bug 1242331 part.2 Rename TextChangeDataBase::mCausedByComposition to mCausedOnlyByComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 281985
diff changeset
  2437
  mCausedOnlyByComposition =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2438
      newData.mCausedOnlyByComposition && oldData.mCausedOnlyByComposition;
282071
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282070
diff changeset
  2439
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282070
diff changeset
  2440
  // mIncludingChangesWithoutComposition should be true if at least one of
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282070
diff changeset
  2441
  // merged changes occurred without composition.
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282070
diff changeset
  2442
  mIncludingChangesWithoutComposition =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2443
      newData.mIncludingChangesWithoutComposition ||
282071
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282070
diff changeset
  2444
      oldData.mIncludingChangesWithoutComposition;
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282070
diff changeset
  2445
282070
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2446
  // mIncludingChangesDuringComposition should be true when at least one of
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2447
  // the merged non-composition changes occurred during the latest composition.
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2448
  if (!newData.mCausedOnlyByComposition &&
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2449
      !newData.mIncludingChangesDuringComposition) {
282071
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282070
diff changeset
  2450
    MOZ_ASSERT(newData.mIncludingChangesWithoutComposition);
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282070
diff changeset
  2451
    MOZ_ASSERT(mIncludingChangesWithoutComposition);
282070
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2452
    // If new change is neither caused by composition nor occurred during
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2453
    // composition, set mIncludingChangesDuringComposition to false because
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2454
    // IME doesn't want outdated text changes as text change during current
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2455
    // composition.
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2456
    mIncludingChangesDuringComposition = false;
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2457
  } else {
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2458
    // Otherwise, set mIncludingChangesDuringComposition to true if either
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2459
    // oldData or newData includes changes during composition.
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2460
    mIncludingChangesDuringComposition =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2461
        newData.mIncludingChangesDuringComposition ||
282070
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2462
        oldData.mIncludingChangesDuringComposition;
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282069
diff changeset
  2463
  }
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2464
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2465
  if (newData.mStartOffset >= oldData.mAddedEndOffset) {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2466
    // Case 1:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2467
    // If new start is after old end offset of added text, it means that text
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2468
    // after the modified range is modified.  Like:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2469
    // added range of old change:             +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2470
    // removed range of new change:                           +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2471
    // So, the old start offset is always the smaller offset.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2472
    mStartOffset = oldData.mStartOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2473
    // The new end offset of removed text is moved by the old change and we
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2474
    // need to cancel the move of the old change for comparing the offsets in
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2475
    // same text because it doesn't make sensce to compare offsets in different
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2476
    // text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2477
    uint32_t newRemovedEndOffsetInOldText =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2478
        newData.mRemovedEndOffset - oldData.Difference();
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2479
    mRemovedEndOffset =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2480
        std::max(newRemovedEndOffsetInOldText, oldData.mRemovedEndOffset);
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2481
    // The new end offset of added text is always the larger offset.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2482
    mAddedEndOffset = newData.mAddedEndOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2483
    return;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2484
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2485
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2486
  if (newData.mStartOffset >= oldData.mStartOffset) {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2487
    // If new start is in the modified range, it means that new data changes
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2488
    // a part or all of the range.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2489
    mStartOffset = oldData.mStartOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2490
    if (newData.mRemovedEndOffset >= oldData.mAddedEndOffset) {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2491
      // Case 2:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2492
      // If new end of removed text is greater than old end of added text, it
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2493
      // means that all or a part of modified range modified again and text
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2494
      // after the modified range is also modified.  Like:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2495
      // added range of old change:             +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2496
      // removed range of new change:                   +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2497
      // So, the new removed end offset is moved by the old change and we need
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2498
      // to cancel the move of the old change for comparing the offsets in the
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2499
      // same text because it doesn't make sense to compare the offsets in
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2500
      // different text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2501
      uint32_t newRemovedEndOffsetInOldText =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2502
          newData.mRemovedEndOffset - oldData.Difference();
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2503
      mRemovedEndOffset =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2504
          std::max(newRemovedEndOffsetInOldText, oldData.mRemovedEndOffset);
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2505
      // The old end of added text is replaced by new change. So, it should be
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2506
      // same as the new start.  On the other hand, the new added end offset is
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2507
      // always same or larger.  Therefore, the merged end offset of added
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2508
      // text should be the new end offset of added text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2509
      mAddedEndOffset = newData.mAddedEndOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2510
      return;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2511
    }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2512
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2513
    // Case 3:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2514
    // If new end of removed text is less than old end of added text, it means
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2515
    // that only a part of the modified range is modified again.  Like:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2516
    // added range of old change:             +------------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2517
    // removed range of new change:               +-----+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2518
    // So, the new end offset of removed text should be same as the old end
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2519
    // offset of removed text.  Therefore, the merged end offset of removed
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2520
    // text should be the old text change's |mRemovedEndOffset|.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2521
    mRemovedEndOffset = oldData.mRemovedEndOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2522
    // The old end of added text is moved by new change.  So, we need to cancel
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2523
    // the move of the new change for comparing the offsets in same text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2524
    uint32_t oldAddedEndOffsetInNewText =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2525
        oldData.mAddedEndOffset + newData.Difference();
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2526
    mAddedEndOffset =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2527
        std::max(newData.mAddedEndOffset, oldAddedEndOffsetInNewText);
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2528
    return;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2529
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2530
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2531
  if (newData.mRemovedEndOffset >= oldData.mStartOffset) {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2532
    // If new end of removed text is greater than old start (and new start is
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2533
    // less than old start), it means that a part of modified range is modified
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2534
    // again and some new text before the modified range is also modified.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2535
    MOZ_ASSERT(newData.mStartOffset < oldData.mStartOffset,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2536
               "new start offset should be less than old one here");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2537
    mStartOffset = newData.mStartOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2538
    if (newData.mRemovedEndOffset >= oldData.mAddedEndOffset) {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2539
      // Case 4:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2540
      // If new end of removed text is greater than old end of added text, it
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2541
      // means that all modified text and text after the modified range is
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2542
      // modified.  Like:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2543
      // added range of old change:             +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2544
      // removed range of new change:        +------------------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2545
      // So, the new end of removed text is moved by the old change.  Therefore,
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2546
      // we need to cancel the move of the old change for comparing the offsets
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2547
      // in same text because it doesn't make sense to compare the offsets in
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2548
      // different text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2549
      uint32_t newRemovedEndOffsetInOldText =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2550
          newData.mRemovedEndOffset - oldData.Difference();
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2551
      mRemovedEndOffset =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2552
          std::max(newRemovedEndOffsetInOldText, oldData.mRemovedEndOffset);
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2553
      // The old end of added text is replaced by new change.  So, the old end
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2554
      // offset of added text is same as new text change's start offset.  Then,
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2555
      // new change's end offset of added text is always same or larger than
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2556
      // it.  Therefore, merged end offset of added text is always the new end
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2557
      // offset of added text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2558
      mAddedEndOffset = newData.mAddedEndOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2559
      return;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2560
    }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2561
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2562
    // Case 5:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2563
    // If new end of removed text is less than old end of added text, it
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2564
    // means that only a part of the modified range is modified again.  Like:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2565
    // added range of old change:             +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2566
    // removed range of new change:      +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2567
    // So, the new end of removed text should be same as old end of removed
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2568
    // text for preventing end of removed text to be modified.  Therefore,
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2569
    // merged end offset of removed text is always the old end offset of removed
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2570
    // text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2571
    mRemovedEndOffset = oldData.mRemovedEndOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2572
    // The old end of added text is moved by this change.  So, we need to
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2573
    // cancel the move of the new change for comparing the offsets in same text
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2574
    // because it doesn't make sense to compare the offsets in different text.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2575
    uint32_t oldAddedEndOffsetInNewText =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2576
        oldData.mAddedEndOffset + newData.Difference();
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2577
    mAddedEndOffset =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2578
        std::max(newData.mAddedEndOffset, oldAddedEndOffsetInNewText);
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2579
    return;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2580
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2581
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2582
  // Case 6:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2583
  // Otherwise, i.e., both new end of added text and new start are less than
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2584
  // old start, text before the modified range is modified.  Like:
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2585
  // added range of old change:                  +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2586
  // removed range of new change: +----------+
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2587
  MOZ_ASSERT(newData.mStartOffset < oldData.mStartOffset,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2588
             "new start offset should be less than old one here");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2589
  mStartOffset = newData.mStartOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2590
  MOZ_ASSERT(newData.mRemovedEndOffset < oldData.mRemovedEndOffset,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2591
             "new removed end offset should be less than old one here");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2592
  mRemovedEndOffset = oldData.mRemovedEndOffset;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2593
  // The end of added text should be adjusted with the new difference.
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2594
  uint32_t oldAddedEndOffsetInNewText =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2595
      oldData.mAddedEndOffset + newData.Difference();
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2596
  mAddedEndOffset =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2597
      std::max(newData.mAddedEndOffset, oldAddedEndOffsetInNewText);
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2598
}
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2599
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2600
#ifdef DEBUG
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2601
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2602
// Let's test the code of merging multiple text change data in debug build
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2603
// and crash if one of them fails because this feature is very complex but
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2604
// cannot be tested with mochitest.
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2605
void IMENotification::TextChangeDataBase::Test() {
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2606
  static bool gTestTextChangeEvent = true;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2607
  if (!gTestTextChangeEvent) {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2608
    return;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2609
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2610
  gTestTextChangeEvent = false;
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2611
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2612
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2613
   * Case 1
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2614
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2615
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2616
  // Appending text
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2617
  MergeWith(TextChangeData(10, 10, 20, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2618
  MergeWith(TextChangeData(20, 20, 35, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2619
  MOZ_ASSERT(mStartOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2620
             "Test 1-1-1: mStartOffset should be the first offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2621
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2622
      mRemovedEndOffset == 10,  // 20 - (20 - 10)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2623
      "Test 1-1-2: mRemovedEndOffset should be the first end of removed text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2624
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2625
      mAddedEndOffset == 35,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2626
      "Test 1-1-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2627
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2628
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2629
  // Removing text (longer line -> shorter line)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2630
  MergeWith(TextChangeData(10, 20, 10, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2631
  MergeWith(TextChangeData(10, 30, 10, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2632
  MOZ_ASSERT(mStartOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2633
             "Test 1-2-1: mStartOffset should be the first offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2634
  MOZ_ASSERT(mRemovedEndOffset == 40,  // 30 + (10 - 20)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2635
             "Test 1-2-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2636
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2637
             "with already removed length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2638
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2639
      mAddedEndOffset == 10,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2640
      "Test 1-2-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2641
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2642
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2643
  // Removing text (shorter line -> longer line)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2644
  MergeWith(TextChangeData(10, 20, 10, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2645
  MergeWith(TextChangeData(10, 15, 10, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2646
  MOZ_ASSERT(mStartOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2647
             "Test 1-3-1: mStartOffset should be the first offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2648
  MOZ_ASSERT(mRemovedEndOffset == 25,  // 15 + (10 - 20)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2649
             "Test 1-3-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2650
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2651
             "with already removed length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2652
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2653
      mAddedEndOffset == 10,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2654
      "Test 1-3-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2655
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2656
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2657
  // Appending text at different point (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2658
  MergeWith(TextChangeData(10, 10, 20, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2659
  MergeWith(TextChangeData(55, 55, 60, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2660
  MOZ_ASSERT(mStartOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2661
             "Test 1-4-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2662
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2663
      mRemovedEndOffset == 45,  // 55 - (10 - 20)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2664
      "Test 1-4-2: mRemovedEndOffset should be the the largest end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2665
      "text without already added length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2666
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2667
      mAddedEndOffset == 60,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2668
      "Test 1-4-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2669
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2670
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2671
  // Removing text at different point (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2672
  MergeWith(TextChangeData(10, 20, 10, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2673
  MergeWith(TextChangeData(55, 68, 55, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2674
  MOZ_ASSERT(mStartOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2675
             "Test 1-5-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2676
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2677
      mRemovedEndOffset == 78,  // 68 - (10 - 20)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2678
      "Test 1-5-2: mRemovedEndOffset should be the the largest end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2679
      "text with already removed length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2680
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2681
      mAddedEndOffset == 55,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2682
      "Test 1-5-3: mAddedEndOffset should be the largest end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2683
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2684
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2685
  // Replacing text and append text (becomes longer)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2686
  MergeWith(TextChangeData(30, 35, 32, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2687
  MergeWith(TextChangeData(32, 32, 40, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2688
  MOZ_ASSERT(mStartOffset == 30,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2689
             "Test 1-6-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2690
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2691
      mRemovedEndOffset == 35,  // 32 - (32 - 35)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2692
      "Test 1-6-2: mRemovedEndOffset should be the the first end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2693
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2694
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2695
      mAddedEndOffset == 40,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2696
      "Test 1-6-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2697
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2698
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2699
  // Replacing text and append text (becomes shorter)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2700
  MergeWith(TextChangeData(30, 35, 32, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2701
  MergeWith(TextChangeData(32, 32, 33, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2702
  MOZ_ASSERT(mStartOffset == 30,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2703
             "Test 1-7-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2704
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2705
      mRemovedEndOffset == 35,  // 32 - (32 - 35)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2706
      "Test 1-7-2: mRemovedEndOffset should be the the first end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2707
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2708
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2709
      mAddedEndOffset == 33,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2710
      "Test 1-7-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2711
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2712
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2713
  // Removing text and replacing text after first range (not sure if actually
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2714
  // occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2715
  MergeWith(TextChangeData(30, 35, 30, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2716
  MergeWith(TextChangeData(32, 34, 48, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2717
  MOZ_ASSERT(mStartOffset == 30,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2718
             "Test 1-8-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2719
  MOZ_ASSERT(mRemovedEndOffset == 39,  // 34 - (30 - 35)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2720
             "Test 1-8-2: mRemovedEndOffset should be the the first end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2721
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2722
             "without already removed text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2723
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2724
      mAddedEndOffset == 48,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2725
      "Test 1-8-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2726
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2727
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2728
  // Removing text and replacing text after first range (not sure if actually
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2729
  // occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2730
  MergeWith(TextChangeData(30, 35, 30, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2731
  MergeWith(TextChangeData(32, 38, 36, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2732
  MOZ_ASSERT(mStartOffset == 30,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2733
             "Test 1-9-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2734
  MOZ_ASSERT(mRemovedEndOffset == 43,  // 38 - (30 - 35)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2735
             "Test 1-9-2: mRemovedEndOffset should be the the first end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2736
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2737
             "without already removed text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2738
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2739
      mAddedEndOffset == 36,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2740
      "Test 1-9-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2741
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2742
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2743
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2744
   * Case 2
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2745
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2746
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2747
  // Replacing text in around end of added text (becomes shorter) (not sure
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2748
  // if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2749
  MergeWith(TextChangeData(50, 50, 55, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2750
  MergeWith(TextChangeData(53, 60, 54, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2751
  MOZ_ASSERT(mStartOffset == 50,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2752
             "Test 2-1-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2753
  MOZ_ASSERT(mRemovedEndOffset == 55,  // 60 - (55 - 50)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2754
             "Test 2-1-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2755
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2756
             "without already added text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2757
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2758
      mAddedEndOffset == 54,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2759
      "Test 2-1-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2760
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2761
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2762
  // Replacing text around end of added text (becomes longer) (not sure
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2763
  // if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2764
  MergeWith(TextChangeData(50, 50, 55, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2765
  MergeWith(TextChangeData(54, 62, 68, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2766
  MOZ_ASSERT(mStartOffset == 50,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2767
             "Test 2-2-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2768
  MOZ_ASSERT(mRemovedEndOffset == 57,  // 62 - (55 - 50)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2769
             "Test 2-2-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2770
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2771
             "without already added text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2772
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2773
      mAddedEndOffset == 68,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2774
      "Test 2-2-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2775
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2776
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2777
  // Replacing text around end of replaced text (became shorter) (not sure if
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2778
  // actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2779
  MergeWith(TextChangeData(36, 48, 45, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2780
  MergeWith(TextChangeData(43, 50, 49, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2781
  MOZ_ASSERT(mStartOffset == 36,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2782
             "Test 2-3-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2783
  MOZ_ASSERT(mRemovedEndOffset == 53,  // 50 - (45 - 48)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2784
             "Test 2-3-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2785
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2786
             "without already removed text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2787
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2788
      mAddedEndOffset == 49,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2789
      "Test 2-3-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2790
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2791
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2792
  // Replacing text around end of replaced text (became longer) (not sure if
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2793
  // actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2794
  MergeWith(TextChangeData(36, 52, 53, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2795
  MergeWith(TextChangeData(43, 68, 61, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2796
  MOZ_ASSERT(mStartOffset == 36,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2797
             "Test 2-4-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2798
  MOZ_ASSERT(mRemovedEndOffset == 67,  // 68 - (53 - 52)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2799
             "Test 2-4-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2800
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2801
             "without already added text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2802
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2803
      mAddedEndOffset == 61,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2804
      "Test 2-4-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2805
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2806
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2807
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2808
   * Case 3
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2809
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2810
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2811
  // Appending text in already added text (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2812
  MergeWith(TextChangeData(10, 10, 20, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2813
  MergeWith(TextChangeData(15, 15, 30, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2814
  MOZ_ASSERT(mStartOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2815
             "Test 3-1-1: mStartOffset should be the smallest offset");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2816
  MOZ_ASSERT(mRemovedEndOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2817
             "Test 3-1-2: mRemovedEndOffset should be the the first end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2818
             "removed text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2819
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2820
      mAddedEndOffset == 35,  // 20 + (30 - 15)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2821
      "Test 3-1-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2822
      "added text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2823
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2824
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2825
  // Replacing text in added text (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2826
  MergeWith(TextChangeData(50, 50, 55, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2827
  MergeWith(TextChangeData(52, 53, 56, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2828
  MOZ_ASSERT(mStartOffset == 50,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2829
             "Test 3-2-1: mStartOffset should be the smallest offset");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2830
  MOZ_ASSERT(mRemovedEndOffset == 50,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2831
             "Test 3-2-2: mRemovedEndOffset should be the the first end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2832
             "removed text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2833
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2834
      mAddedEndOffset == 58,  // 55 + (56 - 53)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2835
      "Test 3-2-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2836
      "added text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2837
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2838
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2839
  // Replacing text in replaced text (became shorter) (not sure if actually
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2840
  // occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2841
  MergeWith(TextChangeData(36, 48, 45, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2842
  MergeWith(TextChangeData(37, 38, 50, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2843
  MOZ_ASSERT(mStartOffset == 36,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2844
             "Test 3-3-1: mStartOffset should be the smallest offset");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2845
  MOZ_ASSERT(mRemovedEndOffset == 48,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2846
             "Test 3-3-2: mRemovedEndOffset should be the the first end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2847
             "removed text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2848
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2849
      mAddedEndOffset == 57,  // 45 + (50 - 38)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2850
      "Test 3-3-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2851
      "added text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2852
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2853
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2854
  // Replacing text in replaced text (became longer) (not sure if actually
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2855
  // occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2856
  MergeWith(TextChangeData(32, 48, 53, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2857
  MergeWith(TextChangeData(43, 50, 52, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2858
  MOZ_ASSERT(mStartOffset == 32,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2859
             "Test 3-4-1: mStartOffset should be the smallest offset");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2860
  MOZ_ASSERT(mRemovedEndOffset == 48,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2861
             "Test 3-4-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2862
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2863
             "without already added text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2864
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2865
      mAddedEndOffset == 55,  // 53 + (52 - 50)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2866
      "Test 3-4-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2867
      "added text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2868
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2869
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2870
  // Replacing text in replaced text (became shorter) (not sure if actually
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2871
  // occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2872
  MergeWith(TextChangeData(36, 48, 50, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2873
  MergeWith(TextChangeData(37, 49, 47, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2874
  MOZ_ASSERT(mStartOffset == 36,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2875
             "Test 3-5-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2876
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2877
      mRemovedEndOffset == 48,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2878
      "Test 3-5-2: mRemovedEndOffset should be the the first end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2879
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2880
  MOZ_ASSERT(mAddedEndOffset == 48,  // 50 + (47 - 49)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2881
             "Test 3-5-3: mAddedEndOffset should be the first end of added "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2882
             "text without "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2883
             "removed text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2884
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2885
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2886
  // Replacing text in replaced text (became longer) (not sure if actually
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2887
  // occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2888
  MergeWith(TextChangeData(32, 48, 53, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2889
  MergeWith(TextChangeData(43, 50, 47, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2890
  MOZ_ASSERT(mStartOffset == 32,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2891
             "Test 3-6-1: mStartOffset should be the smallest offset");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2892
  MOZ_ASSERT(mRemovedEndOffset == 48,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2893
             "Test 3-6-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2894
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2895
             "without already added text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2896
  MOZ_ASSERT(mAddedEndOffset == 50,  // 53 + (47 - 50)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2897
             "Test 3-6-3: mAddedEndOffset should be the first end of added "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2898
             "text without "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2899
             "removed text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2900
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2901
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2902
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2903
   * Case 4
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2904
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2905
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2906
  // Replacing text all of already append text (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2907
  MergeWith(TextChangeData(50, 50, 55, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2908
  MergeWith(TextChangeData(44, 66, 68, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2909
  MOZ_ASSERT(mStartOffset == 44,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2910
             "Test 4-1-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2911
  MOZ_ASSERT(mRemovedEndOffset == 61,  // 66 - (55 - 50)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2912
             "Test 4-1-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2913
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2914
             "without already added text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2915
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2916
      mAddedEndOffset == 68,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2917
      "Test 4-1-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2918
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2919
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2920
  // Replacing text around a point in which text was removed (not sure if
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2921
  // actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2922
  MergeWith(TextChangeData(50, 62, 50, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2923
  MergeWith(TextChangeData(44, 66, 68, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2924
  MOZ_ASSERT(mStartOffset == 44,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2925
             "Test 4-2-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2926
  MOZ_ASSERT(mRemovedEndOffset == 78,  // 66 - (50 - 62)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2927
             "Test 4-2-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2928
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2929
             "without already removed text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2930
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2931
      mAddedEndOffset == 68,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2932
      "Test 4-2-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2933
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2934
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2935
  // Replacing text all replaced text (became shorter) (not sure if actually
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2936
  // occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2937
  MergeWith(TextChangeData(50, 62, 60, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2938
  MergeWith(TextChangeData(49, 128, 130, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2939
  MOZ_ASSERT(mStartOffset == 49,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2940
             "Test 4-3-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2941
  MOZ_ASSERT(mRemovedEndOffset == 130,  // 128 - (60 - 62)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2942
             "Test 4-3-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2943
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2944
             "without already removed text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2945
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2946
      mAddedEndOffset == 130,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2947
      "Test 4-3-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2948
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2949
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2950
  // Replacing text all replaced text (became longer) (not sure if actually
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2951
  // occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2952
  MergeWith(TextChangeData(50, 61, 73, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2953
  MergeWith(TextChangeData(44, 100, 50, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2954
  MOZ_ASSERT(mStartOffset == 44,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2955
             "Test 4-4-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2956
  MOZ_ASSERT(mRemovedEndOffset == 88,  // 100 - (73 - 61)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2957
             "Test 4-4-2: mRemovedEndOffset should be the the last end of "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2958
             "removed text "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2959
             "with already added text length");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2960
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2961
      mAddedEndOffset == 50,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2962
      "Test 4-4-3: mAddedEndOffset should be the last end of added text");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2963
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2964
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2965
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2966
   * Case 5
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2967
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2968
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2969
  // Replacing text around start of added text (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2970
  MergeWith(TextChangeData(50, 50, 55, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2971
  MergeWith(TextChangeData(48, 52, 49, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2972
  MOZ_ASSERT(mStartOffset == 48,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2973
             "Test 5-1-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2974
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2975
      mRemovedEndOffset == 50,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2976
      "Test 5-1-2: mRemovedEndOffset should be the the first end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2977
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2978
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2979
      mAddedEndOffset == 52,  // 55 + (52 - 49)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2980
      "Test 5-1-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2981
      "added text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2982
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2983
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2984
  // Replacing text around start of replaced text (became shorter) (not sure if
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2985
  // actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2986
  MergeWith(TextChangeData(50, 60, 58, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  2987
  MergeWith(TextChangeData(43, 50, 48, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2988
  MOZ_ASSERT(mStartOffset == 43,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2989
             "Test 5-2-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2990
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2991
      mRemovedEndOffset == 60,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2992
      "Test 5-2-2: mRemovedEndOffset should be the the first end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2993
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2994
  MOZ_ASSERT(mAddedEndOffset == 56,  // 58 + (48 - 50)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2995
             "Test 5-2-3: mAddedEndOffset should be the first end of added "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2996
             "text without "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  2997
             "removed text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2998
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  2999
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3000
  // Replacing text around start of replaced text (became longer) (not sure if
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3001
  // actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3002
  MergeWith(TextChangeData(50, 60, 68, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3003
  MergeWith(TextChangeData(43, 55, 53, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3004
  MOZ_ASSERT(mStartOffset == 43,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3005
             "Test 5-3-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3006
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3007
      mRemovedEndOffset == 60,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3008
      "Test 5-3-2: mRemovedEndOffset should be the the first end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3009
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3010
  MOZ_ASSERT(mAddedEndOffset == 66,  // 68 + (53 - 55)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3011
             "Test 5-3-3: mAddedEndOffset should be the first end of added "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3012
             "text without "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3013
             "removed text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3014
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3015
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3016
  // Replacing text around start of replaced text (became shorter) (not sure if
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3017
  // actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3018
  MergeWith(TextChangeData(50, 60, 58, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3019
  MergeWith(TextChangeData(43, 50, 128, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3020
  MOZ_ASSERT(mStartOffset == 43,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3021
             "Test 5-4-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3022
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3023
      mRemovedEndOffset == 60,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3024
      "Test 5-4-2: mRemovedEndOffset should be the the first end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3025
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3026
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3027
      mAddedEndOffset == 136,  // 58 + (128 - 50)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3028
      "Test 5-4-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3029
      "added text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3030
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3031
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3032
  // Replacing text around start of replaced text (became longer) (not sure if
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3033
  // actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3034
  MergeWith(TextChangeData(50, 60, 68, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3035
  MergeWith(TextChangeData(43, 55, 65, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3036
  MOZ_ASSERT(mStartOffset == 43,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3037
             "Test 5-5-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3038
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3039
      mRemovedEndOffset == 60,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3040
      "Test 5-5-2: mRemovedEndOffset should be the the first end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3041
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3042
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3043
      mAddedEndOffset == 78,  // 68 + (65 - 55)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3044
      "Test 5-5-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3045
      "added text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3046
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3047
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3048
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3049
   * Case 6
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3050
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3051
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3052
  // Appending text before already added text (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3053
  MergeWith(TextChangeData(30, 30, 45, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3054
  MergeWith(TextChangeData(10, 10, 20, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3055
  MOZ_ASSERT(mStartOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3056
             "Test 6-1-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3057
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3058
      mRemovedEndOffset == 30,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3059
      "Test 6-1-2: mRemovedEndOffset should be the the largest end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3060
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3061
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3062
      mAddedEndOffset == 55,  // 45 + (20 - 10)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3063
      "Test 6-1-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3064
      "added text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3065
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3066
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3067
  // Removing text before already removed text (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3068
  MergeWith(TextChangeData(30, 35, 30, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3069
  MergeWith(TextChangeData(10, 25, 10, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3070
  MOZ_ASSERT(mStartOffset == 10,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3071
             "Test 6-2-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3072
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3073
      mRemovedEndOffset == 35,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3074
      "Test 6-2-2: mRemovedEndOffset should be the the largest end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3075
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3076
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3077
      mAddedEndOffset == 15,  // 30 - (25 - 10)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3078
      "Test 6-2-3: mAddedEndOffset should be the first end of added text with "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3079
      "removed text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3080
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3081
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3082
  // Replacing text before already replaced text (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3083
  MergeWith(TextChangeData(50, 65, 70, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3084
  MergeWith(TextChangeData(13, 24, 15, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3085
  MOZ_ASSERT(mStartOffset == 13,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3086
             "Test 6-3-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3087
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3088
      mRemovedEndOffset == 65,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3089
      "Test 6-3-2: mRemovedEndOffset should be the the largest end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3090
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3091
  MOZ_ASSERT(mAddedEndOffset == 61,  // 70 + (15 - 24)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3092
             "Test 6-3-3: mAddedEndOffset should be the first end of added "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3093
             "text without "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3094
             "removed text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3095
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3096
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3097
  // Replacing text before already replaced text (not sure if actually occurs)
269643
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3098
  MergeWith(TextChangeData(50, 65, 70, false, false));
760b56778e5a427026377c5ac2170f56917a672c Bug 1184890 part.1 SelectionChangeDataBase and TextChangeDataBase should have a flag which indicates whether the change occurred during composition or not r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 268493
diff changeset
  3099
  MergeWith(TextChangeData(13, 24, 36, false, false));
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3100
  MOZ_ASSERT(mStartOffset == 13,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3101
             "Test 6-4-1: mStartOffset should be the smallest offset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3102
  MOZ_ASSERT(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3103
      mRemovedEndOffset == 65,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3104
      "Test 6-4-2: mRemovedEndOffset should be the the largest end of removed "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3105
      "text");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3106
  MOZ_ASSERT(mAddedEndOffset == 82,  // 70 + (36 - 24)
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3107
             "Test 6-4-3: mAddedEndOffset should be the first end of added "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3108
             "text without "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3109
             "removed text length by the new change");
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3110
  Clear();
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3111
}
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3112
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3113
#endif  // #ifdef DEBUG
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3114
510655
Sylvestre Ledru <sledru@mozilla.com>
parents: 510654
diff changeset
  3115
}  // namespace mozilla::widget
252467
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 252442
diff changeset
  3116
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3117
#ifdef DEBUG
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3118
//////////////////////////////////////////////////////////////
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3119
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3120
// Convert a GUI event message code to a string.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3121
// Makes it a lot easier to debug events.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3122
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3123
// See gtk/nsWidget.cpp and windows/nsWindow.cpp
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3124
// for a DebugPrintEvent() function that uses
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3125
// this.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3126
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3127
//////////////////////////////////////////////////////////////
461907
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3128
/* static */
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3129
nsAutoString nsBaseWidget::debug_GuiEventToString(WidgetGUIEvent* aGuiEvent) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3130
  NS_ASSERTION(nullptr != aGuiEvent, "cmon, null gui event.");
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3131
538158
3f8100fb74318f9e0b3b6351ade737994d13bcf8 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Simon Giesecke <sgiesecke@mozilla.com>
parents: 535009
diff changeset
  3132
  nsAutoString eventName(u"UNKNOWN"_ns);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3133
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
  3134
#  define _ASSIGN_eventName(_value, _name) \
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
  3135
    case _value:                           \
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
  3136
      eventName.AssignLiteral(_name);      \
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
  3137
      break
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3138
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3139
  switch (aGuiEvent->mMessage) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3140
    _ASSIGN_eventName(eBlur, "eBlur");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3141
    _ASSIGN_eventName(eDrop, "eDrop");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3142
    _ASSIGN_eventName(eDragEnter, "eDragEnter");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3143
    _ASSIGN_eventName(eDragExit, "eDragExit");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3144
    _ASSIGN_eventName(eDragOver, "eDragOver");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3145
    _ASSIGN_eventName(eEditorInput, "eEditorInput");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3146
    _ASSIGN_eventName(eFocus, "eFocus");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3147
    _ASSIGN_eventName(eFocusIn, "eFocusIn");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3148
    _ASSIGN_eventName(eFocusOut, "eFocusOut");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3149
    _ASSIGN_eventName(eFormSelect, "eFormSelect");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3150
    _ASSIGN_eventName(eFormChange, "eFormChange");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3151
    _ASSIGN_eventName(eFormReset, "eFormReset");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3152
    _ASSIGN_eventName(eFormSubmit, "eFormSubmit");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3153
    _ASSIGN_eventName(eImageAbort, "eImageAbort");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3154
    _ASSIGN_eventName(eLoadError, "eLoadError");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3155
    _ASSIGN_eventName(eKeyDown, "eKeyDown");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3156
    _ASSIGN_eventName(eKeyPress, "eKeyPress");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3157
    _ASSIGN_eventName(eKeyUp, "eKeyUp");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3158
    _ASSIGN_eventName(eMouseEnterIntoWidget, "eMouseEnterIntoWidget");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3159
    _ASSIGN_eventName(eMouseExitFromWidget, "eMouseExitFromWidget");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3160
    _ASSIGN_eventName(eMouseDown, "eMouseDown");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3161
    _ASSIGN_eventName(eMouseUp, "eMouseUp");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3162
    _ASSIGN_eventName(eMouseClick, "eMouseClick");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3163
    _ASSIGN_eventName(eMouseAuxClick, "eMouseAuxClick");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3164
    _ASSIGN_eventName(eMouseDoubleClick, "eMouseDoubleClick");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3165
    _ASSIGN_eventName(eMouseMove, "eMouseMove");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3166
    _ASSIGN_eventName(eLoad, "eLoad");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3167
    _ASSIGN_eventName(ePopState, "ePopState");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3168
    _ASSIGN_eventName(eBeforeScriptExecute, "eBeforeScriptExecute");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3169
    _ASSIGN_eventName(eAfterScriptExecute, "eAfterScriptExecute");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3170
    _ASSIGN_eventName(eUnload, "eUnload");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3171
    _ASSIGN_eventName(eHashChange, "eHashChange");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3172
    _ASSIGN_eventName(eReadyStateChange, "eReadyStateChange");
260913
8f9d85e978cac16a296c52cc1dd050e2fbdc3f86 Bug 895274 part.91 Rename NS_XUL_BROADCAST to eXULBroadcast r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 260692
diff changeset
  3173
    _ASSIGN_eventName(eXULBroadcast, "eXULBroadcast");
260914
7fd80515c0fecca6849e56ca1e392df06e8f0c7f Bug 895274 part.92 Rename NS_XUL_COMMAND_UPDATE to eXULCommandUpdate r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 260913
diff changeset
  3174
    _ASSIGN_eventName(eXULCommandUpdate, "eXULCommandUpdate");
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3175
454520
5f4630838d46dd81dadb13220a4af0da9e23a619 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
Ehsan Akhgari <ehsan@mozilla.com>
parents: 452446
diff changeset
  3176
#  undef _ASSIGN_eventName
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3177
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3178
    default: {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3179
      eventName.AssignLiteral("UNKNOWN: ");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3180
      eventName.AppendInt(aGuiEvent->mMessage);
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3181
    } break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3182
  }
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
  3183
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3184
  return nsAutoString(eventName);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3185
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3186
//////////////////////////////////////////////////////////////
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3187
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3188
// Code to deal with paint and event debug prefs.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3189
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3190
//////////////////////////////////////////////////////////////
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3191
struct PrefPair {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3192
  const char* name;
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77129
diff changeset
  3193
  bool value;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3194
};
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3195
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3196
static PrefPair debug_PrefValues[] = {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3197
    {"nglayout.debug.crossing_event_dumping", false},
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3198
    {"nglayout.debug.event_dumping", false},
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3199
    {"nglayout.debug.invalidate_dumping", false},
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3200
    {"nglayout.debug.motion_event_dumping", false},
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3201
    {"nglayout.debug.paint_dumping", false},
449380
c84eefa8a511b9c3684e98eb3a0a0cbb7d290f06 Bug 1505257 - add nglayout.debug.paint_flashing_chrome to paint debug pref value list r=mstange
A. Wilcox <AWilcox@Wilcox-Tech.com>
parents: 448947
diff changeset
  3202
    {"nglayout.debug.paint_flashing", false},
c84eefa8a511b9c3684e98eb3a0a0cbb7d290f06 Bug 1505257 - add nglayout.debug.paint_flashing_chrome to paint debug pref value list r=mstange
A. Wilcox <AWilcox@Wilcox-Tech.com>
parents: 448947
diff changeset
  3203
    {"nglayout.debug.paint_flashing_chrome", false}};
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3204
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3205
//////////////////////////////////////////////////////////////
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3206
bool nsBaseWidget::debug_GetCachedBoolPref(const char* aPrefName) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3207
  NS_ASSERTION(nullptr != aPrefName, "cmon, pref name is null.");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3208
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3209
  for (uint32_t i = 0; i < ArrayLength(debug_PrefValues); i++) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3210
    if (strcmp(debug_PrefValues[i].name, aPrefName) == 0) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3211
      return debug_PrefValues[i].value;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3212
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3213
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3214
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78821
diff changeset
  3215
  return false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3216
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3217
//////////////////////////////////////////////////////////////
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3218
static void debug_SetCachedBoolPref(const char* aPrefName, bool aValue) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3219
  NS_ASSERTION(nullptr != aPrefName, "cmon, pref name is null.");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3220
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3221
  for (uint32_t i = 0; i < ArrayLength(debug_PrefValues); i++) {
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3222
    if (strcmp(debug_PrefValues[i].name, aPrefName) == 0) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3223
      debug_PrefValues[i].value = aValue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3224
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3225
      return;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3226
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3227
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3228
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78821
diff changeset
  3229
  NS_ASSERTION(false, "cmon, this code is not reached dude.");
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3230
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3231
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3232
//////////////////////////////////////////////////////////////
234933
ac4464790ec4896a5188fa50cfc69ae0ffeddc08 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
Ehsan Akhgari <ehsan@mozilla.com>
parents: 234460
diff changeset
  3233
class Debug_PrefObserver final : public nsIObserver {
518949
087e9f9efed07fad4c0d8af05464e6a9b580c0ea Bug 1613985 - Use default for equivalent-to-default constructors/destructors in widget. r=jmathies
Simon Giesecke <sgiesecke@mozilla.com>
parents: 518918
diff changeset
  3234
  ~Debug_PrefObserver() = default;
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3235
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3236
 public:
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3237
  NS_DECL_ISUPPORTS
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3238
  NS_DECL_NSIOBSERVER
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3239
};
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3240
180485
6c1c7e45c90289a0875b74f82f39e7ecf6a65af3 Bug 900908 - Part 3: Change uses of numbered macros in nsIClassInfoImpl.h/nsISupportsImpl.h to the variadic variants. r=froydnj
Birunthan Mohanathas <birunthan@mohanathas.com>
parents: 177924
diff changeset
  3241
NS_IMPL_ISUPPORTS(Debug_PrefObserver, nsIObserver)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3242
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3243
NS_IMETHODIMP
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3244
Debug_PrefObserver::Observe(nsISupports* subject, const char* topic,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3245
                            const char16_t* data) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3246
  NS_ConvertUTF16toUTF8 prefName(data);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3247
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77129
diff changeset
  3248
  bool value = Preferences::GetBool(prefName.get(), false);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3249
  debug_SetCachedBoolPref(prefName.get(), value);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3250
  return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3251
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3252
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3253
//////////////////////////////////////////////////////////////
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3254
/* static */ void debug_RegisterPrefCallbacks() {
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77129
diff changeset
  3255
  static bool once = true;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3256
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3257
  if (!once) {
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3258
    return;
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3259
  }
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3260
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78821
diff changeset
  3261
  once = false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3262
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3263
  nsCOMPtr<nsIObserver> obs(new Debug_PrefObserver());
102997
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 102656
diff changeset
  3264
  for (uint32_t i = 0; i < ArrayLength(debug_PrefValues); i++) {
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3265
    // Initialize the pref values
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3266
    debug_PrefValues[i].value =
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3267
        Preferences::GetBool(debug_PrefValues[i].name, false);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3268
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3269
    if (obs) {
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3270
      // Register callbacks for when these change
425149
c430c64b47d64406108819996da3e1e00da91cf4 Bug 1472523: Part 4 - Avoid unnecessary domain string duplication in preference observers. r=njn
Kris Maglione <maglione.k@gmail.com>
parents: 423666
diff changeset
  3271
      nsCString name;
c430c64b47d64406108819996da3e1e00da91cf4 Bug 1472523: Part 4 - Avoid unnecessary domain string duplication in preference observers. r=njn
Kris Maglione <maglione.k@gmail.com>
parents: 423666
diff changeset
  3272
      name.AssignLiteral(debug_PrefValues[i].name,
c430c64b47d64406108819996da3e1e00da91cf4 Bug 1472523: Part 4 - Avoid unnecessary domain string duplication in preference observers. r=njn
Kris Maglione <maglione.k@gmail.com>
parents: 423666
diff changeset
  3273
                         strlen(debug_PrefValues[i].name));
c430c64b47d64406108819996da3e1e00da91cf4 Bug 1472523: Part 4 - Avoid unnecessary domain string duplication in preference observers. r=njn
Kris Maglione <maglione.k@gmail.com>
parents: 423666
diff changeset
  3274
      Preferences::AddStrongObserver(obs, name);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3275
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3276
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3277
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3278
//////////////////////////////////////////////////////////////
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3279
static int32_t _GetPrintCount() {
102997
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 102656
diff changeset
  3280
  static int32_t sCount = 0;
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
  3281
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3282
  return ++sCount;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3283
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3284
//////////////////////////////////////////////////////////////
461907
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3285
/* static */
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3286
bool nsBaseWidget::debug_WantPaintFlashing() {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3287
  return debug_GetCachedBoolPref("nglayout.debug.paint_flashing");
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3288
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3289
//////////////////////////////////////////////////////////////
461907
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3290
/* static */
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3291
void nsBaseWidget::debug_DumpEvent(FILE* aFileOut, nsIWidget* aWidget,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3292
                                   WidgetGUIEvent* aGuiEvent,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3293
                                   const char* aWidgetName, int32_t aWindowID) {
259938
cd4d30cf8ecfb8789d0e69c2adcdfe4c1de7ac8f Bug 895274 part.25 Rename NS_MOUSE_MOVE to eMouseMove r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 259924
diff changeset
  3294
  if (aGuiEvent->mMessage == eMouseMove) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3295
    if (!debug_GetCachedBoolPref("nglayout.debug.motion_event_dumping")) return;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3296
  }
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
  3297
259941
389f60113c0c037c562eb46f4dfa23feab74a20e Bug 895274 part.28 Rename NS_MOUSE_ENTER_WIDGET to eMouseEnterIntoWidget r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 259940
diff changeset
  3298
  if (aGuiEvent->mMessage == eMouseEnterIntoWidget ||
259942
6949e818c397150c21e14c3d05edb55a86255eba Bug 895274 part.29 Rename NS_MOUSE_EXIT_WIDGET to eMouseExitFromWidget r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 259941
diff changeset
  3299
      aGuiEvent->mMessage == eMouseExitFromWidget) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3300
    if (!debug_GetCachedBoolPref("nglayout.debug.crossing_event_dumping"))
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3301
      return;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3302
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3303
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3304
  if (!debug_GetCachedBoolPref("nglayout.debug.event_dumping")) return;
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3305
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3306
  NS_LossyConvertUTF16toASCII tempString(
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3307
      debug_GuiEventToString(aGuiEvent).get());
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3308
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3309
  fprintf(aFileOut, "%4d %-26s widget=%-8p name=%-12s id=0x%-6x refpt=%d,%d\n",
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3310
          _GetPrintCount(), tempString.get(), (void*)aWidget, aWidgetName,
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3311
          aWindowID, aGuiEvent->mRefPoint.x, aGuiEvent->mRefPoint.y);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3312
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3313
//////////////////////////////////////////////////////////////
461907
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3314
/* static */
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3315
void nsBaseWidget::debug_DumpPaintEvent(FILE* aFileOut, nsIWidget* aWidget,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3316
                                        const nsIntRegion& aRegion,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3317
                                        const char* aWidgetName,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3318
                                        int32_t aWindowID) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3319
  NS_ASSERTION(nullptr != aFileOut, "cmon, null output FILE");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3320
  NS_ASSERTION(nullptr != aWidget, "cmon, the widget is null");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3321
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3322
  if (!debug_GetCachedBoolPref("nglayout.debug.paint_dumping")) return;
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
  3323
102463
448410c2035ef7bce315bb6b3c46f60fb909145e Bug 743975 - use a widget listener interface instead of the remaining events that don't need an event, r=tn,jmathies,netzen,smichaud,karlt,blassey,chrisjones
Neil Deakin <neil@mozilla.com>
parents: 102462
diff changeset
  3324
  nsIntRect rect = aRegion.GetBounds();
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3325
  fprintf(aFileOut,
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3326
          "%4d PAINT      widget=%p name=%-12s id=0x%-6x bounds-rect=%3d,%-3d "
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3327
          "%3d,%-3d",
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3328
          _GetPrintCount(), (void*)aWidget, aWidgetName, aWindowID, rect.X(),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3329
          rect.Y(), rect.Width(), rect.Height());
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3330
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3331
  fprintf(aFileOut, "\n");
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3332
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3333
//////////////////////////////////////////////////////////////
461907
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3334
/* static */
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3335
void nsBaseWidget::debug_DumpInvalidate(FILE* aFileOut, nsIWidget* aWidget,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3336
                                        const LayoutDeviceIntRect* aRect,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3337
                                        const char* aWidgetName,
0707c5d273227aed4fb04a8f6360875165f83ddd Bug 1523969 part 26 - Move method definition inline comments to new line in 'widget/'. r=mstange
Ryan Hunt <rhunt@eqrion.net>
parents: 456704
diff changeset
  3338
                                        int32_t aWindowID) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3339
  if (!debug_GetCachedBoolPref("nglayout.debug.invalidate_dumping")) return;
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3340
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3341
  NS_ASSERTION(nullptr != aFileOut, "cmon, null output FILE");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3342
  NS_ASSERTION(nullptr != aWidget, "cmon, the widget is null");
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3343
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3344
  fprintf(aFileOut, "%4d Invalidate widget=%p name=%-12s id=0x%-6x",
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3345
          _GetPrintCount(), (void*)aWidget, aWidgetName, aWindowID);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3346
275419
e091d14c936c948a490457a6420261abe8c16cc6 Bug 1229237 (part 3) - Make nsIWidget::Invalidate() take a LayoutDeviceIntRect. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275417
diff changeset
  3347
  if (aRect) {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3348
    fprintf(aFileOut, " rect=%3d,%-3d %3d,%-3d", aRect->X(), aRect->Y(),
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3349
            aRect->Width(), aRect->Height());
275419
e091d14c936c948a490457a6420261abe8c16cc6 Bug 1229237 (part 3) - Make nsIWidget::Invalidate() take a LayoutDeviceIntRect. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275417
diff changeset
  3350
  } else {
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3351
    fprintf(aFileOut, " rect=%-15s", "none");
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3352
  }
117301
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117093
diff changeset
  3353
275419
e091d14c936c948a490457a6420261abe8c16cc6 Bug 1229237 (part 3) - Make nsIWidget::Invalidate() take a LayoutDeviceIntRect. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 275417
diff changeset
  3354
  fprintf(aFileOut, "\n");
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3355
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3356
//////////////////////////////////////////////////////////////
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3357
448947
6f3709b3878117466168c40affa7bca0b60cf75b Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
Sylvestre Ledru <sledru@mozilla.com>
parents: 448705
diff changeset
  3358
#endif  // DEBUG