widget/nsBaseWidget.cpp
author ffxbld <release@mozilla.com>
Mon, 13 May 2019 12:33:53 +0000 (2019-05-13)
changeset 451197 3d80c100ff930e796422d166cf80599e84f7d657
parent 450616 4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca
permissions -rw-r--r--
Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
375571
50dd0b8e139f152b7c3a7d68b70f139319035fd8 Bug 1317774 - Add non-gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 354600
diff changeset
     1
294513
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
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: 294507
diff changeset
     3
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
94445
Gervase Markham <gerv@gerv.net>
parents: 94047
diff changeset
     4
/* This Source Code Form is subject to the terms of the Mozilla Public
Gervase Markham <gerv@gerv.net>
parents: 94047
diff changeset
     5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
Gervase Markham <gerv@gerv.net>
parents: 94047
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
162495
e0776db3b102510504fdcf57b7f65dfa1da3b46d Bug 713082 - Part 2: Rename Util.h to ArrayUtils.h. r=Waldo
Birunthan Mohanathas <birunthan@mohanathas.com>
parents: 161251
diff changeset
     8
#include "mozilla/ArrayUtils.h"
319361
e3c6988a0a55d437c1a99420dc25ec64d25f992d Bug 1265953, part 3 - Convert more widget code from nsAutoPtr to UniquePtr. r=mstange
Jonathan Watt <jwatt@jwatt.org>
parents: 319224
diff changeset
     9
#include "mozilla/UniquePtr.h"
240642
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 233962
diff changeset
    10
#include "mozilla/TextEventDispatcher.h"
314067
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
    11
#include "mozilla/TextEventDispatcherListener.h"
78791
b9b9d9f379dbef46572c5fab7ea0682988a34374 Bug 693469 - Implement mozilla::ArrayLength and mozilla::ArrayEnd, and replace uses of NS_ARRAY_LENGTH whenever possible. (Exceptions: assigning to static initializers, use in static assertions, as template parameters, etc. These will go away when the relevant compilers have C++11 constexpr support.) r=cjones
Jeff Walden <jwalden@mit.edu>
parents: 78757
diff changeset
    12
315067
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314825
diff changeset
    13
#include "mozilla/layers/CompositorBridgeChild.h"
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314825
diff changeset
    14
#include "mozilla/layers/CompositorBridgeParent.h"
392107
8d5920dc4472dd624e30017d3b1f15e1167e588f Make PLayerTransaction's constructor async. (bug 1350634, ipc_r=billm, r=mattwoodrow, r=kats)
David Anderson <dvander@alliedmods.net>
parents: 391642
diff changeset
    15
#include "mozilla/layers/PLayerTransactionChild.h"
136218
5ac656c40652e04ef462da379197d9d4efb0a78e Bug 871150 - Call IdentifyTextureHost on ImageBridgeChild so that we create appropriate textures for the compositor. r=nical
Matt Woodrow <mwoodrow@mozilla.com>
parents: 136217
diff changeset
    16
#include "mozilla/layers/ImageBridgeChild.h"
365765
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
    17
#include "LiveResizeListener.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
    18
#include "nsBaseWidget.h"
68310
Zack Weinberg <zackw@panix.com>
parents: 68309
diff changeset
    19
#include "nsDeviceContext.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
    20
#include "nsCOMPtr.h"
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    21
#include "nsGfxCIID.h"
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    22
#include "nsWidgetsCID.h"
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    23
#include "nsServiceManagerUtils.h"
319810
1952b7fec843cbb6e1b402c7a0e2a42ba9ba335f Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
Masayuki Nakano <masayuki@d-toybox.com>
parents: 319779
diff changeset
    24
#include "nsIKeyEventInPluginCallback.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
    25
#include "nsIScreenManager.h"
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    26
#include "nsAppDirectoryServiceDefs.h"
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    27
#include "nsISimpleEnumerator.h"
8591
f026e5054abb16e6897c71cacd70f21f6ebb27aa Bug 401627, better way of handling click to close menu so that it doesn't reopen the menu again, r+sr=roc
enndeakin@sympatico.ca
parents: 7751
diff changeset
    28
#include "nsIContent.h"
154132
c89628d36c8d75e60bcff9260b969404b9dfae16 Bug 930393: Fix missing include of nsIDocument.h in nsBaseWidget.cpp, to fix --disable-accessibility builds. r=roc
Alexander J. Vincent <ajvincent@gmail.com>
parents: 151785
diff changeset
    29
#include "nsIDocument.h"
183236
8aec25fc718c1ebdf039a9d601ec43746f7cdb7a Bug 990793: Add #include for nsIPresShell.h to nsBaseWidget.cpp so it doesn't depend indirectly on a separate #ifdeffed include. r=karl
Daniel Holbert <dholbert@cs.stanford.edu>
parents: 183132
diff changeset
    30
#include "nsIPresShell.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
    31
#include "nsIServiceManager.h"
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
    32
#include "mozilla/Preferences.h"
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
    33
#include "BasicLayers.h"
130442
af9e5dba68e8016344fe6ea7fb61a34b55a5124a Bug 867474 - Split BasicShadowableLayerManager into a separate ClientLayerManager. r=nrc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 130430
diff changeset
    34
#include "ClientLayerManager.h"
128272
ee5ca214e87c483e65e45dbf4c3e2d323c976003 Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Bas Schouten <bschouten@mozilla.com>
parents: 128134
diff changeset
    35
#include "mozilla/layers/Compositor.h"
51658
52546421427a7a033644be35544b256dd10ad794 Bug 591139 - Disable hardware acceleration in safe mode. r=bas a=blocking2.0:beta5+
Joe Drew <joe@drew.ca>
parents: 51655
diff changeset
    36
#include "nsIXULRuntime.h"
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
    37
#include "nsIXULWindow.h"
102432
481e19da0409a2979bf4a17449ae6f1b066274f6 Bug 743975 - remove NS_DESTROY event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102431
diff changeset
    38
#include "nsIBaseWindow.h"
111528
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: 110602
diff changeset
    39
#include "nsXULPopupManager.h"
402068
c8dfb8a2de0028fa296e6557612a8c60b167f836 Bug 1351783 part 6 - Create and send KeyboardMap to APZCTreeManager. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 401914
diff changeset
    40
#include "nsXBLWindowKeyHandler.h"
102433
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: 102432
diff changeset
    41
#include "nsIWidgetListener.h"
60833
73fee13f0df306de62d0cf158b5e8da43dd1fafc Bug 625508. This moves the GfxInfo checks out of LayerManagerOGL and into the callers. r=vlad
Jeff Muizelaar <jmuizelaar@mozilla.com>
parents: 60737
diff changeset
    42
#include "nsIGfxInfo.h"
61041
85906f493f63388883c0c703698b88be0ffdceb3 Bug 583499 - Bustage fix #2. Include npapi.h so NP_NO_QUICKDRAW is defined. r=cjones on irc, a=bustage
Joe Drew <joe@drew.ca>
parents: 61016
diff changeset
    43
#include "npapi.h"
341905
fd597b8d1dd62e173a89ba7e85b0a78805fa8add Bug 1300337 - Replace None_ variants from nsStyleConsts.h with None; r=heycam,TYLin
Manish Goregaokar <manishsmail@gmail.com>
parents: 341556
diff changeset
    44
#include "X11UndefineNone.h"
84880
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84487
diff changeset
    45
#include "base/thread.h"
122982
7ec9cda146fb1a015ee2714e67a3adcaecc399c8 bug 816485 - interpreting the devPixelsPerPx value from about:config should not depend on locale. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 120576
diff changeset
    46
#include "prdtoa.h"
94571
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: 94445
diff changeset
    47
#include "prenv.h"
96994
97bbf868d76d1a48fcf017e13cfb00a82a27e571 Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (widget parts); r=roc
Ehsan Akhgari <ehsan@mozilla.com>
parents: 96597
diff changeset
    48
#include "mozilla/Attributes.h"
339483
564549c354b038a465c0b3fc245da3cab8753eab Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj
Kan-Ru Chen <kanru@kanru.info>
parents: 339064
diff changeset
    49
#include "mozilla/Unused.h"
120576
3979463039ed70e832e1b28917363478162f77a8 Bug 833012 - Remove "nsContentUtils.h" inclusion from Element.h. r=Ms2ger
Mounir Lamouri <mounir.lamouri@gmail.com>
parents: 119325
diff changeset
    50
#include "nsContentUtils.h"
176289
bc21c966078991058e6960a451c53fbe8a5849f9 Bug 971942: 3. layers.bufferrotation.enabled, layers.componentalpha.enabled, layers.scroll-graph, layers.acceleration.disabled, layers.acceleration.force-enabled moved to gfxPrefs. r=clord
Milan Sreckovic <milan@mozilla.com>
parents: 175198
diff changeset
    51
#include "gfxPrefs.h"
138530
9f542b4bfbfa80855d91bfb3db64168bf5c5bb67 Bug 882523 - Support OMTC on Mac in non-accelerated mode using OpenGL. r=nrc, r=mattwoodrow
Markus Stange <mstange@themasta.com>
parents: 138073
diff changeset
    52
#include "mozilla/gfx/2D.h"
150816
d3d5df94a2fc526223e1585b9726a61f7eb99dbf Bug 912956 part.14 mozilla/MouseEvents.h should be included directly r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 149830
diff changeset
    53
#include "mozilla/MouseEvents.h"
160587
caa48441db53ab84116ce9a23a58a57040ea030b Bug 924403 - Send non-OMTC GL layers into oblivion. r=nrc
Nicolas Silva <nsilva@mozilla.com>
parents: 160368
diff changeset
    54
#include "GLConsts.h"
339483
564549c354b038a465c0b3fc245da3cab8753eab Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj
Kan-Ru Chen <kanru@kanru.info>
parents: 339064
diff changeset
    55
#include "mozilla/Unused.h"
294173
50657cb9988a3618b7db979b9f00e40a3c790a17 Bug 1222092. Don't let sFocusedIMEWidget keep an nsIWidget alive during shutdown. r=masayuki
Robert O'Callahan <robert@ocallahan.org>
parents: 293910
diff changeset
    56
#include "mozilla/IMEStateManager.h"
233656
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 232974
diff changeset
    57
#include "mozilla/VsyncDispatcher.h"
333453
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 333289
diff changeset
    58
#include "mozilla/layers/IAPZCTreeManager.h"
243241
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 243236
diff changeset
    59
#include "mozilla/layers/APZEventState.h"
242871
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: 242813
diff changeset
    60
#include "mozilla/layers/APZThreadUtils.h"
232974
71b13c6e679a7436dfd3cd3ab6411f9358388f33 Create a common chrome-process GeckoContentController. (bug 1110540 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 232973
diff changeset
    61
#include "mozilla/layers/ChromeProcessController.h"
361322
3d27c7cbcafa48642e0368319c563c4e32895242 Bug 1330037 - Introduce a CompositorOptions struct that holds options on a per-compositor basis. r=dvander
Kartikaya Gupta <kgupta@mozilla.com>
parents: 361186
diff changeset
    62
#include "mozilla/layers/CompositorOptions.h"
233758
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
    63
#include "mozilla/layers/InputAPZContext.h"
243234
cc71f20bede1aedd7385e4a9a5c04f89509e25b1 Bug 1127066 - Apply the APZ callback transform to touch events targeted to the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 242915
diff changeset
    64
#include "mozilla/layers/APZCCallbackHelper.h"
375571
50dd0b8e139f152b7c3a7d68b70f139319035fd8 Bug 1317774 - Add non-gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 354600
diff changeset
    65
#include "mozilla/layers/WebRenderLayerManager.h"
297629
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: 297553
diff changeset
    66
#include "mozilla/dom/ContentChild.h"
233758
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
    67
#include "mozilla/dom/TabParent.h"
324910
e667524c874d997c01833a8a98fe4775825a1574 Add GPUProcessManager to manage access to CompositorBridgeParent. (bug 1274149 part 1, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 324832
diff changeset
    68
#include "mozilla/gfx/GPUProcessManager.h"
375950
917d8c381251a7e573a242fb38dc0ec8165f33be Bug 1337085 - Add a gfxVar to control whether or not webrender is enabled. r=sotaro
Kartikaya Gupta <kgupta@mozilla.com>
parents: 375942
diff changeset
    69
#include "mozilla/gfx/gfxVars.h"
282022
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 282021
diff changeset
    70
#include "mozilla/Move.h"
271968
de9b963a048c99d3c5306237c401e5577ea135fa Bug 1178426. Add GfxInfo to ServicesList.h. r=nfroyd
Jeff Muizelaar <jmuizelaar@mozilla.com>
parents: 271595
diff changeset
    71
#include "mozilla/Services.h"
337901
f881b700b183e9c4bb83cd9e0ae450082fb947e9 Bug 1293384 - Part 2: Rename Snprintf.h header to Sprintf.h. r=froydnj
Igor <palmieri.igor@gmail.com>
parents: 337900
diff changeset
    72
#include "mozilla/Sprintf.h"
414203
919487ecd16f41a7e2251130d24e0dc2d959b4ae Bug 1394338 - Add WebRender error handling to RendererOGL r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 413533
diff changeset
    73
#include "mozilla/webrender/WebRenderTypes.h"
241016
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: 240898
diff changeset
    74
#include "nsRefPtrHashtable.h"
243236
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: 243234
diff changeset
    75
#include "TouchEvents.h"
262105
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: 261546
diff changeset
    76
#include "WritingModes.h"
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
    77
#include "InputData.h"
309718
966bbc65931a548f4938670fb1835226fecfa0ef Handle device resets by recreating the compositor, rather than the compositor IPDL stack. (bug 1245765 part 7, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 306114
diff changeset
    78
#include "FrameLayerBuilder.h"
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
    79
#ifdef ACCESSIBILITY
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
    80
#include "nsAccessibilityService.h"
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
    81
#endif
321678
4dbe9e240867d9073d3e9a4529e15ed036f93852 Introduce gfxConfig, a manager for graphics feature settings. (bug 1254899 part 3, r=milan)
David Anderson <danderson@mozilla.com>
parents: 321635
diff changeset
    82
#include "gfxConfig.h"
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
    83
#include "mozilla/layers/CompositorSession.h"
337854
7b1349cb7487ce1b03a6f91c016315f9e8fdd0ec Bug 1250244 - Part 7: Implement WebVR 1.0 API,r=bz
Kearwood (Kip) Gilbert <kgilbert@mozilla.com>
parents: 337386
diff changeset
    84
#include "VRManagerChild.h"
401829
63d3975c2fad45fd35bf6e568ca2c17c2d00bc2b Add MLGPU feature bits and compositor initialization. (bug 1365879 part 21, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 401554
diff changeset
    85
#include "gfxConfig.h"
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
    86
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
    87
#ifdef DEBUG
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
    88
#include "nsIObserver.h"
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
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
    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
#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
    93
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
#ifdef NOISY_WIDGET_LEAKS
102967
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 102626
diff changeset
    95
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
    96
#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
    97
165573
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: 164802
diff changeset
    98
#ifdef XP_MACOSX
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: 164802
diff changeset
    99
#include "nsCocoaFeatures.h"
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: 164802
diff changeset
   100
#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: 164802
diff changeset
   101
241016
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: 240898
diff changeset
   102
#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: 240898
diff changeset
   103
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: 240898
diff changeset
   104
#endif
263822
3dd4d2de214a96874c9927f1afd1ea708d930c6b Bug 1119980 - Use 'snprintf' instead of 'sprintf' to avoid a warning on Lollipop-based builds. r=froydnj
Botond Ballo <botond@mozilla.com>
parents: 263665
diff changeset
   105
111528
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: 110602
diff changeset
   106
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: 110602
diff changeset
   107
297629
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: 297553
diff changeset
   108
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
   109
using namespace mozilla::layers;
151289
9cc90a4b64758375a2d77f0679fc547f21902f46 Combine AsyncChannel, SyncChannel, and RPCChannel into one class (bug 901789, r=cjones,bent).
David Anderson <danderson@mozilla.com>
parents: 150816
diff changeset
   110
using namespace mozilla::ipc;
240648
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 240642
diff changeset
   111
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
   112
using namespace mozilla;
84880
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84487
diff changeset
   113
using base::Thread;
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
   114
93966
e1fcace4621d6a1a05576c29d2765a8cfe6236bc Bug 754866 - Make mozilla.widget.disable-native-theme export shared bool across widgets. r=roc
Oleg Romashin <romaxa@gmail.com>
parents: 93531
diff changeset
   115
// Global user preference for disabling native theme. Used
e1fcace4621d6a1a05576c29d2765a8cfe6236bc Bug 754866 - Make mozilla.widget.disable-native-theme export shared bool across widgets. r=roc
Oleg Romashin <romaxa@gmail.com>
parents: 93531
diff changeset
   116
// in NativeWindowTheme.
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   117
bool gDisableNativeTheme = false;
8591
f026e5054abb16e6897c71cacd70f21f6ebb27aa Bug 401627, better way of handling click to close menu so that it doesn't reopen the menu again, r+sr=roc
enndeakin@sympatico.ca
parents: 7751
diff changeset
   118
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
   119
// Async pump timer during injected long touch taps
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
   120
#define TOUCH_INJECT_PUMP_TIMER_MSEC 50
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
   121
#define TOUCH_INJECT_LONG_TAP_DEFAULT_MSEC 1500
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
   122
int32_t nsIWidget::sPointerIdCounter = 0;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
   123
256184
371a7026a1dfe35089c8f91014b2eab3a20a18c3 Bug 1146349 - Wire up native event synthesization in child processes. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 256180
diff changeset
   124
// Some statics from nsIWidget.h
371a7026a1dfe35089c8f91014b2eab3a20a18c3 Bug 1146349 - Wire up native event synthesization in child processes. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 256180
diff changeset
   125
/*static*/ uint64_t AutoObserverNotifier::sObserverId = 0;
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   126
/*static*/ nsDataHashtable<nsUint64HashKey, nsCOMPtr<nsIObserver>>
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   127
    AutoObserverNotifier::sSavedObservers;
256184
371a7026a1dfe35089c8f91014b2eab3a20a18c3 Bug 1146349 - Wire up native event synthesization in child processes. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 256180
diff changeset
   128
416040
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 414482
diff changeset
   129
// 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: 414482
diff changeset
   130
// 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: 414482
diff changeset
   131
// milliseconds.
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 414482
diff changeset
   132
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: 414482
diff changeset
   133
262105
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: 261546
diff changeset
   134
namespace mozilla {
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: 261546
diff changeset
   135
namespace widget {
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: 261546
diff changeset
   136
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   137
void IMENotification::SelectionChangeDataBase::SetWritingMode(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   138
    const WritingMode& aWritingMode) {
262105
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: 261546
diff changeset
   139
  mWritingMode = aWritingMode.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: 261546
diff changeset
   140
}
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: 261546
diff changeset
   141
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   142
WritingMode IMENotification::SelectionChangeDataBase::GetWritingMode() const {
262105
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: 261546
diff changeset
   143
  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: 261546
diff changeset
   144
}
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: 261546
diff changeset
   145
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   146
}  // namespace widget
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   147
}  // namespace mozilla
262105
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: 261546
diff changeset
   148
244112
71d030563b18097639ea2bcef8f4242ffa5864af Add weak reference support to nsBaseWidget. (bug 1133150, r=roc)
David Anderson <danderson@mozilla.com>
parents: 243242
diff changeset
   149
NS_IMPL_ISUPPORTS(nsBaseWidget, nsIWidget, nsISupportsWeakReference)
71d030563b18097639ea2bcef8f4242ffa5864af Add weak reference support to nsBaseWidget. (bug 1133150, r=roc)
David Anderson <danderson@mozilla.com>
parents: 243242
diff changeset
   150
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
   151
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   152
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   153
// 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
   154
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   155
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   156
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   157
nsBaseWidget::nsBaseWidget()
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   158
    : mWidgetListener(nullptr),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   159
      mAttachedWidgetListener(nullptr),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   160
      mPreviouslyAttachedWidgetListener(nullptr),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   161
      mLayerManager(nullptr),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   162
      mCompositorVsyncDispatcher(nullptr),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   163
      mCursor(eCursor_standard),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   164
      mBorderStyle(eBorderStyle_none),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   165
      mBounds(0, 0, 0, 0),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   166
      mOriginalBounds(nullptr),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   167
      mClipRectCount(0),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   168
      mSizeMode(nsSizeMode_Normal),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   169
      mPopupLevel(ePopupLevelTop),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   170
      mPopupType(ePopupTypeAny),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   171
      mHasRemoteContent(false),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   172
      mUpdateCursor(true),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   173
      mUseAttachedEvents(false),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   174
      mIMEHasFocus(false),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   175
      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
   176
#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
   177
  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
   178
  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
   179
#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
   180
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   181
#ifdef DEBUG
94571
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: 94445
diff changeset
   182
  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
   183
#endif
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   184
241016
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: 240898
diff changeset
   185
#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: 240898
diff changeset
   186
  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: 240898
diff changeset
   187
    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: 240898
diff changeset
   188
  }
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: 240898
diff changeset
   189
#endif
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   190
  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
   191
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   192
187154
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: 184593
diff changeset
   193
NS_IMPL_ISUPPORTS(WidgetShutdownObserver, nsIObserver)
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   194
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   195
WidgetShutdownObserver::WidgetShutdownObserver(nsBaseWidget* aWidget)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   196
    : mWidget(aWidget), mRegistered(false) {
256812
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: 256651
diff changeset
   197
  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: 256651
diff changeset
   198
}
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: 256651
diff changeset
   199
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   200
WidgetShutdownObserver::~WidgetShutdownObserver() {
256812
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: 256651
diff changeset
   201
  // 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: 256651
diff changeset
   202
  // 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: 256651
diff changeset
   203
  // 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: 256651
diff changeset
   204
}
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: 256651
diff changeset
   205
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   206
NS_IMETHODIMP
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   207
WidgetShutdownObserver::Observe(nsISupports* aSubject, const char* aTopic,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   208
                                const char16_t* aData) {
256812
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: 256651
diff changeset
   209
  if (mWidget && !strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
341556
b4d1a0890f4048ded5479b157b75f05138a34ade Bug 1018486 - Part 3: Changes in widget/cocoa/, r=mstange
Michael Layzell <michael@thelayzells.com>
parents: 340322
diff changeset
   210
    RefPtr<nsBaseWidget> widget(mWidget);
b4d1a0890f4048ded5479b157b75f05138a34ade Bug 1018486 - Part 3: Changes in widget/cocoa/, r=mstange
Michael Layzell <michael@thelayzells.com>
parents: 340322
diff changeset
   211
    widget->Shutdown();
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   212
  }
256812
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: 256651
diff changeset
   213
  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: 256651
diff changeset
   214
}
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: 256651
diff changeset
   215
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   216
void WidgetShutdownObserver::Register() {
256812
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: 256651
diff changeset
   217
  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: 256651
diff changeset
   218
    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: 256651
diff changeset
   219
    nsContentUtils::RegisterShutdownObserver(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: 256651
diff changeset
   220
  }
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: 256651
diff changeset
   221
}
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: 256651
diff changeset
   222
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   223
void WidgetShutdownObserver::Unregister() {
256812
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: 256651
diff changeset
   224
  if (mRegistered) {
257328
a81b76a677aff7273c0556eac273cf7e6b28a4cc Bug 1156283 - Avoid shutdown observer race when shutting down gfx on Mac. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 256835
diff changeset
   225
    mWidget = nullptr;
256812
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: 256651
diff changeset
   226
    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: 256651
diff changeset
   227
    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: 256651
diff changeset
   228
  }
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   229
}
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   230
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   231
void nsBaseWidget::Shutdown() {
365765
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
   232
  NotifyLiveResizeStopped();
355865
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 354600
diff changeset
   233
  RevokeTransactionIdAllocator();
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   234
  DestroyCompositor();
256812
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: 256651
diff changeset
   235
  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: 256651
diff changeset
   236
#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: 256651
diff changeset
   237
  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: 256651
diff changeset
   238
    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: 256651
diff changeset
   239
    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: 256651
diff changeset
   240
  }
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: 256651
diff changeset
   241
#endif
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
   242
}
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
   243
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   244
void nsBaseWidget::DestroyCompositor() {
346086
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 345883
diff changeset
   245
  // 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: 345883
diff changeset
   246
  // 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: 345883
diff changeset
   247
  // 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: 345883
diff changeset
   248
  // 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: 345883
diff changeset
   249
  if (mCompositorVsyncDispatcher) {
446283
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
   250
    MOZ_ASSERT(mCompositorVsyncDispatcherLock.get());
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
   251
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
   252
    MutexAutoLock lock(*mCompositorVsyncDispatcherLock.get());
346086
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 345883
diff changeset
   253
    mCompositorVsyncDispatcher->Shutdown();
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 345883
diff changeset
   254
    mCompositorVsyncDispatcher = nullptr;
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 345883
diff changeset
   255
  }
7eaccbb8e8d39e301aa050db97b7034ec2bc45a1 Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 345883
diff changeset
   256
330321
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   257
  // 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: 330092
diff changeset
   258
  //  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: 330092
diff changeset
   259
  //  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: 330092
diff changeset
   260
  //  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: 330092
diff changeset
   261
  //     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: 330092
diff changeset
   262
  //  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: 330092
diff changeset
   263
  //  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: 330092
diff changeset
   264
  //     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: 330092
diff changeset
   265
  //  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: 330092
diff changeset
   266
  //     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: 330092
diff changeset
   267
  //
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   268
  // 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: 330092
diff changeset
   269
  // 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: 330092
diff changeset
   270
  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: 330092
diff changeset
   271
    ReleaseContentController();
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   272
    mAPZC = nullptr;
409335
db5a86cfd703c9bd245fd3bb26f2163c4b91b6ab Bug 1373739 - Make headless compositing Windows-compatible, in addition to Linux. r=dvander
Michael Smith <michael@spinda.net>
parents: 407823
diff changeset
   273
    SetCompositorWidgetDelegate(nullptr);
330321
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   274
    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: 330092
diff changeset
   275
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   276
    // XXX CompositorBridgeChild and CompositorBridgeParent might be re-created
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   277
    // in ClientLayerManager destructor. See bug 1133426.
330321
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   278
    RefPtr<CompositorSession> session = mCompositorSession.forget();
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   279
    session->Shutdown();
254174
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
   280
  }
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
   281
}
94685
328f316179bd128156703ce66cf743f3b3721d62 Bug 722012 - Fixes crash on Gtk widget destruction when using OMTC on linux. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94602
diff changeset
   282
355865
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 354600
diff changeset
   283
// 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: 354600
diff changeset
   284
