Merge b2g-inbound to m-c.

This commit is contained in:
Ryan VanderMeulen 2014-03-07 15:33:37 -05:00
commit 958011994e
37 changed files with 455 additions and 123 deletions

View File

@ -19,13 +19,13 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="456499c44d1ef39b602ea02e9ed460b6aab85b44"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,14 +15,14 @@
<project name="platform_build" path="build" remote="b2g" revision="a9e08b91e9cd1f0930f16cfc49ec72f63575d5fe">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -19,13 +19,13 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="456499c44d1ef39b602ea02e9ed460b6aab85b44"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -4,6 +4,6 @@
"branch": "",
"revision": ""
},
"revision": "1ad040b490a7eca701eab481a3716c5404041c1b",
"revision": "2d53c8213843d04a5fa3421ff8263fbe67fd5e49",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,12 +17,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

View File

@ -15,11 +15,11 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -19,12 +19,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>

View File

@ -17,12 +17,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -17,12 +17,12 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b3758a90b8888e9d95128846b2833b4d9444ef7f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c109df47006b08c082761c0ddd6ba53a864983a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="707630df1b4270eae3dd49b7344c645f32c1b5f4"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -1205,7 +1205,7 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName,
// Get the nsCSSProperty ID for our mapped attribute.
nsCSSProperty propertyID =
nsCSSProps::LookupProperty(nsDependentAtomString(aMappedAttrName),
nsCSSProps::eEnabled);
nsCSSProps::eEnabledForAllContent);
if (propertyID != eCSSProperty_UNKNOWN) {
bool changed; // outparam for ParseProperty. (ignored)
mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI,
@ -2539,7 +2539,7 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName)
if (IsAttributeMapped(aName)) {
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(aName),
nsCSSProps::eEnabled);
nsCSSProps::eEnabledForAllContent);
// Check IsPropertyAnimatable to avoid attributes that...
// - map to explicitly unanimatable properties (e.g. 'direction')
// - map to unsupported attributes (e.g. 'glyph-orientation-horizontal')

View File

@ -2617,8 +2617,8 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement,
// Convert direction-dependent properties as appropriate, e.g.,
// border-left to border-left-value.
nsCSSProperty property = nsCSSProps::LookupProperty(aProperty,
nsCSSProps::eAny);
nsCSSProperty property =
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState);
if (property != eCSSProperty_UNKNOWN && nsCSSProps::IsShorthand(property)) {
nsCSSProperty subprop0 = *nsCSSProps::SubpropertyEntryFor(property);
if (nsCSSProps::PropHasFlags(subprop0, CSS_PROPERTY_REPORT_OTHER_NAME) &&

View File

@ -7,9 +7,18 @@ import string
propList = eval(sys.stdin.read())
props = ""
for [prop, pref] in propList:
for [prop, id, flags, pref] in propList:
extendedAttrs = ["Throws", "TreatNullAs=EmptyString"]
if pref is not "":
# To limit the overhead of Func= annotations, we only generate them when
# necessary, which is when the
# CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP flag is set.
# Otherwise, we try to get by with just a Pref= annotation or no annotation
# at all.
if "CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP" in flags:
extendedAttrs.append('Func="IsCSSPropertyExposedToJS<eCSSProperty_%s>"' % id)
# The following is an 'elif' because it is the responsibility of
# IsCSSPropertyExposedToJS to handle the pref if there is one.
elif pref is not "":
extendedAttrs.append('Pref="%s"' % pref)
if not prop.startswith("Moz"):
prop = prop[0].lower() + prop[1:]

View File

@ -794,7 +794,7 @@ nsSMILAnimationController::GetTargetIdentifierForAnimation(
} else {
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(attributeName),
nsCSSProps::eEnabled);
nsCSSProps::eEnabledForAllContent);
isCSS = nsSMILCSSProperty::IsPropertyAnimatable(prop);
}
}

View File

@ -125,7 +125,7 @@ nsSMILCompositor::CreateSMILAttr()
if (mKey.mIsCSS) {
nsCSSProperty propId =
nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName),
nsCSSProps::eEnabled);
nsCSSProps::eEnabledForAllContent);
if (nsSMILCSSProperty::IsPropertyAnimatable(propId)) {
return new nsSMILCSSProperty(propId, mKey.mElement.get());
}

View File

