Merge m-c to fx-team a=merge

This commit is contained in:
Wes Kocher 2014-08-25 17:28:53 -07:00
commit 4e6d917ec5
245 changed files with 4415 additions and 2173 deletions

View File

@ -248,7 +248,7 @@ this.AccessFu = { // jshint ignore:line
}
if (this._notifyOutputPref.value) {
Services.obs.notifyObservers(null, 'accessfu-output',
Services.obs.notifyObservers(null, 'accessibility-output',
JSON.stringify(aPresentationData));
}
},
@ -514,7 +514,7 @@ var Output = {
},
B2G: function B2G(aDetails) {
Utils.dispatchChromeEvent('accessfu-output', aDetails);
Utils.dispatchChromeEvent('accessibility-output', aDetails);
},
Visual: function Visual(aDetail, aBrowser) {

View File

@ -81,7 +81,7 @@ var AccessFuTest = {
isDeeply(data.details, aWaitForData, "Data is correct");
aListener.apply(listener);
};
Services.obs.addObserver(listener, 'accessfu-output', false);
Services.obs.addObserver(listener, 'accessibility-output', false);
return listener;
},
@ -90,12 +90,12 @@ var AccessFuTest = {
},
off: function AccessFuTest_off(aListener) {
Services.obs.removeObserver(aListener, 'accessfu-output');
Services.obs.removeObserver(aListener, 'accessibility-output');
},
once: function AccessFuTest_once(aWaitForData, aListener) {
return this._addObserver(aWaitForData, function observerAndRemove() {
Services.obs.removeObserver(this, 'accessfu-output');
Services.obs.removeObserver(this, 'accessibility-output');
aListener();
});
},

View File

@ -54,7 +54,7 @@ pref("browser.cache.memory_limit", 2048); // 2 MB
/* image cache prefs */
pref("image.cache.size", 1048576); // bytes
pref("image.high_quality_downscaling.enabled", false);
pref("canvas.image.cache.limit", 10485760); // 10 MB
pref("canvas.image.cache.limit", 20971520); // 20 MB
/* offline cache prefs */
pref("browser.offline-apps.notify", false);

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="53a59364ce4f14068034c8d6fe01f4f6b9f78f23">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d59843c1d66bd8d93c6012efda47fa447b99813c"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="53a59364ce4f14068034c8d6fe01f4f6b9f78f23">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d59843c1d66bd8d93c6012efda47fa447b99813c"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "5efa211f0198ab15798b456445f163d57e735cdb",
"revision": "0ce5a025c89f6120b55498528323a8a973dd117e",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="d59843c1d66bd8d93c6012efda47fa447b99813c"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1934a2297ffc0d90424cd9cd3294c4a8c74a7333"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d1d0ea5a82cddeeab497774cfa1703639e3c7d9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -1222,13 +1222,15 @@ var gPluginHandler = {
let observer = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
observe : function(subject, topic, data) {
observe : (subject, topic, data) => {
let propertyBag = subject;
if (!(propertyBag instanceof Ci.nsIPropertyBag2))
return;
// Ignore notifications for other crashes.
if (propertyBag.get("minidumpID") != pluginDumpID)
return;
let statusDiv = this.getPluginUI(plugin, "submitStatus");
statusDiv.setAttribute("status", data);
},

View File

@ -1168,13 +1168,13 @@ nsContextMenu.prototype = {
return;
}
var extHelperAppSvc =
let extHelperAppSvc =
Cc["@mozilla.org/uriloader/external-helper-app-service;1"].
getService(Ci.nsIExternalHelperAppService);
var channel = aRequest.QueryInterface(Ci.nsIChannel);
this.extListener =
let channel = aRequest.QueryInterface(Ci.nsIChannel);
this.extListener =
extHelperAppSvc.doContent(channel.contentType, aRequest,
doc.defaultView, true);
doc.defaultView, true, window);
this.extListener.onStartRequest(aRequest, aContext);
},

View File

@ -114,6 +114,15 @@ function onSubmitStatus(subj, topic, data) {
val = getPropertyBagValue(extra, "PluginContentURL");
ok(val === undefined,
"URL should be absent from extra data when opt-in not checked");
// Execute this later in case the event to change submitStatus has not
// have been dispatched yet.
executeSoon(function () {
let plugin = gBrowser.contentDocument.getElementById("test");
let elt = gPluginHandler.getPluginUI.bind(gPluginHandler, plugin);
is(elt("submitStatus").getAttribute("status"), data,
"submitStatus data should match");
});
}
catch (err) {
failWithException(err);

View File

@ -109,7 +109,7 @@ if CONFIG['ARM_ARCH']:
# detection, so we have to set armv7=0 for non-Android target
gyp_vars['armv7'] = 0
# For libyuv
gyp_vars['arm_version'] = CONFIG['ARM_ARCH']
gyp_vars['arm_version'] = int(CONFIG['ARM_ARCH'])
# Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
if CONFIG['INTEL_ARCHITECTURE']:

View File

@ -7501,11 +7501,17 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
nsViewportInfo
nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
{
// Compute the CSS-to-LayoutDevice pixel scale as the product of the
// widget scale and the full zoom.
nsPresContext* context = mPresShell->GetPresContext();
float fullZoom = context ? context->GetFullZoom() : 1.0;
fullZoom = (fullZoom == 0.0) ? 1.0 : fullZoom;
CSSToScreenScale defaultScale = CSSToLayoutDeviceScale(fullZoom) *
LayoutDeviceToScreenScale(1.0);
nsIWidget *widget = nsContentUtils::WidgetForDocument(this);
float widgetScale = widget ? widget->GetDefaultScale().scale : 1.0f;
CSSToLayoutDeviceScale layoutDeviceScale(widgetScale * fullZoom);
CSSToScreenScale defaultScale = layoutDeviceScale
* LayoutDeviceToScreenScale(1.0);
// In cases where the width of the CSS viewport is less than or equal to the width
// of the display (i.e. width <= device-width) then we disable double-tap-to-zoom
@ -7689,19 +7695,13 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
}
}
// Now convert the scale into device pixels per CSS pixel base on this formula
// CSSPixel x widget scale x full zoom = LayoutDevicePixel
nsIWidget *widget = nsContentUtils::WidgetForDocument(this);
CSSToLayoutDeviceScale pixelRatio = CSSToLayoutDeviceScale(
(widget ? widget->GetDefaultScale().scale : 1.0f) * fullZoom);
CSSToScreenScale scaleFloat = mScaleFloat * pixelRatio;
CSSToScreenScale scaleMinFloat = mScaleMinFloat * pixelRatio;
CSSToScreenScale scaleMaxFloat = mScaleMaxFloat * pixelRatio;
CSSToScreenScale scaleFloat = mScaleFloat * layoutDeviceScale;
CSSToScreenScale scaleMinFloat = mScaleMinFloat * layoutDeviceScale;
CSSToScreenScale scaleMaxFloat = mScaleMaxFloat * layoutDeviceScale;
if (mAutoSize) {
// aDisplaySize is in screen pixels; convert them to CSS pixels for the viewport size.
CSSToScreenScale defaultPixelScale = pixelRatio * LayoutDeviceToScreenScale(1.0f);
CSSToScreenScale defaultPixelScale = layoutDeviceScale * LayoutDeviceToScreenScale(1.0f);
size = ScreenSize(aDisplaySize) / defaultPixelScale;
}

View File

@ -973,8 +973,8 @@ HTMLSelectElement::SetOptionsSelectedByIndex(int32_t aStartIndex,
if (aOptionsMask & IS_SELECTED) {
// Setting selectedIndex to an out-of-bounds index means -1. (HTML5)
if (aStartIndex < 0 || SafeCast<uint32_t>(aStartIndex) >= numItems ||
aEndIndex < 0 || SafeCast<uint32_t>(aEndIndex) >= numItems) {
if (aStartIndex < 0 || AssertedCast<uint32_t>(aStartIndex) >= numItems ||
aEndIndex < 0 || AssertedCast<uint32_t>(aEndIndex) >= numItems) {
aStartIndex = -1;
aEndIndex = -1;
}
@ -1004,8 +1004,8 @@ HTMLSelectElement::SetOptionsSelectedByIndex(int32_t aStartIndex,
MOZ_ASSERT(aEndIndex >= 0);
// Loop through the options and select them (if they are not disabled and
// if they are not already selected).
for (uint32_t optIndex = SafeCast<uint32_t>(aStartIndex);
optIndex <= SafeCast<uint32_t>(aEndIndex);
for (uint32_t optIndex = AssertedCast<uint32_t>(aStartIndex);
optIndex <= AssertedCast<uint32_t>(aEndIndex);
optIndex++) {
nsRefPtr<HTMLOptionElement> option = Item(optIndex);
@ -1040,7 +1040,7 @@ HTMLSelectElement::SetOptionsSelectedByIndex(int32_t aStartIndex,
|| ((aOptionsMask & CLEAR_ALL) && !allDisabled)
|| aStartIndex == -1)
&& previousSelectedIndex != -1) {
for (uint32_t optIndex = SafeCast<uint32_t>(previousSelectedIndex);
for (uint32_t optIndex = AssertedCast<uint32_t>(previousSelectedIndex);
optIndex < numItems;
optIndex++) {
if (static_cast<int32_t>(optIndex) < aStartIndex ||

View File

@ -126,6 +126,54 @@ GetPluginPaths(const std::string& aPluginPath,
return true;
}
static bool
GetAppPaths(nsCString &aAppPath, nsCString &aAppBinaryPath)
{
nsAutoCString appPath;
nsAutoCString appBinaryPath(
(CommandLine::ForCurrentProcess()->argv()[0]).c_str());
nsAutoCString::const_iterator start, end;
appBinaryPath.BeginReading(start);
appBinaryPath.EndReading(end);
if (RFindInReadable(NS_LITERAL_CSTRING(".app/Contents/MacOS/"), start, end)) {
end = start;
++end; ++end; ++end; ++end;
appBinaryPath.BeginReading(start);
appPath.Assign(Substring(start, end));
} else {
return false;
}
nsCOMPtr<nsIFile> app, appBinary;
nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(appPath),
true, getter_AddRefs(app));
if (NS_FAILED(rv)) {
return false;
}
rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(appBinaryPath),
true, getter_AddRefs(appBinary));
if (NS_FAILED(rv)) {
return false;
}
bool isLink;
app->IsSymlink(&isLink);
if (isLink) {
app->GetNativeTarget(aAppPath);
} else {
app->GetNativePath(aAppPath);
}
appBinary->IsSymlink(&isLink);
if (isLink) {
appBinary->GetNativeTarget(aAppBinaryPath);
} else {
appBinary->GetNativePath(aAppBinaryPath);
}
return true;
}
void
GMPChild::OnChannelConnected(int32_t aPid)
{
@ -133,6 +181,10 @@ GMPChild::OnChannelConnected(int32_t aPid)
if (!GetPluginPaths(mPluginPath, pluginDirectoryPath, pluginFilePath)) {
MOZ_CRASH("Error scanning plugin path");
}
nsAutoCString appPath, appBinaryPath;
if (!GetAppPaths(appPath, appBinaryPath)) {
MOZ_CRASH("Error resolving child process path");
}
MacSandboxInfo info;
info.type = MacSandboxType_Plugin;
@ -140,6 +192,8 @@ GMPChild::OnChannelConnected(int32_t aPid)
info.pluginInfo.pluginPath.Assign(pluginDirectoryPath);
mPluginBinaryPath.Assign(pluginFilePath);
info.pluginInfo.pluginBinaryPath.Assign(pluginFilePath);
info.appPath.Assign(appPath);
info.appBinaryPath.Assign(appBinaryPath);
nsAutoCString err;
if (!mozilla::StartMacSandbox(info, err)) {

View File

@ -877,7 +877,7 @@ nsDocShell::nsDocShell():
(void*) this,
gNumberOfDocShells,
getpid(),
SafeCast<unsigned long long>(mHistoryID));
AssertedCast<unsigned long long>(mHistoryID));
}
#endif
}
@ -909,7 +909,7 @@ nsDocShell::~nsDocShell()
(void*) this,
gNumberOfDocShells,
getpid(),
SafeCast<unsigned long long>(mHistoryID));
AssertedCast<unsigned long long>(mHistoryID));
}
#endif
}

View File

@ -1035,6 +1035,12 @@ class CGHeaders(CGWrapper):
elif unrolled.isInterface():
if unrolled.isSpiderMonkeyInterface():
bindingHeaders.add("jsfriendapi.h")
if jsImplementedDescriptors:
# Since we can't forward-declare typed array types
# (because they're typedefs), we have to go ahead and
# just include their header if we need to have functions
# taking references to them declared in that header.
headerSet = declareIncludes
headerSet.add("mozilla/dom/TypedArray.h")
else:
providers = getRelevantProviders(descriptor, config)
@ -5485,7 +5491,8 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
'jsvalHandle': "&tmp",
'returnsNewObject': returnsNewObject,
'exceptionCode': exceptionCode,
'obj': "returnArray"
'obj': "returnArray",
'typedArraysAreStructs': typedArraysAreStructs
})
sequenceWrapLevel -= 1
code = fill(
@ -5538,7 +5545,8 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
'jsvalHandle': "&tmp",
'returnsNewObject': returnsNewObject,
'exceptionCode': exceptionCode,
'obj': "returnObj"
'obj': "returnObj",
'typedArraysAreStructs': typedArraysAreStructs
})
mozMapWrapLevel -= 1
code = fill(
@ -11809,6 +11817,8 @@ class CGForwardDeclarations(CGWrapper):
builder.add(desc.nativeType)
except NoSuchDescriptorError:
pass
# Note: Spidermonkey interfaces are typedefs, so can't be
# forward-declared
elif t.isCallback():
builder.addInMozillaDom(str(t))
elif t.isDictionary():
@ -12015,7 +12025,7 @@ class CGBindingRoot(CGThing):
return {desc.getDescriptor(desc.interface.parent.identifier.name)}
for x in dependencySortObjects(jsImplemented, getParentDescriptor,
lambda d: d.interface.identifier.name):
cgthings.append(CGCallbackInterface(x))
cgthings.append(CGCallbackInterface(x, typedArraysAreStructs=True))
cgthings.append(CGJSImplClass(x))
# And make sure we have the right number of newlines at the end
@ -12073,10 +12083,11 @@ class CGBindingRoot(CGThing):
class CGNativeMember(ClassMethod):
def __init__(self, descriptorProvider, member, name, signature, extendedAttrs,
breakAfter=True, passJSBitsAsNeeded=True, visibility="public",
jsObjectsArePtr=False, variadicIsSequence=False):
typedArraysAreStructs=True, variadicIsSequence=False):
"""
If jsObjectsArePtr is true, typed arrays and "object" will be
passed as JSObject*.
If typedArraysAreStructs is false, typed arrays will be passed as
JS::Handle<JSObject*>. If it's true they will be passed as one of the
dom::TypedArray subclasses.
If passJSBitsAsNeeded is false, we don't automatically pass in a
JSContext* or a JSObject* based on the return and argument types. We
@ -12087,7 +12098,7 @@ class CGNativeMember(ClassMethod):
self.extendedAttrs = extendedAttrs
self.resultAlreadyAddRefed = isResultAlreadyAddRefed(self.extendedAttrs)
self.passJSBitsAsNeeded = passJSBitsAsNeeded
self.jsObjectsArePtr = jsObjectsArePtr
self.typedArraysAreStructs = typedArraysAreStructs
self.variadicIsSequence = variadicIsSequence
breakAfterSelf = "\n" if breakAfter else ""
ClassMethod.__init__(self, name,
@ -12195,9 +12206,9 @@ class CGNativeMember(ClassMethod):
# No need for a third element in the isMember case
return "JSObject*", None, None
if type.nullable():
returnCode = "${declName}.IsNull() ? nullptr : ${declName}.Value().Obj();\n"
returnCode = "${declName}.IsNull() ? nullptr : ${declName}.Value().Obj()"
else:
returnCode = "${declName}.Obj();\n"
returnCode = "${declName}.Obj()"
return "void", "", "aRetVal.set(%s);\n" % returnCode
if type.isSequence():
# If we want to handle sequence-of-sequences return values, we're
@ -12373,8 +12384,8 @@ class CGNativeMember(ClassMethod):
False, False)
if type.isSpiderMonkeyInterface():
if self.jsObjectsArePtr:
return "JSObject*", False, False
if not self.typedArraysAreStructs:
return "JS::Handle<JSObject*>", False, False
return type.name, True, True
@ -12862,13 +12873,11 @@ class CGJSImplMember(CGNativeMember):
"""
def __init__(self, descriptorProvider, member, name, signature,
extendedAttrs, breakAfter=True, passJSBitsAsNeeded=True,
visibility="public", jsObjectsArePtr=False,
variadicIsSequence=False):
visibility="public", variadicIsSequence=False):
CGNativeMember.__init__(self, descriptorProvider, member, name,
signature, extendedAttrs, breakAfter=breakAfter,
passJSBitsAsNeeded=passJSBitsAsNeeded,
visibility=visibility,
jsObjectsArePtr=jsObjectsArePtr,
variadicIsSequence=variadicIsSequence)
self.body = self.getImpl()
@ -13370,16 +13379,17 @@ class CGCallbackFunction(CGCallback):
class CGCallbackInterface(CGCallback):
def __init__(self, descriptor):
def __init__(self, descriptor, typedArraysAreStructs=False):
iface = descriptor.interface
attrs = [m for m in iface.members if m.isAttr() and not m.isStatic()]
getters = [CallbackGetter(a, descriptor) for a in attrs]
setters = [CallbackSetter(a, descriptor) for a in attrs
if not a.readonly]
getters = [CallbackGetter(a, descriptor, typedArraysAreStructs)
for a in attrs]
setters = [CallbackSetter(a, descriptor, typedArraysAreStructs)
for a in attrs if not a.readonly]
methods = [m for m in iface.members
if m.isMethod() and not m.isStatic() and not m.isIdentifierLess()]
methods = [CallbackOperation(m, sig, descriptor) for m in methods
for sig in m.signatures()]
methods = [CallbackOperation(m, sig, descriptor, typedArraysAreStructs)
for m in methods for sig in m.signatures()]
if iface.isJSImplemented() and iface.ctor():
sigs = descriptor.interface.ctor().signatures()
if len(sigs) != 1:
@ -13420,7 +13430,8 @@ class FakeMember():
class CallbackMember(CGNativeMember):
def __init__(self, sig, name, descriptorProvider, needThisHandling, rethrowContentException=False):
def __init__(self, sig, name, descriptorProvider, needThisHandling,
rethrowContentException=False, typedArraysAreStructs=False):
"""
needThisHandling is True if we need to be able to accept a specified
thisObj, False otherwise.
@ -13452,7 +13463,7 @@ class CallbackMember(CGNativeMember):
extendedAttrs={},
passJSBitsAsNeeded=False,
visibility=visibility,
jsObjectsArePtr=True)
typedArraysAreStructs=typedArraysAreStructs)
# We have to do all the generation of our body now, because
# the caller relies on us throwing if we can't manage it.
self.exceptionCode = ("aRv.Throw(NS_ERROR_UNEXPECTED);\n"
@ -13568,7 +13579,8 @@ class CallbackMember(CGNativeMember):
# CallSetup already handled the unmark-gray bits for us.
'obj': 'CallbackPreserveColor()',
'returnsNewObject': False,
'exceptionCode': self.exceptionCode
'exceptionCode': self.exceptionCode,
'typedArraysAreStructs': self.typedArraysAreStructs
})
except MethodNotNewObjectError as err:
raise TypeError("%s being passed as an argument to %s but is not "
@ -13671,9 +13683,10 @@ class CallbackMember(CGNativeMember):
class CallbackMethod(CallbackMember):
def __init__(self, sig, name, descriptorProvider, needThisHandling,
rethrowContentException=False):
rethrowContentException=False, typedArraysAreStructs=False):
CallbackMember.__init__(self, sig, name, descriptorProvider,
needThisHandling, rethrowContentException)
needThisHandling, rethrowContentException,
typedArraysAreStructs=typedArraysAreStructs)
def getRvalDecl(self):
return "JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());\n"
@ -13730,10 +13743,14 @@ class CallbackOperationBase(CallbackMethod):
"""
Common class for implementing various callback operations.
"""
def __init__(self, signature, jsName, nativeName, descriptor, singleOperation, rethrowContentException=False):
def __init__(self, signature, jsName, nativeName, descriptor,
singleOperation, rethrowContentException=False,
typedArraysAreStructs=False):
self.singleOperation = singleOperation
self.methodName = descriptor.binaryNameFor(jsName)
CallbackMethod.__init__(self, signature, nativeName, descriptor, singleOperation, rethrowContentException)
CallbackMethod.__init__(self, signature, nativeName, descriptor,
singleOperation, rethrowContentException,
typedArraysAreStructs=typedArraysAreStructs)
def getThisDecl(self):
if not self.singleOperation:
@ -13784,7 +13801,7 @@ class CallbackOperation(CallbackOperationBase):
"""
Codegen actual WebIDL operations on callback interfaces.
"""
def __init__(self, method, signature, descriptor):
def __init__(self, method, signature, descriptor, typedArraysAreStructs):
self.ensureASCIIName(method)
self.method = method
jsName = method.identifier.name
@ -13792,7 +13809,8 @@ class CallbackOperation(CallbackOperationBase):
jsName,
MakeNativeName(descriptor.binaryNameFor(jsName)),
descriptor, descriptor.interface.isSingleOperationInterface(),
rethrowContentException=descriptor.interface.isJSImplemented())
rethrowContentException=descriptor.interface.isJSImplemented(),
typedArraysAreStructs=typedArraysAreStructs)
def getPrettyName(self):
return "%s.%s" % (self.descriptorProvider.interface.identifier.name,
@ -13803,12 +13821,13 @@ class CallbackAccessor(CallbackMember):
"""
Shared superclass for CallbackGetter and CallbackSetter.
"""
def __init__(self, attr, sig, name, descriptor):
def __init__(self, attr, sig, name, descriptor, typedArraysAreStructs):
self.ensureASCIIName(attr)
self.attrName = attr.identifier.name
CallbackMember.__init__(self, sig, name, descriptor,
needThisHandling=False,
rethrowContentException=descriptor.interface.isJSImplemented())
rethrowContentException=descriptor.interface.isJSImplemented(),
typedArraysAreStructs=typedArraysAreStructs)
def getPrettyName(self):
return "%s.%s" % (self.descriptorProvider.interface.identifier.name,
@ -13816,11 +13835,12 @@ class CallbackAccessor(CallbackMember):
class CallbackGetter(CallbackAccessor):
def __init__(self, attr, descriptor):
def __init__(self, attr, descriptor, typedArraysAreStructs):
CallbackAccessor.__init__(self, attr,
(attr.type, []),
callbackGetterName(attr, descriptor),
descriptor)
descriptor,
typedArraysAreStructs)
def getRvalDecl(self):
return "JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());\n"
@ -13842,12 +13862,12 @@ class CallbackGetter(CallbackAccessor):
class CallbackSetter(CallbackAccessor):
def __init__(self, attr, descriptor):
def __init__(self, attr, descriptor, typedArraysAreStructs):
CallbackAccessor.__init__(self, attr,
(BuiltinTypes[IDLBuiltinType.Types.void],
[FakeArgument(attr.type, attr)]),
callbackSetterName(attr, descriptor),
descriptor)
descriptor, typedArraysAreStructs)
def getRvalDecl(self):
# We don't need an rval

View File

@ -1007,7 +1007,14 @@ class IDLInterface(IDLObjectWithScope):
if (self.getExtendedAttribute("Pref") and
self._exposureGlobalNames != set([self.parentScope.primaryGlobalName])):
raise WebIDLError("[Pref] used on an member that is not %s-only" %
raise WebIDLError("[Pref] used on an interface that is not %s-only" %
self.parentScope.primaryGlobalName,
[self.location])
if (self.getExtendedAttribute("CheckPermissions") and
self._exposureGlobalNames != set([self.parentScope.primaryGlobalName])):
raise WebIDLError("[CheckPermissions] used on an interface that is "
"not %s-only" %
self.parentScope.primaryGlobalName,
[self.location])
@ -3022,6 +3029,13 @@ class IDLInterfaceMember(IDLObjectWithIdentifier):
"%s-only" % self._scope.primaryGlobalName,
[self.location])
if (self.getExtendedAttribute("CheckPermissions") and
self.exposureSet != set([self._scope.primaryGlobalName])):
raise WebIDLError("[CheckPermissions] used on an interface member "
"that is not %s-only" %
self._scope.primaryGlobalName,
[self.location])
class IDLConst(IDLInterfaceMember):
def __init__(self, location, identifier, type, value):
IDLInterfaceMember.__init__(self, location, identifier,

View File

@ -461,6 +461,8 @@ public:
void PassVariadicTypedArray(const Sequence<Float32Array>&);
void PassVariadicNullableTypedArray(const Sequence<Nullable<Float32Array> >&);
void ReceiveUint8Array(JSContext*, JS::MutableHandle<JSObject*>);
void SetUint8ArrayAttr(const Uint8Array&);
void GetUint8ArrayAttr(JSContext*, JS::MutableHandle<JSObject*>);
// DOMString types
void PassString(const nsAString&);

View File

@ -33,6 +33,27 @@ callback interface TestCallbackInterface {
sequence<TestCallbackInterface?>? getNullableSequenceOfNullableCallbackInterfaces();
MozMap<long> getMozMapOfLong();
Dict? getDictionary();
void passArrayBuffer(ArrayBuffer arg);
void passNullableArrayBuffer(ArrayBuffer? arg);
void passOptionalArrayBuffer(optional ArrayBuffer arg);
void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg);
void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null);
void passArrayBufferView(ArrayBufferView arg);
void passInt8Array(Int8Array arg);
void passInt16Array(Int16Array arg);
void passInt32Array(Int32Array arg);
void passUint8Array(Uint8Array arg);
void passUint16Array(Uint16Array arg);
void passUint32Array(Uint32Array arg);
void passUint8ClampedArray(Uint8ClampedArray arg);
void passFloat32Array(Float32Array arg);
void passFloat64Array(Float64Array arg);
void passSequenceOfArrayBuffers(sequence<ArrayBuffer> arg);
void passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
void passVariadicTypedArray(Float32Array... arg);
void passVariadicNullableTypedArray(Float32Array?... arg);
Uint8Array receiveUint8Array();
attribute Uint8Array uint8ArrayAttr;
};
callback interface TestSingleOperationCallbackInterface {
@ -420,6 +441,7 @@ interface TestInterface {
void passVariadicTypedArray(Float32Array... arg);
void passVariadicNullableTypedArray(Float32Array?... arg);
Uint8Array receiveUint8Array();
attribute Uint8Array uint8ArrayAttr;
// DOMString types
void passString(DOMString arg);

View File

@ -307,6 +307,7 @@ interface TestExampleInterface {
void passVariadicTypedArray(Float32Array... arg);
void passVariadicNullableTypedArray(Float32Array?... arg);
Uint8Array receiveUint8Array();
attribute Uint8Array uint8ArrayAttr;
// DOMString types
void passString(DOMString arg);

View File

@ -303,33 +303,30 @@ interface TestJSImplInterface {
//MozMap<MozMap<long>> receiveMozMapOfMozMaps();
MozMap<any> receiveAnyMozMap();
// ArrayBuffer is handled differently in callback interfaces and the example generator.
// Need to figure out what should be done there. Seems like other typed array stuff is
// similarly not working in the JS implemented generator. Probably some other issues
// here as well.
// Typed array types
//void passArrayBuffer(ArrayBuffer arg);
//void passNullableArrayBuffer(ArrayBuffer? arg);
//void passOptionalArrayBuffer(optional ArrayBuffer arg);
//void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg);
//void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null);
//void passArrayBufferView(ArrayBufferView arg);
//void passInt8Array(Int8Array arg);
//void passInt16Array(Int16Array arg);
//void passInt32Array(Int32Array arg);
//void passUint8Array(Uint8Array arg);
//void passUint16Array(Uint16Array arg);
//void passUint32Array(Uint32Array arg);
//void passUint8ClampedArray(Uint8ClampedArray arg);
//void passFloat32Array(Float32Array arg);
//void passFloat64Array(Float64Array arg);
//void passSequenceOfArrayBuffers(sequence<ArrayBuffer> arg);
//void passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
//void passMozMapOfArrayBuffers(MozMap<ArrayBuffer> arg);
//void passMozMapOfNullableArrayBuffers(MozMap<ArrayBuffer?> arg);
//void passVariadicTypedArray(Float32Array... arg);
//void passVariadicNullableTypedArray(Float32Array?... arg);
//Uint8Array receiveUint8Array();
void passArrayBuffer(ArrayBuffer arg);
void passNullableArrayBuffer(ArrayBuffer? arg);
void passOptionalArrayBuffer(optional ArrayBuffer arg);
void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg);
void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null);
void passArrayBufferView(ArrayBufferView arg);
void passInt8Array(Int8Array arg);
void passInt16Array(Int16Array arg);
void passInt32Array(Int32Array arg);
void passUint8Array(Uint8Array arg);
void passUint16Array(Uint16Array arg);
void passUint32Array(Uint32Array arg);
void passUint8ClampedArray(Uint8ClampedArray arg);
void passFloat32Array(Float32Array arg);
void passFloat64Array(Float64Array arg);
void passSequenceOfArrayBuffers(sequence<ArrayBuffer> arg);
void passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
void passMozMapOfArrayBuffers(MozMap<ArrayBuffer> arg);
void passMozMapOfNullableArrayBuffers(MozMap<ArrayBuffer?> arg);
void passVariadicTypedArray(Float32Array... arg);
void passVariadicNullableTypedArray(Float32Array?... arg);
Uint8Array receiveUint8Array();
attribute Uint8Array uint8ArrayAttr;
// DOMString types
void passString(DOMString arg);

View File

@ -81,6 +81,9 @@ let SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED = (SEC_ERROR_BASE + 176);
let SSL_ERROR_BASE = Ci.nsINSSErrorsService.NSS_SSL_ERROR_BASE;
let SSL_ERROR_BAD_CERT_DOMAIN = (SSL_ERROR_BASE + 12);
let MOZILLA_PKIX_ERROR_BASE = Ci.nsINSSErrorsService.MOZILLA_PKIX_ERROR_BASE;
let MOZILLA_PKIX_ERROR_CA_CERT_USED_AS_END_ENTITY = (MOZILLA_PKIX_ERROR_BASE + 1);
function getErrorClass(errorCode) {
let NSPRCode = -1 * NS_ERROR_GET_CODE(errorCode);
@ -92,6 +95,7 @@ function getErrorClass(errorCode) {
case SSL_ERROR_BAD_CERT_DOMAIN:
case SEC_ERROR_EXPIRED_CERTIFICATE:
case SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED:
case MOZILLA_PKIX_ERROR_CA_CERT_USED_AS_END_ENTITY:
return Ci.nsINSSErrorsService.ERROR_CLASS_BAD_CERT;
default:
return Ci.nsINSSErrorsService.ERROR_CLASS_SSL_PROTOCOL;

View File

@ -397,12 +397,28 @@ nsDOMCameraControl::SetIsoMode(const nsAString& aIsoMode, ErrorResult& aRv)
aRv = mCameraControl->Set(CAMERA_PARAM_ISOMODE, aIsoMode);
}
double
nsDOMCameraControl::GetPictureQuality(ErrorResult& aRv)
{
MOZ_ASSERT(mCameraControl);
double quality;
aRv = mCameraControl->Get(CAMERA_PARAM_PICTURE_QUALITY, quality);
return quality;
}
void
nsDOMCameraControl::SetPictureQuality(double aQuality, ErrorResult& aRv)
{
MOZ_ASSERT(mCameraControl);
aRv = mCameraControl->Set(CAMERA_PARAM_PICTURE_QUALITY, aQuality);
}
double
nsDOMCameraControl::GetZoom(ErrorResult& aRv)
{
MOZ_ASSERT(mCameraControl);
double zoom;
double zoom = 1.0;
aRv = mCameraControl->Get(CAMERA_PARAM_ZOOM, zoom);
return zoom;
}

View File

@ -82,6 +82,8 @@ public:
already_AddRefed<dom::CameraCapabilities> Capabilities();
void GetIsoMode(nsString& aMode, ErrorResult& aRv);
void SetIsoMode(const nsAString& aMode, ErrorResult& aRv);
double GetPictureQuality(ErrorResult& aRv);
void SetPictureQuality(double aQuality, ErrorResult& aRv);
// Unsolicited event handlers.
dom::CameraShutterCallback* GetOnShutter();

View File

@ -177,18 +177,22 @@ nsGonkCameraControl::Initialize()
mParams.Get(CAMERA_PARAM_FLASHMODE, flashMode);
mFlashSupported = !flashMode.IsEmpty();
double quality; // informational only
mParams.Get(CAMERA_PARAM_PICTURE_QUALITY, quality);
DOM_CAMERA_LOGI(" - maximum metering areas: %u\n", mCurrentConfiguration.mMaxMeteringAreas);
DOM_CAMERA_LOGI(" - maximum focus areas: %u\n", mCurrentConfiguration.mMaxFocusAreas);
DOM_CAMERA_LOGI(" - default picture size: %u x %u\n",
mLastPictureSize.width, mLastPictureSize.height);
DOM_CAMERA_LOGI(" - default picture file format: %s\n",
NS_ConvertUTF16toUTF8(mFileFormat).get());
DOM_CAMERA_LOGI(" - default picture quality: %f\n", quality);
DOM_CAMERA_LOGI(" - default thumbnail size: %u x %u\n",
mLastThumbnailSize.width, mLastThumbnailSize.height);
DOM_CAMERA_LOGI(" - default preview size: %u x %u\n",
mCurrentConfiguration.mPreviewSize.width, mCurrentConfiguration.mPreviewSize.height);
DOM_CAMERA_LOGI(" - default video recorder size: %u x %u\n",
mLastRecorderSize.width, mLastRecorderSize.height);
DOM_CAMERA_LOGI(" - default picture file format: %s\n",
NS_ConvertUTF16toUTF8(mFileFormat).get());
DOM_CAMERA_LOGI(" - luminance reporting: %ssupported\n",
mLuminanceSupported ? "" : "NOT ");
if (mFlashSupported) {

View File

@ -115,6 +115,8 @@ GonkCameraParameters::Parameters::GetTextKey(uint32_t aKey)
return "hdr-need-1x";
case CAMERA_PARAM_RECORDINGHINT:
return KEY_RECORDING_HINT;
case CAMERA_PARAM_PICTURE_QUALITY:
return KEY_JPEG_QUALITY;
case CAMERA_PARAM_SUPPORTED_PREVIEWSIZES:
return KEY_SUPPORTED_PREVIEW_SIZES;
@ -661,6 +663,19 @@ GonkCameraParameters::SetTranslated(uint32_t aKey, const double& aValue)
DOM_CAMERA_LOGI("Zoom = %fx --> index = %d\n", aValue, index);
}
return SetImpl(CAMERA_PARAM_ZOOM, index);
case CAMERA_PARAM_PICTURE_QUALITY:
{
// Convert aValue [0.0..1.0] to nearest index in the range [1..100].
index = (aValue + 0.005) * 99.0 + 1.0;
if (aValue < 0.0) {
index = 1;
} else if (aValue > 1.0) {
index = 100;
}
DOM_CAMERA_LOGI("Picture quality = %f --> index = %d\n", aValue, index);
}
return SetImpl(CAMERA_PARAM_PICTURE_QUALITY, index);
}
return SetImpl(aKey, aValue);
@ -725,6 +740,19 @@ GonkCameraParameters::GetTranslated(uint32_t aKey, double& aValue)
}
break;
case CAMERA_PARAM_PICTURE_QUALITY:
// Convert index [1..100] to a quality value [0.0..1.0].
rv = GetImpl(aKey, index);
if (index < 2) {
val = 0.0;
} else if (index > 99) {
val = 1.0;
} else {
val = static_cast<double>(index - 1) / 99.0;
}
DOM_CAMERA_LOGI("index = %d --> picture quality = %f\n", index, val);
break;
default:
rv = GetImpl(aKey, val);
break;

View File

@ -33,6 +33,7 @@ enum {
CAMERA_PARAM_PICTURE_ROTATION,
CAMERA_PARAM_PICTURE_LOCATION,
CAMERA_PARAM_PICTURE_DATETIME,
CAMERA_PARAM_PICTURE_QUALITY,
CAMERA_PARAM_EFFECT,
CAMERA_PARAM_WHITEBALANCE,
CAMERA_PARAM_SCENEMODE,

View File

@ -159,9 +159,23 @@ var Camera = {
ok(Camera.cameraObj.zoom == 1.0, "zoom = " + Camera.cameraObj.zoom);
// Test snapping to supported values
Camera.cameraObj.zoom = 0.9;
ok(Camera.cameraObj.zoom == 1.0, "zoom = " + Camera.cameraObj.zoom);
ok(Camera.cameraObj.zoom == 1.0, "zoom (lower limit) = " + Camera.cameraObj.zoom);
Camera.cameraObj.zoom = 1.1;
ok(Camera.cameraObj.zoom == 1.0, "zoom = " + Camera.cameraObj.zoom);
ok(Camera.cameraObj.zoom == 1.0, "zoom (upper limit) = " + Camera.cameraObj.zoom);
// Check image quality handling
Camera.cameraObj.pictureQuality = 0.0;
ok(Camera.cameraObj.pictureQuality == 0.0, "picture quality = " + Camera.cameraObj.pictureQuality);
Camera.cameraObj.pictureQuality = -0.1;
ok(Camera.cameraObj.pictureQuality == 0.0, "picture quality (minimum limit) = " + Camera.cameraObj.pictureQuality);
Camera.cameraObj.pictureQuality = -Math.pow(2, 80);
ok(Camera.cameraObj.pictureQuality == 0.0, "picture quality (BIG negative) = " + Camera.cameraObj.pictureQuality);
Camera.cameraObj.pictureQuality = 1.0;
ok(Camera.cameraObj.pictureQuality == 1.0, "picture quality = " + Camera.cameraObj.pictureQuality);
Camera.cameraObj.pictureQuality = 1.1;
ok(Camera.cameraObj.pictureQuality == 1.0, "picture quality (maximum limit) = " + Camera.cameraObj.pictureQuality);
Camera.cameraObj.pictureQuality = Math.pow(2, 80);
ok(Camera.cameraObj.pictureQuality == 1.0, "picture quality (BIG positive) = " + Camera.cameraObj.pictureQuality);
Camera._tests = new Array();
for (var i in Camera._pictureSizes) {

View File

@ -85,22 +85,14 @@ public:
static bool sPrefsInitialized = false;
static int32_t sCanvasImageCacheLimit = 0;
class ImageCacheObserver;
class ImageCache MOZ_FINAL : public nsExpirationTracker<ImageCacheEntryData,4> {
public:
// We use 3 generations of 1 second each to get a 2-3 seconds timeout.
enum { GENERATION_MS = 1000 };
ImageCache()
: nsExpirationTracker<ImageCacheEntryData,4>(GENERATION_MS)
, mTotal(0)
{
if (!sPrefsInitialized) {
sPrefsInitialized = true;
Preferences::AddIntVarCache(&sCanvasImageCacheLimit, "canvas.image.cache.limit", 0);
}
}
~ImageCache() {
AgeAllGenerations();
}
ImageCache();
~ImageCache();
virtual void NotifyExpired(ImageCacheEntryData* aObject)
{
@ -112,10 +104,76 @@ public:
nsTHashtable<ImageCacheEntry> mCache;
size_t mTotal;
nsRefPtr<ImageCacheObserver> mImageCacheObserver;
};
static ImageCache* gImageCache = nullptr;
// Listen memory-pressure event for image cache purge
class ImageCacheObserver MOZ_FINAL : public nsIObserver
{
public:
NS_DECL_ISUPPORTS
ImageCacheObserver(ImageCache* aImageCache)
: mImageCache(aImageCache)
{
RegisterMemoryPressureEvent();
}
void Destroy()
{
UnregisterMemoryPressureEvent();
mImageCache = nullptr;
}
NS_IMETHODIMP Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aSomeData)
{
if (!mImageCache || strcmp(aTopic, "memory-pressure")) {
return NS_OK;
}
mImageCache->AgeAllGenerations();
return NS_OK;
}
private:
virtual ~ImageCacheObserver()
{
}
void RegisterMemoryPressureEvent()
{
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
MOZ_ASSERT(observerService);
if (observerService) {
observerService->AddObserver(this, "memory-pressure", false);
}
}
void UnregisterMemoryPressureEvent()
{
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
// Do not assert on observerService here. This might be triggered by
// the cycle collector at a late enough time, that XPCOM services are
// no longer available. See bug 1029504.
if (observerService) {
observerService->RemoveObserver(this, "memory-pressure");
}
}
ImageCache* mImageCache;
};
NS_IMPL_ISUPPORTS(ImageCacheObserver, nsIObserver)
class CanvasImageCacheShutdownObserver MOZ_FINAL : public nsIObserver
{
~CanvasImageCacheShutdownObserver() {}
@ -124,6 +182,23 @@ public:
NS_DECL_NSIOBSERVER
};
ImageCache::ImageCache()
: nsExpirationTracker<ImageCacheEntryData,4>(GENERATION_MS)
, mTotal(0)
{
if (!sPrefsInitialized) {
sPrefsInitialized = true;
Preferences::AddIntVarCache(&sCanvasImageCacheLimit, "canvas.image.cache.limit", 0);
}
mImageCacheObserver = new ImageCacheObserver(this);
MOZ_RELEASE_ASSERT(mImageCacheObserver, "Can't alloc ImageCacheObserver");
}
ImageCache::~ImageCache() {
AgeAllGenerations();
mImageCacheObserver->Destroy();
}
void
CanvasImageCache::NotifyDrawImage(Element* aImage,
HTMLCanvasElement* aCanvas,

View File

@ -91,6 +91,7 @@
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/HTMLVideoElement.h"
#include "mozilla/dom/SVGMatrix.h"
#include "mozilla/dom/TextMetrics.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/dom/SVGMatrix.h"
@ -4594,6 +4595,25 @@ CanvasPath::BezierTo(const gfx::Point& aCP1,
mPathBuilder->BezierTo(aCP1, aCP2, aCP3);
}
void
CanvasPath::AddPath(CanvasPath& aCanvasPath, const Optional<NonNull<SVGMatrix>>& aMatrix)
{
RefPtr<gfx::Path> tempPath = aCanvasPath.GetPath(CanvasWindingRule::Nonzero,
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
if (aMatrix.WasPassed()) {
const SVGMatrix& m = aMatrix.Value();
Matrix transform(m.A(), m.B(), m.C(), m.D(), m.E(), m.F());
if (!transform.IsIdentity()) {
RefPtr<PathBuilder> tempBuilder = tempPath->TransformedCopyToBuilder(transform, FillRule::FILL_WINDING);
tempPath = tempBuilder->Finish();
}
}
tempPath->StreamToSink(mPathBuilder);
}
TemporaryRef<gfx::Path>
CanvasPath::GetPath(const CanvasWindingRule& winding, const DrawTarget* aTarget) const
{

View File

@ -41,6 +41,7 @@ class ImageData;
class StringOrCanvasGradientOrCanvasPattern;
class OwningStringOrCanvasGradientOrCanvasPattern;
class TextMetrics;
class SVGMatrix;
extern const mozilla::gfx::Float SIGMA_MAX;
@ -94,6 +95,9 @@ public:
CanvasPath(nsISupports* aParent,
TemporaryRef<gfx::PathBuilder> aPathBuilder);
void AddPath(CanvasPath& aCanvasPath,
const Optional<NonNull<SVGMatrix>>& aMatrix);
private:
virtual ~CanvasPath() {}

View File

@ -337,50 +337,100 @@ function test_pathconstructor_canvas() {
}
</script>
<p>Canvas test: test_addpath_canvas</p>
<canvas id="c8" class="output" width="200" height="200">+
</canvas>
<script type="text/javascript">
function test_addpath_canvas() {
var c = document.getElementById("c8");
var ctx = c.getContext("2d");
ctx.beginPath();
var p1 = new Path2D();
p1.rect(0,0,100,100);
var p2 = new Path2D();
p2.rect(0,100,100,100);
var m = ctx.currentTransform;
p1.addPath(p2, m);
ctx.fillStyle = 'yellow';
ctx.fill(p1);
isPixel(ctx, 0, 100, [255, 255, 0, 255], 0);
ctx.clearRect(0,0,200,200);
ctx.beginPath();
var p3 = new Path2D();
p3.rect(0,0,100,100);
var p4 = new Path2D();
p4.rect(0,100,100,100);
var m = document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGMatrix();
m.a = 1; m.b = 0;
m.c = 0; m.d = 1;
m.e = 100; m.f = -100;
p3.addPath(p4, m);
ctx.fillStyle = 'yellow';
ctx.fill(p3);
isPixel(ctx, 50, 50, [255, 255, 0, 255], 0);
isPixel(ctx, 150, 150, [0, 0, 0, 0], 0);
var p5 = new Path2D();
p5.rect(0,0,100,100);
shouldThrow(ctx, "p5.addPath(null, m)");
shouldThrow(ctx, "p5.addPath([], m)");
shouldThrow(ctx, "p5.addPath({}, m)");
}
</script>
<script>
function runTests() {
try {
test_drawClipPath_canvas();
} catch(e) {
throw e;
ok(false, "unexpected exception thrown in: test_drawClipPath_canvas");
throw e;
}
try {
test_drawFillPath_canvas();
} catch(e) {
throw e;
ok(false, "unexpected exception thrown in: test_drawFillPath_canvas");
throw e;
}
try {
test_drawStrokePath_canvas();
} catch(e) {
throw e;
ok(false, "unexpected exception thrown in: test_drawStrokePath_canvas");
throw e;
}
try {
test_large_canvas();
} catch(e) {
throw e;
ok(false, "unexpected exception thrown in: test_large_canvas");
throw e;
}
try {
test_isPointInPath_canvas();
} catch(e) {
throw e;
ok(false, "unexpected exception thrown in: test_isPointInPath_canvas");
throw e;
}
try {
test_isPointInStroke_canvas();
} catch(e) {
throw e;
ok(false, "unexpected exception thrown in: test_isPointInStroke_canvas");
throw e;
}
try {
test_pathconstructor_canvas();
} catch(e) {
throw e;
ok(false, "unexpected exception thrown in: test_pathconstructor_canvas");
throw e;
}
try {
test_addpath_canvas();
} catch(e) {
ok(false, "unexpected exception thrown in: test_addpath_canvas");
throw e;
}
SpecialPowers.setBoolPref("canvas.path.enabled", false);
SimpleTest.finish();

View File

@ -1596,8 +1596,8 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
LayoutDeviceIntPoint pt = aEvent->refPoint +
LayoutDeviceIntPoint::FromUntyped(aEvent->widget->WidgetToScreenOffset());
LayoutDeviceIntPoint distance = pt - mGestureDownPoint;
if (Abs(distance.x.value) > SafeCast<uint32_t>(pixelThresholdX) ||
Abs(distance.y.value) > SafeCast<uint32_t>(pixelThresholdY)) {
if (Abs(distance.x.value) > AssertedCast<uint32_t>(pixelThresholdX) ||
Abs(distance.y.value) > AssertedCast<uint32_t>(pixelThresholdY)) {
if (Prefs::ClickHoldContextMenu()) {
// stop the click-hold before we fire off the drag gesture, in case
// it takes a long time

View File

@ -257,6 +257,16 @@ interface CameraControl : MediaStream
[Throws]
void setPictureSize(optional CameraSize size);
/* if the image blob to be returned by takePicture() supports lossy
compression, this setting controls the quality-size trade-off;
valid values range from 0.0 for smallest size/worst quality to 1.0
for largest size/best quality. Note that depending on the range of
values supported by the underlying platform, this attribute may not
'get' the exact value that was previously 'set'. If this setting is
not supported, it is ignored. */
[Throws]
attribute double pictureQuality;
/* the size of the thumbnail to be included in the picture returned
by a call to takePicture(), assuming the chosen fileFormat supports
one; an object with 'height' and 'width' properties that corresponds

View File

@ -323,5 +323,7 @@ interface TextMetrics {
Constructor(Path2D other),
Constructor(DOMString pathString)]
interface Path2D
{};
{
void addPath(Path2D path, optional SVGMatrix transformation);
};
Path2D implements CanvasPathMethods;

View File

@ -1689,14 +1689,15 @@ nsEditor::MoveNode(nsIContent* aNode, nsINode* aParent, int32_t aOffset)
MOZ_ASSERT(aNode);
MOZ_ASSERT(aParent);
MOZ_ASSERT(aOffset == -1 ||
(0 <= aOffset && SafeCast<uint32_t>(aOffset) <= aParent->Length()));
(0 <= aOffset &&
AssertedCast<uint32_t>(aOffset) <= aParent->Length()));
nsCOMPtr<nsINode> oldParent = aNode->GetParentNode();
int32_t oldOffset = oldParent ? oldParent->IndexOf(aNode) : -1;
if (aOffset == -1) {
// Magic value meaning "move to end of aParent"
aOffset = SafeCast<int32_t>(aParent->Length());
aOffset = AssertedCast<int32_t>(aParent->Length());
}
// Don't do anything if it's already in right place
@ -2870,7 +2871,7 @@ nsEditor::JoinNodesImpl(nsINode* aNodeToKeep,
if (GetShouldTxnSetSelection()) {
// editor wants us to set selection at join point
selection->Collapse(aNodeToKeep, SafeCast<int32_t>(firstNodeLength));
selection->Collapse(aNodeToKeep, AssertedCast<int32_t>(firstNodeLength));
} else if (selStartNode) {
// and adjust the selection if needed
// HACK: this is overly simplified - multi-range selections need more work than this

View File

@ -1358,13 +1358,15 @@ nsWSRunObject::DeleteChars(nsINode* aStartNode, int32_t aStartOffset,
if (node == aStartNode) {
uint32_t len = node->Length();
if (uint32_t(aStartOffset) < len) {
res = mHTMLEditor->DeleteText(*node, SafeCast<uint32_t>(aStartOffset),
res = mHTMLEditor->DeleteText(*node,
AssertedCast<uint32_t>(aStartOffset),
len - aStartOffset);
NS_ENSURE_SUCCESS(res, res);
}
} else if (node == aEndNode) {
if (aEndOffset) {
res = mHTMLEditor->DeleteText(*node, 0, SafeCast<uint32_t>(aEndOffset));
res = mHTMLEditor->DeleteText(*node, 0,
AssertedCast<uint32_t>(aEndOffset));
NS_ENSURE_SUCCESS(res, res);
}
break;

View File

@ -7,7 +7,7 @@
#ifndef mozHunspellAllocator_h__
#define mozHunspellAllocator_h__
#include "nsIMemoryReporter.h"
#include "mozilla/CountingAllocatorBase.h"
class HunspellAllocator : public mozilla::CountingAllocatorBase<HunspellAllocator>
{

View File

@ -19,41 +19,6 @@
namespace mozilla {
namespace gfx {
static inline SkBitmap::Config
GfxFormatToSkiaConfig(SurfaceFormat format)
{
switch (format)
{
case SurfaceFormat::B8G8R8A8:
return SkBitmap::kARGB_8888_Config;
case SurfaceFormat::B8G8R8X8:
// We probably need to do something here.
return SkBitmap::kARGB_8888_Config;
case SurfaceFormat::R5G6B5:
return SkBitmap::kRGB_565_Config;
case SurfaceFormat::A8:
return SkBitmap::kA8_Config;
default:
return SkBitmap::kARGB_8888_Config;
}
}
static inline SurfaceFormat
SkiaConfigToGfxFormat(SkBitmap::Config config)
{
switch (config)
{
case SkBitmap::kARGB_8888_Config:
return SurfaceFormat::B8G8R8A8;
case SkBitmap::kRGB_565_Config:
return SurfaceFormat::R5G6B5;
case SkBitmap::kA8_Config:
return SurfaceFormat::A8;
default:
return SurfaceFormat::B8G8R8A8;
}
}
static inline SkColorType
GfxFormatToSkiaColorType(SurfaceFormat format)
{

View File

@ -22,6 +22,7 @@
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
#include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget
#include "mozilla/layers/AsyncPanZoomController.h" // for AsyncPanZoomController
#include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsDebug.h" // for NS_ASSERTION
@ -86,16 +87,6 @@ GetOpaqueRect(Layer* aLayer)
return result;
}
static gfx::Point GetScrollData(Layer* aLayer) {
gfx::Matrix matrix;
if (aLayer->GetLocalTransform().Is2D(&matrix)) {
return matrix.GetTranslation();
}
gfx::Point origin;
return origin;
}
static void DrawLayerInfo(const RenderTargetIntRect& aClipRect,
LayerManagerComposite* aManager,
Layer* aLayer)
@ -119,7 +110,6 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect,
aManager->GetTextRenderer()->RenderText(ss.str().c_str(), gfx::IntPoint(topLeft.x, topLeft.y),
aLayer->GetEffectiveTransform(), 16,
maxWidth);
}
static void PrintUniformityInfo(Layer* aLayer)
@ -135,12 +125,16 @@ static void PrintUniformityInfo(Layer* aLayer)
return;
}
const LayerPoint scrollOffset = frameMetrics.GetScrollOffsetInLayerPixels();
const gfx::Point layerTransform = GetScrollData(aLayer);
const gfx::Point layerScroll = scrollOffset.ToUnknownPoint() - layerTransform;
printf_stderr("UniformityInfo Layer_Move %llu %p %f, %f\n",
TimeStamp::Now(), aLayer, layerScroll.x, layerScroll.y);
AsyncPanZoomController* apzc = aLayer->GetAsyncPanZoomController();
if (apzc) {
ViewTransform asyncTransform, overscrollTransform;
ScreenPoint scrollOffset;
apzc->SampleContentTransformForFrame(&asyncTransform,
scrollOffset,
&overscrollTransform);
printf_stderr("UniformityInfo Layer_Move %llu %p %f, %f\n",
TimeStamp::Now(), aLayer, scrollOffset.x.value, scrollOffset.y.value);
}
}
/* all of the per-layer prepared data we need to maintain */

View File

@ -411,8 +411,14 @@ LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
}
RefPtr<CompositingRenderTarget>
LayerManagerComposite::PushGroup()
LayerManagerComposite::PushGroupForLayerEffects()
{
// This is currently true, so just making sure that any new use of this
// method is flagged for investigation
MOZ_ASSERT(gfxPrefs::LayersEffectInvert() ||
gfxPrefs::LayersEffectGrayscale() ||
gfxPrefs::LayersEffectContrast() != 0.0);
RefPtr<CompositingRenderTarget> previousTarget = mCompositor->GetCurrentRenderTarget();
// make our render target the same size as the destination target
// so that we don't have to change size if the drawing area changes.
@ -427,35 +433,65 @@ LayerManagerComposite::PushGroup()
mCompositor->SetRenderTarget(mTwoPassTmpTarget);
return previousTarget;
}
void LayerManagerComposite::PopGroup(RefPtr<CompositingRenderTarget> aPreviousTarget, nsIntRect aClipRect)
void
LayerManagerComposite::PopGroupForLayerEffects(RefPtr<CompositingRenderTarget> aPreviousTarget,
nsIntRect aClipRect,
bool aGrayscaleEffect,
bool aInvertEffect,
float aContrastEffect)
{
MOZ_ASSERT(mTwoPassTmpTarget);
// This is currently true, so just making sure that any new use of this
// method is flagged for investigation
MOZ_ASSERT(aInvertEffect || aGrayscaleEffect || aContrastEffect != 0.0);
mCompositor->SetRenderTarget(aPreviousTarget);
EffectChain effectChain(RootLayer());
Matrix5x4 matrix;
if (gfxPrefs::Grayscale()) {
matrix._11 = matrix._12 = matrix._13 = 0.2126f;
matrix._21 = matrix._22 = matrix._23 = 0.7152f;
matrix._31 = matrix._32 = matrix._33 = 0.0722f;
Matrix5x4 effectMatrix;
if (aGrayscaleEffect) {
// R' = G' = B' = luminance
// R' = 0.2126*R + 0.7152*G + 0.0722*B
// G' = 0.2126*R + 0.7152*G + 0.0722*B
// B' = 0.2126*R + 0.7152*G + 0.0722*B
Matrix5x4 grayscaleMatrix(0.2126f, 0.2126f, 0.2126f, 0,
0.7152f, 0.7152f, 0.7152f, 0,
0.0722f, 0.0722f, 0.0722f, 0,
0, 0, 0, 1,
0, 0, 0, 0);
effectMatrix = grayscaleMatrix;
}
if (gfxPrefs::Invert()) {
matrix._11 = -matrix._11;
matrix._12 = -matrix._12;
matrix._13 = -matrix._13;
matrix._21 = -matrix._21;
matrix._22 = -matrix._22;
matrix._23 = -matrix._23;
matrix._31 = -matrix._31;
matrix._32 = -matrix._32;
matrix._33 = -matrix._33;
matrix._51 = 1;
matrix._52 = 1;
matrix._53 = 1;
if (aInvertEffect) {
// R' = 1 - R
// G' = 1 - G
// B' = 1 - B
Matrix5x4 colorInvertMatrix(-1, 0, 0, 0,
0, -1, 0, 0,
0, 0, -1, 0,
0, 0, 0, 1,
1, 1, 1, 0);
effectMatrix = effectMatrix * colorInvertMatrix;
}
if (aContrastEffect != 0.0) {
// Multiplying with:
// R' = (1 + c) * (R - 0.5) + 0.5
// G' = (1 + c) * (G - 0.5) + 0.5
// B' = (1 + c) * (B - 0.5) + 0.5
float cP1 = aContrastEffect + 1;
float hc = 0.5*aContrastEffect;
Matrix5x4 contrastMatrix( cP1, 0, 0, 0,
0, cP1, 0, 0,
0, 0, cP1, 0,
0, 0, 0, 1,
-hc, -hc, -hc, 0);
effectMatrix = effectMatrix * contrastMatrix;
}
effectChain.mPrimaryEffect = new EffectRenderTarget(mTwoPassTmpTarget);
effectChain.mSecondaryEffects[EffectTypes::COLOR_MATRIX] = new EffectColorMatrix(matrix);
effectChain.mSecondaryEffects[EffectTypes::COLOR_MATRIX] = new EffectColorMatrix(effectMatrix);
gfx::Rect clipRectF(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
mCompositor->DrawQuad(Rect(Point(0, 0), Size(mTwoPassTmpTarget->GetSize())), clipRectF, effectChain, 1.,
@ -473,8 +509,15 @@ LayerManagerComposite::Render()
return;
}
/** Our more efficient but less powerful alter ego, if one is available. */
nsRefPtr<Composer2D> composer2D = mCompositor->GetWidget()->GetComposer2D();
// At this time, it doesn't really matter if these preferences change
// during the execution of the function; we should be safe in all
// permutations. However, may as well just get the values onces and
// then use them, just in case the consistency becomes important in
// the future.
bool invertVal = gfxPrefs::LayersEffectInvert();
bool grayscaleVal = gfxPrefs::LayersEffectGrayscale();
float contrastVal = gfxPrefs::LayersEffectContrast();
bool haveLayerEffects = (invertVal || grayscaleVal || contrastVal != 0.0);
// Set LayerScope begin/end frame
LayerScopeAutoFrame frame(PR_Now());
@ -494,8 +537,13 @@ LayerManagerComposite::Render()
LayerScope::SendLayerDump(Move(packet));
}
if (gfxPrefs::Invert() || gfxPrefs::Grayscale()) {
composer2D = nullptr;
/** Our more efficient but less powerful alter ego, if one is available. */
nsRefPtr<Composer2D> composer2D;
// We can't use composert2D if we have layer effects, so only get it
// when we don't have any effects.
if (!haveLayerEffects) {
composer2D = mCompositor->GetWidget()->GetComposer2D();
}
if (!mTarget && composer2D && composer2D->TryRender(mRoot, mWorldMatrix, mGeometryChanged)) {
@ -558,8 +606,8 @@ LayerManagerComposite::Render()
actualBounds.height));
RefPtr<CompositingRenderTarget> previousTarget;
if (gfxPrefs::Invert() || gfxPrefs::Grayscale()) {
previousTarget = PushGroup();
if (haveLayerEffects) {
previousTarget = PushGroupForLayerEffects();
} else {
mTwoPassTmpTarget = nullptr;
}
@ -577,7 +625,9 @@ LayerManagerComposite::Render()
}
if (mTwoPassTmpTarget) {
PopGroup(previousTarget, clipRect);
MOZ_ASSERT(haveLayerEffects);
PopGroupForLayerEffects(previousTarget, clipRect,
grayscaleVal, invertVal, contrastVal);
}
// Allow widget to render a custom foreground.

View File

@ -269,8 +269,12 @@ private:
void WorldTransformRect(nsIntRect& aRect);
RefPtr<CompositingRenderTarget> PushGroup();
void PopGroup(RefPtr<CompositingRenderTarget> aPreviousTarget, nsIntRect aClipRect);
RefPtr<CompositingRenderTarget> PushGroupForLayerEffects();
void PopGroupForLayerEffects(RefPtr<CompositingRenderTarget> aPreviousTarget,
nsIntRect aClipRect,
bool aGrayscaleEffect,
bool aInvertEffect,
float aContrastEffect);
RefPtr<Compositor> mCompositor;
nsAutoPtr<LayerProperties> mClonedLayerTreeProperties;

View File

@ -206,7 +206,6 @@
#define SK_SUPPORT_LEGACY_GETDEVICE
#define SK_SUPPORT_LEGACY_GETTOPDEVICE
#define SK_SUPPORT_LEGACY_BITMAP_CONFIG
#define SK_IGNORE_ETC1_SUPPORT
#endif

View File

@ -8,6 +8,7 @@
#include "gfxAndroidPlatform.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/CountingAllocatorBase.h"
#include "mozilla/Preferences.h"
#include "gfx2DGlue.h"

View File

@ -222,6 +222,13 @@ private:
DECL_GFX_PREF(Live, "layers.flash-borders", FlashLayerBorders, bool, false);
DECL_GFX_PREF(Live, "layers.draw-layer-info", DrawLayerInfo, bool, false);
DECL_GFX_PREF(Live, "layers.dump", LayersDump, bool, false);
// 0 is "no change" for contrast, positive values increase it, negative values
// decrease it until we hit mid gray at -1 contrast, after that it gets weird.
DECL_GFX_PREF(Live, "layers.effect.contrast", LayersEffectContrast, float, 0.0f);
DECL_GFX_PREF(Live, "layers.effect.grayscale", LayersEffectGrayscale, bool, false);
DECL_GFX_PREF(Live, "layers.effect.invert", LayersEffectInvert, bool, false);
DECL_GFX_PREF(Once, "layers.enable-tiles", LayersTilesEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.simple-tiles", LayersUseSimpleTiles, bool, false);
DECL_GFX_PREF(Once, "layers.force-per-tile-drawing", PerTileDrawing, bool, false);
@ -249,8 +256,6 @@ private:
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);
DECL_GFX_PREF(Once, "layers.progressive-paint", UseProgressiveTilePainting, bool, false);
DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false);
DECL_GFX_PREF(Live, "layers.invert", Invert, bool, false);
DECL_GFX_PREF(Live, "layers.grayscale", Grayscale, bool, false);
DECL_GFX_PREF(Live, "layout.css.scroll-behavior.damping-ratio", ScrollBehaviorDampingRatio, float, 1.0f);
DECL_GFX_PREF(Live, "layout.css.scroll-behavior.enabled", ScrollBehaviorEnabled, bool, false);

View File

@ -5965,9 +5965,11 @@ GenerateEntry(ModuleCompiler &m, unsigned exportIndex)
JS_ASSERT(masm.framePushed() == FramePushedAfterSave);
// ARM and MIPS have a globally-pinned GlobalReg (x64 uses RIP-relative
// addressing, x86 uses immediates in effective addresses).
// addressing, x86 uses immediates in effective addresses). For the
// AsmJSGlobalRegBias addition, see Assembler-(mips,arm).h.
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
masm.movePtr(IntArgReg1, GlobalReg);
masm.addPtr(Imm32(AsmJSGlobalRegBias), GlobalReg);
#endif
// ARM, MIPS and x64 have a globally-pinned HeapReg (x86 uses immediates in
@ -6254,7 +6256,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
#elif defined(JS_CODEGEN_X86)
m.masm().append(AsmJSGlobalAccess(masm.movlWithPatch(Imm32(0), callee), globalDataOffset));
#else
masm.computeEffectiveAddress(Address(GlobalReg, globalDataOffset), callee);
masm.computeEffectiveAddress(Address(GlobalReg, globalDataOffset - AsmJSGlobalRegBias), callee);
#endif
// 2.2. Get callee

View File

@ -27,9 +27,9 @@
#include "vm/Shape-inl.h"
using mozilla::AssertedCast;
using mozilla::CheckedInt32;
using mozilla::DebugOnly;
using mozilla::SafeCast;
using namespace js;
@ -1162,7 +1162,7 @@ StructTypeDescr::fieldOffset(size_t index) const
JSObject &fieldOffsets =
getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS).toObject();
JS_ASSERT(index < fieldOffsets.getDenseInitializedLength());
return SafeCast<size_t>(fieldOffsets.getDenseElement(index).toInt32());
return AssertedCast<size_t>(fieldOffsets.getDenseElement(index).toInt32());
}
size_t
@ -1171,7 +1171,7 @@ StructTypeDescr::maybeForwardedFieldOffset(size_t index) const
JSObject &fieldOffsets =
*MaybeForwarded(&getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS).toObject());
JS_ASSERT(index < fieldOffsets.getDenseInitializedLength());
return SafeCast<size_t>(fieldOffsets.getDenseElement(index).toInt32());
return AssertedCast<size_t>(fieldOffsets.getDenseElement(index).toInt32());
}
SizedTypeDescr&

View File

@ -145,6 +145,9 @@ jit::InitializeIon()
if (!TlsIonContext.initialized() && !TlsIonContext.init())
return false;
CheckLogging();
#if defined(JS_CODEGEN_ARM)
InitARMFlags();
#endif
CheckPerf();
return true;
}

View File

@ -33,9 +33,9 @@
using namespace js;
using namespace js::jit;
using mozilla::AssertedCast;
using mozilla::DebugOnly;
using mozilla::Maybe;
using mozilla::SafeCast;
class jit::BaselineFrameInspector
{
@ -7552,7 +7552,7 @@ IonBuilder::addTypedArrayLengthAndData(MDefinition *obj,
obj->setImplicitlyUsedUnchecked();
int32_t len = SafeCast<int32_t>(tarr->length());
int32_t len = AssertedCast<int32_t>(tarr->length());
*length = MConstant::New(alloc(), Int32Value(len));
current->add(*length);

View File

@ -16,8 +16,8 @@
#include "jit/arm/Assembler-arm.h"
#include "jit/RegisterSets.h"
#if defined(ANDROID) || defined(MOZ_B2G) || defined(JS_ARM_SIMULATOR)
// The Android NDK does not include the hwcap.h kernel header, and it is not
#if defined(ANDROID) || defined(JS_ARM_SIMULATOR)
// The Android NDK and B2G do not include the hwcap.h kernel header, and it is not
// defined when building the simulator, so inline the header defines we need.
# define HWCAP_VFP (1 << 6)
# define HWCAP_NEON (1 << 12)
@ -38,20 +38,27 @@
# endif
#endif
// Not part of the HWCAP flag, but we need to know this, and this bit is not
// used so we are using it.
// Not part of the HWCAP flag, but we need to know these and these bits are not used.
// A bit to flag the use of the ARMv7 arch, otherwise ARMv6.
#define HWCAP_ARMv7 (1 << 28)
// Also take a bit to flag the use of the hardfp ABI.
// A bit to flag the use of the hardfp ABI.
#define HWCAP_USE_HARDFP_ABI (1 << 27)
// A bit to flag when alignment faults are enabled and signal.
#define HWCAP_ALIGNMENT_FAULT (1 << 26)
// A bit to flag when the flags are uninitialized, so they can be atomically set.
#define HWCAP_UNINITIALIZED (1 << 25)
namespace js {
namespace jit {
// Parse the Linux kernel cpuinfo features. This is also used to parse the
// override features which has some extensions: 'armv7' and 'hardfp'.
uint32_t
// override features which has some extensions: 'armv7', 'align' and 'hardfp'.
static uint32_t
ParseARMCpuFeatures(const char *features, bool override = false)
{
uint32_t flags = 0;
@ -93,6 +100,8 @@ ParseARMCpuFeatures(const char *features, bool override = false)
flags |= HWCAP_VFPD32;
else if (count == 5 && strncmp(features, "armv7", 5) == 0)
flags |= HWCAP_ARMv7;
else if (count == 5 && strncmp(features, "align", 5) == 0)
flags |= HWCAP_ALIGNMENT_FAULT;
#if defined(JS_ARM_SIMULATOR)
else if (count == 6 && strncmp(features, "hardfp", 6) == 0)
flags |= HWCAP_USE_HARDFP_ABI;
@ -101,33 +110,54 @@ ParseARMCpuFeatures(const char *features, bool override = false)
fprintf(stderr, "Warning: unexpected ARM feature at: %s\n", features);
features = end;
}
IonSpew(IonSpew_Codegen, "ARM features: '%s'\n flags: 0x%x\n", features, flags);
return flags;
}
static uint32_t
CanonicalizeARMHwCapFlags(uint32_t flags)
{
// Canonicalize the flags. These rules are also applied to the features
// supplied for simulation.
// The VFPv3 feature is expected when the VFPv3D16 is reported, but add it
// just in case of a kernel difference in feature reporting.
if (flags & HWCAP_VFPv3D16)
flags |= HWCAP_VFPv3;
// If VFPv3 or Neon is supported then this must be an ARMv7.
if (flags & (HWCAP_VFPv3 | HWCAP_NEON))
flags |= HWCAP_ARMv7;
// Some old kernels report VFP and not VFPv3, but if ARMv7 then it must be
// VFPv3.
if (flags & HWCAP_VFP && flags & HWCAP_ARMv7)
flags |= HWCAP_VFPv3;
// Older kernels do not implement the HWCAP_VFPD32 flag.
if ((flags & HWCAP_VFPv3) && !(flags & HWCAP_VFPv3D16))
flags |= HWCAP_VFPD32;
return flags;
}
// The override flags parsed from the ARMHWCAP environment variable or from the
// --arm-hwcap js shell argument.
volatile static uint32_t armHwCapFlags = 0;
volatile static uint32_t armHwCapFlags = HWCAP_UNINITIALIZED;
bool
ParseARMHwCapFlags(const char *armHwCap)
{
uint32_t flags = 0;
if (!armHwCap || !armHwCap[0])
if (!armHwCap)
return false;
#ifdef JS_CODEGEN_ARM_HARDFP
flags |= HWCAP_USE_HARDFP_ABI;
#endif
if (strstr(armHwCap, "help")) {
fflush(NULL);
printf(
"\n"
"usage: ARMHWCAP=option,option,option,... where options can be:\n"
"\n"
" armv7 \n"
" vfp \n"
" neon \n"
" vfpv3 \n"
@ -136,6 +166,8 @@ ParseARMHwCapFlags(const char *armHwCap)
" idiva \n"
" idivt \n"
" vfpd32 \n"
" armv7 \n"
" align \n"
#if defined(JS_ARM_SIMULATOR)
" hardfp \n"
#endif
@ -145,29 +177,35 @@ ParseARMHwCapFlags(const char *armHwCap)
/*NOTREACHED*/
}
armHwCapFlags = ParseARMCpuFeatures(armHwCap, /* override = */ true);
flags = ParseARMCpuFeatures(armHwCap, /* override = */ true);
#ifdef JS_CODEGEN_ARM_HARDFP
flags |= HWCAP_USE_HARDFP_ABI;
#endif
armHwCapFlags = CanonicalizeARMHwCapFlags(flags);
IonSpew(IonSpew_Codegen, "ARM HWCAP: 0x%x\n", armHwCapFlags);
return true;
}
uint32_t GetARMFlags()
void
InitARMFlags()
{
volatile static bool isSet = false;
volatile static uint32_t flags = 0;
if (isSet)
return flags;
uint32_t flags = 0;
if (armHwCapFlags != HWCAP_UNINITIALIZED)
return;
const char *env = getenv("ARMHWCAP");
if (ParseARMHwCapFlags(env) || armHwCapFlags) {
flags = armHwCapFlags;
isSet = true;
return flags;
}
if (ParseARMHwCapFlags(env))
return;
#ifdef JS_ARM_SIMULATOR
flags = HWCAP_ARMv7 | HWCAP_VFP | HWCAP_VFPv3 | HWCAP_VFPv4 | HWCAP_NEON;
#else
#if defined(__linux__) || defined(ANDROID) || defined(MOZ_B2G)
#if defined(__linux__)
// This includes Android and B2G.
bool readAuxv = false;
int fd = open("/proc/self/auxv", O_RDONLY);
if (fd > 0) {
@ -183,7 +221,7 @@ uint32_t GetARMFlags()
}
if (!readAuxv) {
// Read the Features if the auxv is not available.
// Read the cpuinfo Features if the auxv is not available.
FILE *fp = fopen("/proc/cpuinfo", "r");
if (fp) {
char buf[1024];
@ -223,60 +261,63 @@ uint32_t GetARMFlags()
#endif // JS_ARM_SIMULATOR
// Canonicalize the flags. These rules are also applied to the features
// supplied for simulation.
armHwCapFlags = CanonicalizeARMHwCapFlags(flags);
// The VFPv3 feature is expected when the VFPv3D16 is reported, but add it
// just in case of a kernel difference in feature reporting.
if (flags & HWCAP_VFPv3D16)
flags |= HWCAP_VFPv3;
IonSpew(IonSpew_Codegen, "ARM HWCAP: 0x%x\n", armHwCapFlags);
return;
}
// If VFPv3 or Neon is supported then this must be an ARMv7.
if (flags & (HWCAP_VFPv3 | HWCAP_NEON))
flags |= HWCAP_ARMv7;
// Some old kernels report VFP and not VFPv3, but if ARMv7 then it must be
// VFPv3.
if (flags & HWCAP_VFP && flags & HWCAP_ARMv7)
flags |= HWCAP_VFPv3;
// Older kernels do not implement the HWCAP_VFPD32 flag.
if ((flags & HWCAP_VFPv3) && !(flags & HWCAP_VFPv3D16))
flags |= HWCAP_VFPD32;
IonSpew(IonSpew_Codegen, "ARM HWCAP: 0x%x\n", flags);
isSet = true;
return flags;
uint32_t
GetARMFlags()
{
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
return armHwCapFlags;
}
bool HasMOVWT()
{
return GetARMFlags() & HWCAP_ARMv7;
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
return armHwCapFlags & HWCAP_ARMv7;
}
bool HasVFPv3()
{
return GetARMFlags() & HWCAP_VFPv3;
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
return armHwCapFlags & HWCAP_VFPv3;
}
bool HasVFP()
{
return GetARMFlags() & HWCAP_VFP;
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
return armHwCapFlags & HWCAP_VFP;
}
bool Has32DP()
{
return GetARMFlags() & HWCAP_VFPD32;
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
return armHwCapFlags & HWCAP_VFPD32;
}
bool HasIDIV()
{
return GetARMFlags() & HWCAP_IDIVA;
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
return armHwCapFlags & HWCAP_IDIVA;
}
// Returns true when cpu alignment faults are enabled and signaled, and thus we
// should ensure loads and stores are aligned.
bool HasAlignmentFault()
{
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
return armHwCapFlags & HWCAP_ALIGNMENT_FAULT;
}
// This is defined in the header and inlined when not using the simulator.
#if defined(JS_ARM_SIMULATOR)
bool UseHardFpABI()
{
return GetARMFlags() & HWCAP_USE_HARDFP_ABI;
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
return armHwCapFlags & HWCAP_USE_HARDFP_ABI;
}
#endif

View File

@ -14,8 +14,8 @@
#include "js/Utility.h"
// Gcc appears to use __ARM_PCS_VFP to denote that the target is a hard-float
// target.
// GCC versions 4.6 and above define __ARM_PCS_VFP to denote a hard-float
// ABI target.
#if defined(__ARM_PCS_VFP)
#define JS_CODEGEN_ARM_HARDFP
#endif
@ -519,6 +519,7 @@ bool HasVFPv3();
bool HasVFP();
bool Has32DP();
bool HasIDIV();
bool HasAlignmentFault();
// Arm/D32 has double registers that can NOT be treated as float32 and this
// requires some dances in lowering.
@ -537,6 +538,8 @@ hasMultiAlias()
}
bool ParseARMHwCapFlags(const char *armHwCap);
void InitARMFlags();
uint32_t GetARMFlags();
// If the simulator is used then the ABI choice is dynamic. Otherwise the ABI is
// static and useHardFpABI is inlined so that unused branches can be optimized

View File

@ -102,6 +102,11 @@ static MOZ_CONSTEXPR_VAR FloatRegister ScratchSimdReg = InvalidFloatReg;
static MOZ_CONSTEXPR_VAR FloatRegister ScratchUIntReg = { FloatRegisters::d15, VFPRegister::UInt };
static MOZ_CONSTEXPR_VAR FloatRegister ScratchIntReg = { FloatRegisters::d15, VFPRegister::Int };
// A bias applied to the GlobalReg to allow the use of instructions with small
// negative immediate offsets which doubles the range of global data that can be
// accessed with a single instruction.
static const int32_t AsmJSGlobalRegBias = 1024;
// Registers used in the GenerateFFIIonExit Enable Activation block.
static MOZ_CONSTEXPR_VAR Register AsmJSIonExitRegCallee = r4;
static MOZ_CONSTEXPR_VAR Register AsmJSIonExitRegE0 = r0;

View File

@ -1763,17 +1763,6 @@ DispatchIonCache::initializeAddCacheState(LInstruction *ins, AddCacheState *addS
addState->dispatchScratch = ScratchRegister;
}
template <class U>
Register
getBase(U *mir)
{
switch (mir->base()) {
case U::Heap: return HeapReg;
case U::Global: return GlobalReg;
}
return InvalidReg;
}
bool
CodeGeneratorARM::visitLoadTypedArrayElementStatic(LLoadTypedArrayElementStatic *ins)
{
@ -1845,10 +1834,12 @@ CodeGeneratorARM::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
FloatRegister dst = ToFloatRegister(ins->output());
VFPRegister vd(dst);
if (size == 32) {
masm.ma_vldr(Operand(GlobalReg, AsmJSNaN32GlobalDataOffset), vd.singleOverlay(), Assembler::AboveOrEqual);
masm.ma_vldr(Operand(GlobalReg, AsmJSNaN32GlobalDataOffset - AsmJSGlobalRegBias),
vd.singleOverlay(), Assembler::AboveOrEqual);
masm.ma_vldr(vd.singleOverlay(), HeapReg, ptrReg, 0, Assembler::Below);
} else {
masm.ma_vldr(Operand(GlobalReg, AsmJSNaN64GlobalDataOffset), vd, Assembler::AboveOrEqual);
masm.ma_vldr(Operand(GlobalReg, AsmJSNaN64GlobalDataOffset - AsmJSGlobalRegBias),
vd, Assembler::AboveOrEqual);
masm.ma_vldr(vd, HeapReg, ptrReg, 0, Assembler::Below);
}
} else {
@ -2068,7 +2059,7 @@ bool
CodeGeneratorARM::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar *ins)
{
const MAsmJSLoadGlobalVar *mir = ins->mir();
unsigned addr = mir->globalDataOffset();
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;
if (mir->type() == MIRType_Int32) {
masm.ma_dtr(IsLoad, GlobalReg, Imm32(addr), ToRegister(ins->output()));
} else if (mir->type() == MIRType_Float32) {
@ -2087,7 +2078,7 @@ CodeGeneratorARM::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins)
MIRType type = mir->value()->type();
JS_ASSERT(IsNumberType(type));
unsigned addr = mir->globalDataOffset();
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;
if (mir->value()->type() == MIRType_Int32) {
masm.ma_dtr(IsStore, GlobalReg, Imm32(addr), ToRegister(ins->value()));
} else if (mir->value()->type() == MIRType_Float32) {
@ -2108,7 +2099,7 @@ CodeGeneratorARM::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr *ins)
Register tmp = ToRegister(ins->temp());
Register out = ToRegister(ins->output());
unsigned addr = mir->globalDataOffset();
masm.ma_mov(Imm32(addr), tmp);
masm.ma_mov(Imm32(addr - AsmJSGlobalRegBias), tmp);
masm.as_add(tmp, tmp, lsl(index, 2));
masm.ma_ldr(DTRAddr(GlobalReg, DtrRegImmShift(tmp, LSL, 0)), out);
@ -2120,7 +2111,8 @@ CodeGeneratorARM::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc *ins)
{
const MAsmJSLoadFFIFunc *mir = ins->mir();
masm.ma_ldr(Operand(GlobalReg, mir->globalDataOffset()), ToRegister(ins->output()));
masm.ma_ldr(Operand(GlobalReg, mir->globalDataOffset() - AsmJSGlobalRegBias),
ToRegister(ins->output()));
return true;
}

View File

@ -1627,7 +1627,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
#endif
void loadAsmJSActivation(Register dest) {
loadPtr(Address(GlobalReg, AsmJSActivationGlobalDataOffset), dest);
loadPtr(Address(GlobalReg, AsmJSActivationGlobalDataOffset - AsmJSGlobalRegBias), dest);
}
};

View File

@ -1657,7 +1657,7 @@ Get ## Type ## ArrayLengthAndData(JSObject *obj, uint32_t *length, type **data)
{ \
JS_ASSERT(GetObjectClass(obj) == detail::Type ## ArrayClassPtr); \
const JS::Value &slot = GetReservedSlot(obj, detail::TypedArrayLengthSlot); \
*length = mozilla::SafeCast<uint32_t>(slot.toInt32()); \
*length = mozilla::AssertedCast<uint32_t>(slot.toInt32()); \
*data = static_cast<type*>(GetObjectPrivate(obj)); \
}

View File

@ -58,6 +58,7 @@ using namespace js::unicode;
using JS::Symbol;
using JS::SymbolCode;
using mozilla::AssertedCast;
using mozilla::CheckedInt;
using mozilla::IsNaN;
using mozilla::IsNegativeZero;
@ -66,7 +67,6 @@ using mozilla::Move;
using mozilla::PodCopy;
using mozilla::PodEqual;
using mozilla::RangedPtr;
using mozilla::SafeCast;
using mozilla::UniquePtr;
using JS::AutoCheckCannotGC;
@ -240,7 +240,7 @@ Unescape(StringBuffer &sb, const mozilla::Range<const CharT> chars)
* comparisons without unsigned-underflow hazards.
*/
static_assert(JSString::MAX_LENGTH <= INT_MAX, "String length must fit in a signed integer");
int length = SafeCast<int>(chars.length());
int length = AssertedCast<int>(chars.length());
/*
* Note that the spec algorithm has been optimized to avoid building
@ -1014,7 +1014,7 @@ str_normalize(JSContext *cx, unsigned argc, Value *vp)
static const size_t INLINE_CAPACITY = 32;
const UChar *srcChars = JSCharToUChar(stableChars.twoByteRange().start().get());
int32_t srcLen = SafeCast<int32_t>(str->length());
int32_t srcLen = AssertedCast<int32_t>(str->length());
Vector<jschar, INLINE_CAPACITY> chars(cx);
if (!chars.resize(INLINE_CAPACITY))
return false;

View File

@ -52,7 +52,7 @@ ToUintWidth(double d)
if (exp < 0)
return 0;
uint_fast16_t exponent = mozilla::SafeCast<uint_fast16_t>(exp);
uint_fast16_t exponent = mozilla::AssertedCast<uint_fast16_t>(exp);
// If the exponent is greater than or equal to the bits of precision of a
// double plus ResultType's width, the number is either infinite, NaN, or

View File

@ -2769,7 +2769,9 @@ JSReporter::CollectReports(WindowPaths *windowPaths,
return NS_ERROR_FAILURE;
}
size_t xpconnect = xpcrt->SizeOfIncludingThis(JSMallocSizeOf);
size_t xpcJSRuntimeSize = xpcrt->SizeOfIncludingThis(JSMallocSizeOf);
size_t wrappedJSSize = xpcrt->GetWrappedJSMap()->SizeOfWrappedJS(JSMallocSizeOf);
XPCWrappedNativeScope::ScopeSizeInfo sizeInfo(JSMallocSizeOf);
XPCWrappedNativeScope::AddSizeOfAllScopesIncludingThis(&sizeInfo);
@ -2849,9 +2851,13 @@ JSReporter::CollectReports(WindowPaths *windowPaths,
// Report xpconnect.
REPORT_BYTES(NS_LITERAL_CSTRING("explicit/xpconnect/runtime"),
KIND_HEAP, xpconnect,
KIND_HEAP, xpcJSRuntimeSize,
"The XPConnect runtime.");
REPORT_BYTES(NS_LITERAL_CSTRING("explicit/xpconnect/wrappedjs"),
KIND_HEAP, wrappedJSSize,
"Wrappers used to implement XPIDL interfaces with JS.");
REPORT_BYTES(NS_LITERAL_CSTRING("explicit/xpconnect/scopes"),
KIND_HEAP, sizeInfo.mScopeAndMapSize,
"XPConnect scopes.");

View File

@ -111,6 +111,23 @@ JSObject2WrappedJSMap::ShutdownMarker()
}
}
size_t
JSObject2WrappedJSMap::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{
size_t n = mallocSizeOf(this);
n += mTable.sizeOfExcludingThis(mallocSizeOf);
return n;
}
size_t
JSObject2WrappedJSMap::SizeOfWrappedJS(mozilla::MallocSizeOf mallocSizeOf) const
{
size_t n = 0;
for (Map::Range r = mTable.all(); !r.empty(); r.popFront())
n += r.front().value()->SizeOfIncludingThis(mallocSizeOf);
return n;
}
/***************************************************************************/
// implement Native2WrappedNativeMap...

View File

@ -72,11 +72,11 @@ public:
void ShutdownMarker();
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) {
size_t n = mallocSizeOf(this);
n += mTable.sizeOfExcludingThis(mallocSizeOf);
return n;
}
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
// Report the sum of SizeOfIncludingThis() for all wrapped JS in the map.
// Each wrapped JS is only in one map.
size_t SizeOfWrappedJS(mozilla::MallocSizeOf mallocSizeOf) const;
private:
JSObject2WrappedJSMap() {}

View File

@ -552,6 +552,25 @@ nsXPCWrappedJS::SystemIsBeingShutDown()
mNext->SystemIsBeingShutDown();
}
size_t
nsXPCWrappedJS::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{
// mJSObject is a JS pointer, so don't measure the object.
// mClass is not uniquely owned by this WrappedJS. Measure it in IID2WrappedJSClassMap.
// mRoot is not measured because it is either |this| or we have already measured it.
// mOuter is rare and probably not uniquely owned by this.
size_t n = mallocSizeOf(this);
n += nsAutoXPTCStub::SizeOfExcludingThis(mallocSizeOf);
// Wrappers form a linked list via the mNext field, so include them all
// in the measurement. Only root wrappers are stored in the map, so
// everything will be measured exactly once.
if (mNext)
n += mNext->SizeOfIncludingThis(mallocSizeOf);
return n;
}
/***************************************************************************/
/* readonly attribute nsISimpleEnumerator enumerator; */

View File

@ -2489,6 +2489,8 @@ public:
void TraceJS(JSTracer* trc);
static void GetTraceName(JSTracer* trc, char *buf, size_t bufsize);
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
virtual ~nsXPCWrappedJS();
protected:
nsXPCWrappedJS(); // not implemented

View File

@ -295,7 +295,17 @@ struct ScreenPixel {
}
};
// Operators to apply ScaleFactors directly to Points, Rects, Sizes and Margins
// Operators to apply ScaleFactors directly to Coords, Points, Rects, Sizes and Margins
template<class src, class dst>
gfx::CoordTyped<dst> operator*(gfx::CoordTyped<src>& aCoord, const gfx::ScaleFactor<src, dst>& aScale) {
return gfx::CoordTyped<dst>(aCoord.value * aScale.scale);
}
template<class src, class dst>
gfx::CoordTyped<dst> operator/(gfx::CoordTyped<src>& aCoord, const gfx::ScaleFactor<src, dst>& aScale) {
return gfx::CoordTyped<dst>(aCoord.value / aScale.scale);
}
template<class src, class dst>
gfx::PointTyped<dst> operator*(const gfx::PointTyped<src>& aPoint, const gfx::ScaleFactor<src, dst>& aScale) {

View File

@ -1078,7 +1078,7 @@ nsListControlFrame::GetCurrentOption()
GetSelectedIndex() : mEndSelectionIndex;
if (focusedIndex != kNothingSelected) {
return GetOption(SafeCast<uint32_t>(focusedIndex));
return GetOption(AssertedCast<uint32_t>(focusedIndex));
}
// There is no selected item. Return the first non-disabled item.
@ -1906,7 +1906,7 @@ nsListControlFrame::ScrollToIndex(int32_t aIndex)
ScrollTo(nsPoint(0, 0), nsIScrollableFrame::INSTANT);
} else {
nsRefPtr<dom::HTMLOptionElement> option =
GetOption(SafeCast<uint32_t>(aIndex));
GetOption(AssertedCast<uint32_t>(aIndex));
if (option) {
ScrollToFrame(*option);
}

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Darken an HTML Element Using the Brightness Function</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(0, 64, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a dark green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Darken an HTML Element Using the Brightness Function</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-brightness">
<link rel="match" href="brightness-darken-ref.html">
<meta name="assert"
content="Given a factor less than one, the CSS brightness filter
function should darken the color of an HTML element.">
<style type="text/css">
#target {
filter: brightness(0.25);
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a dark green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Brighten an HTML Element Using a Large Factor</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a bright green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Brighten an HTML Element Using a Large Factor</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-brightness">
<link rel="match" href="brightness-extreme-ref.html">
<meta name="assert"
content="Given a large factor, the CSS brightness filter function should
completely change the color of an HTML element.">
<style type="text/css">
#target {
filter: brightness(1000);
background-color: rgb(0, 1, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a bright green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Brighten an HTML Element Using a Factor of One</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(0, 128, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Brighten an HTML Element Using a Factor of One</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-brightness">
<link rel="match" href="brightness-one-ref.html">
<meta name="assert"
content="Given a factor of one, the CSS brightness filter function
should not change the color of an HTML element.">
<style type="text/css">
#target {
filter: brightness(1);
background-color: rgb(0, 128, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Brighten an HTML Element Using a Percentage</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(0, 128, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Brighten an HTML Element Using a Percentage</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-brightness">
<link rel="match" href="brightness-percent-ref.html">
<meta name="assert"
content="Given a percentage, the CSS brightness filter function should
change the color of an HTML element.">
<style type="text/css">
#target {
filter: brightness(400%);
background-color: rgb(0, 32, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Brighten an HTML Element</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(0, 128, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Darken an HTML Element Using the Brightness Function and a Factor of Zero</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: black;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a black square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Darken an HTML Element Using the Brightness Function and a Factor of Zero</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-brightness">
<link rel="match" href="brightness-zero-ref.html">
<meta name="assert"
content="Given a factor of zero, the CSS brightness filter function
should change the color of an HTML element to black.">
<style type="text/css">
#target {
filter: brightness(0);
background-color: #f00;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a black square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Brighten an HTML Element</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-brightness">
<link rel="match" href="brightness-ref.html">
<meta name="assert"
content="The CSS brightness filter function should change the color of
an HTML element.">
<style type="text/css">
#target {
filter: brightness(4);
background-color: rgb(0, 32, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Increase the Contrast of an HTML Element Using a Large Factor</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a bright green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Increase the Contrast of an HTML Element Using a Large Factor</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-contrast">
<link rel="match" href="contrast-extreme-ref.html">
<meta name="assert"
content="Given a large factor, the CSS contrast filter function should
should change color channel values to be much farther from
their middle value.">
<style type="text/css">
#target {
filter: contrast(1000);
background-color: rgb(127, 129, 127); /* 127 should change to 0, and 129 should change to 255. */
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a bright green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Set the Contrast of HTML Element Using a Factor of One</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(0, 128, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Set the Contrast of HTML Element Using a Factor of One</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-contrast">
<link rel="match" href="contrast-one-ref.html">
<meta name="assert"
content="Given a factor of one, the CSS contrast filter function
should not change the color of an HTML element.">
<style type="text/css">
#target {
filter: contrast(1);
background-color: rgb(0, 128, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Increase the Contrast of an HTML Element</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a bright green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Increase the Contrast of an HTML Element</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-contrast">
<link rel="match" href="contrast-percent-ref.html">
<meta name="assert"
content="Given a percentage, the CSS contrast filter function should
change the color of an HTML element.">
<style type="text/css">
#target {
filter: contrast(200%);
background-color: rgb(0, 196, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a bright green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Reduce the Contrast of an HTML Element</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(64, 191, 64);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Reduce the Contrast of an HTML Element</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-contrast">
<link rel="match" href="contrast-reduce-ref.html">
<meta name="assert"
content="Given a factor of less than one, the CSS contrast filter
function should change color channel values to be closer to
their middle value.">
<style type="text/css">
#target {
filter: contrast(0.5);
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Increase the Contrast of an HTML Element</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a bright green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Reduce the Contrast of an HTML Element Using a Factor of Zero</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
filter: contrast(0);
background-color: rgb(128, 128, 128);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a gray square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Reduce the Contrast of an HTML Element Using a Factor of Zero</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-contrast">
<link rel="match" href="contrast-zero-ref.html">
<meta name="assert"
content="Given a factor of zero, the CSS contrast filter function
should change the color of an HTML element to gray.">
<style type="text/css">
#target {
filter: contrast(0);
background-color: rgb(0, 128, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a gray square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Increase the Contrast of an HTML Element</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-contrast">
<link rel="match" href="contrast-ref.html">
<meta name="assert"
content="The CSS contrast filter function should change the color of
an HTML element.">
<style type="text/css">
#target {
filter: contrast(2);
background-color: rgb(0, 196, 0);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a bright green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Invert an HTML Element Using a Factor of One Half</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(127, 127, 127);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a gray square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Invert an HTML Element Using a Factor of One Half</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-invert">
<link rel="match" href="invert-half-ref.html">
<meta name="assert"
content="Given a factor of one half, the CSS invert filter function
should change the color of an HTML element to gray.">
<style type="text/css">
#target {
filter: invert(0.5);
background-color: #f00;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a gray square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Invert an HTML Element Using a Factor of One</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Invert an HTML Element Using a Factor of One</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-invert">
<link rel="match" href="invert-one-ref.html">
<meta name="assert"
content="Given a factor of one, the CSS invert filter function should
completely change the color of an HTML element.">
<style type="text/css">
#target {
filter: invert(1);
background-color: #f0f;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Invert an HTML Element Using a Factor Over One</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More