// shutdown.
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   285
void nsBaseWidget::RevokeTransactionIdAllocator() {
355865
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 354600
diff changeset
   286
  if (!mLayerManager) {
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 354600
diff changeset
   287
    return;
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 354600
diff changeset
   288
  }
377740
e5a4ef40e13b5132fc666fdc8898aa6727dda99d Bug 1340510 - Fix nsBaseWidget::RevokeTransactionIdAllocator() r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 377739
diff changeset
   289
  mLayerManager->SetTransactionIdAllocator(nullptr);
355865
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 354600
diff changeset
   290
}
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 354600
diff changeset
   291
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   292
void nsBaseWidget::ReleaseContentController() {
330321
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   293
  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: 330092
diff changeset
   294
    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: 330092
diff changeset
   295
    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: 330092
diff changeset
   296
  }
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   297
}
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
   298
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   299
void nsBaseWidget::DestroyLayerManager() {
254174
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
   300
  if (mLayerManager) {
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
   301
    mLayerManager->Destroy();
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
   302
    mLayerManager = nullptr;
94685
328f316179bd128156703ce66cf743f3b3721d62 Bug 722012 - Fixes crash on Gtk widget destruction when using OMTC on linux. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94602
diff changeset
   303
  }
254174
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
   304
  DestroyCompositor();
94685
328f316179bd128156703ce66cf743f3b3721d62 Bug 722012 - Fixes crash on Gtk widget destruction when using OMTC on linux. r=karlt
Nicolas Silva <nsilva@mozilla.com>
parents: 94602
diff changeset
   305
}
90716
db7260efc9a774c4da1dc4e9df64125049666452 Bug 737437 - Post a task to handle compositor destruction. r=bgirard
Ali Juma <ajuma@mozilla.com>
parents: 90599
diff changeset
   306
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   307
void nsBaseWidget::OnRenderingDeviceReset() { DestroyLayerManager(); }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   308
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   309
void nsBaseWidget::FreeShutdownObserver() {
256812
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: 256651
diff changeset
   310
  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: 256651
diff changeset
   311
    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: 256651
diff changeset
   312
  }
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: 256651
diff changeset
   313
  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: 256651
diff changeset
   314
}
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: 256651
diff changeset
   315
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
   316
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   317
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   318
// 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
   319
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   320
//-------------------------------------------------------------------------
300014
a65ccabdef2edc82a80980ce00258c5e603f7121 Bug 1234210 - Restrict updates for accessibility.lastLoadDate to shutdown. r=trevor
Jim Mathies <jmathies@mozilla.com>
parents: 297653
diff changeset
   321
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   322
nsBaseWidget::~nsBaseWidget() {
294173
50657cb9988a3618b7db979b9f00e40a3c790a17 Bug 1222092. Don't let sFocusedIMEWidget keep an nsIWidget alive during shutdown. r=masayuki
Robert O'Callahan <robert@ocallahan.org>
parents: 293910
diff changeset
   323
  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: 293910
diff changeset
   324
351511
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   325
  if (mLayerManager) {
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   326
    if (BasicLayerManager* mgr = mLayerManager->AsBasicLayerManager()) {
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   327
      mgr->ClearRetainerWidget();
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   328
    }
47767
1e2f6e38cd981923b9f8d6612ed9a170326dff85 Bug 564991. Part 34: Make sure that ThebesLayerBuffers are always allocated as similar surfaces to the widget surface, whenever possible. r=cjones
Robert O'Callahan <robert@ocallahan.org>
parents: 47746
diff changeset
   329
  }
1e2f6e38cd981923b9f8d6612ed9a170326dff85 Bug 564991. Part 34: Make sure that ThebesLayerBuffers are always allocated as similar surfaces to the widget surface, whenever possible. r=cjones
Robert O'Callahan <robert@ocallahan.org>
parents: 47746
diff changeset
   330
256812
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: 256651
diff changeset
   331
  FreeShutdownObserver();
355865
7e4570efaff8b823db6e66025893acfe546a4d7c Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 354600
diff changeset
   332
  RevokeTransactionIdAllocator();
254174
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
   333
  DestroyLayerManager();
58810
8e216406592f9228288fea5e78eb11b2319f093b Bug 595277 - Part 0: Clear out user data on destroy. r=roc
Bas Schouten <bschouten@mozilla.com>
parents: 58753
diff changeset
   334
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
   335
#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
   336
  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
   337
  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
   338
#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
   339
69660
c8d5469bed72c3141ef8fcbb149151bf8eeab5f1 Bug 316661 - Part A - Remove null-checks before delete. r=bsmedberg
Ed Morley <bmo@edmorley.co.uk>
parents: 69338
diff changeset
   340
  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
   341
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   342
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   343
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   344
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   345
// 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
   346
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   347
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   348
void nsBaseWidget::BaseCreate(nsIWidget* aParent, nsWidgetInitData* aInitData) {
93966
e1fcace4621d6a1a05576c29d2765a8cfe6236bc Bug 754866 - Make mozilla.widget.disable-native-theme export shared bool across widgets. r=roc
Oleg Romashin <romaxa@gmail.com>
parents: 93531
diff changeset
   349
  static bool gDisableNativeThemeCached = false;
e1fcace4621d6a1a05576c29d2765a8cfe6236bc Bug 754866 - Make mozilla.widget.disable-native-theme export shared bool across widgets. r=roc
Oleg Romashin <romaxa@gmail.com>
parents: 93531
diff changeset
   350
  if (!gDisableNativeThemeCached) {
99577
1df6cd42330dc2520947b5e4f5c92b76bf82fe80 Bug 745148, part 6: Allow layer trees to be given IDs so that the referent can be used in another context. r=ajuma sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 99234
diff changeset
   351
    Preferences::AddBoolVarCache(&gDisableNativeTheme,
1df6cd42330dc2520947b5e4f5c92b76bf82fe80 Bug 745148, part 6: Allow layer trees to be given IDs so that the referent can be used in another context. r=ajuma sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 99234
diff changeset
   352
                                 "mozilla.widget.disable-native-theme",
1df6cd42330dc2520947b5e4f5c92b76bf82fe80 Bug 745148, part 6: Allow layer trees to be given IDs so that the referent can be used in another context. r=ajuma sr=roc
Chris Jones <jones.chris.g@gmail.com>
parents: 99234
diff changeset
   353
                                 gDisableNativeTheme);
93966
e1fcace4621d6a1a05576c29d2765a8cfe6236bc Bug 754866 - Make mozilla.widget.disable-native-theme export shared bool across widgets. r=roc
Oleg Romashin <romaxa@gmail.com>
parents: 93531
diff changeset
   354
    gDisableNativeThemeCached = true;
e1fcace4621d6a1a05576c29d2765a8cfe6236bc Bug 754866 - Make mozilla.widget.disable-native-theme export shared bool across widgets. r=roc
Oleg Romashin <romaxa@gmail.com>
parents: 93531
diff changeset
   355
  }
e1fcace4621d6a1a05576c29d2765a8cfe6236bc Bug 754866 - Make mozilla.widget.disable-native-theme export shared bool across widgets. r=roc
Oleg Romashin <romaxa@gmail.com>
parents: 93531
diff changeset
   356
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
   357
  // keep a reference to the device context
100814
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
   358
  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
   359
    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
   360
    mBorderStyle = aInitData->mBorderStyle;
48254
d8057f320d56b15669dc7ce5d4109e8c48cc09f0 Bug 552982, Part 3: support panel levels, r=mats
Neil Deakin <neil@mozilla.com>
parents: 47857
diff changeset
   361
    mPopupLevel = aInitData->mPopupLevel;
97313
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: 96994
diff changeset
   362
    mPopupType = aInitData->mPopupHint;
394439
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: 393832
diff changeset
   363
    mHasRemoteContent = aInitData->mHasRemoteContent;
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
   364
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   365
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   366
  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
   367
    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
   368
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   369
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   370
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   371
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   372
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   373
// 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
   374
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   375
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   376
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   377
nsIWidgetListener* nsBaseWidget::GetWidgetListener() { return mWidgetListener; }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   378
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   379
void nsBaseWidget::SetWidgetListener(nsIWidgetListener* aWidgetListener) {
102433
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: 102432
diff changeset
   380
  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
   381
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   382
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   383
already_AddRefed<nsIWidget> nsBaseWidget::CreateChild(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   384
    const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   385
    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
   386
  nsIWidget* parent = this;
100814
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
   387
  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
   388
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
   389
  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
   390
    // 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
   391
    // 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
   392
    // nativeWidget parameter.
100814
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
   393
    nativeParent = parent ? parent->GetNativeData(NS_NATIVE_WIDGET) : nullptr;
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
   394
    parent = nativeParent ? nullptr : parent;
242813
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: 242378
diff changeset
   395
    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
   396
  }
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
   397
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
   398
  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
   399
  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
   400
    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
   401
  } else {
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
   402
    static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID);
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
   403
    widget = do_CreateInstance(kCChildCID);
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
   404
  }
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
   405
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
   406
  if (widget &&
242244
28b5570caf8603291c518d04cd14e7bf92e64130 Bug 1129774. Part 5: Remove aContext parameter from nsIWidget::Create. r=jmathies
Robert O'Callahan <robert@ocallahan.org>
parents: 242243
diff changeset
   407
      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
   408
    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
   409
  }
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
   410
100814
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
   411
  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
   412
}
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
   413
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
   414
// Attach a view to our widget which we'll send events to.
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   415
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
   416
  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
   417
                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
   418
                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
   419
                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
   420
               "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
   421
102436
e66c290ab9fcbb37b809fc5273ef54b0cbd14339 Bug 743975 - remove the event handler argument to widget creation methods, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102435
diff changeset
   422
  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
   423
}
30ecff316b34836ee80542f3fc732a10d185e497 Bug 513162 - Widget additions for recycling top level widgets as content containers. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 42226
diff changeset
   424
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   425
nsIWidgetListener* nsBaseWidget::GetAttachedWidgetListener() {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   426
  return mAttachedWidgetListener;
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   427
}
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   428
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   429
nsIWidgetListener* nsBaseWidget::GetPreviouslyAttachedWidgetListener() {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   430
  return mPreviouslyAttachedWidgetListener;
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   431
}
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   432
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   433
void nsBaseWidget::SetPreviouslyAttachedWidgetListener(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   434
    nsIWidgetListener* aListener) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   435
  mPreviouslyAttachedWidgetListener = aListener;
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   436
}
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   437
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   438
void nsBaseWidget::SetAttachedWidgetListener(nsIWidgetListener* aListener) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   439
  mAttachedWidgetListener = aListener;
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   440
}
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
   441
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
   442
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   444
// 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
   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
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   447
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
   448
  // 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
   449
  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
   450
  // disconnect from the parent
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   451
  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
   452
  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
   453
    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
   454
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   455
332665
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: 331955
diff changeset
   456
#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: 331955
diff changeset
   457
  // 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: 331955
diff changeset
   458
  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: 331955
diff changeset
   459
#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
   460
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
// 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
   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
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   467
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
   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
//
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
   471
// 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
   472
//
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
   473
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   474
nsIWidget* nsBaseWidget::GetTopLevelWidget() {
100814
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
   475
  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
   476
  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
   477
    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
   478
    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
   479
  }
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
   480
  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
   481
}
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
   482
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
   483
//-------------------------------------------------------------------------
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
   484
//
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
   485
// 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
   486
//
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
   487
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   488
nsIWidget* nsBaseWidget::GetSheetWindowParent(void) { return nullptr; }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   489
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   490
float nsBaseWidget::GetDPI() { return 96.0f; }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   491
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   492
CSSToLayoutDeviceScale nsIWidget::GetDefaultScale() {
128134
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   493
  double devPixelsPerCSSPixel = DefaultScaleOverride();
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   494
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   495
  if (devPixelsPerCSSPixel <= 0.0) {
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   496
    devPixelsPerCSSPixel = GetDefaultScaleInternal();
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   497
  }
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   498
149830
948b5997476a2b0e6c4a0c5a7e29550c1e8dd8a5 Bug 912166 - Make nsIWidget::GetDefaultScale return a typed scale value. r=roc
Mina Almasry <mina@mozilla.com>
parents: 146497
diff changeset
   499
  return CSSToLayoutDeviceScale(devPixelsPerCSSPixel);
128134
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   500
}
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   501
444149388adb00a77008b9d6c69173cab550d81b bug 859266 - respect devPixelsPerPx preference when calculating screen dimens on Windows. r=roc
Jonathan Kew <jkew@mozilla.com>
parents: 126960
diff changeset
   502
/* static */
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   503
double nsIWidget::DefaultScaleOverride() {
388442
eed4429ced436cd68e968510f6e4d92bd553e286 Bug 1356565 - Use AddFloatVarCache to cache layout.css.devPixelsPerPx. r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 387735
diff changeset
   504
  // The number of device pixels per CSS pixel. A value <= 0 means choose
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   505
  // automatically based on the DPI. A positive value is used as-is. This
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   506
  // effectively controls the size of a CSS "px".
388442
eed4429ced436cd68e968510f6e4d92bd553e286 Bug 1356565 - Use AddFloatVarCache to cache layout.css.devPixelsPerPx. r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 387735
diff changeset
   507
  static float devPixelsPerCSSPixel = -1.0f;
eed4429ced436cd68e968510f6e4d92bd553e286 Bug 1356565 - Use AddFloatVarCache to cache layout.css.devPixelsPerPx. r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 387735
diff changeset
   508
386864
f0792bb960b6e16be5d854366ba81ec2a604052c Bug 1353493 - Cache the return value for nsIWidget::DefaultScaleOverride(). r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 382824
diff changeset
   509
  static bool valueCached = false;
f0792bb960b6e16be5d854366ba81ec2a604052c Bug 1353493 - Cache the return value for nsIWidget::DefaultScaleOverride(). r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 382824
diff changeset
   510
  if (!valueCached) {
388442
eed4429ced436cd68e968510f6e4d92bd553e286 Bug 1356565 - Use AddFloatVarCache to cache layout.css.devPixelsPerPx. r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 387735
diff changeset
   511
    Preferences::AddFloatVarCache(&devPixelsPerCSSPixel,
eed4429ced436cd68e968510f6e4d92bd553e286 Bug 1356565 - Use AddFloatVarCache to cache layout.css.devPixelsPerPx. r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 387735
diff changeset
   512
                                  "layout.css.devPixelsPerPx", -1.0f);
386864
f0792bb960b6e16be5d854366ba81ec2a604052c Bug 1353493 - Cache the return value for nsIWidget::DefaultScaleOverride(). r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 382824
diff changeset
   513
    valueCached = true;
111839
885fb1477a951e25ddca4cdd9b3e59114c212fde Bug 804062. Move device-pixels-per-CSS-pixel preference logic into nsIWidget::GetDefaultScale. r=jfkthame
Robert O'Callahan <robert@ocallahan.org>
parents: 111528
diff changeset
   514
  }
885fb1477a951e25ddca4cdd9b3e59114c212fde Bug 804062. Move device-pixels-per-CSS-pixel preference logic into nsIWidget::GetDefaultScale. r=jfkthame
Robert O'Callahan <robert@ocallahan.org>
parents: 111528
diff changeset
   515
388442
eed4429ced436cd68e968510f6e4d92bd553e286 Bug 1356565 - Use AddFloatVarCache to cache layout.css.devPixelsPerPx. r=kanru
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 387735
diff changeset
   516
  return devPixelsPerCSSPixel;
50782
e95f616c9ee928f417089befd546b25d87128c5f Bug 537890. Part 1: Add nsIWidget::GetDPI and nsIWidget::GetDefaultScale and use them to set up device contexts. r=vlad,sr=dbaron
Robert O'Callahan <robert@ocallahan.org>
parents: 50433
diff changeset
   517
}
e95f616c9ee928f417089befd546b25d87128c5f Bug 537890. Part 1: Add nsIWidget::GetDPI and nsIWidget::GetDefaultScale and use them to set up device contexts. r=vlad,sr=dbaron
Robert O'Callahan <robert@ocallahan.org>
parents: 50433
diff changeset
   518
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
   519
//-------------------------------------------------------------------------
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
   520
//
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
   521
// 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
   522
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   523
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   524
void nsBaseWidget::AddChild(nsIWidget* aChild) {
346943
b5c1c15e0a74879178f610a6e663271a52ed2adc Bug 1295596 - Remove release asserts from nsBaseWidget::AddChild associated with existing sibling checks. r=bsmedberg
Jim Mathies <jmathies@mozilla.com>
parents: 346865
diff changeset
   525
  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: 346865
diff changeset
   526
             "aChild not properly removed from its old child list");
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
   527
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
   528
  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
   529
    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
   530
  } 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
   531
    // append to the list
346943
b5c1c15e0a74879178f610a6e663271a52ed2adc Bug 1295596 - Remove release asserts from nsBaseWidget::AddChild associated with existing sibling checks. r=bsmedberg
Jim Mathies <jmathies@mozilla.com>
parents: 346865
diff changeset
   532
    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: 346865
diff changeset
   533
    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
   534
    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
   535
    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
   536
    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
   537
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
// 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
   543
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   545
void nsBaseWidget::RemoveChild(nsIWidget* aChild) {
138672
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: 138530
diff changeset
   546
#ifdef DEBUG
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: 138530
diff changeset
   547
#ifdef XP_MACOSX
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: 138530
diff changeset
   548
  // 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: 138530
diff changeset
   549
  // 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: 138530
diff changeset
   550
  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: 138530
diff changeset
   551
  NS_ASSERTION(!parent || parent == this, "Not one of our kids!");
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: 138530
diff changeset
   552
#else
316214
da683f5c0a43b8ee64b604406d784667b474f6d1 Bug 1174461 - [e10s] Return a cached result from SendGetNativePluginPort (r=jimm) a=kwierso
Bill McCloskey <billm@mozilla.com>
parents: 316207
diff changeset
   553
  MOZ_RELEASE_ASSERT(aChild->GetParent() == this, "Not one of our kids!");
138672
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: 138530
diff changeset
   554
#endif
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: 138530
diff changeset
   555
#endif
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
   556
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
   557
  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
   558
    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
   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
  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
   561
    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
   562
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   563
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
  // 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
   565
  // 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
   566
  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
   567
  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
   568
  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
   569
    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
   570
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   571
  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
   572
    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
   573
  }
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
   574
100814
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
   575
  aChild->SetNextSibling(nullptr);
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
   576
  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
   577
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   578
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   579
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   580
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   581
// 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
   582
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   583
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   584
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
   585
  // 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
   586
  // 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
   587
  nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
   588
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
   589
  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
   590
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   591
  // reorder this child in its parent's list.
357002
9c229cf88ec224739f127082c1e8ec4c322bcd6f Bug 1317973 - Use auto type specifier for variable declarations to improve code readability and maintainability r=tnikkel
Sylvestre Ledru <sledru@mozilla.com>
parents: 355865
diff changeset
   592
  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
   593
  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
   594
    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
   595
    // 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
   596
    nsIWidget* sib = parent->GetFirstChild();
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   597
    for (; sib; sib = sib->GetNextSibling()) {
181005
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: 179178
diff changeset
   598
      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: 179178
diff changeset
   599
      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: 179178
diff changeset
   600
        // 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: 179178
diff changeset
   601
        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: 179178
diff changeset
   602
        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: 179178
diff changeset
   603
        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: 179178
diff changeset
   604
        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: 179178
diff changeset
   605
        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: 179178
diff changeset
   606
          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: 179178
diff changeset
   607
        } 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: 179178
diff changeset
   608
          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: 179178
diff changeset
   609
          // 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: 179178
diff changeset
   610
          // 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: 179178
diff changeset
   611
          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
   612
        }
181005
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: 179178
diff changeset
   613
        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: 179178
diff changeset
   614
        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
   615
      }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   616
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
    // 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
   618
    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
   619
      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
   620
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   621
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   622
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
// 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
   627
// 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
   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
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   630
void nsBaseWidget::SetSizeMode(nsSizeMode aMode) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   631
  MOZ_ASSERT(aMode == nsSizeMode_Normal || aMode == nsSizeMode_Minimized ||
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   632
             aMode == nsSizeMode_Maximized || aMode == nsSizeMode_Fullscreen);
279876
b8d3872064c7f369787c5097db9956ca99a5253c Bug 1196163 part 1 - Use nsSizeMode instead of int32_t for nsIWidget::{SizeMode,SetSizeMode}. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 279865
diff changeset
   633
  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
   634
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   635
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   636
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   637
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   638
// 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
   639
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   640
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   641
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   642
void nsBaseWidget::SetCursor(nsCursor aCursor) { mCursor = aCursor; }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   643
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   644
nsresult nsBaseWidget::SetCursor(imgIContainer* aCursor, uint32_t aHotspotX,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   645
                                 uint32_t aHotspotY) {
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
  return NS_ERROR_NOT_IMPLEMENTED;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
}
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
   648
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
   649
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
// 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
   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
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   655
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
   656
16601
460fce61ebc7230eecaa9719e83f12102d472373 Implement Aero Glass effect support - bug 418454 r=vlad r=roc
Rob Arnold <robarnold@mozilla.com>
parents: 16520
diff changeset
   657