@ -5,13 +5,16 @@
[
#define DO_PROP(method, pref) \
[ #method, pref ],
#define PROP_STRINGIFY_INTERNAL(X) #X
#define PROP_STRINGIFY(X) PROP_STRINGIFY_INTERNAL(X)
#define DO_PROP(method, id, flags, pref) \
[ #method, #id, PROP_STRINGIFY(flags), pref ],
#define CSS_PROP(name, id, method, flags, pref, parsevariant, kwtable, \
stylestruct, stylestructofset, animtype) \
DO_PROP(method, pref)
DO_PROP(method, id, flags, pref)
#define CSS_PROP_SHORTHAND(name, id, method, flags, pref) \
DO_PROP(method, pref)
DO_PROP(method, id, flags, pref)
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
@ -23,12 +26,14 @@
#undef CSS_PROP
#define CSS_PROP_ALIAS(name, id, method, pref) \
DO_PROP(method, pref)
DO_PROP(method, id, 0, pref)
#include "nsCSSPropAliasList.h"
#undef CSS_PROP_ALIAS
#undef DO_PROP
#undef PROP_STRINGIFY
#undef PROP_STRINGIFY_INTERNAL
]

View File

@ -565,7 +565,7 @@ nsHTMLCSSUtils::GetCSSInlinePropertyBase(nsINode* aNode, nsIAtom* aProperty,
}
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(aProperty),
nsCSSProps::eEnabled);
nsCSSProps::eEnabledForAllContent);
MOZ_ASSERT(prop != eCSSProperty_UNKNOWN);
rule->GetDeclaration()->GetValue(prop, aValue);

View File

@ -368,6 +368,7 @@ GrallocImage::GetAsSourceSurface()
mSize,
surface->GetData(),
surface->Stride());
surface->Unmap();
return surface;
}

View File

