mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
[JAEGER] Merge from Tracemonkey.
This commit is contained in:
commit
357cecb6ca
@ -1,6 +1,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constants
|
||||
|
||||
const EVENT_ALERT = nsIAccessibleEvent.EVENT_ALERT;
|
||||
const EVENT_DOCUMENT_LOAD_COMPLETE = nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE;
|
||||
const EVENT_DOCUMENT_RELOAD = nsIAccessibleEvent.EVENT_DOCUMENT_RELOAD;
|
||||
const EVENT_DOCUMENT_LOAD_STOPPED = nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_STOPPED;
|
||||
@ -315,37 +316,48 @@ function eventQueue(aEventType)
|
||||
invoker.debugCheck(aEvent);
|
||||
|
||||
// Search through unexpected events to ensure no one of them was handled.
|
||||
for (var idx = 0; idx < this.mEventSeq.length; idx++) {
|
||||
var idx = 0;
|
||||
for (; idx < this.mEventSeq.length; idx++) {
|
||||
if (this.mEventSeq[idx].unexpected && this.compareEvents(idx, aEvent))
|
||||
invoker.wasCaught[idx] = true;
|
||||
}
|
||||
|
||||
// Wait for next expected event in an order specified by event sequence.
|
||||
// We've handled all expected events, next invoker processing is pending.
|
||||
if (this.mEventSeqIdx == this.mEventSeq.length)
|
||||
return;
|
||||
|
||||
// Compute next expected event index.
|
||||
for (var idx = this.mEventSeqIdx + 1;
|
||||
idx < this.mEventSeq.length && this.mEventSeq[idx].unexpected; idx++);
|
||||
for (idx = this.mEventSeqIdx + 1;
|
||||
idx < this.mEventSeq.length && this.mEventSeq[idx].unexpected;
|
||||
idx++);
|
||||
|
||||
// No expected events were registered, proceed to next invoker to ensure
|
||||
// unexpected events for current invoker won't be handled.
|
||||
if (idx == this.mEventSeq.length) {
|
||||
// There is no expected events in the sequence.
|
||||
this.mEventSeqIdx = idx;
|
||||
this.processNextInvokerInTimeout();
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if handled event matches expected event.
|
||||
var matched = this.compareEvents(idx, aEvent);
|
||||
this.dumpEventToDOM(aEvent, idx, matched);
|
||||
|
||||
if (matched) {
|
||||
this.checkEvent(idx, aEvent);
|
||||
invoker.wasCaught[idx] = true;
|
||||
|
||||
// The last event is expected and was handled, proceed next invoker.
|
||||
if (idx == this.mEventSeq.length - 1) {
|
||||
this.processNextInvokerInTimeout();
|
||||
return;
|
||||
}
|
||||
|
||||
this.mEventSeqIdx = idx;
|
||||
|
||||
// Get next expected event index.
|
||||
while (++idx < this.mEventSeq.length && this.mEventSeq[idx].unexpected);
|
||||
|
||||
// If the last expected event was processed, proceed next invoker in
|
||||
// timeout to ensure unexpected events for current invoker won't be
|
||||
// handled.
|
||||
if (idx == this.mEventSeq.length) {
|
||||
this.mEventSeqIdx = idx;
|
||||
this.processNextInvokerInTimeout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ _TEST_FILES =\
|
||||
docload_wnd.xul \
|
||||
focus.html \
|
||||
scroll.html \
|
||||
test_aria_alert.html \
|
||||
test_aria_statechange.html \
|
||||
test_attrs.html \
|
||||
test_caretmove.html \
|
||||
|
93
accessible/tests/mochitest/events/test_aria_alert.html
Normal file
93
accessible/tests/mochitest/events/test_aria_alert.html
Normal file
@ -0,0 +1,93 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>ARIA alert event testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function showAlert(aID)
|
||||
{
|
||||
this.DOMNode = document.createElement("div");
|
||||
|
||||
this.invoke = function showAlert_invoke()
|
||||
{
|
||||
this.DOMNode.setAttribute("role", "alert");
|
||||
this.DOMNode.setAttribute("id", aID);
|
||||
var text = document.createTextNode("alert");
|
||||
this.DOMNode.appendChild(text);
|
||||
document.body.appendChild(this.DOMNode);
|
||||
};
|
||||
|
||||
this.getID = function showAlert_getID()
|
||||
{
|
||||
return "Show ARIA alert " + aID;
|
||||
};
|
||||
}
|
||||
|
||||
function changeAlert(aID)
|
||||
{
|
||||
this.__defineGetter__("DOMNode", function() { return getNode(aID) });
|
||||
|
||||
this.invoke = function changeAlert_invoke()
|
||||
{
|
||||
this.DOMNode.textContent = "new alert";
|
||||
}
|
||||
|
||||
this.getID = function showAlert_getID()
|
||||
{
|
||||
return "Change ARIA alert " + aID;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests
|
||||
|
||||
var gQueue = null;
|
||||
|
||||
//gA11yEventDumpID = "eventdump";
|
||||
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_ALERT);
|
||||
|
||||
gQueue.push(new showAlert("alert"));
|
||||
gQueue.push(new changeAlert("alert"));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTests);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=591199"
|
||||
title="mochitest for bug 334386: fire alert event when ARIA alert is shown or new its children are inserted">
|
||||
Mozilla Bug 591199
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<div id="eventdump"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -52,6 +52,7 @@ _TEST_FILES =\
|
||||
test_button.xul \
|
||||
test_colorpicker.xul \
|
||||
test_combobox.xul \
|
||||
test_cssoverflow.html \
|
||||
test_filectrl.html \
|
||||
test_formctrl.html \
|
||||
test_formctrl.xul \
|
||||
|
142
accessible/tests/mochitest/tree/test_cssoverflow.html
Normal file
142
accessible/tests/mochitest/tree/test_cssoverflow.html
Normal file
@ -0,0 +1,142 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>CSS overflow testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<style>
|
||||
a.link:focus {
|
||||
overflow: scroll;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invokers
|
||||
|
||||
function focusAnchor(aID)
|
||||
{
|
||||
this.DOMNode = getNode(aID);
|
||||
this.link = getAccessible(this.DOMNode);
|
||||
this.linkChild = this.link.firstChild;
|
||||
this.linkChildNode = getAccessible(this.linkChild, [nsIAccessNode]).DOMNode;
|
||||
|
||||
this.eventSeq = [
|
||||
// new invokerChecker(EVENT_HIDE, this.linkChild),
|
||||
// new invokerChecker(EVENT_SHOW, getAccessible, this.linkChildNode),
|
||||
new invokerChecker(EVENT_FOCUS, this.link)
|
||||
];
|
||||
|
||||
this.unexpectedEventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, this.link),
|
||||
new invokerChecker(EVENT_SHOW, getAccessible, this.DOMNode)
|
||||
];
|
||||
|
||||
this.invoke = function focusAnchor_invoke()
|
||||
{
|
||||
todo(false, "enable event hide/show events");
|
||||
getNode(aID).focus();
|
||||
}
|
||||
|
||||
this.getID = function focusAnchor_getID()
|
||||
{
|
||||
return "focus a:focus{overflow:scroll} #1";
|
||||
}
|
||||
}
|
||||
|
||||
function tabAnchor(aID, aPrevID)
|
||||
{
|
||||
this.DOMNode = getNode(aID);
|
||||
this.link = getAccessible(this.DOMNode);
|
||||
this.linkChild = this.link.firstChild;
|
||||
this.linkChildNode = getAccessible(this.linkChild, [nsIAccessNode]).DOMNode;
|
||||
this.prevLink = getAccessible(aPrevID);
|
||||
this.prevLinkNode = getAccessible(this.prevLink, [nsIAccessNode]).DOMNode;
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, this.prevLink),
|
||||
new invokerChecker(EVENT_SHOW, getAccessible, this.prevLinkNode),
|
||||
new invokerChecker(EVENT_HIDE, this.linkChild),
|
||||
new invokerChecker(EVENT_SHOW, getAccessible, this.linkChildNode),
|
||||
new invokerChecker(EVENT_FOCUS, this.link)
|
||||
];
|
||||
|
||||
this.unexpectedEventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, this.link),
|
||||
new invokerChecker(EVENT_SHOW, getAccessible, this.DOMNode)
|
||||
];
|
||||
|
||||
this.invoke = function focusAnchor_invoke()
|
||||
{
|
||||
synthesizeKey("VK_TAB", { shiftKey: false });
|
||||
}
|
||||
|
||||
this.getID = function focusAnchor_getID()
|
||||
{
|
||||
return "focus a:focus{overflow:scroll} #2";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests
|
||||
|
||||
var gQueue = null;
|
||||
// gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
|
||||
// CSS 'overflow: scroll' property setting and unsetting causes accessible
|
||||
// recreation (and fire show/hide events) if the accessible is not
|
||||
// focused. If it's focused its children are recreated. For example,
|
||||
// focusing the HTML:a with ':focus {overflow: scroll; }' CSS style
|
||||
// shouldn't cause of HTML:a accessible recreation. The same time blur
|
||||
// makes its accessible to be recreated.
|
||||
gQueue.push(new focusAnchor("a"))
|
||||
gQueue.push(new tabAnchor("a2", "a"));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTests);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=591163"
|
||||
title="mochitest for bug 413777: focus the a:focus {overflow: scroll;} shouldn't recreate HTML a accessible">
|
||||
Mozilla Bug 591163
|
||||
</a><br>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<div id="eventdump"></div>
|
||||
|
||||
<div>
|
||||
<a id="a" class="link" href="www">link</a>
|
||||
</div>
|
||||
<div>
|
||||
<a id="a2" class="link" href="www">link2</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -43,6 +43,13 @@ let gSyncUI = {
|
||||
// this will be the first notification fired during init
|
||||
// we can set up everything else later
|
||||
Services.obs.addObserver(this, "weave:service:ready", true);
|
||||
|
||||
// Remove the observer if the window is closed before the observer
|
||||
// was triggered.
|
||||
window.addEventListener("unload", function() {
|
||||
window.removeEventListener("unload", arguments.callee, false);
|
||||
Services.obs.removeObserver(gSyncUI, "weave:service:ready");
|
||||
}, false);
|
||||
},
|
||||
initUI: function SUI_initUI() {
|
||||
let obs = ["weave:service:sync:start",
|
||||
@ -304,7 +311,7 @@ let gSyncUI = {
|
||||
_updateLastSyncItem: function SUI__updateLastSyncItem() {
|
||||
let lastSync;
|
||||
try {
|
||||
Services.prefs.getCharPref("services.sync.lastSync");
|
||||
lastSync = Services.prefs.getCharPref("services.sync.lastSync");
|
||||
}
|
||||
catch (e) { };
|
||||
if (!lastSync)
|
||||
@ -328,6 +335,10 @@ let gSyncUI = {
|
||||
_onSyncEnd: function SUI__onSyncEnd(success) {
|
||||
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
||||
if (!success) {
|
||||
if (Weave.Status.login != Weave.LOGIN_SUCCEEDED) {
|
||||
this.onLoginError();
|
||||
return;
|
||||
}
|
||||
let error = Weave.Utils.getErrorString(Weave.Status.sync);
|
||||
let description =
|
||||
this._stringBundle.formatStringFromName("error.sync.description", [error], 1);
|
||||
@ -398,6 +409,12 @@ let gSyncUI = {
|
||||
case "weave:service:ready":
|
||||
this.initUI();
|
||||
break;
|
||||
case "weave:notification:added":
|
||||
this.onNotificationAdded();
|
||||
break;
|
||||
case "weave:notification:removed":
|
||||
this.onNotificationRemoved();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -58,6 +58,10 @@ tabbrowser {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned] > .tab-icon-image {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#alltabs-popup {
|
||||
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-alltabs-popup");
|
||||
}
|
||||
@ -252,6 +256,17 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
|
||||
min-width: 1px;
|
||||
}
|
||||
|
||||
/* Sync statusbar UI */
|
||||
%ifdef MOZ_SERVICES_SYNC
|
||||
#sync-notifications-box {
|
||||
-moz-binding: url("chrome://browser/content/syncNotification.xml#notificationbox");
|
||||
}
|
||||
|
||||
#sync-notifications-box notification {
|
||||
-moz-binding: url("chrome://browser/content/syncNotification.xml#notification");
|
||||
}
|
||||
%endif
|
||||
|
||||
/* Identity UI */
|
||||
#identity-popup-content-box.unknownIdentity > #identity-popup-connectedToLabel ,
|
||||
#identity-popup-content-box.unknownIdentity > #identity-popup-runByLabel ,
|
||||
|
181
browser/base/content/syncNotification.xml
Normal file
181
browser/base/content/syncNotification.xml
Normal file
@ -0,0 +1,181 @@
|
||||
<?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 Sync
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2010
|
||||
# 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 *****
|
||||
|
||||
<!DOCTYPE bindings [
|
||||
<!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
|
||||
%notificationDTD;
|
||||
]>
|
||||
|
||||
<bindings id="notificationBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="notificationbox" extends="chrome://global/content/bindings/notification.xml#notificationbox">
|
||||
<content>
|
||||
<xul:vbox xbl:inherits="hidden=notificationshidden">
|
||||
<xul:spacer/>
|
||||
<children includes="notification"/>
|
||||
</xul:vbox>
|
||||
<children/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
Cu.import("resource://services-sync/ext/Observers.js");
|
||||
Cu.import("resource://services-sync/notifications.js");
|
||||
|
||||
Observers.add("weave:notification:added", this.onNotificationAdded, this);
|
||||
Observers.add("weave:notification:removed", this.onNotificationRemoved, this);
|
||||
|
||||
for each (var notification in Notifications.notifications)
|
||||
this._appendNotification(notification);
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
Observers.remove("weave:notification:added", this.onNotificationAdded, this);
|
||||
Observers.remove("weave:notification:removed", this.onNotificationRemoved, this);
|
||||
]]></destructor>
|
||||
|
||||
<method name="onNotificationAdded">
|
||||
<parameter name="subject"/>
|
||||
<parameter name="data"/>
|
||||
<body><![CDATA[
|
||||
this._appendNotification(subject);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onNotificationRemoved">
|
||||
<parameter name="subject"/>
|
||||
<parameter name="data"/>
|
||||
<body><![CDATA[
|
||||
// If the view of the notification hasn't been removed yet, remove it.
|
||||
var notifications = this.allNotifications;
|
||||
for each (var notification in notifications) {
|
||||
if (notification.notification == subject) {
|
||||
notification.close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the user has just closed the last notification, close the panel.
|
||||
// FIXME: this is not quite right, because it might not have been
|
||||
// the user that caused weave:notification:removed to get called.
|
||||
// We need to differentiate between "notification removed" and "user
|
||||
// closed the notification" and only close the panel if it was
|
||||
// the user who closed the last notification. Maybe we should make
|
||||
// the notification's close method handle closing the panel,
|
||||
// but should the notification box or its notifications really know
|
||||
// they are located inside the panel?
|
||||
var panel = document.getElementById("sync-notifications-panel");
|
||||
if (panel.state == "open" &&
|
||||
Notifications.notifications.length == 0)
|
||||
panel.hidePopup();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_appendNotification">
|
||||
<parameter name="notification"/>
|
||||
<body><![CDATA[
|
||||
var node = this.appendNotification(notification.title,
|
||||
notification.description,
|
||||
notification.iconURL,
|
||||
notification.priority,
|
||||
notification.buttons);
|
||||
node.className = notification.constructor.name;
|
||||
node.notification = notification;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="notification" extends="chrome://global/content/bindings/notification.xml#notification">
|
||||
<content>
|
||||
<xul:hbox class="notification-inner outset" flex="1" xbl:inherits="type" align="start">
|
||||
<xul:image anonid="messageImage" class="messageImage" xbl:inherits="src=image" style="padding: 3px;"/>
|
||||
<xul:vbox flex="1">
|
||||
<xul:hbox anonid="details" align="center" flex="1">
|
||||
<xul:description anonid="messageText" class="messageText" flex="1" xbl:inherits="xbl:text=label"/>
|
||||
<xul:spacer flex="1"/>
|
||||
</xul:hbox>
|
||||
<xul:description xbl:inherits="xbl:text=value"/>
|
||||
|
||||
<!-- The children are the buttons defined by the notification. -->
|
||||
<xul:hbox oncommand="document.getBindingParent(this)._doButtonCommand(event);">
|
||||
<xul:spacer flex="1"/>
|
||||
<children/>
|
||||
</xul:hbox>
|
||||
|
||||
</xul:vbox>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:toolbarbutton ondblclick="event.stopPropagation();"
|
||||
class="messageCloseButton tabbable"
|
||||
xbl:inherits="hidden=hideclose"
|
||||
tooltiptext="&closeNotification.tooltip;"
|
||||
oncommand="document.getBindingParent(this).close()"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<!-- Note: this used to be a field, but for some reason it kept getting
|
||||
- reset to its default value for TabNotification elements.
|
||||
- As a property, that doesn't happen, even though the property stores
|
||||
- its value in a JS property |_notification| that is not defined
|
||||
- in XBL as a field or property. Maybe this is wrong, but it works.
|
||||
-->
|
||||
<property name="notification"
|
||||
onget="return this._notification"
|
||||
onset="this._notification = val; return val;"/>
|
||||
<method name="close">
|
||||
<body><![CDATA[
|
||||
Notifications.remove(this.notification);
|
||||
|
||||
// We should be able to call the base class's close method here
|
||||
// to remove the notification element from the notification box,
|
||||
// but we can't because of bug 373652, so instead we copied its code
|
||||
// and execute it below.
|
||||
var control = this.control;
|
||||
if (control)
|
||||
control.removeNotification(this);
|
||||
else
|
||||
this.hidden = true;
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
@ -592,10 +592,12 @@ var gSyncSetup = {
|
||||
}
|
||||
|
||||
if (uri.schemeIs("http")) {
|
||||
let uri2 = uri;
|
||||
uri2.scheme = "https";
|
||||
if (isValid(uri2))
|
||||
uri.scheme = "https";
|
||||
if (isValid(uri))
|
||||
valid = true;
|
||||
else
|
||||
// setting the scheme back to http
|
||||
uri.scheme = "http";
|
||||
}
|
||||
if (!valid)
|
||||
valid = isValid(uri);
|
||||
|
@ -67,6 +67,7 @@ browser.jar:
|
||||
content/browser/syncSetup.js (content/syncSetup.js)
|
||||
* content/browser/syncGenericChange.xul (content/syncGenericChange.xul)
|
||||
content/browser/syncGenericChange.js (content/syncGenericChange.js)
|
||||
* content/browser/syncNotification.xml (content/syncNotification.xml)
|
||||
content/browser/syncUtils.js (content/syncUtils.js)
|
||||
#endif
|
||||
# XXX: We should exclude this one as well (bug 71895)
|
||||
|
@ -626,7 +626,6 @@ xpicleanup@BIN_SUFFIX@
|
||||
components/WebContentConverter.js
|
||||
defaults/autoconfig/platform.js
|
||||
defaults/autoconfig/prefcalls.js
|
||||
defaults/pref/channel-prefs.js
|
||||
defaults/pref/firefox-branding.js
|
||||
defaults/pref/firefox.js
|
||||
defaults/pref/firefox-l10n.js
|
||||
|
@ -1222,6 +1222,10 @@ statusbarpanel#statusbar-display {
|
||||
min-height: 28px;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned] {
|
||||
min-height: 20px; /* corresponds to the max. height of non-textual tab contents, i.e. the tab close button */
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned] + .tabbrowser-tab:not([pinned]) {
|
||||
-moz-margin-start: 0;
|
||||
}
|
||||
@ -1236,7 +1240,8 @@ statusbarpanel#statusbar-display {
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned] > .tab-icon-image {
|
||||
margin: 2px 2px 0;
|
||||
-moz-margin-start: 2px;
|
||||
-moz-margin-end: 2px;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[busy] > .tab-icon-image {
|
||||
|
@ -1380,7 +1380,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
list-style-image: url("chrome://global/skin/tree/item.png");
|
||||
vertical-align: middle; /* for pinned tabs - those are display:block */
|
||||
}
|
||||
|
||||
.tabbrowser-tab[busy] > .tab-icon-image {
|
||||
|
@ -1394,6 +1394,10 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
-moz-margin-end: 3px;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned] {
|
||||
min-height: 16px; /* corresponds to the max. height of non-textual tab contents, i.e. the favicon */
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned] > .tab-icon-image {
|
||||
-moz-margin-start: 2px;
|
||||
-moz-margin-end: 2px;
|
||||
@ -1402,12 +1406,17 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
/* tabbrowser-tab focus ring */
|
||||
.tabbrowser-tab > .tab-text {
|
||||
border: 1px dotted transparent;
|
||||
margin: -1px !important; /* let the border not consume any space, like outline */
|
||||
}
|
||||
|
||||
.tabbrowser-tab:focus > .tab-text {
|
||||
border: 1px dotted -moz-DialogText;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned]:focus > .tab-icon-image {
|
||||
outline: 1px dotted;
|
||||
}
|
||||
|
||||
/* Tab DnD indicator */
|
||||
.tab-drop-indicator {
|
||||
list-style-image: url(chrome://browser/skin/tabbrowser/tabDragIndicator.png);
|
||||
|
@ -53,6 +53,7 @@ MOZ_APP_DISPLAYNAME = @MOZ_APP_DISPLAYNAME@
|
||||
MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
|
||||
MOZ_APP_VERSION = @MOZ_APP_VERSION@
|
||||
MOZ_UA_FIREFOX_VERSION = @FIREFOX_VERSION@
|
||||
MOZ_UA_BUILDID = @MOZ_UA_BUILDID@
|
||||
|
||||
MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@
|
||||
|
||||
|
@ -8769,11 +8769,13 @@ AC_SUBST(MOZ_APP_NAME)
|
||||
AC_SUBST(MOZ_APP_DISPLAYNAME)
|
||||
AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
|
||||
AC_SUBST(MOZ_APP_UA_NAME)
|
||||
AC_DEFINE_UNQUOTED(MOZ_APP_VERSION, "$MOZ_APP_VERSION")
|
||||
AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
|
||||
AC_SUBST(MOZ_APP_VERSION)
|
||||
AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
|
||||
AC_SUBST(MOZ_UA_FIREFOX_VERSION)
|
||||
AC_SUBST(FIREFOX_VERSION)
|
||||
AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
|
||||
AC_SUBST(MOZ_UA_BUILDID)
|
||||
|
||||
AC_SUBST(MOZ_PKG_SPECIAL)
|
||||
|
||||
|
@ -6720,11 +6720,14 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nsCAutoString contentDisp;
|
||||
rv = aChannel->GetContentDisposition(contentDisp);
|
||||
if (NS_SUCCEEDED(rv) && !contentDisp.IsEmpty()) {
|
||||
SetHeaderData(nsGkAtoms::headerContentDisposition,
|
||||
NS_ConvertASCIItoUTF16(contentDisp));
|
||||
nsCOMPtr<nsIMultiPartChannel> partChannel = do_QueryInterface(aChannel);
|
||||
if (partChannel) {
|
||||
nsCAutoString contentDisp;
|
||||
rv = partChannel->GetContentDisposition(contentDisp);
|
||||
if (NS_SUCCEEDED(rv) && !contentDisp.IsEmpty()) {
|
||||
SetHeaderData(nsGkAtoms::headerContentDisposition,
|
||||
NS_ConvertASCIItoUTF16(contentDisp));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFrameFrame.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
@ -645,7 +645,7 @@ class NS_STACK_CLASS AutoResetInShow {
|
||||
PRBool
|
||||
nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
||||
PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
|
||||
nsIFrameFrame* frame)
|
||||
nsSubDocumentFrame* frame)
|
||||
{
|
||||
if (mInShow) {
|
||||
return PR_FALSE;
|
||||
@ -754,7 +754,7 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
bool
|
||||
nsFrameLoader::ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view)
|
||||
nsFrameLoader::ShowRemoteFrame(nsSubDocumentFrame* frame, nsIView* view)
|
||||
{
|
||||
NS_ASSERTION(mRemoteFrame, "ShowRemote only makes sense on remote frames.");
|
||||
|
||||
@ -767,7 +767,7 @@ nsFrameLoader::ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view)
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIntSize size = GetSubDocumentSize(frame->GetFrame());
|
||||
nsIntSize size = GetSubDocumentSize(frame);
|
||||
|
||||
// Painting with shared memory
|
||||
if (!mRemoteBrowser->SendCreateWidget(0))
|
||||
@ -985,7 +985,7 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsIFrameFrame* ourFrameFrame = do_QueryFrame(ourFrame);
|
||||
nsSubDocumentFrame* ourFrameFrame = do_QueryFrame(ourFrame);
|
||||
if (!ourFrameFrame) {
|
||||
mInSwap = aOther->mInSwap = PR_FALSE;
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE);
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
class nsIContent;
|
||||
class nsIURI;
|
||||
class nsIFrameFrame;
|
||||
class nsSubDocumentFrame;
|
||||
class nsIView;
|
||||
class nsIInProcessContentFrameMessageManager;
|
||||
class AutoResetInShow;
|
||||
@ -132,7 +132,7 @@ public:
|
||||
*/
|
||||
PRBool Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
||||
PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
|
||||
nsIFrameFrame* frame);
|
||||
nsSubDocumentFrame* frame);
|
||||
|
||||
/**
|
||||
* Called from the layout frame associated with this frame loader, when
|
||||
@ -204,7 +204,7 @@ private:
|
||||
|
||||
// Do the hookup necessary to actually show a remote frame once the view and
|
||||
// widget are available.
|
||||
bool ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view);
|
||||
bool ShowRemoteFrame(nsSubDocumentFrame* frame, nsIView* view);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
|
@ -460,12 +460,12 @@ nsSyncLoadService::PushSyncStreamToListener(nsIInputStream* aIn,
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIInputStream> bufferedStream;
|
||||
if (!NS_InputStreamIsBuffered(aIn)) {
|
||||
PRInt64 chunkSize;
|
||||
PRInt32 chunkSize;
|
||||
rv = aChannel->GetContentLength(&chunkSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
chunkSize = 4096;
|
||||
}
|
||||
chunkSize = NS_MIN(PRInt64(PR_UINT16_MAX), chunkSize);
|
||||
chunkSize = NS_MIN(PRInt32(PR_UINT16_MAX), chunkSize);
|
||||
|
||||
rv = NS_NewBufferedInputStream(getter_AddRefs(bufferedStream), aIn,
|
||||
chunkSize);
|
||||
|
@ -2407,9 +2407,8 @@ NOT_IMPLEMENTED_IF_FUNC_1(GetContentType, nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentType, const nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(GetContentCharset, nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentCharset, const nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(GetContentDisposition, nsACString &value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(GetContentLength, PRInt64 *value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt64 value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(GetContentLength, PRInt32 *value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt32 value)
|
||||
NOT_IMPLEMENTED_IF_FUNC_1(Open, nsIInputStream **_retval)
|
||||
NOT_IMPLEMENTED_IF_FUNC_2(AsyncOpen, nsIStreamListener *listener,
|
||||
nsISupports *context)
|
||||
|
@ -104,16 +104,21 @@ NS_IMETHODIMP WebGLContext::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) { \
|
||||
MakeContextCurrent(); gl->f##glname(a1,a2,a3,a4,a5,a6); return NS_OK; \
|
||||
}
|
||||
|
||||
already_AddRefed<WebGLUniformLocation> WebGLProgram::GetUniformLocationObject(GLint glLocation)
|
||||
already_AddRefed<WebGLUniformLocation>
|
||||
WebGLProgram::GetUniformLocationObject(GLint glLocation)
|
||||
{
|
||||
WebGLUniformLocation *existingLocationObject;
|
||||
if (mMapUniformLocations.Get(glLocation, &existingLocationObject)) {
|
||||
return existingLocationObject;
|
||||
} else {
|
||||
nsRefPtr<WebGLUniformLocation> loc = new WebGLUniformLocation(mContext, this, glLocation);
|
||||
mMapUniformLocations.Put(glLocation, loc);
|
||||
return loc.forget();
|
||||
}
|
||||
|
||||
if (glLocation < 0) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsRefPtr<WebGLUniformLocation> loc = new WebGLUniformLocation(mContext, this, glLocation);
|
||||
mMapUniformLocations.Put(glLocation, loc);
|
||||
return loc.forget();
|
||||
}
|
||||
|
||||
//
|
||||
@ -2983,7 +2988,14 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
s = ShGetObjectCode(compiler);
|
||||
/* If the GL context is really GLES2, we want to use the original provided code,
|
||||
* since it's actually GLES2. We still need to validate it however, which is
|
||||
* why we ran it through the above, but we don't want the desktop GLSL.
|
||||
*/
|
||||
if (!gl->IsGLES2()) {
|
||||
s = ShGetObjectCode(compiler);
|
||||
}
|
||||
|
||||
gl->fShaderSource(shadername, 1, &s, NULL);
|
||||
shader->SetTranslationSuccess();
|
||||
|
||||
|
@ -133,7 +133,7 @@
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
#include "nsIFrameFrame.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
#include "nsIFrameTraversal.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
@ -3649,7 +3649,7 @@ nsEventStateManager::NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto)
|
||||
if (mLastMouseOverFrame) {
|
||||
// if the frame is associated with a subdocument,
|
||||
// tell the subdocument that we're moving out of it
|
||||
nsIFrameFrame* subdocFrame = do_QueryFrame(mLastMouseOverFrame.GetFrame());
|
||||
nsSubDocumentFrame* subdocFrame = do_QueryFrame(mLastMouseOverFrame.GetFrame());
|
||||
if (subdocFrame) {
|
||||
nsCOMPtr<nsIDocShell> docshell;
|
||||
subdocFrame->GetDocShell(getter_AddRefs(docshell));
|
||||
|
@ -972,7 +972,7 @@ nsHTMLInputElement::SetIndeterminateInternal(PRBool aValue,
|
||||
// Repaint the frame
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame)
|
||||
frame->InvalidateOverflowRect();
|
||||
frame->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
// Notify the document so it can update :indeterminate pseudoclass rules
|
||||
@ -1619,7 +1619,7 @@ nsHTMLInputElement::SetCheckedInternal(PRBool aChecked, PRBool aNotify)
|
||||
if (mType == NS_FORM_INPUT_CHECKBOX || mType == NS_FORM_INPUT_RADIO) {
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
frame->InvalidateOverflowRect();
|
||||
frame->InvalidateFrameSubtree();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,20 +265,13 @@ nsWyciwygChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygChannel::GetContentDisposition(nsACString &aContentDisposition)
|
||||
{
|
||||
aContentDisposition.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
nsWyciwygChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsWyciwygChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
mContentLength = aContentLength;
|
||||
|
||||
@ -513,9 +506,10 @@ nsWyciwygChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctx,
|
||||
|
||||
rv = mListener->OnDataAvailable(this, mListenerContext, input, offset, count);
|
||||
|
||||
// XXX handle 64-bit stuff for real
|
||||
if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
|
||||
mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
|
||||
mContentLength);
|
||||
PRUint64(mContentLength));
|
||||
|
||||
return rv; // let the pump cancel on failure
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ protected:
|
||||
PRPackedBool mNeedToWriteCharset;
|
||||
PRInt32 mCharsetSource;
|
||||
nsCString mCharset;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
|
@ -240,7 +240,7 @@ nsMediaChannelStream::OnStartRequest(nsIRequest* aRequest)
|
||||
responseStatus == HTTP_PARTIAL_RESPONSE_CODE)) {
|
||||
// We weren't seeking and got a valid response status,
|
||||
// set the length of the content.
|
||||
PRInt64 cl = -1;
|
||||
PRInt32 cl = -1;
|
||||
hc->GetContentLength(&cl);
|
||||
if (cl >= 0) {
|
||||
mCacheStream.NotifyDataLength(cl);
|
||||
|
@ -21,7 +21,13 @@ var rate = 44100;
|
||||
|
||||
function runTests() {
|
||||
var a1 = new Audio();
|
||||
a1.mozSetup(channels, rate);
|
||||
try {
|
||||
a1.mozSetup(channels, rate);
|
||||
} catch (ex) {
|
||||
todo(false, "Audio hardware is disabled, can't test audio write API");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
is(a1.mozChannels, channels, "mozChannels should be " + channels + ".");
|
||||
is(a1.mozSampleRate, rate, "mozSampleRate should be " + rate + ".");
|
||||
|
@ -18,7 +18,6 @@ function do_progress(e) {
|
||||
var v = e.target;
|
||||
ok(!v._finished, "Check no progress events after completed for " + v._name);
|
||||
ok(e.lengthComputable, "Check progress lengthComputable for " + v._name);
|
||||
ok(e.loaded >= v._last_progress_total, "Check progress increasing: " + e.loaded + " for " + v._name);
|
||||
v._last_progress_total = e.loaded;
|
||||
ok(e.loaded <= e.total, "Check progress in bounds: " + e.loaded + " for " + v._name);
|
||||
is(e.total, v._size, "Check progress total for " + v._name);
|
||||
|
@ -121,9 +121,7 @@ parent:
|
||||
|
||||
__delete__();
|
||||
|
||||
PExternalHelperApp(URI uri, nsCString aMimeContentType,
|
||||
nsCString aContentDisposition, bool aForceSave,
|
||||
PRInt64 aContentLength);
|
||||
PExternalHelperApp(URI uri, nsCString aMimeContentType, bool aForceSave, PRInt64 aContentLength);
|
||||
|
||||
child:
|
||||
CreateWidget(MagicWindowHandle parentWidget);
|
||||
|
@ -1243,7 +1243,6 @@ TabChildGlobal::GetPrincipal()
|
||||
PExternalHelperAppChild*
|
||||
TabChild::AllocPExternalHelperApp(const IPC::URI& uri,
|
||||
const nsCString& aMimeContentType,
|
||||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const PRInt64& aContentLength)
|
||||
{
|
||||
|
@ -227,7 +227,6 @@ public:
|
||||
virtual PExternalHelperAppChild *AllocPExternalHelperApp(
|
||||
const IPC::URI& uri,
|
||||
const nsCString& aMimeContentType,
|
||||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const PRInt64& aContentLength);
|
||||
virtual bool DeallocPExternalHelperApp(PExternalHelperAppChild *aService);
|
||||
|
@ -811,13 +811,12 @@ TabParent::GetFrameLoader() const
|
||||
PExternalHelperAppParent*
|
||||
TabParent::AllocPExternalHelperApp(const IPC::URI& uri,
|
||||
const nsCString& aMimeContentType,
|
||||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const PRInt64& aContentLength)
|
||||
{
|
||||
ExternalHelperAppParent *parent = new ExternalHelperAppParent(uri, aContentLength);
|
||||
parent->AddRef();
|
||||
parent->Init(this, aMimeContentType, aContentDisposition, aForceSave);
|
||||
parent->Init(this, aMimeContentType, aForceSave);
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,6 @@ public:
|
||||
virtual PExternalHelperAppParent* AllocPExternalHelperApp(
|
||||
const IPC::URI& uri,
|
||||
const nsCString& aMimeContentType,
|
||||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const PRInt64& aContentLength);
|
||||
virtual bool DeallocPExternalHelperApp(PExternalHelperAppParent* aService);
|
||||
|
@ -1012,19 +1012,13 @@ nsJSChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::GetContentDisposition(nsACString &aContentDisposition)
|
||||
{
|
||||
return mStreamChannel->GetContentDisposition(aContentDisposition);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
nsJSChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
return mStreamChannel->GetContentLength(aContentLength);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsJSChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
return mStreamChannel->SetContentLength(aContentLength);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
package="org.mozilla.@MOZ_APP_NAME@"
|
||||
android:installLocation="auto"
|
||||
android:versionCode="1"
|
||||
android:versionName=@MOZ_APP_VERSION@
|
||||
android:versionName="@MOZ_APP_VERSION@"
|
||||
android:sharedUserId="org.mozilla.sharedID">
|
||||
<uses-sdk android:minSdkVersion="5"
|
||||
android:targetSdkVersion="5"/>
|
||||
@ -61,10 +61,20 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<receiver android:enabled="true" android:name="Restarter">
|
||||
<intent-filter>
|
||||
|
||||
<activity android:name="NotificationHandler"
|
||||
android:label="@MOZ_APP_DISPLAYNAME@ Notification"
|
||||
android:theme="@android:style/Theme.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="org.mozilla.gecko.ACTION_ALERT_CLICK" />
|
||||
<action android:name="org.mozilla.gecko.ACTION_ALERT_CLEAR" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver android:enabled="true" android:name="Restarter">
|
||||
<intent-filter>
|
||||
<action android:name="org.mozilla.gecko.restart@MOZ_APP_NAME@" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -57,6 +57,9 @@ import android.util.*;
|
||||
abstract public class GeckoApp
|
||||
extends Activity
|
||||
{
|
||||
public static final String ACTION_ALERT_CLICK = "org.mozilla.gecko.ACTION_ALERT_CLICK";
|
||||
public static final String ACTION_ALERT_CLEAR = "org.mozilla.gecko.ACTION_ALERT_CLEAR";
|
||||
|
||||
public static FrameLayout mainLayout;
|
||||
public static GeckoSurfaceView surfaceView;
|
||||
public static GeckoApp mAppContext;
|
||||
@ -431,4 +434,8 @@ abstract public class GeckoApp
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void handleNotification(String action, String alertName, String alertCookie) {
|
||||
GeckoAppShell.handleNotification(action, alertName, alertCookie);
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +91,8 @@ class GeckoAppShell
|
||||
public static native void setSurfaceView(GeckoSurfaceView sv);
|
||||
public static native void putenv(String map);
|
||||
public static native void onResume();
|
||||
public static native void callObserver(String observerKey, String topic, String data);
|
||||
public static native void removeObserver(String observerKey);
|
||||
|
||||
// java-side stuff
|
||||
public static void loadGeckoLibs() {
|
||||
@ -439,4 +441,69 @@ class GeckoAppShell
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setText(text);
|
||||
}
|
||||
|
||||
static void showAlertNotification(String imageUrl, String alertTitle, String alertText,
|
||||
String alertCookie, String alertName) {
|
||||
Log.i("GeckoAppJava", "GeckoAppShell.showAlertNotification\n" +
|
||||
"- image = '" + imageUrl + "'\n" +
|
||||
"- title = '" + alertTitle + "'\n" +
|
||||
"- text = '" + alertText +"'\n" +
|
||||
"- cookie = '" + alertCookie +"'\n" +
|
||||
"- name = '" + alertName + "'");
|
||||
|
||||
int icon = R.drawable.icon; // Just use the app icon by default
|
||||
|
||||
Uri imageUri = Uri.parse(imageUrl);
|
||||
String scheme = imageUri.getScheme();
|
||||
|
||||
if ("drawable".equals(scheme)) {
|
||||
String resource = imageUri.getSchemeSpecificPart();
|
||||
if ("//alertdownloads".equals(resource))
|
||||
icon = R.drawable.alertdownloads;
|
||||
else if ("//alertaddons".equals(resource))
|
||||
icon = R.drawable.alertaddons;
|
||||
}
|
||||
|
||||
int notificationID = alertName.hashCode();
|
||||
|
||||
Notification notification = new Notification(icon, alertTitle, System.currentTimeMillis());
|
||||
|
||||
// The intent to launch when the user clicks the expanded notification
|
||||
Intent notificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLICK);
|
||||
notificationIntent.setClassName(GeckoApp.mAppContext,
|
||||
"org.mozilla." + GeckoApp.mAppContext.getAppName() + ".NotificationHandler");
|
||||
|
||||
// Put the strings into the intent as an URI "alert:<name>#<cookie>"
|
||||
Uri dataUri = Uri.fromParts("alert", alertName, alertCookie);
|
||||
notificationIntent.setData(dataUri);
|
||||
|
||||
PendingIntent contentIntent = PendingIntent.getActivity(GeckoApp.mAppContext, 0, notificationIntent, 0);
|
||||
notification.setLatestEventInfo(GeckoApp.mAppContext, alertTitle, alertText, contentIntent);
|
||||
|
||||
// The intent to execute when the status entry is deleted by the user with the "Clear All Notifications" button
|
||||
Intent clearNotificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLEAR);
|
||||
clearNotificationIntent.setClassName(GeckoApp.mAppContext,
|
||||
"org.mozilla." + GeckoApp.mAppContext.getAppName() + ".NotificationHandler");
|
||||
clearNotificationIntent.setData(dataUri);
|
||||
|
||||
PendingIntent pendingClearIntent = PendingIntent.getActivity(GeckoApp.mAppContext, 0, clearNotificationIntent, 0);
|
||||
notification.deleteIntent = pendingClearIntent;
|
||||
|
||||
// Show the notification
|
||||
NotificationManager notificationManager = (NotificationManager)
|
||||
GeckoApp.mAppContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(notificationID, notification);
|
||||
Log.i("GeckoAppJava", "Created notification ID " + notificationID);
|
||||
}
|
||||
|
||||
public static void handleNotification(String action, String alertName, String alertCookie) {
|
||||
if (GeckoApp.ACTION_ALERT_CLICK.equals(action)) {
|
||||
Log.i("GeckoAppJava", "GeckoAppShell.handleNotification: callObserver(alertclickcallback)");
|
||||
callObserver(alertName, "alertclickcallback", alertCookie);
|
||||
}
|
||||
|
||||
Log.i("GeckoAppJava", "GeckoAppShell.handleNotification: callObserver(alertfinished)");
|
||||
callObserver(alertName, "alertfinished", alertCookie);
|
||||
removeObserver(alertName);
|
||||
}
|
||||
}
|
||||
|
@ -51,17 +51,23 @@ JAVAFILES = \
|
||||
GeckoInputConnection.java \
|
||||
$(NULL)
|
||||
|
||||
PROCESSEDJAVAFILES = \
|
||||
App.java \
|
||||
Restarter.java \
|
||||
NotificationHandler.java \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += \
|
||||
-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
|
||||
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
|
||||
-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
|
||||
-DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
||||
|
||||
GARBAGE += \
|
||||
AndroidManifest.xml \
|
||||
classes.dex \
|
||||
$(MOZ_APP_NAME).apk \
|
||||
App.java \
|
||||
Restarter.java \
|
||||
$(PROCESSEDJAVAFILES) \
|
||||
gecko.ap_ \
|
||||
gecko-unaligned.apk \
|
||||
gecko-unsigned-unaligned.apk \
|
||||
@ -74,12 +80,22 @@ DIRS = utils
|
||||
# Bug 567884 - Need a way to find appropriate icons during packaging
|
||||
ifeq ($(MOZ_APP_NAME),fennec)
|
||||
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
|
||||
ICON_PATH_HI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
|
||||
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
|
||||
else
|
||||
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
|
||||
ICON_PATH_HI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
|
||||
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
|
||||
endif
|
||||
|
||||
RES_DRAWABLE = \
|
||||
res/drawable/alertaddons.png \
|
||||
res/drawable/alertdownloads.png \
|
||||
$(NULL)
|
||||
|
||||
RES_DRAWABLE_HDPI = \
|
||||
res/drawable-hdpi/alertaddons.png \
|
||||
res/drawable-hdpi/alertdownloads.png \
|
||||
$(NULL)
|
||||
|
||||
NATIVE_LIBS = $(shell cat $(DIST)/bin/dependentlibs.list) libxpcom.so libnssckbi.so libfreebl3.so libmozutils.so
|
||||
FULL_LIBS = $(addprefix libs/armeabi/,$(NATIVE_LIBS))
|
||||
|
||||
@ -120,12 +136,12 @@ tools:: $(MOZ_APP_NAME).apk
|
||||
|
||||
# Note that we're going to set up a dependency directly between embed_android.dex and the java files
|
||||
# Instead of on the .class files, since more than one .class file might be produced per .java file
|
||||
classes.dex: $(JAVAFILES) App.java Restarter.java
|
||||
classes.dex: $(JAVAFILES) $(PROCESSEDJAVAFILES) R.java
|
||||
$(NSINSTALL) -D classes
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES)) App.java Restarter.java
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES)) $(PROCESSEDJAVAFILES) R.java
|
||||
$(DX) --dex --output=$@ classes
|
||||
|
||||
AndroidManifest.xml App.java Restarter.java : % : %.in
|
||||
AndroidManifest.xml $(PROCESSEDJAVAFILES): % : %.in
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
|
||||
$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
|
||||
|
||||
@ -135,9 +151,20 @@ res/drawable/icon.png: $(MOZ_APP_ICON)
|
||||
|
||||
res/drawable-hdpi/icon.png: $(MOZ_APP_ICON)
|
||||
$(NSINSTALL) -D res/drawable-hdpi
|
||||
cp $(ICON_PATH_HI) $@
|
||||
cp $(ICON_PATH_HDPI) $@
|
||||
|
||||
gecko.ap_: AndroidManifest.xml res/drawable/icon.png res/drawable-hdpi/icon.png
|
||||
$(RES_DRAWABLE):
|
||||
$(NSINSTALL) -D res/drawable
|
||||
cp $(topsrcdir)/mobile/app/android/drawable/* res/drawable/
|
||||
|
||||
$(RES_DRAWABLE_HDPI):
|
||||
$(NSINSTALL) -D res/drawable-hdpi
|
||||
cp $(topsrcdir)/mobile/app/android/drawable-hdpi/* res/drawable-hdpi/
|
||||
|
||||
R.java: $(MOZ_APP_ICON) $(RES_DRAWABLE) $(RES_DRAWABLE_HDPI)
|
||||
$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko
|
||||
|
||||
gecko.ap_: AndroidManifest.xml res/drawable/icon.png res/drawable-hdpi/icon.png $(RES_DRAWABLE) $(RES_DRAWABLE_HDPI)
|
||||
$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -F $@
|
||||
|
||||
libs/armeabi/%: $(DIST)/lib/%
|
||||
|
104
embedding/android/NotificationHandler.java.in
Normal file
104
embedding/android/NotificationHandler.java.in
Normal file
@ -0,0 +1,104 @@
|
||||
/* -*- Mode: Java; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* ***** 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 Android code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@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 ***** */
|
||||
|
||||
#filter substitution
|
||||
package org.mozilla.@MOZ_APP_NAME@;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Intent;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.net.Uri;
|
||||
|
||||
public class NotificationHandler
|
||||
extends Activity
|
||||
{
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.i("GeckoAppJava", "NotificationHandler.onCreate");
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null)
|
||||
handleIntent(intent);
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
protected void handleIntent(Intent notificationIntent) {
|
||||
String action = notificationIntent.getAction();
|
||||
String alertName = "";
|
||||
String alertCookie = "";
|
||||
Uri data = notificationIntent.getData();
|
||||
if (data != null) {
|
||||
alertName = data.getSchemeSpecificPart();
|
||||
alertCookie = data.getFragment();
|
||||
if (alertCookie == null)
|
||||
alertCookie = "";
|
||||
}
|
||||
|
||||
Log.i("GeckoAppJava", "NotificationHandler.handleIntent\n" +
|
||||
"- action = '" + action + "'\n" +
|
||||
"- alertName = '" + alertName + "'\n" +
|
||||
"- alertCookie = '" + alertCookie + "'");
|
||||
|
||||
int notificationID = alertName.hashCode();
|
||||
|
||||
Log.i("GeckoAppJava", "Handle notification ID " + notificationID);
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
notificationManager.cancel(notificationID);
|
||||
|
||||
if (App.mAppContext != null) {
|
||||
// This should call the observer, if any
|
||||
App.mAppContext.handleNotification(action, alertName, alertCookie);
|
||||
}
|
||||
|
||||
if (App.ACTION_ALERT_CLICK.equals(action)) {
|
||||
// Start or bring to front the main activity
|
||||
Intent appIntent = new Intent(Intent.ACTION_MAIN);
|
||||
appIntent.setClassName(this, "org.mozilla.@MOZ_APP_NAME@.App");
|
||||
try {
|
||||
startActivity(appIntent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e("GeckoAppJava", "NotificationHandler Exception: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -905,7 +905,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(
|
||||
}
|
||||
}
|
||||
|
||||
PRInt64 channelContentLength = -1;
|
||||
PRInt32 channelContentLength = -1;
|
||||
if (!cancel &&
|
||||
NS_SUCCEEDED(channel->GetContentLength(&channelContentLength)))
|
||||
{
|
||||
|
@ -350,7 +350,7 @@ class nsGnomeVFSInputStream : public nsIInputStream
|
||||
: mSpec(uriSpec)
|
||||
, mChannel(nsnull)
|
||||
, mHandle(nsnull)
|
||||
, mBytesRemaining(LL_MAXUINT)
|
||||
, mBytesRemaining(PR_UINT32_MAX)
|
||||
, mStatus(NS_OK)
|
||||
, mDirList(nsnull)
|
||||
, mDirListPtr(nsnull)
|
||||
@ -386,7 +386,7 @@ class nsGnomeVFSInputStream : public nsIInputStream
|
||||
nsCString mSpec;
|
||||
nsIChannel *mChannel; // manually refcounted
|
||||
GnomeVFSHandle *mHandle;
|
||||
PRUint64 mBytesRemaining;
|
||||
PRUint32 mBytesRemaining;
|
||||
nsresult mStatus;
|
||||
GList *mDirList;
|
||||
GList *mDirListPtr;
|
||||
@ -460,11 +460,12 @@ nsGnomeVFSInputStream::DoOpen()
|
||||
if (info.mime_type && (strcmp(info.mime_type, APPLICATION_OCTET_STREAM) != 0))
|
||||
SetContentTypeOfChannel(info.mime_type);
|
||||
|
||||
mBytesRemaining = info.size;
|
||||
// XXX truncates size from 64-bit to 32-bit
|
||||
mBytesRemaining = (PRUint32) info.size;
|
||||
|
||||
// Update the content length attribute on the channel. We do this
|
||||
// synchronously without proxying. This hack is not as bad as it looks!
|
||||
if (mBytesRemaining != PRUint64(-1))
|
||||
if (mBytesRemaining != PR_UINT32_MAX)
|
||||
mChannel->SetContentLength(mBytesRemaining);
|
||||
}
|
||||
else
|
||||
@ -508,7 +509,6 @@ nsGnomeVFSInputStream::DoRead(char *aBuf, PRUint32 aCount, PRUint32 *aCountRead)
|
||||
rv = gnome_vfs_read(mHandle, aBuf, aCount, &bytesRead);
|
||||
if (rv == GNOME_VFS_OK)
|
||||
{
|
||||
// XXX 64-bit here
|
||||
*aCountRead = (PRUint32) bytesRead;
|
||||
mBytesRemaining -= *aCountRead;
|
||||
}
|
||||
@ -704,7 +704,6 @@ nsGnomeVFSInputStream::Available(PRUint32 *aResult)
|
||||
if (NS_FAILED(mStatus))
|
||||
return mStatus;
|
||||
|
||||
// XXX 64-bit here
|
||||
*aResult = mBytesRemaining;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -690,6 +690,9 @@ GLContext::ResizeOffscreenFBO(const gfxIntSize& aSize)
|
||||
// can restore them.
|
||||
fViewport(0, 0, aSize.width, aSize.height);
|
||||
|
||||
// Clear the new framebuffer with the full viewport
|
||||
ClearSafely();
|
||||
|
||||
// Ok, now restore the GL state back to what it was before the resize took place.
|
||||
fBindTexture(LOCAL_GL_TEXTURE_2D, curBoundTexture);
|
||||
fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, curBoundRenderbuffer);
|
||||
@ -700,8 +703,6 @@ GLContext::ResizeOffscreenFBO(const gfxIntSize& aSize)
|
||||
if (!firstTime)
|
||||
fViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
|
||||
|
||||
ClearSafely();
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,8 @@
|
||||
#include "plbase64.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
|
||||
#include "nsIGfxInfo.h"
|
||||
|
||||
#ifdef MOZ_FT2_FONTS
|
||||
#include "ft2build.h"
|
||||
#include FT_FREETYPE_H
|
||||
@ -228,22 +230,39 @@ gfxWindowsPlatform::gfxWindowsPlatform()
|
||||
::GetVersionExA(&versionInfo);
|
||||
bool isVistaOrHigher = versionInfo.dwMajorVersion >= 6;
|
||||
|
||||
PRBool safeMode = PR_FALSE;
|
||||
nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
|
||||
if (xr)
|
||||
xr->GetInSafeMode(&safeMode);
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
PRBool d2dDisabled = PR_FALSE;
|
||||
PRBool d2dBlocked = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo) {
|
||||
PRInt32 status;
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT2D, &status))) {
|
||||
if (status != nsIGfxInfo::FEATURE_STATUS_UNKNOWN &&
|
||||
status != nsIGfxInfo::FEATURE_AVAILABLE)
|
||||
{
|
||||
d2dDisabled = PR_TRUE;
|
||||
if (status == nsIGfxInfo::FEATURE_BLOCKED) {
|
||||
d2dBlocked = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_RegisterMemoryReporter(new D2DCacheReporter());
|
||||
NS_RegisterMemoryReporter(new D2DVRAMReporter());
|
||||
mD2DDevice = NULL;
|
||||
|
||||
PRBool d2dDisabled = PR_FALSE;
|
||||
nsresult rv = pref->GetBoolPref("gfx.direct2d.disabled", &d2dDisabled);
|
||||
if (NS_FAILED(rv))
|
||||
d2dDisabled = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
|
||||
PRBool safeMode = PR_FALSE;
|
||||
if (xr)
|
||||
xr->GetInSafeMode(&safeMode);
|
||||
|
||||
if (isVistaOrHigher && !d2dDisabled && !safeMode) {
|
||||
if (isVistaOrHigher && !d2dDisabled && !d2dBlocked && !safeMode) {
|
||||
// We need a DWriteFactory to work.
|
||||
HMODULE d3d10module = LoadLibraryA("d3d10_1.dll");
|
||||
D3D10CreateDevice1Func createD3DDevice = (D3D10CreateDevice1Func)
|
||||
@ -329,9 +348,9 @@ gfxWindowsPlatform::gfxWindowsPlatform()
|
||||
NS_SUCCEEDED(pref->GetIntPref("mozilla.widget.render-mode", &rmode))) {
|
||||
if (rmode >= 0 && rmode < RENDER_MODE_MAX) {
|
||||
#ifdef CAIRO_HAS_DWRITE_FONT
|
||||
if (rmode != RENDER_DIRECT2D && !useDirectWrite) {
|
||||
mDWriteFactory = nsnull;
|
||||
}
|
||||
if (rmode != RENDER_DIRECT2D && !useDirectWrite) {
|
||||
mDWriteFactory = nsnull;
|
||||
}
|
||||
#endif
|
||||
#ifndef CAIRO_HAS_DDRAW_SURFACE
|
||||
if (rmode == RENDER_DDRAW || rmode == RENDER_DDRAW_GL)
|
||||
@ -341,8 +360,12 @@ gfxWindowsPlatform::gfxWindowsPlatform()
|
||||
#ifndef CAIRO_HAS_D2D_SURFACE
|
||||
return;
|
||||
#else
|
||||
if (d2dBlocked) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mD2DDevice) {
|
||||
mD2DDevice = cairo_d2d_create_device();
|
||||
mD2DDevice = cairo_d2d_create_device();
|
||||
if (!mD2DDevice) {
|
||||
return;
|
||||
}
|
||||
@ -369,7 +392,7 @@ gfxWindowsPlatform::~gfxWindowsPlatform()
|
||||
// these FT_Faces. See bug 458169.
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (mD2DDevice) {
|
||||
cairo_release_device(mD2DDevice);
|
||||
cairo_release_device(mD2DDevice);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -44,10 +44,36 @@
|
||||
* done by SpiderMonkey.
|
||||
*/
|
||||
|
||||
Narcissus = {
|
||||
options: { version: 185 },
|
||||
hostGlobal: this
|
||||
};
|
||||
(function() {
|
||||
var builderTypes = Object.create(null, {
|
||||
"default": { value: function() {
|
||||
return new narcissus.parser.DefaultBuilder;
|
||||
} },
|
||||
"ssa": { value: function() {
|
||||
return new narcissus.parser.SSABuilder;
|
||||
} }
|
||||
});
|
||||
|
||||
var builderType;
|
||||
|
||||
var narcissus = {
|
||||
options: {
|
||||
version: 185,
|
||||
get builderType() { return builderType },
|
||||
set builderType(type) {
|
||||
var ctor = builderTypes[type];
|
||||
|
||||
if (!ctor)
|
||||
throw new Error("expected builder type ('default' or 'ssa'), got " + type);
|
||||
|
||||
builderType = type;
|
||||
narcissus.definitions.Builder = ctor;
|
||||
}
|
||||
},
|
||||
hostGlobal: this
|
||||
};
|
||||
Narcissus = narcissus;
|
||||
})();
|
||||
|
||||
Narcissus.definitions = (function() {
|
||||
|
||||
@ -270,7 +296,11 @@ Narcissus.definitions = (function() {
|
||||
defineGetter: defineGetter,
|
||||
defineProperty: defineProperty,
|
||||
isNativeCode: isNativeCode,
|
||||
makePassthruHandler: makePassthruHandler
|
||||
makePassthruHandler: makePassthruHandler,
|
||||
Builder: function() {
|
||||
throw new Error("no Builder type selected");
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
Narcissus.options.builderType = "default";
|
||||
|
@ -85,7 +85,7 @@ Narcissus.interpreter = (function() {
|
||||
x2.callee = x.callee;
|
||||
x2.scope = x.scope;
|
||||
try {
|
||||
x2.execute(parser.parse(new parser.DefaultBuilder, s));
|
||||
x2.execute(parser.parse(new definitions.Builder, s));
|
||||
return x2.result;
|
||||
} catch (e if e instanceof SyntaxError || isStackOverflow(e)) {
|
||||
/*
|
||||
@ -119,7 +119,7 @@ Narcissus.interpreter = (function() {
|
||||
|
||||
// NB: Use the STATEMENT_FORM constant since we don't want to push this
|
||||
// function onto the fake compilation context.
|
||||
var x = { builder: new parser.DefaultBuilder };
|
||||
var x = { builder: new definitions.Builder };
|
||||
var f = parser.FunctionDefinition(t, x, false, parser.STATEMENT_FORM);
|
||||
var s = {object: global, parent: null};
|
||||
return newFunction(f,{scope:s});
|
||||
@ -1023,7 +1023,7 @@ Narcissus.interpreter = (function() {
|
||||
return s;
|
||||
|
||||
var x = new ExecutionContext(GLOBAL_CODE);
|
||||
x.execute(parser.parse(new parser.DefaultBuilder, s, f, l));
|
||||
x.execute(parser.parse(new definitions.Builder, s, f, l));
|
||||
return x.result;
|
||||
}
|
||||
|
||||
@ -1059,7 +1059,7 @@ Narcissus.interpreter = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
var b = new parser.DefaultBuilder;
|
||||
var b = new definitions.Builder;
|
||||
var x = new ExecutionContext(GLOBAL_CODE);
|
||||
|
||||
ExecutionContext.current = x;
|
||||
|
@ -2328,6 +2328,9 @@ Narcissus.parser = (function() {
|
||||
parse: parse,
|
||||
Node: Node,
|
||||
DefaultBuilder: DefaultBuilder,
|
||||
get SSABuilder() {
|
||||
throw new Error("SSA builder not yet supported");
|
||||
},
|
||||
bindSubBuilders: bindSubBuilders,
|
||||
DECLARED_FORM: DECLARED_FORM,
|
||||
EXPRESSED_FORM: EXPRESSED_FORM,
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
/* If compiled for profiling, call `_mcount' at the start of each function. */
|
||||
#ifdef PROF
|
||||
/* The mcount code relies on the return address being on the stack
|
||||
/* The mcount code relies on a the return address being on the stack
|
||||
to locate our caller and so it can restore it; so store one just
|
||||
for its benefit. */
|
||||
#ifdef PIC
|
||||
|
@ -1136,7 +1136,12 @@ JSObject::makeDenseArraySlow(JSContext *cx)
|
||||
JS_ASSERT(js_SlowArrayClass.flags & JSCLASS_HAS_PRIVATE);
|
||||
voidDenseOnlyArraySlots();
|
||||
|
||||
/* Finally, update class. */
|
||||
/*
|
||||
* Finally, update class. If |this| is Array.prototype, then js_InitClass
|
||||
* will create an emptyShape whose class is &js_SlowArrayClass, to ensure
|
||||
* that delegating instances can share shapes in the tree rooted at the
|
||||
* proto's empty shape.
|
||||
*/
|
||||
clasp = &js_SlowArrayClass;
|
||||
return true;
|
||||
}
|
||||
@ -3037,8 +3042,14 @@ js_InitArrayClass(JSContext *cx, JSObject *obj)
|
||||
NULL, array_methods, NULL, array_static_methods);
|
||||
if (!proto)
|
||||
return NULL;
|
||||
proto->setArrayLength(0);
|
||||
|
||||
/*
|
||||
* Assert that js_InitClass used the correct (slow array, not dense array)
|
||||
* class for proto's emptyShape class.
|
||||
*/
|
||||
JS_ASSERT(proto->emptyShape->getClass() == proto->getClass());
|
||||
|
||||
proto->setArrayLength(0);
|
||||
return proto;
|
||||
}
|
||||
|
||||
|
@ -1407,6 +1407,7 @@ struct JSRuntime {
|
||||
size_t gcLastBytes;
|
||||
size_t gcMaxBytes;
|
||||
size_t gcMaxMallocBytes;
|
||||
size_t gcNewArenaTriggerBytes;
|
||||
uint32 gcEmptyArenaPoolLifespan;
|
||||
uint32 gcNumber;
|
||||
js::GCMarker *gcMarkingTracer;
|
||||
|
@ -633,7 +633,9 @@ static JSGCArena *
|
||||
NewGCArena(JSContext *cx)
|
||||
{
|
||||
JSRuntime *rt = cx->runtime;
|
||||
if (!JS_THREAD_DATA(cx)->waiveGCQuota && rt->gcBytes >= rt->gcMaxBytes) {
|
||||
if (!JS_THREAD_DATA(cx)->waiveGCQuota &&
|
||||
(rt->gcBytes >= rt->gcMaxBytes ||
|
||||
rt->gcBytes > GC_HEAP_GROWTH_FACTOR * rt->gcNewArenaTriggerBytes)) {
|
||||
/*
|
||||
* FIXME bug 524051 We cannot run a last-ditch GC on trace for now, so
|
||||
* just pretend we are out of memory which will throw us off trace and
|
||||
@ -952,6 +954,7 @@ js_InitGC(JSRuntime *rt, uint32 maxbytes)
|
||||
* (during JS engine start).
|
||||
*/
|
||||
rt->setGCLastBytes(8192);
|
||||
rt->gcNewArenaTriggerBytes = GC_ARENA_ALLOCATION_TRIGGER;
|
||||
|
||||
METER(PodZero(&rt->gcStats));
|
||||
return true;
|
||||
@ -2784,6 +2787,11 @@ GC(JSContext *cx GCTIMER_PARAM)
|
||||
++i) {
|
||||
FinalizeArenaList<JSString, FinalizeExternalString>(cx, i);
|
||||
}
|
||||
|
||||
rt->gcNewArenaTriggerBytes = rt->gcBytes < GC_ARENA_ALLOCATION_TRIGGER ?
|
||||
GC_ARENA_ALLOCATION_TRIGGER :
|
||||
rt->gcBytes;
|
||||
|
||||
TIMESTAMP(sweepStringEnd);
|
||||
|
||||
SweepCompartments(cx);
|
||||
|
@ -65,6 +65,18 @@
|
||||
*/
|
||||
#define JSTRACE_LIMIT 3
|
||||
|
||||
/*
|
||||
* Lower limit after which we limit the heap growth
|
||||
*/
|
||||
const size_t GC_ARENA_ALLOCATION_TRIGGER = 25 * js::GC_CHUNK_SIZE;
|
||||
|
||||
/*
|
||||
* A GC is triggered once the number of newly allocated arenas
|
||||
* is 1.5 times the number of live arenas after the last GC.
|
||||
* (Starting after the lower limit of GC_ARENA_ALLOCATION_TRIGGER)
|
||||
*/
|
||||
const float GC_HEAP_GROWTH_FACTOR = 1.5;
|
||||
|
||||
const uintN JS_EXTERNAL_STRING_LIMIT = 8;
|
||||
|
||||
/*
|
||||
|
@ -3450,12 +3450,13 @@ js_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
|
||||
* Object.prototype.)
|
||||
*
|
||||
* All callers of JSObject::initSharingEmptyShape depend on this.
|
||||
*
|
||||
* FIXME: bug 592296 -- js_InitArrayClass should pass &js_SlowArrayClass
|
||||
* and make the Array.prototype slow from the start.
|
||||
*/
|
||||
bool ok;
|
||||
JS_LOCK_OBJ(cx, proto);
|
||||
ok = proto->getEmptyShape(cx, clasp);
|
||||
JS_UNLOCK_OBJ(cx, proto);
|
||||
if (!ok)
|
||||
JS_ASSERT_IF(proto->clasp != clasp,
|
||||
clasp == &js_ArrayClass && proto->clasp == &js_SlowArrayClass);
|
||||
if (!proto->getEmptyShape(cx, proto->clasp))
|
||||
goto bad;
|
||||
|
||||
/* If this is a standard class, cache its prototype. */
|
||||
|
@ -35,13 +35,18 @@ if __name__ == '__main__':
|
||||
help='enable interactive shell')
|
||||
op.add_option('-H', '--harmony', dest='js_harmony', action='store_true',
|
||||
help='enable ECMAScript Harmony mode')
|
||||
op.add_option('-S', '--ssa', dest='js_ssa', action='store_true',
|
||||
help='enable parse-time SSA construction')
|
||||
|
||||
(options, args) = op.parse_args()
|
||||
|
||||
cmd = ""
|
||||
|
||||
if options.js_harmony:
|
||||
cmd += 'Narcissus.options={version:"harmony"}; '
|
||||
cmd += 'Narcissus.options.version = "harmony"; '
|
||||
|
||||
if options.js_ssa:
|
||||
cmd += 'Narcissus.options.builderType = "ssa"; '
|
||||
|
||||
if options.js_exps:
|
||||
for exp in options.js_exps:
|
||||
|
@ -75,16 +75,22 @@
|
||||
#endif
|
||||
#include "jsxdrapi.h"
|
||||
#include "jsprf.h"
|
||||
#include "nsIFastLoadFileControl.h"
|
||||
// For reporting errors with the console service
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIStorageStream.h"
|
||||
#include "nsIStringStream.h"
|
||||
#include "prmem.h"
|
||||
#include "plbase64.h"
|
||||
#if defined(XP_WIN)
|
||||
#include "nsILocalFileWin.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
#include "mozilla/scache/StartupCache.h"
|
||||
#include "mozilla/scache/StartupCacheUtils.h"
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_SHARK) || defined(MOZ_CALLGRIND) || defined(MOZ_VTUNE) || defined(MOZ_TRACEVIS)
|
||||
#include "jsdbgapi.h"
|
||||
#endif
|
||||
@ -107,9 +113,6 @@ static const char kObserverServiceContractID[] = "@mozilla.org/observer-service;
|
||||
#define XPC_SERIALIZATION_BUFFER_SIZE (64 * 1024)
|
||||
#define XPC_DESERIALIZATION_BUFFER_SIZE (12 * 8192)
|
||||
|
||||
// Inactivity delay before closing our fastload file stream.
|
||||
static const int kFastLoadWriteDelay = 10000; // 10 seconds
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
// NSPR_LOG_MODULES=JSComponentLoader:5
|
||||
static PRLogModuleInfo *gJSCLLog;
|
||||
@ -388,59 +391,6 @@ ReportOnCaller(JSCLContextHelper &helper,
|
||||
return OutputError(cx, format, ap);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsXPCFastLoadIO, nsIFastLoadFileIO)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPCFastLoadIO::GetInputStream(nsIInputStream **_retval)
|
||||
{
|
||||
if (! mInputStream) {
|
||||
nsCOMPtr<nsIInputStream> fileInput;
|
||||
nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(fileInput),
|
||||
mFile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = NS_NewBufferedInputStream(getter_AddRefs(mInputStream),
|
||||
fileInput,
|
||||
XPC_DESERIALIZATION_BUFFER_SIZE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mTruncateOutputFile = false;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval = mInputStream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPCFastLoadIO::GetOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
if (! mOutputStream) {
|
||||
PRInt32 ioFlags = PR_WRONLY;
|
||||
if (mTruncateOutputFile) {
|
||||
ioFlags |= PR_CREATE_FILE | PR_TRUNCATE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIOutputStream> fileOutput;
|
||||
nsresult rv = NS_NewLocalFileOutputStream(getter_AddRefs(fileOutput),
|
||||
mFile, ioFlags, 0644);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = NS_NewBufferedOutputStream(getter_AddRefs(mOutputStream),
|
||||
fileOutput,
|
||||
XPC_SERIALIZATION_BUFFER_SIZE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval = mOutputStream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPCFastLoadIO::DisableTruncate()
|
||||
{
|
||||
mTruncateOutputFile = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
ReadScriptFromStream(JSContext *cx, nsIObjectInputStream *stream,
|
||||
JSScript **script)
|
||||
@ -566,9 +516,6 @@ mozJSComponentLoader::~mozJSComponentLoader()
|
||||
UnloadModules();
|
||||
}
|
||||
|
||||
NS_ASSERTION(!mFastLoadTimer,
|
||||
"Fastload file should have been closed via xpcom-shutdown");
|
||||
|
||||
sSelf = nsnull;
|
||||
}
|
||||
|
||||
@ -584,9 +531,9 @@ nsresult
|
||||
mozJSComponentLoader::ReallyInit()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
||||
/*
|
||||
* Get the JSRuntime from the runtime svc, if possible.
|
||||
* We keep a reference around, because it's a Bad Thing if the runtime
|
||||
@ -634,23 +581,10 @@ mozJSComponentLoader::ReallyInit()
|
||||
if (!mInProgressImports.Init(32))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// Set up our fastload file
|
||||
nsCOMPtr<nsIFastLoadService> flSvc = do_GetFastLoadService(&rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = flSvc->NewFastLoadFile("XPC", getter_AddRefs(mFastLoadFile));
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("Could not get fastload file location\n"));
|
||||
}
|
||||
|
||||
// Listen for xpcom-shutdown so that we can close out our fastload file
|
||||
// at that point (after that we can no longer create an input stream).
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
do_GetService(kObserverServiceContractID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = obsSvc->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = obsSvc->AddObserver(this, "xpcom-shutdown-loaders", PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -932,245 +866,66 @@ class JSScriptHolder
|
||||
JSScript *mScript;
|
||||
};
|
||||
|
||||
class FastLoadStateHolder
|
||||
{
|
||||
public:
|
||||
explicit FastLoadStateHolder(nsIFastLoadService *service);
|
||||
~FastLoadStateHolder() { pop(); }
|
||||
|
||||
void pop();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIFastLoadService> mService;
|
||||
nsCOMPtr<nsIFastLoadFileIO> mIO;
|
||||
nsCOMPtr<nsIObjectInputStream> mInputStream;
|
||||
nsCOMPtr<nsIObjectOutputStream> mOutputStream;
|
||||
};
|
||||
|
||||
FastLoadStateHolder::FastLoadStateHolder(nsIFastLoadService *service)
|
||||
{
|
||||
if (!service)
|
||||
return;
|
||||
|
||||
mService = service;
|
||||
service->GetFileIO(getter_AddRefs(mIO));
|
||||
service->GetInputStream(getter_AddRefs(mInputStream));
|
||||
service->GetOutputStream(getter_AddRefs(mOutputStream));
|
||||
}
|
||||
|
||||
void
|
||||
FastLoadStateHolder::pop()
|
||||
{
|
||||
if (!mService)
|
||||
return;
|
||||
|
||||
mService->SetFileIO(mIO);
|
||||
mService->SetInputStream(mInputStream);
|
||||
mService->SetOutputStream(mOutputStream);
|
||||
|
||||
mService = nsnull;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
mozJSComponentLoader::CloseFastLoad(nsITimer *timer, void *closure)
|
||||
{
|
||||
static_cast<mozJSComponentLoader*>(closure)->CloseFastLoad();
|
||||
}
|
||||
|
||||
void
|
||||
mozJSComponentLoader::CloseFastLoad()
|
||||
{
|
||||
// Close our fastload streams
|
||||
LOG(("Closing fastload file\n"));
|
||||
if (mFastLoadOutput) {
|
||||
nsresult rv = mFastLoadOutput->Close();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIFastLoadService> flSvc = do_GetFastLoadService(&rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
flSvc->CacheChecksum(mFastLoadFile, mFastLoadOutput);
|
||||
}
|
||||
}
|
||||
mFastLoadOutput = nsnull;
|
||||
}
|
||||
if (mFastLoadInput) {
|
||||
mFastLoadInput->Close();
|
||||
mFastLoadInput = nsnull;
|
||||
}
|
||||
|
||||
mFastLoadIO = nsnull;
|
||||
mFastLoadTimer = nsnull;
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
nsresult
|
||||
mozJSComponentLoader::StartFastLoad(nsIFastLoadService *flSvc)
|
||||
{
|
||||
if (!mFastLoadFile || !flSvc) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
// Now set our IO object as current, and create our streams.
|
||||
if (!mFastLoadIO) {
|
||||
mFastLoadIO = new nsXPCFastLoadIO(mFastLoadFile);
|
||||
NS_ENSURE_TRUE(mFastLoadIO, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
nsresult rv = flSvc->SetFileIO(mFastLoadIO);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!mFastLoadInput && !mFastLoadOutput) {
|
||||
// First time accessing the fastload file
|
||||
PRBool exists;
|
||||
mFastLoadFile->Exists(&exists);
|
||||
if (exists) {
|
||||
LOG(("trying to use existing fastload file\n"));
|
||||
|
||||
rv = flSvc->NewInputStream(mFastLoadFile, getter_AddRefs(mFastLoadInput));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
LOG(("opened fastload file for reading\n"));
|
||||
|
||||
nsCOMPtr<nsIFastLoadReadControl>
|
||||
readControl(do_QueryInterface(mFastLoadInput));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
/* Get the JS bytecode version number and validate it. */
|
||||
PRUint32 version;
|
||||
rv = mFastLoadInput->Read32(&version);
|
||||
if (NS_SUCCEEDED(rv) && version != JSXDR_BYTECODE_VERSION) {
|
||||
LOG(("Bad JS bytecode version\n"));
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("Invalid fastload file detected, removing it\n"));
|
||||
if (mFastLoadInput) {
|
||||
mFastLoadInput->Close();
|
||||
mFastLoadInput = nsnull;
|
||||
}
|
||||
mFastLoadIO->SetInputStream(nsnull);
|
||||
mFastLoadFile->Remove(PR_FALSE);
|
||||
exists = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
LOG(("Creating new fastload file\n"));
|
||||
|
||||
nsCOMPtr<nsIOutputStream> output;
|
||||
rv = mFastLoadIO->GetOutputStream(getter_AddRefs(output));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = flSvc->NewOutputStream(output,
|
||||
getter_AddRefs(mFastLoadOutput));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = mFastLoadOutput->Write32(JSXDR_BYTECODE_VERSION);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("Fatal error, could not create fastload file\n"));
|
||||
|
||||
if (mFastLoadOutput) {
|
||||
mFastLoadOutput->Close();
|
||||
mFastLoadOutput = nsnull;
|
||||
} else {
|
||||
output->Close();
|
||||
}
|
||||
mFastLoadIO->SetOutputStream(nsnull);
|
||||
mFastLoadFile->Remove(PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flSvc->SetInputStream(mFastLoadInput);
|
||||
flSvc->SetOutputStream(mFastLoadOutput);
|
||||
|
||||
// Start our update timer. This allows us to keep the stream open
|
||||
// when many components are loaded in succession, but close it once
|
||||
// there has been a period of inactivity.
|
||||
|
||||
if (!mFastLoadTimer) {
|
||||
mFastLoadTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mFastLoadTimer->InitWithFuncCallback(&mozJSComponentLoader::CloseFastLoad,
|
||||
this,
|
||||
kFastLoadWriteDelay,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
} else {
|
||||
// Note, that since CloseFastLoad nulls out mFastLoadTimer,
|
||||
// SetDelay() will only be called on a timer that hasn't fired.
|
||||
rv = mFastLoadTimer->SetDelay(kFastLoadWriteDelay);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
mozJSComponentLoader::ReadScript(nsIFastLoadService *flSvc,
|
||||
const char *nativePath, nsIURI *uri,
|
||||
mozJSComponentLoader::ReadScript(StartupCache* cache, nsIURI *uri,
|
||||
JSContext *cx, JSScript **script)
|
||||
{
|
||||
NS_ASSERTION(flSvc, "fastload not initialized");
|
||||
|
||||
nsresult rv = flSvc->StartMuxedDocument(uri, nativePath,
|
||||
nsIFastLoadService::NS_FASTLOAD_READ);
|
||||
nsresult rv;
|
||||
|
||||
nsCAutoString spec;
|
||||
rv = uri->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsAutoArrayPtr<char> buf;
|
||||
PRUint32 len;
|
||||
rv = cache->GetBuffer(spec.get(), getter_Transfers(buf),
|
||||
&len);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv; // don't warn since NOT_AVAILABLE is an ok error
|
||||
}
|
||||
|
||||
LOG(("Found %s in fastload file\n", nativePath));
|
||||
|
||||
nsCOMPtr<nsIURI> oldURI;
|
||||
rv = flSvc->SelectMuxedDocument(uri, getter_AddRefs(oldURI));
|
||||
LOG(("Found %s in startupcache\n", spec.get()));
|
||||
nsCOMPtr<nsIObjectInputStream> ois;
|
||||
rv = NS_NewObjectInputStreamFromBuffer(buf, len, getter_AddRefs(ois));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
buf.forget();
|
||||
|
||||
NS_ASSERTION(mFastLoadInput,
|
||||
"FASTLOAD_READ should only succeed with an input stream");
|
||||
|
||||
rv = ReadScriptFromStream(cx, mFastLoadInput, script);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = flSvc->EndMuxedDocument(uri);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return ReadScriptFromStream(cx, ois, script);
|
||||
}
|
||||
|
||||
nsresult
|
||||
mozJSComponentLoader::WriteScript(nsIFastLoadService *flSvc, JSScript *script,
|
||||
nsIFile *component, const char *nativePath,
|
||||
nsIURI *uri, JSContext *cx)
|
||||
mozJSComponentLoader::WriteScript(StartupCache* cache, JSScript *script,
|
||||
nsIFile *component, nsIURI *uri, JSContext *cx)
|
||||
{
|
||||
NS_ASSERTION(flSvc, "fastload not initialized");
|
||||
nsresult rv;
|
||||
|
||||
if (!mFastLoadOutput) {
|
||||
// Trying to read a URI that was not in the fastload file will have
|
||||
// created an output stream for us. But, if we haven't tried to
|
||||
// load anything that was missing, it will still be null.
|
||||
rv = flSvc->GetOutputStream(getter_AddRefs(mFastLoadOutput));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_ASSERTION(mFastLoadOutput, "must have an output stream here");
|
||||
|
||||
LOG(("Writing %s to fastload\n", nativePath));
|
||||
rv = flSvc->AddDependency(component);
|
||||
nsCAutoString spec;
|
||||
rv = uri->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = flSvc->StartMuxedDocument(uri, nativePath,
|
||||
nsIFastLoadService::NS_FASTLOAD_WRITE);
|
||||
LOG(("Writing %s to startupcache\n", spec.get()));
|
||||
nsCOMPtr<nsIObjectOutputStream> oos;
|
||||
nsCOMPtr<nsIStorageStream> storageStream;
|
||||
rv = NS_NewObjectOutputWrappedStorageStream(getter_AddRefs(oos),
|
||||
getter_AddRefs(storageStream));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> oldURI;
|
||||
rv = flSvc->SelectMuxedDocument(uri, getter_AddRefs(oldURI));
|
||||
rv = WriteScriptToStream(cx, script, oos);
|
||||
oos->Close();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = WriteScriptToStream(cx, script, mFastLoadOutput);
|
||||
|
||||
nsAutoArrayPtr<char> buf;
|
||||
PRUint32 len;
|
||||
rv = NS_NewBufferFromStorageStream(storageStream, getter_Transfers(buf),
|
||||
&len);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return flSvc->EndMuxedDocument(uri);
|
||||
|
||||
rv = cache->PutBuffer(spec.get(), buf, len);
|
||||
return rv;
|
||||
}
|
||||
#endif //MOZ_ENABLE_LIBXUL
|
||||
|
||||
nsresult
|
||||
mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
|
||||
@ -1267,60 +1022,31 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#endif
|
||||
|
||||
// Before compiling the script, first check to see if we have it in
|
||||
// the fastload file. Note: as a rule, fastload errors are not fatal
|
||||
// to loading the script, since we can always slow-load.
|
||||
nsCOMPtr<nsIFastLoadService> flSvc = do_GetFastLoadService(&rv);
|
||||
|
||||
// Save the old state and restore it upon return
|
||||
FastLoadStateHolder flState(flSvc);
|
||||
PRBool fastLoading = PR_FALSE;
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = StartFastLoad(flSvc);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
fastLoading = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
JSScript *script = nsnull;
|
||||
|
||||
if (fastLoading) {
|
||||
rv = ReadScript(flSvc, nativePath.get(), aURI, cx, &script);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
LOG(("Successfully loaded %s from fastload\n", nativePath.get()));
|
||||
fastLoading = PR_FALSE; // no need to write out the script
|
||||
} else if (rv == NS_ERROR_NOT_AVAILABLE) {
|
||||
// This is ok, it just means the script is not yet in the
|
||||
// fastload file.
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
LOG(("Failed to deserialize %s\n", nativePath.get()));
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
// Before compiling the script, first check to see if we have it in
|
||||
// the startupcache. Note: as a rule, startupcache errors are not fatal
|
||||
// to loading the script, since we can always slow-load.
|
||||
|
||||
PRBool writeToCache = PR_FALSE;
|
||||
StartupCache* cache = StartupCache::GetSingleton();
|
||||
|
||||
// Remove the fastload file, it may be corrupted.
|
||||
LOG(("Invalid fastload file detected, removing it\n"));
|
||||
nsCOMPtr<nsIObjectOutputStream> objectOutput;
|
||||
flSvc->GetOutputStream(getter_AddRefs(objectOutput));
|
||||
if (objectOutput) {
|
||||
flSvc->SetOutputStream(nsnull);
|
||||
objectOutput->Close();
|
||||
}
|
||||
nsCOMPtr<nsIObjectInputStream> objectInput;
|
||||
flSvc->GetInputStream(getter_AddRefs(objectInput));
|
||||
if (objectInput) {
|
||||
flSvc->SetInputStream(nsnull);
|
||||
objectInput->Close();
|
||||
}
|
||||
if (mFastLoadFile) {
|
||||
mFastLoadFile->Remove(PR_FALSE);
|
||||
}
|
||||
fastLoading = PR_FALSE;
|
||||
if (cache) {
|
||||
rv = ReadScript(cache, aURI, cx, &script);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
LOG(("Successfully loaded %s from startupcache\n", nativePath.get()));
|
||||
} else {
|
||||
// This is ok, it just means the script is not yet in the
|
||||
// cache. Could mean that the cache was corrupted and got removed,
|
||||
// but either way we're going to write this out.
|
||||
writeToCache = PR_TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (!script || NS_FAILED(rv)) {
|
||||
// The script wasn't in the fastload cache, so compile it now.
|
||||
if (!script) {
|
||||
// The script wasn't in the cache , so compile it now.
|
||||
LOG(("Slow loading %s\n", nativePath.get()));
|
||||
|
||||
// If |exception| is non-null, then our caller wants us to propagate
|
||||
@ -1479,21 +1205,20 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
|
||||
nativePath.get());
|
||||
#endif
|
||||
|
||||
if (fastLoading) {
|
||||
// We successfully compiled the script, so cache it in fastload.
|
||||
rv = WriteScript(flSvc, script, aComponentFile, nativePath.get(), aURI, cx);
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
if (writeToCache) {
|
||||
// We successfully compiled the script, so cache it.
|
||||
rv = WriteScript(cache, script, aComponentFile, aURI, cx);
|
||||
|
||||
// Don't treat failure to write as fatal, since we might be working
|
||||
// with a read-only fastload file.
|
||||
// with a read-only cache.
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
LOG(("Successfully wrote to fastload\n"));
|
||||
LOG(("Successfully wrote to cache\n"));
|
||||
} else {
|
||||
LOG(("Failed to write to fastload\n"));
|
||||
LOG(("Failed to write to cache\n"));
|
||||
}
|
||||
}
|
||||
|
||||
// Restore the old state of the fastload service.
|
||||
flState.pop();
|
||||
#endif
|
||||
|
||||
// Assign aGlobal here so that it's available to recursive imports.
|
||||
// See bug 384168.
|
||||
@ -1823,14 +1548,7 @@ NS_IMETHODIMP
|
||||
mozJSComponentLoader::Observe(nsISupports *subject, const char *topic,
|
||||
const PRUnichar *data)
|
||||
{
|
||||
if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
||||
if (mFastLoadTimer) {
|
||||
mFastLoadTimer->Cancel();
|
||||
}
|
||||
|
||||
CloseFastLoad();
|
||||
}
|
||||
else if (!strcmp(topic, "xpcom-shutdown-loaders")) {
|
||||
if (!strcmp(topic, "xpcom-shutdown-loaders")) {
|
||||
UnloadModules();
|
||||
}
|
||||
else {
|
||||
|
@ -57,6 +57,12 @@
|
||||
#ifndef XPCONNECT_STANDALONE
|
||||
#include "nsIPrincipal.h"
|
||||
#endif
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
#include "mozilla/scache/StartupCache.h"
|
||||
|
||||
using namespace mozilla::scache;
|
||||
#endif
|
||||
|
||||
#include "xpcIJSGetFactory.h"
|
||||
|
||||
/* 6bd13476-1dd2-11b2-bbef-f0ccb5fa64b6 (thanks, mozbot) */
|
||||
@ -127,23 +133,16 @@ class mozJSComponentLoader : public mozilla::ModuleLoader,
|
||||
char **location,
|
||||
jsval *exception);
|
||||
|
||||
nsresult StartFastLoad(nsIFastLoadService *flSvc);
|
||||
nsresult ReadScript(nsIFastLoadService *flSvc, const char *nativePath,
|
||||
nsIURI *uri, JSContext *cx, JSScript **script);
|
||||
nsresult WriteScript(nsIFastLoadService *flSvc, JSScript *script,
|
||||
nsIFile *component, const char *nativePath,
|
||||
nsIURI *uri, JSContext *cx);
|
||||
static void CloseFastLoad(nsITimer *timer, void *closure);
|
||||
void CloseFastLoad();
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
nsresult ReadScript(StartupCache *cache, nsIURI *uri,
|
||||
JSContext *cx, JSScript **script);
|
||||
nsresult WriteScript(StartupCache *cache, JSScript *script,
|
||||
nsIFile *component, nsIURI *uri, JSContext *cx);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIComponentManager> mCompMgr;
|
||||
nsCOMPtr<nsIJSRuntimeService> mRuntimeService;
|
||||
nsCOMPtr<nsIThreadJSContextStack> mContextStack;
|
||||
nsCOMPtr<nsIFile> mFastLoadFile;
|
||||
nsRefPtr<nsXPCFastLoadIO> mFastLoadIO;
|
||||
nsCOMPtr<nsIObjectInputStream> mFastLoadInput;
|
||||
nsCOMPtr<nsIObjectOutputStream> mFastLoadOutput;
|
||||
nsCOMPtr<nsITimer> mFastLoadTimer;
|
||||
#ifndef XPCONNECT_STANDALONE
|
||||
nsCOMPtr<nsIPrincipal> mSystemPrincipal;
|
||||
#endif
|
||||
|
@ -216,7 +216,7 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL
|
||||
|
||||
/* load up the url. From here on, failures are reflected as ``custom''
|
||||
* js exceptions */
|
||||
PRInt64 len = -1;
|
||||
PRInt32 len = -1;
|
||||
PRUint32 readcount = 0; // Total amount of data read
|
||||
PRUint32 lastReadCount = 0; // Amount of data read in last Read() call
|
||||
nsAutoArrayPtr<char> buf;
|
||||
@ -313,9 +313,6 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL
|
||||
goto return_exception;
|
||||
}
|
||||
|
||||
if (len > PR_INT32_MAX)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
buf = new char[len + 1];
|
||||
if (!buf)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "Layers.h"
|
||||
#include "BasicLayers.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
@ -88,6 +89,9 @@ static void DestroyRegion(void* aPropertyValue)
|
||||
* We add to this region in InvalidateThebesLayerContents. The region
|
||||
* is propagated to ContainerState in BuildContainerLayerFor, and then
|
||||
* the region(s) are actually invalidated in CreateOrRecycleThebesLayer.
|
||||
*
|
||||
* When the property value is null, the region is infinite --- i.e. all
|
||||
* areas of the ThebesLayers should be invalidated.
|
||||
*/
|
||||
NS_DECLARE_FRAME_PROPERTY(ThebesLayerInvalidRegionProperty, DestroyRegion)
|
||||
|
||||
@ -465,19 +469,21 @@ FrameLayerBuilder::UpdateDisplayItemDataForFrame(nsPtrHashKey<nsIFrame>* aEntry,
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
|
||||
if (!newDisplayItems->HasContainerLayer()) {
|
||||
if (newDisplayItems->HasContainerLayer()) {
|
||||
// Reset or create the invalid region now so we can start collecting
|
||||
// new dirty areas.
|
||||
nsRegion* invalidRegion = static_cast<nsRegion*>
|
||||
(props.Get(ThebesLayerInvalidRegionProperty()));
|
||||
if (invalidRegion) {
|
||||
invalidRegion->SetEmpty();
|
||||
} else {
|
||||
props.Set(ThebesLayerInvalidRegionProperty(), new nsRegion());
|
||||
}
|
||||
} else {
|
||||
props.Delete(ThebesLayerInvalidRegionProperty());
|
||||
f->RemoveStateBits(NS_FRAME_HAS_CONTAINER_LAYER);
|
||||
}
|
||||
|
||||
// Reset the invalid region now so we can start collecting new dirty
|
||||
// areas.
|
||||
nsRegion* invalidRegion = static_cast<nsRegion*>
|
||||
(props.Get(ThebesLayerInvalidRegionProperty()));
|
||||
if (invalidRegion) {
|
||||
invalidRegion->SetEmpty();
|
||||
}
|
||||
|
||||
// We need to remove and re-add the DisplayItemDataProperty in
|
||||
// case the nsTArray changes the value of its mHdr.
|
||||
void* propValue = props.Remove(DisplayItemDataProperty());
|
||||
@ -1160,6 +1166,17 @@ ContainerState::Finish()
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SetHasContainerLayer(nsIFrame* aFrame)
|
||||
{
|
||||
aFrame->AddStateBits(NS_FRAME_HAS_CONTAINER_LAYER);
|
||||
for (nsIFrame* f = aFrame;
|
||||
f && !(f->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);
|
||||
f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
|
||||
f->AddStateBits(NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<Layer>
|
||||
FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
@ -1220,12 +1237,17 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
|
||||
invalidThebesContent->MoveBy(offset);
|
||||
state.SetInvalidThebesContent(invalidThebesContent->
|
||||
ToOutsidePixels(aContainerFrame->PresContext()->AppUnitsPerDevPixel()));
|
||||
// We have to preserve the current contents of invalidThebesContent
|
||||
// because there might be multiple container layers for the same
|
||||
// frame and we need to invalidate the ThebesLayer children of all
|
||||
// of them.
|
||||
invalidThebesContent->MoveBy(-offset);
|
||||
} else {
|
||||
// Set up region to collect invalidation data
|
||||
props.Set(ThebesLayerInvalidRegionProperty(), new nsRegion());
|
||||
// The region was deleted to indicate that everything should be
|
||||
// invalidated.
|
||||
state.SetInvalidateAllThebesContent();
|
||||
}
|
||||
aContainerFrame->AddStateBits(NS_FRAME_HAS_CONTAINER_LAYER);
|
||||
SetHasContainerLayer(aContainerFrame);
|
||||
}
|
||||
|
||||
state.ProcessDisplayItems(aChildren, nsnull);
|
||||
@ -1271,6 +1293,55 @@ FrameLayerBuilder::InvalidateThebesLayerContents(nsIFrame* aFrame,
|
||||
invalidThebesContent->SimplifyOutward(20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if we find a descendant with a container layer
|
||||
*/
|
||||
static PRBool
|
||||
InternalInvalidateThebesLayersInSubtree(nsIFrame* aFrame)
|
||||
{
|
||||
if (!(aFrame->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT))
|
||||
return PR_FALSE;
|
||||
|
||||
PRBool foundContainerLayer = PR_FALSE;
|
||||
if (aFrame->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER) {
|
||||
// Delete the invalid region to indicate that all Thebes contents
|
||||
// need to be invalidated
|
||||
aFrame->Properties().Delete(ThebesLayerInvalidRegionProperty());
|
||||
foundContainerLayer = PR_TRUE;
|
||||
}
|
||||
|
||||
PRInt32 listIndex = 0;
|
||||
nsIAtom* childList = nsnull;
|
||||
do {
|
||||
nsIFrame* child = aFrame->GetFirstChild(childList);
|
||||
if (!child && !childList) {
|
||||
nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(aFrame);
|
||||
if (subdocumentFrame) {
|
||||
// Descend into the subdocument
|
||||
child = subdocumentFrame->GetSubdocumentRootFrame();
|
||||
}
|
||||
}
|
||||
while (child) {
|
||||
if (InternalInvalidateThebesLayersInSubtree(child)) {
|
||||
foundContainerLayer = PR_TRUE;
|
||||
}
|
||||
child = child->GetNextSibling();
|
||||
}
|
||||
childList = aFrame->GetAdditionalChildListName(listIndex++);
|
||||
} while (childList);
|
||||
|
||||
if (!foundContainerLayer) {
|
||||
aFrame->RemoveStateBits(NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);
|
||||
}
|
||||
return foundContainerLayer;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
FrameLayerBuilder::InvalidateThebesLayersInSubtree(nsIFrame* aFrame)
|
||||
{
|
||||
InternalInvalidateThebesLayersInSubtree(aFrame);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
FrameLayerBuilder::InvalidateAllThebesLayerContents(LayerManager* aManager)
|
||||
{
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "Layers.h"
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayList;
|
||||
@ -51,12 +52,6 @@ class gfxContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace layers {
|
||||
class Layer;
|
||||
class ThebesLayer;
|
||||
class LayerManager;
|
||||
}
|
||||
|
||||
enum LayerState {
|
||||
LAYER_NONE,
|
||||
LAYER_INACTIVE,
|
||||
@ -172,6 +167,14 @@ public:
|
||||
static void InvalidateThebesLayerContents(nsIFrame* aFrame,
|
||||
const nsRect& aRect);
|
||||
|
||||
/**
|
||||
* For any descendant frame of aFrame (including across documents) that
|
||||
* has an associated container layer, invalidate all the contents of
|
||||
* all ThebesLayer children of the container. Useful when aFrame is
|
||||
* being moved and we need to invalidate everything in aFrame's subtree.
|
||||
*/
|
||||
static void InvalidateThebesLayersInSubtree(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Call this to force *all* retained layer contents to be discarded at
|
||||
* the next paint.
|
||||
|
@ -428,15 +428,6 @@ ReparentFrame(nsFrameManager* aFrameManager,
|
||||
{
|
||||
aFrame->SetParent(aNewParentFrame);
|
||||
aFrameManager->ReparentStyleContext(aFrame);
|
||||
if (aFrame->GetStateBits() &
|
||||
(NS_FRAME_HAS_VIEW | NS_FRAME_HAS_CHILD_WITH_VIEW)) {
|
||||
// No need to walk up the tree, since the bits are already set
|
||||
// right on the parent of aNewParentFrame.
|
||||
NS_ASSERTION(aNewParentFrame->GetParent()->GetStateBits() &
|
||||
NS_FRAME_HAS_CHILD_WITH_VIEW,
|
||||
"aNewParentFrame's parent should have this bit set!");
|
||||
aNewParentFrame->AddStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1317,12 +1308,13 @@ PRBool IsBorderCollapse(nsIFrame* aFrame)
|
||||
|
||||
/**
|
||||
* Moves aFrameList from aOldParent to aNewParent. This updates the parent
|
||||
* pointer of the frames in the list, reparents their views as needed, and sets
|
||||
* the NS_FRAME_HAS_VIEW bit on aNewParent and its ancestors as needed. Then
|
||||
* it sets the list as the initial child list on aNewParent, unless aNewParent
|
||||
* either already has kids or has been reflowed; in that case it appends the
|
||||
* new frames. Note that this method differs from ReparentFrames in that it
|
||||
* doesn't change the kids' style contexts.
|
||||
* pointer of the frames in the list, and reparents their views as needed.
|
||||
* nsFrame::SetParent sets the NS_FRAME_HAS_VIEW bit on aNewParent and its
|
||||
* ancestors as needed. Then it sets the list as the initial child list
|
||||
* on aNewParent, unless aNewParent either already has kids or has been
|
||||
* reflowed; in that case it appends the new frames. Note that this
|
||||
* method differs from ReparentFrames in that it doesn't change the kids'
|
||||
* style contexts.
|
||||
*/
|
||||
// XXXbz Since this is only used for {ib} splits, could we just copy the view
|
||||
// bits from aOldParent to aNewParent and then use the
|
||||
@ -1344,28 +1336,10 @@ MoveChildrenTo(nsPresContext* aPresContext,
|
||||
aOldParent, aNewParent);
|
||||
}
|
||||
|
||||
PRBool setHasChildWithView = PR_FALSE;
|
||||
|
||||
for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
|
||||
if (!setHasChildWithView
|
||||
&& (e.get()->GetStateBits() &
|
||||
(NS_FRAME_HAS_VIEW | NS_FRAME_HAS_CHILD_WITH_VIEW))) {
|
||||
setHasChildWithView = PR_TRUE;
|
||||
}
|
||||
|
||||
e.get()->SetParent(aNewParent);
|
||||
}
|
||||
|
||||
if (setHasChildWithView) {
|
||||
aNewParent->AddStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
|
||||
if (!sameGrandParent) {
|
||||
for (nsIFrame* ancestor = aNewParent->GetParent();
|
||||
ancestor; ancestor = ancestor->GetParent()) {
|
||||
ancestor->AddStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aNewParent->GetChildList(nsnull).IsEmpty() &&
|
||||
(aNewParent->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||
aNewParent->SetInitialChildList(nsnull, aFrameList);
|
||||
@ -7769,7 +7743,7 @@ InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node)
|
||||
|
||||
nsIViewManager::UpdateViewBatch batch(presShell->GetViewManager());
|
||||
nsIFrame* rootFrame = presShell->GetRootFrame();
|
||||
rootFrame->InvalidateOverflowRect();
|
||||
rootFrame->InvalidateFrameSubtree();
|
||||
batch.EndUpdateViewBatch(NS_VMREFRESH_DEFERRED);
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ nsFrameManager::RemoveFrame(nsIAtom* aListName,
|
||||
// that doesn't change the size of the parent.)
|
||||
// This has to sure to invalidate the entire overflow rect; this
|
||||
// is important in the presence of absolute positioning
|
||||
aOldFrame->InvalidateOverflowRect();
|
||||
aOldFrame->InvalidateFrameSubtree();
|
||||
|
||||
NS_ASSERTION(!aOldFrame->GetPrevContinuation() ||
|
||||
// exception for nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames
|
||||
|
@ -7189,7 +7189,7 @@ PresShell::IsVisible()
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
PresShell::ShouldIgnoreInvalidation()
|
||||
{
|
||||
return mPaintingSuppressed;
|
||||
return mPaintingSuppressed || !mIsActive;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
|
@ -674,7 +674,6 @@ nsFieldSetFrame::ReparentFrameList(const nsFrameList& aFrameList)
|
||||
e.get()->SetParent(mContentFrame);
|
||||
frameManager->ReparentStyleContext(e.get());
|
||||
}
|
||||
mContentFrame->AddStateBits(GetStateBits() & NS_FRAME_HAS_CHILD_WITH_VIEW);
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
@ -60,7 +60,6 @@ EXPORTS = \
|
||||
nsHTMLReflowState.h \
|
||||
nsIAnonymousContentCreator.h \
|
||||
nsIFrame.h \
|
||||
nsIFrameFrame.h \
|
||||
nsIFrameUtil.h \
|
||||
nsIImageFrame.h \
|
||||
nsILineIterator.h \
|
||||
@ -69,6 +68,7 @@ EXPORTS = \
|
||||
nsIScrollableFrame.h \
|
||||
nsIStatefulFrame.h \
|
||||
nsFrameSelection.h \
|
||||
nsSubDocumentFrame.h \
|
||||
$(NULL)
|
||||
|
||||
ifdef IBMBIDI
|
||||
@ -90,7 +90,6 @@ CPPSRCS = \
|
||||
nsFirstLetterFrame.cpp \
|
||||
nsFloatManager.cpp \
|
||||
nsFrame.cpp \
|
||||
nsFrameFrame.cpp \
|
||||
nsFrameList.cpp \
|
||||
nsFrameSetFrame.cpp \
|
||||
nsFrameUtil.cpp \
|
||||
@ -113,6 +112,7 @@ CPPSRCS = \
|
||||
nsSelection.cpp \
|
||||
nsSimplePageSequence.cpp \
|
||||
nsSplittableFrame.cpp \
|
||||
nsSubDocumentFrame.cpp \
|
||||
nsTextFrameThebes.cpp \
|
||||
nsTextFrameUtils.cpp \
|
||||
nsTextRunTransformations.cpp \
|
||||
|
@ -88,6 +88,7 @@
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "FrameLayerBuilder.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsBidiPresUtils.h"
|
||||
@ -2459,6 +2460,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
||||
this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height);
|
||||
#endif
|
||||
Invalidate(dirtyRect);
|
||||
FrameLayerBuilder::InvalidateThebesLayersInSubtree(aLine->mFirstChild);
|
||||
} else {
|
||||
nsRect combinedAreaHStrip, combinedAreaVStrip;
|
||||
nsRect boundsHStrip, boundsVStrip;
|
||||
@ -2503,6 +2505,13 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
|
||||
printf(" dirty line is %p\n", static_cast<void*>(aLine.get());
|
||||
#endif
|
||||
Invalidate(dirtyRect);
|
||||
if (GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT) {
|
||||
PRInt32 childCount = aLine->GetChildCount();
|
||||
for (nsIFrame* f = aLine->mFirstChild; childCount;
|
||||
--childCount, f = f->GetNextSibling()) {
|
||||
FrameLayerBuilder::InvalidateThebesLayersInSubtree(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -100,7 +100,7 @@ nsCanvasFrame::ScrollPositionWillChange(nscoord aX, nscoord aY)
|
||||
{
|
||||
if (mDoPaintFocus) {
|
||||
mDoPaintFocus = PR_FALSE;
|
||||
PresContext()->FrameManager()->GetRootFrame()->InvalidateOverflowRect();
|
||||
PresContext()->FrameManager()->GetRootFrame()->InvalidateFrameSubtree();
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ nsCanvasFrame::SetHasFocus(PRBool aHasFocus)
|
||||
{
|
||||
if (mDoPaintFocus != aHasFocus) {
|
||||
mDoPaintFocus = aHasFocus;
|
||||
PresContext()->FrameManager()->GetRootFrame()->InvalidateOverflowRect();
|
||||
PresContext()->FrameManager()->GetRootFrame()->InvalidateFrameSubtree();
|
||||
|
||||
if (!mAddedScrollPositionListener) {
|
||||
nsIScrollableFrame* sf =
|
||||
|
@ -724,7 +724,7 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
|
||||
if ((aFlags & NS_FRAME_INVALIDATE_ON_MOVE) &&
|
||||
!(aKidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
|
||||
aKidFrame->GetPosition() != nsPoint(aX, aY)) {
|
||||
aKidFrame->InvalidateOverflowRect();
|
||||
aKidFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
aKidFrame->SetPosition(nsPoint(aX, aY));
|
||||
}
|
||||
@ -1130,7 +1130,7 @@ nsContainerFrame::DeleteNextInFlowChild(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
aNextInFlow->InvalidateOverflowRect();
|
||||
aNextInFlow->InvalidateFrameSubtree();
|
||||
|
||||
// Take the next-in-flow out of the parent's child list
|
||||
#ifdef DEBUG
|
||||
|
@ -3754,7 +3754,7 @@ LayerActivityTracker::NotifyExpired(LayerActivity* aObject)
|
||||
nsIFrame* f = aObject->mFrame;
|
||||
aObject->mFrame = nsnull;
|
||||
f->Properties().Delete(LayerActivityProperty());
|
||||
f->InvalidateOverflowRect();
|
||||
f->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
void
|
||||
@ -3959,6 +3959,13 @@ nsIFrame::InvalidateRectDifference(const nsRect& aR1, const nsRect& aR2)
|
||||
Invalidate(sizeHStrip);
|
||||
}
|
||||
|
||||
void
|
||||
nsIFrame::InvalidateFrameSubtree()
|
||||
{
|
||||
Invalidate(GetOverflowRectRelativeToSelf());
|
||||
FrameLayerBuilder::InvalidateThebesLayersInSubtree(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsIFrame::InvalidateOverflowRect()
|
||||
{
|
||||
@ -4639,7 +4646,7 @@ nsIFrame::SetSelected(PRBool aSelected, SelectionType aType)
|
||||
}
|
||||
|
||||
// Repaint this frame subtree's entire area
|
||||
InvalidateOverflowRect();
|
||||
InvalidateFrameSubtree();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6775,18 +6782,32 @@ nsFrame::BoxMetrics() const
|
||||
return metrics;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::SetParent(const nsIFrame* aParent)
|
||||
void
|
||||
nsFrame::SetParent(nsIFrame* aParent)
|
||||
{
|
||||
PRBool wasBoxWrapped = IsBoxWrapped();
|
||||
nsIFrame::SetParent(aParent);
|
||||
mParent = aParent;
|
||||
if (!wasBoxWrapped && IsBoxWrapped()) {
|
||||
InitBoxMetrics(PR_TRUE);
|
||||
} else if (wasBoxWrapped && !IsBoxWrapped()) {
|
||||
Properties().Delete(BoxMetricsProperty());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
if (GetStateBits() & (NS_FRAME_HAS_VIEW | NS_FRAME_HAS_CHILD_WITH_VIEW)) {
|
||||
for (nsIFrame* f = aParent;
|
||||
f && !(f->GetStateBits() & NS_FRAME_HAS_CHILD_WITH_VIEW);
|
||||
f = f->GetParent()) {
|
||||
f->AddStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT) {
|
||||
for (nsIFrame* f = aParent;
|
||||
f && !(f->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);
|
||||
f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
|
||||
f->AddStateBits(NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -187,7 +187,7 @@ public:
|
||||
virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const;
|
||||
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
|
||||
nsStyleContext* aStyleContext);
|
||||
NS_IMETHOD SetParent(const nsIFrame* aParent);
|
||||
virtual void SetParent(nsIFrame* aParent);
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
|
@ -1263,7 +1263,7 @@ public:
|
||||
virtual void NotifyExpired(nsGfxScrollFrameInner *aObject) {
|
||||
RemoveObject(aObject);
|
||||
aObject->mScrollingActive = PR_FALSE;
|
||||
aObject->mOuter->InvalidateOverflowRect();
|
||||
aObject->mOuter->InvalidateFrameSubtree();
|
||||
}
|
||||
};
|
||||
|
||||
@ -2968,7 +2968,7 @@ static void LayoutAndInvalidate(nsBoxLayoutState& aState,
|
||||
if (aScrollbarIsBeingHidden) {
|
||||
aBox->GetParent()->Invalidate(aBox->GetOverflowRect() + aBox->GetPosition());
|
||||
} else {
|
||||
aBox->InvalidateOverflowRect();
|
||||
aBox->InvalidateFrameSubtree();
|
||||
}
|
||||
}
|
||||
nsBoxFrame::LayoutChildAt(aState, aBox, aRect);
|
||||
@ -2976,7 +2976,7 @@ static void LayoutAndInvalidate(nsBoxLayoutState& aState,
|
||||
if (aScrollbarIsBeingHidden) {
|
||||
aBox->GetParent()->Invalidate(aBox->GetOverflowRect() + aBox->GetPosition());
|
||||
} else {
|
||||
aBox->InvalidateOverflowRect();
|
||||
aBox->InvalidateFrameSubtree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -262,6 +262,10 @@ typedef PRUint64 nsFrameState;
|
||||
// This bit acts as a loop flag for recursive paint server drawing.
|
||||
#define NS_FRAME_DRAWING_AS_PAINTSERVER NS_FRAME_STATE_BIT(33)
|
||||
|
||||
// Frame or one of its (cross-doc) descendants may have the
|
||||
// NS_FRAME_HAS_CONTAINER_LAYER bit.
|
||||
#define NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT NS_FRAME_STATE_BIT(34)
|
||||
|
||||
// The lower 20 bits and upper 32 bits of the frame state are reserved
|
||||
// by this API.
|
||||
#define NS_FRAME_RESERVED ~NS_FRAME_IMPL_RESERVED
|
||||
@ -756,7 +760,7 @@ public:
|
||||
* Accessor functions for geometric parent
|
||||
*/
|
||||
nsIFrame* GetParent() const { return mParent; }
|
||||
NS_IMETHOD SetParent(const nsIFrame* aParent) { mParent = (nsIFrame*)aParent; return NS_OK; }
|
||||
virtual void SetParent(nsIFrame* aParent) = 0;
|
||||
|
||||
/**
|
||||
* Bounding rect of the frame. The values are in app units, and the origin is
|
||||
@ -1963,10 +1967,21 @@ public:
|
||||
void InvalidateRectDifference(const nsRect& aR1, const nsRect& aR2);
|
||||
|
||||
/**
|
||||
* Invalidate the overflow rect of this frame
|
||||
* Invalidate the entire frame subtree for this frame. Invalidates this
|
||||
* frame's overflow rect, and also ensures that all ThebesLayer children
|
||||
* of ContainerLayers associated with frames in this subtree are
|
||||
* completely invalidated.
|
||||
*/
|
||||
void InvalidateFrameSubtree();
|
||||
|
||||
/**
|
||||
* Invalidate the overflow area for this frame. Invalidates this
|
||||
* frame's overflow rect. Does not necessarily cause ThebesLayers for
|
||||
* descendant frames to be repainted; only this frame can be relied on
|
||||
* to be repainted.
|
||||
*/
|
||||
void InvalidateOverflowRect();
|
||||
|
||||
|
||||
/**
|
||||
* Computes a rect that encompasses everything that might be painted by
|
||||
* this frame. This includes this frame, all its descendent frames, this
|
||||
@ -2401,7 +2416,7 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::EmbeddingLevelProperty()))
|
||||
PRBool IsHorizontal() const { return (mState & NS_STATE_IS_HORIZONTAL) != 0; }
|
||||
PRBool IsNormalDirection() const { return (mState & NS_STATE_IS_DIRECTION_NORMAL) != 0; }
|
||||
|
||||
NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE);
|
||||
NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull);
|
||||
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)=0;
|
||||
virtual PRBool GetMouseThrough() const = 0;
|
||||
|
||||
@ -2631,6 +2646,11 @@ class nsWeakFrame {
|
||||
public:
|
||||
nsWeakFrame() : mPrev(nsnull), mFrame(nsnull) { }
|
||||
|
||||
nsWeakFrame(const nsWeakFrame& aOther) : mPrev(nsnull), mFrame(nsnull)
|
||||
{
|
||||
Init(aOther.GetFrame());
|
||||
}
|
||||
|
||||
nsWeakFrame(nsIFrame* aFrame) : mPrev(nsnull), mFrame(nsnull)
|
||||
{
|
||||
Init(aFrame);
|
||||
@ -2666,7 +2686,7 @@ public:
|
||||
|
||||
PRBool IsAlive() { return !!mFrame; }
|
||||
|
||||
nsIFrame* GetFrame() { return mFrame; }
|
||||
nsIFrame* GetFrame() const { return mFrame; }
|
||||
|
||||
nsWeakFrame* GetPreviousWeakFrame() { return mPrev; }
|
||||
|
||||
|
@ -42,8 +42,8 @@
|
||||
* as <frame>, <iframe>, and some <object>s
|
||||
*/
|
||||
|
||||
#include "nsSubDocumentFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellLoadInfo.h"
|
||||
@ -73,7 +73,6 @@
|
||||
#include "nsIDOMHTMLFrameElement.h"
|
||||
#include "nsIDOMHTMLIFrameElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIScrollable.h"
|
||||
@ -82,12 +81,9 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIFrameFrame.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMNSHTMLDocument.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsIReflowCallback.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIObjectLoadingContent.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
@ -104,126 +100,6 @@
|
||||
|
||||
class AsyncFrameInit;
|
||||
|
||||
/******************************************************************************
|
||||
* nsSubDocumentFrame
|
||||
*****************************************************************************/
|
||||
class nsSubDocumentFrame : public nsLeafFrame,
|
||||
public nsIFrameFrame,
|
||||
public nsIReflowCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
nsSubDocumentFrame(nsStyleContext* aContext);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
virtual nsIAtom* GetType() const;
|
||||
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
// nsLeafFrame is already eReplacedContainsBlock, but that's somewhat bogus
|
||||
return nsLeafFrame::IsFrameOfType(aFlags &
|
||||
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
||||
}
|
||||
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
||||
|
||||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
|
||||
virtual IntrinsicSize GetIntrinsicSize();
|
||||
virtual nsSize GetIntrinsicRatio();
|
||||
|
||||
virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, PRBool aShrinkWrap);
|
||||
|
||||
virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
PRBool aShrinkWrap);
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists);
|
||||
|
||||
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
|
||||
// if the content is "visibility:hidden", then just hide the view
|
||||
// and all our contents. We don't extend "visibility:hidden" to
|
||||
// the child content ourselves, since it belongs to a different
|
||||
// document and CSS doesn't inherit in there.
|
||||
virtual PRBool SupportsVisibilityHidden() { return PR_FALSE; }
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
||||
#endif
|
||||
|
||||
// nsIFrameFrame
|
||||
NS_IMETHOD GetDocShell(nsIDocShell **aDocShell);
|
||||
NS_IMETHOD BeginSwapDocShells(nsIFrame* aOther);
|
||||
virtual void EndSwapDocShells(nsIFrame* aOther);
|
||||
virtual nsIFrame* GetFrame() { return this; }
|
||||
|
||||
// nsIReflowCallback
|
||||
virtual PRBool ReflowFinished();
|
||||
virtual void ReflowCallbackCanceled();
|
||||
|
||||
protected:
|
||||
friend class AsyncFrameInit;
|
||||
|
||||
// Helper method to look up the HTML marginwidth & marginheight attributes
|
||||
nsIntSize GetMarginAttributes();
|
||||
|
||||
nsFrameLoader* FrameLoader();
|
||||
|
||||
PRBool IsInline() { return mIsInline; }
|
||||
nsIView* CreateViewAndWidget(nsContentType aContentType);
|
||||
|
||||
virtual nscoord GetIntrinsicWidth();
|
||||
virtual nscoord GetIntrinsicHeight();
|
||||
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
||||
// Hide or show our document viewer
|
||||
void HideViewer();
|
||||
void ShowViewer();
|
||||
|
||||
/* Obtains the frame we should use for intrinsic size information if we are
|
||||
* an HTML <object>, <embed> or <applet> (a replaced element - not <iframe>)
|
||||
* and our sub-document has an intrinsic size. The frame returned is the
|
||||
* frame for the document element of the document we're embedding.
|
||||
*
|
||||
* Called "Obtain*" and not "Get*" because of comment on GetDocShell that
|
||||
* says it should be called ObtainDocShell because of it's side effects.
|
||||
*/
|
||||
nsIFrame* ObtainIntrinsicSizeFrame();
|
||||
|
||||
nsRefPtr<nsFrameLoader> mFrameLoader;
|
||||
nsIView* mInnerView;
|
||||
PRPackedBool mIsInline;
|
||||
PRPackedBool mPostedReflowCallback;
|
||||
PRPackedBool mDidCreateDoc;
|
||||
PRPackedBool mCallingShow;
|
||||
};
|
||||
|
||||
nsSubDocumentFrame::nsSubDocumentFrame(nsStyleContext* aContext)
|
||||
: nsLeafFrame(aContext)
|
||||
, mIsInline(PR_FALSE)
|
||||
@ -245,7 +121,7 @@ nsSubDocumentFrame::CreateAccessible()
|
||||
#endif
|
||||
|
||||
NS_QUERYFRAME_HEAD(nsSubDocumentFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsIFrameFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsSubDocumentFrame)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame)
|
||||
|
||||
class AsyncFrameInit : public nsRunnable
|
||||
@ -355,6 +231,17 @@ nsSubDocumentFrame::GetSkipSides() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsSubDocumentFrame::GetSubdocumentRootFrame()
|
||||
{
|
||||
if (!mInnerView)
|
||||
return nsnull;
|
||||
nsIView* subdocView = mInnerView->GetFirstChild();
|
||||
if (!subdocView)
|
||||
return nsnull;
|
||||
return static_cast<nsIFrame*>(subdocView->GetClientData());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
@ -890,7 +777,7 @@ nsSubDocumentFrame::FrameLoader()
|
||||
|
||||
// XXX this should be called ObtainDocShell or something like that,
|
||||
// to indicate that it could have side effects
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsSubDocumentFrame::GetDocShell(nsIDocShell **aDocShell)
|
||||
{
|
||||
*aDocShell = nsnull;
|
||||
@ -899,7 +786,7 @@ nsSubDocumentFrame::GetDocShell(nsIDocShell **aDocShell)
|
||||
return mFrameLoader->GetDocShell(aDocShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsSubDocumentFrame::BeginSwapDocShells(nsIFrame* aOther)
|
||||
{
|
||||
if (!aOther || aOther->GetType() != nsGkAtoms::subDocumentFrame) {
|
||||
@ -935,12 +822,12 @@ nsSubDocumentFrame::EndSwapDocShells(nsIFrame* aOther)
|
||||
if (weakThis.IsAlive()) {
|
||||
PresContext()->PresShell()->
|
||||
FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY);
|
||||
InvalidateOverflowRect();
|
||||
InvalidateFrameSubtree();
|
||||
}
|
||||
if (weakOther.IsAlive()) {
|
||||
other->PresContext()->PresShell()->
|
||||
FrameNeedsReflow(other, nsIPresShell::eTreeChange, NS_FRAME_IS_DIRTY);
|
||||
other->InvalidateOverflowRect();
|
||||
other->InvalidateFrameSubtree();
|
||||
}
|
||||
}
|
||||
|
164
layout/generic/nsSubDocumentFrame.h
Normal file
164
layout/generic/nsSubDocumentFrame.h
Normal file
@ -0,0 +1,164 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** 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 Corporation code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Robert O'Callahan <robert@ocallahan.org>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef NSSUBDOCUMENTFRAME_H_
|
||||
#define NSSUBDOCUMENTFRAME_H_
|
||||
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsIReflowCallback.h"
|
||||
#include "nsFrameLoader.h"
|
||||
|
||||
/******************************************************************************
|
||||
* nsSubDocumentFrame
|
||||
*****************************************************************************/
|
||||
class nsSubDocumentFrame : public nsLeafFrame,
|
||||
public nsIReflowCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_QUERYFRAME_TARGET(nsSubDocumentFrame)
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
nsSubDocumentFrame(nsStyleContext* aContext);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
virtual nsIAtom* GetType() const;
|
||||
|
||||
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
// nsLeafFrame is already eReplacedContainsBlock, but that's somewhat bogus
|
||||
return nsLeafFrame::IsFrameOfType(aFlags &
|
||||
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
||||
}
|
||||
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
||||
|
||||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
|
||||
virtual IntrinsicSize GetIntrinsicSize();
|
||||
virtual nsSize GetIntrinsicRatio();
|
||||
|
||||
virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, PRBool aShrinkWrap);
|
||||
|
||||
virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
||||
PRBool aShrinkWrap);
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists);
|
||||
|
||||
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
|
||||
// if the content is "visibility:hidden", then just hide the view
|
||||
// and all our contents. We don't extend "visibility:hidden" to
|
||||
// the child content ourselves, since it belongs to a different
|
||||
// document and CSS doesn't inherit in there.
|
||||
virtual PRBool SupportsVisibilityHidden() { return PR_FALSE; }
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
||||
#endif
|
||||
|
||||
nsresult GetDocShell(nsIDocShell **aDocShell);
|
||||
nsresult BeginSwapDocShells(nsIFrame* aOther);
|
||||
void EndSwapDocShells(nsIFrame* aOther);
|
||||
nsIView* CreateViewAndWidget(nsContentType aContentType);
|
||||
nsIFrame* GetSubdocumentRootFrame();
|
||||
|
||||
// nsIReflowCallback
|
||||
virtual PRBool ReflowFinished();
|
||||
virtual void ReflowCallbackCanceled();
|
||||
|
||||
protected:
|
||||
friend class AsyncFrameInit;
|
||||
|
||||
// Helper method to look up the HTML marginwidth & marginheight attributes
|
||||
nsIntSize GetMarginAttributes();
|
||||
|
||||
nsFrameLoader* FrameLoader();
|
||||
|
||||
PRBool IsInline() { return mIsInline; }
|
||||
|
||||
virtual nscoord GetIntrinsicWidth();
|
||||
virtual nscoord GetIntrinsicHeight();
|
||||
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
||||
// Hide or show our document viewer
|
||||
void HideViewer();
|
||||
void ShowViewer();
|
||||
|
||||
/* Obtains the frame we should use for intrinsic size information if we are
|
||||
* an HTML <object>, <embed> or <applet> (a replaced element - not <iframe>)
|
||||
* and our sub-document has an intrinsic size. The frame returned is the
|
||||
* frame for the document element of the document we're embedding.
|
||||
*
|
||||
* Called "Obtain*" and not "Get*" because of comment on GetDocShell that
|
||||
* says it should be called ObtainDocShell because of it's side effects.
|
||||
*/
|
||||
nsIFrame* ObtainIntrinsicSizeFrame();
|
||||
|
||||
nsRefPtr<nsFrameLoader> mFrameLoader;
|
||||
nsIView* mInnerView;
|
||||
PRPackedBool mIsInline;
|
||||
PRPackedBool mPostedReflowCallback;
|
||||
PRPackedBool mDidCreateDoc;
|
||||
PRPackedBool mCallingShow;
|
||||
};
|
||||
|
||||
#endif /* NSSUBDOCUMENTFRAME_H_ */
|
@ -361,7 +361,8 @@ ViewportFrame::InvalidateInternal(const nsRect& aDamageRect,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
nsRect r = aDamageRect + nsPoint(aX, aY);
|
||||
PresContext()->NotifyInvalidation(r, aFlags);
|
||||
nsPresContext* presContext = PresContext();
|
||||
presContext->NotifyInvalidation(r, aFlags);
|
||||
|
||||
if ((mState & NS_FRAME_HAS_CONTAINER_LAYER) &&
|
||||
!(aFlags & INVALIDATE_NO_THEBES_LAYERS)) {
|
||||
@ -372,8 +373,10 @@ ViewportFrame::InvalidateInternal(const nsRect& aDamageRect,
|
||||
|
||||
nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrame(this);
|
||||
if (parent) {
|
||||
if (!presContext->PresShell()->IsActive())
|
||||
return;
|
||||
nsPoint pt = -parent->GetOffsetToCrossDoc(this);
|
||||
PRInt32 ourAPD = PresContext()->AppUnitsPerDevPixel();
|
||||
PRInt32 ourAPD = presContext->AppUnitsPerDevPixel();
|
||||
PRInt32 parentAPD = parent->PresContext()->AppUnitsPerDevPixel();
|
||||
r = r.ConvertAppUnitsRoundOut(ourAPD, parentAPD);
|
||||
parent->InvalidateInternal(r, pt.x, pt.y, this,
|
||||
|
18
layout/reftests/bugs/579323-1-ref.html
Normal file
18
layout/reftests/bugs/579323-1-ref.html
Normal file
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
width: 500px;
|
||||
}
|
||||
div {
|
||||
height: 100px;
|
||||
opacity: 0.5;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
28
layout/reftests/bugs/579323-1.html
Normal file
28
layout/reftests/bugs/579323-1.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
display: -moz-box;
|
||||
-moz-box-orient: horizontal;
|
||||
width: 400px;
|
||||
}
|
||||
canvas {
|
||||
-moz-box-flex: 1;
|
||||
height: 100px;
|
||||
opacity: 0.5;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function doTest() {
|
||||
document.body.style.width = "500px";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas></canvas>
|
||||
</body>
|
||||
</html>
|
@ -1484,6 +1484,7 @@ random-if(d2d) == 555388-1.html 555388-1-ref.html
|
||||
== 574898-1.html 574898-ref.html
|
||||
== 577838-1.html 577838-1-ref.html
|
||||
== 577838-2.html 577838-2-ref.html
|
||||
== 579323-1.html 579323-1-ref.html
|
||||
== 579349-1.html 579349-1-ref.html
|
||||
== 580160-1.html 580160-1-ref.html
|
||||
== 581317-1.html 581317-1-ref.html
|
||||
|
@ -608,7 +608,7 @@ void nsTableCellFrame::VerticallyAlignChild(nscoord aMaxAscent)
|
||||
|
||||
if (kidYTop != kidRect.y) {
|
||||
// Invalidate at the old position first
|
||||
firstKid->InvalidateOverflowRect();
|
||||
firstKid->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
firstKid->SetPosition(nsPoint(kidRect.x, kidYTop));
|
||||
@ -624,7 +624,7 @@ void nsTableCellFrame::VerticallyAlignChild(nscoord aMaxAscent)
|
||||
nsContainerFrame::PositionChildViews(firstKid);
|
||||
|
||||
// Invalidate new overflow rect
|
||||
firstKid->InvalidateOverflowRect();
|
||||
firstKid->InvalidateFrameSubtree();
|
||||
}
|
||||
if (HasView()) {
|
||||
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this,
|
||||
@ -926,7 +926,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
// XXXbz is this invalidate actually needed, really?
|
||||
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
|
||||
InvalidateOverflowRect();
|
||||
InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -2881,12 +2881,12 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
|
||||
nsRect kidRect = kidFrame->GetRect();
|
||||
if (kidRect.y != aReflowState.y) {
|
||||
// invalidate the old position
|
||||
kidFrame->InvalidateOverflowRect();
|
||||
kidFrame->InvalidateFrameSubtree();
|
||||
kidRect.y = aReflowState.y;
|
||||
kidFrame->SetRect(kidRect); // move to the new position
|
||||
RePositionViews(kidFrame);
|
||||
// invalidate the new position
|
||||
kidFrame->InvalidateOverflowRect();
|
||||
kidFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
aReflowState.y += kidRect.height;
|
||||
|
||||
@ -3072,10 +3072,10 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
|
||||
else {
|
||||
if (amountUsed > 0 && yOriginRow != rowRect.y &&
|
||||
!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||
rowFrame->InvalidateOverflowRect();
|
||||
rowFrame->InvalidateFrameSubtree();
|
||||
rowFrame->SetPosition(nsPoint(rowRect.x, yOriginRow));
|
||||
nsTableFrame::RePositionViews(rowFrame);
|
||||
rowFrame->InvalidateOverflowRect();
|
||||
rowFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
yOriginRow += rowRect.height + cellSpacingY;
|
||||
yEndRG += rowRect.height + cellSpacingY;
|
||||
@ -3084,7 +3084,7 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
|
||||
}
|
||||
if (amountUsed > 0) {
|
||||
if (rgRect.y != yOriginRG) {
|
||||
rgFrame->InvalidateOverflowRect();
|
||||
rgFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
nsRect origRgRect = rgRect;
|
||||
@ -3100,11 +3100,11 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
|
||||
}
|
||||
}
|
||||
else if (amountUsed > 0 && yOriginRG != rgRect.y) {
|
||||
rgFrame->InvalidateOverflowRect();
|
||||
rgFrame->InvalidateFrameSubtree();
|
||||
rgFrame->SetPosition(nsPoint(rgRect.x, yOriginRG));
|
||||
// Make sure child views are properly positioned
|
||||
nsTableFrame::RePositionViews(rgFrame);
|
||||
rgFrame->InvalidateOverflowRect();
|
||||
rgFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
yOriginRG = yEndRG;
|
||||
}
|
||||
@ -3213,7 +3213,7 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
|
||||
amountForRow = NS_MIN(amountForRow, aAmount - amountUsed);
|
||||
|
||||
if (yOriginRow != rowRect.y) {
|
||||
rowFrame->InvalidateOverflowRect();
|
||||
rowFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
// update the row height
|
||||
@ -3235,10 +3235,10 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
|
||||
}
|
||||
else {
|
||||
if (amountUsed > 0 && yOriginRow != rowRect.y) {
|
||||
rowFrame->InvalidateOverflowRect();
|
||||
rowFrame->InvalidateFrameSubtree();
|
||||
rowFrame->SetPosition(nsPoint(rowRect.x, yOriginRow));
|
||||
nsTableFrame::RePositionViews(rowFrame);
|
||||
rowFrame->InvalidateOverflowRect();
|
||||
rowFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
yOriginRow += rowRect.height + cellSpacingY;
|
||||
yEndRG += rowRect.height + cellSpacingY;
|
||||
@ -3247,7 +3247,7 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
|
||||
}
|
||||
if (amountUsed > 0) {
|
||||
if (rgRect.y != yOriginRG) {
|
||||
rgFrame->InvalidateOverflowRect();
|
||||
rgFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
rgFrame->SetRect(nsRect(rgRect.x, yOriginRG, rgRect.width,
|
||||
@ -3259,11 +3259,11 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
|
||||
// Make sure child views are properly positioned
|
||||
}
|
||||
else if (amountUsed > 0 && yOriginRG != rgRect.y) {
|
||||
rgFrame->InvalidateOverflowRect();
|
||||
rgFrame->InvalidateFrameSubtree();
|
||||
rgFrame->SetPosition(nsPoint(rgRect.x, yOriginRG));
|
||||
// Make sure child views are properly positioned
|
||||
nsTableFrame::RePositionViews(rgFrame);
|
||||
rgFrame->InvalidateOverflowRect();
|
||||
rgFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
yOriginRG = yEndRG;
|
||||
}
|
||||
|
@ -921,7 +921,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
}
|
||||
else {
|
||||
if (x != kidRect.x) {
|
||||
kidFrame->InvalidateOverflowRect();
|
||||
kidFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
desiredSize.width = cellDesiredSize.width;
|
||||
@ -978,12 +978,12 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
else {
|
||||
if (kidRect.x != x) {
|
||||
// Invalidate the old position
|
||||
kidFrame->InvalidateOverflowRect();
|
||||
kidFrame->InvalidateFrameSubtree();
|
||||
// move to the new position
|
||||
kidFrame->SetPosition(nsPoint(x, kidRect.y));
|
||||
nsTableFrame::RePositionViews(kidFrame);
|
||||
// invalidate the new position
|
||||
kidFrame->InvalidateOverflowRect();
|
||||
kidFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
// we need to account for the cell's width even if it isn't reflowed
|
||||
x += kidRect.width;
|
||||
@ -1152,7 +1152,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
|
||||
|
||||
if (aRowOffset != 0) {
|
||||
// We're moving, so invalidate our old position
|
||||
InvalidateOverflowRect();
|
||||
InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
nsRect rowRect = GetRect();
|
||||
@ -1273,7 +1273,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
|
||||
|
||||
if (aRowOffset == 0 && cRect.TopLeft() != oldCellRect.TopLeft()) {
|
||||
// We're moving the cell. Invalidate the old overflow area
|
||||
cellFrame->InvalidateOverflowRect();
|
||||
cellFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
cellFrame->SetRect(cRect);
|
||||
|
@ -816,7 +816,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
|
||||
if (movedFrame || (rowHeight != rowBounds.height)) {
|
||||
// Resize/move the row to its final size and position
|
||||
if (movedFrame) {
|
||||
rowFrame->InvalidateOverflowRect();
|
||||
rowFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
rowFrame->SetRect(nsRect(rowBounds.x, yOrigin, rowBounds.width,
|
||||
@ -881,7 +881,7 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aYTotalOffset,
|
||||
groupRect.width = aWidth;
|
||||
|
||||
if (aYTotalOffset != 0) {
|
||||
InvalidateOverflowRect();
|
||||
InvalidateFrameSubtree();
|
||||
}
|
||||
|
||||
SetRect(groupRect);
|
||||
@ -906,10 +906,10 @@ nsTableRowGroupFrame::SlideChild(nsRowGroupReflowState& aReflowState,
|
||||
nsPoint newPosition = oldPosition;
|
||||
newPosition.y = aReflowState.y;
|
||||
if (oldPosition.y != newPosition.y) {
|
||||
aKidFrame->InvalidateOverflowRect();
|
||||
aKidFrame->InvalidateFrameSubtree();
|
||||
aKidFrame->SetPosition(newPosition);
|
||||
nsTableFrame::RePositionViews(aKidFrame);
|
||||
aKidFrame->InvalidateOverflowRect();
|
||||
aKidFrame->InvalidateFrameSubtree();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,9 @@
|
||||
#include "nsITheme.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIBoxLayout.h"
|
||||
#include "FrameLayerBuilder.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
PRInt32 gIndent = 0;
|
||||
@ -648,8 +651,7 @@ nsBox::SyncLayout(nsBoxLayoutState& aState)
|
||||
|
||||
nsresult
|
||||
nsIFrame::Redraw(nsBoxLayoutState& aState,
|
||||
const nsRect* aDamageRect,
|
||||
PRBool aImmediate)
|
||||
const nsRect* aDamageRect)
|
||||
{
|
||||
if (aState.PaintingDisabled())
|
||||
return NS_OK;
|
||||
@ -660,7 +662,10 @@ nsIFrame::Redraw(nsBoxLayoutState& aState,
|
||||
else
|
||||
damageRect = GetOverflowRect();
|
||||
|
||||
InvalidateWithFlags(damageRect, aImmediate ? INVALIDATE_IMMEDIATE : 0);
|
||||
Invalidate(damageRect);
|
||||
// nsStackLayout, at least, expects us to repaint descendants even
|
||||
// if a damage rect is provided
|
||||
FrameLayerBuilder::InvalidateThebesLayersInSubtree(this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFrameFrame.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
|
||||
/**
|
||||
* nsContainerBoxObject implements deprecated nsIBrowserBoxObject,
|
||||
@ -83,12 +83,12 @@ NS_IMETHODIMP nsContainerBoxObject::GetDocShell(nsIDocShell** aResult)
|
||||
nsIFrame *frame = GetFrame(PR_FALSE);
|
||||
|
||||
if (frame) {
|
||||
nsIFrameFrame *frame_frame = do_QueryFrame(frame);
|
||||
if (frame_frame) {
|
||||
// Ok, the frame for mContent is a nsIFrameFrame, it knows how
|
||||
nsSubDocumentFrame *subDocFrame = do_QueryFrame(frame);
|
||||
if (subDocFrame) {
|
||||
// Ok, the frame for mContent is an nsSubDocumentFrame, it knows how
|
||||
// to reach the docshell, so ask it...
|
||||
|
||||
return frame_frame->GetDocShell(aResult);
|
||||
return subDocFrame->GetDocShell(aResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ NS_IMETHODIMP nsContainerBoxObject::GetDocShell(nsIDocShell** aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// No nsIFrameFrame available for mContent, try if there's a mapping
|
||||
// No nsSubDocumentFrame available for mContent, try if there's a mapping
|
||||
// between mContent's document to mContent's subdocument.
|
||||
|
||||
// XXXbz sXBL/XBL2 issue -- ownerDocument or currentDocument?
|
||||
|
@ -232,12 +232,11 @@ nsMenuFrame::nsMenuFrame(nsIPresShell* aShell, nsStyleContext* aContext):
|
||||
|
||||
} // cntr
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMenuFrame::SetParent(const nsIFrame* aParent)
|
||||
void
|
||||
nsMenuFrame::SetParent(nsIFrame* aParent)
|
||||
{
|
||||
nsBoxFrame::SetParent(aParent);
|
||||
InitMenuParent(const_cast<nsIFrame *>(aParent));
|
||||
return NS_OK;
|
||||
InitMenuParent(aParent);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
// otherwise null will be returned.
|
||||
nsMenuFrame* Enter();
|
||||
|
||||
NS_IMETHOD SetParent(const nsIFrame* aParent);
|
||||
virtual void SetParent(nsIFrame* aParent);
|
||||
|
||||
virtual nsMenuParent *GetMenuParent() { return mMenuParent; }
|
||||
const nsAString& GetRadioGroupName() { return mGroupName; }
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
NS_IF_ADDREF(*result = mJarReader);
|
||||
}
|
||||
|
||||
PRInt64 GetContentLength()
|
||||
PRInt32 GetContentLength()
|
||||
{
|
||||
return mContentLength;
|
||||
}
|
||||
@ -127,7 +127,7 @@ private:
|
||||
nsCString mJarDirSpec;
|
||||
nsCOMPtr<nsIInputStream> mJarStream;
|
||||
nsCString mJarEntry;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
};
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputThunk, nsIInputStream)
|
||||
@ -173,11 +173,8 @@ nsJARInputThunk::EnsureJarStream()
|
||||
}
|
||||
|
||||
// ask the JarStream for the content length
|
||||
// XXX want a 64-bit value from nsIInputStream::Available()
|
||||
PRUint32 contentLength;
|
||||
rv = mJarStream->Available(&contentLength);
|
||||
rv = mJarStream->Available((PRUint32 *) &mContentLength);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mContentLength = contentLength;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -632,14 +629,7 @@ nsJARChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentDisposition(nsACString &result)
|
||||
{
|
||||
result = mContentDisposition;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentLength(PRInt64 *result)
|
||||
nsJARChannel::GetContentLength(PRInt32 *result)
|
||||
{
|
||||
// if content length is unknown, query mJarInput...
|
||||
if (mContentLength < 0 && mJarInput)
|
||||
@ -650,7 +640,7 @@ nsJARChannel::GetContentLength(PRInt64 *result)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetContentLength(PRInt64 aContentLength)
|
||||
nsJARChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
// XXX does this really make any sense at all?
|
||||
mContentLength = aContentLength;
|
||||
@ -778,6 +768,7 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(status) && channel) {
|
||||
nsCAutoString header;
|
||||
// Grab the security info from our base channel
|
||||
channel->GetSecurityInfo(getter_AddRefs(mSecurityInfo));
|
||||
|
||||
@ -786,7 +777,6 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
||||
// We only want to run scripts if the server really intended to
|
||||
// send us a JAR file. Check the server-supplied content type for
|
||||
// a JAR type.
|
||||
nsCAutoString header;
|
||||
httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Type"),
|
||||
header);
|
||||
nsCAutoString contentType;
|
||||
@ -797,6 +787,10 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
||||
mIsUnsafe = !(contentType.Equals(channelContentType) &&
|
||||
(contentType.EqualsLiteral("application/java-archive") ||
|
||||
contentType.EqualsLiteral("application/x-jar")));
|
||||
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Disposition"),
|
||||
header);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
SetPropertyAsACString(NS_CHANNEL_PROP_CONTENT_DISPOSITION, header);
|
||||
} else {
|
||||
nsCOMPtr<nsIJARChannel> innerJARChannel(do_QueryInterface(channel));
|
||||
if (innerJARChannel) {
|
||||
@ -804,9 +798,11 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
||||
innerJARChannel->GetIsUnsafe(&unsafe);
|
||||
mIsUnsafe = unsafe;
|
||||
}
|
||||
// Soon-to-be common way to get Disposition: right now only nsIJARChannel
|
||||
rv = NS_GetContentDisposition(request, header);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
SetPropertyAsACString(NS_CHANNEL_PROP_CONTENT_DISPOSITION, header);
|
||||
}
|
||||
|
||||
channel->GetContentDisposition(mContentDisposition);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(status) && mIsUnsafe) {
|
||||
@ -906,14 +902,14 @@ nsJARChannel::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// XXX want 64-bit values in OnDataAvailable
|
||||
rv = mListener->OnDataAvailable(this, mListenerContext, stream, offset, count);
|
||||
|
||||
// simply report progress here instead of hooking ourselves up as a
|
||||
// nsITransportEventSink implementation.
|
||||
// XXX do the 64-bit stuff for real
|
||||
if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
|
||||
mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
|
||||
mContentLength);
|
||||
PRUint64(mContentLength));
|
||||
|
||||
return rv; // let the pump cancel on failure
|
||||
}
|
||||
|
@ -96,8 +96,7 @@ private:
|
||||
nsCOMPtr<nsISupports> mListenerContext;
|
||||
nsCString mContentType;
|
||||
nsCString mContentCharset;
|
||||
nsCString mContentDisposition;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsresult mStatus;
|
||||
PRPackedBool mIsPending;
|
||||
|
@ -736,6 +736,12 @@ PRUint8* nsZipArchive::GetData(nsZipItem* aItem)
|
||||
return data + offset;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsZipArchive::CheckCRC(nsZipItem* aItem, PRUint8* aItemData) {
|
||||
PRUint32 crc = crc32(0, (const unsigned char*)aItemData, aItem->Size());
|
||||
return crc == aItem->CRC32();
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// nsZipArchive constructor and destructor
|
||||
//------------------------------------------
|
||||
|
@ -196,6 +196,8 @@ public:
|
||||
*/
|
||||
PRUint8* GetData(nsZipItem* aItem);
|
||||
|
||||
PRBool CheckCRC(nsZipItem* aItem, PRUint8* aData);
|
||||
|
||||
private:
|
||||
//--- private members ---
|
||||
|
||||
|
@ -407,20 +407,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::GetContentDisposition(nsACString &aContentDisposition)
|
||||
{
|
||||
aContentDisposition.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -399,20 +399,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::GetContentDisposition(nsACString &aContentDisposition)
|
||||
{
|
||||
aContentDisposition.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -636,20 +636,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::GetContentDisposition(nsACString &aContentDisposition)
|
||||
{
|
||||
aContentDisposition.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -693,20 +693,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::GetContentDisposition(nsACString &aContentDisposition)
|
||||
{
|
||||
aContentDisposition.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
PRInt64 mContentLength;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -988,10 +988,11 @@ NS_IMETHODIMP imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctx
|
||||
/* NS_WARNING if the content type from the channel isn't the same if the sniffing */
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
|
||||
if (mContentType.IsEmpty()) {
|
||||
LOG_SCOPE(gImgLog, "imgRequest::OnDataAvailable |sniffing of mimetype failed|");
|
||||
|
||||
nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
|
||||
|
||||
rv = NS_ERROR_FAILURE;
|
||||
if (chan) {
|
||||
rv = chan->GetContentType(mContentType);
|
||||
@ -1031,8 +1032,14 @@ NS_IMETHODIMP imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctx
|
||||
|
||||
/* set our content disposition as a property */
|
||||
nsCAutoString disposition;
|
||||
if (chan) {
|
||||
chan->GetContentDisposition(disposition);
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aRequest));
|
||||
if (httpChannel) {
|
||||
httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("content-disposition"), disposition);
|
||||
} else {
|
||||
nsCOMPtr<nsIMultiPartChannel> multiPartChannel(do_QueryInterface(aRequest));
|
||||
if (multiPartChannel) {
|
||||
multiPartChannel->GetContentDisposition(disposition);
|
||||
}
|
||||
}
|
||||
if (!disposition.IsEmpty()) {
|
||||
nsCOMPtr<nsISupportsCString> contentDisposition(do_CreateInstance("@mozilla.org/supports-cstring;1"));
|
||||
@ -1092,15 +1099,17 @@ NS_IMETHODIMP imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctx
|
||||
|
||||
if (imageType == imgIContainer::TYPE_RASTER) {
|
||||
/* Use content-length as a size hint for http channels. */
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aRequest));
|
||||
if (httpChannel) {
|
||||
PRInt64 contentLength;
|
||||
rv = httpChannel->GetContentLength(&contentLength);
|
||||
nsCAutoString contentLength;
|
||||
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("content-length"),
|
||||
contentLength);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 len = contentLength.ToInteger(&rv);
|
||||
|
||||
// Pass anything usable on so that the RasterImage can preallocate
|
||||
// its source buffer
|
||||
if (contentLength > 0) {
|
||||
PRUint32 sizeHint = (PRUint32) contentLength;
|
||||
if (len > 0) {
|
||||
PRUint32 sizeHint = (PRUint32) len;
|
||||
sizeHint = PR_MIN(sizeHint, 20000000); /* Bound by something reasonable */
|
||||
RasterImage* rasterImage = static_cast<RasterImage*>(mImage.get());
|
||||
rasterImage->SetSourceSizeHint(sizeHint);
|
||||
|
@ -784,6 +784,24 @@ static nsresult pref_InitAppDefaultsFromOmnijar()
|
||||
NS_WARNING("Error parsing preferences.");
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
// Bug 591866 - channel-prefs.js should not be in omni.jar
|
||||
rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(file));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Error getting default prefs dir");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = file->AppendNative(NS_LITERAL_CSTRING("channel-prefs.js"));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Error setting channel-prefs.js path");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = openPrefFile(file);
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("Error reading channel-prefs.js");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
@ -519,7 +519,7 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
|
||||
if (loadGroup)
|
||||
mWeakPtrChannelLoadGroup = do_GetWeakReference(loadGroup);
|
||||
|
||||
PRInt64 length;
|
||||
PRInt32 length;
|
||||
rv = channel->GetContentLength(&length);
|
||||
|
||||
// it's possible for the server to not send a Content-Length.
|
||||
|
@ -136,7 +136,7 @@ private:
|
||||
PRPackedBool mStartBinding;
|
||||
PRPackedBool mHaveFiredOnStartRequest;
|
||||
// these get passed to the plugin stream listener
|
||||
PRUint64 mLength;
|
||||
PRUint32 mLength;
|
||||
PRInt32 mStreamType;
|
||||
|
||||
// local cached file, we save the content into local cache if browser cache is not available,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user