nsTransparencyMode nsBaseWidget::GetTransparencyMode() {
460fce61ebc7230eecaa9719e83f12102d472373 Implement Aero Glass effect support - bug 418454 r=vlad r=roc
Rob Arnold <robarnold@mozilla.com>
parents: 16520
diff changeset
   658
  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
   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
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   661
bool nsBaseWidget::IsWindowClipRegionEqual(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   662
    const nsTArray<LayoutDeviceIntRect>& aRects) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   663
  return mClipRects && mClipRectCount == aRects.Length() &&
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   664
         memcmp(mClipRects.get(), aRects.Elements(),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   665
                sizeof(LayoutDeviceIntRect) * mClipRectCount) == 0;
240898
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: 240660
diff changeset
   666
}
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: 240660
diff changeset
   667
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   668
void nsBaseWidget::StoreWindowClipRegion(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   669
    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
   670
  mClipRectCount = aRects.Length();
297011
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296863
diff changeset
   671
  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
   672
  if (mClipRects) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   673
    memcpy(mClipRects.get(), aRects.Elements(),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   674
           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
   675
  }
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   676
}
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   677
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   678
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
   679
  if (mClipRects) {
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   680
    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
   681
  } else {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   682
    aRects->AppendElement(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   683
        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
   684
  }
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   685
}
8d7d268bd181f6b5064c6c5c270e86190c9716d0 Bug 339548. Part 3: Introduce native widget clip region API.
Robert O'Callahan <robert@ocallahan.org>
parents: 30075
diff changeset
   686
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   687
const LayoutDeviceIntRegion nsBaseWidget::RegionFromArray(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   688
    const nsTArray<LayoutDeviceIntRect>& aRects) {
297011
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296863
diff changeset
   689
  LayoutDeviceIntRegion region;
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   690
  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: 224257
diff changeset
   691
    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: 224257
diff changeset
   692
  }
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   693
  return region;
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   694
}
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   695
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   696
void nsBaseWidget::ArrayFromRegion(const LayoutDeviceIntRegion& aRegion,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   697
                                   nsTArray<LayoutDeviceIntRect>& aRects) {
305643
3b02ba9cfc4f686b6d485c729c31c02e2477b611 Bug 1239864 (part 10) - Use the new rect iterators in view/ and widget/. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 305527
diff changeset
   698
  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: 305527
diff changeset
   699
    aRects.AppendElement(iter.Get());
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   700
  }
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   701
}
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   702
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   703
nsresult nsBaseWidget::SetWindowClipRegion(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   704
    const nsTArray<LayoutDeviceIntRect>& aRects, bool aIntersectWithExisting) {
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   705
  if (!aIntersectWithExisting) {
240898
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: 240660
diff changeset
   706
    StoreWindowClipRegion(aRects);
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   707
  } else {
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   708
    // get current rects
297011
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296863
diff changeset
   709
    nsTArray<LayoutDeviceIntRect> currentRects;
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   710
    GetWindowClipRegion(&currentRects);
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   711
    // create region from them
297011
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296863
diff changeset
   712
    LayoutDeviceIntRegion currentRegion = RegionFromArray(currentRects);
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   713
    // create region from new rects
297011
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296863
diff changeset
   714
    LayoutDeviceIntRegion newRegion = RegionFromArray(aRects);
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   715
    // intersect regions
297011
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296863
diff changeset
   716
    LayoutDeviceIntRegion intersection;
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   717
    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: 224257
diff changeset
   718
    // create int rect array from intersection
297011
1602b93dcc413caa7ac8af1a2ca8d3812c6b33b9 Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296863
diff changeset
   719
    nsTArray<LayoutDeviceIntRect> rects;
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   720
    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: 224257
diff changeset
   721
    // store
240898
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: 240660
diff changeset
   722
    StoreWindowClipRegion(rects);
227617
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   723
  }
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   724
  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: 224257
diff changeset
   725
}
dcc233b91a99e7d8cfaa39b508d2eb2c2496fab6 Bug 669200 - Various widget changes to support two new types of plugin widget. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 224257
diff changeset
   726
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   727
/* virtual */ void nsBaseWidget::PerformFullscreenTransition(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   728
    FullscreenTransitionStage aStage, uint16_t aDuration, nsISupports* aData,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   729
    nsIRunnable* aCallback) {
271576
5e2d116989a55b3db96e88864ea1fc89fd56a235 Bug 1160014 part 1 - Implement common part of fullscreen transition. r=roc,smaug,dao
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271449
diff changeset
   730
  MOZ_ASSERT_UNREACHABLE(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   731
      "Should never call PerformFullscreenTransition on nsBaseWidget");
271576
5e2d116989a55b3db96e88864ea1fc89fd56a235 Bug 1160014 part 1 - Implement common part of fullscreen transition. r=roc,smaug,dao
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271449
diff changeset
   732
}
5e2d116989a55b3db96e88864ea1fc89fd56a235 Bug 1160014 part 1 - Implement common part of fullscreen transition. r=roc,smaug,dao
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271449
diff changeset
   733
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
   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
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
// 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
   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
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   739
void nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   740
                                            nsIScreen* aScreen) {
30004
Doug Turner <dougt@meer.net>
parents: 29975
diff changeset
   741
  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
   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
  if (aFullScreen) {
294194
25836f531c30e3119d41d69b71e8c4daccb85f85 Bug 1224482 (part 7) - Make GetScaledScreenBounds() return a CSSIntRect. r=kats.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294190
diff changeset
   744
    if (!mOriginalBounds) {
302236
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302234
diff changeset
   745
      mOriginalBounds = new LayoutDeviceIntRect();
294194
25836f531c30e3119d41d69b71e8c4daccb85f85 Bug 1224482 (part 7) - Make GetScaledScreenBounds() return a CSSIntRect. r=kats.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294190
diff changeset
   746
    }
338754
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338753
diff changeset
   747
    *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
   748
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   749
    // Move to top-left corner of screen and size to the screen dimensions
271577
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
   750
    nsCOMPtr<nsIScreen> screen = aScreen;
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
   751
    if (!screen) {
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
   752
      screen = GetWidgetScreen();
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
   753
    }
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
   754
    if (screen) {
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
   755
      int32_t left, top, width, height;
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   756
      if (NS_SUCCEEDED(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   757
              screen->GetRectDisplayPix(&left, &top, &width, &height))) {
271577
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
   758
        Resize(left, top, width, height, 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
   759
      }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   760
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   761
  } else if (mOriginalBounds) {
302236
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302234
diff changeset
   762
    if (BoundsUseDesktopPixels()) {
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302234
diff changeset
   763
      DesktopRect deskRect = *mOriginalBounds / GetDesktopToDeviceScale();
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   764
      Resize(deskRect.X(), deskRect.Y(), deskRect.Width(), deskRect.Height(),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   765
             true);
302236
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302234
diff changeset
   766
    } else {
437295
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 435452
diff changeset
   767
      Resize(mOriginalBounds->X(), mOriginalBounds->Y(),
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   768
             mOriginalBounds->Width(), mOriginalBounds->Height(), true);
302236
cc09fb02f2c9191098ff2ab9ba97ed57162e806b Bug 890156 - patch 1 - Add nsIWidget::GetDesktopToDeviceScale() method. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302234
diff changeset
   769
    }
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
   770
  }
338757
581e898152d059ed2c2f9ba38c36f14291328e83 Bug 1293596 (part 5) - Tweak nsIWidget::MakeFullScreen{,WithNativeTransition}(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338755
diff changeset
   771
}
581e898152d059ed2c2f9ba38c36f14291328e83 Bug 1293596 (part 5) - Tweak nsIWidget::MakeFullScreen{,WithNativeTransition}(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338755
diff changeset
   772
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   773
nsresult nsBaseWidget::MakeFullScreen(bool aFullScreen, nsIScreen* aScreen) {
338757
581e898152d059ed2c2f9ba38c36f14291328e83 Bug 1293596 (part 5) - Tweak nsIWidget::MakeFullScreen{,WithNativeTransition}(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338755
diff changeset
   774
  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
   775
  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
   776
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   777
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
   778
nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   779
    nsBaseWidget* aWidget, gfxContext* aTarget, BufferMode aDoubleBuffering,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   780
    ScreenRotation aRotation)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   781
    : mWidget(aWidget) {
351511
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   782
  LayerManager* lm = mWidget->GetLayerManager();
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   783
  NS_ASSERTION(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   784
      !lm || lm->GetBackendType() == LayersBackend::LAYERS_BASIC,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   785
      "AutoLayerManagerSetup instantiated for non-basic layer backend!");
351511
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   786
  if (lm) {
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   787
    mLayerManager = lm->AsBasicLayerManager();
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   788
    if (mLayerManager) {
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   789
      mLayerManager->SetDefaultTarget(aTarget);
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   790
      mLayerManager->SetDefaultTargetConfiguration(aDoubleBuffering, aRotation);
a229fb665939c49ae5dbccd0717882aa65f8029b Bug 1315477 - Add a AsBasicLayerManager() function and use instead of static_casts. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 350761
diff changeset
   791
    }
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
   792
  }
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
   793
}
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
   794
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   795
nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup() {
117091
0bcd652f17321e89975e97dd555c78675d46f06b Bug 824868. Make AutoLayerManagerSetup save the layer manager it is using so we are sure to use the right oen when it goes out of scope to clean up. r=roc
Timothy Nikkel <tnikkel@gmail.com>
parents: 116242
diff changeset
   796
  if (mLayerManager) {
0bcd652f17321e89975e97dd555c78675d46f06b Bug 824868. Make AutoLayerManagerSetup save the layer manager it is using so we are sure to use the right oen when it goes out of scope to clean up. r=roc
Timothy Nikkel <tnikkel@gmail.com>
parents: 116242
diff changeset
   797
    mLayerManager->SetDefaultTarget(nullptr);
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   798
    mLayerManager->SetDefaultTargetConfiguration(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   799
        mozilla::layers::BufferMode::BUFFER_NONE, ROTATION_0);
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
   800
  }
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
   801
}
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
   802
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   803
bool nsBaseWidget::IsSmallPopup() const {
329355
e9723c6c6136e2311374e5e6d4ea9cdc9f42b6b3 Bug 1264365 - Disable hardware acceleration for small popup widgets. r=dvander
Nicolas Silva <nsilva@mozilla.com>
parents: 328812
diff changeset
   804
  return mWindowType == eWindowType_popup && mPopupType != ePopupTypePanel;
e9723c6c6136e2311374e5e6d4ea9cdc9f42b6b3 Bug 1264365 - Disable hardware acceleration for small popup widgets. r=dvander
Nicolas Silva <nsilva@mozilla.com>
parents: 328812
diff changeset
   805
}
e9723c6c6136e2311374e5e6d4ea9cdc9f42b6b3 Bug 1264365 - Disable hardware acceleration for small popup widgets. r=dvander
Nicolas Silva <nsilva@mozilla.com>
parents: 328812
diff changeset
   806
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   807
bool nsBaseWidget::ComputeShouldAccelerate() {
437975
a99a53c8f13d7a93eb1c532358d5e36dc6eece61 Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats
Nicolas Silva <nsilva@mozilla.com>
parents: 437295
diff changeset
   808
  if (gfx::gfxVars::UseWebRender() && !AllowWebRenderForThisWindow()) {
a99a53c8f13d7a93eb1c532358d5e36dc6eece61 Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats
Nicolas Silva <nsilva@mozilla.com>
parents: 437295
diff changeset
   809
    // If WebRender is enabled, non-WebRender widgets use the basic compositor
a99a53c8f13d7a93eb1c532358d5e36dc6eece61 Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats
Nicolas Silva <nsilva@mozilla.com>
parents: 437295
diff changeset
   810
    // (at least for now), even though they would get an accelerated compositor
a99a53c8f13d7a93eb1c532358d5e36dc6eece61 Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats
Nicolas Silva <nsilva@mozilla.com>
parents: 437295
diff changeset
   811
    // if WebRender wasn't enabled.
a99a53c8f13d7a93eb1c532358d5e36dc6eece61 Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats
Nicolas Silva <nsilva@mozilla.com>
parents: 437295
diff changeset
   812
    return false;
a99a53c8f13d7a93eb1c532358d5e36dc6eece61 Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats
Nicolas Silva <nsilva@mozilla.com>
parents: 437295
diff changeset
   813
  }
346987
72c643ed82ba38231f730a5995579e3606f43e9a Bug 1299860 - Don't use the compositor backend of a popup with ImageBridge and VRManager. r=Bas
Nicolas Silva <nsilva@mozilla.com>
parents: 346943
diff changeset
   814
  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: 346943
diff changeset
   815
         WidgetTypeSupportsAcceleration();
53686
350f09a18800bd0e01fffdbe03b5e081b4f96145 b=594553; correctly create gl layer manager on android; r=jrmuizel
Vladimir Vukicevic <vladimir@pobox.com>
parents: 52189
diff changeset
   816
}
350f09a18800bd0e01fffdbe03b5e081b4f96145 b=594553; correctly create gl layer manager on android; r=jrmuizel
Vladimir Vukicevic <vladimir@pobox.com>
parents: 52189
diff changeset
   817
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   818
bool nsBaseWidget::UseAPZ() {
321849
b45b6eca1e7b239197945e0966674979731834ba Use CompositorWidgetProxy in place of nsIWidget in CompositorBridgeParent. (bug 1264545 part 5, r=jimm,kats)
David Anderson <danderson@mozilla.com>
parents: 321708
diff changeset
   819
  return (gfxPlatform::AsyncPanZoomEnabled() &&
393075
63a1460c38043c88d9ff4556eed904aebeb333ce Bug 1353060: Allow APZ in popup window widgets. r=kats
Kris Maglione <maglione.k@gmail.com>
parents: 392653
diff changeset
   820
          (WindowType() == eWindowType_toplevel ||
63a1460c38043c88d9ff4556eed904aebeb333ce Bug 1353060: Allow APZ in popup window widgets. r=kats
Kris Maglione <maglione.k@gmail.com>
parents: 392653
diff changeset
   821
           WindowType() == eWindowType_child ||
405158
228602d59911f40a39c75841722be7c4b124c447 Bug 1381097: Part 1 - Add default-false pref to enable APZ in remote popups. r=kats
Kris Maglione <maglione.k@gmail.com>
parents: 403597
diff changeset
   822
           (WindowType() == eWindowType_popup && HasRemoteContent() &&
228602d59911f40a39c75841722be7c4b124c447 Bug 1381097: Part 1 - Add default-false pref to enable APZ in remote popups. r=kats
Kris Maglione <maglione.k@gmail.com>
parents: 403597
diff changeset
   823
            gfxPrefs::APZPopupsEnabled())));
321849
b45b6eca1e7b239197945e0966674979731834ba Use CompositorWidgetProxy in place of nsIWidget in CompositorBridgeParent. (bug 1264545 part 5, r=jimm,kats)
David Anderson <danderson@mozilla.com>
parents: 321708
diff changeset
   824
}
b45b6eca1e7b239197945e0966674979731834ba Use CompositorWidgetProxy in place of nsIWidget in CompositorBridgeParent. (bug 1264545 part 5, r=jimm,kats)
David Anderson <danderson@mozilla.com>
parents: 321708
diff changeset
   825
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   826
bool nsBaseWidget::AllowWebRenderForThisWindow() {
438191
fe6f236e1fb51c18210ed992f53c2246669504b5 Bug 1430797 - Allow webrender on eWindowType_child, so that it is used on OS X. r=nical
Kartikaya Gupta <kgupta@mozilla.com>
parents: 437975
diff changeset
   827
  return WindowType() == eWindowType_toplevel ||
fe6f236e1fb51c18210ed992f53c2246669504b5 Bug 1430797 - Allow webrender on eWindowType_child, so that it is used on OS X. r=nical
Kartikaya Gupta <kgupta@mozilla.com>
parents: 437975
diff changeset
   828
         WindowType() == eWindowType_child ||
438346
f05239cea76cbc2634a39f5e6879989d09ea29a4 Bug 1430797 - Follow-up to address review comment. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 438191
diff changeset
   829
         WindowType() == eWindowType_dialog ||
438191
fe6f236e1fb51c18210ed992f53c2246669504b5 Bug 1430797 - Allow webrender on eWindowType_child, so that it is used on OS X. r=nical
Kartikaya Gupta <kgupta@mozilla.com>
parents: 437975
diff changeset
   830
         (WindowType() == eWindowType_popup && HasRemoteContent());
437975
a99a53c8f13d7a93eb1c532358d5e36dc6eece61 Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats
Nicolas Silva <nsilva@mozilla.com>
parents: 437295
diff changeset
   831
}
a99a53c8f13d7a93eb1c532358d5e36dc6eece61 Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats
Nicolas Silva <nsilva@mozilla.com>
parents: 437295
diff changeset
   832
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   833
void nsBaseWidget::CreateCompositor() {
338754
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338753
diff changeset
   834
  LayoutDeviceIntRect rect = GetBounds();
437295
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 435452
diff changeset
   835
  CreateCompositor(rect.Width(), rect.Height());
125701
e70bea1fd1662ece0eb065c085bce689456b7fa0 Bug 852526 - Make sure the compositor starts unpaused and with a size. r=kats
Chris Lord <chrislord.net@gmail.com>
parents: 125451
diff changeset
   836
}
e70bea1fd1662ece0eb065c085bce689456b7fa0 Bug 852526 - Make sure the compositor starts unpaused and with a size. r=kats
Chris Lord <chrislord.net@gmail.com>
parents: 125451
diff changeset
   837
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   838
already_AddRefed<GeckoContentController>
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   839
nsBaseWidget::CreateRootContentController() {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   840
  RefPtr<GeckoContentController> controller =
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   841
      new ChromeProcessController(this, mAPZEventState, mAPZC);
232974
71b13c6e679a7436dfd3cd3ab6411f9358388f33 Create a common chrome-process GeckoContentController. (bug 1110540 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 232973
diff changeset
   842
  return controller.forget();
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   843
}
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   844
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   845
void nsBaseWidget::ConfigureAPZCTreeManager() {
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   846
  MOZ_ASSERT(mAPZC);
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   847
252202
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 251911
diff changeset
   848
  ConfigureAPZControllerThread();
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 251911
diff changeset
   849
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   850
  mAPZC->SetDPI(GetDPI());
402079
e37625d5695e96bbd554db809db07abbba56fe3e Bug 1351783 part 17 - Do less work when apz.keyboard.enabled is false. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 402068
diff changeset
   851
e37625d5695e96bbd554db809db07abbba56fe3e Bug 1351783 part 17 - Do less work when apz.keyboard.enabled is false. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 402068
diff changeset
   852
  if (gfxPrefs::APZKeyboardEnabled()) {
e37625d5695e96bbd554db809db07abbba56fe3e Bug 1351783 part 17 - Do less work when apz.keyboard.enabled is false. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 402068
diff changeset
   853
    mAPZC->SetKeyboardMap(nsXBLWindowKeyHandler::CollectKeyboardShortcuts());
e37625d5695e96bbd554db809db07abbba56fe3e Bug 1351783 part 17 - Do less work when apz.keyboard.enabled is false. r=kats
Ryan Hunt <rhunt@eqrion.net>
parents: 402068
diff changeset
   854
  }
282022
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 282021
diff changeset
   855
333453
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 333289
diff changeset
   856
  RefPtr<IAPZCTreeManager> treeManager = mAPZC;  // for capture by the lambdas
282022
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 282021
diff changeset
   857
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 282021
diff changeset
   858
  ContentReceivedInputBlockCallback callback(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   859
      [treeManager](const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   860
                    bool aPreventDefault) {
282022
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 282021
diff changeset
   861
        MOZ_ASSERT(NS_IsMainThread());
401914
312f7a5a2c08d394a2403c837e5ee546dd4103d7 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
Bill McCloskey <billm@mozilla.com>
parents: 401829
diff changeset
   862
        APZThreadUtils::RunOnControllerThread(NewRunnableMethod<uint64_t, bool>(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   863
            "layers::IAPZCTreeManager::ContentReceivedInputBlock", treeManager,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   864
            &IAPZCTreeManager::ContentReceivedInputBlock, aInputBlockId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   865
            aPreventDefault));
282022
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 282021
diff changeset
   866
      });
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 282021
diff changeset
   867
  mAPZEventState = new APZEventState(this, mozilla::Move(callback));
fbfb900230fe46a08c37aa9e4d5ac74f61228d38 Bug 1202312 - Use mozilla::Function for the ContentReceivedInputBlock callback. r=kats
Botond Ballo <botond@mozilla.com>
parents: 282021
diff changeset
   868
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   869
  mSetAllowedTouchBehaviorCallback =
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   870
      [treeManager](uint64_t aInputBlockId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   871
                    const nsTArray<TouchBehaviorFlags>& aFlags) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   872
        MOZ_ASSERT(NS_IsMainThread());
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   873
        APZThreadUtils::RunOnControllerThread(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   874
            NewRunnableMethod<
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   875
                uint64_t, StoreCopyPassByLRef<nsTArray<TouchBehaviorFlags>>>(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   876
                "layers::IAPZCTreeManager::SetAllowedTouchBehavior",
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   877
                treeManager, &IAPZCTreeManager::SetAllowedTouchBehavior,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   878
                aInputBlockId, aFlags));
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   879
      };
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   880
319779
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 319456
diff changeset
   881
  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: 319456
diff changeset
   882
  if (mRootContentController) {
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
   883
    mCompositorSession->SetContentController(mRootContentController);
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   884
  }
289201
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 289080
diff changeset
   885
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 289080
diff changeset
   886
  // 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: 289080
diff changeset
   887
  // 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: 289080
diff changeset
   888
  // function doesn't get called.
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 289080
diff changeset
   889
  if (Preferences::GetInt("dom.w3c_touch_events.enabled", 0) ||
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 289080
diff changeset
   890
      Preferences::GetBool("dom.w3c_pointer_events.enabled", false)) {
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 289080
diff changeset
   891
    RegisterTouchWindow();
cb6b065f2a23d263fa47cdcf71016cbdf0f8deb6 Bug 978679. Implement touch events for GTK3. r=karlt
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 289080
diff changeset
   892
  }
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   893
}
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
   894
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   895
void nsBaseWidget::ConfigureAPZControllerThread() {
252202
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 251911
diff changeset
   896
  // By default the controller thread is the main thread.
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 251911
diff changeset
   897
  APZThreadUtils::SetControllerThread(MessageLoop::current());
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 251911
diff changeset
   898
}
c2179c027c28922befd5617fdb5c5728cc387b10 Allow dispatching to the APZ controller thread from any thread. (bug 1147681 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 251911
diff changeset
   899
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   900
void nsBaseWidget::SetConfirmedTargetAPZC(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   901
    uint64_t aInputBlockId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   902
    const nsTArray<ScrollableLayerGuid>& aTargets) const {
401914
312f7a5a2c08d394a2403c837e5ee546dd4103d7 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
Bill McCloskey <billm@mozilla.com>
parents: 401829
diff changeset
   903
  APZThreadUtils::RunOnControllerThread(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   904
      NewRunnableMethod<uint64_t,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   905
                        StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   906
          "layers::IAPZCTreeManager::SetTargetAPZC", mAPZC,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   907
          &IAPZCTreeManager::SetTargetAPZC, aInputBlockId, aTargets));
256206
879e74f2e74cc56c507c7784f05020462c7ad734 Fix APZ target confirmations arriving before dependent layer transactions. (bug 1154130, r=kats)
David Anderson <danderson@mozilla.com>
parents: 256184
diff changeset
   908
}
879e74f2e74cc56c507c7784f05020462c7ad734 Fix APZ target confirmations arriving before dependent layer transactions. (bug 1154130, r=kats)
David Anderson <danderson@mozilla.com>
parents: 256184
diff changeset
   909
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   910
void nsBaseWidget::UpdateZoomConstraints(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   911
    const uint32_t& aPresShellId, const FrameMetrics::ViewID& aViewId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   912
    const Maybe<ZoomConstraints>& aConstraints) {
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
   913
  if (!mCompositorSession || !mAPZC) {
290795
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
   914
    if (mInitialZoomConstraints) {
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
   915
      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: 290351
diff changeset
   916
      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: 290351
diff changeset
   917
      if (!aConstraints) {
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
   918
        mInitialZoomConstraints.reset();
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
   919
      }
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
   920
    }
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
   921
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
   922
    if (aConstraints) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   923
      // We have some constraints, but the compositor and APZC aren't created
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   924
      // yet. Save these so we can use them later.
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   925
      mInitialZoomConstraints = Some(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   926
          InitialZoomConstraints(aPresShellId, aViewId, aConstraints.ref()));
290795
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
   927
    }
267533
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: 266846
diff changeset
   928
    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: 266846
diff changeset
   929
  }
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
   930
  uint64_t layersId = mCompositorSession->RootLayerTreeId();
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   931
  mAPZC->UpdateZoomConstraints(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   932
      ScrollableLayerGuid(layersId, aPresShellId, aViewId), aConstraints);
267533
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: 266846
diff changeset
   933
}
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: 266846
diff changeset
   934
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   935
bool nsBaseWidget::AsyncPanZoomEnabled() const { return !!mAPZC; }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   936
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   937
nsEventStatus nsBaseWidget::ProcessUntransformedAPZEvent(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   938
    WidgetInputEvent* aEvent, const ScrollableLayerGuid& aGuid,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   939
    uint64_t aInputBlockId, nsEventStatus aApzResponse) {
242871
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: 242813
diff changeset
   940
  MOZ_ASSERT(NS_IsMainThread());
262376
8c5b4478608d9a993850464fe07797d39bb406bb Bug 1162009 - Add TOUCH_CANCEL sending on e10s. r=kats
Maksim Lebedev <Alessarik@gmail.com>
parents: 262105
diff changeset
   941
  InputAPZContext context(aGuid, aInputBlockId, aApzResponse);
233758
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   942
313349
f5bc4a98a12cf1166a6c9607faedfdd269f127b3 Bug 1242690 - Ensure that mouse events have the callback transform applied. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 309718
diff changeset
   943
  // If this is an event that the APZ has targeted to an APZC in the root
243234
cc71f20bede1aedd7385e4a9a5c04f89509e25b1 Bug 1127066 - Apply the APZ callback transform to touch events targeted to the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 242915
diff changeset
   944
  // process, apply that APZC's callback-transform before dispatching the
cc71f20bede1aedd7385e4a9a5c04f89509e25b1 Bug 1127066 - Apply the APZ callback transform to touch events targeted to the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 242915
diff changeset
   945
  // event. If the event is instead targeted to an APZC in the child process,
cc71f20bede1aedd7385e4a9a5c04f89509e25b1 Bug 1127066 - Apply the APZ callback transform to touch events targeted to the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 242915
diff changeset
   946
  // the transform will be applied in the child process before dispatching
cc71f20bede1aedd7385e4a9a5c04f89509e25b1 Bug 1127066 - Apply the APZ callback transform to touch events targeted to the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 242915
diff changeset
   947
  // the event there (see e.g. TabChild::RecvRealTouchEvent()).
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
   948
  if (aGuid.mLayersId == mCompositorSession->RootLayerTreeId()) {
313349
f5bc4a98a12cf1166a6c9607faedfdd269f127b3 Bug 1242690 - Ensure that mouse events have the callback transform applied. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 309718
diff changeset
   949
    APZCCallbackHelper::ApplyCallbackTransform(*aEvent, aGuid,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   950
                                               GetDefaultScale());
243234
cc71f20bede1aedd7385e4a9a5c04f89509e25b1 Bug 1127066 - Apply the APZ callback transform to touch events targeted to the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 242915
diff changeset
   951
  }
cc71f20bede1aedd7385e4a9a5c04f89509e25b1 Bug 1127066 - Apply the APZ callback transform to touch events targeted to the root process. r=kats
Botond Ballo <botond@mozilla.com>
parents: 242915
diff changeset
   952
296552
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: 295358
diff changeset
   953
  // 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: 295358
diff changeset
   954
  // 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: 295358
diff changeset
   955
  // ways that we don't want (i.e. touch points can get stripped out).
233758
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   956
  nsEventStatus status;
296552
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: 295358
diff changeset
   957
  UniquePtr<WidgetEvent> original(aEvent->Duplicate());
233758
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   958
  DispatchEvent(aEvent, status);
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   959
313349
f5bc4a98a12cf1166a6c9607faedfdd269f127b3 Bug 1242690 - Ensure that mouse events have the callback transform applied. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 309718
diff changeset
   960
  if (mAPZC && !context.WasRoutedToChildProcess() && aInputBlockId) {
243236
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: 243234
diff changeset
   961
    // EventStateManager did not route the event into the child process.
233758
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   962
    // It's safe to communicate to APZ that the event has been processed.
243241
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 243236
diff changeset
   963
    // TODO: Eventually we'll be able to move the SendSetTargetAPZCNotification
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 243236
diff changeset
   964
    // call into APZEventState::Process*Event() as well.
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 243236
diff changeset
   965
    if (WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent()) {
282266
a92cec9902d70d52289ee2205b3f5f925c332e3c Bug 895274 part.241 Rename NS_TOUCH_START to eTouchStart r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 282257
diff changeset
   966
      if (touchEvent->mMessage == eTouchStart) {
250618
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: 250143
diff changeset
   967
        if (gfxPrefs::TouchActionEnabled()) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   968
          APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   969
              this, GetDocument(), *(original->AsTouchEvent()), aInputBlockId,
296552
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: 295358
diff changeset
   970
              mSetAllowedTouchBehaviorCallback);
250618
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: 250143
diff changeset
   971
        }
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   972
        APZCCallbackHelper::SendSetTargetAPZCNotification(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   973
            this, GetDocument(), *(original->AsTouchEvent()), aGuid,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   974
            aInputBlockId);
243241
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 243236
diff changeset
   975
      }
291973
377b4cc2501664fcdf2d8f8078384414f5a2924a Bug 1219898 - Remove use of gPreventMouseEvents in APZ event state-tracking code. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 291937
diff changeset
   976
      mAPZEventState->ProcessTouchEvent(*touchEvent, aGuid, aInputBlockId,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   977
                                        aApzResponse, status);
243241
0c3e7de46a8873ec225e4a6510778cf591c467b2 Bug 1127066 - Use APZEventState in nsBaseWidget. r=kats
Botond Ballo <botond@mozilla.com>
parents: 243236
diff changeset
   978
    } else if (WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent()) {
328237
b72ab182dd554343b504a771e535214de53b5d6f Bug 1273137 - Add the missing main-thread target confirmation for drag blocks. r=rbarker
Kartikaya Gupta <kgupta@mozilla.com>
parents: 326885
diff changeset
   979
      MOZ_ASSERT(wheelEvent->mFlags.mHandledByAPZ);
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   980
      APZCCallbackHelper::SendSetTargetAPZCNotification(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   981
          this, GetDocument(), *(original->AsWheelEvent()), aGuid,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   982
          aInputBlockId);
328237
b72ab182dd554343b504a771e535214de53b5d6f Bug 1273137 - Add the missing main-thread target confirmation for drag blocks. r=rbarker
Kartikaya Gupta <kgupta@mozilla.com>
parents: 326885
diff changeset
   983
      if (wheelEvent->mCanTriggerSwipe) {
b72ab182dd554343b504a771e535214de53b5d6f Bug 1273137 - Add the missing main-thread target confirmation for drag blocks. r=rbarker
Kartikaya Gupta <kgupta@mozilla.com>
parents: 326885
diff changeset
   984
        ReportSwipeStarted(aInputBlockId, wheelEvent->TriggersSwipe());
279383
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: 278974
diff changeset
   985
      }
328237
b72ab182dd554343b504a771e535214de53b5d6f Bug 1273137 - Add the missing main-thread target confirmation for drag blocks. r=rbarker
Kartikaya Gupta <kgupta@mozilla.com>
parents: 326885
diff changeset
   986
      mAPZEventState->ProcessWheelEvent(*wheelEvent, aGuid, aInputBlockId);
291937
0095ee7c07a34c940a30836704b5dff9107be686 Bug 1211612 - Add DragInputBlock for async scrollbars. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 290795
diff changeset
   987
    } else if (WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent()) {
328237
b72ab182dd554343b504a771e535214de53b5d6f Bug 1273137 - Add the missing main-thread target confirmation for drag blocks. r=rbarker
Kartikaya Gupta <kgupta@mozilla.com>
parents: 326885
diff changeset
   988
      MOZ_ASSERT(mouseEvent->mFlags.mHandledByAPZ);
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   989
      APZCCallbackHelper::SendSetTargetAPZCNotification(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   990
          this, GetDocument(), *(original->AsMouseEvent()), aGuid,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   991
          aInputBlockId);
291937
0095ee7c07a34c940a30836704b5dff9107be686 Bug 1211612 - Add DragInputBlock for async scrollbars. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 290795
diff changeset
   992
      mAPZEventState->ProcessMouseEvent(*mouseEvent, aGuid, aInputBlockId);
243236
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: 243234
diff changeset
   993
    }
233758
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   994
  }
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   995
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   996
  return status;
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   997
}
03090de75c45691f9e8c3020313ac5d6f0516b4d Handle in-process APZ events correctly on Windows. (bug 1111873 part 2, r=kats)
David Anderson <danderson@mozilla.com>
parents: 233656
diff changeset
   998
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
   999
class DispatchWheelEventOnMainThread : public Runnable {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1000
 public:
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1001
  DispatchWheelEventOnMainThread(const ScrollWheelInput& aWheelInput,
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1002
                                 nsBaseWidget* aWidget,
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1003
                                 nsEventStatus aAPZResult,
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1004
                                 uint64_t aInputBlockId,
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1005
                                 ScrollableLayerGuid aGuid)
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1006
      : mozilla::Runnable("DispatchWheelEventOnMainThread"),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1007
        mWheelInput(aWheelInput),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1008
        mWidget(aWidget),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1009
        mAPZResult(aAPZResult),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1010
        mInputBlockId(aInputBlockId),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1011
        mGuid(aGuid) {}
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1012
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1013
  NS_IMETHOD Run() override {
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1014
    WidgetWheelEvent wheelEvent = mWheelInput.ToWidgetWheelEvent(mWidget);
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1015
    mWidget->ProcessUntransformedAPZEvent(&wheelEvent, mGuid, mInputBlockId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1016
                                          mAPZResult);
321473
30dcf34cfb753d94c79f40bd1af15d3b75e981a5 Bug 1266595: Replace Chromium Task with Runnable. r=froydnj
Kyle Huey <khuey@kylehuey.com>
parents: 319810
diff changeset
  1017
    return NS_OK;
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1018
  }
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1019
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1020
 private:
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1021
  ScrollWheelInput mWheelInput;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1022
  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: 294513
diff changeset
  1023
  nsEventStatus mAPZResult;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1024
  uint64_t mInputBlockId;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1025
  ScrollableLayerGuid mGuid;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1026
};
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1027
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1028
class DispatchWheelInputOnControllerThread : public Runnable {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1029
 public:
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1030
  DispatchWheelInputOnControllerThread(const WidgetWheelEvent& aWheelEvent,
333453
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 333289
diff changeset
  1031
                                       IAPZCTreeManager* aAPZC,
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1032
                                       nsBaseWidget* aWidget)
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1033
      : mozilla::Runnable("DispatchWheelInputOnControllerThread"),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1034
        mMainMessageLoop(MessageLoop::current()),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1035
        mWheelInput(aWheelEvent),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1036
        mAPZC(aAPZC),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1037
        mWidget(aWidget),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1038
        mInputBlockId(0) {}
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1039
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1040
  NS_IMETHOD Run() override {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1041
    nsEventStatus result =
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1042
        mAPZC->ReceiveInputEvent(mWheelInput, &mGuid, &mInputBlockId);
334130
99cc6fc1ed3fe878644247449fcf2b62198f67f9 Bug 1289792 - removed member variable mAPZResult and used a local one in Run(). r=vlad
Andi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
parents: 333891
diff changeset
  1043
    if (result == nsEventStatus_eConsumeNoDefault) {
321473
30dcf34cfb753d94c79f40bd1af15d3b75e981a5 Bug 1266595: Replace Chromium Task with Runnable. r=froydnj
Kyle Huey <khuey@kylehuey.com>
parents: 319810
diff changeset
  1044
      return NS_OK;
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1045
    }
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1046
    RefPtr<Runnable> r = new DispatchWheelEventOnMainThread(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1047
        mWheelInput, mWidget, result, mInputBlockId, mGuid);
321473
30dcf34cfb753d94c79f40bd1af15d3b75e981a5 Bug 1266595: Replace Chromium Task with Runnable. r=froydnj
Kyle Huey <khuey@kylehuey.com>
parents: 319810
diff changeset
  1048
    mMainMessageLoop->PostTask(r.forget());
30dcf34cfb753d94c79f40bd1af15d3b75e981a5 Bug 1266595: Replace Chromium Task with Runnable. r=froydnj
Kyle Huey <khuey@kylehuey.com>
parents: 319810
diff changeset
  1049
    return NS_OK;
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1050
  }
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1051
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1052
 private:
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1053
  MessageLoop* mMainMessageLoop;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1054
  ScrollWheelInput mWheelInput;
333453
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 333289
diff changeset
  1055
  RefPtr<IAPZCTreeManager> mAPZC;
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1056
  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: 294513
diff changeset
  1057
  uint64_t mInputBlockId;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1058
  ScrollableLayerGuid mGuid;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1059
};
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1060
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1061
void nsBaseWidget::DispatchTouchInput(MultiTouchInput& aInput) {
336598
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: 336597
diff changeset
  1062
  MOZ_ASSERT(NS_IsMainThread());
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: 336597
diff changeset
  1063
  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: 336597
diff changeset
  1064
    MOZ_ASSERT(APZThreadUtils::IsControllerThread());
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: 336597
diff changeset
  1065
    uint64_t inputBlockId = 0;
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: 336597
diff changeset
  1066
    ScrollableLayerGuid guid;
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: 336597
diff changeset
  1067
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1068
    nsEventStatus result =
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1069
        mAPZC->ReceiveInputEvent(aInput, &guid, &inputBlockId);
336598
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: 336597
diff changeset
  1070
    if (result == nsEventStatus_eConsumeNoDefault) {
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: 336597
diff changeset
  1071
      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: 336597
diff changeset
  1072
    }
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: 336597
diff changeset
  1073
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: 336597
diff changeset
  1074
    WidgetTouchEvent event = aInput.ToWidgetTouchEvent(this);
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: 336597
diff changeset
  1075
    ProcessUntransformedAPZEvent(&event, guid, inputBlockId, result);
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: 336597
diff changeset
  1076
  } else {
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: 336597
diff changeset
  1077
    WidgetTouchEvent event = aInput.ToWidgetTouchEvent(this);
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: 336597
diff changeset
  1078
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: 336597
diff changeset
  1079
    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: 336597
diff changeset
  1080
    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: 336597
diff changeset
  1081
  }
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: 336597
diff changeset
  1082
}
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: 336597
diff changeset
  1083
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1084
nsEventStatus nsBaseWidget::DispatchInputEvent(WidgetInputEvent* aEvent) {
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1085
  MOZ_ASSERT(NS_IsMainThread());
248496
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 244698
diff changeset
  1086
  if (mAPZC) {
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1087
    if (APZThreadUtils::IsControllerThread()) {
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1088
      uint64_t inputBlockId = 0;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1089
      ScrollableLayerGuid guid;
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1090
376765
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 375950
diff changeset
  1091
      nsEventStatus result =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1092
          mAPZC->ReceiveInputEvent(*aEvent, &guid, &inputBlockId);
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1093
      if (result == nsEventStatus_eConsumeNoDefault) {
376765
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 375950
diff changeset
  1094
        return result;
294672
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1095
      }
ca5fae7924d23616afaf3d625b5d10d5a79e6bfa Bug 1223946 - Part 2: Ensure wheel event from nsDOMWindowUtil is dispatched on correct thread. r=kats
Randall Barker <rbarker@mozilla.com>
parents: 294513
diff changeset
  1096
      return ProcessUntransformedAPZEvent(aEvent, guid, inputBlockId, result);
248496
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 244698
diff changeset
  1097
    }
376765
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 375950
diff changeset
  1098
    WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent();
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 375950
diff changeset
  1099
    if (wheelEvent) {
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 375950
diff changeset
  1100
      RefPtr<Runnable> r =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1101
          new DispatchWheelInputOnControllerThread(*wheelEvent, mAPZC, this);
376765
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 375950
diff changeset
  1102
      APZThreadUtils::RunOnControllerThread(r.forget());
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 375950
diff changeset
  1103
      return nsEventStatus_eConsumeDoDefault;
22a9503bcd34de5fe6edee9b9e1c6b946fd3b1da Bug 1338086 - Remove useless else blocks in order to reduce complexity widget/ r=mstange
Sylvestre Ledru <sledru@mozilla.com>
parents: 375950
diff changeset
  1104
    }
379269
4048d3a531078eb13aed019c5cc5f68da49967c5 Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp
Jim Chen <nchen@mozilla.com>
parents: 378659
diff changeset
  1105
    // 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: 378659
diff changeset
  1106
    MOZ_ASSERT(aEvent->AsKeyboardEvent());
248496
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 244698
diff changeset
  1107
  }
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 244698
diff changeset
  1108
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 244698
diff changeset
  1109
  nsEventStatus 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: 244698
diff changeset
  1110
  DispatchEvent(aEvent, 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: 244698
diff changeset
  1111
  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: 244698
diff changeset
  1112
}
2d15f031ead0648b05dd6c0260c957618417b078 Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2, r=kats)
dvander@alliedmods.net <danderson@mozilla.com>
parents: 244698
diff changeset
  1113
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1114
void nsBaseWidget::DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) {
319224
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: 319129
diff changeset
  1115
  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: 319129
diff changeset
  1116
  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: 319129
diff changeset
  1117
    MOZ_ASSERT(APZThreadUtils::IsControllerThread());
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: 319129
diff changeset
  1118
    uint64_t inputBlockId = 0;
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: 319129
diff changeset
  1119
    ScrollableLayerGuid guid;
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: 319129
diff changeset
  1120
    mAPZC->ReceiveInputEvent(*aEvent, &guid, &inputBlockId);
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: 319129
diff changeset
  1121
  }
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: 319129
diff changeset
  1122
}
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: 319129
diff changeset
  1123
