Merge m-c to b2g-inbound a=merge

This commit is contained in:
Wes Kocher 2014-08-25 17:26:44 -07:00
Родитель 1b9beaee07 79bcafc2c6
Коммит 4088e84b5b
243 изменённых файлов: 4631 добавлений и 2176 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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();
});
},

Просмотреть файл

@ -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);

Просмотреть файл

@ -3,6 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# NB: IF YOU ADD ITEMS TO THIS FILE, PLEASE UPDATE THE WHITELIST IN
# BrowserUITelemetry.jsm. SEE BUG 991757 FOR DETAILS.
<menugroup id="context-navigation">
<menuitem id="context-back"
class="menuitem-iconic"

Просмотреть файл

@ -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);
},

Просмотреть файл

@ -38,6 +38,9 @@ nsContextMenu.prototype = {
// Initialize (disable/remove) menu items.
this.initItems();
// Register this opening of the menu with telemetry:
this._checkTelemetryForMenu(aXulMenu);
},
hiding: function CM_hiding() {
@ -45,6 +48,11 @@ nsContextMenu.prototype = {
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu();
InlineSpellCheckerUI.uninit();
// This handler self-deletes, only run it if it is still there:
if (this._onPopupHiding) {
this._onPopupHiding();
}
},
initItems: function CM_initItems() {
@ -1160,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);
},
@ -1703,5 +1711,76 @@ nsContextMenu.prototype = {
selectedText]);
menuItem.label = menuLabel;
menuItem.accessKey = gNavigatorBundle.getString("contextMenuSearch.accesskey");
}
},
_getTelemetryClickInfo: function(aXulMenu) {
this._onPopupHiding = () => {
aXulMenu.ownerDocument.removeEventListener("command", activationHandler, true);
aXulMenu.removeEventListener("popuphiding", this._onPopupHiding, true);
delete this._onPopupHiding;
let eventKey = [
this._telemetryPageContext,
this._telemetryHadCustomItems ? "withcustom" : "withoutcustom"
];
let target = this._telemetryClickID || "close-without-interaction";
BrowserUITelemetry.registerContextMenuInteraction(eventKey, target);
};
let activationHandler = (e) => {
// Deal with command events being routed to command elements; figure out
// what triggered the event (which will have the right e.target)
if (e.sourceEvent) {
e = e.sourceEvent;
}
// Target should be in the menu (this catches using shortcuts for items
// not in the menu while the menu is up)
if (!aXulMenu.contains(e.target)) {
return;
}
// Check if this is a page menu item:
if (e.target.hasAttribute(PageMenu.GENERATEDITEMID_ATTR)) {
this._telemetryClickID = "custom-page-item";
} else {
this._telemetryClickID = (e.target.id || "unknown").replace(/^context-/i, "");
}
};
aXulMenu.ownerDocument.addEventListener("command", activationHandler, true);
aXulMenu.addEventListener("popuphiding", this._onPopupHiding, true);
},
_getTelemetryPageContextInfo: function() {
if (this.isContentSelected) {
return "selection";
}
if (this.onLink) {
if (this.onImage || this.onCanvas) {
return "image-link";
}
return "link";
}
if (this.onImage) {
return "image"
}
if (this.onCanvas) {
return "canvas";
}
if (this.onVideo || this.onAudio) {
return "media";
}
if (this.onTextInput) {
return "input";
}
if (this.onSocial) {
return "social";
}
return "other";
},
_checkTelemetryForMenu: function(aXulMenu) {
this._telemetryClickID = null;
this._telemetryPageContext = this._getTelemetryPageContextInfo();
this._telemetryHadCustomItems = this.hasPageMenu;
this._getTelemetryClickInfo(aXulMenu);
},
};

Просмотреть файл

@ -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);

Просмотреть файл

@ -119,6 +119,9 @@ function* clickOnInspectMenuItem(node) {
info("Triggering inspect action.");
yield contextMenu.inspectNode();
// Clean up context menu:
contextMenu.hiding();
info("Waiting for inspector to update.");
yield getActiveInspector().once("inspector-updated");
}

Просмотреть файл

