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_bug655273.js]
[browser_bug670318.js]
skip-if = (os == 'mac' && debug) # Bug 1241704
[browser_bug673467.js]
[browser_bug852909.js]
[browser_bug92473.js]

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

@ -12,13 +12,15 @@
namespace mozilla {
TimingParams::TimingParams(const dom::AnimationEffectTimingProperties& aRhs)
TimingParams::TimingParams(const dom::AnimationEffectTimingProperties& aRhs,
const dom::Element* aTarget)
: mDuration(aRhs.mDuration)
, mDelay(TimeDuration::FromMilliseconds(aRhs.mDelay))
, mIterations(aRhs.mIterations)
, mDirection(aRhs.mDirection)
, mFill(aRhs.mFill)
{
mFunction = AnimationUtils::ParseEasing(aTarget, aRhs.mEasing);
}
TimingParams::TimingParams(double aDuration)
@ -28,25 +30,27 @@ TimingParams::TimingParams(double aDuration)
/* static */ TimingParams
TimingParams::FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions)
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
const dom::Element* aTarget)
{
if (aOptions.IsUnrestrictedDouble()) {
return TimingParams(aOptions.GetAsUnrestrictedDouble());
} else {
MOZ_ASSERT(aOptions.IsKeyframeEffectOptions());
return TimingParams(aOptions.GetAsKeyframeEffectOptions());
return TimingParams(aOptions.GetAsKeyframeEffectOptions(), aTarget);
}
}
/* static */ TimingParams
TimingParams::FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions)
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
const dom::Element* aTarget)
{
if (aOptions.IsUnrestrictedDouble()) {
return TimingParams(aOptions.GetAsUnrestrictedDouble());
} else {
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 &&
mIterations == aOther.mIterations &&
mDirection == aOther.mDirection &&
mFill == aOther.mFill;
mFill == aOther.mFill &&
mFunction == aOther.mFunction;
}
namespace dom {
@ -84,5 +89,15 @@ AnimationEffectTimingReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*>
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 mozilla

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

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

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

@ -6,10 +6,13 @@
#include "AnimationUtils.h"
#include "nsCSSParser.h" // For nsCSSParser
#include "nsDebug.h"
#include "nsIAtom.h"
#include "nsIContent.h"
#include "nsString.h"
#include "mozilla/ComputedTimingFunction.h" // ComputedTimingFunction
#include "mozilla/dom/Element.h" // For dom::Element
namespace mozilla {
@ -33,4 +36,66 @@ AnimationUtils::LogAsyncAnimationFailure(nsCString& aMessage,
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

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

@ -15,6 +15,12 @@ class nsIContent;
namespace mozilla {
class ComputedTimingFunction;
namespace dom {
class Element;
}
class AnimationUtils
{
public:
@ -44,6 +50,14 @@ public:
static void LogAsyncAnimationFailure(nsCString& aMessage,
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

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

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

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

@ -41,6 +41,14 @@ public:
int32_t Compare(const ComputedTimingFunction& aRhs) 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:
nsTimingFunction::Type mType;
nsSMILKeySpline mTimingFunction;

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

@ -347,6 +347,11 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
result.mProgress.SetValue(1.0 - result.mProgress.Value());
}
if (aTiming.mFunction) {
result.mProgress.SetValue(
aTiming.mFunction->GetValue(result.mProgress.Value()));
}
return result;
}
@ -539,7 +544,8 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
(computedTiming.mProgress.Value() - segment->mFromKey) /
(segment->mToKey - segment->mFromKey);
double valuePosition =
segment->mTimingFunction.GetValue(positionInSegment);
ComputedTimingFunction::GetPortion(segment->mTimingFunction,
positionInSegment);
StyleAnimationValue *val = aStyleRule->AddEmptyValue(prop.mProperty);
@ -677,7 +683,7 @@ enum class ValuePosition
struct OrderedKeyframeValueEntry : KeyframeValue
{
float mOffset;
const ComputedTimingFunction* mTimingFunction;
const Maybe<ComputedTimingFunction>* mTimingFunction;
ValuePosition mPosition;
bool SameKeyframe(const OrderedKeyframeValueEntry& aOther) const
@ -712,7 +718,9 @@ struct OrderedKeyframeValueEntry : KeyframeValue
// Third, by easing.
if (aLhs.mTimingFunction) {
if (aRhs.mTimingFunction) {
int32_t order = aLhs.mTimingFunction->Compare(*aRhs.mTimingFunction);
int32_t order =
ComputedTimingFunction::Compare(*aLhs.mTimingFunction,
*aRhs.mTimingFunction);
if (order != 0) {
return order < 0;
}
@ -743,7 +751,7 @@ struct OrderedKeyframeValueEntry : KeyframeValue
struct KeyframeValueEntry : KeyframeValue
{
float mOffset;
ComputedTimingFunction mTimingFunction;
Maybe<ComputedTimingFunction> mTimingFunction;
struct PropertyOffsetComparator
{
@ -863,64 +871,6 @@ struct OffsetIndexedKeyframe
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
* or PropertyIndexedKeyframes object.
@ -1209,8 +1159,8 @@ GenerateValueEntries(Element* aTarget,
for (OffsetIndexedKeyframe& keyframe : aKeyframes) {
float offset = float(keyframe.mKeyframeDict.mOffset.Value());
ComputedTimingFunction easing;
ParseEasing(aTarget, keyframe.mKeyframeDict.mEasing, easing);
Maybe<ComputedTimingFunction> easing =
AnimationUtils::ParseEasing(aTarget, keyframe.mKeyframeDict.mEasing);
// We ignore keyframe.mKeyframeDict.mComposite since we don't support
// composite modes on keyframes yet.
@ -1471,8 +1421,8 @@ BuildAnimationPropertyListFromPropertyIndexedKeyframes(
return;
}
ComputedTimingFunction easing;
ParseEasing(aTarget, keyframes.mEasing, easing);
Maybe<ComputedTimingFunction> easing =
AnimationUtils::ParseEasing(aTarget, keyframes.mEasing);
// We ignore easing.mComposite since we don't support composite modes on
// keyframes yet.
@ -1739,8 +1689,8 @@ KeyframeEffectReadOnly::GetFrames(JSContext*& aCx,
entry->mProperty = property.mProperty;
entry->mValue = segment.mToValue;
entry->mOffset = segment.mToKey;
entry->mTimingFunction =
segment.mToKey == 1.0f ? nullptr : &segment.mTimingFunction;
entry->mTimingFunction = segment.mToKey == 1.0f ?
nullptr : &segment.mTimingFunction;
entry->mPosition =
segment.mFromKey == segment.mToKey && segment.mToKey == 1.0f ?
ValuePosition::Last :
@ -1759,10 +1709,10 @@ KeyframeEffectReadOnly::GetFrames(JSContext*& aCx,
ComputedKeyframe keyframeDict;
keyframeDict.mOffset.SetValue(entry->mOffset);
keyframeDict.mComputedOffset.Construct(entry->mOffset);
if (entry->mTimingFunction) {
if (entry->mTimingFunction && entry->mTimingFunction->isSome()) {
// If null, leave easing as its default "linear".
keyframeDict.mEasing.Truncate();
entry->mTimingFunction->AppendToString(keyframeDict.mEasing);
entry->mTimingFunction->value().AppendToString(keyframeDict.mEasing);
}
keyframeDict.mComposite.SetValue(CompositeOperation::Replace);

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

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

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

@ -1,14 +1,27 @@
[DEFAULT]
skip-if = buildapp == 'b2g' || os == 'android'
support-files =
apps/*
asmjs/*
common.js
cross_origin.html
file_bug_945152.html
file_bug_945152.sjs
head.js
install_and_redirect_helper.xul
[test_apps_service.xul]
[test_bug_765063.xul]
[test_bug_771294.xul]
[test_bug_945152.html]
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_operator_app_install.js]
[test_operator_app_install.xul]

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

@ -1,7 +1,7 @@
SimpleTest.waitForExplicitFinish();
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 = [
// APP 1

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

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

@ -5,7 +5,7 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<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);
document.location = "about:blank";
</script>

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

@ -10,6 +10,8 @@ support-files =
common.js
file_app.sjs
file_app.template.html
file_bug_779982.html
file_bug_779982.js
file_script.template.js
file_cached_app.template.appcache
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_update.html]
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_1168300.html]
skip-if = toolkit == "gonk" || e10s # see bug 1175784

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

@ -50,6 +50,6 @@ confirmNextPopup();
<!-- 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
- 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>

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

@ -40,6 +40,6 @@ addEventListener("DOMContentLoaded", () => {
<!-- 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
- 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>

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

@ -20,8 +20,8 @@
<script>
var url1 = "http://test1.example.com/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
var url2 = "http://test2.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/apps/tests/apps/basic.webapp";
// 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
@ -58,7 +58,7 @@ function installAppFromOwnOrigin(next) {
*/
function installAppFromOtherOrigin(next) {
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) {
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
// 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;

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

@ -21,7 +21,7 @@
<script>
<![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 steps = [

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

@ -49,7 +49,7 @@ function noArgs(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() {
is(this.error.name, "MANIFEST_PARSE_ERROR", "manifest with syntax error");
@ -58,7 +58,7 @@ function parseError(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() {
is(this.error.name, "INVALID_MANIFEST", "manifest missing required field");
@ -67,7 +67,7 @@ function invalidManifest(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();
var request = navigator.mozApps.install(url, null);
@ -87,7 +87,7 @@ function permissionDenied(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);
@ -106,7 +106,7 @@ function invalidContent(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() {
is(this.error.name, "INVALID_MANIFEST", "Invalid Manifest");
@ -115,7 +115,7 @@ function invalidLaunchPath(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() {
is(this.error.name, "INVALID_MANIFEST", "Invalid Manifest");
@ -124,7 +124,7 @@ function invalidLaunchPath2(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() {
is(this.error.name, "INVALID_MANIFEST", "manifest missing required field");
@ -133,7 +133,7 @@ function invalidEntryPoint(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() {
is(this.error.name, "INVALID_MANIFEST", "manifest missing required field");
@ -142,7 +142,7 @@ function invalidLocaleEntryPoint(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() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has non-relative URI for activity href");
@ -151,7 +151,7 @@ function invalidActivityHref(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() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has data: URI for activity href");
@ -160,7 +160,7 @@ function invalidActivityHref2(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() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has absolute message href");
@ -197,7 +197,7 @@ function fileURL(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);
@ -216,7 +216,7 @@ function originNotAllowed(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();
var request = navigator.mozApps.install(url, null);

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

@ -20,7 +20,7 @@
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();
navigator.mozApps.install(url, null).onsuccess = function onInstall() {

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

@ -21,7 +21,7 @@
<script>
<![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 steps = [

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

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

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

@ -464,37 +464,6 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
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
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;
}
TraceClosure closure(aTrc, aGCNumber);
// Mark globals of active windows black.
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
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
}
/**
* Clear map pointer for attributes.
*/
PLDHashOperator
RemoveMapRef(nsAttrHashKey::KeyType aKey, RefPtr<Attr>& aData,
void* aUserArg)
{
aData->SetMap(nullptr);
return PL_DHASH_REMOVE;
}
nsDOMAttributeMap::~nsDOMAttributeMap()
{
mAttributeCache.Enumerate(RemoveMapRef, nullptr);
DropReference();
}
void
nsDOMAttributeMap::DropReference()
{
mAttributeCache.Enumerate(RemoveMapRef, nullptr);
for (auto iter = mAttributeCache.Iter(); !iter.Done(); iter.Next()) {
iter.Data()->SetMap(nullptr);
iter.Remove();
}
mContent = nullptr;
}
@ -70,20 +61,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttributeMap)
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)
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(mContent)
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
void
nsMessageManagerScriptExecutor::Shutdown()
@ -1640,7 +1631,10 @@ nsMessageManagerScriptExecutor::Shutdown()
if (sCachedScripts) {
AutoSafeJSContext cx;
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;
sCachedScripts = nullptr;

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

@ -1769,13 +1769,6 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(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)
if (tmp->IsBlackForCC(false)) {
if (nsCCUncollectableMarker::InGeneration(tmp->mCanSkipCCGeneration)) {
@ -1783,7 +1776,11 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow)
}
tmp->mCanSkipCCGeneration = nsCCUncollectableMarker::sGeneration;
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()) {
elm->MarkForCC();
@ -1979,24 +1976,14 @@ nsGlobalWindow::RiskyUnlink()
}
#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)
if (tmp->mCachedXBLPrototypeHandlers) {
TraceData data = { aCallbacks, aClosure };
tmp->mCachedXBLPrototypeHandlers->Enumerate(TraceXBLHandlers, &data);
for (auto iter = tmp->mCachedXBLPrototypeHandlers->Iter();
!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_END

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

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

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

@ -444,15 +444,6 @@ CollectWindowReports(nsGlobalWindow *aWindow,
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
nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
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
// destroyed while we're calling the memory reporter callback.
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
// 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
nsWindowMemoryReporter::ObserveAfterMinimizeMemoryUsage()
{
@ -712,78 +692,12 @@ nsWindowMemoryReporter::ObserveAfterMinimizeMemoryUsage()
TimeStamp minTimeStamp = TimeStamp::Now() -
TimeDuration::FromSeconds(GetGhostTimeout());
mDetachedWindows.Enumerate(BackdateTimeStampsEnumerator,
&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());
}
for (auto iter = mDetachedWindows.Iter(); !iter.Done(); iter.Next()) {
TimeStamp& timeStamp = iter.Data();
if (!timeStamp.IsNull() && timeStamp > minTimeStamp) {
timeStamp = minTimeStamp;
}
}
return PL_DHASH_NEXT;
}
/**
@ -846,11 +760,64 @@ nsWindowMemoryReporter::CheckForGhostWindows(
// Update mDetachedWindows and write the ghost window IDs into aOutGhostIDs,
// if it's not null.
CheckForGhostWindowsEnumeratorData ghostEnumData =
{ &nonDetachedWindowDomains, aOutGhostIDs, tldService,
GetGhostTimeout(), mLastCheckForGhostWindows };
mDetachedWindows.Enumerate(CheckForGhostWindowsEnumerator,
&ghostEnumData);
uint32_t ghostTimeout = GetGhostTimeout();
TimeStamp now = mLastCheckForGhostWindows;
for (auto iter = mDetachedWindows.Iter(); !iter.Done(); iter.Next()) {
nsWeakPtr weakKey = do_QueryInterface(iter.Key());
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,
@ -890,7 +857,9 @@ nsWindowMemoryReporter::UnlinkGhostWindows()
// Hold on to every window in memory so that window objects can't be
// destroyed while we're calling the UnlinkGhostWindows callback.
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.
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
BluetoothService::UnregisterAllSignalHandlers(BluetoothSignalObserver* aHandler)
{
MOZ_ASSERT(NS_IsMainThread());
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

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

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

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

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

@ -847,11 +847,10 @@ WebGLFramebuffer::PrecheckFramebufferStatus(nsCString* const out_info) const
if (HasIncompleteAttachments(out_info))
return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
if (!mContext->IsWebGL2()) {
// INCOMPLETE_DIMENSIONS doesn't exist in GLES3.
if (!AllImageRectsMatch())
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()) +
int(mStencilAttachment.IsDefined()) +
int(mDepthStencilAttachment.IsDefined());

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

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

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

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

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

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

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

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

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

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

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

@ -1206,11 +1206,6 @@ protected:
// Current audio volume
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;
// URI of the resource we're attempting to load. This stores the value we

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

@ -17603,7 +17603,7 @@ QuotaClient::DetermineMaintenanceAction(mozIStorageConnection* aConnection,
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...
if (NS_WARN_IF(mMaintenanceStartTime <= lastVacuumTime)) {

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

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

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

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

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

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

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

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

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

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

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

@ -411,38 +411,24 @@ SpeechDispatcherService::Setup()
//mInitialized = true;
}
struct VoiceTraverserData
{
SpeechDispatcherService* mService;
nsSynthVoiceRegistry* mRegistry;
};
// 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
SpeechDispatcherService::RegisterVoices()
{
VoiceTraverserData data = { this, nsSynthVoiceRegistry::GetInstance() };
mVoices.Enumerate(AddVoiceTraverser, &data);
nsSynthVoiceRegistry* registry = nsSynthVoiceRegistry::GetInstance();
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 = nullptr;

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

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

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

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

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

@ -17,7 +17,7 @@
const csp = SpecialPowers.Cc["@mozilla.org/cspcontext;1"]
.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();
var app;

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

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

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

@ -76,7 +76,7 @@ SimpleTest.registerCleanupFunction(() => {
});
// 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.
var gTestAppId = 0;
// Cookies currently in the system.

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

@ -80,7 +80,7 @@ SimpleTest.registerCleanupFunction(() => {
SpecialPowers.setAllAppsLaunchable(true);
// 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.
var gTestAppId = 0;
// 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/sessionstorage/mochitest.ini',
'mochitest/storageevent/mochitest.ini',
'mochitest/webapps/mochitest.ini',
'mochitest/webcomponents/mochitest.ini',
'mochitest/whatwg/mochitest.ini',
]
@ -37,7 +36,6 @@ MOCHITEST_CHROME_MANIFESTS += [
'mochitest/general/chrome.ini',
'mochitest/localstorage/chrome.ini',
'mochitest/sessionstorage/chrome.ini',
'mochitest/webapps/chrome.ini',
'mochitest/whatwg/chrome.ini',
]

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

@ -125,7 +125,7 @@ SimpleTest.registerCleanupFunction(() =>
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 gCurrentCookiesCount = 0;

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

@ -58,7 +58,7 @@ SimpleTest.registerCleanupFunction(() =>
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() {
var testAppId = appsService.getAppLocalIdByManifestURL(gManifestURL);

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

@ -30,6 +30,7 @@
#include "mozilla/layers/CompositableClient.h" // for CompositableClient
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayerAnimationUtils.h" // for TimingFunctionToComputedTimingFunction
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
#include "mozilla/layers/LayersMessages.h" // for TransformFunction, etc
@ -470,31 +471,15 @@ Layer::SetAnimations(const AnimationArray& aAnimations)
mAnimationData.Clear();
for (uint32_t i = 0; i < mAnimations.Length(); i++) {
AnimData* data = mAnimationData.AppendElement();
InfallibleTArray<nsAutoPtr<ComputedTimingFunction> >& functions =
InfallibleTArray<Maybe<ComputedTimingFunction>>& functions =
data->mFunctions;
const InfallibleTArray<AnimationSegment>& segments =
mAnimations.ElementAt(i).segments();
for (uint32_t j = 0; j < segments.Length(); j++) {
TimingFunction tf = segments.ElementAt(j).sampleFn();
ComputedTimingFunction* ctf = new ComputedTimingFunction();
switch (tf.type()) {
case TimingFunction::TCubicBezierFunction: {
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;
}
}
Maybe<ComputedTimingFunction> ctf =
AnimationUtils::TimingFunctionToComputedTimingFunction(tf);
functions.AppendElement(ctf);
}

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

@ -715,7 +715,7 @@ typedef InfallibleTArray<Animation> AnimationArray;
struct AnimData {
InfallibleTArray<mozilla::StyleAnimationValue> mStartValues;
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/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorParent.h" // for CompositorParent, etc
#include "mozilla/layers/LayerAnimationUtils.h" // for TimingFunctionToComputedTimingFunction
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
#include "nsCoord.h" // for NSAppUnitsToFloatPixels, 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
// assume that we should fill.
timing.mFill = dom::FillMode::Both;
timing.mFunction =
AnimationUtils::TimingFunctionToComputedTimingFunction(
animation.easingFunction());
ComputedTiming computedTiming =
dom::KeyframeEffectReadOnly::GetComputedTimingAt(
@ -617,7 +621,8 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
(segment->endPortion() - segment->startPortion());
double portion =
animData.mFunctions[segmentIndex]->GetValue(positionInSegment);
ComputedTimingFunction::GetPortion(animData.mFunctions[segmentIndex],
positionInSegment);
// interpolate the property
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 {
null_t;
CubicBezierFunction;
StepFunction;
};
@ -199,6 +200,8 @@ struct Animation {
nsCSSProperty property;
AnimationData data;
float playbackRate;
// This is used in the transformed progress calculation.
TimingFunction easingFunction;
};
// Change a layer's attributes

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

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

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

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

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