Merge m-c to m-i

This commit is contained in:
Phil Ringnalda 2013-12-08 17:32:55 -08:00
commit d673d7e6ed
29 changed files with 235 additions and 287 deletions

View File

@ -284,6 +284,7 @@ textarea:active {
background-color: rgba(141, 184, 216, 0.5);
}
input[type=number] > div > div, /* work around bug 946184 */
input[type=number]::-moz-number-spin-box {
display: none;
}

View File

@ -56,9 +56,7 @@ MOZ_TOOLKIT_SEARCH=
MOZ_PLACES=
MOZ_B2G=1
if test "$OS_TARGET" = "Android"; then
MOZ_NUWA_PROCESS=1
fi
#MOZ_NUWA_PROCESS=1
MOZ_FOLD_LIBS=1
MOZ_JSDOWNLOADS=1

View File

@ -113,8 +113,8 @@ class DOMRectList;
// IID for the dom::Element interface
#define NS_ELEMENT_IID \
{ 0xec962aa7, 0x53ee, 0x46ff, \
{ 0x90, 0x34, 0x68, 0xea, 0x79, 0x9d, 0x7d, 0xf7 } }
{ 0xf7c18f0f, 0xa8fd, 0x4a95, \
{ 0x91, 0x72, 0xd3, 0xa7, 0x4a, 0xb8, 0xc4, 0xbe } }
class Element : public FragmentOrElement
{
@ -385,16 +385,17 @@ private:
// Style state computed from element's state and style locks.
nsEventStates StyleStateFromLocks() const;
protected:
// Methods for the ESM to manage state bits. These will handle
// setting up script blockers when they notify, so no need to do it
// in the callers unless desired.
void AddStates(nsEventStates aStates) {
virtual void AddStates(nsEventStates aStates) {
NS_PRECONDITION(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be adding ESM-managed states here");
AddStatesSilently(aStates);
NotifyStateChange(aStates);
}
void RemoveStates(nsEventStates aStates) {
virtual void RemoveStates(nsEventStates aStates) {
NS_PRECONDITION(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing ESM-managed states here");
RemoveStatesSilently(aStates);

View File

@ -1,6 +1,7 @@
default-preferences pref(dom.forms.number,true)
needs-focus == input-load.html input-ref.html
needs-focus == input-create.html input-ref.html
fails-if(Android) needs-focus == input-number.html input-number-ref.html
needs-focus == input-number.html input-number-ref.html
needs-focus == button-load.html button-ref.html
needs-focus == button-create.html button-ref.html
needs-focus == textarea-load.html textarea-ref.html

View File

@ -5731,6 +5731,38 @@ HTMLInputElement::IntrinsicState() const
return state;
}
void
HTMLInputElement::AddStates(nsEventStates aStates)
{
if (mType == NS_FORM_INPUT_TEXT) {
nsEventStates focusStates(aStates & (NS_EVENT_STATE_FOCUS |
NS_EVENT_STATE_FOCUSRING));
if (!focusStates.IsEmpty()) {
HTMLInputElement* ownerNumberControl = GetOwnerNumberControl();
if (ownerNumberControl) {
ownerNumberControl->AddStates(focusStates);
}
}
}
nsGenericHTMLFormElementWithState::AddStates(aStates);
}
void
HTMLInputElement::RemoveStates(nsEventStates aStates)
{
if (mType == NS_FORM_INPUT_TEXT) {
nsEventStates focusStates(aStates & (NS_EVENT_STATE_FOCUS |
NS_EVENT_STATE_FOCUSRING));
if (!focusStates.IsEmpty()) {
HTMLInputElement* ownerNumberControl = GetOwnerNumberControl();
if (ownerNumberControl) {
ownerNumberControl->RemoveStates(focusStates);
}
}
}
nsGenericHTMLFormElementWithState::RemoveStates(aStates);
}
bool
HTMLInputElement::RestoreState(nsPresState* aState)
{

View File

@ -166,6 +166,12 @@ public:
virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE;
// Element
private:
virtual void AddStates(nsEventStates aStates);
virtual void RemoveStates(nsEventStates aStates);
public:
// nsITextControlElement
NS_IMETHOD SetValueChanged(bool aValueChanged) MOZ_OVERRIDE;
NS_IMETHOD_(bool) IsSingleLineTextControl() const MOZ_OVERRIDE;

View File

@ -1348,6 +1348,17 @@ PreloadSlowThings()
TabChild::PreloadSlowThings();
#ifdef MOZ_NUWA_PROCESS
// After preload of slow things, start freezing threads.
if (IsNuwaProcess()) {
// Perform GC before freezing the Nuwa process to reduce memory usage.
ContentChild::GetSingleton()->RecvGarbageCollect();
MessageLoop::current()->
PostTask(FROM_HERE,
NewRunnableFunction(OnFinishNuwaPreparation));
}
#endif
}
bool
@ -1358,32 +1369,15 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
mAppInfo.buildID.Assign(buildID);
mAppInfo.name.Assign(name);
mAppInfo.UAName.Assign(UAName);
if (!Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
return true;
}
// If we're part of the mozbrowser machinery, go ahead and start
// preloading things. We can only do this for mozbrowser because
// PreloadSlowThings() may set the docshell of the first TabChild
// inactive, and we can only safely restore it to active from
// BrowserElementChild.js.
if ((mIsForApp || mIsForBrowser)
#ifdef MOZ_NUWA_PROCESS
&& !IsNuwaProcess()
#endif
) {
if ((mIsForApp || mIsForBrowser) &&
Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
PreloadSlowThings();
}
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess()) {
ContentChild::GetSingleton()->RecvGarbageCollect();
MessageLoop::current()->PostTask(
FROM_HERE, NewRunnableFunction(OnFinishNuwaPreparation));
}
#endif
return true;
}

View File

@ -1249,13 +1249,93 @@ ContentParent::ContentParent(mozIApplication* aApp,
Open(mSubprocess->GetChannel(), mSubprocess->GetOwnedChildProcessHandle());
InitInternal(aInitialPriority,
true, /* Setup off-main thread compositing */
true /* Send registered chrome */);
// Set the subprocess's priority. We do this early on because we're likely
// /lowering/ the process's CPU and memory priority, which it has inherited
// from this process.
//
// This call can cause us to send IPC messages to the child process, so it
// must come after the Open() call above.
ProcessPriorityManager::SetProcessPriority(this, aInitialPriority);
// NB: internally, this will send an IPC message to the child
// process to get it to create the CompositorChild. This
// message goes through the regular IPC queue for this
// channel, so delivery will happen-before any other messages
// we send. The CompositorChild must be created before any
// PBrowsers are created, because they rely on the Compositor
// already being around. (Creation is async, so can't happen
// on demand.)
bool useOffMainThreadCompositing = !!CompositorParent::CompositorLoop();
if (useOffMainThreadCompositing) {
DebugOnly<bool> opened = PCompositor::Open(this);
MOZ_ASSERT(opened);
if (Preferences::GetBool("layers.async-video.enabled",false)) {
opened = PImageBridge::Open(this);
MOZ_ASSERT(opened);
}
}
nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
nsChromeRegistryChrome* chromeRegistry =
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
chromeRegistry->SendRegisteredChrome(this);
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
if (gAppData) {
nsCString version(gAppData->version);
nsCString buildID(gAppData->buildID);
nsCString name(gAppData->name);
nsCString UAName(gAppData->UAName);
// Sending all information to content process.
unused << SendAppInfo(version, buildID, name, UAName);
}
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
if (sheetService) {
// This looks like a lot of work, but in a normal browser session we just
// send two loads.
nsCOMArray<nsIStyleSheet>& agentSheets = *sheetService->AgentStyleSheets();
for (uint32_t i = 0; i < agentSheets.Length(); i++) {
URIParams uri;
SerializeURI(agentSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
}
nsCOMArray<nsIStyleSheet>& userSheets = *sheetService->UserStyleSheets();
for (uint32_t i = 0; i < userSheets.Length(); i++) {
URIParams uri;
SerializeURI(userSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
}
nsCOMArray<nsIStyleSheet>& authorSheets = *sheetService->AuthorStyleSheets();
for (uint32_t i = 0; i < authorSheets.Length(); i++) {
URIParams uri;
SerializeURI(authorSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
}
}
#ifdef MOZ_CONTENT_SANDBOX
// Bug 921817. We enable the sandbox in RecvSetProcessPrivileges,
// which is where a preallocated process drops unnecessary privileges,
// but a non-preallocated process will already have changed its
// uid/gid/etc immediately after forking. Thus, we send this message,
// which is otherwise a no-op, to sandbox it at an appropriate point
// during startup.
if (aOSPrivileges != base::PRIVILEGES_INHERIT) {
if (!SendSetProcessPrivileges(base::PRIVILEGES_INHERIT)) {
KillHard();
}
}
#endif
}
#ifdef MOZ_NUWA_PROCESS
static const mozilla::ipc::FileDescriptor*
static const FileDescriptor*
FindFdProtocolFdMapping(const nsTArray<ProtocolFdMapping>& aFds,
ProtocolId aProtoId)
{
@ -1321,9 +1401,8 @@ ContentParent::ContentParent(ContentParent* aTemplate,
priority = PROCESS_PRIORITY_FOREGROUND;
}
InitInternal(priority,
false, /* Setup Off-main thread compositing */
false /* Send registered chrome */);
ProcessPriorityManager::SetProcessPriority(this, priority);
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
}
#endif // MOZ_NUWA_PROCESS
@ -1353,101 +1432,6 @@ ContentParent::~ContentParent()
}
}
void
ContentParent::InitInternal(ProcessPriority aInitialPriority,
bool aSetupOffMainThreadCompositing,
bool aSendRegisteredChrome)
{
// Set the subprocess's priority. We do this early on because we're likely
// /lowering/ the process's CPU and memory priority, which it has inherited
// from this process.
//
// This call can cause us to send IPC messages to the child process, so it
// must come after the Open() call above.
ProcessPriorityManager::SetProcessPriority(this, aInitialPriority);
if (aSetupOffMainThreadCompositing) {
// NB: internally, this will send an IPC message to the child
// process to get it to create the CompositorChild. This
// message goes through the regular IPC queue for this
// channel, so delivery will happen-before any other messages
// we send. The CompositorChild must be created before any
// PBrowsers are created, because they rely on the Compositor
// already being around. (Creation is async, so can't happen
// on demand.)
bool useOffMainThreadCompositing = !!CompositorParent::CompositorLoop();
if (useOffMainThreadCompositing) {
DebugOnly<bool> opened = PCompositor::Open(this);
MOZ_ASSERT(opened);
if (Preferences::GetBool("layers.async-video.enabled",false)) {
opened = PImageBridge::Open(this);
MOZ_ASSERT(opened);
}
}
}
if (aSendRegisteredChrome) {
nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
nsChromeRegistryChrome* chromeRegistry =
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
chromeRegistry->SendRegisteredChrome(this);
}
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
if (gAppData) {
nsCString version(gAppData->version);
nsCString buildID(gAppData->buildID);
nsCString name(gAppData->name);
nsCString UAName(gAppData->UAName);
// Sending all information to content process.
unused << SendAppInfo(version, buildID, name, UAName);
}
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
if (sheetService) {
// This looks like a lot of work, but in a normal browser session we just
// send two loads.
nsCOMArray<nsIStyleSheet>& agentSheets = *sheetService->AgentStyleSheets();
for (uint32_t i = 0; i < agentSheets.Length(); i++) {
URIParams uri;
SerializeURI(agentSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
}
nsCOMArray<nsIStyleSheet>& userSheets = *sheetService->UserStyleSheets();
for (uint32_t i = 0; i < userSheets.Length(); i++) {
URIParams uri;
SerializeURI(userSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
}
nsCOMArray<nsIStyleSheet>& authorSheets = *sheetService->AuthorStyleSheets();
for (uint32_t i = 0; i < authorSheets.Length(); i++) {
URIParams uri;
SerializeURI(authorSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
}
}
#ifdef MOZ_CONTENT_SANDBOX
// Bug 921817. We enable the sandbox in RecvSetProcessPrivileges,
// which is where a preallocated process drops unnecessary privileges,
// but a non-preallocated process will already have changed its
// uid/gid/etc immediately after forking. Thus, we send this message,
// which is otherwise a no-op, to sandbox it at an appropriate point
// during startup.
if (mOSPrivileges != base::PRIVILEGES_INHERIT) {
if (!SendSetProcessPrivileges(base::PRIVILEGES_INHERIT)) {
KillHard();
}
}
#endif
}
bool
ContentParent::IsAlive()
{

View File

@ -265,11 +265,6 @@ private:
// The common initialization for the constructors.
void InitializeMembers();
// The common initialization logic shared by all constuctors.
void InitInternal(ProcessPriority aPriority,
bool aSetupOffMainThreadCompositing,
bool aSendRegisteredChrome);
virtual ~ContentParent();
void Init();

View File

@ -281,15 +281,6 @@ PreallocatedProcessManagerImpl::PublishSpareProcess(ContentParent* aContent)
{
MOZ_ASSERT(NS_IsMainThread());
if (Preferences::GetBool("dom.ipc.processPriorityManager.testMode")) {
AutoJSContext cx;
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
nsresult rv = ppmm->BroadcastAsyncMessage(
NS_LITERAL_STRING("TEST-ONLY:nuwa-add-new-process"),
JSVAL_NULL, JSVAL_NULL, cx, 1);
}
if (!mNuwaForkWaitTasks.IsEmpty()) {
mNuwaForkWaitTasks.ElementAt(0)->Cancel();
mNuwaForkWaitTasks.RemoveElementAt(0);
@ -321,14 +312,6 @@ PreallocatedProcessManagerImpl::OnNuwaReady()
ProcessPriorityManager::SetProcessPriority(mPreallocatedAppProcess,
hal::PROCESS_PRIORITY_FOREGROUND);
mIsNuwaReady = true;
if (Preferences::GetBool("dom.ipc.processPriorityManager.testMode")) {
AutoJSContext cx;
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
nsresult rv = ppmm->BroadcastAsyncMessage(
NS_LITERAL_STRING("TEST-ONLY:nuwa-ready"),
JSVAL_NULL, JSVAL_NULL, cx, 1);
}
NuwaFork();
}

View File

@ -1,2 +0,0 @@
[test_NuwaProcessCreation.html]
run-if = toolkit == 'gonk'

View File

@ -5,5 +5,4 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
MOCHITEST_MANIFESTS += ['mochitest.ini']

View File

@ -1,99 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
Test if Nuwa process created successfully.
-->
<head>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7">
"use strict";
SimpleTest.waitForExplicitFinish();
function TestLoader() {}
TestLoader.prototype = {
_waitingTask: 0,
onTestReady: null,
unlockTestReady: function() {
this._waitingTask--;
this._maybeLoadTest();
},
lockTestReady: function() {
this._waitingTask++;
},
_maybeLoadTest: function() {
if (this._waitingTask == 0) {
this.onTestReady();
}
}
}
var testLoader = new TestLoader();
testLoader.lockTestReady();
window.addEventListener('load', function() {
testLoader.unlockTestReady();
});
function setPref(pref, value) {
testLoader.lockTestReady();
if (value !== undefined && value !== null) {
SpecialPowers.pushPrefEnv({'set': [[pref, value]]}, function() { testLoader.unlockTestReady(); });
} else {
SpecialPowers.pushPrefEnv({'clear': [[pref]]}, function() { testLoader.unlockTestReady(); });
}
}
setPref('dom.ipc.processPriorityManager.testMode', true);
setPref('dom.ipc.processPriorityManager.enabled', true);
setPref('dom.ipc.processPriorityManager.backgroundLRUPoolLevels', 2);
function runTest()
{
// Shutdown preallocated process.
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', false);
let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
.getService(SpecialPowers.Ci.nsISyncMessageSender);
let seenNuwaReady = false;
let msgHandler = {
receiveMessage: function receiveMessage(msg) {
msg = SpecialPowers.wrap(msg);
if (msg.name == 'TEST-ONLY:nuwa-ready') {
ok(true, "Got nuwa-ready");
is(seenNuwaReady, false, "Already received nuwa ready");
seenNuwaReady = true;
} else if (msg.name == 'TEST-ONLY:nuwa-add-new-process') {
ok(true, "Got nuwa-add-new-process");
is(seenNuwaReady, true, "Receive nuwa-add-new-process before nuwa-ready");
testEnd();
}
}
};
let timeout = setTimeout(function() {
ok(false, "Nuwa process is not launched");
testEnd();
}, 60000);
function testEnd() {
cpmm.removeMessageListener("TEST-ONLY:nuwa-ready", msgHandler);
cpmm.removeMessageListener("TEST-ONLY:nuwa-add-new-process", msgHandler);
clearTimeout(timeout);
SimpleTest.finish();
}
cpmm.addMessageListener("TEST-ONLY:nuwa-ready", msgHandler);
cpmm.addMessageListener("TEST-ONLY:nuwa-add-new-process", msgHandler);
// Setting this pref to true should cause us to prelaunch a process.
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', true);
}
testLoader.onTestReady = runTest;
</script>
</body>
</html>

View File

@ -137,6 +137,9 @@
// The textfield of a spin control
#define NS_THEME_SPINNER_TEXTFIELD 75
// For HTML's <input type=number>
#define NS_THEME_NUMBER_INPUT 76
// A scrollbar.
#define NS_THEME_SCROLLBAR 80

View File

@ -280,6 +280,12 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
fm->SetFocus(element, 0);
}
if (StyleDisplay()->mAppearance == NS_THEME_TEXTFIELD) {
// The author has elected to hide the spinner by setting this
// -moz-appearance. We will reframe if it changes.
return rv;
}
// Create the ::-moz-number-spin-box pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mSpinBox),
outerWrapperCI.mChildren,
@ -368,6 +374,10 @@ nsNumberControlFrame::GetSpinButtonForPointerEvent(WidgetGUIEvent* aEvent) const
MOZ_ASSERT(aEvent->eventStructType == NS_MOUSE_EVENT,
"Unexpected event type");
if (!mSpinBox) {
// we don't have a spinner
return eSpinButtonNone;
}
if (aEvent->originalTarget == mSpinUp) {
return eSpinButtonUp;
}
@ -398,6 +408,9 @@ nsNumberControlFrame::GetSpinButtonForPointerEvent(WidgetGUIEvent* aEvent) const
void
nsNumberControlFrame::SpinnerStateChanged() const
{
MOZ_ASSERT(mSpinUp && mSpinDown,
"We should not be called when we have no spinner");
nsIFrame* spinUpFrame = mSpinUp->GetPrimaryFrame();
if (spinUpFrame && spinUpFrame->IsThemed()) {
spinUpFrame->InvalidateFrame();
@ -449,6 +462,9 @@ nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
bool
nsNumberControlFrame::ShouldUseNativeStyleForSpinner() const
{
MOZ_ASSERT(mSpinUp && mSpinDown,
"We should not be called when we have no spinner");
nsIFrame* spinUpFrame = mSpinUp->GetPrimaryFrame();
nsIFrame* spinDownFrame = mSpinDown->GetPrimaryFrame();
@ -504,14 +520,17 @@ nsNumberControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
}
if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinBox) {
MOZ_ASSERT(mSpinBox);
return mSpinBox;
}
if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinUp) {
MOZ_ASSERT(mSpinUp);
return mSpinUp;
}
if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinDown) {
MOZ_ASSERT(mSpinDown);
return mSpinDown;
}

View File

@ -18,7 +18,7 @@ fuzzy-if(/^Windows\x20NT\x205\.1/.test(http.oscpu),64,4) fuzzy-if(cocoaWidget,63
== show-value.html show-value-ref.html
# focus
fails-if(B2G) needs-focus == focus-handling.html focus-handling-ref.html # bug 940760
needs-focus == focus-handling.html focus-handling-ref.html
# pseudo-elements not usable from content:
== number-pseudo-elements.html number-pseudo-elements-ref.html

View File

@ -887,11 +887,13 @@ input[type=range]::-moz-range-thumb {
}
input[type="number"] {
-moz-appearance: number-input;
/* Has to revert some properties applied by the generic input rule. */
-moz-binding: none;
width: 149px; /* to match type=text */
}
input[type=number] > div, /* work around bug 946184 */
input[type=number]::-moz-number-wrapper {
/* Prevent styling that would change the type of frame we construct. */
display: flex;
@ -900,6 +902,7 @@ input[type=number]::-moz-number-wrapper {
height: 100%;
}
input[type=number] > div > input, /* work around bug 946184 */
input[type=number]::-moz-number-text {
-moz-appearance: none;
/* work around autofocus bug 939248 on initial load */
@ -917,6 +920,7 @@ input[type=number]::-moz-number-text {
margin: 0;
}
input[type=number] > div > div, /* work around bug 946184 */
input[type=number]::-moz-number-spin-box {
display: flex;
flex-direction: column;
@ -931,6 +935,7 @@ input[type=number]::-moz-number-spin-box {
justify-content: center;
}
input[type=number] > div > div > div:first-child, /* work around bug 946184 */
input[type=number]::-moz-number-spin-up {
-moz-appearance: spinner-upbutton;
display: block; /* bug 926670 */
@ -946,6 +951,7 @@ input[type=number]::-moz-number-spin-up {
border-top-right-radius: 4px;
}
input[type=number] > div > div > div:not(:first-child), /* work around bug 946184 */
input[type=number]::-moz-number-spin-down {
-moz-appearance: spinner-downbutton;
display: block; /* bug 926670 */

View File

@ -610,6 +610,7 @@ CSS_KEY(resizerpanel, resizerpanel)
CSS_KEY(resizer, resizer)
CSS_KEY(listbox, listbox)
CSS_KEY(listitem, listitem)
CSS_KEY(number-input, number_input)
CSS_KEY(treeview, treeview)
CSS_KEY(treeitem, treeitem)
CSS_KEY(treetwisty, treetwisty)

View File

@ -529,6 +529,7 @@ const int32_t nsCSSProps::kAppearanceKTable[] = {
eCSSKeyword_button_arrow_previous, NS_THEME_BUTTON_ARROW_PREVIOUS,
eCSSKeyword_meterbar, NS_THEME_METERBAR,
eCSSKeyword_meterchunk, NS_THEME_METERBAR_CHUNK,
eCSSKeyword_number_input, NS_THEME_NUMBER_INPUT,
eCSSKeyword_separator, NS_THEME_TOOLBAR_SEPARATOR,
eCSSKeyword_splitter, NS_THEME_SPLITTER,
eCSSKeyword_statusbar, NS_THEME_STATUSBAR,

View File

@ -2420,6 +2420,19 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mResize != aOther.mResize)
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
if ((mAppearance == NS_THEME_TEXTFIELD &&
aOther.mAppearance != NS_THEME_TEXTFIELD) ||
(mAppearance != NS_THEME_TEXTFIELD &&
aOther.mAppearance == NS_THEME_TEXTFIELD)) {
// This is for <input type=number> where we allow authors to specify a
// |-moz-appearance:textfield| to get a control without a spinner. (The
// spinner is present for |-moz-appearance:number-input| but also other
// values such as 'none'.) We need to reframe since we want to use
// nsTextControlFrame instead of nsNumberControlFrame if the author
// specifies 'textfield'.
return nsChangeHint_ReconstructFrame;
}
if (mFloats != aOther.mFloats) {
// Changing which side we float on doesn't affect descendants directly
NS_UpdateHint(hint,

View File

@ -309,6 +309,7 @@ xul|menulist:active {
background-color: @color_background_highlight_overlay@;
}
input[type=number] > div > div, /* work around bug 946184 */
input[type=number]::-moz-number-spin-box {
display: none;
}

View File

@ -868,7 +868,9 @@ pref("dom.min_background_timeout_value", 1000);
// Don't use new input types
pref("dom.experimental_forms", false);
pref("dom.forms.number", false);
// Enable <input type=number>:
pref("dom.forms.number", true);
// Enable <input type=color> by default. It will be turned off for remaining
// platforms which don't have a color picker implemented yet.

View File

@ -14,9 +14,6 @@
#include "nsNetUtil.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsISystemProxySettings.h"
#ifdef MOZ_NUWA_PROCESS
#include "ipc/Nuwa.h"
#endif
//-----------------------------------------------------------------------------
using namespace mozilla;
@ -677,13 +674,6 @@ nsPACMan::NamePACThread()
{
NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread");
PR_SetCurrentThreadName("Proxy Resolution");
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess()) {
NS_ASSERTION(NuwaMarkCurrentThread != nullptr,
"NuwaMarkCurrentThread is undefined!");
NuwaMarkCurrentThread(nullptr, nullptr);
}
#endif
}
nsresult

View File

@ -2317,6 +2317,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
}
case NS_THEME_TEXTFIELD:
case NS_THEME_NUMBER_INPUT:
// HIThemeSetFill is not available on 10.3
CGContextSetRGBFillColor(cgContext, 1.0, 1.0, 1.0, 1.0);
CGContextFillRect(cgContext, macRect);
@ -2662,6 +2663,7 @@ nsNativeThemeCocoa::GetWidgetBorder(nsDeviceContext* aContext,
*aResult = RTLAwareMargin(kAquaComboboxBorder, aFrame);
break;
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
{
SInt32 frameOutset = 0;
@ -2775,6 +2777,7 @@ nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFram
switch (aWidgetType) {
case NS_THEME_BUTTON:
case NS_THEME_TOOLBAR_BUTTON:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_SEARCHFIELD:
@ -2871,7 +2874,8 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->SizeTo(0, popupHeight);
break;
}
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_SEARCHFIELD:
@ -3212,6 +3216,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
case NS_THEME_TOOLBAR:
case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR:
case NS_THEME_STATUSBAR:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_SEARCHFIELD:
@ -3337,6 +3342,7 @@ nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType)
case NS_THEME_SPINNER_DOWN_BUTTON:
case NS_THEME_TOOLBAR_SEPARATOR:
case NS_THEME_TOOLBOX:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TREEVIEW:
case NS_THEME_TREEVIEW_LINE:

View File

@ -232,7 +232,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
// For these widget types, some element (either a child or parent)
// actually has element focus, so we check the focused attribute
// to see whether to draw in the focused state.
if (aWidgetType == NS_THEME_TEXTFIELD ||
if (aWidgetType == NS_THEME_NUMBER_INPUT ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD ||
aWidgetType == NS_THEME_SPINNER_TEXTFIELD ||
@ -441,6 +442,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
case NS_THEME_RESIZER:
aGtkWidgetType = MOZ_GTK_RESIZER;
break;
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
aGtkWidgetType = MOZ_GTK_ENTRY;
@ -1384,6 +1386,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_DROPDOWN_TEXTFIELD:

View File

@ -270,6 +270,7 @@ nsNativeThemeQt::DrawWidgetBackground(QPainter *qPainter,
}
case NS_THEME_DROPDOWN_TEXT:
case NS_THEME_DROPDOWN_TEXTFIELD:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_LISTBOX: {
@ -282,7 +283,9 @@ nsNativeThemeQt::DrawWidgetBackground(QPainter *qPainter,
frameOpt.rect = r;
frameOpt.features = QStyleOptionFrameV2::Flat;
if (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
if (aWidgetType == NS_THEME_NUMBER_INPUT ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
QRect contentRect = style->subElementRect(QStyle::SE_LineEditContents, &frameOpt);
contentRect.adjust(mFrameWidth, mFrameWidth, -mFrameWidth, -mFrameWidth);
qPainter->fillRect(contentRect, QBrush(Qt::white));
@ -335,7 +338,8 @@ nsNativeThemeQt::GetWidgetPadding(nsDeviceContext* ,
nsIntMargin* aResult)
{
// XXX: Where to get padding values, framewidth?
if (aWidgetType == NS_THEME_TEXTFIELD ||
if (aWidgetType == NS_THEME_NUMBER_INPUT ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
aWidgetType == NS_THEME_DROPDOWN) {
aResult->SizeTo(2, 2, 2, 2);
@ -505,6 +509,7 @@ nsNativeThemeQt::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aF
//*aIsOverridable = false;
break;
}
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
break;
@ -555,6 +560,7 @@ nsNativeThemeQt::ThemeSupportsWidget(nsPresContext* aPresContext,
case NS_THEME_DROPDOWN_BUTTON:
case NS_THEME_DROPDOWN_TEXT:
case NS_THEME_DROPDOWN_TEXTFIELD:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_LISTBOX:

View File

@ -732,6 +732,7 @@ nsNativeThemeWin::GetTheme(uint8_t aWidgetType)
case NS_THEME_CHECKBOX:
case NS_THEME_GROUPBOX:
return nsUXThemeData::GetTheme(eUXButton);
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
return nsUXThemeData::GetTheme(eUXEdit);
@ -938,6 +939,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
// same as GBS_NORMAL don't bother supporting GBS_DISABLED.
return NS_OK;
}
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE: {
nsEventStates eventState = GetContentState(aFrame, aWidgetType);
@ -2014,7 +2016,9 @@ nsNativeThemeWin::GetWidgetBorder(nsDeviceContext* aContext,
aResult->left = 0;
}
if (aFrame && (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE)) {
if (aFrame && (aWidgetType == NS_THEME_NUMBER_INPUT ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE)) {
nsIContent* content = aFrame->GetContent();
if (content && content->IsHTML()) {
// We need to pad textfields by 1 pixel, since the caret will draw
@ -2088,7 +2092,8 @@ nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
}
if (IsVistaOrLater()) {
if (aWidgetType == NS_THEME_TEXTFIELD ||
if (aWidgetType == NS_THEME_NUMBER_INPUT ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
aWidgetType == NS_THEME_DROPDOWN)
{
@ -2103,7 +2108,9 @@ nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
* contents look too small. Instead, we add 2px padding for the
* contents and fix this. (Used to be 1px added, see bug 430212)
*/
if (aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
if (aWidgetType == NS_THEME_NUMBER_INPUT ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE) {
aResult->top = aResult->bottom = 2;
aResult->left = aResult->right = 2;
return true;
@ -2217,6 +2224,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* a
switch (aWidgetType) {
case NS_THEME_GROUPBOX:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TOOLBOX:
case NS_THEME_WIN_MEDIA_TOOLBOX:
@ -2683,6 +2691,7 @@ nsNativeThemeWin::ClassicThemeSupportsWidget(nsPresContext* aPresContext,
if (!nsUXThemeData::sFlatMenus)
return false;
case NS_THEME_BUTTON:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_CHECKBOX:
@ -2765,6 +2774,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsDeviceContext* aContext,
case NS_THEME_DROPDOWN:
case NS_THEME_DROPDOWN_TEXTFIELD:
case NS_THEME_TAB:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
(*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
@ -2910,6 +2920,7 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsRenderingContext* aContext, nsIF
case NS_THEME_GROUPBOX:
case NS_THEME_LISTBOX:
case NS_THEME_TREEVIEW:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_DROPDOWN_TEXTFIELD:
@ -3150,6 +3161,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t
}
case NS_THEME_LISTBOX:
case NS_THEME_TREEVIEW:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_DROPDOWN:
@ -3583,6 +3595,7 @@ RENDER_AGAIN:
break;
}
// Draw controls with 2px 3D inset border
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_LISTBOX:
@ -3949,6 +3962,7 @@ nsNativeThemeWin::GetWidgetNativeDrawingFlags(uint8_t aWidgetType)
{
switch (aWidgetType) {
case NS_THEME_BUTTON:
case NS_THEME_NUMBER_INPUT:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:

View File

@ -78,7 +78,7 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, uint8_t aWidgetType)
// <input type=number> needs special handling since its nested native
// anonymous <input type=text> takes focus for it.
if (aWidgetType == NS_THEME_TEXTFIELD &&
if (aWidgetType == NS_THEME_NUMBER_INPUT &&
frameContent->IsHTML(nsGkAtoms::input)) {
nsNumberControlFrame *numberControlFrame = do_QueryFrame(aFrame);
if (numberControlFrame && numberControlFrame->IsFocused()) {
@ -97,7 +97,8 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, uint8_t aWidgetType)
// focus something in the window.
#if defined(XP_MACOSX)
// Mac always draws focus rings for textboxes and lists.
if (aWidgetType == NS_THEME_TEXTFIELD ||
if (aWidgetType == NS_THEME_NUMBER_INPUT ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
aWidgetType == NS_THEME_SEARCHFIELD ||
aWidgetType == NS_THEME_LISTBOX) {
@ -333,7 +334,8 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
}
}
return (aWidgetType == NS_THEME_BUTTON ||
return (aWidgetType == NS_THEME_NUMBER_INPUT ||
aWidgetType == NS_THEME_BUTTON ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
aWidgetType == NS_THEME_LISTBOX ||

View File

@ -11,9 +11,6 @@
#include "mozilla/Telemetry.h"
#include "mozilla/ThreadHangStats.h"
#include "mozilla/ThreadLocal.h"
#ifdef MOZ_NUWA_PROCESS
#include "ipc/Nuwa.h"
#endif
#include "prinrval.h"
#include "prthread.h"
@ -34,15 +31,6 @@ private:
static void MonitorThread(void* aData)
{
PR_SetCurrentThreadName("BgHangManager");
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess()) {
NS_ASSERTION(NuwaMarkCurrentThread != nullptr,
"NuwaMarkCurrentThread is undefined!");
NuwaMarkCurrentThread(nullptr, nullptr);
}
#endif
/* We do not hold a reference to BackgroundHangManager here
because the monitor thread only exists as long as the
BackgroundHangManager instance exists. We stop the monitor