Merging mozilla-inbound into mozilla-central.
@ -15,8 +15,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
|
||||
<script type="application/javascript"
|
||||
src="states.js"></script>
|
||||
|
||||
<!-- chrome-harness.js breaks this test (bug 736886) -->
|
||||
<!--
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/chrome-harness.js"/>
|
||||
-->
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
@ -41,9 +44,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
|
||||
"Wrong attribute on document!");
|
||||
|
||||
// nsIAccessibleDocument
|
||||
// getRootDirectory() depends on broken chrome-harness.js include (bug
|
||||
// 736886)
|
||||
/*
|
||||
var rootDir = getRootDirectory(window.location.href);
|
||||
is(docAcc.URL, rootDir.path + "test_nsIAccessibleDocument.html",
|
||||
"Wrong URL for document!");
|
||||
*/
|
||||
todo(false, "chrome-harness.js include is broken (bug 736886)");
|
||||
is(docAcc.title, "nsIAccessibleDocument chrome tests",
|
||||
"Wrong title for document!");
|
||||
is(docAcc.mimeType, "text/html",
|
||||
|
@ -442,6 +442,10 @@ CustomEventManager = {
|
||||
case "desktop-notification-close":
|
||||
AlertsHelper.handleEvent(detail);
|
||||
break;
|
||||
case "webapps-install-granted":
|
||||
case "webapps-install-denied":
|
||||
WebappsHelper.handleEvent(detail);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -478,18 +482,51 @@ AlertsHelper = {
|
||||
}
|
||||
|
||||
WebappsHelper = {
|
||||
_installers: {},
|
||||
_count: 0,
|
||||
|
||||
init: function webapps_init() {
|
||||
Services.obs.addObserver(this, "webapps-launch", false);
|
||||
Services.obs.addObserver(this, "webapps-ask-install", false);
|
||||
},
|
||||
|
||||
registerInstaller: function webapps_registerInstaller(data) {
|
||||
let id = "installer" + this._count++;
|
||||
this._installers[id] = data;
|
||||
return id;
|
||||
},
|
||||
|
||||
handleEvent: function webapps_handleEvent(detail) {
|
||||
if (!detail || !detail.id)
|
||||
return;
|
||||
|
||||
let installer = this._installers[detail.id];
|
||||
switch (detail.type) {
|
||||
case "webapps-install-granted":
|
||||
DOMApplicationRegistry.confirmInstall(installer);
|
||||
break;
|
||||
case "webapps-install-denied":
|
||||
DOMApplicationRegistry.denyInstall(installer);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
observe: function webapps_observe(subject, topic, data) {
|
||||
let json = JSON.parse(data);
|
||||
DOMApplicationRegistry.getManifestFor(json.origin, function(aManifest) {
|
||||
if (!aManifest)
|
||||
return;
|
||||
switch(topic) {
|
||||
case "webapps-launch":
|
||||
DOMApplicationRegistry.getManifestFor(json.origin, function(aManifest) {
|
||||
if (!aManifest)
|
||||
return;
|
||||
|
||||
let manifest = new DOMApplicationManifest(aManifest, json.origin);
|
||||
shell.sendEvent(content, "mozChromeEvent", { type: "webapps-launch", url: manifest.fullLaunchPath(), origin: json.origin });
|
||||
});
|
||||
let manifest = new DOMApplicationManifest(aManifest, json.origin);
|
||||
shell.sendEvent(content, "mozChromeEvent", { type: "webapps-launch", url: manifest.fullLaunchPath(), origin: json.origin });
|
||||
});
|
||||
break;
|
||||
case "webapps-ask-install":
|
||||
let id = this.registerInstaller(json);
|
||||
shell.sendEvent(content, "mozChromeEvent", { type: "webapps-ask-install", id: id, app: json.app } );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,16 +150,14 @@ const SNIPPETS_UPDATE_INTERVAL_MS = 86400000; // 1 Day.
|
||||
|
||||
let gSearchEngine;
|
||||
|
||||
function onLoad(event)
|
||||
{
|
||||
document.addEventListener("DOMContentLoaded", function init() {
|
||||
setupSearchEngine();
|
||||
document.getElementById("searchText").focus();
|
||||
|
||||
loadSnippets();
|
||||
|
||||
fitToWidth();
|
||||
window.addEventListener("resize", fitToWidth);
|
||||
}
|
||||
});
|
||||
window.addEventListener("load", fitToWidth);
|
||||
window.addEventListener("resize", fitToWidth);
|
||||
|
||||
|
||||
function onSearchSubmit(aEvent)
|
||||
|
@ -67,7 +67,7 @@
|
||||
src="chrome://browser/content/abouthome/aboutHome.js"/>
|
||||
</head>
|
||||
|
||||
<body dir="&locale.dir;" onload="onLoad(event)">
|
||||
<body dir="&locale.dir;">
|
||||
<div class="spacer"/>
|
||||
<div id="topSection">
|
||||
<img id="brandLogo" src="chrome://branding/content/about-logo.png" alt=""/>
|
||||
|
@ -156,6 +156,9 @@ __defineSetter__("PluralForm", function (val) {
|
||||
return this.PluralForm = val;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
|
||||
"resource:///modules/TelemetryStopwatch.jsm");
|
||||
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
XPCOMUtils.defineLazyGetter(this, "Weave", function() {
|
||||
let tmp = {};
|
||||
@ -3644,6 +3647,19 @@ function toOpenWindowByType(inType, uri, features)
|
||||
|
||||
function OpenBrowserWindow()
|
||||
{
|
||||
var telemetryObj = {};
|
||||
TelemetryStopwatch.start("FX_NEW_WINDOW_MS", telemetryObj);
|
||||
|
||||
function newDocumentShown(doc, topic, data) {
|
||||
if (topic == "document-shown" &&
|
||||
doc != document &&
|
||||
doc.defaultView == win) {
|
||||
Services.obs.removeObserver(newDocumentShown, "document-shown");
|
||||
TelemetryStopwatch.finish("FX_NEW_WINDOW_MS", telemetryObj);
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(newDocumentShown, "document-shown", false);
|
||||
|
||||
var charsetArg = new String();
|
||||
var handler = Components.classes["@mozilla.org/browser/clh;1"]
|
||||
.getService(Components.interfaces.nsIBrowserHandler);
|
||||
@ -3900,10 +3916,23 @@ var FullScreen = {
|
||||
if (event && event.type == "fullscreen")
|
||||
enterFS = !enterFS;
|
||||
|
||||
// show/hide all menubars, toolbars (except the full screen toolbar)
|
||||
this.showXULChrome("toolbar", !enterFS);
|
||||
// Toggle the View:FullScreen command, which controls elements like the
|
||||
// fullscreen menuitem, menubars, and the appmenu.
|
||||
document.getElementById("View:FullScreen").setAttribute("checked", enterFS);
|
||||
|
||||
// On OS X Lion we don't want to hide toolbars when entering fullscreen, unless
|
||||
// we're entering DOM fullscreen, in which case we should hide the toolbars.
|
||||
// If we're leaving fullscreen, then we'll go through the exit code below to
|
||||
// make sure toolbars are made visible in the case of DOM fullscreen.
|
||||
if (enterFS && this.useLionFullScreen) {
|
||||
if (document.mozFullScreen)
|
||||
this.showXULChrome("toolbar", false);
|
||||
return;
|
||||
}
|
||||
|
||||
// show/hide menubars, toolbars (except the full screen toolbar)
|
||||
this.showXULChrome("toolbar", !enterFS);
|
||||
|
||||
if (enterFS) {
|
||||
// Add a tiny toolbar to receive mouseover and dragenter events, and provide affordance.
|
||||
// This will help simulate the "collapse" metaphor while also requiring less code and
|
||||
@ -4010,7 +4039,8 @@ var FullScreen = {
|
||||
gBrowser.tabContainer.addEventListener("TabSelect", this.exitDomFullScreen);
|
||||
|
||||
// Exit DOM full-screen mode when the browser window loses focus (ALT+TAB, etc).
|
||||
if (gPrefService.getBoolPref("full-screen-api.exit-on-deactivate")) {
|
||||
if (!this.useLionFullScreen &&
|
||||
gPrefService.getBoolPref("full-screen-api.exit-on-deactivate")) {
|
||||
window.addEventListener("deactivate", this);
|
||||
}
|
||||
|
||||
@ -4046,7 +4076,9 @@ var FullScreen = {
|
||||
gBrowser.tabContainer.removeEventListener("TabOpen", this.exitDomFullScreen);
|
||||
gBrowser.tabContainer.removeEventListener("TabClose", this.exitDomFullScreen);
|
||||
gBrowser.tabContainer.removeEventListener("TabSelect", this.exitDomFullScreen);
|
||||
window.removeEventListener("deactivate", this);
|
||||
if (this.useLionFullScreen) {
|
||||
window.removeEventListener("deactivate", this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -4396,6 +4428,18 @@ var FullScreen = {
|
||||
controls[i].hidden = aShow;
|
||||
}
|
||||
};
|
||||
XPCOMUtils.defineLazyGetter(FullScreen, "useLionFullScreen", function() {
|
||||
// We'll only use OS X Lion full screen if we're
|
||||
// * on OS X
|
||||
// * on Lion (Darwin 11.x) -- this will need to be updated for OS X 10.8
|
||||
// * have fullscreenbutton="true"
|
||||
#ifdef XP_MACOSX
|
||||
return /^11\./.test(Services.sysinfo.getProperty("version")) &&
|
||||
document.documentElement.getAttribute("fullscreenbutton") == "true";
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns true if |aMimeType| is text-based, false otherwise.
|
||||
|
@ -94,6 +94,7 @@
|
||||
macanimationtype="document"
|
||||
screenX="4" screenY="4"
|
||||
browsingmode="normal"
|
||||
fullscreenbutton="true"
|
||||
persist="screenX screenY width height sizemode">
|
||||
|
||||
# All JS files which are not content (only) dependent that browser.xul
|
||||
|
@ -427,6 +427,7 @@
|
||||
@BINPATH@/modules/*
|
||||
|
||||
; Safe Browsing
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
@BINPATH@/components/nsSafebrowsingApplication.manifest
|
||||
@BINPATH@/components/nsSafebrowsingApplication.js
|
||||
@BINPATH@/components/nsURLClassifier.manifest
|
||||
@ -434,6 +435,7 @@
|
||||
@BINPATH@/components/nsUrlClassifierListManager.js
|
||||
@BINPATH@/components/nsUrlClassifierLib.js
|
||||
@BINPATH@/components/url-classifier.xpt
|
||||
#endif
|
||||
|
||||
; GNOME hooks
|
||||
#ifdef MOZ_ENABLE_GNOME_COMPONENT
|
||||
|
@ -57,7 +57,10 @@ class DroidMixin(object):
|
||||
if self.processExist(app):
|
||||
return False
|
||||
|
||||
acmd = [ "am", "start", "-a", intent, "-W", "-n", "%s/.%s" % (app, activity)]
|
||||
acmd = [ "am", "start", "-W", "-n", "%s/.%s" % (app, activity)]
|
||||
|
||||
if intent:
|
||||
acmd.extend(["-a", intent])
|
||||
|
||||
if extra_args:
|
||||
acmd.extend(["--es", "args", " ".join(extra_args)])
|
||||
|
@ -1515,6 +1515,13 @@ public:
|
||||
// returns it.
|
||||
static PRUint32 FilterDropEffect(PRUint32 aAction, PRUint32 aEffectAllowed);
|
||||
|
||||
/*
|
||||
* Return true if the target of a drop event is a content document that is
|
||||
* an ancestor of the document for the source of the drag.
|
||||
*/
|
||||
static bool CheckForSubFrameDrop(nsIDragSession* aDragSession,
|
||||
nsDragEvent* aDropEvent);
|
||||
|
||||
/**
|
||||
* Return true if aURI is a local file URI (i.e. file://).
|
||||
*/
|
||||
@ -1659,15 +1666,19 @@ public:
|
||||
|
||||
/**
|
||||
* Convert ASCII A-Z to a-z.
|
||||
* @return NS_OK on success, or NS_ERROR_OUT_OF_MEMORY if making the string
|
||||
* writable needs to allocate memory and that allocation fails.
|
||||
*/
|
||||
static void ASCIIToLower(nsAString& aStr);
|
||||
static void ASCIIToLower(const nsAString& aSource, nsAString& aDest);
|
||||
static nsresult ASCIIToLower(nsAString& aStr);
|
||||
static nsresult ASCIIToLower(const nsAString& aSource, nsAString& aDest);
|
||||
|
||||
/**
|
||||
* Convert ASCII a-z to A-Z.
|
||||
* @return NS_OK on success, or NS_ERROR_OUT_OF_MEMORY if making the string
|
||||
* writable needs to allocate memory and that allocation fails.
|
||||
*/
|
||||
static void ASCIIToUpper(nsAString& aStr);
|
||||
static void ASCIIToUpper(const nsAString& aSource, nsAString& aDest);
|
||||
static nsresult ASCIIToUpper(nsAString& aStr);
|
||||
static nsresult ASCIIToUpper(const nsAString& aSource, nsAString& aDest);
|
||||
|
||||
// Returns NS_OK for same origin, error (NS_ERROR_DOM_BAD_URI) if not.
|
||||
static nsresult CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChannel);
|
||||
|
@ -178,6 +178,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsParserConstants.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIBidiKeyboard.h"
|
||||
@ -5180,8 +5181,15 @@ nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent)
|
||||
dragSession->SetDataTransfer(initialDataTransfer);
|
||||
}
|
||||
|
||||
bool isCrossDomainSubFrameDrop = false;
|
||||
if (aDragEvent->message == NS_DRAGDROP_DROP ||
|
||||
aDragEvent->message == NS_DRAGDROP_DRAGDROP) {
|
||||
isCrossDomainSubFrameDrop = CheckForSubFrameDrop(dragSession, aDragEvent);
|
||||
}
|
||||
|
||||
// each event should use a clone of the original dataTransfer.
|
||||
initialDataTransfer->Clone(aDragEvent->message, aDragEvent->userCancelled,
|
||||
isCrossDomainSubFrameDrop,
|
||||
getter_AddRefs(aDragEvent->dataTransfer));
|
||||
NS_ENSURE_TRUE(aDragEvent->dataTransfer, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
@ -5243,6 +5251,52 @@ nsContentUtils::FilterDropEffect(PRUint32 aAction, PRUint32 aEffectAllowed)
|
||||
return nsIDragService::DRAGDROP_ACTION_NONE;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession, nsDragEvent* aDropEvent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> target = do_QueryInterface(aDropEvent->originalTarget);
|
||||
if (!target && !target->OwnerDoc()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsIDocument* targetDoc = target->OwnerDoc();
|
||||
nsCOMPtr<nsIWebNavigation> twebnav = do_GetInterface(targetDoc->GetWindow());
|
||||
nsCOMPtr<nsIDocShellTreeItem> tdsti = do_QueryInterface(twebnav);
|
||||
if (!tdsti) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PRInt32 type = -1;
|
||||
if (NS_FAILED(tdsti->GetItemType(&type))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Always allow dropping onto chrome shells.
|
||||
if (type == nsIDocShellTreeItem::typeChrome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there is no source node, then this is a drag from another
|
||||
// application, which should be allowed.
|
||||
nsCOMPtr<nsIDOMDocument> sourceDocument;
|
||||
aDragSession->GetSourceDocument(getter_AddRefs(sourceDocument));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(sourceDocument);
|
||||
if (doc) {
|
||||
// Get each successive parent of the source document and compare it to
|
||||
// the drop document. If they match, then this is a drag from a child frame.
|
||||
do {
|
||||
doc = doc->GetParentDocument();
|
||||
if (doc == targetDoc) {
|
||||
// The drag is from a child frame.
|
||||
return true;
|
||||
}
|
||||
} while (doc);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::URIIsLocalFile(nsIURI *aURI)
|
||||
@ -5324,11 +5378,14 @@ nsContentUtils::GetCurrentJSContext()
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsresult
|
||||
nsContentUtils::ASCIIToLower(nsAString& aStr)
|
||||
{
|
||||
PRUnichar* iter = aStr.BeginWriting();
|
||||
PRUnichar* end = aStr.EndWriting();
|
||||
if (NS_UNLIKELY(!iter || !end)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
while (iter != end) {
|
||||
PRUnichar c = *iter;
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
@ -5336,16 +5393,20 @@ nsContentUtils::ASCIIToLower(nsAString& aStr)
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsresult
|
||||
nsContentUtils::ASCIIToLower(const nsAString& aSource, nsAString& aDest)
|
||||
{
|
||||
PRUint32 len = aSource.Length();
|
||||
aDest.SetLength(len);
|
||||
if (aDest.Length() == len) {
|
||||
PRUnichar* dest = aDest.BeginWriting();
|
||||
if (NS_UNLIKELY(!dest)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
const PRUnichar* iter = aSource.BeginReading();
|
||||
const PRUnichar* end = aSource.EndReading();
|
||||
while (iter != end) {
|
||||
@ -5355,15 +5416,20 @@ nsContentUtils::ASCIIToLower(const nsAString& aSource, nsAString& aDest)
|
||||
++iter;
|
||||
++dest;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsresult
|
||||
nsContentUtils::ASCIIToUpper(nsAString& aStr)
|
||||
{
|
||||
PRUnichar* iter = aStr.BeginWriting();
|
||||
PRUnichar* end = aStr.EndWriting();
|
||||
if (NS_UNLIKELY(!iter || !end)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
while (iter != end) {
|
||||
PRUnichar c = *iter;
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
@ -5371,16 +5437,20 @@ nsContentUtils::ASCIIToUpper(nsAString& aStr)
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsresult
|
||||
nsContentUtils::ASCIIToUpper(const nsAString& aSource, nsAString& aDest)
|
||||
{
|
||||
PRUint32 len = aSource.Length();
|
||||
aDest.SetLength(len);
|
||||
if (aDest.Length() == len) {
|
||||
PRUnichar* dest = aDest.BeginWriting();
|
||||
if (NS_UNLIKELY(!dest)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
const PRUnichar* iter = aSource.BeginReading();
|
||||
const PRUnichar* end = aSource.EndReading();
|
||||
while (iter != end) {
|
||||
@ -5390,7 +5460,9 @@ nsContentUtils::ASCIIToUpper(const nsAString& aSource, nsAString& aDest)
|
||||
++iter;
|
||||
++dest;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -1379,24 +1379,31 @@ nsTreeSanitizer::SanitizeURL(mozilla::dom::Element* aElement,
|
||||
nsCOMPtr<nsIURI> baseURI = aElement->GetBaseURI();
|
||||
nsCOMPtr<nsIURI> attrURI;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(attrURI), v, nsnull, baseURI);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckLoadURIWithPrincipal(sNullPrincipal, attrURI, flags);
|
||||
}
|
||||
if (mCidEmbedsOnly &&
|
||||
NS_SUCCEEDED(rv) &&
|
||||
kNameSpaceID_None == aNamespace) {
|
||||
if (nsGkAtoms::src == aLocalName || nsGkAtoms::background == aLocalName) {
|
||||
bool isCid;
|
||||
attrURI->SchemeIs("cid", &isCid);
|
||||
if (!isCid) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (mCidEmbedsOnly &&
|
||||
kNameSpaceID_None == aNamespace) {
|
||||
if (nsGkAtoms::src == aLocalName || nsGkAtoms::background == aLocalName) {
|
||||
// comm-central uses a hack that makes nsIURIs created with cid: specs
|
||||
// actually have an about:blank spec. Therefore, nsIURI facilities are
|
||||
// useless for cid: when comm-central code is participating.
|
||||
if (!(v.Length() > 4 &&
|
||||
(v[0] == 'c' || v[0] == 'C') &&
|
||||
(v[1] == 'i' || v[1] == 'I') &&
|
||||
(v[2] == 'd' || v[2] == 'D') &&
|
||||
v[3] == ':')) {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
} else if (nsGkAtoms::cdgroup_ == aLocalName ||
|
||||
nsGkAtoms::altimg_ == aLocalName ||
|
||||
nsGkAtoms::definitionURL_ == aLocalName) {
|
||||
// Gecko doesn't fetch these now and shouldn't in the future, but
|
||||
// in case someone goofs with these in the future, let's drop them.
|
||||
rv = NS_ERROR_FAILURE;
|
||||
} else {
|
||||
rv = secMan->CheckLoadURIWithPrincipal(sNullPrincipal, attrURI, flags);
|
||||
}
|
||||
} else if (nsGkAtoms::cdgroup_ == aLocalName ||
|
||||
nsGkAtoms::altimg_ == aLocalName ||
|
||||
nsGkAtoms::definitionURL_ == aLocalName) {
|
||||
// Gecko doesn't fetch these now and shouldn't in the future, but
|
||||
// in case someone goofs with these in the future, let's drop them.
|
||||
rv = NS_ERROR_FAILURE;
|
||||
} else {
|
||||
rv = secMan->CheckLoadURIWithPrincipal(sNullPrincipal, attrURI, flags);
|
||||
}
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -97,6 +97,7 @@
|
||||
#include "gfxFont.h"
|
||||
#include "gfxBlur.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "nsRenderingContext.h"
|
||||
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsFrameLoader.h"
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "prlog.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
@ -55,6 +56,8 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -97,6 +100,7 @@ nsDOMDataTransfer::nsDOMDataTransfer()
|
||||
mReadOnly(false),
|
||||
mIsExternal(false),
|
||||
mUserCancelled(false),
|
||||
mIsCrossDomainSubFrameDrop(false),
|
||||
mDragImageX(0),
|
||||
mDragImageY(0)
|
||||
{
|
||||
@ -110,6 +114,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(PRUint32 aEventType)
|
||||
mReadOnly(true),
|
||||
mIsExternal(true),
|
||||
mUserCancelled(false),
|
||||
mIsCrossDomainSubFrameDrop(false),
|
||||
mDragImageX(0),
|
||||
mDragImageY(0)
|
||||
{
|
||||
@ -121,6 +126,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(PRUint32 aEventType,
|
||||
bool aCursorState,
|
||||
bool aIsExternal,
|
||||
bool aUserCancelled,
|
||||
bool aIsCrossDomainSubFrameDrop,
|
||||
nsTArray<nsTArray<TransferItem> >& aItems,
|
||||
nsIDOMElement* aDragImage,
|
||||
PRUint32 aDragImageX,
|
||||
@ -132,6 +138,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(PRUint32 aEventType,
|
||||
mReadOnly(true),
|
||||
mIsExternal(aIsExternal),
|
||||
mUserCancelled(aUserCancelled),
|
||||
mIsCrossDomainSubFrameDrop(aIsCrossDomainSubFrameDrop),
|
||||
mItems(aItems),
|
||||
mDragImage(aDragImage),
|
||||
mDragImageX(aDragImageX),
|
||||
@ -330,7 +337,10 @@ nsDOMDataTransfer::GetData(const nsAString& aFormat, nsAString& aData)
|
||||
// for the URL type, parse out the first URI from the list. The URIs are
|
||||
// separated by newlines
|
||||
nsAutoString lowercaseFormat;
|
||||
nsContentUtils::ASCIIToLower(aFormat, lowercaseFormat);
|
||||
rv = nsContentUtils::ASCIIToLower(aFormat, lowercaseFormat);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (lowercaseFormat.EqualsLiteral("url")) {
|
||||
PRInt32 lastidx = 0, idx;
|
||||
@ -463,12 +473,16 @@ nsDOMDataTransfer::MozGetDataAt(const nsAString& aFormat,
|
||||
|
||||
nsTArray<TransferItem>& item = mItems[aIndex];
|
||||
|
||||
// allow access to any data in the drop and dragdrop events, or if the
|
||||
// UniversalXPConnect privilege is set, otherwise only allow access to
|
||||
// data from the same principal.
|
||||
// Check if the caller is allowed to access the drag data. Callers with
|
||||
// UniversalXPConnect privileges can always read the data. During the
|
||||
// drop event, allow retrieving the data except in the case where the
|
||||
// source of the drag is in a child frame of the caller. In that case,
|
||||
// we only allow access to data of the same principal. During other events,
|
||||
// only allow access to the data with the same principal.
|
||||
nsIPrincipal* principal = nsnull;
|
||||
if (mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
|
||||
!nsContentUtils::CallerHasUniversalXPConnect()) {
|
||||
if (mIsCrossDomainSubFrameDrop ||
|
||||
(mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
|
||||
!nsContentUtils::CallerHasUniversalXPConnect())) {
|
||||
nsresult rv = NS_OK;
|
||||
principal = GetCurrentPrincipal(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -615,6 +629,11 @@ nsDOMDataTransfer::AddElement(nsIDOMElement* aElement)
|
||||
{
|
||||
NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);
|
||||
|
||||
if (aElement) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
|
||||
if (mReadOnly)
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
|
||||
@ -625,12 +644,13 @@ nsDOMDataTransfer::AddElement(nsIDOMElement* aElement)
|
||||
|
||||
nsresult
|
||||
nsDOMDataTransfer::Clone(PRUint32 aEventType, bool aUserCancelled,
|
||||
bool aIsCrossDomainSubFrameDrop,
|
||||
nsIDOMDataTransfer** aNewDataTransfer)
|
||||
{
|
||||
nsDOMDataTransfer* newDataTransfer =
|
||||
new nsDOMDataTransfer(aEventType, mEffectAllowed, mCursorState,
|
||||
mIsExternal, aUserCancelled, mItems,
|
||||
mDragImage, mDragImageX, mDragImageY);
|
||||
mIsExternal, aUserCancelled, aIsCrossDomainSubFrameDrop,
|
||||
mItems, mDragImage, mDragImageX, mDragImageY);
|
||||
NS_ENSURE_TRUE(newDataTransfer, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
*aNewDataTransfer = newDataTransfer;
|
||||
|
@ -100,6 +100,7 @@ protected:
|
||||
bool aCursorState,
|
||||
bool aIsExternal,
|
||||
bool aUserCancelled,
|
||||
bool aIsCrossDomainSubFrameDrop,
|
||||
nsTArray<nsTArray<TransferItem> >& aItems,
|
||||
nsIDOMElement* aDragImage,
|
||||
PRUint32 aDragImageX,
|
||||
@ -193,6 +194,10 @@ protected:
|
||||
// true if the user cancelled the drag. Used only for the dragend event.
|
||||
bool mUserCancelled;
|
||||
|
||||
// true if this is a cross-domain drop from a subframe where access to the
|
||||
// data should be prevented
|
||||
bool mIsCrossDomainSubFrameDrop;
|
||||
|
||||
// array of items, each containing an array of format->data pairs
|
||||
nsTArray<nsTArray<TransferItem> > mItems;
|
||||
|
||||
|
@ -352,8 +352,10 @@ nsGenericHTMLElement::SetAttribute(const nsAString& aName,
|
||||
nsCOMPtr<nsIAtom> nameAtom;
|
||||
if (IsInHTMLDocument()) {
|
||||
nsAutoString lower;
|
||||
nsContentUtils::ASCIIToLower(aName, lower);
|
||||
nameAtom = do_GetAtom(lower);
|
||||
rv = nsContentUtils::ASCIIToLower(aName, lower);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nameAtom = do_GetAtom(lower);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nameAtom = do_GetAtom(aName);
|
||||
|
@ -326,7 +326,10 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
||||
}
|
||||
|
||||
nsAutoString type;
|
||||
nsContentUtils::ASCIIToLower(aMimeType, type);
|
||||
nsresult rv = nsContentUtils::ASCIIToLower(aMimeType, type);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString params;
|
||||
|
||||
@ -367,8 +370,7 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
nsresult rv = ExtractData(type, params, getter_AddRefs(stream),
|
||||
fallbackToPNG);
|
||||
rv = ExtractData(type, params, getter_AddRefs(stream), fallbackToPNG);
|
||||
|
||||
// If there are unrecognized custom parse options, we should fall back to
|
||||
// the default values for the encoder without any options at all.
|
||||
|
@ -15,7 +15,7 @@ Test that restricted key pressed drop documents out of DOM full-screen mode.
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="document.body.mozRequestFullScreen();">
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
@ -92,28 +92,35 @@ function testScriptInitiatedKeyEvents() {
|
||||
|
||||
function testNextKey() {
|
||||
if (!document.mozFullScreen) {
|
||||
document.addEventListener("mozfullscreenchange", reallyTestNextKey, false);
|
||||
document.body.mozRequestFullScreen();
|
||||
}
|
||||
// mozRequestFullScreen() is async...
|
||||
setTimeout(
|
||||
function() {
|
||||
ok(document.mozFullScreen, "Must be in full-screen mode");
|
||||
else {
|
||||
reallyTestNextKey();
|
||||
}
|
||||
}
|
||||
|
||||
gKeyName = keyList[gKeyTestIndex].code;
|
||||
gKeyCode = KeyEvent["DOM_" + gKeyName];
|
||||
gKeySuppressed = keyList[gKeyTestIndex].suppressed;
|
||||
gKeyTestIndex++;
|
||||
function reallyTestNextKey() {
|
||||
document.removeEventListener("mozfullscreenchange", reallyTestNextKey, false);
|
||||
|
||||
testScriptInitiatedKeyEvents();
|
||||
testTrustedKeyEvents();
|
||||
}, 0);
|
||||
ok(document.mozFullScreen, "Must be in full-screen mode");
|
||||
|
||||
gKeyName = keyList[gKeyTestIndex].code;
|
||||
gKeyCode = KeyEvent["DOM_" + gKeyName];
|
||||
gKeySuppressed = keyList[gKeyTestIndex].suppressed;
|
||||
gKeyTestIndex++;
|
||||
|
||||
testScriptInitiatedKeyEvents();
|
||||
testTrustedKeyEvents();
|
||||
}
|
||||
|
||||
window.addEventListener("keydown", keyHandler, true);
|
||||
window.addEventListener("keyup", keyHandler, true);
|
||||
window.addEventListener("keypress", keyHandler, true);
|
||||
setTimeout(testNextKey, 0);
|
||||
|
||||
function begin() {
|
||||
testNextKey();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -16,7 +16,7 @@ Test DOM full-screen API.
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 545812 **/
|
||||
@ -47,8 +47,6 @@ var fullScreenChangeCount = 0;
|
||||
var fullscreendenied = false;
|
||||
var fullScreenErrorRun = false;
|
||||
|
||||
document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true;}, false);
|
||||
|
||||
function sendMouseClick(element) {
|
||||
synthesizeMouseAtCenter(element, {});
|
||||
}
|
||||
@ -232,10 +230,11 @@ function fullScreenChange(event) {
|
||||
fullScreenChangeCount++;
|
||||
}
|
||||
|
||||
document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true;}, false);
|
||||
document.addEventListener("mozfullscreenchange", fullScreenChange, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {fullScreenElement().mozRequestFullScreen();});
|
||||
function begin() {
|
||||
fullScreenElement().mozRequestFullScreen();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -15,7 +15,7 @@ Test DOM full-screen API.
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="run();">
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
@ -35,7 +35,7 @@ document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true
|
||||
|
||||
var gotFullScreenChange = false;
|
||||
|
||||
function run() {
|
||||
function begin() {
|
||||
document.addEventListener("mozfullscreenchange",
|
||||
function() {
|
||||
ok(false, "Should never receive a mozfullscreenchange event in the main window.");
|
||||
|
@ -16,7 +16,7 @@ exit DOM full-screen mode.
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="startTest();">
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
@ -49,9 +49,9 @@ function fullscreenchange2(event) {
|
||||
finish();
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
function begin() {
|
||||
document.addEventListener("mozfullscreenchange", fullscreenchange1, false);
|
||||
SimpleTest.waitForFocus(function() {document.body.mozRequestFullScreen();});
|
||||
document.body.mozRequestFullScreen();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -8,7 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=697636
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="boom();">
|
||||
<body>
|
||||
|
||||
<iframe id="f" src="data:text/html,<body text=green>1" mozallowfullscreen></iframe>
|
||||
|
||||
@ -25,7 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=697636
|
||||
var frameWin;
|
||||
var e1;
|
||||
|
||||
function boom()
|
||||
function begin()
|
||||
{
|
||||
frameWin = document.getElementById("f").contentWindow;
|
||||
e1 = frameWin.document.documentElement;
|
||||
|
@ -8,7 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=685402
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="boom();" style="background-color: gray;">
|
||||
<body style="background-color: gray;">
|
||||
|
||||
<iframe id="f" src="data:text/html,<body text=green>1" mozallowfullscreen></iframe>
|
||||
|
||||
@ -27,16 +27,17 @@ var e1;
|
||||
var prevEnabled;
|
||||
var prevTrusted;
|
||||
|
||||
function boom()
|
||||
function begin()
|
||||
{
|
||||
frameWin = document.getElementById("f").contentWindow;
|
||||
e1 = frameWin.document.body;
|
||||
document.addEventListener("mozfullscreenchange", function onfullscreen() {
|
||||
document.removeEventListener("mozfullscreenchange", onfullscreen, false);
|
||||
opener.ok(document.mozFullScreen, "[navigation] Request should be granted");
|
||||
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
|
||||
}, false);
|
||||
|
||||
e1.mozRequestFullScreen();
|
||||
setTimeout(
|
||||
function() {
|
||||
opener.ok(document.mozFullScreen, "[navigation] Request should be granted");
|
||||
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function b2()
|
||||
|
@ -21,7 +21,7 @@ Test plugins with DOM full-screen API:
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="scheduleTest();">
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Windowed plugin, focusing should revoke full-screen. -->
|
||||
@ -59,7 +59,7 @@ const isMacOs = navigator.appVersion.indexOf("Macintosh") != -1;
|
||||
|
||||
var windowedPlugin = null;
|
||||
|
||||
function scheduleTest() {
|
||||
function begin() {
|
||||
// Delay test startup long enough for the windowed plugin in the subframe to
|
||||
// start up and create its window.
|
||||
opener.SimpleTest.executeSoon(function() {
|
||||
|
@ -20,7 +20,7 @@ Tests:
|
||||
<title>Test for Bug 700764</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<body>
|
||||
|
||||
<div id="fse">
|
||||
<div id="fse-inner">
|
||||
@ -54,13 +54,9 @@ function e(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(
|
||||
function() {
|
||||
addListener("change", change1);
|
||||
e("fse").mozRequestFullScreen();
|
||||
}
|
||||
);
|
||||
function begin() {
|
||||
addListener("change", change1);
|
||||
e("fse").mozRequestFullScreen();
|
||||
}
|
||||
|
||||
function change1() {
|
||||
|
@ -24,12 +24,10 @@
|
||||
/** Tests for Bug 545812 **/
|
||||
|
||||
// Ensure the full-screen api is enabled, and will be disabled on test exit.
|
||||
var prevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
|
||||
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
|
||||
|
||||
// Disable the requirement for trusted contexts only, so the tests are easier
|
||||
// to write.
|
||||
var prevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
|
||||
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
|
||||
|
||||
// Run the tests which go full-screen in new windows, as mochitests normally
|
||||
@ -50,6 +48,7 @@ var testWindow = null;
|
||||
var gTestIndex = 0;
|
||||
|
||||
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
|
||||
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||
|
||||
function nextTest() {
|
||||
if (isWinXP) {
|
||||
@ -59,13 +58,34 @@ function nextTest() {
|
||||
}
|
||||
if (testWindow) {
|
||||
testWindow.close();
|
||||
if (isOSXLion) {
|
||||
// On OS X Lion, tests cause problems. Timeouts are a bad way to get around
|
||||
// the problem and may lead to future [orange], but they are the only option
|
||||
// at this point.
|
||||
SimpleTest.waitForFocus(function() { setTimeout(runNextTest, 3000); });
|
||||
return;
|
||||
}
|
||||
}
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
if (gTestIndex < gTestWindows.length) {
|
||||
testWindow = window.open(gTestWindows[gTestIndex], "", "width=500,height=500");
|
||||
// We'll wait for the window to load, then make sure our window is refocused
|
||||
// before starting the test, which will get kicked off on "focus".
|
||||
// This ensures that we're essentially back on the primary "desktop" on
|
||||
// OS X Lion before we run the test.
|
||||
testWindow.addEventListener("load", function onload() {
|
||||
testWindow.removeEventListener("load", onload, false);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
SimpleTest.waitForFocus(testWindow.begin, testWindow);
|
||||
});
|
||||
}, false);
|
||||
gTestIndex++;
|
||||
} else {
|
||||
SpecialPowers.setBoolPref("full-screen-api.enabled", prevEnabled);
|
||||
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", prevTrusted);
|
||||
SpecialPowers.clearUserPref("full-screen-api.enabled");
|
||||
SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
@ -407,7 +407,10 @@ HTMLContentSink::AddAttributes(const nsIParserNode& aNode,
|
||||
nsAutoString key;
|
||||
for (; i != limit; i += step) {
|
||||
// Get lower-cased key
|
||||
nsContentUtils::ASCIIToLower(aNode.GetKeyAt(i), key);
|
||||
nsresult rv = nsContentUtils::ASCIIToLower(aNode.GetKeyAt(i), key);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> keyAtom = do_GetAtom(key);
|
||||
|
||||
|
@ -399,8 +399,14 @@ nsSMILAnimationController::DoSample(bool aSkipUnchangedContainers)
|
||||
// Set running sample flag -- do this before flushing styles so that when we
|
||||
// flush styles we don't end up requesting extra samples
|
||||
mRunningSample = true;
|
||||
nsCOMPtr<nsIDocument> kungFuDeathGrip(mDocument); // keeps 'this' alive too
|
||||
mDocument->FlushPendingNotifications(Flush_Style);
|
||||
|
||||
// WARNING:
|
||||
// WARNING: the above flush may have destroyed the pres shell and/or
|
||||
// WARNING: frames and other layout related objects.
|
||||
// WARNING:
|
||||
|
||||
// STEP 1: Bring model up to date
|
||||
// (i) Rewind elements where necessary
|
||||
// (ii) Run milestone samples
|
||||
|
@ -95,6 +95,7 @@ public:
|
||||
// Methods for resampling all animations
|
||||
// (A resample performs the same operations as a sample but doesn't advance
|
||||
// the current time and doesn't check if the container is paused)
|
||||
// This will flush pending style changes for the document.
|
||||
void Resample() { DoSample(false); }
|
||||
|
||||
void SetResampleNeeded()
|
||||
@ -106,6 +107,8 @@ public:
|
||||
mResampleNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
// This will flush pending style changes for the document.
|
||||
void FlushResampleRequests()
|
||||
{
|
||||
if (!mResampleNeeded)
|
||||
|
@ -52,6 +52,8 @@
|
||||
#include "prdtoa.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
|
@ -3800,17 +3800,10 @@ nsSVGFEMorphologyElement::Filter(nsSVGFilterInstance *instance,
|
||||
PRUint8* sourceData = aSources[0]->mImage->Data();
|
||||
PRUint8* targetData = aTarget->mImage->Data();
|
||||
PRUint32 stride = aTarget->mImage->Stride();
|
||||
PRUint32 xExt[4], yExt[4]; // X, Y indices of RGBA extrema
|
||||
PRUint8 extrema[4]; // RGBA magnitude of extrema
|
||||
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue();
|
||||
|
||||
/* Scan the kernel for each pixel to determine max/min RGBA values. Note that
|
||||
* as we advance in the x direction, each kernel overlaps the previous kernel.
|
||||
* Thus, we can avoid iterating over the entire kernel by comparing the
|
||||
* leading edge of the new kernel against the extrema found in the previous
|
||||
* kernel. We must still scan the entire kernel if the previous extrema do
|
||||
* not fall within the current kernel or if we are starting a new row.
|
||||
*/
|
||||
// Scan the kernel for each pixel to determine max/min RGBA values.
|
||||
for (PRInt32 y = rect.y; y < rect.YMost(); y++) {
|
||||
PRUint32 startY = NS_MAX(0, y - ry);
|
||||
// We need to read pixels not just in 'rect', which is limited to
|
||||
@ -3822,39 +3815,18 @@ nsSVGFEMorphologyElement::Filter(nsSVGFilterInstance *instance,
|
||||
PRUint32 endX = NS_MIN(x + rx, instance->GetSurfaceWidth() - 1);
|
||||
PRUint32 targIndex = y * stride + 4 * x;
|
||||
|
||||
// We need to scan the entire kernel
|
||||
if (x == rect.x || xExt[0] <= startX || xExt[1] <= startX ||
|
||||
xExt[2] <= startX || xExt[3] <= startX) {
|
||||
PRUint32 i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
extrema[i] = sourceData[targIndex + i];
|
||||
}
|
||||
for (PRUint32 y1 = startY; y1 <= endY; y1++) {
|
||||
for (PRUint32 x1 = startX; x1 <= endX; x1++) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
PRUint8 pixel = sourceData[y1 * stride + 4 * x1 + i];
|
||||
if ((extrema[i] >= pixel &&
|
||||
op == nsSVGFEMorphologyElement::SVG_OPERATOR_ERODE) ||
|
||||
(extrema[i] <= pixel &&
|
||||
op == nsSVGFEMorphologyElement::SVG_OPERATOR_DILATE)) {
|
||||
extrema[i] = pixel;
|
||||
xExt[i] = x1;
|
||||
yExt[i] = y1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { // We only need to look at the newest column
|
||||
for (PRUint32 y1 = startY; y1 <= endY; y1++) {
|
||||
for (PRUint32 i = 0; i < 4; i++) {
|
||||
extrema[i] = sourceData[targIndex + i];
|
||||
}
|
||||
for (PRUint32 y1 = startY; y1 <= endY; y1++) {
|
||||
for (PRUint32 x1 = startX; x1 <= endX; x1++) {
|
||||
for (PRUint32 i = 0; i < 4; i++) {
|
||||
PRUint8 pixel = sourceData[y1 * stride + 4 * endX + i];
|
||||
if ((extrema[i] >= pixel &&
|
||||
PRUint8 pixel = sourceData[y1 * stride + 4 * x1 + i];
|
||||
if ((extrema[i] > pixel &&
|
||||
op == nsSVGFEMorphologyElement::SVG_OPERATOR_ERODE) ||
|
||||
(extrema[i] <= pixel &&
|
||||
(extrema[i] < pixel &&
|
||||
op == nsSVGFEMorphologyElement::SVG_OPERATOR_DILATE)) {
|
||||
extrema[i] = pixel;
|
||||
xExt[i] = endX;
|
||||
yExt[i] = y1;
|
||||
extrema[i] = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5119,14 +5091,11 @@ nsSVGFELightingElement::Filter(nsSVGFilterInstance *instance,
|
||||
S[2] = pointsAt[2] - lightPos[2];
|
||||
NORMALIZE(S);
|
||||
float dot = -DOT(L, S);
|
||||
if (dot < cosConeAngle) {
|
||||
color = NS_RGB(0, 0, 0);
|
||||
} else {
|
||||
float tmp = pow(dot, specularExponent);
|
||||
color = NS_RGB(PRUint8(NS_GET_R(lightColor) * tmp),
|
||||
PRUint8(NS_GET_G(lightColor) * tmp),
|
||||
PRUint8(NS_GET_B(lightColor) * tmp));
|
||||
}
|
||||
if (dot < cosConeAngle) dot = 0;
|
||||
float tmp = pow(dot, specularExponent);
|
||||
color = NS_RGB(PRUint8(NS_GET_R(lightColor) * tmp),
|
||||
PRUint8(NS_GET_G(lightColor) * tmp),
|
||||
PRUint8(NS_GET_B(lightColor) * tmp));
|
||||
} else {
|
||||
color = lightColor;
|
||||
}
|
||||
@ -5293,19 +5262,14 @@ nsSVGFEDiffuseLightingElement::LightPixel(const float *N, const float *L,
|
||||
float diffuseNL =
|
||||
mNumberAttributes[DIFFUSE_CONSTANT].GetAnimValue() * DOT(N, L);
|
||||
|
||||
if (diffuseNL > 0) {
|
||||
targetData[GFX_ARGB32_OFFSET_B] =
|
||||
NS_MIN(PRUint32(diffuseNL * NS_GET_B(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_G] =
|
||||
NS_MIN(PRUint32(diffuseNL * NS_GET_G(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_R] =
|
||||
NS_MIN(PRUint32(diffuseNL * NS_GET_R(color)), 255U);
|
||||
} else {
|
||||
targetData[GFX_ARGB32_OFFSET_B] = 0;
|
||||
targetData[GFX_ARGB32_OFFSET_G] = 0;
|
||||
targetData[GFX_ARGB32_OFFSET_R] = 0;
|
||||
}
|
||||
if (diffuseNL < 0) diffuseNL = 0;
|
||||
|
||||
targetData[GFX_ARGB32_OFFSET_B] =
|
||||
NS_MIN(PRUint32(diffuseNL * NS_GET_B(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_G] =
|
||||
NS_MIN(PRUint32(diffuseNL * NS_GET_G(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_R] =
|
||||
NS_MIN(PRUint32(diffuseNL * NS_GET_R(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_A] = 255;
|
||||
}
|
||||
|
||||
@ -5460,27 +5424,24 @@ nsSVGFESpecularLightingElement::LightPixel(const float *N, const float *L,
|
||||
float kS = mNumberAttributes[SPECULAR_CONSTANT].GetAnimValue();
|
||||
float dotNH = DOT(N, H);
|
||||
|
||||
if (dotNH > 0 && kS > 0) {
|
||||
float specularNH =
|
||||
kS * pow(dotNH, mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue());
|
||||
bool invalid = dotNH <= 0 || kS <= 0;
|
||||
kS *= invalid ? 0 : 1;
|
||||
PRUint8 minAlpha = invalid ? 255 : 0;
|
||||
|
||||
targetData[GFX_ARGB32_OFFSET_B] =
|
||||
NS_MIN(PRUint32(specularNH * NS_GET_B(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_G] =
|
||||
NS_MIN(PRUint32(specularNH * NS_GET_G(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_R] =
|
||||
NS_MIN(PRUint32(specularNH * NS_GET_R(color)), 255U);
|
||||
float specularNH =
|
||||
kS * pow(dotNH, mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue());
|
||||
|
||||
targetData[GFX_ARGB32_OFFSET_A] =
|
||||
NS_MAX(targetData[GFX_ARGB32_OFFSET_B],
|
||||
NS_MAX(targetData[GFX_ARGB32_OFFSET_G],
|
||||
targetData[GFX_ARGB32_OFFSET_R]));
|
||||
} else {
|
||||
targetData[GFX_ARGB32_OFFSET_B] = 0;
|
||||
targetData[GFX_ARGB32_OFFSET_G] = 0;
|
||||
targetData[GFX_ARGB32_OFFSET_R] = 0;
|
||||
targetData[GFX_ARGB32_OFFSET_A] = 255;
|
||||
}
|
||||
targetData[GFX_ARGB32_OFFSET_B] =
|
||||
NS_MIN(PRUint32(specularNH * NS_GET_B(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_G] =
|
||||
NS_MIN(PRUint32(specularNH * NS_GET_G(color)), 255U);
|
||||
targetData[GFX_ARGB32_OFFSET_R] =
|
||||
NS_MIN(PRUint32(specularNH * NS_GET_R(color)), 255U);
|
||||
|
||||
targetData[GFX_ARGB32_OFFSET_A] =
|
||||
NS_MAX(minAlpha, NS_MAX(targetData[GFX_ARGB32_OFFSET_B],
|
||||
NS_MAX(targetData[GFX_ARGB32_OFFSET_G],
|
||||
targetData[GFX_ARGB32_OFFSET_R])));
|
||||
}
|
||||
|
||||
//---------------------Image------------------------
|
||||
@ -5989,6 +5950,8 @@ nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance,
|
||||
PRUint8* targetData = aTarget->mImage->Data();
|
||||
PRUint32 stride = aTarget->mImage->Stride();
|
||||
|
||||
static PRUint8 dummyData[4] = { 0, 0, 0, 0 };
|
||||
|
||||
static const PRUint16 channelMap[5] = {
|
||||
0,
|
||||
GFX_ARGB32_OFFSET_R,
|
||||
@ -6011,13 +5974,20 @@ nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance,
|
||||
PRInt32 sourceY = y +
|
||||
NSToIntFloor(scaleOver255 * displacementData[targIndex + yChannel] +
|
||||
scaleAdjustment);
|
||||
if (sourceX < 0 || sourceX >= width ||
|
||||
sourceY < 0 || sourceY >= height) {
|
||||
*(PRUint32*)(targetData + targIndex) = 0;
|
||||
|
||||
bool outOfBounds = sourceX < 0 || sourceX >= width ||
|
||||
sourceY < 0 || sourceY >= height;
|
||||
PRUint8* data;
|
||||
PRInt32 multiplier;
|
||||
if (outOfBounds) {
|
||||
data = dummyData;
|
||||
multiplier = 0;
|
||||
} else {
|
||||
*(PRUint32*)(targetData + targIndex) =
|
||||
*(PRUint32*)(sourceData + sourceY * stride + 4 * sourceX);
|
||||
data = sourceData;
|
||||
multiplier = 1;
|
||||
}
|
||||
*(PRUint32*)(targetData + targIndex) =
|
||||
*(PRUint32*)(data + multiplier * (sourceY * stride + 4 * sourceX));
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -202,7 +202,6 @@ nsSVGSVGElement::nsSVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
mCurrentScale(1.0f),
|
||||
mPreviousTranslate(0.0f, 0.0f),
|
||||
mPreviousScale(1.0f),
|
||||
mRedrawSuspendCount(0),
|
||||
mStartAnimationOnBindToTree(!aFromParser),
|
||||
mImageNeedsTransformInvalidation(false),
|
||||
mIsPaintingSVGImageElement(false)
|
||||
@ -379,20 +378,9 @@ nsSVGSVGElement::GetCurrentTranslate(nsIDOMSVGPoint * *aCurrentTranslate)
|
||||
NS_IMETHODIMP
|
||||
nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval)
|
||||
{
|
||||
// suspendRedraw is a no-op in Mozilla, so it doesn't matter what
|
||||
// we set the ID out-param to:
|
||||
*_retval = 1;
|
||||
|
||||
if (++mRedrawSuspendCount > 1)
|
||||
return NS_OK;
|
||||
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsISVGSVGFrame* svgframe = do_QueryFrame(frame);
|
||||
// might fail this check if we've failed conditional processing
|
||||
if (svgframe) {
|
||||
svgframe->SuspendRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -400,32 +388,15 @@ nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval
|
||||
NS_IMETHODIMP
|
||||
nsSVGSVGElement::UnsuspendRedraw(PRUint32 suspend_handle_id)
|
||||
{
|
||||
if (mRedrawSuspendCount == 0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (mRedrawSuspendCount > 1) {
|
||||
--mRedrawSuspendCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return UnsuspendRedrawAll();
|
||||
// no-op
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void unsuspendRedrawAll (); */
|
||||
NS_IMETHODIMP
|
||||
nsSVGSVGElement::UnsuspendRedrawAll()
|
||||
{
|
||||
mRedrawSuspendCount = 0;
|
||||
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsISVGSVGFrame* svgframe = do_QueryFrame(frame);
|
||||
// might fail this check if we've failed conditional processing
|
||||
if (svgframe) {
|
||||
svgframe->UnsuspendRedraw();
|
||||
}
|
||||
}
|
||||
// no-op
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -87,18 +87,22 @@ nsSVGSwitchElement::nsSVGSwitchElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
void
|
||||
nsSVGSwitchElement::MaybeInvalidate()
|
||||
{
|
||||
// We don't reuse UpdateActiveChild() and check if mActiveChild has changed
|
||||
// to determine if we should invalidate. If we did that,
|
||||
// nsSVGUtils::UpdateGraphic would not invalidate the old mActiveChild area!
|
||||
// We must not change mActiveChild until after
|
||||
// InvalidateAndScheduleBoundsUpdate has been called, otherwise
|
||||
// it will not correctly invalidate the old mActiveChild area.
|
||||
|
||||
if (FindActiveChild() == mActiveChild) {
|
||||
nsIContent *newActiveChild = FindActiveChild();
|
||||
|
||||
if (newActiveChild == mActiveChild) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame *frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsSVGUtils::UpdateGraphic(frame);
|
||||
nsSVGUtils::InvalidateAndScheduleBoundsUpdate(frame);
|
||||
}
|
||||
|
||||
mActiveChild = newActiveChild;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -8,6 +8,9 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// Make sure that any change here is also made in
|
||||
// * mobile/android/base/GeckoScreenOrientationListener.java
|
||||
// * embedding/android/GeckoScreenOrientationListener.java
|
||||
enum ScreenOrientation {
|
||||
eScreenOrientation_Current = 0,
|
||||
eScreenOrientation_PortraitPrimary = 1, // 00000001
|
||||
|
@ -40,7 +40,7 @@
|
||||
interface nsIVariant;
|
||||
interface nsIDOMFileList;
|
||||
|
||||
[scriptable, uuid(E929ACB6-435C-4CB8-9AD1-AE3B9353BCC5)]
|
||||
[scriptable, uuid(7D73CFBF-EC30-4F8E-B6A4-BB31EB943580)]
|
||||
interface nsIDOMDataTransfer : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -264,8 +264,11 @@ interface nsIDOMDataTransfer : nsISupports
|
||||
|
||||
/**
|
||||
* Creates a copy of the data transfer object, for the given event type and
|
||||
* user cancelled flag.
|
||||
* user cancelled flag. If isCrossDomainSubFrameDrop is set, then this is a
|
||||
* cross-domain drop from a subframe where access to the data should be
|
||||
* prevented.
|
||||
*/
|
||||
[noscript] nsIDOMDataTransfer clone(in PRUint32 aEventType,
|
||||
in boolean aUserCancelled);
|
||||
in boolean aUserCancelled,
|
||||
in boolean isCrossDomainSubFrameDrop);
|
||||
};
|
||||
|
@ -33,8 +33,8 @@
|
||||
const NSLeftMouseDown = 1,
|
||||
NSLeftMouseUp = 2;
|
||||
|
||||
// Don't run any tests if we're not testing the Cocoa event model.
|
||||
if (plugin1.getEventModel() != 1) {
|
||||
window.opener.todo(false, "Skipping this test when not testing the Cocoa event model");
|
||||
window.opener.testsFinished();
|
||||
return;
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
var plugin1 = document.getElementById("plugin1");
|
||||
var plugin2 = document.getElementById("plugin2");
|
||||
|
||||
// Don't run any tests if we're not testing the Cocoa event model.
|
||||
if (plugin1.getEventModel() != 1) {
|
||||
window.opener.todo(false, "Skipping this test when not testing the Cocoa event model");
|
||||
window.opener.testsFinished();
|
||||
return;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript>
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function frameLoaded() {
|
||||
|
@ -10,6 +10,7 @@
|
||||
onload="nextStep()">
|
||||
|
||||
<script type="text/javascript;version=1.8">
|
||||
let testNum = 0;
|
||||
let tests = [
|
||||
function test1() {
|
||||
checkAndContinue("normal");
|
||||
@ -51,6 +52,7 @@ let tests = [
|
||||
];
|
||||
|
||||
function nextStep() {
|
||||
testNum++;
|
||||
tests.shift()();
|
||||
}
|
||||
|
||||
@ -70,9 +72,16 @@ function checkAndContinue(sizemode) {
|
||||
};
|
||||
|
||||
setTimeout(function() {
|
||||
is(window.document.documentElement.getAttribute("sizemode"), sizemode, "sizemode attribute should match actual window state");
|
||||
is(window.fullScreen, sizemode == "fullscreen", "window.fullScreen should match actual window state");
|
||||
is(window.windowState, windowStates[sizemode], "window.sizeMode should match actual window state");
|
||||
// The sizemode attribute is wrong when the window is in fullscreen.
|
||||
// cf. bug 714911
|
||||
if (sizemode != "fullscreen") {
|
||||
is(window.document.documentElement.getAttribute("sizemode"), sizemode,
|
||||
"Test " + testNum + ": sizemode attribute should match actual window state");
|
||||
}
|
||||
is(window.fullScreen, sizemode == "fullscreen",
|
||||
"Test " + testNum + ": window.fullScreen should match actual window state");
|
||||
is(window.windowState, windowStates[sizemode],
|
||||
"Test " + testNum + ": window.sizeMode should match actual window state");
|
||||
nextStep();
|
||||
}, 0);
|
||||
}
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIFileChannel.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIDocumentStateListener.h"
|
||||
|
@ -61,6 +61,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616590
|
||||
editor.insertAsCitedQuotation("<html><body><div contenteditable>foo</div></body></html>", "", true);
|
||||
document.documentElement.clientWidth;
|
||||
progress.removeProgressListener(this);
|
||||
ok(true, "Test complete");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "nsISelection.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMDOMStringList.h"
|
||||
@ -192,6 +193,15 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
|
||||
nsresult rv = dragEvent->GetDataTransfer(getter_AddRefs(dataTransfer));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
|
||||
NS_ASSERTION(dragSession, "No drag session");
|
||||
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aDropEvent));
|
||||
nsDragEvent* dragEventInternal = static_cast<nsDragEvent *>(privateEvent->GetInternalNSEvent());
|
||||
if (nsContentUtils::CheckForSubFrameDrop(dragSession, dragEventInternal)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Current doc is destination
|
||||
nsCOMPtr<nsIDOMDocument> destdomdoc;
|
||||
rv = GetDocument(getter_AddRefs(destdomdoc));
|
||||
|
@ -512,6 +512,7 @@ abstract public class GeckoApp
|
||||
|
||||
unregisterReceiver(mConnectivityReceiver);
|
||||
GeckoNetworkManager.getInstance().stop();
|
||||
GeckoScreenOrientationListener.getInstance().stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -531,6 +532,7 @@ abstract public class GeckoApp
|
||||
|
||||
registerReceiver(mConnectivityReceiver, mConnectivityFilter);
|
||||
GeckoNetworkManager.getInstance().start();
|
||||
GeckoScreenOrientationListener.getInstance().start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -586,6 +588,7 @@ abstract public class GeckoApp
|
||||
}
|
||||
|
||||
GeckoNetworkManager.getInstance().stop();
|
||||
GeckoScreenOrientationListener.getInstance().stop();
|
||||
|
||||
super.onDestroy();
|
||||
|
||||
|
@ -1843,4 +1843,16 @@ public class GeckoAppShell
|
||||
|
||||
// This is only used in Native Fennec.
|
||||
public static void setPreventPanning(final boolean aPreventPanning) { }
|
||||
|
||||
public static short getScreenOrientation() {
|
||||
return GeckoScreenOrientationListener.getInstance().getScreenOrientation();
|
||||
}
|
||||
|
||||
public static void enableScreenOrientationNotifications() {
|
||||
GeckoScreenOrientationListener.getInstance().enableNotifications();
|
||||
}
|
||||
|
||||
public static void disableScreenOrientationNotifications() {
|
||||
GeckoScreenOrientationListener.getInstance().disableNotifications();
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ public class GeckoEvent {
|
||||
public static final int VISITED = 21;
|
||||
public static final int NETWORK_CHANGED = 22;
|
||||
public static final int PROXIMITY_EVENT = 23;
|
||||
public static final int SCREENORIENTATION_CHANGED = 26;
|
||||
|
||||
public static final int IME_COMPOSITION_END = 0;
|
||||
public static final int IME_COMPOSITION_BEGIN = 1;
|
||||
@ -126,6 +127,8 @@ public class GeckoEvent {
|
||||
public double mBandwidth;
|
||||
public boolean mCanBeMetered;
|
||||
|
||||
public short mScreenOrientation;
|
||||
|
||||
public int mNativeWindow;
|
||||
|
||||
public GeckoEvent() {
|
||||
@ -333,4 +336,9 @@ public class GeckoEvent {
|
||||
mBandwidth = bandwidth;
|
||||
mCanBeMetered = canBeMetered;
|
||||
}
|
||||
|
||||
public GeckoEvent(short aScreenOrientation) {
|
||||
mType = SCREENORIENTATION_CHANGED;
|
||||
mScreenOrientation = aScreenOrientation;
|
||||
}
|
||||
}
|
||||
|
122
embedding/android/GeckoScreenOrientationListener.java
Normal file
@ -0,0 +1,122 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.OrientationEventListener;
|
||||
import android.view.Surface;
|
||||
|
||||
public class GeckoScreenOrientationListener
|
||||
{
|
||||
static class OrientationEventListenerImpl extends OrientationEventListener {
|
||||
public OrientationEventListenerImpl(Context c) {
|
||||
super(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrientationChanged(int aOrientation) {
|
||||
GeckoScreenOrientationListener.getInstance().updateScreenOrientation();
|
||||
}
|
||||
}
|
||||
|
||||
static private GeckoScreenOrientationListener sInstance = null;
|
||||
|
||||
// Make sure that any change in dom/base/ScreenOrientation.h happens here too.
|
||||
static public final short eScreenOrientation_PortraitPrimary = 1;
|
||||
static public final short eScreenOrientation_PortraitSecondary = 2;
|
||||
static public final short eScreenOrientation_LandscapePrimary = 4;
|
||||
static public final short eScreenOrientation_LandscapeSecondary = 8;
|
||||
|
||||
private short mOrientation;
|
||||
private OrientationEventListenerImpl mListener = null;
|
||||
|
||||
// Whether the listener should be listening to changes.
|
||||
private boolean mShouldBeListening = false;
|
||||
// Whether the listener should notify Gecko that a change happened.
|
||||
private boolean mShouldNotify = false;
|
||||
|
||||
private GeckoScreenOrientationListener() {
|
||||
mListener = new OrientationEventListenerImpl(GeckoApp.mAppContext);
|
||||
}
|
||||
|
||||
public static GeckoScreenOrientationListener getInstance() {
|
||||
if (sInstance == null) {
|
||||
sInstance = new GeckoScreenOrientationListener();
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
mShouldBeListening = true;
|
||||
updateScreenOrientation();
|
||||
|
||||
if (mShouldNotify) {
|
||||
startListening();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
mShouldBeListening = false;
|
||||
|
||||
if (mShouldNotify) {
|
||||
stopListening();
|
||||
}
|
||||
}
|
||||
|
||||
public void enableNotifications() {
|
||||
updateScreenOrientation();
|
||||
mShouldNotify = true;
|
||||
|
||||
if (mShouldBeListening) {
|
||||
startListening();
|
||||
}
|
||||
}
|
||||
|
||||
public void disableNotifications() {
|
||||
mShouldNotify = false;
|
||||
|
||||
if (mShouldBeListening) {
|
||||
stopListening();
|
||||
}
|
||||
}
|
||||
|
||||
private void startListening() {
|
||||
mListener.enable();
|
||||
}
|
||||
|
||||
private void stopListening() {
|
||||
mListener.disable();
|
||||
}
|
||||
|
||||
// NOTE: this is public so OrientationEventListenerImpl can access it.
|
||||
// Unfortunately, Java doesn't know about friendship.
|
||||
public void updateScreenOrientation() {
|
||||
int rotation = GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getRotation();
|
||||
short previousOrientation = mOrientation;
|
||||
|
||||
if (rotation == Surface.ROTATION_0) {
|
||||
mOrientation = eScreenOrientation_PortraitPrimary;
|
||||
} else if (rotation == Surface.ROTATION_180) {
|
||||
mOrientation = eScreenOrientation_PortraitSecondary;
|
||||
} else if (rotation == Surface.ROTATION_270) {
|
||||
mOrientation = eScreenOrientation_LandscapeSecondary;
|
||||
} else if (rotation == Surface.ROTATION_90) {
|
||||
mOrientation = eScreenOrientation_LandscapePrimary;
|
||||
} else {
|
||||
Log.e("GeckoScreenOrientationListener", "Unexpected value received! (" + rotation + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mShouldNotify && mOrientation != previousOrientation) {
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(mOrientation));
|
||||
}
|
||||
}
|
||||
|
||||
public short getScreenOrientation() {
|
||||
return mOrientation;
|
||||
}
|
||||
}
|
@ -57,6 +57,7 @@ JAVAFILES = \
|
||||
GeckoBatteryManager.java \
|
||||
VideoPlayer.java \
|
||||
GeckoNetworkManager.java \
|
||||
GeckoScreenOrientationListener.java \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_WEBSMS_BACKEND
|
||||
|
@ -507,7 +507,6 @@ public:
|
||||
bool SwapBuffers()
|
||||
{
|
||||
if (mSurface && !mPlatformContext) {
|
||||
//sEGLLibrary.fSetSwapRectangleANDROID(EGL_DISPLAY(), mSurface, 0, 0, gScreenBounds.width, gScreenBounds.height);
|
||||
return sEGLLibrary.fSwapBuffers(EGL_DISPLAY(), mSurface);
|
||||
} else {
|
||||
return false;
|
||||
|
@ -141,9 +141,6 @@ GLLibraryEGL::EnsureInitialized()
|
||||
SYMBOL(BindTexImage),
|
||||
SYMBOL(ReleaseTexImage),
|
||||
SYMBOL(QuerySurface),
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
SYMBOL(SetSwapRectangleANDROID),
|
||||
#endif
|
||||
{ NULL, { NULL } }
|
||||
};
|
||||
|
||||
|
@ -323,16 +323,6 @@ public:
|
||||
return b;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
EGLBoolean fSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface surface, EGLint left, EGLint top, EGLint width, EGLint height)
|
||||
{
|
||||
BEFORE_GL_CALL;
|
||||
EGLBoolean b = mSymbols.fSetSwapRectangleANDROID(dpy, surface, left, top, width, height);
|
||||
AFTER_GL_CALL;
|
||||
return b;
|
||||
}
|
||||
#endif
|
||||
|
||||
// New extension which allow us to lock texture and get raw image pointer
|
||||
EGLBoolean fLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list)
|
||||
{
|
||||
@ -467,10 +457,6 @@ public:
|
||||
pfnCreateImageKHR fCreateImageKHR;
|
||||
typedef EGLBoolean (GLAPIENTRY * pfnDestroyImageKHR)(EGLDisplay dpy, EGLImageKHR image);
|
||||
pfnDestroyImageKHR fDestroyImageKHR;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
typedef EGLBoolean (GLAPIENTRY * pfnSetSwapRectangleANDROID)(EGLDisplay dpy, EGLSurface surface, EGLint left, EGLint top, EGLint width, EGLint height);
|
||||
pfnSetSwapRectangleANDROID fSetSwapRectangleANDROID;
|
||||
#endif
|
||||
|
||||
// New extension which allow us to lock texture and get raw image pointer
|
||||
typedef EGLBoolean (GLAPIENTRY * pfnLockSurfaceKHR)(EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
|
||||
|
@ -485,8 +485,8 @@ const BYTE ComponentPass2ShaderPS[] =
|
||||
dcl t0.xy
|
||||
dcl_2d s0
|
||||
texld r0, t0, s0
|
||||
mul r0.xyz, r0, c0.x
|
||||
mov r0.w, c1.x
|
||||
mul r0, r0, c0.x
|
||||
mov oC0, r0
|
||||
|
||||
// approximately 4 instruction slots used (1 texture, 3 arithmetic)
|
||||
@ -536,11 +536,11 @@ const BYTE RGBShaderPS[] =
|
||||
15, 160, 66, 0, 0, 3,
|
||||
0, 0, 15, 128, 0, 0,
|
||||
228, 176, 0, 8, 228, 160,
|
||||
1, 0, 0, 2, 0, 0,
|
||||
8, 128, 1, 0, 0, 160,
|
||||
5, 0, 0, 3, 0, 0,
|
||||
7, 128, 0, 0, 228, 128,
|
||||
15, 128, 0, 0, 228, 128,
|
||||
0, 0, 0, 160, 1, 0,
|
||||
0, 2, 0, 0, 8, 128,
|
||||
1, 0, 0, 160, 1, 0,
|
||||
0, 2, 0, 8, 15, 128,
|
||||
0, 0, 228, 128, 255, 255,
|
||||
0, 0
|
||||
|
@ -84,9 +84,9 @@ float4 RGBAShader(const VS_OUTPUT aVertex) : COLOR
|
||||
float4 RGBShader(const VS_OUTPUT aVertex) : COLOR
|
||||
{
|
||||
float4 result;
|
||||
result = tex2D(s2D, aVertex.vTexCoords) * fLayerOpacity;
|
||||
result = tex2D(s2D, aVertex.vTexCoords);
|
||||
result.a = 1.0;
|
||||
return result;
|
||||
return result * fLayerOpacity;
|
||||
}
|
||||
|
||||
float4 YCbCrShader(const VS_OUTPUT aVertex) : COLOR
|
||||
|
@ -71,7 +71,6 @@ CPPSRCS = \
|
||||
SandboxHal.cpp \
|
||||
WindowIdentifier.cpp \
|
||||
HalWakeLock.cpp \
|
||||
ScreenOrientationFallback.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
@ -111,6 +110,11 @@ ifneq (gonk,$(MOZ_WIDGET_TOOLKIT)) #{
|
||||
CPPSRCS += FallbackLights.cpp FallbackTime.cpp
|
||||
endif #}
|
||||
|
||||
# Screen Orientation backend
|
||||
ifneq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
CPPSRCS += ScreenOrientationFallback.cpp
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "WindowIdentifier.h"
|
||||
#include "AndroidBridge.h"
|
||||
#include "mozilla/dom/network/Constants.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
|
||||
using mozilla::hal::WindowIdentifier;
|
||||
|
||||
@ -181,6 +182,41 @@ void
|
||||
PowerOff()
|
||||
{}
|
||||
|
||||
void
|
||||
EnableScreenOrientationNotifications()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->EnableScreenOrientationNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
DisableScreenOrientationNotifications()
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
bridge->DisableScreenOrientationNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation)
|
||||
{
|
||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
dom::ScreenOrientationWrapper orientationWrapper;
|
||||
bridge->GetScreenOrientation(orientationWrapper);
|
||||
*aScreenOrientation = orientationWrapper.orientation;
|
||||
}
|
||||
|
||||
} // hal_impl
|
||||
} // mozilla
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
include protocol PContent;
|
||||
include protocol PBrowser;
|
||||
include "nspr/prtime.h";
|
||||
include "prtime.h";
|
||||
include "mozilla/HalSensor.h";
|
||||
include "mozilla/HalTypes.h";
|
||||
include "mozilla/dom/ScreenOrientation.h";
|
||||
|
@ -153,12 +153,12 @@ DiscardTracker::Initialize()
|
||||
// Create the timer.
|
||||
sTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
|
||||
// Read the timeout pref and start the timer.
|
||||
ReloadTimeout();
|
||||
|
||||
// Mark us as initialized
|
||||
sInitialized = true;
|
||||
|
||||
// Read the timeout pref and start the timer.
|
||||
ReloadTimeout();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -194,9 +194,12 @@ DiscardTracker::ReloadTimeout()
|
||||
nsresult
|
||||
DiscardTracker::EnableTimer()
|
||||
{
|
||||
// Nothing to do if the timer's already on.
|
||||
if (sTimerOn)
|
||||
// Nothing to do if the timer's already on or we haven't yet been
|
||||
// initialized. !sTimer probably means we've shut down, so just ignore that,
|
||||
// too.
|
||||
if (sTimerOn || !sInitialized || !sTimer)
|
||||
return NS_OK;
|
||||
|
||||
sTimerOn = true;
|
||||
|
||||
// Activate the timer. Have it call us back in (sMinDiscardTimeoutMs / 2)
|
||||
@ -215,7 +218,7 @@ void
|
||||
DiscardTracker::DisableTimer()
|
||||
{
|
||||
// Nothing to do if the timer's already off.
|
||||
if (!sTimerOn)
|
||||
if (!sTimerOn || !sTimer)
|
||||
return;
|
||||
sTimerOn = false;
|
||||
|
||||
|
@ -291,13 +291,20 @@ inline void
|
||||
HeapId::pre()
|
||||
{
|
||||
#ifdef JSGC_INCREMENTAL
|
||||
if (JS_UNLIKELY(JSID_IS_OBJECT(value))) {
|
||||
if (JSID_IS_OBJECT(value)) {
|
||||
JSObject *obj = JSID_TO_OBJECT(value);
|
||||
JSCompartment *comp = obj->compartment();
|
||||
if (comp->needsBarrier()) {
|
||||
js::gc::MarkObjectUnbarriered(comp->barrierTracer(), &obj, "write barrier");
|
||||
JS_ASSERT(obj == JSID_TO_OBJECT(value));
|
||||
}
|
||||
} else if (JSID_IS_STRING(value)) {
|
||||
JSString *str = JSID_TO_STRING(value);
|
||||
JSCompartment *comp = str->compartment();
|
||||
if (comp->needsBarrier()) {
|
||||
js::gc::MarkStringUnbarriered(comp->barrierTracer(), &str, "write barrier");
|
||||
JS_ASSERT(str == JSID_TO_STRING(value));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -310,7 +317,8 @@ HeapId::post()
|
||||
inline HeapId &
|
||||
HeapId::operator=(jsid id)
|
||||
{
|
||||
pre();
|
||||
if (id != value)
|
||||
pre();
|
||||
JS_ASSERT(!IsPoisonedId(id));
|
||||
value = id;
|
||||
post();
|
||||
@ -320,7 +328,8 @@ HeapId::operator=(jsid id)
|
||||
inline HeapId &
|
||||
HeapId::operator=(const HeapId &v)
|
||||
{
|
||||
pre();
|
||||
if (v.value != value)
|
||||
pre();
|
||||
JS_ASSERT(!IsPoisonedId(v.value));
|
||||
value = v.value;
|
||||
post();
|
||||
|
@ -249,6 +249,7 @@ struct Shape;
|
||||
class BaseShape;
|
||||
namespace types { struct TypeObject; }
|
||||
|
||||
typedef HeapPtr<JSAtom> HeapPtrAtom;
|
||||
typedef HeapPtr<JSObject> HeapPtrObject;
|
||||
typedef HeapPtr<JSFunction> HeapPtrFunction;
|
||||
typedef HeapPtr<JSString> HeapPtrString;
|
||||
|
@ -488,6 +488,7 @@ js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
{
|
||||
JSContext *cx;
|
||||
JSFunction *fun;
|
||||
JSAtom *atom;
|
||||
uint32_t firstword; /* flag telling whether fun->atom is non-null,
|
||||
plus for fun->u.i.skipmin, fun->u.i.wrapper,
|
||||
and 14 bits reserved for future use */
|
||||
@ -507,6 +508,7 @@ js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
}
|
||||
firstword = !!fun->atom;
|
||||
flagsword = (fun->nargs << 16) | fun->flags;
|
||||
atom = fun->atom;
|
||||
script = fun->script();
|
||||
} else {
|
||||
RootedVarObject parent(cx, NULL);
|
||||
@ -517,12 +519,13 @@ js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
return false;
|
||||
if (!fun->clearType(cx))
|
||||
return false;
|
||||
atom = NULL;
|
||||
script = NULL;
|
||||
}
|
||||
|
||||
if (!JS_XDRUint32(xdr, &firstword))
|
||||
return false;
|
||||
if ((firstword & 1U) && !js_XDRAtom(xdr, &fun->atom))
|
||||
if ((firstword & 1U) && !js_XDRAtom(xdr, &atom))
|
||||
return false;
|
||||
if (!JS_XDRUint32(xdr, &flagsword))
|
||||
return false;
|
||||
@ -534,7 +537,8 @@ js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
fun->nargs = flagsword >> 16;
|
||||
JS_ASSERT((flagsword & JSFUN_KINDMASK) >= JSFUN_INTERPRETED);
|
||||
fun->flags = uint16_t(flagsword);
|
||||
fun->setScript(script);
|
||||
fun->atom.init(atom);
|
||||
fun->initScript(script);
|
||||
if (!script->typeSetFunction(cx, fun))
|
||||
return false;
|
||||
JS_ASSERT(fun->nargs == fun->script()->bindings.countArgs());
|
||||
@ -587,7 +591,7 @@ JSFunction::trace(JSTracer *trc)
|
||||
}
|
||||
|
||||
if (atom)
|
||||
MarkStringUnbarriered(trc, &atom, "atom");
|
||||
MarkString(trc, &atom, "atom");
|
||||
|
||||
if (isInterpreted()) {
|
||||
if (u.i.script_)
|
||||
@ -1008,7 +1012,7 @@ fun_bind(JSContext *cx, unsigned argc, Value *vp)
|
||||
}
|
||||
|
||||
/* Step 4-6, 10-11. */
|
||||
JSAtom *name = target->isFunction() ? target->toFunction()->atom : NULL;
|
||||
JSAtom *name = target->isFunction() ? target->toFunction()->atom.get() : NULL;
|
||||
|
||||
JSObject *funobj =
|
||||
js_NewFunction(cx, NULL, CallOrConstructBoundFunction, length,
|
||||
@ -1304,7 +1308,7 @@ js_NewFunction(JSContext *cx, JSObject *funobj, Native native, unsigned nargs,
|
||||
fun->flags |= JSFUN_EXTENDED;
|
||||
fun->initializeExtended();
|
||||
}
|
||||
fun->atom = atom;
|
||||
fun->atom.init(atom);
|
||||
|
||||
if (native && !fun->setSingletonType(cx))
|
||||
return NULL;
|
||||
@ -1332,7 +1336,7 @@ js_CloneFunctionObject(JSContext *cx, JSFunction *fun, JSObject *parent,
|
||||
} else {
|
||||
clone->u.n = fun->u.n;
|
||||
}
|
||||
clone->atom = fun->atom;
|
||||
clone->atom.init(fun->atom);
|
||||
|
||||
if (kind == JSFunction::ExtendedFinalizeKind) {
|
||||
clone->flags |= JSFUN_EXTENDED;
|
||||
|
@ -102,7 +102,7 @@ struct JSFunction : public JSObject
|
||||
} i;
|
||||
void *nativeOrScript;
|
||||
} u;
|
||||
JSAtom *atom; /* name for diagnostics and decompiling */
|
||||
js::HeapPtrAtom atom; /* name for diagnostics and decompiling */
|
||||
|
||||
bool optimizedClosure() const { return kind() > JSFUN_INTERPRETED; }
|
||||
bool isInterpreted() const { return kind() >= JSFUN_INTERPRETED; }
|
||||
|
@ -666,7 +666,7 @@ namespace js {
|
||||
static inline JSAtom *
|
||||
CallObjectLambdaName(JSFunction *fun)
|
||||
{
|
||||
return (fun->flags & JSFUN_LAMBDA) ? fun->atom : NULL;
|
||||
return (fun->flags & JSFUN_LAMBDA) ? fun->atom.get() : NULL;
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
@ -678,7 +678,7 @@ JSObject::getDateUTCTime() const
|
||||
return getFixedSlot(JSSLOT_DATE_UTC_TIME);
|
||||
}
|
||||
|
||||
inline void
|
||||
inline void
|
||||
JSObject::setDateUTCTime(const js::Value &time)
|
||||
{
|
||||
JS_ASSERT(isDate());
|
||||
|
@ -325,10 +325,9 @@ FunctionName(JSContext *cx, const JSFunction *fun, JSAutoByteString* bytes)
|
||||
{
|
||||
if (!fun)
|
||||
return Probes::nullName;
|
||||
JSAtom *atom = const_cast<JSAtom*>(fun->atom);
|
||||
if (!atom)
|
||||
if (!fun->atom)
|
||||
return Probes::anonymousName;
|
||||
return bytes->encode(cx, atom) ? bytes->ptr() : Probes::nullName;
|
||||
return bytes->encode(cx, fun->atom) ? bytes->ptr() : Probes::nullName;
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
38
layout/base/crashtests/735943.html
Normal file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<script>
|
||||
|
||||
var asvg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><script xlink:href="data:text/javascript," /><rect width="100" height="100" fill="green"><set attributeName="fill" attributeType="CSS" to="red" begin="0s" end="2s" dur="2s" fill="remove" /></rect></svg>';
|
||||
|
||||
function boom()
|
||||
{
|
||||
var f = document.createElementNS("http://www.w3.org/1999/xhtml", "iframe"); f.src = "data:text/html,1"; document.body.appendChild(f);
|
||||
var w;
|
||||
|
||||
setTimeout(function() {
|
||||
w = window.open("data:text/html,<body onload=window.close()>", "_blank", "width=200,height=200");
|
||||
// Note that most of the code below will execute before the window appears, and in fact before "w" becomes non-null.
|
||||
}, 0);
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function() { }, 0);
|
||||
f.contentWindow.location = "data:image/svg+xml," + encodeURIComponent(asvg);
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
document.body.style.MozColumnCount = "2";
|
||||
document.documentElement.className = "";
|
||||
}, 20);
|
||||
}, 0);
|
||||
}, 0);
|
||||
}, 20);
|
||||
}
|
||||
|
||||
window.addEventListener("MozReftestInvalidate", boom, false);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
</html>
|
@ -352,5 +352,6 @@ load 707098.html
|
||||
load 722137.html
|
||||
load 725535.html
|
||||
load 727601.html
|
||||
load 736389-1.xhtml
|
||||
asserts(0-2) pref(dom.disable_open_during_load,false) load 735943.html # the assertion is bug 735966
|
||||
asserts(0-2) load 736389-1.xhtml # sometimes the above assertions are delayed and is reported on this test instead
|
||||
load 736924-1.html
|
||||
|
@ -7621,12 +7621,11 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
|
||||
if (aChange & nsChangeHint_RepaintFrame) {
|
||||
if (aFrame->IsFrameOfType(nsIFrame::eSVG)) {
|
||||
if (aChange & nsChangeHint_UpdateEffects) {
|
||||
// Invalidate the frame's old bounds, update its bounds, invalidate its new
|
||||
// bounds, and then inform anyone observing _us_ that we've changed:
|
||||
nsSVGUtils::UpdateGraphic(aFrame);
|
||||
// Invalidate and update our area:
|
||||
nsSVGUtils::InvalidateAndScheduleBoundsUpdate(aFrame);
|
||||
} else {
|
||||
// Just invalidate our area:
|
||||
nsSVGUtils::InvalidateCoveredRegion(aFrame);
|
||||
nsSVGUtils::InvalidateBounds(aFrame);
|
||||
}
|
||||
} else {
|
||||
aFrame->InvalidateOverflowRect();
|
||||
@ -10710,13 +10709,15 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
||||
nsIContent* const content = aItem.mContent;
|
||||
nsStyleContext* const styleContext = aItem.mStyleContext;
|
||||
|
||||
nsIFrame *newFrame;
|
||||
|
||||
bool positioned =
|
||||
NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay &&
|
||||
(NS_STYLE_POSITION_RELATIVE == aDisplay->mPosition ||
|
||||
aDisplay->HasTransform());
|
||||
newFrame = NS_NewInlineFrame(mPresShell, styleContext);
|
||||
|
||||
nsIFrame* newFrame = NS_NewInlineFrame(mPresShell, styleContext);
|
||||
if (!newFrame) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Initialize the frame
|
||||
InitAndRestoreFrame(aState, content, aParentFrame, nsnull, newFrame);
|
||||
@ -10736,7 +10737,11 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
||||
nsresult rv = ConstructFramesFromItemList(aState, aItem.mChildItems, newFrame,
|
||||
childItems);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Clean up?
|
||||
// Clean up.
|
||||
// Link up any successfully-created child frames here, so that we'll
|
||||
// clean them up as well.
|
||||
newFrame->SetInitialChildList(kPrincipalList, childItems);
|
||||
newFrame->Destroy();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "gfxContext.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxImageSurface.h"
|
||||
|
@ -69,6 +69,7 @@
|
||||
#include "gfxRect.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxFont.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -3965,9 +3965,12 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
|
||||
mDocument->GetAnimationController()->FlushResampleRequests();
|
||||
}
|
||||
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
mFrameConstructor->CreateNeededFrames();
|
||||
mFrameConstructor->ProcessPendingRestyles();
|
||||
// The FlushResampleRequests() above flushed style changes.
|
||||
if (!mIsDestroying) {
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
mFrameConstructor->CreateNeededFrames();
|
||||
mFrameConstructor->ProcessPendingRestyles();
|
||||
}
|
||||
}
|
||||
|
||||
// Dispatch any 'animationstart' events those (or earlier) restyles
|
||||
|
5
layout/generic/crashtests/737313-1.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<html>
|
||||
<span><div style="display: -moz-flexbox"></div></span>
|
||||
</html>
|
5
layout/generic/crashtests/737313-2.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<html>
|
||||
<span>some text<img><div style="display: -moz-flexbox"></div></span>
|
||||
</html>
|
5
layout/generic/crashtests/737313-3.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<html>
|
||||
<span><div>a block</div><div style="display: -moz-flexbox"></div></span>
|
||||
</html>
|
@ -386,3 +386,6 @@ load text-overflow-bug713610.html
|
||||
load 700031.xhtml
|
||||
load first-letter-638937.html
|
||||
asserts(18) load first-letter-638937-2.html
|
||||
load 737313-1.html
|
||||
load 737313-2.html
|
||||
load 737313-3.html
|
||||
|
@ -124,6 +124,7 @@
|
||||
#include "nsDeckFrame.h"
|
||||
|
||||
#include "gfxContext.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "CSSCalc.h"
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
|
||||
|
6
layout/reftests/bugs/723484-1-ref.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body style="background:yellow;">
|
||||
<img style="opacity:0.001" src="repeatable-diagonal-gradient.png">
|
||||
</body>
|
||||
</html>
|
13
layout/reftests/bugs/723484-1.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:yellow;">
|
||||
<img id="i" src="repeatable-diagonal-gradient.png">
|
||||
<script>
|
||||
function doTest() {
|
||||
document.getElementById("i").style.opacity = 0.001;
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1693,6 +1693,7 @@ needs-focus != 703186-1.html 703186-2.html
|
||||
fuzzy-if(d2d,1,19) fuzzy-if(cocoaWidget,1,170) == 718521.html 718521-ref.html
|
||||
== 720987.html 720987-ref.html
|
||||
== 722923-1.html 722923-1-ref.html
|
||||
== 723484-1.html 723484-1-ref.html
|
||||
== 729143-1.html 729143-1-ref.html
|
||||
needs-focus == 731726-1.html 731726-1-ref.html
|
||||
== 735481-1.html 735481-1-ref.html
|
||||
|
@ -227,9 +227,9 @@ random-if(gtk2Widget) == objectBoundingBox-and-fePointLight-02.svg objectBoundin
|
||||
== svg-in-foreignObject-01.xhtml svg-in-foreignObject-01-ref.xhtml
|
||||
== svg-in-foreignObject-02.xhtml svg-in-foreignObject-01-ref.xhtml # reuse -01-ref.xhtml
|
||||
== switch-01.svg pass.svg
|
||||
== suspend-01.svg about:blank
|
||||
== suspend-01.svg pass.svg
|
||||
== suspend-02.svg pass.svg
|
||||
fails == suspend-03.svg pass.svg # bug 724242
|
||||
== suspend-03.svg pass.svg
|
||||
== suspend-04.svg pass.svg
|
||||
== suspend-05.svg pass.svg
|
||||
== suspend-06.svg pass.svg
|
||||
|
@ -4,10 +4,10 @@
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test that suspendRedraw works</title>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=615146 -->
|
||||
<title>Test that suspendRedraw doesn't apply after the end of a script</title>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=734079 -->
|
||||
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
<script>
|
||||
document.documentElement.suspendRedraw(10000);
|
||||
</script>
|
||||
|
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 456 B |
@ -4,8 +4,8 @@
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait">
|
||||
<title>Test that suspendRedraw works</title>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=615146 -->
|
||||
<title>Test that suspendRedraw doesn't apply after the end of a script</title>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=734079 -->
|
||||
|
||||
<script type="text/javascript">
|
||||
<![CDATA[
|
||||
@ -17,12 +17,12 @@
|
||||
function doTest() {
|
||||
var svg = document.documentElement;
|
||||
svg.suspendRedraw(10000);
|
||||
document.getElementById("r").setAttribute("fill", "red");
|
||||
document.getElementById("r").setAttribute("fill", "lime");
|
||||
setTimeout(function() {
|
||||
svg.removeAttribute("class");
|
||||
}, 50);
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
<rect id="r" width="100%" height="100%" fill="lime"/>
|
||||
<rect id="r" width="100%" height="100%" fill="red"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 827 B After Width: | Height: | Size: 861 B |
@ -4,8 +4,8 @@
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait" onload="f()">
|
||||
<title>Test that suspendRedraw works</title>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=615146 -->
|
||||
<title>Test that suspendRedraw doesn't apply after the end of a script</title>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=734079 -->
|
||||
|
||||
<script>
|
||||
function f() {
|
||||
@ -19,6 +19,6 @@
|
||||
}, 1);
|
||||
}
|
||||
</script>
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
<rect id="r" width="100%" height="100%" fill="lime"/>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
<rect id="r" width="100%" height="100%" fill="red"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 782 B |
@ -4,7 +4,7 @@
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait">
|
||||
<title>Test that suspendRedraw works</title>
|
||||
<title>Test that suspendRedraw doesn't apply after the end of a script</title>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=615146 -->
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -21,12 +21,12 @@
|
||||
var r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||
r.setAttribute("width", "100%");
|
||||
r.setAttribute("height", "100%");
|
||||
r.setAttribute("fill", "red");
|
||||
r.setAttribute("fill", "lime");
|
||||
svg.appendChild(r);
|
||||
svg.removeAttribute("class");
|
||||
}, 50);
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 988 B After Width: | Height: | Size: 1022 B |
@ -39,21 +39,21 @@
|
||||
#ifndef __NS_ISVGCHILDFRAME_H__
|
||||
#define __NS_ISVGCHILDFRAME_H__
|
||||
|
||||
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRect.h"
|
||||
#include "gfxRect.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class gfxContext;
|
||||
class nsIFrame;
|
||||
class nsRenderingContext;
|
||||
|
||||
struct gfxMatrix;
|
||||
struct nsPoint;
|
||||
|
||||
namespace mozilla {
|
||||
class SVGAnimatedNumberList;
|
||||
class SVGNumberList;
|
||||
class SVGAnimatedLengthList;
|
||||
class SVGAnimatedNumberList;
|
||||
class SVGLengthList;
|
||||
class SVGNumberList;
|
||||
class SVGUserUnitList;
|
||||
}
|
||||
|
||||
@ -88,13 +88,13 @@ public:
|
||||
|
||||
// Get bounds in our gfxContext's coordinates space (in app units)
|
||||
NS_IMETHOD_(nsRect) GetCoveredRegion()=0;
|
||||
NS_IMETHOD UpdateCoveredRegion()=0;
|
||||
|
||||
// Called once on SVG child frames except descendants of <defs>, either
|
||||
// when their nsSVGOuterSVGFrame receives its initial reflow (i.e. once
|
||||
// the SVG viewport dimensions are known), or else when they're inserted
|
||||
// into the frame tree (if they're inserted after the initial reflow).
|
||||
NS_IMETHOD InitialUpdate()=0;
|
||||
// Called on SVG child frames (except NS_STATE_SVG_NONDISPLAY_CHILD frames)
|
||||
// to update and then invalidate their cached bounds. This method is not
|
||||
// called until after the nsSVGOuterSVGFrame has had its initial reflow
|
||||
// (i.e. once the SVG viewport dimensions are known). It should also only
|
||||
// be called by nsSVGOuterSVGFrame during its reflow.
|
||||
virtual void UpdateBounds()=0;
|
||||
|
||||
// Flags to pass to NotifySVGChange:
|
||||
//
|
||||
@ -112,8 +112,6 @@ public:
|
||||
COORD_CONTEXT_CHANGED = 0x04
|
||||
};
|
||||
virtual void NotifySVGChanged(PRUint32 aFlags)=0;
|
||||
virtual void NotifyRedrawSuspended()=0;
|
||||
virtual void NotifyRedrawUnsuspended()=0;
|
||||
|
||||
/**
|
||||
* Get this frame's contribution to the rect returned by a GetBBox() call
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsQueryFrame.h"
|
||||
|
||||
class nsIDOMSVGPoint;
|
||||
class nsSVGGlyphFrame;
|
||||
|
||||
class nsISVGGlyphFragmentNode : public nsQueryFrame
|
||||
{
|
||||
|
@ -46,8 +46,6 @@ class nsISVGSVGFrame
|
||||
public:
|
||||
NS_DECL_QUERYFRAME_TARGET(nsISVGSVGFrame)
|
||||
|
||||
virtual void SuspendRedraw()=0;
|
||||
virtual void UnsuspendRedraw()=0;
|
||||
virtual void NotifyViewportChange()=0;
|
||||
};
|
||||
|
||||
|
@ -34,10 +34,12 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsSVGClipPathFrame.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMSVGClipPathElement.h"
|
||||
#include "nsSVGClipPathFrame.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsSVGEffects.h"
|
||||
|
@ -37,9 +37,9 @@
|
||||
#ifndef __NS_SVGCLIPPATHFRAME_H__
|
||||
#define __NS_SVGCLIPPATHFRAME_H__
|
||||
|
||||
#include "gfxMatrix.h"
|
||||
#include "nsSVGContainerFrame.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "gfxMatrix.h"
|
||||
|
||||
class nsRenderingContext;
|
||||
|
||||
|
@ -101,8 +101,7 @@ nsSVGDisplayContainerFrame::Init(nsIContent* aContent,
|
||||
{
|
||||
if (!(GetStateBits() & NS_STATE_IS_OUTER_SVG)) {
|
||||
AddStateBits(aParent->GetStateBits() &
|
||||
(NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD |
|
||||
NS_STATE_SVG_REDRAW_SUSPENDED));
|
||||
(NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD));
|
||||
}
|
||||
nsresult rv = nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
return rv;
|
||||
@ -123,14 +122,23 @@ nsSVGDisplayContainerFrame::InsertFrames(ChildListID aListID,
|
||||
// Insert the new frames
|
||||
nsSVGContainerFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
|
||||
|
||||
// Call InitialUpdate on the new frames ONLY if our nsSVGOuterSVGFrame has had
|
||||
// its initial reflow (our NS_FRAME_FIRST_REFLOW bit is clear) - bug 399863.
|
||||
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||
// If we are not a non-display SVG frame and we do not have a bounds update
|
||||
// pending, then we need to schedule one for our new children:
|
||||
if (!(GetStateBits() &
|
||||
(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN |
|
||||
NS_STATE_SVG_NONDISPLAY_CHILD))) {
|
||||
for (nsIFrame* kid = firstNewFrame; kid != firstOldFrame;
|
||||
kid = kid->GetNextSibling()) {
|
||||
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
|
||||
if (SVGFrame) {
|
||||
SVGFrame->InitialUpdate();
|
||||
NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
||||
"Check for this explicitly in the |if|, then");
|
||||
// Remove bits so that ScheduleBoundsUpdate will work:
|
||||
kid->RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
|
||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
// No need to invalidate the new kid's old bounds, so we just use
|
||||
// nsSVGUtils::ScheduleBoundsUpdate.
|
||||
nsSVGUtils::ScheduleBoundsUpdate(kid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,10 +150,7 @@ NS_IMETHODIMP
|
||||
nsSVGDisplayContainerFrame::RemoveFrame(ChildListID aListID,
|
||||
nsIFrame* aOldFrame)
|
||||
{
|
||||
// Force the invalidation before it's too late
|
||||
RemoveStateBits(NS_STATE_SVG_REDRAW_SUSPENDED);
|
||||
|
||||
nsSVGUtils::InvalidateCoveredRegion(aOldFrame);
|
||||
nsSVGUtils::InvalidateBounds(aOldFrame);
|
||||
|
||||
nsresult rv = nsSVGContainerFrame::RemoveFrame(aListID, aOldFrame);
|
||||
|
||||
@ -187,42 +192,48 @@ nsSVGDisplayContainerFrame::GetCoveredRegion()
|
||||
return nsSVGUtils::GetCoveredRegion(mFrames);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGDisplayContainerFrame::UpdateCoveredRegion()
|
||||
void
|
||||
nsSVGDisplayContainerFrame::UpdateBounds()
|
||||
{
|
||||
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
||||
kid = kid->GetNextSibling()) {
|
||||
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
|
||||
if (SVGFrame) {
|
||||
SVGFrame->UpdateCoveredRegion();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingUpdateBounds(this),
|
||||
"This call is probaby a wasteful mistake");
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGDisplayContainerFrame::InitialUpdate()
|
||||
{
|
||||
NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW,
|
||||
"Yikes! We've been called already! Hopefully we weren't called "
|
||||
"before our nsSVGOuterSVGFrame's initial Reflow()!!!");
|
||||
NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
||||
"UpdateBounds mechanism not designed for this");
|
||||
|
||||
if (!nsSVGUtils::NeedsUpdatedBounds(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the NS_FRAME_FIRST_REFLOW bit has been removed from our parent frame,
|
||||
// then our outer-<svg> has previously had its initial reflow. In that case
|
||||
// we need to make sure that that bit has been removed from ourself _before_
|
||||
// recursing over our children to ensure that they know too. Otherwise, we
|
||||
// need to remove it _after_ recursing over our children so that they know
|
||||
// the initial reflow is currently underway.
|
||||
|
||||
bool outerSVGHasHadFirstReflow =
|
||||
(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) == 0;
|
||||
|
||||
if (outerSVGHasHadFirstReflow) {
|
||||
mState &= ~NS_FRAME_FIRST_REFLOW; // tell our children
|
||||
}
|
||||
|
||||
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
||||
kid = kid->GetNextSibling()) {
|
||||
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
|
||||
if (SVGFrame) {
|
||||
SVGFrame->InitialUpdate();
|
||||
NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
||||
"Check for this explicitly in the |if|, then");
|
||||
SVGFrame->UpdateBounds();
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW),
|
||||
"We don't actually participate in reflow");
|
||||
|
||||
// Do unset the various reflow bits, though.
|
||||
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
|
||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
// XXXsvgreflow once we store bounds on containers, do...
|
||||
// nsSVGUtils::InvalidateBounds(this);
|
||||
}
|
||||
|
||||
void
|
||||
@ -238,18 +249,6 @@ nsSVGDisplayContainerFrame::NotifySVGChanged(PRUint32 aFlags)
|
||||
nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGDisplayContainerFrame::NotifyRedrawSuspended()
|
||||
{
|
||||
nsSVGUtils::NotifyRedrawSuspended(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGDisplayContainerFrame::NotifyRedrawUnsuspended()
|
||||
{
|
||||
nsSVGUtils::NotifyRedrawUnsuspended(this);
|
||||
}
|
||||
|
||||
gfxRect
|
||||
nsSVGDisplayContainerFrame::GetBBoxContribution(
|
||||
const gfxMatrix &aToBBoxUserspace,
|
||||
|
@ -37,12 +37,22 @@
|
||||
#ifndef NS_SVGCONTAINERFRAME_H
|
||||
#define NS_SVGCONTAINERFRAME_H
|
||||
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "gfxRect.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "gfxRect.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsFrameList;
|
||||
class nsIContent;
|
||||
class nsIPresShell;
|
||||
class nsRenderingContext;
|
||||
class nsStyleContext;
|
||||
|
||||
struct nsPoint;
|
||||
|
||||
typedef nsContainerFrame nsSVGContainerFrameBase;
|
||||
|
||||
@ -116,11 +126,8 @@ public:
|
||||
const nsIntRect *aDirtyRect);
|
||||
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
|
||||
NS_IMETHOD_(nsRect) GetCoveredRegion();
|
||||
NS_IMETHOD UpdateCoveredRegion();
|
||||
NS_IMETHOD InitialUpdate();
|
||||
virtual void UpdateBounds();
|
||||
virtual void NotifySVGChanged(PRUint32 aFlags);
|
||||
virtual void NotifyRedrawSuspended();
|
||||
virtual void NotifyRedrawUnsuspended();
|
||||
virtual gfxRect GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
||||
PRUint32 aFlags);
|
||||
NS_IMETHOD_(bool) IsDisplayContainer() { return true; }
|
||||
|
@ -331,7 +331,7 @@ nsSVGPaintingProperty::DoUpdate()
|
||||
return;
|
||||
|
||||
if (mFrame->IsFrameOfType(nsIFrame::eSVG)) {
|
||||
nsSVGUtils::InvalidateCoveredRegion(mFrame);
|
||||
nsSVGUtils::InvalidateBounds(mFrame);
|
||||
} else {
|
||||
InvalidateAllContinuations(mFrame);
|
||||
}
|
||||
|
@ -38,14 +38,25 @@
|
||||
#ifndef NSSVGEFFECTS_H_
|
||||
#define NSSVGEFFECTS_H_
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "FramePropertyTable.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsID.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIMutationObserver.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsISupportsBase.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsReferencedElement.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "nsURIHashKey.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIPresShell;
|
||||
class nsIURI;
|
||||
class nsSVGClipPathFrame;
|
||||
class nsSVGFilterFrame;
|
||||
class nsSVGMaskFrame;
|
||||
|
@ -35,6 +35,8 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsSVGFilterFrame.h"
|
||||
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsSVGOuterSVGFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -37,14 +37,22 @@
|
||||
#ifndef __NS_SVGFILTERFRAME_H__
|
||||
#define __NS_SVGFILTERFRAME_H__
|
||||
|
||||
#include "nsFrame.h"
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsSVGContainerFrame.h"
|
||||
#include "nsSVGUtils.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsRenderingContext;
|
||||
class nsStyleContext;
|
||||
class nsSVGFilterPaintCallback;
|
||||
|
||||
typedef nsSVGContainerFrame nsSVGFilterFrameBase;
|
||||
|
||||
class nsSVGFilterFrame : public nsSVGFilterFrameBase
|
||||
{
|
||||
friend nsIFrame*
|
||||
|
@ -35,6 +35,8 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsSVGFilterInstance.h"
|
||||
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsIDOMSVGUnitTypes.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
@ -37,21 +37,24 @@
|
||||
#ifndef __NS_SVGFILTERINSTANCE_H__
|
||||
#define __NS_SVGFILTERINSTANCE_H__
|
||||
|
||||
#include "nsIDOMSVGLength.h"
|
||||
#include "nsIDOMSVGFilters.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "gfxPoint.h"
|
||||
#include "gfxRect.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsSVGFilters.h"
|
||||
#include "nsSVGNumber2.h"
|
||||
#include "nsSVGNumberPair.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "gfxImageSurface.h"
|
||||
|
||||
class nsSVGElement;
|
||||
class gfxASurface;
|
||||
class gfxImageSurface;
|
||||
class nsIFrame;
|
||||
class nsSVGFilterElement;
|
||||
class nsSVGFilterPaintCallback;
|
||||
struct gfxRect;
|
||||
|
||||
/**
|
||||
* This class performs all filter processing.
|
||||
|
@ -37,11 +37,11 @@
|
||||
#ifndef __NS_SVGFILTERPAINTCALLBACK_H__
|
||||
#define __NS_SVGFILTERPAINTCALLBACK_H__
|
||||
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsRenderingContext;
|
||||
|
||||
struct nsIntRect;
|
||||
|
||||
class nsSVGFilterPaintCallback {
|
||||
public:
|
||||
/**
|
||||
|
@ -42,12 +42,14 @@
|
||||
#include "nsIDOMSVGSVGElement.h"
|
||||
#include "nsSVGOuterSVGFrame.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsSVGForeignObjectElement.h"
|
||||
#include "nsSVGContainerFrame.h"
|
||||
#include "gfxContext.h"
|
||||
@ -91,20 +93,10 @@ nsSVGForeignObjectFrame::Init(nsIContent* aContent,
|
||||
|
||||
nsresult rv = nsSVGForeignObjectFrameBase::Init(aContent, aParent, aPrevInFlow);
|
||||
AddStateBits(aParent->GetStateBits() &
|
||||
(NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD |
|
||||
NS_STATE_SVG_REDRAW_SUSPENDED));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsSVGUtils::GetOuterSVGFrame(this)->RegisterForeignObject(this);
|
||||
}
|
||||
(NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD));
|
||||
return rv;
|
||||
}
|
||||
|
||||
void nsSVGForeignObjectFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
{
|
||||
nsSVGUtils::GetOuterSVGFrame(this)->UnregisterForeignObject(this);
|
||||
nsSVGForeignObjectFrameBase::DestroyFrom(aDestructRoot);
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsSVGForeignObjectFrame::GetType() const
|
||||
{
|
||||
@ -119,17 +111,18 @@ nsSVGForeignObjectFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::width ||
|
||||
aAttribute == nsGkAtoms::height) {
|
||||
UpdateGraphic(); // update mRect before requesting reflow
|
||||
nsSVGUtils::InvalidateAndScheduleBoundsUpdate(this);
|
||||
// XXXjwatt: why mark intrinsic widths dirty? can't we just use eResize?
|
||||
RequestReflow(nsIPresShell::eStyleChange);
|
||||
} else if (aAttribute == nsGkAtoms::x ||
|
||||
aAttribute == nsGkAtoms::y ||
|
||||
aAttribute == nsGkAtoms::viewBox ||
|
||||
aAttribute == nsGkAtoms::preserveAspectRatio ||
|
||||
aAttribute == nsGkAtoms::transform) {
|
||||
// make sure our cached transform matrix gets (lazily) updated
|
||||
mCanvasTM = nsnull;
|
||||
UpdateGraphic();
|
||||
nsSVGUtils::InvalidateAndScheduleBoundsUpdate(this);
|
||||
} else if (aAttribute == nsGkAtoms::viewBox ||
|
||||
aAttribute == nsGkAtoms::preserveAspectRatio) {
|
||||
nsSVGUtils::InvalidateBounds(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +138,10 @@ nsSVGForeignObjectFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
// Moreover we haven't been initialised properly yet so we may not have the
|
||||
// right state bits.
|
||||
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||
UpdateGraphic();
|
||||
// XXXperf: probably only need a bounds update if 'font-size' changed and
|
||||
// we have em unit width/height. Or, once we map 'transform' into style,
|
||||
// if some transform property changed.
|
||||
nsSVGUtils::InvalidateAndScheduleBoundsUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,8 +151,18 @@ nsSVGForeignObjectFrame::Reflow(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
// InitialUpdate and AttributeChanged make sure mRect is up to date before
|
||||
// we're called (UpdateCoveredRegion sets mRect).
|
||||
NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
||||
"Should not have been called");
|
||||
|
||||
// Only InvalidateAndScheduleBoundsUpdate marks us with NS_FRAME_IS_DIRTY,
|
||||
// so if that bit is still set we still have a resize pending. If we hit
|
||||
// this assertion, then we should get the presShell to skip reflow roots
|
||||
// that have a dirty parent since a reflow is going to come via the
|
||||
// reflow root's parent anyway.
|
||||
NS_ASSERTION(!(GetStateBits() & NS_FRAME_IS_DIRTY),
|
||||
"Reflowing while a resize is pending is wasteful");
|
||||
|
||||
// UpdateBounds makes sure mRect is up to date before we're called.
|
||||
|
||||
NS_ASSERTION(!aReflowState.parentReflowState,
|
||||
"should only get reflow from being reflow root");
|
||||
@ -183,13 +189,27 @@ nsSVGForeignObjectFrame::InvalidateInternal(const nsRect& aDamageRect,
|
||||
{
|
||||
// This is called by our descendants when they change.
|
||||
|
||||
if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)
|
||||
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
|
||||
// Our entire area has been (or will be) invalidated, so no point
|
||||
// keeping track of sub-areas that our descendants dirty.
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) {
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mInReflow) {
|
||||
// We can't collect dirty areas, since we don't have a place to reliably
|
||||
// call FlushDirtyRegion before we paint, so we have to invalidate now.
|
||||
InvalidateDirtyRect(nsSVGUtils::GetOuterSVGFrame(this), aDamageRect + nsPoint(aX, aY), aFlags);
|
||||
return;
|
||||
}
|
||||
|
||||
nsRegion* region = (aFlags & INVALIDATE_CROSS_DOC)
|
||||
? &mSubDocDirtyRegion : &mSameDocDirtyRegion;
|
||||
region->Or(*region, aDamageRect + nsPoint(aX, aY));
|
||||
FlushDirtyRegion(aFlags);
|
||||
}
|
||||
|
||||
|
||||
@ -345,11 +365,21 @@ nsSVGForeignObjectFrame::GetCoveredRegion()
|
||||
return mCoveredRegion;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGForeignObjectFrame::UpdateCoveredRegion()
|
||||
void
|
||||
nsSVGForeignObjectFrame::UpdateBounds()
|
||||
{
|
||||
if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingUpdateBounds(this),
|
||||
"This call is probaby a wasteful mistake");
|
||||
|
||||
NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
||||
"UpdateBounds mechanism not designed for this");
|
||||
|
||||
if (!nsSVGUtils::NeedsUpdatedBounds(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We update mRect before the DoReflow call so that DoReflow uses the
|
||||
// correct dimensions:
|
||||
|
||||
float x, y, w, h;
|
||||
static_cast<nsSVGForeignObjectElement*>(mContent)->
|
||||
@ -365,30 +395,32 @@ nsSVGForeignObjectFrame::UpdateCoveredRegion()
|
||||
PresContext()->AppUnitsPerCSSPixel());
|
||||
mCoveredRegion = ToCanvasBounds(gfxRect(0.0, 0.0, w, h), GetCanvasTM(), PresContext());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
// Since we'll invalidate our entire area at the end of this method, we
|
||||
// empty our cached dirty regions to prevent FlushDirtyRegion under DoReflow
|
||||
// from wasting time invalidating:
|
||||
mSameDocDirtyRegion.SetEmpty();
|
||||
mSubDocDirtyRegion.SetEmpty();
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGForeignObjectFrame::InitialUpdate()
|
||||
{
|
||||
NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW,
|
||||
"Yikes! We've been called already! Hopefully we weren't called "
|
||||
"before our nsSVGOuterSVGFrame's initial Reflow()!!!");
|
||||
// Fully mark our kid dirty so that it gets resized if necessary
|
||||
// (NS_FRAME_HAS_DIRTY_CHILDREN isn't enough in that case):
|
||||
nsIFrame* kid = GetFirstPrincipalChild();
|
||||
kid->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
|
||||
UpdateCoveredRegion();
|
||||
|
||||
// Make sure to not allow interrupts if we're not being reflown as a root
|
||||
// Make sure to not allow interrupts if we're not being reflown as a root:
|
||||
nsPresContext::InterruptPreventer noInterrupts(PresContext());
|
||||
|
||||
DoReflow();
|
||||
|
||||
NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW),
|
||||
"We don't actually participate in reflow");
|
||||
|
||||
// Do unset the various reflow bits, though.
|
||||
// Now unset the various reflow bits:
|
||||
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
|
||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
|
||||
return NS_OK;
|
||||
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||
// We only invalidate if our outer-<svg> has already had its
|
||||
// initial reflow (since if it hasn't, its entire area will be
|
||||
// invalidated when it gets that initial reflow):
|
||||
nsSVGUtils::InvalidateBounds(this, true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -401,9 +433,32 @@ nsSVGForeignObjectFrame::NotifySVGChanged(PRUint32 aFlags)
|
||||
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
||||
"Invalidation logic may need adjusting");
|
||||
|
||||
bool reflow = false;
|
||||
bool needNewBounds = false; // i.e. mRect or visual overflow rect
|
||||
bool needReflow = false;
|
||||
bool needNewCanvasTM = false;
|
||||
|
||||
if (aFlags & COORD_CONTEXT_CHANGED) {
|
||||
nsSVGForeignObjectElement *fO =
|
||||
static_cast<nsSVGForeignObjectElement*>(mContent);
|
||||
// Coordinate context changes affect mCanvasTM if we have a
|
||||
// percentage 'x' or 'y'
|
||||
if (fO->mLengthAttributes[nsSVGForeignObjectElement::X].IsPercentage() ||
|
||||
fO->mLengthAttributes[nsSVGForeignObjectElement::Y].IsPercentage()) {
|
||||
needNewBounds = true;
|
||||
needNewCanvasTM = true;
|
||||
}
|
||||
// Our coordinate context's width/height has changed. If we have a
|
||||
// percentage width/height our dimensions will change so we must reflow.
|
||||
if (fO->mLengthAttributes[nsSVGForeignObjectElement::WIDTH].IsPercentage() ||
|
||||
fO->mLengthAttributes[nsSVGForeignObjectElement::HEIGHT].IsPercentage()) {
|
||||
needNewBounds = true;
|
||||
needReflow = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlags & TRANSFORM_CHANGED) {
|
||||
needNewBounds = true; // needed if it was _our_ transform that changed
|
||||
needNewCanvasTM = true;
|
||||
// In an ideal world we would reflow when our CTM changes. This is because
|
||||
// glyph metrics do not necessarily scale uniformly with change in scale
|
||||
// and, as a result, CTM changes may require text to break at different
|
||||
@ -411,60 +466,28 @@ nsSVGForeignObjectFrame::NotifySVGChanged(PRUint32 aFlags)
|
||||
// e.g. the transform of an ancestor is animated.
|
||||
// We also seem to get some sort of infinite loop post bug 421584 if we
|
||||
// reflow.
|
||||
}
|
||||
|
||||
if (needNewBounds &&
|
||||
!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS)) {
|
||||
nsSVGUtils::InvalidateAndScheduleBoundsUpdate(this);
|
||||
}
|
||||
|
||||
// If we're called while the PresShell is handling reflow events then we
|
||||
// must have been called as a result of the NotifyViewportChange() call in
|
||||
// our nsSVGOuterSVGFrame's Reflow() method. We must not call RequestReflow
|
||||
// at this point (i.e. during reflow) because it could confuse the
|
||||
// PresShell and prevent it from reflowing us properly in future. Besides
|
||||
// that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us
|
||||
// synchronously, so there's no need.
|
||||
if (needReflow && !PresContext()->PresShell()->IsReflowLocked()) {
|
||||
RequestReflow(nsIPresShell::eResize);
|
||||
}
|
||||
|
||||
if (needNewCanvasTM) {
|
||||
// Do this after calling InvalidateAndScheduleBoundsUpdate in case we
|
||||
// change the code and it needs to use it.
|
||||
mCanvasTM = nsnull;
|
||||
if (!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS)) {
|
||||
UpdateGraphic();
|
||||
}
|
||||
|
||||
} else if (aFlags & COORD_CONTEXT_CHANGED) {
|
||||
nsSVGForeignObjectElement *fO =
|
||||
static_cast<nsSVGForeignObjectElement*>(mContent);
|
||||
// Coordinate context changes affect mCanvasTM if we have a
|
||||
// percentage 'x' or 'y'
|
||||
if (fO->mLengthAttributes[nsSVGForeignObjectElement::X].IsPercentage() ||
|
||||
fO->mLengthAttributes[nsSVGForeignObjectElement::Y].IsPercentage()) {
|
||||
mCanvasTM = nsnull;
|
||||
}
|
||||
// Our coordinate context's width/height has changed. If we have a
|
||||
// percentage width/height our dimensions will change so we must reflow.
|
||||
if (fO->mLengthAttributes[nsSVGForeignObjectElement::WIDTH].IsPercentage() ||
|
||||
fO->mLengthAttributes[nsSVGForeignObjectElement::HEIGHT].IsPercentage()) {
|
||||
reflow = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (reflow) {
|
||||
// If we're called while the PresShell is handling reflow events then we
|
||||
// must have been called as a result of the NotifyViewportChange() call in
|
||||
// our nsSVGOuterSVGFrame's Reflow() method. We must not call RequestReflow
|
||||
// at this point (i.e. during reflow) because it could confuse the
|
||||
// PresShell and prevent it from reflowing us properly in future. Besides
|
||||
// that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us
|
||||
// synchronously, so there's no need.
|
||||
if (!PresContext()->PresShell()->IsReflowLocked()) {
|
||||
UpdateGraphic(); // update mRect before requesting reflow
|
||||
RequestReflow(nsIPresShell::eResize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGForeignObjectFrame::NotifyRedrawSuspended()
|
||||
{
|
||||
AddStateBits(NS_STATE_SVG_REDRAW_SUSPENDED);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGForeignObjectFrame::NotifyRedrawUnsuspended()
|
||||
{
|
||||
RemoveStateBits(NS_STATE_SVG_REDRAW_SUSPENDED);
|
||||
|
||||
if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
|
||||
if (GetStateBits() & NS_STATE_SVG_DIRTY) {
|
||||
UpdateGraphic(); // invalidate our entire area
|
||||
} else {
|
||||
FlushDirtyRegion(0); // only invalidate areas dirtied by our descendants
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -522,7 +545,7 @@ nsSVGForeignObjectFrame::GetCanvasTMForChildren()
|
||||
void nsSVGForeignObjectFrame::RequestReflow(nsIPresShell::IntrinsicDirty aType)
|
||||
{
|
||||
if (GetStateBits() & NS_FRAME_FIRST_REFLOW)
|
||||
// If we haven't had an InitialUpdate yet, nothing to do.
|
||||
// If we haven't had a UpdateBounds yet, nothing to do.
|
||||
return;
|
||||
|
||||
nsIFrame* kid = GetFirstPrincipalChild();
|
||||
@ -532,63 +555,14 @@ void nsSVGForeignObjectFrame::RequestReflow(nsIPresShell::IntrinsicDirty aType)
|
||||
PresContext()->PresShell()->FrameNeedsReflow(kid, aType, NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
|
||||
void nsSVGForeignObjectFrame::UpdateGraphic()
|
||||
{
|
||||
nsSVGUtils::UpdateGraphic(this);
|
||||
|
||||
// We just invalidated our entire area, so clear the caches of areas dirtied
|
||||
// by our descendants:
|
||||
mSameDocDirtyRegion.SetEmpty();
|
||||
mSubDocDirtyRegion.SetEmpty();
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGForeignObjectFrame::MaybeReflowFromOuterSVGFrame()
|
||||
{
|
||||
// If IsDisabled() is true, then we know that our DoReflow() call will return
|
||||
// early, leaving us with a marked-dirty but not-reflowed kid. That'd be bad;
|
||||
// it'd mean that all future calls to this method would be doomed to take the
|
||||
// NS_FRAME_IS_DIRTY early-return below. To avoid that problem, we need to
|
||||
// bail out *before* we mark our kid as dirty.
|
||||
if (IsDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* kid = GetFirstPrincipalChild();
|
||||
|
||||
// If we're already scheduled to reflow (if we or our kid is dirty) we don't
|
||||
// want to reflow now or else our presShell will do extra work trying to
|
||||
// reflow us a second time. (It will also complain if it finds that a reflow
|
||||
// root scheduled for reflow isn't dirty).
|
||||
|
||||
if (kid->GetStateBits() & NS_FRAME_IS_DIRTY) {
|
||||
return;
|
||||
}
|
||||
kid->AddStateBits(NS_FRAME_IS_DIRTY); // we must be fully marked dirty
|
||||
if (kid->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure to not allow interrupts if we're not being reflown as a root
|
||||
nsPresContext::InterruptPreventer noInterrupts(PresContext());
|
||||
DoReflow();
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGForeignObjectFrame::DoReflow()
|
||||
{
|
||||
NS_ASSERTION(!(nsSVGUtils::GetOuterSVGFrame(this)->
|
||||
GetStateBits() & NS_FRAME_FIRST_REFLOW),
|
||||
"Calling InitialUpdate too early - must not call DoReflow!!!");
|
||||
|
||||
// Skip reflow if we're zero-sized, unless this is our first reflow.
|
||||
if (IsDisabled() &&
|
||||
!(GetStateBits() & NS_FRAME_FIRST_REFLOW))
|
||||
return;
|
||||
|
||||
if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)
|
||||
return;
|
||||
|
||||
nsPresContext *presContext = PresContext();
|
||||
nsIFrame* kid = GetFirstPrincipalChild();
|
||||
if (!kid)
|
||||
@ -602,48 +576,36 @@ nsSVGForeignObjectFrame::DoReflow()
|
||||
if (!renderingContext)
|
||||
return;
|
||||
|
||||
nsSVGForeignObjectElement *fO = static_cast<nsSVGForeignObjectElement*>
|
||||
(mContent);
|
||||
|
||||
float width =
|
||||
fO->mLengthAttributes[nsSVGForeignObjectElement::WIDTH].GetAnimValue(fO);
|
||||
float height =
|
||||
fO->mLengthAttributes[nsSVGForeignObjectElement::HEIGHT].GetAnimValue(fO);
|
||||
|
||||
// Clamp height & width to be non-negative (to match UpdateCoveredRegion).
|
||||
width = NS_MAX(width, 0.0f);
|
||||
height = NS_MAX(height, 0.0f);
|
||||
|
||||
nsSize size(nsPresContext::CSSPixelsToAppUnits(width),
|
||||
nsPresContext::CSSPixelsToAppUnits(height));
|
||||
|
||||
mInReflow = true;
|
||||
|
||||
nsHTMLReflowState reflowState(presContext, kid,
|
||||
renderingContext,
|
||||
nsSize(size.width, NS_UNCONSTRAINEDSIZE));
|
||||
nsSize(mRect.width, NS_UNCONSTRAINEDSIZE));
|
||||
nsHTMLReflowMetrics desiredSize;
|
||||
nsReflowStatus status;
|
||||
|
||||
// We don't use size.height above because that tells the child to do
|
||||
// We don't use mRect.height above because that tells the child to do
|
||||
// page/column breaking at that height.
|
||||
NS_ASSERTION(reflowState.mComputedBorderPadding == nsMargin(0, 0, 0, 0) &&
|
||||
reflowState.mComputedMargin == nsMargin(0, 0, 0, 0),
|
||||
"style system should ensure that :-moz-svg-foreign-content "
|
||||
"does not get styled");
|
||||
NS_ASSERTION(reflowState.ComputedWidth() == size.width,
|
||||
NS_ASSERTION(reflowState.ComputedWidth() == mRect.width,
|
||||
"reflow state made child wrong size");
|
||||
reflowState.SetComputedHeight(size.height);
|
||||
|
||||
reflowState.SetComputedHeight(mRect.height);
|
||||
|
||||
ReflowChild(kid, presContext, desiredSize, reflowState, 0, 0,
|
||||
NS_FRAME_NO_MOVE_FRAME, status);
|
||||
NS_ASSERTION(size.width == desiredSize.width &&
|
||||
size.height == desiredSize.height, "unexpected size");
|
||||
NS_ASSERTION(mRect.width == desiredSize.width &&
|
||||
mRect.height == desiredSize.height, "unexpected size");
|
||||
FinishReflowChild(kid, presContext, &reflowState, desiredSize, 0, 0,
|
||||
NS_FRAME_NO_MOVE_FRAME);
|
||||
|
||||
mInReflow = false;
|
||||
FlushDirtyRegion(0);
|
||||
|
||||
if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
|
||||
FlushDirtyRegion(0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -672,10 +634,15 @@ nsSVGForeignObjectFrame::InvalidateDirtyRect(nsSVGOuterSVGFrame* aOuter,
|
||||
void
|
||||
nsSVGForeignObjectFrame::FlushDirtyRegion(PRUint32 aFlags)
|
||||
{
|
||||
if ((mSameDocDirtyRegion.IsEmpty() && mSubDocDirtyRegion.IsEmpty()) ||
|
||||
mInReflow ||
|
||||
(GetStateBits() & NS_STATE_SVG_REDRAW_SUSPENDED))
|
||||
NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
||||
"Should not have been called");
|
||||
|
||||
NS_ASSERTION(!mInReflow,
|
||||
"We shouldn't be flushing while we have a pending flush");
|
||||
|
||||
if (mSameDocDirtyRegion.IsEmpty() && mSubDocDirtyRegion.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsSVGOuterSVGFrame *outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
|
||||
if (!outerSVGFrame) {
|
||||
|
@ -40,11 +40,10 @@
|
||||
#define NSSVGFOREIGNOBJECTFRAME_H__
|
||||
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsSVGUtils.h"
|
||||
|
||||
class nsRenderingContext;
|
||||
class nsSVGOuterSVGFrame;
|
||||
@ -67,7 +66,6 @@ public:
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow);
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
||||
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
@ -126,11 +124,8 @@ public:
|
||||
const nsIntRect *aDirtyRect);
|
||||
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
|
||||
NS_IMETHOD_(nsRect) GetCoveredRegion();
|
||||
NS_IMETHOD UpdateCoveredRegion();
|
||||
NS_IMETHOD InitialUpdate();
|
||||
virtual void UpdateBounds();
|
||||
virtual void NotifySVGChanged(PRUint32 aFlags);
|
||||
virtual void NotifyRedrawSuspended();
|
||||
virtual void NotifyRedrawUnsuspended();
|
||||
virtual gfxRect GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
||||
PRUint32 aFlags);
|
||||
NS_IMETHOD_(bool) IsDisplayContainer() { return true; }
|
||||
@ -140,14 +135,10 @@ public:
|
||||
|
||||
gfxMatrix GetCanvasTM();
|
||||
|
||||
// This method allows our nsSVGOuterSVGFrame to reflow us as necessary.
|
||||
void MaybeReflowFromOuterSVGFrame();
|
||||
|
||||
protected:
|
||||
// implementation helpers:
|
||||
void DoReflow();
|
||||
void RequestReflow(nsIPresShell::IntrinsicDirty aType);
|
||||
void UpdateGraphic();
|
||||
|
||||
// Returns GetCanvasTM followed by a scale from CSS px to Dev px. Used for
|
||||
// painting, because children expect to paint to device space, not userspace.
|
||||
|
@ -39,8 +39,8 @@
|
||||
#ifndef NSSVGGFRAME_H
|
||||
#define NSSVGGFRAME_H
|
||||
|
||||
#include "nsSVGContainerFrame.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "nsSVGContainerFrame.h"
|
||||
|
||||
typedef nsSVGDisplayContainerFrame nsSVGGFrameBase;
|
||||
|
||||
|
@ -39,10 +39,16 @@
|
||||
#ifndef __NS_SVGGENERICCONTAINERFRAME_H__
|
||||
#define __NS_SVGGENERICCONTAINERFRAME_H__
|
||||
|
||||
#include "nsIDOMSVGGElement.h"
|
||||
#include "nsSVGContainerFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsSVGContainerFrame.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsStyleContext;
|
||||
|
||||
typedef nsSVGDisplayContainerFrame nsSVGGenericContainerFrameBase;
|
||||
|
||||
|
@ -54,8 +54,7 @@ nsSVGGeometryFrame::Init(nsIContent* aContent,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
AddStateBits(aParent->GetStateBits() &
|
||||
(NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD |
|
||||
NS_STATE_SVG_REDRAW_SUSPENDED));
|
||||
(NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD));
|
||||
nsresult rv = nsSVGGeometryFrameBase::Init(aContent, aParent, aPrevInFlow);
|
||||
return rv;
|
||||
}
|
||||
|
@ -38,11 +38,19 @@
|
||||
#ifndef __NS_SVGGEOMETRYFRAME_H__
|
||||
#define __NS_SVGGEOMETRYFRAME_H__
|
||||
|
||||
#include "nsFrame.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsSVGPaintServerFrame;
|
||||
class gfxContext;
|
||||
class nsIContent;
|
||||
class nsStyleContext;
|
||||
class nsSVGPaintServerFrame;
|
||||
|
||||
struct nsStyleSVGPaint;
|
||||
|
||||
typedef nsFrame nsSVGGeometryFrameBase;
|
||||
|
||||
|