diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
commit | fc61780b35af913801d72086456f493f63197da6 (patch) | |
tree | f85891288a7bd988da9f0f15ae64e5c63f00d493 /widget | |
parent | 69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff) | |
parent | 50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff) | |
download | UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.gz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.lz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.xz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.zip |
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts:
# browser/app/profile/firefox.js
# browser/components/preferences/jar.mn
Diffstat (limited to 'widget')
-rw-r--r-- | widget/BasicEvents.h | 12 | ||||
-rw-r--r-- | widget/GfxInfoBase.cpp | 18 | ||||
-rw-r--r-- | widget/GfxInfoBase.h | 1 | ||||
-rw-r--r-- | widget/GfxInfoX11.cpp | 8 | ||||
-rw-r--r-- | widget/LookAndFeel.h | 14 | ||||
-rw-r--r-- | widget/WidgetEventImpl.cpp | 34 | ||||
-rw-r--r-- | widget/android/GfxInfo.cpp | 4 | ||||
-rw-r--r-- | widget/cocoa/GfxInfo.mm | 4 | ||||
-rw-r--r-- | widget/cocoa/nsLookAndFeel.mm | 31 | ||||
-rw-r--r-- | widget/gtk/nsClipboard.cpp | 3 | ||||
-rw-r--r-- | widget/gtk/nsLookAndFeel.cpp | 35 | ||||
-rw-r--r-- | widget/uikit/GfxInfo.cpp | 4 | ||||
-rw-r--r-- | widget/windows/GfxInfo.cpp | 4 | ||||
-rw-r--r-- | widget/windows/nsLookAndFeel.cpp | 1 |
14 files changed, 135 insertions, 38 deletions
diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h index a6228f179..960cb67c6 100644 --- a/widget/BasicEvents.h +++ b/widget/BasicEvents.h @@ -161,6 +161,9 @@ public: } inline void PreventDefault(bool aCalledByDefaultHandler = true) { + if (!mCancelable) { + return; + } mDefaultPrevented = true; // Note that even if preventDefault() has already been called by chrome, // a call of preventDefault() by content needs to overwrite @@ -175,6 +178,9 @@ public: // This should be used only before dispatching events into the DOM tree. inline void PreventDefaultBeforeDispatch() { + if (!mCancelable) { + return; + } mDefaultPrevented = true; } inline bool DefaultPrevented() const @@ -407,10 +413,16 @@ public: nsString mSpecifiedEventTypeString; // Event targets, needed by DOM Events + // Note that when you need event target for DOM event, you should use + // Get*DOMEventTarget() instead of accessing these members directly. nsCOMPtr<dom::EventTarget> mTarget; nsCOMPtr<dom::EventTarget> mCurrentTarget; nsCOMPtr<dom::EventTarget> mOriginalTarget; + dom::EventTarget* GetDOMEventTarget() const; + dom::EventTarget* GetCurrentDOMEventTarget() const; + dom::EventTarget* GetOriginalDOMEventTarget() const; + void AssignEventData(const WidgetEvent& aEvent, bool aCopyTargets) { // mClass should be initialized with the constructor. diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp index c937f5099..e20de8277 100644 --- a/widget/GfxInfoBase.cpp +++ b/widget/GfxInfoBase.cpp @@ -43,6 +43,7 @@ using mozilla::MutexAutoLock; nsTArray<GfxDriverInfo>* GfxInfoBase::mDriverInfo; bool GfxInfoBase::mDriverInfoObserverInitialized; +bool GfxInfoBase::mShutdownOccurred; // Observes for shutdown so that the child GfxDriverInfo list is freed. class ShutdownObserver : public nsIObserver @@ -62,11 +63,17 @@ public: delete GfxInfoBase::mDriverInfo; GfxInfoBase::mDriverInfo = nullptr; - for (uint32_t i = 0; i < DeviceFamilyMax; i++) + for (uint32_t i = 0; i < DeviceFamilyMax; i++) { delete GfxDriverInfo::mDeviceFamilies[i]; + GfxDriverInfo::mDeviceFamilies[i] = nullptr; + } - for (uint32_t i = 0; i < DeviceVendorMax; i++) + for (uint32_t i = 0; i < DeviceVendorMax; i++) { delete GfxDriverInfo::mDeviceVendors[i]; + GfxDriverInfo::mDeviceVendors[i] = nullptr; + } + + GfxInfoBase::mShutdownOccurred = true; return NS_OK; } @@ -849,6 +856,13 @@ GfxInfoBase::GetFeatureStatusImpl(int32_t aFeature, return NS_OK; } + if (mShutdownOccurred) { + // This is futile; we've already commenced shutdown and our blocklists have + // been deleted. We may want to look into resurrecting the blocklist instead + // but for now, just don't even go there. + return NS_OK; + } + // If an operating system was provided by the derived GetFeatureStatusImpl, // grab it here. Otherwise, the OS is unknown. OperatingSystem os = (aOS ? *aOS : OperatingSystem::Unknown); diff --git a/widget/GfxInfoBase.h b/widget/GfxInfoBase.h index 6d30f1b71..5bc23f762 100644 --- a/widget/GfxInfoBase.h +++ b/widget/GfxInfoBase.h @@ -77,6 +77,7 @@ public: static nsTArray<GfxDriverInfo>* mDriverInfo; static bool mDriverInfoObserverInitialized; + static bool mShutdownOccurred; virtual nsString Model() { return EmptyString(); } virtual nsString Hardware() { return EmptyString(); } diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index 48fc3dbb5..338dcac67 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -268,8 +268,6 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, OperatingSystem* aOS /* = nullptr */) { - GetData(); - NS_ENSURE_ARG_POINTER(aStatus); *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; aSuggestedDriverVersion.SetIsVoid(true); @@ -277,6 +275,12 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = os; + if (mShutdownOccurred) { + return NS_OK; + } + + GetData(); + if (mGLMajorVersion == 1) { // We're on OpenGL 1. In most cases that indicates really old hardware. // We better block them, rather than rely on them to fail gracefully, because they don't! diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h index cf84b3308..60ebc2782 100644 --- a/widget/LookAndFeel.h +++ b/widget/LookAndFeel.h @@ -250,7 +250,7 @@ public: * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric. */ eIntID_WindowsAccentColorApplies, - + /* * A Boolean value to determine whether the Windows accent color * is considered dark and should get bright text/controls. @@ -313,6 +313,16 @@ public: */ eIntID_MacGraphiteTheme, + /* + * A Boolean value to determine whether the Mac OS X Lion-specific theming + * should be used. + * + * The value of this metric is not used on non-Mac platforms. These + * platforms should return NS_ERROR_NOT_IMPLEMENTED when queried for this + * metric. + */ + eIntID_MacLionTheme, + /* * A Boolean value to determine whether the Mac OS X Yosemite-specific theming * should be used. @@ -412,7 +422,7 @@ public: */ eIntID_ScrollbarFadeBeginDelay, eIntID_ScrollbarFadeDuration, - + /** * Distance in pixels to offset the context menu from the cursor * on open. diff --git a/widget/WidgetEventImpl.cpp b/widget/WidgetEventImpl.cpp index 7dd292cb0..59c80672b 100644 --- a/widget/WidgetEventImpl.cpp +++ b/widget/WidgetEventImpl.cpp @@ -12,6 +12,7 @@ #include "mozilla/Preferences.h" #include "mozilla/TextEvents.h" #include "mozilla/TouchEvents.h" +#include "nsIDOMEventTarget.h" #include "nsPrintfCString.h" namespace mozilla { @@ -411,6 +412,39 @@ WidgetEvent::IsAllowedToDispatchDOMEvent() const } /****************************************************************************** + * mozilla::WidgetEvent + * + * Misc methods. + ******************************************************************************/ + +static dom::EventTarget* +GetTargetForDOMEvent(nsIDOMEventTarget* aTarget) +{ + return aTarget ? aTarget->GetTargetForDOMEvent() : nullptr; +} + +dom::EventTarget* +WidgetEvent::GetDOMEventTarget() const +{ + return GetTargetForDOMEvent(mTarget); +} + +dom::EventTarget* +WidgetEvent::GetCurrentDOMEventTarget() const +{ + return GetTargetForDOMEvent(mCurrentTarget); +} + +dom::EventTarget* +WidgetEvent::GetOriginalDOMEventTarget() const +{ + if (mOriginalTarget) { + return GetTargetForDOMEvent(mOriginalTarget); + } + return GetDOMEventTarget(); +} + +/****************************************************************************** * mozilla::WidgetInputEvent ******************************************************************************/ diff --git a/widget/android/GfxInfo.cpp b/widget/android/GfxInfo.cpp index 181629e96..d92cdb526 100644 --- a/widget/android/GfxInfo.cpp +++ b/widget/android/GfxInfo.cpp @@ -377,6 +377,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = os; + if (mShutdownOccurred) { + return NS_OK; + } + // OpenGL layers are never blacklisted on Android. // This early return is so we avoid potentially slow // GLStrings initialization on startup when we initialize GL layers. diff --git a/widget/cocoa/GfxInfo.mm b/widget/cocoa/GfxInfo.mm index 74333c514..85c469286 100644 --- a/widget/cocoa/GfxInfo.mm +++ b/widget/cocoa/GfxInfo.mm @@ -308,6 +308,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = os; + if (mShutdownOccurred) { + return NS_OK; + } + // Don't evaluate special cases when we're evaluating the downloaded blocklist. if (!aDriverInfo.Length()) { if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) { diff --git a/widget/cocoa/nsLookAndFeel.mm b/widget/cocoa/nsLookAndFeel.mm index cbee90f58..0b68cd0e4 100644 --- a/widget/cocoa/nsLookAndFeel.mm +++ b/widget/cocoa/nsLookAndFeel.mm @@ -67,19 +67,19 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; nsresult res = NS_OK; - + switch (aID) { case eColorID_WindowBackground: aColor = NS_RGB(0xff,0xff,0xff); break; case eColorID_WindowForeground: - aColor = NS_RGB(0x00,0x00,0x00); + aColor = NS_RGB(0x00,0x00,0x00); break; case eColorID_WidgetBackground: aColor = NS_RGB(0xdd,0xdd,0xdd); break; case eColorID_WidgetForeground: - aColor = NS_RGB(0x00,0x00,0x00); + aColor = NS_RGB(0x00,0x00,0x00); break; case eColorID_WidgetSelectBackground: aColor = NS_RGB(0x80,0x80,0x80); @@ -107,7 +107,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) break; case eColorID__moz_menuhover: aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]); - break; + break; case eColorID_TextSelectForeground: GetColor(eColorID_TextSelectBackground, aColor); if (aColor == 0x000000) @@ -147,9 +147,9 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) // css2 system colors http://www.w3.org/TR/REC-CSS2/ui.html#system-colors // // It's really hard to effectively map these to the Appearance Manager properly, - // since they are modeled word for word after the win32 system colors and don't have any - // real counterparts in the Mac world. I'm sure we'll be tweaking these for - // years to come. + // since they are modeled word for word after the win32 system colors and don't have any + // real counterparts in the Mac world. I'm sure we'll be tweaking these for + // years to come. // // Thanks to mpt26@student.canterbury.ac.nz for the hardcoded values that form the defaults // if querying the Appearance Manager fails ;) @@ -161,7 +161,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) break; } // Otherwise fall through and return the regular button text: - + case eColorID_buttontext: case eColorID__moz_buttonhovertext: aColor = GetColorFromNSColor([NSColor controlTextColor]); @@ -267,13 +267,13 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) break; case eColorID__moz_mac_menushadow: aColor = NS_RGB(0xA3,0xA3,0xA3); - break; + break; case eColorID__moz_mac_menutextdisable: aColor = NS_RGB(0x98,0x98,0x98); - break; + break; case eColorID__moz_mac_menutextselect: aColor = GetColorFromNSColor([NSColor selectedMenuItemTextColor]); - break; + break; case eColorID__moz_mac_disabledtoolbartext: aColor = GetColorFromNSColor([NSColor disabledControlTextColor]); break; @@ -307,7 +307,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) res = NS_ERROR_FAILURE; break; } - + return res; NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; @@ -322,7 +322,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) if (NS_SUCCEEDED(res)) return res; res = NS_OK; - + switch (aID) { case eIntID_CaretBlinkTime: aResult = 567; @@ -411,6 +411,9 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) case eIntID_MacGraphiteTheme: aResult = [NSColor currentControlTint] == NSGraphiteControlTint; break; + case eIntID_MacLionTheme: + aResult = 1; + break; case eIntID_MacYosemiteTheme: aResult = nsCocoaFeatures::OnYosemiteOrLater(); break; @@ -473,7 +476,7 @@ nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult) if (NS_SUCCEEDED(res)) return res; res = NS_OK; - + switch (aID) { case eFloatID_IMEUnderlineRelativeSize: aResult = 2.0f; diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp index 053ae970e..eecae3e88 100644 --- a/widget/gtk/nsClipboard.cpp +++ b/widget/gtk/nsClipboard.cpp @@ -214,7 +214,8 @@ nsClipboard::SetData(nsITransferable *aTransferable, GtkTargetEntry *gtkTargets = gtk_target_table_new_from_list(list, &numTargets); // Set getcallback and request to store data after an application exit - if (gtk_clipboard_set_with_data(gtkClipboard, gtkTargets, numTargets, + if (gtkTargets && + gtk_clipboard_set_with_data(gtkClipboard, gtkTargets, numTargets, clipboard_get_cb, clipboard_clear_cb, this)) { // We managed to set-up the clipboard so update internal state diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp index d2b82e495..7a95f81c6 100644 --- a/widget/gtk/nsLookAndFeel.cpp +++ b/widget/gtk/nsLookAndFeel.cpp @@ -51,7 +51,7 @@ nsLookAndFeel::nsLookAndFeel() mDefaultFontCached(false), mButtonFontCached(false), mFieldFontCached(false), mMenuFontCached(false) { - Init(); + Init(); } nsLookAndFeel::~nsLookAndFeel() @@ -266,7 +266,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) break; case eColorID_WindowForeground: case eColorID_WidgetForeground: - case eColorID_TextForeground: + case eColorID_TextForeground: case eColorID_captiontext: // text in active window caption, size box, and scrollbar arrow box (!) case eColorID_windowtext: case eColorID__moz_dialogtext: @@ -303,7 +303,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) // not used? aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]); break; - case eColorID_TextForeground: + case eColorID_TextForeground: // not used? aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_NORMAL]); break; @@ -415,7 +415,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) // inactive window caption GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW); gtk_style_context_get_background_color(style, - GTK_STATE_FLAG_INSENSITIVE, + GTK_STATE_FLAG_INSENSITIVE, &gdk_color); aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); ReleaseStyleContext(style); @@ -509,7 +509,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) break; case eColorID__moz_dragtargetzone: aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_SELECTED]); - break; + break; case eColorID__moz_buttondefault: // default button border color aColor = GDK_COLOR_TO_NS_RGB(mStyle->black); @@ -552,8 +552,8 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) } case eColorID__moz_buttonhoverface: { GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_BUTTON); - gtk_style_context_get_background_color(style, - GTK_STATE_FLAG_PRELIGHT, + gtk_style_context_get_background_color(style, + GTK_STATE_FLAG_PRELIGHT, &gdk_color); aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); ReleaseStyleContext(style); @@ -637,7 +637,7 @@ static int32_t ConvertGTKStepperStyleToMozillaScrollArrowStyle(GtkWidget* aWidge { if (!aWidget) return mozilla::LookAndFeel::eScrollArrowStyle_Single; - + return CheckWidgetStyle(aWidget, "has-backward-stepper", mozilla::LookAndFeel::eScrollArrow_StartBackward) | @@ -654,7 +654,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) { nsresult res = NS_OK; - // Set these before they can get overrided in the nsXPLookAndFeel. + // Set these before they can get overrided in the nsXPLookAndFeel. switch (aID) { case eIntID_ScrollButtonLeftMouseButtonAction: aResult = 0; @@ -686,7 +686,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) "gtk-cursor-blink-time", &blink_time, "gtk-cursor-blink", &blink, nullptr); - + if (blink) aResult = (int32_t) blink_time; else @@ -708,11 +708,11 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) entry = gtk_entry_new(); g_object_ref_sink(entry); settings = gtk_widget_get_settings(entry); - g_object_get(settings, + g_object_get(settings, "gtk-entry-select-on-focus", &select_on_focus, nullptr); - + if(select_on_focus) aResult = 1; else @@ -773,7 +773,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) "gtk-dnd-drag-threshold", &threshold, nullptr); g_object_ref_sink(box); - + aResult = threshold; } break; @@ -818,6 +818,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) #endif break; case eIntID_MacGraphiteTheme: + case eIntID_MacLionTheme: aResult = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; @@ -1082,7 +1083,7 @@ nsLookAndFeel::Init() gtk_widget_destroy(widget); g_object_unref(widget); - + // tooltip foreground and background GtkStyle *style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", @@ -1116,7 +1117,7 @@ nsLookAndFeel::Init() if (style) { sMenuBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]); } - + style = gtk_widget_get_style(menuitem); if (style) { sMenuHover = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_PRELIGHT]); @@ -1225,7 +1226,7 @@ nsLookAndFeel::Init() gtk_container_add(GTK_CONTAINER(window), parent); gtk_container_add(GTK_CONTAINER(parent), entry); gtk_container_add(GTK_CONTAINER(parent), textView); - + #if (MOZ_WIDGET_GTK == 2) gtk_widget_set_style(button, nullptr); gtk_widget_set_style(label, nullptr); @@ -1348,7 +1349,7 @@ nsLookAndFeel::Init() sComboBoxText = GDK_RGBA_TO_NS_RGBA(color); ReleaseStyleContext(style); - // Menubar text and hover text colors + // Menubar text and hover text colors style = ClaimStyleContext(MOZ_GTK_MENUBARITEM); gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); sMenuBarText = GDK_RGBA_TO_NS_RGBA(color); diff --git a/widget/uikit/GfxInfo.cpp b/widget/uikit/GfxInfo.cpp index 2aea3b5ea..cabe993dd 100644 --- a/widget/uikit/GfxInfo.cpp +++ b/widget/uikit/GfxInfo.cpp @@ -175,6 +175,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = OperatingSystem::Ios; + if (mShutdownOccurred) { + return NS_OK; + } + // OpenGL layers are never blacklisted on iOS. // This early return is so we avoid potentially slow // GLStrings initialization on startup when we initialize GL layers. diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index 8a429ad32..c62f5873e 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -1101,6 +1101,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = os; + if (mShutdownOccurred) { + return NS_OK; + } + // Don't evaluate special cases if we're checking the downloaded blocklist. if (!aDriverInfo.Length()) { nsAutoString adapterVendorID; diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp index 06eee3771..97f81abfd 100644 --- a/widget/windows/nsLookAndFeel.cpp +++ b/widget/windows/nsLookAndFeel.cpp @@ -423,6 +423,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) } case eIntID_MacGraphiteTheme: + case eIntID_MacLionTheme: aResult = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; |