@ -26,6 +26,7 @@
#include "nsSize.h" // for nsIntSize
#include "nsTArray.h" // for nsTArray
#include "mozilla/Atomics.h"
#include "mozilla/WeakPtr.h"
#include "nsThreadUtils.h"
#include "mozilla/gfx/2D.h"
#include "nsDataHashtable.h"
@ -380,7 +381,7 @@ struct RemoteImageData {
* updates the shared state to point to the new image and the old image
* is immediately released (not true in Normal or Asynchronous modes).
*/
class ImageContainer {
class ImageContainer : public SupportsWeakPtr<ImageContainer> {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ImageContainer)
public:

View File

@ -922,8 +922,24 @@ RasterImage::GetFrame(uint32_t aWhichFrame,
nsIntRect framerect = frame->GetRect();
if (framerect.x == 0 && framerect.y == 0 &&
framerect.width == mSize.width &&
framerect.height == mSize.height)
framerect.height == mSize.height) {
frame->GetSurface(getter_AddRefs(framesurf));
if (!framesurf && !frame->IsSinglePixel()) {
// No reason to be optimized away here - the OS threw out the data
if (!(aFlags & FLAG_SYNC_DECODE))
return nullptr;
// Unconditionally call ForceDiscard() here because GetSurface can only
// return null when we can forcibly discard and redecode. There are two
// other cases where GetSurface() can return null - when it is a single
// pixel image, which we check before getting here, or when this is an
// indexed image, in which case we shouldn't be in this function at all.
// The only remaining possibility is that SetDiscardable() was called on
// this imgFrame, which implies the image can be redecoded.
ForceDiscard();
return GetFrame(aWhichFrame, aFlags);
}
}
// The image doesn't have a surface because it's been optimized away. Create
// one.
@ -947,7 +963,15 @@ RasterImage::GetCurrentImage()
}
nsRefPtr<gfxASurface> imageSurface = GetFrame(FRAME_CURRENT, FLAG_NONE);
NS_ENSURE_TRUE(imageSurface, nullptr);
if (!imageSurface) {
// The OS threw out some or all of our buffer. Start decoding again.
// GetFrame will only return null in the case that the image was
// discarded. We already checked that the image is decoded, so other
// error paths are not possible.
ForceDiscard();
RequestDecodeCore(ASYNCHRONOUS);
return nullptr;
}
if (!mImageContainer) {
mImageContainer = LayerManager::CreateImageContainer();
@ -981,6 +1005,10 @@ RasterImage::GetImageContainer(LayerManager* aManager, ImageContainer **_retval)
mStatusTracker->OnUnlockedDraw();
}
if (!mImageContainer) {
mImageContainer = mImageContainerCache;
}
if (mImageContainer) {
*_retval = mImageContainer;
NS_ADDREF(*_retval);
@ -995,6 +1023,13 @@ RasterImage::GetImageContainer(LayerManager* aManager, ImageContainer **_retval)
*_retval = mImageContainer;
NS_ADDREF(*_retval);
// We only need to be careful about holding on to the image when it is
// discardable by the OS.
if (CanForciblyDiscardAndRedecode()) {
mImageContainerCache = mImageContainer->asWeakPtr();
mImageContainer = nullptr;
}
return NS_OK;
}
@ -1392,6 +1427,12 @@ RasterImage::DecodingComplete()
// We don't optimize the frame for multipart images because we reuse
// the frame.
if ((GetNumFrames() == 1) && !mMultipart) {
// CanForciblyDiscard is used instead of CanForciblyDiscardAndRedecode
// because we know decoding is complete at this point and this is not
// an animation
if (DiscardingEnabled() && CanForciblyDiscard()) {
mFrameBlender.RawGetFrame(0)->SetDiscardable();
}
rv = mFrameBlender.RawGetFrame(0)->Optimize();
NS_ENSURE_SUCCESS(rv, rv);
}
@ -2093,13 +2134,6 @@ RasterImage::ShutdownDecoder(eShutdownIntent aIntent)
// Figure out what kind of decode we were doing before we get rid of our decoder
bool wasSizeDecode = mDecoder->IsSizeDecode();
// Unlock the last frame (if we have any). Our invariant is that, while we
// have a decoder open, the last frame is always locked.
if (GetNumFrames() > 0) {
imgFrame *curframe = mFrameBlender.RawGetFrame(GetNumFrames() - 1);
curframe->UnlockImageData();
}
// Finalize the decoder
// null out mDecoder, _then_ check for errors on the close (otherwise the
// error routine might re-invoke ShutdownDecoder)
@ -2112,6 +2146,13 @@ RasterImage::ShutdownDecoder(eShutdownIntent aIntent)
mInDecoder = false;
mFinishing = false;
// Unlock the last frame (if we have any). Our invariant is that, while we
// have a decoder open, the last frame is always locked.
if (GetNumFrames() > 0) {
imgFrame *curframe = mFrameBlender.RawGetFrame(GetNumFrames() - 1);
curframe->UnlockImageData();
}
// Kill off our decode request, if it's pending. (If not, this call is
// harmless.)
DecodePool::StopDecoding(this);
@ -2677,6 +2718,17 @@ RasterImage::Draw(gfxContext *aContext,
return NS_OK; // Getting the frame (above) touches the image and kicks off decoding
}
nsRefPtr<gfxASurface> surf;
if (!frame->IsSinglePixel()) {
frame->GetSurface(getter_AddRefs(surf));
if (!surf) {
// The OS threw out some or all of our buffer. Start decoding again.
ForceDiscard();
WantDecodedFrames();
return NS_OK;
}
}
DrawWithPreDownscaleIfNeeded(frame, aContext, aFilter, aUserSpaceToImageSpace, aFill, aSubimage, aFlags);
if (mDecoded && !mDrawStartTime.IsNull()) {

View File

@ -659,6 +659,9 @@ private: // data
// Cached value for GetImageContainer.
nsRefPtr<mozilla::layers::ImageContainer> mImageContainer;
// If not cached in mImageContainer, this might have our image container
WeakPtr<mozilla::layers::ImageContainer> mImageContainerCache;
#ifdef DEBUG
uint32_t mFramesNotified;
#endif

View File

@ -12,6 +12,7 @@
#include "gfx2DGlue.h"
#include "gfxPlatform.h"
#include "gfxUtils.h"
#include "gfxAlphaRecovery.h"
static bool gDisableOptimize = false;
@ -35,6 +36,48 @@ using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::image;
static cairo_user_data_key_t kVolatileBuffer;
static void
VolatileBufferRelease(void *vbuf)
{
delete static_cast<VolatileBufferPtr<unsigned char>*>(vbuf);
}
gfxImageSurface *
LockedImageSurface::CreateSurface(VolatileBuffer *vbuf,
const gfxIntSize& size,
gfxImageFormat format)
{
VolatileBufferPtr<unsigned char> *vbufptr =
new VolatileBufferPtr<unsigned char>(vbuf);
MOZ_ASSERT(!vbufptr->WasBufferPurged(), "Expected image data!");
long stride = gfxImageSurface::ComputeStride(size, format);
gfxImageSurface *img = new gfxImageSurface(*vbufptr, size, stride, format);
if (!img || img->CairoStatus()) {
delete img;
delete vbufptr;
return nullptr;
}
img->SetData(&kVolatileBuffer, vbufptr, VolatileBufferRelease);
return img;
}
TemporaryRef<VolatileBuffer>
LockedImageSurface::AllocateBuffer(const gfxIntSize& size,
gfxImageFormat format)
{
long stride = gfxImageSurface::ComputeStride(size, format);
RefPtr<VolatileBuffer> buf = new VolatileBuffer();
if (buf->Init(stride * size.height,
1 << gfxAlphaRecovery::GoodAlignmentLog2()))
return buf;
return nullptr;
}
// Returns true if an image of aWidth x aHeight is allowed and legal.
static bool AllowedImageSize(int32_t aWidth, int32_t aHeight)
{
@ -108,6 +151,7 @@ imgFrame::imgFrame() :
mFormatChanged(false),
mCompositingFailed(false),
mNonPremult(false),
mDiscardable(false),
mInformedDiscardTracker(false),
mDirty(false)
{
@ -174,12 +218,17 @@ nsresult imgFrame::Init(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
}
#endif
// For other platforms we create the image surface first and then
// possibly wrap it in a device surface. This branch is also used
// on Windows if we're not using device surfaces or if we couldn't
// create one.
if (!mImageSurface)
mImageSurface = new gfxImageSurface(gfxIntSize(mSize.width, mSize.height), mFormat);
// For other platforms, space for the image surface is first allocated in
// a volatile buffer and then wrapped by a LockedImageSurface.
// This branch is also used on Windows if we're not using device surfaces
// or if we couldn't create one.
if (!mImageSurface) {
mVBuf = LockedImageSurface::AllocateBuffer(mSize, mFormat);
if (!mVBuf) {
return NS_ERROR_OUT_OF_MEMORY;
}
mImageSurface = LockedImageSurface::CreateSurface(mVBuf, mSize, mFormat);
}
if (!mImageSurface || mImageSurface->CairoStatus()) {
mImageSurface = nullptr;
@ -251,6 +300,7 @@ nsresult imgFrame::Optimize()
mSinglePixel = true;
// blow away the older surfaces (if they exist), to release their memory
mVBuf = nullptr;
mImageSurface = nullptr;
mOptSurface = nullptr;
#ifdef USE_WIN_SURFACE
@ -300,6 +350,7 @@ nsresult imgFrame::Optimize()
mOptSurface = gfxPlatform::GetPlatform()->OptimizeImage(mImageSurface, mFormat);
if (mOptSurface) {
mVBuf = nullptr;
mImageSurface = nullptr;
#ifdef USE_WIN_SURFACE
mWinSurface = nullptr;
@ -483,10 +534,13 @@ uint32_t imgFrame::GetImageBytesPerRow() const
if (mImageSurface)
return mImageSurface->Stride();
if (mVBuf)
return gfxImageSurface::ComputeStride(mSize, mFormat);
if (mPaletteDepth)
return mSize.width;
NS_ERROR("GetImageBytesPerRow called with mImageSurface == null and mPaletteDepth == 0");
NS_ERROR("GetImageBytesPerRow called with mImageSurface == null, mVBuf == null and mPaletteDepth == 0");
return 0;
}
@ -569,28 +623,42 @@ nsresult imgFrame::LockImageData()
if (mPalettedImageData)
return NS_OK;
if ((mOptSurface || mSinglePixel) && !mImageSurface) {
// Recover the pixels
mImageSurface = new gfxImageSurface(gfxIntSize(mSize.width, mSize.height),
gfxImageFormat::ARGB32);
if (!mImageSurface || mImageSurface->CairoStatus())
return NS_ERROR_OUT_OF_MEMORY;
if (!mImageSurface) {
if (mVBuf) {
VolatileBufferPtr<uint8_t> ref(mVBuf);
if (ref.WasBufferPurged())
return NS_ERROR_FAILURE;
gfxContext context(mImageSurface);
context.SetOperator(gfxContext::OPERATOR_SOURCE);
if (mSinglePixel)
context.SetDeviceColor(mSinglePixelColor);
else
context.SetSource(mOptSurface);
context.Paint();
mImageSurface = LockedImageSurface::CreateSurface(mVBuf, mSize, mFormat);
if (!mImageSurface || mImageSurface->CairoStatus())
return NS_ERROR_OUT_OF_MEMORY;
} else if (mOptSurface || mSinglePixel) {
// Recover the pixels
mVBuf = LockedImageSurface::AllocateBuffer(mSize, mFormat);
if (!mVBuf) {
return NS_ERROR_OUT_OF_MEMORY;
}
mOptSurface = nullptr;
mImageSurface = LockedImageSurface::CreateSurface(mVBuf, mSize, mFormat);
if (!mImageSurface || mImageSurface->CairoStatus())
return NS_ERROR_OUT_OF_MEMORY;
gfxContext context(mImageSurface);
context.SetOperator(gfxContext::OPERATOR_SOURCE);
if (mSinglePixel)
context.SetDeviceColor(mSinglePixelColor);
else
context.SetSource(mOptSurface);
context.Paint();
mOptSurface = nullptr;
#ifdef USE_WIN_SURFACE
mWinSurface = nullptr;
mWinSurface = nullptr;
#endif
#ifdef XP_MACOSX
mQuartzSurface = nullptr;
mQuartzSurface = nullptr;
#endif
}
}
// We might write to the bits in this image surface, so we need to make the
@ -603,6 +671,12 @@ nsresult imgFrame::LockImageData()
mWinSurface->Flush();
#endif
#ifdef XP_MACOSX
if (!mQuartzSurface && !ShouldUseImageSurfaces()) {
mQuartzSurface = new gfxQuartzImageSurface(mImageSurface);
}
#endif
return NS_OK;
}
@ -658,6 +732,13 @@ nsresult imgFrame::UnlockImageData()
mQuartzSurface->Flush();
#endif
if (mVBuf && mDiscardable) {
mImageSurface = nullptr;
#ifdef XP_MACOSX
mQuartzSurface = nullptr;
#endif
}
return NS_OK;
}
@ -697,6 +778,12 @@ void imgFrame::ApplyDirtToSurfaces()
}
}
void imgFrame::SetDiscardable()
{
MOZ_ASSERT(mLockCount, "Expected to be locked when SetDiscardable is called");
mDiscardable = true;
}
int32_t imgFrame::GetRawTimeout() const
{
return mTimeout;
@ -795,8 +882,8 @@ imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxMemoryLocation aLocat
#endif
#ifdef XP_MACOSX
if (mQuartzSurface && aLocation == gfxMemoryLocation::IN_PROCESS_HEAP) {
n += mSize.width * mSize.height * 4;
} else
n += aMallocSizeOf(mQuartzSurface);
}
#endif
if (mImageSurface && aLocation == mImageSurface->GetMemoryLocation()) {
size_t n2 = 0;
@ -809,6 +896,11 @@ imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxMemoryLocation aLocat
n += n2;
}
if (mVBuf && aLocation == gfxMemoryLocation::IN_PROCESS_HEAP) {
n += aMallocSizeOf(mVBuf);
n += mVBuf->HeapSizeOfExcludingThis(aMallocSizeOf);
}
if (mOptSurface && aLocation == mOptSurface->GetMemoryLocation()) {
size_t n2 = 0;
if (aLocation == gfxMemoryLocation::IN_PROCESS_HEAP &&

View File

@ -9,6 +9,7 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/Mutex.h"
#include "mozilla/VolatileBuffer.h"
#include "nsRect.h"
#include "nsPoint.h"
#include "nsSize.h"
@ -24,6 +25,21 @@
#include "imgIContainer.h"
#include "gfxColor.h"
/*
* This creates a gfxImageSurface which will unlock the buffer on destruction
*/
class LockedImageSurface
{
public:
static gfxImageSurface *
CreateSurface(mozilla::VolatileBuffer *vbuf,
const gfxIntSize& size,
gfxImageFormat format);
static mozilla::TemporaryRef<mozilla::VolatileBuffer>
AllocateBuffer(const gfxIntSize& size, gfxImageFormat format);
};
class imgFrame
{
public:
@ -72,14 +88,16 @@ public:
nsresult UnlockImageData();
void ApplyDirtToSurfaces();
nsresult GetSurface(gfxASurface **aSurface) const
void SetDiscardable();
nsresult GetSurface(gfxASurface **aSurface)
{
*aSurface = ThebesSurface();
NS_IF_ADDREF(*aSurface);
return NS_OK;
}
nsresult GetPattern(gfxPattern **aPattern) const
nsresult GetPattern(gfxPattern **aPattern)
{
if (mSinglePixel)
*aPattern = new gfxPattern(mSinglePixelColor);
@ -89,7 +107,12 @@ public:
return NS_OK;
}
gfxASurface* ThebesSurface() const
bool IsSinglePixel()
{
return mSinglePixel;
}
gfxASurface* ThebesSurface()
{
if (mOptSurface)
return mOptSurface;
@ -100,7 +123,32 @@ public:
if (mQuartzSurface)
return mQuartzSurface;
#endif
return mImageSurface;
if (mImageSurface)
return mImageSurface;
if (mVBuf) {
mozilla::VolatileBufferPtr<uint8_t> ref(mVBuf);
if (ref.WasBufferPurged())
return nullptr;
gfxImageSurface *sur =
LockedImageSurface::CreateSurface(mVBuf, mSize, mFormat);
#if defined(XP_MACOSX)
// Manually addref and release to make sure the cairo surface isn't lost
NS_ADDREF(sur);
gfxQuartzImageSurface *quartzSur = new gfxQuartzImageSurface(sur);
// quartzSur does not hold on to the gfxImageSurface
NS_RELEASE(sur);
return quartzSur;
#else
return sur;
#endif
}
// We can return null here if we're single pixel optimized
// or a paletted image. However, one has to check for paletted
// image data first before attempting to get a surface, so
// this is only valid for single pixel optimized images
MOZ_ASSERT(mSinglePixel, "No image surface and not a single pixel!");
return nullptr;
}
size_t SizeOfExcludingThisWithComputedFallbackIfHeap(
@ -167,6 +215,8 @@ private: // data
/** Indicates how many readers currently have locked this frame */
int32_t mLockCount;
mozilla::RefPtr<mozilla::VolatileBuffer> mVBuf;
gfxImageFormat mFormat;
uint8_t mPaletteDepth;
int8_t mBlendMethod;
@ -174,6 +224,7 @@ private: // data
bool mFormatChanged;
bool mCompositingFailed;
bool mNonPremult;
bool mDiscardable;
/** Have we called DiscardTracker::InformAllocation()? */
bool mInformedDiscardTracker;

View File

@ -227,7 +227,7 @@ inCSSValueSearch::AddPropertyCriteria(const char16_t *aPropName)
{
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentString(aPropName),
nsCSSProps::eAny);
nsCSSProps::eIgnoreEnabledState);
mProperties[mPropertyCount] = prop;
mPropertyCount++;
return NS_OK;

View File

@ -383,8 +383,8 @@ inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement,
NS_IMETHODIMP
inDOMUtils::IsInheritedProperty(const nsAString &aPropertyName, bool *_retval)
{
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eAny);
nsCSSProperty prop =
nsCSSProps::LookupProperty(aPropertyName, nsCSSProps::eIgnoreEnabledState);
if (prop == eCSSProperty_UNKNOWN) {
*_retval = false;
return NS_OK;
@ -565,7 +565,7 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
char16_t*** aValues)
{
nsCSSProperty propertyID = nsCSSProps::LookupProperty(aProperty,
nsCSSProps::eEnabled);
nsCSSProps::eEnabledForAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
}

View File

@ -959,7 +959,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
bool
Declaration::GetValueIsImportant(const nsAString& aProperty) const
{
nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty, nsCSSProps::eAny);
nsCSSProperty propID =
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState);
if (propID == eCSSProperty_UNKNOWN) {
return false;
}

View File

@ -45,6 +45,7 @@
#include "mozilla/Preferences.h"
#include "nsRuleData.h"
#include "mozilla/CSSVariableValues.h"
#include "mozilla/dom/URL.h"
using namespace mozilla;
@ -248,9 +249,17 @@ public:
uint32_t aLineOffset);
nsCSSProperty LookupEnabledProperty(const nsAString& aProperty) {
return nsCSSProps::LookupProperty(aProperty, mUnsafeRulesEnabled ?
nsCSSProps::eEnabledInUASheets :
nsCSSProps::eEnabled);
static_assert(nsCSSProps::eEnabledForAllContent == 0,
"nsCSSProps::eEnabledForAllContent should be zero for "
"this bitfield to work");
nsCSSProps::EnabledState enabledState = nsCSSProps::eEnabledForAllContent;
if (mUnsafeRulesEnabled) {
enabledState |= nsCSSProps::eEnabledInUASheets;
}
if (mIsChromeOrCertifiedApp) {
enabledState |= nsCSSProps::eEnabledInChromeOrCertifiedApp;
}
return nsCSSProps::LookupProperty(aProperty, enabledState);
}
protected:
@ -879,6 +888,12 @@ protected:
// True if unsafe rules should be allowed
bool mUnsafeRulesEnabled : 1;
// True if we are in parsing rules for Chrome or Certified App content,
// in which case CSS properties with the
// CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP
// flag should be allowed.
bool mIsChromeOrCertifiedApp : 1;
// True if viewport units should be allowed.
bool mViewportUnitsEnabled : 1;
@ -973,6 +988,7 @@ CSSParserImpl::CSSParserImpl()
mHashlessColorQuirk(false),
mUnitlessLengthQuirk(false),
mUnsafeRulesEnabled(false),
mIsChromeOrCertifiedApp(false),
mViewportUnitsEnabled(true),
mHTMLMediaMode(false),
mParsingCompoundProperty(false),
@ -1113,6 +1129,9 @@ CSSParserImpl::ParseSheet(const nsAString& aInput,
}
mUnsafeRulesEnabled = aAllowUnsafeRules;
mIsChromeOrCertifiedApp =
dom::IsChromeURI(aSheetURI) ||
aSheetPrincipal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED;
nsCSSToken* tk = &mToken;
for (;;) {
@ -1136,6 +1155,7 @@ CSSParserImpl::ParseSheet(const nsAString& aInput,
ReleaseScanner();
mUnsafeRulesEnabled = false;
mIsChromeOrCertifiedApp = false;
// XXX check for low level errors
return NS_OK;

View File

@ -3791,7 +3791,8 @@ CSS_PROP_DISPLAY(
will_change,
WillChange,
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_VALUE_LIST_USES_COMMAS,
CSS_PROPERTY_VALUE_LIST_USES_COMMAS |
CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP,
"layout.css.will-change.enabled",
0,
nullptr,

View File

@ -395,13 +395,13 @@ nsCSSProps::LookupProperty(const nsACString& aProperty,
}
MOZ_ASSERT(eCSSAliasCount != 0,
"'res' must be an alias at this point so we better have some!");
// We intentionally don't support eEnabledInUASheets for aliases yet
// because it's unlikely there will be a need for it.
if (IsEnabled(res) || aEnabled == eAny) {
// We intentionally don't support eEnabledInUASheets or eEnabledInChromeOrCertifiedApp
// for aliases yet because it's unlikely there will be a need for it.
if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
res = gAliases[res - eCSSProperty_COUNT];
NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT,
"aliases must not point to other aliases");
if (IsEnabled(res) || aEnabled == eAny) {
if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
return res;
}
}
@ -431,11 +431,11 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
"'res' must be an alias at this point so we better have some!");
// We intentionally don't support eEnabledInUASheets for aliases yet
// because it's unlikely there will be a need for it.
if (IsEnabled(res) || aEnabled == eAny) {
if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
res = gAliases[res - eCSSProperty_COUNT];
NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT,
"aliases must not point to other aliases");
if (IsEnabled(res) || aEnabled == eAny) {
if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
return res;
}
}

View File

@ -201,6 +201,14 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
// In other words, this bit has no effect on the use of aliases.
#define CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS (1<<22)
// This property is always enabled in chrome and in certified apps. This is
// meant to be used together with a pref that enables the property for
// non-privileged content. Note that if such a property has an alias, then any
// use of that alias in privileged content will still be ignored unless the
// pref is enabled. In other words, this bit has no effect on the use of
// aliases.
#define CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP (1<<23)
/**
* Types of animatable values.
*/
@ -258,12 +266,21 @@ public:
static void AddRefTable(void);
static void ReleaseTable(void);
// Given a property string, return the enum value
enum EnabledState {
eEnabled,
eEnabledInUASheets,
eAny
// The default EnabledState: only enable what's enabled for all content,
// given the current values of preferences.
eEnabledForAllContent = 0,
// Enable a property in UA sheets.
eEnabledInUASheets = 0x01,
// Enable a property in privileged content, i.e. chrome or Certified Apps
eEnabledInChromeOrCertifiedApp = 0x02,
// Special value to unconditionally enable a property. This implies all the
// bits above, but is strictly more than just their OR-ed union.
// This just skips any test so a property will be enabled even if it would
// have been disabled with all the bits above set.
eIgnoreEnabledState = 0xff
};
// Looks up the property with name aProperty and returns its corresponding
// nsCSSProperty value. If aProperty is the name of a custom property,
// then eCSSPropertyExtra_variable will be returned.
@ -447,11 +464,25 @@ public:
return gPropertyEnabled[aProperty];
}
static bool IsEnabled(nsCSSProperty aProperty, EnabledState aEnabled) {
return IsEnabled(aProperty) ||
(aEnabled == eEnabledInUASheets &&
PropHasFlags(aProperty, CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS)) ||
aEnabled == eAny;
static bool IsEnabled(nsCSSProperty aProperty, EnabledState aEnabled)
{
if (IsEnabled(aProperty)) {
return true;
}
if (aEnabled == eIgnoreEnabledState) {
return true;
}
if ((aEnabled & eEnabledInUASheets) &&
PropHasFlags(aProperty, CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS))
{
return true;
}
if ((aEnabled & eEnabledInChromeOrCertifiedApp) &&
PropHasFlags(aProperty, CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP))
{
return true;
}
return false;
}
public:
@ -607,4 +638,28 @@ public:
static const KTableValue kHyphensKTable[];
};
inline nsCSSProps::EnabledState operator|(nsCSSProps::EnabledState a,
nsCSSProps::EnabledState b)
{
return nsCSSProps::EnabledState(int(a) | int(b));
}
inline nsCSSProps::EnabledState operator&(nsCSSProps::EnabledState a,
nsCSSProps::EnabledState b)
{
return nsCSSProps::EnabledState(int(a) & int(b));
}
inline nsCSSProps::EnabledState& operator|=(nsCSSProps::EnabledState& a,
nsCSSProps::EnabledState b)
{
return a = a | b;
}
inline nsCSSProps::EnabledState& operator&=(nsCSSProps::EnabledState& a,
nsCSSProps::EnabledState b)
{
return a = a & b;
}
#endif /* nsCSSProps_h___ */

View File

@ -718,7 +718,7 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv)
{
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabled);
nsCSSProps::eEnabledForAllContent);
bool needsLayoutFlush;
nsComputedStyleMap::Entry::ComputeMethod getter;

