merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-02-01 15:40:46 +01:00
Родитель e1fb61e725 e1cf33d34a
Коммит 60730a77d2
159 изменённых файлов: 2860 добавлений и 5583 удалений

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

@ -72,6 +72,7 @@ skip-if = buildapp == 'mulet'
[browser_bug655270.js] [browser_bug655270.js]
[browser_bug655273.js] [browser_bug655273.js]
[browser_bug670318.js] [browser_bug670318.js]
skip-if = (os == 'mac' && debug) # Bug 1241704
[browser_bug673467.js] [browser_bug673467.js]
[browser_bug852909.js] [browser_bug852909.js]
[browser_bug92473.js] [browser_bug92473.js]

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

@ -12,13 +12,15 @@
namespace mozilla { namespace mozilla {
TimingParams::TimingParams(const dom::AnimationEffectTimingProperties& aRhs) TimingParams::TimingParams(const dom::AnimationEffectTimingProperties& aRhs,
const dom::Element* aTarget)
: mDuration(aRhs.mDuration) : mDuration(aRhs.mDuration)
, mDelay(TimeDuration::FromMilliseconds(aRhs.mDelay)) , mDelay(TimeDuration::FromMilliseconds(aRhs.mDelay))
, mIterations(aRhs.mIterations) , mIterations(aRhs.mIterations)
, mDirection(aRhs.mDirection) , mDirection(aRhs.mDirection)
, mFill(aRhs.mFill) , mFill(aRhs.mFill)
{ {
mFunction = AnimationUtils::ParseEasing(aTarget, aRhs.mEasing);
} }
TimingParams::TimingParams(double aDuration) TimingParams::TimingParams(double aDuration)
@ -28,25 +30,27 @@ TimingParams::TimingParams(double aDuration)
/* static */ TimingParams /* static */ TimingParams
TimingParams::FromOptionsUnion( TimingParams::FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions) const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
const dom::Element* aTarget)
{ {
if (aOptions.IsUnrestrictedDouble()) { if (aOptions.IsUnrestrictedDouble()) {
return TimingParams(aOptions.GetAsUnrestrictedDouble()); return TimingParams(aOptions.GetAsUnrestrictedDouble());
} else { } else {
MOZ_ASSERT(aOptions.IsKeyframeEffectOptions()); MOZ_ASSERT(aOptions.IsKeyframeEffectOptions());
return TimingParams(aOptions.GetAsKeyframeEffectOptions()); return TimingParams(aOptions.GetAsKeyframeEffectOptions(), aTarget);
} }
} }
/* static */ TimingParams /* static */ TimingParams
TimingParams::FromOptionsUnion( TimingParams::FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions) const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
const dom::Element* aTarget)
{ {
if (aOptions.IsUnrestrictedDouble()) { if (aOptions.IsUnrestrictedDouble()) {
return TimingParams(aOptions.GetAsUnrestrictedDouble()); return TimingParams(aOptions.GetAsUnrestrictedDouble());
} else { } else {
MOZ_ASSERT(aOptions.IsKeyframeAnimationOptions()); MOZ_ASSERT(aOptions.IsKeyframeAnimationOptions());
return TimingParams(aOptions.GetAsKeyframeAnimationOptions()); return TimingParams(aOptions.GetAsKeyframeAnimationOptions(), aTarget);
} }
} }
@ -68,7 +72,8 @@ TimingParams::operator==(const TimingParams& aOther) const
mDelay == aOther.mDelay && mDelay == aOther.mDelay &&
mIterations == aOther.mIterations && mIterations == aOther.mIterations &&
mDirection == aOther.mDirection && mDirection == aOther.mDirection &&
mFill == aOther.mFill; mFill == aOther.mFill &&
mFunction == aOther.mFunction;
} }
namespace dom { namespace dom {
@ -84,5 +89,15 @@ AnimationEffectTimingReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*>
return AnimationEffectTimingReadOnlyBinding::Wrap(aCx, this, aGivenProto); return AnimationEffectTimingReadOnlyBinding::Wrap(aCx, this, aGivenProto);
} }
void
AnimationEffectTimingReadOnly::GetEasing(nsString& aRetVal) const
{
if (mTiming.mFunction.isSome()) {
mTiming.mFunction->AppendToString(aRetVal);
} else {
aRetVal.AssignLiteral("linear");
}
}
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla

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

@ -26,6 +26,7 @@ namespace mozilla {
namespace dom { namespace dom {
struct AnimationEffectTimingProperties; struct AnimationEffectTimingProperties;
class Element;
class UnrestrictedDoubleOrKeyframeEffectOptions; class UnrestrictedDoubleOrKeyframeEffectOptions;
class UnrestrictedDoubleOrKeyframeAnimationOptions; class UnrestrictedDoubleOrKeyframeAnimationOptions;
} }
@ -34,13 +35,16 @@ struct TimingParams
{ {
TimingParams() = default; TimingParams() = default;
explicit TimingParams( explicit TimingParams(
const dom::AnimationEffectTimingProperties& aTimingProperties); const dom::AnimationEffectTimingProperties& aTimingProperties,
const dom::Element* aTarget);
explicit TimingParams(double aDuration); explicit TimingParams(double aDuration);
static TimingParams FromOptionsUnion( static TimingParams FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions); const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
const dom::Element* aTarget);
static TimingParams FromOptionsUnion( static TimingParams FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions); const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
const dom::Element* aTarget);
// The unitialized state of mDuration represents "auto". // The unitialized state of mDuration represents "auto".
// Bug 1237173: We will replace this with Maybe<TimeDuration>. // Bug 1237173: We will replace this with Maybe<TimeDuration>.
@ -49,6 +53,7 @@ struct TimingParams
double mIterations = 1.0; // Can be NaN, negative, +/-Infinity double mIterations = 1.0; // Can be NaN, negative, +/-Infinity
dom::PlaybackDirection mDirection = dom::PlaybackDirection::Normal; dom::PlaybackDirection mDirection = dom::PlaybackDirection::Normal;
dom::FillMode mFill = dom::FillMode::Auto; dom::FillMode mFill = dom::FillMode::Auto;
Maybe<ComputedTimingFunction> mFunction;
bool operator==(const TimingParams& aOther) const; bool operator==(const TimingParams& aOther) const;
bool operator!=(const TimingParams& aOther) const bool operator!=(const TimingParams& aOther) const
@ -87,7 +92,7 @@ public:
aRetVal = mTiming.mDuration; aRetVal = mTiming.mDuration;
} }
PlaybackDirection Direction() const { return mTiming.mDirection; } PlaybackDirection Direction() const { return mTiming.mDirection; }
void GetEasing(nsString& aRetVal) const { aRetVal.AssignLiteral("linear"); } void GetEasing(nsString& aRetVal) const;
const TimingParams& AsTimingParams() const { return mTiming; } const TimingParams& AsTimingParams() const { return mTiming; }
void SetTimingParams(const TimingParams& aTiming) { mTiming = aTiming; } void SetTimingParams(const TimingParams& aTiming) { mTiming = aTiming; }

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

@ -6,10 +6,13 @@
#include "AnimationUtils.h" #include "AnimationUtils.h"
#include "nsCSSParser.h" // For nsCSSParser
#include "nsDebug.h" #include "nsDebug.h"
#include "nsIAtom.h" #include "nsIAtom.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsString.h" #include "nsString.h"
#include "mozilla/ComputedTimingFunction.h" // ComputedTimingFunction
#include "mozilla/dom/Element.h" // For dom::Element
namespace mozilla { namespace mozilla {
@ -33,4 +36,66 @@ AnimationUtils::LogAsyncAnimationFailure(nsCString& aMessage,
printf_stderr("%s", aMessage.get()); printf_stderr("%s", aMessage.get());
} }
/* static */ Maybe<ComputedTimingFunction>
AnimationUtils::ParseEasing(const dom::Element* aTarget,
const nsAString& aEasing)
{
if (!aTarget) {
return Nothing();
}
nsIDocument* doc = aTarget->OwnerDoc();
nsCSSValue value;
nsCSSParser parser;
parser.ParseLonghandProperty(eCSSProperty_animation_timing_function,
aEasing,
doc->GetDocumentURI(),
doc->GetDocumentURI(),
doc->NodePrincipal(),
value);
switch (value.GetUnit()) {
case eCSSUnit_List: {
const nsCSSValueList* list = value.GetListValue();
if (list->mNext) {
// don't support a list of timing functions
break;
}
switch (list->mValue.GetUnit()) {
case eCSSUnit_Enumerated:
// Return Nothing() if "linear" is passed in.
if (list->mValue.GetIntValue() ==
NS_STYLE_TRANSITION_TIMING_FUNCTION_LINEAR) {
return Nothing();
}
// Fall through
case eCSSUnit_Cubic_Bezier:
case eCSSUnit_Steps: {
nsTimingFunction timingFunction;
nsRuleNode::ComputeTimingFunction(list->mValue, timingFunction);
ComputedTimingFunction computedTimingFunction;
computedTimingFunction.Init(timingFunction);
return Some(computedTimingFunction);
}
default:
MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function list "
"item unit");
break;
}
break;
}
case eCSSUnit_Null:
case eCSSUnit_Inherit:
case eCSSUnit_Initial:
case eCSSUnit_Unset:
case eCSSUnit_TokenStream:
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function unit");
break;
}
return Nothing();
}
} // namespace mozilla } // namespace mozilla

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

@ -15,6 +15,12 @@ class nsIContent;
namespace mozilla { namespace mozilla {
class ComputedTimingFunction;
namespace dom {
class Element;
}
class AnimationUtils class AnimationUtils
{ {
public: public:
@ -44,6 +50,14 @@ public:
static void LogAsyncAnimationFailure(nsCString& aMessage, static void LogAsyncAnimationFailure(nsCString& aMessage,
const nsIContent* aContent = nullptr); const nsIContent* aContent = nullptr);
/**
* Parses a CSS <single-transition-timing-function> value from
* aEasing into a ComputedTimingFunction. If parsing fails, Nothing() will
* be returned.
*/
static Maybe<ComputedTimingFunction>
ParseEasing(const dom::Element* aTarget, const nsAString& aEasing);
}; };
} // namespace mozilla } // namespace mozilla

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

@ -96,4 +96,29 @@ ComputedTimingFunction::AppendToString(nsAString& aResult) const
} }
} }
/* static */ int32_t
ComputedTimingFunction::Compare(const Maybe<ComputedTimingFunction>& aLhs,
const Maybe<ComputedTimingFunction>& aRhs)
{
// We can't use |operator<| for const Maybe<>& here because
// 'ease' is prior to 'linear' which is represented by Nothing().
// So we have to convert Nothing() as 'linear' and check it first.
nsTimingFunction::Type lhsType = aLhs.isNothing() ?
nsTimingFunction::Type::Linear : aLhs->GetType();
nsTimingFunction::Type rhsType = aRhs.isNothing() ?
nsTimingFunction::Type::Linear : aRhs->GetType();
if (lhsType != rhsType) {
return int32_t(lhsType) - int32_t(rhsType);
}
// Both of them are Nothing().
if (lhsType == nsTimingFunction::Type::Linear) {
return 0;
}
// Other types.
return aLhs->Compare(aRhs.value());
}
} // namespace mozilla } // namespace mozilla

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

@ -41,6 +41,14 @@ public:
int32_t Compare(const ComputedTimingFunction& aRhs) const; int32_t Compare(const ComputedTimingFunction& aRhs) const;
void AppendToString(nsAString& aResult) const; void AppendToString(nsAString& aResult) const;
static double GetPortion(const Maybe<ComputedTimingFunction>& aFunction,
double aPortion)
{
return aFunction.isSome() ? aFunction->GetValue(aPortion) : aPortion;
}
static int32_t Compare(const Maybe<ComputedTimingFunction>& aLhs,
const Maybe<ComputedTimingFunction>& aRhs);
private: private:
nsTimingFunction::Type mType; nsTimingFunction::Type mType;
nsSMILKeySpline mTimingFunction; nsSMILKeySpline mTimingFunction;

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

@ -347,6 +347,11 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
result.mProgress.SetValue(1.0 - result.mProgress.Value()); result.mProgress.SetValue(1.0 - result.mProgress.Value());
} }
if (aTiming.mFunction) {
result.mProgress.SetValue(
aTiming.mFunction->GetValue(result.mProgress.Value()));
}
return result; return result;
} }
@ -539,7 +544,8 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
(computedTiming.mProgress.Value() - segment->mFromKey) / (computedTiming.mProgress.Value() - segment->mFromKey) /
(segment->mToKey - segment->mFromKey); (segment->mToKey - segment->mFromKey);
double valuePosition = double valuePosition =
segment->mTimingFunction.GetValue(positionInSegment); ComputedTimingFunction::GetPortion(segment->mTimingFunction,
positionInSegment);
StyleAnimationValue *val = aStyleRule->AddEmptyValue(prop.mProperty); StyleAnimationValue *val = aStyleRule->AddEmptyValue(prop.mProperty);
@ -677,7 +683,7 @@ enum class ValuePosition
struct OrderedKeyframeValueEntry : KeyframeValue struct OrderedKeyframeValueEntry : KeyframeValue
{ {
float mOffset; float mOffset;
const ComputedTimingFunction* mTimingFunction; const Maybe<ComputedTimingFunction>* mTimingFunction;
ValuePosition mPosition; ValuePosition mPosition;
bool SameKeyframe(const OrderedKeyframeValueEntry& aOther) const bool SameKeyframe(const OrderedKeyframeValueEntry& aOther) const
@ -712,7 +718,9 @@ struct OrderedKeyframeValueEntry : KeyframeValue
// Third, by easing. // Third, by easing.
if (aLhs.mTimingFunction) { if (aLhs.mTimingFunction) {
if (aRhs.mTimingFunction) { if (aRhs.mTimingFunction) {
int32_t order = aLhs.mTimingFunction->Compare(*aRhs.mTimingFunction); int32_t order =
ComputedTimingFunction::Compare(*aLhs.mTimingFunction,
*aRhs.mTimingFunction);
if (order != 0) { if (order != 0) {
return order < 0; return order < 0;
} }
@ -743,7 +751,7 @@ struct OrderedKeyframeValueEntry : KeyframeValue
struct KeyframeValueEntry : KeyframeValue struct KeyframeValueEntry : KeyframeValue
{ {
float mOffset; float mOffset;
ComputedTimingFunction mTimingFunction; Maybe<ComputedTimingFunction> mTimingFunction;
struct PropertyOffsetComparator struct PropertyOffsetComparator
{ {
@ -863,64 +871,6 @@ struct OffsetIndexedKeyframe
nsTArray<PropertyValuesPair> mPropertyValuePairs; nsTArray<PropertyValuesPair> mPropertyValuePairs;
}; };
/**
* Parses a CSS <single-transition-timing-function> value from
* aEasing into a ComputedTimingFunction. If parsing fails, aResult will
* be set to 'linear'.
*/
static void
ParseEasing(Element* aTarget,
const nsAString& aEasing,
ComputedTimingFunction& aResult)
{
nsIDocument* doc = aTarget->OwnerDoc();
nsCSSValue value;
nsCSSParser parser;
parser.ParseLonghandProperty(eCSSProperty_animation_timing_function,
aEasing,
doc->GetDocumentURI(),
doc->GetDocumentURI(),
doc->NodePrincipal(),
value);
switch (value.GetUnit()) {
case eCSSUnit_List: {
const nsCSSValueList* list = value.GetListValue();
if (list->mNext) {
// don't support a list of timing functions
break;
}
switch (list->mValue.GetUnit()) {
case eCSSUnit_Enumerated:
case eCSSUnit_Cubic_Bezier:
case eCSSUnit_Steps: {
nsTimingFunction timingFunction;
nsRuleNode::ComputeTimingFunction(list->mValue, timingFunction);
aResult.Init(timingFunction);
return;
}
default:
MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function list "
"item unit");
break;
}
break;
}
case eCSSUnit_Null:
case eCSSUnit_Inherit:
case eCSSUnit_Initial:
case eCSSUnit_Unset:
case eCSSUnit_TokenStream:
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function unit");
break;
}
aResult.Init(nsTimingFunction(NS_STYLE_TRANSITION_TIMING_FUNCTION_LINEAR));
}
/** /**
* An additional property (for a property-values pair) found on a Keyframe * An additional property (for a property-values pair) found on a Keyframe
* or PropertyIndexedKeyframes object. * or PropertyIndexedKeyframes object.
@ -1209,8 +1159,8 @@ GenerateValueEntries(Element* aTarget,
for (OffsetIndexedKeyframe& keyframe : aKeyframes) { for (OffsetIndexedKeyframe& keyframe : aKeyframes) {
float offset = float(keyframe.mKeyframeDict.mOffset.Value()); float offset = float(keyframe.mKeyframeDict.mOffset.Value());
ComputedTimingFunction easing; Maybe<ComputedTimingFunction> easing =
ParseEasing(aTarget, keyframe.mKeyframeDict.mEasing, easing); AnimationUtils::ParseEasing(aTarget, keyframe.mKeyframeDict.mEasing);
// We ignore keyframe.mKeyframeDict.mComposite since we don't support // We ignore keyframe.mKeyframeDict.mComposite since we don't support
// composite modes on keyframes yet. // composite modes on keyframes yet.
@ -1471,8 +1421,8 @@ BuildAnimationPropertyListFromPropertyIndexedKeyframes(
return; return;
} }
ComputedTimingFunction easing; Maybe<ComputedTimingFunction> easing =
ParseEasing(aTarget, keyframes.mEasing, easing); AnimationUtils::ParseEasing(aTarget, keyframes.mEasing);
// We ignore easing.mComposite since we don't support composite modes on // We ignore easing.mComposite since we don't support composite modes on
// keyframes yet. // keyframes yet.
@ -1739,8 +1689,8 @@ KeyframeEffectReadOnly::GetFrames(JSContext*& aCx,
entry->mProperty = property.mProperty; entry->mProperty = property.mProperty;
entry->mValue = segment.mToValue; entry->mValue = segment.mToValue;
entry->mOffset = segment.mToKey; entry->mOffset = segment.mToKey;
entry->mTimingFunction = entry->mTimingFunction = segment.mToKey == 1.0f ?
segment.mToKey == 1.0f ? nullptr : &segment.mTimingFunction; nullptr : &segment.mTimingFunction;
entry->mPosition = entry->mPosition =
segment.mFromKey == segment.mToKey && segment.mToKey == 1.0f ? segment.mFromKey == segment.mToKey && segment.mToKey == 1.0f ?
ValuePosition::Last : ValuePosition::Last :
@ -1759,10 +1709,10 @@ KeyframeEffectReadOnly::GetFrames(JSContext*& aCx,
ComputedKeyframe keyframeDict; ComputedKeyframe keyframeDict;
keyframeDict.mOffset.SetValue(entry->mOffset); keyframeDict.mOffset.SetValue(entry->mOffset);
keyframeDict.mComputedOffset.Construct(entry->mOffset); keyframeDict.mComputedOffset.Construct(entry->mOffset);
if (entry->mTimingFunction) { if (entry->mTimingFunction && entry->mTimingFunction->isSome()) {
// If null, leave easing as its default "linear". // If null, leave easing as its default "linear".
keyframeDict.mEasing.Truncate(); keyframeDict.mEasing.Truncate();
entry->mTimingFunction->AppendToString(keyframeDict.mEasing); entry->mTimingFunction->value().AppendToString(keyframeDict.mEasing);
} }
keyframeDict.mComposite.SetValue(CompositeOperation::Replace); keyframeDict.mComposite.SetValue(CompositeOperation::Replace);

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

@ -94,7 +94,7 @@ struct AnimationPropertySegment
{ {
float mFromKey, mToKey; float mFromKey, mToKey;
StyleAnimationValue mFromValue, mToValue; StyleAnimationValue mFromValue, mToValue;
ComputedTimingFunction mTimingFunction; Maybe<ComputedTimingFunction> mTimingFunction;
bool operator==(const AnimationPropertySegment& aOther) const { bool operator==(const AnimationPropertySegment& aOther) const {
return mFromKey == aOther.mFromKey && return mFromKey == aOther.mFromKey &&
@ -194,7 +194,8 @@ public:
ErrorResult& aRv) ErrorResult& aRv)
{ {
return Constructor(aGlobal, aTarget, aFrames, return Constructor(aGlobal, aTarget, aFrames,
TimingParams::FromOptionsUnion(aOptions), aRv); TimingParams::FromOptionsUnion(aOptions, aTarget),
aRv);
} }
// More generalized version for Animatable.animate. // More generalized version for Animatable.animate.

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

@ -1,14 +1,27 @@
[DEFAULT] [DEFAULT]
skip-if = buildapp == 'b2g' || os == 'android' skip-if = buildapp == 'b2g' || os == 'android'
support-files = support-files =
apps/*
asmjs/* asmjs/*
common.js common.js
cross_origin.html
file_bug_945152.html file_bug_945152.html
file_bug_945152.sjs file_bug_945152.sjs
head.js
install_and_redirect_helper.xul
[test_apps_service.xul] [test_apps_service.xul]
[test_bug_765063.xul]
[test_bug_771294.xul]
[test_bug_945152.html] [test_bug_945152.html]
skip-if = os != 'linux' skip-if = os != 'linux'
[test_cross_origin.xul]
[test_getNotInstalled.xul]
[test_install_app.xul]
[test_install_errors.xul]
[test_install_utf8.xul]
[test_launch_paths.xul]
[test_list_api.xul]
[test_manifest_helper.xul] [test_manifest_helper.xul]
[test_operator_app_install.js] [test_operator_app_install.js]
[test_operator_app_install.xul] [test_operator_app_install.xul]

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

@ -1,7 +1,7 @@
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.setAllAppsLaunchable(true);
var fileTestOnCurrentOrigin = 'http://example.org/tests/dom/tests/mochitest/webapps/file_bug_779982.html'; var fileTestOnCurrentOrigin = 'http://example.org/tests/dom/apps/tests/file_bug_779982.html';
var gData = [ var gData = [
// APP 1 // APP 1

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

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

@ -5,7 +5,7 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script> <script>
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/basic.webapp";
navigator.mozApps.install(url, null); navigator.mozApps.install(url, null);
document.location = "about:blank"; document.location = "about:blank";
</script> </script>

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

@ -10,6 +10,8 @@ support-files =
common.js common.js
file_app.sjs file_app.sjs
file_app.template.html file_app.template.html
file_bug_779982.html
file_bug_779982.js
file_script.template.js file_script.template.js
file_cached_app.template.appcache file_cached_app.template.appcache
file_cached_app.template.webapp file_cached_app.template.webapp
@ -43,6 +45,8 @@ skip-if = buildapp != 'mulet' # we need MOZ_B2G defined and the test to run in t
[test_app_enabled.html] [test_app_enabled.html]
[test_app_update.html] [test_app_update.html]
skip-if = os == "android" || toolkit == "gonk" || e10s # embed-apps doesn't work in mochitest app skip-if = os == "android" || toolkit == "gonk" || e10s # embed-apps doesn't work in mochitest app
[test_bug_779982.html]
skip-if = e10s || buildapp == 'b2g' || toolkit == 'android' #Bug 793211
[test_bug_795164.html] [test_bug_795164.html]
[test_bug_1168300.html] [test_bug_1168300.html]
skip-if = toolkit == "gonk" || e10s # see bug 1175784 skip-if = toolkit == "gonk" || e10s # see bug 1175784

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

@ -50,6 +50,6 @@ confirmNextPopup();
<!-- Load a page that initiates an app installation and then immediately <!-- Load a page that initiates an app installation and then immediately
- redirects to a page at a different origin. We can't do this directly - redirects to a page at a different origin. We can't do this directly
- inside this test page, because that would cause the test to hang. --> - inside this test page, because that would cause the test to hang. -->
<iframe src="http://test/chrome/dom/tests/mochitest/webapps/install_and_redirect_helper.xul"/> <iframe src="http://test/chrome/dom/apps/tests/install_and_redirect_helper.xul"/>
</window> </window>

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

@ -40,6 +40,6 @@ addEventListener("DOMContentLoaded", () => {
<!-- Load a page that initiates an app installation and then immediately <!-- Load a page that initiates an app installation and then immediately
- redirects to a page at a different origin. We can't do this directly - redirects to a page at a different origin. We can't do this directly
- inside this test page, because that would cause the test to hang. --> - inside this test page, because that would cause the test to hang. -->
<iframe id="iframe" src="http://test/chrome/dom/tests/mochitest/webapps/install_and_redirect_helper.xul"/> <iframe id="iframe" src="http://test/chrome/dom/apps/tests/install_and_redirect_helper.xul"/>
</window> </window>

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

@ -20,8 +20,8 @@
<script> <script>
var url1 = "http://test1.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; var url1 = "http://test1.example.com/chrome/dom/apps/tests/apps/basic.webapp";
var url2 = "http://test2.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; var url2 = "http://test2.example.com/chrome/dom/apps/tests/apps/basic.webapp";
// References to the apps we install, so we can uninstall them afterward. // References to the apps we install, so we can uninstall them afterward.
// Note that app2 is set by the helper page, which throws "TypeError: can't // Note that app2 is set by the helper page, which throws "TypeError: can't
@ -58,7 +58,7 @@ function installAppFromOwnOrigin(next) {
*/ */
function installAppFromOtherOrigin(next) { function installAppFromOtherOrigin(next) {
document.getElementById("iframe").setAttribute("src", document.getElementById("iframe").setAttribute("src",
"http://test2.example.com/chrome/dom/tests/mochitest/webapps/cross_origin.html"); "http://test2.example.com/chrome/dom/apps/tests/cross_origin.html");
window.addEventListener("message", function onMessage(event) { window.addEventListener("message", function onMessage(event) {
if (event.data == "next") { if (event.data == "next") {

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

@ -39,7 +39,7 @@ Cu.import("resource://gre/modules/Webapps.jsm");
// since then we can make this test install its own personal webapp from any // since then we can make this test install its own personal webapp from any
// origin. // origin.
// //
let url = "http://example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; let url = "http://example.com/chrome/dom/apps/tests/apps/basic.webapp";
let app, notInstalled, _isLaunchable; let app, notInstalled, _isLaunchable;

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

@ -21,7 +21,7 @@
<script> <script>
<![CDATA[ <![CDATA[
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/basic.webapp";
var app; var app;
var steps = [ var steps = [

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

@ -49,7 +49,7 @@ function noArgs(next) {
} }
function parseError(next) { function parseError(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/json_syntax_error.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/json_syntax_error.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "MANIFEST_PARSE_ERROR", "manifest with syntax error"); is(this.error.name, "MANIFEST_PARSE_ERROR", "manifest with syntax error");
@ -58,7 +58,7 @@ function parseError(next) {
} }
function invalidManifest(next) { function invalidManifest(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/missing_required_field.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/missing_required_field.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "manifest missing required field"); is(this.error.name, "INVALID_MANIFEST", "manifest missing required field");
@ -67,7 +67,7 @@ function invalidManifest(next) {
} }
function permissionDenied(next) { function permissionDenied(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/no_delegated_install.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/no_delegated_install.webapp";
confirmNextPopup(); confirmNextPopup();
var request = navigator.mozApps.install(url, null); var request = navigator.mozApps.install(url, null);
@ -87,7 +87,7 @@ function permissionDenied(next) {
} }
function invalidContent(next) { function invalidContent(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/bad_content_type.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/bad_content_type.webapp";
var request = navigator.mozApps.install(url, null); var request = navigator.mozApps.install(url, null);
@ -106,7 +106,7 @@ function invalidContent(next) {
} }
function invalidLaunchPath(next) { function invalidLaunchPath(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_launch_path.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/invalid_launch_path.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "Invalid Manifest"); is(this.error.name, "INVALID_MANIFEST", "Invalid Manifest");
@ -115,7 +115,7 @@ function invalidLaunchPath(next) {
} }
function invalidLaunchPath2(next) { function invalidLaunchPath2(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_launch_path2.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/invalid_launch_path2.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "Invalid Manifest"); is(this.error.name, "INVALID_MANIFEST", "Invalid Manifest");
@ -124,7 +124,7 @@ function invalidLaunchPath2(next) {
} }
function invalidEntryPoint(next) { function invalidEntryPoint(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_entry_point.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/invalid_entry_point.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "manifest missing required field"); is(this.error.name, "INVALID_MANIFEST", "manifest missing required field");
@ -133,7 +133,7 @@ function invalidEntryPoint(next) {
} }
function invalidLocaleEntryPoint(next) { function invalidLocaleEntryPoint(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_locale_entry_point.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/invalid_locale_entry_point.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "manifest missing required field"); is(this.error.name, "INVALID_MANIFEST", "manifest missing required field");
@ -142,7 +142,7 @@ function invalidLocaleEntryPoint(next) {
} }
function invalidActivityHref(next) { function invalidActivityHref(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_activity_href.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/invalid_activity_href.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has non-relative URI for activity href"); is(this.error.name, "INVALID_MANIFEST", "Manifest has non-relative URI for activity href");
@ -151,7 +151,7 @@ function invalidActivityHref(next) {
} }
function invalidActivityHref2(next) { function invalidActivityHref2(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_activity_href2.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/invalid_activity_href2.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has data: URI for activity href"); is(this.error.name, "INVALID_MANIFEST", "Manifest has data: URI for activity href");
@ -160,7 +160,7 @@ function invalidActivityHref2(next) {
} }
function invalidMessage(next) { function invalidMessage(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_message.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/invalid_message.webapp";
navigator.mozApps.install(url, null).onerror = function onInstallError() { navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has absolute message href"); is(this.error.name, "INVALID_MANIFEST", "Manifest has absolute message href");
@ -197,7 +197,7 @@ function fileURL(next) {
} }
function originNotAllowed(next) { function originNotAllowed(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/installs_allowed_from_example.com.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/installs_allowed_from_example.com.webapp";
var request = navigator.mozApps.install(url, null); var request = navigator.mozApps.install(url, null);
@ -216,7 +216,7 @@ function originNotAllowed(next) {
} }
function originAllowed(next) { function originAllowed(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/installs_allowed_from_chrome_mochitests.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/installs_allowed_from_chrome_mochitests.webapp";
confirmNextPopup(); confirmNextPopup();
var request = navigator.mozApps.install(url, null); var request = navigator.mozApps.install(url, null);

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

@ -20,7 +20,7 @@
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/utf8.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/utf8.webapp";
confirmNextPopup(); confirmNextPopup();
navigator.mozApps.install(url, null).onsuccess = function onInstall() { navigator.mozApps.install(url, null).onsuccess = function onInstall() {

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

@ -21,7 +21,7 @@
<script> <script>
<![CDATA[ <![CDATA[
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/launch_paths.webapp"; var url = "http://test/chrome/dom/apps/tests/apps/launch_paths.webapp";
var app; var app;
var steps = [ var steps = [

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

@ -3339,7 +3339,7 @@ Element::Animate(JSContext* aContext,
// Bug 1211783: Use KeyframeEffect here (instead of KeyframeEffectReadOnly) // Bug 1211783: Use KeyframeEffect here (instead of KeyframeEffectReadOnly)
RefPtr<KeyframeEffectReadOnly> effect = RefPtr<KeyframeEffectReadOnly> effect =
KeyframeEffectReadOnly::Constructor(global, this, frames, KeyframeEffectReadOnly::Constructor(global, this, frames,
TimingParams::FromOptionsUnion(aOptions), aError); TimingParams::FromOptionsUnion(aOptions, this), aError);
if (aError.Failed()) { if (aError.Failed()) {
return nullptr; return nullptr;
} }

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

@ -464,37 +464,6 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK; return NS_OK;
} }
struct TraceClosure
{
TraceClosure(JSTracer* aTrc, uint32_t aGCNumber)
: mTrc(aTrc), mGCNumber(aGCNumber)
{}
JSTracer* mTrc;
uint32_t mGCNumber;
};
static PLDHashOperator
TraceActiveWindowGlobal(const uint64_t& aId, nsGlobalWindow*& aWindow, void* aClosure)
{
if (aWindow->GetDocShell() && aWindow->IsOuterWindow()) {
TraceClosure* closure = static_cast<TraceClosure*>(aClosure);
aWindow->TraceGlobalJSObject(closure->mTrc);
EventListenerManager* elm = aWindow->GetExistingListenerManager();
if (elm) {
elm->TraceListeners(closure->mTrc);
}
#ifdef MOZ_XUL
nsIDocument* doc = aWindow->GetExtantDoc();
if (doc && doc->IsXULDocument()) {
XULDocument* xulDoc = static_cast<XULDocument*>(doc);
xulDoc->TraceProtos(closure->mTrc, closure->mGCNumber);
}
#endif
}
return PL_DHASH_NEXT;
}
void void
mozilla::dom::TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownGC) mozilla::dom::TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownGC)
{ {
@ -515,12 +484,27 @@ mozilla::dom::TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownG
return; return;
} }
TraceClosure closure(aTrc, aGCNumber);
// Mark globals of active windows black. // Mark globals of active windows black.
nsGlobalWindow::WindowByIdTable* windowsById = nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable(); nsGlobalWindow::GetWindowsTable();
if (windowsById) { if (windowsById) {
windowsById->Enumerate(TraceActiveWindowGlobal, &closure); for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
nsGlobalWindow* window = iter.Data();
if (window->GetDocShell() && window->IsOuterWindow()) {
window->TraceGlobalJSObject(aTrc);
EventListenerManager* elm = window->GetExistingListenerManager();
if (elm) {
elm->TraceListeners(aTrc);
}
#ifdef MOZ_XUL
nsIDocument* doc = window->GetExtantDoc();
if (doc && doc->IsXULDocument()) {
XULDocument* xulDoc = static_cast<XULDocument*>(doc);
xulDoc->TraceProtos(aTrc, aGCNumber);
}
#endif
}
}
} }
} }

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

@ -37,27 +37,18 @@ nsDOMAttributeMap::nsDOMAttributeMap(Element* aContent)
// we'll be told to drop our reference // we'll be told to drop our reference
} }
/**
* Clear map pointer for attributes.
*/
PLDHashOperator
RemoveMapRef(nsAttrHashKey::KeyType aKey, RefPtr<Attr>& aData,
void* aUserArg)
{
aData->SetMap(nullptr);
return PL_DHASH_REMOVE;
}
nsDOMAttributeMap::~nsDOMAttributeMap() nsDOMAttributeMap::~nsDOMAttributeMap()
{ {
mAttributeCache.Enumerate(RemoveMapRef, nullptr); DropReference();
} }
void void
nsDOMAttributeMap::DropReference() nsDOMAttributeMap::DropReference()
{ {
mAttributeCache.Enumerate(RemoveMapRef, nullptr); for (auto iter = mAttributeCache.Iter(); !iter.Done(); iter.Next()) {
iter.Data()->SetMap(nullptr);
iter.Remove();
}
mContent = nullptr; mContent = nullptr;
} }
@ -70,20 +61,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttributeMap)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_UNLINK_END
PLDHashOperator
TraverseMapEntry(nsAttrHashKey::KeyType aKey, RefPtr<Attr>& aData,
void* aUserArg)
{
nsCycleCollectionTraversalCallback *cb =
static_cast<nsCycleCollectionTraversalCallback*>(aUserArg);
cb->NoteXPCOMChild(static_cast<nsINode*>(aData.get()));
return PL_DHASH_NEXT;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttributeMap) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttributeMap)
tmp->mAttributeCache.Enumerate(TraverseMapEntry, &cb); for (auto iter = tmp->mAttributeCache.Iter(); !iter.Done(); iter.Next()) {
cb.NoteXPCOMChild(static_cast<nsINode*>(iter.Data().get()));
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContent) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

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

@ -1624,15 +1624,6 @@ nsMessageManagerScriptExecutor::DidCreateGlobal()
} }
} }
static PLDHashOperator
RemoveCachedScriptEntry(const nsAString& aKey,
nsMessageManagerScriptHolder*& aData,
void* aUserArg)
{
delete aData;
return PL_DHASH_REMOVE;
}
// static // static
void void
nsMessageManagerScriptExecutor::Shutdown() nsMessageManagerScriptExecutor::Shutdown()
@ -1640,7 +1631,10 @@ nsMessageManagerScriptExecutor::Shutdown()
if (sCachedScripts) { if (sCachedScripts) {
AutoSafeJSContext cx; AutoSafeJSContext cx;
NS_ASSERTION(sCachedScripts != nullptr, "Need cached scripts"); NS_ASSERTION(sCachedScripts != nullptr, "Need cached scripts");
sCachedScripts->Enumerate(RemoveCachedScriptEntry, nullptr); for (auto iter = sCachedScripts->Iter(); !iter.Done(); iter.Next()) {
delete iter.Data();
iter.Remove();
}
delete sCachedScripts; delete sCachedScripts;
sCachedScripts = nullptr; sCachedScripts = nullptr;

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

@ -1769,13 +1769,6 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTING_RELEASE(nsGlobalWindow)
static PLDHashOperator
MarkXBLHandlers(nsXBLPrototypeHandler* aKey, JS::Heap<JSObject*>& aData, void* aClosure)
{
JS::ExposeObjectToActiveJS(aData);
return PL_DHASH_NEXT;
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow)
if (tmp->IsBlackForCC(false)) { if (tmp->IsBlackForCC(false)) {
if (nsCCUncollectableMarker::InGeneration(tmp->mCanSkipCCGeneration)) { if (nsCCUncollectableMarker::InGeneration(tmp->mCanSkipCCGeneration)) {
@ -1783,7 +1776,11 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow)
} }
tmp->mCanSkipCCGeneration = nsCCUncollectableMarker::sGeneration; tmp->mCanSkipCCGeneration = nsCCUncollectableMarker::sGeneration;
if (tmp->mCachedXBLPrototypeHandlers) { if (tmp->mCachedXBLPrototypeHandlers) {
tmp->mCachedXBLPrototypeHandlers->Enumerate(MarkXBLHandlers, nullptr); for (auto iter = tmp->mCachedXBLPrototypeHandlers->Iter();
!iter.Done();
iter.Next()) {
JS::ExposeObjectToActiveJS(iter.Data());
}
} }
if (EventListenerManager* elm = tmp->GetExistingListenerManager()) { if (EventListenerManager* elm = tmp->GetExistingListenerManager()) {
elm->MarkForCC(); elm->MarkForCC();
@ -1979,24 +1976,14 @@ nsGlobalWindow::RiskyUnlink()
} }
#endif #endif
struct TraceData
{
const TraceCallbacks& callbacks;
void* closure;
};
static PLDHashOperator
TraceXBLHandlers(nsXBLPrototypeHandler* aKey, JS::Heap<JSObject*>& aData, void* aClosure)
{
TraceData* data = static_cast<TraceData*>(aClosure);
data->callbacks.Trace(&aData, "Cached XBL prototype handler", data->closure);
return PL_DHASH_NEXT;
}
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindow)
if (tmp->mCachedXBLPrototypeHandlers) { if (tmp->mCachedXBLPrototypeHandlers) {
TraceData data = { aCallbacks, aClosure }; for (auto iter = tmp->mCachedXBLPrototypeHandlers->Iter();
tmp->mCachedXBLPrototypeHandlers->Enumerate(TraceXBLHandlers, &data); !iter.Done();
iter.Next()) {
JS::Heap<JSObject*>& data = iter.Data();
aCallbacks.Trace(&data, "Cached XBL prototype handler", aClosure);
}
} }
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_IMPL_CYCLE_COLLECTION_TRACE_END

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

@ -180,11 +180,6 @@ public:
aConstructorEnabled); aConstructorEnabled);
} }
typedef PLDHashOperator
(* NameEnumerator)(const nsAString& aGlobalName,
const nsGlobalNameStruct& aGlobalNameStruct,
void* aClosure);
class NameIterator : public PLDHashTable::Iterator class NameIterator : public PLDHashTable::Iterator
{ {
public: public:

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

@ -444,15 +444,6 @@ CollectWindowReports(nsGlobalWindow *aWindow,
typedef nsTArray< RefPtr<nsGlobalWindow> > WindowArray; typedef nsTArray< RefPtr<nsGlobalWindow> > WindowArray;
static
PLDHashOperator
GetWindows(const uint64_t& aId, nsGlobalWindow*& aWindow, void* aClosure)
{
((WindowArray *)aClosure)->AppendElement(aWindow);
return PL_DHASH_NEXT;
}
NS_IMETHODIMP NS_IMETHODIMP
nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb, nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
nsISupports* aClosure, bool aAnonymize) nsISupports* aClosure, bool aAnonymize)
@ -464,7 +455,9 @@ nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
// Hold on to every window in memory so that window objects can't be // Hold on to every window in memory so that window objects can't be
// destroyed while we're calling the memory reporter callback. // destroyed while we're calling the memory reporter callback.
WindowArray windows; WindowArray windows;
windowsById->Enumerate(GetWindows, &windows); for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
windows.AppendElement(iter.Data());
}
// Get the IDs of all the "ghost" windows, and call aCb->Callback() for each // Get the IDs of all the "ghost" windows, and call aCb->Callback() for each
// one. // one.
@ -687,19 +680,6 @@ nsWindowMemoryReporter::AsyncCheckForGhostWindows()
} }
} }
static PLDHashOperator
BackdateTimeStampsEnumerator(nsISupports *aKey, TimeStamp &aTimeStamp,
void* aClosure)
{
TimeStamp *minTimeStamp = static_cast<TimeStamp*>(aClosure);
if (!aTimeStamp.IsNull() && aTimeStamp > *minTimeStamp) {
aTimeStamp = *minTimeStamp;
}
return PL_DHASH_NEXT;
}
void void
nsWindowMemoryReporter::ObserveAfterMinimizeMemoryUsage() nsWindowMemoryReporter::ObserveAfterMinimizeMemoryUsage()
{ {
@ -712,78 +692,12 @@ nsWindowMemoryReporter::ObserveAfterMinimizeMemoryUsage()
TimeStamp minTimeStamp = TimeStamp::Now() - TimeStamp minTimeStamp = TimeStamp::Now() -
TimeDuration::FromSeconds(GetGhostTimeout()); TimeDuration::FromSeconds(GetGhostTimeout());
mDetachedWindows.Enumerate(BackdateTimeStampsEnumerator, for (auto iter = mDetachedWindows.Iter(); !iter.Done(); iter.Next()) {
&minTimeStamp); TimeStamp& timeStamp = iter.Data();
} if (!timeStamp.IsNull() && timeStamp > minTimeStamp) {
timeStamp = minTimeStamp;
struct CheckForGhostWindowsEnumeratorData
{
nsTHashtable<nsCStringHashKey> *nonDetachedDomains;
nsTHashtable<nsUint64HashKey> *ghostWindowIDs;
nsIEffectiveTLDService *tldService;
uint32_t ghostTimeout;
TimeStamp now;
};
static PLDHashOperator
CheckForGhostWindowsEnumerator(nsISupports *aKey, TimeStamp& aTimeStamp,
void* aClosure)
{
CheckForGhostWindowsEnumeratorData *data =
static_cast<CheckForGhostWindowsEnumeratorData*>(aClosure);
nsWeakPtr weakKey = do_QueryInterface(aKey);
nsCOMPtr<mozIDOMWindow> iwindow = do_QueryReferent(weakKey);
if (!iwindow) {
// The window object has been destroyed. Stop tracking its weak ref in our
// hashtable.
return PL_DHASH_REMOVE;
}
nsPIDOMWindowInner* window = nsPIDOMWindowInner::From(iwindow);
// Avoid calling GetTop() if we have no outer window. Nothing will break if
// we do, but it will spew debug output, which can cause our test logs to
// overflow.
nsCOMPtr<nsPIDOMWindowOuter> top;
if (window->GetOuterWindow()) {
top = window->GetOuterWindow()->GetTop();
}
if (top) {
// The window is no longer detached, so we no longer want to track it.
return PL_DHASH_REMOVE;
}
nsCOMPtr<nsIURI> uri = GetWindowURI(nsGlobalWindow::Cast(window));
nsAutoCString domain;
if (uri) {
// GetBaseDomain works fine if |uri| is null, but it outputs a warning
// which ends up overrunning the mochitest logs.
data->tldService->GetBaseDomain(uri, 0, domain);
}
if (data->nonDetachedDomains->Contains(domain)) {
// This window shares a domain with a non-detached window, so reset its
// clock.
aTimeStamp = TimeStamp();
} else {
// This window does not share a domain with a non-detached window, so it
// meets ghost criterion (2).
if (aTimeStamp.IsNull()) {
// This may become a ghost window later; start its clock.
aTimeStamp = data->now;
} else if ((data->now - aTimeStamp).ToSeconds() > data->ghostTimeout) {
// This definitely is a ghost window, so add it to ghostWindowIDs, if
// that is not null.
if (data->ghostWindowIDs && window) {
data->ghostWindowIDs->PutEntry(window->WindowID());
}
} }
} }
return PL_DHASH_NEXT;
} }
/** /**
@ -846,11 +760,64 @@ nsWindowMemoryReporter::CheckForGhostWindows(
// Update mDetachedWindows and write the ghost window IDs into aOutGhostIDs, // Update mDetachedWindows and write the ghost window IDs into aOutGhostIDs,
// if it's not null. // if it's not null.
CheckForGhostWindowsEnumeratorData ghostEnumData = uint32_t ghostTimeout = GetGhostTimeout();
{ &nonDetachedWindowDomains, aOutGhostIDs, tldService, TimeStamp now = mLastCheckForGhostWindows;
GetGhostTimeout(), mLastCheckForGhostWindows }; for (auto iter = mDetachedWindows.Iter(); !iter.Done(); iter.Next()) {
mDetachedWindows.Enumerate(CheckForGhostWindowsEnumerator, nsWeakPtr weakKey = do_QueryInterface(iter.Key());
&ghostEnumData); nsCOMPtr<mozIDOMWindow> iwindow = do_QueryReferent(weakKey);
if (!iwindow) {
// The window object has been destroyed. Stop tracking its weak ref in
// our hashtable.
iter.Remove();
continue;
}
nsPIDOMWindowInner* window = nsPIDOMWindowInner::From(iwindow);
// Avoid calling GetTop() if we have no outer window. Nothing will break if
// we do, but it will spew debug output, which can cause our test logs to
// overflow.
nsCOMPtr<nsPIDOMWindowOuter> top;
if (window->GetOuterWindow()) {
top = window->GetOuterWindow()->GetTop();
}
if (top) {
// The window is no longer detached, so we no longer want to track it.
iter.Remove();
continue;
}
nsCOMPtr<nsIURI> uri = GetWindowURI(nsGlobalWindow::Cast(window));
nsAutoCString domain;
if (uri) {
// GetBaseDomain works fine if |uri| is null, but it outputs a warning
// which ends up overrunning the mochitest logs.
tldService->GetBaseDomain(uri, 0, domain);
}
TimeStamp& timeStamp = iter.Data();
if (nonDetachedWindowDomains.Contains(domain)) {
// This window shares a domain with a non-detached window, so reset its
// clock.
timeStamp = TimeStamp();
} else {
// This window does not share a domain with a non-detached window, so it
// meets ghost criterion (2).
if (timeStamp.IsNull()) {
// This may become a ghost window later; start its clock.
timeStamp = now;
} else if ((now - timeStamp).ToSeconds() > ghostTimeout) {
// This definitely is a ghost window, so add it to aOutGhostIDs, if
// that is not null.
if (aOutGhostIDs && window) {
aOutGhostIDs->PutEntry(window->WindowID());
}
}
}
}
} }
NS_IMPL_ISUPPORTS(nsWindowMemoryReporter::GhostWindowsReporter, NS_IMPL_ISUPPORTS(nsWindowMemoryReporter::GhostWindowsReporter,
@ -890,7 +857,9 @@ nsWindowMemoryReporter::UnlinkGhostWindows()
// Hold on to every window in memory so that window objects can't be // Hold on to every window in memory so that window objects can't be
// destroyed while we're calling the UnlinkGhostWindows callback. // destroyed while we're calling the UnlinkGhostWindows callback.
WindowArray windows; WindowArray windows;
windowsById->Enumerate(GetWindows, &windows); for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
windows.AppendElement(iter.Data());
}
// Get the IDs of all the "ghost" windows, and unlink them all. // Get the IDs of all the "ghost" windows, and unlink them all.
nsTHashtable<nsUint64HashKey> ghostWindows; nsTHashtable<nsUint64HashKey> ghostWindows;

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

@ -294,28 +294,25 @@ BluetoothService::UnregisterBluetoothSignalHandler(
} }
} }
PLDHashOperator
RemoveAllSignalHandlers(const nsAString& aKey,
nsAutoPtr<BluetoothSignalObserverList>& aData,
void* aUserArg)
{
BluetoothSignalObserver* handler =
static_cast<BluetoothSignalObserver*>(aUserArg);
aData->RemoveObserver(handler);
// We shouldn't have duplicate instances in the ObserverList, but there's
// no appropriate way to do duplication check while registering, so
// assertions are added here.
MOZ_ASSERT(!aData->RemoveObserver(handler));
return aData->Length() ? PL_DHASH_NEXT : PL_DHASH_REMOVE;
}
void void
BluetoothService::UnregisterAllSignalHandlers(BluetoothSignalObserver* aHandler) BluetoothService::UnregisterAllSignalHandlers(BluetoothSignalObserver* aHandler)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aHandler); MOZ_ASSERT(aHandler);
mBluetoothSignalObserverTable.Enumerate(RemoveAllSignalHandlers, aHandler); for (auto iter = mBluetoothSignalObserverTable.Iter();
!iter.Done();
iter.Next()) {
nsAutoPtr<BluetoothSignalObserverList>& ol = iter.Data();
ol->RemoveObserver(aHandler);
// We shouldn't have duplicate instances in the ObserverList, but there's
// no appropriate way to do duplication check while registering, so
// assertions are added here.
MOZ_ASSERT(!ol->RemoveObserver(aHandler));
if (ol->Length() == 0) {
iter.Remove();
}
}
} }
void void

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -67,7 +67,7 @@ class CanvasRenderingContext2D final :
public: public:
CanvasRenderingContext2D(); CanvasRenderingContext2D();
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override; virtual JSObject* WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
HTMLCanvasElement* GetCanvas() const HTMLCanvasElement* GetCanvas() const
{ {
@ -81,14 +81,14 @@ public:
void Save(); void Save();
void Restore(); void Restore();
void Scale(double x, double y, mozilla::ErrorResult& error); void Scale(double aX, double aY, mozilla::ErrorResult& aError);
void Rotate(double angle, mozilla::ErrorResult& error); void Rotate(double aAngle, mozilla::ErrorResult& aError);
void Translate(double x, double y, mozilla::ErrorResult& error); void Translate(double aX, double aY, mozilla::ErrorResult& aError);
void Transform(double m11, double m12, double m21, double m22, double dx, void Transform(double aM11, double aM12, double aM21, double aM22, double aDx,
double dy, mozilla::ErrorResult& error); double aDy, mozilla::ErrorResult& aError);
void SetTransform(double m11, double m12, double m21, double m22, double dx, void SetTransform(double aM11, double aM12, double aM21, double aM22, double aDx,
double dy, mozilla::ErrorResult& error); double aDy, mozilla::ErrorResult& aError);
void ResetTransform(mozilla::ErrorResult& error); void ResetTransform(mozilla::ErrorResult& aError);
double GlobalAlpha() double GlobalAlpha()
{ {
@ -98,54 +98,54 @@ public:
// Useful for silencing cast warnings // Useful for silencing cast warnings
static mozilla::gfx::Float ToFloat(double aValue) { return mozilla::gfx::Float(aValue); } static mozilla::gfx::Float ToFloat(double aValue) { return mozilla::gfx::Float(aValue); }
void SetGlobalAlpha(double globalAlpha) void SetGlobalAlpha(double aGlobalAlpha)
{ {
if (globalAlpha >= 0.0 && globalAlpha <= 1.0) { if (aGlobalAlpha >= 0.0 && aGlobalAlpha <= 1.0) {
CurrentState().globalAlpha = ToFloat(globalAlpha); CurrentState().globalAlpha = ToFloat(aGlobalAlpha);
} }
} }
void GetGlobalCompositeOperation(nsAString& op, mozilla::ErrorResult& error); void GetGlobalCompositeOperation(nsAString& aOp, mozilla::ErrorResult& aError);
void SetGlobalCompositeOperation(const nsAString& op, void SetGlobalCompositeOperation(const nsAString& aOp,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void GetStrokeStyle(OwningStringOrCanvasGradientOrCanvasPattern& value) void GetStrokeStyle(OwningStringOrCanvasGradientOrCanvasPattern& aValue)
{ {
GetStyleAsUnion(value, Style::STROKE); GetStyleAsUnion(aValue, Style::STROKE);
} }
void SetStrokeStyle(const StringOrCanvasGradientOrCanvasPattern& value) void SetStrokeStyle(const StringOrCanvasGradientOrCanvasPattern& aValue)
{ {
SetStyleFromUnion(value, Style::STROKE); SetStyleFromUnion(aValue, Style::STROKE);
} }
void GetFillStyle(OwningStringOrCanvasGradientOrCanvasPattern& value) void GetFillStyle(OwningStringOrCanvasGradientOrCanvasPattern& aValue)
{ {
GetStyleAsUnion(value, Style::FILL); GetStyleAsUnion(aValue, Style::FILL);
} }
void SetFillStyle(const StringOrCanvasGradientOrCanvasPattern& value) void SetFillStyle(const StringOrCanvasGradientOrCanvasPattern& aValue)
{ {
SetStyleFromUnion(value, Style::FILL); SetStyleFromUnion(aValue, Style::FILL);
} }
already_AddRefed<CanvasGradient> already_AddRefed<CanvasGradient>
CreateLinearGradient(double x0, double y0, double x1, double y1); CreateLinearGradient(double aX0, double aY0, double aX1, double aY1);
already_AddRefed<CanvasGradient> already_AddRefed<CanvasGradient>
CreateRadialGradient(double x0, double y0, double r0, double x1, double y1, CreateRadialGradient(double aX0, double aY0, double aR0, double aX1, double aY1,
double r1, ErrorResult& aError); double aR1, ErrorResult& aError);
already_AddRefed<CanvasPattern> already_AddRefed<CanvasPattern>
CreatePattern(const CanvasImageSource& element, CreatePattern(const CanvasImageSource& aElement,
const nsAString& repeat, ErrorResult& error); const nsAString& aRepeat, ErrorResult& aError);
double ShadowOffsetX() double ShadowOffsetX()
{ {
return CurrentState().shadowOffset.x; return CurrentState().shadowOffset.x;
} }
void SetShadowOffsetX(double shadowOffsetX) void SetShadowOffsetX(double aShadowOffsetX)
{ {
CurrentState().shadowOffset.x = ToFloat(shadowOffsetX); CurrentState().shadowOffset.x = ToFloat(aShadowOffsetX);
} }
double ShadowOffsetY() double ShadowOffsetY()
@ -153,9 +153,9 @@ public:
return CurrentState().shadowOffset.y; return CurrentState().shadowOffset.y;
} }
void SetShadowOffsetY(double shadowOffsetY) void SetShadowOffsetY(double aShadowOffsetY)
{ {
CurrentState().shadowOffset.y = ToFloat(shadowOffsetY); CurrentState().shadowOffset.y = ToFloat(aShadowOffsetY);
} }
double ShadowBlur() double ShadowBlur()
@ -163,128 +163,128 @@ public:
return CurrentState().shadowBlur; return CurrentState().shadowBlur;
} }
void SetShadowBlur(double shadowBlur) void SetShadowBlur(double aShadowBlur)
{ {
if (shadowBlur >= 0.0) { if (aShadowBlur >= 0.0) {
CurrentState().shadowBlur = ToFloat(shadowBlur); CurrentState().shadowBlur = ToFloat(aShadowBlur);
} }
} }
void GetShadowColor(nsAString& shadowColor) void GetShadowColor(nsAString& aShadowColor)
{ {
StyleColorToString(CurrentState().shadowColor, shadowColor); StyleColorToString(CurrentState().shadowColor, aShadowColor);
} }
void GetFilter(nsAString& filter) void GetFilter(nsAString& aFilter)
{ {
filter = CurrentState().filterString; aFilter = CurrentState().filterString;
} }
void SetShadowColor(const nsAString& shadowColor); void SetShadowColor(const nsAString& aShadowColor);
void SetFilter(const nsAString& filter, mozilla::ErrorResult& error); void SetFilter(const nsAString& aFilter, mozilla::ErrorResult& aError);
void ClearRect(double x, double y, double w, double h); void ClearRect(double aX, double aY, double aW, double aH);
void FillRect(double x, double y, double w, double h); void FillRect(double aX, double aY, double aW, double aH);
void StrokeRect(double x, double y, double w, double h); void StrokeRect(double aX, double aY, double aW, double aH);
void BeginPath(); void BeginPath();
void Fill(const CanvasWindingRule& winding); void Fill(const CanvasWindingRule& aWinding);
void Fill(const CanvasPath& path, const CanvasWindingRule& winding); void Fill(const CanvasPath& aPath, const CanvasWindingRule& aWinding);
void Stroke(); void Stroke();
void Stroke(const CanvasPath& path); void Stroke(const CanvasPath& aPath);
void DrawFocusIfNeeded(mozilla::dom::Element& element, ErrorResult& aRv); void DrawFocusIfNeeded(mozilla::dom::Element& aElement, ErrorResult& aRv);
bool DrawCustomFocusRing(mozilla::dom::Element& element); bool DrawCustomFocusRing(mozilla::dom::Element& aElement);
void Clip(const CanvasWindingRule& winding); void Clip(const CanvasWindingRule& aWinding);
void Clip(const CanvasPath& path, const CanvasWindingRule& winding); void Clip(const CanvasPath& aPath, const CanvasWindingRule& aWinding);
bool IsPointInPath(double x, double y, const CanvasWindingRule& winding); bool IsPointInPath(double aX, double aY, const CanvasWindingRule& aWinding);
bool IsPointInPath(const CanvasPath& path, double x, double y, const CanvasWindingRule& winding); bool IsPointInPath(const CanvasPath& aPath, double aX, double aY, const CanvasWindingRule& aWinding);
bool IsPointInStroke(double x, double y); bool IsPointInStroke(double aX, double aY);
bool IsPointInStroke(const CanvasPath& path, double x, double y); bool IsPointInStroke(const CanvasPath& aPath, double aX, double aY);
void FillText(const nsAString& text, double x, double y, void FillText(const nsAString& aText, double aX, double aY,
const Optional<double>& maxWidth, const Optional<double>& aMaxWidth,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void StrokeText(const nsAString& text, double x, double y, void StrokeText(const nsAString& aText, double aX, double aY,
const Optional<double>& maxWidth, const Optional<double>& aMaxWidth,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
TextMetrics* TextMetrics*
MeasureText(const nsAString& rawText, mozilla::ErrorResult& error); MeasureText(const nsAString& aRawText, mozilla::ErrorResult& aError);
void AddHitRegion(const HitRegionOptions& options, mozilla::ErrorResult& error); void AddHitRegion(const HitRegionOptions& aOptions, mozilla::ErrorResult& aError);
void RemoveHitRegion(const nsAString& id); void RemoveHitRegion(const nsAString& aId);
void ClearHitRegions(); void ClearHitRegions();
void DrawImage(const CanvasImageSource& image, void DrawImage(const CanvasImageSource& aImage,
double dx, double dy, mozilla::ErrorResult& error) double aDx, double aDy, mozilla::ErrorResult& aError)
{ {
DrawImage(image, 0.0, 0.0, 0.0, 0.0, dx, dy, 0.0, 0.0, 0, error); DrawImage(aImage, 0.0, 0.0, 0.0, 0.0, aDx, aDy, 0.0, 0.0, 0, aError);
} }
void DrawImage(const CanvasImageSource& image, void DrawImage(const CanvasImageSource& aImage,
double dx, double dy, double dw, double dh, double aDx, double aDy, double aDw, double aDh,
mozilla::ErrorResult& error) mozilla::ErrorResult& aError)
{ {
DrawImage(image, 0.0, 0.0, 0.0, 0.0, dx, dy, dw, dh, 2, error); DrawImage(aImage, 0.0, 0.0, 0.0, 0.0, aDx, aDy, aDw, aDh, 2, aError);
} }
void DrawImage(const CanvasImageSource& image, void DrawImage(const CanvasImageSource& aImage,
double sx, double sy, double sw, double sh, double dx, double aSx, double aSy, double aSw, double aSh, double aDx,
double dy, double dw, double dh, mozilla::ErrorResult& error) double aDy, double aDw, double aDh, mozilla::ErrorResult& aError)
{ {
DrawImage(image, sx, sy, sw, sh, dx, dy, dw, dh, 6, error); DrawImage(aImage, aSx, aSy, aSw, aSh, aDx, aDy, aDw, aDh, 6, aError);
} }
already_AddRefed<ImageData> already_AddRefed<ImageData>
CreateImageData(JSContext* cx, double sw, double sh, CreateImageData(JSContext* aCx, double aSw, double aSh,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
already_AddRefed<ImageData> already_AddRefed<ImageData>
CreateImageData(JSContext* cx, ImageData& imagedata, CreateImageData(JSContext* aCx, ImageData& aImagedata,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
already_AddRefed<ImageData> already_AddRefed<ImageData>
GetImageData(JSContext* cx, double sx, double sy, double sw, double sh, GetImageData(JSContext* aCx, double aSx, double aSy, double aSw, double aSh,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void PutImageData(ImageData& imageData, void PutImageData(ImageData& aImageData,
double dx, double dy, mozilla::ErrorResult& error); double aDx, double aDy, mozilla::ErrorResult& aError);
void PutImageData(ImageData& imageData, void PutImageData(ImageData& aImageData,
double dx, double dy, double dirtyX, double dirtyY, double aDx, double aDy, double aDirtyX, double aDirtyY,
double dirtyWidth, double dirtyHeight, double aDirtyWidth, double aDirtyHeight,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
double LineWidth() double LineWidth()
{ {
return CurrentState().lineWidth; return CurrentState().lineWidth;
} }
void SetLineWidth(double width) void SetLineWidth(double aWidth)
{ {
if (width > 0.0) { if (aWidth > 0.0) {
CurrentState().lineWidth = ToFloat(width); CurrentState().lineWidth = ToFloat(aWidth);
} }
} }
void GetLineCap(nsAString& linecap); void GetLineCap(nsAString& aLinecapStyle);
void SetLineCap(const nsAString& linecap); void SetLineCap(const nsAString& aLinecapStyle);
void GetLineJoin(nsAString& linejoin, mozilla::ErrorResult& error); void GetLineJoin(nsAString& aLinejoinStyle, mozilla::ErrorResult& aError);
void SetLineJoin(const nsAString& linejoin); void SetLineJoin(const nsAString& aLinejoinStyle);
double MiterLimit() double MiterLimit()
{ {
return CurrentState().miterLimit; return CurrentState().miterLimit;
} }
void SetMiterLimit(double miter) void SetMiterLimit(double aMiter)
{ {
if (miter > 0.0) { if (aMiter > 0.0) {
CurrentState().miterLimit = ToFloat(miter); CurrentState().miterLimit = ToFloat(aMiter);
} }
} }
void GetFont(nsAString& font) void GetFont(nsAString& aFont)
{ {
font = GetFont(); aFont = GetFont();
} }
void SetFont(const nsAString& font, mozilla::ErrorResult& error); void SetFont(const nsAString& aFont, mozilla::ErrorResult& aError);
void GetTextAlign(nsAString& textAlign); void GetTextAlign(nsAString& aTextAlign);
void SetTextAlign(const nsAString& textAlign); void SetTextAlign(const nsAString& aTextAlign);
void GetTextBaseline(nsAString& textBaseline); void GetTextBaseline(nsAString& aTextBaseline);
void SetTextBaseline(const nsAString& textBaseline); void SetTextBaseline(const nsAString& aTextBaseline);
void ClosePath() void ClosePath()
{ {
@ -297,97 +297,97 @@ public:
} }
} }
void MoveTo(double x, double y) void MoveTo(double aX, double aY)
{ {
EnsureWritablePath(); EnsureWritablePath();
if (mPathBuilder) { if (mPathBuilder) {
mPathBuilder->MoveTo(mozilla::gfx::Point(ToFloat(x), ToFloat(y))); mPathBuilder->MoveTo(mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
} else { } else {
mDSPathBuilder->MoveTo(mTarget->GetTransform() * mDSPathBuilder->MoveTo(mTarget->GetTransform() *
mozilla::gfx::Point(ToFloat(x), ToFloat(y))); mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
} }
} }
void LineTo(double x, double y) void LineTo(double aX, double aY)
{ {
EnsureWritablePath(); EnsureWritablePath();
LineTo(mozilla::gfx::Point(ToFloat(x), ToFloat(y))); LineTo(mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
} }
void QuadraticCurveTo(double cpx, double cpy, double x, double y) void QuadraticCurveTo(double aCpx, double aCpy, double aX, double aY)
{ {
EnsureWritablePath(); EnsureWritablePath();
if (mPathBuilder) { if (mPathBuilder) {
mPathBuilder->QuadraticBezierTo(mozilla::gfx::Point(ToFloat(cpx), ToFloat(cpy)), mPathBuilder->QuadraticBezierTo(mozilla::gfx::Point(ToFloat(aCpx), ToFloat(aCpy)),
mozilla::gfx::Point(ToFloat(x), ToFloat(y))); mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
} else { } else {
mozilla::gfx::Matrix transform = mTarget->GetTransform(); mozilla::gfx::Matrix transform = mTarget->GetTransform();
mDSPathBuilder->QuadraticBezierTo(transform * mDSPathBuilder->QuadraticBezierTo(transform *
mozilla::gfx::Point(ToFloat(cpx), ToFloat(cpy)), mozilla::gfx::Point(ToFloat(aCpx), ToFloat(aCpy)),
transform * transform *
mozilla::gfx::Point(ToFloat(x), ToFloat(y))); mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
} }
} }
void BezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y) void BezierCurveTo(double aCp1x, double aCp1y, double aCp2x, double aCp2y, double aX, double aY)
{ {
EnsureWritablePath(); EnsureWritablePath();
BezierTo(mozilla::gfx::Point(ToFloat(cp1x), ToFloat(cp1y)), BezierTo(mozilla::gfx::Point(ToFloat(aCp1x), ToFloat(aCp1y)),
mozilla::gfx::Point(ToFloat(cp2x), ToFloat(cp2y)), mozilla::gfx::Point(ToFloat(aCp2x), ToFloat(aCp2y)),
mozilla::gfx::Point(ToFloat(x), ToFloat(y))); mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
} }
void ArcTo(double x1, double y1, double x2, double y2, double radius, void ArcTo(double aX1, double aY1, double aX2, double aY2, double aRadius,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void Rect(double x, double y, double w, double h); void Rect(double aX, double aY, double aW, double aH);
void Arc(double x, double y, double radius, double startAngle, void Arc(double aX, double aY, double aRadius, double aStartAngle,
double endAngle, bool anticlockwise, mozilla::ErrorResult& error); double aEndAngle, bool aAnticlockwise, mozilla::ErrorResult& aError);
void GetMozCurrentTransform(JSContext* cx, void GetMozCurrentTransform(JSContext* aCx,
JS::MutableHandle<JSObject*> result, JS::MutableHandle<JSObject*> aResult,
mozilla::ErrorResult& error) const; mozilla::ErrorResult& aError) const;
void SetMozCurrentTransform(JSContext* cx, void SetMozCurrentTransform(JSContext* aCx,
JS::Handle<JSObject*> currentTransform, JS::Handle<JSObject*> aCurrentTransform,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void GetMozCurrentTransformInverse(JSContext* cx, void GetMozCurrentTransformInverse(JSContext* aCx,
JS::MutableHandle<JSObject*> result, JS::MutableHandle<JSObject*> aResult,
mozilla::ErrorResult& error) const; mozilla::ErrorResult& aError) const;
void SetMozCurrentTransformInverse(JSContext* cx, void SetMozCurrentTransformInverse(JSContext* aCx,
JS::Handle<JSObject*> currentTransform, JS::Handle<JSObject*> aCurrentTransform,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void GetFillRule(nsAString& fillRule); void GetFillRule(nsAString& aFillRule);
void SetFillRule(const nsAString& fillRule); void SetFillRule(const nsAString& aFillRule);
void GetMozDash(JSContext* cx, JS::MutableHandle<JS::Value> retval, void GetMozDash(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void SetMozDash(JSContext* cx, const JS::Value& mozDash, void SetMozDash(JSContext* aCx, const JS::Value& aMozDash,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void SetLineDash(const Sequence<double>& mSegments, void SetLineDash(const Sequence<double>& aSegments,
mozilla::ErrorResult& aRv); mozilla::ErrorResult& aRv);
void GetLineDash(nsTArray<double>& mSegments) const; void GetLineDash(nsTArray<double>& aSegments) const;
void SetLineDashOffset(double mOffset); void SetLineDashOffset(double aOffset);
double LineDashOffset() const; double LineDashOffset() const;
double MozDashOffset() double MozDashOffset()
{ {
return CurrentState().dashOffset; return CurrentState().dashOffset;
} }
void SetMozDashOffset(double mozDashOffset); void SetMozDashOffset(double aMozDashOffset);
void GetMozTextStyle(nsAString& mozTextStyle) void GetMozTextStyle(nsAString& aMozTextStyle)
{ {
GetFont(mozTextStyle); GetFont(aMozTextStyle);
} }
void SetMozTextStyle(const nsAString& mozTextStyle, void SetMozTextStyle(const nsAString& aMozTextStyle,
mozilla::ErrorResult& error) mozilla::ErrorResult& aError)
{ {
SetFont(mozTextStyle, error); SetFont(aMozTextStyle, aError);
} }
bool ImageSmoothingEnabled() bool ImageSmoothingEnabled()
@ -395,22 +395,22 @@ public:
return CurrentState().imageSmoothingEnabled; return CurrentState().imageSmoothingEnabled;
} }
void SetImageSmoothingEnabled(bool imageSmoothingEnabled) void SetImageSmoothingEnabled(bool aImageSmoothingEnabled)
{ {
if (imageSmoothingEnabled != CurrentState().imageSmoothingEnabled) { if (aImageSmoothingEnabled != CurrentState().imageSmoothingEnabled) {
CurrentState().imageSmoothingEnabled = imageSmoothingEnabled; CurrentState().imageSmoothingEnabled = aImageSmoothingEnabled;
} }
} }
void DrawWindow(nsGlobalWindow& window, double x, double y, void DrawWindow(nsGlobalWindow& aWindow, double aX, double aY,
double w, double h, double aW, double aH,
const nsAString& bgColor, uint32_t flags, const nsAString& aBgColor, uint32_t aFlags,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void DrawWidgetAsOnScreen(nsGlobalWindow& aWindow, void DrawWidgetAsOnScreen(nsGlobalWindow& aWindow,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
void AsyncDrawXULElement(nsXULElement& elem, double x, double y, double w, void AsyncDrawXULElement(nsXULElement& aElem, double aX, double aY, double aW,
double h, const nsAString& bgColor, uint32_t flags, double aH, const nsAString& aBgColor, uint32_t aFlags,
mozilla::ErrorResult& error); mozilla::ErrorResult& aError);
enum RenderingMode { enum RenderingMode {
SoftwareBackendMode, SoftwareBackendMode,
@ -441,12 +441,12 @@ public:
} }
return nullptr; return nullptr;
} }
NS_IMETHOD SetDimensions(int32_t width, int32_t height) override; NS_IMETHOD SetDimensions(int32_t aWidth, int32_t aHeight) override;
NS_IMETHOD InitializeWithSurface(nsIDocShell *shell, gfxASurface *surface, int32_t width, int32_t height) override; NS_IMETHOD InitializeWithSurface(nsIDocShell* aShell, gfxASurface* aSurface, int32_t aWidth, int32_t aHeight) override;
NS_IMETHOD GetInputStream(const char* aMimeType, NS_IMETHOD GetInputStream(const char* aMimeType,
const char16_t* aEncoderOptions, const char16_t* aEncoderOptions,
nsIInputStream **aStream) override; nsIInputStream** aStream) override;
already_AddRefed<mozilla::gfx::SourceSurface> GetSurfaceSnapshot(bool* aPremultAlpha = nullptr) override already_AddRefed<mozilla::gfx::SourceSurface> GetSurfaceSnapshot(bool* aPremultAlpha = nullptr) override
{ {
@ -457,21 +457,21 @@ public:
return mTarget->Snapshot(); return mTarget->Snapshot();
} }
NS_IMETHOD SetIsOpaque(bool isOpaque) override; NS_IMETHOD SetIsOpaque(bool aIsOpaque) override;
bool GetIsOpaque() override { return mOpaque; } bool GetIsOpaque() override { return mOpaque; }
NS_IMETHOD Reset() override; NS_IMETHOD Reset() override;
mozilla::layers::PersistentBufferProvider* GetBufferProvider(mozilla::layers::LayerManager* aManager); mozilla::layers::PersistentBufferProvider* GetBufferProvider(mozilla::layers::LayerManager* aManager);
already_AddRefed<Layer> GetCanvasLayer(nsDisplayListBuilder* aBuilder, already_AddRefed<Layer> GetCanvasLayer(nsDisplayListBuilder* aBuilder,
Layer *aOldLayer, Layer* aOldLayer,
LayerManager *aManager) override; LayerManager* aManager) override;
virtual bool ShouldForceInactiveLayer(LayerManager *aManager) override; virtual bool ShouldForceInactiveLayer(LayerManager* aManager) override;
void MarkContextClean() override; void MarkContextClean() override;
void MarkContextCleanForFrameCapture() override; void MarkContextCleanForFrameCapture() override;
bool IsContextCleanForFrameCapture() override; bool IsContextCleanForFrameCapture() override;
NS_IMETHOD SetIsIPC(bool isIPC) override; NS_IMETHOD SetIsIPC(bool aIsIPC) override;
// this rect is in canvas device space // this rect is in canvas device space
void Redraw(const mozilla::gfx::Rect &r); void Redraw(const mozilla::gfx::Rect& aR);
NS_IMETHOD Redraw(const gfxRect &r) override { Redraw(ToRect(r)); return NS_OK; } NS_IMETHOD Redraw(const gfxRect& aR) override { Redraw(ToRect(aR)); return NS_OK; }
NS_IMETHOD SetContextOptions(JSContext* aCx, NS_IMETHOD SetContextOptions(JSContext* aCx,
JS::Handle<JS::Value> aOptions, JS::Handle<JS::Value> aOptions,
ErrorResult& aRvForDictionaryInit) override; ErrorResult& aRvForDictionaryInit) override;
@ -484,7 +484,7 @@ public:
virtual void DidRefresh() override; virtual void DidRefresh() override;
// this rect is in mTarget's current user space // this rect is in mTarget's current user space
void RedrawUser(const gfxRect &r); void RedrawUser(const gfxRect& aR);
// nsISupports interface + CC // nsISupports interface + CC
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -548,18 +548,18 @@ protected:
uint32_t aWidth, uint32_t aHeight, uint32_t aWidth, uint32_t aHeight,
JSObject** aRetval); JSObject** aRetval);
nsresult PutImageData_explicit(int32_t x, int32_t y, uint32_t w, uint32_t h, nsresult PutImageData_explicit(int32_t aX, int32_t aY, uint32_t aW, uint32_t aH,
dom::Uint8ClampedArray* aArray, dom::Uint8ClampedArray* aArray,
bool hasDirtyRect, int32_t dirtyX, int32_t dirtyY, bool aHasDirtyRect, int32_t aDirtyX, int32_t aDirtyY,
int32_t dirtyWidth, int32_t dirtyHeight); int32_t aDirtyWidth, int32_t aDirtyHeight);
/** /**
* Internal method to complete initialisation, expects mTarget to have been set * Internal method to complete initialisation, expects mTarget to have been set
*/ */
nsresult Initialize(int32_t width, int32_t height); nsresult Initialize(int32_t aWidth, int32_t aHeight);
nsresult InitializeWithTarget(mozilla::gfx::DrawTarget *surface, nsresult InitializeWithTarget(mozilla::gfx::DrawTarget* aSurface,
int32_t width, int32_t height); int32_t aWidth, int32_t aHeight);
/** /**
* The number of living nsCanvasRenderingContexts. When this goes down to * The number of living nsCanvasRenderingContexts. When this goes down to
@ -580,18 +580,18 @@ protected:
static mozilla::gfx::DrawTarget* sErrorTarget; static mozilla::gfx::DrawTarget* sErrorTarget;
// Some helpers. Doesn't modify a color on failure. // Some helpers. Doesn't modify a color on failure.
void SetStyleFromUnion(const StringOrCanvasGradientOrCanvasPattern& value, void SetStyleFromUnion(const StringOrCanvasGradientOrCanvasPattern& aValue,
Style whichStyle); Style aWhichStyle);
void SetStyleFromString(const nsAString& str, Style whichStyle); void SetStyleFromString(const nsAString& aStr, Style aWhichStyle);
void SetStyleFromGradient(CanvasGradient& gradient, Style whichStyle) void SetStyleFromGradient(CanvasGradient& aGradient, Style aWhichStyle)
{ {
CurrentState().SetGradientStyle(whichStyle, &gradient); CurrentState().SetGradientStyle(aWhichStyle, &aGradient);
} }
void SetStyleFromPattern(CanvasPattern& pattern, Style whichStyle) void SetStyleFromPattern(CanvasPattern& aPattern, Style aWhichStyle)
{ {
CurrentState().SetPatternStyle(whichStyle, &pattern); CurrentState().SetPatternStyle(aWhichStyle, &aPattern);
} }
void GetStyleAsUnion(OwningStringOrCanvasGradientOrCanvasPattern& aValue, void GetStyleAsUnion(OwningStringOrCanvasGradientOrCanvasPattern& aValue,
@ -605,10 +605,10 @@ protected:
// Returns whether a filter was successfully parsed. // Returns whether a filter was successfully parsed.
bool ParseFilter(const nsAString& aString, bool ParseFilter(const nsAString& aString,
nsTArray<nsStyleFilter>& aFilterChain, nsTArray<nsStyleFilter>& aFilterChain,
ErrorResult& error); ErrorResult& aError);
// Returns whether the font was successfully updated. // Returns whether the font was successfully updated.
bool SetFontInternal(const nsAString& font, mozilla::ErrorResult& error); bool SetFontInternal(const nsAString& aFont, mozilla::ErrorResult& aError);
/** /**
@ -624,7 +624,7 @@ protected:
void EnsureWritablePath(); void EnsureWritablePath();
// Ensures a path in UserSpace is available. // Ensures a path in UserSpace is available.
void EnsureUserSpacePath(const CanvasWindingRule& winding = CanvasWindingRule::Nonzero); void EnsureUserSpacePath(const CanvasWindingRule& aWinding = CanvasWindingRule::Nonzero);
/** /**
* Needs to be called before updating the transform. This makes a call to * Needs to be called before updating the transform. This makes a call to
@ -678,16 +678,16 @@ protected:
nsLayoutUtils::SurfaceFromElementResult nsLayoutUtils::SurfaceFromElementResult
CachedSurfaceFromElement(Element* aElement); CachedSurfaceFromElement(Element* aElement);
void DrawImage(const CanvasImageSource &imgElt, void DrawImage(const CanvasImageSource& aImgElt,
double sx, double sy, double sw, double sh, double aSx, double aSy, double aSw, double aSh,
double dx, double dy, double dw, double dh, double aDx, double aDy, double aDw, double aDh,
uint8_t optional_argc, mozilla::ErrorResult& error); uint8_t aOptional_argc, mozilla::ErrorResult& aError);
void DrawDirectlyToCanvas(const nsLayoutUtils::DirectDrawInfo& image, void DrawDirectlyToCanvas(const nsLayoutUtils::DirectDrawInfo& aImage,
mozilla::gfx::Rect* bounds, mozilla::gfx::Rect* aBounds,
mozilla::gfx::Rect dest, mozilla::gfx::Rect aDest,
mozilla::gfx::Rect src, mozilla::gfx::Rect aSrc,
gfx::IntSize imgSize); gfx::IntSize aImgSize);
nsString& GetFont() nsString& GetFont()
{ {
@ -703,8 +703,8 @@ protected:
static std::vector<CanvasRenderingContext2D*>& DemotableContexts(); static std::vector<CanvasRenderingContext2D*>& DemotableContexts();
static void DemoteOldestContextIfNecessary(); static void DemoteOldestContextIfNecessary();
static void AddDemotableContext(CanvasRenderingContext2D* context); static void AddDemotableContext(CanvasRenderingContext2D* aContext);
static void RemoveDemotableContext(CanvasRenderingContext2D* context); static void RemoveDemotableContext(CanvasRenderingContext2D* aContext);
RenderingMode mRenderingMode; RenderingMode mRenderingMode;
@ -895,14 +895,14 @@ protected:
* Implementation of the fillText, strokeText, and measure functions with * Implementation of the fillText, strokeText, and measure functions with
* the operation abstracted to a flag. * the operation abstracted to a flag.
*/ */
nsresult DrawOrMeasureText(const nsAString& text, nsresult DrawOrMeasureText(const nsAString& aText,
float x, float aX,
float y, float aY,
const Optional<double>& maxWidth, const Optional<double>& aMaxWidth,
TextDrawOperation op, TextDrawOperation aOp,
float* aWidth); float* aWidth);
bool CheckSizeForSkiaGL(mozilla::gfx::IntSize size); bool CheckSizeForSkiaGL(mozilla::gfx::IntSize aSize);
// state stack handling // state stack handling
class ContextState { class ContextState {
@ -924,63 +924,63 @@ protected:
fontExplicitLanguage(false) fontExplicitLanguage(false)
{ } { }
ContextState(const ContextState& other) ContextState(const ContextState& aOther)
: fontGroup(other.fontGroup), : fontGroup(aOther.fontGroup),
fontLanguage(other.fontLanguage), fontLanguage(aOther.fontLanguage),
fontFont(other.fontFont), fontFont(aOther.fontFont),
gradientStyles(other.gradientStyles), gradientStyles(aOther.gradientStyles),
patternStyles(other.patternStyles), patternStyles(aOther.patternStyles),
colorStyles(other.colorStyles), colorStyles(aOther.colorStyles),
font(other.font), font(aOther.font),
textAlign(other.textAlign), textAlign(aOther.textAlign),
textBaseline(other.textBaseline), textBaseline(aOther.textBaseline),
shadowColor(other.shadowColor), shadowColor(aOther.shadowColor),
transform(other.transform), transform(aOther.transform),
shadowOffset(other.shadowOffset), shadowOffset(aOther.shadowOffset),
lineWidth(other.lineWidth), lineWidth(aOther.lineWidth),
miterLimit(other.miterLimit), miterLimit(aOther.miterLimit),
globalAlpha(other.globalAlpha), globalAlpha(aOther.globalAlpha),
shadowBlur(other.shadowBlur), shadowBlur(aOther.shadowBlur),
dash(other.dash), dash(aOther.dash),
dashOffset(other.dashOffset), dashOffset(aOther.dashOffset),
op(other.op), op(aOther.op),
fillRule(other.fillRule), fillRule(aOther.fillRule),
lineCap(other.lineCap), lineCap(aOther.lineCap),
lineJoin(other.lineJoin), lineJoin(aOther.lineJoin),
filterString(other.filterString), filterString(aOther.filterString),
filterChain(other.filterChain), filterChain(aOther.filterChain),
filterChainObserver(other.filterChainObserver), filterChainObserver(aOther.filterChainObserver),
filter(other.filter), filter(aOther.filter),
filterAdditionalImages(other.filterAdditionalImages), filterAdditionalImages(aOther.filterAdditionalImages),
imageSmoothingEnabled(other.imageSmoothingEnabled), imageSmoothingEnabled(aOther.imageSmoothingEnabled),
fontExplicitLanguage(other.fontExplicitLanguage) fontExplicitLanguage(aOther.fontExplicitLanguage)
{ } { }
void SetColorStyle(Style whichStyle, nscolor color) void SetColorStyle(Style aWhichStyle, nscolor aColor)
{ {
colorStyles[whichStyle] = color; colorStyles[aWhichStyle] = aColor;
gradientStyles[whichStyle] = nullptr; gradientStyles[aWhichStyle] = nullptr;
patternStyles[whichStyle] = nullptr; patternStyles[aWhichStyle] = nullptr;
} }
void SetPatternStyle(Style whichStyle, CanvasPattern* pat) void SetPatternStyle(Style aWhichStyle, CanvasPattern* aPat)
{ {
gradientStyles[whichStyle] = nullptr; gradientStyles[aWhichStyle] = nullptr;
patternStyles[whichStyle] = pat; patternStyles[aWhichStyle] = aPat;
} }
void SetGradientStyle(Style whichStyle, CanvasGradient* grad) void SetGradientStyle(Style aWhichStyle, CanvasGradient* aGrad)
{ {
gradientStyles[whichStyle] = grad; gradientStyles[aWhichStyle] = aGrad;
patternStyles[whichStyle] = nullptr; patternStyles[aWhichStyle] = nullptr;
} }
/** /**
* returns true iff the given style is a solid color. * returns true iff the given style is a solid color.
*/ */
bool StyleIsColor(Style whichStyle) const bool StyleIsColor(Style aWhichStyle) const
{ {
return !(patternStyles[whichStyle] || gradientStyles[whichStyle]); return !(patternStyles[aWhichStyle] || gradientStyles[aWhichStyle]);
} }
int32_t ShadowBlurRadius() const int32_t ShadowBlurRadius() const
@ -1051,7 +1051,7 @@ protected:
friend class AdjustedTargetForFilter; friend class AdjustedTargetForFilter;
// other helpers // other helpers
void GetAppUnitsValues(int32_t *perDevPixel, int32_t *perCSSPixel) void GetAppUnitsValues(int32_t* aPerDevPixel, int32_t* aPerCSSPixel)
{ {
// If we don't have a canvas element, we just return something generic. // If we don't have a canvas element, we just return something generic.
int32_t devPixel = 60; int32_t devPixel = 60;
@ -1067,10 +1067,10 @@ protected:
cssPixel = pc->AppUnitsPerCSSPixel(); cssPixel = pc->AppUnitsPerCSSPixel();
FINISH: FINISH:
if (perDevPixel) if (aPerDevPixel)
*perDevPixel = devPixel; *aPerDevPixel = devPixel;
if (perCSSPixel) if (aPerCSSPixel)
*perCSSPixel = cssPixel; *aPerCSSPixel = cssPixel;
} }
friend struct CanvasBidiProcessor; friend struct CanvasBidiProcessor;

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

@ -847,11 +847,10 @@ WebGLFramebuffer::PrecheckFramebufferStatus(nsCString* const out_info) const
if (HasIncompleteAttachments(out_info)) if (HasIncompleteAttachments(out_info))
return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
if (!mContext->IsWebGL2()) { if (!AllImageRectsMatch())
// INCOMPLETE_DIMENSIONS doesn't exist in GLES3. return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; // Inconsistent sizes
if (!AllImageRectsMatch())
return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; // Inconsistent sizes
if (!mContext->IsWebGL2()) {
const auto depthOrStencilCount = int(mDepthAttachment.IsDefined()) + const auto depthOrStencilCount = int(mDepthAttachment.IsDefined()) +
int(mStencilAttachment.IsDefined()) + int(mStencilAttachment.IsDefined()) +
int(mDepthStencilAttachment.IsDefined()); int(mDepthStencilAttachment.IsDefined());

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

@ -150,16 +150,16 @@ WebGLContext::CreateShaderValidator(GLenum shaderType) const
resources.MaxFragmentUniformVectors = mGLMaxFragmentUniformVectors; resources.MaxFragmentUniformVectors = mGLMaxFragmentUniformVectors;
resources.MaxDrawBuffers = mGLMaxDrawBuffers; resources.MaxDrawBuffers = mGLMaxDrawBuffers;
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::EXT_frag_depth)) if (IsExtensionEnabled(WebGLExtensionID::EXT_frag_depth))
resources.EXT_frag_depth = 1; resources.EXT_frag_depth = 1;
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::OES_standard_derivatives)) if (IsExtensionEnabled(WebGLExtensionID::OES_standard_derivatives))
resources.OES_standard_derivatives = 1; resources.OES_standard_derivatives = 1;
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::WEBGL_draw_buffers)) if (IsExtensionEnabled(WebGLExtensionID::WEBGL_draw_buffers))
resources.EXT_draw_buffers = 1; resources.EXT_draw_buffers = 1;
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::EXT_shader_texture_lod)) if (IsExtensionEnabled(WebGLExtensionID::EXT_shader_texture_lod))
resources.EXT_shader_texture_lod = 1; resources.EXT_shader_texture_lod = 1;
// Tell ANGLE to allow highp in frag shaders. (unless disabled) // Tell ANGLE to allow highp in frag shaders. (unless disabled)

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

@ -923,8 +923,8 @@ Event::GetScreenCoords(nsPresContext* aPresContext,
nsPoint pt = nsPoint pt =
LayoutDevicePixel::ToAppUnits(aPoint, aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom()); LayoutDevicePixel::ToAppUnits(aPoint, aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
if (aPresContext->PresShell()) { if (nsIPresShell* ps = aPresContext->GetPresShell()) {
pt = pt.RemoveResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(aPresContext->PresShell())); pt = pt.RemoveResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(ps));
} }
pt += LayoutDevicePixel::ToAppUnits(guiEvent->widget->WidgetToScreenOffset(), pt += LayoutDevicePixel::ToAppUnits(guiEvent->widget->WidgetToScreenOffset(),

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

@ -5030,19 +5030,17 @@ EventStateManager::SetContentState(nsIContent* aContent, EventStates aState)
return true; return true;
} }
PLDHashOperator void
EventStateManager::ResetLastOverForContent( EventStateManager::ResetLastOverForContent(
const uint32_t& aIdx, const uint32_t& aIdx,
RefPtr<OverOutElementsWrapper>& aElemWrapper, RefPtr<OverOutElementsWrapper>& aElemWrapper,
void* aClosure) nsIContent* aContent)
{ {
nsIContent* content = static_cast<nsIContent*>(aClosure);
if (aElemWrapper && aElemWrapper->mLastOverElement && if (aElemWrapper && aElemWrapper->mLastOverElement &&
nsContentUtils::ContentIsDescendantOf(aElemWrapper->mLastOverElement, content)) { nsContentUtils::ContentIsDescendantOf(aElemWrapper->mLastOverElement,
aContent)) {
aElemWrapper->mLastOverElement = nullptr; aElemWrapper->mLastOverElement = nullptr;
} }
return PL_DHASH_NEXT;
} }
void void
@ -5091,8 +5089,11 @@ EventStateManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent)
// See bug 292146 for why we want to null this out // See bug 292146 for why we want to null this out
ResetLastOverForContent(0, mMouseEnterLeaveHelper, aContent); ResetLastOverForContent(0, mMouseEnterLeaveHelper, aContent);
mPointersEnterLeaveHelper.Enumerate( for (auto iter = mPointersEnterLeaveHelper.Iter();
&EventStateManager::ResetLastOverForContent, aContent); !iter.Done();
iter.Next()) {
ResetLastOverForContent(iter.Key(), iter.Data(), aContent);
}
} }
bool bool

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

@ -875,9 +875,9 @@ private:
nsIContent* aStopBefore, nsIContent* aStopBefore,
EventStates aState, EventStates aState,
bool aAddState); bool aAddState);
static PLDHashOperator ResetLastOverForContent(const uint32_t& aIdx, static void ResetLastOverForContent(const uint32_t& aIdx,
RefPtr<OverOutElementsWrapper>& aChunk, RefPtr<OverOutElementsWrapper>& aChunk,
void* aClosure); nsIContent* aClosure);
void PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent, void PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent,
nsEventStatus& aStatus, nsEventStatus& aStatus,
bool dispatchedToContentProcess); bool dispatchedToContentProcess);

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

@ -1277,7 +1277,8 @@ Geolocation::Init(nsPIDOMWindowInner* aContentDom)
mPrincipal = doc->NodePrincipal(); mPrincipal = doc->NodePrincipal();
if (XRE_IsContentProcess()) { if (Preferences::GetBool("dom.wakelock.enabled") &&
XRE_IsContentProcess()) {
doc->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"), doc->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
/* listener */ this, /* listener */ this,
/* use capture */ true, /* use capture */ true,
@ -1380,7 +1381,8 @@ Geolocation::Shutdown()
mPendingCallbacks.Clear(); mPendingCallbacks.Clear();
mWatchingCallbacks.Clear(); mWatchingCallbacks.Clear();
if (XRE_IsContentProcess()) { if (Preferences::GetBool("dom.wakelock.enabled") &&
XRE_IsContentProcess()) {
if (nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mOwner)) { if (nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mOwner)) {
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc(); nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
if (doc) { if (doc) {

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

@ -1206,11 +1206,6 @@ protected:
// Current audio volume // Current audio volume
double mVolume; double mVolume;
// Helper function to iterate over a hash table
// and convert it to a JSObject.
static PLDHashOperator BuildObjectFromTags(nsCStringHashKey::KeyType aKey,
nsCString aValue,
void* aUserArg);
nsAutoPtr<const MetadataTags> mTags; nsAutoPtr<const MetadataTags> mTags;
// URI of the resource we're attempting to load. This stores the value we // URI of the resource we're attempting to load. This stores the value we

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

@ -17603,7 +17603,7 @@ QuotaClient::DetermineMaintenanceAction(mozIStorageConnection* aConnection,
return rv; return rv;
} }
MOZ_ASSERT(lastVacuumSize > 0); NS_ASSERTION(lastVacuumSize > 0, "Thy last vacuum size shall be greater than zero, less than zero shall thy last vacuum size not be. Zero is right out.");
// This shouldn't really be possible... // This shouldn't really be possible...
if (NS_WARN_IF(mMaintenanceStartTime <= lastVacuumTime)) { if (NS_WARN_IF(mMaintenanceStartTime <= lastVacuumTime)) {

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

@ -1643,7 +1643,7 @@ MediaDecoderStateMachine::InitiateSeek()
// Do the seek. // Do the seek.
RefPtr<MediaDecoderStateMachine> self = this; RefPtr<MediaDecoderStateMachine> self = this;
mSeekRequest.Begin(InvokeAsync(DecodeTaskQueue(), mReader.get(), __func__, mSeekRequest.Begin(InvokeAsync(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::Seek, mCurrentSeek.mTarget.mTime, &MediaDecoderReader::Seek, mCurrentSeek.mTarget.mTime + StartTime(),
Duration().ToMicroseconds()) Duration().ToMicroseconds())
->Then(OwnerThread(), __func__, ->Then(OwnerThread(), __func__,
[self] (int64_t) -> void { [self] (int64_t) -> void {

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

@ -14,7 +14,6 @@
#include "AudioSegment.h" #include "AudioSegment.h"
#include "GonkNativeWindow.h" #include "GonkNativeWindow.h"
#include "GonkNativeWindowClient.h"
#include "mozilla/media/MediaSystemResourceClient.h" #include "mozilla/media/MediaSystemResourceClient.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"

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

@ -35,7 +35,6 @@
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "GonkNativeWindow.h" #include "GonkNativeWindow.h"
#include "GonkNativeWindowClient.h"
#include "OMXCodecProxy.h" #include "OMXCodecProxy.h"
#include "OmxDecoder.h" #include "OmxDecoder.h"

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

@ -20,7 +20,6 @@
#include <stagefright/MediaErrors.h> #include <stagefright/MediaErrors.h>
#include <stagefright/foundation/AString.h> #include <stagefright/foundation/AString.h>
#include "GonkNativeWindow.h" #include "GonkNativeWindow.h"
#include "GonkNativeWindowClient.h"
#include "mozilla/layers/GrallocTextureClient.h" #include "mozilla/layers/GrallocTextureClient.h"
#include "mozilla/layers/ImageBridgeChild.h" #include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/TextureClient.h" #include "mozilla/layers/TextureClient.h"

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

@ -13,7 +13,6 @@
#include "I420ColorConverterHelper.h" #include "I420ColorConverterHelper.h"
#include "MediaCodecProxy.h" #include "MediaCodecProxy.h"
#include "GonkNativeWindow.h" #include "GonkNativeWindow.h"
#include "GonkNativeWindowClient.h"
#include "mozilla/layers/FenceUtils.h" #include "mozilla/layers/FenceUtils.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include <ui/Fence.h> #include <ui/Fence.h>

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

@ -411,38 +411,24 @@ SpeechDispatcherService::Setup()
//mInitialized = true; //mInitialized = true;
} }
struct VoiceTraverserData
{
SpeechDispatcherService* mService;
nsSynthVoiceRegistry* mRegistry;
};
// private methods // private methods
static PLDHashOperator
AddVoiceTraverser(const nsAString& aUri,
RefPtr<SpeechDispatcherVoice>& aVoice,
void* aUserArg)
{
VoiceTraverserData* data = static_cast<VoiceTraverserData*>(aUserArg);
// This service can only speak one utterance at a time, se we set
// aQueuesUtterances to true in order to track global state and schedule
// access to this service.
DebugOnly<nsresult> rv = data->mRegistry->AddVoice(data->mService, aUri,
aVoice->mName, aVoice->mLanguage,
aVoice->mName.EqualsLiteral("default"), true);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to add voice");
return PL_DHASH_NEXT;
}
void void
SpeechDispatcherService::RegisterVoices() SpeechDispatcherService::RegisterVoices()
{ {
VoiceTraverserData data = { this, nsSynthVoiceRegistry::GetInstance() }; nsSynthVoiceRegistry* registry = nsSynthVoiceRegistry::GetInstance();
mVoices.Enumerate(AddVoiceTraverser, &data); for (auto iter = mVoices.Iter(); !iter.Done(); iter.Next()) {
RefPtr<SpeechDispatcherVoice>& voice = iter.Data();
// This service can only speak one utterance at a time, so we set
// aQueuesUtterances to true in order to track global state and schedule
// access to this service.
DebugOnly<nsresult> rv =
registry->AddVoice(this, iter.Key(), voice->mName, voice->mLanguage,
voice->mName.EqualsLiteral("default"), true);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to add voice");
}
mInitThread->Shutdown(); mInitThread->Shutdown();
mInitThread = nullptr; mInitThread = nullptr;

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

@ -51,12 +51,6 @@ private:
class MessagePortServiceData; class MessagePortServiceData;
#ifdef DEBUG
static PLDHashOperator
CloseAllDebugCheck(const nsID& aID, MessagePortServiceData* aData,
void* aPtr);
#endif
nsClassHashtable<nsIDHashKey, MessagePortServiceData> mPorts; nsClassHashtable<nsIDHashKey, MessagePortServiceData> mPorts;
}; };

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

@ -267,7 +267,7 @@ parent:
// @param aX x position of candidate window // @param aX x position of candidate window
// @param aY y position of candidate window // @param aY y position of candidate window
async SetCandidateWindow(int32_t aX, int32_t aY); async SetCandidateWindow(int32_t aX, int32_t aY);
sync RequestCommitOrCancel(bool aCommitted); async RequestCommitOrCancel(bool aCommitted);
both: both:
async PPluginScriptableObject(); async PPluginScriptableObject();

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

@ -17,7 +17,7 @@
const csp = SpecialPowers.Cc["@mozilla.org/cspcontext;1"] const csp = SpecialPowers.Cc["@mozilla.org/cspcontext;1"]
.createInstance(SpecialPowers.Ci.nsIContentSecurityPolicy); .createInstance(SpecialPowers.Ci.nsIContentSecurityPolicy);
const gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; const gManifestURL = "http://www.example.com/chrome/dom/apps/tests/apps/basic.webapp";
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
var app; var app;

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

@ -84,10 +84,6 @@ public:
// method updates the cached value (and toggles the 'mForceCompositing' flag) // method updates the cached value (and toggles the 'mForceCompositing' flag)
void UpdateCachedBaseValue(const nsSMILValue& aBaseValue); void UpdateCachedBaseValue(const nsSMILValue& aBaseValue);
// Static callback methods
static PLDHashOperator DoComposeAttribute(
nsSMILCompositor* aCompositor, void *aData);
// The hash key (tuple of element/attributeName/attributeType) // The hash key (tuple of element/attributeName/attributeType)
KeyType mKey; KeyType mKey;

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

@ -76,7 +76,7 @@ SimpleTest.registerCleanupFunction(() => {
}); });
// URL of the manifest of the app we want to install. // URL of the manifest of the app we want to install.
const gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; const gManifestURL = "http://www.example.com/chrome/dom/apps/tests/apps/basic.webapp";
// ID of the installed app. // ID of the installed app.
var gTestAppId = 0; var gTestAppId = 0;
// Cookies currently in the system. // Cookies currently in the system.

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

@ -80,7 +80,7 @@ SimpleTest.registerCleanupFunction(() => {
SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.setAllAppsLaunchable(true);
// URL of the manifest of the app we want to install. // URL of the manifest of the app we want to install.
const gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; const gManifestURL = "http://www.example.com/chrome/dom/apps/tests/apps/basic.webapp";
// ID of the installed app. // ID of the installed app.
var gTestAppId = 0; var gTestAppId = 0;
// Cookies currently in the system. // Cookies currently in the system.

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

@ -1,17 +0,0 @@
[DEFAULT]
skip-if = buildapp == 'b2g' || os == 'android'
support-files =
cross_origin.html
head.js
install_and_redirect_helper.xul
apps/*
[test_bug_765063.xul]
[test_bug_771294.xul]
[test_cross_origin.xul]
[test_getNotInstalled.xul]
[test_install_app.xul]
[test_install_errors.xul]
[test_install_utf8.xul]
[test_launch_paths.xul]
[test_list_api.xul]

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

@ -1,8 +0,0 @@
[DEFAULT]
skip-if = e10s
support-files =
file_bug_779982.html
file_bug_779982.js
[test_bug_779982.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' #Bug 793211

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

@ -26,7 +26,6 @@ MOCHITEST_MANIFESTS += [
'mochitest/pointerlock/mochitest.ini', 'mochitest/pointerlock/mochitest.ini',
'mochitest/sessionstorage/mochitest.ini', 'mochitest/sessionstorage/mochitest.ini',
'mochitest/storageevent/mochitest.ini', 'mochitest/storageevent/mochitest.ini',
'mochitest/webapps/mochitest.ini',
'mochitest/webcomponents/mochitest.ini', 'mochitest/webcomponents/mochitest.ini',
'mochitest/whatwg/mochitest.ini', 'mochitest/whatwg/mochitest.ini',
] ]
@ -37,7 +36,6 @@ MOCHITEST_CHROME_MANIFESTS += [
'mochitest/general/chrome.ini', 'mochitest/general/chrome.ini',
'mochitest/localstorage/chrome.ini', 'mochitest/localstorage/chrome.ini',
'mochitest/sessionstorage/chrome.ini', 'mochitest/sessionstorage/chrome.ini',
'mochitest/webapps/chrome.ini',
'mochitest/whatwg/chrome.ini', 'mochitest/whatwg/chrome.ini',
] ]

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

@ -125,7 +125,7 @@ SimpleTest.registerCleanupFunction(() =>
Ci.nsIPermissionManager.ALLOW_ACTION) Ci.nsIPermissionManager.ALLOW_ACTION)
); );
var gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; var gManifestURL = "http://www.example.com/chrome/dom/apps/tests/apps/basic.webapp";
var gTestAppId = 0; var gTestAppId = 0;
var gCurrentCookiesCount = 0; var gCurrentCookiesCount = 0;

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

@ -58,7 +58,7 @@ SimpleTest.registerCleanupFunction(() =>
Ci.nsIPermissionManager.ALLOW_ACTION) Ci.nsIPermissionManager.ALLOW_ACTION)
); );
var gManifestURL = "http://www.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp"; var gManifestURL = "http://www.example.com/chrome/dom/apps/tests/apps/basic.webapp";
function onInstall() { function onInstall() {
var testAppId = appsService.getAppLocalIdByManifestURL(gManifestURL); var testAppId = appsService.getAppLocalIdByManifestURL(gManifestURL);

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

@ -30,6 +30,7 @@
#include "mozilla/layers/CompositableClient.h" // for CompositableClient #include "mozilla/layers/CompositableClient.h" // for CompositableClient
#include "mozilla/layers/Compositor.h" // for Compositor #include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorTypes.h" #include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayerAnimationUtils.h" // for TimingFunctionToComputedTimingFunction
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper #include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
#include "mozilla/layers/LayersMessages.h" // for TransformFunction, etc #include "mozilla/layers/LayersMessages.h" // for TransformFunction, etc
@ -470,31 +471,15 @@ Layer::SetAnimations(const AnimationArray& aAnimations)
mAnimationData.Clear(); mAnimationData.Clear();
for (uint32_t i = 0; i < mAnimations.Length(); i++) { for (uint32_t i = 0; i < mAnimations.Length(); i++) {
AnimData* data = mAnimationData.AppendElement(); AnimData* data = mAnimationData.AppendElement();
InfallibleTArray<nsAutoPtr<ComputedTimingFunction> >& functions = InfallibleTArray<Maybe<ComputedTimingFunction>>& functions =
data->mFunctions; data->mFunctions;
const InfallibleTArray<AnimationSegment>& segments = const InfallibleTArray<AnimationSegment>& segments =
mAnimations.ElementAt(i).segments(); mAnimations.ElementAt(i).segments();
for (uint32_t j = 0; j < segments.Length(); j++) { for (uint32_t j = 0; j < segments.Length(); j++) {
TimingFunction tf = segments.ElementAt(j).sampleFn(); TimingFunction tf = segments.ElementAt(j).sampleFn();
ComputedTimingFunction* ctf = new ComputedTimingFunction();
switch (tf.type()) { Maybe<ComputedTimingFunction> ctf =
case TimingFunction::TCubicBezierFunction: { AnimationUtils::TimingFunctionToComputedTimingFunction(tf);
CubicBezierFunction cbf = tf.get_CubicBezierFunction();
ctf->Init(nsTimingFunction(cbf.x1(), cbf.y1(), cbf.x2(), cbf.y2()));
break;
}
default: {
NS_ASSERTION(tf.type() == TimingFunction::TStepFunction,
"Function must be bezier or step");
StepFunction sf = tf.get_StepFunction();
nsTimingFunction::Type type = sf.type() == 1 ?
nsTimingFunction::Type::StepStart :
nsTimingFunction::Type::StepEnd;
ctf->Init(nsTimingFunction(type, sf.steps(),
nsTimingFunction::Keyword::Explicit));
break;
}
}
functions.AppendElement(ctf); functions.AppendElement(ctf);
} }

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

@ -715,7 +715,7 @@ typedef InfallibleTArray<Animation> AnimationArray;
struct AnimData { struct AnimData {
InfallibleTArray<mozilla::StyleAnimationValue> mStartValues; InfallibleTArray<mozilla::StyleAnimationValue> mStartValues;
InfallibleTArray<mozilla::StyleAnimationValue> mEndValues; InfallibleTArray<mozilla::StyleAnimationValue> mEndValues;
InfallibleTArray<nsAutoPtr<mozilla::ComputedTimingFunction> > mFunctions; InfallibleTArray<Maybe<mozilla::ComputedTimingFunction>> mFunctions;
}; };
/** /**

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

@ -23,6 +23,7 @@
#include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform #include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform
#include "mozilla/layers/Compositor.h" // for Compositor #include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorParent.h" // for CompositorParent, etc #include "mozilla/layers/CompositorParent.h" // for CompositorParent, etc
#include "mozilla/layers/LayerAnimationUtils.h" // for TimingFunctionToComputedTimingFunction
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper #include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
#include "nsCoord.h" // for NSAppUnitsToFloatPixels, etc #include "nsCoord.h" // for NSAppUnitsToFloatPixels, etc
#include "nsDebug.h" // for NS_ASSERTION, etc #include "nsDebug.h" // for NS_ASSERTION, etc
@ -595,6 +596,9 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
// example, while they are waiting to be removed) we currently just // example, while they are waiting to be removed) we currently just
// assume that we should fill. // assume that we should fill.
timing.mFill = dom::FillMode::Both; timing.mFill = dom::FillMode::Both;
timing.mFunction =
AnimationUtils::TimingFunctionToComputedTimingFunction(
animation.easingFunction());
ComputedTiming computedTiming = ComputedTiming computedTiming =
dom::KeyframeEffectReadOnly::GetComputedTimingAt( dom::KeyframeEffectReadOnly::GetComputedTimingAt(
@ -617,7 +621,8 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
(segment->endPortion() - segment->startPortion()); (segment->endPortion() - segment->startPortion());
double portion = double portion =
animData.mFunctions[segmentIndex]->GetValue(positionInSegment); ComputedTimingFunction::GetPortion(animData.mFunctions[segmentIndex],
positionInSegment);
// interpolate the property // interpolate the property
Animatable interpolatedValue; Animatable interpolatedValue;

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

@ -0,0 +1,47 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "LayerAnimationUtils.h"
#include "mozilla/ComputedTimingFunction.h" // For ComputedTimingFunction
#include "mozilla/layers/LayersMessages.h" // For TimingFunction etc.
#include "mozilla/Maybe.h" // For Maybe<>
namespace mozilla {
namespace layers {
/* static */ Maybe<ComputedTimingFunction>
AnimationUtils::TimingFunctionToComputedTimingFunction(
const TimingFunction& aTimingFunction)
{
switch (aTimingFunction.type()) {
case TimingFunction::Tnull_t:
return Nothing();
case TimingFunction::TCubicBezierFunction: {
ComputedTimingFunction result;
CubicBezierFunction cbf = aTimingFunction.get_CubicBezierFunction();
result.Init(nsTimingFunction(cbf.x1(), cbf.y1(), cbf.x2(), cbf.y2()));
return Some(result);
}
case TimingFunction::TStepFunction: {
StepFunction sf = aTimingFunction.get_StepFunction();
nsTimingFunction::Type type = sf.type() == 1 ?
nsTimingFunction::Type::StepStart :
nsTimingFunction::Type::StepEnd;
ComputedTimingFunction result;
result.Init(nsTimingFunction(type, sf.steps(),
nsTimingFunction::Keyword::Explicit));
return Some(result);
}
default:
MOZ_ASSERT_UNREACHABLE(
"Function must be null, bezier or step");
break;
}
return Nothing();
}
} // namespace layers
} // namespace mozilla

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

@ -0,0 +1,26 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_layers_LayerAnimationUtils_h
#define mozilla_layers_LayerAnimationUtils_h
namespace mozilla {
class ComputedTimingFunction;
namespace layers {
class AnimationUtils
{
public:
static Maybe<ComputedTimingFunction> TimingFunctionToComputedTimingFunction(
const TimingFunction& aTimingFunction);
};
} // namespace layers
} // namespace mozilla
#endif // mozilla_layers_LayerAnimationUtils_h

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

@ -93,6 +93,7 @@ struct StepFunction {
}; };
union TimingFunction { union TimingFunction {
null_t;
CubicBezierFunction; CubicBezierFunction;
StepFunction; StepFunction;
}; };
@ -199,6 +200,8 @@ struct Animation {
nsCSSProperty property; nsCSSProperty property;
AnimationData data; AnimationData data;
float playbackRate; float playbackRate;
// This is used in the transformed progress calculation.
TimingFunction easingFunction;
}; };
// Change a layer's attributes // Change a layer's attributes

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

@ -163,6 +163,7 @@ EXPORTS.mozilla.layers += [
'ipc/ImageBridgeParent.h', 'ipc/ImageBridgeParent.h',
'ipc/ImageContainerParent.h', 'ipc/ImageContainerParent.h',
'ipc/ISurfaceAllocator.h', 'ipc/ISurfaceAllocator.h',
'ipc/LayerAnimationUtils.h',
'ipc/LayerTransactionChild.h', 'ipc/LayerTransactionChild.h',
'ipc/LayerTransactionParent.h', 'ipc/LayerTransactionParent.h',
'ipc/ShadowLayerChild.h', 'ipc/ShadowLayerChild.h',
@ -337,6 +338,7 @@ UNIFIED_SOURCES += [
'ipc/ImageBridgeParent.cpp', 'ipc/ImageBridgeParent.cpp',
'ipc/ImageContainerParent.cpp', 'ipc/ImageContainerParent.cpp',
'ipc/ISurfaceAllocator.cpp', 'ipc/ISurfaceAllocator.cpp',
'ipc/LayerAnimationUtils.cpp',
'ipc/LayerTransactionChild.cpp', 'ipc/LayerTransactionChild.cpp',
'ipc/LayerTransactionParent.cpp', 'ipc/LayerTransactionParent.cpp',
'ipc/ShadowLayerChild.cpp', 'ipc/ShadowLayerChild.cpp',

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

@ -316,11 +316,6 @@ protected:
void GenerateFontListKey(const nsAString& aKeyName, nsAString& aResult); void GenerateFontListKey(const nsAString& aKeyName, nsAString& aResult);
static PLDHashOperator
HashEnumFuncForFamilies(nsStringHashKey::KeyType aKey,
RefPtr<gfxFontFamily>& aFamilyEntry,
void* aUserArg);
virtual void GetFontFamilyNames(nsTArray<nsString>& aFontFamilyNames); virtual void GetFontFamilyNames(nsTArray<nsString>& aFontFamilyNames);
nsILanguageAtomService* GetLangService(); nsILanguageAtomService* GetLangService();

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