431440
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1124
// static
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1125
bool nsBaseWidget::ShowContextMenuAfterMouseUp() {
431440
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1126
  static bool gContextMenuAfterMouseUp = false;
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1127
  static bool gContextMenuAfterMouseUpCached = false;
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1128
  if (!gContextMenuAfterMouseUpCached) {
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1129
    Preferences::AddBoolVarCache(&gContextMenuAfterMouseUp,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1130
                                 "ui.context_menus.after_mouseup", false);
431440
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1131
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1132
    gContextMenuAfterMouseUpCached = true;
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1133
  }
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1134
  return gContextMenuAfterMouseUp;
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1135
}
f540f9e801cb2e0be5259baea13dfce953ccb520 Bug 1360278 - Add preference to trigger context menu on mouse up for GTK+ and macOS, r=mstange,smaug
Robin Grenet <robin.grenet@wanadoo.fr>
parents: 430488
diff changeset
  1136
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1137
nsIDocument* nsBaseWidget::GetDocument() const {
243236
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: 243234
diff changeset
  1138
  if (mWidgetListener) {
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: 243234
diff changeset
  1139
    if (nsIPresShell* presShell = mWidgetListener->GetPresShell()) {
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: 243234
diff changeset
  1140
      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: 243234
diff changeset
  1141
    }
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: 243234
diff changeset
  1142
  }
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: 243234
diff changeset
  1143
  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: 243234
diff changeset
  1144
}
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: 243234
diff changeset
  1145
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1146
void nsBaseWidget::CreateCompositorVsyncDispatcher() {
278974
697f5d72aebe8d661e31424f328ffb1539d8e904 Bug 1197201. Delete hardware vsync and vsync compositor prefs. r=kats
Mason Chang <mchang@mozilla.com>
parents: 278826
diff changeset
  1147
  // 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: 278826
diff changeset
  1148
  // child process communicate via IPC
697f5d72aebe8d661e31424f328ffb1539d8e904 Bug 1197201. Delete hardware vsync and vsync compositor prefs. r=kats
Mason Chang <mchang@mozilla.com>
parents: 278826
diff changeset
  1149
  // 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: 278826
diff changeset
  1150
  if (XRE_IsParentProcess()) {
446283
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
  1151
    if (!mCompositorVsyncDispatcherLock) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1152
      mCompositorVsyncDispatcherLock =
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1153
          MakeUnique<Mutex>("mCompositorVsyncDispatcherLock");
446283
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
  1154
    }
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
  1155
    MutexAutoLock lock(*mCompositorVsyncDispatcherLock.get());
278974
697f5d72aebe8d661e31424f328ffb1539d8e904 Bug 1197201. Delete hardware vsync and vsync compositor prefs. r=kats
Mason Chang <mchang@mozilla.com>
parents: 278826
diff changeset
  1156
    mCompositorVsyncDispatcher = new CompositorVsyncDispatcher();
233656
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 232974
diff changeset
  1157
  }
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 232974
diff changeset
  1158
}
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 232974
diff changeset
  1159
435452
4309d6abe27f88b9dcc90b59a69b469df6da959e Bug 1425878 - Don't expose raw pointers to refcounted vsync dispatcher object. r=sotaro
Kartikaya Gupta <kgupta@mozilla.com>
parents: 431440
diff changeset
  1160
already_AddRefed<CompositorVsyncDispatcher>
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1161
nsBaseWidget::GetCompositorVsyncDispatcher() {
446283
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
  1162
  MOZ_ASSERT(mCompositorVsyncDispatcherLock.get());
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
  1163
76a8f710da41058f6825d45aa8759c954812b488 Bug 1441498 - Protect mCompositorVsyncDispatcher by lock. r=kats
Sotaro Ikeda <sikeda@mozilla.com>
parents: 438346
diff changeset
  1164
  MutexAutoLock lock(*mCompositorVsyncDispatcherLock.get());
435452
4309d6abe27f88b9dcc90b59a69b469df6da959e Bug 1425878 - Don't expose raw pointers to refcounted vsync dispatcher object. r=sotaro
Kartikaya Gupta <kgupta@mozilla.com>
parents: 431440
diff changeset
  1165
  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: 431440
diff changeset
  1166
  return dispatcher.forget();
233656
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 232974
diff changeset
  1167
}
4177b97a946c4277e40c3c17fe74d91ca2228a02 Bug 1101974. Part 1: Create VsyncDispatcher at nsBaseWidget. r=roc
Mason Chang <mchang@mozilla.com>
parents: 232974
diff changeset
  1168
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1169
already_AddRefed<LayerManager> nsBaseWidget::CreateCompositorSession(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1170
    int aWidth, int aHeight, CompositorOptions* aOptionsOut) {
405769
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: 405158
diff changeset
  1171
  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: 405158
diff changeset
  1172
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: 405158
diff changeset
  1173
  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: 405158
diff changeset
  1174
    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: 405158
diff changeset
  1175
427765
2dbd4a1032d06a74b5afa9883c49ee3aa3ad236d Bug 1390741 - Use BasicCompositor if widget type does not support acceleration r=aosmond,kats
sotaro <sotaro.ikeda.g@gmail.com>
parents: 425188
diff changeset
  1176
    // If widget type does not supports acceleration, we use ClientLayerManager
2dbd4a1032d06a74b5afa9883c49ee3aa3ad236d Bug 1390741 - Use BasicCompositor if widget type does not support acceleration r=aosmond,kats
sotaro <sotaro.ikeda.g@gmail.com>
parents: 425188
diff changeset
  1177
    // even when gfxVars::UseWebRender() is true. WebRender could coexist only
2dbd4a1032d06a74b5afa9883c49ee3aa3ad236d Bug 1390741 - Use BasicCompositor if widget type does not support acceleration r=aosmond,kats
sotaro <sotaro.ikeda.g@gmail.com>
parents: 425188
diff changeset
  1178
    // with BasicCompositor.
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1179
    bool enableWR = gfx::gfxVars::UseWebRender() &&
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1180
                    WidgetTypeSupportsAcceleration() &&
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1181
                    AllowWebRenderForThisWindow();
405769
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: 405158
diff changeset
  1182
    bool enableAPZ = UseAPZ();
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: 405158
diff changeset
  1183
    CompositorOptions options(enableAPZ, enableWR);
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: 405158
diff changeset
  1184
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: 405158
diff changeset
  1185
    bool enableAL = gfx::gfxConfig::IsEnabled(gfx::Feature::ADVANCED_LAYERS);
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: 405158
diff changeset
  1186
    options.SetUseAdvancedLayers(enableAL);
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: 405158
diff changeset
  1187
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: 405158
diff changeset
  1188
    RefPtr<LayerManager> lm;
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: 405158
diff changeset
  1189
    if (options.UseWebRender()) {
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: 405158
diff changeset
  1190
      lm = new WebRenderLayerManager(this);
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: 405158
diff changeset
  1191
    } else {
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: 405158
diff changeset
  1192
      lm = new ClientLayerManager(this);
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: 405158
diff changeset
  1193
    }
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: 405158
diff changeset
  1194
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: 405158
diff changeset
  1195
    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: 405158
diff changeset
  1196
    gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get();
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: 405158
diff changeset
  1197
    mCompositorSession = gpu->CreateTopLevelCompositor(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1198
        this, lm, GetDefaultScale(), options, UseExternalCompositingSurface(),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1199
        gfx::IntSize(aWidth, aHeight), &retry);
405769
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: 405158
diff changeset
  1200
407486
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 405769
diff changeset
  1201
    if (lm->AsWebRenderLayerManager() && mCompositorSession) {
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 405769
diff changeset
  1202
      TextureFactoryIdentifier textureFactoryIdentifier;
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1203
      lm->AsWebRenderLayerManager()->Initialize(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1204
          mCompositorSession->GetCompositorBridgeChild(),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1205
          wr::AsPipelineId(mCompositorSession->RootLayerTreeId()),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1206
          &textureFactoryIdentifier);
407486
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 405769
diff changeset
  1207
      if (textureFactoryIdentifier.mParentBackend != LayersBackend::LAYERS_WR) {
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 405769
diff changeset
  1208
        retry = true;
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 405769
diff changeset
  1209
        DestroyCompositor();
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1210
        gfx::GPUProcessManager::Get()->DisableWebRender(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1211
            wr::WebRenderError::INITIALIZE);
407486
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 405769
diff changeset
  1212
      }
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 405769
diff changeset
  1213
    }
e781433714c456eb678826fb00725a630e88c736 Bug 1372880 - Add WebRender creation failure handling r=aosmond
sotaro <sotaro.ikeda.g@gmail.com>
parents: 405769
diff changeset
  1214
405769
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: 405158
diff changeset
  1215
    // 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: 405158
diff changeset
  1216
    // 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: 405158
diff changeset
  1217
    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: 405158
diff changeset
  1218
      *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: 405158
diff changeset
  1219
      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: 405158
diff changeset
  1220
    }
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: 405158
diff changeset
  1221
  } 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: 405158
diff changeset
  1222
}
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: 405158
diff changeset
  1223
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1224
void nsBaseWidget::CreateCompositor(int aWidth, int aHeight) {
221040
5c6980f9caff1c87e94cce5e67d0ef28f7e7d49c Bug 1064107 - Ensure that gfxPlatform is initialized by the time we create the compositor. r=Bas
Nicolas Silva <nsilva@mozilla.com>
parents: 217247
diff changeset
  1225
  // 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: 217247
diff changeset
  1226
  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: 217247
diff changeset
  1227
197627
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: 196738
diff changeset
  1228
  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: 196738
diff changeset
  1229
             "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: 196738
diff changeset
  1230
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
  1231
  MOZ_ASSERT(!mCompositorSession && !mCompositorBridgeChild,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1232
             "Should have properly cleaned up the previous PCompositor pair "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1233
             "beforehand");
254174
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
  1234
315067
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314825
diff changeset
  1235
  if (mCompositorBridgeChild) {
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314825
diff changeset
  1236
    mCompositorBridgeChild->Destroy();
254174
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
  1237
  }
248688
0556bae4c05e67cf951f60d4058768a6f057803e Bug 1125848 - Reduce the likelyhood of a CompositorParent being destroyed without the proper shutdown sequence. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 248496
diff changeset
  1238
131390
d5a2a23786f57b09c707e17ef29dcca9410d194e Bug 830347 - Part 3: Integrate new D3D compositor into widget. r=jmathies
Bas Schouten <bschouten@mozilla.com>
parents: 131291
diff changeset
  1239
  // 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: 131291
diff changeset
  1240
  // 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: 131291
diff changeset
  1241
135287
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
  1242
  // 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: 135280
diff changeset
  1243
  // 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: 135280
diff changeset
  1244
  if (!mShutdownObserver) {
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
  1245
    return;
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
  1246
  }
18a68adb330fe42be6a236512093a6fdafd5e28d Bug 877534 - Use a shutdown listener to destroy the compositor from nsBaseWidget. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 135280
diff changeset
  1247
405769
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: 405158
diff changeset
  1248
  CompositorOptions options;
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1249
  RefPtr<LayerManager> lm = CreateCompositorSession(aWidth, aHeight, &options);
405769
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: 405158
diff changeset
  1250
  if (!lm) {
403523
a67e2718b0c535d6f3f863559108001e24cc397a Bug 1378956 - Don't try starting WebRender on widgets that have transparency. r=jrmuizel
Kartikaya Gupta <kgupta@mozilla.com>
parents: 402079
diff changeset
  1251
    return;
a67e2718b0c535d6f3f863559108001e24cc397a Bug 1378956 - Don't try starting WebRender on widgets that have transparency. r=jrmuizel
Kartikaya Gupta <kgupta@mozilla.com>
parents: 402079
diff changeset
  1252
  }
405769
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: 405158
diff changeset
  1253
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: 405158
diff changeset
  1254
  MOZ_ASSERT(mCompositorSession);
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
  1255
  mCompositorBridgeChild = mCompositorSession->GetCompositorBridgeChild();
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1256
  SetCompositorWidgetDelegate(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1257
      mCompositorSession->GetCompositorWidgetDelegate());
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
  1258
361322
3d27c7cbcafa48642e0368319c563c4e32895242 Bug 1330037 - Introduce a CompositorOptions struct that holds options on a per-compositor basis. r=dvander
Kartikaya Gupta <kgupta@mozilla.com>
parents: 361186
diff changeset
  1259
  if (options.UseAPZ()) {
333453
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 333289
diff changeset
  1260
    mAPZC = mCompositorSession->GetAPZCTreeManager();
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
  1261
    ConfigureAPZCTreeManager();
333453
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 333289
diff changeset
  1262
  } else {
02f12f2a1fbfadbae78864cd754cf3f721f6abcb Bug 1281575 - Extract interface of APZCTreeManager for moving to GPUProcess. r=kats
Ryan Hunt <rhunt@mozilla.com>
parents: 333289
diff changeset
  1263
    mAPZC = nullptr;
232973
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
  1264
  }
3fd3bc9d9cd2f3a742df615483435c99c8391eec Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
David Anderson <danderson@mozilla.com>
parents: 229195
diff changeset
  1265
290795
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
  1266
  if (mInitialZoomConstraints) {
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
  1267
    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: 290351
diff changeset
  1268
                          mInitialZoomConstraints->mViewID,
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
  1269
                          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: 290351
diff changeset
  1270
    mInitialZoomConstraints.reset();
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
  1271
  }
5978297efa48ec6673ed5e108c70d9edf2cb6959 Bug 1218991 - Save initial zoom constraints to be used once compositor is created r=kats
James Willcox <snorp@snorp.net>
parents: 290351
diff changeset
  1272
375571
50dd0b8e139f152b7c3a7d68b70f139319035fd8 Bug 1317774 - Add non-gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 354600
diff changeset
  1273
  if (lm->AsWebRenderLayerManager()) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1274
    TextureFactoryIdentifier textureFactoryIdentifier =
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1275
        lm->GetTextureFactoryIdentifier();
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1276
    MOZ_ASSERT(textureFactoryIdentifier.mParentBackend ==
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1277
               LayersBackend::LAYERS_WR);
375659
dc2b7e346fc28a9658ba01008710ff97cffe0e4b Bug 1321183 - Deliver TextureFactoryIdentifier r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 375629
diff changeset
  1278
    ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
dc2b7e346fc28a9658ba01008710ff97cffe0e4b Bug 1321183 - Deliver TextureFactoryIdentifier r=nical
sotaro <sotaro.ikeda.g@gmail.com>
parents: 375629
diff changeset
  1279
    gfx::VRManagerChild::IdentifyTextureHost(textureFactoryIdentifier);
375571
50dd0b8e139f152b7c3a7d68b70f139319035fd8 Bug 1317774 - Add non-gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 354600
diff changeset
  1280
  }
50dd0b8e139f152b7c3a7d68b70f139319035fd8 Bug 1317774 - Add non-gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 354600
diff changeset
  1281
351690
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1282
  ShadowLayerForwarder* lf = lm->AsShadowForwarder();
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1283
  if (lf) {
375571
50dd0b8e139f152b7c3a7d68b70f139319035fd8 Bug 1317774 - Add non-gfx code needed to use WebRender in gecko. r=gfx
Mozilla Graphics Team <graphics@mozilla.com>
parents: 354600
diff changeset
  1284
    // lf is non-null if we are creating a ClientLayerManager above
351690
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1285
    TextureFactoryIdentifier textureFactoryIdentifier;
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1286
    PLayerTransactionChild* shadowManager = nullptr;
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1287
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1288
    nsTArray<LayersBackend> backendHints;
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1289
    gfxPlatform::GetPlatform()->GetCompositorBackends(ComputeShouldAccelerate(),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1290
                                                      backendHints);
351690
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1291
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1292
    bool success = false;
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1293
    if (!backendHints.IsEmpty()) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1294
      shadowManager = mCompositorBridgeChild->SendPLayerTransactionConstructor(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1295
          backendHints, 0);
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1296
      if (shadowManager->SendGetTextureFactoryIdentifier(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1297
              &textureFactoryIdentifier) &&
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1298
          textureFactoryIdentifier.mParentBackend !=
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1299
              LayersBackend::LAYERS_NONE) {
392107
8d5920dc4472dd624e30017d3b1f15e1167e588f Make PLayerTransaction's constructor async. (bug 1350634, ipc_r=billm, r=mattwoodrow, r=kats)
David Anderson <dvander@alliedmods.net>
parents: 391642
diff changeset
  1300
        success = true;
8d5920dc4472dd624e30017d3b1f15e1167e588f Make PLayerTransaction's constructor async. (bug 1350634, ipc_r=billm, r=mattwoodrow, r=kats)
David Anderson <dvander@alliedmods.net>
parents: 391642
diff changeset
  1301
      }
351690
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1302
    }
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1303
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1304
    if (!success) {
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1305
      NS_WARNING("Failed to create an OMT compositor.");
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1306
      DestroyCompositor();
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1307
      mLayerManager = nullptr;
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1308
      return;
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1309
    }
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1310
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1311
    lf->SetShadowManager(shadowManager);
430488
c9117e83e3a25d9e67d326147699f7e6946f0eda Bug 1415469 - Remove mDeviceResetSequenceNumber from TDR process since we don't need it anymore; r=dvander
Kevin Chen <kechen@mozilla.com>
parents: 427765
diff changeset
  1312
    lm->UpdateTextureFactoryIdentifier(textureFactoryIdentifier);
351690
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1313
    // Some popup or transparent widgets may use a different backend than the
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1314
    // compositors used with ImageBridge and VR (and more generally web
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1315
    // content).
351690
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1316
    if (WidgetTypeSupportsAcceleration()) {
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1317
      ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1318
      gfx::VRManagerChild::IdentifyTextureHost(textureFactoryIdentifier);
6864810d43907191e3520fa2323b4460fc3411a9 Bug 1315974 - When creating the widget layer manager, don't assume it will always be a ClientLayerManager. r=mattwoodrow
Kartikaya Gupta <kgupta@mozilla.com>
parents: 351511
diff changeset
  1319
    }
271595
bee2c9b57a80d07c8b01db444067922abc7a4ee7 Bug 1180688 - Backout previous fix to try another solution. r=me
Nicolas Silva <nsilva@mozilla.com>
parents: 271577
diff changeset
  1320
  }
84880
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84487
diff changeset
  1321
254174
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
  1322
  WindowUsesOMTC();
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
  1323
295db120bf1294195fdee467ba8fded9caae4842 Bug 1125848 - Consolidate PCompositor's creation-destruction logic. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 254156
diff changeset
  1324
  mLayerManager = lm.forget();
