Merge last PGO-green changeset from m-i to m-c.

This commit is contained in:
Ms2ger 2012-08-27 10:52:35 +02:00
commit f539a4e5bd
29 changed files with 217 additions and 106 deletions

View File

@ -12,9 +12,6 @@ Cu.import('resource://gre/modules/Services.jsm');
var EXPORTED_SYMBOLS = ['Utils', 'Logger'];
var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
getService(Ci.nsIAccessibleRetrieval);
var Utils = {
_buildAppMap: {
'{3c2e2abc-06d4-11e1-ac3b-374f68613e61}': 'b2g',
@ -23,6 +20,15 @@ var Utils = {
'{a23983c0-fd0e-11dc-95ff-0800200c9a66}': 'mobile/xul'
},
get AccRetrieval() {
if (!this._AccRetrieval) {
this._AccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
getService(Ci.nsIAccessibleRetrieval);
}
return this._AccRetrieval;
},
get MozBuildApp() {
if (!this._buildApp)
this._buildApp = this._buildAppMap[Services.appinfo.ID];
@ -72,7 +78,7 @@ var Utils = {
},
getAllDocuments: function getAllDocuments(aWindow) {
let doc = gAccRetrieval.
let doc = this.AccRetrieval.
getAccessibleFor(this.getCurrentContentDoc(aWindow)).
QueryInterface(Ci.nsIAccessibleDocument);
let docs = [];
@ -106,7 +112,7 @@ var Utils = {
getVirtualCursor: function getVirtualCursor(aDocument) {
let doc = (aDocument instanceof Ci.nsIAccessible) ? aDocument :
gAccRetrieval.getAccessibleFor(aDocument);
this.AccRetrieval.getAccessibleFor(aDocument);
while (doc) {
try {
@ -170,7 +176,7 @@ var Utils = {
if (!main)
continue;
let mainAcc = gAccRetrieval.getAccessibleFor(main);
let mainAcc = this.AccRetrieval.getAccessibleFor(main);
if (!mainAcc)
continue;
@ -237,7 +243,7 @@ var Logger = {
accessibleToString: function accessibleToString(aAccessible) {
let str = '[ defunct ]';
try {
str = '[ ' + gAccRetrieval.getStringRole(aAccessible.role) +
str = '[ ' + Utils.AccRetrieval.getStringRole(aAccessible.role) +
' | ' + aAccessible.name + ' ]';
} catch (x) {
}
@ -246,12 +252,12 @@ var Logger = {
},
eventToString: function eventToString(aEvent) {
let str = gAccRetrieval.getStringEventType(aEvent.eventType);
let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType);
if (aEvent.eventType == Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE) {
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
let stateStrings = (event.isExtraState()) ?
gAccRetrieval.getStringStates(0, event.state) :
gAccRetrieval.getStringStates(event.state, 0);
Utils.AccRetrieval.getStringStates(0, event.state) :
Utils.AccRetrieval.getStringStates(event.state, 0);
str += ' (' + stateStrings.item(0) + ')';
}
@ -261,7 +267,7 @@ var Logger = {
statesToString: function statesToString(aAccessible) {
let [state, extState] = Utils.getStates(aAccessible);
let stringArray = [];
let stateStrings = gAccRetrieval.getStringStates(state, extState);
let stateStrings = Utils.AccRetrieval.getStringStates(state, extState);
for (var i=0; i < stateStrings.length; i++)
stringArray.push(stateStrings.item(i));
return stringArray.join(' ');

View File

@ -17,11 +17,11 @@ var gStringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
getService(Ci.nsIStringBundleService).
createBundle('chrome://global/locale/AccessFu.properties');
var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
getService(Ci.nsIAccessibleRetrieval);
var EXPORTED_SYMBOLS = ['UtteranceGenerator'];
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
/**
* Generates speech utterances from objects, actions and state changes.
* An utterance is an array of strings.
@ -66,7 +66,7 @@ var UtteranceGenerator = {
* {@link verbosityRoleMap}.
*/
genForObject: function genForObject(aAccessible) {
let roleString = gAccRetrieval.getStringRole(aAccessible.role);
let roleString = Utils.AccRetrieval.getStringRole(aAccessible.role);
let func = this.objectUtteranceFunctions[roleString] ||
this.objectUtteranceFunctions.defaultFunc;

View File

@ -14,9 +14,6 @@ var EXPORTED_SYMBOLS = ['VirtualCursorController'];
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
getService(Ci.nsIAccessibleRetrieval);
function BaseTraversalRule(aRoles, aMatchFunc) {
this._matchRoles = aRoles;
this._matchFunc = aMatchFunc;
@ -349,7 +346,7 @@ var VirtualCursorController = {
} catch (x) {
this.moveCursorToObject(
virtualCursor,
gAccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
Utils.AccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
}
}
},
@ -364,7 +361,7 @@ var VirtualCursorController = {
} catch (x) {
this.moveCursorToObject(
virtualCursor,
gAccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
Utils.AccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
}
}
},
@ -380,7 +377,7 @@ var VirtualCursorController = {
// (via ARIA roles, etc.), so we need to generate a click.
// Could possibly be made simpler in the future. Maybe core
// engine could expose nsCoreUtiles::DispatchMouseEvent()?
let docAcc = gAccRetrieval.getAccessibleFor(this.chromeWin.document);
let docAcc = Utils.AccRetrieval.getAccessibleFor(this.chromeWin.document);
let docX = {}, docY = {}, docW = {}, docH = {};
docAcc.getBounds(docX, docY, docW, docH);

View File

@ -525,3 +525,6 @@ pref("dom.ipc.processPrelauch.delayMs", 1000);
// Ignore the "dialog=1" feature in window.open.
pref("dom.disable_window_open_dialog_feature", true);
// Screen reader support
pref("accessibility.accessfu.activate", 2);

View File

@ -18,6 +18,7 @@ Cu.import('resource://gre/modules/AlarmService.jsm');
Cu.import('resource://gre/modules/ActivitiesService.jsm');
Cu.import('resource://gre/modules/PermissionPromptHelper.jsm');
Cu.import('resource://gre/modules/ObjectWrapper.jsm');
Cu.import("resource://gre/modules/accessibility/AccessFu.jsm");
XPCOMUtils.defineLazyServiceGetter(Services, 'env',
'@mozilla.org/process/environment;1',
@ -149,6 +150,7 @@ var shell = {
CustomEventManager.init();
WebappsHelper.init();
AccessFu.attach(window);
// XXX could factor out into a settings->pref map. Not worth it yet.
SettingsListener.observe("debug.fps.enabled", false, function(value) {

View File

@ -2813,7 +2813,6 @@ stack[anonid=browserStack][responsivemode] {
box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2);
}
/* toolbarbutton-icon */
.chatbar-button > .toolbarbutton-text,
.chatbar-button > .toolbarbutton-menu-dropmarker {
display: none;
@ -2821,24 +2820,24 @@ stack[anonid=browserStack][responsivemode] {
.chatbar-innerbox {
background: transparent;
margin: -200px -1px 0 -1px;
margin: -285px -1px 0 -1px;
overflow: hidden;
}
chatbar > chatbox {
height: 200px;
width: 200px;
chatbar {
-moz-margin-end: 20px;
}
chatbox {
height: 285px;
width: 260px;
-moz-margin-start: 4px;
background-color: white;
border: 1px solid gray;
border-bottom: none;
}
chatbar > chatbox[minimized="true"] {
width: 100px;
chatbox[minimized="true"] {
width: 160px;
height: 20px;
border-bottom: none;
}
chatbar > chatbox + chatbox {
-moz-margin-start: -1px;
}

View File

@ -3502,7 +3502,6 @@ stack[anonid=browserStack][responsivemode] {
box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2);
}
/* toolbarbutton-icon */
.chatbar-button > .toolbarbutton-text,
.chatbar-button > .toolbarbutton-menu-dropmarker {
display: none;
@ -3510,25 +3509,24 @@ stack[anonid=browserStack][responsivemode] {
.chatbar-innerbox {
background: transparent;
margin: -200px -1px 0 -1px;
margin: -285px -1px 0 -1px;
overflow: hidden;
}
chatbar > chatbox {
height: 200px;
width: 200px;
chatbar {
-moz-margin-end: 20px;
}
chatbox {
height: 285px;
width: 260px;
-moz-margin-start: 4px;
background-color: white;
border: 1px solid #404040;
border-bottom: none;
}
chatbar > chatbox[minimized="true"] {
width: 100px;
chatbox[minimized="true"] {
width: 160px;
height: 20px;
border-bottom: none;
}
chatbar > chatbox + chatbox {
-moz-margin-start: -1px;
}

View File

@ -3525,7 +3525,6 @@ stack[anonid=browserStack][responsivemode] {
box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2);
}
/* toolbarbutton-icon */
.chatbar-button > .toolbarbutton-text,
.chatbar-button > .toolbarbutton-menu-dropmarker {
display: none;
@ -3533,25 +3532,24 @@ stack[anonid=browserStack][responsivemode] {
.chatbar-innerbox {
background: transparent;
margin: -200px -1px 0 -1px;
margin: -285px -1px 0 -1px;
overflow: hidden;
}
chatbar > chatbox {
height: 200px;
width: 200px;
chatbar {
-moz-margin-end: 20px;
}
chatbox {
height: 285px;
width: 260px;
-moz-margin-start: 4px;
background-color: white;
border: 1px solid gray;
border-bottom: none;
}
chatbar > chatbox[minimized="true"] {
width: 100px;
chatbox[minimized="true"] {
width: 160px;
height: 20px;
border-bottom: none;
}
chatbar > chatbox + chatbox {
-moz-margin-start: -1px;
}

View File

@ -445,6 +445,7 @@ GK_ATOM(inherits, "inherits")
GK_ATOM(inheritstyle, "inheritstyle")
GK_ATOM(initial_scale, "initial-scale")
GK_ATOM(input, "input")
GK_ATOM(inputmode, "inputmode")
GK_ATOM(ins, "ins")
GK_ATOM(insertafter, "insertafter")
GK_ATOM(insertbefore, "insertbefore")

View File

@ -322,6 +322,8 @@ nsIMEStateManager::SetIMEState(const IMEState &aState,
aContent->Tag() == nsGkAtoms::textarea)) {
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type,
context.mHTMLInputType);
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::inputmode,
context.mHTMLInputInputmode);
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::moz_action_hint,
context.mActionHint);

View File

@ -147,6 +147,28 @@ static const nsAttrValue::EnumTable kInputAutocompleteTable[] = {
// Default autocomplete value is "".
static const nsAttrValue::EnumTable* kInputDefaultAutocomplete = &kInputAutocompleteTable[0];
static const uint8_t NS_INPUT_INPUTMODE_AUTO = 0;
static const uint8_t NS_INPUT_INPUTMODE_NUMERIC = 1;
static const uint8_t NS_INPUT_INPUTMODE_DIGIT = 2;
static const uint8_t NS_INPUT_INPUTMODE_UPPERCASE = 3;
static const uint8_t NS_INPUT_INPUTMODE_LOWERCASE = 4;
static const uint8_t NS_INPUT_INPUTMODE_TITLECASE = 5;
static const uint8_t NS_INPUT_INPUTMODE_AUTOCAPITALIZED = 6;
static const nsAttrValue::EnumTable kInputInputmodeTable[] = {
{ "auto", NS_INPUT_INPUTMODE_AUTO },
{ "numeric", NS_INPUT_INPUTMODE_NUMERIC },
{ "digit", NS_INPUT_INPUTMODE_DIGIT },
{ "uppercase", NS_INPUT_INPUTMODE_UPPERCASE },
{ "lowercase", NS_INPUT_INPUTMODE_LOWERCASE },
{ "titlecase", NS_INPUT_INPUTMODE_TITLECASE },
{ "autocapitalized", NS_INPUT_INPUTMODE_AUTOCAPITALIZED },
{ 0 }
};
// Default inputmode value is "auto".
static const nsAttrValue::EnumTable* kInputDefaultInputmode = &kInputInputmodeTable[0];
const double nsHTMLInputElement::kDefaultStepBase = 0;
const double nsHTMLInputElement::kStepAny = 0;
@ -866,6 +888,8 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, FormMethod, formmethod,
kFormDefaultMethod->tag)
NS_IMPL_BOOL_ATTR(nsHTMLInputElement, FormNoValidate, formnovalidate)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, FormTarget, formtarget)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, Inputmode, inputmode,
kInputDefaultInputmode->tag)
NS_IMPL_BOOL_ATTR(nsHTMLInputElement, Multiple, multiple)
NS_IMPL_NON_NEGATIVE_INT_ATTR(nsHTMLInputElement, MaxLength, maxlength)
NS_IMPL_STRING_ATTR(nsHTMLInputElement, Name, name)
@ -2741,6 +2765,9 @@ nsHTMLInputElement::ParseAttribute(int32_t aNamespaceID,
if (aAttribute == nsGkAtoms::autocomplete) {
return aResult.ParseEnumValue(aValue, kInputAutocompleteTable, false);
}
if (aAttribute == nsGkAtoms::inputmode) {
return aResult.ParseEnumValue(aValue, kInputInputmodeTable, false);
}
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
// We have to call |ParseImageAttribute| unconditionally since we
// don't know if we're going to have a type="image" attribute yet,

View File

@ -110,6 +110,15 @@ reflectUnsignedInt({
// .indeterminate doesn't reflect a content attribute.
// .inputmode
reflectLimitedEnumerated({
element: document.createElement("input"),
attribute: "inputmode",
validValues: [ "numeric", "digit", "uppercase", "lowercase", "titlecase", "autocapitalized", "auto" ],
invalidValues: [ "", "foo", "tulip" ],
defaultValue: "auto"
});
// TODO: list (HTMLElement)
// .max

View File

@ -20,7 +20,7 @@ interface nsIDOMValidityState;
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(c12471c8-155f-4368-9e8b-13a231e85f3b)]
[scriptable, uuid(83984fd0-b0b2-11e1-afa6-0800200c9a66)]
interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
{
attribute DOMString accept;
@ -43,6 +43,8 @@ interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
attribute unsigned long height;
attribute boolean indeterminate;
attribute DOMString inputmode;
readonly attribute nsIDOMHTMLElement list;
attribute DOMString max;
attribute long maxLength;

View File

@ -161,6 +161,7 @@ parent:
SetInputContext(int32_t IMEEnabled,
int32_t IMEOpen,
nsString type,
nsString inputmode,
nsString actionHint,
int32_t cause,
int32_t focusChange);

View File

@ -684,6 +684,7 @@ bool
TabParent::RecvSetInputContext(const int32_t& aIMEEnabled,
const int32_t& aIMEOpen,
const nsString& aType,
const nsString& aInputmode,
const nsString& aActionHint,
const int32_t& aCause,
const int32_t& aFocusChange)
@ -701,6 +702,7 @@ TabParent::RecvSetInputContext(const int32_t& aIMEEnabled,
context.mIMEState.mEnabled = static_cast<IMEState::Enabled>(aIMEEnabled);
context.mIMEState.mOpen = static_cast<IMEState::Open>(aIMEOpen);
context.mHTMLInputType.Assign(aType);
context.mHTMLInputInputmode.Assign(aInputmode);
context.mActionHint.Assign(aActionHint);
InputContextAction action(
static_cast<InputContextAction::Cause>(aCause),

View File

@ -98,6 +98,7 @@ public:
virtual bool RecvSetInputContext(const int32_t& aIMEEnabled,
const int32_t& aIMEOpen,
const nsString& aType,
const nsString& aInputmode,
const nsString& aActionHint,
const int32_t& aCause,
const int32_t& aFocusChange);

View File

@ -896,11 +896,11 @@ var WifiManager = (function() {
function didConnectSupplicant(reconnected, callback) {
waitForEvent();
notify("supplicantconnection");
// Load up the supplicant state.
statusCommand(function(status) {
parseStatus(status, reconnected);
notify("supplicantconnection");
callback();
});
}
@ -1945,7 +1945,7 @@ WifiWorker.prototype = {
getNetworks: function(msg) {
const message = "WifiManager:getNetworks:Return";
if (WifiManager.state === "UNINITIALIZED") {
if (!WifiManager.enabled) {
this._sendMessage(message, false, "Wifi is disabled", msg);
return;
}
@ -2023,7 +2023,7 @@ WifiWorker.prototype = {
const MAX_PRIORITY = 9999;
const message = "WifiManager:associate:Return";
let network = msg.data;
if (WifiManager.state === "UNINITIALIZED") {
if (!WifiManager.enabled) {
this._sendMessage(message, false, "Wifi is disabled", msg);
return;
}
@ -2093,7 +2093,7 @@ WifiWorker.prototype = {
forget: function(msg) {
const message = "WifiManager:forget:Return";
let network = msg.data;
if (WifiManager.state === "UNINITIALIZED") {
if (!WifiManager.enabled) {
this._sendMessage(message, false, "Wifi is disabled", msg);
return;
}

View File

@ -539,7 +539,7 @@ public class GeckoAppShell
}
}
public static void notifyIMEEnabled(int state, String typeHint,
public static void notifyIMEEnabled(int state, String typeHint, String modeHint,
String actionHint, boolean landscapeFS)
{
if (GeckoApp.surfaceView == null)
@ -549,6 +549,7 @@ public class GeckoAppShell
In addition, the IME UI is hidden */
GeckoApp.surfaceView.mIMEState = state;
GeckoApp.surfaceView.mIMETypeHint = typeHint;
GeckoApp.surfaceView.mIMEModeHint = modeHint;
GeckoApp.surfaceView.mIMEActionHint = actionHint;
GeckoApp.surfaceView.mIMELandscapeFS = landscapeFS;
IMEStateUpdater.enableIME();

View File

@ -63,6 +63,7 @@ class GeckoSurfaceView
initEditable("");
mIMEState = IME_STATE_DISABLED;
mIMETypeHint = "";
mIMEModeHint = "";
mIMEActionHint = "";
}
@ -502,6 +503,20 @@ class GeckoSurfaceView
else if (mIMETypeHint.equalsIgnoreCase("time"))
outAttrs.inputType = InputType.TYPE_CLASS_DATETIME |
InputType.TYPE_DATETIME_VARIATION_TIME;
else if (mIMEModeHint.equalsIgnoreCase("numeric"))
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER |
InputType.TYPE_NUMBER_FLAG_SIGNED |
InputType.TYPE_NUMBER_FLAG_DECIMAL;
else if (mIMEModeHint.equalsIgnoreCase("digit"))
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER;
else if (mIMEModeHint.equalsIgnoreCase("uppercase"))
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
else if (mIMEModeHint.equalsIgnoreCase("lowercase"))
outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
else if (mIMEModeHint.equalsIgnoreCase("titlecase"))
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS;
else if (mIMEModeHint.equalsIgnoreCase("autocapitalized"))
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
if (mIMEActionHint.equalsIgnoreCase("go"))
outAttrs.imeOptions = EditorInfo.IME_ACTION_GO;
@ -748,6 +763,7 @@ class GeckoSurfaceView
Editable.Factory mEditableFactory;
int mIMEState;
String mIMETypeHint;
String mIMEModeHint;
String mIMEActionHint;
boolean mIMELandscapeFS;

View File

@ -6,6 +6,7 @@
/* Utilities for animation of computed style values */
#include "mozilla/Util.h"
#include "mozilla/MathAlgorithms.h"
#include "nsStyleAnimation.h"
#include "nsCOMArray.h"
@ -242,33 +243,6 @@ ToPrimitive(nsCSSValue::Array* aArray)
return arr.forget();
}
// Greatest Common Divisor
static uint32_t
gcd(uint32_t a, uint32_t b)
{
// Euclid's algorithm; O(N) in the worst case. (There are better
// ways, but we don't need them for stroke-dasharray animation.)
NS_ABORT_IF_FALSE(a > 0 && b > 0, "positive numbers expected");
while (a != b) {
if (a > b) {
a = a - b;
} else {
b = b - a;
}
}
return a;
}
// Least Common Multiple
static uint32_t
lcm(uint32_t a, uint32_t b)
{
// Divide first to reduce overflow risk.
return (a / gcd(a, b)) * b;
}
inline void
nscoordToCSSValue(nscoord aCoord, nsCSSValue& aCSSValue)
{
@ -1953,7 +1927,7 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
nsAutoPtr<nsCSSValueList> result;
nsCSSValueList **resultTail = getter_Transfers(result);
for (uint32_t i = 0, i_end = lcm(len1, len2); i != i_end; ++i) {
for (uint32_t i = 0, i_end = EuclidLCM<uint32_t>(len1, len2); i != i_end; ++i) {
const nsCSSValue &v1 = list1->mValue;
const nsCSSValue &v2 = list2->mValue;
NS_ABORT_IF_FALSE(v1.GetUnit() == eCSSUnit_Number ||

47
mfbt/MathAlgorithms.h Normal file
View File

@ -0,0 +1,47 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* mfbt maths algorithms. */
#ifndef mozilla_MathAlgorithms_h_
#define mozilla_MathAlgorithms_h_
#include "mozilla/Assertions.h"
namespace mozilla {
// Greatest Common Divisor
template<typename IntegerType>
MOZ_ALWAYS_INLINE IntegerType
EuclidGCD(IntegerType a, IntegerType b)
{
// Euclid's algorithm; O(N) in the worst case. (There are better
// ways, but we don't need them for the current use of this algo.)
MOZ_ASSERT(a > 0);
MOZ_ASSERT(b > 0);
while (a != b) {
if (a > b) {
a = a - b;
} else {
b = b - a;
}
}
return a;
}
// Least Common Multiple
template<typename IntegerType>
MOZ_ALWAYS_INLINE IntegerType
EuclidLCM(IntegerType a, IntegerType b)
{
// Divide first to reduce overflow risk.
return (a / EuclidGCD(a, b)) * b;
}
} /* namespace mozilla */
#endif /* mozilla_MathAlgorithms_h_ */

View File

@ -19,6 +19,7 @@ EXPORTS_mozilla += \
HashFunctions.h \
Likely.h \
LinkedList.h \
MathAlgorithms.h \
MSStdInt.h \
RangedPtr.h \
RefPtr.h \

View File

@ -585,12 +585,12 @@ public class GeckoAppShell
mInputConnection.notifyIME(type, state);
}
public static void notifyIMEEnabled(int state, String typeHint,
public static void notifyIMEEnabled(int state, String typeHint, String modeHint,
String actionHint, boolean landscapeFS) {
// notifyIMEEnabled() still needs the landscapeFS parameter because it is called from JNI
// code that assumes it has the same signature as XUL Fennec's (which does use landscapeFS).
if (mInputConnection != null)
mInputConnection.notifyIMEEnabled(state, typeHint, actionHint);
mInputConnection.notifyIMEEnabled(state, typeHint, modeHint, actionHint);
}
public static void notifyIMEChange(String text, int start, int end, int newEnd) {

View File

@ -86,6 +86,7 @@ class GeckoInputConnection
private static final Timer mIMETimer = new Timer("GeckoInputConnection Timer");
private static int mIMEState;
private static String mIMETypeHint = "";
private static String mIMEModeHint = "";
private static String mIMEActionHint = "";
private String mCurrentInputMethod;
@ -804,6 +805,20 @@ class GeckoInputConnection
else if (mIMETypeHint.equalsIgnoreCase("time"))
outAttrs.inputType = InputType.TYPE_CLASS_DATETIME
| InputType.TYPE_DATETIME_VARIATION_TIME;
else if (mIMEModeHint.equalsIgnoreCase("numeric"))
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER |
InputType.TYPE_NUMBER_FLAG_SIGNED |
InputType.TYPE_NUMBER_FLAG_DECIMAL;
else if (mIMEModeHint.equalsIgnoreCase("digit"))
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER;
else if (mIMEModeHint.equalsIgnoreCase("uppercase"))
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
else if (mIMEModeHint.equalsIgnoreCase("lowercase"))
outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
else if (mIMEModeHint.equalsIgnoreCase("titlecase"))
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS;
else if (mIMEModeHint.equalsIgnoreCase("autocapitalized"))
outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
if (mIMEActionHint.equalsIgnoreCase("go"))
outAttrs.imeOptions = EditorInfo.IME_ACTION_GO;
@ -1030,7 +1045,7 @@ class GeckoInputConnection
});
}
public void notifyIMEEnabled(final int state, final String typeHint, final String actionHint) {
public void notifyIMEEnabled(final int state, final String typeHint, final String modeHint, final String actionHint) {
postToUiThread(new Runnable() {
public void run() {
View v = getView();
@ -1041,6 +1056,7 @@ class GeckoInputConnection
In addition, the IME UI is hidden */
mIMEState = state;
mIMETypeHint = (typeHint == null) ? "" : typeHint;
mIMEModeHint = (modeHint == null) ? "" : modeHint;
mIMEActionHint = (actionHint == null) ? "" : actionHint;
IMEStateUpdater.enableIME();
}
@ -1441,13 +1457,14 @@ private static final class DebugGeckoInputConnection extends GeckoInputConnectio
}
@Override
public void notifyIMEEnabled(int state, String typeHint, String actionHint) {
public void notifyIMEEnabled(int state, String typeHint, String modeHint, String actionHint) {
Log.d(LOGTAG, "IME: >notifyIMEEnabled(state=" + state + ", typeHint=\"" + typeHint
+ "\", actionHint=\"" + actionHint + "\"");
+ "\", modeHint=\"" + modeHint + "\", actionHint=\""
+ actionHint + "\"");
GeckoApp.assertOnGeckoThread();
if (state < IME_STATE_DISABLED || state > IME_STATE_PLUGIN)
throw new IllegalArgumentException("Unexpected IMEState=" + state);
super.notifyIMEEnabled(state, typeHint, actionHint);
super.notifyIMEEnabled(state, typeHint, modeHint, actionHint);
}
}

View File

@ -99,7 +99,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
mGeckoAppShellClass = (jclass) jEnv->NewGlobalRef(jGeckoAppShellClass);
jNotifyIME = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIME", "(II)V");
jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;Z)V");
jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V");
jNotifyIMEChange = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEChange", "(Ljava/lang/String;III)V");
jNotifyScreenShot = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyScreenShot", "(Ljava/nio/ByteBuffer;IIIIIIII)V");
jAcknowledgeEventSync = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "acknowledgeEventSync", "()V");
@ -263,7 +263,7 @@ jstring NewJavaString(AutoLocalJNIFrame* frame, const PRUnichar* string, uint32_
void
AndroidBridge::NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
const nsAString& aActionHint)
const nsAString& aModeHint, const nsAString& aActionHint)
{
ALOG_BRIDGE("AndroidBridge::NotifyIMEEnabled");
if (!sBridge)
@ -275,18 +275,20 @@ AndroidBridge::NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
AutoLocalJNIFrame jniFrame(env);
nsPromiseFlatString typeHint(aTypeHint);
nsPromiseFlatString modeHint(aModeHint);
nsPromiseFlatString actionHint(aActionHint);
jvalue args[4];
jvalue args[5];
args[0].i = aState;
args[1].l = NewJavaString(&jniFrame, typeHint.get(), typeHint.Length());
args[2].l = NewJavaString(&jniFrame, actionHint.get(), actionHint.Length());
args[3].z = false;
args[2].l = env->NewString(modeHint.get(), modeHint.Length());
args[3].l = env->NewString(actionHint.get(), actionHint.Length());
args[4].z = false;
int32_t landscapeFS;
if (NS_SUCCEEDED(Preferences::GetInt(IME_FULLSCREEN_PREF, &landscapeFS))) {
if (landscapeFS == 1) {
args[3].z = true;
args[4].z = true;
} else if (landscapeFS == -1){
if (NS_SUCCEEDED(
Preferences::GetInt(IME_FULLSCREEN_THRESHOLD_PREF,
@ -295,7 +297,7 @@ AndroidBridge::NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
// threshold to pixels and multiply the height by 100
if (nsWindow::GetAndroidScreenBounds().height * 100 <
landscapeFS * Bridge()->GetDPI()) {
args[3].z = true;
args[4].z = true;
}
}

View File

@ -142,7 +142,7 @@ public:
static void NotifyIME(int aType, int aState);
static void NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
const nsAString& aActionHint);
const nsAString& aModeHint, const nsAString& aActionHint);
static void NotifyIMEChange(const PRUnichar *aText, uint32_t aTextLen, int aStart, int aEnd, int aNewEnd);

View File

@ -2115,6 +2115,7 @@ nsWindow::SetInputContext(const InputContext& aContext,
AndroidBridge::NotifyIMEEnabled(enabled,
aContext.mHTMLInputType,
aContext.mHTMLInputInputmode,
aContext.mActionHint);
}

View File

@ -281,6 +281,9 @@ struct InputContext {
/* The type of the input if the input is a html input field */
nsString mHTMLInputType;
/* The type of the inputmode */
nsString mHTMLInputInputmode;
/* A hint for the action that is performed when the input is submitted */
nsString mActionHint;
};

View File

@ -363,6 +363,7 @@ PuppetWidget::SetInputContext(const InputContext& aContext,
static_cast<int32_t>(aContext.mIMEState.mEnabled),
static_cast<int32_t>(aContext.mIMEState.mOpen),
aContext.mHTMLInputType,
aContext.mHTMLInputInputmode,
aContext.mActionHint,
static_cast<int32_t>(aAction.mCause),
static_cast<int32_t>(aAction.mFocusChange));