View File

@ -16,6 +16,8 @@
#include "nsCOMPtr.h"
#include "mozAutoDocUpdate.h"
#include "nsIURI.h"
#include "mozilla/dom/BindingUtils.h"
#include "nsContentUtils.h"
using namespace mozilla;
@ -169,8 +171,9 @@ NS_IMETHODIMP
nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabled);
const nsCSSProperty propID =
nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;
@ -188,8 +191,9 @@ NS_IMETHODIMP
nsDOMCSSDeclaration::GetAuthoredPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabled);
const nsCSSProperty propID =
nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;
@ -229,8 +233,9 @@ nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
const nsAString& aPriority)
{
// In the common (and fast) cases we can use the property id
nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabled);
nsCSSProperty propID =
nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
if (propID == eCSSProperty_UNKNOWN) {
return NS_OK;
}
@ -265,8 +270,9 @@ NS_IMETHODIMP
nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabled);
const nsCSSProperty propID =
nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;
@ -425,3 +431,24 @@ nsDOMCSSDeclaration::RemoveCustomProperty(const nsAString& aPropertyName)
decl->RemoveVariableDeclaration(Substring(aPropertyName, VAR_PREFIX_LENGTH));
return SetCSSDeclaration(decl);
}
bool IsCSSPropertyExposedToJS(nsCSSProperty aProperty, JSContext* cx, JSObject* obj)
{
nsCSSProps::EnabledState enabledState = nsCSSProps::eEnabledForAllContent;
// Optimization: we skip checking properties of the JSContext
// in the majority case where the property does not have the
// CSS_PROPERTY_ALWAYS_ENABLED_IN_PRIVILEGED_CONTENT flag.
bool isEnabledInChromeOrCertifiedApp
= nsCSSProps::PropHasFlags(aProperty,
CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP);
if (isEnabledInChromeOrCertifiedApp) {
if (dom::IsInCertifiedApp(cx, obj) ||
nsContentUtils::ThreadsafeIsCallerChrome())
{
enabledState |= nsCSSProps::eEnabledInChromeOrCertifiedApp;
}
}
return nsCSSProps::IsEnabled(aProperty, enabledState);
}