@ -31,6 +31,10 @@ let test = asyncTest(function*() {
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
let contextMenu = new nsContextMenu(contentAreaContextMenu);
yield contextMenu.inspectNode();
// Clean up context menu:
contextMenu.hiding();
yield onInspectorReady;
let target = TargetFactory.forTab(gBrowser.selectedTab);

Просмотреть файл

@ -561,11 +561,7 @@ let UI = {
// If connected and a project is selected
if (AppManager.selectedProject.type == "runtimeApp") {
if (isProjectRunning) {
playCmd.setAttribute("disabled", "true");
} else {
playCmd.removeAttribute("disabled");
}
playCmd.removeAttribute("disabled");
} else if (AppManager.selectedProject.type == "mainProcess") {
playCmd.setAttribute("disabled", "true");
stopCmd.setAttribute("disabled", "true");

Просмотреть файл

@ -383,7 +383,11 @@ exports.AppManager = AppManager = {
let client = this.connection.client;
let actor = this._listTabsResponse.webappsActor;
let manifest = this.getProjectManifestURL(this.selectedProject);
return AppActorFront.launchApp(client, actor, manifest);
if (!this.isProjectRunning()) {
return AppActorFront.launchApp(client, actor, manifest);
} else {
return AppActorFront.reloadApp(client, actor, manifest);
}
},
installAndRunProject: function() {

Просмотреть файл

@ -135,7 +135,7 @@ panel > vbox {
panel > .panel-arrowcontainer > .panel-arrowcontent {
padding: 12px 0;
width: 200px;
min-width: 200px;
}
.panel-item {

Просмотреть файл

@ -170,6 +170,8 @@ this.BrowserUITelemetry = {
init: function() {
UITelemetry.addSimpleMeasureFunction("toolbars",
this.getToolbarMeasures.bind(this));
UITelemetry.addSimpleMeasureFunction("contextmenu",
this.getContextMenuInfo.bind(this));
// Ensure that UITour.jsm remains lazy-loaded, yet always registers its
// simple measure function with UITelemetry.
UITelemetry.addSimpleMeasureFunction("UITour",
@ -220,11 +222,13 @@ this.BrowserUITelemetry = {
*
* @param aKeys the Array of keys to chain Objects together with.
* @param aEndWith the value to assign to the last key.
* @param aRoot the root object onto which we create/get the object chain
* designated by aKeys.
* @returns a reference to the second last object in the chain -
* so in our example, that'd be "b".
*/
_ensureObjectChain: function(aKeys, aEndWith) {
let current = this._countableEvents;
_ensureObjectChain: function(aKeys, aEndWith, aRoot) {
let current = aRoot;
let parent = null;
aKeys.unshift(this._bucket);
for (let [i, key] of Iterator(aKeys)) {
@ -242,8 +246,8 @@ this.BrowserUITelemetry = {
},
_countableEvents: {},
_countEvent: function(aKeyArray) {
let countObject = this._ensureObjectChain(aKeyArray, 0);
_countEvent: function(aKeyArray, root=this._countableEvents) {
let countObject = this._ensureObjectChain(aKeyArray, 0, root);
let lastItemKey = aKeyArray[aKeyArray.length - 1];
countObject[lastItemKey]++;
},
@ -587,6 +591,54 @@ this.BrowserUITelemetry = {
}
},
_contextMenuItemWhitelist: new Set([
"close-without-interaction", // for closing the menu without clicking it.
"custom-page-item", // The ID we use for page-provided items
"unknown", // The bucket for stuff with no id.
// Everything we know of so far (which will exclude add-on items):
"navigation", "back", "forward", "reload", "stop", "bookmarkpage",
"spell-no-suggestions", "spell-add-to-dictionary",
"spell-undo-add-to-dictionary", "openlinkincurrent", "openlinkintab",
"openlink", "openlinkprivate", "bookmarklink", "sharelink", "savelink",
"marklinkMenu", "copyemail", "copylink", "media-play", "media-pause",
"media-mute", "media-unmute", "media-playbackrate",
"media-playbackrate-050x", "media-playbackrate-100x",
"media-playbackrate-150x", "media-playbackrate-200x",
"media-showcontrols", "media-hidecontrols", "video-showstats",
"video-hidestats", "video-fullscreen", "leave-dom-fullscreen",
"reloadimage", "viewimage", "viewvideo", "copyimage-contents", "copyimage",
"copyvideourl", "copyaudiourl", "saveimage", "shareimage", "sendimage",
"setDesktopBackground", "viewimageinfo", "viewimagedesc", "savevideo",
"sharevideo", "saveaudio", "video-saveimage", "sendvideo", "sendaudio",
"ctp-play", "ctp-hide", "sharepage", "savepage", "markpageMenu",
"viewbgimage", "undo", "cut", "copy", "paste", "delete", "selectall",
"keywordfield", "searchselect", "shareselect", "frame", "showonlythisframe",
"openframeintab", "openframe", "reloadframe", "bookmarkframe", "saveframe",
"printframe", "viewframesource", "viewframeinfo",
"viewpartialsource-selection", "viewpartialsource-mathml",
"viewsource", "viewinfo", "spell-check-enabled",
"spell-add-dictionaries-main", "spell-dictionaries",
"spell-dictionaries-menu", "spell-add-dictionaries",
"bidi-text-direction-toggle", "bidi-page-direction-toggle", "inspect",
]),
_contextMenuInteractions: {},
registerContextMenuInteraction: function(keys, itemID) {
if (itemID) {
if (!this._contextMenuItemWhitelist.has(itemID)) {
itemID = "other-item";
}
keys.push(itemID);
}
this._countEvent(keys, this._contextMenuInteractions);
},
getContextMenuInfo: function() {
return this._contextMenuInteractions;
},
_bucket: BUCKET_DEFAULT,
_bucketTimer: null,

Просмотреть файл

@ -94,12 +94,13 @@
}
#customization-header {
font-size: 1.5em;
line-height: 1.5em;
color: rgb(64,100,128);
font-weight: lighter;
margin-bottom: 1em;
padding: 25px 25px 0;
font-size: 1.75em;
line-height: 1.75em;
color: #666;
font-weight: 200;
margin: 25px 25px 12px;
padding-bottom: 12px;
border-bottom: 1px solid #e5e5e5;
}
#customization-panel-container {

Просмотреть файл

@ -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']:

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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 ||

Просмотреть файл

@ -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)) {

Просмотреть файл

@ -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
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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&);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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
{

Просмотреть файл

@ -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() {}

Просмотреть файл

@ -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();

Просмотреть файл

@ -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

Просмотреть файл

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

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

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

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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.

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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&

Просмотреть файл

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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}

Просмотреть файл

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

Просмотреть файл

@ -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)); \
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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.");

Просмотреть файл

@ -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...

Просмотреть файл

@ -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() {}

Просмотреть файл

@ -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; */

Просмотреть файл

@ -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

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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 Over 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-over-one-ref.html">
<meta name="assert"
content="Given a factor over one, the CSS invert filter function
should completely change the color of an HTML element.">
<style type="text/css">
#target {
filter: invert(1000);
background-color: #f0f;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

Просмотреть файл

@ -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 Percentage</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(63, 191, 63);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

Просмотреть файл

@ -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 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-invert">
<link rel="match" href="invert-percent-ref.html">
<meta name="assert"
content="Given a percentage, the CSS invert filter function should
change the color of an HTML element.">
<style type="text/css">
#target {
filter: invert(75%);
background-color: #f0f;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

Просмотреть файл

@ -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</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
background-color: rgb(63, 191, 63);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

Просмотреть файл

@ -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 Zero</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>

Просмотреть файл

@ -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 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-invert">
<link rel="match" href="invert-zero-ref.html">
<meta name="assert"
content="Given a factor of zero, the CSS invert filter function should
not change the color of an HTML element.">
<style type="text/css">
#target {
filter: invert(0);
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

Просмотреть файл

@ -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</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-ref.html">
<meta name="assert"
content="The CSS invert filter function should change the color of an
HTML element.">
<style type="text/css">
#target {
filter: invert(0.75);
background-color: #f0f;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

Просмотреть файл

@ -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: Apply Opacity to 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>

Просмотреть файл

@ -0,0 +1,36 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Apply Opacity to 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-opacity">
<link rel="match" href="opacity-one-ref.html">
<meta name="assert"
content="Given a factor of one, the CSS opacity filter function should
not change the opaqueness of an HTML element.">
<style type="text/css">
#below-target {
background-color: #f00;
width: 100px;
height: 100px;
}
#target {
filter: opacity(1000);
background-color: #0f0;
position: relative;
top: -100px;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="below-target"></div>
<div id="target"></div>
</body>
</html>

Просмотреть файл

@ -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: Apply Opacity to 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>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше