merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-03-22 12:14:15 +01:00
commit 5d83e31d04
330 changed files with 6793 additions and 8046 deletions

View File

@ -17,7 +17,7 @@ default::
ifndef TEST_MOZBUILD
ifdef MOZ_BUILD_APP
include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
include $(wildcard $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk)
endif
endif

View File

@ -460,8 +460,8 @@ bool
TextAttrsMgr::FontFamilyTextAttr::
GetFontFamily(nsIFrame* aFrame, nsString& aFamily)
{
RefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForFrame(aFrame, 1.0f);
gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
gfxFont* font = fontGroup->GetFirstValidFont();
@ -618,8 +618,8 @@ TextAttrsMgr::FontWeightTextAttr::
{
// nsFont::width isn't suitable here because it's necessary to expose real
// value of font weight (used font might not have some font weight values).
RefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForFrame(aFrame, 1.0f);
gfxFontGroup *fontGroup = fm->GetThebesFontGroup();
gfxFont *font = fontGroup->GetFirstValidFont();

View File

@ -179,8 +179,8 @@ sdnTextAccessible::get_fontFamily(BSTR __RPC_FAR* aFontFamily)
if (!frame)
return E_FAIL;
RefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(frame, getter_AddRefs(fm));
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForFrame(frame, 1.0f);
const nsString& name =
fm->GetThebesFontGroup()->GetFirstValidFont()->GetName();

View File

@ -56,7 +56,8 @@ function defineCohort() {
let userOptedOut = optedOut();
let userOptedIn = optedIn();
let disqualified = (Services.appinfo.multiprocessBlockPolicy != 0);
let disqualified = (Services.appinfo.multiprocessBlockPolicy != 0) ||
isThereAnActiveExperiment();
let testGroup = (getUserSample() < TEST_THRESHOLD[updateChannel]);
if (userOptedOut) {
@ -112,3 +113,7 @@ function optedOut() {
Preferences.get(PREF_TOGGLE_E10S) == false);
}
function isThereAnActiveExperiment() {
let { Experiments } = Cu.import("resource:///modules/experiments/Experiments.jsm", {});
return (Experiments.instance().getActiveExperimentID() !== null);
}

View File

@ -23,7 +23,7 @@ AC_SUBST(MOZ_SYSTEM_FFI)
])
AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [
if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
if test "$BUILD_CTYPES" -a -z "$MOZ_SYSTEM_FFI"; then
# Run the libffi 'configure' script.

View File

@ -128,7 +128,7 @@ fi
AC_DEFUN([MOZ_SUBCONFIGURE_ICU], [
if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
if test -n "$USE_ICU" -a -z "$MOZ_SYSTEM_ICU"; then
# Set ICU compile options

View File

@ -4,7 +4,7 @@ dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
AC_DEFUN([MOZ_SUBCONFIGURE_JEMALLOC], [
if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
# Run jemalloc configure script

View File

@ -8,11 +8,11 @@ ifelse([$1],,define(CONFIGURING_JS,yes))
dnl Possible ways this can be called:
dnl from toplevel configure:
dnl JS_STANDALONE= BUILDING_JS=
dnl JS_STANDALONE= MOZ_BUILD_APP!=js
dnl from js/src/configure invoked by toplevel configure:
dnl JS_STANDALONE= BUILDING_JS=1
dnl JS_STANDALONE= MOZ_BUILD_APP=js
dnl from standalone js/src/configure:
dnl JS_STANDALONE=1 BUILDING_JS=1
dnl JS_STANDALONE=1 MOZ_BUILD_APP=js
dnl ========================================================
dnl = Find the right NSPR to use.
@ -38,7 +38,7 @@ ifdef([CONFIGURING_JS],[
MOZ_BUILD_NSPR=)
])
if test -z "$BUILDING_JS" || test -n "$JS_STANDALONE"; then
if test "$MOZ_BUILD_APP" != js || test -n "$JS_STANDALONE"; then
_IS_OUTER_CONFIGURE=1
fi
@ -99,7 +99,7 @@ else
fi
if test -z "$nspr_opts"; then
if test -z "$BUILDING_JS"; then
if test "$MOZ_BUILD_APP" != js; then
dnl Toplevel configure defaults to using nsprpub from the source tree
MOZ_BUILD_NSPR=1
which_nspr="source-tree"
@ -124,7 +124,7 @@ fi
AC_SUBST(MOZ_BUILD_NSPR)
if test -n "$BUILDING_JS"; then
if test "$MOZ_BUILD_APP" = js; then
if test "$JS_POSIX_NSPR" = 1; then
AC_DEFINE(JS_POSIX_NSPR)
fi

View File

@ -255,6 +255,7 @@ def wanted_mozconfig_variables(help):
'DSYMUTIL',
'EXTERNAL_SOURCE_DIR',
'GENISOIMAGE',
'JS_STANDALONE',
'L10NBASEDIR',
'MOZILLABUILD',
'MOZ_ARTIFACT_BUILDS',
@ -276,6 +277,7 @@ def wanted_mozconfig_variables(help):
'USE_FC_FREETYPE',
'WITHOUT_X',
'XARGS',
'YASM',
'ZIP',
])
@ -514,6 +516,26 @@ def host_variables(host):
set_config('HOST_OS_ARCH', os_arch)
@depends(target)
def target_platform_defines(target):
if target.kernel == 'WINNT':
set_define('_WINDOWS', '1')
set_define('WIN32', '1')
set_define('XP_WIN', '1')
set_define('XP_WIN32', '1')
else:
set_define('XP_UNIX', '1')
if target.kernel == 'Darwin':
set_define('XP_DARWIN', '1')
if target.os == 'iOS':
set_define('XP_IOS', '1')
elif target.os == 'OSX':
set_define('XP_MACOSX', '1')
elif target.kernel == 'Linux':
set_define('XP_LINUX', '1')
# The application/project to build
# ==============================================================
option('--enable-application', nargs=1, env='MOZ_BUILD_APP',
@ -559,6 +581,8 @@ def include_project_configure(project, external_source_dir, build_env, help):
def build_project(include_project_configure, build_env, help):
ret = os.path.dirname(os.path.relpath(include_project_configure,
build_env['TOPSRCDIR']))
set_config('MOZ_BUILD_APP', ret)
set_define('MOZ_BUILD_APP', ret)
add_old_configure_assignment('MOZ_BUILD_APP', ret)
return ret

View File

@ -314,6 +314,7 @@ def run(objdir):
command = [
sys.executable,
os.path.join(os.path.dirname(__file__), '..', 'configure.py'),
'--enable-project=js',
]
data['env']['OLD_CONFIGURE'] = os.path.join(
os.path.dirname(configure), 'old-configure')

View File

@ -138,7 +138,7 @@ _DEBUG_CFLAGS :=
_DEBUG_LDFLAGS :=
ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS))
ifeq ($(AS),yasm)
ifeq ($(AS),$(YASM))
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
_DEBUG_ASFLAGS += -g cv8
else

View File

@ -58,7 +58,7 @@ def config_status(config):
fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', "
"'non_global_defines', 'substs']")
if not config.get('BUILDING_JS') or config.get('JS_STANDALONE'):
if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
fh.write('''
if __name__ == '__main__':
args = dict([(name, globals()[name]) for name in __all__])
@ -69,7 +69,7 @@ if __name__ == '__main__':
# Other things than us are going to run this file, so we need to give it
# executable permissions.
os.chmod('config.status', 0755)
if not config.get('BUILDING_JS') or config.get('JS_STANDALONE'):
if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
if not config.get('JS_STANDALONE'):
os.environ['WRITE_MOZINFO'] = '1'
# Until we have access to the virtualenv from this script, execute

View File

@ -622,6 +622,15 @@ var AnimationsActor = exports.AnimationsActor = ActorClass({
if (player.playState !== "idle") {
continue;
}
// FIXME: In bug 1249219, we support the animation mutation for pseudo
// elements. However, the timeline may not be ready yet to
// display those correctly. Therefore, we add this check to bails out if
// the mutation target is a pseudo-element.
// Note. Only CSSPseudoElement object has |type| attribute, so if type
// exists, it is a CSSPseudoElement object.
if (player.effect.target.type) {
continue;
}
let index = this.actors.findIndex(a => a.player === player);
if (index !== -1) {
eventData.push({
@ -638,6 +647,15 @@ var AnimationsActor = exports.AnimationsActor = ActorClass({
if (this.actors.find(a => a.player === player)) {
continue;
}
// FIXME: In bug 1249219, we support the animation mutation for pseudo
// elements. However, the timeline may not be ready yet to
// display those correctly. Therefore, we add this check to bails out if
// the mutation target is a pseudo-element.
// Note. Only CSSPseudoElement object has |type| attribute, so if type
// exists, it is a CSSPseudoElement object.
if (player.effect.target.type) {
continue;
}
// If the added player has the same name and target node as a player we
// already have, it means it's a transition that's re-starting. So send
// a "removed" event for the one we already have.

View File

@ -11,6 +11,7 @@
#include "mozilla/AutoRestore.h"
#include "mozilla/AsyncEventDispatcher.h" // For AsyncEventDispatcher
#include "mozilla/Maybe.h" // For Maybe
#include "mozilla/NonOwningAnimationTarget.h"
#include "nsAnimationManager.h" // For CSSAnimation
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
#include "nsIDocument.h" // For nsIDocument
@ -58,13 +59,14 @@ namespace {
explicit AutoMutationBatchForAnimation(const Animation& aAnimation
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
Element* targetElement = nsNodeUtils::GetTargetForAnimation(&aAnimation);
if (!targetElement) {
Maybe<NonOwningAnimationTarget> target =
nsNodeUtils::GetTargetForAnimation(&aAnimation);
if (!target) {
return;
}
// For mutation observers, we use the OwnerDoc.
nsIDocument* doc = targetElement->OwnerDoc();
nsIDocument* doc = target->mElement->OwnerDoc();
if (!doc) {
return;
}
@ -1106,16 +1108,14 @@ Animation::PostUpdate()
return;
}
Element* targetElement;
CSSPseudoElementType targetPseudoType;
mEffect->GetTarget(targetElement, targetPseudoType);
if (!targetElement) {
Maybe<NonOwningAnimationTarget> target = mEffect->GetTarget();
if (!target) {
return;
}
presContext->EffectCompositor()
->RequestRestyle(targetElement,
targetPseudoType,
->RequestRestyle(target->mElement,
target->mPseudoType,
EffectCompositor::RestyleType::Layer,
CascadeLevel());
}

View File

@ -6,15 +6,12 @@
#include "AnimationUtils.h"
#include "nsCSSParser.h" // For nsCSSParser
#include "nsDebug.h"
#include "nsIAtom.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsGlobalWindow.h"
#include "nsString.h"
#include "mozilla/Attributes.h"
#include "mozilla/ComputedTimingFunction.h" // ComputedTimingFunction
#include "xpcpublic.h" // For xpc::NativeGlobal
namespace mozilla {
@ -39,64 +36,6 @@ AnimationUtils::LogAsyncAnimationFailure(nsCString& aMessage,
printf_stderr("%s", aMessage.get());
}
/* static */ Maybe<ComputedTimingFunction>
AnimationUtils::ParseEasing(const nsAString& aEasing,
nsIDocument* aDocument)
{
MOZ_ASSERT(aDocument);
nsCSSValue value;
nsCSSParser parser;
parser.ParseLonghandProperty(eCSSProperty_animation_timing_function,
aEasing,
aDocument->GetDocumentURI(),
aDocument->GetDocumentURI(),
aDocument->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();
}
MOZ_FALLTHROUGH;
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();
}
/* static */ nsIDocument*
AnimationUtils::GetCurrentRealmDocument(JSContext* aCx)
{

View File

@ -19,7 +19,6 @@
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetPresShellForContent
#include "nsCSSPropertySet.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoElements.h"
#include "nsIPresShell.h"
#include "nsLayoutUtils.h"
#include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation
@ -83,11 +82,11 @@ FindAnimationsForCompositor(const nsIFrame* aFrame,
// Those cases are probably not important but just to be safe, let's make
// sure the cascade is up to date since if it *is* up to date, this is
// basically a no-op.
Maybe<Pair<dom::Element*, CSSPseudoElementType>> pseudoElement =
Maybe<NonOwningAnimationTarget> pseudoElement =
EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
if (pseudoElement) {
EffectCompositor::MaybeUpdateCascadeResults(pseudoElement->first(),
pseudoElement->second(),
EffectCompositor::MaybeUpdateCascadeResults(pseudoElement->mElement,
pseudoElement->mPseudoType,
aFrame->StyleContext());
}
@ -150,7 +149,7 @@ EffectCompositor::RequestRestyle(dom::Element* aElement,
}
auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
PseudoElementHashKey key = { aElement, aPseudoType };
PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
if (aRestyleType == RestyleType::Throttled) {
if (!elementsToRestyle.Contains(key)) {
@ -232,7 +231,7 @@ EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
MaybeUpdateCascadeResults(aElement, aPseudoType);
auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
PseudoElementHashKey key = { aElement, aPseudoType };
PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
if (!mPresContext || !elementsToRestyle.Contains(key)) {
return;
@ -278,7 +277,7 @@ EffectCompositor::GetAnimationRule(dom::Element* aElement,
#ifdef DEBUG
{
auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
PseudoElementHashKey key = { aElement, aPseudoType };
PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
MOZ_ASSERT(!elementsToRestyle.Contains(key),
"Element should no longer require a restyle after its "
"animation rule has been updated");
@ -364,7 +363,8 @@ EffectCompositor::AddStyleUpdatesTo(RestyleTracker& aTracker)
// it will only mutate the bool value associated with each element in the
// set but even doing that will cause assertions in PLDHashTable to fail
// if we are iterating over the hashtable at the same time.
nsTArray<PseudoElementHashKey> elementsToRestyle(elementSet.Count());
nsTArray<PseudoElementHashEntry::KeyType> elementsToRestyle(
elementSet.Count());
for (auto iter = elementSet.Iter(); !iter.Done(); iter.Next()) {
elementsToRestyle.AppendElement(iter.Key());
}
@ -497,11 +497,11 @@ EffectCompositor::UpdateCascadeResults(Element* aElement,
UpdateCascadeResults(*effects, aElement, aPseudoType, aStyleContext);
}
/* static */ Maybe<Pair<Element*, CSSPseudoElementType>>
/* static */ Maybe<NonOwningAnimationTarget>
EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
{
// Always return the same object to benefit from return-value optimization.
Maybe<Pair<Element*, CSSPseudoElementType>> result;
Maybe<NonOwningAnimationTarget> result;
nsIContent* content = aFrame->GetContent();
if (!content) {
@ -538,7 +538,7 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
return result;
}
result = Some(MakePair(content->AsElement(), pseudoType));
result.emplace(content->AsElement(), pseudoType);
return result;
}

View File

@ -10,7 +10,7 @@
#include "mozilla/EnumeratedArray.h"
#include "mozilla/Maybe.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/Pair.h"
#include "mozilla/NonOwningAnimationTarget.h"
#include "mozilla/PseudoElementHashEntry.h"
#include "mozilla/RefPtr.h"
#include "nsCSSProperty.h"
@ -29,7 +29,6 @@ namespace mozilla {
class EffectSet;
class RestyleTracker;
enum class CSSPseudoElementType : uint8_t;
struct AnimationPerformanceWarning;
namespace dom {
@ -185,7 +184,7 @@ public:
// Returns an empty result when a suitable element cannot be found including
// when the frame represents a pseudo-element on which we do not support
// animations.
static Maybe<Pair<dom::Element*, CSSPseudoElementType>>
static Maybe<NonOwningAnimationTarget>
GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame);
// Associates a performance warning with effects on |aFrame| that animates

View File

@ -1292,10 +1292,13 @@ GenerateValueEntries(Element* aTarget,
nsCSSPropertySet propertiesWithToValue; // Those with a defined 100% value.
for (OffsetIndexedKeyframe& keyframe : aKeyframes) {
float offset = float(keyframe.mKeyframeDict.mOffset.Value());
Maybe<ComputedTimingFunction> easing =
AnimationUtils::ParseEasing(keyframe.mKeyframeDict.mEasing,
aTarget->OwnerDoc());
TimingParams::ParseEasing(keyframe.mKeyframeDict.mEasing,
aTarget->OwnerDoc(), aRv);
if (aRv.Failed()) {
return;
}
float offset = float(keyframe.mKeyframeDict.mOffset.Value());
// We ignore keyframe.mKeyframeDict.mComposite since we don't support
// composite modes on keyframes yet.
@ -1560,7 +1563,7 @@ BuildAnimationPropertyListFromPropertyIndexedKeyframes(
}
Maybe<ComputedTimingFunction> easing =
AnimationUtils::ParseEasing(keyframes.mEasing, aTarget->OwnerDoc());
TimingParams::ParseEasing(keyframes.mEasing, aTarget->OwnerDoc(), aRv);
// We ignore easing.mComposite since we don't support composite modes on
// keyframes yet.
@ -2318,15 +2321,8 @@ KeyframeEffect::Constructor(
void KeyframeEffect::NotifySpecifiedTimingUpdated()
{
nsIDocument* doc = nullptr;
// Bug 1249219:
// We don't support animation mutation observers on pseudo-elements yet.
if (mTarget &&
mPseudoType == CSSPseudoElementType::NotPseudo) {
doc = mTarget->OwnerDoc();
}
nsAutoAnimationMutationBatch mb(doc);
// Use the same document for a pseudo element and its parent element.
nsAutoAnimationMutationBatch mb(mTarget->OwnerDoc());
if (mAnimation) {
mAnimation->NotifyEffectTimingUpdated();

View File

@ -15,6 +15,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/ComputedTimingFunction.h" // ComputedTimingFunction
#include "mozilla/LayerAnimationInfo.h" // LayerAnimations::kRecords
#include "mozilla/NonOwningAnimationTarget.h"
#include "mozilla/OwningNonNull.h" // OwningNonNull<...>
#include "mozilla/StickyTimeDuration.h"
#include "mozilla/StyleAnimationValue.h"
@ -206,20 +207,20 @@ public:
ErrorResult& aRv);
void GetTarget(Nullable<OwningElementOrCSSPseudoElement>& aRv) const;
Maybe<NonOwningAnimationTarget> GetTarget() const
{
Maybe<NonOwningAnimationTarget> result;
if (mTarget) {
result.emplace(mTarget, mPseudoType);
}
return result;
}
void GetFrames(JSContext*& aCx,
nsTArray<JSObject*>& aResult,
ErrorResult& aRv);
void GetProperties(nsTArray<AnimationPropertyDetails>& aProperties,
ErrorResult& aRv) const;
// Temporary workaround to return both the target element and pseudo-type
// until we implement PseudoElement (bug 1174575).
void GetTarget(Element*& aTarget,
CSSPseudoElementType& aPseudoType) const {
aTarget = mTarget;
aPseudoType = mPseudoType;
}
IterationCompositeOperation IterationComposite() const;
CompositeOperation Composite() const;
void GetSpacing(nsString& aRetVal) const {

View File

@ -0,0 +1,32 @@
/* -*- 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_NonOwningAnimationTarget_h
#define mozilla_NonOwningAnimationTarget_h
#include "mozilla/Attributes.h" // For MOZ_NON_OWNING_REF
#include "nsCSSPseudoElements.h"
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
struct NonOwningAnimationTarget
{
NonOwningAnimationTarget(dom::Element* aElement, CSSPseudoElementType aType)
: mElement(aElement), mPseudoType(aType) { }
// mElement represents the parent element of a pseudo-element, not the
// generated content element.
dom::Element* MOZ_NON_OWNING_REF mElement = nullptr;
CSSPseudoElementType mPseudoType = CSSPseudoElementType::NotPseudo;
};
} // namespace mozilla
#endif // mozilla_NonOwningAnimationTarget_h

View File

@ -9,24 +9,17 @@
#include "mozilla/dom/Element.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/NonOwningAnimationTarget.h"
#include "PLDHashTable.h"
namespace mozilla {
enum class CSSPseudoElementType : uint8_t;
struct PseudoElementHashKey
{
dom::Element* mElement;
CSSPseudoElementType mPseudoType;
};
// A hash entry that uses a RefPtr<dom::Element>, CSSPseudoElementType pair
class PseudoElementHashEntry : public PLDHashEntryHdr
{
public:
typedef PseudoElementHashKey KeyType;
typedef const PseudoElementHashKey* KeyTypePointer;
typedef NonOwningAnimationTarget KeyType;
typedef const NonOwningAnimationTarget* KeyTypePointer;
explicit PseudoElementHashEntry(KeyTypePointer aKey)
: mElement(aKey->mElement)
@ -35,7 +28,7 @@ public:
~PseudoElementHashEntry() = default;
KeyType GetKey() const { return {mElement, mPseudoType}; }
KeyType GetKey() const { return { mElement, mPseudoType }; }
bool KeyEquals(KeyTypePointer aKey) const
{
return mElement == aKey->mElement &&

View File

@ -6,6 +6,7 @@
#include "mozilla/TimingParams.h"
#include "nsCSSParser.h" // For nsCSSParser
#include "nsIDocument.h"
namespace mozilla {
@ -60,6 +61,15 @@ TimingParamsFromOptionsUnion(const OptionsType& aOptions,
if (aRv.Failed()) {
return result;
}
TimingParams::ValidateIterations(timing.mIterations, aRv);
if (aRv.Failed()) {
return result;
}
Maybe<ComputedTimingFunction> easing =
TimingParams::ParseEasing(timing.mEasing, aDocument, aRv);
if (aRv.Failed()) {
return result;
}
result.mDuration = duration;
result.mDelay = TimeDuration::FromMilliseconds(timing.mDelay);
@ -68,7 +78,7 @@ TimingParamsFromOptionsUnion(const OptionsType& aOptions,
result.mIterationStart = timing.mIterationStart;
result.mDirection = timing.mDirection;
result.mFill = timing.mFill;
result.mFunction = AnimationUtils::ParseEasing(timing.mEasing, aDocument);
result.mFunction = easing;
}
return result;
}
@ -91,6 +101,66 @@ TimingParams::FromOptionsUnion(
return TimingParamsFromOptionsUnion(aOptions, aDocument, aRv);
}
/* static */ Maybe<ComputedTimingFunction>
TimingParams::ParseEasing(const nsAString& aEasing,
nsIDocument* aDocument,
ErrorResult& aRv)
{
MOZ_ASSERT(aDocument);
nsCSSValue value;
nsCSSParser parser;
parser.ParseLonghandProperty(eCSSProperty_animation_timing_function,
aEasing,
aDocument->GetDocumentURI(),
aDocument->GetDocumentURI(),
aDocument->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();
}
MOZ_FALLTHROUGH;
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_Inherit:
case eCSSUnit_Initial:
case eCSSUnit_Unset:
case eCSSUnit_TokenStream:
case eCSSUnit_Null:
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function unit");
break;
}
aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>();
return Nothing();
}
bool
TimingParams::operator==(const TimingParams& aOther) const
{

View File

@ -7,6 +7,7 @@
#ifndef mozilla_TimingParams_h
#define mozilla_TimingParams_h
#include "nsStringFwd.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/UnionTypes.h" // For OwningUnrestrictedDoubleOrString
#include "mozilla/ComputedTimingFunction.h"
@ -53,12 +54,13 @@ struct TimingParams
double durationInMs = aDuration.GetAsUnrestrictedDouble();
if (durationInMs >= 0) {
result.emplace(StickyTimeDuration::FromMilliseconds(durationInMs));
return result;
} else {
aRv.ThrowTypeError<dom::MSG_ENFORCE_RANGE_OUT_OF_RANGE>(
NS_LITERAL_STRING("duration"));
}
} else if (aDuration.GetAsString().EqualsLiteral("auto")) {
return result;
} else if (!aDuration.GetAsString().EqualsLiteral("auto")) {
aRv.ThrowTypeError<dom::MSG_INVALID_DURATION_ERROR>();
}
aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
return result;
}
@ -66,10 +68,23 @@ struct TimingParams
ErrorResult& aRv)
{
if (aIterationStart < 0) {
aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
aRv.ThrowTypeError<dom::MSG_ENFORCE_RANGE_OUT_OF_RANGE>(
NS_LITERAL_STRING("iterationStart"));
}
}
static void ValidateIterations(double aIterations, ErrorResult& aRv)
{
if (IsNaN(aIterations) || aIterations < 0) {
aRv.ThrowTypeError<dom::MSG_ENFORCE_RANGE_OUT_OF_RANGE>(
NS_LITERAL_STRING("iterations"));
}
}
static Maybe<ComputedTimingFunction> ParseEasing(const nsAString& aEasing,
nsIDocument* aDocument,
ErrorResult& aRv);
// mDuration.isNothing() represents the "auto" value
Maybe<StickyTimeDuration> mDuration;
TimeDuration mDelay; // Initializes to zero

View File

@ -26,6 +26,7 @@ EXPORTS.mozilla += [
'ComputedTimingFunction.h',
'EffectCompositor.h',
'EffectSet.h',
'NonOwningAnimationTarget.h',
'PendingAnimationTracker.h',
'PseudoElementHashEntry.h',
'TimingParams.h',

View File

@ -14,6 +14,10 @@
background-color: yellow;
line-height: 16px;
}
.init::before {
content: "";
animation: anim 100s;
}
</style>
<div id=container><div id=target></div></div>
<script>
@ -27,6 +31,10 @@ var gObserver = new MutationObserver(function(newRecords) {
gRecordPromiseResolvers = [];
resolvers.forEach(fn => fn());
});
// Get the pseudo element target.
div.classList.add("init");
var pseudoTarget = document.getAnimations()[0].effect.target;
div.classList.remove("init");
// Asynchronous testing framework based on layout/style/test/animation_utils.js.
@ -161,8 +169,8 @@ function assert_records(expected, desc) {
// -- Tests ------------------------------------------------------------------
// We run all tests first targetting the div and observing the div, then again
// targetting the div and observing its parent while using the subtree:true
// We run all tests first targeting the div and observing the div, then again
// targeting the div and observing its parent while using the subtree:true
// MutationObserver option.
[
@ -1391,12 +1399,24 @@ function assert_records(expected, desc) {
});
addAsyncAnimTest("tree_ordering", { observe: div, subtree: true }, function*() {
// Add style for pseudo elements
var extraStyle = document.createElement('style');
document.head.appendChild(extraStyle);
var sheet = extraStyle.sheet;
var rules = { ".before::before": "animation: anim 100s;",
".after::after" : "animation: anim 100s, anim 100s;" };
for (var selector in rules) {
sheet.insertRule(selector + '{' + rules[selector] + '}',
sheet.cssRules.length);
}
// Create a tree with two children:
//
// div
// / \
// childA childB
// div
// (::before)
// (::after)
// / \
// childA childB(::before)
var childA = document.createElement("div");
var childB = document.createElement("div");
@ -1411,9 +1431,26 @@ addAsyncAnimTest("tree_ordering", { observe: div, subtree: true }, function*() {
div.style = "animation: anim 100s, anim 100s, anim 100s";
childA.style = "animation: anim 100s, anim 100s";
// Start animations targeting to pseudo element of div and childB.
childB.classList.add("before");
div.classList.add("after");
div.classList.add("before");
// Check all animations we have in this document
var docAnims = document.getAnimations();
is(docAnims.length, 10, "total animations");
var divAnimations = div.getAnimations();
var childAAnimations = childA.getAnimations();
var childBAnimations = childB.getAnimations();
var divBeforeAnimations =
[ for (x of docAnims) if (x.effect.target.parentElement == div &&
x.effect.target.type == "::before") x ];
var divAfterAnimations =
[ for (x of docAnims) if (x.effect.target.parentElement == div &&
x.effect.target.type == "::after") x ];
var childBPseudoAnimations =
[ for (x of docAnims) if (x.effect.target.parentElement == childB) x ];
// The order in which we get the corresponding records is currently
// based on the order we visit these nodes when updating styles.
@ -1423,11 +1460,15 @@ addAsyncAnimTest("tree_ordering", { observe: div, subtree: true }, function*() {
// future but for now all we are interested in testing here is that the order
// these records are dispatched is consistent between runs.
//
// We currently expect to get records in order childA, childB, div
// We currently expect to get records in order div::after, childA, childB,
// childB::before, div, div::before
yield await_frame();
assert_records([{ added: childAAnimations, changed: [], removed: [] },
assert_records([{ added: divAfterAnimations, changed: [], removed: [] },
{ added: childAAnimations, changed: [], removed: [] },
{ added: childBAnimations, changed: [], removed: [] },
{ added: divAnimations, changed: [], removed: [] }],
{ added: childBPseudoAnimations, changed: [], removed: [] },
{ added: divAnimations, changed: [], removed: [] },
{ added: divBeforeAnimations, changed: [], removed: [] }],
"records after simultaneous animation start");
// The one case where we *do* currently perform document-level (or actually
@ -1435,14 +1476,15 @@ addAsyncAnimTest("tree_ordering", { observe: div, subtree: true }, function*() {
// driver tick. In particular, this means that when animations finish
// naturally the removed records should be dispatched according to the
// position of the elements in the tree.
//
// First, flatten the set of animations.
var animations = [ divAnimations,
childAAnimations,
childBAnimations ].reduce(
(a, b) => a.concat(b), []
);
// First, flatten the set of animations. we put the animations targeting to
// pseudo elements last. (Actually, we don't care the order in the list.)
var animations = [ ...divAnimations,
...childAAnimations,
...childBAnimations,
...divBeforeAnimations,
...divAfterAnimations,
...childBPseudoAnimations ];
// Fast-forward to *just* before the end of the animation.
animations.forEach(animation => animation.currentTime = 99999);
@ -1457,7 +1499,13 @@ addAsyncAnimTest("tree_ordering", { observe: div, subtree: true }, function*() {
// After the changed notifications, which will be dispatched in the order that
// the animations were seeked, we should get removal MutationRecords in order
// div, childA, childB
// (div, div::before, div::after), childA, (childB, childB::before).
// Note: The animations targeting to the pseudo element are appended after
// the animations of its parent element.
divAnimations = [ ...divAnimations,
...divBeforeAnimations,
...divAfterAnimations ];
childBAnimations = [ ...childBAnimations, ...childBPseudoAnimations ];
assert_records(seekRecords.concat(
{ added: [], changed: [], removed: divAnimations },
{ added: [], changed: [], removed: childAAnimations },
@ -1465,55 +1513,60 @@ addAsyncAnimTest("tree_ordering", { observe: div, subtree: true }, function*() {
"records after finishing");
// Clean up
div.classList.remove("before");
div.classList.remove("after");
div.style = "";
childA.remove();
childB.remove();
extraStyle.remove();
});
[ div, pseudoTarget ].forEach(function(target) {
addAsyncAnimTest("change_duration_and_currenttime",
{ observe: div, subtree: true }, function*() {
var anim = target.animate({ opacity: [ 0, 1 ] }, 100000);
addAsyncAnimTest("change_duration_and_currenttime",
{ observe: div, subtree: true }, function*() {
var anim = div.animate({ opacity: [ 0, 1 ] }, 100000);
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation is added");
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation is added");
anim.effect.timing.duration = 10000;
yield await_frame();
anim.effect.timing.duration = 10000;
yield await_frame();
assert_records([{ added: [], changed: [anim], removed: [] }],
"records after duration is changed");
assert_records([{ added: [], changed: [anim], removed: [] }],
"records after duration is changed");
anim.effect.timing.duration = 10000;
yield await_frame();
assert_records([], "records after assigning same value");
anim.effect.timing.duration = 10000;
yield await_frame();
assert_records([], "records after assigning same value");
anim.currentTime = 50000;
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after animation end");
anim.currentTime = 50000;
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after animation end");
anim.effect.timing.duration = 100000;
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation restarted");
anim.effect.timing.duration = 100000;
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation restarted");
anim.effect.timing.duration = "auto";
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after duration set \"auto\"");
anim.effect.timing.duration = "auto";
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after duration set \"auto\"");
anim.effect.timing.duration = "auto";
yield await_frame();
assert_records([], "records after assigning same value \"auto\"");
anim.effect.timing.duration = "auto";
yield await_frame();
assert_records([], "records after assigning same value \"auto\"");
anim.cancel();
yield await_frame();
anim.cancel();
yield await_frame();
});
});
addAsyncAnimTest("change_enddelay_and_currenttime",
{ observe: div, subtree: true }, function*() {
var anim = div.animate({ opacity: [ 0, 1 ] }, { duration: 100000 });
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation is added");
@ -1548,6 +1601,22 @@ addAsyncAnimTest("change_enddelay_and_currenttime",
assert_records([], "records after animation is added");
});
addAsyncAnimTest("exclude_animations_targeting_pseudo_elements",
{ observe: div, subtree: false }, function*() {
var anim = div.animate({ opacity: [ 0, 1 ] }, { duration: 100000 });
var pAnim = pseudoTarget.animate({ opacity: [ 0, 1 ] }, { duration: 100000 });
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation is added");
anim.finish();
pAnim.finish();
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after animation is finished");
});
// Run the tests.
SimpleTest.requestLongerTimeout(2);
SimpleTest.waitForExplicitFinish();

View File

@ -388,31 +388,33 @@ nsAnimationReceiver::RecordAnimationMutation(Animation* aAnimation,
return;
}
mozilla::dom::Element* animationTarget;
CSSPseudoElementType pseudoType;
effect->GetTarget(animationTarget, pseudoType);
Maybe<NonOwningAnimationTarget> animationTarget = effect->GetTarget();
if (!animationTarget) {
return;
}
if (!Animations() || !(Subtree() || animationTarget == Target()) ||
animationTarget->ChromeOnlyAccess()) {
dom::Element* elem = animationTarget->mElement;
if (!Animations() || !(Subtree() || elem == Target()) ||
elem->ChromeOnlyAccess()) {
return;
}
// Record animations targeting to a pseudo element only when subtree is true.
if (animationTarget->mPseudoType != CSSPseudoElementType::NotPseudo &&
!Subtree()) {
return;
}
if (nsAutoAnimationMutationBatch::IsBatching()) {
switch (aMutationType) {
case eAnimationMutation_Added:
nsAutoAnimationMutationBatch::AnimationAdded(aAnimation,
animationTarget);
nsAutoAnimationMutationBatch::AnimationAdded(aAnimation, elem);
break;
case eAnimationMutation_Changed:
nsAutoAnimationMutationBatch::AnimationChanged(aAnimation,
animationTarget);
nsAutoAnimationMutationBatch::AnimationChanged(aAnimation, elem);
break;
case eAnimationMutation_Removed:
nsAutoAnimationMutationBatch::AnimationRemoved(aAnimation,
animationTarget);
nsAutoAnimationMutationBatch::AnimationRemoved(aAnimation, elem);
break;
}
@ -425,7 +427,7 @@ nsAnimationReceiver::RecordAnimationMutation(Animation* aAnimation,
NS_ASSERTION(!m->mTarget, "Wrong target!");
m->mTarget = animationTarget;
m->mTarget = elem;
switch (aMutationType) {
case eAnimationMutation_Added:

View File

@ -911,6 +911,8 @@ private:
typedef nsTArray<Entry> EntryArray;
nsClassHashtable<nsPtrHashKey<nsINode>, EntryArray> mEntryTable;
// List of nodes referred to by mEntryTable so we can sort them
// For a specific pseudo element, we use its parent element as the
// batch target, so they will be put in the same EntryArray.
nsTArray<nsINode*> mBatchTargets;
};

View File

@ -943,6 +943,11 @@ public:
*/
nsINode* SubtreeRoot() const;
nsINode* RootNode() const
{
return SubtreeRoot();
}
/**
* See nsIDOMEventTarget
*/

View File

@ -119,50 +119,7 @@ nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound)
return mimeType;
}
// Now let's check with the MIME service.
nsCOMPtr<nsIMIMEService> mimeSrv = do_GetService("@mozilla.org/mime;1");
if (!mimeSrv) {
return nullptr;
}
nsCOMPtr<nsIMIMEInfo> mimeInfo;
mimeSrv->GetFromTypeAndExtension(NS_ConvertUTF16toUTF8(lowerName),
EmptyCString(), getter_AddRefs(mimeInfo));
if (!mimeInfo) {
return nullptr;
}
// Now we check whether we can really claim to support this type
nsHandlerInfoAction action = nsIHandlerInfo::saveToDisk;
mimeInfo->GetPreferredAction(&action);
if (action != nsIMIMEInfo::handleInternally) {
bool hasHelper = false;
mimeInfo->GetHasDefaultHandler(&hasHelper);
if (!hasHelper) {
nsCOMPtr<nsIHandlerApp> helper;
mimeInfo->GetPreferredApplicationHandler(getter_AddRefs(helper));
if (!helper) {
// mime info from the OS may not have a PreferredApplicationHandler
// so just check for an empty default description
nsAutoString defaultDescription;
mimeInfo->GetDefaultDescription(defaultDescription);
if (defaultDescription.IsEmpty()) {
// no support; just leave
return nullptr;
}
}
}
}
// If we got here, we support this type! Say so.
aFound = true;
nsMimeType *mt = new nsMimeType(mWindow, lowerName);
mMimeTypes.AppendElement(mt);
return mt;
return nullptr;
}
bool
@ -228,13 +185,7 @@ nsMimeType::nsMimeType(nsPIDOMWindowInner* aWindow,
mDescription(aDescription),
mExtension(aExtension)
{
}
nsMimeType::nsMimeType(nsPIDOMWindowInner* aWindow, const nsAString& aType)
: mWindow(aWindow),
mPluginElement(nullptr),
mType(aType)
{
MOZ_ASSERT(aPluginElement);
}
nsMimeType::~nsMimeType()
@ -263,6 +214,8 @@ nsMimeType::GetDescription(nsString& aRetval) const
nsPluginElement*
nsMimeType::GetEnabledPlugin() const
{
// mPluginElement might be null if we got unlinked but are still somehow being
// called into.
if (!mPluginElement || !mPluginElement->PluginTag()->IsEnabled()) {
return nullptr;
}

View File

@ -63,7 +63,6 @@ public:
const nsAString& aType,
const nsAString& aDescription,
const nsAString& aExtension);
nsMimeType(nsPIDOMWindowInner* aWindow, const nsAString& aMimeType);
nsPIDOMWindowInner* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@ -83,10 +82,9 @@ protected:
nsCOMPtr<nsPIDOMWindowInner> mWindow;
// Strong reference to the active plugin, if any. Note that this
// creates an explicit reference cycle through the plugin element's
// mimetype array. We rely on the cycle collector to break this
// cycle.
// Strong reference to the active plugin. Note that this creates an explicit
// reference cycle through the plugin element's mimetype array. We rely on the
// cycle collector to break this cycle.
RefPtr<nsPluginElement> mPluginElement;
nsString mType;
nsString mDescription;

View File

@ -227,68 +227,59 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
aPreviousSibling));
}
Element*
Maybe<NonOwningAnimationTarget>
nsNodeUtils::GetTargetForAnimation(const Animation* aAnimation)
{
KeyframeEffectReadOnly* effect = aAnimation->GetEffect();
if (!effect) {
return nullptr;
return effect ? effect->GetTarget() : Nothing();
}
void
nsNodeUtils::AnimationMutated(Animation* aAnimation,
AnimationMutationType aMutatedType)
{
Maybe<NonOwningAnimationTarget> target = GetTargetForAnimation(aAnimation);
if (!target) {
return;
}
Element* target;
CSSPseudoElementType pseudoType;
effect->GetTarget(target, pseudoType);
// If the animation targets a pseudo-element, we don't dispatch
// notifications for it. (In the future we will have PseudoElement
// objects we can use as the target of the notifications.)
if (pseudoType != CSSPseudoElementType::NotPseudo) {
return nullptr;
// A pseudo element and its parent element use the same owner doc.
nsIDocument* doc = target->mElement->OwnerDoc();
if (doc->MayHaveAnimationObservers()) {
// we use the its parent element as the subject in DOM Mutation Observer.
Element* elem = target->mElement;
switch (aMutatedType) {
case AnimationMutationType::Added:
IMPL_ANIMATION_NOTIFICATION(AnimationAdded, elem, (aAnimation));
break;
case AnimationMutationType::Changed:
IMPL_ANIMATION_NOTIFICATION(AnimationChanged, elem, (aAnimation));
break;
case AnimationMutationType::Removed:
IMPL_ANIMATION_NOTIFICATION(AnimationRemoved, elem, (aAnimation));
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected mutation type");
}
}
return target;
}
void
nsNodeUtils::AnimationAdded(Animation* aAnimation)
{
Element* target = GetTargetForAnimation(aAnimation);
if (!target) {
return;
}
nsIDocument* doc = target->OwnerDoc();
if (doc->MayHaveAnimationObservers()) {
IMPL_ANIMATION_NOTIFICATION(AnimationAdded, target, (aAnimation));
}
AnimationMutated(aAnimation, AnimationMutationType::Added);
}
void
nsNodeUtils::AnimationChanged(Animation* aAnimation)
{
Element* target = GetTargetForAnimation(aAnimation);
if (!target) {
return;
}
nsIDocument* doc = target->OwnerDoc();
if (doc->MayHaveAnimationObservers()) {
IMPL_ANIMATION_NOTIFICATION(AnimationChanged, target, (aAnimation));
}
AnimationMutated(aAnimation, AnimationMutationType::Changed);
}
void
nsNodeUtils::AnimationRemoved(Animation* aAnimation)
{
Element* target = GetTargetForAnimation(aAnimation);
if (!target) {
return;
}
nsIDocument* doc = target->OwnerDoc();
if (doc->MayHaveAnimationObservers()) {
IMPL_ANIMATION_NOTIFICATION(AnimationRemoved, target, (aAnimation));
}
AnimationMutated(aAnimation, AnimationMutationType::Removed);
}
void

View File

@ -7,6 +7,8 @@
#ifndef nsNodeUtils_h___
#define nsNodeUtils_h___
#include "mozilla/Maybe.h"
#include "mozilla/NonOwningAnimationTarget.h"
#include "nsIContent.h" // for use in inline function (ParentChainChanged)
#include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged)
#include "js/TypeDecls.h"
@ -142,8 +144,18 @@ public:
}
}
static mozilla::dom::Element*
/**
* Utility function to get the target (pseudo-)element associated with an
* animation.
* @param aAnimation The animation whose target is what we want.
*/
static mozilla::Maybe<mozilla::NonOwningAnimationTarget>
GetTargetForAnimation(const mozilla::dom::Animation* aAnimation);
/**
* Notify that an animation is added/changed/removed.
* @param aAnimation The animation we added/changed/removed.
*/
static void AnimationAdded(mozilla::dom::Animation* aAnimation);
static void AnimationChanged(mozilla::dom::Animation* aAnimation);
static void AnimationRemoved(mozilla::dom::Animation* aAnimation);
@ -299,6 +311,22 @@ private:
JS::Handle<JSObject*> aReparentScope,
nsCOMArray<nsINode> &aNodesWithProperties,
nsINode *aParent, nsINode **aResult);
enum class AnimationMutationType
{
Added,
Changed,
Removed
};
/**
* Notify the observers of the target of an animation
* @param aAnimation The mutated animation.
* @param aMutationType The mutation type of this animation. It could be
* Added, Changed, or Removed.
*/
static void AnimationMutated(mozilla::dom::Animation* aAnimation,
AnimationMutationType aMutatedType);
};
#endif // nsNodeUtils_h___

View File

@ -92,3 +92,5 @@ MSG_DEF(MSG_SW_INSTALL_ERROR, 2, JSEXN_TYPEERR, "ServiceWorker script at {0} for
MSG_DEF(MSG_SW_SCRIPT_THREW, 2, JSEXN_TYPEERR, "ServiceWorker script at {0} for scope {1} threw an exception during script evaluation.")
MSG_DEF(MSG_TYPEDARRAY_IS_SHARED, 1, JSEXN_TYPEERR, "{0} can't be a typed array on SharedArrayBuffer")
MSG_DEF(MSG_CACHE_ADD_FAILED_RESPONSE, 3, JSEXN_TYPEERR, "Cache got {0} response with bad status {1} while trying to add request {2}")
MSG_DEF(MSG_INVALID_DURATION_ERROR, 0, JSEXN_TYPEERR, "Invalid duration.")
MSG_DEF(MSG_INVALID_EASING_ERROR, 0, JSEXN_TYPEERR, "Invalid easing.")

View File

@ -2468,12 +2468,12 @@ public:
virtual float GetExLength() const override
{
gfxTextPerfMetrics* tp = mPresContext->GetTextPerfMetrics();
RefPtr<nsFontMetrics> fontMetrics;
nsDeviceContext* dc = mPresContext->DeviceContext();
dc->GetMetricsFor(mFont, mFontLanguage, mExplicitLanguage,
gfxFont::eHorizontal, nullptr, tp,
*getter_AddRefs(fontMetrics));
nsFontMetrics::Params params;
params.language = mFontLanguage;
params.explicitLanguage = mExplicitLanguage;
params.textPerf = mPresContext->GetTextPerfMetrics();
RefPtr<nsFontMetrics> fontMetrics = dc->GetMetricsFor(mFont, params);
return NSAppUnitsToFloatPixels(fontMetrics->XHeight(),
nsPresContext::AppUnitsPerCSSPixel());
}
@ -3230,14 +3230,13 @@ CanvasRenderingContext2D::SetFontInternal(const nsAString& aFont,
resizedFont.size =
(fontStyle->mSize * c->AppUnitsPerDevPixel()) / c->AppUnitsPerCSSPixel();
RefPtr<nsFontMetrics> metrics;
c->DeviceContext()->GetMetricsFor(resizedFont,
fontStyle->mLanguage,
fontStyle->mExplicitLanguage,
gfxFont::eHorizontal,
c->GetUserFontSet(),
c->GetTextPerfMetrics(),
*getter_AddRefs(metrics));
nsFontMetrics::Params params;
params.language = fontStyle->mLanguage;
params.explicitLanguage = fontStyle->mExplicitLanguage;
params.userFontSet = c->GetUserFontSet();
params.textPerf = c->GetTextPerfMetrics();
RefPtr<nsFontMetrics> metrics =
c->DeviceContext()->GetMetricsFor(resizedFont, params);
gfxFontGroup* newFontGroup = metrics->GetThebesFontGroup();
CurrentState().fontGroup = newFontGroup;
@ -4962,6 +4961,10 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& aWindow, double aX,
EnsureTarget();
if (drawDT) {
RefPtr<SourceSurface> snapshot = drawDT->Snapshot();
if (NS_WARN_IF(!snapshot)) {
aError.Throw(NS_ERROR_FAILURE);
return;
}
RefPtr<DataSourceSurface> data = snapshot->GetDataSurface();
DataSourceSurface::MappedSurface rawData;

View File

@ -20,16 +20,15 @@ pref(webgl.force-layers-readback,true) == webgl-clear-test.html?readback wrappe
== webgl-resize-test.html wrapper.html?green.png
# Check that captureStream() displays in a local video element
skip-if(winWidget&&layersGPUAccelerated&&d2d) == webgl-capturestream-test.html?preserve wrapper.html?green.png
== webgl-capturestream-test.html?preserve wrapper.html?green.png
# Some of the failure conditions are a little crazy. I'm (jgilbert) setting these based on
# failures encountered when running on Try, and then targetting the Try config by
# differences in the `sandbox` contents. That is, I'm labeling based on symptoms rather
# than cause.
# Lin-R-e10s: gtkWidget && browserIsRemote
# WinXP-R: winWidget && layersGPUAccelerated && !d2d
# Win7+-R: winWidget && layersGPUAccelerated && d2d
# Win7+-Ru: winWidget && !layersGPUAccelerated
# WinXP R: winWidget && layersGPUAccelerated && !d3d11
# Win7+ R: winWidget && layersGPUAccelerated && d3d11
# Win7+ Ru: winWidget && !layersGPUAccelerated && d3d11
# (Note that we have to remove spaces when used below)
# IMPORTANT: Expected outcomes are evaluated left-to-right, and they replace eachother.
@ -42,73 +41,73 @@ skip-if(winWidget&&layersGPUAccelerated&&d2d) == webgl-capturestream-test.html?p
# Does we draw the correct colors in the correct places?
# Combinations: PowerSet([readback, aa, preserve, premult, alpha]) x [frame=1,frame=6]
# This is 2^6 = 64 combinations.
== webgl-color-test.html?frame=1&__&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
== webgl-color-test.html?frame=1&__&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&aa&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&__&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&aa&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&__&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=1&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
== webgl-color-test.html?frame=1&__&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&aa&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&__&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=1&aa&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&__&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d3d11)) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
== webgl-color-test.html?frame=6&__&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&aa&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&__&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&aa&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&__&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
== webgl-color-test.html?frame=6&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
== webgl-color-test.html?frame=6&__&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&aa&________&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&__&preserve&premult&alpha wrapper.html?colors-premult.png
== webgl-color-test.html?frame=6&aa&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d3d11)) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
fuzzy(1,30000) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
# Check for hanging bindings/state settings:
== webgl-hanging-fb-test.html?__&________ wrapper.html?green.png
@ -157,6 +156,6 @@ pref(canvas.focusring.enabled,true) skip-if(B2G) skip-if(cocoaWidget) skip-if(wi
pref(canvas.customfocusring.enabled,true) skip-if(B2G) skip-if(cocoaWidget) skip-if(Android) skip-if(winWidget) needs-focus == drawCustomFocusRing.html drawCustomFocusRing-ref.html
# Check that captureStream() displays in a local video element
skip-if(winWidget&&layersGPUAccelerated&&d2d) == capturestream.html wrapper.html?green.png
== capturestream.html wrapper.html?green.png
fuzzy-if(azureSkiaGL,1,2) fuzzy-if(Android,3,40) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),1,1) == 1177726-text-stroke-bounds.html 1177726-text-stroke-bounds-ref.html

View File

@ -1453,23 +1453,14 @@ ContentEventHandler::OnQueryCaretRect(WidgetQueryContentEvent* aEvent)
rect.x = posInFrame.x;
rect.y = posInFrame.y;
nscoord fontHeight = 0;
float inflation = nsLayoutUtils::FontSizeInflationFor(frame);
RefPtr<nsFontMetrics> fontMetrics;
rv = nsLayoutUtils::GetFontMetricsForFrame(frame, getter_AddRefs(fontMetrics),
inflation);
if (NS_WARN_IF(!fontMetrics)) {
// If we cannot get font height, use frame size instead.
fontHeight = isVertical ? frame->GetSize().width : frame->GetSize().height;
} else {
fontHeight = fontMetrics->MaxAscent() + fontMetrics->MaxDescent();
}
RefPtr<nsFontMetrics> fontMetrics =
nsLayoutUtils::GetInflatedFontMetricsForFrame(frame);
if (isVertical) {
rect.width = fontHeight;
rect.width = fontMetrics->MaxHeight();
rect.height = caretRect.height;
} else {
rect.width = caretRect.width;
rect.height = fontHeight;
rect.height = fontMetrics->MaxHeight();
}
rv = ConvertToRootRelativeOffset(frame, rect);

View File

@ -17,21 +17,30 @@ using namespace mozilla::dom;
CustomEvent::CustomEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent)
: Event(aOwner, aPresContext, aEvent)
: Event(aOwner, aPresContext, aEvent)
, mDetail(JS::NullValue())
{
mozilla::HoldJSObjects(this);
}
CustomEvent::~CustomEvent() {}
CustomEvent::~CustomEvent()
{
mozilla::DropJSObjects(this);
}
NS_IMPL_CYCLE_COLLECTION_CLASS(CustomEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(CustomEvent, Event)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDetail)
tmp->mDetail.setUndefined();
mozilla::DropJSObjects(this);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CustomEvent, Event)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDetail)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(CustomEvent, Event)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mDetail)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_ADDREF_INHERITED(CustomEvent, Event)
NS_IMPL_RELEASE_INHERITED(CustomEvent, Event)
@ -66,8 +75,21 @@ CustomEvent::InitCustomEvent(const nsAString& aType,
bool aCancelable,
nsIVariant* aDetail)
{
AutoJSAPI jsapi;
NS_ENSURE_STATE(jsapi.Init(GetParentObject()));
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> detail(cx);
if (!aDetail) {
detail = JS::NullValue();
} else if (NS_WARN_IF(!VariantToJsval(cx, aDetail, &detail))) {
JS_ClearPendingException(cx);
return NS_ERROR_FAILURE;
}
Event::InitEvent(aType, aCanBubble, aCancelable);
mDetail = aDetail;
mDetail = detail;
return NS_OK;
}
@ -79,35 +101,36 @@ CustomEvent::InitCustomEvent(JSContext* aCx,
JS::Handle<JS::Value> aDetail,
ErrorResult& aRv)
{
nsCOMPtr<nsIVariant> detail;
if (nsIXPConnect* xpc = nsContentUtils::XPConnect()) {
xpc->JSToVariant(aCx, aDetail, getter_AddRefs(detail));
}
if (!detail) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
InitCustomEvent(aType, aCanBubble, aCancelable, detail);
Event::InitEvent(aType, aCanBubble, aCancelable);
mDetail = aDetail;
}
NS_IMETHODIMP
CustomEvent::GetDetail(nsIVariant** aDetail)
{
NS_IF_ADDREF(*aDetail = mDetail);
return NS_OK;
if (mDetail.isNull()) {
*aDetail = nullptr;
return NS_OK;
}
AutoJSAPI jsapi;
NS_ENSURE_STATE(jsapi.Init(GetParentObject()));
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> detail(cx, mDetail);
nsIXPConnect* xpc = nsContentUtils::XPConnect();
if (NS_WARN_IF(!xpc)) {
return NS_ERROR_FAILURE;
}
return xpc->JSToVariant(cx, detail, aDetail);
}
void
CustomEvent::GetDetail(JSContext* aCx,
JS::MutableHandle<JS::Value> aRetval)
{
if (!mDetail) {
aRetval.setNull();
return;
}
VariantToJsval(aCx, mDetail, aRetval);
aRetval.set(mDetail);
}
already_AddRefed<CustomEvent>

View File

@ -21,7 +21,7 @@ class CustomEvent final : public Event,
private:
virtual ~CustomEvent();
nsCOMPtr<nsIVariant> mDetail;
JS::Heap<JS::Value> mDetail;
public:
explicit CustomEvent(mozilla::dom::EventTarget* aOwner,
@ -29,7 +29,7 @@ public:
mozilla::WidgetEvent* aEvent = nullptr);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CustomEvent, Event)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CustomEvent, Event)
NS_FORWARD_TO_EVENT
NS_DECL_NSIDOMCUSTOMEVENT

View File

@ -2513,9 +2513,8 @@ EventStateManager::GetScrollAmount(nsPresContext* aPresContext,
if (!rootFrame) {
return nsSize(0, 0);
}
RefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(rootFrame, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(rootFrame));
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetInflatedFontMetricsForFrame(rootFrame);
NS_ENSURE_TRUE(fm, nsSize(0, 0));
return nsSize(fm->AveCharWidth(), fm->MaxHeight());
}

View File

@ -46,6 +46,8 @@ skip-if = buildapp == 'b2g' # b2g(2 failures out of 8, mousewheel test) b2g-debu
[test_bug426082.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || os == "win" || toolkit == 'android' || e10s # Intermittent failures, bug 921693 # b2g(1 failure out of 6, Moving the mouse down from the label should have unpressed the button) b2g-debug(1 failure out of 6, Moving the mouse down from the label should have unpressed the button) b2g-desktop(1 failure out of 6, Moving the mouse down from the label should have unpressed the button)
[test_bug427537.html]
[test_bug1003432.html]
support-files = test_bug1003432.js
[test_bug428988.html]
[test_bug432698.html]
skip-if = buildapp == 'mulet'

View File

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1003432
-->
<head>
<title>Test for Bug 1003432</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1003432">Mozilla Bug 1003432</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 1003432 **/
// Test CustomEvent on worker
SimpleTest.waitForExplicitFinish();
var worker = new Worker("test_bug1003432.js");
ok(worker, "Should have worker!");
var count = 0;
worker.onmessage = function(evt) {
is(evt.data.type, "foobar", "Should get 'foobar' event!");
is(evt.data.detail, "test", "Detail should be 'test'.");
ok(evt.data.bubbles, "Event should bubble!");
ok(evt.data.cancelable, "Event should be cancelable.");
// wait for test results of constructor and initCustomEvent
if (++count == 2) {
worker.terminate();
SimpleTest.finish();
}
};
worker.postMessage("");
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,23 @@
addEventListener("foobar",
function(evt) {
postMessage(
{
type: evt.type,
bubbles: evt.bubbles,
cancelable: evt.cancelable,
detail: evt.detail
});
}, true);
addEventListener("message",
function(evt) {
// Test the constructor of CustomEvent
var e = new CustomEvent("foobar",
{bubbles:true, cancelable: true, detail:"test"});
dispatchEvent(e);
// Test initCustomEvent
e = new CustomEvent("foobar");
e.initCustomEvent("foobar", true, true, "test");
dispatchEvent(e);
}, true);

View File

@ -39,6 +39,10 @@ document.addEventListener("foobar",
document.dispatchEvent(e);
ok(didCallListener, "Should have called listener!");
e = document.createEvent("CustomEvent");
e.initEvent("foo", true, true);
is(e.detail, null, "Default detail should be null.");
e = document.createEvent("CustomEvent");
e.initCustomEvent("foobar", true, true, 1);
is(e.detail, 1, "Detail should be 1.");

View File

@ -5299,9 +5299,10 @@ public:
Finish(uint64_t aTransactionId, FinishCallback* aCallback);
void
CloseDatabaseWhenIdle(const nsACString& aDatabaseId)
CloseDatabaseWhenIdle(const nsACString& aDatabaseId,
uintptr_t aCallsite)
{
Unused << CloseDatabaseWhenIdleInternal(aDatabaseId);
Unused << CloseDatabaseWhenIdleInternal(aDatabaseId, aCallsite);
}
void
@ -5363,7 +5364,8 @@ private:
CloseDatabase(DatabaseInfo* aDatabaseInfo, uintptr_t aCallsite);
bool
CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId);
CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId,
uintptr_t aCallsite);
};
class ConnectionPool::ConnectionRunnable
@ -10915,8 +10917,8 @@ UpdateRefcountFunction::Reset()
if (aFileManager->EnforcingQuota()) {
rv = file->GetFileSize(&fileSize);
if (NS_WARN_IF(!file)) {
return NS_ERROR_FAILURE;
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
@ -11645,7 +11647,7 @@ ConnectionPool::WaitForDatabasesToComplete(nsTArray<nsCString>&& aDatabaseIds,
const nsCString& databaseId = aDatabaseIds[index];
MOZ_ASSERT(!databaseId.IsEmpty());
if (CloseDatabaseWhenIdleInternal(databaseId)) {
if (CloseDatabaseWhenIdleInternal(databaseId, 0x6)) {
mayRunCallbackImmediately = false;
}
}
@ -12149,7 +12151,7 @@ ConnectionPool::NoteIdleDatabase(DatabaseInfo* aDatabaseInfo)
{
AssertIsOnOwningThread();
MOZ_ASSERT(aDatabaseInfo);
MOZ_ASSERT(!aDatabaseInfo->TotalTransactionCount());
MOZ_RELEASE_ASSERT(!aDatabaseInfo->TotalTransactionCount());
MOZ_ASSERT(aDatabaseInfo->mThreadInfo.mThread);
MOZ_ASSERT(aDatabaseInfo->mThreadInfo.mRunnable);
MOZ_ASSERT(!mIdleDatabases.Contains(aDatabaseInfo));
@ -12323,7 +12325,7 @@ ConnectionPool::PerformIdleDatabaseMaintenance(DatabaseInfo* aDatabaseInfo)
{
AssertIsOnOwningThread();
MOZ_ASSERT(aDatabaseInfo);
MOZ_ASSERT(!aDatabaseInfo->TotalTransactionCount());
MOZ_RELEASE_ASSERT(!aDatabaseInfo->TotalTransactionCount());
MOZ_ASSERT(aDatabaseInfo->mThreadInfo.mThread);
MOZ_ASSERT(aDatabaseInfo->mThreadInfo.mRunnable);
MOZ_ASSERT(aDatabaseInfo->mIdle);
@ -12369,7 +12371,8 @@ ConnectionPool::CloseDatabase(DatabaseInfo* aDatabaseInfo,
}
bool
ConnectionPool::CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId)
ConnectionPool::CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId,
uintptr_t aCallsite)
{
AssertIsOnOwningThread();
MOZ_ASSERT(!aDatabaseId.IsEmpty());
@ -12381,7 +12384,7 @@ ConnectionPool::CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId)
if (DatabaseInfo* dbInfo = mDatabases.Get(aDatabaseId)) {
if (mIdleDatabases.RemoveElement(dbInfo) ||
mDatabasesPerformingIdleMaintenance.RemoveElement(dbInfo)) {
CloseDatabase(dbInfo, 5);
CloseDatabase(dbInfo, aCallsite);
AdjustIdleTimer();
} else {
dbInfo->mCloseOnIdle = true;
@ -13656,7 +13659,7 @@ Database::CloseInternal()
mClosed = true;
if (gConnectionPool) {
gConnectionPool->CloseDatabaseWhenIdle(Id());
gConnectionPool->CloseDatabaseWhenIdle(Id(), 0x7);
}
DatabaseActorInfo* info;

View File

@ -20,8 +20,7 @@ public:
mParsedFrames(0),
mDecodedFrames(0),
mPresentedFrames(0),
mDroppedFrames(0),
mCorruptFrames(0) {}
mDroppedFrames(0) {}
// Returns number of frames which have been parsed from the media.
// Can be called on any thread.
@ -49,12 +48,7 @@ public:
// compoisition deadline.
uint32_t GetDroppedFrames() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
return mDroppedFrames + mCorruptFrames;
}
uint32_t GetCorruptedFrames() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
return mCorruptFrames;
return mDroppedFrames;
}
// Increments the parsed and decoded frame counters by the passed in counts.
@ -76,11 +70,6 @@ public:
++mPresentedFrames;
}
void NotifyCorruptFrame() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
++mCorruptFrames;
}
private:
~FrameStatistics() {}
@ -100,8 +89,6 @@ private:
uint32_t mPresentedFrames;
uint32_t mDroppedFrames;
uint32_t mCorruptFrames;
};
} // namespace mozilla

View File

@ -281,8 +281,6 @@ public:
// decoding.
virtual bool VideoIsHardwareAccelerated() const { return false; }
virtual void DisableHardwareAcceleration() {}
TimedMetadataEventSource& TimedMetadataEvent()
{
return mTimedMetadataEvent;

View File

@ -238,7 +238,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
mDropAudioUntilNextDiscontinuity(false),
mDropVideoUntilNextDiscontinuity(false),
mCurrentTimeBeforeSeek(0),
mCorruptFrames(60),
mDecodingFirstFrame(true),
mSentLoadedMetadataEvent(false),
mSentFirstFrameLoadedEvent(false),
@ -461,12 +460,13 @@ void MediaDecoderStateMachine::DiscardStreamData()
}
}
bool MediaDecoderStateMachine::HaveEnoughDecodedAudio(int64_t aAmpleAudioUSecs)
bool MediaDecoderStateMachine::HaveEnoughDecodedAudio()
{
MOZ_ASSERT(OnTaskQueue());
int64_t ampleAudioUSecs = mAmpleAudioThresholdUsecs * mPlaybackRate;
if (AudioQueue().GetSize() == 0 ||
GetDecodedAudioDuration() < aAmpleAudioUSecs) {
GetDecodedAudioDuration() < ampleAudioUSecs) {
return false;
}
@ -563,14 +563,12 @@ MediaDecoderStateMachine::NeedToDecodeAudio()
{
MOZ_ASSERT(OnTaskQueue());
SAMPLE_LOG("NeedToDecodeAudio() isDec=%d minPrl=%d enufAud=%d",
IsAudioDecoding(), mMinimizePreroll,
HaveEnoughDecodedAudio(mAmpleAudioThresholdUsecs * mPlaybackRate));
IsAudioDecoding(), mMinimizePreroll, HaveEnoughDecodedAudio());
return IsAudioDecoding() &&
mState != DECODER_STATE_SEEKING &&
((IsDecodingFirstFrame() && AudioQueue().GetSize() == 0) ||
(!mMinimizePreroll &&
!HaveEnoughDecodedAudio(mAmpleAudioThresholdUsecs * mPlaybackRate)));
(!mMinimizePreroll && !HaveEnoughDecodedAudio()));
}
bool
@ -894,10 +892,6 @@ MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideoSample,
(video ? video->GetEndTime() : -1),
(video ? video->mDiscontinuity : 0));
// Check frame validity here for every decoded frame in order to have a
// better chance to make the decision of turning off HW acceleration.
CheckFrameValidity(aVideoSample->As<VideoData>());
switch (mState) {
case DECODER_STATE_BUFFERING: {
// If we're buffering, this may be the sample we need to stop buffering.
@ -2419,33 +2413,6 @@ MediaDecoderStateMachine::Reset()
DecodeTaskQueue()->Dispatch(resetTask.forget());
}
void
MediaDecoderStateMachine::CheckFrameValidity(VideoData* aData)
{
MOZ_ASSERT(OnTaskQueue());
// Update corrupt-frames statistics
if (aData->mImage && !aData->mImage->IsValid() && !gfxPrefs::HardwareVideoDecodingForceEnabled()) {
FrameStatistics& frameStats = *mFrameStats;
frameStats.NotifyCorruptFrame();
// If more than 10% of the last 30 frames have been corrupted, then try disabling
// hardware acceleration. We use 10 as the corrupt value because RollingMean<>
// only supports integer types.
mCorruptFrames.insert(10);
if (mReader->VideoIsHardwareAccelerated() &&
frameStats.GetPresentedFrames() > 60 &&
mCorruptFrames.mean() >= 2 /* 20% */) {
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(mReader, &MediaDecoderReader::DisableHardwareAcceleration);
DecodeTaskQueue()->Dispatch(task.forget());
mCorruptFrames.clear();
gfxCriticalNote << "Too many dropped/corrupted frames, disabling DXVA";
}
} else {
mCorruptFrames.insert(0);
}
}
int64_t
MediaDecoderStateMachine::GetClock(TimeStamp* aTimeStamp) const
{

View File

@ -84,7 +84,6 @@ hardware (via AudioStream).
#include "mozilla/Attributes.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/RollingMean.h"
#include "mozilla/StateMirroring.h"
#include "nsThreadUtils.h"
@ -341,7 +340,7 @@ private:
// Discard audio/video data that are already played by MSG.
void DiscardStreamData();
bool HaveEnoughDecodedAudio(int64_t aAmpleAudioUSecs);
bool HaveEnoughDecodedAudio();
bool HaveEnoughDecodedVideo();
// Returns true if the state machine has shutdown or is in the process of
@ -454,10 +453,6 @@ protected:
// machine thread, caller must hold the decoder lock.
void UpdatePlaybackPositionInternal(int64_t aTime);
// Decode monitor must be held. To determine if MDSM needs to turn off HW
// acceleration.
void CheckFrameValidity(VideoData* aData);
// Update playback position and trigger next update by default time period.
// Called on the state machine thread.
void UpdatePlaybackPositionPeriodically();
@ -1131,8 +1126,6 @@ private:
mozilla::MediaMetadataManager mMetadataManager;
mozilla::RollingMean<uint32_t, uint32_t> mCorruptFrames;
// Track our request to update the buffered ranges
MozPromiseRequestHolder<MediaDecoderReader::BufferedUpdatePromise> mBufferedUpdateRequest;

View File

@ -68,7 +68,6 @@ MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
, mInitDone(false)
, mIsEncrypted(false)
, mTrackDemuxersMayBlock(false)
, mHardwareAccelerationDisabled(false)
, mDemuxOnly(false)
, mVideoFrameContainer(aVideoFrameContainer)
{
@ -406,7 +405,6 @@ MediaFormatReader::EnsureDecoderCreated(TrackType aTrack)
mInfo.mVideo,
decoder.mTaskQueue,
decoder.mCallback,
mHardwareAccelerationDisabled ? LayersBackend::LAYERS_NONE :
mLayersBackendType,
GetImageContainer());
break;
@ -471,23 +469,6 @@ MediaFormatReader::GetDecoderData(TrackType aTrack)
return mVideo;
}
void
MediaFormatReader::DisableHardwareAcceleration()
{
MOZ_ASSERT(OnTaskQueue());
if (HasVideo() && !mHardwareAccelerationDisabled) {
mHardwareAccelerationDisabled = true;
Flush(TrackInfo::kVideoTrack);
mVideo.ShutdownDecoder();
if (!EnsureDecoderCreated(TrackType::kVideoTrack)) {
LOG("Unable to re-create decoder, aborting");
NotifyError(TrackInfo::kVideoTrack);
return;
}
ScheduleUpdate(TrackInfo::kVideoTrack);
}
}
bool
MediaFormatReader::ShouldSkip(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold)
{

View File

@ -70,8 +70,6 @@ public:
bool VideoIsHardwareAccelerated() const override;
void DisableHardwareAcceleration() override;
bool IsWaitForDataSupported() override { return true; }
RefPtr<WaitForDataPromise> WaitForData(MediaData::Type aType) override;
@ -449,8 +447,6 @@ private:
// Set to true if any of our track buffers may be blocking.
bool mTrackDemuxersMayBlock;
bool mHardwareAccelerationDisabled;
// Set the demuxed-only flag.
Atomic<bool> mDemuxOnly;

View File

@ -244,7 +244,7 @@ MediaPermissionRequest::Allow(JS::HandleValue aChoices)
}
// iterate through audio-capture and video-capture
AutoJSAPI jsapi;
if (!jsapi.init(&aChoices.toObject())) {
if (!jsapi.Init(&aChoices.toObject())) {
return NS_ERROR_UNEXPECTED;
}
JSContext* cx = jsapi.cx();

View File

@ -277,6 +277,11 @@ bool
MediaSourceDecoder::CanPlayThrough()
{
MOZ_ASSERT(NS_IsMainThread());
if (NextFrameBufferedStatus() == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE) {
return false;
}
if (IsNaN(mMediaSource->Duration())) {
// Don't have any data yet.
return false;

View File

@ -66,6 +66,11 @@ static const DWORD sAMDPreUVD4[] = {
0x999c, 0x999d, 0x99a0, 0x99a2, 0x99a4
};
// The size we use for our synchronization surface.
// 16x16 is the size recommended by Microsoft (in the D3D9ExDXGISharedSurf sample) that works
// best to avoid driver bugs.
static const uint32_t kSyncSurfaceSize = 16;
namespace mozilla {
using layers::Image;
@ -100,6 +105,7 @@ private:
RefPtr<IDirect3DDeviceManager9> mDeviceManager;
RefPtr<D3D9RecycleAllocator> mTextureClientAllocator;
RefPtr<IDirectXVideoDecoderService> mDecoderService;
RefPtr<IDirect3DSurface9> mSyncSurface;
GUID mDecoderGUID;
UINT32 mResetToken;
bool mFirstFrame;
@ -392,12 +398,19 @@ D3D9DXVA2Manager::Init(nsACString& aFailureReason)
}
}
RefPtr<IDirect3DSurface9> syncSurf;
hr = device->CreateRenderTarget(kSyncSurfaceSize, kSyncSurfaceSize,
D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE,
0, TRUE, getter_AddRefs(syncSurf), NULL);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
mDecoderService = decoderService;
mResetToken = resetToken;
mD3D9 = d3d9Ex;
mDevice = device;
mDeviceManager = deviceManager;
mSyncSurface = syncSurf;
mTextureClientAllocator = new D3D9RecycleAllocator(layers::ImageBridgeChild::GetSingleton(),
mDevice);
@ -427,35 +440,20 @@ D3D9DXVA2Manager::CopyToImage(IMFSample* aSample,
hr = image->AllocateAndCopy(mTextureClientAllocator, surface, aRegion);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
// Flush the draw command now, so that by the time we come to draw this
// image, we're less likely to need to wait for the draw operation to
// complete.
RefPtr<IDirect3DQuery9> query;
hr = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, getter_AddRefs(query));
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
hr = query->Issue(D3DISSUE_END);
RefPtr<IDirect3DSurface9> sourceSurf = image->GetD3D9Surface();
// Copy a small rect into our sync surface, and then map it
// to block until decoding/color conversion completes.
RECT copyRect = { 0, 0, kSyncSurfaceSize, kSyncSurfaceSize };
hr = mDevice->StretchRect(sourceSurf, &copyRect, mSyncSurface, &copyRect, D3DTEXF_NONE);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
bool valid = false;
int iterations = 0;
while (iterations < (mFirstFrame ? 100 : 10)) {
hr = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
if (hr == S_FALSE) {
Sleep(1);
iterations++;
continue;
}
if (hr == S_OK) {
valid = true;
}
break;
}
D3DLOCKED_RECT lockedRect;
hr = mSyncSurface->LockRect(&lockedRect, NULL, D3DLOCK_READONLY);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
mFirstFrame = false;
if (!valid) {
image->Invalidate();
}
hr = mSyncSurface->UnlockRect();
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
image.forget(aOutImage);
return S_OK;
@ -525,6 +523,7 @@ private:
RefPtr<IMFDXGIDeviceManager> mDXGIDeviceManager;
RefPtr<MFTDecoder> mTransform;
RefPtr<D3D11RecycleAllocator> mTextureClientAllocator;
RefPtr<ID3D11Texture2D> mSyncSurface;
GUID mDecoderGUID;
uint32_t mWidth;
uint32_t mHeight;
@ -704,6 +703,22 @@ D3D11DXVA2Manager::Init(nsACString& aFailureReason)
}
}
D3D11_TEXTURE2D_DESC desc;
desc.Width = kSyncSurfaceSize;
desc.Height = kSyncSurfaceSize;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_STAGING;
desc.BindFlags = 0;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
desc.MiscFlags = 0;
hr = mDevice->CreateTexture2D(&desc, NULL, getter_AddRefs(mSyncSurface));
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
mTextureClientAllocator = new D3D11RecycleAllocator(layers::ImageBridgeChild::GetSingleton(),
mDevice);
mTextureClientAllocator->SetMaxPoolSize(5);
@ -755,18 +770,22 @@ D3D11DXVA2Manager::CopyToImage(IMFSample* aVideoSample,
hr = CreateOutputSample(sample, texture);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
RefPtr<IDXGIKeyedMutex> keyedMutex;
hr = texture->QueryInterface(static_cast<IDXGIKeyedMutex**>(getter_AddRefs(keyedMutex)));
NS_ENSURE_TRUE(SUCCEEDED(hr) && keyedMutex, hr);
hr = keyedMutex->AcquireSync(0, INFINITE);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
hr = mTransform->Output(&sample);
keyedMutex->ReleaseSync(0);
RefPtr<ID3D11DeviceContext> ctx;
mDevice->GetImmediateContext(getter_AddRefs(ctx));
// Copy a small rect into our sync surface, and then map it
// to block until decoding/color conversion completes.
D3D11_BOX rect = { 0, 0, 0, kSyncSurfaceSize, kSyncSurfaceSize, 1 };
ctx->CopySubresourceRegion(mSyncSurface, 0, 0, 0, 0, texture, 0, &rect);
D3D11_MAPPED_SUBRESOURCE mapped;
hr = ctx->Map(mSyncSurface, 0, D3D11_MAP_READ, 0, &mapped);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
ctx->Unmap(mSyncSurface, 0);
image.forget(aOutImage);
return S_OK;

View File

@ -27,15 +27,17 @@ class MediaTestArgumentsBase(object):
def verify_usage_handler(self, args):
if args.urls:
if not os.path.isfile(args.urls):
raise ValueError('--urls must provide a path to an ini file')
else:
path = os.path.abspath(args.urls)
args.video_urls = MediaTestArgumentsBase.get_urls(path)
if not os.path.isfile(args.urls):
raise ValueError('--urls must provide a path to an ini file')
else:
path = os.path.abspath(args.urls)
args.video_urls = MediaTestArgumentsBase.get_urls(path)
if not args.video_urls:
raise ValueError('list of video URLs cannot be empty')
def parse_args_handler(self, args):
if not args.tests:
args.tests = [external_media_tests.manifest]
args.tests = [external_media_tests.manifest]
@staticmethod

View File

@ -50,7 +50,7 @@ def run_external_media_test(tests, testtype=None, topsrcdir=None, **kwargs):
args,
{"mach": sys.stdout})
failed = mn_cli(MediaTestRunner, MediaTestArguments, FirefoxMediaHarness,
args=args)
args=vars(args))
if failed > 0:
return 1

View File

@ -340,9 +340,8 @@ SVGContentUtils::GetFontXHeight(nsStyleContext *aStyleContext)
nsPresContext *presContext = aStyleContext->PresContext();
MOZ_ASSERT(presContext, "NULL pres context in GetFontXHeight");
RefPtr<nsFontMetrics> fontMetrics;
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
getter_AddRefs(fontMetrics));
RefPtr<nsFontMetrics> fontMetrics =
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext);
if (!fontMetrics) {
// ReportToConsole

View File

@ -10,7 +10,8 @@
* liability, trademark and document use rules apply.
*/
[Constructor(DOMString type, optional CustomEventInit eventInitDict)]
[Constructor(DOMString type, optional CustomEventInit eventInitDict),
Exposed=(Window, Worker)]
interface CustomEvent : Event
{
readonly attribute any detail;

View File

@ -37,6 +37,8 @@ interface Node : EventTarget {
[Pure]
readonly attribute Document? ownerDocument;
[Pure]
readonly attribute Node rootNode;
[Pure]
readonly attribute Node? parentNode;
[Pure]
readonly attribute Element? parentElement;

View File

@ -26,7 +26,9 @@
#include "mozilla/dom/InternalHeaders.h"
#include "mozilla/dom/NotificationEvent.h"
#include "mozilla/dom/PromiseNativeHandler.h"
#ifndef MOZ_SIMPLEPUSH
#include "mozilla/dom/PushEventBinding.h"
#endif
#include "mozilla/dom/RequestBinding.h"
using namespace mozilla;

View File

@ -88,6 +88,8 @@ var interfaceNamesInGlobalScope =
"Client",
// IMPORTANT: Do not change this list without review from a DOM peer!
"Clients",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CustomEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "DataStore", b2g: true },
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -84,6 +84,8 @@ var interfaceNamesInGlobalScope =
"Cache",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CacheStorage",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CustomEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
"DedicatedWorkerGlobalScope",
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -1,4 +1,4 @@
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == empty-1.xul empty-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == empty-1.xul empty-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop, Windows: bug 1239170
skip-if((B2G&&browserIsRemote)||Mulet) != empty-2.xul empty-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
# There is no way to simulate an autocomplete textbox in windows XP/Vista/7/8/10 default theme using CSS.
# Therefore, the equlity tests below should be marked as failing.
@ -6,11 +6,11 @@ fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == emptyautocomplete-1.xul emptyautocomplete-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
skip-if((B2G&&browserIsRemote)||Mulet) != emptymultiline-1.xul emptymultiline-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == emptymultiline-2.xul emptymultiline-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == emptytextbox-1.xul emptytextbox-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == emptytextbox-2.xul emptytextbox-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == emptytextbox-1.xul emptytextbox-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop, Windows: bug 1239170
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == emptytextbox-2.xul emptytextbox-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop, Windows: bug 1239170
skip-if((B2G&&browserIsRemote)||Mulet) != emptytextbox-3.xul emptytextbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
skip-if((B2G&&browserIsRemote)||Mulet) != emptytextbox-4.xul emptytextbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == emptytextbox-5.xul emptytextbox-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == emptytextbox-5.xul emptytextbox-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop, Windows: bug 1239170
# There is no way to simulate a number textbox in windows XP/Vista/7 default theme using CSS.
# Therefore, the equlity tests below should be marked as failing.
skip-if((B2G&&browserIsRemote)||Mulet) != number-1.xul number-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
@ -19,11 +19,11 @@ fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]
skip-if((B2G&&browserIsRemote)||Mulet) != number-4.xul number-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == number-5.xul number-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet) == numberwithvalue-1.xul numberwithvalue-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == passwd-1.xul passwd-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == passwd-2.xul passwd-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == passwd-1.xul passwd-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop, Windows: bug 1239170
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||((browserIsRemote&&winWidget))) == passwd-2.xul passwd-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop, Windows: bug 1239170
skip-if((B2G&&browserIsRemote)||Mulet) != passwd-3.xul passwd-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet) == plain-1.xul plain-ref.xul # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||(browserIsRemote&&winWidget)) == textbox-1.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(Android||B2G) skip-if((B2G&&browserIsRemote)||Mulet||(browserIsRemote&&winWidget)) == textbox-1.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop, Windows: bug 1239170
skip-if((B2G&&browserIsRemote)||Mulet) != textbox-disabled.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
# Read-only textboxes look like normal textboxes in windows Vista/7 default theme
fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet||(browserIsRemote&&winWidget)) != textbox-readonly.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop
fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(6\.[012]|10\.0)/.test(http.oscpu)) skip-if((B2G&&browserIsRemote)||Mulet||(browserIsRemote&&winWidget)) != textbox-readonly.xul textbox-ref.xul # Initial mulet triage: parity with B2G/B2G Desktop, Windows: bug 1239170

View File

@ -1640,7 +1640,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
RefPtr<ID2D1Image> oldTarget;
RefPtr<ID2D1Bitmap1> tmpBitmap;
mDC->CreateBitmap(D2D1::SizeU(pat->mSurface->GetSize().width, pat->mSurface->GetSize().height), nullptr, 0,
&D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_TARGET, D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)),
D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_TARGET, D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)),
getter_AddRefs(tmpBitmap));
mDC->GetTarget(getter_AddRefs(oldTarget));
mDC->SetTarget(tmpBitmap);

View File

@ -79,7 +79,7 @@ bool
MultiThreadedJobQueue::PopJob(Job*& aOutJobs, AccessType aAccess)
{
for (;;) {
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
while (aAccess == BLOCKING && !mShuttingDown && mJobs.empty()) {
mAvailableCondvar.Wait(&mMutex);
@ -110,7 +110,7 @@ void
MultiThreadedJobQueue::SubmitJob(Job* aJobs)
{
MOZ_ASSERT(aJobs);
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
mJobs.push_back(aJobs);
mAvailableCondvar.Broadcast();
}
@ -118,21 +118,21 @@ MultiThreadedJobQueue::SubmitJob(Job* aJobs)
size_t
MultiThreadedJobQueue::NumJobs()
{
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
return mJobs.size();
}
bool
MultiThreadedJobQueue::IsEmpty()
{
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
return mJobs.empty();
}
void
MultiThreadedJobQueue::ShutDown()
{
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
mShuttingDown = true;
while (mThreadsCount) {
mAvailableCondvar.Broadcast();
@ -149,7 +149,7 @@ MultiThreadedJobQueue::RegisterThread()
void
MultiThreadedJobQueue::UnregisterThread()
{
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
mThreadsCount -= 1;
if (mThreadsCount == 0) {
mShutdownCondvar.Broadcast();
@ -166,14 +166,14 @@ EventObject::~EventObject()
bool
EventObject::Peak()
{
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
return mIsSet;
}
void
EventObject::Set()
{
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
if (!mIsSet) {
mIsSet = true;
mCond.Broadcast();
@ -183,7 +183,7 @@ EventObject::Set()
void
EventObject::Wait()
{
MutexAutoLock lock(&mMutex);
CriticalSectionAutoEnter lock(&mMutex);
if (mIsSet) {
return;
}

View File

@ -26,9 +26,6 @@ class Job;
class PosixCondVar;
class WorkerThread;
typedef mozilla::gfx::CriticalSection Mutex;
typedef mozilla::gfx::CriticalSectionAutoEnter MutexAutoLock;
// posix platforms only!
class PosixCondVar {
public:
@ -42,7 +39,7 @@ public:
MOZ_ASSERT(!err);
}
void Wait(Mutex* aMutex) {
void Wait(CriticalSection* aMutex) {
DebugOnly<int> err = pthread_cond_wait(&mCond, &aMutex->mMutex);
MOZ_ASSERT(!err);
}
@ -101,7 +98,7 @@ public:
protected:
std::list<Job*> mJobs;
Mutex mMutex;
CriticalSection mMutex;
PosixCondVar mAvailableCondvar;
PosixCondVar mShutdownCondvar;
int32_t mThreadsCount;
@ -131,7 +128,7 @@ public:
void Set();
protected:
Mutex mMutex;
CriticalSection mMutex;
PosixCondVar mCond;
bool mIsSet;
};

View File

@ -153,13 +153,13 @@ RadialGradientEffectD2D1::PrepareForRender(D2D1_CHANGE_TYPE changeType)
float transform[8];
};
PSConstantBuffer buffer = { { dc.x, dc.y, dr }, 0,
PSConstantBuffer buffer = { { dc.x, dc.y, dr }, 0.0f,
{ mCenter1.x, mCenter1.y },
A, mRadius1, mRadius1 * mRadius1,
mStopCollection->GetExtendMode() != D2D1_EXTEND_MODE_CLAMP ? 1 : 0,
mStopCollection->GetExtendMode() == D2D1_EXTEND_MODE_MIRROR ? 1 : 0,
{ 0 }, { mat._11, mat._21, mat._31, 0,
mat._12, mat._22, mat._32, 0 } };
mStopCollection->GetExtendMode() != D2D1_EXTEND_MODE_CLAMP ? 1.0f : 0.0f,
mStopCollection->GetExtendMode() == D2D1_EXTEND_MODE_MIRROR ? 1.0f : 0.0f,
{ 0.0f }, { mat._11, mat._21, mat._31, 0.0f,
mat._12, mat._22, mat._32, 0.0f } };
hr = mDrawInfo->SetPixelShaderConstantBuffer((BYTE*)&buffer, sizeof(buffer));

View File

@ -288,7 +288,7 @@ ChooseBufferBits(const SurfaceCaps& caps,
SurfaceFactory::SurfaceFactory(SharedSurfaceType type, GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
: mType(type)
, mGL(gl)

View File

@ -39,7 +39,7 @@ class DrawTarget;
} // namespace gfx
namespace layers {
class ISurfaceAllocator;
class ClientIPCAllocator;
class SharedSurfaceTextureClient;
enum class TextureFlags : uint32_t;
class SurfaceDescriptor;
@ -269,7 +269,7 @@ public:
const SharedSurfaceType mType;
GLContext* const mGL;
const SurfaceCaps mCaps;
const RefPtr<layers::ISurfaceAllocator> mAllocator;
const RefPtr<layers::ClientIPCAllocator> mAllocator;
const layers::TextureFlags mFlags;
const GLFormats mFormats;
Mutex mMutex;
@ -280,7 +280,7 @@ protected:
RefSet<layers::SharedSurfaceTextureClient> mRecycleTotalPool;
SurfaceFactory(SharedSurfaceType type, GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags);
public:

View File

@ -209,7 +209,11 @@ public:
}
}
ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11Device();
RefPtr<ID3D11Device> device;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11Device(&device)) {
return;
}
device->GetImmediateContext(getter_AddRefs(mDeviceContext));
mTexture->GetDesc(&mDesc);
@ -260,8 +264,13 @@ bool
SharedSurface_ANGLEShareHandle::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surface)
{
MOZ_ASSERT(out_surface);
RefPtr<ID3D11Device> device;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11Device(&device)) {
return false;
}
RefPtr<ID3D11Texture2D> tex;
ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11Device();
HRESULT hr = device->OpenSharedResource(mShareHandle,
__uuidof(ID3D11Texture2D),
(void**)(ID3D11Texture2D**)getter_AddRefs(tex));
@ -321,7 +330,7 @@ SharedSurface_ANGLEShareHandle::ReadbackBySharedHandle(gfx::DataSourceSurface* o
/*static*/ UniquePtr<SurfaceFactory_ANGLEShareHandle>
SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
{
GLLibraryEGL* egl = &sEGLLibrary;
@ -341,7 +350,7 @@ SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl, const SurfaceCaps& caps,
SurfaceFactory_ANGLEShareHandle::SurfaceFactory_ANGLEShareHandle(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags,
GLLibraryEGL* egl,
EGLConfig config)

View File

@ -89,12 +89,12 @@ protected:
public:
static UniquePtr<SurfaceFactory_ANGLEShareHandle> Create(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags);
protected:
SurfaceFactory_ANGLEShareHandle(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags, GLLibraryEGL* egl,
EGLConfig config);

View File

@ -373,7 +373,7 @@ SharedSurface_D3D11Interop::ToSurfaceDescriptor(layers::SurfaceDescriptor* const
/*static*/ UniquePtr<SurfaceFactory_D3D11Interop>
SurfaceFactory_D3D11Interop::Create(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
{
WGLLibrary* wgl = &sWGLLib;
@ -394,7 +394,7 @@ SurfaceFactory_D3D11Interop::Create(GLContext* gl, const SurfaceCaps& caps,
SurfaceFactory_D3D11Interop::SurfaceFactory_D3D11Interop(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags,
const RefPtr<DXGLDevice>& dxgl)
: SurfaceFactory(SharedSurfaceType::DXGLInterop2, gl, caps, allocator, flags)

View File

@ -85,12 +85,12 @@ public:
static UniquePtr<SurfaceFactory_D3D11Interop> Create(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags);
protected:
SurfaceFactory_D3D11Interop(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags,
const RefPtr<DXGLDevice>& dxgl);

View File

@ -39,7 +39,7 @@ SharedSurface_EGLImage::Create(GLContext* prodGL,
return Move(ret);
}
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(prodTex);
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(uintptr_t(prodTex));
EGLImage image = egl->fCreateImage(egl->Display(), context,
LOCAL_EGL_GL_TEXTURE_2D, buffer,
nullptr);
@ -197,7 +197,7 @@ SharedSurface_EGLImage::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surfa
/*static*/ UniquePtr<SurfaceFactory_EGLImage>
SurfaceFactory_EGLImage::Create(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
{
EGLContext context = GLContextEGL::Cast(prodGL)->mContext;

View File

@ -96,14 +96,14 @@ public:
// Fallible:
static UniquePtr<SurfaceFactory_EGLImage> Create(GLContext* prodGL,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags);
protected:
const EGLContext mContext;
SurfaceFactory_EGLImage(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags,
EGLContext context)
: SurfaceFactory(SharedSurfaceType::EGLImageShare, prodGL, caps, allocator, flags)

View File

@ -149,7 +149,7 @@ class SurfaceFactory_GLTexture
public:
SurfaceFactory_GLTexture(GLContext* prodGL,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
: SurfaceFactory(SharedSurfaceType::SharedGLTexture, prodGL, caps, allocator, flags)
{

View File

@ -120,7 +120,7 @@ SharedSurface_GLXDrawable::ReadbackBySharedHandle(gfx::DataSourceSurface* out_su
UniquePtr<SurfaceFactory_GLXDrawable>
SurfaceFactory_GLXDrawable::Create(GLContext* prodGL,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
{
MOZ_ASSERT(caps.alpha, "GLX surfaces require an alpha channel!");

View File

@ -49,14 +49,14 @@ class SurfaceFactory_GLXDrawable
public:
static UniquePtr<SurfaceFactory_GLXDrawable> Create(GLContext* prodGL,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags);
virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) override;
private:
SurfaceFactory_GLXDrawable(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
: SurfaceFactory(SharedSurfaceType::GLXDrawable, prodGL, caps, allocator, flags)
{ }

View File

@ -35,7 +35,7 @@ using namespace mozilla::layers;
using namespace android;
SurfaceFactory_Gralloc::SurfaceFactory_Gralloc(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
: SurfaceFactory(SharedSurfaceType::Gralloc, prodGL, caps, allocator, flags)
{
@ -48,7 +48,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
const gfx::IntSize& size,
bool hasAlpha,
layers::TextureFlags flags,
ISurfaceAllocator* allocator)
ClientIPCAllocator* allocator)
{
GLLibraryEGL* egl = &sEGLLibrary;
MOZ_ASSERT(egl);
@ -118,7 +118,7 @@ SharedSurface_Gralloc::SharedSurface_Gralloc(GLContext* prodGL,
const gfx::IntSize& size,
bool hasAlpha,
GLLibraryEGL* egl,
layers::ISurfaceAllocator* allocator,
layers::ClientIPCAllocator* allocator,
layers::TextureClient* textureClient,
GLuint prodTex)
: SharedSurface(SharedSurfaceType::Gralloc,

View File

@ -12,7 +12,7 @@
namespace mozilla {
namespace layers {
class ISurfaceAllocator;
class ClientIPCAllocator;
class TextureClient;
}
@ -29,7 +29,7 @@ public:
const gfx::IntSize& size,
bool hasAlpha,
layers::TextureFlags flags,
layers::ISurfaceAllocator* allocator);
layers::ClientIPCAllocator* allocator);
static SharedSurface_Gralloc* Cast(SharedSurface* surf) {
MOZ_ASSERT(surf->mType == SharedSurfaceType::Gralloc);
@ -40,7 +40,7 @@ public:
protected:
GLLibraryEGL* const mEGL;
EGLSync mSync;
RefPtr<layers::ISurfaceAllocator> mAllocator;
RefPtr<layers::ClientIPCAllocator> mAllocator;
RefPtr<layers::TextureClient> mTextureClient;
const GLuint mProdTex;
@ -48,7 +48,7 @@ protected:
const gfx::IntSize& size,
bool hasAlpha,
GLLibraryEGL* egl,
layers::ISurfaceAllocator* allocator,
layers::ClientIPCAllocator* allocator,
layers::TextureClient* textureClient,
GLuint prodTex);
@ -83,7 +83,7 @@ class SurfaceFactory_Gralloc
{
public:
SurfaceFactory_Gralloc(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags);
virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) override {

View File

@ -212,7 +212,7 @@ SharedSurface_IOSurface::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surf
/*static*/ UniquePtr<SurfaceFactory_IOSurface>
SurfaceFactory_IOSurface::Create(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags)
{
gfx::IntSize maxDims(MacIOSurface::GetMaxWidth(),

View File

@ -77,13 +77,13 @@ public:
// Infallible.
static UniquePtr<SurfaceFactory_IOSurface> Create(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags);
protected:
const gfx::IntSize mMaxDims;
SurfaceFactory_IOSurface(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ISurfaceAllocator>& allocator,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const layers::TextureFlags& flags,
const gfx::IntSize& maxDims)
: SurfaceFactory(SharedSurfaceType::IOSurface, gl, caps, allocator, flags)

View File

@ -25,16 +25,16 @@ public:
static MemoryTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend,TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ISurfaceAllocator* aAllocator);
ClientIPCAllocator* aAllocator);
virtual TextureData*
CreateSimilar(ISurfaceAllocator* aAllocator,
CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual void Deallocate(ISurfaceAllocator*) override;
virtual void Deallocate(ClientIPCAllocator*) override;
MemoryTextureData(const BufferDescriptor& aDesc,
gfx::BackendType aMoz2DBackend,
@ -62,16 +62,16 @@ public:
static ShmemTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend, TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ISurfaceAllocator* aAllocator);
ClientIPCAllocator* aAllocator);
virtual TextureData*
CreateSimilar(ISurfaceAllocator* aAllocator,
CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual void Deallocate(ISurfaceAllocator* aAllocator) override;
virtual void Deallocate(ClientIPCAllocator* aAllocator) override;
ShmemTextureData(const BufferDescriptor& aDesc,
gfx::BackendType aMoz2DBackend, mozilla::ipc::Shmem aShmem)
@ -111,19 +111,20 @@ BufferTextureData*
BufferTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend, TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ISurfaceAllocator* aAllocator)
ClientIPCAllocator* aAllocator)
{
if (!aAllocator || aAllocator->IsSameProcess()) {
return MemoryTextureData::Create(aSize, aFormat, aMoz2DBackend, aFlags,
aAllocFlags, aAllocator);
} else {
} else if (aAllocator->AsShmemAllocator()) {
return ShmemTextureData::Create(aSize, aFormat, aMoz2DBackend, aFlags,
aAllocFlags, aAllocator);
}
return nullptr;
}
BufferTextureData*
BufferTextureData::CreateInternal(ISurfaceAllocator* aAllocator,
BufferTextureData::CreateInternal(ClientIPCAllocator* aAllocator,
const BufferDescriptor& aDesc,
gfx::BackendType aMoz2DBackend,
int32_t aBufferSize,
@ -138,18 +139,19 @@ BufferTextureData::CreateInternal(ISurfaceAllocator* aAllocator,
GfxMemoryImageReporter::DidAlloc(buffer);
return new MemoryTextureData(aDesc, aMoz2DBackend, buffer, aBufferSize);
} else {
} else if (aAllocator->AsShmemAllocator()) {
ipc::Shmem shm;
if (!aAllocator->AllocUnsafeShmem(aBufferSize, OptimalShmemType(), &shm)) {
if (!aAllocator->AsShmemAllocator()->AllocUnsafeShmem(aBufferSize, OptimalShmemType(), &shm)) {
return nullptr;
}
return new ShmemTextureData(aDesc, aMoz2DBackend, shm);
}
return nullptr;
}
BufferTextureData*
BufferTextureData::CreateForYCbCrWithBufferSize(ISurfaceAllocator* aAllocator,
BufferTextureData::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
gfx::SurfaceFormat aFormat,
int32_t aBufferSize,
TextureFlags aTextureFlags)
@ -168,7 +170,7 @@ BufferTextureData::CreateForYCbCrWithBufferSize(ISurfaceAllocator* aAllocator,
}
BufferTextureData*
BufferTextureData::CreateForYCbCr(ISurfaceAllocator* aAllocator,
BufferTextureData::CreateForYCbCr(ClientIPCAllocator* aAllocator,
gfx::IntSize aYSize,
gfx::IntSize aCbCrSize,
StereoMode aStereoMode,
@ -427,7 +429,7 @@ MemoryTextureData*
MemoryTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend, TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ISurfaceAllocator* aAllocator)
ClientIPCAllocator* aAllocator)
{
// Should have used CreateForYCbCr.
MOZ_ASSERT(aFormat != gfx::SurfaceFormat::YUV);
@ -460,7 +462,7 @@ MemoryTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
}
void
MemoryTextureData::Deallocate(ISurfaceAllocator*)
MemoryTextureData::Deallocate(ClientIPCAllocator*)
{
MOZ_ASSERT(mBuffer);
GfxMemoryImageReporter::WillFree(mBuffer);
@ -469,7 +471,7 @@ MemoryTextureData::Deallocate(ISurfaceAllocator*)
}
TextureData*
MemoryTextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
MemoryTextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -494,13 +496,13 @@ ShmemTextureData*
ShmemTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend, TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ISurfaceAllocator* aAllocator)
ClientIPCAllocator* aAllocator)
{
MOZ_ASSERT(aAllocator);
// Should have used CreateForYCbCr.
MOZ_ASSERT(aFormat != gfx::SurfaceFormat::YUV);
if (!aAllocator) {
if (!aAllocator || !aAllocator->AsShmemAllocator()) {
return nullptr;
}
@ -515,7 +517,7 @@ ShmemTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
}
mozilla::ipc::Shmem shm;
if (!aAllocator->AllocUnsafeShmem(bufSize, OptimalShmemType(), &shm)) {
if (!aAllocator->AsShmemAllocator()->AllocUnsafeShmem(bufSize, OptimalShmemType(), &shm)) {
return nullptr;
}
@ -537,7 +539,7 @@ ShmemTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
}
TextureData*
ShmemTextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
ShmemTextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -546,9 +548,9 @@ ShmemTextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
}
void
ShmemTextureData::Deallocate(ISurfaceAllocator* aAllocator)
ShmemTextureData::Deallocate(ClientIPCAllocator* aAllocator)
{
aAllocator->DeallocShmem(mShmem);
aAllocator->AsShmemAllocator()->DeallocShmem(mShmem);
}
} // namespace

View File

@ -21,9 +21,9 @@ public:
static BufferTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend,TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ISurfaceAllocator* aAllocator);
ClientIPCAllocator* aAllocator);
static BufferTextureData* CreateForYCbCr(ISurfaceAllocator* aAllocator,
static BufferTextureData* CreateForYCbCr(ClientIPCAllocator* aAllocator,
gfx::IntSize aYSize,
gfx::IntSize aCbCrSize,
StereoMode aStereoMode,
@ -32,7 +32,7 @@ public:
// It is generally better to use CreateForYCbCr instead.
// This creates a half-initialized texture since we don't know the sizes and
// offsets in the buffer.
static BufferTextureData* CreateForYCbCrWithBufferSize(ISurfaceAllocator* aAllocator,
static BufferTextureData* CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
gfx::SurfaceFormat aFormat,
int32_t aSize,
TextureFlags aTextureFlags);
@ -64,7 +64,7 @@ public:
void SetDesciptor(const BufferDescriptor& aDesc);
protected:
static BufferTextureData* CreateInternal(ISurfaceAllocator* aAllocator,
static BufferTextureData* CreateInternal(ClientIPCAllocator* aAllocator,
const BufferDescriptor& aDesc,
gfx::BackendType aMoz2DBackend,
int32_t aBufferSize,

View File

@ -230,8 +230,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(OpenMode)
// We rely on the items in this enum being sequential
enum class MaskType : uint8_t {
MaskNone = 0, // no mask layer
Mask2d, // mask layer for layers with 2D transforms
Mask3d, // mask layer for layers with 3D transforms
Mask, // mask layer
NumMaskTypes
};

View File

@ -55,17 +55,6 @@ D3D11ShareHandleImage::GetAsSourceSurface()
RefPtr<ID3D11Device> device;
texture->GetDevice(getter_AddRefs(device));
RefPtr<IDXGIKeyedMutex> keyedMutex;
if (FAILED(texture->QueryInterface(static_cast<IDXGIKeyedMutex**>(getter_AddRefs(keyedMutex))))) {
NS_WARNING("Failed to QueryInterface for IDXGIKeyedMutex, strange.");
return nullptr;
}
if (FAILED(keyedMutex->AcquireSync(0, 0))) {
NS_WARNING("Failed to acquire sync for keyedMutex, plugin failed to release?");
return nullptr;
}
D3D11_TEXTURE2D_DESC desc;
texture->GetDesc(&desc);
@ -83,19 +72,16 @@ D3D11ShareHandleImage::GetAsSourceSurface()
if (FAILED(hr)) {
NS_WARNING("Failed to create 2D staging texture.");
keyedMutex->ReleaseSync(0);
return nullptr;
}
RefPtr<ID3D11DeviceContext> context;
device->GetImmediateContext(getter_AddRefs(context));
if (!context) {
keyedMutex->ReleaseSync(0);
return nullptr;
}
context->CopyResource(softTexture, texture);
keyedMutex->ReleaseSync(0);
RefPtr<gfx::DataSourceSurface> surface =
gfx::Factory::CreateDataSourceSurface(mSize, gfx::SurfaceFormat::B8G8R8X8);
@ -152,7 +138,8 @@ D3D11RecycleAllocator::CreateOrRecycleClient(gfx::SurfaceFormat aFormat,
CreateOrRecycle(aFormat,
aSize,
BackendSelector::Content,
layers::TextureFlags::DEFAULT);
layers::TextureFlags::DEFAULT,
TextureAllocationFlags::ALLOC_MANUAL_SYNCHRONIZATION);
return textureClient.forget();
}

View File

@ -77,6 +77,13 @@ D3D9SurfaceImage::AllocateAndCopy(D3D9RecycleAllocator* aAllocator,
return S_OK;
}
already_AddRefed<IDirect3DSurface9>
D3D9SurfaceImage::GetD3D9Surface()
{
return static_cast<DXGID3D9TextureData*>(
mTextureClient->GetInternalData())->GetD3D9Surface();
}
const D3DSURFACE_DESC&
D3D9SurfaceImage::GetDesc() const
{

View File

@ -63,6 +63,8 @@ public:
virtual TextureClient* GetTextureClient(CompositableClient* aClient) override;
already_AddRefed<IDirect3DSurface9> GetD3D9Surface();
virtual bool IsValid() override { return mValid; }
void Invalidate() { mValid = false; }

View File

@ -34,10 +34,6 @@ EffectMask::PrintInfo(std::stringstream& aStream, const char* aPrefix)
aStream << nsPrintfCString("EffectMask (0x%p)", this).get();
AppendToString(aStream, mSize, " [size=", "]");
AppendToString(aStream, mMaskTransform, " [mask-transform=", "]");
if (mIs3D) {
aStream << " [is-3d]";
}
}
void

View File

@ -85,7 +85,6 @@ struct EffectMask : public Effect
const gfx::Matrix4x4 &aMaskTransform)
: Effect(EffectTypes::MASK)
, mMaskTexture(aMaskTexture)
, mIs3D(false)
, mSize(aSize)
, mMaskTransform(aMaskTransform)
{}
@ -93,7 +92,6 @@ struct EffectMask : public Effect
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
TextureSource* mMaskTexture;
bool mIs3D;
gfx::IntSize mSize;
gfx::Matrix4x4 mMaskTransform;
};

View File

@ -73,7 +73,7 @@ GrallocImage::SetData(const Data& aData)
return false;
}
ISurfaceAllocator* allocator = ImageBridgeChild::GetSingleton();
ClientIPCAllocator* allocator = ImageBridgeChild::GetSingleton();
GrallocTextureData* texData = GrallocTextureData::Create(mData.mYSize, HAL_PIXEL_FORMAT_YV12,
gfx::BackendType::NONE,
GraphicBuffer::USAGE_SW_READ_OFTEN |

View File

@ -224,9 +224,10 @@ IMFYCbCrImage::GetTextureClient(CompositableClient* aClient)
return mTextureClient;
}
LayersBackend backend = aClient->GetForwarder()->GetCompositorBackendType();
ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11ImageBridgeDevice();
RefPtr<ID3D11Device> device;
gfxWindowsPlatform::GetPlatform()->GetD3D11ImageBridgeDevice(&device);
LayersBackend backend = aClient->GetForwarder()->GetCompositorBackendType();
if (!device || backend != LayersBackend::LAYERS_D3D11) {
if (backend == LayersBackend::LAYERS_D3D9 ||
backend == LayersBackend::LAYERS_D3D11) {

View File

@ -1202,7 +1202,6 @@ SenderHelper::SendMaskEffect(GLContext* aGLContext,
// Expose packet creation here, so we could dump secondary mask effect attributes.
auto packet = MakeUnique<layerscope::Packet>();
TexturePacket::EffectMask* mask = packet->mutable_texture()->mutable_mask();
mask->set_mis3d(aEffect->mIs3D);
mask->mutable_msize()->set_w(aEffect->mSize.width);
mask->mutable_msize()->set_h(aEffect->mSize.height);
auto element = reinterpret_cast<const Float *>(&(aEffect->mMaskTransform));

View File

@ -1466,11 +1466,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS
ComputeEffectiveTransformsForChildren(idealTransform);
}
if (idealTransform.CanDraw2D()) {
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
} else {
ComputeEffectiveTransformForMaskLayers(Matrix4x4());
}
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
}
void

View File

@ -24,7 +24,7 @@ public:
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual TextureData*
CreateSimilar(ISurfaceAllocator* aAllocator,
CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
@ -33,7 +33,7 @@ public:
static
DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat);
virtual void Deallocate(ISurfaceAllocator* aAllocator) override
virtual void Deallocate(ClientIPCAllocator* aAllocator) override
{
mSurface = nullptr;
}
@ -61,7 +61,7 @@ public:
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual TextureData*
CreateSimilar(ISurfaceAllocator* aAllocator,
CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
@ -69,7 +69,7 @@ public:
static
DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
ISurfaceAllocator* aAllocator);
ClientIPCAllocator* aAllocator);
void DeallocateData()
{
@ -84,7 +84,7 @@ public:
}
}
virtual void Deallocate(ISurfaceAllocator* aAllocator) override
virtual void Deallocate(ClientIPCAllocator* aAllocator) override
{
DeallocateData();
}
@ -125,7 +125,7 @@ DIBTextureData::BorrowDrawTarget()
DIBTextureData*
DIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
ISurfaceAllocator* aAllocator)
ClientIPCAllocator* aAllocator)
{
if (!aAllocator) {
return nullptr;
@ -141,7 +141,7 @@ DIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
}
TextureData*
MemoryDIBTextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
MemoryDIBTextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -204,7 +204,7 @@ MemoryDIBTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
}
TextureData*
ShmemDIBTextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
ShmemDIBTextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -268,9 +268,9 @@ ShmemDIBTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
DIBTextureData*
ShmemDIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
ISurfaceAllocator* aAllocator)
ClientIPCAllocator* aAllocator)
{
MOZ_ASSERT(aAllocator->ParentPid() != base::ProcessId());
MOZ_ASSERT(aAllocator->AsLayerForwarder()->GetParentPid() != base::ProcessId());
DWORD mapSize = aSize.width * aSize.height * BytesPerPixel(aFormat);
HANDLE fileMapping = ::CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, mapSize, NULL);
@ -332,7 +332,7 @@ ShmemDIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
HANDLE hostHandle = NULL;
if (!ipc::DuplicateHandle(fileMapping, aAllocator->ParentPid(),
if (!ipc::DuplicateHandle(fileMapping, aAllocator->AsLayerForwarder()->GetParentPid(),
&hostHandle, 0, DUPLICATE_SAME_ACCESS)) {
gfxCriticalError() << "Failed to duplicate handle to parent process for surface.";
::DeleteObject(bitmap);

View File

@ -34,7 +34,7 @@ public:
static
DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
ISurfaceAllocator* aAllocator);
ClientIPCAllocator* aAllocator);
protected:
DIBTextureData(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,

View File

@ -397,6 +397,25 @@ RoundOut(Rect r)
return IntRect(r.x, r.y, r.width, r.height);
}
static void
SetupMask(const EffectChain& aEffectChain,
DrawTarget* aDest,
const IntPoint& aOffset,
RefPtr<SourceSurface>& aMaskSurface,
Matrix& aMaskTransform)
{
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
aMaskSurface = effectMask->mMaskTexture->AsSourceBasic()->GetSurface(aDest);
if (!aMaskSurface) {
gfxWarning() << "Invalid sourceMask effect";
}
MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
aMaskTransform = effectMask->mMaskTransform.As2D();
aMaskTransform.PostTranslate(-aOffset.x, -aOffset.y);
}
}
void
BasicCompositor::DrawQuad(const gfx::Rect& aRect,
const gfx::Rect& aClipRect,
@ -442,7 +461,8 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
// When we apply the 3D transformation, we do it against a temporary
// surface, so undo the coordinate offset.
new3DTransform = Matrix4x4::Translation(aRect.x, aRect.y, 0) * aTransform;
new3DTransform = aTransform;
new3DTransform.PreTranslate(aRect.x, aRect.y, 0);
}
buffer->PushClipRect(aClipRect);
@ -452,16 +472,8 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
RefPtr<SourceSurface> sourceMask;
Matrix maskTransform;
if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
sourceMask = effectMask->mMaskTexture->AsSourceBasic()->GetSurface(dest);
if (!sourceMask) {
gfxWarning() << "Invalid sourceMask effect";
}
MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
MOZ_ASSERT(!effectMask->mIs3D);
maskTransform = effectMask->mMaskTransform.As2D();
maskTransform.PostTranslate(-offset.x, -offset.y);
if (aTransform.Is2D()) {
SetupMask(aEffectChain, dest, offset, sourceMask, maskTransform);
}
CompositionOp blendMode = CompositionOp::OP_OVER;
@ -568,8 +580,40 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
Transform(temp, source, new3DTransform, transformBounds.TopLeft());
SetupMask(aEffectChain, buffer, offset, sourceMask, maskTransform);
// Adjust for the fact that our content now start at 0,0 instead
// of the top left of transformBounds.
transformBounds.MoveTo(0, 0);
buffer->DrawSurface(temp, transformBounds, transformBounds);
maskTransform.PostTranslate(-transformBounds.x, -transformBounds.y);
if (sourceMask) {
// Transform the source by it's normal transform, and then the inverse
// of the mask transform so that it's in the mask's untransformed
// coordinate space.
Matrix old = buffer->GetTransform();
Matrix sourceTransform = old;
Matrix inverseMask = maskTransform;
inverseMask.Invert();
sourceTransform *= inverseMask;
SurfacePattern source(temp, ExtendMode::CLAMP, sourceTransform);
buffer->PushClipRect(transformBounds);
// Mask in the untransformed coordinate space, and then transform
// by the mask transform to put the result back into destination
// coords.
buffer->SetTransform(maskTransform);
buffer->MaskSurface(source, sourceMask, Point(0, 0));
buffer->SetTransform(old);
buffer->PopClip();
} else {
buffer->DrawSurface(temp, transformBounds, transformBounds);
}
}
buffer->PopClip();

View File

@ -96,13 +96,13 @@ X11TextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
}
void
X11TextureData::Deallocate(ISurfaceAllocator*)
X11TextureData::Deallocate(ClientIPCAllocator*)
{
mSurface = nullptr;
}
TextureData*
X11TextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
X11TextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -111,7 +111,7 @@ X11TextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
X11TextureData*
X11TextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
TextureFlags aFlags, ISurfaceAllocator* aAllocator)
TextureFlags aFlags, ClientIPCAllocator* aAllocator)
{
MOZ_ASSERT(aSize.width >= 0 && aSize.height >= 0);
if (aSize.width <= 0 || aSize.height <= 0 ||

View File

@ -17,7 +17,7 @@ class X11TextureData : public TextureData
{
public:
static X11TextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
TextureFlags aFlags, ISurfaceAllocator* aAllocator);
TextureFlags aFlags, ClientIPCAllocator* aAllocator);
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
@ -35,10 +35,10 @@ public:
virtual bool HasIntermediateBuffer() const override { return false; }
virtual void Deallocate(ISurfaceAllocator*) override;
virtual void Deallocate(ClientIPCAllocator*) override;
virtual TextureData*
CreateSimilar(ISurfaceAllocator* aAllocator,
CreateSimilar(ClientIPCAllocator* aAllocator,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;

View File

@ -184,7 +184,7 @@ static inline void SwapRB_R8G8B8A8(uint8_t* pixel) {
class TexClientFactory
{
ISurfaceAllocator* const mAllocator;
ClientIPCAllocator* const mAllocator;
const bool mHasAlpha;
const gfx::IntSize mSize;
const gfx::BackendType mBackendType;
@ -192,7 +192,7 @@ class TexClientFactory
const LayersBackend mLayersBackend;
public:
TexClientFactory(ISurfaceAllocator* allocator, bool hasAlpha,
TexClientFactory(ClientIPCAllocator* allocator, bool hasAlpha,
const gfx::IntSize& size, gfx::BackendType backendType,
TextureFlags baseTexFlags, LayersBackend layersBackend)
: mAllocator(allocator)
@ -240,7 +240,7 @@ public:
};
static already_AddRefed<TextureClient>
TexClientFromReadback(SharedSurface* src, ISurfaceAllocator* allocator,
TexClientFromReadback(SharedSurface* src, ClientIPCAllocator* allocator,
TextureFlags baseFlags, LayersBackend layersBackend)
{
auto backendType = gfx::BackendType::CAIRO;

View File

@ -538,7 +538,7 @@ ClientLayerManager::MakeSnapshotIfRequired()
DrawOptions(1.0f, CompositionOp::OP_OVER));
dt->SetTransform(oldMatrix);
}
mForwarder->DestroySharedSurface(&inSnapshot);
mForwarder->DestroySurfaceDescriptor(&inSnapshot);
}
}
}

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