View File

@ -15,6 +15,8 @@
class nsIPrincipal;
class nsIDocument;
struct JSContext;
class JSObject;
namespace mozilla {
namespace css {
@ -152,4 +154,12 @@ protected:
}
};
bool IsCSSPropertyExposedToJS(nsCSSProperty aProperty, JSContext* cx, JSObject* obj);
template <nsCSSProperty Property>
MOZ_ALWAYS_INLINE bool IsCSSPropertyExposedToJS(JSContext* cx, JSObject* obj)
{
return IsCSSPropertyExposedToJS(Property, cx, obj);
}
#endif // nsDOMCSSDeclaration_h___

View File

@ -4858,8 +4858,9 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
if (val.GetUnit() == eCSSUnit_Ident) {
nsDependentString
propertyStr(property.list->mValue.GetStringBufferValue());
nsCSSProperty prop = nsCSSProps::LookupProperty(propertyStr,
nsCSSProps::eEnabled);
nsCSSProperty prop =
nsCSSProps::LookupProperty(propertyStr,
nsCSSProps::eEnabledForAllContent);
if (prop == eCSSProperty_UNKNOWN) {
transition->SetUnknownProperty(propertyStr);
} else {
@ -5502,7 +5503,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
}
nsCSSProperty prop =
nsCSSProps::LookupProperty(buffer, nsCSSProps::eEnabled);
nsCSSProps::LookupProperty(buffer,
nsCSSProps::eEnabledForAllContent);
if (prop != eCSSProperty_UNKNOWN &&
nsCSSProps::PropHasFlags(prop,
CSS_PROPERTY_CREATES_STACKING_CONTEXT))

View File

@ -2230,7 +2230,7 @@ void nsTransition::SetInitialValues()
void nsTransition::SetUnknownProperty(const nsAString& aUnknownProperty)
{
NS_ASSERTION(nsCSSProps::LookupProperty(aUnknownProperty,
nsCSSProps::eEnabled) ==
nsCSSProps::eEnabledForAllContent) ==
eCSSProperty_UNKNOWN,
"should be unknown property");
mProperty = eCSSProperty_UNKNOWN;

View File

@ -40,7 +40,8 @@ TestProps()
PL_strcpy(tagName, *et);
index = nsCSSProperty(int32_t(index) + 1);
id = nsCSSProps::LookupProperty(nsCString(tagName), nsCSSProps::eAny);
id = nsCSSProps::LookupProperty(nsCString(tagName),
nsCSSProps::eIgnoreEnabledState);
if (id == eCSSProperty_UNKNOWN) {
printf("bug: can't find '%s'\n", tagName);
success = false;
@ -55,7 +56,7 @@ TestProps()
tagName[0] = tagName[0] - 32;
}
id = nsCSSProps::LookupProperty(NS_ConvertASCIItoUTF16(tagName),
nsCSSProps::eAny);
nsCSSProps::eIgnoreEnabledState);
if (id < 0) {
printf("bug: can't find '%s'\n", tagName);
success = false;
@ -70,7 +71,8 @@ TestProps()
// Now make sure we don't find some garbage
for (int i = 0; i < (int) (sizeof(kJunkNames) / sizeof(const char*)); i++) {
const char* const tag = kJunkNames[i];
id = nsCSSProps::LookupProperty(nsAutoCString(tag), nsCSSProps::eAny);
id = nsCSSProps::LookupProperty(nsAutoCString(tag),
nsCSSProps::eIgnoreEnabledState);
if (id >= 0) {
printf("bug: found '%s'\n", tag ? tag : "(null)");
success = false;