272647
5b4aec6951dd81465c423029768a1d4880e20729 Add compositor, layers, and rendering info to nsIGfxInfo. (bug 1179051 part 5, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 272614
diff changeset
  1325
346031
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 345883
diff changeset
  1326
  // 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: 345883
diff changeset
  1327
  // 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: 345883
diff changeset
  1328
#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: 345883
diff changeset
  1329
  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: 345883
diff changeset
  1330
#else
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 345883
diff changeset
  1331
  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: 345883
diff changeset
  1332
#endif
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 345883
diff changeset
  1333
13d0743bcaa67972a09e45472b161a787eceee7e Bug 1306383: The top level window logic for the OS X is different. r=dvander
Milan Sreckovic <milan@mozilla.com>
parents: 345883
diff changeset
  1334
  if (getCompositorFromThisWindow) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1335
    gfxPlatform::GetPlatform()->NotifyCompositorCreated(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1336
        mLayerManager->GetCompositorBackendType());
286932
f6dfce68d9e6d67cdff0630cb90f31a8b40d5653 Allow top-level window changes to the remembered compositor type. (bug 1211109 part 3, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 286851
diff changeset
  1337
  }
84880
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84487
diff changeset
  1338
}
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84487
diff changeset
  1339
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1340
void nsBaseWidget::NotifyCompositorSessionLost(CompositorSession* aSession) {
344646
5ac08fb77360da01e694dd3fb5fef07a64173298 Recreate widget compositors when the GPU process dies. (bug 1300936 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 342873
diff changeset
  1341
  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: 342873
diff changeset
  1342
  DestroyLayerManager();
5ac08fb77360da01e694dd3fb5fef07a64173298 Recreate widget compositors when the GPU process dies. (bug 1300936 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 342873
diff changeset
  1343
}
5ac08fb77360da01e694dd3fb5fef07a64173298 Recreate widget compositors when the GPU process dies. (bug 1300936 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 342873
diff changeset
  1344
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1345
bool nsBaseWidget::ShouldUseOffMainThreadCompositing() {
197627
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: 196738
diff changeset
  1346
  return gfxPlatform::UsesOffMainThreadCompositing();
94571
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: 94445
diff changeset
  1347
}
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: 94445
diff changeset
  1348
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1349
LayerManager* nsBaseWidget::GetLayerManager(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1350
    PLayerTransactionChild* aShadowManager, LayersBackend aBackendHint,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1351
    LayerManagerPersistence aPersistence) {
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
  1352
  if (!mLayerManager) {
282944
c6b0c072e68fd44eb1771e6fd481e20048cde301 Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 282266
diff changeset
  1353
    if (!mShutdownObserver) {
c6b0c072e68fd44eb1771e6fd481e20048cde301 Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 282266
diff changeset
  1354
      // 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: 282266
diff changeset
  1355
      return nullptr;
c6b0c072e68fd44eb1771e6fd481e20048cde301 Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro
Nicolas Silva <nsilva@mozilla.com>
parents: 282266
diff changeset
  1356
    }
95277
bea5301cf21fdd3f97fc407dda193edd7164bcc9 Bug 703484 - Part 1: Allow OMTC to be used with basic layers. r=bgirard
Marco Castelluccio <mar.castelluccio@studenti.unina.it>
parents: 94685
diff changeset
  1357
    // Try to use an async compositor first, if possible
123700
1473f6edfcad0377b376461adc7a01937a7e9609 Bug 839808 - Add support for omtc to winrt widget. r=bbondy
Jim Mathies <jmathies@mozilla.com>
parents: 122982
diff changeset
  1358
    if (ShouldUseOffMainThreadCompositing()) {
95277
bea5301cf21fdd3f97fc407dda193edd7164bcc9 Bug 703484 - Part 1: Allow OMTC to be used with basic layers. r=bgirard
Marco Castelluccio <mar.castelluccio@studenti.unina.it>
parents: 94685
diff changeset
  1359
      // e10s uses the parameter to pass in the shadow manager from the TabChild
bea5301cf21fdd3f97fc407dda193edd7164bcc9 Bug 703484 - Part 1: Allow OMTC to be used with basic layers. r=bgirard
Marco Castelluccio <mar.castelluccio@studenti.unina.it>
parents: 94685
diff changeset
  1360
      // so we don't expect to see it there since this doesn't support e10s.
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1361
      NS_ASSERTION(aShadowManager == nullptr,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1362
                   "Async Compositor not supported with e10s");
95277
bea5301cf21fdd3f97fc407dda193edd7164bcc9 Bug 703484 - Part 1: Allow OMTC to be used with basic layers. r=bgirard
Marco Castelluccio <mar.castelluccio@studenti.unina.it>
parents: 94685
diff changeset
  1363
      CreateCompositor();
bea5301cf21fdd3f97fc407dda193edd7164bcc9 Bug 703484 - Part 1: Allow OMTC to be used with basic layers. r=bgirard
Marco Castelluccio <mar.castelluccio@studenti.unina.it>
parents: 94685
diff changeset
  1364
    }
84880
5bd7228ca8a7f416e1cf38adbde530dcdf741f79 Bug 711168 - Implement the compositor protocol for OMTC. r=cjones
Benoit Girard <b56girard@gmail.com>, Ali Juma <ajuma@mozilla.com>
parents: 84487
diff changeset
  1365
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
  1366
    if (!mLayerManager) {
119325
d835ea3c8339c5533aff81c43ef582f4c1960604 Bug 831829 - Fix OSX titlebar painting from being upside-down and tiled. r=roc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 118730
diff changeset
  1367
      mLayerManager = 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
  1368
    }
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
  1369
  }
256835
0713b4e66f53debe98bb7ae5bcb29678f7484136 Bug 1153570 - Remove AutoUseBasicLayerManager, which has been unused since 78b90e6c491b (bug 676241 part 3). r=mstange
L. David Baron <dbaron@dbaron.org>
parents: 256812
diff changeset
  1370
  return mLayerManager;
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
  1371
}
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
  1372
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1373
LayerManager* nsBaseWidget::CreateBasicLayerManager() {
130442
af9e5dba68e8016344fe6ea7fb61a34b55a5124a Bug 867474 - Split BasicShadowableLayerManager into a separate ClientLayerManager. r=nrc
Matt Woodrow <mwoodrow@mozilla.com>
parents: 130430
diff changeset
  1374
  return new BasicLayerManager(this);
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
  1375
}
bd2a2bf17e5e583759494e617322d6886e360048 Bug 596410: Use BasicShadowLayerManager when there might be content processes. r=vlad
Chris Jones <jones.chris.g@gmail.com>
parents: 54097
diff changeset
  1376
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1377
CompositorBridgeChild* nsBaseWidget::GetRemoteRenderer() {
315067
4f1482e6da917442cfd73f8994ebac3c58f8fe5c Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow)
David Anderson <danderson@mozilla.com>
parents: 314825
diff changeset
  1378
  return mCompositorBridgeChild;
109216
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: 108847
diff changeset
  1379
}
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: 108847
diff changeset
  1380
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1381
already_AddRefed<gfx::DrawTarget> nsBaseWidget::StartRemoteDrawing() {
138530
9f542b4bfbfa80855d91bfb3db64168bf5c5bb67 Bug 882523 - Support OMTC on Mac in non-accelerated mode using OpenGL. r=nrc, r=mattwoodrow
Markus Stange <mstange@themasta.com>
parents: 138073
diff changeset
  1382
  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: 138073
diff changeset
  1383
}
9f542b4bfbfa80855d91bfb3db64168bf5c5bb67 Bug 882523 - Support OMTC on Mac in non-accelerated mode using OpenGL. r=nrc, r=mattwoodrow
Markus Stange <mstange@themasta.com>
parents: 138073
diff changeset
  1384
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1385
uint32_t nsBaseWidget::GetGLFrameBufferFormat() { return LOCAL_GL_RGBA; }
321850
304b1365d2d73af93e87322caaaca0ff148b31ef Move CompositorWidgetProxy inheritance out of nsIWidget. (bug 1264545 part 6, r=jimm)
David Anderson <danderson@mozilla.com>
parents: 321849
diff changeset
  1386
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
  1387
//-------------------------------------------------------------------------
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1388
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1389
// 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
  1390
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1391
//-------------------------------------------------------------------------
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1392
void nsBaseWidget::OnDestroy() {
240642
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 233962
diff changeset
  1393
  if (mTextEventDispatcher) {
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 233962
diff changeset
  1394
    mTextEventDispatcher->OnDestroyWidget();
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 233962
diff changeset
  1395
    // 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: 233962
diff changeset
  1396
    // 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: 233962
diff changeset
  1397
  }
319779
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 319456
diff changeset
  1398
3d22a2e2a5948493a0ced8568b8c98a8486ecb37 Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond
Kartikaya Gupta <kgupta@mozilla.com>
parents: 319456
diff changeset
  1399
  // 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: 319456
diff changeset
  1400
  // 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: 319456
diff changeset
  1401
  // on this widget already.
330321
0ac0b0b0968d9254b1510918076853364aff29c7 Don't leave temporary dangling nsWindow references to CompositorBridgeParent. (bug 1282343 part 1, r=mattwoodrow,kats)
David Anderson <danderson@mozilla.com>
parents: 330092
diff changeset
  1402
  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
  1403
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1404
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1405
void nsBaseWidget::MoveClient(double aX, double aY) {
293903
cfde91a29f0357a661370fb2742b8d209856a76d Bug 1224403 (part 2) - Split GetClientOffset() into typed and untyped versions. r=kats.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 293510
diff changeset
  1406
  LayoutDeviceIntPoint clientOffset(GetClientOffset());
128790
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: 128272
diff changeset
  1407
302233
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: 300014
diff changeset
  1408
  // GetClientOffset returns device pixels; scale back to desktop pixels
128790
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: 128272
diff changeset
  1409
  // if that's what this widget uses for the Move/Resize APIs
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1410
  if (BoundsUseDesktopPixels()) {
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1411
    DesktopPoint desktopOffset = clientOffset / GetDesktopToDeviceScale();
358666
bf2c019eaf93eecfd79dcd1a235282a9b93fceee Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 358664
diff changeset
  1412
    Move(aX - desktopOffset.x, aY - desktopOffset.y);
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1413
  } else {
358666
bf2c019eaf93eecfd79dcd1a235282a9b93fceee Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 358664
diff changeset
  1414
    Move(aX - clientOffset.x, aY - clientOffset.y);
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1415
  }
81090
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81085
diff changeset
  1416
}
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81085
diff changeset
  1417
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1418
void nsBaseWidget::ResizeClient(double aWidth, double aHeight, bool aRepaint) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1419
  NS_ASSERTION((aWidth >= 0), "Negative width passed to ResizeClient");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1420
  NS_ASSERTION((aHeight >= 0), "Negative height passed to ResizeClient");
81090
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81085
diff changeset
  1421
338754
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338753
diff changeset
  1422
  LayoutDeviceIntRect clientBounds = GetClientBounds();
128790
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: 128272
diff changeset
  1423
302233
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: 300014
diff changeset
  1424
  // GetClientBounds and mBounds are device pixels; scale back to desktop pixels
128790
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: 128272
diff changeset
  1425
  // if that's what this widget uses for the Move/Resize APIs
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1426
  if (BoundsUseDesktopPixels()) {
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1427
    DesktopSize desktopDelta =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1428
        (LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()) -
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1429
         clientBounds.Size()) /
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1430
        GetDesktopToDeviceScale();
358666
bf2c019eaf93eecfd79dcd1a235282a9b93fceee Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 358664
diff changeset
  1431
    Resize(aWidth + desktopDelta.width, aHeight + desktopDelta.height,
bf2c019eaf93eecfd79dcd1a235282a9b93fceee Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 358664
diff changeset
  1432
           aRepaint);
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1433
  } else {
437295
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 435452
diff changeset
  1434
    Resize(mBounds.Width() + (aWidth - clientBounds.Width()),
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 435452
diff changeset
  1435
           mBounds.Height() + (aHeight - clientBounds.Height()), aRepaint);
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1436
  }
81090
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81085
diff changeset
  1437
}
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81085
diff changeset
  1438
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1439
void nsBaseWidget::ResizeClient(double aX, double aY, double aWidth,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1440
                                double aHeight, bool aRepaint) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1441
  NS_ASSERTION((aWidth >= 0), "Negative width passed to ResizeClient");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1442
  NS_ASSERTION((aHeight >= 0), "Negative height passed to ResizeClient");
81090
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81085
diff changeset
  1443
338754
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338753
diff changeset
  1444
  LayoutDeviceIntRect clientBounds = GetClientBounds();
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338753
diff changeset
  1445
  LayoutDeviceIntPoint clientOffset = GetClientOffset();
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1446
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1447
  if (BoundsUseDesktopPixels()) {
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1448
    DesktopToLayoutDeviceScale scale = GetDesktopToDeviceScale();
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1449
    DesktopPoint desktopOffset = clientOffset / scale;
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1450
    DesktopSize desktopDelta =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1451
        (LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()) -
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1452
         clientBounds.Size()) /
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1453
        scale;
358666
bf2c019eaf93eecfd79dcd1a235282a9b93fceee Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 358664
diff changeset
  1454
    Resize(aX - desktopOffset.x, aY - desktopOffset.y,
bf2c019eaf93eecfd79dcd1a235282a9b93fceee Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 358664
diff changeset
  1455
           aWidth + desktopDelta.width, aHeight + desktopDelta.height,
bf2c019eaf93eecfd79dcd1a235282a9b93fceee Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 358664
diff changeset
  1456
           aRepaint);
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1457
  } else {
358666
bf2c019eaf93eecfd79dcd1a235282a9b93fceee Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 358664
diff changeset
  1458
    Resize(aX - clientOffset.x, aY - clientOffset.y,
437295
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 435452
diff changeset
  1459
           aWidth + mBounds.Width() - clientBounds.Width(),
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1460
           aHeight + mBounds.Height() - clientBounds.Height(), aRepaint);
302239
68d1b9a375b0b03f976d254aee2012a8d2b0ddb6 Bug 890156 - patch 4 - Update widget/windows code for per-monitor DPI support. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 302236
diff changeset
  1461
  }
81090
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81085
diff changeset
  1462
}
7bc5973b530d3971c9b0ba7885012ad0772f74d1 Back out revs d445f83ecfb1:dc9cc326cad0, because they did not back out what was intended.
Justin Lebar <justin.lebar@gmail.com>
parents: 81085
diff changeset
  1463
46198
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1464
//-------------------------------------------------------------------------
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1465
//
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1466
// Bounds
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1467
//
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1468
//-------------------------------------------------------------------------
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1469
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
  1470
/**
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1471
 * If the implementation of nsWindow supports borders this method MUST be
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1472
 * overridden
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1473
 *
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1474
 **/
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1475
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
  1476
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1477
/**
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1478
 * If the implementation of nsWindow supports borders this method MUST be
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1479
 * overridden
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1480
 *
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1481
 **/
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1482
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
  1483
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1484
/**
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1485
 * If the implementation of nsWindow uses a local coordinate system within the
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1486
 *window, this method must be overridden
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1487
 *
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1488
 **/
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1489
LayoutDeviceIntRect nsBaseWidget::GetScreenBounds() { return GetBounds(); }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1490
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1491
nsresult nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect& aRect) {
191190
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 191052
diff changeset
  1492
  if (SizeMode() != nsSizeMode_Normal) {
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 191052
diff changeset
  1493
    return NS_ERROR_FAILURE;
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 191052
diff changeset
  1494
  }
338754
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338753
diff changeset
  1495
  aRect = GetScreenBounds();
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338753
diff changeset
  1496
  return NS_OK;
191190
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 191052
diff changeset
  1497
}
0b52fbd68bf3185176bd37feaf4d4917ab7c1617 Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc
Masatoshi Kimura <VYV03354@nifty.ne.jp>
parents: 191052
diff changeset
  1498
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1499
LayoutDeviceIntPoint nsBaseWidget::GetClientOffset() {
294190
e49cd993ae2a456bdb2ad126dfccb7aa09d3d9ff Bug 1224482 (part 3) - Replace GetClientOffsetUntyped() with GetClientOffset(). r=kats.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294188
diff changeset
  1500
  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
  1501
}
30ecff316b34836ee80542f3fc732a10d185e497 Bug 513162 - Widget additions for recycling top level widgets as content containers. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 42226
diff changeset
  1502
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1503
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
  1504
  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
  1505
}
1d4ef53ab997d0927d5fd9582e33ddbd9dd9e0c3 Bug 513162 - Widget additions for setting custom chrome margins. r=vlad.
Jim Mathies <jmathies@mozilla.com>
parents: 46192
diff changeset
  1506
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1507
uint32_t nsBaseWidget::GetMaxTouchPoints() const { return 0; }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1508
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1509
bool nsBaseWidget::HasPendingInputEvent() { return false; }
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1510
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1511
bool nsBaseWidget::ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) {
78810
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78791
diff changeset
  1512
  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
  1513
}
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
  1514
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
  1515
/**
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1516
 * 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
  1517
 * 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
  1518
 * 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
  1519
 */
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1520
static bool ResolveIconNameHelper(nsIFile* aFile, const nsAString& aIconName,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1521
                                  const nsAString& aIconSuffix) {
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
  1522
  aFile->Append(NS_LITERAL_STRING("icons"));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1523
  aFile->Append(NS_LITERAL_STRING("default"));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1524
  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
  1525
77769
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77099
diff changeset
  1526
  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
  1527
  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
  1528
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1529
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1530
/**
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1531
 * 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
  1532
 * 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
  1533
 * 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
  1534
 *
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1535
 * 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
  1536
 */
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1537
void nsBaseWidget::ResolveIconName(const nsAString& aIconName,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1538
                                   const nsAString& aIconSuffix,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1539
                                   nsIFile** aResult) {
100814
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100293
diff changeset
  1540
  *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
  1541
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1542
  nsCOMPtr<nsIProperties> dirSvc =
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1543
      do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1544
  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
  1545
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1546
  // 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
  1547
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1548
  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
  1549
  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
  1550
              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
  1551
  if (dirs) {
77769
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77099
diff changeset
  1552
    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
  1553
    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
  1554
      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
  1555
      dirs->GetNext(getter_AddRefs(element));
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1556
      if (!element) continue;
95796
a15d75939cd5d820507656f64edae9a18e10918e Bug 749930 - Replace uses of nsILocalFile with nsIFile (compiled code only); r=bsmedberg
Geoff Lankow <geoff@darktrojan.net>
parents: 95411
diff changeset
  1557
      nsCOMPtr<nsIFile> file = do_QueryInterface(element);
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1558
      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
  1559
      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
  1560
        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
  1561
        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
  1562
      }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1563
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1564
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1565
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1566
  // 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
  1567
95796
a15d75939cd5d820507656f64edae9a18e10918e Bug 749930 - Replace uses of nsILocalFile with nsIFile (compiled code only); r=bsmedberg
Geoff Lankow <geoff@darktrojan.net>
parents: 95411
diff changeset
  1568
  nsCOMPtr<nsIFile> file;
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1569
  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
  1570
  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
  1571
    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
  1572
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1573
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1574
void nsBaseWidget::SetSizeConstraints(const SizeConstraints& aConstraints) {
100899
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: 100890
diff changeset
  1575
  mSizeConstraints = aConstraints;
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: 100890
diff changeset
  1576
  // We can't ensure that the size is honored at this point because we're
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: 100890
diff changeset
  1577
  // probably in the middle of a reflow.
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: 100890
diff changeset
  1578
}
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: 100890
diff changeset
  1579
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1580
const widget::SizeConstraints nsBaseWidget::GetSizeConstraints() {
100899
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: 100890
diff changeset
  1581
  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: 100890
diff changeset
  1582
}
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: 100890
diff changeset
  1583
111528
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: 110602
diff changeset
  1584
// static
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1585
nsIRollupListener* nsBaseWidget::GetActiveRollupListener() {
111528
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: 110602
diff changeset
  1586
  // If set, then this is likely an <html:select> dropdown.
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1587
  if (gRollupListener) return gRollupListener;
111528
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: 110602
diff changeset
  1588
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: 110602
diff changeset
  1589
  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: 110602
diff changeset
  1590
}
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: 110602
diff changeset
  1591
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1592
void nsBaseWidget::NotifyWindowDestroyed() {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1593
  if (!mWidgetListener) return;
102433
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: 102432
diff changeset
  1594
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: 102432
diff changeset
  1595
  nsCOMPtr<nsIXULWindow> window = mWidgetListener->GetXULWindow();
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: 102432
diff changeset
  1596
  nsCOMPtr<nsIBaseWindow> xulWindow(do_QueryInterface(window));
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: 102432
diff changeset
  1597
  if (xulWindow) {
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: 102432
diff changeset
  1598
    xulWindow->Destroy();
102432
481e19da0409a2979bf4a17449ae6f1b066274f6 Bug 743975 - remove NS_DESTROY event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102431
diff changeset
  1599
  }
481e19da0409a2979bf4a17449ae6f1b066274f6 Bug 743975 - remove NS_DESTROY event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102431
diff changeset
  1600
}
481e19da0409a2979bf4a17449ae6f1b066274f6 Bug 743975 - remove NS_DESTROY event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102431
diff changeset
  1601
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1602
void nsBaseWidget::NotifySizeMoveDone() {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1603
  if (!mWidgetListener || mWidgetListener->GetXULWindow()) return;
102434
4aca82dc0d41007d1fdf231d1c3be86705132d73 Bug 743975 - add a getpresshell method to the widget listener, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102433
diff changeset
  1604
4aca82dc0d41007d1fdf231d1c3be86705132d73 Bug 743975 - add a getpresshell method to the widget listener, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102433
diff changeset
  1605
  nsIPresShell* presShell = mWidgetListener->GetPresShell();
102428
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1606
  if (presShell) {
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1607
    presShell->WindowSizeMoveDone();
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1608
  }
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1609
}
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1610
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1611
void nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY) {
176838
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 176829
diff changeset
  1612
  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: 176829
diff changeset
  1613
    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: 176829
diff changeset
  1614
  }
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 176829
diff changeset
  1615
389432
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 388442
diff changeset
  1616
  if (mIMEHasFocus && IMENotificationRequestsRef().WantPositionChanged()) {
176838
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 176829
diff changeset
  1617
    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: 176829
diff changeset
  1618
  }
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 176829
diff changeset
  1619
}
d3ce99c9b61ee2c18c5a44e80726ac3057918fcc Bug 968647 - Part 2. Listen window position change for IME. r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 176829
diff changeset
  1620
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1621
void nsBaseWidget::NotifySysColorChanged() {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1622
  if (!mWidgetListener || mWidgetListener->GetXULWindow()) return;
102434
4aca82dc0d41007d1fdf231d1c3be86705132d73 Bug 743975 - add a getpresshell method to the widget listener, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102433
diff changeset
  1623
4aca82dc0d41007d1fdf231d1c3be86705132d73 Bug 743975 - add a getpresshell method to the widget listener, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102433
diff changeset
  1624
  nsIPresShell* presShell = mWidgetListener->GetPresShell();
102428
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1625
  if (presShell) {
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1626
    presShell->SysColorChanged();
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1627
  }
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1628
}
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1629
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1630
void nsBaseWidget::NotifyThemeChanged() {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1631
  if (!mWidgetListener || mWidgetListener->GetXULWindow()) return;
102434
4aca82dc0d41007d1fdf231d1c3be86705132d73 Bug 743975 - add a getpresshell method to the widget listener, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102433
diff changeset
  1632
4aca82dc0d41007d1fdf231d1c3be86705132d73 Bug 743975 - add a getpresshell method to the widget listener, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102433
diff changeset
  1633
  nsIPresShell* presShell = mWidgetListener->GetPresShell();
102428
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1634
  if (presShell) {
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1635
    presShell->ThemeChanged();
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1636
  }
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1637
}
340f7af0fb8e7f4f17c916b1337c3e46223795d6 Bug 743975 - move theme and window size done events to direct calls, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102324
diff changeset
  1638
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1639
void nsBaseWidget::NotifyUIStateChanged(UIStateChangeType aShowAccelerators,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1640
                                        UIStateChangeType aShowFocusRings) {
243236
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: 243234
diff changeset
  1641
  if (nsIDocument* doc = GetDocument()) {
306084
e22b3043887ed36bf2c634c2924a7c8d39d226b1 Bug 1241764: Replace nsPIDOMWindow with nsPIDOMWindowInner/Outer. r=mrbkap,smaug
Kyle Huey <khuey@kylehuey.com>
parents: 306048
diff changeset
  1642
    nsPIDOMWindowOuter* win = doc->GetWindow();
102431
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102430
diff changeset
  1643
    if (win) {
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102430
diff changeset
  1644
      win->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102430
diff changeset
  1645
    }
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102430
diff changeset
  1646
  }
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102430
diff changeset
  1647
}
e389f7bcd86d14ba2d9f35d4f9a3b0111448a385 Bug 743975 - use a direct call instead of move uistatechanged event, r=smaug
Neil Deakin <neil@mozilla.com>
parents: 102430
diff changeset
  1648
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1649
nsresult nsBaseWidget::NotifyIME(const IMENotification& aIMENotification) {
240648
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 240642
diff changeset
  1650
  switch (aIMENotification.mMessage) {
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 240642
diff changeset
  1651
    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: 240642
diff changeset
  1652
    case REQUEST_TO_CANCEL_COMPOSITION:
407427
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: 405769
diff changeset
  1653
      // 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: 405769
diff changeset
  1654
      // 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: 405769
diff changeset
  1655
      // 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: 405769
diff changeset
  1656
      // 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: 405769
diff changeset
  1657
      // 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: 405769
diff changeset
  1658
      // 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: 405769
diff changeset
  1659
      // TextEventDispatcherListener::NotifyIME().
240648
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 240642
diff changeset
  1660
      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: 240642
diff changeset
  1661
        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: 240642
diff changeset
  1662
      }
407427
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: 405769
diff changeset
  1663
      return NS_OK;
314067
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1664
    default: {
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1665
      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: 313350
diff changeset
  1666
        mIMEHasFocus = true;
240660
62716b1991452c571272936eab7dde3f7042408a Bug 917322 part.19 Add nsITextInputProcessorCallback r=smaug+xyuan, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 240648
diff changeset
  1667
      }
314067
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1668
      EnsureTextEventDispatcher();
407427
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: 405769
diff changeset
  1669
      // 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: 405769
diff changeset
  1670
      // 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: 405769
diff changeset
  1671
      // 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: 405769
diff changeset
  1672
      // notifications will be sent to native IME.
314067
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1673
      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: 313350
diff changeset
  1674
      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: 313350
diff changeset
  1675
        mIMEHasFocus = false;
275487
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: 273016
diff changeset
  1676
      }
407427
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: 405769
diff changeset
  1677
      return rv;
275487
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: 273016
diff changeset
  1678
    }
240648
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 240642
diff changeset
  1679
  }
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 240642
diff changeset
  1680
}
994fee1e166c6a7a9ba0a8b33366b886067f47d1 Bug 917322 part.7 TextEventDispatcher should manage if it has composition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 240642
diff changeset
  1681
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1682
void nsBaseWidget::EnsureTextEventDispatcher() {
314067
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1683
  if (mTextEventDispatcher) {
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1684
    return;
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1685
  }
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1686
  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: 313350
diff changeset
  1687
}
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1688
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1689
nsIWidget::TextEventDispatcher* nsBaseWidget::GetTextEventDispatcher() {
314067
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1690
  EnsureTextEventDispatcher();
240642
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 233962
diff changeset
  1691
  return mTextEventDispatcher;
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 233962
diff changeset
  1692
}
87c8054d9040f96a3babbd3decfb9c7ad2d6882a Bug 917322 part.1 Create mozilla::widget::TextEventDispatcher class r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 233962
diff changeset
  1693
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1694
void* nsBaseWidget::GetPseudoIMEContext() {
314068
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: 314067
diff changeset
  1695
  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: 314067
diff changeset
  1696
  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: 314067
diff changeset
  1697
    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: 314067
diff changeset
  1698
  }
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: 314067
diff changeset
  1699
  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: 314067
