author | Carsten "Tomcat" Book <cbook@mozilla.com> |
Thu, 21 Jul 2016 13:59:02 +0200 | |
changeset 306086 | 34fab997a0a18bc72da09d0811ff98357fe0eb5f |
parent 306085 | 8798ff34e0701f7d7631483cf2509944182968a8 |
child 306087 | 6b180266ac16e3226be33319ff710ddfa85f5836 |
child 306164 | b83fcff9edd2e930eaf518d0a337eb53b75ec9f1 |
push id | 30474 |
push user | cbook@mozilla.com |
push date | Thu, 21 Jul 2016 14:25:10 +0000 |
treeherder | mozilla-central@6b180266ac16 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1265386 |
milestone | 50.0a1 |
backs out | 2bea1e1e403d0a000e0c3de7a565638f6bdefe10 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/widget/android/nsDeviceContextAndroid.cpp +++ b/widget/android/nsDeviceContextAndroid.cpp @@ -58,27 +58,27 @@ nsDeviceContextSpecAndroid::BeginDocumen } NS_IMETHODIMP nsDeviceContextSpecAndroid::EndDocument() { nsXPIDLString targetPath; nsCOMPtr<nsIFile> destFile; mPrintSettings->GetToFileName(getter_Copies(targetPath)); - + nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(targetPath), false, getter_AddRefs(destFile)); NS_ENSURE_SUCCESS(rv, rv); - + nsAutoString destLeafName; rv = destFile->GetLeafName(destLeafName); NS_ENSURE_SUCCESS(rv, rv); - + nsCOMPtr<nsIFile> destDir; rv = destFile->GetParent(getter_AddRefs(destDir)); NS_ENSURE_SUCCESS(rv, rv); - + rv = mTempFile->MoveTo(destDir, destLeafName); NS_ENSURE_SUCCESS(rv, rv); - + destFile->SetPermissions(0666); return NS_OK; }
--- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -417,17 +417,17 @@ public: double aDeltaX, double aDeltaY, double aDeltaZ, uint32_t aModifierFlags, uint32_t aAdditionalFlags, nsIObserver* aObserver) override; // Mac specific methods - + virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent& event); void WillPaintWindow(); bool PaintWindow(LayoutDeviceIntRegion aRegion); bool PaintWindowInContext(CGContextRef aContext, const LayoutDeviceIntRegion& aRegion, mozilla::gfx::IntSize aSurfaceSize); #ifdef ACCESSIBILITY @@ -570,17 +570,17 @@ protected: NSView<mozView>* mView; // my parallel cocoa view (ChildView or NativeScrollbarView), [STRONG] RefPtr<mozilla::widget::TextInputHandler> mTextInputHandler; InputContext mInputContext; NSView<mozView>* mParentView; nsIWidget* mParentWidget; #ifdef ACCESSIBILITY - // weak ref to this childview's associated mozAccessible for speed reasons + // weak ref to this childview's associated mozAccessible for speed reasons // (we get queried for it *a lot* but don't want to own it) nsWeakPtr mAccessible; #endif // Protects the view from being teared down while a composition is in // progress on the compositor thread. mozilla::Mutex mViewTearDownLock;
--- a/widget/cocoa/nsCocoaWindow.h +++ b/widget/cocoa/nsCocoaWindow.h @@ -167,17 +167,17 @@ typedef struct _nsCocoaWindowList { - (nsCocoaWindow*)geckoWidget; - (bool)toplevelActiveState; - (void)sendToplevelActivateEvents; - (void)sendToplevelDeactivateEvents; @end @class ToolbarWindow; -// NSColor subclass that allows us to draw separate colors both in the titlebar +// NSColor subclass that allows us to draw separate colors both in the titlebar // and for background of the window. @interface TitlebarAndBackgroundColor : NSColor { ToolbarWindow *mWindow; // [WEAK] (we are owned by the window) } - (id)initWithWindow:(ToolbarWindow*)aWindow;
--- a/widget/cocoa/nsMenuBarX.mm +++ b/widget/cocoa/nsMenuBarX.mm @@ -122,30 +122,30 @@ nsresult nsMenuBarX::Create(nsIWidget* a static_cast<nsCocoaWindow*>(mParentWindow)->SetMenuBar(this); return NS_OK; } void nsMenuBarX::ConstructNativeMenus() { uint32_t count = mContent->GetChildCount(); - for (uint32_t i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { nsIContent *menuContent = mContent->GetChildAt(i); if (menuContent && menuContent->IsXULElement(nsGkAtoms::menu)) { nsMenuX* newMenu = new nsMenuX(); if (newMenu) { nsresult rv = newMenu->Create(this, this, menuContent); if (NS_SUCCEEDED(rv)) InsertMenuAtIndex(newMenu, GetMenuCount()); else delete newMenu; } } - } + } } void nsMenuBarX::ConstructFallbackNativeMenus() { if (sApplicationMenu) { // Menu has already been built. return; } @@ -265,17 +265,17 @@ void nsMenuBarX::RemoveMenuAtIndex(uint3 void nsMenuBarX::ObserveAttributeChanged(nsIDocument* aDocument, nsIContent* aContent, nsIAtom* aAttribute) { } void nsMenuBarX::ObserveContentRemoved(nsIDocument* aDocument, - nsIContent* aChild, + nsIContent* aChild, int32_t aIndexInContainer) { RemoveMenuAtIndex(aIndexInContainer); } void nsMenuBarX::ObserveContentInserted(nsIDocument* aDocument, nsIContent* aContainer, nsIContent* aChild) @@ -473,17 +473,17 @@ void nsMenuBarX::ResetNativeApplicationM } // Hide the item in the menu by setting the 'hidden' attribute. Returns it in |outHiddenNode| so // the caller can hang onto it if they so choose. It is acceptable to pass nsull // for |outHiddenNode| if the caller doesn't care about the hidden node. void nsMenuBarX::HideItem(nsIDOMDocument* inDoc, const nsAString & inID, nsIContent** outHiddenNode) { nsCOMPtr<nsIDOMElement> menuItem; - inDoc->GetElementById(inID, getter_AddRefs(menuItem)); + inDoc->GetElementById(inID, getter_AddRefs(menuItem)); nsCOMPtr<nsIContent> menuContent(do_QueryInterface(menuItem)); if (menuContent) { menuContent->SetAttr(kNameSpaceID_None, nsGkAtoms::hidden, NS_LITERAL_STRING("true"), false); if (outHiddenNode) { *outHiddenNode = menuContent.get(); NS_IF_ADDREF(*outHiddenNode); } } @@ -500,17 +500,17 @@ void nsMenuBarX::AquifyMenuBar() if (!sAboutItemContent) sAboutItemContent = mAboutItemContent; // remove quit item and its separator HideItem(domDoc, NS_LITERAL_STRING("menu_FileQuitSeparator"), nullptr); HideItem(domDoc, NS_LITERAL_STRING("menu_FileQuitItem"), getter_AddRefs(mQuitItemContent)); if (!sQuitItemContent) sQuitItemContent = mQuitItemContent; - + // remove prefs item and its separator, but save off the pref content node // so we can invoke its command later. HideItem(domDoc, NS_LITERAL_STRING("menu_PrefsSeparator"), nullptr); HideItem(domDoc, NS_LITERAL_STRING("menu_preferences"), getter_AddRefs(mPrefItemContent)); if (!sPrefItemContent) sPrefItemContent = mPrefItemContent; // hide items that we use for the Application menu @@ -581,17 +581,17 @@ NSMenuItem* nsMenuBarX::CreateNativeAppM if (!labelString) labelString = @""; if (!keyEquiv) keyEquiv = @""; // put together the actual NSMenuItem NSMenuItem* newMenuItem = [[NSMenuItem alloc] initWithTitle:labelString action:action keyEquivalent:keyEquiv]; - + [newMenuItem setTag:tag]; [newMenuItem setTarget:target]; [newMenuItem setKeyEquivalentModifierMask:macKeyModifiers]; MenuItemInfo * info = [[MenuItemInfo alloc] initWithMenuGroupOwner:this]; [newMenuItem setRepresentedObject:info]; [info release]; @@ -604,46 +604,46 @@ NSMenuItem* nsMenuBarX::CreateNativeAppM nsresult nsMenuBarX::CreateApplicationMenu(nsMenuX* inMenu) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; // At this point, the application menu is the application menu from // the nib in cocoa widgets. We do not have a way to create an application // menu manually, so we grab the one from the nib and use that. sApplicationMenu = [[[[NSApp mainMenu] itemAtIndex:0] submenu] retain]; - + /* We support the following menu items here: Menu Item DOM Node ID Notes - + ======================== = About This App = <- aboutName ======================== = Preferences... = <- menu_preferences ======================== = Services > = <- menu_mac_services <- (do not define key equivalent) - ======================== + ======================== = Hide App = <- menu_mac_hide_app = Hide Others = <- menu_mac_hide_others = Show All = <- menu_mac_show_all - ======================== + ======================== = Quit = <- menu_FileQuitItem - ======================== - + ======================== + If any of them are ommitted from the application's DOM, we just don't add them. We always add a "Quit" item, but if an app developer does not provide a DOM node with the right ID for the Quit item, we add it in English. App developers need only add each node with a label and a key equivalent (if they want one). Other attributes are optional. Like so: - + <menuitem id="menu_preferences" label="&preferencesCmdMac.label;" key="open_prefs_key"/> - + We need to use this system for localization purposes, until we have a better way to define the Application menu to be used on Mac OS X. */ if (sApplicationMenu) { // This code reads attributes we are going to care about from the DOM elements NSMenuItem *itemBeingAdded = nil; @@ -676,68 +676,68 @@ nsresult nsMenuBarX::CreateApplicationMe [sApplicationMenu addItem:[NSMenuItem separatorItem]]; } // Add Services menu item itemBeingAdded = CreateNativeAppMenuItem(inMenu, NS_LITERAL_STRING("menu_mac_services"), nil, 0, nil); if (itemBeingAdded) { [sApplicationMenu addItem:itemBeingAdded]; - + // set this menu item up as the Mac OS X Services menu NSMenu* servicesMenu = [[GeckoServicesNSMenu alloc] initWithTitle:@""]; [itemBeingAdded setSubmenu:servicesMenu]; [NSApp setServicesMenu:servicesMenu]; - + [itemBeingAdded release]; itemBeingAdded = nil; - + // Add separator after Services menu - [sApplicationMenu addItem:[NSMenuItem separatorItem]]; + [sApplicationMenu addItem:[NSMenuItem separatorItem]]; } - + BOOL addHideShowSeparator = FALSE; - + // Add menu item to hide this application itemBeingAdded = CreateNativeAppMenuItem(inMenu, NS_LITERAL_STRING("menu_mac_hide_app"), @selector(menuItemHit:), eCommand_ID_HideApp, nsMenuBarX::sNativeEventTarget); if (itemBeingAdded) { [sApplicationMenu addItem:itemBeingAdded]; [itemBeingAdded release]; itemBeingAdded = nil; - + addHideShowSeparator = TRUE; } - + // Add menu item to hide other applications itemBeingAdded = CreateNativeAppMenuItem(inMenu, NS_LITERAL_STRING("menu_mac_hide_others"), @selector(menuItemHit:), eCommand_ID_HideOthers, nsMenuBarX::sNativeEventTarget); if (itemBeingAdded) { [sApplicationMenu addItem:itemBeingAdded]; [itemBeingAdded release]; itemBeingAdded = nil; - + addHideShowSeparator = TRUE; } - + // Add menu item to show all applications itemBeingAdded = CreateNativeAppMenuItem(inMenu, NS_LITERAL_STRING("menu_mac_show_all"), @selector(menuItemHit:), eCommand_ID_ShowAll, nsMenuBarX::sNativeEventTarget); if (itemBeingAdded) { [sApplicationMenu addItem:itemBeingAdded]; [itemBeingAdded release]; itemBeingAdded = nil; - + addHideShowSeparator = TRUE; } - + // Add a separator after the hide/show menus if at least one exists if (addHideShowSeparator) [sApplicationMenu addItem:[NSMenuItem separatorItem]]; - + // Add quit menu item itemBeingAdded = CreateNativeAppMenuItem(inMenu, NS_LITERAL_STRING("menu_FileQuitItem"), @selector(menuItemHit:), eCommand_ID_Quit, nsMenuBarX::sNativeEventTarget); if (itemBeingAdded) { [sApplicationMenu addItem:itemBeingAdded]; [itemBeingAdded release]; itemBeingAdded = nil; } @@ -746,17 +746,17 @@ nsresult nsMenuBarX::CreateApplicationMe // anyway, in English. NSMenuItem* defaultQuitItem = [[[NSMenuItem alloc] initWithTitle:@"Quit" action:@selector(menuItemHit:) keyEquivalent:@"q"] autorelease]; [defaultQuitItem setTarget:nsMenuBarX::sNativeEventTarget]; [defaultQuitItem setTag:eCommand_ID_Quit]; [sApplicationMenu addItem:defaultQuitItem]; } } - + return (sApplicationMenu) ? NS_OK : NS_ERROR_FAILURE; NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; } void nsMenuBarX::SetParent(nsIWidget* aParent) { mParentWindow = aParent;
--- a/widget/cocoa/nsMenuItemX.mm +++ b/widget/cocoa/nsMenuItemX.mm @@ -120,22 +120,22 @@ nsresult nsMenuItemX::Create(nsMenuX* aP NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; } nsresult nsMenuItemX::SetChecked(bool aIsChecked) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; mIsChecked = aIsChecked; - + // update the content model. This will also handle unchecking our siblings // if we are a radiomenu - mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::checked, + mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::checked, mIsChecked ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"), true); - + // update native menu item if (mIsChecked) [mNativeMenuItem setState:NSOnState]; else [mNativeMenuItem setState:NSOffState]; return NS_OK; @@ -212,24 +212,24 @@ void nsMenuItemX::UncheckRadioSiblings(n nsCOMPtr<nsIContent> parent = inCheckedContent->GetParent(); if (!parent) return; // loop over siblings uint32_t count = parent->GetChildCount(); for (uint32_t i = 0; i < count; i++) { nsIContent *sibling = parent->GetChildAt(i); - if (sibling) { + if (sibling) { if (sibling != inCheckedContent) { // skip this node // if the current sibling is in the same group, clear it if (sibling->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, myGroupName, eCaseMatters)) sibling->SetAttr(kNameSpaceID_None, nsGkAtoms::checked, NS_LITERAL_STRING("false"), true); } - } + } } } void nsMenuItemX::SetKeyEquiv() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; // Set key shortcut and modifiers @@ -284,17 +284,17 @@ void nsMenuItemX::SetKeyEquiv() void nsMenuItemX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aContent, nsIAtom *aAttribute) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; if (!aContent) return; - + if (aContent == mContent) { // our own content node changed if (aAttribute == nsGkAtoms::checked) { // if we're a radio menu, uncheck our sibling radio items. No need to // do any of this if we're just a normal check menu. if (mType == eRadioMenuItemType) { if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked, nsGkAtoms::_true, eCaseMatters)) UncheckRadioSiblings(mContent); @@ -325,17 +325,17 @@ nsMenuItemX::ObserveAttributeChanged(nsI if (aAttribute == nsGkAtoms::disabled) { // first we sync our menu item DOM node with the command DOM node nsAutoString commandDisabled; nsAutoString menuDisabled; aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandDisabled); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::disabled, menuDisabled); if (!commandDisabled.Equals(menuDisabled)) { // The menu's disabled state needs to be updated to match the command. - if (commandDisabled.IsEmpty()) + if (commandDisabled.IsEmpty()) mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::disabled, true); else mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandDisabled, true); } // now we sync our native menu item with the command DOM node if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled, nsGkAtoms::_true, eCaseMatters)) [mNativeMenuItem setEnabled:NO]; else
--- a/widget/cocoa/nsMenuX.h +++ b/widget/cocoa/nsMenuX.h @@ -70,17 +70,17 @@ protected: nsresult RemoveAll(); nsresult SetEnabled(bool aIsEnabled); nsresult GetEnabled(bool* aIsEnabled); void GetMenuPopupContent(nsIContent** aResult); bool OnOpen(); bool OnClose(); nsresult AddMenuItem(nsMenuItemX* aMenuItem); nsMenuX* AddMenu(mozilla::UniquePtr<nsMenuX> aMenu); - void LoadMenuItem(nsIContent* inMenuItemContent); + void LoadMenuItem(nsIContent* inMenuItemContent); void LoadSubMenu(nsIContent* inMenuContent); GeckoNSMenu* CreateMenuWithGeckoString(nsString& menuTitle); nsTArray<mozilla::UniquePtr<nsMenuObjectX>> mMenuObjectsArray; nsString mLabel; uint32_t mVisibleItemsCount; // cache nsMenuObjectX* mParent; // [weak] nsMenuGroupOwnerX* mMenuGroupOwner; // [weak]
--- a/widget/cocoa/nsMenuX.mm +++ b/widget/cocoa/nsMenuX.mm @@ -114,17 +114,17 @@ nsMenuX::nsMenuX() Class SCTGRLIndexClass = ::NSClassFromString(@"SCTGRLIndex"); nsToolkit::SwizzleMethods(SCTGRLIndexClass, @selector(indexMenuBarDynamically), @selector(nsMenuX_SCTGRLIndex_indexMenuBarDynamically)); gMenuMethodsSwizzled = true; } mMenuDelegate = [[MenuDelegate alloc] initWithGeckoMenu:this]; - + if (!nsMenuBarX::sNativeEventTarget) nsMenuBarX::sNativeEventTarget = [[NativeMenuItemTarget alloc] init]; MOZ_COUNT_CTOR(nsMenuX); NS_OBJC_END_TRY_ABORT_BLOCK; } @@ -282,17 +282,17 @@ nsresult nsMenuX::GetVisibleItemCount(ui aCount = mVisibleItemsCount; return NS_OK; } // Only includes visible items. Note that this is provides O(N) access // If you need to iterate or search, consider using GetItemAt and doing your own filtering nsMenuObjectX* nsMenuX::GetVisibleItemAt(uint32_t aPos) { - + uint32_t count = mMenuObjectsArray.Length(); if (aPos >= mVisibleItemsCount || aPos >= count) return NULL; // If there are no invisible items, can provide direct access if (mVisibleItemsCount == count) return mMenuObjectsArray[aPos].get(); @@ -357,17 +357,17 @@ nsEventStatus nsMenuX::MenuOpened() nsEventStatus status = nsEventStatus_eIgnore; WidgetMouseEvent event(true, eXULPopupShown, nullptr, WidgetMouseEvent::eReal); nsCOMPtr<nsIContent> popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); nsIContent* dispatchTo = popupContent ? popupContent : mContent; dispatchTo->DispatchDOMEvent(&event, nullptr, nullptr, &status); - + return nsEventStatus_eConsumeNoDefault; } void nsMenuX::MenuClosed() { if (mConstructed) { // Don't close if a handler tells us to stop. if (!OnClose()) @@ -391,17 +391,17 @@ void nsMenuX::MenuClosed() mConstructed = false; } } void nsMenuX::MenuConstruct() { mConstructed = false; gConstructingMenu = true; - + // reset destroy handler flag so that we'll know to fire it next time this menu goes away. mDestroyHandlerCalled = false; //printf("nsMenuX::MenuConstruct called for %s = %d \n", NS_LossyConvertUTF16toASCII(mLabel).get(), mNativeMenu); // Retrieve our menupopup. nsCOMPtr<nsIContent> menuPopup; GetMenuPopupContent(getter_AddRefs(menuPopup)); @@ -559,20 +559,20 @@ void nsMenuX::LoadSubMenu(nsIContent* in // This menu is about to open. Returns TRUE if we should keep processing the event, // FALSE if the handler wants to stop the opening of the menu. bool nsMenuX::OnOpen() { nsEventStatus status = nsEventStatus_eIgnore; WidgetMouseEvent event(true, eXULPopupShowing, nullptr, WidgetMouseEvent::eReal); - + nsCOMPtr<nsIContent> popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); - + nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mContent; rv = dispatchTo->DispatchDOMEvent(&event, nullptr, nullptr, &status); if (NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault) return false; // If the open is going to succeed we need to walk our menu items, checking to // see if any of them have a command attribute. If so, several attributes @@ -604,47 +604,47 @@ bool nsMenuX::OnClose() WidgetMouseEvent::eReal); nsCOMPtr<nsIContent> popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mContent; rv = dispatchTo->DispatchDOMEvent(&event, nullptr, nullptr, &status); - + mDestroyHandlerCalled = true; - + if (NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault) return false; - + return true; } // Find the |menupopup| child in the |popup| representing this menu. It should be one // of a very few children so we won't be iterating over a bazillion menu items to find // it (so the strcmp won't kill us). void nsMenuX::GetMenuPopupContent(nsIContent** aResult) { if (!aResult) return; *aResult = nullptr; - + // Check to see if we are a "menupopup" node (if we are a native menu). { int32_t dummy; nsCOMPtr<nsIAtom> tag = mContent->OwnerDoc()->BindingManager()->ResolveTag(mContent, &dummy); if (tag == nsGkAtoms::menupopup) { *aResult = mContent; NS_ADDREF(*aResult); return; } } // Otherwise check our child nodes. - + uint32_t count = mContent->GetChildCount(); for (uint32_t i = 0; i < count; i++) { int32_t dummy; nsIContent *child = mContent->GetChildAt(i); nsCOMPtr<nsIAtom> tag = child->OwnerDoc()->BindingManager()->ResolveTag(child, &dummy); if (tag == nsGkAtoms::menupopup) { *aResult = child; @@ -699,17 +699,17 @@ void nsMenuX::ObserveAttributeChanged(ns if (parentType == eMenuBarObjectType) { // reuse the existing menu, to avoid rebuilding the root menu bar. NS_ASSERTION(mNativeMenu, "nsMenuX::AttributeChanged: invalid menu handle."); NSString *newCocoaLabelString = nsMenuUtilsX::GetTruncatedCocoaLabel(mLabel); [mNativeMenu setTitle:newCocoaLabelString]; } else if (parentType == eSubmenuObjectType) { static_cast<nsMenuX*>(mParent)->SetRebuild(true); - } + } else if (parentType == eStandaloneNativeMenuObjectType) { static_cast<nsStandaloneNativeMenu*>(mParent)->GetMenuXObject()->SetRebuild(true); } } else if (aAttribute == nsGkAtoms::hidden || aAttribute == nsGkAtoms::collapsed) { SetRebuild(true); bool contentIsHiddenOrCollapsed = nsMenuUtilsX::NodeIsHiddenOrCollapsed(mContent); @@ -897,17 +897,17 @@ static NSMutableDictionary *gShadowKeyEq @end @implementation KeyEquivDBItem - (id)initWithItem:(NSMenuItem *)aItem table:(NSMapTable *)aTable { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - + if (!gShadowKeyEquivDB) gShadowKeyEquivDB = [[NSMutableDictionary alloc] init]; self = [super init]; if (aItem && aTable) { mTables = [[NSMutableSet alloc] init]; mItem = [aItem retain]; [mTables addObject:[NSValue valueWithPointer:aTable]]; } else {
--- a/widget/gtk/nsScreenManagerGtk.cpp +++ b/widget/gtk/nsScreenManagerGtk.cpp @@ -140,17 +140,17 @@ nsScreenManagerGtk :: Init() } } if (mXineramalib && mXineramalib != SCREEN_MANAGER_LIBRARY_LOAD_FAILED) { _XnrmIsActive_fn _XnrmIsActive = (_XnrmIsActive_fn) PR_FindFunctionSymbol(mXineramalib, "XineramaIsActive"); _XnrmQueryScreens_fn _XnrmQueryScreens = (_XnrmQueryScreens_fn) PR_FindFunctionSymbol(mXineramalib, "XineramaQueryScreens"); - + // get the number of screens via xinerama Display *display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); if (_XnrmIsActive && _XnrmQueryScreens && _XnrmIsActive(display)) { screenInfo = _XnrmQueryScreens(display, &numScreens); } } // screenInfo == nullptr if either Xinerama couldn't be loaded or @@ -228,17 +228,17 @@ nsScreenManagerGtk :: ScreenForId ( uint } } return NS_ERROR_FAILURE; } // -// ScreenForRect +// ScreenForRect // // Returns the screen that contains the rectangle. If the rect overlaps // multiple screens, it picks the screen with the greatest area of intersection. // // The coordinates are in desktop pixels. // NS_IMETHODIMP nsScreenManagerGtk::ScreenForRect(int32_t aX, int32_t aY, @@ -274,39 +274,39 @@ nsScreenManagerGtk::ScreenForRect(int32_ which = i; area = tempArea; } } } *aOutScreen = mCachedScreenArray.SafeObjectAt(which); NS_IF_ADDREF(*aOutScreen); return NS_OK; - + } // ScreenForRect // // GetPrimaryScreen // // The screen with the menubar/taskbar. This shouldn't be needed very // often. // -NS_IMETHODIMP -nsScreenManagerGtk :: GetPrimaryScreen(nsIScreen * *aPrimaryScreen) +NS_IMETHODIMP +nsScreenManagerGtk :: GetPrimaryScreen(nsIScreen * *aPrimaryScreen) { nsresult rv; rv = EnsureInit(); if (NS_FAILED(rv)) { NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from GetPrimaryScreen"); return rv; } *aPrimaryScreen = mCachedScreenArray.SafeObjectAt(0); NS_IF_ADDREF(*aPrimaryScreen); return NS_OK; - + } // GetPrimaryScreen // // GetNumberOfScreens // // Returns how many physical screens are available. // @@ -316,17 +316,17 @@ nsScreenManagerGtk :: GetNumberOfScreens nsresult rv; rv = EnsureInit(); if (NS_FAILED(rv)) { NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from GetNumberOfScreens"); return rv; } *aNumberOfScreens = mCachedScreenArray.Count(); return NS_OK; - + } // GetNumberOfScreens NS_IMETHODIMP nsScreenManagerGtk::GetSystemDefaultScale(float *aDefaultScale) { *aDefaultScale = nsScreenGtk::GetDPIScale(); return NS_OK; }
--- a/widget/gtk/nsSound.cpp +++ b/widget/gtk/nsSound.cpp @@ -179,17 +179,17 @@ nsSound::~nsSound() { } NS_IMETHODIMP nsSound::Init() { // This function is designed so that no library is compulsory, and // one library missing doesn't cause the other(s) to not be used. - if (mInited) + if (mInited) return NS_OK; mInited = true; if (!libcanberra) { libcanberra = PR_LoadLibrary("libcanberra.so.0"); if (libcanberra) { ca_context_create = (ca_context_create_fn) PR_FindFunctionSymbol(libcanberra, "ca_context_create"); @@ -424,17 +424,17 @@ NS_IMETHODIMP nsSound::PlaySystemSound(c return PlayEventSound(eventId); } nsresult rv; nsCOMPtr <nsIURI> fileURI; // create a nsIFile and then a nsIFileURL from that nsCOMPtr <nsIFile> soundFile; - rv = NS_NewLocalFile(aSoundAlias, true, + rv = NS_NewLocalFile(aSoundAlias, true, getter_AddRefs(soundFile)); NS_ENSURE_SUCCESS(rv,rv); rv = NS_NewFileURI(getter_AddRefs(fileURI), soundFile); NS_ENSURE_SUCCESS(rv,rv); nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(fileURI,&rv); NS_ENSURE_SUCCESS(rv,rv);
--- a/widget/gtk/nsWidgetFactory.cpp +++ b/widget/gtk/nsWidgetFactory.cpp @@ -212,17 +212,17 @@ NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID) NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); NS_DEFINE_NAMED_CID(NS_THEMERENDERER_CID); #ifdef NS_PRINTING NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID); NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID); NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID); NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID); -#endif +#endif NS_DEFINE_NAMED_CID(NS_IMAGE_TO_PIXBUF_CID); #if defined(MOZ_X11) NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); #endif static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
--- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -586,23 +586,23 @@ nsWindow::DispatchEvent(WidgetGUIEvent* void nsWindow::OnDestroy(void) { if (mOnDestroyCalled) return; mOnDestroyCalled = true; - + // Prevent deletion. nsCOMPtr<nsIWidget> kungFuDeathGrip = this; // release references to children, device context, toolkit + app shell - nsBaseWidget::OnDestroy(); - + nsBaseWidget::OnDestroy(); + // Remove association between this object and its parent and siblings. nsBaseWidget::Destroy(); mParent = nullptr; NotifyWindowDestroyed(); } bool @@ -714,19 +714,19 @@ nsWindow::Destroy(void) mCreated = false; /** Need to clean our LayerManager up while still alive */ if (mLayerManager) { mLayerManager->Destroy(); } mLayerManager = nullptr; - // It is safe to call DestroyeCompositor several times (here and + // It is safe to call DestroyeCompositor several times (here and // in the parent class) since it will take effect only once. - // The reason we call it here is because on gtk platforms we need + // The reason we call it here is because on gtk platforms we need // to destroy the compositor before we destroy the gdk window (which // destroys the the gl context attached to it). DestroyCompositor(); ClearCachedResources(); g_signal_handlers_disconnect_by_func(gtk_settings_get_default(), FuncToGpointer(theme_changed_cb), @@ -884,17 +884,17 @@ nsWindow::ReparentNativeWidget(nsIWidget // The GdkWindows have been destroyed so there is nothing else to // reparent. MOZ_ASSERT(gdk_window_is_destroyed(mGdkWindow), "live GdkWindow with no widget"); return NS_OK; } MOZ_ASSERT(!gdk_window_is_destroyed(mGdkWindow), "destroyed GdkWindow with widget"); - + nsWindow* newParent = static_cast<nsWindow*>(aNewParent); GdkWindow* newParentWindow = newParent->mGdkWindow; GtkWidget* newContainer = newParent->GetMozContainerWidget(); GtkWindow* shell = GTK_WINDOW(mShell); if (shell && gtk_window_get_transient_for(shell)) { GtkWindow* topLevelParent = GTK_WINDOW(gtk_widget_get_toplevel(newContainer)); @@ -970,24 +970,24 @@ nsWindow::RegisterTouchWindow() mHandleTouchEvent = true; mTouches.Clear(); #endif } NS_IMETHODIMP nsWindow::ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY) { - if (!mIsTopLevel || !mShell) + if (!mIsTopLevel || !mShell) return NS_OK; double dpiScale = GetDefaultScale().scale; // we need to use the window size in logical screen pixels int32_t logWidth = std::max(NSToIntRound(mBounds.width / dpiScale), 1); - int32_t logHeight = std::max(NSToIntRound(mBounds.height / dpiScale), 1); + int32_t logHeight = std::max(NSToIntRound(mBounds.height / dpiScale), 1); /* get our playing field. use the current screen, or failing that for any reason, use device caps for the default screen. */ nsCOMPtr<nsIScreen> screen; nsCOMPtr<nsIScreenManager> screenmgr = do_GetService("@mozilla.org/gfx/screenmanager;1"); if (screenmgr) { screenmgr->ScreenForRect(*aX, *aY, logWidth, logHeight, getter_AddRefs(screen)); @@ -1013,17 +1013,17 @@ nsWindow::ConstrainPosition(bool aAllowS *aX = screenRect.x - logWidth + kWindowPositionSlop; else if (*aX >= screenRect.XMost() - kWindowPositionSlop) *aX = screenRect.XMost() - kWindowPositionSlop; if (*aY < screenRect.y - logHeight + kWindowPositionSlop) *aY = screenRect.y - logHeight + kWindowPositionSlop; else if (*aY >= screenRect.YMost() - kWindowPositionSlop) *aY = screenRect.YMost() - kWindowPositionSlop; - } else { + } else { if (*aX < screenRect.x) *aX = screenRect.x; else if (*aX >= screenRect.XMost() - logWidth) *aX = screenRect.XMost() - logWidth; if (*aY < screenRect.y) *aY = screenRect.y; else if (*aY >= screenRect.YMost() - logHeight) @@ -1393,17 +1393,17 @@ nsWindow::GetLastUserInputTime() // drags, WM_DELETE_WINDOW delete events, but not usually mouse motion nor // button and key releases. Therefore use the most recent of // gdk_x11_display_get_user_time and the last time that we have seen. guint32 timestamp = gdk_x11_display_get_user_time(gdk_display_get_default()); if (sLastUserInputTime != GDK_CURRENT_TIME && TimestampIsNewerThan(sLastUserInputTime, timestamp)) { return sLastUserInputTime; - } + } return timestamp; } NS_IMETHODIMP nsWindow::SetFocus(bool aRaise) { // Make sure that our owning widget has focus. If it doesn't try to @@ -1809,26 +1809,26 @@ nsWindow::SetTitle(const nsAString& aTit NS_IMETHODIMP nsWindow::SetIcon(const nsAString& aIconSpec) { if (!mShell) return NS_OK; nsAutoCString iconName; - + if (aIconSpec.EqualsLiteral("default")) { nsXPIDLString brandName; GetBrandName(brandName); AppendUTF16toUTF8(brandName, iconName); ToLowerCase(iconName); } else { AppendUTF16toUTF8(aIconSpec, iconName); } - + nsCOMPtr<nsIFile> iconFile; nsAutoCString path; gint *iconSizes = gtk_icon_theme_get_icon_sizes(gtk_icon_theme_get_default(), iconName.get()); bool foundIcon = (iconSizes[0] != 0); g_free(iconSizes); @@ -3219,34 +3219,34 @@ nsWindow::OnScrollEvent(GdkEventScroll * { // check to see if we should rollup if (CheckForRollup(aEvent->x_root, aEvent->y_root, true, false)) return; #if GTK_CHECK_VERSION(3,4,0) // check for duplicate legacy scroll event, see GNOME bug 726878 if (aEvent->direction != GDK_SCROLL_SMOOTH && mLastScrollEventTime == aEvent->time) - return; + return; #endif WidgetWheelEvent wheelEvent(true, eWheel, this); wheelEvent.mDeltaMode = nsIDOMWheelEvent::DOM_DELTA_LINE; switch (aEvent->direction) { #if GTK_CHECK_VERSION(3,4,0) case GDK_SCROLL_SMOOTH: { // As of GTK 3.4, all directional scroll events are provided by // the GDK_SCROLL_SMOOTH direction on XInput2 devices. mLastScrollEventTime = aEvent->time; // TODO - use a more appropriate scrolling unit than lines. // Multiply event deltas by 3 to emulate legacy behaviour. wheelEvent.mDeltaX = aEvent->delta_x * 3; wheelEvent.mDeltaY = aEvent->delta_y * 3; wheelEvent.mIsNoLineOrPageDelta = true; - // This next step manually unsets smooth scrolling for touch devices - // that trigger GDK_SCROLL_SMOOTH. We use the slave device, which + // This next step manually unsets smooth scrolling for touch devices + // that trigger GDK_SCROLL_SMOOTH. We use the slave device, which // represents the actual input. GdkDevice *device = gdk_event_get_source_device((GdkEvent*)aEvent); GdkInputSource source = gdk_device_get_source(device); if (source == GDK_SOURCE_TOUCHSCREEN || source == GDK_SOURCE_TOUCHPAD) { wheelEvent.mScrollType = WidgetWheelEvent::SCROLL_ASYNCHRONOUSELY; } break; @@ -3658,17 +3658,17 @@ nsWindow::Create(nsIWidget* aParent, // We only move a general managed toplevel window if someone has // actually placed the window somewhere. If no placement has taken // place, we just let the window manager Do The Right Thing. NativeResize(); if (mWindowType == eWindowType_dialog) { SetDefaultIcon(); - gtk_window_set_wmclass(GTK_WINDOW(mShell), "Dialog", + gtk_window_set_wmclass(GTK_WINDOW(mShell), "Dialog", gdk_get_program_class()); gtk_window_set_type_hint(GTK_WINDOW(mShell), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent); } else if (mWindowType == eWindowType_popup) { // With popup windows, we want to control their position, so don't @@ -3714,17 +3714,17 @@ nsWindow::Create(nsIWidget* aParent, // WM_HINTS input field is set to False to tell the window // manager not to set input focus to this window ... gtk_window_set_accept_focus(GTK_WINDOW(mShell), FALSE); #ifdef MOZ_X11 // ... but when the window manager offers focus through // WM_TAKE_FOCUS, focus is requested on the parent window. gtk_widget_realize(mShell); gdk_window_add_filter(gtk_widget_get_window(mShell), - popup_take_focus_filter, nullptr); + popup_take_focus_filter, nullptr); #endif } GdkWindowTypeHint gtkTypeHint; if (aInitData->mIsDragPopup) { gtkTypeHint = GDK_WINDOW_TYPE_HINT_DND; mIsDragPopup = true; } @@ -3745,17 +3745,17 @@ nsWindow::Create(nsIWidget* aParent, if (topLevelParent) { gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent); } } else { // must be eWindowType_toplevel SetDefaultIcon(); - gtk_window_set_wmclass(GTK_WINDOW(mShell), "Toplevel", + gtk_window_set_wmclass(GTK_WINDOW(mShell), "Toplevel", gdk_get_program_class()); // each toplevel window gets its own window group GtkWindowGroup *group = gtk_window_group_new(); gtk_window_group_add_window(group, GTK_WINDOW(mShell)); g_object_unref(group); } @@ -4026,17 +4026,17 @@ NS_IMETHODIMP nsWindow::SetWindowClass(const nsAString &xulWinType) { if (!mShell) return NS_ERROR_FAILURE; const char *res_class = gdk_get_program_class(); if (!res_class) return NS_ERROR_FAILURE; - + char *res_name = ToNewCString(xulWinType); if (!res_name) return NS_ERROR_OUT_OF_MEMORY; const char *role = nullptr; // Parse res_name into a name and role. Characters other than // [A-Za-z0-9_-] are converted to '_'. Anything after the first @@ -4573,19 +4573,19 @@ nsWindow::ApplyTransparencyBitmap() mTransparencyBitmapWidth, mTransparencyBitmapHeight); if (!maskBitmap) return; gtk_widget_shape_combine_mask(mShell, maskBitmap, 0, 0); g_object_unref(maskBitmap); #else cairo_surface_t *maskBitmap; - maskBitmap = cairo_image_surface_create_for_data((unsigned char*)mTransparencyBitmap, - CAIRO_FORMAT_A1, - mTransparencyBitmapWidth, + maskBitmap = cairo_image_surface_create_for_data((unsigned char*)mTransparencyBitmap, + CAIRO_FORMAT_A1, + mTransparencyBitmapWidth, mTransparencyBitmapHeight, GetBitmapStride(mTransparencyBitmapWidth)); if (!maskBitmap) return; cairo_region_t * maskRegion = gdk_cairo_region_create_from_surface(maskBitmap); gtk_widget_shape_combine_region(mShell, maskRegion); cairo_region_destroy(maskRegion); @@ -4761,47 +4761,47 @@ nsWindow::GetContainerWindow() return window; } void nsWindow::SetUrgencyHint(GtkWidget *top_window, bool state) { if (!top_window) return; - + gdk_window_set_urgency_hint(gtk_widget_get_window(top_window), state); } void * nsWindow::SetupPluginPort(void) { if (!mGdkWindow) return nullptr; if (gdk_window_is_destroyed(mGdkWindow) == TRUE) return nullptr; Window window = gdk_x11_window_get_xid(mGdkWindow); - + // we have to flush the X queue here so that any plugins that // might be running on separate X connections will be able to use // this window in case it was just created #ifdef MOZ_X11 - XWindowAttributes xattrs; + XWindowAttributes xattrs; Display *display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); XGetWindowAttributes(display, window, &xattrs); XSelectInput (display, window, xattrs.your_event_mask | SubstructureNotifyMask); gdk_window_add_filter(mGdkWindow, plugin_window_filter_func, this); XSync(display, False); #endif /* MOZ_X11 */ - + return (void *)window; } void nsWindow::SetDefaultIcon(void) { SetIcon(NS_LITERAL_STRING("default")); } @@ -4824,17 +4824,17 @@ nsWindow::SetNonXEmbedPluginFocus() RefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow; gPluginFocusWindow->LoseNonXEmbedPluginFocus(); } LOGFOCUS(("nsWindow::SetNonXEmbedPluginFocus\n")); Window curFocusWindow; int focusState; - + GdkDisplay *gdkDisplay = gdk_window_get_display(mGdkWindow); XGetInputFocus(gdk_x11_display_get_xdisplay(gdkDisplay), &curFocusWindow, &focusState); LOGFOCUS(("\t curFocusWindow=%p\n", curFocusWindow)); GdkWindow* toplevel = gdk_window_get_toplevel(mGdkWindow); @@ -5308,17 +5308,17 @@ static GdkCursor * get_gtk_cursor(nsCursor aCursor) { GdkCursor *gdkcursor = nullptr; uint8_t newType = 0xff; if ((gdkcursor = gCursorCache[aCursor])) { return gdkcursor; } - + GdkDisplay *defaultDisplay = gdk_display_get_default(); // The strategy here is to use standard GDK cursors, and, if not available, // load by standard name with gdk_cursor_new_from_name. // Spec is here: http://www.freedesktop.org/wiki/Specifications/cursor-spec/ switch (aCursor) { case eCursor_standard: gdkcursor = gdk_cursor_new_for_display(defaultDisplay, GDK_LEFT_PTR); @@ -5482,41 +5482,41 @@ get_gtk_cursor(nsCursor aCursor) gdkcursor = gdk_cursor_new_from_name(defaultDisplay, GtkCursors[newType].hash); } // If we still don't have a xcursor, we now really create a bitmap cursor if (newType != 0xff && !gdkcursor) { GdkPixbuf * cursor_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32); if (!cursor_pixbuf) return nullptr; - + guchar *data = gdk_pixbuf_get_pixels(cursor_pixbuf); - + // Read data from GtkCursors and compose RGBA surface from 1bit bitmap and mask // GtkCursors bits and mask are 32x32 monochrome bitmaps (1 bit for each pixel) // so it's 128 byte array (4 bytes for are one bitmap row and there are 32 rows here). const unsigned char *bits = GtkCursors[newType].bits; const unsigned char *mask_bits = GtkCursors[newType].mask_bits; - + for (int i = 0; i < 128; i++) { char bit = *bits++; char mask = *mask_bits++; for (int j = 0; j < 8; j++) { unsigned char pix = ~(((bit >> j) & 0x01) * 0xff); *data++ = pix; *data++ = pix; *data++ = pix; *data++ = (((mask >> j) & 0x01) * 0xff); } } - + gdkcursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), cursor_pixbuf, GtkCursors[newType].hot_x, GtkCursors[newType].hot_y); - + g_object_unref(cursor_pixbuf); } gCursorCache[aCursor] = gdkcursor; return gdkcursor; } @@ -5537,37 +5537,37 @@ expose_event_cb(GtkWidget *widget, GdkEv void draw_window_of_widget(GtkWidget *widget, GdkWindow *aWindow, cairo_t *cr) { if (gtk_cairo_should_draw_window(cr, aWindow)) { RefPtr<nsWindow> window = get_window_for_gdk_window(aWindow); if (!window) { NS_WARNING("Cannot get nsWindow from GtkWidget"); } - else { - cairo_save(cr); - gtk_cairo_transform_to_window(cr, widget, aWindow); + else { + cairo_save(cr); + gtk_cairo_transform_to_window(cr, widget, aWindow); // TODO - window->OnExposeEvent() can destroy this or other windows, // do we need to handle it somehow? window->OnExposeEvent(cr); cairo_restore(cr); } } - + GList *children = gdk_window_get_children(aWindow); GList *child = children; while (child) { GdkWindow *window = GDK_WINDOW(child->data); gpointer windowWidget; gdk_window_get_user_data(window, &windowWidget); if (windowWidget == widget) { draw_window_of_widget(widget, window, cr); } child = g_list_next(child); - } + } g_list_free(children); } /* static */ gboolean expose_event_cb(GtkWidget *widget, cairo_t *cr) { draw_window_of_widget(widget, gtk_widget_get_window(widget), cr); @@ -5841,28 +5841,28 @@ plugin_window_filter_func(GdkXEvent *gdk break; xeventWindow = xevent->xreparent.window; } #if (MOZ_WIDGET_GTK == 2) plugin_window = gdk_window_lookup(xeventWindow); #else plugin_window = gdk_x11_window_lookup_for_display( gdk_x11_lookup_xdisplay(xevent->xcreatewindow.display), xeventWindow); -#endif +#endif if (plugin_window) { GtkWidget *widget = get_gtk_widget_for_gdk_window(plugin_window); // TODO GTK3 #if (MOZ_WIDGET_GTK == 2) if (GTK_IS_XTBIN(widget)) { nswindow->SetPluginType(nsWindow::PluginType_NONXEMBED); break; } - else + else #endif if(GTK_IS_SOCKET(widget)) { if (!g_object_get_data(G_OBJECT(widget), "enable-xt-focus")) { nswindow->SetPluginType(nsWindow::PluginType_XEMBED); break; } } }
--- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -74,38 +74,38 @@ public: typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::WidgetEventTime WidgetEventTime; nsWindow(); static void ReleaseGlobals(); NS_DECL_ISUPPORTS_INHERITED - + void CommonCreate(nsIWidget *aParent, bool aListenForResizes); - + virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override; - + // called when we are destroyed virtual void OnDestroy(void) override; // called to check and see if a widget's dimensions are sane bool AreBoundsSane(void); // nsIWidget using nsBaseWidget::Create; // for Create signature not overridden here NS_IMETHOD Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData) override; NS_IMETHOD Destroy(void) override; virtual nsIWidget *GetParent() override; virtual float GetDPI() override; - virtual double GetDefaultScaleInternal() override; + virtual double GetDefaultScaleInternal() override; // Under Gtk, we manage windows using device pixels so no scaling is needed: mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() final { return mozilla::DesktopToLayoutDeviceScale(1.0); } virtual nsresult SetParent(nsIWidget* aNewParent) override; NS_IMETHOD SetModal(bool aModal) override; virtual bool IsVisible() const override; @@ -524,17 +524,17 @@ private: static GdkCursor *gsGtkCursorCache[eCursorCount]; // Transparency bool mIsTransparent; // This bitmap tracks which pixels are transparent. We don't support // full translucency at this time; each pixel is either fully opaque // or fully transparent. gchar* mTransparencyBitmap; - + // all of our DND stuff void InitDragEvent(mozilla::WidgetDragEvent& aEvent); float mLastMotionPressure; // Remember the last sizemode so that we can restore it when // leaving fullscreen nsSizeMode mLastSizeMode;
--- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -93,19 +93,19 @@ public: void Unregister(); nsBaseWidget *mWidget; bool mRegistered; }; /** * Common widget implementation used as base class for native - * or crossplatform implementations of Widgets. - * All cross-platform behavior that all widgets need to implement - * should be placed in this class. + * or crossplatform implementations of Widgets. + * All cross-platform behavior that all widgets need to implement + * should be placed in this class. * (Note: widget implementations are not required to use this * class, but it gives them a head start.) */ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference { friend class nsAutoRollup; friend class DispatchWheelEventOnMainThread; @@ -321,17 +321,17 @@ public: } // return the screen the widget is in. already_AddRefed<nsIScreen> GetWidgetScreen(); // return true if this is a popup widget with a native titlebar bool IsPopupWithTitleBar() const { - return (mWindowType == eWindowType_popup && + return (mWindowType == eWindowType_popup && mBorderStyle != eBorderStyle_default && mBorderStyle & eBorderStyle_title); } NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override = 0; virtual const SizeConstraints GetSizeConstraints() override; virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override; @@ -585,17 +585,17 @@ protected: // Returns whether compositing should use an external surface size. virtual bool UseExternalCompositingSurface() const { return false; } /** * Starts the OMTC compositor destruction sequence. * - * When this function returns, the compositor should not be + * When this function returns, the compositor should not be * able to access the opengl context anymore. * It is safe to call it several times if platform implementations * require the compositor to be destroyed before ~nsBaseWidget is * reached (This is the case with gtk2 for instance). */ virtual void DestroyCompositor(); void DestroyLayerManager(); void ReleaseContentController();
--- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -165,23 +165,23 @@ enum nsTransparencyMode { eTransparencyBorderlessGlass // As above, but without a border around the opaque areas when there would otherwise be one with eTransparencyGlass }; /** * Cursor types. */ enum nsCursor { ///(normal cursor, usually rendered as an arrow) - eCursor_standard, + eCursor_standard, ///(system is busy, usually rendered as a hourglass or watch) - eCursor_wait, + eCursor_wait, ///(Selecting something, usually rendered as an IBeam) - eCursor_select, + eCursor_select, ///(can hyper-link, usually rendered as a human hand) - eCursor_hyperlink, + eCursor_hyperlink, ///(north/south/west/east edge sizing) eCursor_n_resize, eCursor_s_resize, eCursor_w_resize, eCursor_e_resize, ///(corner sizing) eCursor_nw_resize, eCursor_se_resize, @@ -207,17 +207,17 @@ enum nsCursor { ///(normal cursor, eCursor_all_scroll, eCursor_nesw_resize, eCursor_nwse_resize, eCursor_ns_resize, eCursor_ew_resize, eCursor_none, // This one better be the last one in this list. eCursorCount - }; + }; enum nsTopLevelWidgetZPlacement { // for PlaceBehind() eZPlacementBottom = 0, // bottom of the window stack eZPlacementBelow, // just below another widget eZPlacementTop // top of the window stack }; /** @@ -384,31 +384,31 @@ class nsIWidget : public nsISupports , mOnDestroyCalled(false) , mWindowType(eWindowType_child) , mZIndex(0) { ClearNativeTouchSequence(nullptr); } - + /** - * Create and initialize a widget. + * Create and initialize a widget. * * All the arguments can be null in which case a top level window * with size 0 is created. The event callback function has to be * provided only if the caller wants to deal with the events this * widget receives. The event callback is basically a preprocess * hook called synchronously. The return value determines whether * the event goes to the default window procedure or it is hidden * to the os. The assumption is that if the event handler returns - * false the widget does not see the event. The widget should not - * automatically clear the window to the background color. The - * calling code must handle paint messages and clear the background - * itself. + * false the widget does not see the event. The widget should not + * automatically clear the window to the background color. The + * calling code must handle paint messages and clear the background + * itself. * * In practice at least one of aParent and aNativeParent will be null. If * both are null the widget isn't parented (e.g. context menus or * independent top level windows). * * The dimensions given in aRect are specified in the parent's * device coordinate system. * This must not be called for parentless widgets such as top-level @@ -461,17 +461,17 @@ class nsIWidget : public nsISupports * understood code, and shouldn't be used in new code. */ virtual already_AddRefed<nsIWidget> CreateChild(const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr, bool aForceUseIWidgetParent = false) = 0; /** - * Attach to a top level widget. + * Attach to a top level widget. * * In cases where a top level chrome widget is being used as a content * container, attach a secondary listener and update the device * context. The primary widget listener will continue to be called for * notifications relating to the top-level window, whereas other * notifications such as painting and events will instead be called via * the attached listener. SetAttachedWidgetListener should be used to * assign the attached listener. @@ -495,17 +495,17 @@ class nsIWidget : public nsISupports * actions for the widget. */ //@{ virtual nsIWidgetListener* GetWidgetListener() = 0; virtual void SetWidgetListener(nsIWidgetListener* alistener) = 0; //@} /** - * Close and destroy the internal native window. + * Close and destroy the internal native window. * This method does not delete the widget. */ NS_IMETHOD Destroy(void) = 0; /** * Destroyed() returns true if Destroy() has been called already. * Otherwise, false. @@ -513,22 +513,22 @@ class nsIWidget : public nsISupports bool Destroyed() const { return mOnDestroyCalled; } /** * Reparent a widget * * Change the widget's parent. Null parents are allowed. * - * @param aNewParent new parent + * @param aNewParent new parent */ NS_IMETHOD SetParent(nsIWidget* aNewParent) = 0; /** - * Return the parent Widget of this Widget or nullptr if this is a + * Return the parent Widget of this Widget or nullptr if this is a * top level window * * @return the parent widget or nullptr if it does not have a parent * */ virtual nsIWidget* GetParent(void) = 0; /** @@ -585,39 +585,39 @@ class nsIWidget : public nsISupports /** * Return the first child of this widget. Will return null if * there are no children. */ nsIWidget* GetFirstChild() const { return mFirstChild; } - + /** * Return the last child of this widget. Will return null if * there are no children. */ nsIWidget* GetLastChild() const { return mLastChild; } /** * Return the next sibling of this widget */ nsIWidget* GetNextSibling() const { return mNextSibling; } - + /** * Set the next sibling of this widget */ void SetNextSibling(nsIWidget* aSibling) { mNextSibling = aSibling; } - + /** * Return the previous sibling of this widget */ nsIWidget* GetPrevSibling() const { return mPrevSibling; } /** @@ -795,17 +795,17 @@ class nsIWidget : public nsISupports bool aRepaint) = 0; /** * Sets the widget's z-index. */ virtual void SetZIndex(int32_t aZIndex) = 0; /** - * Gets the widget's z-index. + * Gets the widget's z-index. */ int32_t GetZIndex() { return mZIndex; } /** * Position this widget just behind the given widget. (Used to @@ -977,17 +977,17 @@ class nsIWidget : public nsISupports * @param aX the X coordinate of the hotspot (from left). * @param aY the Y coordinate of the hotspot (from top). * @retval NS_ERROR_NOT_IMPLEMENTED if setting images as cursors is not * supported */ NS_IMETHOD SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY) = 0; - /** + /** * Get the window type of this widget. */ nsWindowType WindowType() { return mWindowType; } /** * Determines if this widget is one of the three types of plugin widgets. */ bool IsPlugin() { @@ -1152,17 +1152,17 @@ class nsIWidget : public nsISupports virtual void SetDrawsTitle(bool aDrawTitle) {} /** * Indicates whether the widget should attempt to make titlebar controls * easier to see on dark titlebar backgrounds. */ virtual void SetUseBrightTitlebarForeground(bool aBrightForeground) {} - /** + /** * Hide window chrome (borders, buttons) for this widget. * */ NS_IMETHOD HideWindowChrome(bool aShouldHide) = 0; enum FullscreenTransitionStage { eBeforeFullscreenToggle, @@ -1373,47 +1373,47 @@ class nsIWidget : public nsISupports */ virtual bool AsyncPanZoomEnabled() const = 0; /** * Enables the dropping of files to a widget (XXX this is temporary) * */ NS_IMETHOD EnableDragDrop(bool aEnable) = 0; - + /** * Enables/Disables system mouse capture. - * @param aCapture true enables mouse capture, false disables mouse capture + * @param aCapture true enables mouse capture, false disables mouse capture * */ NS_IMETHOD CaptureMouse(bool aCapture) = 0; /** * Classify the window for the window manager. Mostly for X11. */ NS_IMETHOD SetWindowClass(const nsAString& xulWinType) = 0; /** * Enables/Disables system capture of any and all events that would cause a * popup to be rolled up. aListener should be set to a non-null value for * any popups that are not managed by the popup manager. - * @param aDoCapture true enables capture, false disables capture + * @param aDoCapture true enables capture, false disables capture * */ NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener, bool aDoCapture) = 0; /** * Bring this window to the user's attention. This is intended to be a more * gentle notification than popping the window to the top or putting up an * alert. See, for example, Win32 FlashWindow or the NotificationManager on * the Mac. The notification should be suppressed if the window is already * in the foreground and should be dismissed when the user brings this window * to the foreground. - * @param aCycleCount Maximum number of times to animate the window per system - * conventions. If set to -1, cycles indefinitely until + * @param aCycleCount Maximum number of times to animate the window per system + * conventions. If set to -1, cycles indefinitely until * window is brought into the foreground. */ NS_IMETHOD GetAttention(int32_t aCycleCount) = 0; /** * Ask whether there user input events pending. All input events are * included, including those not targeted at this nsIwidget instance. */ @@ -1422,19 +1422,19 @@ class nsIWidget : public nsISupports /** * Set the background color of the window titlebar for this widget. On Mac, * for example, this will remove the grey gradient and bottom border and * instead show a single, solid color. * * Ignored on any platform that does not support it. Ignored by widgets that * do not represent windows. * - * @param aColor The color to set the title bar background to. Alpha values - * other than fully transparent (0) are respected if possible - * on the platform. An alpha of 0 will cause the window to + * @param aColor The color to set the title bar background to. Alpha values + * other than fully transparent (0) are respected if possible + * on the platform. An alpha of 0 will cause the window to * draw with the default style for the platform. * * @param aActive Whether the color should be applied to active or inactive * windows. */ NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive) = 0; /** @@ -1700,17 +1700,17 @@ public: * submenu, and we want to activate the 5th item within that submenu. */ virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) = 0; /** * This is used for native menu system testing. * * Updates a native menu at the position specified by the index string. - * The index string is a string of positive integers separated by the "|" + * The index string is a string of positive integers separated by the "|" * (pipe) character. * * Example: 1|0|4 * In this string, the first integer represents the top-level submenu * in the native menu bar. Since the integer is 1, it is the second submeu * in the native menu bar. Within that, the first item (index 0) is a * submenu, and we want to update submenu at index 4 within that submenu. * @@ -1747,17 +1747,17 @@ public: * * aFocused Whether or not a plugin is focused */ NS_IMETHOD SetPluginFocused(bool& aFocused) = 0; /* * Tell the plugin has focus. It is unnecessary to use IPC */ - bool PluginHasFocus() + bool PluginHasFocus() { return GetInputContext().mIMEState.mEnabled == IMEState::PLUGIN; } /** * Set IME candidate window position by windowless plugin. */ virtual void SetCandidateWindowForPlugin(
--- a/widget/nsPrintOptionsImpl.cpp +++ b/widget/nsPrintOptionsImpl.cpp @@ -430,17 +430,17 @@ GetPrefName((_a2), aPrefName), (_a3)); #endif /* DEBUG_rods_X */ //---------------------------------------------------------------------- /** * This will either read in the generic prefs (not specific to a printer) * or read the prefs in using the printer name to qualify. * It is either "print.attr_name" or "print.printer_HPLasr5.attr_name" */ -nsresult +nsresult nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, uint32_t aFlags) { NS_ENSURE_ARG_POINTER(aPS); if (aFlags & nsIPrintSettings::kInitSaveMargins) { int32_t halfInch = NS_INCHES_TO_INT_TWIPS(0.5); nsIntMargin margin(halfInch, halfInch, halfInch, halfInch); @@ -726,17 +726,17 @@ nsPrintOptions::ReadPrefs(nsIPrintSettin return NS_OK; } /** --------------------------------------------------- * See documentation in nsPrintOptionsImpl.h * @update 1/12/01 rods */ -nsresult +nsresult nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, uint32_t aFlags) { NS_ENSURE_ARG_POINTER(aPS); nsIntMargin margin; if (aFlags & nsIPrintSettings::kInitSaveMargins) { if (NS_SUCCEEDED(aPS->GetMarginInTwips(margin))) { @@ -791,17 +791,17 @@ nsPrintOptions::WritePrefs(nsIPrintSetti } } // Paper size prefs are saved as a group if (aFlags & nsIPrintSettings::kInitSavePaperSize) { int16_t sizeUnit; double width, height; char16_t *name; - + if ( NS_SUCCEEDED(aPS->GetPaperSizeUnit(&sizeUnit)) && NS_SUCCEEDED(aPS->GetPaperWidth(&width)) && NS_SUCCEEDED(aPS->GetPaperHeight(&height)) && NS_SUCCEEDED(aPS->GetPaperName(&name)) ) { DUMP_INT(kWriteStr, kPrintPaperSizeUnit, sizeUnit); Preferences::SetInt(GetPrefName(kPrintPaperSizeUnit, aPrinterName), @@ -1098,27 +1098,27 @@ nsPrintOptions::InitPrintSettingsFromPri aPrintSettings->SetIsInitializedFromPrinter(true); return rv; } #ifndef MOZ_X11 /** --------------------------------------------------- * Helper function - Returns either the name or sets the length to zero */ -static nsresult +static nsresult GetAdjustedPrinterName(nsIPrintSettings* aPS, bool aUsePNP, nsAString& aPrinterName) { NS_ENSURE_ARG_POINTER(aPS); aPrinterName.Truncate(); if (!aUsePNP) return NS_OK; - // Get the Printer Name from the PrintSettings + // Get the Printer Name from the PrintSettings // to use as a prefix for Pref Names char16_t* prtName = nullptr; nsresult rv = aPS->GetPrinterName(&prtName); NS_ENSURE_SUCCESS(rv, rv); aPrinterName = nsDependentString(prtName); @@ -1136,17 +1136,17 @@ GetAdjustedPrinterName(nsIPrintSettings* aPrinterName.Replace(i, 1, replSubstr); i++; } } return NS_OK; } #endif -NS_IMETHODIMP +NS_IMETHODIMP nsPrintOptions::InitPrintSettingsFromPrefs(nsIPrintSettings* aPS, bool aUsePNP, uint32_t aFlags) { NS_ENSURE_ARG_POINTER(aPS); bool isInitialized; aPS->GetIsInitializedFromPrefs(&isInitialized);
--- a/widget/nsTransferable.cpp +++ b/widget/nsTransferable.cpp @@ -7,33 +7,33 @@ Notes to self: - at some point, strings will be accessible from JS, so we won't have to wrap flavors in an nsISupportsCString. Until then, we're kinda stuck with this crappy API of nsISupportsArrays. */ - + #include "nsTransferable.h" #include "nsString.h" #include "nsReadableUtils.h" #include "nsTArray.h" #include "nsIFormatConverter.h" #include "nsIContentPolicy.h" #include "nsIComponentManager.h" #include "nsCOMPtr.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsMemory.h" #include "nsPrimitiveHelpers.h" #include "nsXPIDLString.h" #include "nsDirectoryServiceDefs.h" #include "nsDirectoryService.h" -#include "nsCRT.h" +#include "nsCRT.h" #include "nsNetUtil.h" #include "nsIDOMNode.h" #include "nsIOutputStream.h" #include "nsIInputStream.h" #include "nsIWeakReferenceUtils.h" #include "nsIFile.h" #include "nsILoadContext.h" #include "mozilla/UniquePtr.h" @@ -47,37 +47,37 @@ size_t GetDataForFlavor (const nsTArray< if (aArray[i].GetFlavor().Equals (aDataFlavor)) return i; } return aArray.NoIndex; } //------------------------------------------------------------------------- -DataStruct::~DataStruct() -{ - if (mCacheFileName) free(mCacheFileName); +DataStruct::~DataStruct() +{ + if (mCacheFileName) free(mCacheFileName); } //------------------------------------------------------------------------- void DataStruct::SetData ( nsISupports* aData, uint32_t aDataLen, bool aIsPrivateData ) { // Now, check to see if we consider the data to be "too large" // as well as ensuring that private browsing mode is disabled if (aDataLen > kLargeDatasetSize && !aIsPrivateData) { // if so, cache it to disk instead of memory if ( NS_SUCCEEDED(WriteCache(aData, aDataLen)) ) return; else - NS_WARNING("Oh no, couldn't write data to the cache file"); - } + NS_WARNING("Oh no, couldn't write data to the cache file"); + } mData = aData; - mDataLen = aDataLen; + mDataLen = aDataLen; } //------------------------------------------------------------------------- void DataStruct::GetData ( nsISupports** aData, uint32_t *aDataLen ) { // check here to see if the data is cached on disk @@ -89,44 +89,44 @@ DataStruct::GetData ( nsISupports** aDat else { // oh shit, something went horribly wrong here. NS_WARNING("Oh no, couldn't read data in from the cache file"); *aData = nullptr; *aDataLen = 0; return; } } - + *aData = mData; if ( mData ) - NS_ADDREF(*aData); + NS_ADDREF(*aData); *aDataLen = mDataLen; } //------------------------------------------------------------------------- already_AddRefed<nsIFile> DataStruct::GetFileSpec(const char* aFileName) { nsCOMPtr<nsIFile> cacheFile; NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(cacheFile)); - + if (!cacheFile) return nullptr; // if the param aFileName contains a name we should use that // because the file probably already exists // otherwise create a unique name if (!aFileName) { cacheFile->AppendNative(NS_LITERAL_CSTRING("clipboardcache")); cacheFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600); } else { cacheFile->AppendNative(nsDependentCString(aFileName)); } - + return cacheFile.forget(); } //------------------------------------------------------------------------- nsresult DataStruct::WriteCache(nsISupports* aData, uint32_t aDataLen) { @@ -182,22 +182,22 @@ DataStruct::ReadCache(nsISupports** aDat if (fileSize > max32) return NS_ERROR_OUT_OF_MEMORY; uint32_t size = uint32_t(fileSize); // create new memory for the large clipboard data auto data = mozilla::MakeUnique<char[]>(size); if ( !data ) return NS_ERROR_OUT_OF_MEMORY; - + // now read it all in nsCOMPtr<nsIInputStream> inStr; NS_NewLocalFileInputStream( getter_AddRefs(inStr), cacheFile); - + if (!cacheFile) return NS_ERROR_FAILURE; nsresult rv = inStr->Read(data.get(), fileSize, aDataLen); // make sure we got all the data ok if (NS_SUCCEEDED(rv) && *aDataLen == size) { nsPrimitiveHelpers::CreatePrimitiveForData(mFlavor.get(), data.get(), fileSize, aData); @@ -249,17 +249,17 @@ nsTransferable::Init(nsILoadContext* aCo mInitialized = true; #endif return NS_OK; } // // GetTransferDataFlavors // -// Returns a copy of the internal list of flavors. This does NOT take into +// Returns a copy of the internal list of flavors. This does NOT take into // account any converter that may be registered. This list consists of // nsISupportsCString objects so that the flavor list can be accessed from JS. // nsresult nsTransferable::GetTransferDataFlavors(nsISupportsArray ** aDataFlavorList) { MOZ_ASSERT(mInitialized); @@ -291,17 +291,17 @@ NS_IMETHODIMP nsTransferable::GetTransferData(const char *aFlavor, nsISupports **aData, uint32_t *aDataLen) { MOZ_ASSERT(mInitialized); NS_ENSURE_ARG_POINTER(aFlavor && aData && aDataLen); nsresult rv = NS_OK; nsCOMPtr<nsISupports> savedData; - + // first look and see if the data is present in one of the intrinsic flavors for (size_t i = 0; i < mDataArray.Length(); ++i) { DataStruct& data = mDataArray.ElementAt(i); if ( data.GetFlavor().Equals(aFlavor) ) { nsCOMPtr<nsISupports> dataBytes; uint32_t len; data.GetData(getter_AddRefs(dataBytes), &len); if (len == kFlavorHasDataProvider && dataBytes) { @@ -363,17 +363,17 @@ nsTransferable::GetTransferData(const ch } // // GetAnyTransferData // // Returns the data of the first flavor found. Caller is responsible for deleting the // flavor string. -// +// NS_IMETHODIMP nsTransferable::GetAnyTransferData(char **aFlavor, nsISupports **aData, uint32_t *aDataLen) { MOZ_ASSERT(mInitialized); NS_ENSURE_ARG_POINTER(aFlavor && aData && aDataLen); for (size_t i = 0; i < mDataArray.Length(); ++i) { @@ -388,17 +388,17 @@ nsTransferable::GetAnyTransferData(char return NS_ERROR_FAILURE; } // // SetTransferData // // -// +// NS_IMETHODIMP nsTransferable::SetTransferData(const char *aFlavor, nsISupports *aData, uint32_t aDataLen) { MOZ_ASSERT(mInitialized); NS_ENSURE_ARG(aFlavor); // first check our intrinsic flavors to see if one has been registered. @@ -426,26 +426,26 @@ nsTransferable::SetTransferData(const ch } } } // Can't set data neither directly nor through converter. Just add this flavor and try again nsresult result = NS_ERROR_FAILURE; if ( NS_SUCCEEDED(AddDataFlavor(aFlavor)) ) result = SetTransferData (aFlavor, aData, aDataLen); - + return result; } // // AddDataFlavor // // Adds a data flavor to our list with no data. Error if it already exists. -// +// NS_IMETHODIMP nsTransferable::AddDataFlavor(const char *aDataFlavor) { MOZ_ASSERT(mInitialized); if (GetDataForFlavor (mDataArray, aDataFlavor) != mDataArray.NoIndex) return NS_ERROR_FAILURE; @@ -472,45 +472,45 @@ nsTransferable::RemoveDataFlavor(const c mDataArray.RemoveElementAt (idx); return NS_OK; } return NS_ERROR_FAILURE; } /** - * + * * */ NS_IMETHODIMP nsTransferable::IsLargeDataSet(bool *_retval) { MOZ_ASSERT(mInitialized); NS_ENSURE_ARG_POINTER(_retval); *_retval = false; return NS_OK; } /** - * + * * */ NS_IMETHODIMP nsTransferable::SetConverter(nsIFormatConverter * aConverter) { MOZ_ASSERT(mInitialized); mFormatConv = aConverter; return NS_OK; } /** - * + * * */ NS_IMETHODIMP nsTransferable::GetConverter(nsIFormatConverter * *aConverter) { MOZ_ASSERT(mInitialized); NS_ENSURE_ARG_POINTER(aConverter); *aConverter = mFormatConv; @@ -526,17 +526,17 @@ NS_IMETHODIMP nsTransferable::GetConvert // intrinsic knowledge or input data converters. // NS_IMETHODIMP nsTransferable::FlavorsTransferableCanImport(nsISupportsArray **_retval) { MOZ_ASSERT(mInitialized); NS_ENSURE_ARG_POINTER(_retval); - + // Get the flavor list, and on to the end of it, append the list of flavors we // can also get to through a converter. This is so that we can just walk the list // in one go, looking for the desired flavor. GetTransferDataFlavors(_retval); // addrefs nsCOMPtr<nsIFormatConverter> converter; GetConverter(getter_AddRefs(converter)); if ( converter ) { nsCOMPtr<nsISupportsArray> convertedList; @@ -556,33 +556,33 @@ nsTransferable::FlavorsTransferableCanIm if (GetDataForFlavor (mDataArray, flavorStr.get()) == mDataArray.NoIndex) // Don't append if already in intrinsic list (*_retval)->AppendElement (genericFlavor); } // foreach flavor that can be converted to } } // if a converter exists - return NS_OK; + return NS_OK; } // FlavorsTransferableCanImport // // FlavorsTransferableCanExport // // Computes a list of flavors that the transferable can export, either through // intrinsic knowledge or output data converters. // NS_IMETHODIMP nsTransferable::FlavorsTransferableCanExport(nsISupportsArray **_retval) { MOZ_ASSERT(mInitialized); NS_ENSURE_ARG_POINTER(_retval); - + // Get the flavor list, and on to the end of it, append the list of flavors we // can also get to through a converter. This is so that we can just walk the list // in one go, looking for the desired flavor. GetTransferDataFlavors(_retval); // addrefs nsCOMPtr<nsIFormatConverter> converter; GetConverter(getter_AddRefs(converter)); if ( converter ) { nsCOMPtr<nsISupportsArray> convertedList;
--- a/widget/windows/AudioSession.cpp +++ b/widget/windows/AudioSession.cpp @@ -21,17 +21,17 @@ #include "nsXULAppAPI.h" #include "mozilla/Attributes.h" #include <objbase.h> namespace mozilla { namespace widget { -/* +/* * To take advantage of what Vista+ have to offer with respect to audio, * we need to maintain an audio session. This class wraps IAudioSessionControl * and implements IAudioSessionEvents (for callbacks from Windows) */ class AudioSession final : public IAudioSessionEvents { private: AudioSession(); ~AudioSession(); @@ -196,17 +196,17 @@ AudioSession::Start() // Content processes should be CLONED if (XRE_IsContentProcess()) { return NS_ERROR_FAILURE; } MOZ_ASSERT(XRE_IsParentProcess(), "Should only get here in a chrome process!"); - nsCOMPtr<nsIStringBundleService> bundleService = + nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID); NS_ENSURE_TRUE(bundleService, NS_ERROR_FAILURE); nsCOMPtr<nsIStringBundle> bundle; bundleService->CreateBundle("chrome://branding/locale/brand.properties", getter_AddRefs(bundle)); NS_ENSURE_TRUE(bundle, NS_ERROR_FAILURE); bundle->GetStringFromName(u"brandFullName",
--- a/widget/windows/JumpListBuilder.cpp +++ b/widget/windows/JumpListBuilder.cpp @@ -43,17 +43,17 @@ NS_IMPL_ISUPPORTS(JumpListBuilder, nsIJu #define TOPIC_PROFILE_BEFORE_CHANGE "profile-before-change" #define TOPIC_CLEAR_PRIVATE_DATA "clear-private-data" JumpListBuilder::JumpListBuilder() : mMaxItems(0), mHasCommit(false) { ::CoInitialize(nullptr); - + CoCreateInstance(CLSID_DestinationList, nullptr, CLSCTX_INPROC_SERVER, IID_ICustomDestinationList, getter_AddRefs(mJumpListMgr)); // Make a lazy thread for any IO mIOThread = new LazyIdleThread(DEFAULT_THREAD_TIMEOUT_MS, NS_LITERAL_CSTRING("Jump List"), LazyIdleThread::ManualShutdown); Preferences::AddStrongObserver(this, kPrefTaskbarEnabled); @@ -143,22 +143,22 @@ NS_IMETHODIMP JumpListBuilder::InitListB sBuildingList = true; *_retval = true; return NS_OK; } return NS_OK; } -// Ensures that we don't have old ICO files that aren't in our jump lists +// Ensures that we don't have old ICO files that aren't in our jump lists // anymore left over in the cache. -nsresult JumpListBuilder::RemoveIconCacheForItems(nsIMutableArray *items) +nsresult JumpListBuilder::RemoveIconCacheForItems(nsIMutableArray *items) { NS_ENSURE_ARG_POINTER(items); - + nsresult rv; uint32_t length; items->GetLength(&length); for (uint32_t i = 0; i < length; ++i) { //Obtain an IJumpListItem and get the type nsCOMPtr<nsIJumpListItem> item = do_QueryElementAt(items, i); if (!item) { @@ -171,24 +171,24 @@ nsresult JumpListBuilder::RemoveIconCach // If the item is a shortcut, remove its associated icon if any if (type == nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT) { nsCOMPtr<nsIJumpListShortcut> shortcut = do_QueryInterface(item); if (shortcut) { nsCOMPtr<nsIURI> uri; rv = shortcut->GetFaviconPageUri(getter_AddRefs(uri)); if (NS_SUCCEEDED(rv) && uri) { - + // The local file path is stored inside the nsIURI // Get the nsIURI spec which stores the local path for the icon to remove nsAutoCString spec; nsresult rv = uri->GetSpec(spec); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr<nsIRunnable> event + nsCOMPtr<nsIRunnable> event = new mozilla::widget::AsyncDeleteIconFromDisk(NS_ConvertUTF8toUTF16(spec)); mIOThread->Dispatch(event, NS_DISPATCH_NORMAL); // The shortcut was generated from an IShellLinkW so IShellLinkW can // only tell us what the original icon is and not the URI. // So this field was used only temporarily as the actual icon file // path. It should be cleared. shortcut->SetFaviconPageUri(nullptr); @@ -197,30 +197,30 @@ nsresult JumpListBuilder::RemoveIconCach } } // end for return NS_OK; } // Ensures that we have no old ICO files left in the jump list cache -nsresult JumpListBuilder::RemoveIconCacheForAllItems() +nsresult JumpListBuilder::RemoveIconCacheForAllItems() { // Construct the path of our jump list cache nsCOMPtr<nsIFile> jumpListCacheDir; - nsresult rv = NS_GetSpecialDirectory("ProfLDS", + nsresult rv = NS_GetSpecialDirectory("ProfLDS", getter_AddRefs(jumpListCacheDir)); NS_ENSURE_SUCCESS(rv, rv); rv = jumpListCacheDir->AppendNative(nsDependentCString( mozilla::widget::FaviconHelper::kJumpListCacheDir)); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsISimpleEnumerator> entries; rv = jumpListCacheDir->GetDirectoryEntries(getter_AddRefs(entries)); NS_ENSURE_SUCCESS(rv, rv); - + // Loop through each directory entry and remove all ICO files found do { bool hasMore = false; if (NS_FAILED(entries->HasMoreElements(&hasMore)) || !hasMore) break; nsCOMPtr<nsISupports> supp; if (NS_FAILED(entries->GetNext(getter_AddRefs(supp)))) @@ -269,17 +269,17 @@ NS_IMETHODIMP JumpListBuilder::AddListTo // Build the list uint32_t length; items->GetLength(&length); for (uint32_t i = 0; i < length; ++i) { nsCOMPtr<nsIJumpListItem> item = do_QueryElementAt(items, i); if (!item) continue; - // Check for separators + // Check for separators if (IsSeparator(item)) { RefPtr<IShellLinkW> link; rv = JumpListSeparator::GetSeparator(link); if (NS_FAILED(rv)) return rv; collection->AddObject(link); continue; } @@ -449,17 +449,17 @@ NS_IMETHODIMP JumpListBuilder::DeleteAct /* internal */ bool JumpListBuilder::IsSeparator(nsCOMPtr<nsIJumpListItem>& item) { int16_t type; item->GetType(&type); if (NS_FAILED(item->GetType(&type))) return false; - + if (type == nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR) return true; return false; } // TransferIObjectArrayToIMutableArray - used in converting removed items // to our objects. nsresult JumpListBuilder::TransferIObjectArrayToIMutableArray(IObjectArray *objArray, nsIMutableArray *removedItems) @@ -474,25 +474,25 @@ nsresult JumpListBuilder::TransferIObjec nsCOMPtr<nsIJumpListItem> item; for (uint32_t idx = 0; idx < count; idx++) { IShellLinkW * pLink = nullptr; IShellItem * pItem = nullptr; if (SUCCEEDED(objArray->GetAt(idx, IID_IShellLinkW, (LPVOID*)&pLink))) { - nsCOMPtr<nsIJumpListShortcut> shortcut = + nsCOMPtr<nsIJumpListShortcut> shortcut = do_CreateInstance(kJumpListShortcutCID, &rv); if (NS_FAILED(rv)) return NS_ERROR_UNEXPECTED; rv = JumpListShortcut::GetJumpListShortcut(pLink, shortcut); item = do_QueryInterface(shortcut); } else if (SUCCEEDED(objArray->GetAt(idx, IID_IShellItem, (LPVOID*)&pItem))) { - nsCOMPtr<nsIJumpListLink> link = + nsCOMPtr<nsIJumpListLink> link = do_CreateInstance(kJumpListLinkCID, &rv); if (NS_FAILED(rv)) return NS_ERROR_UNEXPECTED; rv = JumpListLink::GetJumpListLink(pItem, link); item = do_QueryInterface(link); } if (pLink) @@ -518,18 +518,18 @@ NS_IMETHODIMP JumpListBuilder::Observe(n if (observerService) { observerService->RemoveObserver(this, TOPIC_PROFILE_BEFORE_CHANGE); } mIOThread->Shutdown(); } else if (strcmp(aTopic, "nsPref:changed") == 0 && nsDependentString(aData).EqualsASCII(kPrefTaskbarEnabled)) { bool enabled = Preferences::GetBool(kPrefTaskbarEnabled, true); if (!enabled) { - - nsCOMPtr<nsIRunnable> event = + + nsCOMPtr<nsIRunnable> event = new mozilla::widget::AsyncDeleteAllFaviconsFromDisk(); mIOThread->Dispatch(event, NS_DISPATCH_NORMAL); } } else if (strcmp(aTopic, TOPIC_CLEAR_PRIVATE_DATA) == 0) { // Delete JumpListCache icons from Disk, if any. nsCOMPtr<nsIRunnable> event = new mozilla::widget::AsyncDeleteAllFaviconsFromDisk(false); mIOThread->Dispatch(event, NS_DISPATCH_NORMAL);
--- a/widget/windows/JumpListItem.h +++ b/widget/windows/JumpListItem.h @@ -100,33 +100,33 @@ public: {} NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut, JumpListItem) NS_IMETHOD GetType(int16_t *aType) override { return JumpListItem::GetType(aType); } NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval) override; NS_DECL_NSIJUMPLISTSHORTCUT - static nsresult GetShellLink(nsCOMPtr<nsIJumpListItem>& item, - RefPtr<IShellLinkW>& aShellLink, + static nsresult GetShellLink(nsCOMPtr<nsIJumpListItem>& item, + RefPtr<IShellLinkW>& aShellLink, nsCOMPtr<nsIThread> &aIOThread); static nsresult GetJumpListShortcut(IShellLinkW *pLink, nsCOMPtr<nsIJumpListShortcut>& aShortcut); - static nsresult GetOutputIconPath(nsCOMPtr<nsIURI> aFaviconPageURI, + static nsresult GetOutputIconPath(nsCOMPtr<nsIURI> aFaviconPageURI, nsCOMPtr<nsIFile> &aICOFile); protected: int32_t mIconIndex; nsCOMPtr<nsIURI> mFaviconPageURI; nsCOMPtr<nsILocalHandlerApp> mHandlerApp; bool ExecutableExists(nsCOMPtr<nsILocalHandlerApp>& handlerApp); - static nsresult ObtainCachedIconFile(nsCOMPtr<nsIURI> aFaviconPageURI, + static nsresult ObtainCachedIconFile(nsCOMPtr<nsIURI> aFaviconPageURI, nsString &aICOFilePath, nsCOMPtr<nsIThread> &aIOThread); - static nsresult CacheIconFileFromFaviconURIAsync(nsCOMPtr<nsIURI> aFaviconPageURI, + static nsresult CacheIconFileFromFaviconURIAsync(nsCOMPtr<nsIURI> aFaviconPageURI, nsCOMPtr<nsIFile> aICOFile, nsCOMPtr<nsIThread> &aIOThread); }; } // namespace widget } // namespace mozilla #endif /* __JumpListItem_h__ */
--- a/widget/windows/TSFTextStore.h +++ b/widget/windows/TSFTextStore.h @@ -670,17 +670,17 @@ protected: if (!IsPendingCompositionUpdateIncomplete()) { return; } RecordCompositionUpdateAction(); } // When On*Composition() is called without document lock, we need to flush // the recorded actions at quitting the method. - // AutoPendingActionAndContentFlusher class is usedful for it. + // AutoPendingActionAndContentFlusher class is usedful for it. class MOZ_STACK_CLASS AutoPendingActionAndContentFlusher final { public: AutoPendingActionAndContentFlusher(TSFTextStore* aTextStore) : mTextStore(aTextStore) { MOZ_ASSERT(!mTextStore->mIsRecordingActionsWithoutLock); if (!mTextStore->IsReadWriteLocked()) { @@ -861,17 +861,17 @@ protected: return false; } return aOffset >= static_cast<uint32_t>(mStart) && aOffset < static_cast<uint32_t>(mStart + mLength); } DWORD Cookie() const { return mCookie; } bool OnMouseButtonEvent(ULONG aEdge, ULONG aQuadrant, DWORD aButtonStatus); LONG RangeStart() const { return mStart; } - + private: RefPtr<ITfMouseSink> mSink; LONG mStart; LONG mLength; DWORD mCookie; }; // mMouseTrackers is an array to store each information of installed // ITfMouseSink instance.
--- a/widget/windows/TaskbarPreviewButton.h +++ b/widget/windows/TaskbarPreviewButton.h @@ -20,17 +20,17 @@ namespace mozilla { namespace widget { class TaskbarWindowPreview; class TaskbarPreviewButton : public nsITaskbarPreviewButton, public nsSupportsWeakReference { virtual ~TaskbarPreviewButton(); -public: +public: TaskbarPreviewButton(TaskbarWindowPreview* preview, uint32_t index); NS_DECL_ISUPPORTS NS_DECL_NSITASKBARPREVIEWBUTTON private: THUMBBUTTON& Button(); nsresult Update();
--- a/widget/windows/WidgetTraceEvent.cpp +++ b/widget/windows/WidgetTraceEvent.cpp @@ -55,17 +55,17 @@ public: nsCOMPtr<nsIDocShell> docShell; rv = hiddenWindow->GetDocShell(getter_AddRefs(docShell)); if (NS_FAILED(rv) || !docShell) { return rv; } nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(docShell)); - + if (!baseWindow) return NS_ERROR_FAILURE; nsCOMPtr<nsIWidget> widget; baseWindow->GetMainWidget(getter_AddRefs(widget)); if (!widget) return NS_ERROR_FAILURE;
--- a/widget/windows/WinTaskbar.cpp +++ b/widget/windows/WinTaskbar.cpp @@ -52,17 +52,17 @@ GetHWNDFromDocShell(nsIDocShell *aShell) return widget ? (HWND)widget->GetNativeData(NS_NATIVE_WINDOW) : nullptr; } HWND GetHWNDFromDOMWindow(mozIDOMWindow *dw) { nsCOMPtr<nsIWidget> widget; - if (!dw) + if (!dw) return nullptr; nsCOMPtr<nsPIDOMWindowInner> window = nsPIDOMWindowInner::From(dw); return GetHWNDFromDocShell(window->GetDocShell()); } nsresult SetWindowAppUserModelProp(mozIDOMWindow *aParent, @@ -120,17 +120,17 @@ SetWindowAppUserModelProp(mozIDOMWindow /////////////////////////////////////////////////////////////////////////////// // default nsITaskbarPreviewController class DefaultController final : public nsITaskbarPreviewController { ~DefaultController() {} HWND mWnd; public: - DefaultController(HWND hWnd) + DefaultController(HWND hWnd) : mWnd(hWnd) { } NS_DECL_ISUPPORTS NS_DECL_NSITASKBARPREVIEWCONTROLLER }; @@ -236,17 +236,17 @@ WinTaskbar::Initialize() { // This may fail with shell extensions like blackbox installed. NS_WARNING("Unable to initialize taskbar"); NS_RELEASE(mTaskbar); return false; } return true; } -WinTaskbar::WinTaskbar() +WinTaskbar::WinTaskbar() : mTaskbar(nullptr) { } WinTaskbar::~WinTaskbar() { if (mTaskbar) { // match successful Initialize() call NS_RELEASE(mTaskbar); ::CoUninitialize(); } @@ -451,17 +451,17 @@ WinTaskbar::GetOverlayIconController(nsI NS_IMETHODIMP WinTaskbar::CreateJumpListBuilder(nsIJumpListBuilder * *aJumpListBuilder) { nsresult rv; if (JumpListBuilder::sBuildingList) return NS_ERROR_ALREADY_INITIALIZED; - nsCOMPtr<nsIJumpListBuilder> builder = + nsCOMPtr<nsIJumpListBuilder> builder = do_CreateInstance(kJumpListBuilderCID, &rv); if (NS_FAILED(rv)) return NS_ERROR_UNEXPECTED; NS_IF_ADDREF(*aJumpListBuilder = builder); return NS_OK; } @@ -474,28 +474,28 @@ WinTaskbar::SetGroupIdForWindow(mozIDOMW NS_IMETHODIMP WinTaskbar::PrepareFullScreen(mozIDOMWindow *aWindow, bool aFullScreen) { NS_ENSURE_ARG_POINTER(aWindow); HWND toplevelHWND = ::GetAncestor(GetHWNDFromDOMWindow(aWindow), GA_ROOT); if (!toplevelHWND) return NS_ERROR_INVALID_ARG; - + return PrepareFullScreenHWND(toplevelHWND, aFullScreen); } NS_IMETHODIMP WinTaskbar::PrepareFullScreenHWND(void *aHWND, bool aFullScreen) { if (!Initialize()) return NS_ERROR_NOT_AVAILABLE; NS_ENSURE_ARG_POINTER(aHWND); - if (!::IsWindow((HWND)aHWND)) + if (!::IsWindow((HWND)aHWND)) return NS_ERROR_INVALID_ARG; HRESULT hr = mTaskbar->MarkFullscreenWindow((HWND)aHWND, aFullScreen); if (FAILED(hr)) { return NS_ERROR_UNEXPECTED; } return NS_OK;
--- a/widget/windows/WinUtils.h +++ b/widget/windows/WinUtils.h @@ -287,18 +287,18 @@ public: * | | TRUE | * a pupup window (WS_POPUP) | * | | | * an owned top level window (like dialog) | * | aStopIfNotChild +-------+-----------------------+-----------------------+ * | | | * independent window | * only an independent | * | | FALSE | * non-popup-owned- | top level window | * | | | window like dialog | | * +-----------------+-------+-----------------------+-----------------------+ */ - static HWND GetTopLevelHWND(HWND aWnd, - bool aStopIfNotChild = false, + static HWND GetTopLevelHWND(HWND aWnd, + bool aStopIfNotChild = false, bool aStopIfNotPopup = true); /** * SetNSWindowBasePtr() associates an nsWindowBase to aWnd. If aWidget is * nullptr, it dissociate any nsBaseWidget pointer from aWnd. * GetNSWindowBasePtr() returns an nsWindowBase pointer which was associated by * SetNSWindowBasePtr(). * GetNSWindowPtr() is a legacy api for win32 nsWindow and should be avoided @@ -529,19 +529,19 @@ private: }; #ifdef MOZ_PLACES class AsyncFaviconDataReady final : public nsIFaviconDataCallback { public: NS_DECL_ISUPPORTS NS_DECL_NSIFAVICONDATACALLBACK - - AsyncFaviconDataReady(nsIURI *aNewURI, - nsCOMPtr<nsIThread> &aIOThread, + + AsyncFaviconDataReady(nsIURI *aNewURI, + nsCOMPtr<nsIThread> &aIOThread, const bool aURLShortcut); nsresult OnFaviconDataNotAvailable(void); private: ~AsyncFaviconDataReady() {} nsCOMPtr<nsIURI> mNewURI; nsCOMPtr<nsIThread> mIOThread; const bool mURLShortcut; @@ -609,25 +609,25 @@ class FaviconHelper public: static const char kJumpListCacheDir[]; static const char kShortcutCacheDir[]; static nsresult ObtainCachedIconFile(nsCOMPtr<nsIURI> aFaviconPageURI, nsString &aICOFilePath, nsCOMPtr<nsIThread> &aIOThread, bool aURLShortcut); - static nsresult HashURI(nsCOMPtr<nsICryptoHash> &aCryptoHash, + static nsresult HashURI(nsCOMPtr<nsICryptoHash> &aCryptoHash, nsIURI *aUri, nsACString& aUriHash); static nsresult GetOutputIconPath(nsCOMPtr<nsIURI> aFaviconPageURI, nsCOMPtr<nsIFile> &aICOFile, bool aURLShortcut); - static nsresult + static nsresult CacheIconFileFromFaviconURIAsync(nsCOMPtr<nsIURI> aFaviconPageURI, nsCOMPtr<nsIFile> aICOFile, nsCOMPtr<nsIThread> &aIOThread, bool aURLShortcut); static int32_t GetICOCacheSecondsTimeout(); };
--- a/widget/windows/nsDataObjCollection.h +++ b/widget/windows/nsDataObjCollection.h @@ -17,25 +17,25 @@ #define MULTI_MIME "Mozilla/IDataObjectCollectionFormat" EXTERN_C const IID IID_IDataObjCollection; // An interface to make sure we have the right kind of object for D&D // this way we can filter out collection objects that aren't ours class nsIDataObjCollection : public IUnknown { public: - + }; /* * This ole registered class is used to facilitate drag-drop of objects which * can be adapted by an object derived from CfDragDrop. The CfDragDrop is * associated with instances via SetDragDrop(). */ - + class nsDataObjCollection final : public nsIDataObjCollection, public nsDataObj { public: nsDataObjCollection(); ~nsDataObjCollection(); public: // IUnknown methods - see iunknown.h for documentation STDMETHODIMP_(ULONG) AddRef ();
--- a/widget/windows/nsDeviceContextSpecWin.cpp +++ b/widget/windows/nsDeviceContextSpecWin.cpp @@ -193,17 +193,17 @@ NS_IMETHODIMP nsDeviceContextSpecWin::In // If there is no name then use the default printer if (!printerName || (printerName && !*printerName)) { printerName = GetDefaultPrinterNameFromGlobalPrinters(); } NS_ASSERTION(printerName, "We have to have a printer name"); if (!printerName || !*printerName) return rv; - + return GetDataFromPrinter(printerName, mPrintSettings); } //---------------------------------------------------------- // Helper Function - Free and reallocate the string static void CleanAndCopyString(wchar_t*& aStr, const wchar_t* aNewStr) { if (aStr != nullptr) { @@ -313,23 +313,23 @@ void nsDeviceContextSpecWin::SetDevMode( if (mDevMode) { ::HeapFree(::GetProcessHeap(), 0, mDevMode); } mDevMode = aDevMode; } //------------------------------------------------------------------ -void +void nsDeviceContextSpecWin::GetDevMode(LPDEVMODEW &aDevMode) { aDevMode = mDevMode; } -#define DISPLAY_LAST_ERROR +#define DISPLAY_LAST_ERROR //---------------------------------------------------------------------------------- // Setup the object's data member with the selected printer's data nsresult nsDeviceContextSpecWin::GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* aPS) { nsresult rv = NS_ERROR_FAILURE; @@ -339,17 +339,17 @@ nsDeviceContextSpecWin::GetDataFromPrint PR_PL(("***** nsDeviceContextSpecWin::GetDataFromPrinter - Couldn't enumerate printers!\n")); DISPLAY_LAST_ERROR } NS_ENSURE_SUCCESS(rv, rv); } HANDLE hPrinter = nullptr; wchar_t *name = (wchar_t*)aName; // Windows APIs use non-const name argument - + BOOL status = ::OpenPrinterW(name, &hPrinter, nullptr); if (status) { LPDEVMODEW pDevMode; DWORD dwNeeded, dwRet; // Allocate a buffer of the correct size. dwNeeded = ::DocumentPropertiesW(nullptr, hPrinter, name, nullptr, nullptr, 0); @@ -421,27 +421,27 @@ nsPrinterEnumeratorWin::~nsPrinterEnumer // Do not free printers here // GlobalPrinters::GetInstance()->FreeGlobalPrinters(); } NS_IMPL_ISUPPORTS(nsPrinterEnumeratorWin, nsIPrinterEnumerator) //---------------------------------------------------------------------------------- // Return the Default Printer name -NS_IMETHODIMP +NS_IMETHODIMP nsPrinterEnumeratorWin::GetDefaultPrinterName(char16_t * *aDefaultPrinterName) { NS_ENSURE_ARG_POINTER(aDefaultPrinterName); *aDefaultPrinterName = GetDefaultPrinterNameFromGlobalPrinters(); // helper return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsPrinterEnumeratorWin::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, nsIPrintSettings *aPrintSettings) { NS_ENSURE_ARG_POINTER(aPrinterName); NS_ENSURE_ARG_POINTER(aPrintSettings); if (!*aPrinterName) { return NS_OK; } @@ -493,17 +493,17 @@ nsPrinterEnumeratorWin::InitPrintSetting return NS_OK; } //---------------------------------------------------------------------------------- // Enumerate all the Printers from the global array and pass their // names back (usually to script) -NS_IMETHODIMP +NS_IMETHODIMP nsPrinterEnumeratorWin::GetPrinterNameList(nsIStringEnumerator **aPrinterNameList) { NS_ENSURE_ARG_POINTER(aPrinterNameList); *aPrinterNameList = nullptr; nsresult rv = GlobalPrinters::GetInstance()->EnumeratePrinterList(); if (NS_FAILED(rv)) { PR_PL(("***** nsDeviceContextSpecWin::GetPrinterNameList - Couldn't enumerate printers!\n")); @@ -525,48 +525,48 @@ nsPrinterEnumeratorWin::GetPrinterNameLi } //---------------------------------------------------------------------------------- //-- Global Printers //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- // THe array hold the name and port for each printer -void +void GlobalPrinters::ReallocatePrinters() { if (PrintersAreAllocated()) { FreeGlobalPrinters(); } mPrinters = new nsTArray<LPWSTR>(); NS_ASSERTION(mPrinters, "Printers Array is NULL!"); } //---------------------------------------------------------------------------------- -void +void GlobalPrinters::FreeGlobalPrinters() { if (mPrinters != nullptr) { for (uint32_t i=0;i<mPrinters->Length();i++) { free(mPrinters->ElementAt(i)); } delete mPrinters; mPrinters = nullptr; } } //---------------------------------------------------------------------------------- -nsresult +nsresult GlobalPrinters::EnumerateNativePrinters() { nsresult rv = NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE; PR_PL(("-----------------------\n")); PR_PL(("EnumerateNativePrinters\n")); - WCHAR szDefaultPrinterName[1024]; + WCHAR szDefaultPrinterName[1024]; DWORD status = GetProfileStringW(L"devices", 0, L",", szDefaultPrinterName, ArrayLength(szDefaultPrinterName)); if (status > 0) { DWORD count = 0; LPWSTR sPtr = szDefaultPrinterName; LPWSTR ePtr = szDefaultPrinterName + status; LPWSTR prvPtr = sPtr; @@ -583,44 +583,44 @@ GlobalPrinters::EnumerateNativePrinters( rv = NS_OK; } PR_PL(("-----------------------\n")); return rv; } //------------------------------------------------------------------ // Uses the GetProfileString to get the default printer from the registry -void +void GlobalPrinters::GetDefaultPrinterName(nsString& aDefaultPrinterName) { aDefaultPrinterName.Truncate(); - WCHAR szDefaultPrinterName[1024]; + WCHAR szDefaultPrinterName[1024]; DWORD status = GetProfileStringW(L"windows", L"device", 0, szDefaultPrinterName, ArrayLength(szDefaultPrinterName)); if (status > 0) { WCHAR comma = ','; LPWSTR sPtr = szDefaultPrinterName; - while (*sPtr != comma && *sPtr != 0) + while (*sPtr != comma && *sPtr != 0) sPtr++; if (*sPtr == comma) { *sPtr = 0; } aDefaultPrinterName = szDefaultPrinterName; } else { aDefaultPrinterName = EmptyString(); } PR_PL(("DEFAULT PRINTER [%s]\n", aDefaultPrinterName.get())); } //---------------------------------------------------------------------------------- // This goes and gets the list of available printers and puts // the default printer at the beginning of the list -nsresult +nsresult GlobalPrinters::EnumeratePrinterList() { // reallocate and get a new list each time it is asked for // this deletes the list and re-allocates them ReallocatePrinters(); // any of these could only fail with an OUT_MEMORY_ERROR // PRINTER_ENUM_LOCAL should get the network printers on Win95
--- a/widget/windows/nsDragService.cpp +++ b/widget/windows/nsDragService.cpp @@ -68,17 +68,17 @@ bool nsDragService::CreateDragImage(nsIDOMNode *aDOMNode, nsIScriptableRegion *aRegion, SHDRAGIMAGE *psdi) { if (!psdi) return false; memset(psdi, 0, sizeof(SHDRAGIMAGE)); - if (!aDOMNode) + if (!aDOMNode) return false; // Prepare the drag image nsIntRect dragRect; RefPtr<SourceSurface> surface; nsPresContext* pc; DrawDrag(aDOMNode, aRegion, mScreenX, mScreenY, @@ -132,17 +132,17 @@ nsDragService::CreateDragImage(nsIDOMNod bmih.bV5RedMask = 0x00FF0000; bmih.bV5GreenMask = 0x0000FF00; bmih.bV5BlueMask = 0x000000FF; bmih.bV5AlphaMask = 0xFF000000; HDC hdcSrc = CreateCompatibleDC(nullptr); void *lpBits = nullptr; if (hdcSrc) { - psdi->hbmpDragImage = + psdi->hbmpDragImage = ::CreateDIBSection(hdcSrc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (void**)&lpBits, nullptr, 0); if (psdi->hbmpDragImage && lpBits) { CopySurfaceDataToPackedArray(map.mData, static_cast<uint8_t*>(lpBits), dataSurface->GetSize(), map.mStride, BytesPerPixel(dataSurface->GetFormat())); } @@ -292,31 +292,31 @@ nsDragService::StartInvokingDragSession( } else { NS_NOTREACHED("When did our data object stop being async"); } // Call the native D&D method HRESULT res = ::DoDragDrop(aDataObj, nativeDragSrc, effects, &winDropRes); // In cases where the drop operation completed outside the application, update - // the source node's nsIDOMDataTransfer dropEffect value so it is up to date. + // the source node's nsIDOMDataTransfer dropEffect value so it is up to date. if (!mSentLocalDropEvent) { uint32_t dropResult; // Order is important, since multiple flags can be returned. if (winDropRes & DROPEFFECT_COPY) dropResult = DRAGDROP_ACTION_COPY; else if (winDropRes & DROPEFFECT_LINK) dropResult = DRAGDROP_ACTION_LINK; else if (winDropRes & DROPEFFECT_MOVE) dropResult = DRAGDROP_ACTION_MOVE; else dropResult = DRAGDROP_ACTION_NONE; - + if (mDataTransfer) { - if (res == DRAGDROP_S_DROP) // Success + if (res == DRAGDROP_S_DROP) // Success mDataTransfer->SetDropEffectInt(dropResult); else mDataTransfer->SetDropEffectInt(DRAGDROP_ACTION_NONE); } } mUserCancelled = nativeDragSrc->UserCancelled(); @@ -368,17 +368,17 @@ nsDragService::GetNumDropItems(uint32_t if (IsCollectionObject(mDataObject)) { nsDataObjCollection * dataObjCol = GetDataObjCollection(mDataObject); if (dataObjCol) { *aNumItems = dataObjCol->GetNumDataObjects(); } else { // If the count cannot be determined just return 0. - // This can happen if we have collection data of type + // This can happen if we have collection data of type // MULTI_MIME ("Mozilla/IDataObjectCollectionFormat") on the clipboard // from another process but we can't obtain an IID_IDataObjCollection // from this process. *aNumItems = 0; } } else { // Next check if we have a file drop. Return the number of files in
--- a/widget/windows/nsFilePicker.h +++ b/widget/windows/nsFilePicker.h @@ -53,33 +53,33 @@ protected: */ class nsFilePicker : public IFileDialogEvents, public nsBaseWinFilePicker { virtual ~nsFilePicker(); public: - nsFilePicker(); + nsFilePicker(); NS_IMETHOD Init(mozIDOMWindowProxy *aParent, const nsAString& aTitle, int16_t aMode); - + NS_DECL_ISUPPORTS - + // IUnknown's QueryInterface STDMETHODIMP QueryInterface(REFIID refiid, void** ppvResult); // nsIFilePicker (less what's in nsBaseFilePicker and nsBaseWinFilePicker) NS_IMETHOD GetFilterIndex(int32_t *aFilterIndex); NS_IMETHOD SetFilterIndex(int32_t aFilterIndex); NS_IMETHOD GetFile(nsIFile * *aFile); NS_IMETHOD GetFileURL(nsIURI * *aFileURL); NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); - NS_IMETHOD Show(int16_t *aReturnVal); - NS_IMETHOD ShowW(int16_t *aReturnVal); + NS_IMETHOD Show(int16_t *aReturnVal); + NS_IMETHOD ShowW(int16_t *aReturnVal); NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter); // IFileDialogEvents HRESULT STDMETHODCALLTYPE OnFileOk(IFileDialog *pfd); HRESULT STDMETHODCALLTYPE OnFolderChanging(IFileDialog *pfd, IShellItem *psiFolder); HRESULT STDMETHODCALLTYPE OnFolderChange(IFileDialog *pfd); HRESULT STDMETHODCALLTYPE OnSelectionChange(IFileDialog *pfd); HRESULT STDMETHODCALLTYPE OnShareViolation(IFileDialog *pfd, IShellItem *psi, FDE_SHAREVIOLATION_RESPONSE *pResponse); @@ -126,29 +126,29 @@ protected: static char16_t *mLastUsedUnicodeDirectory; HWND mDlgWnd; class ComDlgFilterSpec { public: ComDlgFilterSpec() {} ~ComDlgFilterSpec() {} - + const uint32_t Length() { return mSpecList.Length(); } const bool IsEmpty() { return (mSpecList.Length() == 0); } const COMDLG_FILTERSPEC* get() { return mSpecList.Elements(); } - + void Append(const nsAString& aTitle, const nsAString& aFilter); private: AutoTArray<COMDLG_FILTERSPEC, 1> mSpecList; AutoTArray<nsString, 2> mStrings; }; ComDlgFilterSpec mComFilterList; DWORD mFDECookie;
--- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -476,17 +476,17 @@ protected: /** * Misc. */ void StopFlashing(); static bool IsTopLevelMouseExit(HWND aWnd); virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects, bool aIntersectWithExisting) override; - nsIntRegion GetRegionToPaint(bool aForceFullRepaint, + nsIntRegion GetRegionToPaint(bool aForceFullRepaint, PAINTSTRUCT ps, HDC aDC); static void ActivateOtherWindowHelper(HWND aWnd); void ClearCachedResources(); nsIWidgetListener* GetPaintListener(); already_AddRefed<SourceSurface> CreateScrollSnapshot() override; struct ScrollSnapshot @@ -562,17 +562,17 @@ protected: LayoutDeviceIntMargin mNonClientMargins; // Margins we'd like to set once chrome is reshown: LayoutDeviceIntMargin mFutureMarginsOnceChromeShows; // Indicates we need to apply margins once toggling chrome into showing: bool mFutureMarginsToUse; // Indicates custom frames are enabled bool mCustomNonClient; - // Cached copy of L&F's resize border + // Cached copy of L&F's resize border int32_t mHorResizeMargin; int32_t mVertResizeMargin; // Height of the caption plus border int32_t mCaptionHeight; double mDefaultScale; nsCOMPtr<nsIIdleServiceInternal> mIdleService;
--- a/widget/windows/nsWindowBase.cpp +++ b/widget/windows/nsWindowBase.cpp @@ -82,28 +82,28 @@ nsWindowBase::InjectTouchPoint(uint32_t POINTER_TOUCH_INFO info; memset(&info, 0, sizeof(POINTER_TOUCH_INFO)); info.touchFlags = TOUCH_FLAG_NONE; info.touchMask = TOUCH_MASK_CONTACTAREA|TOUCH_MASK_ORIENTATION|TOUCH_MASK_PRESSURE; info.pressure = aPressure; info.orientation = aOrientation; - + info.pointerInfo.pointerFlags = aFlags; info.pointerInfo.pointerType = PT_TOUCH; info.pointerInfo.pointerId = aId; info.pointerInfo.ptPixelLocation.x = aPoint.x; info.pointerInfo.ptPixelLocation.y = aPoint.y; info.rcContact.top = info.pointerInfo.ptPixelLocation.y - 2; info.rcContact.bottom = info.pointerInfo.ptPixelLocation.y + 2; info.rcContact.left = info.pointerInfo.ptPixelLocation.x - 2; info.rcContact.right = info.pointerInfo.ptPixelLocation.x + 2; - + if (!sInjectTouchFuncPtr(1, &info)) { WinUtils::Log("InjectTouchInput failure. GetLastError=%d", GetLastError()); return false; } return true; } void nsWindowBase::ChangedDPI()