Skip to content

Commit

Permalink
Bug 1265386: Fix white-space errors in widget/, r=nfroyd
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: ATXI7dYFHmA
  • Loading branch information
tdz committed Jul 21, 2016
1 parent f8c8538 commit 72bc614
Show file tree
Hide file tree
Showing 30 changed files with 253 additions and 253 deletions.
10 changes: 5 additions & 5 deletions widget/android/nsDeviceContextAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ 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;
}
4 changes: 2 additions & 2 deletions widget/cocoa/nsChildView.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class nsChildView : public nsBaseWidget
nsIObserver* aObserver) override;

// Mac specific methods

virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent& event);

void WillPaintWindow();
Expand Down Expand Up @@ -575,7 +575,7 @@ class nsChildView : public nsBaseWidget
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
Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsCocoaWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ typedef struct _nsCocoaWindowList {

@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
{
Expand Down
56 changes: 28 additions & 28 deletions widget/cocoa/nsMenuBarX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
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)) {
Expand All @@ -140,7 +140,7 @@
delete newMenu;
}
}
}
}
}

void nsMenuBarX::ConstructFallbackNativeMenus()
Expand Down Expand Up @@ -270,7 +270,7 @@
}

void nsMenuBarX::ObserveContentRemoved(nsIDocument* aDocument,
nsIContent* aChild,
nsIContent* aChild,
int32_t aIndexInContainer)
{
RemoveMenuAtIndex(aIndexInContainer);
Expand Down Expand Up @@ -478,7 +478,7 @@
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);
Expand All @@ -505,7 +505,7 @@
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);
Expand Down Expand Up @@ -586,7 +586,7 @@

// put together the actual NSMenuItem
NSMenuItem* newMenuItem = [[NSMenuItem alloc] initWithTitle:labelString action:action keyEquivalent:keyEquiv];

[newMenuItem setTag:tag];
[newMenuItem setTarget:target];
[newMenuItem setKeyEquivalentModifierMask:macKeyModifiers];
Expand All @@ -609,36 +609,36 @@
// 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.
*/
Expand Down Expand Up @@ -681,58 +681,58 @@ developers need only add each node with a label and a key equivalent (if they
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);
Expand All @@ -751,7 +751,7 @@ developers need only add each node with a label and a key equivalent (if they
[sApplicationMenu addItem:defaultQuitItem];
}
}

return (sApplicationMenu) ? NS_OK : NS_ERROR_FAILURE;

NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
Expand Down
14 changes: 7 additions & 7 deletions widget/cocoa/nsMenuItemX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@
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];
Expand Down Expand Up @@ -217,14 +217,14 @@
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);
}
}
}
}
}

Expand Down Expand Up @@ -289,7 +289,7 @@

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
Expand Down Expand Up @@ -330,7 +330,7 @@
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);
Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsMenuX.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class nsMenuX : public nsMenuObjectX,
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);

Expand Down
26 changes: 13 additions & 13 deletions widget/cocoa/nsMenuX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ - (void) setMenuGroupOwner:(nsMenuGroupOwnerX *)aMenuGroupOwner
}

mMenuDelegate = [[MenuDelegate alloc] initWithGeckoMenu:this];

if (!nsMenuBarX::sNativeEventTarget)
nsMenuBarX::sNativeEventTarget = [[NativeMenuItemTarget alloc] init];

Expand Down Expand Up @@ -287,7 +287,7 @@ - (void) setMenuGroupOwner:(nsMenuGroupOwnerX *)aMenuGroupOwner
// 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;
Expand Down Expand Up @@ -362,7 +362,7 @@ WidgetMouseEvent event(true, eXULPopupShown, nullptr,
GetMenuPopupContent(getter_AddRefs(popupContent));
nsIContent* dispatchTo = popupContent ? popupContent : mContent;
dispatchTo->DispatchDOMEvent(&event, nullptr, nullptr, &status);

return nsEventStatus_eConsumeNoDefault;
}

Expand Down Expand Up @@ -396,7 +396,7 @@ WidgetMouseEvent event(true, eXULPopupHidden, nullptr,
{
mConstructed = false;
gConstructingMenu = true;

// reset destroy handler flag so that we'll know to fire it next time this menu goes away.
mDestroyHandlerCalled = false;

Expand Down Expand Up @@ -564,10 +564,10 @@ WidgetMouseEvent event(true, eXULPopupHidden, nullptr,
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);
Expand Down Expand Up @@ -609,12 +609,12 @@ WidgetMouseEvent event(true, eXULPopupHiding, nullptr,
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;
}

Expand All @@ -626,7 +626,7 @@ WidgetMouseEvent event(true, eXULPopupHiding, nullptr,
if (!aResult)
return;
*aResult = nullptr;

// Check to see if we are a "menupopup" node (if we are a native menu).
{
int32_t dummy;
Expand All @@ -639,7 +639,7 @@ WidgetMouseEvent event(true, eXULPopupHiding, nullptr,
}

// Otherwise check our child nodes.

uint32_t count = mContent->GetChildCount();

for (uint32_t i = 0; i < count; i++) {
Expand Down Expand Up @@ -704,7 +704,7 @@ WidgetMouseEvent event(true, eXULPopupHiding, nullptr,
}
else if (parentType == eSubmenuObjectType) {
static_cast<nsMenuX*>(mParent)->SetRebuild(true);
}
}
else if (parentType == eStandaloneNativeMenuObjectType) {
static_cast<nsStandaloneNativeMenu*>(mParent)->GetMenuXObject()->SetRebuild(true);
}
Expand Down Expand Up @@ -902,7 +902,7 @@ @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];
Expand Down
Loading

0 comments on commit 72bc614

Please sign in to comment.