diff changeset
  1700
}
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: 314067
diff changeset
  1701
360626
1e51e167058e06429deb642480c0c5691715601e Bug 1325234 (part 9) - Remove remaining NS_IMETHOD_ occurrences from nsIWidget. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 360622
diff changeset
  1702
TextEventDispatcherListener*
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1703
nsBaseWidget::GetNativeTextEventDispatcherListener() {
314067
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1704
  // 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: 313350
diff changeset
  1705
  //       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: 313350
diff changeset
  1706
  //       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: 313350
diff changeset
  1707
  return nullptr;
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1708
}
b8af9e4c043927f01a858538b0d7e46b6e5c25b0 Bug 1137572 part.2 Add nsIWidget::GetNativeTextEventDispatcherListener() for TextEventDispatcher::NotifyIME() r=smaug, sr=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 313350
diff changeset
  1709
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1710
void nsBaseWidget::ZoomToRect(const uint32_t& aPresShellId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1711
                              const FrameMetrics::ViewID& aViewId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1712
                              const CSSRect& aRect, const uint32_t& aFlags) {
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
  1713
  if (!mCompositorSession || !mAPZC) {
303303
cfc568b890f8046d9b6828c1d277bc5a062bda35 Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats
Randall Barker <rbarker@mozilla.com>
parents: 302798
diff changeset
  1714
    return;
cfc568b890f8046d9b6828c1d277bc5a062bda35 Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats
Randall Barker <rbarker@mozilla.com>
parents: 302798
diff changeset
  1715
  }
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
  1716
  uint64_t layerId = mCompositorSession->RootLayerTreeId();
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1717
  mAPZC->ZoomToRect(ScrollableLayerGuid(layerId, aPresShellId, aViewId), aRect,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1718
                    aFlags);
303303
cfc568b890f8046d9b6828c1d277bc5a062bda35 Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats
Randall Barker <rbarker@mozilla.com>
parents: 302798
diff changeset
  1719
}
cfc568b890f8046d9b6828c1d277bc5a062bda35 Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats
Randall Barker <rbarker@mozilla.com>
parents: 302798
diff changeset
  1720
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1721
#ifdef ACCESSIBILITY
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1722
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1723
a11y::Accessible* nsBaseWidget::GetRootAccessible() {
102626
71dce48a6079b54228bb766ae6414b38a23d2b4f Bug 783383 - Add null-checks for nsBaseWidget::mWidgetListener r=tn
Andrew Quartey <andrew.quartey@gmail.com>
parents: 102437
diff changeset
  1724
  NS_ENSURE_TRUE(mWidgetListener, nullptr);
71dce48a6079b54228bb766ae6414b38a23d2b4f Bug 783383 - Add null-checks for nsBaseWidget::mWidgetListener r=tn
Andrew Quartey <andrew.quartey@gmail.com>
parents: 102437
diff changeset
  1725
102434
4aca82dc0d41007d1fdf231d1c3be86705132d73 Bug 743975 - add a getpresshell method to the widget listener, r=tn
Neil Deakin <neil@mozilla.com>
parents: 102433
diff changeset
  1726
  nsIPresShell* presShell = mWidgetListener->GetPresShell();
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1727
  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: 102429
diff changeset
  1728
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1729
  // 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: 102429
diff changeset
  1730
  // 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: 102429
diff changeset
  1731
  nsPresContext* presContext = presShell->GetPresContext();
164539
4c67b63a52c28b10707d43de4cbc30df67fdd185 bug 947022 - type nsIPresShell::mForwardingContainer and nsPresContext::mContainer r=bz
Trevor Saunders <trev.saunders@gmail.com>
parents: 162495
diff changeset
  1732
  NS_ENSURE_TRUE(presContext->GetContainerWeak(), nullptr);
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1733
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1734
  // Accessible creation might be not safe so use IsSafeToRunScript to
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1735
  // make sure it's not created at unsafe times.
337251
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: 336598
diff changeset
  1736
  nsAccessibilityService* accService = GetOrCreateAccService();
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1737
  if (accService) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1738
    return accService->GetRootDocumentAccessible(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1739
        presShell, nsContentUtils::IsSafeToRunScript());
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1740
  }
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1741
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1742
  return nullptr;
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1743
}
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1744
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1745
#endif  // ACCESSIBILITY
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1746
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1747
void nsBaseWidget::StartAsyncScrollbarDrag(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1748
    const AsyncDragMetrics& aDragMetrics) {
287407
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 286932
diff changeset
  1749
  if (!AsyncPanZoomEnabled()) {
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 286932
diff changeset
  1750
    return;
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 286932
diff changeset
  1751
  }
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 286932
diff changeset
  1752
324141
76466e5503993d57ea96eace53742ffb104b3e84 Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner)
David Anderson <danderson@mozilla.com>
parents: 324138
diff changeset
  1753
  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: 324138
diff changeset
  1754
396784
8709ce04de16a63c5ec10baf7447ffb588fe522b Bug 1369074 - Store the layers id in a variable of the proper type (uint64_t) in nsBaseWidget::StartAsyncScrollbarDrag(). r=kats
Botond Ballo <botond@mozilla.com>
parents: 394496
diff changeset
  1755
  uint64_t layersId = mCompositorSession->RootLayerTreeId();
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1756
  ScrollableLayerGuid guid(layersId, aDragMetrics.mPresShellId,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1757
                           aDragMetrics.mViewId);
287407
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 286932
diff changeset
  1758
401914
312f7a5a2c08d394a2403c837e5ee546dd4103d7 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
Bill McCloskey <billm@mozilla.com>
parents: 401829
diff changeset
  1759
  APZThreadUtils::RunOnControllerThread(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1760
      NewRunnableMethod<ScrollableLayerGuid, AsyncDragMetrics>(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1761
          "layers::IAPZCTreeManager::StartScrollbarDrag", mAPZC,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1762
          &IAPZCTreeManager::StartScrollbarDrag, guid, aDragMetrics));
287407
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 286932
diff changeset
  1763
}
c9999ccc9a8b7f77ad54b3540196c2725a82bb7b Bug 1199885 - Part 12: Add StartScrollbarDrag IPC message. r=kats
Benoit Girard <b56girard@gmail.com>
parents: 286932
diff changeset
  1764
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1765
bool nsBaseWidget::StartAsyncAutoscroll(const ScreenPoint& aAnchorLocation,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1766
                                        const ScrollableLayerGuid& aGuid) {
407823
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 407530
diff changeset
  1767
  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: 407530
diff changeset
  1768
425188
d6703dd120654a1a201a09d1870be9b9d27edf44 Bug 1340415 - Ensure main-thread and async autoscrolling do not happen at the same time. r=kats
Botond Ballo <botond@mozilla.com>
parents: 424267
diff changeset
  1769
  return mAPZC->StartAutoscroll(aGuid, aAnchorLocation);
407823
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 407530
diff changeset
  1770
}
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 407530
diff changeset
  1771
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1772
void nsBaseWidget::StopAsyncAutoscroll(const ScrollableLayerGuid& aGuid) {
407823
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 407530
diff changeset
  1773
  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: 407530
diff changeset
  1774
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 407530
diff changeset
  1775
  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: 407530
diff changeset
  1776
}
ab07a3654f59dfc98ed7a884d84936123af3fca3 Bug 1105109 - Have the parent process notify APZ of the start and stop of autoscrolling. r=kats
Botond Ballo <botond@mozilla.com>
parents: 407530
diff changeset
  1777
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1778
already_AddRefed<nsIScreen> nsBaseWidget::GetWidgetScreen() {
271577
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
  1779
  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: 271576
diff changeset
  1780
  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: 271576
diff changeset
  1781
  if (!screenManager) {
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
  1782
    return nullptr;
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
  1783
  }
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
  1784
338754
6a81bba012c8d4283978ae3c6920843916817bfc Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 338753
diff changeset
  1785
  LayoutDeviceIntRect bounds = GetScreenBounds();
328812
358018e43d8da2517c3600c6172f129c1e65ada0 Bug 1278818 - Convert window coordinates to desktop pixels before passing to ScreenForRect. r=emk
Jonathan Kew <jkew@mozilla.com>
parents: 328237
diff changeset
  1786
  DesktopIntRect deskBounds = RoundedToInt(bounds / GetDesktopToDeviceScale());
271577
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
  1787
  nsCOMPtr<nsIScreen> screen;
437295
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 435452
diff changeset
  1788
  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: 435452
diff changeset
  1789
                               deskBounds.Width(), deskBounds.Height(),
271577
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
  1790
                               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: 271576
diff changeset
  1791
  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: 271576
diff changeset
  1792
}
9110eb085b13f684d5ee5a88f1167701c943422f Bug 1160014 part 2 - Move some procedures in nsBaseWidget::MakeFullScreen to individual methods. r=roc
Xidorn Quan <quanxunzhen@gmail.com>
parents: 271576
diff changeset
  1793
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1794
nsresult nsIWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1795
                                             bool aLongTap,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1796
                                             nsIObserver* aObserver) {
256180
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 254444
diff changeset
  1797
  AutoObserverNotifier notifier(aObserver, "touchtap");
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 254444
diff changeset
  1798
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1799
  if (sPointerIdCounter > TOUCH_INJECT_MAX_POINTS) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1800
    sPointerIdCounter = 0;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1801
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1802
  int pointerId = sPointerIdCounter;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1803
  sPointerIdCounter++;
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1804
  nsresult rv = SynthesizeNativeTouchPoint(pointerId, TOUCH_CONTACT, aPoint,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1805
                                           1.0, 90, nullptr);
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1806
  if (NS_FAILED(rv)) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1807
    return rv;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1808
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1809
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1810
  if (!aLongTap) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1811
    return SynthesizeNativeTouchPoint(pointerId, TOUCH_REMOVE, aPoint, 0, 0,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1812
                                      nullptr);
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1813
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1814
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1815
  // initiate a long tap
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1816
  int elapse = Preferences::GetInt("ui.click_hold_context_menus.delay",
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1817
                                   TOUCH_INJECT_LONG_TAP_DEFAULT_MSEC);
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1818
  if (!mLongTapTimer) {
424267
e7c3876d6d2f31f137dd9d62c870ed6320963770 Bug 1404198: Part 2d - Switch to NS_NewTimer* in widget. r=njn
Kris Maglione <maglione.k@gmail.com>
parents: 420578
diff changeset
  1819
    mLongTapTimer = NS_NewTimer();
e7c3876d6d2f31f137dd9d62c870ed6320963770 Bug 1404198: Part 2d - Switch to NS_NewTimer* in widget. r=njn
Kris Maglione <maglione.k@gmail.com>
parents: 420578
diff changeset
  1820
    if (!mLongTapTimer) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1821
      SynthesizeNativeTouchPoint(pointerId, TOUCH_CANCEL, aPoint, 0, 0,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1822
                                 nullptr);
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1823
      return NS_ERROR_UNEXPECTED;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1824
    }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1825
    // 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: 164662
diff changeset
  1826
    // than the pref value.
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1827
    int timeout = elapse;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1828
    if (timeout > TOUCH_INJECT_PUMP_TIMER_MSEC) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1829
      timeout = TOUCH_INJECT_PUMP_TIMER_MSEC;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1830
    }
401914
312f7a5a2c08d394a2403c837e5ee546dd4103d7 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
Bill McCloskey <billm@mozilla.com>
parents: 401829
diff changeset
  1831
    mLongTapTimer->InitWithNamedFuncCallback(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1832
        OnLongTapTimerCallback, this, timeout, nsITimer::TYPE_REPEATING_SLACK,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1833
        "nsIWidget::SynthesizeNativeTouchTap");
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1834
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1835
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1836
  // 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: 164662
diff changeset
  1837
  // tap to be active at a time.
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1838
  if (mLongTapTouchPoint) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1839
    SynthesizeNativeTouchPoint(mLongTapTouchPoint->mPointerId, TOUCH_CANCEL,
256180
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 254444
diff changeset
  1840
                               mLongTapTouchPoint->mPosition, 0, 0, nullptr);
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1841
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1842
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1843
  mLongTapTouchPoint = MakeUnique<LongTapInfo>(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1844
      pointerId, aPoint, TimeDuration::FromMilliseconds(elapse), aObserver);
256180
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 254444
diff changeset
  1845
  notifier.SkipNotification();  // we'll do it in the long-tap callback
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1846
  return NS_OK;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1847
}
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1848
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1849
// static
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1850
void nsIWidget::OnLongTapTimerCallback(nsITimer* aTimer, void* aClosure) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1851
  auto* self = static_cast<nsIWidget*>(aClosure);
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1852
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1853
  if ((self->mLongTapTouchPoint->mStamp + self->mLongTapTouchPoint->mDuration) >
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1854
      TimeStamp::Now()) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1855
#ifdef XP_WIN
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1856
    // 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: 164662
diff changeset
  1857
    // the pointer id with the same position.
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1858
    self->SynthesizeNativeTouchPoint(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1859
        self->mLongTapTouchPoint->mPointerId, TOUCH_CONTACT,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1860
        self->mLongTapTouchPoint->mPosition, 1.0, 90, nullptr);
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1861
#endif
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1862
    return;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1863
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1864
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1865
  AutoObserverNotifier notifier(self->mLongTapTouchPoint->mObserver,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1866
                                "touchtap");
256180
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 254444
diff changeset
  1867
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1868
  // finished, remove the touch point
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1869
  self->mLongTapTimer->Cancel();
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1870
  self->mLongTapTimer = nullptr;
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1871
  self->SynthesizeNativeTouchPoint(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1872
      self->mLongTapTouchPoint->mPointerId, TOUCH_REMOVE,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1873
      self->mLongTapTouchPoint->mPosition, 0, 0, nullptr);
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1874
  self->mLongTapTouchPoint = nullptr;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1875
}
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1876
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1877
nsresult nsIWidget::ClearNativeTouchSequence(nsIObserver* aObserver) {
256180
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 254444
diff changeset
  1878
  AutoObserverNotifier notifier(aObserver, "cleartouch");
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 254444
diff changeset
  1879
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1880
  if (!mLongTapTimer) {
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1881
    return NS_OK;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1882
  }
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1883
  mLongTapTimer->Cancel();
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1884
  mLongTapTimer = nullptr;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1885
  SynthesizeNativeTouchPoint(mLongTapTouchPoint->mPointerId, TOUCH_CANCEL,
256180
30b7130a25e436a98ec9e004dfdfbb5c9d067b44 Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug
Kartikaya Gupta <kgupta@mozilla.com>
parents: 254444
diff changeset
  1886
                             mLongTapTouchPoint->mPosition, 0, 0, nullptr);
164802
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1887
  mLongTapTouchPoint = nullptr;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1888
  return NS_OK;
bd9d5c318301f0b9f605ef47f213b0a597a01976 Bug 941774 - Base widget implementation. r=roc
Jim Mathies <jmathies@mozilla.com>
parents: 164662
diff changeset
  1889
}
102430
92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37 Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
Neil Deakin <neil@mozilla.com>
parents: 102429
diff changeset
  1890
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1891
MultiTouchInput nsBaseWidget::UpdateSynthesizedTouchState(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1892
    MultiTouchInput* aState, uint32_t aTime, mozilla::TimeStamp aTimeStamp,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1893
    uint32_t aPointerId, TouchPointerState aPointerState,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1894
    LayoutDeviceIntPoint aPoint, double aPointerPressure,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1895
    uint32_t aPointerOrientation) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1896
  ScreenIntPoint pointerScreenPoint = ViewAs<ScreenPixel>(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1897
      aPoint, PixelCastJustification::LayoutDeviceIsScreenForBounds);
333886
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: 333453
diff changeset
  1898
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: 333453
diff changeset
  1899
  // 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: 333453
diff changeset
  1900
  // 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: 333453
diff changeset
  1901
  // 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: 333453
diff changeset
  1902
  // 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: 333453
diff changeset
  1903
  // 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: 333453
diff changeset
  1904
  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: 333453
diff changeset
  1905
  inputToDispatch.mInputType = MULTITOUCH_INPUT;
336597
25aa60d92c63db75fbaae54cc8c89a17fdd3dd9d Bug 1289435 - Ensure that the synthesized native touch events have sane timestamps. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 334130
diff changeset
  1906
  inputToDispatch.mTime = aTime;
25aa60d92c63db75fbaae54cc8c89a17fdd3dd9d Bug 1289435 - Ensure that the synthesized native touch events have sane timestamps. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 334130
diff changeset
  1907
  inputToDispatch.mTimeStamp = aTimeStamp;
333886
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: 333453
diff changeset
  1908
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: 333453
diff changeset
  1909
  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: 333453
diff changeset
  1910
  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: 333453
diff changeset
  1911
    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: 333453
diff changeset
  1912
      // 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: 333453
diff changeset
  1913
      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: 333453
diff changeset
  1914
      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: 333453
diff changeset
  1915
      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: 333453
diff changeset
  1916
      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: 333453
diff changeset
  1917
      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: 333453
diff changeset
  1918
    } 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: 333453
diff changeset
  1919
      // 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: 333453
diff changeset
  1920
      aState->mTouches.AppendElement(SingleTouchData(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1921
          (int32_t)aPointerId, pointerScreenPoint, ScreenSize(0, 0),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1922
          (float)aPointerOrientation, (float)aPointerPressure));
333886
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: 333453
diff changeset
  1923
      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: 333453
diff changeset
  1924
    }
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: 333453
diff changeset
  1925
    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: 333453
diff changeset
  1926
  } 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: 333453
diff changeset
  1927
    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: 333453
diff changeset
  1928
    // 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: 333453
diff changeset
  1929
    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: 333453
diff changeset
  1930
      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: 333453
diff changeset
  1931
    }
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1932
    inputToDispatch.mType =
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1933
        (aPointerState == TOUCH_REMOVE ? MultiTouchInput::MULTITOUCH_END
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1934
                                       : MultiTouchInput::MULTITOUCH_CANCEL);
333886
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: 333453
diff changeset
  1935
    inputToDispatch.mTouches.AppendElement(SingleTouchData(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1936
        (int32_t)aPointerId, pointerScreenPoint, ScreenSize(0, 0),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1937
        (float)aPointerOrientation, (float)aPointerPressure));
333886
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: 333453
diff changeset
  1938
  }
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: 333453
diff changeset
  1939
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: 333453
diff changeset
  1940
  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: 333453
diff changeset
  1941
}
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: 333453
diff changeset
  1942
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1943
void nsBaseWidget::NotifyLiveResizeStarted() {
365765
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1944
  // 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: 365495
diff changeset
  1945
  // 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: 365495
diff changeset
  1946
  // 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: 365495
diff changeset
  1947
  NotifyLiveResizeStopped();
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1948
  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: 365495
diff changeset
  1949
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1950
  // If we can get the active tab parent for the current widget, suppress
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1951
  // 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: 365495
diff changeset
  1952
  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: 365495
diff changeset
  1953
    return;
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1954
  }
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1955
  nsCOMPtr<nsIXULWindow> xulWindow = mWidgetListener->GetXULWindow();
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1956
  if (!xulWindow) {
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1957
    return;
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1958
  }
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1959
  mLiveResizeListeners = xulWindow->GetLiveResizeListeners();
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1960
  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: 365495
diff changeset
  1961
    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: 365495
diff changeset
  1962
  }
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1963
}
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1964
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1965
void nsBaseWidget::NotifyLiveResizeStopped() {
365765
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1966
  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: 365495
diff changeset
  1967
    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: 365495
diff changeset
  1968
      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: 365495
diff changeset
  1969
    }
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1970
    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: 365495
diff changeset
  1971
  }
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1972
}
37a01852d4205709e9a9bb079a41f429f360ef03 Bug 1328066 - Don't broadcast the live-resize events to all browser windows unnecessarily. r=mstange
Kartikaya Gupta <kgupta@mozilla.com>
parents: 365495
diff changeset
  1973
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1974
void nsBaseWidget::RegisterPluginWindowForRemoteUpdates() {
241016
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: 240898
diff changeset
  1975
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1976
  NS_NOTREACHED(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1977
      "nsBaseWidget::RegisterPluginWindowForRemoteUpdates not implemented!");
241016
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: 240898
diff changeset
  1978
  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: 240898
diff changeset
  1979
#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: 240898
diff changeset
  1980
  MOZ_ASSERT(NS_IsMainThread());
241031
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: 241016
diff changeset
  1981
  void* id = GetNativeData(NS_NATIVE_PLUGIN_ID);
241016
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: 240898
diff changeset
  1982
  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: 240898
diff changeset
  1983
    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: 240898
diff changeset
  1984
    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: 240898
diff changeset
  1985
  }
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: 240898
diff changeset
  1986
  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: 240898
diff changeset
  1987
  sPluginWidgetList->Put(id, this);
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: 240898
diff changeset
  1988
#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: 240898
diff changeset
  1989
}
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: 240898
diff changeset
  1990
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1991
void nsBaseWidget::UnregisterPluginWindowForRemoteUpdates() {
241016
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: 240898
diff changeset
  1992
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1993
  NS_NOTREACHED(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  1994
      "nsBaseWidget::UnregisterPluginWindowForRemoteUpdates not implemented!");
241016
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: 240898
diff changeset
  1995
  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: 240898
diff changeset
  1996
#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: 240898
diff changeset
  1997
  MOZ_ASSERT(NS_IsMainThread());
241031
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: 241016
diff changeset
  1998
  void* id = GetNativeData(NS_NATIVE_PLUGIN_ID);
241016
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: 240898
diff changeset
  1999
  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: 240898
diff changeset
  2000
    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: 240898
diff changeset
  2001
    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: 240898
diff changeset
  2002
  }
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: 240898
diff changeset
  2003
  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: 240898
diff changeset
  2004
  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: 240898
diff changeset
  2005
#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: 240898
diff changeset
  2006
}
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: 240898
diff changeset
  2007
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2008
nsresult nsBaseWidget::AsyncEnableDragDrop(bool aEnable) {
416040
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 414482
diff changeset
  2009
  RefPtr<nsBaseWidget> kungFuDeathGrip = this;
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 414482
diff changeset
  2010
  return NS_IdleDispatchToCurrentThread(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2011
      NS_NewRunnableFunction(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2012
          "AsyncEnableDragDropFn",
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2013
          [this, aEnable, kungFuDeathGrip]() { EnableDragDrop(aEnable); }),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2014
      kAsyncDragDropTimeout);
416040
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 414482
diff changeset
  2015
}
6aa682399e1ef4c523abff8f5447d2c10508c064 Bug 1362382 - Move RegisterDragDrop to be called during idle time, if possible r=jimm
Kirk Steuber <ksteuber@mozilla.com>
parents: 414482
diff changeset
  2016
241016
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: 240898
diff changeset
  2017
// static
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2018
nsIWidget* nsIWidget::LookupRegisteredPluginWindow(uintptr_t aWindowID) {
241016
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: 240898
diff changeset
  2019
#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: 240898
diff changeset
  2020
  NS_NOTREACHED("nsBaseWidget::LookupRegisteredPluginWindow not implemented!");
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: 240898
diff changeset
  2021
  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: 240898
diff changeset
  2022
#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: 240898
diff changeset
  2023
  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: 240898
diff changeset
  2024
  MOZ_ASSERT(sPluginWidgetList);
286851
e54d330a1de68a83e3ccf65c75f0fc970f7d872c Bug 1210912 - fix widget leak in LookupRegisteredPluginWindow; r=roc
Nathan Froyd <froydnj@mozilla.com>
parents: 282944
diff changeset
  2025
  return sPluginWidgetList->GetWeak((void*)aWindowID);
241016
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: 240898
diff changeset
  2026
#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: 240898
diff changeset
  2027
}
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: 240898
diff changeset
  2028
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: 240898
diff changeset
  2029
// static
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2030
void nsIWidget::UpdateRegisteredPluginWindowVisibility(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2031
    uintptr_t aOwnerWidget, nsTArray<uintptr_t>& aPluginIds) {
241016
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: 240898
diff changeset
  2032
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2033
  NS_NOTREACHED(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2034
      "nsBaseWidget::UpdateRegisteredPluginWindowVisibility not implemented!");
241016
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: 240898
diff changeset
  2035
  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: 240898
diff changeset
  2036
#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: 240898
diff changeset
  2037
  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: 240898
diff changeset
  2038
  MOZ_ASSERT(sPluginWidgetList);
294513
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2039
267686
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: 267534
diff changeset
  2040
  // Our visible list is associated with a compositor which is associated with
294513
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2041
  // 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: 294507
diff changeset
  2042
  // to skip the plugin widgets owned by other top level windows.
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2043
  for (auto iter = sPluginWidgetList->Iter(); !iter.Done(); iter.Next()) {
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2044
    const void* windowId = iter.Key();
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2045
    nsIWidget* widget = iter.UserData();
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2046
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2047
    MOZ_ASSERT(windowId);
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2048
    MOZ_ASSERT(widget);
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2049
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2050
    if (!widget->Destroyed()) {
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2051
      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: 294507
diff changeset
  2052
        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: 294507
diff changeset
  2053
      }
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2054
    }
66d66e4a2b320878f946736eb8e9324a070ca96f Bug 1186795 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in widget/ with iterators. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 294507
diff changeset
  2055
  }
241016
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: 240898
diff changeset
  2056
#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: 240898
diff changeset
  2057
}
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: 240898
diff changeset
  2058
332665
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: 331955
diff changeset
  2059
#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: 331955
diff changeset
  2060
// static
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2061
void nsIWidget::CaptureRegisteredPlugins(uintptr_t aOwnerWidget) {
332665
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: 331955
diff changeset
  2062
  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: 331955
diff changeset
  2063
  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: 331955
diff changeset
  2064
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: 331955
diff changeset
  2065
  // 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: 331955
diff changeset
  2066
  // 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: 331955
diff changeset
  2067
  // to skip the plugin widgets owned by other top level windows.
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: 331955
diff changeset
  2068
  for (auto iter = sPluginWidgetList->Iter(); !iter.Done(); iter.Next()) {
413533
e2566bf1593494759d19135bb6eb087ef0e2edd9 Bug 1393536 Clean up unused variables in widget/ r=jimm
Tom Ritter <tom@mozilla.com>
parents: 409513
diff changeset
  2069
    DebugOnly<const void*> windowId = iter.Key();
332665
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: 331955
diff changeset
  2070
    nsIWidget* widget = iter.UserData();
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: 331955
diff changeset
  2071
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: 331955
diff changeset
  2072
    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: 331955
diff changeset
  2073
    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: 331955
diff changeset
  2074
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: 331955
diff changeset
  2075
    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: 331955
diff changeset
  2076
      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: 331955
diff changeset
  2077
        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: 331955
diff changeset
  2078
      }
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: 331955
diff changeset
  2079
    }
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: 331955
diff changeset
  2080
  }
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: 331955
diff changeset
  2081
}
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: 331955
diff changeset
  2082
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2083
uint64_t nsBaseWidget::CreateScrollCaptureContainer() {
332665
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: 331955
diff changeset
  2084
  mScrollCaptureContainer =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2085
      LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS);
