From 9dd34729c141bab0f4fc67f94f21b02e493a3fa2 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Fri, 22 Jul 2011 11:38:57 -0700 Subject: [PATCH 01/10] Sync in-tree and user-repo versions of xpt.py --- xpcom/typelib/xpt/tools/xpt.py | 71 ++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/xpcom/typelib/xpt/tools/xpt.py b/xpcom/typelib/xpt/tools/xpt.py index 3bd303516e5b..2e75482aa6ae 100644 --- a/xpcom/typelib/xpt/tools/xpt.py +++ b/xpcom/typelib/xpt/tools/xpt.py @@ -1118,6 +1118,42 @@ class Typelib(object): if isinstance(m.result, InterfaceType) and m.result.iface not in self.interfaces: raise DataError, "Interface method %s::%s, result references interface %s not present in typelib!" % (i.name, m.name, m.result.iface.name) + def writefd(self, fd): + # write out space for a header + one empty annotation, + # padded to 4-byte alignment. + headersize = (Typelib._header.size + 1) + if headersize % 4: + headersize += 4 - headersize % 4 + fd.write("\x00" * headersize) + # save this offset, it's the interface directory offset. + interface_directory_offset = fd.tell() + # write out space for an interface directory + fd.write("\x00" * Interface._direntry.size * len(self.interfaces)) + # save this offset, it's the data pool offset. + data_pool_offset = fd.tell() + # write out all the interface descriptors to the data pool + for i in self.interfaces: + i.write_names(fd, data_pool_offset) + i.write(self, fd, data_pool_offset) + # now, seek back and write the header + file_len = fd.tell() + fd.seek(0) + fd.write(Typelib._header.pack(XPT_MAGIC, + TYPELIB_VERSION[0], + TYPELIB_VERSION[1], + len(self.interfaces), + file_len, + interface_directory_offset, + data_pool_offset)) + # write an empty annotation + fd.write(struct.pack(">B", 0x80)) + # now write the interface directory + #XXX: bug-compatible with existing xpt lib, put it one byte + # ahead of where it's supposed to be. + fd.seek(interface_directory_offset - 1) + for i in self.interfaces: + i.write_directory_entry(fd) + def write(self, filename): """ Write the contents of this typelib to the file named |filename|. @@ -1125,40 +1161,7 @@ class Typelib(object): """ self._sanityCheck() with open(filename, "wb") as f: - # write out space for a header + one empty annotation, - # padded to 4-byte alignment. - headersize = (Typelib._header.size + 1) - if headersize % 4: - headersize += 4 - headersize % 4 - f.write("\x00" * headersize) - # save this offset, it's the interface directory offset. - interface_directory_offset = f.tell() - # write out space for an interface directory - f.write("\x00" * Interface._direntry.size * len(self.interfaces)) - # save this offset, it's the data pool offset. - data_pool_offset = f.tell() - # write out all the interface descriptors to the data pool - for i in self.interfaces: - i.write_names(f, data_pool_offset) - i.write(self, f, data_pool_offset) - # now, seek back and write the header - file_len = f.tell() - f.seek(0) - f.write(Typelib._header.pack(XPT_MAGIC, - TYPELIB_VERSION[0], - TYPELIB_VERSION[1], - len(self.interfaces), - file_len, - interface_directory_offset, - data_pool_offset)) - # write an empty annotation - f.write(struct.pack(">B", 0x80)) - # now write the interface directory - #XXX: bug-compatible with existing xpt lib, put it one byte - # ahead of where it's supposed to be. - f.seek(interface_directory_offset - 1) - for i in self.interfaces: - i.write_directory_entry(f) + self.writefd(f) def merge(self, other, sanitycheck=True): """ From 0de151045b7748b2af53d7576b20438bc528d737 Mon Sep 17 00:00:00 2001 From: Jeff Hammel Date: Tue, 26 Jul 2011 12:40:47 -0400 Subject: [PATCH 02/10] Bug 659881 - mismatch during build due to build/manifestparser.py;r=ted --- build/manifestparser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/manifestparser.py b/build/manifestparser.py index 238faa98de88..baf2105c572b 100644 --- a/build/manifestparser.py +++ b/build/manifestparser.py @@ -55,10 +55,10 @@ import sys from fnmatch import fnmatch from optparse import OptionParser -version = '0.5.2' # package version +version = '0.5.3' # package version try: from setuptools import setup -except ImportError: +except: setup = None # we need relpath, but it is introduced in python 2.6 From f687b378122a9efc0d5441bf7886a3125cc4ad05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Mon, 25 Jul 2011 19:15:00 -0400 Subject: [PATCH 03/10] bug 673789 - Fix Breakpad compilation on OS X 10.7 SDK by #ifdefing out PPC support when targeting 10.7. r=ted --- .../client/mac/handler/minidump_generator.cc | 17 ++++++++++++++++- .../src/client/mac/handler/minidump_generator.h | 6 ++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc index 8d6704297bcf..087d4d709d1d 100644 --- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc +++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -43,6 +42,11 @@ #include #include "client/mac/handler/minidump_generator.h" + +#ifdef HAS_PPC_SUPPORT +#include +#endif + #include "client/minidump_file_writer-inl.h" #include "common/mac/file_id.h" #include "common/mac/string_utilities.h" @@ -336,10 +340,12 @@ bool MinidumpGenerator::WriteStackFromStartAddress( bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state, MDMemoryDescriptor *stack_location) { switch (cpu_type_) { +#ifdef HAS_PPC_SUUPORT case CPU_TYPE_POWERPC: return WriteStackPPC(state, stack_location); case CPU_TYPE_POWERPC64: return WriteStackPPC64(state, stack_location); +#endif case CPU_TYPE_I386: return WriteStackX86(state, stack_location); case CPU_TYPE_X86_64: @@ -352,10 +358,12 @@ bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state, bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state, MDLocationDescriptor *register_location) { switch (cpu_type_) { +#ifdef HAS_PPC_SUPPORT case CPU_TYPE_POWERPC: return WriteContextPPC(state, register_location); case CPU_TYPE_POWERPC64: return WriteContextPPC64(state, register_location); +#endif case CPU_TYPE_I386: return WriteContextX86(state, register_location); case CPU_TYPE_X86_64: @@ -368,10 +376,12 @@ bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state, u_int64_t MinidumpGenerator::CurrentPCForStack( breakpad_thread_state_data_t state) { switch (cpu_type_) { +#ifdef HAS_PPC_SUPPORT case CPU_TYPE_POWERPC: return CurrentPCForStackPPC(state); case CPU_TYPE_POWERPC64: return CurrentPCForStackPPC64(state); +#endif case CPU_TYPE_I386: return CurrentPCForStackX86(state); case CPU_TYPE_X86_64: @@ -382,6 +392,7 @@ u_int64_t MinidumpGenerator::CurrentPCForStack( } } +#ifdef HAS_PCC_SUPPORT bool MinidumpGenerator::WriteStackPPC(breakpad_thread_state_data_t state, MDMemoryDescriptor *stack_location) { ppc_thread_state_t *machine_state = @@ -539,6 +550,8 @@ bool MinidumpGenerator::WriteContextPPC64( return true; } +#endif + bool MinidumpGenerator::WriteStackX86(breakpad_thread_state_data_t state, MDMemoryDescriptor *stack_location) { i386_thread_state_t *machine_state = @@ -663,12 +676,14 @@ bool MinidumpGenerator::GetThreadState(thread_act_t target_thread, mach_msg_type_number_t *count) { thread_state_flavor_t flavor; switch (cpu_type_) { +#ifdef HAS_PPC_SUPPORT case CPU_TYPE_POWERPC: flavor = PPC_THREAD_STATE; break; case CPU_TYPE_POWERPC64: flavor = PPC_THREAD_STATE64; break; +#endif case CPU_TYPE_I386: flavor = i386_THREAD_STATE; break; diff --git a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h index 224ad1c2a261..55c4c8a34681 100644 --- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h +++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h @@ -43,6 +43,10 @@ #include "dynamic_images.h" +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 + #define HAS_PPC_SUPPORT +#endif + namespace google_breakpad { using std::string; @@ -128,6 +132,7 @@ class MinidumpGenerator { int FindExecutableModule(); // Per-CPU implementations of these methods +#ifdef HAS_PPC_SUPPORT bool WriteStackPPC(breakpad_thread_state_data_t state, MDMemoryDescriptor *stack_location); bool WriteContextPPC(breakpad_thread_state_data_t state, @@ -138,6 +143,7 @@ class MinidumpGenerator { bool WriteContextPPC64(breakpad_thread_state_data_t state, MDLocationDescriptor *register_location); u_int64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state); +#endif bool WriteStackX86(breakpad_thread_state_data_t state, MDMemoryDescriptor *stack_location); bool WriteContextX86(breakpad_thread_state_data_t state, From ffa810a68a4fca8d230f0aff32330afb9f58b742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Mon, 25 Jul 2011 20:43:00 -0400 Subject: [PATCH 04/10] bug 672501 - pass MOZ_OPTIMIZE_LDFLAGS when checking for __thread support. r=ted --- configure.in | 5 ++++- js/src/configure.in | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index b63a95734a5a..1e289f717d05 100644 --- a/configure.in +++ b/configure.in @@ -4287,8 +4287,11 @@ if test "$ac_cv_trouble_comparing_to_zero" = yes ; then fi # try harder, when checking for __thread support, see bug 521750 comment #33 and below +# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is +# enabled, the linker in xcode 4.1 will crash. Without this it would crash when +# linking XUL. _SAVE_LDFLAGS=$LDFLAGS -LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS" +LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS" AC_CACHE_CHECK(for __thread keyword for TLS variables, ac_cv_thread_keyword, [AC_TRY_LINK([__thread bool tlsIsMainThread = false;], diff --git a/js/src/configure.in b/js/src/configure.in index 32e506941a0c..dc684a24c36f 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -4202,8 +4202,11 @@ if test "$ac_cv_trouble_comparing_to_zero" = yes ; then fi # try harder, when checking for __thread support, see bug 521750 comment #33 and below +# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is +# enabled, the linker in xcode 4.1 will crash. Without this it would crash when +# linking XUL. _SAVE_LDFLAGS=$LDFLAGS -LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS" +LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS" AC_CACHE_CHECK(for __thread keyword for TLS variables, ac_cv_thread_keyword, [AC_TRY_LINK([__thread bool tlsIsMainThread = false;], From dc7b23c122efa23eecabc63bd9449e7d77bf4002 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Mon, 1 Aug 2011 08:11:26 -0400 Subject: [PATCH 05/10] Bug 674284: Add nsTArray::SizeOf. r=bsmedberg --- xpcom/glue/nsTArray.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index f385a680ce30..e28b8cfb0a42 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -430,6 +430,12 @@ public: return *this; } + // @return The amount of memory taken used by this nsTArray, not including + // sizeof(this) + size_t SizeOf() const { + return Capacity() * sizeof(elem_type) + sizeof(mHdr); + } + // // Accessor methods // From c67e76416eb787fb5208c94766e5b76965771eb7 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Mon, 1 Aug 2011 08:26:15 -0400 Subject: [PATCH 06/10] Backed out changeset 030c419226ed --- xpcom/glue/nsTArray.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index e28b8cfb0a42..f385a680ce30 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -430,12 +430,6 @@ public: return *this; } - // @return The amount of memory taken used by this nsTArray, not including - // sizeof(this) - size_t SizeOf() const { - return Capacity() * sizeof(elem_type) + sizeof(mHdr); - } - // // Accessor methods // From c76e02d88196903ba28d17530df6aec467445ad9 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Mon, 1 Aug 2011 17:36:42 -0400 Subject: [PATCH 07/10] Bug 670222 - Accidental text selection and more [r=wjohnston] --- mobile/chrome/content/common-ui.js | 36 ++++++++-------- mobile/chrome/content/content.js | 66 ++++++++++++++++++++++-------- 2 files changed, 68 insertions(+), 34 deletions(-) diff --git a/mobile/chrome/content/common-ui.js b/mobile/chrome/content/common-ui.js index 953a3e4f867d..0c6c9908a683 100644 --- a/mobile/chrome/content/common-ui.js +++ b/mobile/chrome/content/common-ui.js @@ -1274,10 +1274,7 @@ var SelectionHelper = { dragMove: function dragMove(dx, dy, scroller) { return false; } }; - this._start.addEventListener("TapDown", this, true); this._start.addEventListener("TapUp", this, true); - - this._end.addEventListener("TapDown", this, true); this._end.addEventListener("TapUp", this, true); messageManager.addMessageListener("Browser:SelectionRange", this); @@ -1285,9 +1282,8 @@ var SelectionHelper = { this.popupState.target.messageManager.sendAsyncMessage("Browser:SelectionStart", { x: this.popupState.x, y: this.popupState.y }); - BrowserUI.pushPopup(this, [this._start, this._end]); - // Hide the selection handles + window.addEventListener("TapDown", this, true); window.addEventListener("resize", this, true); window.addEventListener("keypress", this, true); Elements.browsers.addEventListener("URLChanged", this, true); @@ -1301,12 +1297,18 @@ var SelectionHelper = { return true; }, - hide: function sh_hide() { + hide: function sh_hide(aEvent) { if (this._start.hidden) return; + let pos = this.popupState.target.transformClientToBrowser(aEvent.clientX || 0, aEvent.clientY || 0); + let json = { + x: pos.x, + y: pos.y + }; + try { - this.popupState.target.messageManager.sendAsyncMessage("Browser:SelectionEnd", {}); + this.popupState.target.messageManager.sendAsyncMessage("Browser:SelectionEnd", json); } catch (e) { Cu.reportError(e); } @@ -1316,30 +1318,30 @@ var SelectionHelper = { this._start.hidden = true; this._end.hidden = true; - this._start.removeEventListener("TapDown", this, true); this._start.removeEventListener("TapUp", this, true); - - this._end.removeEventListener("TapDown", this, true); this._end.removeEventListener("TapUp", this, true); messageManager.removeMessageListener("Browser:SelectionRange", this); + window.removeEventListener("TapDown", this, true); window.removeEventListener("resize", this, true); window.removeEventListener("keypress", this, true); Elements.browsers.removeEventListener("URLChanged", this, true); Elements.browsers.removeEventListener("SizeChanged", this, true); Elements.browsers.removeEventListener("ZoomChanged", this, true); - - BrowserUI.popPopup(this); }, handleEvent: function handleEvent(aEvent) { switch (aEvent.type) { case "TapDown": - this.target = aEvent.target; - this.deltaX = (aEvent.clientX - this.target.left); - this.deltaY = (aEvent.clientY - this.target.top); - window.addEventListener("TapMove", this, true); + if (aEvent.target == this._start || aEvent.target == this._end) { + this.target = aEvent.target; + this.deltaX = (aEvent.clientX - this.target.left); + this.deltaY = (aEvent.clientY - this.target.top); + window.addEventListener("TapMove", this, true); + } else { + this.hide(aEvent); + } break; case "TapUp": window.removeEventListener("TapMove", this, true); @@ -1367,7 +1369,7 @@ var SelectionHelper = { case "URLChanged": case "SizeChanged": case "ZoomChanged": - this.hide(); + this.hide(aEvent); break; } }, diff --git a/mobile/chrome/content/content.js b/mobile/chrome/content/content.js index 521522c37ae6..b410535c8204 100644 --- a/mobile/chrome/content/content.js +++ b/mobile/chrome/content/content.js @@ -1334,13 +1334,13 @@ var SelectionHandler = { selectedText: "", contentWindow: null, - init: function() { + init: function sh_init() { addMessageListener("Browser:SelectionStart", this); addMessageListener("Browser:SelectionEnd", this); addMessageListener("Browser:SelectionMove", this); }, - receiveMessage: function(aMessage) { + receiveMessage: function sh_receiveMessage(aMessage) { let scrollOffset = ContentScroll.getScrollOffset(content); let utils = Util.getWindowUtils(content); let json = aMessage.json; @@ -1352,17 +1352,16 @@ var SelectionHandler = { // if this is an iframe, dig down to find the document that was clicked let x = json.x; let y = json.y; - let offsetX = 0; - let offsetY = 0; + let offset = scrollOffset; let elem = utils.elementFromPoint(x, y, true, false); while (elem && (elem instanceof HTMLIFrameElement || elem instanceof HTMLFrameElement)) { // adjust client coordinates' origin to be top left of iframe viewport let rect = elem.getBoundingClientRect(); scrollOffset = ContentScroll.getScrollOffset(elem.ownerDocument.defaultView); - offsetX += rect.left; + offset.x += rect.left; x -= rect.left; - offsetY += rect.top + scrollOffset.y; + offset.y += rect.top + scrollOffset.y; y -= rect.top + scrollOffset.y; utils = elem.contentDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); elem = utils.elementFromPoint(x, y, true, false); @@ -1402,23 +1401,25 @@ var SelectionHandler = { return; } - this.cache = { start: {}, end: {} }; - let rects = range.getClientRects(); - for (let i=0; i this.cache.rect.left && tap.x < this.cache.rect.right) && (tap.y > this.cache.rect.top && tap.y < this.cache.rect.bottom); + if (!pointInSelection) { + selection.collapseToStart(); + return; } this.contentWindow = contentWindow; + sendAsyncMessage("Browser:SelectionRange", this.cache); break; } case "Browser:SelectionEnd": { + let tap = { x: json.x - this.cache.offset.x, y: json.y - this.cache.offset.y }; + pointInSelection = (tap.x > this.cache.rect.left && tap.x < this.cache.rect.right) && (tap.y > this.cache.rect.top && tap.y < this.cache.rect.bottom); + try { // The selection might already be gone if (this.contentWindow) @@ -1426,7 +1427,7 @@ var SelectionHandler = { this.contentWindow = null; } catch(e) {} - if (this.selectedText.length) { + if (pointInSelection && this.selectedText.length) { let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper); clipboard.copyString(this.selectedText); sendAsyncMessage("Browser:SelectionCopied", { succeeded: true }); @@ -1439,11 +1440,16 @@ var SelectionHandler = { case "Browser:SelectionMove": if (!this.contentWindow) return; + // Hack to avoid setting focus in a textbox [Bugs 654352 & 667243] let elemUnder = elementFromPoint(json.x - scrollOffset.x, json.y - scrollOffset.y); if (elemUnder && elemUnder instanceof Ci.nsIDOMHTMLInputElement || elemUnder instanceof Ci.nsIDOMHTMLTextAreaElement) return; + // Limit the selection to the initial content window (don't leave or enter iframes) + if (elemUnder && elemUnder.ownerDocument.defaultView != this.contentWindow) + return; + if (json.type == "end") { this.cache.end.x = json.x - scrollOffset.x; this.cache.end.y = json.y - scrollOffset.y; @@ -1460,9 +1466,35 @@ var SelectionHandler = { } // Cache the selected text since the selection might be gone by the time we get the "end" message - this.selectedText = this.contentWindow.getSelection().toString().trim(); + let selection = this.contentWindow.getSelection() + this.selectedText = selection.toString().trim(); + + // Update the rect we use to test when finishing the clipboard operation + let range = selection.getRangeAt(0).QueryInterface(Ci.nsIDOMNSRange); + this.cache.rect = this._extractFromRange(range, this.cache.offset).rect; break; } + }, + + _extractFromRange: function sh_extractFromRange(aRange, aOffset) { + let cache = { start: {}, end: {}, rect: { left: Number.MAX_VALUE, top: Number.MAX_VALUE, right: 0, bottom: 0 } }; + let rects = aRange.getClientRects(); + for (let i=0; i Date: Mon, 1 Aug 2011 17:37:14 -0400 Subject: [PATCH 08/10] Bug 675236 - portrait view shifted on tablet awesomescreen [r=wjohnston] --- mobile/themes/core/gingerbread/platform.css | 2 +- mobile/themes/core/platform.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/themes/core/gingerbread/platform.css b/mobile/themes/core/gingerbread/platform.css index d266e8a63d87..aad8c3986e93 100644 --- a/mobile/themes/core/gingerbread/platform.css +++ b/mobile/themes/core/gingerbread/platform.css @@ -737,7 +737,7 @@ dialog { -moz-box-align: start; } - .panel-row-button { + #panel-controls > .panel-row-button { -moz-box-orient: horizontal; -moz-box-flex: 0; min-width: @tablet_panel_controls@ !important; diff --git a/mobile/themes/core/platform.css b/mobile/themes/core/platform.css index fc7d76cb7907..32442e0c6e74 100644 --- a/mobile/themes/core/platform.css +++ b/mobile/themes/core/platform.css @@ -750,7 +750,7 @@ dialog { -moz-box-align: start; } - .panel-row-button { + #panel-controls > .panel-row-button { -moz-box-orient: horizontal; -moz-box-flex: 0; min-width: @tablet_panel_controls@ !important; From 78624d4f5868bccbcf3098c164051cedfde4033c Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Mon, 1 Aug 2011 19:03:06 -0400 Subject: [PATCH 09/10] backout bug 341223, changeset backout_4d794b0ef38d because it breaks some developer's builds --- build/autoconf/mozconfig-find | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/build/autoconf/mozconfig-find b/build/autoconf/mozconfig-find index fafd07b1dc65..31f5b71b58e2 100755 --- a/build/autoconf/mozconfig-find +++ b/build/autoconf/mozconfig-find @@ -46,23 +46,17 @@ # topsrcdir=$1 -absolute_path() { - if [ -n "${1%%/*}" ]; then - echo $topsrcdir/$1 - else - echo $1 - fi -} - -if [ -n "$MOZCONFIG" ]; then - MOZCONFIG=`absolute_path "$MOZCONFIG"` - if ! [ -f "$MOZCONFIG" ]; then - echo "Specified MOZCONFIG \"$MOZCONFIG\" does not exist!" +for _config in "$MOZCONFIG" \ + "$MOZ_MYCONFIG" +do + if [ -n "$_config" ] && ! [ -f "$_config" ]; then + echo "Specified MOZCONFIG \"$_config\" does not exist!" exit 1 fi -fi +done for _config in "$MOZCONFIG" \ + "$MOZ_MYCONFIG" \ "$topsrcdir/.mozconfig" \ "$topsrcdir/mozconfig" \ "$topsrcdir/mozconfig.sh" \ From a2e2baf3cd4a03137bda82d3d50fccb5f9ce6397 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Tue, 2 Aug 2011 12:03:15 +0900 Subject: [PATCH 10/10] Bug 658194 Get rid of SendMessage() from mouse wheel event handling r=jimm --- dom/plugins/ipc/PluginInstanceChild.cpp | 4 - widget/src/windows/nsWindow.cpp | 372 ++++++++++++------------ widget/src/windows/nsWindow.h | 19 +- widget/src/windows/nsWindowDefs.h | 6 + 4 files changed, 207 insertions(+), 194 deletions(-) diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 5d50c3b1f775..4ed9ae31c188 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -1289,10 +1289,6 @@ PluginInstanceChild::PluginWindowProcInternal(HWND hWnd, if ((InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) { switch(message) { case WM_KILLFOCUS: - case WM_MOUSEHWHEEL: - case WM_MOUSEWHEEL: - case WM_HSCROLL: - case WM_VSCROLL: ReplyMessage(0); break; } diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 89660cb72726..1b6e63fb1101 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -4251,11 +4251,6 @@ nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam) handled = PR_TRUE; } break; - // Wheel events forwarded from the child. - case WM_MOUSEWHEEL: - case WM_MOUSEHWHEEL: - case WM_HSCROLL: - case WM_VSCROLL: // Plugins taking or losing focus triggering focus app messages. case WM_SETFOCUS: case WM_KILLFOCUS: @@ -5123,6 +5118,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam, result = OnScroll(msg, wParam, lParam); break; + case MOZ_WM_HSCROLL: + case MOZ_WM_VSCROLL: + *aRetValue = 0; + OnScrollInternal(GetNativeMessage(msg), wParam, lParam); + // Doesn't need to call next wndproc for internal message. + return PR_TRUE; + // The WM_ACTIVATE event is fired when a window is raised or lowered, // and the loword of wParam specifies which. But we don't want to tell // the focus system about this until the WM_SETFOCUS or WM_KILLFOCUS @@ -5285,18 +5287,26 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam, case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: + OnMouseWheel(msg, wParam, lParam, aRetValue); + // We don't need to call next wndproc WM_MOUSEWHEEL and WM_MOUSEHWHEEL. + // We should consume them always. If the messages would be handled by + // our window again, it causes making infinite message loop. + return PR_TRUE; + + case MOZ_WM_MOUSEVWHEEL: + case MOZ_WM_MOUSEHWHEEL: { + UINT nativeMessage = GetNativeMessage(msg); // If OnMouseWheel returns true, the event was forwarded directly to another // mozilla window message handler (ProcessMessage). In this case the return // value of the forwarded event is in 'result' which we should return immediately. // If OnMouseWheel returns false, OnMouseWheel processed the event internally. // 'result' and 'aRetValue' will be set based on what we did with the event, so // we should fall through. - if (OnMouseWheel(msg, wParam, lParam, result, aRetValue)) { - return result; - } + OnMouseWheelInternal(nativeMessage, wParam, lParam, aRetValue); + // Doesn't need to call next wndproc for internal message. + return PR_TRUE; } - break; #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN case WM_DWMCOMPOSITIONCHANGED: @@ -6366,14 +6376,14 @@ static PRInt32 RoundDelta(double aDelta) return aDelta >= 0 ? (PRInt32)NS_floor(aDelta) : (PRInt32)NS_ceil(aDelta); } -/* - * OnMouseWheel - mouse wheel event processing. This was originally embedded - * within the message case block. If returning true result should be returned - * immediately (no more processing). +/** + * OnMouseWheelInternal - mouse wheel event processing. + * aMessage may be WM_MOUSEWHEEL or WM_MOUSEHWHEEL but this is called when + * ProcessMessage() handles MOZ_WM_MOUSEVWHEEL or MOZ_WM_MOUSEHWHEEL. */ -PRBool -nsWindow::OnMouseWheel(UINT aMessage, WPARAM aWParam, LPARAM aLParam, - PRBool& aHandled, LRESULT *aRetValue) +void +nsWindow::OnMouseWheelInternal(UINT aMessage, WPARAM aWParam, LPARAM aLParam, + LRESULT *aRetValue) { InitMouseWheelScrollData(); @@ -6385,31 +6395,16 @@ nsWindow::OnMouseWheel(UINT aMessage, WPARAM aWParam, LPARAM aLParam, // and web application may want to handle the event for non-scroll action. ResetRemainingWheelDelta(); *aRetValue = isVertical ? TRUE : FALSE; // means we don't process it - aHandled = PR_FALSE; - return PR_FALSE; + return; } - // The mousewheel event will be dispatched to the toplevel - // window. We need to give it to the child window. - PRBool quit; - if (!HandleScrollingPlugins(aMessage, aWParam, aLParam, - aHandled, aRetValue, quit)) { - ResetRemainingWheelDelta(); - return quit; // return immediately if it's not our window - } - PRInt32 nativeDelta = (short)HIWORD(aWParam); if (!nativeDelta) { *aRetValue = isVertical ? TRUE : FALSE; // means we don't process it - aHandled = PR_FALSE; ResetRemainingWheelDelta(); - return PR_FALSE; // We cannot process this message + return; // We cannot process this message } - // The event may go to a plug-in which already dispatched this message. - // Then, the event can cause deadlock. We should unlock the sender here. - ::ReplyMessage(isVertical ? 0 : TRUE); - PRBool isPageScroll = ((isVertical && sMouseWheelScrollLines == WHEEL_PAGESCROLL) || (!isVertical && sMouseWheelScrollChars == WHEEL_PAGESCROLL)); @@ -6556,17 +6551,17 @@ nsWindow::OnMouseWheel(UINT aMessage, WPARAM aWParam, LPARAM aLParam, } if (scrollEvent.delta) { - aHandled = DispatchWindowEvent(&scrollEvent); + DispatchWindowEvent(&scrollEvent); if (mOnDestroyCalled) { ResetRemainingWheelDelta(); - return PR_FALSE; + return; } } // If the query event failed, we cannot send pixel events. if (!dispatchPixelScrollEvent) { sRemainingDeltaForPixel = 0; - return PR_FALSE; + return; } nsMouseScrollEvent pixelEvent(PR_TRUE, NS_MOUSE_PIXEL_SCROLL, this); @@ -6596,9 +6591,9 @@ nsWindow::OnMouseWheel(UINT aMessage, WPARAM aWParam, LPARAM aLParam, (PRInt32)(pixelEvent.delta * orienterForPixel * deltaPerPixel); sRemainingDeltaForPixel = nativeDeltaForPixel - recomputedNativeDelta; if (pixelEvent.delta != 0) { - aHandled = DispatchWindowEvent(&pixelEvent); + DispatchWindowEvent(&pixelEvent); } - return PR_FALSE; + return; } static PRBool @@ -7582,28 +7577,59 @@ static PRBool IsElantechHelperWindow(HWND aHWND) return result; } -// Scrolling helper function for handling plugins. -// Return value indicates whether the calling function should handle this -// aHandled indicates whether this was handled at all -// aQuitProcessing tells whether or not to continue processing the message -PRBool nsWindow::HandleScrollingPlugins(UINT aMsg, WPARAM aWParam, - LPARAM aLParam, PRBool& aHandled, - LRESULT* aRetValue, - PRBool& aQuitProcessing) +// static +UINT +nsWindow::GetInternalMessage(UINT aNativeMessage) { - // The scroll event will be dispatched to the toplevel - // window. We need to give it to the child window - aQuitProcessing = PR_FALSE; // default is to not stop processing + switch (aNativeMessage) { + case WM_MOUSEWHEEL: + return MOZ_WM_MOUSEVWHEEL; + case WM_MOUSEHWHEEL: + return MOZ_WM_MOUSEHWHEEL; + case WM_VSCROLL: + return MOZ_WM_VSCROLL; + case WM_HSCROLL: + return MOZ_WM_HSCROLL; + default: + return aNativeMessage; + } +} + +// static +UINT +nsWindow::GetNativeMessage(UINT aInternalMessage) +{ + switch (aInternalMessage) { + case MOZ_WM_MOUSEVWHEEL: + return WM_MOUSEWHEEL; + case MOZ_WM_MOUSEHWHEEL: + return WM_MOUSEHWHEEL; + case MOZ_WM_VSCROLL: + return WM_VSCROLL; + case MOZ_WM_HSCROLL: + return WM_HSCROLL; + default: + return aInternalMessage; + } +} + +/** + * OnMouseWheel() is called when ProcessMessage() handles WM_MOUSEWHEEL, + * WM_MOUSEHWHEEL and also OnScroll() tries to emulate mouse wheel action for + * WM_VSCROLL or WM_HSCROLL. + * So, aMsg may be WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL or WM_HSCROLL. + */ +void +nsWindow::OnMouseWheel(UINT aMsg, WPARAM aWParam, LPARAM aLParam, + LRESULT *aRetValue) +{ + *aRetValue = (aMsg != WM_MOUSEHWHEEL) ? TRUE : FALSE; + POINT point; DWORD dwPoints = ::GetMessagePos(); point.x = GET_X_LPARAM(dwPoints); point.y = GET_Y_LPARAM(dwPoints); - static PRBool sIsProcessing = PR_FALSE; - if (sIsProcessing) { - return PR_TRUE; // the caller should handle this. - } - static PRBool sMayBeUsingLogitechMouse = PR_FALSE; if (aMsg == WM_MOUSEHWHEEL) { // Logitech (Logicool) mouse driver (confirmed with 4.82.11 and MX-1100) @@ -7630,109 +7656,86 @@ PRBool nsWindow::HandleScrollingPlugins(UINT aMsg, WPARAM aWParam, } } - HWND destWnd = ::WindowFromPoint(point); - // Since we receive scroll events for as long as - // we are focused, it's entirely possible that there - // is another app's window or no window under the - // pointer. + HWND underCursorWnd = ::WindowFromPoint(point); + if (!underCursorWnd) { + return; + } - if (sUseElantechPinchHack && IsElantechHelperWindow(destWnd)) { + if (sUseElantechPinchHack && IsElantechHelperWindow(underCursorWnd)) { // The Elantech driver places a window right underneath the cursor // when sending a WM_MOUSEWHEEL event to us as part of a pinch-to-zoom // gesture. We detect that here, and search for our window that would // be beneath the cursor if that window wasn't there. - destWnd = FindOurWindowAtPoint(point); - } - - if (!destWnd) { - // No window is under the pointer - return PR_FALSE; // break, but continue processing - } - - nsWindow* destWindow; - - // We don't handle the message if the found window belongs to another - // process's top window. If it belongs window, that is a plug-in's window. - // Then, we need to send the message to the plug-in window. - if (!IsOurProcessWindow(destWnd)) { - HWND ourPluginWnd = FindOurProcessWindow(destWnd); - if (!ourPluginWnd) { - // Somebody elses window - return PR_FALSE; // break, but continue processing + underCursorWnd = FindOurWindowAtPoint(point); + if (!underCursorWnd) { + return; } - destWindow = GetNSWindowPtr(ourPluginWnd); - } else { - destWindow = GetNSWindowPtr(destWnd); } - if (destWindow == this && mWindowType == eWindowType_plugin) { - // If this is plug-in window, the message came from the plug-in window. - // Then, the message should be processed on the parent window. - destWindow = static_cast(GetParent()); - NS_ENSURE_TRUE(destWindow, PR_FALSE); // break, but continue processing - destWnd = destWindow->mWnd; - NS_ENSURE_TRUE(destWnd, PR_FALSE); // break, but continue processing - } - - if (!destWindow || destWindow->mWindowType == eWindowType_plugin) { - // Some other app, or a plugin window. - // Windows directs scrolling messages to the focused window. - // However, Mozilla does not like plugins having focus, so a - // Mozilla window (ie, the plugin's parent (us!) has focus.) - // Therefore, plugins etc _should_ get first grab at the - // message, but this focus vaguary means the plugin misses - // out. If the window is a child of ours, forward it on. - // Determine if a child by walking the parent list until - // we find a parent matching our wndproc. - HWND parentWnd = ::GetParent(destWnd); - while (parentWnd) { - nsWindow* parentWindow = GetNSWindowPtr(parentWnd); - if (parentWindow) { - // We have a child window - quite possibly a plugin window. - // However, not all plugins are created equal - some will handle this - // message themselves, some will forward directly back to us, while - // others will call DefWndProc, which itself still forwards back to us. - // So if we have sent it once, we need to handle it ourself. - - // XXX The message shouldn't come from the plugin window at here. - // But the message might come from it due to some bugs. If it happens, - // SendMessage causes deadlock. For safety, we should unlock the - // sender here. - ::ReplyMessage(aMsg == WM_MOUSEHWHEEL ? TRUE : 0); - - // First time we have seen this message. - // Call the child - either it will consume it, or - // it will wind it's way back to us,triggering the destWnd case above - // either way,when the call returns,we are all done with the message, - sIsProcessing = PR_TRUE; - ::SendMessageW(destWnd, aMsg, aWParam, aLParam); - sIsProcessing = PR_FALSE; - aHandled = PR_TRUE; - aQuitProcessing = PR_TRUE; - return PR_FALSE; // break, and stop processing + // Handle most cases first. If the window under mouse cursor is our window + // except plugin window (MozillaWindowClass), we should handle the message + // on the window. + if (IsOurProcessWindow(underCursorWnd)) { + nsWindow* destWindow = GetNSWindowPtr(underCursorWnd); + if (!destWindow) { + NS_WARNING("We're not sure what cause this is."); + HWND wnd = ::GetParent(underCursorWnd); + for (; wnd; wnd = ::GetParent(wnd)) { + destWindow = GetNSWindowPtr(wnd); + if (destWindow) { + break; + } + } + if (!wnd) { + return; } - parentWnd = ::GetParent(parentWnd); - } // while parentWnd - } - if (destWnd == nsnull) - return PR_FALSE; - if (destWnd != mWnd) { - if (destWindow) { - sIsProcessing = PR_TRUE; - aHandled = destWindow->ProcessMessage(aMsg, aWParam, aLParam, aRetValue); - sIsProcessing = PR_FALSE; - aQuitProcessing = PR_TRUE; - return PR_FALSE; // break, and stop processing } - #ifdef DEBUG - else - printf("WARNING: couldn't get child window for SCROLL event\n"); - #endif + + NS_ASSERTION(destWindow, "destWindow must not be NULL"); + // If the found window is our plugin window, it means that the message + // has been handled by the plugin but not consumed. We should handle the + // message on its parent window. + if (destWindow->mWindowType == eWindowType_plugin) { + destWindow = destWindow->GetParentWindow(PR_FALSE); + NS_ENSURE_TRUE(destWindow, ); + } + UINT internalMessage = GetInternalMessage(aMsg); + destWindow->ProcessMessage(internalMessage, aWParam, aLParam, aRetValue); + return; } - return PR_TRUE; // caller should handle this + + // If the window under cursor is not in our process, it means: + // 1. The window may be a plugin window (GeckoPluginWindow or its descendant). + // 2. The window may be another application's window. + HWND pluginWnd = FindOurProcessWindow(underCursorWnd); + if (!pluginWnd) { + // If there is no plugin window in ancestors of the window under cursor, + // the window is for another applications (case 2). + // We don't need to handle this message. + return; + } + + // If we're a plugin window (MozillaWindowClass) and cursor in this window, + // the message shouldn't go to plugin's wndproc again. So, we should handle + // it on parent window. + if (mWindowType == eWindowType_plugin && pluginWnd == mWnd) { + nsWindow* destWindow = GetParentWindow(PR_FALSE); + NS_ENSURE_TRUE(destWindow, ); + UINT internalMessage = GetInternalMessage(aMsg); + destWindow->ProcessMessage(internalMessage, aWParam, aLParam, aRetValue); + return; + } + + // If the window is a part of plugin, we should post the message to it. + ::PostMessage(underCursorWnd, aMsg, aWParam, aLParam); } -PRBool nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam) +/** + * OnScroll() is called when ProcessMessage() handles WM_VSCROLL or WM_HSCROLL. + * aMsg may be WM_VSCROLL or WM_HSCROLL. + */ +PRBool +nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam) { static PRInt8 sMouseWheelEmulation = -1; if (sMouseWheelEmulation < 0) { @@ -7744,43 +7747,10 @@ PRBool nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam) if (aLParam || sMouseWheelEmulation) { // Scroll message generated by Thinkpad Trackpoint Driver or similar // Treat as a mousewheel message and scroll appropriately - PRBool quit, result; LRESULT retVal; - - if (!HandleScrollingPlugins(aMsg, aWParam, aLParam, result, &retVal, quit)) - return quit; // Return if it's not our message or has been dispatched - - nsMouseScrollEvent scrollevent(PR_TRUE, NS_MOUSE_SCROLL, this); - scrollevent.scrollFlags = (aMsg == WM_VSCROLL) - ? nsMouseScrollEvent::kIsVertical - : nsMouseScrollEvent::kIsHorizontal; - switch (LOWORD(aWParam)) - { - case SB_PAGEDOWN: - scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage; - case SB_LINEDOWN: - scrollevent.delta = 1; - break; - case SB_PAGEUP: - scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage; - case SB_LINEUP: - scrollevent.delta = -1; - break; - default: - return PR_FALSE; - } - // The event may go to a plug-in which already dispatched this message. - // Then, the event can cause deadlock. We should unlock the sender here. - ::ReplyMessage(0); - scrollevent.isShift = IS_VK_DOWN(NS_VK_SHIFT); - scrollevent.isControl = IS_VK_DOWN(NS_VK_CONTROL); - scrollevent.isMeta = PR_FALSE; - scrollevent.isAlt = IS_VK_DOWN(NS_VK_ALT); - InitEvent(scrollevent); - if (nsnull != mEventCallback) - { - DispatchWindowEvent(&scrollevent); - } + OnMouseWheel(aMsg, aWParam, aLParam, &retVal); + // Always consume the scroll message if we try to emulate mouse wheel + // action. return PR_TRUE; } @@ -7818,10 +7788,49 @@ PRBool nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam) default: return PR_FALSE; } + // XXX If this is a plugin window, we should dispatch the event from + // parent window. DispatchWindowEvent(&command); return PR_TRUE; } +/** + * OnScrollInternal() is called when ProcessMessage() handles MOZ_WM_VSCROLL or + * MOZ_WM_HSCROLL but aMsg may be WM_VSCROLL or WM_HSCROLL. + * These internal messages used only when OnScroll() tries to emulate mouse + * wheel action for the WM_VSCROLL or WM_HSCROLL message. + */ +void +nsWindow::OnScrollInternal(UINT aMsg, WPARAM aWParam, LPARAM aLParam) +{ + nsMouseScrollEvent scrollevent(PR_TRUE, NS_MOUSE_SCROLL, this); + scrollevent.scrollFlags = (aMsg == WM_VSCROLL) + ? nsMouseScrollEvent::kIsVertical + : nsMouseScrollEvent::kIsHorizontal; + switch (LOWORD(aWParam)) { + case SB_PAGEDOWN: + scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage; + case SB_LINEDOWN: + scrollevent.delta = 1; + break; + case SB_PAGEUP: + scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage; + case SB_LINEUP: + scrollevent.delta = -1; + break; + default: + return; + } + scrollevent.isShift = IS_VK_DOWN(NS_VK_SHIFT); + scrollevent.isControl = IS_VK_DOWN(NS_VK_CONTROL); + scrollevent.isMeta = PR_FALSE; + scrollevent.isAlt = IS_VK_DOWN(NS_VK_ALT); + InitEvent(scrollevent); + if (mEventCallback) { + DispatchWindowEvent(&scrollevent); + } +} + // Can be overriden. Controls auto-erase of background. PRBool nsWindow::AutoErase(HDC dc) { @@ -8389,7 +8398,7 @@ LRESULT CALLBACK nsWindow::MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM l LRESULT CALLBACK nsWindow::MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam) { if (sProcessHook) { - switch (wParam) { + switch (GetNativeMessage(wParam)) { case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: @@ -8590,6 +8599,7 @@ nsWindow::DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLPara { if (sRollupListener && sRollupWidget && ::IsWindowVisible(inWnd)) { + inMsg = GetNativeMessage(inMsg); if (inMsg == WM_LBUTTONDOWN || inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN || inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL || inMsg == WM_ACTIVATE || (inMsg == WM_KILLFOCUS && IsDifferentThreadWindow((HWND)inWParam)) || diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index efb1f3331991..af48462412d5 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -375,11 +375,6 @@ protected: // Convert nsEventStatus value to a windows boolean static PRBool ConvertStatus(nsEventStatus aStatus); static void PostSleepWakeNotification(const char* aNotification); - PRBool HandleScrollingPlugins(UINT aMsg, WPARAM aWParam, - LPARAM aLParam, - PRBool& aResult, - LRESULT* aRetValue, - PRBool& aQuitProcessing); PRInt32 ClientMarginHitTestPoint(PRInt32 mx, PRInt32 my); static WORD GetScanCode(LPARAM aLParam) { @@ -417,7 +412,9 @@ protected: PRUint32 aFlags = 0, const MSG *aMsg = nsnull, PRBool *aEventDispatched = nsnull); - virtual PRBool OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam); + PRBool OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam); + void OnScrollInternal(UINT aMsg, WPARAM aWParam, + LPARAM aLParam); PRBool OnGesture(WPARAM wParam, LPARAM lParam); #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7 PRBool OnTouch(WPARAM wParam, LPARAM lParam); @@ -426,9 +423,13 @@ protected: BOOL OnInputLangChange(HKL aHKL); PRBool OnPaint(HDC aDC, PRUint32 aNestingLevel); void OnWindowPosChanged(WINDOWPOS *wp, PRBool& aResult); - PRBool OnMouseWheel(UINT aMessage, WPARAM aWParam, - LPARAM aLParam, PRBool& aHandled, - LRESULT *aRetValue); + static UINT GetInternalMessage(UINT aNativeMessage); + static UINT GetNativeMessage(UINT aInternalMessage); + void OnMouseWheel(UINT aMsg, WPARAM aWParam, + LPARAM aLParam, LRESULT *aRetValue); + void OnMouseWheelInternal(UINT aMessage, WPARAM aWParam, + LPARAM aLParam, + LRESULT *aRetValue); void OnWindowPosChanging(LPWINDOWPOS& info); /** diff --git a/widget/src/windows/nsWindowDefs.h b/widget/src/windows/nsWindowDefs.h index dfb593909c5c..28b32e1365b1 100644 --- a/widget/src/windows/nsWindowDefs.h +++ b/widget/src/windows/nsWindowDefs.h @@ -58,6 +58,12 @@ #define MOZ_WM_APP_QUIT (WM_APP+0x0300) // Used as a "tracer" event to probe event loop latency. #define MOZ_WM_TRACE (WM_APP+0x0301) +// Our internal message for WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL and +// WM_HSCROLL +#define MOZ_WM_MOUSEVWHEEL (WM_APP+0x0310) +#define MOZ_WM_MOUSEHWHEEL (WM_APP+0x0311) +#define MOZ_WM_VSCROLL (WM_APP+0x0312) +#define MOZ_WM_HSCROLL (WM_APP+0x0313) // GetWindowsVersion constants #define WIN2K_VERSION 0x500