Merge m-c to inbound.

--HG--
rename : widget/gtk2/nsGtkIMModule.cpp => widget/gtk/nsGtkIMModule.cpp
This commit is contained in:
Ryan VanderMeulen 2013-09-23 17:10:33 -04:00
commit a053c4c09f
145 changed files with 595 additions and 163 deletions

View File

@ -31,7 +31,7 @@ this.Keyboard = {
if (this._messageManager && !Cu.isDeadWrapper(this._messageManager))
return this._messageManager;
throw Error('no message manager set');
return null;
},
set messageManager(mm) {
@ -92,6 +92,10 @@ this.Keyboard = {
// If we get a 'Keyboard:XXX' message, check that the sender has the
// keyboard permission.
if (msg.name.indexOf("Keyboard:") != -1) {
if (!this.messageManager) {
return;
}
let mm;
try {
mm = msg.target.QueryInterface(Ci.nsIFrameLoaderOwner)

View File

@ -199,15 +199,51 @@ MozKeyboard.prototype = {
}
};
const TESTING_ENABLED_PREF = "dom.mozInputMethod.testing";
/*
* A WeakMap to map input method iframe window to its active status.
*/
let WindowMap = {
// WeakMap of <window, boolean> pairs.
_map: null,
/*
* Check if the given window is active.
*/
isActive: function(win) {
if (!this._map || !win) {
return false;
}
return this._map.get(win, false);
},
/*
* Set the active status of the given window.
*/
setActive: function(win, isActive) {
if (!win) {
return;
}
if (!this._map) {
this._map = new WeakMap();
}
this._map.set(win, isActive);
}
};
/**
* ==============================================
* InputMethodManager
* ==============================================
*/
function MozInputMethodManager() { }
function MozInputMethodManager(win) {
this._window = win;
}
MozInputMethodManager.prototype = {
_supportsSwitching: false,
_window: null,
classID: Components.ID("{7e9d7280-ef86-11e2-b778-0800200c9a66}"),
@ -224,18 +260,30 @@ MozInputMethodManager.prototype = {
}),
showAll: function() {
if (!WindowMap.isActive(this._window)) {
return;
}
cpmm.sendAsyncMessage('Keyboard:ShowInputMethodPicker', {});
},
next: function() {
if (!WindowMap.isActive(this._window)) {
return;
}
cpmm.sendAsyncMessage('Keyboard:SwitchToNextInputMethod', {});
},
supportsSwitching: function() {
if (!WindowMap.isActive(this._window)) {
return false;
}
return this._supportsSwitching;
},
hide: function() {
if (!WindowMap.isActive(this._window)) {
return;
}
cpmm.sendAsyncMessage('Keyboard:RemoveFocus', {});
}
};
@ -250,6 +298,7 @@ function MozInputMethod() { }
MozInputMethod.prototype = {
_inputcontext: null,
_layouts: {},
_window: null,
classID: Components.ID("{4607330d-e7d2-40a4-9eb8-43967eae0142}"),
@ -268,17 +317,26 @@ MozInputMethod.prototype = {
}),
init: function mozInputMethodInit(win) {
let principal = win.document.nodePrincipal;
let perm = Services.perms
.testExactPermissionFromPrincipal(principal, "keyboard");
if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) {
dump("No permission to use the keyboard API for " +
principal.origin + "\n");
return null;
// Check if we're in testing mode.
let isTesting = false;
try {
isTesting = Services.prefs.getBoolPref(TESTING_ENABLED_PREF);
} catch (e) {}
// Don't bypass the permission check if not in testing mode.
if (!isTesting) {
let principal = win.document.nodePrincipal;
let perm = Services.perms
.testExactPermissionFromPrincipal(principal, "keyboard");
if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) {
dump("No permission to use the keyboard API for " +
principal.origin + "\n");
return null;
}
}
this._window = win;
this._mgmt = new MozInputMethodManager();
this._mgmt = new MozInputMethodManager(win);
this.innerWindowID = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.currentInnerWindowID;
@ -288,11 +346,6 @@ MozInputMethod.prototype = {
cpmm.addMessageListener('Keyboard:SelectionChange', this);
cpmm.addMessageListener('Keyboard:GetContext:Result:OK', this);
cpmm.addMessageListener('Keyboard:LayoutsChange', this);
// If there already is an active context, then this will trigger
// a GetContext:Result:OK event, and we can initialize ourselves.
// Otherwise silently ignored.
cpmm.sendAsyncMessage("Keyboard:GetContext", {});
},
uninit: function mozInputMethodUninit() {
@ -307,6 +360,10 @@ MozInputMethod.prototype = {
},
receiveMessage: function mozInputMethodReceiveMsg(msg) {
if (!WindowMap.isActive(this._window)) {
return;
}
let json = msg.json;
switch(msg.name) {
@ -338,11 +395,18 @@ MozInputMethod.prototype = {
},
get mgmt() {
if (!WindowMap.isActive(this._window)) {
return null;
}
return this._mgmt;
},
get inputcontext() {
return this._inputcontext;
if (!WindowMap.isActive(this._window)) {
return null;
}
return this._inputcontext;
},
set oninputcontextchange(handler) {
@ -372,6 +436,27 @@ MozInputMethod.prototype = {
let event = new this._window.Event("inputcontextchange",
ObjectWrapper.wrap({}, this._window));
this.__DOM_IMPL__.dispatchEvent(event);
},
setActive: function mozInputMethodSetActive(isActive) {
if (WindowMap.isActive(this._window) === isActive) {
return;
}
WindowMap.setActive(this._window, isActive);
if (isActive) {
// Activate current input method.
// If there is already an active context, then this will trigger
// a GetContext:Result:OK event, and we can initialize ourselves.
// Otherwise silently ignored.
cpmm.sendAsyncMessage("Keyboard:GetContext", {});
} else {
// Deactive current input method.
if (this._inputcontext) {
this.setInputContext(null);
}
}
}
};
@ -400,6 +485,7 @@ function MozInputContext(ctx) {
MozInputContext.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
_window: null,
_context: null,
_contextId: -1,
@ -452,6 +538,8 @@ MozInputContext.prototype = {
this._context[k] = null;
}
}
this._window = null;
},
receiveMessage: function ic_receiveMessage(msg) {
@ -558,8 +646,7 @@ MozInputContext.prototype = {
getText: function ic_getText(offset, length) {
let self = this;
return this.createPromise(function(resolve, reject) {
let resolverId = self.getPromiseResolverId({ resolve: resolve, reject: reject });
return this._sendPromise(function(resolverId) {
cpmm.sendAsyncMessage('Keyboard:GetText', {
contextId: self._contextId,
requestId: resolverId,
@ -587,8 +674,7 @@ MozInputContext.prototype = {
setSelectionRange: function ic_setSelectionRange(start, length) {
let self = this;
return this.createPromise(function(resolve, reject) {
let resolverId = self.getPromiseResolverId({ resolve: resolve, reject: reject });
return this._sendPromise(function(resolverId) {
cpmm.sendAsyncMessage("Keyboard:SetSelectionRange", {
contextId: self._contextId,
requestId: resolverId,
@ -616,8 +702,7 @@ MozInputContext.prototype = {
replaceSurroundingText: function ic_replaceSurrText(text, offset, length) {
let self = this;
return this.createPromise(function(resolve, reject) {
let resolverId = self.getPromiseResolverId({ resolve: resolve, reject: reject });
return this._sendPromise(function(resolverId) {
cpmm.sendAsyncMessage('Keyboard:ReplaceSurroundingText', {
contextId: self._contextId,
requestId: resolverId,
@ -634,8 +719,7 @@ MozInputContext.prototype = {
sendKey: function ic_sendKey(keyCode, charCode, modifiers) {
let self = this;
return this.createPromise(function(resolve, reject) {
let resolverId = self.getPromiseResolverId({ resolve: resolve, reject: reject });
return this._sendPromise(function(resolverId) {
cpmm.sendAsyncMessage('Keyboard:SendKey', {
contextId: self._contextId,
requestId: resolverId,
@ -648,8 +732,7 @@ MozInputContext.prototype = {
setComposition: function ic_setComposition(text, cursor, clauses) {
let self = this;
return this.createPromise(function(resolve, reject) {
let resolverId = self.getPromiseResolverId({ resolve: resolve, reject: reject });
return this._sendPromise(function(resolverId) {
cpmm.sendAsyncMessage('Keyboard:SetComposition', {
contextId: self._contextId,
requestId: resolverId,
@ -662,14 +745,26 @@ MozInputContext.prototype = {
endComposition: function ic_endComposition(text) {
let self = this;
return this.createPromise(function(resolve, reject) {
let resolverId = self.getPromiseResolverId({ resolve: resolve, reject: reject });
return this._sendPromise(function(resolverId) {
cpmm.sendAsyncMessage('Keyboard:EndComposition', {
contextId: self._contextId,
requestId: resolverId,
text: text || ''
});
});
},
_sendPromise: function(callback) {
let self = this;
return this.createPromise(function(resolve, reject) {
let resolverId = self.getPromiseResolverId({ resolve: resolve, reject: reject });
if (!WindowMap.isActive(self._window)) {
self.removePromiseResolver(resolverId);
reject('Input method is not active.');
return;
}
callback(resolverId);
});
}
};

View File

@ -1,4 +1,4 @@
{
"revision": "c062ff36671ed3b1249428ad098dc70615e5e612",
"revision": "7c63d2f71b0b68f085e01cb09f355b259ade2dd1",
"repo_path": "/integration/gaia-central"
}

View File

@ -912,7 +912,7 @@ var gBrowserInit = {
defaultHeight = screen.availHeight * .75;
}
#ifdef MOZ_WIDGET_GTK2
#if MOZ_WIDGET_GTK == 2
// On X, we're not currently able to account for the size of the window
// border. Use 28px as a guess (titlebar + bottom window border)
defaultHeight -= 28;

View File

@ -66,7 +66,7 @@ const PREF_AUDIO_FEED_SELECTED_READER = "browser.audioFeeds.handler.default";
const kActionUsePlugin = 5;
/*
#ifdef MOZ_WIDGET_GTK2
#if MOZ_WIDGET_GTK == 2
*/
const ICON_URL_APP = "moz-icon://dummy.exe?size=16";
/*

View File

@ -14,7 +14,7 @@ JAVAFILES = \
R.java \
$(NULL)
RES_FILES = \
ANDROID_RESFILES = \
res/values/strings.xml \
$(NULL)

View File

@ -21,7 +21,7 @@ JAVAFILES = \
R.java \
$(NULL)
RES_FILES = \
ANDROID_RESFILES = \
res/drawable/icon.png \
res/drawable/ateamlogo.png \
res/drawable/ic_stat_first.png \

View File

@ -12,7 +12,7 @@ JAVAFILES = \
R.java \
$(NULL)
RES_FILES = \
ANDROID_RESFILES = \
res/drawable-hdpi/icon.png \
res/drawable-ldpi/icon.png \
res/drawable-mdpi/icon.png \

View File

@ -12,7 +12,7 @@ JAVAFILES = \
R.java \
$(NULL)
RES_FILES = \
ANDROID_RESFILES = \
res/drawable-hdpi/icon.png \
res/drawable-ldpi/icon.png \
res/drawable-mdpi/icon.png \

View File

@ -13,7 +13,7 @@ JAVAFILES = \
WatcherService.java \
$(NULL)
RES_FILES = \
ANDROID_RESFILES = \
res/drawable-hdpi/icon.png \
res/drawable-hdpi/ateamlogo.png \
res/drawable-ldpi/icon.png \

View File

@ -797,8 +797,8 @@ PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
export CL_INCLUDES_PREFIX
ifeq ($(MOZ_WIDGET_GTK),2)
MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS)
ifdef MOZ_GTK2_CFLAGS
MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk/compat $(MOZ_GTK2_CFLAGS)
endif
DEFINES += -DNO_NSPR_10_SUPPORT

View File

@ -7,7 +7,7 @@
ifndef INCLUDED_JAVA_BUILD_MK #{
ifdef RES_FILES #{
ifdef ANDROID_RESFILES #{
res-dep := .deps-copy-java-res
GENERATED_DIRS += res
@ -16,7 +16,7 @@ GARBAGE += $(res-dep)
export:: $(res-dep)
res-dep-preqs := \
$(addprefix $(srcdir)/,$(RES_FILES)) \
$(addprefix $(srcdir)/,$(ANDROID_RESFILES)) \
$(call mkdir_deps,res) \
$(if $(IS_LANGUAGE_REPACK),FORCE) \
$(NULL)

View File

@ -1225,7 +1225,7 @@ endif
###############################################################################
# Java rules
###############################################################################
ifneq (,$(value JAVAFILES)$(value RESFILES))
ifneq (,$(value JAVAFILES)$(value ANDROID_RESFILES))
include $(topsrcdir)/config/makefiles/java-build.mk
endif

View File

@ -287,6 +287,11 @@ this.PermissionsTable = { geolocation: {
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION
},
"inputmethod-manage": {
app: DENY_ACTION,
privileged: DENY_ACTION,
certified: ALLOW_ACTION
},
"wappush": {
app: DENY_ACTION,
privileged: DENY_ACTION,

View File

@ -210,6 +210,7 @@ BrowserElementChild.prototype = {
"owner-visibility-change": this._recvOwnerVisibilityChange,
"exit-fullscreen": this._recvExitFullscreen.bind(this),
"activate-next-paint-listener": this._activateNextPaintListener.bind(this),
"set-input-method-active": this._recvSetInputMethodActive.bind(this),
"deactivate-next-paint-listener": this._deactivateNextPaintListener.bind(this)
}
@ -886,6 +887,20 @@ BrowserElementChild.prototype = {
webNav.stop(webNav.STOP_NETWORK);
},
_recvSetInputMethodActive: function(data) {
let msgData = { id: data.json.id };
// Unwrap to access webpage content.
let nav = XPCNativeWrapper.unwrap(content.document.defaultView.navigator);
if (nav.mozInputMethod) {
// Wrap to access the chrome-only attribute setActive.
new XPCNativeWrapper(nav.mozInputMethod).setActive(data.json.args.isActive);
msgData.successRv = null;
} else {
msgData.errorMsg = 'Cannot access mozInputMethod.';
}
sendAsyncMsg('got-set-input-method-active', msgData);
},
_keyEventHandler: function(e) {
if (whitelistedEvents.indexOf(e.keyCode) != -1 && !e.defaultPrevented) {
sendAsyncMsg('keyevent', {

View File

@ -92,6 +92,10 @@ this.BrowserElementParentBuilder = {
}
}
// The active input method iframe.
let activeInputFrame = null;
function BrowserElementParent(frameLoader, hasRemoteFrame) {
debug("Creating new BrowserElementParent object for " + frameLoader);
this._domRequestCounter = 0;
@ -141,6 +145,7 @@ function BrowserElementParent(frameLoader, hasRemoteFrame) {
"exit-fullscreen": this._exitFullscreen,
"got-visible": this._gotDOMRequestResult,
"visibilitychange": this._childVisibilityChange,
"got-set-input-method-active": this._gotDOMRequestResult
}
this._mm.addMessageListener('browser-element-api:call', function(aMsg) {
@ -188,6 +193,13 @@ function BrowserElementParent(frameLoader, hasRemoteFrame) {
defineDOMRequestMethod('getCanGoBack', 'get-can-go-back');
defineDOMRequestMethod('getCanGoForward', 'get-can-go-forward');
let principal = this._frameElement.ownerDocument.nodePrincipal;
let perm = Services.perms
.testExactPermissionFromPrincipal(principal, "inputmethod-manage");
if (perm === Ci.nsIPermissionManager.ALLOW_ACTION) {
defineMethod('setInputMethodActive', this._setInputMethodActive);
}
// Listen to visibilitychange on the iframe's owner window, and forward
// changes down to the child. We want to do this while registering as few
// visibilitychange listeners on _window as possible, because such a listener
@ -581,6 +593,47 @@ BrowserElementParent.prototype = {
this._sendAsyncMsg('deactivate-next-paint-listener');
},
_setInputMethodActive: function(isActive) {
if (typeof isActive !== 'boolean') {
throw Components.Exception("Invalid argument",
Cr.NS_ERROR_INVALID_ARG);
}
let req = Services.DOMRequest.createRequest(this._window);
// Deactivate the old input method if needed.
if (activeInputFrame && isActive) {
let reqOld = XPCNativeWrapper.unwrap(activeInputFrame)
.setInputMethodActive(false);
reqOld.onsuccess = function() {
activeInputFrame = null;
this._sendSetInputMethodActiveDOMRequest(req, isActive);
}.bind(this);
reqOld.onerror = function() {
Services.DOMRequest.fireErrorAsync(req,
'Failed to deactivate the old input method: ' +
reqOld.error + '.');
};
} else {
this._sendSetInputMethodActiveDOMRequest(req, isActive);
}
return req;
},
_sendSetInputMethodActiveDOMRequest: function(req, isActive) {
let id = 'req_' + this._domRequestCounter++;
let data = {
id : id,
args: { isActive: isActive }
};
if (this._sendAsyncMsg('set-input-method-active', data)) {
activeInputFrame = this._frameElement;
this._pendingDOMRequests[id] = req;
} else {
Services.DOMRequest.fireErrorAsync(req, 'fail');
}
},
_fireKeyEvent: function(data) {
let evt = this._window.document.createEvent("KeyboardEvent");
evt.initKeyEvent(data.json.type, true, true, this._window,

View File

@ -163,6 +163,11 @@ MOCHITEST_FILES = \
test_browserElement_inproc_BrowserWindowResize.html \
$(NULL)
# Disabled until we fix bug 906096.
# browserElement_SetInputMethodActive.js \
# test_browserElement_inproc_SetInputMethodActive.html \
# file_inputmethod.html \
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
# test_browserElement_inproc_Reload.html \
@ -239,4 +244,7 @@ MOCHITEST_FILES += \
test_browserElement_oop_BrowserWindowResize.html \
$(NULL)
# Disabled until we fix bug 906096.
# test_browserElement_oop_SetInputMethodActive.html \
endif #}

View File

@ -0,0 +1,96 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Bug 905573 - Add setInputMethodActive to browser elements to allow gaia
// system set the active IME app.
'use strict';
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
function setup() {
SpecialPowers.setBoolPref("dom.mozInputMethod.enabled", true);
SpecialPowers.setBoolPref("dom.mozInputMethod.testing", true);
SpecialPowers.addPermission('inputmethod-manage', true, document);
}
function tearDown() {
SpecialPowers.setBoolPref("dom.mozInputMethod.enabled", false);
SpecialPowers.setBoolPref("dom.mozInputMethod.testing", false);
SpecialPowers.removePermission("inputmethod-manage", document);
SimpleTest.finish();
}
function runTest() {
// Create an input field to receive string from input method iframes.
let input = document.createElement('input');
input.type = 'text';
document.body.appendChild(input);
// Create two input method iframes.
let frames = [];
for (let i = 0; i < 2; i++) {
frames[i] = document.createElement('iframe');
SpecialPowers.wrap(frames[i]).mozbrowser = true;
// When the input method iframe is activated, it will send the URL
// hash to current focused element. We set different hash to each
// iframe so that iframes can be differentiated by their hash.
frames[i].src = 'file_inputmethod.html#' + i;
frames[i].setAttribute('mozapp', location.href.replace(/[^/]+$/, 'file_inputmethod.webapp'));
document.body.appendChild(frames[i]);
}
let count = 0;
// Set focus to the input field and wait for input methods' inputting.
SpecialPowers.DOMWindowUtils.focus(input);
var timerId = null;
input.oninput = function() {
// The texts sent from the first and the second input method are '#0' and
// '#1' respectively.
switch (count) {
case 1:
is(input.value, '#0', 'Failed to get correct input from the first iframe.');
testNextInputMethod();
break;
case 2:
is(input.value, '#0#1', 'Failed to get correct input from the second iframe.');
// Do nothing and wait for the next input from the second iframe.
count++;
break;
case 3:
is(input.value, '#0#1#1', 'Failed to get correct input from the second iframe.');
// Receive the second input from the second iframe.
count++;
// Deactive the second iframe.
frames[1].setInputMethodActive(false);
// Wait for a short while to ensure the second iframe is not active any
// more.
timerId = setTimeout(function() {
ok(true, 'Successfully deactivate the second iframe.');
tearDown();
}, 1000);
break;
default:
ok(false, 'Failed to deactivate the second iframe.');
clearTimeout(timerId);
tearDown();
break;
}
}
ok(frames[0].setInputMethodActive, 'Cannot access setInputMethodActive.');
function testNextInputMethod() {
frames[count++].setInputMethodActive(true);
}
// Wait for a short while to let input method get ready.
setTimeout(function() {
testNextInputMethod();
}, 500);
}
setup();
addEventListener('testready', runTest);

View File

@ -0,0 +1,21 @@
<html>
<body>
<script>
var im = navigator.mozInputMethod;
if (im) {
var intervalId = null;
// Automatically append location hash to current input field.
im.oninputcontextchange = function() {
var ctx = im.inputcontext;
if (ctx) {
intervalId = setInterval(function() {
ctx.replaceSurroundingText(location.hash);
}, 500);
} else {
clearInterval(intervalId);
}
};
}
</script>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 905573</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7" src="browserElement_SetInputMethodActive.js">
</script>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 905573</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7" src="browserElement_SetInputMethodActive.js">
</script>
</body>
</html>

View File

@ -1,5 +1,6 @@
<!doctype html>
<title>Editing event tests</title>
<style>body { font-family: serif }</style>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=test></div>

View File

@ -1922,7 +1922,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
return NPERR_NO_ERROR;
}
}
#ifdef MOZ_WIDGET_GTK2
#if (MOZ_WIDGET_GTK == 2)
// adobe nppdf calls XtGetApplicationNameAndClass(display,
// &instance, &class) we have to init Xt toolkit before get
// XtDisplay just call gtk_xtbin_new(w,0) once
@ -1943,7 +1943,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
return NPERR_GENERIC_ERROR;
#endif
#if defined(XP_WIN) || defined(XP_OS2) || defined(MOZ_WIDGET_GTK2) \
#if defined(XP_WIN) || defined(XP_OS2) || (MOZ_WIDGET_GTK == 2) \
|| defined(MOZ_WIDGET_QT)
case NPNVnetscapeWindow: {
if (!npp || !npp->ndata)

View File

@ -557,7 +557,7 @@ nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window)
if (!window || RUNNING != mRunning)
return NS_OK;
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
// bug 108347, flash plugin on linux doesn't like window->width <=
// 0, but Java needs wants this call.
if (!nsPluginHost::IsJavaMIMEType(mMIMEType) && window->type == NPWindowTypeWindow &&

View File

@ -75,7 +75,7 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#include "nsPluginUtilsOSX.h"
#endif
#ifdef MOZ_WIDGET_GTK2
#if (MOZ_WIDGET_GTK == 2)
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>

View File

@ -737,7 +737,7 @@ nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
if (owner) {
NPWindow* window = nullptr;
owner->GetWindow(window);
#if defined(MOZ_WIDGET_GTK2) || defined(MOZ_WIDGET_QT)
#if (MOZ_WIDGET_GTK == 2) || defined(MOZ_WIDGET_QT)
// Should call GetPluginPort() here.
// This part is copied from nsPluginInstanceOwner::GetPluginPort().
nsCOMPtr<nsIWidget> widget;

View File

@ -40,7 +40,7 @@
#define DEFAULT_X11_PATH ""
#endif
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
#define PLUGIN_MAX_LEN_OF_TMP_ARR 512
@ -266,7 +266,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
libSpec.value.pathname = path.get();
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
// Normally, Mozilla isn't linked against libXt and libXext
// since it's a Gtk/Gdk application. On the other hand,

View File

@ -1101,7 +1101,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
CreateWindow(aWindow);
}
#ifdef MOZ_WIDGET_GTK2
#if (MOZ_WIDGET_GTK == 2)
if (mXEmbed && gtk_check_version(2,18,7) != NULL) { // older
if (aWindow.type == NPWindowTypeWindow) {
GdkWindow* socket_window = gdk_window_lookup(static_cast<GdkNativeWindow>(aWindow.window));

View File

@ -23,6 +23,10 @@ interface MozInputMethod : EventTarget {
// allow to mutate. this attribute should be null when there is no
// text field currently focused.
readonly attribute MozInputContext? inputcontext;
[ChromeOnly]
// Activate or decactive current input method window.
void setActive(boolean isActive);
};
// Manages the list of IMEs, enables/disables IME and switches to an

View File

@ -507,6 +507,20 @@ ComputeBufferRect(const nsIntRect& aRequestedRect)
// rendering glitch, and guarantees image rows can be SIMD'd for
// even r5g6b5 surfaces pretty much everywhere.
rect.width = std::max(aRequestedRect.width, 64);
#ifdef MOZ_WIDGET_GONK
// Set a minumum height to guarantee a minumum height of buffers we
// allocate. Some GL implementations fail to render gralloc textures
// with a height 9px-16px. It happens on Adreno 200. Adreno 320 does not
// have this problem. 32 is choosed as alignment of gralloc buffers.
// See Bug 873937.
// Increase the height only when the requested height is more than 0.
// See Bug 895976.
// XXX it might be better to disable it on the gpu that does not have
// the height problem.
if (rect.height > 0) {
rect.height = std::max(aRequestedRect.height, 32);
}
#endif
return rect;
}

View File

@ -6,7 +6,7 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h"
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
#include "gfxPlatformGtk.h"
#define gfxToolkitPlatform gfxPlatformGtk
#elif defined(MOZ_WIDGET_QT)

View File

@ -38,7 +38,7 @@ static const mozilla::Module::CategoryEntry kIconCategories[] = {
static void
IconDecoderModuleDtor()
{
#ifdef MOZ_WIDGET_GTK2
#if (MOZ_WIDGET_GTK == 2)
nsIconChannel::Shutdown();
#endif
}

View File

@ -797,8 +797,8 @@ PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
export CL_INCLUDES_PREFIX
ifeq ($(MOZ_WIDGET_GTK),2)
MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS)
ifdef MOZ_GTK2_CFLAGS
MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk/compat $(MOZ_GTK2_CFLAGS)
endif
DEFINES += -DNO_NSPR_10_SUPPORT

View File

@ -7,7 +7,7 @@
ifndef INCLUDED_JAVA_BUILD_MK #{
ifdef RES_FILES #{
ifdef ANDROID_RESFILES #{
res-dep := .deps-copy-java-res
GENERATED_DIRS += res
@ -16,7 +16,7 @@ GARBAGE += $(res-dep)
export:: $(res-dep)
res-dep-preqs := \
$(addprefix $(srcdir)/,$(RES_FILES)) \
$(addprefix $(srcdir)/,$(ANDROID_RESFILES)) \
$(call mkdir_deps,res) \
$(if $(IS_LANGUAGE_REPACK),FORCE) \
$(NULL)

View File

@ -1225,7 +1225,7 @@ endif
###############################################################################
# Java rules
###############################################################################
ifneq (,$(value JAVAFILES)$(value RESFILES))
ifneq (,$(value JAVAFILES)$(value ANDROID_RESFILES))
include $(topsrcdir)/config/makefiles/java-build.mk
endif

View File

@ -149,7 +149,7 @@ nsMenuBarFrame::ToggleMenuActiveState()
// Activate the menu bar
SetActive(true);
#ifdef MOZ_WIDGET_GTK2
#if (MOZ_WIDGET_GTK == 2)
firstFrame->OpenMenu(true);
#else
firstFrame->SelectMenu(true);

View File

@ -2555,6 +2555,7 @@ abstract public class GeckoApp
protected void geckoConnected() {
mLayerView.geckoConnected();
mLayerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
}
public void setAccessibilityEnabled(boolean enabled) {

View File

@ -218,10 +218,4 @@ public class WebAppImpl extends GeckoApp {
}
super.onTabChanged(tab, msg, data);
}
@Override
protected void geckoConnected() {
super.geckoConnected();
mLayerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
}
};

View File

@ -144,6 +144,8 @@ abstract class Axis {
protected abstract float getViewportLength();
protected abstract float getPageStart();
protected abstract float getPageLength();
protected abstract float getMarginStart();
protected abstract float getMarginEnd();
protected abstract boolean marginsHidden();
Axis(SubdocumentScrollHelper subscroller) {
@ -377,11 +379,11 @@ abstract class Axis {
// getOverscroll which doesn't take into account any new displacment being applied.
// If we using a subscroller, we don't want to alter the scrolling being done
if (getOverScrollMode() == View.OVER_SCROLL_NEVER && !mSubscroller.scrolling()) {
if (mDisplacement + getOrigin() < getPageStart()) {
mDisplacement = getPageStart() - getOrigin();
if (mDisplacement + getOrigin() < getPageStart() - getMarginStart()) {
mDisplacement = getPageStart() - getMarginStart() - getOrigin();
stopFling();
} else if (mDisplacement + getViewportEnd() > getPageEnd()) {
mDisplacement = getPageEnd() - getViewportEnd();
} else if (mDisplacement + getViewportEnd() > getPageEnd() + getMarginEnd()) {
mDisplacement = getPageEnd() - getMarginEnd() - getViewportEnd();
stopFling();
}
}

View File

@ -1102,6 +1102,10 @@ class JavaPanZoomController
@Override
protected float getPageStart() { return getMetrics().pageRectLeft; }
@Override
protected float getMarginStart() { return mTarget.getMaxMargins().left - getMetrics().marginLeft; }
@Override
protected float getMarginEnd() { return mTarget.getMaxMargins().right - getMetrics().marginRight; }
@Override
protected float getPageLength() { return getMetrics().getPageWidthWithMargins(); }
@Override
protected boolean marginsHidden() {
@ -1122,6 +1126,10 @@ class JavaPanZoomController
@Override
protected float getPageLength() { return getMetrics().getPageHeightWithMargins(); }
@Override
protected float getMarginStart() { return mTarget.getMaxMargins().top - getMetrics().marginTop; }
@Override
protected float getMarginEnd() { return mTarget.getMaxMargins().bottom - getMetrics().marginBottom; }
@Override
protected boolean marginsHidden() {
ImmutableViewportMetrics metrics = getMetrics();
RectF maxMargins = mTarget.getMaxMargins();
@ -1169,6 +1177,11 @@ class JavaPanZoomController
mLastZoomFocus.y - detector.getFocusY());
mLastZoomFocus.set(detector.getFocusX(), detector.getFocusY());
ImmutableViewportMetrics target = getMetrics().scaleTo(zoomFactor, mLastZoomFocus);
// If overscroll is diabled, prevent zooming outside the normal document pans.
if (mX.getOverScrollMode() == View.OVER_SCROLL_NEVER || mY.getOverScrollMode() == View.OVER_SCROLL_NEVER) {
target = getValidViewportMetrics(target);
}
mTarget.setViewportMetrics(target);
}

View File

@ -183,7 +183,7 @@ public class TopSitesGridItemView extends RelativeLayout {
mTitleView.setText(title);
mIsEmpty = false;
} else {
mTitleView.setText(R.string.bookmark_add);
mTitleView.setText(R.string.home_top_sites_add);
mIsEmpty = true;
}

View File

@ -235,7 +235,6 @@ size. -->
<!ENTITY history_removed "Page removed">
<!ENTITY bookmark_add "Add a bookmark">
<!ENTITY bookmark_edit_title "Edit Bookmark">
<!ENTITY bookmark_edit_name "Name">
<!ENTITY bookmark_edit_location "Location">
@ -271,6 +270,10 @@ size. -->
<!ENTITY button_clear "Clear">
<!ENTITY home_top_sites_title "Top Sites">
<!-- Localization note (home_top_sites_add): This string is used as placeholder
text underneath empty thumbnails in the Top Sites page on about:home. -->
<!ENTITY home_top_sites_add "Add a site">
<!ENTITY home_history_title "History">
<!ENTITY home_last_tabs_title "Tabs from last time">
<!ENTITY home_last_tabs_open "Open all tabs from last time">

View File

@ -232,7 +232,6 @@
<string name="history_removed">&history_removed;</string>
<string name="bookmark_add">&bookmark_add;</string>
<string name="bookmark_edit_title">&bookmark_edit_title;</string>
<string name="bookmark_edit_name">&bookmark_edit_name;</string>
<string name="bookmark_edit_location">&bookmark_edit_location;</string>
@ -253,6 +252,7 @@
<string name="button_no">&button_no;</string>
<string name="home_top_sites_title">&home_top_sites_title;</string>
<string name="home_top_sites_add">&home_top_sites_add;</string>
<string name="home_history_title">&home_history_title;</string>
<string name="home_last_tabs_title">&home_last_tabs_title;</string>
<string name="home_last_tabs_open">&home_last_tabs_open;</string>

View File

@ -4666,14 +4666,14 @@ const ElementTouchHelper = {
anyElementFromPoint: function(aX, aY, aWindow) {
let win = (aWindow ? aWindow : BrowserApp.selectedBrowser.contentWindow);
let cwu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
let elem = cwu.elementFromPoint(aX, aY, false, true);
let elem = cwu.elementFromPoint(aX, aY, true, true);
while (elem && (elem instanceof HTMLIFrameElement || elem instanceof HTMLFrameElement)) {
let rect = elem.getBoundingClientRect();
aX -= rect.left;
aY -= rect.top;
cwu = elem.contentDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
elem = cwu.elementFromPoint(aX, aY, false, true);
elem = cwu.elementFromPoint(aX, aY, true, true);
}
return elem;

View File

@ -4166,7 +4166,7 @@ pref("gfx.apitrace.enabled",false);
#endif
#ifdef MOZ_X11
#ifdef MOZ_WIDGET_GTK2
#ifdef MOZ_WIDGET_GTK
pref("gfx.xrender.enabled",true);
#endif
#endif

View File

@ -95,7 +95,13 @@ this.UserAgentUpdates = {
let file = FileUtils.getFile(dir, [FILE_UPDATES], true).path;
// tryNext returns promise to read file under dir and parse it
let tryNext = () => OS.File.read(file).then(
(bytes) => JSON.parse(gDecoder.decode(bytes))
(bytes) => {
let update = JSON.parse(gDecoder.decode(bytes));
if (!update) {
throw new Error("invalid update");
}
return update;
}
);
// try to load next one if the previous load failed
return prevLoad ? prevLoad.then(null, tryNext) : tryNext();
@ -170,7 +176,10 @@ this.UserAgentUpdates = {
request.overrideMimeType("application/json");
request.responseType = "json";
request.addEventListener("load", function() success(request.response));
request.addEventListener("load", function() {
let response = request.response;
response ? success(response) : error();
});
request.addEventListener("error", error);
request.send();
},

View File

@ -65,7 +65,7 @@ include ../../security/manager/ssl/crashtests/crashtests.list
include ../../view/crashtests/crashtests.list
include ../../widget/cocoa/crashtests/crashtests.list
include ../../widget/gtk2/crashtests/crashtests.list
include ../../widget/gtk/crashtests/crashtests.list
include ../../widget/crashtests/crashtests.list
include ../../media/libpng/crashtests/crashtests.list

View File

@ -125,7 +125,6 @@
"dom/browser-element/mochitest/test_browserElement_inproc_SecurityChange.html": "TIMED_OUT, bug 766586",
"dom/browser-element/mochitest/test_browserElement_inproc_CloseApp.html": "FAILS, bug 796982",
"dom/devicestorage": "bug 781789 & bug 782275",
"dom/imptests/editing/conformancetest/test_event.html": "",
"dom/imptests/editing/conformancetest/test_runtest.html": "",
"dom/imptests/editing/selecttest/test_addRange.html": "bug 775227",
"dom/imptests/html/webgl": "WebGL",

View File

@ -195,7 +195,6 @@
"dom/browser-element/mochitest/test_browserElement_inproc_CloseApp.html": "FAILS, bug 796982",
"dom/contacts/tests/test_contacts_getall.html": "x86 only",
"dom/devicestorage": "bug 781789 & bug 782275",
"dom/imptests/editing/conformancetest/test_event.html": "",
"dom/imptests/editing/conformancetest/test_runtest.html": "",
"dom/imptests/editing/selecttest/test_addRange.html": "bug 775227",
"dom/imptests/html/webgl": "WebGL",

View File

@ -293,7 +293,6 @@
"dom/file/test/test_workers.html":"",
"dom/file/test/test_write_read_data.html":"",
"dom/imptests/editing/conformancetest/test_event.html":"1 failure, bug 908879",
"dom/imptests/editing/conformancetest/test_runtest.html":"takes too long",
"dom/media/tests/mochitest/test_dataChannel_basicAudio.html":"bug 908473",

View File

@ -61,7 +61,7 @@ int main(int argc, char** argv)
gdk_init(&argc, &argv);
// TODO GTK3
#if defined(HAVE_LIBXSS) && defined(MOZ_WIDGET_GTK2)
#if defined(HAVE_LIBXSS) && (MOZ_WIDGET_GTK == 2)
int event_base, error_base;
Bool have_xscreensaver =
XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base);
@ -129,7 +129,7 @@ int main(int argc, char** argv)
GdkWindow* window = gdk_get_default_root_window();
GdkPixbuf* screenshot = NULL;
// TODO GTK3
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
screenshot = gdk_pixbuf_get_from_drawable(NULL, window, NULL,
0, 0, 0, 0,
gdk_screen_width(),

View File

@ -199,14 +199,15 @@ class XPCShellTestThread(Thread):
# Processing of incremental output put here to
# sidestep issues on remote platforms, where what we know
# as proc is a file pulled off of a device.
while True:
line = proc.stdout.readline()
if not line:
break
self.process_line(line)
if proc.stdout:
while True:
line = proc.stdout.readline()
if not line:
break
self.process_line(line)
if self.saw_proc_start and not self.saw_proc_end:
self.has_failure_output = True
if self.saw_proc_start and not self.saw_proc_end:
self.has_failure_output = True
return proc.communicate()

View File

@ -206,9 +206,10 @@ add_task(function test_getTemporaryDownloadsDirectory()
add_task(function test_notifications()
{
enableObserversTestMode();
mustInterruptResponses();
for (let isPrivate of [false, true]) {
mustInterruptResponses();
let list = yield promiseNewList(isPrivate);
let download1 = yield promiseNewDownload(httpUrl("interruptible.txt"));
let download2 = yield promiseNewDownload(httpUrl("interruptible.txt"));

View File

@ -161,8 +161,11 @@ let Scheduler = {
latestPromise: Promise.resolve("OS.File scheduler hasn't been launched yet"),
post: function post(...args) {
if (!this.launched && OS.Shared.DEBUG) {
// If we have delayed sending SET_DEBUG, do it now.
worker.post("SET_DEBUG", [true]);
}
this.launched = true;
if (this.shutdown) {
LOG("OS.File is not available anymore. The following request has been rejected.", args);
return Promise.reject(new Error("OS.File has been shut down."));
@ -241,7 +244,10 @@ let readDebugPref = function readDebugPref(prefName, oldPref = false) {
Services.prefs.addObserver(PREF_OSFILE_LOG,
function prefObserver(aSubject, aTopic, aData) {
OS.Shared.DEBUG = readDebugPref(PREF_OSFILE_LOG, OS.Shared.DEBUG);
Scheduler.post("SET_DEBUG", [OS.Shared.DEBUG]);
if (Scheduler.launched) {
// Don't start the worker just to set this preference.
Scheduler.post("SET_DEBUG", [OS.Shared.DEBUG]);
}
}, false);
OS.Shared.DEBUG = readDebugPref(PREF_OSFILE_LOG, false);
@ -252,7 +258,8 @@ Services.prefs.addObserver(PREF_OSFILE_LOG_REDIRECT,
OS.Shared.TEST = readDebugPref(PREF_OSFILE_LOG_REDIRECT, false);
// Update worker's DEBUG flag if it's true.
if (OS.Shared.DEBUG === true) {
// Don't start the worker just for this, though.
if (OS.Shared.DEBUG && Scheduler.launched) {
Scheduler.post("SET_DEBUG", [true]);
}

View File

@ -210,13 +210,17 @@ Spinner.prototype = {
try {
if (typeof condition == "function") {
// Normalize |condition| to the result of the function.
condition = condition(topic);
try {
condition = condition(topic);
} catch (ex) {
condition = Promise.reject(ex);
}
}
// Normalize to a promise. Of course, if |condition| was not a
// promise in the first place (in particular if the above
// function didn't return or returned |undefined|), that new
// promise isn't going to be terribly interesting, but it will
// behave as a promise.
// function returned |undefined| or failed), that new promise
// isn't going to be terribly interesting, but it will behave
// as a promise.
condition = Promise.resolve(condition);
// If the promise takes too long to be resolved/rejected,

View File

@ -53,21 +53,29 @@ add_task(function test_simple_async() {
do_print("Testing various combinations of a phase with a single condition");
for (let arg of [undefined, null, "foo", 100, new Error("BOOM")]) {
for (let resolution of [arg, Promise.reject(arg)]) {
// Asynchronous phase
do_print("Asynchronous test with " + arg + ", " + resolution);
let topic = getUniqueTopic();
let outParam = { isFinished: false };
AsyncShutdown._getPhase(topic).addBlocker(
"Async test",
() => longRunningAsyncTask(resolution, outParam)
);
do_check_false(outParam.isFinished);
Services.obs.notifyObservers(null, topic, null);
do_check_true(outParam.isFinished);
for (let success of [false, true]) {
// Asynchronous phase
do_print("Asynchronous test with " + arg + ", " + resolution);
let topic = getUniqueTopic();
let outParam = { isFinished: false };
AsyncShutdown._getPhase(topic).addBlocker(
"Async test",
function() {
if (success) {
return longRunningAsyncTask(resolution, outParam);
} else {
throw resolution;
}
}
);
do_check_false(outParam.isFinished);
Services.obs.notifyObservers(null, topic, null);
do_check_eq(outParam.isFinished, success);
}
// Synchronous phase - just test that we don't throw/freeze
do_print("Synchronous test with " + arg + ", " + resolution);
topic = getUniqueTopic();
let topic = getUniqueTopic();
AsyncShutdown._getPhase(topic).addBlocker(
"Sync test",
resolution

View File

@ -58,7 +58,7 @@ X11Error(Display *display, XErrorEvent *event) {
}
XCloseDisplay(tmpDisplay);
#ifdef MOZ_WIDGET_GTK2
#if (MOZ_WIDGET_GTK == 2)
// GDK2 calls XCloseDevice the devices that it opened on startup, but
// the XI protocol no longer ensures that the devices will still exist.
// If they have been removed, then a BadDevice error results. Ignore

View File

@ -32,6 +32,8 @@
#define NS_DEBUG_CRT "msvcr100d.dll"
#elif _MSC_VER == 1700
#define NS_DEBUG_CRT "msvcr110d.dll"
#elif _MSC_VER == 1800
#define NS_DEBUG_CRT "msvcr120d.dll"
#else
#error "Don't know filename of MSVC debug library."
#endif

View File

@ -18,6 +18,7 @@
#include <gui/SurfaceTextureClient.h>
#else
#include <gui/Surface.h>
#include <gui/GraphicBufferAlloc.h>
#endif
#include <hardware/hardware.h>
@ -25,7 +26,9 @@
#include <hardware/power.h>
#include <suspend/autosuspend.h>
#if ANDROID_VERSION == 17
#include "GraphicBufferAlloc.h"
#endif
#include "BootAnimation.h"
using namespace android;

View File

@ -27,6 +27,7 @@ DEFINES += -DXPCOM_GLUE
LOCAL_INCLUDES += \
-I$(ANDROID_SOURCE)/hardware/libhardware/include \
-I$(ANDROID_SOURCE)/hardware/libhardware_legacy/include \
-I$(ANDROID_SOURCE)/frameworks/native/include/gui \
-I$(ANDROID_SOURCE)/frameworks/native/opengl/include \
-I$(ANDROID_SOURCE)/system/core/libsuspend/include \
-I$(srcdir) \

View File

@ -20,7 +20,12 @@ CPP_SOURCES += [
'BootAnimation.cpp',
]
if CONFIG['ANDROID_VERSION'] >= '17':
if CONFIG['ANDROID_VERSION'] >= '18':
CPP_SOURCES += [
'FramebufferSurface.cpp',
'GonkDisplayJB.cpp',
]
elif CONFIG['ANDROID_VERSION'] == '17':
CPP_SOURCES += [
'FramebufferSurface.cpp',
'GraphicBufferAlloc.cpp',

View File

@ -85,7 +85,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
// not used?
aColor = BASE_NORMAL_COLOR;
break;
case eColorID_TextForeground:
case eColorID_TextForeground:
// not used?
aColor = TEXT_NORMAL_COLOR;
break;
@ -246,7 +246,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
break;
case eColorID__moz_dragtargetzone:
aColor = BG_SELECTED_COLOR;
break;
break;
case eColorID__moz_buttondefault:
// default button border color
aColor = NS_RGB(0,0,0);
@ -359,6 +359,16 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
rv = NS_ERROR_NOT_IMPLEMENTED;
break;
case eIntID_IMERawInputUnderlineStyle:
case eIntID_IMEConvertedTextUnderlineStyle:
aResult = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
break;
case eIntID_IMESelectedRawTextUnderlineStyle:
case eIntID_IMESelectedConvertedTextUnderline:
aResult = NS_STYLE_TEXT_DECORATION_STYLE_NONE;
break;
case eIntID_SpellCheckerUnderlineStyle:
aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
break;
@ -382,6 +392,28 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
return rv;
}
nsresult
nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
{
nsresult res = nsXPLookAndFeel::GetFloatImpl(aID, aResult);
if (NS_SUCCEEDED(res))
return res;
res = NS_OK;
switch (aID) {
case eFloatID_IMEUnderlineRelativeSize:
aResult = 1.0f;
break;
case eFloatID_SpellCheckerUnderlineRelativeSize:
aResult = 1.0f;
break;
default:
aResult = -1.0;
res = NS_ERROR_FAILURE;
}
return res;
}
/*virtual*/
bool
nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,

View File

@ -28,6 +28,7 @@ public:
virtual bool GetFontImpl(FontID aID, nsString& aName, gfxFontStyle& aStyle,
float aDevPixPerCSSPixel);
virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
virtual bool GetEchoPasswordImpl();
virtual uint32_t GetPasswordMaskDelayImpl();
virtual PRUnichar GetPasswordCharacterImpl();

View File

@ -209,7 +209,7 @@ gint moz_gtk_enable_style_props(style_prop_t styleGetProp);
*/
gint moz_gtk_shutdown();
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
/**
* Retrieves the colormap to use for drawables passed to moz_gtk_widget_paint.
*/
@ -217,7 +217,7 @@ GdkColormap* moz_gtk_widget_get_colormap();
#endif
/*** Widget drawing ***/
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
/**
* Paint a widget in the current theme.
* widget: a constant giving the widget to paint

View File

@ -236,14 +236,14 @@ moz_container_realize (GtkWidget *widget)
attributes.visual = gtk_widget_get_visual (widget);
attributes.window_type = GDK_WINDOW_CHILD;
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
attributes.colormap = gtk_widget_get_colormap (widget);
attributes_mask |= GDK_WA_COLORMAP;
#endif
window = gdk_window_new (parent, &attributes, attributes_mask);
gdk_window_set_user_data (window, widget);
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
/* TODO GTK3? */
/* set the back pixmap to None so that you don't end up with the gtk
default which is BlackPixel */
@ -256,7 +256,7 @@ moz_container_realize (GtkWidget *widget)
gtk_widget_set_window (widget, window);
#if defined(MOZ_WIDGET_GTK2)
#if (MOZ_WIDGET_GTK == 2)
widget->style = gtk_style_attach (widget->style, widget->window);
#endif
}

Some files were not shown because too many files have changed in this diff Show More