332665
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: 331955
diff changeset
  2086
  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: 331955
diff changeset
  2087
    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: 331955
diff changeset
  2088
    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: 331955
diff changeset
  2089
  }
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: 331955
diff changeset
  2090
361897
8205e8a9e7a33ed521fa5e0b2e947ca89448ff52 Replace async image container IDs with a typed struct. (bug 1323957 part 1, r=mattwoodrow)
David Anderson <dvander@alliedmods.net>
parents: 361322
diff changeset
  2091
  return mScrollCaptureContainer->GetAsyncContainerHandle().Value();
332665
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: 331955
diff changeset
  2092
}
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: 331955
diff changeset
  2093
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2094
void nsBaseWidget::UpdateScrollCapture() {
332665
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: 331955
diff changeset
  2095
  // Don't capture if no container or no size.
437295
ef2f9e08e01238ae5893951fa13aafdaa3146f45 Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange
Milan Sreckovic <milan@mozilla.com>
parents: 435452
diff changeset
  2096
  if (!mScrollCaptureContainer || mBounds.IsEmpty()) {
332665
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: 331955
diff changeset
  2097
    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: 331955
diff changeset
  2098
  }
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: 331955
diff changeset
  2099
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: 331955
diff changeset
  2100
  // 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: 331955
diff changeset
  2101
  // 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: 331955
diff changeset
  2102
  // 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: 331955
diff changeset
  2103
  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: 331955
diff changeset
  2104
  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: 331955
diff changeset
  2105
    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: 331955
diff changeset
  2106
  }
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: 331955
diff changeset
  2107
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: 331955
diff changeset
  2108
  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: 331955
diff changeset
  2109
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: 331955
diff changeset
  2110
  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: 331955
diff changeset
  2111
  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: 331955
diff changeset
  2112
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: 331955
diff changeset
  2113
  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: 331955
diff changeset
  2114
}
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: 331955
diff changeset
  2115
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2116
void nsBaseWidget::DefaultFillScrollCapture(DrawTarget* aSnapshotDrawTarget) {
332665
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: 331955
diff changeset
  2117
  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: 331955
diff changeset
  2118
  aSnapshotDrawTarget->FillRect(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2119
      gfx::Rect(0, 0, dtSize.width, dtSize.height),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2120
      gfx::ColorPattern(gfx::Color::FromABGR(kScrollCaptureFillColor)),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2121
      gfx::DrawOptions(1.f, gfx::CompositionOp::OP_SOURCE));
332665
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: 331955
diff changeset
  2122
  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: 331955
diff changeset
  2123
}
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: 331955
diff changeset
  2124
#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: 331955
diff changeset
  2125
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2126
nsIWidget::NativeIMEContext nsIWidget::GetNativeIMEContext() {
297629
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: 297553
diff changeset
  2127
  return NativeIMEContext(this);
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: 297553
diff changeset
  2128
}
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: 297553
diff changeset
  2129
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2130
const IMENotificationRequests& nsIWidget::IMENotificationRequestsRef() {
389432
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 388442
diff changeset
  2131
  TextEventDispatcher* dispatcher = GetTextEventDispatcher();
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 388442
diff changeset
  2132
  return dispatcher->IMENotificationRequestsRef();
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 388442
diff changeset
  2133
}
640ff6dddc6cb411d55b9c897670fa1a690865d1 Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 388442
diff changeset
  2134
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2135
nsresult nsIWidget::OnWindowedPluginKeyEvent(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2136
    const NativeEventData& aKeyEventData,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2137
    nsIKeyEventInPluginCallback* aCallback) {
319810
1952b7fec843cbb6e1b402c7a0e2a42ba9ba335f Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
Masayuki Nakano <masayuki@d-toybox.com>
parents: 319779
diff changeset
  2138
  return NS_ERROR_NOT_IMPLEMENTED;
1952b7fec843cbb6e1b402c7a0e2a42ba9ba335f Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
Masayuki Nakano <masayuki@d-toybox.com>
parents: 319779
diff changeset
  2139
}
1952b7fec843cbb6e1b402c7a0e2a42ba9ba335f Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
Masayuki Nakano <masayuki@d-toybox.com>
parents: 319779
diff changeset
  2140
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2141
void nsIWidget::PostHandleKeyEvent(mozilla::WidgetKeyboardEvent* aEvent) {}
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2142
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2143
void nsIWidget::GetEditCommands(nsIWidget::NativeKeyBindingsType aType,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2144
                                const WidgetKeyboardEvent& aEvent,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2145
                                nsTArray<CommandInt>& aCommands) {
394489
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: 393832
diff changeset
  2146
  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: 393832
diff changeset
  2147
  MOZ_ASSERT(aCommands.IsEmpty());
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: 393832
diff changeset
  2148
}
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: 393832
diff changeset
  2149
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2150
namespace mozilla {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2151
namespace widget {
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2152
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2153
const char* ToChar(InputContext::Origin aOrigin) {
403597
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 403523
diff changeset
  2154
  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: 403523
diff changeset
  2155
    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: 403523
diff changeset
  2156
      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: 403523
diff changeset
  2157
    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: 403523
diff changeset
  2158
      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: 403523
diff changeset
  2159
    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: 403523
diff changeset
  2160
      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: 403523
diff changeset
  2161
  }
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 403523
diff changeset
  2162
}
cd648a42778f4910d8588f57ad5954162def726d Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Masayuki Nakano <masayuki@d-toybox.com>
parents: 403523
diff changeset
  2163
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2164
const char* ToChar(IMEMessage aIMEMessage) {
326564
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: 324910
diff changeset
  2165
  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: 324910
diff changeset
  2166
    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: 324910
diff changeset
  2167
      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: 324910
diff changeset
  2168
    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: 324910
diff changeset
  2169
      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: 324910
diff changeset
  2170
    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: 324910
diff changeset
  2171
      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: 324910
diff changeset
  2172
    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: 324910
diff changeset
  2173
      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: 324910
diff changeset
  2174
    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: 324910
diff changeset
  2175
      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: 324910
diff changeset
  2176
    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: 324910
diff changeset
  2177
      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: 324910
diff changeset
  2178
    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: 324910
diff changeset
  2179
      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: 324910
diff changeset
  2180
    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: 324910
diff changeset
  2181
      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: 324910
diff changeset
  2182
    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: 324910
diff changeset
  2183
      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: 324910
diff changeset
  2184
    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: 324910
diff changeset
  2185
      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: 324910
diff changeset
  2186
    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: 324910
diff changeset
  2187
      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: 324910
diff changeset
  2188
  }
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: 324910
diff changeset
  2189
}
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: 324910
diff changeset
  2190
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2191
void NativeIMEContext::Init(nsIWidget* aWidget) {
297629
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: 297553
diff changeset
  2192
  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: 297553
diff changeset
  2193
    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: 297553
diff changeset
  2194
    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: 297553
diff changeset
  2195
    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: 297553
diff changeset
  2196
  }
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: 297553
diff changeset
  2197
  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: 297553
diff changeset
  2198
    mRawNativeIMEContext = reinterpret_cast<uintptr_t>(
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2199
        aWidget->GetNativeData(NS_RAW_NATIVE_IME_CONTEXT));
297629
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: 297553
diff changeset
  2200
    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: 297553
diff changeset
  2201
    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: 297553
diff changeset
  2202
  }
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: 297553
diff changeset
  2203
  // 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: 297553
diff changeset
  2204
  // 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: 297553
diff changeset
  2205
  // 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: 297553
diff changeset
  2206
  // 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: 297553
diff changeset
  2207
  *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: 297553
diff changeset
  2208
}
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: 297553
diff changeset
  2209
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2210
void NativeIMEContext::InitWithRawNativeIMEContext(void* aRawNativeIMEContext) {
297629
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: 297553
diff changeset
  2211
  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: 297553
diff changeset
  2212
    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: 297553
diff changeset
  2213
    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: 297553
diff changeset
  2214
    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: 297553
diff changeset
  2215
  }
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: 297553
diff changeset
  2216
  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: 297553
diff changeset
  2217
  mOriginProcessID =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2218
      XRE_IsContentProcess() ? ContentChild::GetSingleton()->GetID() : 0;
297629
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: 297553
diff changeset
  2219
}
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: 297553
diff changeset
  2220
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2221
void IMENotification::TextChangeDataBase::MergeWith(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2222
    const IMENotification::TextChangeDataBase& aOther) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2223
  MOZ_ASSERT(aOther.IsValid(), "Merging data must store valid data");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2224
  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: 271414
diff changeset
  2225
             "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: 271414
diff changeset
  2226
  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: 271414
diff changeset
  2227
             "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: 271414
diff changeset
  2228
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2229
  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: 271414
diff changeset
  2230
    *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: 271414
diff changeset
  2231
    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: 271414
diff changeset
  2232
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2233
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2234
  // |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: 271414
diff changeset
  2235
  // 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: 271414
diff changeset
  2236
  // 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: 271414
diff changeset
  2237
  // 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: 271414
diff changeset
  2238
  // |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: 271414
diff changeset
  2239
  // 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: 271414
diff changeset
  2240
  // 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: 271414
diff changeset
  2241
  // 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: 271414
diff changeset
  2242
  // |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: 271414
diff changeset
  2243
  // 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: 271414
diff changeset
  2244
  // 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: 271414
diff changeset
  2245
  // 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: 271414
diff changeset
  2246
  // 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: 271414
diff changeset
  2247
  // |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: 271414
diff changeset
  2248
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2249
  // 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: 271414
diff changeset
  2250
  // 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: 271414
diff changeset
  2251
  // |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: 271414
diff changeset
  2252
  // |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: 271414
diff changeset
  2253
  // 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: 271414
diff changeset
  2254
  // 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: 271414
diff changeset
  2255
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2256
  // 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: 271414
diff changeset
  2257
  // 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: 271414
diff changeset
  2258
  // 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: 271414
diff changeset
  2259
  // 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: 271414
diff changeset
  2260
  // 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: 271414
diff changeset
  2261
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2262
  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: 271414
diff changeset
  2263
  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: 271414
diff changeset
  2264
305727
66b71325dfbf5cf32f2eb20a724d0dfcd805ccd0 Bug 1242331 part.2 Rename TextChangeDataBase::mCausedByComposition to mCausedOnlyByComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305643
diff changeset
  2265
  // 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: 305643
diff changeset
  2266
  // by composition.
66b71325dfbf5cf32f2eb20a724d0dfcd805ccd0 Bug 1242331 part.2 Rename TextChangeDataBase::mCausedByComposition to mCausedOnlyByComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305643
diff changeset
  2267
  mCausedOnlyByComposition =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2268
      newData.mCausedOnlyByComposition && oldData.mCausedOnlyByComposition;
305729
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305728
diff changeset
  2269
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305728
diff changeset
  2270
  // 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: 305728
diff changeset
  2271
  // merged changes occurred without composition.
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305728
diff changeset
  2272
  mIncludingChangesWithoutComposition =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2273
      newData.mIncludingChangesWithoutComposition ||
305729
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305728
diff changeset
  2274
      oldData.mIncludingChangesWithoutComposition;
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305728
diff changeset
  2275
305728
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305727
diff changeset
  2276
  // 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: 305727
diff changeset
  2277
  // 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: 305727
diff changeset
  2278
  if (!newData.mCausedOnlyByComposition &&
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305727
diff changeset
  2279
      !newData.mIncludingChangesDuringComposition) {
305729
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305728
diff changeset
  2280
    MOZ_ASSERT(newData.mIncludingChangesWithoutComposition);
04d8a95c6a5e19ca4debf62a052e8011cf6af478 Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305728
diff changeset
  2281
    MOZ_ASSERT(mIncludingChangesWithoutComposition);
305728
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305727
diff changeset
  2282
    // 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: 305727
diff changeset
  2283
    // 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: 305727
diff changeset
  2284
    // 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: 305727
diff changeset
  2285
    // composition.
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305727
diff changeset
  2286
    mIncludingChangesDuringComposition = false;
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305727
diff changeset
  2287
  } else {
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305727
diff changeset
  2288
    // 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: 305727
diff changeset
  2289
    // 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: 305727
diff changeset
  2290
    mIncludingChangesDuringComposition =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2291
        newData.mIncludingChangesDuringComposition ||
305728
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305727
diff changeset
  2292
        oldData.mIncludingChangesDuringComposition;
3442a539cc8b8f2a7ab504f1e3fad11541579652 Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 305727
diff changeset
  2293
  }
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2294
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2295
  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: 271414
diff changeset
  2296
    // 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: 271414
diff changeset
  2297
    // 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: 271414
diff changeset
  2298
    // 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: 271414
diff changeset
  2299
    // 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: 271414
diff changeset
  2300
    // 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: 271414
diff changeset
  2301
    // 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: 271414
diff changeset
  2302
    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: 271414
diff changeset
  2303
    // 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: 271414
diff changeset
  2304
    // 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: 271414
diff changeset
  2305
    // 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: 271414
diff changeset
  2306
    // 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: 271414
diff changeset
  2307
    uint32_t newRemovedEndOffsetInOldText =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2308
        newData.mRemovedEndOffset - oldData.Difference();
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2309
    mRemovedEndOffset =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2310
        std::max(newRemovedEndOffsetInOldText, oldData.mRemovedEndOffset);
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2311
    // 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: 271414
diff changeset
  2312
    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: 271414
diff changeset
  2313
    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: 271414
diff changeset
  2314
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2315
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2316
  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: 271414
diff changeset
  2317
    // 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: 271414
diff changeset
  2318
    // 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: 271414
diff changeset
  2319
    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: 271414
diff changeset
  2320
    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: 271414
diff changeset
  2321
      // 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: 271414
diff changeset
  2322
      // 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: 271414
diff changeset
  2323
      // 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: 271414
diff changeset
  2324
      // 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: 271414
diff changeset
  2325
      // 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: 271414
diff changeset
  2326
      // 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: 271414
diff changeset
  2327
      // 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: 271414
diff changeset
  2328
      // 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: 271414
diff changeset
  2329
      // 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: 271414
diff changeset
  2330
      // 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: 271414
diff changeset
  2331
      uint32_t newRemovedEndOffsetInOldText =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2332
          newData.mRemovedEndOffset - oldData.Difference();
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2333
      mRemovedEndOffset =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2334
          std::max(newRemovedEndOffsetInOldText, oldData.mRemovedEndOffset);
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2335
      // 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: 271414
diff changeset
  2336
      // 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: 271414
diff changeset
  2337
      // 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: 271414
diff changeset
  2338
      // 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: 271414
diff changeset
  2339
      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: 271414
diff changeset
  2340
      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: 271414
diff changeset
  2341
    }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2342
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2343
    // 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: 271414
diff changeset
  2344
    // 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: 271414
diff changeset
  2345
    // 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: 271414
diff changeset
  2346
    // 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: 271414
diff changeset
  2347
    // 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: 271414
diff changeset
  2348
    // 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: 271414
diff changeset
  2349
    // 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: 271414
diff changeset
  2350
    // 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: 271414
diff changeset
  2351
    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: 271414
diff changeset
  2352
    // 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: 271414
diff changeset
  2353
    // 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: 271414
diff changeset
  2354
    uint32_t oldAddedEndOffsetInNewText =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2355
        oldData.mAddedEndOffset + newData.Difference();
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2356
    mAddedEndOffset =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2357
        std::max(newData.mAddedEndOffset, oldAddedEndOffsetInNewText);
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2358
    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: 271414
diff changeset
  2359
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2360
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2361
  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: 271414
diff changeset
  2362
    // 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: 271414
diff changeset
  2363
    // 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: 271414
diff changeset
  2364
    // 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: 271414
diff changeset
  2365
    MOZ_ASSERT(newData.mStartOffset < oldData.mStartOffset,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2366
               "new start offset should be less than old one here");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2367
    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: 271414
diff changeset
  2368
    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: 271414
diff changeset
  2369
      // 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: 271414
diff changeset
  2370
      // 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: 271414
diff changeset
  2371
      // 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: 271414
diff changeset
  2372
      // 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: 271414
diff changeset
  2373
      // 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: 271414
diff changeset
  2374
      // 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: 271414
diff changeset
  2375
      // 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: 271414
diff changeset
  2376
      // 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: 271414
diff changeset
  2377
      // 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: 271414
diff changeset
  2378
      // 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: 271414
diff changeset
  2379
      uint32_t newRemovedEndOffsetInOldText =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2380
          newData.mRemovedEndOffset - oldData.Difference();
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2381
      mRemovedEndOffset =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2382
          std::max(newRemovedEndOffsetInOldText, oldData.mRemovedEndOffset);
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2383
      // 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: 271414
diff changeset
  2384
      // 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: 271414
diff changeset
  2385
      // 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: 271414
diff changeset
  2386
      // 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: 271414
diff changeset
  2387
      // 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: 271414
diff changeset
  2388
      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: 271414
diff changeset
  2389
      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: 271414
diff changeset
  2390
    }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2391
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2392
    // 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: 271414
diff changeset
  2393
    // 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: 271414
diff changeset
  2394
    // 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: 271414
diff changeset
  2395
    // 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: 271414
diff changeset
  2396
    // 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: 271414
diff changeset
  2397
    // 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: 271414
diff changeset
  2398
    // 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: 271414
diff changeset
  2399
    // 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: 271414
diff changeset
  2400
    // 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: 271414
diff changeset
  2401
    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: 271414
diff changeset
  2402
    // 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: 271414
diff changeset
  2403
    // 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: 271414
diff changeset
  2404
    // 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: 271414
diff changeset
  2405
    uint32_t oldAddedEndOffsetInNewText =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2406
        oldData.mAddedEndOffset + newData.Difference();
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2407
    mAddedEndOffset =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2408
        std::max(newData.mAddedEndOffset, oldAddedEndOffsetInNewText);
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2409
    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: 271414
diff changeset
  2410
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2411
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2412
  // 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: 271414
diff changeset
  2413
  // 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: 271414
diff changeset
  2414
  // 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: 271414
diff changeset
  2415
  // 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: 271414
diff changeset
  2416
  // 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: 271414
diff changeset
  2417
  MOZ_ASSERT(newData.mStartOffset < oldData.mStartOffset,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2418
             "new start offset should be less than old one here");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2419
  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: 271414
diff changeset
  2420
  MOZ_ASSERT(newData.mRemovedEndOffset < oldData.mRemovedEndOffset,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2421
             "new removed end offset should be less than old one here");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2422
  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: 271414
diff changeset
  2423
  // 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: 271414
diff changeset
  2424
  uint32_t oldAddedEndOffsetInNewText =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2425
      oldData.mAddedEndOffset + newData.Difference();
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2426
  mAddedEndOffset =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2427
      std::max(newData.mAddedEndOffset, oldAddedEndOffsetInNewText);
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2428
}
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2429
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2430
#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: 271414
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: 271414
diff changeset
  2432
// 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: 271414
diff changeset
  2433
// 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: 271414
diff changeset
  2434
// cannot be tested with mochitest.
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2435
void IMENotification::TextChangeDataBase::Test() {
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2436
  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: 271414
diff changeset
  2437
  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: 271414
diff changeset
  2438
    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: 271414
diff changeset
  2439
  }
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2440
  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: 271414
diff changeset
  2441
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2442
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2443
   * 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: 271414
diff changeset
  2444
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2445
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2446
  // Appending text
290351
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: 289201
diff changeset
  2447
  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: 289201
