Skip to content

Commit 8cffdc2

Browse files
committed
Issue #2051 - Part 1 - Initial changes to get UXP building on Mac 10.5 PowerPC.
Additionally update the version detection back to 10.5 and forward to 14. Fill some parts with code from TenFourFox when changes are not obvious. Using gcc 7 from MacPorts, the gcc 4.8 TenFourFox used is too old. Don't use GNU as on MacPPC it is too old. Fix struct/class sizes by limiting bool size.
1 parent 3a092d3 commit 8cffdc2

File tree

77 files changed

+1629
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1629
-121
lines changed

accessible/base/RoleMap.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
* ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, nameRule)
88
*/
99

10+
#ifndef NSAccessibilityCellRole
11+
#define NSAccessibilityCellRole NSAccessibilityUnknownRole
12+
#endif
13+
1014
ROLE(NOTHING,
1115
"nothing",
1216
ATK_ROLE_UNKNOWN,

accessible/mac/mozActionElements.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ - (void)invalidateChildren
295295

296296
@implementation mozPaneAccessible
297297

298+
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
298299
- (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute
299300
{
300301
AccessibleWrap* accWrap = [self getGeckoAccessible];
@@ -313,6 +314,7 @@ - (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute
313314

314315
return [super accessibilityArrayAttributeCount:attribute];
315316
}
317+
#endif
316318

317319
- (NSArray*)children
318320
{

accessible/mac/mozTableAccessible.mm

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@
4747
return nativeArray;
4848
}
4949

50+
// Convert to an object without @ syntax
51+
static inline id
52+
ConvertToId(NSInteger val)
53+
{
54+
return [NSString stringWithFormat:@"%i", val];
55+
}
56+
57+
// Missing from SDK 10.5
58+
#if !defined(MAC_OS_X_VERSION_10_6) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
59+
#define __IntToNSString(x) ([NSString stringWithFormat:@"%i", x])
60+
#define NSAccessibilityRowIndexRangeAttribute @"AXRowIndexRange"
61+
#define NSAccessibilityColumnIndexRangeAttribute @"AXColumnIndexRange"
62+
#define NSAccessibilityRowHeaderUIElementsAttribute @"AXRowHeaderUIElements"
63+
#define NSAccessibilityColumnHeaderUIElementsAttribute @"AXColumnHeaderUIElements"
64+
#define NSAccessibilityRowCountAttribute @"AXRowCount"
65+
#define NSAccessibilityColumnCountAttribute @"AXColumnCount"
66+
#endif
67+
5068
@implementation mozTablePartAccessible
5169
- (BOOL)isLayoutTablePart;
5270
{
@@ -83,10 +101,14 @@ - (NSArray*)additionalAccessibilityAttributeNames
83101
{
84102
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
85103

104+
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
86105
NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
87106
if ([self isLayoutTablePart]) {
88107
return additionalAttributes;
89108
}
109+
#else
110+
NSArray* additionalAttributes = [[NSArray alloc] init];
111+
#endif
90112

91113
static NSArray* tableAttrs = nil;
92114
if (!tableAttrs) {
@@ -108,9 +130,9 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
108130
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
109131
TableAccessible* table = accWrap->AsTable();
110132
if ([attribute isEqualToString:NSAccessibilityRowCountAttribute])
111-
return @(table->RowCount());
133+
return ConvertToId(table->RowCount());
112134
if ([attribute isEqualToString:NSAccessibilityColumnCountAttribute])
113-
return @(table->ColCount());
135+
return ConvertToId(table->ColCount());
114136
if ([attribute isEqualToString:NSAccessibilityRowsAttribute]) {
115137
// Create a new array with the list of table rows.
116138
NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
@@ -127,9 +149,9 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
127149
}
128150
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
129151
if ([attribute isEqualToString:NSAccessibilityRowCountAttribute])
130-
return @(proxy->TableRowCount());
152+
return ConvertToId(proxy->TableRowCount());
131153
if ([attribute isEqualToString:NSAccessibilityColumnCountAttribute])
132-
return @(proxy->TableColumnCount());
154+
return ConvertToId(proxy->TableColumnCount());
133155
if ([attribute isEqualToString:NSAccessibilityRowsAttribute]) {
134156
// Create a new array with the list of table rows.
135157
NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
@@ -155,10 +177,14 @@ - (NSArray*)additionalAccessibilityAttributeNames
155177
{
156178
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
157179

180+
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
158181
NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
159182
if ([self isLayoutTablePart]) {
160183
return additionalAttributes;
161184
}
185+
#else
186+
NSArray* additionalAttributes = [[NSArray alloc] init];
187+
#endif
162188

163189
static NSArray* tableRowAttrs = nil;
164190
if (!tableRowAttrs) {
@@ -214,10 +240,14 @@ - (NSArray*)additionalAccessibilityAttributeNames
214240
{
215241
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
216242

243+
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
217244
NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
218245
if ([self isLayoutTablePart]) {
219246
return additionalAttributes;
220247
}
248+
#else
249+
NSArray* additionalAttributes = [[NSArray alloc] init];
250+
#endif
221251

222252
static NSArray* tableCellAttrs = nil;
223253
if (!tableCellAttrs) {

config/external/icu/data/moz.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ LOCAL_INCLUDES += ['.']
2626
if CONFIG['HAVE_YASM']:
2727
USE_YASM = True
2828
SOURCES += ['icudata.s']
29+
elif CONFIG['OS_ARCH'] == 'Darwin':
30+
if CONFIG['CPU_ARCH'] != 'ppc':
31+
SOURCES += ['icudata_gas.S']
2932
elif CONFIG['GNU_AS']:
3033
SOURCES += ['icudata_gas.S']

config/external/nspr/pr/moz.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ elif CONFIG['OS_TARGET'] == 'Darwin':
4646
)
4747
SOURCES += [
4848
'/nsprpub/pr/src/md/unix/darwin.c',
49-
'/nsprpub/pr/src/md/unix/os_Darwin.s',
49+
'/nsprpub/pr/src/md/unix/os_Darwin.S',
5050
]
5151
if not CONFIG['MOZ_IOS']:
5252
DEFINES['HAVE_CRT_EXTERNS_H'] = True

dom/bindings/BindingUtils.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,10 +1986,10 @@ GetCallbackFromCallbackObject(T& aObj)
19861986
}
19871987

19881988
static inline bool
1989-
AtomizeAndPinJSString(JSContext* cx, jsid& id, const char* chars)
1989+
AtomizeAndPinJSString(JSContext* cx, jsid& jid, const char* chars)
19901990
{
19911991
if (JSString *str = ::JS_AtomizeAndPinString(cx, chars)) {
1992-
id = INTERNED_STRING_TO_JSID(cx, str);
1992+
jid = INTERNED_STRING_TO_JSID(cx, str);
19931993
return true;
19941994
}
19951995
return false;
@@ -2156,17 +2156,17 @@ ConvertJSValueToUSVString(JSContext* cx, JS::Handle<JS::Value> v, T& result)
21562156

21572157
template<typename T>
21582158
inline bool
2159-
ConvertIdToString(JSContext* cx, JS::HandleId id, T& result, bool& isSymbol)
2159+
ConvertIdToString(JSContext* cx, JS::HandleId hid, T& result, bool& isSymbol)
21602160
{
2161-
if (MOZ_LIKELY(JSID_IS_STRING(id))) {
2162-
if (!AssignJSString(cx, result, JSID_TO_STRING(id))) {
2161+
if (MOZ_LIKELY(JSID_IS_STRING(hid))) {
2162+
if (!AssignJSString(cx, result, JSID_TO_STRING(hid))) {
21632163
return false;
21642164
}
2165-
} else if (JSID_IS_SYMBOL(id)) {
2165+
} else if (JSID_IS_SYMBOL(hid)) {
21662166
isSymbol = true;
21672167
return true;
21682168
} else {
2169-
JS::RootedValue nameVal(cx, js::IdToValue(id));
2169+
JS::RootedValue nameVal(cx, js::IdToValue(hid));
21702170
if (!ConvertJSValueToString(cx, nameVal, eStringify, eStringify, result)) {
21712171
return false;
21722172
}
@@ -2502,10 +2502,10 @@ class MOZ_STACK_CLASS NullableRootedUnion : public Nullable<T>,
25022502
};
25032503

25042504
inline bool
2505-
IdEquals(jsid id, const char* string)
2505+
IdEquals(jsid jid, const char* string)
25062506
{
2507-
return JSID_IS_STRING(id) &&
2508-
JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(id), string);
2507+
return JSID_IS_STRING(jid) &&
2508+
JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(jid), string);
25092509
}
25102510

25112511
inline bool
@@ -2543,7 +2543,7 @@ Constructor(JSContext* cx, unsigned argc, JS::Value* vp);
25432543
bool
25442544
XrayResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
25452545
JS::Handle<JSObject*> obj,
2546-
JS::Handle<jsid> id,
2546+
JS::Handle<jsid> jid,
25472547
JS::MutableHandle<JS::PropertyDescriptor> desc,
25482548
bool& cacheOnHolder);
25492549

@@ -2560,7 +2560,7 @@ XrayResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
25602560
*/
25612561
bool
25622562
XrayDefineProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
2563-
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
2563+
JS::Handle<JSObject*> obj, JS::Handle<jsid> jid,
25642564
JS::Handle<JS::PropertyDescriptor> desc,
25652565
JS::ObjectOpResult &result,
25662566
bool *defined);
@@ -2635,7 +2635,7 @@ XrayGetExpandoClass(JSContext* cx, JS::Handle<JSObject*> obj);
26352635
*/
26362636
bool
26372637
XrayDeleteNamedProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
2638-
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
2638+
JS::Handle<JSObject*> obj, JS::Handle<jsid> jid,
26392639
JS::ObjectOpResult& opresult);
26402640

26412641
/**
@@ -3225,26 +3225,26 @@ CreateGlobal(JSContext* aCx, T* aNative, nsWrapperCache* aCache,
32253225
*/
32263226
class PinnedStringId
32273227
{
3228-
jsid id;
3228+
jsid jid;
32293229

32303230
public:
3231-
PinnedStringId() : id(JSID_VOID) {}
3231+
PinnedStringId() : jid(JSID_VOID) {}
32323232

32333233
bool init(JSContext *cx, const char *string) {
32343234
JSString* str = JS_AtomizeAndPinString(cx, string);
32353235
if (!str)
32363236
return false;
3237-
id = INTERNED_STRING_TO_JSID(cx, str);
3237+
jid = INTERNED_STRING_TO_JSID(cx, str);
32383238
return true;
32393239
}
32403240

32413241
operator const jsid& () {
3242-
return id;
3242+
return jid;
32433243
}
32443244

32453245
operator JS::Handle<jsid> () {
32463246
/* This is safe because we have pinned the string. */
3247-
return JS::Handle<jsid>::fromMarkedLocation(&id);
3247+
return JS::Handle<jsid>::fromMarkedLocation(&jid);
32483248
}
32493249
};
32503250

dom/geolocation/nsGeolocation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,12 @@ nsresult nsGeolocationService::Init()
651651
#endif
652652

653653
#ifdef MOZ_WIDGET_COCOA
654+
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
654655
if (Preferences::GetBool("geo.provider.use_corelocation", true)) {
655656
mProvider = new CoreLocationLocationProvider();
656657
}
657658
#endif
659+
#endif
658660

659661
#ifdef XP_WIN
660662
if (Preferences::GetBool("geo.provider.ms-windows-location", false) &&

dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@
164164
mTask = nullptr;
165165
}
166166

167+
// NSSpeechSynthesizerDelegate is not a protocol in SDK 10.5
168+
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
167169
@interface SpeechDelegate : NSObject<NSSpeechSynthesizerDelegate>
170+
#else
171+
@interface SpeechDelegate : NSObject
172+
#endif
168173
{
169174
@private
170175
SpeechTaskCallback* mCallback;
@@ -293,7 +298,8 @@ explicit EnumVoicesRunnable(OSXSpeechSynthesizerService* aSpeechService)
293298
NSArray* voices = [NSSpeechSynthesizer availableVoices];
294299
NSString* defaultVoice = [NSSpeechSynthesizer defaultVoice];
295300

296-
for (NSString* voice in voices) {
301+
for (NSUInteger i = 0; i < [voices count]; i++) {
302+
NSString* voice = (NSString *)[voices objectAtIndex:i];
297303
OSXVoice item;
298304

299305
NSDictionary* attr = [NSSpeechSynthesizer attributesForVoice:voice];

dom/plugins/ipc/PluginInterposeOSX.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ void OnPluginShowWindow(uint32_t window_id,
583583
plugin_fullscreen_windows_set_.end())) {
584584
plugin_fullscreen_windows_set_.insert(window_id);
585585

586-
nsCocoaUtils::HideOSChromeOnScreen(true);
586+
nsCocoaUtils::HideOSChromeOnScreen(true, nil);
587587
}
588588
}
589589

@@ -606,7 +606,7 @@ static void ReleasePluginFullScreen(pid_t plugin_pid) {
606606
// focus, but give it back to the plugin process if requested.
607607
ActivateProcess(base::GetCurrentProcId());
608608

609-
nsCocoaUtils::HideOSChromeOnScreen(false);
609+
nsCocoaUtils::HideOSChromeOnScreen(false, nil);
610610

611611
if (plugin_pid != -1) {
612612
ActivateProcess(plugin_pid);

dom/plugins/ipc/PluginUtilsOSX.mm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,23 @@ - (void)setRemoteEvents:(RemoteProcessEvents) remoteEvents pluginModule:(void*)
185185
NSMenu* nsmenu = reinterpret_cast<NSMenu*>(aMenu);
186186
NSPoint screen_point = ::NSMakePoint(aX, aY);
187187

188+
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
188189
[nsmenu popUpMenuPositioningItem:nil atLocation:screen_point inView:nil];
190+
#else
191+
NSEvent *event = [[NSApplication sharedApplication] currentEvent];
192+
NSWindow *window = [event window];
193+
NSView *view = [window contentView];
194+
NSEvent* fake = [NSEvent mouseEventWithType:NSRightMouseDown
195+
location:screen_point
196+
modifierFlags:0
197+
timestamp:[event timestamp]
198+
windowNumber:[window windowNumber]
199+
context:[NSGraphicsContext currentContext]
200+
eventNumber:1
201+
clickCount:1
202+
pressure:0.0];
203+
[NSMenu popUpContextMenu:nsmenu withEvent:fake forView:view];
204+
#endif
189205

190206
if (pluginModule) {
191207
[eventTimer invalidate];

dom/system/moz.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
77

88
if toolkit == 'windows':
99
DIRS += ['windows']
10-
elif toolkit == 'cocoa':
10+
elif toolkit == 'cocoa' and CONFIG['CPU_ARCH'] != 'ppc':
1111
DIRS += ['mac']
1212
elif toolkit in ('gtk2', 'gtk3'):
1313
DIRS += ['linux']

gfx/2d/PathCG.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
#include "Logging.h"
99
#include "PathHelpers.h"
1010

11+
#if !defined(MAC_OS_X_VERSION_10_6) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
12+
// CGContextCopyPath has existed since 10.2, but was not public until 10.6.
13+
extern "C" CGPathRef CGContextCopyPath(CGContextRef cg);
14+
#endif
15+
1116
namespace mozilla {
1217
namespace gfx {
1318

gfx/gl/GLContextProviderCGL.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ bool UseDoubleBufferedWindows() const {
210210

211211
static const NSOpenGLPixelFormatAttribute kAttribs_offscreen_coreProfile[] = {
212212
NSOpenGLPFAAccelerated,
213+
#if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
213214
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
215+
#endif
214216
0
215217
};
216218

gfx/graphite2/src/MozGrMalloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
#include "mozilla/mozalloc.h"
1414

15-
#define malloc moz_xmalloc
16-
#define calloc moz_xcalloc
17-
#define realloc moz_xrealloc
15+
#define malloc(a) moz_xmalloc(a)
16+
#define calloc(a, b) moz_xcalloc(a, b)
17+
#define realloc(a, b) moz_xrealloc(a, b)
1818

1919
#endif // MOZ_GR_MALLOC_H

0 commit comments

Comments
 (0)