mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge last PGO-green changeset of mozilla-inbound to mozilla-central
This commit is contained in:
commit
ee0f5c1120
@ -202,9 +202,9 @@ protected:
|
||||
static bool gIsFormFillEnabled;
|
||||
|
||||
private:
|
||||
nsAccessNode();
|
||||
nsAccessNode(const nsAccessNode&);
|
||||
nsAccessNode& operator =(const nsAccessNode&);
|
||||
nsAccessNode() MOZ_DELETE;
|
||||
nsAccessNode(const nsAccessNode&) MOZ_DELETE;
|
||||
nsAccessNode& operator =(const nsAccessNode&) MOZ_DELETE;
|
||||
|
||||
static nsApplicationAccessible *gApplicationAccessible;
|
||||
};
|
||||
|
@ -1,40 +1,8 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Mobile Browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mark Finkle <mfinkle@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* Command Updater
|
||||
|
@ -1,40 +1,8 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is B2G.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* 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/. */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
@ -98,6 +66,8 @@ function addPermissions(urls) {
|
||||
var shell = {
|
||||
// FIXME/bug 678695: this should be a system setting
|
||||
preferredScreenBrightness: 1.0,
|
||||
|
||||
isDebug: false,
|
||||
|
||||
get contentBrowser() {
|
||||
delete this.contentBrowser;
|
||||
@ -177,6 +147,7 @@ var shell = {
|
||||
window.controllers.removeController(this);
|
||||
window.removeEventListener('keypress', this);
|
||||
window.removeEventListener('MozApplicationManifest', this);
|
||||
window.removeEventListener('AppCommand', this);
|
||||
},
|
||||
|
||||
supportsCommand: function shell_supportsCommand(cmd) {
|
||||
@ -204,6 +175,18 @@ var shell = {
|
||||
}
|
||||
},
|
||||
|
||||
toggleDebug: function shell_toggleDebug() {
|
||||
this.isDebug = !this.isDebug;
|
||||
|
||||
if (this.isDebug) {
|
||||
Services.prefs.setBoolPref("layers.acceleration.draw-fps", true);
|
||||
Services.prefs.setBoolPref("nglayout.debug.paint_flashing", true);
|
||||
} else {
|
||||
Services.prefs.setBoolPref("layers.acceleration.draw-fps", false);
|
||||
Services.prefs.setBoolPref("nglayout.debug.paint_flashing", false);
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent: function shell_handleEvent(evt) {
|
||||
switch (evt.type) {
|
||||
case 'keypress':
|
||||
@ -231,6 +214,9 @@ var shell = {
|
||||
case 'Menu':
|
||||
this.sendEvent(content, 'menu');
|
||||
break;
|
||||
case 'Search':
|
||||
this.toggleDebug();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'load':
|
||||
|
@ -1,41 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Mozilla Mobile Browser.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Mozilla Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2011
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Chris Jones <jones.chris.g@gmail.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
<!-- 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/. -->
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="shell"
|
||||
@ -50,7 +17,9 @@
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/commandUtil.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/shell.js"/>
|
||||
#ifndef MOZ_TOUCH
|
||||
<script type="application/javascript" src="chrome://browser/content/touch.js"/>
|
||||
#endif
|
||||
|
||||
<commandset id="mainCommandSet">
|
||||
<command id="cmd_close" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
|
@ -1,38 +1,8 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is B2G.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* 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/. */
|
||||
|
||||
(function touchEventHandler() {
|
||||
let debugging = false;
|
||||
|
@ -318,6 +318,24 @@ function SettingsMessage(name, value) {
|
||||
|
||||
// MozApps - Bug 709015
|
||||
var webapps = [
|
||||
{ // clock
|
||||
installOrigin: 'http://gaiamobile.org:8888',
|
||||
origin: '../clock',
|
||||
receipt: null,
|
||||
installTime: 1323339869000,
|
||||
manifest: {
|
||||
'name': 'Clock',
|
||||
'description': 'Gaia Clock',
|
||||
'launch_path': '/clock.html',
|
||||
'developer': {
|
||||
'name': 'The Gaia Team',
|
||||
'url': 'https://github.com/andreasgal/gaia'
|
||||
},
|
||||
'icons': {
|
||||
'120': '/style/icons/Clock.png'
|
||||
}
|
||||
}
|
||||
},
|
||||
{ // browser
|
||||
installOrigin: 'http://gaiamobile.org:8888',
|
||||
origin: '../browser',
|
||||
|
@ -6,7 +6,9 @@ chrome.jar:
|
||||
|
||||
* content/shell.xul (content/shell.xul)
|
||||
content/shell.js (content/shell.js)
|
||||
#ifndef MOZ_TOUCH
|
||||
content/touch.js (content/touch.js)
|
||||
#endif
|
||||
content/commandUtil.js (content/commandUtil.js)
|
||||
content/httpd.js (content/httpd.js)
|
||||
content/webapi.js (content/webapi.js)
|
||||
|
@ -123,7 +123,7 @@
|
||||
<!ENTITY nssFailure2.title "Secure Connection Failed">
|
||||
<!ENTITY nssFailure2.longDesc "
|
||||
<ul>
|
||||
<li>The page you are trying to view can not be shown because the authenticity of the received data could not be verified.</li>
|
||||
<li>The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.</li>
|
||||
<li>Please contact the website owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.</li>
|
||||
</ul>
|
||||
">
|
||||
|
@ -1941,7 +1941,7 @@ function nonBrowserWindowStartup() {
|
||||
'viewToolbarsMenu', 'viewSidebarMenuMenu', 'Browser:Reload',
|
||||
'viewFullZoomMenu', 'pageStyleMenu', 'charsetMenu', 'View:PageSource', 'View:FullScreen',
|
||||
'viewHistorySidebar', 'Browser:AddBookmarkAs', 'Browser:BookmarkAllTabs',
|
||||
'View:PageInfo', 'Tasks:InspectPage', 'Browser:ToggleTabView', ];
|
||||
'View:PageInfo', 'Tasks:InspectPage', 'Browser:ToggleTabView', 'Browser:ToggleAddonBar'];
|
||||
var element;
|
||||
|
||||
for (var id in disabledItems) {
|
||||
@ -7162,25 +7162,10 @@ var gPluginHandler = {
|
||||
BrowserOpenAddonsMgr("addons://list/plugin");
|
||||
},
|
||||
|
||||
// When user clicks try, checks if we should also send crash report in bg
|
||||
retryPluginPage: function (browser, plugin, pluginDumpID, browserDumpID) {
|
||||
let doc = plugin.ownerDocument;
|
||||
|
||||
let statusDiv =
|
||||
doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus");
|
||||
let status = statusDiv.getAttribute("status");
|
||||
|
||||
let submitChk =
|
||||
doc.getAnonymousElementByAttribute(plugin, "class", "pleaseSubmitCheckbox");
|
||||
|
||||
// Check status to make sure we haven't submitted already
|
||||
if (status == "please" && submitChk.checked) {
|
||||
this.submitReport(pluginDumpID, browserDumpID);
|
||||
}
|
||||
this.reloadPage(browser);
|
||||
},
|
||||
|
||||
submitReport: function (pluginDumpID, browserDumpID) {
|
||||
// Callback for user clicking "submit a report" link
|
||||
submitReport : function(pluginDumpID, browserDumpID) {
|
||||
// The crash reporter wants a DOM element it can append an IFRAME to,
|
||||
// which it uses to submit a form. Let's just give it gBrowser.
|
||||
this.CrashSubmit.submit(pluginDumpID);
|
||||
if (browserDumpID)
|
||||
this.CrashSubmit.submit(browserDumpID);
|
||||
@ -7398,7 +7383,8 @@ var gPluginHandler = {
|
||||
return;
|
||||
|
||||
let submittedReport = aEvent.getData("submittedCrashReport");
|
||||
let doPrompt = true; // XXX followup to get via gCrashReporter
|
||||
let doPrompt = true; // XXX followup for .getData("doPrompt");
|
||||
let submitReports = true; // XXX followup for .getData("submitReports");
|
||||
let pluginName = aEvent.getData("pluginName");
|
||||
let pluginFilename = aEvent.getData("pluginFilename");
|
||||
let pluginDumpID = aEvent.getData("pluginDumpID");
|
||||
@ -7416,7 +7402,6 @@ var gPluginHandler = {
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
|
||||
let statusDiv = doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus");
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
let submitReports = gCrashReporter.submitReports;
|
||||
let status;
|
||||
|
||||
// Determine which message to show regarding crash reports.
|
||||
@ -7427,21 +7412,18 @@ var gPluginHandler = {
|
||||
status = "noSubmit";
|
||||
}
|
||||
else { // doPrompt
|
||||
// link submit checkbox to gCrashReporter submitReports preference
|
||||
let submitChk = doc.getAnonymousElementByAttribute(
|
||||
plugin, "class", "pleaseSubmitCheckbox");
|
||||
submitChk.checked = submitReports;
|
||||
submitChk.addEventListener("click", function() {
|
||||
gCrashReporter.submitReports = this.checked;
|
||||
}, false);
|
||||
|
||||
status = "please";
|
||||
// XXX can we make the link target actually be blank?
|
||||
let pleaseLink = doc.getAnonymousElementByAttribute(
|
||||
plugin, "class", "pleaseSubmitLink");
|
||||
this.addLinkClickCallback(pleaseLink, "submitReport",
|
||||
pluginDumpID, browserDumpID);
|
||||
}
|
||||
|
||||
// If we don't have a minidumpID, we can't (or didn't) submit anything.
|
||||
// This can happen if the plugin is killed from the task manager.
|
||||
if (!pluginDumpID) {
|
||||
status = "noReport";
|
||||
status = "noReport";
|
||||
}
|
||||
|
||||
statusDiv.setAttribute("status", status);
|
||||
@ -7451,23 +7433,10 @@ var gPluginHandler = {
|
||||
let helpIcon = doc.getAnonymousElementByAttribute(plugin, "class", "helpIcon");
|
||||
this.addLinkClickCallback(helpIcon, "openHelpPage");
|
||||
|
||||
// If we're showing the checkbox to trigger report submission, we'll want
|
||||
// to be able to update all the instances of the UI for this crash when
|
||||
// one instance of the checkbox is modified or the status is updated.
|
||||
// If we're showing the link to manually trigger report submission, we'll
|
||||
// want to be able to update all the instances of the UI for this crash to
|
||||
// show an updated message when a report is submitted.
|
||||
if (doPrompt) {
|
||||
let submitReportsPrefObserver = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference]),
|
||||
observe : function(subject, topic, data) {
|
||||
let submitChk = doc.getAnonymousElementByAttribute(
|
||||
plugin, "class", "pleaseSubmitCheckbox");
|
||||
submitChk.checked = gCrashReporter.submitReports;
|
||||
},
|
||||
handleEvent : function(event) {
|
||||
// Not expected to be called, just here for the closure.
|
||||
}
|
||||
};
|
||||
|
||||
let observer = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference]),
|
||||
@ -7484,21 +7453,16 @@ var gPluginHandler = {
|
||||
handleEvent : function(event) {
|
||||
// Not expected to be called, just here for the closure.
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Use a weak reference, so we don't have to remove it...
|
||||
Services.obs.addObserver(observer, "crash-report-status", true);
|
||||
Services.obs.addObserver(
|
||||
submitReportsPrefObserver, "submit-reports-pref-changed", true);
|
||||
|
||||
// ...alas, now we need something to hold a strong reference to prevent
|
||||
// it from being GC. But I don't want to manually manage the reference's
|
||||
// lifetime (which should be no greater than the page).
|
||||
// Clever solution? Use a closure with an event listener on the document.
|
||||
// Clever solution? Use a closue with an event listener on the document.
|
||||
// When the doc goes away, so do the listener references and the closure.
|
||||
doc.addEventListener("mozCleverClosureHack", observer, false);
|
||||
doc.addEventListener(
|
||||
"mozCleverClosureHack", submitReportsPrefObserver, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -7508,12 +7472,7 @@ var gPluginHandler = {
|
||||
let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document);
|
||||
|
||||
let link = doc.getAnonymousElementByAttribute(plugin, "class", "reloadLink");
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
this.addLinkClickCallback(
|
||||
link, "retryPluginPage", browser, plugin, pluginDumpID, browserDumpID);
|
||||
#else
|
||||
this.addLinkClickCallback(link, "reloadPage", browser);
|
||||
#endif
|
||||
|
||||
let notificationBox = gBrowser.getNotificationBox(browser);
|
||||
|
||||
|
@ -1,207 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2008
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Dão Gottwald <dao@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" accelerated="11">
|
||||
<head>
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
html,
|
||||
body,
|
||||
video {
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
background: black;
|
||||
overflow: -moz-hidden-unscrollable;
|
||||
}
|
||||
body.userIdle {
|
||||
cursor: none;
|
||||
}
|
||||
video {
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
body.loadingdata > video,
|
||||
body.loadingdata > #close,
|
||||
body.userIdle > #close {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
]]></style>
|
||||
<link href="chrome://browser/skin/fullscreen-video.css"
|
||||
rel="stylesheet" type="text/css"/>
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
var contentVideo = window.arguments[0];
|
||||
var video;
|
||||
|
||||
var title = (contentVideo.currentSrc || contentVideo.src).replace(/^.*\//, "");
|
||||
try {
|
||||
title = decodeURI(title);
|
||||
} catch (e) {}
|
||||
document.title = title;
|
||||
|
||||
window.addEventListener("focus", function () {
|
||||
window.removeEventListener("focus", arguments.callee, false);
|
||||
|
||||
window.fullScreen = true;
|
||||
|
||||
window.addEventListener("deactivate", function () {
|
||||
window.close();
|
||||
}, false);
|
||||
|
||||
video = document.querySelector("video");
|
||||
|
||||
video.addEventListener("loadeddata", function () {
|
||||
video.removeEventListener("loadeddata", arguments.callee, false);
|
||||
video.volume = contentVideo.volume;
|
||||
video.muted = contentVideo.muted;
|
||||
video.poster = contentVideo.poster;
|
||||
|
||||
if (contentVideo.currentTime && !contentVideo.ended) {
|
||||
video.addEventListener("seeked", function () {
|
||||
video.removeEventListener("seeked", arguments.callee, false);
|
||||
playbackStarts();
|
||||
}, false);
|
||||
|
||||
video.currentTime = contentVideo.currentTime;
|
||||
} else {
|
||||
playbackStarts();
|
||||
}
|
||||
|
||||
video.controls = true;
|
||||
video.play();
|
||||
}, false);
|
||||
|
||||
// Automatically close this window when the playback ended, unless the user
|
||||
// interacted with it.
|
||||
video.addEventListener("ended", autoClose, false);
|
||||
window.addEventListener("click", cancelAutoClose, false);
|
||||
window.addEventListener("keypress", cancelAutoClose, false);
|
||||
|
||||
video.addEventListener("playing", hideUI, false);
|
||||
video.addEventListener("seeked", hideUI, false);
|
||||
video.addEventListener("seeking", showUI, false);
|
||||
video.addEventListener("pause", showUI, false);
|
||||
video.addEventListener("ended", showUI, false);
|
||||
|
||||
window.addEventListener("mousemove", function () {
|
||||
showUI();
|
||||
resetIdleTimer();
|
||||
}, false);
|
||||
|
||||
video.mozLoadFrom(contentVideo);
|
||||
}, false);
|
||||
|
||||
window.addEventListener("unload", function () {
|
||||
if (video.currentSrc) {
|
||||
contentVideo.currentTime = video.currentTime;
|
||||
contentVideo.volume = video.volume;
|
||||
contentVideo.muted = video.muted;
|
||||
if (!video.paused && !video.ended) {
|
||||
video.pause();
|
||||
contentVideo.play();
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
window.addEventListener("keypress", function (event) {
|
||||
if (event.keyCode == event.DOM_VK_ESCAPE) {
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
resetIdleTimer();
|
||||
|
||||
if (!video.controls &&
|
||||
String.fromCharCode(event.charCode) == " ")
|
||||
video.pause();
|
||||
}, false);
|
||||
|
||||
function playbackStarts() {
|
||||
// Loading the data from the content video may take a second or two. We hide
|
||||
// the video during that period.
|
||||
document.body.classList.remove("loadingdata");
|
||||
video.focus();
|
||||
}
|
||||
|
||||
function autoClose() {
|
||||
window.close();
|
||||
}
|
||||
|
||||
function cancelAutoClose() {
|
||||
video.removeEventListener("ended", autoClose, false);
|
||||
window.removeEventListener("click", cancelAutoClose, false);
|
||||
window.removeEventListener("keypress", cancelAutoClose, false);
|
||||
}
|
||||
|
||||
var idleTimer;
|
||||
function resetIdleTimer() {
|
||||
if (idleTimer) {
|
||||
clearTimeout(idleTimer);
|
||||
idleTimer = 0;
|
||||
}
|
||||
idleTimer = setTimeout(function () {
|
||||
idleTimer = 0;
|
||||
hideUI();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
function showUI() {
|
||||
if (!video.controls) {
|
||||
document.body.classList.remove("userIdle");
|
||||
video.controls = true;
|
||||
}
|
||||
}
|
||||
|
||||
function hideUI() {
|
||||
if (!video.paused && !video.ended && !video.seeking && !video.error) {
|
||||
document.body.classList.add("userIdle");
|
||||
video.controls = false;
|
||||
}
|
||||
}
|
||||
|
||||
]]></script>
|
||||
</head>
|
||||
<body class="loadingdata">
|
||||
<span id="close" onclick="window.close();"/>
|
||||
<video/>
|
||||
</body>
|
||||
</html>
|
@ -860,12 +860,6 @@ nsContextMenu.prototype = {
|
||||
let video = this.target;
|
||||
if (document.mozFullScreenEnabled)
|
||||
video.mozRequestFullScreen();
|
||||
else {
|
||||
// Fallback for the legacy full-screen video implementation.
|
||||
video.pause();
|
||||
openDialog("chrome://browser/content/fullscreen-video.xhtml",
|
||||
"", "chrome,centerscreen,dialog=no", video);
|
||||
}
|
||||
},
|
||||
|
||||
// Change current window to the URL of the background image.
|
||||
|
@ -30,7 +30,6 @@ browser.jar:
|
||||
* content/browser/browser.xul (content/browser.xul)
|
||||
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
|
||||
* content/browser/content.js (content/content.js)
|
||||
* content/browser/fullscreen-video.xhtml (content/fullscreen-video.xhtml)
|
||||
* content/browser/newtab/newTab.xul (content/newtab/newTab.xul)
|
||||
* content/browser/newtab/newTab.js (content/newtab/newTab.js)
|
||||
content/browser/newtab/newTab.css (content/newtab/newTab.css)
|
||||
|
@ -41,6 +41,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
/**
|
||||
* The base view implements everything that's common to the toolbar and
|
||||
@ -808,6 +809,7 @@ PlacesViewBase.prototype = {
|
||||
};
|
||||
|
||||
function PlacesToolbar(aPlace) {
|
||||
let startTime = Date.now();
|
||||
// Add some smart getters for our elements.
|
||||
let thisView = this;
|
||||
[
|
||||
@ -836,6 +838,9 @@ function PlacesToolbar(aPlace) {
|
||||
this._addEventListeners(window, ["resize", "unload"], false);
|
||||
|
||||
PlacesViewBase.call(this, aPlace);
|
||||
|
||||
Services.telemetry.getHistogramById("FX_BOOKMARKS_TOOLBAR_INIT_MS")
|
||||
.add(Date.now() - startTime);
|
||||
}
|
||||
|
||||
PlacesToolbar.prototype = {
|
||||
|
@ -36,11 +36,6 @@
|
||||
|
||||
function test() {
|
||||
/** Test for Bug 477657 **/
|
||||
|
||||
// Test fails randomly on OS X (bug 482975)
|
||||
if ("nsILocalFileMac" in Ci)
|
||||
return;
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
|
||||
|
@ -128,7 +128,7 @@
|
||||
<!ENTITY nssFailure2.title "Secure Connection Failed">
|
||||
<!ENTITY nssFailure2.longDesc "
|
||||
<ul>
|
||||
<li>The page you are trying to view can not be shown because the authenticity of the received data could not be verified.</li>
|
||||
<li>The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.</li>
|
||||
<li>Please contact the website owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.</li>
|
||||
</ul>
|
||||
">
|
||||
|
@ -70,7 +70,7 @@ public interface Driver {
|
||||
int stopFrameRecording();
|
||||
|
||||
void startCheckerboardRecording();
|
||||
int stopCheckerboardRecording();
|
||||
float stopCheckerboardRecording();
|
||||
|
||||
/**
|
||||
* Get a copy of the painted content region.
|
||||
|
@ -37,19 +37,11 @@
|
||||
|
||||
package @ANDROID_PACKAGE_NAME@;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class FennecMochitestAssert implements Assert {
|
||||
private String logFile = null;
|
||||
|
||||
// Objects for reflexive access of fennec classes.
|
||||
|
||||
private LinkedList<testInfo> testList = new LinkedList<testInfo>();
|
||||
@ -72,34 +64,16 @@ public class FennecMochitestAssert implements Assert {
|
||||
public FennecMochitestAssert() {
|
||||
}
|
||||
|
||||
public void dumpLog(String message) {
|
||||
File file = new File(logFile);
|
||||
BufferedWriter bw = null;
|
||||
|
||||
try {
|
||||
bw = new BufferedWriter(new FileWriter(logFile, true));
|
||||
bw.write(message);
|
||||
bw.newLine();
|
||||
} catch(IOException e) {
|
||||
Log.e("Robocop", "exception with file writer on: " + logFile);
|
||||
} finally {
|
||||
try {
|
||||
if (bw != null) {
|
||||
bw.flush();
|
||||
bw.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Log.i("Robocop", message);
|
||||
// Write information to a logfile and logcat
|
||||
public void dumpLog(String message)
|
||||
{
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message);
|
||||
}
|
||||
|
||||
// Set the filename used for dumpLog.
|
||||
public void setLogFile(String filename)
|
||||
{
|
||||
logFile = filename;
|
||||
FennecNativeDriver.setLogFile(filename);
|
||||
|
||||
String message;
|
||||
if (!logStarted) {
|
||||
@ -154,18 +128,7 @@ public class FennecMochitestAssert implements Assert {
|
||||
if (test.diag != null) diag += " - " + test.diag;
|
||||
|
||||
String message = Integer.toString(lineNumber++) + " INFO " + resultString + " | " + logTestName + " | " + diag;
|
||||
if (isError) {
|
||||
if (logFile == null)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
else {
|
||||
dumpLog(message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
dumpLog(message);
|
||||
}
|
||||
dumpLog(message);
|
||||
|
||||
if (test.todo) {
|
||||
todo++;
|
||||
|
@ -39,17 +39,6 @@
|
||||
|
||||
package @ANDROID_PACKAGE_NAME@;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import java.lang.Class;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -60,7 +49,6 @@ import java.lang.Long;
|
||||
import android.app.Activity;
|
||||
import android.app.Instrumentation;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
@ -71,7 +59,6 @@ import org.json.*;
|
||||
import com.jayway.android.robotium.solo.Solo;
|
||||
|
||||
public class FennecNativeActions implements Actions {
|
||||
// Map of IDs to element names.
|
||||
private Solo solo;
|
||||
private Instrumentation instr;
|
||||
private Activity geckoApp;
|
||||
@ -144,7 +131,8 @@ public class FennecNativeActions implements Actions {
|
||||
if(methodName.equals("hashCode")) {
|
||||
return 314;
|
||||
}
|
||||
Log.i("Robocop", "Waking up on "+methodName);
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
|
||||
"Waking up on "+methodName);
|
||||
mEventExpecter.notifyOfEvent();
|
||||
return null;
|
||||
}
|
||||
@ -169,7 +157,8 @@ public class FennecNativeActions implements Actions {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.i("Robocop", "unblocked on expecter for " + mGeckoEvent);
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
|
||||
"unblocked on expecter for " + mGeckoEvent);
|
||||
}
|
||||
|
||||
public synchronized boolean eventReceived() {
|
||||
@ -184,7 +173,8 @@ public class FennecNativeActions implements Actions {
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i("Robocop", "received event " + mGeckoEvent);
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
|
||||
"received event " + mGeckoEvent);
|
||||
synchronized (this) {
|
||||
mEventReceived = true;
|
||||
this.notifyAll();
|
||||
@ -193,7 +183,8 @@ public class FennecNativeActions implements Actions {
|
||||
}
|
||||
|
||||
public EventExpecter expectGeckoEvent(String geckoEvent) {
|
||||
Log.i("Robocop", "waiting for "+geckoEvent);
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
|
||||
"waiting for "+geckoEvent);
|
||||
try {
|
||||
Class [] interfaces = new Class[1];
|
||||
interfaces[0] = gel;
|
||||
@ -225,7 +216,8 @@ public class FennecNativeActions implements Actions {
|
||||
public Object invoke(Object proxy, Method method, Object[] args) {
|
||||
String methodName = method.getName();
|
||||
if ("drawFinished".equals(methodName)) {
|
||||
Log.i("Robocop", "Received drawFinished notification");
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
|
||||
"Received drawFinished notification");
|
||||
mPaintExpecter.notifyOfEvent();
|
||||
} else if ("toString".equals(methodName)) {
|
||||
return "DrawListenerProxy";
|
||||
|
@ -60,8 +60,8 @@ import java.lang.Long;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.*;
|
||||
|
||||
@ -73,6 +73,9 @@ public class FennecNativeDriver implements Driver {
|
||||
private Activity activity;
|
||||
private Solo solo;
|
||||
|
||||
private static String mLogFile = null;
|
||||
private static LogLevel mLogLevel = LogLevel.LOG_LEVEL_INFO;
|
||||
|
||||
// Objects for reflexive access of fennec classes.
|
||||
private ClassLoader classLoader;
|
||||
private Class gel;
|
||||
@ -87,6 +90,24 @@ public class FennecNativeDriver implements Driver {
|
||||
private Method _stopCheckerboardRecording;
|
||||
private Method _getPixels;
|
||||
|
||||
public enum LogLevel {
|
||||
LOG_LEVEL_DEBUG(1),
|
||||
LOG_LEVEL_INFO(2),
|
||||
LOG_LEVEL_WARN(3),
|
||||
LOG_LEVEL_ERROR(4);
|
||||
|
||||
private int mValue;
|
||||
LogLevel(int value) {
|
||||
mValue = value;
|
||||
}
|
||||
public boolean isEnabled(LogLevel configuredLevel) {
|
||||
return mValue >= configuredLevel.getValue();
|
||||
}
|
||||
private int getValue() {
|
||||
return mValue;
|
||||
}
|
||||
}
|
||||
|
||||
public FennecNativeDriver(Activity activity, Solo robocop){
|
||||
this.activity = activity;
|
||||
this.solo = robocop;
|
||||
@ -237,7 +258,7 @@ public class FennecNativeDriver implements Driver {
|
||||
}
|
||||
}
|
||||
|
||||
public int stopCheckerboardRecording() {
|
||||
public float stopCheckerboardRecording() {
|
||||
Class [] parameters = new Class[1];
|
||||
parameters[0] = null;
|
||||
List checkerboard;
|
||||
@ -246,20 +267,19 @@ public class FennecNativeDriver implements Driver {
|
||||
Object [] params = null;
|
||||
checkerboard = (List)_stopCheckerboardRecording.invoke(null, params);
|
||||
Object [] amountarray = checkerboard.toArray();
|
||||
int numIncompleteFrames = 0;
|
||||
for (int i=0; i < amountarray.length; i++) {
|
||||
Float val = (Float)amountarray[i];
|
||||
if (val > 0.0f)
|
||||
numIncompleteFrames++;
|
||||
double completeness = 0;
|
||||
for (Object obj : amountarray) {
|
||||
float val = (Float)obj;
|
||||
completeness += (1.0 - (double)val) / (double)amountarray.length;
|
||||
}
|
||||
return numIncompleteFrames;
|
||||
return (float)completeness;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
private GLSurfaceView getSurfaceView() {
|
||||
@ -313,7 +333,8 @@ public class FennecNativeDriver implements Driver {
|
||||
}
|
||||
|
||||
} catch( Throwable e) {
|
||||
Log.i("Robocop", "WARNING: ScrollReceived, but read wrong!");
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_WARN,
|
||||
"WARNING: ScrollReceived, but read wrong!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -386,4 +407,57 @@ public class FennecNativeDriver implements Driver {
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
// Set the filename used for logging. If the file already exists, delete it
|
||||
// as a safe-guard against accidentally appending to an old log file.
|
||||
public static void setLogFile(String filename) {
|
||||
mLogFile = filename;
|
||||
File file = new File(mLogFile);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setLogLevel(LogLevel level) {
|
||||
mLogLevel = level;
|
||||
}
|
||||
|
||||
public static void log(LogLevel level, String message) {
|
||||
if (mLogFile == null) {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if (level.isEnabled(mLogLevel)) {
|
||||
File file = new File(mLogFile);
|
||||
BufferedWriter bw = null;
|
||||
|
||||
try {
|
||||
bw = new BufferedWriter(new FileWriter(mLogFile, true));
|
||||
bw.write(message);
|
||||
bw.newLine();
|
||||
} catch(IOException e) {
|
||||
Log.e("Robocop", "exception with file writer on: " + mLogFile);
|
||||
} finally {
|
||||
try {
|
||||
if (bw != null) {
|
||||
bw.flush();
|
||||
bw.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (level == LogLevel.LOG_LEVEL_INFO) {
|
||||
Log.i("Robocop", message);
|
||||
} else if (level == LogLevel.LOG_LEVEL_DEBUG) {
|
||||
Log.d("Robocop", message);
|
||||
} else if (level == LogLevel.LOG_LEVEL_WARN) {
|
||||
Log.w("Robocop", message);
|
||||
} else if (level == LogLevel.LOG_LEVEL_ERROR) {
|
||||
Log.e("Robocop", message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextSwitcher;
|
||||
import android.app.Instrumentation;
|
||||
import android.util.Log;
|
||||
import com.jayway.android.robotium.solo.Solo;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
|
||||
@ -78,7 +77,8 @@ public class FennecNativeElement implements Element {
|
||||
View view = (View)mActivity.findViewById(id);
|
||||
if(view != null) {
|
||||
if (!view.performClick()) {
|
||||
Log.w("Robocop", "Robocop called click on an element with no listener");
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_WARN,
|
||||
"Robocop called click on an element with no listener");
|
||||
}
|
||||
} else {
|
||||
throw new RoboCopException("click: unable to find view "+id);
|
||||
|
@ -37,47 +37,22 @@
|
||||
|
||||
package @ANDROID_PACKAGE_NAME@;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class FennecTalosAssert implements Assert {
|
||||
private String logFile = null;
|
||||
|
||||
public FennecTalosAssert() {
|
||||
}
|
||||
|
||||
public void dumpLog(String message) {
|
||||
File file = new File(logFile);
|
||||
BufferedWriter bw = null;
|
||||
|
||||
try {
|
||||
bw = new BufferedWriter(new FileWriter(logFile, true));
|
||||
bw.write(message);
|
||||
bw.newLine();
|
||||
} catch(IOException e) {
|
||||
Log.e("Robocop", "exception with file writer on: " + logFile);
|
||||
} finally {
|
||||
try {
|
||||
if (bw != null) {
|
||||
bw.flush();
|
||||
bw.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Log.i("Robocop", message);
|
||||
// Write information to a logfile and logcat
|
||||
public void dumpLog(String message)
|
||||
{
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message);
|
||||
}
|
||||
|
||||
// Set the filename used for dumpLog.
|
||||
public void setLogFile(String filename)
|
||||
{
|
||||
logFile = filename;
|
||||
FennecNativeDriver.setLogFile(filename);
|
||||
}
|
||||
|
||||
public void setTestName(String testName)
|
||||
|
@ -143,6 +143,37 @@ public:
|
||||
NS_EVENT_STATE_FULL_SCREEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* The style state of this element. This is the real state of the element
|
||||
* with any style locks applied for pseudo-class inspecting.
|
||||
*/
|
||||
nsEventStates StyleState() const {
|
||||
if (!HasLockedStyleStates()) {
|
||||
return mState;
|
||||
}
|
||||
return StyleStateFromLocks();
|
||||
};
|
||||
|
||||
/**
|
||||
* The style state locks applied to this element.
|
||||
*/
|
||||
nsEventStates LockedStyleStates() const;
|
||||
|
||||
/**
|
||||
* Add a style state lock on this element.
|
||||
*/
|
||||
void LockStyleStates(nsEventStates aStates);
|
||||
|
||||
/**
|
||||
* Remove a style state lock on this element.
|
||||
*/
|
||||
void UnlockStyleStates(nsEventStates aStates);
|
||||
|
||||
/**
|
||||
* Clear all style state locks on this element.
|
||||
*/
|
||||
void ClearStyleStateLocks();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Method to get the _intrinsic_ content state of this element. This is the
|
||||
@ -184,6 +215,11 @@ private:
|
||||
|
||||
void NotifyStateChange(nsEventStates aStates);
|
||||
|
||||
void NotifyStyleStateChange(nsEventStates aStates);
|
||||
|
||||
// Style state computed from element's state and style locks.
|
||||
nsEventStates StyleStateFromLocks() const;
|
||||
|
||||
// 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.
|
||||
|
@ -1249,6 +1249,8 @@ private:
|
||||
NodeIsPurpleRoot,
|
||||
// Set if the node has an explicit base URI stored
|
||||
NodeHasExplicitBaseURI,
|
||||
// Set if the element has some style states locked
|
||||
ElementHasLockedStyleStates,
|
||||
// Guard value
|
||||
BooleanFlagCount
|
||||
};
|
||||
@ -1321,6 +1323,10 @@ protected:
|
||||
{ SetBoolFlag(ElementMayHaveContentEditableAttr); }
|
||||
bool HasExplicitBaseURI() const { return GetBoolFlag(NodeHasExplicitBaseURI); }
|
||||
void SetHasExplicitBaseURI() { SetBoolFlag(NodeHasExplicitBaseURI); }
|
||||
void SetHasLockedStyleStates() { SetBoolFlag(ElementHasLockedStyleStates); }
|
||||
void ClearHasLockedStyleStates() { ClearBoolFlag(ElementHasLockedStyleStates); }
|
||||
bool HasLockedStyleStates() const
|
||||
{ return GetBoolFlag(ElementHasLockedStyleStates); }
|
||||
|
||||
public:
|
||||
// Optimized way to get classinfo.
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMXPathExpression;
|
||||
|
@ -1375,6 +1375,103 @@ nsGenericElement::UpdateEditableState(bool aNotify)
|
||||
}
|
||||
}
|
||||
|
||||
nsEventStates
|
||||
Element::StyleStateFromLocks() const
|
||||
{
|
||||
nsEventStates locks = LockedStyleStates();
|
||||
nsEventStates state = mState | locks;
|
||||
|
||||
if (locks.HasState(NS_EVENT_STATE_VISITED)) {
|
||||
return state & ~NS_EVENT_STATE_UNVISITED;
|
||||
}
|
||||
if (locks.HasState(NS_EVENT_STATE_UNVISITED)) {
|
||||
return state & ~NS_EVENT_STATE_VISITED;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
nsEventStates
|
||||
Element::LockedStyleStates() const
|
||||
{
|
||||
nsEventStates *locks =
|
||||
static_cast<nsEventStates*> (GetProperty(nsGkAtoms::lockedStyleStates));
|
||||
if (locks) {
|
||||
return *locks;
|
||||
}
|
||||
return nsEventStates();
|
||||
}
|
||||
|
||||
static void
|
||||
nsEventStatesPropertyDtor(void *aObject, nsIAtom *aProperty,
|
||||
void *aPropertyValue, void *aData)
|
||||
{
|
||||
nsEventStates *states = static_cast<nsEventStates*>(aPropertyValue);
|
||||
delete states;
|
||||
}
|
||||
|
||||
void
|
||||
Element::NotifyStyleStateChange(nsEventStates aStates)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
nsIPresShell *presShell = doc->GetShell();
|
||||
if (presShell) {
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
presShell->ContentStateChanged(doc, this, aStates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Element::LockStyleStates(nsEventStates aStates)
|
||||
{
|
||||
nsEventStates *locks = new nsEventStates(LockedStyleStates());
|
||||
|
||||
*locks |= aStates;
|
||||
|
||||
if (aStates.HasState(NS_EVENT_STATE_VISITED)) {
|
||||
*locks &= ~NS_EVENT_STATE_UNVISITED;
|
||||
}
|
||||
if (aStates.HasState(NS_EVENT_STATE_UNVISITED)) {
|
||||
*locks &= ~NS_EVENT_STATE_VISITED;
|
||||
}
|
||||
|
||||
SetProperty(nsGkAtoms::lockedStyleStates, locks, nsEventStatesPropertyDtor);
|
||||
SetHasLockedStyleStates();
|
||||
|
||||
NotifyStyleStateChange(aStates);
|
||||
}
|
||||
|
||||
void
|
||||
Element::UnlockStyleStates(nsEventStates aStates)
|
||||
{
|
||||
nsEventStates *locks = new nsEventStates(LockedStyleStates());
|
||||
|
||||
*locks &= ~aStates;
|
||||
|
||||
if (locks->IsEmpty()) {
|
||||
DeleteProperty(nsGkAtoms::lockedStyleStates);
|
||||
ClearHasLockedStyleStates();
|
||||
delete locks;
|
||||
}
|
||||
else {
|
||||
SetProperty(nsGkAtoms::lockedStyleStates, locks, nsEventStatesPropertyDtor);
|
||||
}
|
||||
|
||||
NotifyStyleStateChange(aStates);
|
||||
}
|
||||
|
||||
void
|
||||
Element::ClearStyleStateLocks()
|
||||
{
|
||||
nsEventStates locks = LockedStyleStates();
|
||||
|
||||
DeleteProperty(nsGkAtoms::lockedStyleStates);
|
||||
ClearHasLockedStyleStates();
|
||||
|
||||
NotifyStyleStateChange(locks);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsIContent::FindFirstNonNativeAnonymous() const
|
||||
{
|
||||
|
@ -1852,6 +1852,7 @@ GK_ATOM(transitionsOfAfterProperty, "TransitionsOfAfterProperty") // FrameTransi
|
||||
GK_ATOM(genConInitializerProperty, "QuoteNodeProperty")
|
||||
GK_ATOM(labelMouseDownPtProperty, "LabelMouseDownPtProperty")
|
||||
GK_ATOM(baseURIProperty, "baseURIProperty")
|
||||
GK_ATOM(lockedStyleStates, "lockedStyleStates")
|
||||
|
||||
// Languages for lang-specific transforms
|
||||
GK_ATOM(Japanese, "ja")
|
||||
|
@ -141,6 +141,9 @@ DOMSVGStringList::InsertItemBefore(const nsAString & newItem,
|
||||
PRUint32 index,
|
||||
nsAString & _retval)
|
||||
{
|
||||
if (newItem.IsEmpty()) { // takes care of DOMStringIsNull too
|
||||
return NS_ERROR_DOM_SVG_INVALID_VALUE_ERR;
|
||||
}
|
||||
index = NS_MIN(index, InternalList().Length());
|
||||
|
||||
// Ensure we have enough memory so we can avoid complex error handling below:
|
||||
@ -160,6 +163,9 @@ DOMSVGStringList::ReplaceItem(const nsAString & newItem,
|
||||
PRUint32 index,
|
||||
nsAString & _retval)
|
||||
{
|
||||
if (newItem.IsEmpty()) { // takes care of DOMStringIsNull too
|
||||
return NS_ERROR_DOM_SVG_INVALID_VALUE_ERR;
|
||||
}
|
||||
if (index >= InternalList().Length()) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
@ -123,8 +123,11 @@ SVGLengthListSMILType::Add(nsSMILValue& aDest,
|
||||
// should be, not zeros, and those values are not explicit or otherwise
|
||||
// available.
|
||||
|
||||
NS_ABORT_IF_FALSE(!dest.IsEmpty() || !valueToAdd.IsEmpty(),
|
||||
"Expecting at least one non-identity operand");
|
||||
if (dest.IsEmpty() && valueToAdd.IsEmpty()) {
|
||||
// Adding two identity values, no-op. This occurs when performing a
|
||||
// discrete by-animation on an attribute with no specified base value.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!valueToAdd.Element()) { // Adding identity value - no-op
|
||||
NS_ABORT_IF_FALSE(valueToAdd.IsEmpty(),
|
||||
|
@ -90,6 +90,7 @@ _TEST_FILES = \
|
||||
test_SVGMatrix.xhtml \
|
||||
test_SVGPathSegList.xhtml \
|
||||
test_SVGStyleElement.xhtml \
|
||||
test_SVGStringList.xhtml \
|
||||
test_SVGTransformList.xhtml \
|
||||
test_SVGTransformListAddition.xhtml \
|
||||
test_SVGxxxList.xhtml \
|
||||
|
119
content/svg/content/test/test_SVGStringList.xhtml
Normal file
119
content/svg/content/test/test_SVGStringList.xhtml
Normal file
@ -0,0 +1,119 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=724993-->
|
||||
<head>
|
||||
<title>Tests specific to SVGStringList</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=724993">Mozilla Bug 724993</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display:none;">
|
||||
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100">
|
||||
<g id="g" requiredFeatures="foo bar baz"/>
|
||||
</svg>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
/*
|
||||
This file runs a series of SVGStringList specific tests. Generic SVGXxxList
|
||||
tests can be found in test_SVGxxxList.xhtml. Anything that can be generalized
|
||||
to other list types belongs there.
|
||||
*/
|
||||
|
||||
function initializeThrowsFor(stringList, value)
|
||||
{
|
||||
try {
|
||||
stringList.initialize(value);
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function insertItemBeforeThrowsFor(stringList, value)
|
||||
{
|
||||
try {
|
||||
stringList.insertItemBefore(value, 0);
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function replaceItemThrowsFor(stringList, value)
|
||||
{
|
||||
try {
|
||||
stringList.replaceItem(value, 0);
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function appendItemThrowsFor(stringList, value)
|
||||
{
|
||||
try {
|
||||
stringList.appendItem(value);
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function run_tests()
|
||||
{
|
||||
var g = document.getElementById("g");
|
||||
var strings = g.requiredFeatures;
|
||||
|
||||
// sanity check:
|
||||
is(strings.numberOfItems, 3, 'numberOfItems should be 3');
|
||||
|
||||
|
||||
ok(initializeThrowsFor(strings, null),
|
||||
"SVGStringList.initialize() should throw when passed null");
|
||||
ok(initializeThrowsFor(strings, ""),
|
||||
"SVGStringList.initialize() should throw when passed the empty string");
|
||||
|
||||
ok(insertItemBeforeThrowsFor(strings, null),
|
||||
"SVGStringList.insertItemBefore() should throw when passed null");
|
||||
ok(insertItemBeforeThrowsFor(strings, ""),
|
||||
"SVGStringList.insertItemBefore() should throw when passed the empty string");
|
||||
|
||||
ok(replaceItemThrowsFor(strings, null),
|
||||
"SVGStringList.replaceItem() should throw when passed null");
|
||||
ok(replaceItemThrowsFor(strings, ""),
|
||||
"SVGStringList.replaceItem() should throw when passed the empty string");
|
||||
|
||||
ok(appendItemThrowsFor(strings, null),
|
||||
"SVGStringList.appendItem() should throw when passed null");
|
||||
ok(appendItemThrowsFor(strings, ""),
|
||||
"SVGStringList.appendItem() should throw when passed the empty string");
|
||||
|
||||
|
||||
// more sanity checks:
|
||||
ok(!initializeThrowsFor(strings, "valid-string"),
|
||||
"SVGStringList.initialize() should not throw when passed a valid string");
|
||||
ok(!insertItemBeforeThrowsFor(strings, "valid-string"),
|
||||
"SVGStringList.insertItemBefore() should not throw when passed a valid string");
|
||||
ok(!replaceItemThrowsFor(strings, "valid-string"),
|
||||
"SVGStringList.replaceItem() should not throw when passed a valid string");
|
||||
ok(!appendItemThrowsFor(strings, "valid-string"),
|
||||
"SVGStringList.appendItem() should not throw when passed a valid string");
|
||||
is(strings.length, 3, 'numberOfItems should be 3');
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.addEventListener("load", run_tests, false);
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -62,7 +62,7 @@
|
||||
<!ENTITY unknownSocketType.longDesc "<p>The site responded to the network request in an unexpected way and the browser cannot continue.</p>">
|
||||
|
||||
<!ENTITY nssFailure2.title "Secure Connection Failed">
|
||||
<!ENTITY nssFailure2.longDesc "<p>The page you are trying to view can not be shown because the authenticity of the received data could not be verified.</p><ul><li>Please contact the website owners to inform them of this problem.</li></ul>">
|
||||
<!ENTITY nssFailure2.longDesc "<p>The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.</p><ul><li>Please contact the website owners to inform them of this problem.</li></ul>">
|
||||
|
||||
<!ENTITY nssBadCert.title "Secure Connection Failed">
|
||||
<!ENTITY nssBadCert.longDesc2 "<ul>
|
||||
|
@ -295,7 +295,7 @@ PluginPRLibrary::HandleGUIEvent(NPP instance, const nsGUIEvent& anEvent,
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginPRLibrary::GetImage(NPP instance, ImageContainer* aContainer, Image** aImage)
|
||||
PluginPRLibrary::GetImageContainer(NPP instance, ImageContainer** aContainer)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public:
|
||||
virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
|
||||
|
||||
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
|
||||
virtual nsresult GetImage(NPP instance, ImageContainer* aContainer, Image** aImage);
|
||||
virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer);
|
||||
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
|
||||
NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }
|
||||
#if defined(XP_MACOSX)
|
||||
|
@ -958,15 +958,15 @@ nsNPAPIPluginInstance::HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled)
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetImage(ImageContainer* aContainer, Image** aImage)
|
||||
nsNPAPIPluginInstance::GetImageContainer(ImageContainer**aContainer)
|
||||
{
|
||||
*aImage = nsnull;
|
||||
*aContainer = nsnull;
|
||||
|
||||
if (RUNNING != mRunning)
|
||||
return NS_OK;
|
||||
|
||||
AutoPluginLibraryCall library(this);
|
||||
return !library ? NS_ERROR_FAILURE : library->GetImage(&mNPP, aContainer, aImage);
|
||||
return !library ? NS_ERROR_FAILURE : library->GetImageContainer(&mNPP, aContainer);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
bool ShouldCache();
|
||||
nsresult IsWindowless(bool* isWindowless);
|
||||
nsresult AsyncSetWindow(NPWindow* window);
|
||||
nsresult GetImage(ImageContainer* aContainer, Image** aImage);
|
||||
nsresult GetImageContainer(ImageContainer **aContainer);
|
||||
nsresult GetImageSize(nsIntSize* aSize);
|
||||
nsresult NotifyPainted(void);
|
||||
nsresult UseAsyncPainting(bool* aIsAsync);
|
||||
|
@ -190,7 +190,7 @@ static void DrawPlugin(ImageContainer* aContainer, void* aPluginInstanceOwner)
|
||||
{
|
||||
nsObjectFrame* frame = static_cast<nsPluginInstanceOwner*>(aPluginInstanceOwner)->GetFrame();
|
||||
if (frame) {
|
||||
frame->UpdateImageLayer(aContainer, gfxRect(0,0,0,0));
|
||||
frame->UpdateImageLayer(gfxRect(0,0,0,0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,29 +201,28 @@ static void OnDestroyImage(void* aPluginInstanceOwner)
|
||||
}
|
||||
#endif // XP_MACOSX
|
||||
|
||||
bool
|
||||
nsPluginInstanceOwner::SetCurrentImage(ImageContainer* aContainer)
|
||||
already_AddRefed<ImageContainer>
|
||||
nsPluginInstanceOwner::GetImageContainer()
|
||||
{
|
||||
if (mInstance) {
|
||||
nsRefPtr<Image> image;
|
||||
nsRefPtr<ImageContainer> container;
|
||||
// Every call to nsIPluginInstance::GetImage() creates
|
||||
// a new image. See nsIPluginInstance.idl.
|
||||
mInstance->GetImage(aContainer, getter_AddRefs(image));
|
||||
if (image) {
|
||||
mInstance->GetImageContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
#ifdef XP_MACOSX
|
||||
if (image->GetFormat() == Image::MAC_IO_SURFACE && mObjectFrame) {
|
||||
nsRefPtr<Image> image = container->GetCurrentImage();
|
||||
if (image && image->GetFormat() == Image::MAC_IO_SURFACE && mObjectFrame) {
|
||||
MacIOSurfaceImage *oglImage = static_cast<MacIOSurfaceImage*>(image.get());
|
||||
NS_ADDREF_THIS();
|
||||
oglImage->SetUpdateCallback(&DrawPlugin, this);
|
||||
oglImage->SetDestroyCallback(&OnDestroyImage);
|
||||
}
|
||||
#endif
|
||||
aContainer->SetCurrentImage(image);
|
||||
return true;
|
||||
return container.forget();
|
||||
}
|
||||
}
|
||||
aContainer->SetCurrentImage(nsnull);
|
||||
return false;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
@ -635,12 +634,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
|
||||
// Each time an asynchronously-drawing plugin sends a new surface to display,
|
||||
// InvalidateRect is called. We notify reftests that painting is up to
|
||||
// date and update our ImageContainer with the new surface.
|
||||
nsRefPtr<ImageContainer> container = mObjectFrame->GetImageContainer();
|
||||
nsRefPtr<ImageContainer> container;
|
||||
mInstance->GetImageContainer(getter_AddRefs(container));
|
||||
gfxIntSize oldSize(0, 0);
|
||||
if (container) {
|
||||
oldSize = container->GetCurrentSize();
|
||||
SetCurrentImage(container);
|
||||
}
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
// Windowed plugins should not be calling NPN_InvalidateRect, but
|
||||
|
@ -275,8 +275,10 @@ public:
|
||||
}
|
||||
|
||||
void NotifyPaintWaiter(nsDisplayListBuilder* aBuilder);
|
||||
// Return true if we set image with valid surface
|
||||
bool SetCurrentImage(ImageContainer* aContainer);
|
||||
|
||||
// Returns the image container that has our currently displayed image.
|
||||
already_AddRefed<ImageContainer> GetImageContainer();
|
||||
|
||||
/**
|
||||
* Returns the bounds of the current async-rendered surface. This can only
|
||||
* change in response to messages received by the event loop (i.e. not during
|
||||
|
@ -178,14 +178,14 @@ static UINT sLastMsg = 0;
|
||||
static bool ProcessFlashMessageDelayed(nsPluginNativeWindowWin * aWin, nsNPAPIPluginInstance * aInst,
|
||||
HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
NS_ENSURE_TRUE(aWin, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aInst, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aWin, false);
|
||||
NS_ENSURE_TRUE(aInst, false);
|
||||
|
||||
if (msg == sWM_FLASHBOUNCEMSG) {
|
||||
// See PluginWindowEvent::Run() below.
|
||||
NS_ASSERTION((sWM_FLASHBOUNCEMSG != 0), "RegisterWindowMessage failed in flash plugin WM_USER message handling!");
|
||||
::CallWindowProc((WNDPROC)aWin->GetWindowProc(), hWnd, WM_USER_FLASH, wParam, lParam);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msg != WM_USER_FLASH)
|
||||
@ -348,10 +348,8 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
|
||||
|
||||
sInMessageDispatch = true;
|
||||
|
||||
LRESULT res = TRUE;
|
||||
NS_TRY_SAFE_CALL_RETURN(res,
|
||||
::CallWindowProc((WNDPROC)win->GetWindowProc(), hWnd, msg, wParam, lParam),
|
||||
inst);
|
||||
LRESULT res = CallWindowProc((WNDPROC)win->GetWindowProc(),
|
||||
hWnd, msg, wParam, lParam);
|
||||
|
||||
sInMessageDispatch = false;
|
||||
|
||||
|
@ -631,7 +631,7 @@ PluginInstanceParent::HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled)
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginInstanceParent::GetImage(ImageContainer* aContainer, Image** aImage)
|
||||
PluginInstanceParent::GetImageContainer(ImageContainer** aContainer)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
nsIOSurface* ioSurface = NULL;
|
||||
@ -655,8 +655,14 @@ PluginInstanceParent::GetImage(ImageContainer* aContainer, Image** aImage)
|
||||
}
|
||||
#endif
|
||||
|
||||
ImageContainer *container = GetImageContainer();
|
||||
|
||||
if (!container) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<Image> image;
|
||||
image = aContainer->CreateImage(&format, 1);
|
||||
image = container->CreateImage(&format, 1);
|
||||
if (!image) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -668,7 +674,10 @@ PluginInstanceParent::GetImage(ImageContainer* aContainer, Image** aImage)
|
||||
MacIOSurfaceImage::Data ioData;
|
||||
ioData.mIOSurface = ioSurface;
|
||||
ioImage->SetData(ioData);
|
||||
*aImage = image.forget().get();
|
||||
container->SetCurrentImage(ioImage);
|
||||
|
||||
NS_IF_ADDREF(container);
|
||||
*aContainer = container;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
@ -680,7 +689,10 @@ PluginInstanceParent::GetImage(ImageContainer* aContainer, Image** aImage)
|
||||
cairoData.mSize = mFrontSurface->GetSize();
|
||||
pluginImage->SetData(cairoData);
|
||||
|
||||
*aImage = image.forget().get();
|
||||
container->SetCurrentImage(pluginImage);
|
||||
|
||||
NS_IF_ADDREF(container);
|
||||
*aContainer = container;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -858,6 +870,17 @@ PluginInstanceParent::BackgroundDescriptor()
|
||||
return SurfaceDescriptor();
|
||||
}
|
||||
|
||||
ImageContainer*
|
||||
PluginInstanceParent::GetImageContainer()
|
||||
{
|
||||
if (mImageContainer) {
|
||||
return mImageContainer;
|
||||
}
|
||||
|
||||
mImageContainer = LayerManager::CreateImageContainer();
|
||||
return mImageContainer;
|
||||
}
|
||||
|
||||
PPluginBackgroundDestroyerParent*
|
||||
PluginInstanceParent::AllocPPluginBackgroundDestroyer()
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ public:
|
||||
AnswerPluginFocusChange(const bool& gotFocus);
|
||||
|
||||
nsresult AsyncSetWindow(NPWindow* window);
|
||||
nsresult GetImage(mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage);
|
||||
nsresult GetImageContainer(mozilla::layers::ImageContainer** aContainer);
|
||||
nsresult GetImageSize(nsIntSize* aSize);
|
||||
#ifdef XP_MACOSX
|
||||
nsresult IsRemoteDrawingCoreAnimation(bool *aDrawing);
|
||||
@ -301,6 +301,9 @@ private:
|
||||
void DestroyBackground();
|
||||
SurfaceDescriptor BackgroundDescriptor() /*const*/;
|
||||
|
||||
typedef mozilla::layers::ImageContainer ImageContainer;
|
||||
ImageContainer *GetImageContainer();
|
||||
|
||||
NS_OVERRIDE
|
||||
virtual PPluginBackgroundDestroyerParent*
|
||||
AllocPPluginBackgroundDestroyer();
|
||||
@ -365,6 +368,8 @@ private:
|
||||
// the consistency of the pixels in |mBackground|. A plugin may
|
||||
// be able to observe partial updates to the background.
|
||||
nsRefPtr<gfxASurface> mBackground;
|
||||
|
||||
nsRefPtr<ImageContainer> mImageContainer;
|
||||
};
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& aResult) = 0;
|
||||
|
||||
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0;
|
||||
virtual nsresult GetImage(NPP instance, ImageContainer* aContainer, Image** aImage) = 0;
|
||||
virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer) = 0;
|
||||
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
|
||||
virtual bool UseAsyncPainting() = 0;
|
||||
#if defined(XP_MACOSX)
|
||||
|
@ -687,12 +687,11 @@ PluginModuleParent::HandleGUIEvent(NPP instance,
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginModuleParent::GetImage(NPP instance,
|
||||
mozilla::layers::ImageContainer* aContainer,
|
||||
mozilla::layers::Image** aImage)
|
||||
PluginModuleParent::GetImageContainer(NPP instance,
|
||||
mozilla::layers::ImageContainer** aContainer)
|
||||
{
|
||||
PluginInstanceParent* i = InstCast(instance);
|
||||
return !i ? NS_ERROR_FAILURE : i->GetImage(aContainer, aImage);
|
||||
return !i ? NS_ERROR_FAILURE : i->GetImageContainer(aContainer);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -262,7 +262,7 @@ private:
|
||||
|
||||
virtual bool HasRequiredFunctions();
|
||||
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
|
||||
virtual nsresult GetImage(NPP instance, mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage);
|
||||
virtual nsresult GetImageContainer(NPP instance, mozilla::layers::ImageContainer** aContainer);
|
||||
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
|
||||
NS_OVERRIDE virtual bool UseAsyncPainting() { return true; }
|
||||
NS_OVERRIDE
|
||||
|
@ -83,6 +83,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(SmsManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozSmsManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMozSmsManager)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSmsManager)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
@ -163,7 +163,7 @@ Telephony::SwitchActiveCall(TelephonyCall* aCall)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(Telephony)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(Telephony,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
nsDOMEventTargetHelper)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(incoming)
|
||||
for (PRUint32 index = 0; index < tmp->mCalls.Length(); index++) {
|
||||
@ -173,12 +173,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(Telephony,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(Telephony,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
nsDOMEventTargetHelper)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(tmp->mCallsArray, "mCallsArray")
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(Telephony,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
nsDOMEventTargetHelper)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(incoming)
|
||||
tmp->mCalls.Clear();
|
||||
tmp->mActiveCall = nsnull;
|
||||
@ -188,10 +188,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Telephony)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTelephony)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Telephony)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(Telephony, nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_RELEASE_INHERITED(Telephony, nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_ADDREF_INHERITED(Telephony, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(Telephony, nsDOMEventTargetHelper)
|
||||
|
||||
DOMCI_DATA(Telephony, Telephony)
|
||||
|
||||
|
@ -51,7 +51,7 @@ class nsPIDOMWindow;
|
||||
|
||||
BEGIN_TELEPHONY_NAMESPACE
|
||||
|
||||
class Telephony : public nsDOMEventTargetWrapperCache,
|
||||
class Telephony : public nsDOMEventTargetHelper,
|
||||
public nsIDOMTelephony
|
||||
{
|
||||
nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
|
||||
@ -72,10 +72,10 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMTELEPHONY
|
||||
NS_DECL_NSIRILTELEPHONYCALLBACK
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
|
||||
Telephony,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
static already_AddRefed<Telephony>
|
||||
Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL);
|
||||
@ -83,7 +83,7 @@ public:
|
||||
nsIDOMEventTarget*
|
||||
ToIDOMEventTarget() const
|
||||
{
|
||||
return static_cast<nsDOMEventTargetWrapperCache*>(
|
||||
return static_cast<nsDOMEventTargetHelper*>(
|
||||
const_cast<Telephony*>(this));
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ TelephonyCall::ChangeStateInternal(PRUint16 aCallState, bool aFireEvents)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(TelephonyCall)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TelephonyCall,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
nsDOMEventTargetHelper)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_PTR(tmp->mTelephony->ToISupports(),
|
||||
Telephony, "mTelephony")
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(statechange)
|
||||
@ -168,7 +168,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TelephonyCall,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(TelephonyCall,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
nsDOMEventTargetHelper)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTelephony)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(statechange)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(dialing)
|
||||
@ -184,10 +184,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TelephonyCall)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTelephonyCall)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TelephonyCall)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(TelephonyCall, nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_RELEASE_INHERITED(TelephonyCall, nsDOMEventTargetWrapperCache)
|
||||
NS_IMPL_ADDREF_INHERITED(TelephonyCall, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(TelephonyCall, nsDOMEventTargetHelper)
|
||||
|
||||
DOMCI_DATA(TelephonyCall, TelephonyCall)
|
||||
|
||||
|
@ -49,7 +49,7 @@ class nsPIDOMWindow;
|
||||
|
||||
BEGIN_TELEPHONY_NAMESPACE
|
||||
|
||||
class TelephonyCall : public nsDOMEventTargetWrapperCache,
|
||||
class TelephonyCall : public nsDOMEventTargetHelper,
|
||||
public nsIDOMTelephonyCall
|
||||
{
|
||||
NS_DECL_EVENT_HANDLER(statechange)
|
||||
@ -75,9 +75,9 @@ class TelephonyCall : public nsDOMEventTargetWrapperCache,
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMTELEPHONYCALL
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCall,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
static already_AddRefed<TelephonyCall>
|
||||
Create(Telephony* aTelephony, const nsAString& aNumber, PRUint16 aCallState,
|
||||
@ -86,7 +86,7 @@ public:
|
||||
nsIDOMEventTarget*
|
||||
ToIDOMEventTarget() const
|
||||
{
|
||||
return static_cast<nsDOMEventTargetWrapperCache*>(
|
||||
return static_cast<nsDOMEventTargetHelper*>(
|
||||
const_cast<TelephonyCall*>(this));
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsDOMEventTargetWrapperCache.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
|
@ -3636,12 +3636,14 @@ nsEditor::IsEditable(nsIContent *aNode)
|
||||
// rely on frameless textnodes being visible.
|
||||
return false;
|
||||
}
|
||||
if (aNode->NodeType() == nsIDOMNode::COMMENT_NODE)
|
||||
return false;
|
||||
if (aNode->NodeType() != nsIDOMNode::TEXT_NODE)
|
||||
return true; // not a text node; not invisible
|
||||
|
||||
return IsTextInDirtyFrameVisible(aNode);
|
||||
switch (aNode->NodeType()) {
|
||||
case nsIDOMNode::ELEMENT_NODE:
|
||||
return true; // not a text node; not invisible
|
||||
case nsIDOMNode::TEXT_NODE:
|
||||
return IsTextInDirtyFrameVisible(aNode);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -101,7 +101,12 @@ public class CrashReporter extends Activity
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
mProgressDialog.dismiss();
|
||||
try {
|
||||
if (mProgressDialog.isShowing()) {
|
||||
mProgressDialog.dismiss();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
super.finish();
|
||||
}
|
||||
|
||||
@ -230,8 +235,10 @@ public class CrashReporter extends Activity
|
||||
final CheckBox includeURLCheckbox = (CheckBox) findViewById(R.id.include_url);
|
||||
|
||||
String spec = extras.get("ServerURL");
|
||||
if (spec == null)
|
||||
if (spec == null) {
|
||||
doFinish();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.i("GeckoCrashReport", "server url: " + spec);
|
||||
try {
|
||||
|
@ -2595,7 +2595,7 @@ _cairo_d2d_acquire_source_image(void *abstract_surface,
|
||||
assert(cairo_surface_status(image_out) == CAIRO_STATUS_SUCCESS ||
|
||||
cairo_surface_status(image_out) == CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
*image_extra = softTexture.forget();
|
||||
*image_extra = softTexture.forget().drop();
|
||||
*image_out_ret = (cairo_image_surface_t*)image_out;
|
||||
|
||||
return cairo_surface_status(image_out);
|
||||
@ -2668,7 +2668,7 @@ _cairo_d2d_acquire_dest_image(void *abstract_surface,
|
||||
size.width,
|
||||
size.height,
|
||||
data.RowPitch);
|
||||
*image_extra = softTexture.forget();
|
||||
*image_extra = softTexture.forget().drop();
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -36,55 +36,68 @@
|
||||
#ifndef CAIRO_WIN32_REFPTR_H
|
||||
#define CAIRO_WIN32_REFPTR_H
|
||||
|
||||
template<class T>
|
||||
template<typename T> class TemporaryRef;
|
||||
|
||||
/**
|
||||
* RefPtr points to a refcounted thing that has AddRef and Release
|
||||
* methods to increase/decrease the refcount, respectively. After a
|
||||
* RefPtr<T> is assigned a T*, the T* can be used through the RefPtr
|
||||
* as if it were a T*.
|
||||
*
|
||||
* A RefPtr can forget its underlying T*, which results in the T*
|
||||
* being wrapped in a temporary object until the T* is either
|
||||
* re-adopted from or released by the temporary.
|
||||
*/
|
||||
template<typename T>
|
||||
class RefPtr
|
||||
{
|
||||
// To allow them to use unref()
|
||||
friend class TemporaryRef<T>;
|
||||
|
||||
struct dontRef {};
|
||||
|
||||
public:
|
||||
RefPtr() : mPtr(NULL)
|
||||
{ }
|
||||
RefPtr() : ptr(0) { }
|
||||
RefPtr(const RefPtr& o) : ptr(ref(o.ptr)) {}
|
||||
RefPtr(const TemporaryRef<T>& o) : ptr(o.drop()) {}
|
||||
RefPtr(T* t) : ptr(ref(t)) {}
|
||||
|
||||
RefPtr(T *aPtr) : mPtr(aPtr)
|
||||
{
|
||||
if (mPtr) {
|
||||
mPtr->AddRef();
|
||||
}
|
||||
template<typename U>
|
||||
RefPtr(const RefPtr<U>& o) : ptr(ref(o.get())) {}
|
||||
|
||||
~RefPtr() { unref(ptr); }
|
||||
|
||||
RefPtr& operator=(const RefPtr& o) {
|
||||
assign(ref(o.ptr));
|
||||
return *this;
|
||||
}
|
||||
RefPtr& operator=(const TemporaryRef<T>& o) {
|
||||
assign(o.drop());
|
||||
return *this;
|
||||
}
|
||||
RefPtr& operator=(T* t) {
|
||||
assign(ref(t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
RefPtr(const RefPtr<T> &aRefPtr)
|
||||
{
|
||||
mPtr = aRefPtr.mPtr;
|
||||
if (mPtr) {
|
||||
mPtr->AddRef();
|
||||
}
|
||||
template<typename U>
|
||||
RefPtr& operator=(const RefPtr<U>& o) {
|
||||
assign(ref(o.get()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class newType>
|
||||
explicit RefPtr(const RefPtr<newType> &aRefPtr)
|
||||
{
|
||||
mPtr = aRefPtr.get();
|
||||
if (mPtr) {
|
||||
mPtr->AddRef();
|
||||
}
|
||||
TemporaryRef<T> forget() {
|
||||
T* tmp = ptr;
|
||||
ptr = 0;
|
||||
return TemporaryRef<T>(tmp, dontRef());
|
||||
}
|
||||
|
||||
~RefPtr()
|
||||
{
|
||||
if (mPtr) {
|
||||
mPtr->Release();
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<T> &operator =(const RefPtr<T> aPtr)
|
||||
{
|
||||
assignPtr(aPtr.mPtr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
RefPtr<T> &operator =(T* aPtr)
|
||||
{
|
||||
assignPtr(aPtr);
|
||||
return *this;
|
||||
}
|
||||
T* get() const { return ptr; }
|
||||
operator T*() const { return ptr; }
|
||||
T* operator->() const { return ptr; }
|
||||
T& operator*() const { return *ptr; }
|
||||
template<typename U>
|
||||
operator TemporaryRef<U>() { return TemporaryRef<U>(ptr); }
|
||||
|
||||
/**
|
||||
* WARNING for ease of use, passing a reference will release/clear out ptr!
|
||||
@ -95,67 +108,71 @@ public:
|
||||
*/
|
||||
T** operator&()
|
||||
{
|
||||
if (mPtr) {
|
||||
mPtr->Release();
|
||||
mPtr = NULL;
|
||||
}
|
||||
return &mPtr;
|
||||
}
|
||||
|
||||
T* operator->()
|
||||
{
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
T* operator->() const
|
||||
{
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
operator bool()
|
||||
{
|
||||
return (mPtr ? true : false);
|
||||
}
|
||||
|
||||
operator T*()
|
||||
{
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
template <class newType>
|
||||
operator RefPtr<newType>()
|
||||
{
|
||||
RefPtr<newType> newPtr;
|
||||
newPtr = mPtr;
|
||||
return newPtr;
|
||||
}
|
||||
|
||||
T* get() const
|
||||
{
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
T* forget()
|
||||
{
|
||||
T* ptr = mPtr;
|
||||
mPtr = NULL;
|
||||
return ptr;
|
||||
if (ptr) {
|
||||
ptr->Release();
|
||||
ptr = NULL;
|
||||
}
|
||||
return &ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
void assignPtr(T* aPtr)
|
||||
{
|
||||
T *oldPtr = mPtr;
|
||||
mPtr = aPtr;
|
||||
if (mPtr) {
|
||||
mPtr->AddRef();
|
||||
}
|
||||
if (oldPtr) {
|
||||
oldPtr->Release();
|
||||
}
|
||||
void assign(T* t) {
|
||||
unref(ptr);
|
||||
ptr = t;
|
||||
}
|
||||
|
||||
T *mPtr;
|
||||
T* ptr;
|
||||
|
||||
static inline T* ref(T* t) {
|
||||
if (t) {
|
||||
t->AddRef();
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
static inline void unref(T* t) {
|
||||
if (t) {
|
||||
t->Release();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* TemporaryRef<T> represents an object that holds a temporary
|
||||
* reference to a T. TemporaryRef objects can't be manually ref'd or
|
||||
* unref'd (being temporaries, not lvalues), so can only relinquish
|
||||
* references to other objects, or unref on destruction.
|
||||
*/
|
||||
template<typename T>
|
||||
class TemporaryRef
|
||||
{
|
||||
// To allow it to construct TemporaryRef from a bare T*
|
||||
friend class RefPtr<T>;
|
||||
|
||||
typedef typename RefPtr<T>::dontRef dontRef;
|
||||
|
||||
public:
|
||||
TemporaryRef(T* t) : ptr(RefPtr<T>::ref(t)) {}
|
||||
TemporaryRef(const TemporaryRef& o) : ptr(o.drop()) {}
|
||||
|
||||
template<typename U>
|
||||
TemporaryRef(const TemporaryRef<U>& o) : ptr(o.drop()) {}
|
||||
|
||||
~TemporaryRef() { RefPtr<T>::unref(ptr); }
|
||||
|
||||
T* drop() const {
|
||||
T* tmp = ptr;
|
||||
ptr = 0;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private:
|
||||
TemporaryRef(T* t, const dontRef&) : ptr(t) {}
|
||||
|
||||
mutable T* ptr;
|
||||
|
||||
TemporaryRef();
|
||||
TemporaryRef& operator=(const TemporaryRef&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -533,6 +533,8 @@ public:
|
||||
bool aIsOffscreen = false,
|
||||
GLContext *aSharedContext = nsnull)
|
||||
: mFlushGuaranteesResolve(false),
|
||||
mBoundDrawFBO(0),
|
||||
mBoundReadFBO(0),
|
||||
mOffscreenFBOsDirty(false),
|
||||
mInitialized(false),
|
||||
mIsOffscreen(aIsOffscreen),
|
||||
@ -775,11 +777,10 @@ public:
|
||||
return mIsOffscreen;
|
||||
}
|
||||
|
||||
protected:
|
||||
private:
|
||||
bool mFlushGuaranteesResolve;
|
||||
|
||||
public:
|
||||
|
||||
void SetFlushGuaranteesResolve(bool aFlushGuaranteesResolve) {
|
||||
mFlushGuaranteesResolve = aFlushGuaranteesResolve;
|
||||
}
|
||||
@ -851,22 +852,59 @@ public:
|
||||
return IsExtensionSupported(EXT_framebuffer_blit) || IsExtensionSupported(ANGLE_framebuffer_blit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
GLuint mBoundDrawFBO;
|
||||
GLuint mBoundReadFBO;
|
||||
|
||||
public:
|
||||
void fBindFramebuffer(GLenum target, GLuint framebuffer) {
|
||||
switch (target) {
|
||||
case LOCAL_GL_FRAMEBUFFER:
|
||||
mBoundDrawFBO = mBoundReadFBO = framebuffer;
|
||||
break;
|
||||
case LOCAL_GL_DRAW_FRAMEBUFFER_EXT:
|
||||
mBoundDrawFBO = framebuffer;
|
||||
break;
|
||||
case LOCAL_GL_READ_FRAMEBUFFER_EXT:
|
||||
mBoundReadFBO = framebuffer;
|
||||
break;
|
||||
}
|
||||
raw_fBindFramebuffer(target, framebuffer);
|
||||
}
|
||||
|
||||
GLuint GetBoundDrawFBO() {
|
||||
#ifdef DEBUG
|
||||
GLint ret = 0;
|
||||
if (SupportsOffscreenSplit())
|
||||
fGetIntegerv(LOCAL_GL_DRAW_FRAMEBUFFER_BINDING_EXT, &ret);
|
||||
else
|
||||
fGetIntegerv(LOCAL_GL_FRAMEBUFFER_BINDING, &ret);
|
||||
return ret;
|
||||
// Don't need a branch here, because:
|
||||
// LOCAL_GL_DRAW_FRAMEBUFFER_BINDING_EXT == LOCAL_GL_FRAMEBUFFER_BINDING == 0x8CA6
|
||||
fGetIntegerv(LOCAL_GL_DRAW_FRAMEBUFFER_BINDING_EXT, &ret);
|
||||
|
||||
if (mBoundDrawFBO != (GLuint)ret) {
|
||||
printf_stderr("!!! Draw FBO mismatch: Was: %d, Expected: %d\n", ret, mBoundDrawFBO);
|
||||
NS_ABORT();
|
||||
}
|
||||
#endif
|
||||
|
||||
return mBoundDrawFBO;
|
||||
}
|
||||
|
||||
GLuint GetBoundReadFBO() {
|
||||
#ifdef DEBUG
|
||||
GLint ret = 0;
|
||||
if (SupportsOffscreenSplit())
|
||||
fGetIntegerv(LOCAL_GL_READ_FRAMEBUFFER_BINDING_EXT, &ret);
|
||||
else
|
||||
fGetIntegerv(LOCAL_GL_FRAMEBUFFER_BINDING, &ret);
|
||||
return ret;
|
||||
|
||||
if (mBoundReadFBO != (GLuint)ret) {
|
||||
printf_stderr("!!! Read FBO mismatch: Was: %d, Expected: %d\n", ret, mBoundReadFBO);
|
||||
NS_ABORT();
|
||||
}
|
||||
#endif
|
||||
|
||||
return mBoundReadFBO;
|
||||
}
|
||||
|
||||
void BindDrawFBO(GLuint name) {
|
||||
@ -2421,12 +2459,14 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fBindFramebuffer(GLenum target, GLuint framebuffer) {
|
||||
private:
|
||||
void raw_fBindFramebuffer(GLenum target, GLuint framebuffer) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fBindFramebuffer(target, framebuffer);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
public:
|
||||
void fBindRenderbuffer(GLenum target, GLuint renderbuffer) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fBindRenderbuffer(target, renderbuffer);
|
||||
|
@ -276,6 +276,9 @@ CPPSRCS += \
|
||||
gfxPDFSurface.cpp \
|
||||
nsUnicodeRange.cpp \
|
||||
$(NULL)
|
||||
# This is set for "normal Android", that is, when Gecko is running on
|
||||
# top of the android java runtime.
|
||||
DEFINES += -DMOZ_USING_ANDROID_JAVA_WIDGETS
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gonk)
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "gfxFT2FontList.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "cairo.h"
|
||||
|
||||
@ -195,3 +196,28 @@ gfxAndroidPlatform::GetScaledFontForFont(gfxFont *aFont)
|
||||
return scaledFont;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxAndroidPlatform::FontHintingEnabled()
|
||||
{
|
||||
// In "mobile" builds, we sometimes use non-reflow-zoom, so we
|
||||
// might not want hinting. Let's see.
|
||||
#ifdef MOZ_USING_ANDROID_JAVA_WIDGETS
|
||||
// On android-java, we currently only use gecko to render web
|
||||
// content that can always be be non-reflow-zoomed. So turn off
|
||||
// hinting.
|
||||
//
|
||||
// XXX when gecko-android-java is used as an "app runtime", we'll
|
||||
// want to re-enable hinting.
|
||||
return false;
|
||||
#else
|
||||
// Otherwise, if we're in a content process, assume we don't want
|
||||
// hinting.
|
||||
//
|
||||
// XXX when we use content processes to load "apps", we'll want to
|
||||
// configure this dynamically based on whether we're an "app
|
||||
// content process" or a "browser content process". The former
|
||||
// wants hinting, the latter doesn't since it might be
|
||||
// non-reflow-zoomed.
|
||||
return (XRE_GetProcessType() != GeckoProcessType_Content);
|
||||
#endif // MOZ_USING_ANDROID_JAVA_WIDGETS
|
||||
}
|
||||
|
@ -99,6 +99,8 @@ public:
|
||||
const gfxFontStyle *aStyle,
|
||||
gfxUserFontSet* aUserFontSet);
|
||||
|
||||
virtual bool FontHintingEnabled() MOZ_OVERRIDE;
|
||||
|
||||
FT_Library GetFTLibrary();
|
||||
};
|
||||
|
||||
|
@ -154,9 +154,9 @@ FT2FontEntry::CreateScaledFont(const gfxFontStyle *aStyle)
|
||||
|
||||
cairo_font_options_t *fontOptions = cairo_font_options_create();
|
||||
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
cairo_font_options_set_hint_metrics(fontOptions, CAIRO_HINT_METRICS_OFF);
|
||||
#endif
|
||||
if (!gfxPlatform::GetPlatform()->FontHintingEnabled()) {
|
||||
cairo_font_options_set_hint_metrics(fontOptions, CAIRO_HINT_METRICS_OFF);
|
||||
}
|
||||
|
||||
scaledFont = cairo_scaled_font_create(CairoFontFace(),
|
||||
&sizeMatrix,
|
||||
@ -279,11 +279,10 @@ FT2FontEntry::CreateFontEntry(FT_Face aFace,
|
||||
FT2FontEntry *fe = new FT2FontEntry(fontName);
|
||||
fe->mItalic = aFace->style_flags & FT_STYLE_FLAG_ITALIC;
|
||||
fe->mFTFace = aFace;
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
fe->mFontFace = cairo_ft_font_face_create_for_ft_face(aFace, FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING);
|
||||
#else
|
||||
fe->mFontFace = cairo_ft_font_face_create_for_ft_face(aFace, 0);
|
||||
#endif
|
||||
int flags = gfxPlatform::GetPlatform()->FontHintingEnabled() ?
|
||||
FT_LOAD_DEFAULT :
|
||||
(FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING);
|
||||
fe->mFontFace = cairo_ft_font_face_create_for_ft_face(aFace, flags);
|
||||
fe->mFilename = aFilename;
|
||||
fe->mFTFontIndex = aIndex;
|
||||
FTUserFontData *userFontData = new FTUserFontData(aFace, aFontData);
|
||||
@ -330,11 +329,10 @@ FT2FontEntry::CairoFontFace()
|
||||
FT_Face face;
|
||||
FT_New_Face(gfxToolkitPlatform::GetPlatform()->GetFTLibrary(), mFilename.get(), mFTFontIndex, &face);
|
||||
mFTFace = face;
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
mFontFace = cairo_ft_font_face_create_for_ft_face(face, FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING);
|
||||
#else
|
||||
mFontFace = cairo_ft_font_face_create_for_ft_face(face, 0);
|
||||
#endif
|
||||
int flags = gfxPlatform::GetPlatform()->FontHintingEnabled() ?
|
||||
FT_LOAD_DEFAULT :
|
||||
(FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING);
|
||||
mFontFace = cairo_ft_font_face_create_for_ft_face(face, flags);
|
||||
FTUserFontData *userFontData = new FTUserFontData(face, nsnull);
|
||||
cairo_font_face_set_user_data(mFontFace, &key,
|
||||
userFontData, FTFontDestroyFunc);
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsUnicodeRange.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "prlog.h"
|
||||
#include "prinit.h"
|
||||
@ -641,11 +642,10 @@ gfxFT2Font::FillGlyphDataForChar(PRUint32 ch, CachedGlyphData *gd)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
FT_Error err = FT_Load_Glyph(face, gid, FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING);
|
||||
#else
|
||||
FT_Error err = FT_Load_Glyph(face, gid, FT_LOAD_DEFAULT);
|
||||
#endif
|
||||
FT_Int32 flags = gfxPlatform::GetPlatform()->FontHintingEnabled() ?
|
||||
FT_LOAD_DEFAULT :
|
||||
(FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING);
|
||||
FT_Error err = FT_Load_Glyph(face, gid, flags);
|
||||
|
||||
if (err) {
|
||||
// hmm, this is weird, we failed to load a glyph that we had?
|
||||
|
@ -310,6 +310,15 @@ public:
|
||||
*/
|
||||
bool SanitizeDownloadedFonts();
|
||||
|
||||
/**
|
||||
* True when hinting should be enabled. This setting shouldn't
|
||||
* change per gecko process, while the process is live. If so the
|
||||
* results are not defined.
|
||||
*
|
||||
* NB: this bit is only honored by the FT2 backend, currently.
|
||||
*/
|
||||
virtual bool FontHintingEnabled() { return true; }
|
||||
|
||||
#ifdef MOZ_GRAPHITE
|
||||
/**
|
||||
* Whether to use the SIL Graphite rendering engine
|
||||
|
@ -64,6 +64,131 @@ ParseNode::isConstant()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void
|
||||
IndentNewLine(int indent)
|
||||
{
|
||||
fputc('\n', stderr);
|
||||
for (int i = 0; i < indent; ++i)
|
||||
fputc(' ', stderr);
|
||||
}
|
||||
|
||||
inline void
|
||||
ParseNode::dump(int indent)
|
||||
{
|
||||
switch (pn_arity) {
|
||||
case PN_NULLARY:
|
||||
((NullaryNode *) this)->dump();
|
||||
break;
|
||||
case PN_UNARY:
|
||||
((UnaryNode *) this)->dump(indent);
|
||||
break;
|
||||
case PN_BINARY:
|
||||
((BinaryNode *) this)->dump(indent);
|
||||
break;
|
||||
case PN_TERNARY:
|
||||
((TernaryNode *) this)->dump(indent);
|
||||
break;
|
||||
case PN_FUNC:
|
||||
((FunctionNode *) this)->dump(indent);
|
||||
break;
|
||||
case PN_LIST:
|
||||
((ListNode *) this)->dump(indent);
|
||||
break;
|
||||
case PN_NAME:
|
||||
((NameNode *) this)->dump(indent);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "?");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
NullaryNode::dump()
|
||||
{
|
||||
fprintf(stderr, "(%s)", js_CodeName[getOp()]);
|
||||
}
|
||||
|
||||
inline void
|
||||
UnaryNode::dump(int indent)
|
||||
{
|
||||
const char *name = js_CodeName[getOp()];
|
||||
fprintf(stderr, "(%s ", name);
|
||||
indent += strlen(name) + 2;
|
||||
DumpParseTree(pn_kid, indent);
|
||||
fprintf(stderr, ")");
|
||||
}
|
||||
|
||||
inline void
|
||||
BinaryNode::dump(int indent)
|
||||
{
|
||||
const char *name = js_CodeName[getOp()];
|
||||
fprintf(stderr, "(%s ", name);
|
||||
indent += strlen(name) + 2;
|
||||
DumpParseTree(pn_left, indent);
|
||||
IndentNewLine(indent);
|
||||
DumpParseTree(pn_right, indent);
|
||||
fprintf(stderr, ")");
|
||||
}
|
||||
|
||||
inline void
|
||||
TernaryNode::dump(int indent)
|
||||
{
|
||||
const char *name = js_CodeName[getOp()];
|
||||
fprintf(stderr, "(%s ", name);
|
||||
indent += strlen(name) + 2;
|
||||
DumpParseTree(pn_kid1, indent);
|
||||
IndentNewLine(indent);
|
||||
DumpParseTree(pn_kid2, indent);
|
||||
IndentNewLine(indent);
|
||||
DumpParseTree(pn_kid3, indent);
|
||||
fprintf(stderr, ")");
|
||||
}
|
||||
|
||||
inline void
|
||||
FunctionNode::dump(int indent)
|
||||
{
|
||||
const char *name = js_CodeName[getOp()];
|
||||
fprintf(stderr, "(%s ", name);
|
||||
indent += strlen(name) + 2;
|
||||
DumpParseTree(pn_body, indent);
|
||||
fprintf(stderr, ")");
|
||||
}
|
||||
|
||||
inline void
|
||||
ListNode::dump(int indent)
|
||||
{
|
||||
const char *name = js_CodeName[getOp()];
|
||||
fprintf(stderr, "(%s ", name);
|
||||
if (pn_head != NULL) {
|
||||
indent += strlen(name) + 2;
|
||||
DumpParseTree(pn_head, indent);
|
||||
ParseNode *pn = pn_head->pn_next;
|
||||
while (pn != NULL) {
|
||||
IndentNewLine(indent);
|
||||
DumpParseTree(pn, indent);
|
||||
pn = pn->pn_next;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, ")");
|
||||
}
|
||||
|
||||
inline void
|
||||
NameNode::dump(int indent)
|
||||
{
|
||||
const char *name = js_CodeName[getOp()];
|
||||
if (isUsed())
|
||||
fprintf(stderr, "(%s)", name);
|
||||
else {
|
||||
fprintf(stderr, "(%s ", name);
|
||||
indent += strlen(name) + 2;
|
||||
DumpParseTree(expr(), indent);
|
||||
fprintf(stderr, ")");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void
|
||||
NameNode::initCommon(TreeContext *tc)
|
||||
{
|
||||
|
@ -660,3 +660,14 @@ js::CloneLeftHandSide(ParseNode *opn, TreeContext *tc)
|
||||
}
|
||||
return pn;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
js::DumpParseTree(ParseNode *pn, int indent)
|
||||
{
|
||||
if (pn == NULL)
|
||||
fprintf(stderr, "()");
|
||||
else
|
||||
pn->dump(indent);
|
||||
}
|
||||
#endif
|
||||
|
@ -929,12 +929,20 @@ struct ParseNode {
|
||||
#endif
|
||||
inline ConditionalExpression &asConditionalExpression();
|
||||
inline PropertyAccess &asPropertyAccess();
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void dump(int indent);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct NullaryNode : public ParseNode {
|
||||
static inline NullaryNode *create(ParseNodeKind kind, TreeContext *tc) {
|
||||
return (NullaryNode *)ParseNode::create(kind, PN_NULLARY, tc);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void dump();
|
||||
#endif
|
||||
};
|
||||
|
||||
struct UnaryNode : public ParseNode {
|
||||
@ -947,6 +955,10 @@ struct UnaryNode : public ParseNode {
|
||||
static inline UnaryNode *create(ParseNodeKind kind, TreeContext *tc) {
|
||||
return (UnaryNode *)ParseNode::create(kind, PN_UNARY, tc);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void dump(int indent);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct BinaryNode : public ParseNode {
|
||||
@ -967,6 +979,10 @@ struct BinaryNode : public ParseNode {
|
||||
static inline BinaryNode *create(ParseNodeKind kind, TreeContext *tc) {
|
||||
return (BinaryNode *)ParseNode::create(kind, PN_BINARY, tc);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void dump(int indent);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct TernaryNode : public ParseNode {
|
||||
@ -983,24 +999,40 @@ struct TernaryNode : public ParseNode {
|
||||
static inline TernaryNode *create(ParseNodeKind kind, TreeContext *tc) {
|
||||
return (TernaryNode *)ParseNode::create(kind, PN_TERNARY, tc);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void dump(int indent);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ListNode : public ParseNode {
|
||||
static inline ListNode *create(ParseNodeKind kind, TreeContext *tc) {
|
||||
return (ListNode *)ParseNode::create(kind, PN_LIST, tc);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void dump(int indent);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct FunctionNode : public ParseNode {
|
||||
static inline FunctionNode *create(ParseNodeKind kind, TreeContext *tc) {
|
||||
return (FunctionNode *)ParseNode::create(kind, PN_FUNC, tc);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void dump(int indent);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct NameNode : public ParseNode {
|
||||
static NameNode *create(ParseNodeKind kind, JSAtom *atom, TreeContext *tc);
|
||||
|
||||
inline void initCommon(TreeContext *tc);
|
||||
|
||||
#ifdef DEBUG
|
||||
inline void dump(int indent);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct NameSetNode : public ParseNode {
|
||||
@ -1254,6 +1286,10 @@ class PropertyByValue : public ParseNode {
|
||||
ParseNode *
|
||||
CloneLeftHandSide(ParseNode *opn, TreeContext *tc);
|
||||
|
||||
#ifdef DEBUG
|
||||
void DumpParseTree(ParseNode *pn, int indent = 0);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* js::Definition is a degenerate subtype of the PN_FUNC and PN_NAME variants
|
||||
* of js::ParseNode, allocated only for function, var, const, and let
|
||||
|
@ -1331,6 +1331,7 @@ Parser::functionArguments(TreeContext &funtc, FunctionBox *funbox, ParseNode **l
|
||||
* until after all arguments have been parsed.
|
||||
*/
|
||||
if (funtc.decls.lookupFirst(name)) {
|
||||
funtc.bindings.noteDup();
|
||||
duplicatedArg = name;
|
||||
if (destructuringArg)
|
||||
goto report_dup_and_destructuring;
|
||||
|
5
js/src/jit-test/tests/basic/bug714614.js
Normal file
5
js/src/jit-test/tests/basic/bug714614.js
Normal file
@ -0,0 +1,5 @@
|
||||
function testForVarInWith(foo, foo) {
|
||||
return eval("with ({}) { for (var x = 0; x < 5; x++); } (function() { return delete x; })");
|
||||
}
|
||||
f = testForVarInWith()();
|
||||
|
@ -3107,47 +3107,29 @@ END_CASE(JSOP_ARGUMENTS)
|
||||
|
||||
BEGIN_CASE(JSOP_GETARG)
|
||||
BEGIN_CASE(JSOP_CALLARG)
|
||||
{
|
||||
uint32_t slot = GET_ARGNO(regs.pc);
|
||||
JS_ASSERT(slot < regs.fp()->numFormalArgs());
|
||||
PUSH_COPY(argv[slot]);
|
||||
}
|
||||
PUSH_COPY(regs.fp()->formalArg(GET_ARGNO(regs.pc)));
|
||||
END_CASE(JSOP_GETARG)
|
||||
|
||||
BEGIN_CASE(JSOP_SETARG)
|
||||
{
|
||||
uint32_t slot = GET_ARGNO(regs.pc);
|
||||
JS_ASSERT(slot < regs.fp()->numFormalArgs());
|
||||
argv[slot] = regs.sp[-1];
|
||||
}
|
||||
regs.fp()->formalArg(GET_ARGNO(regs.pc)) = regs.sp[-1];
|
||||
END_CASE(JSOP_SETARG)
|
||||
|
||||
BEGIN_CASE(JSOP_GETLOCAL)
|
||||
BEGIN_CASE(JSOP_CALLLOCAL)
|
||||
{
|
||||
PUSH_COPY_SKIP_CHECK(regs.fp()->localSlot(GET_SLOTNO(regs.pc)));
|
||||
|
||||
/*
|
||||
* Skip the same-compartment assertion if the local will be immediately
|
||||
* popped. We do not guarantee sync for dead locals when coming in from the
|
||||
* method JIT, and a GETLOCAL followed by POP is not considered to be
|
||||
* a use of the variable.
|
||||
*/
|
||||
uint32_t slot = GET_SLOTNO(regs.pc);
|
||||
JS_ASSERT(slot < script->nslots);
|
||||
PUSH_COPY_SKIP_CHECK(regs.fp()->slots()[slot]);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (regs.pc[JSOP_GETLOCAL_LENGTH] != JSOP_POP)
|
||||
assertSameCompartment(cx, regs.sp[-1]);
|
||||
#endif
|
||||
}
|
||||
END_CASE(JSOP_GETLOCAL)
|
||||
|
||||
BEGIN_CASE(JSOP_SETLOCAL)
|
||||
{
|
||||
uint32_t slot = GET_SLOTNO(regs.pc);
|
||||
JS_ASSERT(slot < script->nslots);
|
||||
regs.fp()->slots()[slot] = regs.sp[-1];
|
||||
}
|
||||
regs.fp()->localSlot(GET_SLOTNO(regs.pc)) = regs.sp[-1];
|
||||
END_CASE(JSOP_SETLOCAL)
|
||||
|
||||
BEGIN_CASE(JSOP_GETFCSLOT)
|
||||
@ -3380,8 +3362,7 @@ BEGIN_CASE(JSOP_DEFLOCALFUN)
|
||||
|
||||
JS_ASSERT_IF(script->hasGlobal(), obj->getProto() == fun->getProto());
|
||||
|
||||
uint32_t slot = GET_SLOTNO(regs.pc);
|
||||
regs.fp()->slots()[slot].setObject(*obj);
|
||||
regs.fp()->varSlot(GET_SLOTNO(regs.pc)) = ObjectValue(*obj);
|
||||
}
|
||||
END_CASE(JSOP_DEFLOCALFUN)
|
||||
|
||||
@ -3393,8 +3374,7 @@ BEGIN_CASE(JSOP_DEFLOCALFUN_FC)
|
||||
if (!obj)
|
||||
goto error;
|
||||
|
||||
uint32_t slot = GET_SLOTNO(regs.pc);
|
||||
regs.fp()->slots()[slot].setObject(*obj);
|
||||
regs.fp()->varSlot(GET_SLOTNO(regs.pc)) = ObjectValue(*obj);
|
||||
}
|
||||
END_CASE(JSOP_DEFLOCALFUN_FC)
|
||||
|
||||
@ -3819,16 +3799,12 @@ BEGIN_CASE(JSOP_THROW)
|
||||
goto error;
|
||||
}
|
||||
BEGIN_CASE(JSOP_SETLOCALPOP)
|
||||
{
|
||||
/*
|
||||
* The stack must have a block with at least one local slot below the
|
||||
* exception object.
|
||||
*/
|
||||
JS_ASSERT((size_t) (regs.sp - regs.fp()->base()) >= 2);
|
||||
uint32_t slot = GET_UINT16(regs.pc);
|
||||
JS_ASSERT(slot + 1 < script->nslots);
|
||||
POP_COPY_TO(regs.fp()->slots()[slot]);
|
||||
}
|
||||
POP_COPY_TO(regs.fp()->localSlot(GET_UINT16(regs.pc)));
|
||||
END_CASE(JSOP_SETLOCALPOP)
|
||||
|
||||
BEGIN_CASE(JSOP_INSTANCEOF)
|
||||
|
@ -1297,35 +1297,6 @@ ToUint32Slow(JSContext *cx, const Value &v, uint32_t *out)
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
uint32_t
|
||||
js_DoubleToECMAUint32(jsdouble d)
|
||||
{
|
||||
int32_t i;
|
||||
JSBool neg;
|
||||
jsdouble two32;
|
||||
|
||||
if (!JSDOUBLE_IS_FINITE(d))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* We check whether d fits int32, not uint32, as all but the ">>>" bit
|
||||
* manipulation bytecode stores the result as int, not uint. When the
|
||||
* result does not fit int Value, it will be stored as a negative double.
|
||||
*/
|
||||
i = (int32_t) d;
|
||||
if ((jsdouble) i == d)
|
||||
return (int32_t)i;
|
||||
|
||||
neg = (d < 0);
|
||||
d = floor(neg ? -d : d);
|
||||
d = neg ? -d : d;
|
||||
|
||||
two32 = 4294967296.0;
|
||||
d = fmod(d, two32);
|
||||
|
||||
return (uint32_t) (d >= 0 ? d : d + two32);
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
bool
|
||||
|
@ -556,8 +556,11 @@ js_DoubleToECMAInt32(jsdouble d)
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t
|
||||
js_DoubleToECMAUint32(jsdouble d);
|
||||
inline uint32_t
|
||||
js_DoubleToECMAUint32(jsdouble d)
|
||||
{
|
||||
return uint32_t(js_DoubleToECMAInt32(d));
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a jsdouble to an integral number, stored in a jsdouble.
|
||||
|
@ -466,7 +466,6 @@ struct Shape : public js::gc::Cell
|
||||
friend class js::Bindings;
|
||||
friend struct js::StackShape;
|
||||
friend struct js::StackBaseShape;
|
||||
friend bool IsShapeAboutToBeFinalized(JSContext *cx, const js::Shape *shape);
|
||||
|
||||
protected:
|
||||
HeapPtrBaseShape base_;
|
||||
|
@ -184,6 +184,47 @@ Bindings::add(JSContext *cx, JSAtom *name, BindingKind kind)
|
||||
return true;
|
||||
}
|
||||
|
||||
Shape *
|
||||
Bindings::callObjectShape(JSContext *cx) const
|
||||
{
|
||||
if (!hasDup())
|
||||
return lastShape();
|
||||
|
||||
/*
|
||||
* Build a vector of non-duplicate properties in order from last added
|
||||
* to first (i.e., the order we normally have iterate over Shapes). Choose
|
||||
* the last added property in each set of dups.
|
||||
*/
|
||||
Vector<const Shape *> shapes(cx);
|
||||
HashSet<jsid> seen(cx);
|
||||
if (!seen.init())
|
||||
return false;
|
||||
|
||||
for (Shape::Range r = lastShape()->all(); !r.empty(); r.popFront()) {
|
||||
const Shape &s = r.front();
|
||||
HashSet<jsid>::AddPtr p = seen.lookupForAdd(s.propid());
|
||||
if (!p) {
|
||||
if (!seen.add(p, s.propid()))
|
||||
return NULL;
|
||||
if (!shapes.append(&s))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now build the Shape without duplicate properties.
|
||||
*/
|
||||
RootedVarShape shape(cx);
|
||||
shape = initialShape(cx);
|
||||
for (int i = shapes.length() - 1; i >= 0; --i) {
|
||||
shape = shape->getChildBinding(cx, shapes[i]);
|
||||
if (!shape)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
bool
|
||||
Bindings::getLocalNameArray(JSContext *cx, Vector<JSAtom *> *namesp)
|
||||
{
|
||||
|
@ -176,7 +176,9 @@ class Bindings {
|
||||
uint16_t nargs;
|
||||
uint16_t nvars;
|
||||
uint16_t nupvars;
|
||||
bool hasDup_:1; // true if there are duplicate argument names
|
||||
|
||||
inline Shape *initialShape(JSContext *cx) const;
|
||||
public:
|
||||
inline Bindings(JSContext *cx);
|
||||
|
||||
@ -208,9 +210,15 @@ class Bindings {
|
||||
/* Ensure these bindings have a shape lineage. */
|
||||
inline bool ensureShape(JSContext *cx);
|
||||
|
||||
/* Returns the shape lineage generated for these bindings. */
|
||||
/* Return the shape lineage generated for these bindings. */
|
||||
inline Shape *lastShape() const;
|
||||
|
||||
/*
|
||||
* Return the shape to use to create a call object for these bindings.
|
||||
* The result is guaranteed not to have duplicate property names.
|
||||
*/
|
||||
Shape *callObjectShape(JSContext *cx) const;
|
||||
|
||||
/* See Scope::extensibleParents */
|
||||
inline bool extensibleParents();
|
||||
bool setExtensibleParents(JSContext *cx);
|
||||
@ -263,6 +271,9 @@ class Bindings {
|
||||
return add(cx, NULL, ARGUMENT);
|
||||
}
|
||||
|
||||
void noteDup() { hasDup_ = true; }
|
||||
bool hasDup() const { return hasDup_; }
|
||||
|
||||
/*
|
||||
* Look up an argument or variable name, returning its kind when found or
|
||||
* NONE when no such name exists. When indexp is not null and the name
|
||||
|
@ -58,7 +58,7 @@ namespace js {
|
||||
|
||||
inline
|
||||
Bindings::Bindings(JSContext *cx)
|
||||
: lastBinding(NULL), nargs(0), nvars(0), nupvars(0)
|
||||
: lastBinding(NULL), nargs(0), nvars(0), nupvars(0), hasDup_(false)
|
||||
{}
|
||||
|
||||
inline void
|
||||
@ -90,16 +90,22 @@ Bindings::lastShape() const
|
||||
return lastBinding;
|
||||
}
|
||||
|
||||
Shape *
|
||||
Bindings::initialShape(JSContext *cx) const
|
||||
{
|
||||
/* Get an allocation kind to match an empty call object. */
|
||||
gc::AllocKind kind = gc::FINALIZE_OBJECT4;
|
||||
JS_ASSERT(gc::GetGCKindSlots(kind) == CallObject::RESERVED_SLOTS + 1);
|
||||
|
||||
return EmptyShape::getInitialShape(cx, &CallClass, NULL, NULL, kind,
|
||||
BaseShape::VAROBJ);
|
||||
}
|
||||
|
||||
bool
|
||||
Bindings::ensureShape(JSContext *cx)
|
||||
{
|
||||
if (!lastBinding) {
|
||||
/* Get an allocation kind to match an empty call object. */
|
||||
gc::AllocKind kind = gc::FINALIZE_OBJECT4;
|
||||
JS_ASSERT(gc::GetGCKindSlots(kind) == CallObject::RESERVED_SLOTS + 1);
|
||||
|
||||
lastBinding = EmptyShape::getInitialShape(cx, &CallClass, NULL, NULL, kind,
|
||||
BaseShape::VAROBJ);
|
||||
lastBinding = initialShape(cx);
|
||||
if (!lastBinding)
|
||||
return false;
|
||||
}
|
||||
|
@ -249,8 +249,7 @@ stubs::FixupArity(VMFrame &f, uint32_t nactual)
|
||||
/*
|
||||
* Grossssss! *move* the stack frame. If this ends up being perf-critical,
|
||||
* we can figure out how to spot-optimize it. Be careful to touch only the
|
||||
* members that have been initialized by initJitFrameCallerHalf and the
|
||||
* early prologue.
|
||||
* members that have been initialized by the caller and early prologue.
|
||||
*/
|
||||
InitialFrameFlags initial = oldfp->initialFlags();
|
||||
JSFunction *fun = oldfp->fun();
|
||||
|
@ -3704,8 +3704,12 @@ Parse(JSContext *cx, uintN argc, jsval *vp)
|
||||
js::Parser parser(cx);
|
||||
parser.init(JS_GetStringCharsZ(cx, scriptContents), JS_GetStringLength(scriptContents),
|
||||
"<string>", 0, cx->findVersion());
|
||||
if (!parser.parse(NULL))
|
||||
ParseNode *pn = parser.parse(NULL);
|
||||
if (!pn)
|
||||
return JS_FALSE;
|
||||
#ifdef DEBUG
|
||||
DumpParseTree(pn);
|
||||
#endif
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ script regress-68498-004.js
|
||||
script regress-69607.js
|
||||
script regress-71107.js
|
||||
script regress-76054.js
|
||||
script regress-80981.js
|
||||
slow script regress-80981.js
|
||||
script regress-82306.js
|
||||
script regress-89443.js
|
||||
script regress-89474.js
|
||||
|
@ -109,6 +109,79 @@ ArgumentsObject::setElement(uint32_t i, const js::Value &v)
|
||||
data()->slots[i] = v;
|
||||
}
|
||||
|
||||
inline bool
|
||||
ArgumentsObject::getElement(uint32_t i, Value *vp)
|
||||
{
|
||||
if (i >= initialLength())
|
||||
return false;
|
||||
|
||||
*vp = element(i);
|
||||
|
||||
/*
|
||||
* If the argument was overwritten, it could be in any object slot, so we
|
||||
* can't optimize.
|
||||
*/
|
||||
if (vp->isMagic(JS_ARGS_HOLE))
|
||||
return false;
|
||||
|
||||
/*
|
||||
* If this arguments object has an associated stack frame, that contains
|
||||
* the canonical argument value. Note that strict arguments objects do not
|
||||
* alias named arguments and never have a stack frame.
|
||||
*/
|
||||
StackFrame *fp = maybeStackFrame();
|
||||
JS_ASSERT_IF(isStrictArguments(), !fp);
|
||||
if (fp)
|
||||
*vp = fp->canonicalActualArg(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct STATIC_SKIP_INFERENCE CopyNonHoleArgsTo
|
||||
{
|
||||
CopyNonHoleArgsTo(ArgumentsObject *argsobj, Value *dst) : argsobj(*argsobj), dst(dst) {}
|
||||
ArgumentsObject &argsobj;
|
||||
Value *dst;
|
||||
bool operator()(uint32_t argi, Value *src) {
|
||||
if (argsobj.element(argi).isMagic(JS_ARGS_HOLE))
|
||||
return false;
|
||||
*dst++ = *src;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace detail */
|
||||
|
||||
inline bool
|
||||
ArgumentsObject::getElements(uint32_t start, uint32_t count, Value *vp)
|
||||
{
|
||||
JS_ASSERT(start + count >= start);
|
||||
|
||||
uint32_t length = initialLength();
|
||||
if (start > length || start + count > length)
|
||||
return false;
|
||||
|
||||
StackFrame *fp = maybeStackFrame();
|
||||
|
||||
/* If there's no stack frame for this, argument values are in elements(). */
|
||||
if (!fp) {
|
||||
const Value *srcbeg = elements() + start;
|
||||
const Value *srcend = srcbeg + count;
|
||||
const Value *src = srcbeg;
|
||||
for (Value *dst = vp; src < srcend; ++dst, ++src) {
|
||||
if (src->isMagic(JS_ARGS_HOLE))
|
||||
return false;
|
||||
*dst = *src;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Otherwise, element values are on the stack. */
|
||||
JS_ASSERT(fp->numActualArgs() <= StackSpace::ARGS_LENGTH_MAX);
|
||||
return fp->forEachCanonicalActualArg(detail::CopyNonHoleArgsTo(this, vp), start, count);
|
||||
}
|
||||
|
||||
inline js::StackFrame *
|
||||
ArgumentsObject::maybeStackFrame() const
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
/* -*- Mode: C++; tab-width: 6; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sw=4 et tw=78:
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
@ -65,8 +65,12 @@ using namespace js::types;
|
||||
CallObject *
|
||||
CallObject::create(JSContext *cx, JSScript *script, JSObject &enclosing, JSObject *callee)
|
||||
{
|
||||
Bindings &bindings = script->bindings;
|
||||
gc::AllocKind kind = gc::GetGCObjectKind(bindings.lastShape()->numFixedSlots() + 1);
|
||||
RootedVarShape shape(cx);
|
||||
shape = script->bindings.callObjectShape(cx);
|
||||
if (shape == NULL)
|
||||
return NULL;
|
||||
|
||||
gc::AllocKind kind = gc::GetGCObjectKind(shape->numFixedSlots() + 1);
|
||||
|
||||
RootedVarTypeObject type(cx);
|
||||
|
||||
@ -75,12 +79,9 @@ CallObject::create(JSContext *cx, JSScript *script, JSObject &enclosing, JSObjec
|
||||
return NULL;
|
||||
|
||||
HeapValue *slots;
|
||||
if (!PreallocateObjectDynamicSlots(cx, bindings.lastShape(), &slots))
|
||||
if (!PreallocateObjectDynamicSlots(cx, shape, &slots))
|
||||
return NULL;
|
||||
|
||||
RootedVarShape shape(cx);
|
||||
shape = bindings.lastShape();
|
||||
|
||||
JSObject *obj = JSObject::create(cx, kind, shape, type, slots);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
|
@ -170,39 +170,12 @@ StackFrame::initCallFrame(JSContext *cx, JSFunction &callee,
|
||||
SetValueRangeToUndefined(slots(), script->nfixed);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reinitialize the StackFrame fields that have been initialized up to the
|
||||
* point of FixupArity in the function prologue.
|
||||
*/
|
||||
inline void
|
||||
StackFrame::resetCallFrame(JSScript *script)
|
||||
{
|
||||
JS_ASSERT(script == this->script());
|
||||
|
||||
if (flags_ & UNDERFLOW_ARGS)
|
||||
SetValueRangeToUndefined(formalArgs() + numActualArgs(), formalArgsEnd());
|
||||
|
||||
JS_ASSERT(!(flags_ & ~(FUNCTION |
|
||||
OVERFLOW_ARGS |
|
||||
UNDERFLOW_ARGS |
|
||||
OVERRIDE_ARGS |
|
||||
HAS_PREVPC |
|
||||
HAS_RVAL |
|
||||
HAS_SCOPECHAIN |
|
||||
HAS_ANNOTATION |
|
||||
HAS_HOOK_DATA |
|
||||
FINISHED_IN_INTERP |
|
||||
DOWN_FRAMES_EXPANDED)));
|
||||
|
||||
flags_ &= FUNCTION |
|
||||
OVERFLOW_ARGS |
|
||||
HAS_PREVPC |
|
||||
UNDERFLOW_ARGS;
|
||||
|
||||
JS_ASSERT(exec.fun->script() == callee().toFunction()->script());
|
||||
scopeChain_ = callee().toFunction()->environment();
|
||||
|
||||
SetValueRangeToUndefined(slots(), script->nfixed);
|
||||
}
|
||||
|
||||
inline void
|
||||
StackFrame::initJitFrameCallerHalf(StackFrame *prev, StackFrame::Flags flags, void *ncode)
|
||||
StackFrame::initFixupFrame(StackFrame *prev, StackFrame::Flags flags, void *ncode, uintN nactual)
|
||||
{
|
||||
JS_ASSERT((flags & ~(CONSTRUCTING |
|
||||
LOWERED_CALL_APPLY |
|
||||
@ -213,38 +186,9 @@ StackFrame::initJitFrameCallerHalf(StackFrame *prev, StackFrame::Flags flags, vo
|
||||
flags_ = FUNCTION | flags;
|
||||
prev_ = prev;
|
||||
ncode_ = ncode;
|
||||
}
|
||||
|
||||
/*
|
||||
* The "early prologue" refers to either the fast path or arity check path up
|
||||
* to the "late prologue".
|
||||
*/
|
||||
inline void
|
||||
StackFrame::initJitFrameEarlyPrologue(JSFunction *fun, uint32_t nactual)
|
||||
{
|
||||
exec.fun = fun;
|
||||
u.nactual = nactual;
|
||||
}
|
||||
|
||||
/*
|
||||
* The "late prologue" (in generatePrologue) extends from the join point of the
|
||||
* fast path and arity check to where the call object is (possibly) created.
|
||||
*/
|
||||
inline bool
|
||||
StackFrame::initJitFrameLatePrologue(JSContext *cx, Value **limit)
|
||||
{
|
||||
*limit = cx->stack.space().getStackLimit(cx, DONT_REPORT_ERROR);
|
||||
if (!*limit) {
|
||||
cx->stack.popFrameAfterOverflow();
|
||||
js_ReportOverRecursed(cx);
|
||||
return false;
|
||||
}
|
||||
|
||||
scopeChain();
|
||||
SetValueRangeToUndefined(slots(), script()->nfixed);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void
|
||||
StackFrame::overwriteCallee(JSObject &newCallee)
|
||||
{
|
||||
@ -519,7 +463,7 @@ StackSpace::getStackLimit(JSContext *cx, MaybeReportError report)
|
||||
|
||||
JS_ALWAYS_INLINE StackFrame *
|
||||
ContextStack::getCallFrame(JSContext *cx, MaybeReportError report, const CallArgs &args,
|
||||
JSFunction *fun, JSScript *script, /*StackFrame::Flags*/ uint32_t *flags) const
|
||||
JSFunction *fun, JSScript *script, StackFrame::Flags *flags) const
|
||||
{
|
||||
JS_ASSERT(fun->script() == script);
|
||||
uintN nformal = fun->nargs;
|
||||
@ -567,13 +511,13 @@ ContextStack::pushInlineFrame(JSContext *cx, FrameRegs ®s, const CallArgs &ar
|
||||
/* Cannot assert callee == args.callee() since this is called from LeaveTree. */
|
||||
JS_ASSERT(script == callee.script());
|
||||
|
||||
/*StackFrame::Flags*/ uint32_t flags = ToFrameFlags(initial);
|
||||
StackFrame::Flags flags = ToFrameFlags(initial);
|
||||
StackFrame *fp = getCallFrame(cx, REPORT_ERROR, args, &callee, script, &flags);
|
||||
if (!fp)
|
||||
return false;
|
||||
|
||||
/* Initialize frame, locals, regs. */
|
||||
fp->initCallFrame(cx, callee, script, args.length(), (StackFrame::Flags) flags);
|
||||
fp->initCallFrame(cx, callee, script, args.length(), flags);
|
||||
|
||||
/*
|
||||
* N.B. regs may differ from the active registers, if the parent is about
|
||||
@ -603,14 +547,13 @@ ContextStack::getFixupFrame(JSContext *cx, MaybeReportError report,
|
||||
JS_ASSERT(fun->script() == args.callee().toFunction()->script());
|
||||
JS_ASSERT(fun->script() == script);
|
||||
|
||||
/*StackFrame::Flags*/ uint32_t flags = ToFrameFlags(initial);
|
||||
StackFrame::Flags flags = ToFrameFlags(initial);
|
||||
StackFrame *fp = getCallFrame(cx, report, args, fun, script, &flags);
|
||||
if (!fp)
|
||||
return NULL;
|
||||
|
||||
/* Do not init late prologue or regs; this is done by jit code. */
|
||||
fp->initJitFrameCallerHalf(cx->fp(), (StackFrame::Flags) flags, ncode);
|
||||
fp->initJitFrameEarlyPrologue(fun, args.length());
|
||||
fp->initFixupFrame(cx->fp(), flags, ncode, args.length());
|
||||
|
||||
*stackLimit = space().conservativeEnd_;
|
||||
return fp;
|
||||
@ -684,80 +627,5 @@ ContextStack::currentScriptedScopeChain() const
|
||||
return &fp()->scopeChain();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct STATIC_SKIP_INFERENCE CopyNonHoleArgsTo
|
||||
{
|
||||
CopyNonHoleArgsTo(ArgumentsObject *argsobj, Value *dst) : argsobj(*argsobj), dst(dst) {}
|
||||
ArgumentsObject &argsobj;
|
||||
Value *dst;
|
||||
bool operator()(uint32_t argi, Value *src) {
|
||||
if (argsobj.element(argi).isMagic(JS_ARGS_HOLE))
|
||||
return false;
|
||||
*dst++ = *src;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace detail */
|
||||
|
||||
inline bool
|
||||
ArgumentsObject::getElement(uint32_t i, Value *vp)
|
||||
{
|
||||
if (i >= initialLength())
|
||||
return false;
|
||||
|
||||
*vp = element(i);
|
||||
|
||||
/*
|
||||
* If the argument was overwritten, it could be in any object slot, so we
|
||||
* can't optimize.
|
||||
*/
|
||||
if (vp->isMagic(JS_ARGS_HOLE))
|
||||
return false;
|
||||
|
||||
/*
|
||||
* If this arguments object has an associated stack frame, that contains
|
||||
* the canonical argument value. Note that strict arguments objects do not
|
||||
* alias named arguments and never have a stack frame.
|
||||
*/
|
||||
StackFrame *fp = maybeStackFrame();
|
||||
JS_ASSERT_IF(isStrictArguments(), !fp);
|
||||
if (fp)
|
||||
*vp = fp->canonicalActualArg(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool
|
||||
ArgumentsObject::getElements(uint32_t start, uint32_t count, Value *vp)
|
||||
{
|
||||
JS_ASSERT(start + count >= start);
|
||||
|
||||
uint32_t length = initialLength();
|
||||
if (start > length || start + count > length)
|
||||
return false;
|
||||
|
||||
StackFrame *fp = maybeStackFrame();
|
||||
|
||||
/* If there's no stack frame for this, argument values are in elements(). */
|
||||
if (!fp) {
|
||||
const Value *srcbeg = elements() + start;
|
||||
const Value *srcend = srcbeg + count;
|
||||
const Value *src = srcbeg;
|
||||
for (Value *dst = vp; src < srcend; ++dst, ++src) {
|
||||
if (src->isMagic(JS_ARGS_HOLE))
|
||||
return false;
|
||||
*dst = *src;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Otherwise, element values are on the stack. */
|
||||
JS_ASSERT(fp->numActualArgs() <= StackSpace::ARGS_LENGTH_MAX);
|
||||
return fp->forEachCanonicalActualArg(detail::CopyNonHoleArgsTo(this, vp), start, count);
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
#endif /* Stack_inl_h__ */
|
||||
|
@ -640,12 +640,12 @@ ContextStack::pushInvokeFrame(JSContext *cx, const CallArgs &args,
|
||||
JSFunction *fun = callee.toFunction();
|
||||
JSScript *script = fun->script();
|
||||
|
||||
/*StackFrame::Flags*/ uint32_t flags = ToFrameFlags(initial);
|
||||
StackFrame::Flags flags = ToFrameFlags(initial);
|
||||
StackFrame *fp = getCallFrame(cx, REPORT_ERROR, args, fun, script, &flags);
|
||||
if (!fp)
|
||||
return false;
|
||||
|
||||
fp->initCallFrame(cx, *fun, script, args.length(), (StackFrame::Flags) flags);
|
||||
fp->initCallFrame(cx, *fun, script, args.length(), flags);
|
||||
ifg->regs_.prepareToRun(*fp, script);
|
||||
|
||||
ifg->prevRegs_ = seg_->pushRegs(ifg->regs_);
|
||||
|
@ -422,13 +422,8 @@ class StackFrame
|
||||
void initCallFrame(JSContext *cx, JSFunction &callee,
|
||||
JSScript *script, uint32_t nactual, StackFrame::Flags flags);
|
||||
|
||||
/* Used for SessionInvoke. */
|
||||
void resetCallFrame(JSScript *script);
|
||||
|
||||
/* Called by jit stubs and serve as a specification for jit-code. */
|
||||
void initJitFrameCallerHalf(StackFrame *prev, StackFrame::Flags flags, void *ncode);
|
||||
void initJitFrameEarlyPrologue(JSFunction *fun, uint32_t nactual);
|
||||
bool initJitFrameLatePrologue(JSContext *cx, Value **limit);
|
||||
/* Used for getFixupFrame (for FixupArity). */
|
||||
void initFixupFrame(StackFrame *prev, StackFrame::Flags flags, void *ncode, uintN nactual);
|
||||
|
||||
/* Used for eval. */
|
||||
void initExecuteFrame(JSScript *script, StackFrame *prev, FrameRegs *regs,
|
||||
@ -546,6 +541,12 @@ class StackFrame
|
||||
return slots()[i];
|
||||
}
|
||||
|
||||
Value &localSlot(uintN i) {
|
||||
/* Let variables can be above script->nfixed. */
|
||||
JS_ASSERT(i < script()->nslots);
|
||||
return slots()[i];
|
||||
}
|
||||
|
||||
/*
|
||||
* Script
|
||||
*
|
||||
@ -1572,7 +1573,7 @@ class ContextStack
|
||||
|
||||
inline StackFrame *
|
||||
getCallFrame(JSContext *cx, MaybeReportError report, const CallArgs &args,
|
||||
JSFunction *fun, JSScript *script, /*StackFrame::Flags*/ uint32_t *pflags) const;
|
||||
JSFunction *fun, JSScript *script, StackFrame::Flags *pflags) const;
|
||||
|
||||
/* Make pop* functions private since only called by guard classes. */
|
||||
void popSegment();
|
||||
@ -1685,10 +1686,7 @@ class ContextStack
|
||||
/*
|
||||
* Called by the methodjit for an arity mismatch. Arity mismatch can be
|
||||
* hot, so getFixupFrame avoids doing call setup performed by jit code when
|
||||
* FixupArity returns. In terms of work done:
|
||||
*
|
||||
* getFixupFrame = pushInlineFrame -
|
||||
* (fp->initJitFrameLatePrologue + regs->prepareToRun)
|
||||
* FixupArity returns.
|
||||
*/
|
||||
StackFrame *getFixupFrame(JSContext *cx, MaybeReportError report,
|
||||
const CallArgs &args, JSFunction *fun, JSScript *script,
|
||||
|
@ -71,6 +71,7 @@
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsEventStates.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
@ -143,8 +144,8 @@ typedef struct CapturingContentInfo {
|
||||
} CapturingContentInfo;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x87acd089, 0x8da7, 0x4438, \
|
||||
{ 0xa5, 0xcd, 0x90, 0x1e, 0x5d, 0x8f, 0xd8, 0x19 } }
|
||||
{ 0x87719fd6, 0xe50c, 0x4d72, \
|
||||
{ 0xbd, 0x55, 0x05, 0xf9, 0x5f, 0x33, 0x9e, 0xf2 } }
|
||||
|
||||
// Constants for ScrollContentIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
@ -782,6 +783,13 @@ public:
|
||||
*/
|
||||
virtual nsresult ReconstructFrames() = 0;
|
||||
|
||||
/**
|
||||
* Notify that a content node's state has changed
|
||||
*/
|
||||
virtual void ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
nsEventStates aStateMask) = 0;
|
||||
|
||||
/**
|
||||
* Given aFrame, the root frame of a stacking context, find its descendant
|
||||
* frame under the point aPt that receives a mouse event at that location,
|
||||
|
@ -43,10 +43,8 @@ function openFullscreenWindow() {
|
||||
|
||||
function childFocused() {
|
||||
ok(win.fullScreen, "window should be fullscreen");
|
||||
// bug 670026
|
||||
((navigator.platform.indexOf("Mac") < 0) ? is : todo_is)
|
||||
(win.windowState, win.STATE_FULLSCREEN,
|
||||
"window state should be fullscreen");
|
||||
is(win.windowState, win.STATE_FULLSCREEN,
|
||||
"window state should be fullscreen");
|
||||
|
||||
// The select doesn't open if the mouse click is fired too soon
|
||||
// (on X11 at least).
|
||||
@ -97,10 +95,8 @@ function finish() {
|
||||
synthesizeMouseAtCenter(select, {}, win);
|
||||
}
|
||||
|
||||
// bug 670026
|
||||
((navigator.platform.indexOf("Mac") < 0) ? is : todo_is)
|
||||
(win.windowState, win.STATE_FULLSCREEN,
|
||||
"window state should still be fullscreen");
|
||||
is(win.windowState, win.STATE_FULLSCREEN,
|
||||
"window state should still be fullscreen");
|
||||
|
||||
win.close();
|
||||
SimpleTest.finish();
|
||||
|
@ -1498,7 +1498,7 @@ nsObjectFrame::GetPaintedRect(nsDisplayPlugin* aItem)
|
||||
}
|
||||
|
||||
void
|
||||
nsObjectFrame::UpdateImageLayer(ImageContainer* aContainer, const gfxRect& aRect)
|
||||
nsObjectFrame::UpdateImageLayer(const gfxRect& aRect)
|
||||
{
|
||||
if (!mInstanceOwner) {
|
||||
return;
|
||||
@ -1507,10 +1507,13 @@ nsObjectFrame::UpdateImageLayer(ImageContainer* aContainer, const gfxRect& aRect
|
||||
#ifdef XP_MACOSX
|
||||
if (!mInstanceOwner->UseAsyncRendering()) {
|
||||
mInstanceOwner->DoCocoaEventDrawRect(aRect, nsnull);
|
||||
// This makes sure the image on the container is up to date.
|
||||
// XXX - Eventually we probably just want to make sure DoCocoaEventDrawRect
|
||||
// updates the image container, to make this truly use 'push' semantics
|
||||
// too.
|
||||
mInstanceOwner->GetImageContainer();
|
||||
}
|
||||
#endif
|
||||
|
||||
mInstanceOwner->SetCurrentImage(aContainer);
|
||||
}
|
||||
|
||||
LayerState
|
||||
@ -1552,16 +1555,11 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
return nsnull;
|
||||
|
||||
// Create image
|
||||
nsRefPtr<ImageContainer> container = GetImageContainer();
|
||||
nsRefPtr<ImageContainer> container = mInstanceOwner->GetImageContainer();
|
||||
|
||||
{
|
||||
nsRefPtr<Image> current = container->GetCurrentImage();
|
||||
if (!current) {
|
||||
// Only set the current image if there isn't already one. If there is
|
||||
// already one, InvalidateRect() will be keeping it up to date.
|
||||
if (!mInstanceOwner->SetCurrentImage(container))
|
||||
return nsnull;
|
||||
}
|
||||
if (!container) {
|
||||
// This can occur if our instance is gone.
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
gfxIntSize size = container->GetCurrentSize();
|
||||
@ -1585,7 +1583,7 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
NS_ASSERTION(layer->GetType() == Layer::TYPE_IMAGE, "Bad layer type");
|
||||
|
||||
ImageLayer* imglayer = static_cast<ImageLayer*>(layer.get());
|
||||
UpdateImageLayer(container, r);
|
||||
UpdateImageLayer(r);
|
||||
|
||||
imglayer->SetContainer(container);
|
||||
gfxPattern::GraphicsFilter filter =
|
||||
|
@ -158,7 +158,7 @@ public:
|
||||
virtual bool ReflowFinished();
|
||||
virtual void ReflowCallbackCanceled();
|
||||
|
||||
void UpdateImageLayer(ImageContainer* aContainer, const gfxRect& aRect);
|
||||
void UpdateImageLayer(const gfxRect& aRect);
|
||||
|
||||
/**
|
||||
* Builds either an ImageLayer or a ReadbackLayer, depending on the type
|
||||
|
@ -49,7 +49,7 @@ interface nsIDOMNodeList;
|
||||
interface nsIDOMFontFaceList;
|
||||
interface nsIDOMRange;
|
||||
|
||||
[scriptable, uuid(0D9E5532-F5D5-44DD-94CA-D9EED5778B1C)]
|
||||
[scriptable, uuid(983475e4-6bdf-4741-a733-76e9a8d119b9)]
|
||||
interface inIDOMUtils : nsISupports
|
||||
{
|
||||
// CSS utilities
|
||||
@ -77,4 +77,12 @@ interface inIDOMUtils : nsISupports
|
||||
void setContentState(in nsIDOMElement aElement, in unsigned long long aState);
|
||||
|
||||
nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange);
|
||||
|
||||
// pseudo-class style locking methods. aPseudoClass must be a valid pseudo-class
|
||||
// selector string, e.g. ":hover". ":-moz-any-link" and non-event-state
|
||||
// pseudo-classes are ignored.
|
||||
void addPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
|
||||
void removePseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
|
||||
bool hasPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
|
||||
void clearPseudoClassLocks(in nsIDOMElement aElement);
|
||||
};
|
||||
|
@ -357,3 +357,103 @@ inDOMUtils::GetUsedFontFaces(nsIDOMRange* aRange,
|
||||
{
|
||||
return static_cast<nsRange*>(aRange)->GetUsedFontFaces(aFontFaceList);
|
||||
}
|
||||
|
||||
static nsEventStates
|
||||
GetStatesForPseudoClass(const nsAString& aStatePseudo)
|
||||
{
|
||||
// An array of the states that are relevant for various pseudoclasses.
|
||||
// XXXbz this duplicates code in nsCSSRuleProcessor
|
||||
static const nsEventStates sPseudoClassStates[] = {
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
||||
nsEventStates(),
|
||||
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _states) \
|
||||
_states,
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_STATE_PSEUDO_CLASS
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
|
||||
// Add more entries for our fake values to make sure we can't
|
||||
// index out of bounds into this array no matter what.
|
||||
nsEventStates(),
|
||||
nsEventStates()
|
||||
};
|
||||
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassStates) ==
|
||||
nsCSSPseudoClasses::ePseudoClass_NotPseudoClass + 1);
|
||||
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(aStatePseudo);
|
||||
|
||||
// Ignore :moz-any-link so we don't give the element simultaneous
|
||||
// visited and unvisited style state
|
||||
if (nsCSSPseudoClasses::GetPseudoType(atom) ==
|
||||
nsCSSPseudoClasses::ePseudoClass_mozAnyLink) {
|
||||
return nsEventStates();
|
||||
}
|
||||
// Our array above is long enough that indexing into it with
|
||||
// NotPseudoClass is ok.
|
||||
return sPseudoClassStates[nsCSSPseudoClasses::GetPseudoType(atom)];
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::AddPseudoClassLock(nsIDOMElement *aElement,
|
||||
const nsAString &aPseudoClass)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
nsEventStates state = GetStatesForPseudoClass(aPseudoClass);
|
||||
if (state.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aElement);
|
||||
element->LockStyleStates(state);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::RemovePseudoClassLock(nsIDOMElement *aElement,
|
||||
const nsAString &aPseudoClass)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
nsEventStates state = GetStatesForPseudoClass(aPseudoClass);
|
||||
if (state.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aElement);
|
||||
element->UnlockStyleStates(state);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::HasPseudoClassLock(nsIDOMElement *aElement,
|
||||
const nsAString &aPseudoClass,
|
||||
bool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
nsEventStates state = GetStatesForPseudoClass(aPseudoClass);
|
||||
if (state.IsEmpty()) {
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aElement);
|
||||
nsEventStates locks = element->LockedStyleStates();
|
||||
|
||||
*_retval = locks.HasAllStates(state);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::ClearPseudoClassLocks(nsIDOMElement *aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aElement);
|
||||
element->ClearStyleStateLocks();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ _CHROME_FILES =\
|
||||
test_bug695639.xul \
|
||||
test_bug695639.css \
|
||||
GentiumPlus-R.woff \
|
||||
test_bug708874.xul \
|
||||
test_bug708874.css \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_CHROME_FILES)
|
||||
|
33
layout/inspector/tests/chrome/test_bug708874.css
Normal file
33
layout/inspector/tests/chrome/test_bug708874.css
Normal file
@ -0,0 +1,33 @@
|
||||
#test-div {
|
||||
color: rgb(0, 0, 0);
|
||||
font-family: serif;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
#test-div:hover {
|
||||
color: rgb(10, 0, 0);
|
||||
}
|
||||
|
||||
#test-div:active {
|
||||
font-family: Arial;
|
||||
}
|
||||
|
||||
#test-div:focus {
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
#test-button {
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
|
||||
#test-button:disabled {
|
||||
color: rgb(40, 0, 0);
|
||||
}
|
||||
|
||||
#test-link:visited {
|
||||
color: rgb(20, 0, 0);
|
||||
}
|
||||
|
||||
#test-link:link {
|
||||
color: rgb(30, 0, 0);
|
||||
}
|
284
layout/inspector/tests/chrome/test_bug708874.xul
Normal file
284
layout/inspector/tests/chrome/test_bug708874.xul
Normal file
@ -0,0 +1,284 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<?xml-stylesheet type="text/css" href="test_bug708874.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=708874
|
||||
-->
|
||||
<window title="Mozilla Bug 708874"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="RunTests();">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 708874 - API for locking pseudo-class state of an element **/
|
||||
|
||||
var DOMUtils = Components.classes["@mozilla.org/inspector/dom-utils;1"]
|
||||
.getService(Components.interfaces.inIDOMUtils);
|
||||
var DOMWindowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
|
||||
var defaultColor = "rgb(0, 0, 0)";
|
||||
var disabledColor = "rgb(40, 0, 0)";
|
||||
|
||||
function RunTests() {
|
||||
testLockEnabled();
|
||||
testLockDisabled();
|
||||
testVisited();
|
||||
testMultiple();
|
||||
testInvalid();
|
||||
}
|
||||
|
||||
function testLockEnabled() {
|
||||
var button = document.getElementById("test-button");
|
||||
|
||||
/* starting state is enabled */
|
||||
button.removeAttribute("disabled");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(button, ":disabled"), false,
|
||||
"doesn't have lock at start");
|
||||
|
||||
is(window.getComputedStyle(button).color, defaultColor,
|
||||
"color is default color before locking on");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), false,
|
||||
"doesn't match selector at start");
|
||||
|
||||
/* lock */
|
||||
DOMUtils.addPseudoClassLock(button, ":disabled");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(button, ":disabled"), true,
|
||||
"hasPseudoClassLock is true after locking");
|
||||
|
||||
is(window.getComputedStyle(button).color, disabledColor,
|
||||
":disabled style applied after adding lock");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), true,
|
||||
"matches selector after adding lock");
|
||||
|
||||
/* change state to disabled */
|
||||
button.setAttribute("disabled", "disabled");
|
||||
|
||||
is(window.getComputedStyle(button).color, disabledColor,
|
||||
":disabled style still applied after really disabling");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), true,
|
||||
"matches selector after adding lock");
|
||||
|
||||
/* remove lock */
|
||||
DOMUtils.removePseudoClassLock(button, ":disabled");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(button, ":disabled"), false,
|
||||
"hasPseudoClassLock is false after removing on lock");
|
||||
|
||||
is(window.getComputedStyle(button).color, disabledColor,
|
||||
":disabled style still applied after removing lock");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), true,
|
||||
"matches selector after removing lock");
|
||||
|
||||
/* change state to enabled */
|
||||
button.removeAttribute("disabled");
|
||||
|
||||
is(window.getComputedStyle(button).color, defaultColor,
|
||||
"back to default style after un-disabling");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), false,
|
||||
"doesn't match selector after enabling");
|
||||
}
|
||||
|
||||
|
||||
function testLockDisabled() {
|
||||
var button = document.getElementById("test-button");
|
||||
|
||||
/* starting state is disabled */
|
||||
button.setAttribute("disabled", "disabled");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(button, ":disabled"), false,
|
||||
"doesn't have lock at start");
|
||||
|
||||
is(window.getComputedStyle(button).color, disabledColor,
|
||||
"color is :disabled color before locking");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), true,
|
||||
"matches selector before locking");
|
||||
|
||||
/* lock */
|
||||
DOMUtils.addPseudoClassLock(button, ":disabled");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(button, ":disabled"), true,
|
||||
"hasPseudoClassLock is true after locking");
|
||||
|
||||
is(window.getComputedStyle(button).color, disabledColor,
|
||||
":disabled style still applied after adding on lock");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), true,
|
||||
"matches selector after locking");
|
||||
|
||||
/* change state to enabled */
|
||||
button.removeAttribute("disabled");
|
||||
|
||||
is(window.getComputedStyle(button).color, disabledColor,
|
||||
":disabled style applied after enabling");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), true,
|
||||
"matches selector after enabling with lock on");
|
||||
|
||||
/* remove lock */
|
||||
DOMUtils.removePseudoClassLock(button, ":disabled");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(button, ":disabled"), false,
|
||||
"hasPseudoClassLock is false after removing on lock");
|
||||
|
||||
is(window.getComputedStyle(button).color, defaultColor,
|
||||
"default style applied after removing lock");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), false,
|
||||
"doesn't match selector after unlocking");
|
||||
|
||||
/* change state to disabled */
|
||||
button.setAttribute("disabled", "disabled");
|
||||
|
||||
is(window.getComputedStyle(button).color, disabledColor,
|
||||
":disabled style applied after disabling after unlocking");
|
||||
|
||||
is(button.mozMatchesSelector(":disabled"), true,
|
||||
"matches selector again after disabling");
|
||||
}
|
||||
|
||||
function testVisited() {
|
||||
var link = document.getElementById("test-link");
|
||||
var visitedColor = "rgb(20, 0, 0)";
|
||||
var unvisitedColor = "rgb(30, 0, 0)";
|
||||
|
||||
/* lock visited */
|
||||
DOMUtils.addPseudoClassLock(link, ":visited");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(link, ":visited"), true,
|
||||
"hasPseudoClassLock is true after adding lock");
|
||||
|
||||
var color = DOMWindowUtils.getVisitedDependentComputedStyle(link,
|
||||
null, "color");
|
||||
is(color, visitedColor, "color is :visited color after locking");
|
||||
|
||||
/* lock unvisited */
|
||||
DOMUtils.addPseudoClassLock(link, ":link");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(link, ":link"), true,
|
||||
"hasPseudoClassLock is true after adding :link lock");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(link, ":visited"), false,
|
||||
"hasPseudoClassLock is false for :visited after adding :link lock");
|
||||
|
||||
var color = DOMWindowUtils.getVisitedDependentComputedStyle(link,
|
||||
null, "color");
|
||||
is(color, unvisitedColor, "color is :link color after locking :link");
|
||||
|
||||
/* lock visited back on */
|
||||
DOMUtils.addPseudoClassLock(link, ":visited");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(link, ":visited"), true,
|
||||
"hasPseudoClassLock is true after adding :visited lock");
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(link, ":link"), false,
|
||||
"hasPseudoClassLock is false for :link after adding :visited lock");
|
||||
|
||||
var color = DOMWindowUtils.getVisitedDependentComputedStyle(link,
|
||||
null, "color");
|
||||
is(color, visitedColor, "color is :visited color after locking back on");
|
||||
}
|
||||
|
||||
function testMultiple() {
|
||||
var div = document.getElementById("test-div");
|
||||
|
||||
var styles = {
|
||||
":hover": {
|
||||
property: "color",
|
||||
value: "rgb(10, 0, 0)",
|
||||
defaultValue: "rgb(0, 0, 0)"
|
||||
},
|
||||
":active": {
|
||||
property: "font-family",
|
||||
value: "Arial",
|
||||
defaultValue: "serif"
|
||||
},
|
||||
":focus": {
|
||||
property: "font-weight",
|
||||
value: "800",
|
||||
defaultValue: "400"
|
||||
}
|
||||
};
|
||||
|
||||
for (var pseudo in styles) {
|
||||
DOMUtils.addPseudoClassLock(div, pseudo);
|
||||
}
|
||||
|
||||
for (var pseudo in styles) {
|
||||
is(DOMUtils.hasPseudoClassLock(div, pseudo), true,
|
||||
"hasPseudoClassLock is true after locking");
|
||||
|
||||
var style = styles[pseudo];
|
||||
is(window.getComputedStyle(div).getPropertyValue(style.property),
|
||||
style.value, "style for pseudo-class is applied after locking");
|
||||
|
||||
is(div.mozMatchesSelector(pseudo), true,
|
||||
"matches selector after locking");
|
||||
}
|
||||
|
||||
DOMUtils.clearPseudoClassLocks(div);
|
||||
|
||||
for (var pseudo in styles) {
|
||||
is(DOMUtils.hasPseudoClassLock(div, pseudo), false,
|
||||
"hasPseudoClassLock is false after clearing");
|
||||
|
||||
is(window.getComputedStyle(div).getPropertyValue(style.property),
|
||||
style.defaultValue, "style is back to default after clearing");
|
||||
|
||||
is(div.mozMatchesSelector(pseudo), false,
|
||||
"doesn't match selector after unlocking");
|
||||
}
|
||||
}
|
||||
|
||||
function testInvalid() {
|
||||
var div = document.getElementById("test-div");
|
||||
var pseudos = ["not a valid pseudo-class", ":moz-any-link", ":first-child"];
|
||||
|
||||
for (var i = 0; i < pseudos.length; i++) {
|
||||
var pseudo = pseudos[i];
|
||||
|
||||
// basically make sure these don't crash the browser.
|
||||
DOMUtils.addPseudoClassLock(div, pseudo);
|
||||
|
||||
is(DOMUtils.hasPseudoClassLock(div, pseudo), false);
|
||||
|
||||
DOMUtils.removePseudoClassLock(div, pseudo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=708874"
|
||||
target="_blank">Mozilla Bug 708874</a>
|
||||
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=708874">
|
||||
Mozilla Bug 708874 - API for locking pseudo-class state of an element
|
||||
</a>
|
||||
|
||||
<a id="test-link" href="http://notavisitedwebsite.com">
|
||||
test link
|
||||
</a>
|
||||
|
||||
<div id="test-div">
|
||||
test div
|
||||
</div>
|
||||
|
||||
<button id="test-button">
|
||||
test button
|
||||
</button>
|
||||
</body>
|
||||
|
||||
</window>
|
@ -20,4 +20,13 @@
|
||||
dy="20 10mm 3pc 36pt 2em 3% 1ex">YZ123456
|
||||
</text>
|
||||
|
||||
<text transform="translate(420, 20)"
|
||||
x="20 10mm 3pc 72pt 2em 3% 1ex"
|
||||
dy="20 10mm 3pc 36pt 2em 3% 1ex">7890abcd
|
||||
</text>
|
||||
|
||||
<text transform="translate(520, 20)"
|
||||
x="20 10mm 3pc 72pt 2em 3% 1ex"
|
||||
dy="20 10mm 3pc 36pt 2em 3% 1ex">efghijkl
|
||||
</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 891 B |
@ -22,7 +22,7 @@
|
||||
number of inches in 50px is not always the same, so we can't fix how
|
||||
many inches is midway between 50px and 10in in the reference file. To
|
||||
get around this problem this test mainly pairs different units with a
|
||||
knows, fixed, relationship. For example, animating between cm and mm,
|
||||
known, fixed, relationship. For example, animating between cm and mm,
|
||||
or between 'in' and pt (72 pt/in) or between 'in' and pc (6 pc/in).
|
||||
Note that we can animate between px and em by fixing the relationship
|
||||
between these units by setting the CSS 'font-size' property to a fixed
|
||||
@ -176,4 +176,47 @@
|
||||
fill="freeze"/>
|
||||
</text>
|
||||
|
||||
|
||||
<!-- Test 'by' animation with calcMode="discrete". -->
|
||||
|
||||
<text transform="translate(420, 20)"
|
||||
x="20 10mm 3pc 72pt 2em 3% 1ex">7890abcd
|
||||
|
||||
<!-- At 5s the animVal should be "10px 0.5cm 0.25in 0.5in 16px 0cm 0%",
|
||||
since the discrete animation is considered to be an additive
|
||||
animation from an empty list to the list specified in by="". -->
|
||||
<animate attributeName="x"
|
||||
calcMode="discrete"
|
||||
begin="0s" dur="15s"
|
||||
by="30 15mm 4.5pc 108pt 3em 9% 3ex"
|
||||
fill="freeze"/>
|
||||
|
||||
<!-- At 5s the animVal should be the empty list, as both the underlying
|
||||
value and the first value of the equivalent additive animation are
|
||||
empty lists. -->
|
||||
<animate attributeName="dy"
|
||||
calcMode="discrete"
|
||||
begin="0s" dur="15s"
|
||||
by="20 10mm 3pc 36pt 2em 3% 1ex"
|
||||
fill="freeze"/>
|
||||
</text>
|
||||
|
||||
<text transform="translate(520, 20)"
|
||||
x="10px 0.5cm 0.25in 0.5in 16px 0cm 0%">efghijkl
|
||||
|
||||
<!-- At 5s the animVal should be "20 10mm 3pc 72pt 2em 3% 1ex". -->
|
||||
<animate attributeName="x"
|
||||
calcMode="discrete"
|
||||
begin="0s" dur="8s"
|
||||
by="10 5mm 1.5pc 36pt 1em 3% 1ex"
|
||||
fill="freeze"/>
|
||||
|
||||
<!-- At 5s the animVal should be "20 10mm 3pc 36pt 2em 3% 1ex". -->
|
||||
<animate attributeName="dy"
|
||||
calcMode="discrete"
|
||||
begin="0s" dur="8s"
|
||||
by="20 10mm 3pc 36pt 2em 3% 1ex"
|
||||
fill="freeze"/>
|
||||
</text>
|
||||
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 9.4 KiB |
@ -2,10 +2,10 @@
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div style="-moz-transform: rotatex(90deg); -moz-transform-style: preserve-3d;">
|
||||
<div style="-moz-transform: rotatex(90deg); -moz-transform-style: preserve-3d;">
|
||||
<div style="-moz-transform: rotatex(90deg); -moz-transform-style: preserve-3d;">
|
||||
<div style="-moz-transform: rotatex(90deg); width: 100px; height: 100px;">
|
||||
<div style="-moz-transform: rotatex(45deg); -moz-transform-style: preserve-3d;">
|
||||
<div style="-moz-transform: rotatex(45deg); -moz-transform-style: preserve-3d;">
|
||||
<div style="-moz-transform: rotatex(45deg); -moz-transform-style: preserve-3d;">
|
||||
<div style="-moz-transform: rotatex(45deg); width: 100px; height: 100px;">
|
||||
Test Text
|
||||
</div>
|
||||
</div>
|
||||
|
@ -10,7 +10,7 @@
|
||||
== rotatex-perspective-1c.html rotatex-1-ref.html
|
||||
== rotatex-perspective-3a.html rotatex-perspective-3-ref.html
|
||||
== scalez-1a.html scalez-1-ref.html
|
||||
fails == preserve3d-1a.html preserve3d-1-ref.html
|
||||
fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == preserve3d-1a.html preserve3d-1-ref.html
|
||||
== preserve3d-1b.html about:blank
|
||||
== preserve3d-clipped.html about:blank
|
||||
== preserve3d-2a.html preserve3d-2-ref.html
|
||||
|
@ -2350,7 +2350,7 @@ CSS_PROP_DISPLAY(
|
||||
perspective,
|
||||
CSS_PROP_DOMPROP_PREFIXED(Perspective),
|
||||
CSS_PROPERTY_PARSE_VALUE,
|
||||
VARIANT_NONE | VARIANT_INHERIT | VARIANT_LENGTH,
|
||||
VARIANT_NONE | VARIANT_INHERIT | VARIANT_LENGTH | VARIANT_POSITIVE_LENGTH,
|
||||
nsnull,
|
||||
offsetof(nsStyleDisplay, mChildPerspective),
|
||||
eStyleAnimType_Coord)
|
||||
|
@ -1262,7 +1262,7 @@ nsCSSRuleProcessor::GetWindowsThemeIdentifier()
|
||||
nsEventStates
|
||||
nsCSSRuleProcessor::GetContentState(Element* aElement)
|
||||
{
|
||||
nsEventStates state = aElement->State();
|
||||
nsEventStates state = aElement->StyleState();
|
||||
|
||||
// If we are not supposed to mark visited links as such, be sure to
|
||||
// flip the bits appropriately. We want to do this here, rather
|
||||
@ -1282,7 +1282,7 @@ nsCSSRuleProcessor::GetContentState(Element* aElement)
|
||||
bool
|
||||
nsCSSRuleProcessor::IsLink(Element* aElement)
|
||||
{
|
||||
nsEventStates state = aElement->State();
|
||||
nsEventStates state = aElement->StyleState();
|
||||
return state.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED);
|
||||
}
|
||||
|
||||
|
@ -3768,10 +3768,6 @@ nsComputedDOMStyle::GetFrameBoundsWidthForTransform(nscoord& aWidth)
|
||||
|
||||
AssertFlushedPendingReflows();
|
||||
|
||||
// Check to see that we're transformed.
|
||||
if (!mInnerFrame->GetStyleDisplay()->HasTransform())
|
||||
return false;
|
||||
|
||||
aWidth = nsDisplayTransform::GetFrameBoundsForTransform(mInnerFrame).width;
|
||||
return true;
|
||||
}
|
||||
@ -3786,10 +3782,6 @@ nsComputedDOMStyle::GetFrameBoundsHeightForTransform(nscoord& aHeight)
|
||||
|
||||
AssertFlushedPendingReflows();
|
||||
|
||||
// Check to see that we're transformed.
|
||||
if (!mInnerFrame->GetStyleDisplay()->HasTransform())
|
||||
return false;
|
||||
|
||||
aHeight = nsDisplayTransform::GetFrameBoundsForTransform(mInnerFrame).height;
|
||||
return true;
|
||||
}
|
||||
|
@ -1030,11 +1030,11 @@ var gCSSProperties = {
|
||||
/* no subproperties */
|
||||
prerequisites: { "width": "10px", "height": "10px", "display": "block"},
|
||||
initial_values: [ "50% 50%", "center", "center center" ],
|
||||
other_values: [ "25% 25%", "5px 5px", "20% 3em", "0 0", "0in 1in",
|
||||
other_values: [ "25% 25%", "6px 5px", "20% 3em", "0 0", "0in 1in",
|
||||
"top", "bottom","top left", "top right",
|
||||
"top center", "center left", "center right",
|
||||
"bottom left", "bottom right", "bottom center",
|
||||
"20% center", "5px center", "13in bottom",
|
||||
"20% center", "6px center", "13in bottom",
|
||||
"left 50px", "right 13%", "center 40px",
|
||||
"-moz-calc(20px)",
|
||||
"-moz-calc(20px) 10px",
|
||||
@ -1058,11 +1058,11 @@ var gCSSProperties = {
|
||||
/* no subproperties */
|
||||
prerequisites: { "width": "10px", "height": "10px", "display": "block"},
|
||||
initial_values: [ "50% 50%", "center", "center center" ],
|
||||
other_values: [ "25% 25%", "5px 5px", "20% 3em", "0 0", "0in 1in",
|
||||
other_values: [ "25% 25%", "6px 5px", "20% 3em", "0 0", "0in 1in",
|
||||
"top", "bottom","top left", "top right",
|
||||
"top center", "center left", "center right",
|
||||
"bottom left", "bottom right", "bottom center",
|
||||
"20% center", "5px center", "13in bottom",
|
||||
"20% center", "6px center", "13in bottom",
|
||||
"left 50px", "right 13%", "center 40px",
|
||||
"-moz-calc(20px)",
|
||||
"-moz-calc(20px) 10px",
|
||||
@ -1082,9 +1082,9 @@ var gCSSProperties = {
|
||||
domProp: "MozPerspective",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "none", "0" ],
|
||||
other_values: [ "1000px", "500.2px", "-100px", "-27.2em" ],
|
||||
invalid_values: [ "pants", "200" ]
|
||||
initial_values: [ "none" ],
|
||||
other_values: [ "1000px", "500.2px" ],
|
||||
invalid_values: [ "pants", "200", "0", "-100px", "-27.2em" ]
|
||||
},
|
||||
"-moz-backface-visibility": {
|
||||
domProp: "MozBackfaceVisibility",
|
||||
|
@ -1030,11 +1030,11 @@ function test_length_pair_transition_clamped(prop) {
|
||||
function test_length_percent_pair_transition(prop) {
|
||||
div.style.setProperty("-moz-transition-property", "none", "");
|
||||
div.style.setProperty(prop, "4px 50%", "");
|
||||
is(cs.getPropertyValue(prop), "4px 50%",
|
||||
is(cs.getPropertyValue(prop), "4px 5px",
|
||||
"length-valued property " + prop + ": computed value before transition");
|
||||
div.style.setProperty("-moz-transition-property", prop, "");
|
||||
div.style.setProperty(prop, "12px 70%", "");
|
||||
is(cs.getPropertyValue(prop), "6px 55%",
|
||||
is(cs.getPropertyValue(prop), "6px 5.5px",
|
||||
"length-valued property " + prop + ": interpolation of lengths");
|
||||
check_distance(prop, "4px 50%", "6px 55%", "12px 70%");
|
||||
}
|
||||
@ -1051,11 +1051,11 @@ function test_length_percent_pair_clamped_or_unclamped(prop, is_clamped) {
|
||||
div.style.setProperty("-moz-transition-timing-function", FUNC_NEGATIVE, "");
|
||||
div.style.setProperty("-moz-transition-property", "none", "");
|
||||
div.style.setProperty(prop, "0px 0%", "");
|
||||
is(cs.getPropertyValue(prop), "0px 0%",
|
||||
is(cs.getPropertyValue(prop), "0px 0px",
|
||||
"length+percent-valued property " + prop + ": flush before clamping test");
|
||||
div.style.setProperty("-moz-transition-property", prop, "");
|
||||
div.style.setProperty(prop, "30px 25%", "");
|
||||
(is_clamped ? is : isnot)(cs.getPropertyValue(prop), "0px 0%",
|
||||
(is_clamped ? is : isnot)(cs.getPropertyValue(prop), "0px 0px",
|
||||
"length+percent-valued property " + prop + ": clamping of negatives");
|
||||
div.style.setProperty("-moz-transition-timing-function", "linear", "");
|
||||
}
|
||||
|
@ -405,13 +405,29 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
|
||||
Object selectedItem = null;
|
||||
String title = "";
|
||||
|
||||
if (view == (ListView)findViewById(R.id.history_list)) {
|
||||
if (! (menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo)) {
|
||||
if (list == findViewById(R.id.all_pages_list)) {
|
||||
if (!(menuInfo instanceof AdapterView.AdapterContextMenuInfo)) {
|
||||
Log.e(LOGTAG, "menuInfo is not AdapterContextMenuInfo");
|
||||
return;
|
||||
}
|
||||
|
||||
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
|
||||
selectedItem = list.getItemAtPosition(info.position);
|
||||
|
||||
if (!(selectedItem instanceof Cursor)) {
|
||||
Log.e(LOGTAG, "item at " + info.position + " is not a Cursor");
|
||||
return;
|
||||
}
|
||||
|
||||
Cursor cursor = (Cursor) selectedItem;
|
||||
title = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.TITLE));
|
||||
} else {
|
||||
if (!(menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo)) {
|
||||
Log.e(LOGTAG, "menuInfo is not ExpandableListContextMenuInfo");
|
||||
return;
|
||||
}
|
||||
|
||||
ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
|
||||
ExpandableListView exList = (ExpandableListView)list;
|
||||
int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
|
||||
int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
|
||||
|
||||
@ -419,23 +435,18 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
|
||||
if (groupPosition < 0 || childPosition < 0)
|
||||
return;
|
||||
|
||||
ExpandableListView exList = (ExpandableListView) list;
|
||||
selectedItem = exList.getExpandableListAdapter().getChild(groupPosition, childPosition);
|
||||
|
||||
Map map = (Map)selectedItem;
|
||||
title = (String)map.get(URLColumns.TITLE);
|
||||
} else {
|
||||
if (! (menuInfo instanceof AdapterView.AdapterContextMenuInfo)) {
|
||||
Log.e(LOGTAG, "menuInfo is not AdapterContextMenuInfo");
|
||||
return;
|
||||
if (exList == findViewById(R.id.bookmarks_list)) {
|
||||
// The bookmarks list is backed by a SimpleCursorTreeAdapter
|
||||
Cursor cursor = (Cursor) selectedItem;
|
||||
title = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.TITLE));
|
||||
} else {
|
||||
// The history list is backed by a SimpleExpandableListAdapter
|
||||
Map map = (Map) selectedItem;
|
||||
title = (String) map.get(URLColumns.TITLE);
|
||||
}
|
||||
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
|
||||
selectedItem = list.getItemAtPosition(info.position);
|
||||
if (! (selectedItem instanceof Cursor)) {
|
||||
Log.e(LOGTAG, "item at " + info.position + " is not a Cursor");
|
||||
return;
|
||||
}
|
||||
Cursor cursor = (Cursor)selectedItem;
|
||||
title = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.TITLE));
|
||||
}
|
||||
|
||||
if (selectedItem == null || !((selectedItem instanceof Cursor) || (selectedItem instanceof Map))) {
|
||||
@ -448,7 +459,7 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.awesomebar_contextmenu, menu);
|
||||
|
||||
if (view != (ListView)findViewById(R.id.bookmarks_list)) {
|
||||
if (list != findViewById(R.id.bookmarks_list)) {
|
||||
MenuItem removeBookmarkItem = menu.findItem(R.id.remove_bookmark);
|
||||
removeBookmarkItem.setVisible(false);
|
||||
}
|
||||
|
@ -241,8 +241,10 @@ public class CrashReporter extends Activity
|
||||
final CheckBox includeURLCheckbox = (CheckBox) findViewById(R.id.include_url);
|
||||
|
||||
String spec = extras.get(SERVER_URL_KEY);
|
||||
if (spec == null)
|
||||
if (spec == null) {
|
||||
doFinish();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.i(LOGTAG, "server url: " + spec);
|
||||
try {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user