diff changeset
  2448
  MergeWith(TextChangeData(20, 20, 35, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2449
  MOZ_ASSERT(mStartOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2450
             "Test 1-1-1: mStartOffset should be the first offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2451
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2452
      mRemovedEndOffset == 10,  // 20 - (20 - 10)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2453
      "Test 1-1-2: mRemovedEndOffset should be the first end of removed text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2454
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2455
      mAddedEndOffset == 35,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2456
      "Test 1-1-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2457
  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: 271414
diff changeset
  2458
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2459
  // Removing text (longer line -> shorter line)
290351
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: 289201
diff changeset
  2460
  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: 289201
diff changeset
  2461
  MergeWith(TextChangeData(10, 30, 10, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2462
  MOZ_ASSERT(mStartOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2463
             "Test 1-2-1: mStartOffset should be the first offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2464
  MOZ_ASSERT(mRemovedEndOffset == 40,  // 30 + (10 - 20)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2465
             "Test 1-2-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2466
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2467
             "with already removed length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2468
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2469
      mAddedEndOffset == 10,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2470
      "Test 1-2-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2471
  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: 271414
diff changeset
  2472
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2473
  // Removing text (shorter line -> longer line)
290351
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: 289201
diff changeset
  2474
  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: 289201
diff changeset
  2475
  MergeWith(TextChangeData(10, 15, 10, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2476
  MOZ_ASSERT(mStartOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2477
             "Test 1-3-1: mStartOffset should be the first offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2478
  MOZ_ASSERT(mRemovedEndOffset == 25,  // 15 + (10 - 20)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2479
             "Test 1-3-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2480
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2481
             "with already removed length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2482
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2483
      mAddedEndOffset == 10,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2484
      "Test 1-3-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2485
  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: 271414
diff changeset
  2486
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2487
  // Appending text at different point (not sure if actually occurs)
290351
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: 289201
diff changeset
  2488
  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: 289201
diff changeset
  2489
  MergeWith(TextChangeData(55, 55, 60, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2490
  MOZ_ASSERT(mStartOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2491
             "Test 1-4-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2492
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2493
      mRemovedEndOffset == 45,  // 55 - (10 - 20)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2494
      "Test 1-4-2: mRemovedEndOffset should be the the largest end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2495
      "text without already added length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2496
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2497
      mAddedEndOffset == 60,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2498
      "Test 1-4-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2499
  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: 271414
diff changeset
  2500
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2501
  // Removing text at different point (not sure if actually occurs)
290351
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: 289201
diff changeset
  2502
  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: 289201
diff changeset
  2503
  MergeWith(TextChangeData(55, 68, 55, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2504
  MOZ_ASSERT(mStartOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2505
             "Test 1-5-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2506
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2507
      mRemovedEndOffset == 78,  // 68 - (10 - 20)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2508
      "Test 1-5-2: mRemovedEndOffset should be the the largest end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2509
      "text with already removed length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2510
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2511
      mAddedEndOffset == 55,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2512
      "Test 1-5-3: mAddedEndOffset should be the largest end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2513
  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: 271414
diff changeset
  2514
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2515
  // Replacing text and append text (becomes longer)
290351
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: 289201
diff changeset
  2516
  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: 289201
diff changeset
  2517
  MergeWith(TextChangeData(32, 32, 40, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2518
  MOZ_ASSERT(mStartOffset == 30,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2519
             "Test 1-6-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2520
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2521
      mRemovedEndOffset == 35,  // 32 - (32 - 35)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2522
      "Test 1-6-2: mRemovedEndOffset should be the the first end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2523
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2524
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2525
      mAddedEndOffset == 40,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2526
      "Test 1-6-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2527
  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: 271414
diff changeset
  2528
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2529
  // Replacing text and append text (becomes shorter)
290351
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: 289201
diff changeset
  2530
  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: 289201
diff changeset
  2531
  MergeWith(TextChangeData(32, 32, 33, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2532
  MOZ_ASSERT(mStartOffset == 30,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2533
             "Test 1-7-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2534
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2535
      mRemovedEndOffset == 35,  // 32 - (32 - 35)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2536
      "Test 1-7-2: mRemovedEndOffset should be the the first end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2537
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2538
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2539
      mAddedEndOffset == 33,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2540
      "Test 1-7-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2541
  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: 271414
diff changeset
  2542
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2543
  // 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: 271414
diff changeset
  2544
  // occurs)
290351
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: 289201
diff changeset
  2545
  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: 289201
diff changeset
  2546
  MergeWith(TextChangeData(32, 34, 48, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2547
  MOZ_ASSERT(mStartOffset == 30,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2548
             "Test 1-8-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2549
  MOZ_ASSERT(mRemovedEndOffset == 39,  // 34 - (30 - 35)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2550
             "Test 1-8-2: mRemovedEndOffset should be the the first end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2551
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2552
             "without already removed text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2553
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2554
      mAddedEndOffset == 48,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2555
      "Test 1-8-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2556
  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: 271414
diff changeset
  2557
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2558
  // 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: 271414
diff changeset
  2559
  // occurs)
290351
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: 289201
diff changeset
  2560
  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: 289201
diff changeset
  2561
  MergeWith(TextChangeData(32, 38, 36, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2562
  MOZ_ASSERT(mStartOffset == 30,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2563
             "Test 1-9-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2564
  MOZ_ASSERT(mRemovedEndOffset == 43,  // 38 - (30 - 35)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2565
             "Test 1-9-2: mRemovedEndOffset should be the the first end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2566
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2567
             "without already removed text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2568
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2569
      mAddedEndOffset == 36,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2570
      "Test 1-9-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2571
  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: 271414
diff changeset
  2572
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2573
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2574
   * 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: 271414
diff changeset
  2575
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2576
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2577
  // 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: 271414
diff changeset
  2578
  // if actually occurs)
290351
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: 289201
diff changeset
  2579
  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: 289201
diff changeset
  2580
  MergeWith(TextChangeData(53, 60, 54, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2581
  MOZ_ASSERT(mStartOffset == 50,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2582
             "Test 2-1-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2583
  MOZ_ASSERT(mRemovedEndOffset == 55,  // 60 - (55 - 50)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2584
             "Test 2-1-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2585
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2586
             "without already added text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2587
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2588
      mAddedEndOffset == 54,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2589
      "Test 2-1-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2590
  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: 271414
diff changeset
  2591
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2592
  // 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: 271414
diff changeset
  2593
  // if actually occurs)
290351
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: 289201
diff changeset
  2594
  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: 289201
diff changeset
  2595
  MergeWith(TextChangeData(54, 62, 68, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2596
  MOZ_ASSERT(mStartOffset == 50,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2597
             "Test 2-2-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2598
  MOZ_ASSERT(mRemovedEndOffset == 57,  // 62 - (55 - 50)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2599
             "Test 2-2-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2600
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2601
             "without already added text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2602
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2603
      mAddedEndOffset == 68,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2604
      "Test 2-2-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2605
  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: 271414
diff changeset
  2606
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2607
  // 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: 271414
diff changeset
  2608
  // actually occurs)
290351
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: 289201
diff changeset
  2609
  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: 289201
diff changeset
  2610
  MergeWith(TextChangeData(43, 50, 49, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2611
  MOZ_ASSERT(mStartOffset == 36,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2612
             "Test 2-3-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2613
  MOZ_ASSERT(mRemovedEndOffset == 53,  // 50 - (45 - 48)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2614
             "Test 2-3-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2615
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2616
             "without already removed text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2617
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2618
      mAddedEndOffset == 49,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2619
      "Test 2-3-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2620
  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: 271414
diff changeset
  2621
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2622
  // 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: 271414
diff changeset
  2623
  // actually occurs)
290351
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: 289201
diff changeset
  2624
  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: 289201
diff changeset
  2625
  MergeWith(TextChangeData(43, 68, 61, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2626
  MOZ_ASSERT(mStartOffset == 36,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2627
             "Test 2-4-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2628
  MOZ_ASSERT(mRemovedEndOffset == 67,  // 68 - (53 - 52)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2629
             "Test 2-4-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2630
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2631
             "without already added text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2632
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2633
      mAddedEndOffset == 61,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2634
      "Test 2-4-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2635
  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: 271414
diff changeset
  2636
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2637
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2638
   * 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: 271414
diff changeset
  2639
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2640
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2641
  // Appending text in already added text (not sure if actually occurs)
290351
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: 289201
diff changeset
  2642
  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: 289201
diff changeset
  2643
  MergeWith(TextChangeData(15, 15, 30, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2644
  MOZ_ASSERT(mStartOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2645
             "Test 3-1-1: mStartOffset should be the smallest offset");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2646
  MOZ_ASSERT(mRemovedEndOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2647
             "Test 3-1-2: mRemovedEndOffset should be the the first end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2648
             "removed text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2649
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2650
      mAddedEndOffset == 35,  // 20 + (30 - 15)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2651
      "Test 3-1-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2652
      "added text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2653
  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: 271414
diff changeset
  2654
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2655
  // Replacing text in added text (not sure if actually occurs)
290351
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: 289201
diff changeset
  2656
  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: 289201
diff changeset
  2657
  MergeWith(TextChangeData(52, 53, 56, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2658
  MOZ_ASSERT(mStartOffset == 50,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2659
             "Test 3-2-1: mStartOffset should be the smallest offset");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2660
  MOZ_ASSERT(mRemovedEndOffset == 50,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2661
             "Test 3-2-2: mRemovedEndOffset should be the the first end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2662
             "removed text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2663
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2664
      mAddedEndOffset == 58,  // 55 + (56 - 53)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2665
      "Test 3-2-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2666
      "added text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2667
  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: 271414
diff changeset
  2668
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2669
  // 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: 271414
diff changeset
  2670
  // occurs)
290351
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: 289201
diff changeset
  2671
  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: 289201
diff changeset
  2672
  MergeWith(TextChangeData(37, 38, 50, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2673
  MOZ_ASSERT(mStartOffset == 36,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2674
             "Test 3-3-1: mStartOffset should be the smallest offset");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2675
  MOZ_ASSERT(mRemovedEndOffset == 48,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2676
             "Test 3-3-2: mRemovedEndOffset should be the the first end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2677
             "removed text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2678
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2679
      mAddedEndOffset == 57,  // 45 + (50 - 38)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2680
      "Test 3-3-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2681
      "added text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2682
  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: 271414
diff changeset
  2683
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2684
  // 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: 271414
diff changeset
  2685
  // occurs)
290351
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: 289201
diff changeset
  2686
  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: 289201
diff changeset
  2687
  MergeWith(TextChangeData(43, 50, 52, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2688
  MOZ_ASSERT(mStartOffset == 32,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2689
             "Test 3-4-1: mStartOffset should be the smallest offset");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2690
  MOZ_ASSERT(mRemovedEndOffset == 48,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2691
             "Test 3-4-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2692
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2693
             "without already added text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2694
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2695
      mAddedEndOffset == 55,  // 53 + (52 - 50)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2696
      "Test 3-4-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2697
      "added text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2698
  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: 271414
diff changeset
  2699
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2700
  // 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: 271414
diff changeset
  2701
  // occurs)
290351
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: 289201
diff changeset
  2702
  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: 289201
diff changeset
  2703
  MergeWith(TextChangeData(37, 49, 47, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2704
  MOZ_ASSERT(mStartOffset == 36,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2705
             "Test 3-5-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2706
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2707
      mRemovedEndOffset == 48,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2708
      "Test 3-5-2: mRemovedEndOffset should be the the first end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2709
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2710
  MOZ_ASSERT(mAddedEndOffset == 48,  // 50 + (47 - 49)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2711
             "Test 3-5-3: mAddedEndOffset should be the first end of added "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2712
             "text without "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2713
             "removed text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2714
  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: 271414
diff changeset
  2715
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2716
  // 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: 271414
diff changeset
  2717
  // occurs)
290351
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: 289201
diff changeset
  2718
  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: 289201
diff changeset
  2719
  MergeWith(TextChangeData(43, 50, 47, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2720
  MOZ_ASSERT(mStartOffset == 32,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2721
             "Test 3-6-1: mStartOffset should be the smallest offset");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2722
  MOZ_ASSERT(mRemovedEndOffset == 48,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2723
             "Test 3-6-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2724
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2725
             "without already added text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2726
  MOZ_ASSERT(mAddedEndOffset == 50,  // 53 + (47 - 50)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2727
             "Test 3-6-3: mAddedEndOffset should be the first end of added "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2728
             "text without "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2729
             "removed text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2730
  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: 271414
diff changeset
  2731
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2732
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2733
   * 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: 271414
diff changeset
  2734
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2735
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2736
  // Replacing text all of already append text (not sure if actually occurs)
290351
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: 289201
diff changeset
  2737
  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: 289201
diff changeset
  2738
  MergeWith(TextChangeData(44, 66, 68, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2739
  MOZ_ASSERT(mStartOffset == 44,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2740
             "Test 4-1-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2741
  MOZ_ASSERT(mRemovedEndOffset == 61,  // 66 - (55 - 50)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2742
             "Test 4-1-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2743
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2744
             "without already added text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2745
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2746
      mAddedEndOffset == 68,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2747
      "Test 4-1-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2748
  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: 271414
diff changeset
  2749
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2750
  // 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: 271414
diff changeset
  2751
  // actually occurs)
290351
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: 289201
diff changeset
  2752
  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: 289201
diff changeset
  2753
  MergeWith(TextChangeData(44, 66, 68, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2754
  MOZ_ASSERT(mStartOffset == 44,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2755
             "Test 4-2-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2756
  MOZ_ASSERT(mRemovedEndOffset == 78,  // 66 - (50 - 62)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2757
             "Test 4-2-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2758
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2759
             "without already removed text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2760
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2761
      mAddedEndOffset == 68,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2762
      "Test 4-2-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2763
  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: 271414
diff changeset
  2764
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2765
  // 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: 271414
diff changeset
  2766
  // occurs)
290351
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: 289201
diff changeset
  2767
  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: 289201
diff changeset
  2768
  MergeWith(TextChangeData(49, 128, 130, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2769
  MOZ_ASSERT(mStartOffset == 49,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2770
             "Test 4-3-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2771
  MOZ_ASSERT(mRemovedEndOffset == 130,  // 128 - (60 - 62)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2772
             "Test 4-3-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2773
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2774
             "without already removed text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2775
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2776
      mAddedEndOffset == 130,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2777
      "Test 4-3-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2778
  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: 271414
diff changeset
  2779
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2780
  // 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: 271414
diff changeset
  2781
  // occurs)
290351
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: 289201
diff changeset
  2782
  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: 289201
diff changeset
  2783
  MergeWith(TextChangeData(44, 100, 50, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2784
  MOZ_ASSERT(mStartOffset == 44,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2785
             "Test 4-4-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2786
  MOZ_ASSERT(mRemovedEndOffset == 88,  // 100 - (73 - 61)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2787
             "Test 4-4-2: mRemovedEndOffset should be the the last end of "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2788
             "removed text "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2789
             "with already added text length");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2790
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2791
      mAddedEndOffset == 50,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2792
      "Test 4-4-3: mAddedEndOffset should be the last end of added text");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2793
  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: 271414
diff changeset
  2794
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2795
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2796
   * 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: 271414
diff changeset
  2797
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2798
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2799
  // Replacing text around start of added text (not sure if actually occurs)
290351
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: 289201
diff changeset
  2800
  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: 289201
diff changeset
  2801
  MergeWith(TextChangeData(48, 52, 49, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2802
  MOZ_ASSERT(mStartOffset == 48,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2803
             "Test 5-1-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2804
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2805
      mRemovedEndOffset == 50,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2806
      "Test 5-1-2: mRemovedEndOffset should be the the first end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2807
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2808
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2809
      mAddedEndOffset == 52,  // 55 + (52 - 49)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2810
      "Test 5-1-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2811
      "added text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2812
  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: 271414
diff changeset
  2813
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2814
  // 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: 271414
diff changeset
  2815
  // actually occurs)
290351
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: 289201
diff changeset
  2816
  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: 289201
diff changeset
  2817
  MergeWith(TextChangeData(43, 50, 48, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2818
  MOZ_ASSERT(mStartOffset == 43,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2819
             "Test 5-2-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2820
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2821
      mRemovedEndOffset == 60,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2822
      "Test 5-2-2: mRemovedEndOffset should be the the first end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2823
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2824
  MOZ_ASSERT(mAddedEndOffset == 56,  // 58 + (48 - 50)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2825
             "Test 5-2-3: mAddedEndOffset should be the first end of added "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2826
             "text without "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2827
             "removed text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2828
  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: 271414
diff changeset
  2829
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2830
  // 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: 271414
diff changeset
  2831
  // actually occurs)
290351
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: 289201
diff changeset
  2832
  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: 289201
diff changeset
  2833
  MergeWith(TextChangeData(43, 55, 53, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2834
  MOZ_ASSERT(mStartOffset == 43,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2835
             "Test 5-3-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2836
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2837
      mRemovedEndOffset == 60,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2838
      "Test 5-3-2: mRemovedEndOffset should be the the first end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2839
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2840
  MOZ_ASSERT(mAddedEndOffset == 66,  // 68 + (53 - 55)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2841
             "Test 5-3-3: mAddedEndOffset should be the first end of added "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2842
             "text without "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2843
             "removed text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2844
  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: 271414
diff changeset
  2845
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2846
  // 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: 271414
diff changeset
  2847
  // actually occurs)
290351
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: 289201
diff changeset
  2848
  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: 289201
diff changeset
  2849
  MergeWith(TextChangeData(43, 50, 128, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2850
  MOZ_ASSERT(mStartOffset == 43,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2851
             "Test 5-4-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2852
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2853
      mRemovedEndOffset == 60,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2854
      "Test 5-4-2: mRemovedEndOffset should be the the first end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2855
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2856
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2857
      mAddedEndOffset == 136,  // 58 + (128 - 50)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2858
      "Test 5-4-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2859
      "added text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2860
  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: 271414
diff changeset
  2861
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2862
  // 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: 271414
diff changeset
  2863
  // actually occurs)
290351
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: 289201
diff changeset
  2864
  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: 289201
diff changeset
  2865
  MergeWith(TextChangeData(43, 55, 65, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2866
  MOZ_ASSERT(mStartOffset == 43,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2867
             "Test 5-5-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2868
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2869
      mRemovedEndOffset == 60,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2870
      "Test 5-5-2: mRemovedEndOffset should be the the first end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2871
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2872
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2873
      mAddedEndOffset == 78,  // 68 + (65 - 55)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2874
      "Test 5-5-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2875
      "added text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2876
  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: 271414
diff changeset
  2877
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2878
  /****************************************************************************
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2879
   * 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: 271414
diff changeset
  2880
   ****************************************************************************/
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2881
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2882
  // Appending text before already added text (not sure if actually occurs)
290351
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: 289201
diff changeset
  2883
  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: 289201
diff changeset
  2884
  MergeWith(TextChangeData(10, 10, 20, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2885
  MOZ_ASSERT(mStartOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2886
             "Test 6-1-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2887
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2888
      mRemovedEndOffset == 30,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2889
      "Test 6-1-2: mRemovedEndOffset should be the the largest end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2890
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2891
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2892
      mAddedEndOffset == 55,  // 45 + (20 - 10)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2893
      "Test 6-1-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2894
      "added text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2895
  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: 271414
diff changeset
  2896
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2897
  // Removing text before already removed text (not sure if actually occurs)
290351
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: 289201
diff changeset
  2898
  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: 289201
diff changeset
  2899
  MergeWith(TextChangeData(10, 25, 10, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2900
  MOZ_ASSERT(mStartOffset == 10,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2901
             "Test 6-2-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2902
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2903
      mRemovedEndOffset == 35,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2904
      "Test 6-2-2: mRemovedEndOffset should be the the largest end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2905
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2906
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2907
      mAddedEndOffset == 15,  // 30 - (25 - 10)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2908
      "Test 6-2-3: mAddedEndOffset should be the first end of added text with "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2909
      "removed text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2910
  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: 271414
diff changeset
  2911
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2912
  // Replacing text before already replaced text (not sure if actually occurs)
290351
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: 289201
diff changeset
  2913
  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: 289201
diff changeset
  2914
  MergeWith(TextChangeData(13, 24, 15, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2915
  MOZ_ASSERT(mStartOffset == 13,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2916
             "Test 6-3-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2917
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2918
      mRemovedEndOffset == 65,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2919
      "Test 6-3-2: mRemovedEndOffset should be the the largest end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2920
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2921
  MOZ_ASSERT(mAddedEndOffset == 61,  // 70 + (15 - 24)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2922
             "Test 6-3-3: mAddedEndOffset should be the first end of added "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2923
             "text without "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2924
             "removed text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2925
  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: 271414
diff changeset
  2926
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2927
  // Replacing text before already replaced text (not sure if actually occurs)
290351
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: 289201
diff changeset
  2928
  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: 289201
diff changeset
  2929
  MergeWith(TextChangeData(13, 24, 36, false, false));
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2930
  MOZ_ASSERT(mStartOffset == 13,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2931
             "Test 6-4-1: mStartOffset should be the smallest offset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2932
  MOZ_ASSERT(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2933
      mRemovedEndOffset == 65,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2934
      "Test 6-4-2: mRemovedEndOffset should be the the largest end of removed "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2935
      "text");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2936
  MOZ_ASSERT(mAddedEndOffset == 82,  // 70 + (36 - 24)
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2937
             "Test 6-4-3: mAddedEndOffset should be the first end of added "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2938
             "text without "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2939
             "removed text length by the new change");
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2940
  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: 271414
diff changeset
  2941
}
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2942
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2943
#endif  // #ifdef DEBUG
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2944
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2945
}  // namespace widget
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2946
}  // namespace mozilla
271439
2bc21c05668234919c25c3e85cb602ee3dfb46a1 Bug 1176954 part.7 IMENotification::TextChangeData should have a method to merge with another instance and IMENotification::MergeWith() should use it r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 271414
diff changeset
  2947
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
  2948
#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
  2949
//////////////////////////////////////////////////////////////
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  2950
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  2951
// 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
  2952
// 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
  2953
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  2954
// 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
  2955
// 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
  2956
// 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
  2957
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  2958
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2959
/* static */ nsAutoString nsBaseWidget::debug_GuiEventToString(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2960
    WidgetGUIEvent* aGuiEvent) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2961
  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
  2962
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  2963
  nsAutoString eventName(NS_LITERAL_STRING("UNKNOWN"));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  2964
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2965
#define _ASSIGN_eventName(_value, _name) \
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2966
  case _value:                           \
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2967
    eventName.AssignLiteral(_name);      \
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2968
    break
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2969
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2970
  switch (aGuiEvent->mMessage) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2971
    _ASSIGN_eventName(eBlur, "eBlur");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2972
    _ASSIGN_eventName(eDrop, "eDrop");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2973
    _ASSIGN_eventName(eDragEnter, "eDragEnter");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2974
    _ASSIGN_eventName(eDragExit, "eDragExit");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2975
    _ASSIGN_eventName(eDragOver, "eDragOver");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2976
    _ASSIGN_eventName(eEditorInput, "eEditorInput");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2977
    _ASSIGN_eventName(eFocus, "eFocus");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2978
    _ASSIGN_eventName(eFocusIn, "eFocusIn");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2979
    _ASSIGN_eventName(eFocusOut, "eFocusOut");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2980
    _ASSIGN_eventName(eFormSelect, "eFormSelect");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2981
    _ASSIGN_eventName(eFormChange, "eFormChange");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2982
    _ASSIGN_eventName(eFormReset, "eFormReset");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2983
    _ASSIGN_eventName(eFormSubmit, "eFormSubmit");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2984
    _ASSIGN_eventName(eImageAbort, "eImageAbort");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2985
    _ASSIGN_eventName(eLoadError, "eLoadError");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2986
    _ASSIGN_eventName(eKeyDown, "eKeyDown");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2987
    _ASSIGN_eventName(eKeyPress, "eKeyPress");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2988
    _ASSIGN_eventName(eKeyUp, "eKeyUp");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2989
    _ASSIGN_eventName(eMouseEnterIntoWidget, "eMouseEnterIntoWidget");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2990
    _ASSIGN_eventName(eMouseExitFromWidget, "eMouseExitFromWidget");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2991
    _ASSIGN_eventName(eMouseDown, "eMouseDown");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2992
    _ASSIGN_eventName(eMouseUp, "eMouseUp");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2993
    _ASSIGN_eventName(eMouseClick, "eMouseClick");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2994
    _ASSIGN_eventName(eMouseAuxClick, "eMouseAuxClick");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2995
    _ASSIGN_eventName(eMouseDoubleClick, "eMouseDoubleClick");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2996
    _ASSIGN_eventName(eMouseMove, "eMouseMove");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2997
    _ASSIGN_eventName(eLoad, "eLoad");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2998
    _ASSIGN_eventName(ePopState, "ePopState");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  2999
    _ASSIGN_eventName(eBeforeScriptExecute, "eBeforeScriptExecute");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3000
    _ASSIGN_eventName(eAfterScriptExecute, "eAfterScriptExecute");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3001
    _ASSIGN_eventName(eUnload, "eUnload");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3002
    _ASSIGN_eventName(eHashChange, "eHashChange");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3003
    _ASSIGN_eventName(eReadyStateChange, "eReadyStateChange");
280834
8f9d85e978cac16a296c52cc1dd050e2fbdc3f86 Bug 895274 part.91 Rename NS_XUL_BROADCAST to eXULBroadcast r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 280613
diff changeset
  3004
    _ASSIGN_eventName(eXULBroadcast, "eXULBroadcast");
280835
7fd80515c0fecca6849e56ca1e392df06e8f0c7f Bug 895274 part.92 Rename NS_XUL_COMMAND_UPDATE to eXULCommandUpdate r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 280834
diff changeset
  3005
    _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
  3006
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3007
#undef _ASSIGN_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
  3008
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3009
    default: {
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
  3010
      char buf[32];
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
  3011
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3012
      SprintfLiteral(buf, "UNKNOWN: %d", aGuiEvent->mMessage);
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
  3013
81411
c1311b1ce53c187004e2ea12eb70c56bef0148bf Bug 700234 - get rid of *WithConversion (widget part). r=roc
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 81090
diff changeset
  3014
      CopyASCIItoUTF16(buf, eventName);
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3015
    } 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
  3016
  }
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
  3017
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
  3018
  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
  3019
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3020
//////////////////////////////////////////////////////////////
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3021
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3022
// 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
  3023
//
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3024
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3025
struct PrefPair {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3026
  const char* name;
77769
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77099
diff changeset
  3027
  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
  3028
};
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3029
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3030
static PrefPair debug_PrefValues[] = {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3031
    {"nglayout.debug.crossing_event_dumping", false},
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3032
    {"nglayout.debug.event_dumping", false},
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3033
    {"nglayout.debug.invalidate_dumping", false},
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3034
    {"nglayout.debug.motion_event_dumping", false},
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3035
    {"nglayout.debug.paint_dumping", false},
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3036
    {"nglayout.debug.paint_flashing", 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
  3037
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3038
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3039
bool nsBaseWidget::debug_GetCachedBoolPref(const char* aPrefName) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3040
  NS_ASSERTION(nullptr != aPrefName, "cmon, pref name is null.");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3041
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3042
  for (uint32_t i = 0; i < ArrayLength(debug_PrefValues); i++) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3043
    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
  3044
      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
  3045
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3046
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3047
78810
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78791
diff changeset
  3048
  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
  3049
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3050
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3051
static void debug_SetCachedBoolPref(const char* aPrefName, bool aValue) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3052
  NS_ASSERTION(nullptr != aPrefName, "cmon, pref name is null.");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3053
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3054
  for (uint32_t i = 0; i < ArrayLength(debug_PrefValues); i++) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3055
    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
  3056
      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
  3057
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3058
      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
  3059
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3060
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3061
78810
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78791
diff changeset
  3062
  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
  3063
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3064
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3065
//////////////////////////////////////////////////////////////
251093
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: 250620
diff changeset
  3066
class Debug_PrefObserver final : public nsIObserver {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3067
  ~Debug_PrefObserver() {}
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3068
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3069
 public:
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3070
  NS_DECL_ISUPPORTS
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3071
  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
  3072
};
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3073
187154
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: 184593
diff changeset
  3074
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
  3075
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3076
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
  3077
Debug_PrefObserver::Observe(nsISupports* subject, const char* topic,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3078
                            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
  3079
  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
  3080
77769
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77099
diff changeset
  3081
  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
  3082
  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
  3083
  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
  3084
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3085
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3086
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3087
/* static */ void debug_RegisterPrefCallbacks() {
77769
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77099
diff changeset
  3088
  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
  3089
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3090
  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
  3091
    return;
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3092
  }
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
  3093
78810
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78791
diff changeset
  3094
  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
  3095
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3096
  nsCOMPtr<nsIObserver> obs(new Debug_PrefObserver());
102967
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 102626
diff changeset
  3097
  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
  3098
    // 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
  3099
    debug_PrefValues[i].value =
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3100
        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
  3101
69979
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3102
    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
  3103
      // Register callbacks for when these change
8b60dc275a20c65b77f6bc08f1f79985a2e5ce24 Bug 656826 part.4 xpwidgets should use new pref utilities r=roc
Masayuki Nakano <masayuki@d-toybox.com>
parents: 69890
diff changeset
  3104
      Preferences::AddStrongObserver(obs, debug_PrefValues[i].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
  3105
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3106
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3107
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3108
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3109
static int32_t _GetPrintCount() {
102967
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 102626
diff changeset
  3110
  static int32_t sCount = 0;
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
  3111
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
  3112
  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
  3113
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3114
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3115
/* static */ 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
  3116
  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
  3117
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3119
/* static */ void nsBaseWidget::debug_DumpEvent(FILE* aFileOut,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3120
                                                nsIWidget* aWidget,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3121
                                                WidgetGUIEvent* aGuiEvent,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3122
                                                const char* aWidgetName,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3123
                                                int32_t aWindowID) {
279859
cd4d30cf8ecfb8789d0e69c2adcdfe4c1de7ac8f Bug 895274 part.25 Rename NS_MOUSE_MOVE to eMouseMove r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 279845
diff changeset
  3124
  if (aGuiEvent->mMessage == eMouseMove) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3125
    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
  3126
  }
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
  3127
279862
389f60113c0c037c562eb46f4dfa23feab74a20e Bug 895274 part.28 Rename NS_MOUSE_ENTER_WIDGET to eMouseEnterIntoWidget r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 279861
diff changeset
  3128
  if (aGuiEvent->mMessage == eMouseEnterIntoWidget ||
279863
6949e818c397150c21e14c3d05edb55a86255eba Bug 895274 part.29 Rename NS_MOUSE_EXIT_WIDGET to eMouseExitFromWidget r=smaug
Masayuki Nakano <masayuki@d-toybox.com>
parents: 279862
diff changeset
  3129
      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
  3130
    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
  3131
      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
  3132
  }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! 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
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3134
  if (!debug_GetCachedBoolPref("nglayout.debug.event_dumping")) return;
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3135
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3136
  NS_LossyConvertUTF16toASCII tempString(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3137
      debug_GuiEventToString(aGuiEvent).get());
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3138
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3139
  fprintf(aFileOut, "%4d %-26s widget=%-8p name=%-12s id=0x%-6x refpt=%d,%d\n",
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3140
          _GetPrintCount(), tempString.get(), (void*)aWidget, aWidgetName,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3141
          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
  3142
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3143
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3144
/* static */ void nsBaseWidget::debug_DumpPaintEvent(FILE* aFileOut,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3145
                                                     nsIWidget* aWidget,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3146
                                                     const nsIntRegion& aRegion,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3147
                                                     const char* aWidgetName,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3148
                                                     int32_t aWindowID) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3149
  NS_ASSERTION(nullptr != aFileOut, "cmon, null output FILE");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3150
  NS_ASSERTION(nullptr != aWidget, "cmon, the widget is null");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3151
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3152
  if (!debug_GetCachedBoolPref("nglayout.debug.paint_dumping")) return;
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
  3153
102433
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: 102432
diff changeset
  3154
  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
  3155
  fprintf(aFileOut,
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3156
          "%4d PAINT      widget=%p name=%-12s id=0x%-6x bounds-rect=%3d,%-3d "
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3157
          "%3d,%-3d",
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3158
          _GetPrintCount(), (void*)aWidget, aWidgetName, aWindowID, rect.X(),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3159
          rect.Y(), rect.Width(), rect.Height());
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3160
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3161
  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
  3162
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  3163
//////////////////////////////////////////////////////////////
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3164
/* static */ void nsBaseWidget::debug_DumpInvalidate(
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3165
    FILE* aFileOut, nsIWidget* aWidget, const LayoutDeviceIntRect* aRect,
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3166
    const char* aWidgetName, int32_t aWindowID) {
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3167
  if (!debug_GetCachedBoolPref("nglayout.debug.invalidate_dumping")) return;
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3168
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3169
  NS_ASSERTION(nullptr != aFileOut, "cmon, null output FILE");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3170
  NS_ASSERTION(nullptr != aWidget, "cmon, the widget is null");
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3171
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3172
  fprintf(aFileOut, "%4d Invalidate widget=%p name=%-12s id=0x%-6x",
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3173
          _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
  3174
296863
e091d14c936c948a490457a6420261abe8c16cc6 Bug 1229237 (part 3) - Make nsIWidget::Invalidate() take a LayoutDeviceIntRect. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296861
diff changeset
  3175
  if (aRect) {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3176
    fprintf(aFileOut, " rect=%3d,%-3d %3d,%-3d", aRect->X(), aRect->Y(),
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3177
            aRect->Width(), aRect->Height());
296863
e091d14c936c948a490457a6420261abe8c16cc6 Bug 1229237 (part 3) - Make nsIWidget::Invalidate() take a LayoutDeviceIntRect. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296861
diff changeset
  3178
  } else {
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3179
    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
  3180
  }
117299
dabddf3ea183100cd39a2b9a1b81b6035d81f209 Bug 825079 - Fix -Wint-to-pointer-cast warnings and remove trailing whitespace in nsBaseWidget.cpp. r=roc.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 117091
diff changeset
  3181
296863
e091d14c936c948a490457a6420261abe8c16cc6 Bug 1229237 (part 3) - Make nsIWidget::Invalidate() take a LayoutDeviceIntRect. r=botond.
Nicholas Nethercote <nnethercote@mozilla.com>
parents: 296861
diff changeset
  3182
  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
  3183
}
450616
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3184
  //////////////////////////////////////////////////////////////
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3185
4bcb64fd8fa1aae1bdb7a2a019a283eacb7af4ca Bug 1513900 - Reformat everything on the ESR branch to the Google coding style r=ehsan a=liz
Sylvestre Ledru <sledru@mozilla.com>
parents: 450585
diff changeset
  3186
#endif  // DEBUG