mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
05c118f45b
@ -223,6 +223,8 @@ static StaticAutoPtr<nsTArray<nsCOMPtr<nsITimer> > > sPluginTimers;
|
||||
|
||||
class PluginTimerCallBack MOZ_FINAL : public nsITimerCallback
|
||||
{
|
||||
~PluginTimerCallBack() {}
|
||||
|
||||
public:
|
||||
PluginTimerCallBack(nsIContent* aContent) : mContent(aContent) {}
|
||||
|
||||
|
@ -22,6 +22,8 @@ namespace a11y {
|
||||
class ARIAGridAccessibleWrap : public ARIAGridAccessible,
|
||||
public ia2AccessibleTable
|
||||
{
|
||||
~ARIAGridAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
ARIAGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
ARIAGridAccessible(aContent, aDoc), ia2AccessibleTable(this) {}
|
||||
@ -42,6 +44,8 @@ public:
|
||||
class ARIAGridCellAccessibleWrap : public ARIAGridCellAccessible,
|
||||
public ia2AccessibleTableCell
|
||||
{
|
||||
~ARIAGridCellAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
ARIAGridCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
ARIAGridCellAccessible(aContent, aDoc), ia2AccessibleTableCell(this) {}
|
||||
|
@ -34,7 +34,6 @@ class AccessibleWrap : public Accessible,
|
||||
public: // construction, destruction
|
||||
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
Accessible(aContent, aDoc) { }
|
||||
virtual ~AccessibleWrap() { }
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@ -176,6 +175,7 @@ public: // construction, destruction
|
||||
static IDispatch *NativeAccessible(nsIAccessible *aXPAccessible);
|
||||
|
||||
protected:
|
||||
virtual ~AccessibleWrap() { }
|
||||
|
||||
/**
|
||||
* Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it.
|
||||
|
@ -18,6 +18,8 @@ namespace a11y {
|
||||
class ApplicationAccessibleWrap: public ApplicationAccessible,
|
||||
public IAccessibleApplication
|
||||
{
|
||||
~ApplicationAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
// nsISupporst
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -23,6 +23,8 @@ namespace a11y {
|
||||
class HTMLTableAccessibleWrap : public HTMLTableAccessible,
|
||||
public ia2AccessibleTable
|
||||
{
|
||||
~HTMLTableAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
HTMLTableAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
HTMLTableAccessible(aContent, aDoc), ia2AccessibleTable(this) {}
|
||||
@ -44,6 +46,8 @@ public:
|
||||
class HTMLTableCellAccessibleWrap : public HTMLTableCellAccessible,
|
||||
public ia2AccessibleTableCell
|
||||
{
|
||||
~HTMLTableCellAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
HTMLTableCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
HTMLTableCellAccessible(aContent, aDoc), ia2AccessibleTableCell(this) {}
|
||||
@ -65,6 +69,8 @@ public:
|
||||
class HTMLTableHeaderCellAccessibleWrap : public HTMLTableHeaderCellAccessible,
|
||||
public ia2AccessibleTableCell
|
||||
{
|
||||
~HTMLTableHeaderCellAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
HTMLTableHeaderCellAccessibleWrap(nsIContent* aContent,
|
||||
DocAccessible* aDoc) :
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
virtual nsresult HandleAccEvent(AccEvent* aEvent);
|
||||
|
||||
protected:
|
||||
~HyperTextAccessibleWrap() {}
|
||||
|
||||
virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
|
||||
uint32_t *aStartOffset,
|
||||
uint32_t *aEndOffset);
|
||||
|
@ -26,6 +26,9 @@ public:
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
protected:
|
||||
~ImageAccessibleWrap() {}
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
@ -21,6 +21,8 @@ namespace a11y {
|
||||
class XULListboxAccessibleWrap : public XULListboxAccessible,
|
||||
public ia2AccessibleTable
|
||||
{
|
||||
~XULListboxAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
XULListboxAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
XULListboxAccessible(aContent, aDoc), ia2AccessibleTable(this) {}
|
||||
@ -41,6 +43,8 @@ public:
|
||||
class XULListCellAccessibleWrap : public XULListCellAccessible,
|
||||
public ia2AccessibleTableCell
|
||||
{
|
||||
~XULListCellAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
XULListCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
XULListCellAccessible(aContent, aDoc), ia2AccessibleTableCell(this) {}
|
||||
|
@ -21,6 +21,8 @@ namespace a11y {
|
||||
class XULTreeGridAccessibleWrap : public XULTreeGridAccessible,
|
||||
public ia2AccessibleTable
|
||||
{
|
||||
~XULTreeGridAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
XULTreeGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc,
|
||||
nsTreeBodyFrame* aTree) :
|
||||
@ -42,6 +44,8 @@ public:
|
||||
class XULTreeGridCellAccessibleWrap : public XULTreeGridCellAccessible,
|
||||
public ia2AccessibleTableCell
|
||||
{
|
||||
~XULTreeGridCellAccessibleWrap() {}
|
||||
|
||||
public:
|
||||
XULTreeGridCellAccessibleWrap(nsIContent* aContent,
|
||||
DocAccessible* aDoc,
|
||||
|
@ -54,6 +54,7 @@ for moz_config_dir in $1; do
|
||||
fi
|
||||
_save_cache_file="$cache_file"
|
||||
ifelse($2,,cache_file="$moz_config_dir/config.cache",cache_file="$2")
|
||||
cache_file="$(cd $(dirname "$cache_file"); pwd -W 2>/dev/null || pwd)/$(basename "$cache_file")"
|
||||
_MOZ_AC_OUTPUT_SUBDIRS($moz_config_dir)
|
||||
cache_file="$_save_cache_file"
|
||||
(cd "$moz_config_dir"; $PYTHON $_topsrcdir/build/subconfigure.py adjust $ac_sub_configure)
|
||||
|
@ -13,8 +13,13 @@
|
||||
# Support usage outside of config/rules.mk
|
||||
ifndef INCLUDED_DEBUGMAKE_MK #{
|
||||
|
||||
define CR
|
||||
|
||||
|
||||
endef
|
||||
|
||||
define shell_quote
|
||||
'$(subst ','\'',$(1))'
|
||||
'$(subst $(CR),\$(CR),$(subst ','\'',$(1)))'
|
||||
endef
|
||||
|
||||
echo-variable-%:
|
||||
|
@ -91,7 +91,7 @@ GARBAGE_DIRS += subtiers
|
||||
# root.mk defines subtier_of_* variables, that map a normalized subdir path to
|
||||
# a subtier name (e.g. subtier_of_memory_jemalloc = base)
|
||||
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
|
||||
+@$(MAKE) -C $* $(if $(filter $*,$(tier_$(subtier_of_$(subst /,_,$*))_staticdirs)),,$(CURRENT_TIER))
|
||||
$(call SUBMAKE,$(if $(filter $*,$(tier_$(subtier_of_$(subst /,_,$*))_staticdirs)),,$(CURRENT_TIER)),$*)
|
||||
# Ensure existing stamps are up-to-date, but don't create one if submake didn't create one.
|
||||
$(if $(wildcard $@),@$(STAMP_TOUCH))
|
||||
|
||||
|
@ -346,8 +346,12 @@ ifdef MOZ_UPDATE_XTERM
|
||||
# Its good not to have a newline at the end of the titlebar string because it
|
||||
# makes the make -s output easier to read. Echo -n does not work on all
|
||||
# platforms, but we can trick printf into doing it.
|
||||
ifeq (.,$(relativesrcdir))
|
||||
UPDATE_TITLE = printf '\033]0;%s in %s\007' $(1) $(2) ;
|
||||
else
|
||||
UPDATE_TITLE = printf '\033]0;%s in %s\007' $(1) $(relativesrcdir)/$(2) ;
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MACH
|
||||
ifndef NO_BUILDSTATUS_MESSAGES
|
||||
@ -360,7 +364,7 @@ endif
|
||||
|
||||
define SUBMAKE # $(call SUBMAKE,target,directory,static)
|
||||
+@$(UPDATE_TITLE)
|
||||
+$(MAKE) $(if $(2),-C $(2)) $(1)
|
||||
+@$(MAKE) $(if $(2),-C $(2)) $(1)
|
||||
|
||||
endef # The extra line is important here! don't delete it
|
||||
|
||||
|
@ -101,6 +101,7 @@ enum {
|
||||
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET);
|
||||
|
||||
namespace mozilla {
|
||||
class ElementAnimation;
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
class EventChainVisitor;
|
||||
@ -783,6 +784,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void GetAnimationPlayers(nsTArray<nsRefPtr<ElementAnimation> >& aPlayers);
|
||||
|
||||
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
|
||||
virtual void SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError);
|
||||
void GetOuterHTML(nsAString& aOuterHTML);
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "mozilla/dom/ElementInlines.h"
|
||||
|
||||
#include "AnimationCommon.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/dom/Attr.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
@ -2864,6 +2865,30 @@ Element::MozRequestPointerLock()
|
||||
OwnerDoc()->RequestPointerLock(this);
|
||||
}
|
||||
|
||||
void
|
||||
Element::GetAnimationPlayers(nsTArray<nsRefPtr<ElementAnimation> >& aPlayers)
|
||||
{
|
||||
nsIAtom* properties[] = { nsGkAtoms::transitionsProperty,
|
||||
nsGkAtoms::animationsProperty };
|
||||
for (size_t propIdx = 0; propIdx < MOZ_ARRAY_LENGTH(properties);
|
||||
propIdx++) {
|
||||
ElementAnimationCollection* collection =
|
||||
static_cast<ElementAnimationCollection*>(
|
||||
GetProperty(properties[propIdx]));
|
||||
if (!collection) {
|
||||
continue;
|
||||
}
|
||||
for (size_t animIdx = 0;
|
||||
animIdx < collection->mAnimations.Length();
|
||||
animIdx++) {
|
||||
ElementAnimation* anim = collection->mAnimations[animIdx];
|
||||
if (anim->IsCurrent()) {
|
||||
aPlayers.AppendElement(anim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Element::GetInnerHTML(nsAString& aInnerHTML)
|
||||
{
|
||||
|
@ -9,6 +9,16 @@
|
||||
|
||||
#include "nsAttrValue.h"
|
||||
|
||||
struct MiscContainer;
|
||||
|
||||
namespace mozilla {
|
||||
template<>
|
||||
struct HasDangerousPublicDestructor<MiscContainer>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
}
|
||||
|
||||
struct MiscContainer
|
||||
{
|
||||
typedef nsAttrValue::ValueType ValueType;
|
||||
@ -93,7 +103,6 @@ struct MiscContainer
|
||||
void Evict();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of inline methods
|
||||
*/
|
||||
|
@ -1463,11 +1463,13 @@ public:
|
||||
MOZ_COUNT_CTOR(SelectorCacheKeyDeleter);
|
||||
}
|
||||
|
||||
protected:
|
||||
~SelectorCacheKeyDeleter()
|
||||
{
|
||||
MOZ_COUNT_DTOR(SelectorCacheKeyDeleter);
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
return NS_OK;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
|
@ -1088,10 +1088,6 @@ CanvasRenderingContext2D::SetIsOpaque(bool isOpaque)
|
||||
ClearTarget();
|
||||
}
|
||||
|
||||
if (mOpaque) {
|
||||
EnsureTarget();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -4259,6 +4255,12 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
||||
CanvasLayer *aOldLayer,
|
||||
LayerManager *aManager)
|
||||
{
|
||||
if (mOpaque) {
|
||||
// If we're opaque then make sure we have a surface so we paint black
|
||||
// instead of transparent.
|
||||
EnsureTarget();
|
||||
}
|
||||
|
||||
// Don't call EnsureTarget() ... if there isn't already a surface, then
|
||||
// we have nothing to paint and there is no need to create a surface just
|
||||
// to paint nothing. Also, EnsureTarget() can cause creation of a persistent
|
||||
|
@ -24,8 +24,10 @@ namespace mozilla {
|
||||
class AudioNodeExternalInputStream : public AudioNodeStream {
|
||||
public:
|
||||
AudioNodeExternalInputStream(AudioNodeEngine* aEngine, TrackRate aSampleRate);
|
||||
protected:
|
||||
~AudioNodeExternalInputStream();
|
||||
|
||||
public:
|
||||
virtual void ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
@ -65,8 +65,11 @@ public:
|
||||
mHasCurrentData = true;
|
||||
MOZ_COUNT_CTOR(AudioNodeStream);
|
||||
}
|
||||
|
||||
protected:
|
||||
~AudioNodeStream();
|
||||
|
||||
public:
|
||||
// Control API
|
||||
/**
|
||||
* Sets a parameter that's a time relative to some stream's played time.
|
||||
|
@ -33,11 +33,13 @@ public:
|
||||
MOZ_COUNT_CTOR(BufferMediaResource);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~BufferMediaResource()
|
||||
{
|
||||
MOZ_COUNT_DTOR(BufferMediaResource);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual nsresult Close() { return NS_OK; }
|
||||
virtual void Suspend(bool aCloseImmediately) {}
|
||||
virtual void Resume() {}
|
||||
|
@ -56,8 +56,10 @@ public:
|
||||
|
||||
FileBlockCache();
|
||||
|
||||
protected:
|
||||
~FileBlockCache();
|
||||
|
||||
public:
|
||||
// Assumes ownership of aFD.
|
||||
nsresult Open(PRFileDesc* aFD);
|
||||
|
||||
|
@ -104,10 +104,12 @@ private:
|
||||
{
|
||||
MOZ_COUNT_CTOR(DeliverAudioTask);
|
||||
}
|
||||
protected:
|
||||
~DeliverAudioTask()
|
||||
{
|
||||
MOZ_COUNT_DTOR(DeliverAudioTask);
|
||||
}
|
||||
public:
|
||||
NS_METHOD Run() {
|
||||
mTarget->OnAudioDecoded(mSample.forget());
|
||||
return NS_OK;
|
||||
@ -125,10 +127,12 @@ private:
|
||||
{
|
||||
MOZ_COUNT_CTOR(DeliverVideoTask);
|
||||
}
|
||||
protected:
|
||||
~DeliverVideoTask()
|
||||
{
|
||||
MOZ_COUNT_DTOR(DeliverVideoTask);
|
||||
}
|
||||
public:
|
||||
NS_METHOD Run() {
|
||||
mTarget->OnVideoDecoded(mSample.forget());
|
||||
return NS_OK;
|
||||
|
@ -1639,11 +1639,13 @@ public:
|
||||
MOZ_COUNT_CTOR(DispatchBytesConsumedEvent);
|
||||
}
|
||||
|
||||
protected:
|
||||
~DispatchBytesConsumedEvent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(DispatchBytesConsumedEvent);
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD Run() {
|
||||
mDecoder->NotifyBytesConsumed(mNumBytes, mOffset);
|
||||
// Drop ref to decoder on main thread, just in case this reference
|
||||
|
@ -193,6 +193,8 @@ SharedThreadPool::~SharedThreadPool()
|
||||
// deinitialized on the thread pool thread. We may call into WMF or
|
||||
// DirectShow on this thread, so we need MSCOM working.
|
||||
class MSCOMInitThreadPoolListener MOZ_FINAL : public nsIThreadPoolListener {
|
||||
~MSCOMInitThreadPoolListener() {}
|
||||
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSITHREADPOOLLISTENER
|
||||
|
@ -83,9 +83,9 @@ FFmpegH264Decoder<LIBAV_VER>::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
|
||||
info.mHasVideo = true;
|
||||
|
||||
data = VideoData::CreateFromImage(
|
||||
info, mImageContainer, aSample->byte_offset,
|
||||
aSample->composition_timestamp, aSample->duration,
|
||||
reinterpret_cast<Image*>(frame->opaque), aSample->is_sync_point, -1,
|
||||
info, mImageContainer, aSample->byte_offset, frame->pkt_pts,
|
||||
aSample->duration, reinterpret_cast<Image*>(frame->opaque),
|
||||
aSample->is_sync_point, -1,
|
||||
gfx::IntRect(0, 0, mCodecContext.width, mCodecContext.height));
|
||||
|
||||
mCallback->Output(data.forget());
|
||||
|
@ -192,8 +192,10 @@ private:
|
||||
public:
|
||||
SourceBufferResource(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aType);
|
||||
protected:
|
||||
~SourceBufferResource();
|
||||
|
||||
public:
|
||||
virtual nsresult Close() MOZ_OVERRIDE;
|
||||
virtual void Suspend(bool aCloseImmediately) MOZ_OVERRIDE {}
|
||||
virtual void Resume() MOZ_OVERRIDE {}
|
||||
|
@ -49,8 +49,11 @@ class OggReader : public MediaDecoderReader
|
||||
{
|
||||
public:
|
||||
OggReader(AbstractMediaDecoder* aDecoder);
|
||||
|
||||
protected:
|
||||
~OggReader();
|
||||
|
||||
public:
|
||||
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
|
||||
virtual nsresult ResetDecode();
|
||||
virtual bool DecodeAudioData();
|
||||
|
@ -15,8 +15,11 @@ class RawReader : public MediaDecoderReader
|
||||
{
|
||||
public:
|
||||
RawReader(AbstractMediaDecoder* aDecoder);
|
||||
|
||||
protected:
|
||||
~RawReader();
|
||||
|
||||
public:
|
||||
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
|
||||
virtual nsresult ResetDecode();
|
||||
virtual bool DecodeAudioData();
|
||||
|
@ -21,8 +21,11 @@ class WaveReader : public MediaDecoderReader
|
||||
{
|
||||
public:
|
||||
WaveReader(AbstractMediaDecoder* aDecoder);
|
||||
|
||||
protected:
|
||||
~WaveReader();
|
||||
|
||||
public:
|
||||
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
|
||||
virtual bool DecodeAudioData();
|
||||
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
|
@ -105,8 +105,11 @@ class WebMReader : public MediaDecoderReader
|
||||
{
|
||||
public:
|
||||
WebMReader(AbstractMediaDecoder* aDecoder);
|
||||
|
||||
protected:
|
||||
~WebMReader();
|
||||
|
||||
public:
|
||||
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
|
||||
virtual nsresult ResetDecode();
|
||||
virtual bool DecodeAudioData();
|
||||
|
@ -79,8 +79,8 @@ MediaEngineWebRTCVideoSource::DeliverFrame(
|
||||
return 0;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mWidth*mHeight*3/2 == size);
|
||||
if (mWidth*mHeight*3/2 != size) {
|
||||
if (mWidth*mHeight + 2*(((mWidth+1)/2)*((mHeight+1)/2)) != size) {
|
||||
MOZ_ASSERT(false, "Wrong size frame in DeliverFrame!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -93,14 +93,15 @@ MediaEngineWebRTCVideoSource::DeliverFrame(
|
||||
const uint8_t lumaBpp = 8;
|
||||
const uint8_t chromaBpp = 4;
|
||||
|
||||
// Take lots of care to round up!
|
||||
layers::PlanarYCbCrData data;
|
||||
data.mYChannel = frame;
|
||||
data.mYSize = IntSize(mWidth, mHeight);
|
||||
data.mYStride = mWidth * lumaBpp/ 8;
|
||||
data.mCbCrStride = mWidth * chromaBpp / 8;
|
||||
data.mYStride = (mWidth * lumaBpp + 7)/ 8;
|
||||
data.mCbCrStride = (mWidth * chromaBpp + 7) / 8;
|
||||
data.mCbChannel = frame + mHeight * data.mYStride;
|
||||
data.mCrChannel = data.mCbChannel + mHeight * data.mCbCrStride / 2;
|
||||
data.mCbCrSize = IntSize(mWidth/ 2, mHeight/ 2);
|
||||
data.mCrChannel = data.mCbChannel + ((mHeight+1)/2) * data.mCbCrStride;
|
||||
data.mCbCrSize = IntSize((mWidth+1)/ 2, (mHeight+1)/ 2);
|
||||
data.mPicX = 0;
|
||||
data.mPicY = 0;
|
||||
data.mPicSize = IntSize(mWidth, mHeight);
|
||||
|
@ -86,11 +86,13 @@ protected:
|
||||
public:
|
||||
List() { MOZ_COUNT_CTOR(MemoryElementSet::List); }
|
||||
|
||||
protected:
|
||||
~List() {
|
||||
MOZ_COUNT_DTOR(MemoryElementSet::List);
|
||||
delete mElement;
|
||||
NS_IF_RELEASE(mNext); }
|
||||
|
||||
public:
|
||||
int32_t AddRef() { return ++mRefCnt; }
|
||||
|
||||
int32_t Release() {
|
||||
@ -231,10 +233,13 @@ protected:
|
||||
List(const nsAssignment &aAssignment) : mAssignment(aAssignment) {
|
||||
MOZ_COUNT_CTOR(nsAssignmentSet::List); }
|
||||
|
||||
protected:
|
||||
~List() {
|
||||
MOZ_COUNT_DTOR(nsAssignmentSet::List);
|
||||
NS_IF_RELEASE(mNext); }
|
||||
|
||||
public:
|
||||
|
||||
int32_t AddRef() { return ++mRefCnt; }
|
||||
|
||||
int32_t Release() {
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "AnimationTimeline.h"
|
||||
#include "mozilla/dom/AnimationTimelineBinding.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
@ -28,23 +29,43 @@ AnimationTimeline::WrapObject(JSContext* aCx)
|
||||
Nullable<double>
|
||||
AnimationTimeline::GetCurrentTime() const
|
||||
{
|
||||
Nullable<double> result; // Default ctor initializes to null
|
||||
return ToTimelineTime(GetCurrentTimeStamp());
|
||||
}
|
||||
|
||||
TimeStamp
|
||||
AnimationTimeline::GetCurrentTimeStamp() const
|
||||
{
|
||||
// Always return the same object to benefit from return-value optimization.
|
||||
TimeStamp result; // Initializes to null timestamp
|
||||
|
||||
nsIPresShell* presShell = mDocument->GetShell();
|
||||
if (!presShell)
|
||||
if (MOZ_UNLIKELY(!presShell)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (!presContext)
|
||||
if (MOZ_UNLIKELY(!presContext)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = presContext->RefreshDriver()->MostRecentRefresh();
|
||||
return result;
|
||||
}
|
||||
|
||||
Nullable<double>
|
||||
AnimationTimeline::ToTimelineTime(const mozilla::TimeStamp& aTimeStamp) const
|
||||
{
|
||||
Nullable<double> result; // Initializes to null
|
||||
if (aTimeStamp.IsNull()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsRefPtr<nsDOMNavigationTiming> timing = mDocument->GetNavigationTiming();
|
||||
if (!timing)
|
||||
if (MOZ_UNLIKELY(!timing)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
TimeStamp now = presContext->RefreshDriver()->MostRecentRefresh();
|
||||
result.SetValue(timing->TimeStampToDOMHighRes(now));
|
||||
|
||||
result.SetValue(timing->TimeStampToDOMHighRes(aTimeStamp));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,9 @@
|
||||
struct JSContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class TimeStamp;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class AnimationTimeline MOZ_FINAL : public nsWrapperCache
|
||||
@ -33,6 +36,9 @@ public:
|
||||
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
Nullable<double> GetCurrentTime() const;
|
||||
mozilla::TimeStamp GetCurrentTimeStamp() const;
|
||||
|
||||
Nullable<double> ToTimelineTime(const mozilla::TimeStamp& aTimeStamp) const;
|
||||
|
||||
protected:
|
||||
virtual ~AnimationTimeline() { }
|
||||
|
@ -0,0 +1,276 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<style>
|
||||
@keyframes anim1 {
|
||||
to { left: 100px }
|
||||
}
|
||||
@keyframes anim2 {
|
||||
to { top: 100px }
|
||||
}
|
||||
@keyframes multiPropAnim {
|
||||
to { background: green, opacity: 0.5, left: 100px, top: 100px }
|
||||
}
|
||||
@keyframes empty { }
|
||||
</style>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
function addDiv() {
|
||||
var div = document.createElement('div');
|
||||
document.body.appendChild(div);
|
||||
return div;
|
||||
}
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
assert_equals(div.getAnimationPlayers().length, 0,
|
||||
'getAnimationPlayers returns an empty sequence for an element'
|
||||
+ ' with no animations');
|
||||
div.remove();
|
||||
}, 'getAnimationPlayers for non-animated content');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv();
|
||||
|
||||
// Add an animation
|
||||
div.style.animation = 'anim1 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
var players = div.getAnimationPlayers();
|
||||
assert_equals(players.length, 1,
|
||||
'getAnimationPlayers returns a player running CSS Animations');
|
||||
var startTime = players[0].startTime;
|
||||
assert_true(startTime > 0 && startTime <= document.timeline.currentTime,
|
||||
'CSS animation has a sensible start time');
|
||||
|
||||
// Wait a moment then add a second animation.
|
||||
//
|
||||
// We wait for the next frame so that we can test that the start times of
|
||||
// the animations differ.
|
||||
window.requestAnimationFrame(t.step_func(function() {
|
||||
div.style.animation = 'anim1 100s, anim2 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
players = div.getAnimationPlayers();
|
||||
assert_equals(players.length, 2,
|
||||
'getAnimationPlayers returns one player for each value of'
|
||||
+ ' animation-name');
|
||||
assert_true(players[0].startTime < players[1].startTime,
|
||||
'Additional players for CSS animations start after the original'
|
||||
+ ' animation and appear later in the list');
|
||||
div.remove();
|
||||
t.done();
|
||||
}));
|
||||
}, 'getAnimationPlayers for CSS Animations');
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
|
||||
// Add an animation that targets multiple properties
|
||||
div.style.animation = 'multiPropAnim 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
assert_equals(div.getAnimationPlayers().length, 1,
|
||||
'getAnimationPlayers returns only one player for a CSS Animation'
|
||||
+ ' that targets multiple properties');
|
||||
div.remove();
|
||||
}, 'getAnimationsPlayers for multi-property animations');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv();
|
||||
|
||||
// Add a couple of transitions
|
||||
div.style.left = '0px';
|
||||
div.style.top = '0px';
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.left = '100px';
|
||||
div.style.top = '100px';
|
||||
window.getComputedStyle(div).left;
|
||||
|
||||
var players = div.getAnimationPlayers();
|
||||
assert_equals(players.length, 2,
|
||||
'getAnimationPlayers() returns one player per transitioning property');
|
||||
var startTime = players[0].startTime;
|
||||
assert_true(startTime > 0 && startTime <= document.timeline.currentTime,
|
||||
'CSS transitions have sensible start times');
|
||||
assert_equals(players[0].startTime, players[1].startTime,
|
||||
'CSS transitions started together have the same start time');
|
||||
|
||||
// Wait a moment then add a third transition
|
||||
window.requestAnimationFrame(t.step_func(function() {
|
||||
div.style.backgroundColor = 'green';
|
||||
window.getComputedStyle(div).backgroundColor;
|
||||
players = div.getAnimationPlayers();
|
||||
assert_equals(players.length, 3,
|
||||
'getAnimationPlayers returns players for all running CSS Transitions');
|
||||
assert_true(players[1].startTime < players[2].startTime,
|
||||
'Player for additional CSS transition starts after the original'
|
||||
+ ' transitions and appears later in the list');
|
||||
div.remove();
|
||||
t.done();
|
||||
}));
|
||||
}, 'getAnimationPlayers for CSS Transitions');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv();
|
||||
|
||||
// Add an animation
|
||||
div.style.backgroundColor = 'red';
|
||||
div.style.animation = 'anim1 100s';
|
||||
window.getComputedStyle(div).backgroundColor;
|
||||
|
||||
// Wait a moment then add a transition
|
||||
window.requestAnimationFrame(t.step_func(function() {
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.backgroundColor = 'green';
|
||||
window.getComputedStyle(div).backgroundColor;
|
||||
|
||||
var players = div.getAnimationPlayers();
|
||||
assert_equals(players.length, 2,
|
||||
'getAnimationPlayers returns players for both animations and '
|
||||
+ ' transitions that run simultaneously');
|
||||
assert_true(players[0].startTime > players[1].startTime,
|
||||
'players for transitions appear before animations even if they '
|
||||
+ ' start later');
|
||||
div.remove();
|
||||
t.done();
|
||||
}));
|
||||
}, 'getAnimationPlayers for both CSS Animations and Transitions at once');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv();
|
||||
|
||||
// Set up event listener
|
||||
div.addEventListener('animationend', t.step_func(function() {
|
||||
assert_equals(div.getAnimationPlayers().length, 0,
|
||||
'getAnimationPlayers does not return players for finished '
|
||||
+ ' (and non-forwards-filling) CSS Animations');
|
||||
div.remove();
|
||||
t.done();
|
||||
}));
|
||||
|
||||
// Add a very short animation
|
||||
div.style.animation = 'anim1 0.01s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
}, 'getAnimationPlayers for CSS Animations that have finished');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv();
|
||||
|
||||
// Set up event listener
|
||||
div.addEventListener('transitionend', t.step_func(function() {
|
||||
assert_equals(div.getAnimationPlayers().length, 0,
|
||||
'getAnimationPlayers does not return finished CSS Transitions');
|
||||
div.remove();
|
||||
t.done();
|
||||
}));
|
||||
|
||||
// Add a very short transition
|
||||
div.style.left = '0px';
|
||||
window.getComputedStyle(div).left;
|
||||
div.style.transition = 'all 0.01s';
|
||||
div.style.left = '100px';
|
||||
window.getComputedStyle(div).left;
|
||||
}, 'getAnimationPlayers for CSS Transitions that have finished');
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
div.style.animation = 'none 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
|
||||
var players = div.getAnimationPlayers();
|
||||
assert_equals(players.length, 0,
|
||||
'getAnimationPlayers returns an empty sequence for an element'
|
||||
+ ' with animation-name: none');
|
||||
|
||||
div.style.animation = 'none 100s, anim1 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
players = div.getAnimationPlayers();
|
||||
assert_equals(players.length, 1,
|
||||
'getAnimationPlayers returns players only for those CSS Animations whose'
|
||||
+ ' animation-name is not none');
|
||||
|
||||
div.remove();
|
||||
}, 'getAnimationPlayers for CSS Animations with animation-name: none');
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
div.style.animation = 'anim1 100s, anim1 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
|
||||
assert_equals(div.getAnimationPlayers().length, 2,
|
||||
'getAnimationPlayers returns one player for each CSS animation-name'
|
||||
+ ' even if the names are duplicated');
|
||||
div.remove();
|
||||
}, 'getAnimationPlayers for CSS Animations with duplicated animation-name');
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
div.style.animation = 'empty 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
|
||||
assert_equals(div.getAnimationPlayers().length, 1,
|
||||
'getAnimationPlayers returns players for CSS animations with an'
|
||||
+ ' empty keyframes rule');
|
||||
div.remove();
|
||||
}, 'getAnimationPlayers for CSS Animations with empty keyframes rule');
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
div.style.animation = 'anim1 100s 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
|
||||
var players = div.getAnimationPlayers();
|
||||
assert_equals(players.length, 1,
|
||||
'getAnimationPlayers returns animations for CSS animations whose'
|
||||
+ ' delay makes them start later');
|
||||
assert_true(players[0].startTime <= document.timeline.currentTime,
|
||||
'For CSS Animations in delay phase, the start time of the player is'
|
||||
+ ' not in the future');
|
||||
div.remove();
|
||||
}, 'getAnimationPlayers for CSS animations in delay phase');
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
div.style.animation = 'anim1 0s 100s';
|
||||
window.getComputedStyle(div).animationName;
|
||||
|
||||
assert_equals(div.getAnimationPlayers().length, 1,
|
||||
'getAnimationPlayers returns animations for CSS animations whose'
|
||||
+ ' duration is zero');
|
||||
div.remove();
|
||||
}, 'getAnimationPlayers for zero-duration CSS Animations');
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
|
||||
// Try to transition non-animatable property animation-duration
|
||||
div.style.animationDuration = '10s';
|
||||
window.getComputedStyle(div).animationDuration;
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.animationDuration = '100s';
|
||||
window.getComputedStyle(div).left;
|
||||
|
||||
assert_equals(div.getAnimationPlayers().length, 0,
|
||||
'getAnimationPlayers returns an empty sequence for a transition'
|
||||
+ ' of a non-animatable property');
|
||||
div.remove();
|
||||
}, 'getAnimationPlayers for transition on non-animatable property');
|
||||
|
||||
test(function() {
|
||||
var div = addDiv();
|
||||
|
||||
div.style.setProperty('-vendor-unsupported', '0px', '');
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.setProperty('-vendor-unsupported', '100px', '');
|
||||
window.getComputedStyle(div).getPropertyValue('-vendor-unsupported');
|
||||
|
||||
assert_equals(div.getAnimationPlayers().length, 0,
|
||||
'getAnimationPlayers returns an empty sequence for a transition'
|
||||
+ ' of an unsupported property');
|
||||
div.remove();
|
||||
}, 'getAnimationPlayers for transition on unsupported property');
|
||||
|
||||
</script>
|
@ -1 +1,2 @@
|
||||
[animation-timeline/test_animation-timeline.html]
|
||||
[css-integration/test_element-get-animation-players.html]
|
||||
|
@ -56,8 +56,10 @@ public:
|
||||
|
||||
ArchiveReaderEvent(ArchiveReader* aArchiveReader);
|
||||
|
||||
protected:
|
||||
virtual ~ArchiveReaderEvent();
|
||||
|
||||
public:
|
||||
// This must be implemented
|
||||
virtual nsresult Exec() = 0;
|
||||
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
MOZ_COUNT_CTOR(ArchiveRequestEvent);
|
||||
}
|
||||
|
||||
protected:
|
||||
~ArchiveRequestEvent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ArchiveRequestEvent);
|
||||
|
@ -24,8 +24,10 @@ public:
|
||||
ArchiveZipItem(const char* aFilename,
|
||||
const ZipCentral& aCentralStruct,
|
||||
const nsACString& aEncoding);
|
||||
protected:
|
||||
virtual ~ArchiveZipItem();
|
||||
|
||||
public:
|
||||
nsresult GetFilename(nsString& aFilename) MOZ_OVERRIDE;
|
||||
|
||||
// From zipItem to DOMFile:
|
||||
|
@ -1116,6 +1116,7 @@ public:
|
||||
MOZ_COUNT_CTOR(SingleProcessRunnable);
|
||||
}
|
||||
|
||||
protected:
|
||||
~SingleProcessRunnable()
|
||||
{
|
||||
MOZ_COUNT_DTOR(SingleProcessRunnable);
|
||||
@ -1370,6 +1371,7 @@ public:
|
||||
MOZ_COUNT_CTOR(ChildProcessRunnable);
|
||||
}
|
||||
|
||||
protected:
|
||||
~ChildProcessRunnable()
|
||||
{
|
||||
MOZ_ASSERT(mState == eFinished);
|
||||
|
@ -7840,11 +7840,13 @@ class PostMessageEvent : public nsRunnable
|
||||
MOZ_COUNT_CTOR(PostMessageEvent);
|
||||
}
|
||||
|
||||
protected:
|
||||
~PostMessageEvent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(PostMessageEvent);
|
||||
}
|
||||
|
||||
public:
|
||||
JSAutoStructuredCloneBuffer& Buffer()
|
||||
{
|
||||
return mBuffer;
|
||||
|
@ -136,6 +136,11 @@ DOMInterfaces = {
|
||||
'resultNotAddRefed': [ 'inputBuffer', 'outputBuffer' ],
|
||||
},
|
||||
|
||||
'AnimationPlayer' : {
|
||||
'nativeType': 'mozilla::ElementAnimation',
|
||||
'headerFile': 'AnimationCommon.h',
|
||||
},
|
||||
|
||||
'BarProp': {
|
||||
'headerFile': 'mozilla/dom/BarProps.h',
|
||||
},
|
||||
|
@ -36,11 +36,14 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(DOMCameraControlListener::DOMCallback);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~DOMCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(DOMCameraControlListener::DOMCallback);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void RunCallback(nsDOMCameraControl* aDOMCameraControl) = 0;
|
||||
|
||||
NS_IMETHOD
|
||||
|
@ -141,14 +141,15 @@ public:
|
||||
virtual void EventListenerWasRemoved(const nsAString& aType,
|
||||
ErrorResult& aRv,
|
||||
JSCompartment* aCompartment = nullptr) {}
|
||||
|
||||
// Dispatch a trusted, non-cancellable and non-bubbling event to |this|.
|
||||
nsresult DispatchTrustedEvent(const nsAString& aEventName);
|
||||
protected:
|
||||
virtual ~DOMEventTargetHelper();
|
||||
|
||||
nsresult WantsUntrusted(bool* aRetVal);
|
||||
|
||||
nsRefPtr<EventListenerManager> mListenerManager;
|
||||
// Dispatch a trusted, non-cancellable and non-bubbling event to |this|.
|
||||
nsresult DispatchTrustedEvent(const nsAString& aEventName);
|
||||
// Make |event| trusted and dispatch |aEvent| to |this|.
|
||||
nsresult DispatchTrustedEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "prlog.h"
|
||||
|
||||
#include "mozilla/IMEStateManager.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -36,6 +38,155 @@ namespace mozilla {
|
||||
using namespace dom;
|
||||
using namespace widget;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
/**
|
||||
* When a method is called, log its arguments and/or related static variables
|
||||
* with PR_LOG_ALWAYS. However, if it puts too many logs like
|
||||
* OnDestroyPresContext(), should long only when the method actually does
|
||||
* something. In this case, the log should start with "ISM: <method name>".
|
||||
*
|
||||
* When a method quits due to unexpected situation, log the reason with
|
||||
* PR_LOG_ERROR. In this case, the log should start with
|
||||
* "ISM: <method name>(), FAILED". The indent makes the log look easier.
|
||||
*
|
||||
* When a method does something only in some situations and it may be important
|
||||
* for debug, log the information with PR_LOG_DEBUG. In this case, the log
|
||||
* should start with "ISM: <method name>(),".
|
||||
*/
|
||||
PRLogModuleInfo* sISMLog = nullptr;
|
||||
|
||||
static const char*
|
||||
GetBoolName(bool aBool)
|
||||
{
|
||||
return aBool ? "true" : "false";
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetActionCauseName(InputContextAction::Cause aCause)
|
||||
{
|
||||
switch (aCause) {
|
||||
case InputContextAction::CAUSE_UNKNOWN:
|
||||
return "CAUSE_UNKNOWN";
|
||||
case InputContextAction::CAUSE_UNKNOWN_CHROME:
|
||||
return "CAUSE_UNKNOWN_CHROME";
|
||||
case InputContextAction::CAUSE_KEY:
|
||||
return "CAUSE_KEY";
|
||||
case InputContextAction::CAUSE_MOUSE:
|
||||
return "CAUSE_MOUSE";
|
||||
default:
|
||||
return "illegal value";
|
||||
}
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetActionFocusChangeName(InputContextAction::FocusChange aFocusChange)
|
||||
{
|
||||
switch (aFocusChange) {
|
||||
case InputContextAction::FOCUS_NOT_CHANGED:
|
||||
return "FOCUS_NOT_CHANGED";
|
||||
case InputContextAction::GOT_FOCUS:
|
||||
return "GOT_FOCUS";
|
||||
case InputContextAction::LOST_FOCUS:
|
||||
return "LOST_FOCUS";
|
||||
case InputContextAction::MENU_GOT_PSEUDO_FOCUS:
|
||||
return "MENU_GOT_PSEUDO_FOCUS";
|
||||
case InputContextAction::MENU_LOST_PSEUDO_FOCUS:
|
||||
return "MENU_LOST_PSEUDO_FOCUS";
|
||||
default:
|
||||
return "illegal value";
|
||||
}
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetIMEStateEnabledName(IMEState::Enabled aEnabled)
|
||||
{
|
||||
switch (aEnabled) {
|
||||
case IMEState::DISABLED:
|
||||
return "DISABLED";
|
||||
case IMEState::ENABLED:
|
||||
return "ENABLED";
|
||||
case IMEState::PASSWORD:
|
||||
return "PASSWORD";
|
||||
case IMEState::PLUGIN:
|
||||
return "PLUGIN";
|
||||
default:
|
||||
return "illegal value";
|
||||
}
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetIMEStateSetOpenName(IMEState::Open aOpen)
|
||||
{
|
||||
switch (aOpen) {
|
||||
case IMEState::DONT_CHANGE_OPEN_STATE:
|
||||
return "DONT_CHANGE_OPEN_STATE";
|
||||
case IMEState::OPEN:
|
||||
return "OPEN";
|
||||
case IMEState::CLOSED:
|
||||
return "CLOSED";
|
||||
default:
|
||||
return "illegal value";
|
||||
}
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetEventStructName(nsEventStructType aEventStructType)
|
||||
{
|
||||
switch (aEventStructType) {
|
||||
case NS_COMPOSITION_EVENT:
|
||||
return "NS_COMPOSITION_EVENT";
|
||||
case NS_TEXT_EVENT:
|
||||
return "NS_TEXT_EVENT";
|
||||
default:
|
||||
return "unacceptable event struct type";
|
||||
}
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetEventMessageName(uint32_t aMessage)
|
||||
{
|
||||
switch (aMessage) {
|
||||
case NS_COMPOSITION_START:
|
||||
return "NS_COMPOSITION_START";
|
||||
case NS_COMPOSITION_END:
|
||||
return "NS_COMPOSITION_END";
|
||||
case NS_COMPOSITION_UPDATE:
|
||||
return "NS_COMPOSITION_UPDATE";
|
||||
case NS_TEXT_TEXT:
|
||||
return "NS_TEXT_TEXT";
|
||||
default:
|
||||
return "unacceptable event message";
|
||||
}
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetNotifyIMEMessageName(IMEMessage aMessage)
|
||||
{
|
||||
switch (aMessage) {
|
||||
case NOTIFY_IME_OF_CURSOR_POS_CHANGED:
|
||||
return "NOTIFY_IME_OF_CURSOR_POS_CHANGED";
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
return "NOTIFY_IME_OF_FOCUS";
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
return "NOTIFY_IME_OF_BLUR";
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
return "NOTIFY_IME_OF_SELECTION_CHANGE";
|
||||
case NOTIFY_IME_OF_TEXT_CHANGE:
|
||||
return "NOTIFY_IME_OF_TEXT_CHANGE";
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
return "NOTIFY_IME_OF_COMPOSITION_UPDATE";
|
||||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
return "NOTIFY_IME_OF_POSITION_CHANGE";
|
||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||
return "REQUEST_TO_COMMIT_COMPOSITION";
|
||||
case REQUEST_TO_CANCEL_COMPOSITION:
|
||||
return "REQUEST_TO_CANCEL_COMPOSITION";
|
||||
default:
|
||||
return "unacceptable IME notification message";
|
||||
}
|
||||
}
|
||||
#endif // #ifdef PR_LOGGING
|
||||
|
||||
nsIContent* IMEStateManager::sContent = nullptr;
|
||||
nsPresContext* IMEStateManager::sPresContext = nullptr;
|
||||
bool IMEStateManager::sInstalledMenuKeyboardListener = false;
|
||||
@ -46,14 +197,32 @@ bool IMEStateManager::sIsTestingIME = false;
|
||||
IMEContentObserver* IMEStateManager::sActiveIMEContentObserver = nullptr;
|
||||
TextCompositionArray* IMEStateManager::sTextCompositions = nullptr;
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::Init()
|
||||
{
|
||||
#ifdef PR_LOGGING
|
||||
if (!sISMLog) {
|
||||
sISMLog = PR_NewLogModule("IMEStateManager");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::Shutdown()
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::Shutdown(), "
|
||||
"sTextCompositions=0x%p, sTextCompositions->Length()=%u",
|
||||
sTextCompositions, sTextCompositions ? sTextCompositions->Length() : 0));
|
||||
|
||||
MOZ_ASSERT(!sTextCompositions || !sTextCompositions->Length());
|
||||
delete sTextCompositions;
|
||||
sTextCompositions = nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
|
||||
{
|
||||
@ -64,11 +233,21 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
|
||||
TextCompositionArray::index_type i =
|
||||
sTextCompositions->IndexOf(aPresContext);
|
||||
if (i != TextCompositionArray::NoIndex) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnDestroyPresContext(), "
|
||||
"removing TextComposition instance from the array (index=%u)", i));
|
||||
// there should be only one composition per presContext object.
|
||||
sTextCompositions->ElementAt(i)->Destroy();
|
||||
sTextCompositions->RemoveElementAt(i);
|
||||
MOZ_ASSERT(sTextCompositions->IndexOf(aPresContext) ==
|
||||
TextCompositionArray::NoIndex);
|
||||
#if defined DEBUG || PR_LOGGING
|
||||
if (sTextCompositions->IndexOf(aPresContext) !=
|
||||
TextCompositionArray::NoIndex) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::OnDestroyPresContext(), FAILED to remove "
|
||||
"TextComposition instance from the array"));
|
||||
MOZ_CRASH("Failed to remove TextComposition instance from the array");
|
||||
}
|
||||
#endif // #if defined DEBUG || PR_LOGGING
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +255,12 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DestroyTextStateManager();
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnDestroyPresContext(aPresContext=0x%p), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sTextCompositions=0x%p",
|
||||
aPresContext, sPresContext, sContent, sTextCompositions));
|
||||
|
||||
DestroyIMEContentObserver();
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
|
||||
if (widget) {
|
||||
@ -90,6 +274,7 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
@ -102,6 +287,10 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
||||
sTextCompositions->GetCompositionInContent(aPresContext, aContent);
|
||||
|
||||
if (compositionInContent) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnRemoveContent(), "
|
||||
"composition is in the content"));
|
||||
|
||||
// Try resetting the native IME state. Be aware, typically, this method
|
||||
// is called during the content being removed. Then, the native
|
||||
// composition events which are caused by following APIs are ignored due
|
||||
@ -124,6 +313,9 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
||||
// If the compositionInContent is still available, we should finish the
|
||||
// composition just on the content forcibly.
|
||||
if (compositionInContent) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnRemoveContent(), "
|
||||
"composition in the content still alive, committing it forcibly..."));
|
||||
compositionInContent->SynthesizeCommit(true);
|
||||
}
|
||||
}
|
||||
@ -133,7 +325,12 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DestroyTextStateManager();
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnRemoveContent(aPresContext=0x%p, "
|
||||
"aContent=0x%p), sPresContext=0x%p, sContent=0x%p, sTextCompositions=0x%p",
|
||||
aPresContext, aContent, sPresContext, sContent, sTextCompositions));
|
||||
|
||||
DestroyIMEContentObserver();
|
||||
|
||||
// Current IME transaction should commit
|
||||
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
|
||||
@ -150,20 +347,35 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
IMEStateManager::OnChangeFocus(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
InputContextAction::Cause aCause)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnChangeFocus(aPresContext=0x%p, "
|
||||
"aContent=0x%p, aCause=%s)",
|
||||
aPresContext, aContent, GetActionCauseName(aCause)));
|
||||
|
||||
InputContextAction action(aCause);
|
||||
return OnChangeFocusInternal(aPresContext, aContent, action);
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
InputContextAction aAction)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(aPresContext=0x%p, "
|
||||
"aContent=0x%p, aAction={ mCause=%s, mFocusChange=%s }), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p",
|
||||
aPresContext, aContent, GetActionCauseName(aAction.mCause),
|
||||
GetActionFocusChangeName(aAction.mFocusChange),
|
||||
sPresContext, sContent, sActiveIMEContentObserver));
|
||||
|
||||
bool focusActuallyChanging =
|
||||
(sContent != aContent || sPresContext != aPresContext);
|
||||
|
||||
@ -180,17 +392,23 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
if (sActiveIMEContentObserver &&
|
||||
(aPresContext || !sActiveIMEContentObserver->KeepAliveDuringDeactive()) &&
|
||||
!sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) {
|
||||
DestroyTextStateManager();
|
||||
DestroyIMEContentObserver();
|
||||
}
|
||||
|
||||
if (!aPresContext) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(), "
|
||||
"no nsPresContext is being activated"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> widget =
|
||||
(sPresContext == aPresContext) ? oldWidget.get() :
|
||||
aPresContext->GetRootWidget();
|
||||
if (!widget) {
|
||||
if (NS_WARN_IF(!widget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(), FAILED due to "
|
||||
"no widget to manage its IME state"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -200,7 +418,9 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
// we should do it.
|
||||
InputContext context = widget->GetInputContext();
|
||||
if (context.mIMEState.mEnabled == newState.mEnabled) {
|
||||
// the enabled state isn't changing.
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnChangeFocusInternal(), "
|
||||
"neither focus nor IME state is changing"));
|
||||
return NS_OK;
|
||||
}
|
||||
aAction.mFocusChange = InputContextAction::FOCUS_NOT_CHANGED;
|
||||
@ -233,9 +453,15 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnInstalledMenuKeyboardListener(aInstalling=%s), "
|
||||
"sInstalledMenuKeyboardListener=%s",
|
||||
GetBoolName(aInstalling), GetBoolName(sInstalledMenuKeyboardListener)));
|
||||
|
||||
sInstalledMenuKeyboardListener = aInstalling;
|
||||
|
||||
InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
|
||||
@ -244,12 +470,21 @@ IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling)
|
||||
OnChangeFocusInternal(sPresContext, sContent, action);
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnClickInEditor(aPresContext=0x%p, aContent=0x%p, "
|
||||
"aMouseEvent=0x%p), sPresContext=0x%p, sContent=0x%p",
|
||||
aPresContext, aContent, aMouseEvent, sPresContext, sContent));
|
||||
|
||||
if (sPresContext != aPresContext || sContent != aContent) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnClickInEditor(), "
|
||||
"the mouse event isn't fired on the editor managed by ISM"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -260,6 +495,9 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (!isTrusted) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnClickInEditor(), "
|
||||
"the mouse event isn't a trusted event"));
|
||||
return; // ignore untrusted event.
|
||||
}
|
||||
|
||||
@ -267,6 +505,9 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
rv = aMouseEvent->GetButton(&button);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (button != 0) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnClickInEditor(), "
|
||||
"the mouse event isn't a left mouse button event"));
|
||||
return; // not a left click event.
|
||||
}
|
||||
|
||||
@ -274,6 +515,9 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
rv = aMouseEvent->GetDetail(&clickCount);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (clickCount != 1) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnClickInEditor(), "
|
||||
"the mouse event isn't a single click event"));
|
||||
return; // should notify only first click event.
|
||||
}
|
||||
|
||||
@ -283,11 +527,21 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
SetIMEState(newState, aContent, widget, action);
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::OnFocusInEditor(aPresContext=0x%p, aContent=0x%p), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p",
|
||||
aPresContext, aContent, sPresContext, sContent,
|
||||
sActiveIMEContentObserver));
|
||||
|
||||
if (sPresContext != aPresContext || sContent != aContent) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnFocusInEditor(), "
|
||||
"an editor not managed by ISM gets focus"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -295,25 +549,41 @@ IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext,
|
||||
// we need to recreate the instance.
|
||||
if (sActiveIMEContentObserver) {
|
||||
if (sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::OnFocusInEditor(), "
|
||||
"the editor is already being managed by sActiveIMEContentObserver"));
|
||||
return;
|
||||
}
|
||||
DestroyTextStateManager();
|
||||
DestroyIMEContentObserver();
|
||||
}
|
||||
|
||||
CreateIMEContentObserver();
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
if (!sPresContext) {
|
||||
NS_WARNING("ISM doesn't know which editor has focus");
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::UpdateIMEState(aNewIMEState={ mEnabled=%s, "
|
||||
"mOpen=%s }, aContent=0x%p), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p",
|
||||
GetIMEStateEnabledName(aNewIMEState.mEnabled),
|
||||
GetIMEStateSetOpenName(aNewIMEState.mOpen), aContent,
|
||||
sPresContext, sContent, sActiveIMEContentObserver));
|
||||
|
||||
if (NS_WARN_IF(!sPresContext)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::UpdateIMEState(), FAILED due to "
|
||||
"no managing nsPresContext"));
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
|
||||
if (!widget) {
|
||||
NS_WARNING("focused widget is not found");
|
||||
if (NS_WARN_IF(!widget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::UpdateIMEState(), FAILED due to "
|
||||
"no widget for the managing nsPresContext"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -333,7 +603,7 @@ IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
|
||||
}
|
||||
|
||||
if (createTextStateManager) {
|
||||
DestroyTextStateManager();
|
||||
DestroyIMEContentObserver();
|
||||
}
|
||||
|
||||
if (updateIMEState) {
|
||||
@ -347,17 +617,29 @@ IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
IMEState
|
||||
IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::GetNewIMEState(aPresContext=0x%p, aContent=0x%p), "
|
||||
"sInstalledMenuKeyboardListener=%s",
|
||||
aPresContext, aContent, GetBoolName(sInstalledMenuKeyboardListener)));
|
||||
|
||||
// On Printing or Print Preview, we don't need IME.
|
||||
if (aPresContext->Type() == nsPresContext::eContext_PrintPreview ||
|
||||
aPresContext->Type() == nsPresContext::eContext_Print) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
|
||||
"the nsPresContext is for print or print preview"));
|
||||
return IMEState(IMEState::DISABLED);
|
||||
}
|
||||
|
||||
if (sInstalledMenuKeyboardListener) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
|
||||
"menu keyboard listener was installed"));
|
||||
return IMEState(IMEState::DISABLED);
|
||||
}
|
||||
|
||||
@ -366,12 +648,24 @@ IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
|
||||
// editable, such case is design mode.
|
||||
nsIDocument* doc = aPresContext->Document();
|
||||
if (doc && doc->HasFlag(NODE_IS_EDITABLE)) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns ENABLED because "
|
||||
"design mode editor has focus"));
|
||||
return IMEState(IMEState::ENABLED);
|
||||
}
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because "
|
||||
"no content has focus"));
|
||||
return IMEState(IMEState::DISABLED);
|
||||
}
|
||||
|
||||
return aContent->GetDesiredIMEState();
|
||||
IMEState newIMEState = aContent->GetDesiredIMEState();
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::GetNewIMEState() returns { mEnabled=%s, "
|
||||
"mOpen=%s }",
|
||||
GetIMEStateEnabledName(newIMEState.mEnabled),
|
||||
GetIMEStateSetOpenName(newIMEState.mOpen)));
|
||||
return newIMEState;
|
||||
}
|
||||
|
||||
// Helper class, used for IME enabled state change notification
|
||||
@ -387,6 +681,9 @@ public:
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
services::GetObserverService();
|
||||
if (observerService) {
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEEnabledStateChangedEvent::Run(), notifies observers of "
|
||||
"\"ime-enabled-state-changed\""));
|
||||
nsAutoString state;
|
||||
state.AppendInt(mState);
|
||||
observerService->NotifyObservers(nullptr, "ime-enabled-state-changed",
|
||||
@ -399,12 +696,21 @@ private:
|
||||
uint32_t mState;
|
||||
};
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::SetIMEState(const IMEState& aState,
|
||||
nsIContent* aContent,
|
||||
nsIWidget* aWidget,
|
||||
InputContextAction aAction)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::SetIMEState(aState={ mEnabled=%s, mOpen=%s }, "
|
||||
"aContent=0x%p, aWidget=0x%p, aAction={ mCause=%s, mFocusChange=%s })",
|
||||
GetIMEStateEnabledName(aState.mEnabled),
|
||||
GetIMEStateSetOpenName(aState.mOpen), aContent, aWidget,
|
||||
GetActionCauseName(aAction.mCause),
|
||||
GetActionFocusChangeName(aAction.mFocusChange)));
|
||||
|
||||
NS_ENSURE_TRUE_VOID(aWidget);
|
||||
|
||||
InputContext oldContext = aWidget->GetInputContext();
|
||||
@ -478,6 +784,20 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
||||
aAction.mCause = InputContextAction::CAUSE_UNKNOWN_CHROME;
|
||||
}
|
||||
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::SetIMEState(), "
|
||||
"calling nsIWidget::SetInputContext(context={ mIMEState={ mEnabled=%s, "
|
||||
"mOpen=%s }, mHTMLInputType=\"%s\", mHTMLInputInputmode=\"%s\", "
|
||||
"mActionHint=\"%s\" }, aAction={ mCause=%s, mAction=%s })",
|
||||
GetIMEStateEnabledName(context.mIMEState.mEnabled),
|
||||
GetIMEStateSetOpenName(context.mIMEState.mOpen),
|
||||
NS_ConvertUTF16toUTF8(context.mHTMLInputType).get(),
|
||||
NS_ConvertUTF16toUTF8(context.mHTMLInputInputmode).get(),
|
||||
NS_ConvertUTF16toUTF8(context.mActionHint).get(),
|
||||
GetActionCauseName(aAction.mCause),
|
||||
GetActionFocusChangeName(aAction.mFocusChange)));
|
||||
|
||||
aWidget->SetInputContext(context, aAction);
|
||||
if (oldContext.mIMEState.mEnabled == context.mIMEState.mEnabled) {
|
||||
return;
|
||||
@ -487,6 +807,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
||||
new IMEEnabledStateChangedEvent(context.mIMEState.mEnabled));
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::EnsureTextCompositionArray()
|
||||
{
|
||||
@ -496,6 +817,7 @@ IMEStateManager::EnsureTextCompositionArray()
|
||||
sTextCompositions = new TextCompositionArray();
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
|
||||
nsPresContext* aPresContext,
|
||||
@ -503,6 +825,16 @@ IMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
|
||||
nsEventStatus* aStatus,
|
||||
EventDispatchingCallback* aCallBack)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::DispatchCompositionEvent(aNode=0x%p, "
|
||||
"aPresContext=0x%p, aEvent={ eventStructType=%s, message=%s, "
|
||||
" mFlags={ mIsTrusted=%s, mPropagationStopped=%s } })",
|
||||
aEventTargetNode, aPresContext,
|
||||
GetEventStructName(aEvent->eventStructType),
|
||||
GetEventMessageName(aEvent->message),
|
||||
GetBoolName(aEvent->mFlags.mIsTrusted),
|
||||
GetBoolName(aEvent->mFlags.mPropagationStopped)));
|
||||
|
||||
MOZ_ASSERT(aEvent->eventStructType == NS_COMPOSITION_EVENT ||
|
||||
aEvent->eventStructType == NS_TEXT_EVENT);
|
||||
if (!aEvent->mFlags.mIsTrusted || aEvent->mFlags.mPropagationStopped) {
|
||||
@ -516,6 +848,9 @@ IMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
|
||||
nsRefPtr<TextComposition> composition =
|
||||
sTextCompositions->GetCompositionFor(GUIEvent->widget);
|
||||
if (!composition) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::DispatchCompositionEvent(), "
|
||||
"adding new TextComposition to the array"));
|
||||
MOZ_ASSERT(GUIEvent->message == NS_COMPOSITION_START);
|
||||
composition = new TextComposition(aPresContext, aEventTargetNode, GUIEvent);
|
||||
sTextCompositions->AppendElement(composition);
|
||||
@ -536,6 +871,10 @@ IMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
|
||||
TextCompositionArray::index_type i =
|
||||
sTextCompositions->IndexOf(GUIEvent->widget);
|
||||
if (i != TextCompositionArray::NoIndex) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::DispatchCompositionEvent(), "
|
||||
"removing TextComposition from the array since NS_COMPOSTION_END "
|
||||
"was dispatched"));
|
||||
sTextCompositions->ElementAt(i)->Destroy();
|
||||
sTextCompositions->RemoveElementAt(i);
|
||||
}
|
||||
@ -547,12 +886,23 @@ nsresult
|
||||
IMEStateManager::NotifyIME(IMEMessage aMessage,
|
||||
nsIWidget* aWidget)
|
||||
{
|
||||
NS_ENSURE_TRUE(aWidget, NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsRefPtr<TextComposition> composition;
|
||||
if (sTextCompositions) {
|
||||
if (aWidget && sTextCompositions) {
|
||||
composition = sTextCompositions->GetCompositionFor(aWidget);
|
||||
}
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::NotifyIME(aMessage=%s, aWidget=0x%p), "
|
||||
"composition=0x%p, composition->IsSynthesizedForTests()=%s",
|
||||
GetNotifyIMEMessageName(aMessage), aWidget, composition.get(),
|
||||
GetBoolName(composition ? composition->IsSynthesizedForTests() : false)));
|
||||
|
||||
if (NS_WARN_IF(!aWidget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::NotifyIME(), FAILED due to no widget"));
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (!composition || !composition->IsSynthesizedForTests()) {
|
||||
switch (aMessage) {
|
||||
case NOTIFY_IME_OF_CURSOR_POS_CHANGED:
|
||||
@ -634,15 +984,23 @@ nsresult
|
||||
IMEStateManager::NotifyIME(IMEMessage aMessage,
|
||||
nsPresContext* aPresContext)
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::NotifyIME(aMessage=%s, aPresContext=0x%p)",
|
||||
GetNotifyIMEMessageName(aMessage), aPresContext));
|
||||
|
||||
NS_ENSURE_TRUE(aPresContext, NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsIWidget* widget = aPresContext->GetRootWidget();
|
||||
if (!widget) {
|
||||
if (NS_WARN_IF(!widget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::NotifyIME(), FAILED due to no widget for the "
|
||||
"nsPresContext"));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
return NotifyIME(aMessage, widget);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
IMEStateManager::IsEditable(nsINode* node)
|
||||
{
|
||||
@ -657,6 +1015,7 @@ IMEStateManager::IsEditable(nsINode* node)
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
nsINode*
|
||||
IMEStateManager::GetRootEditableNode(nsPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
@ -679,6 +1038,7 @@ IMEStateManager::GetRootEditableNode(nsPresContext* aPresContext,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
IMEStateManager::IsEditableIMEState(nsIWidget* aWidget)
|
||||
{
|
||||
@ -694,34 +1054,62 @@ IMEStateManager::IsEditableIMEState(nsIWidget* aWidget)
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::DestroyTextStateManager()
|
||||
IMEStateManager::DestroyIMEContentObserver()
|
||||
{
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::DestroyIMEContentObserver(), "
|
||||
"sActiveIMEContentObserver=0x%p",
|
||||
sActiveIMEContentObserver));
|
||||
|
||||
if (!sActiveIMEContentObserver) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::DestroyIMEContentObserver() does nothing"));
|
||||
return;
|
||||
}
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::DestroyIMEContentObserver(), destroying "
|
||||
"the active IMEContentObserver..."));
|
||||
nsRefPtr<IMEContentObserver> tsm;
|
||||
tsm.swap(sActiveIMEContentObserver);
|
||||
tsm->Destroy();
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IMEStateManager::CreateIMEContentObserver()
|
||||
{
|
||||
if (sActiveIMEContentObserver) {
|
||||
NS_WARNING("text state observer has been there already");
|
||||
PR_LOG(sISMLog, PR_LOG_ALWAYS,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver(), "
|
||||
"sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p, "
|
||||
"sActiveIMEContentObserver->IsManaging(sPresContext, sContent)=%s",
|
||||
sPresContext, sContent, sActiveIMEContentObserver,
|
||||
GetBoolName(sActiveIMEContentObserver ?
|
||||
sActiveIMEContentObserver->IsManaging(sPresContext, sContent) : false)));
|
||||
|
||||
if (NS_WARN_IF(sActiveIMEContentObserver)) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver(), FAILED due to "
|
||||
"there is already an active IMEContentObserver"));
|
||||
MOZ_ASSERT(sActiveIMEContentObserver->IsManaging(sPresContext, sContent));
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = sPresContext->GetRootWidget();
|
||||
if (!widget) {
|
||||
PR_LOG(sISMLog, PR_LOG_ERROR,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver(), FAILED due to "
|
||||
"there is a root widget for the nsPresContext"));
|
||||
return; // Sometimes, there are no widgets.
|
||||
}
|
||||
|
||||
// If it's not text ediable, we don't need to create IMEContentObserver.
|
||||
if (!IsEditableIMEState(widget)) {
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver() doesn't create "
|
||||
"IMEContentObserver because of non-editable IME state"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -731,6 +1119,9 @@ IMEStateManager::CreateIMEContentObserver()
|
||||
sInitializeIsTestingIME = false;
|
||||
}
|
||||
|
||||
PR_LOG(sISMLog, PR_LOG_DEBUG,
|
||||
("ISM: IMEStateManager::CreateIMEContentObserver() is creating an "
|
||||
"IMEContentObserver instance..."));
|
||||
sActiveIMEContentObserver = new IMEContentObserver();
|
||||
NS_ADDREF(sActiveIMEContentObserver);
|
||||
|
||||
@ -741,6 +1132,7 @@ IMEStateManager::CreateIMEContentObserver()
|
||||
sActiveIMEContentObserver->Init(widget, sPresContext, sContent);
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
IMEStateManager::GetFocusSelectionAndRoot(nsISelection** aSelection,
|
||||
nsIContent** aRootContent)
|
||||
|
@ -37,6 +37,7 @@ class IMEStateManager
|
||||
typedef widget::InputContextAction InputContextAction;
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
|
||||
static nsresult OnDestroyPresContext(nsPresContext* aPresContext);
|
||||
@ -135,7 +136,7 @@ protected:
|
||||
|
||||
static void EnsureTextCompositionArray();
|
||||
static void CreateIMEContentObserver();
|
||||
static void DestroyTextStateManager();
|
||||
static void DestroyIMEContentObserver();
|
||||
|
||||
static bool IsEditable(nsINode* node);
|
||||
|
||||
|
@ -5,7 +5,9 @@
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[uuid(44ef0b7e-92c0-48a7-a092-5a49f2533792)]
|
||||
interface nsIURI;
|
||||
|
||||
[uuid(6117cdf1-cb10-42a3-9901-4f1bab7ffa4d)]
|
||||
interface nsIServiceWorkerManager : nsISupports
|
||||
{
|
||||
// Returns a Promise
|
||||
@ -14,6 +16,10 @@ interface nsIServiceWorkerManager : nsISupports
|
||||
// Returns a Promise
|
||||
nsISupports unregister(in nsIDOMWindow aWindow, in DOMString aScope);
|
||||
|
||||
// aTarget MUST be a ServiceWorkerContainer.
|
||||
[noscript] void AddContainerEventListener(in nsIURI aPageURI, in nsIDOMEventTarget aTarget);
|
||||
[noscript] void RemoveContainerEventListener(in nsIURI aPageURI, in nsIDOMEventTarget aTarget);
|
||||
|
||||
// Testing
|
||||
DOMString getScopeForUrl(in DOMString path);
|
||||
};
|
||||
|
@ -43,11 +43,13 @@ public:
|
||||
MOZ_COUNT_CTOR(PromiseTask);
|
||||
}
|
||||
|
||||
protected:
|
||||
~PromiseTask()
|
||||
{
|
||||
MOZ_COUNT_DTOR(PromiseTask);
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mPromise->mTaskPending = false;
|
||||
@ -70,11 +72,13 @@ public:
|
||||
MOZ_COUNT_CTOR(WorkerPromiseTask);
|
||||
}
|
||||
|
||||
protected:
|
||||
~WorkerPromiseTask()
|
||||
{
|
||||
MOZ_COUNT_DTOR(WorkerPromiseTask);
|
||||
}
|
||||
|
||||
public:
|
||||
bool
|
||||
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
{
|
||||
|
@ -70,8 +70,11 @@ public:
|
||||
NS_IMETHOD_(void) Release(void);
|
||||
|
||||
DOMStorageCache(const nsACString* aScope);
|
||||
|
||||
protected:
|
||||
virtual ~DOMStorageCache();
|
||||
|
||||
public:
|
||||
void Init(DOMStorageManager* aManager, bool aPersistent, nsIPrincipal* aPrincipal,
|
||||
const nsACString& aQuotaScope);
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
class nsHapticFeedback MOZ_FINAL : public nsIHapticFeedback
|
||||
{
|
||||
~nsHapticFeedback() {}
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIHAPTICFEEDBACK
|
||||
|
@ -118,6 +118,8 @@ var interfaceNamesInGlobalScope =
|
||||
"AnalyserNode",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"AnimationEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "AnimationPlayer", pref: "dom.animations-api.core.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "AnimationTimeline", pref: "dom.animations-api.core.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
17
dom/webidl/Animatable.webidl
Normal file
17
dom/webidl/Animatable.webidl
Normal file
@ -0,0 +1,17 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://dev.w3.org/fxtf/web-animations/#the-animatable-interface
|
||||
*
|
||||
* Copyright © 2014 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface Animatable {
|
||||
[Pref="dom.animations-api.core.enabled"]
|
||||
sequence<AnimationPlayer> getAnimationPlayers();
|
||||
};
|
18
dom/webidl/AnimationPlayer.webidl
Normal file
18
dom/webidl/AnimationPlayer.webidl
Normal file
@ -0,0 +1,18 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://dev.w3.org/fxtf/web-animations/#the-animationtimeline-interface
|
||||
*
|
||||
* Copyright © 2014 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[Pref="dom.animations-api.core.enabled"]
|
||||
interface AnimationPlayer {
|
||||
readonly attribute AnimationTimeline timeline;
|
||||
[Pure] readonly attribute double startTime;
|
||||
readonly attribute double currentTime;
|
||||
};
|
@ -212,3 +212,4 @@ partial interface Element {
|
||||
Element implements ChildNode;
|
||||
Element implements NonDocumentTypeChildNode;
|
||||
Element implements ParentNode;
|
||||
Element implements Animatable;
|
||||
|
@ -19,7 +19,9 @@ WEBIDL_FILES = [
|
||||
'ActivityRequestHandler.webidl',
|
||||
'AlarmsManager.webidl',
|
||||
'AnalyserNode.webidl',
|
||||
'Animatable.webidl',
|
||||
'AnimationEvent.webidl',
|
||||
'AnimationPlayer.webidl',
|
||||
'AnimationTimeline.webidl',
|
||||
'AppInfo.webidl',
|
||||
'AppNotificationServiceOptions.webidl',
|
||||
|
@ -127,6 +127,26 @@ ServiceWorkerContainer::Ready()
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
// XXXnsm, maybe this can be optimized to only add when a event handler is
|
||||
// registered.
|
||||
void
|
||||
ServiceWorkerContainer::StartListeningForEvents()
|
||||
{
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID);
|
||||
if (swm) {
|
||||
swm->AddContainerEventListener(mWindow->GetDocumentURI(), this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerContainer::StopListeningForEvents()
|
||||
{
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID);
|
||||
if (swm) {
|
||||
swm->RemoveContainerEventListener(mWindow->GetDocumentURI(), this);
|
||||
}
|
||||
}
|
||||
|
||||
// Testing only.
|
||||
already_AddRefed<Promise>
|
||||
ServiceWorkerContainer::ClearAllServiceWorkerData(ErrorResult& aRv)
|
||||
|
@ -36,8 +36,8 @@ public:
|
||||
explicit ServiceWorkerContainer(nsPIDOMWindow* aWindow)
|
||||
: mWindow(aWindow)
|
||||
{
|
||||
// FIXME(nsm): Bug 983497. Here the NSW should hook into SWM to be notified of events.
|
||||
SetIsDOMBinding();
|
||||
StartListeningForEvents();
|
||||
}
|
||||
|
||||
nsPIDOMWindow*
|
||||
@ -75,6 +75,12 @@ public:
|
||||
already_AddRefed<Promise>
|
||||
Ready();
|
||||
|
||||
nsIURI*
|
||||
GetDocumentURI() const
|
||||
{
|
||||
return mWindow->GetDocumentURI();
|
||||
}
|
||||
|
||||
// Testing only.
|
||||
already_AddRefed<Promise>
|
||||
ClearAllServiceWorkerData(ErrorResult& aRv);
|
||||
@ -91,9 +97,15 @@ public:
|
||||
private:
|
||||
~ServiceWorkerContainer()
|
||||
{
|
||||
// FIXME(nsm): Bug 983497. Unhook from events.
|
||||
StopListeningForEvents();
|
||||
}
|
||||
|
||||
void
|
||||
StartListeningForEvents();
|
||||
|
||||
void
|
||||
StopListeningForEvents();
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "ServiceWorkerManager.h"
|
||||
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
@ -367,10 +368,10 @@ public:
|
||||
}
|
||||
|
||||
nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
ServiceWorkerManager::ServiceWorkerDomainInfo* domainInfo;
|
||||
nsRefPtr<ServiceWorkerManager::ServiceWorkerDomainInfo> domainInfo;
|
||||
// XXXnsm: This pattern can be refactored if we end up using it
|
||||
// often enough.
|
||||
if (!swm->mDomainMap.Get(domain, &domainInfo)) {
|
||||
if (!swm->mDomainMap.Get(domain, getter_AddRefs(domainInfo))) {
|
||||
domainInfo = new ServiceWorkerManager::ServiceWorkerDomainInfo;
|
||||
swm->mDomainMap.Put(domain, domainInfo);
|
||||
}
|
||||
@ -681,8 +682,8 @@ ServiceWorkerManager::HandleError(JSContext* aCx,
|
||||
return;
|
||||
}
|
||||
|
||||
ServiceWorkerDomainInfo* domainInfo;
|
||||
if (!mDomainMap.Get(domain, &domainInfo)) {
|
||||
nsRefPtr<ServiceWorkerDomainInfo> domainInfo;
|
||||
if (!mDomainMap.Get(domain, getter_AddRefs(domainInfo))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -915,7 +916,8 @@ ServiceWorkerManager::Install(ServiceWorkerRegistration* aRegistration,
|
||||
// a wait is likely to be required only when performing networking or storage
|
||||
// transactions in the first place.
|
||||
|
||||
// FIXME(nsm): Bug 983497. Fire "updatefound" on ServiceWorkerContainers.
|
||||
FireEventOnServiceWorkerContainers(aRegistration,
|
||||
NS_LITERAL_STRING("updatefound"));
|
||||
}
|
||||
|
||||
class ActivationRunnable : public nsRunnable
|
||||
@ -1003,26 +1005,13 @@ ServiceWorkerManager::GetServiceWorkerRegistration(nsIDocument* aDoc)
|
||||
already_AddRefed<ServiceWorkerRegistration>
|
||||
ServiceWorkerManager::GetServiceWorkerRegistration(nsIURI* aURI)
|
||||
{
|
||||
if (!aURI) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCString domain;
|
||||
nsresult rv = aURI->GetHost(domain);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ServiceWorkerDomainInfo* domainInfo = mDomainMap.Get(domain);
|
||||
|
||||
// XXXnsm: This pattern can be refactored if we end up using it
|
||||
// often enough.
|
||||
nsRefPtr<ServiceWorkerDomainInfo> domainInfo = GetDomainInfo(aURI);
|
||||
if (!domainInfo) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCString spec;
|
||||
rv = aURI->GetSpec(spec);
|
||||
nsresult rv = aURI->GetSpec(spec);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1126,6 +1115,45 @@ ServiceWorkerManager::RemoveScope(nsTArray<nsCString>& aList, const nsACString&
|
||||
aList.RemoveElement(aScope);
|
||||
}
|
||||
|
||||
already_AddRefed<ServiceWorkerManager::ServiceWorkerDomainInfo>
|
||||
ServiceWorkerManager::GetDomainInfo(nsIDocument* aDoc)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aDoc);
|
||||
nsCOMPtr<nsIURI> documentURI = aDoc->GetDocumentURI();
|
||||
return GetDomainInfo(documentURI);
|
||||
}
|
||||
|
||||
already_AddRefed<ServiceWorkerManager::ServiceWorkerDomainInfo>
|
||||
ServiceWorkerManager::GetDomainInfo(nsIURI* aURI)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aURI);
|
||||
|
||||
nsCString domain;
|
||||
nsresult rv = aURI->GetHost(domain);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<ServiceWorkerDomainInfo> domainInfo;
|
||||
mDomainMap.Get(domain, getter_AddRefs(domainInfo));
|
||||
return domainInfo.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<ServiceWorkerManager::ServiceWorkerDomainInfo>
|
||||
ServiceWorkerManager::GetDomainInfo(const nsCString& aURL)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr, nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GetDomainInfo(uri);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceWorkerManager::GetScopeForUrl(const nsAString& aUrl, nsAString& aScope)
|
||||
{
|
||||
@ -1143,6 +1171,79 @@ ServiceWorkerManager::GetScopeForUrl(const nsAString& aUrl, nsAString& aScope)
|
||||
aScope = NS_ConvertUTF8toUTF16(r->mScope);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
ServiceWorkerManager::AddContainerEventListener(nsIURI* aDocumentURI, nsIDOMEventTarget* aListener)
|
||||
{
|
||||
MOZ_ASSERT(aDocumentURI);
|
||||
nsRefPtr<ServiceWorkerDomainInfo> domainInfo = GetDomainInfo(aDocumentURI);
|
||||
if (!domainInfo) {
|
||||
nsCString domain;
|
||||
nsresult rv = aDocumentURI->GetHost(domain);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
domainInfo = new ServiceWorkerDomainInfo;
|
||||
mDomainMap.Put(domain, domainInfo);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(domainInfo);
|
||||
|
||||
ServiceWorkerContainer* container = static_cast<ServiceWorkerContainer*>(aListener);
|
||||
domainInfo->mServiceWorkerContainers.AppendElement(container);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceWorkerManager::RemoveContainerEventListener(nsIURI* aDocumentURI, nsIDOMEventTarget* aListener)
|
||||
{
|
||||
MOZ_ASSERT(aDocumentURI);
|
||||
nsRefPtr<ServiceWorkerDomainInfo> domainInfo = GetDomainInfo(aDocumentURI);
|
||||
if (!domainInfo) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ServiceWorkerContainer* container = static_cast<ServiceWorkerContainer*>(aListener);
|
||||
domainInfo->mServiceWorkerContainers.RemoveElement(container);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerManager::FireEventOnServiceWorkerContainers(
|
||||
ServiceWorkerRegistration* aRegistration,
|
||||
const nsAString& aName)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
nsRefPtr<ServiceWorkerDomainInfo> domainInfo =
|
||||
GetDomainInfo(aRegistration->mScriptSpec);
|
||||
|
||||
if (domainInfo) {
|
||||
nsTObserverArray<ServiceWorkerContainer*>::ForwardIterator it(domainInfo->mServiceWorkerContainers);
|
||||
while (it.HasMore()) {
|
||||
nsRefPtr<ServiceWorkerContainer> target = it.GetNext();
|
||||
nsIURI* targetURI = target->GetDocumentURI();
|
||||
if (!targetURI) {
|
||||
NS_WARNING("Controlled domain cannot have page with null URI!");
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCString path;
|
||||
nsresult rv = targetURI->GetSpec(path);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCString scope = FindScopeForPath(domainInfo->mOrderedScopes, path);
|
||||
if (scope.IsEmpty() ||
|
||||
!scope.Equals(aRegistration->mScope)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
target->DispatchTrustedEvent(aName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceWorkerManager::CreateServiceWorker(const nsACString& aScriptSpec,
|
||||
const nsACString& aScope,
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "mozilla/dom/ServiceWorkerContainer.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nsTWeakRef.h"
|
||||
|
||||
class nsIScriptError;
|
||||
@ -210,6 +210,12 @@ public:
|
||||
// Scope to registration.
|
||||
nsRefPtrHashtable<nsCStringHashKey, ServiceWorkerRegistration> mServiceWorkerRegistrations;
|
||||
|
||||
// This array can't be stored in ServiceWorkerRegistration because one may
|
||||
// not exist when a certain window is opened, but we still want that
|
||||
// window's container to be notified if it's in scope.
|
||||
// The containers inform the SWM on creation and destruction.
|
||||
nsTObserverArray<ServiceWorkerContainer*> mServiceWorkerContainers;
|
||||
|
||||
ServiceWorkerDomainInfo()
|
||||
{ }
|
||||
|
||||
@ -232,9 +238,15 @@ public:
|
||||
ServiceWorkerManager::AddScope(mOrderedScopes, aScope);
|
||||
return registration;
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerDomainInfo)
|
||||
|
||||
private:
|
||||
~ServiceWorkerDomainInfo()
|
||||
{ }
|
||||
};
|
||||
|
||||
nsClassHashtable<nsCStringHashKey, ServiceWorkerDomainInfo> mDomainMap;
|
||||
nsRefPtrHashtable<nsCStringHashKey, ServiceWorkerDomainInfo> mDomainMap;
|
||||
|
||||
void
|
||||
ResolveRegisterPromises(ServiceWorkerRegistration* aRegistration,
|
||||
@ -296,6 +308,15 @@ private:
|
||||
ServiceWorkerDomainInfo* aDomainInfo,
|
||||
void *aUnused);
|
||||
|
||||
already_AddRefed<ServiceWorkerDomainInfo>
|
||||
GetDomainInfo(nsIDocument* aDoc);
|
||||
|
||||
already_AddRefed<ServiceWorkerDomainInfo>
|
||||
GetDomainInfo(nsIURI* aURI);
|
||||
|
||||
already_AddRefed<ServiceWorkerDomainInfo>
|
||||
GetDomainInfo(const nsCString& aURL);
|
||||
|
||||
already_AddRefed<ServiceWorkerRegistration>
|
||||
GetServiceWorkerRegistration(nsPIDOMWindow* aWindow);
|
||||
|
||||
@ -314,6 +335,10 @@ private:
|
||||
static void
|
||||
RemoveScope(nsTArray<nsCString>& aList, const nsACString& aScope);
|
||||
|
||||
void
|
||||
FireEventOnServiceWorkerContainers(ServiceWorkerRegistration* aRegistration,
|
||||
const nsAString& aName);
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(ServiceWorkerManager,
|
||||
|
@ -56,11 +56,11 @@
|
||||
}
|
||||
|
||||
function realWorker() {
|
||||
var p = navigator.serviceWorker.register("worker.js");
|
||||
var p = navigator.serviceWorker.register("worker.js", { scope: "realworker*" });
|
||||
return p.then(function(w) {
|
||||
ok(w instanceof ServiceWorker, "Register a ServiceWorker");
|
||||
info(w.scope);
|
||||
ok(w.scope == (new URL("/*", document.baseURI)).href, "Scope should match");
|
||||
ok(w.scope == (new URL("realworker*", document.baseURI)).href, "Scope should match");
|
||||
ok(w.url == (new URL("worker.js", document.baseURI)).href, "URL should be of the worker");
|
||||
}, function(e) {
|
||||
info("Error: " + e.name);
|
||||
@ -107,6 +107,18 @@
|
||||
|
||||
// FIXME(nsm): test for parse error when Update step doesn't happen (directly from register).
|
||||
|
||||
function updatefound() {
|
||||
var p = navigator.serviceWorker.register("worker.js");
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
navigator.serviceWorker.onupdatefound = function(e) {
|
||||
ok(true, "Got updatefound event");
|
||||
navigator.serviceWorker.onupdatefound = null;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
simpleRegister()
|
||||
.then(sameOriginWorker)
|
||||
@ -116,6 +128,7 @@
|
||||
.then(abortPrevious)
|
||||
.then(networkError404)
|
||||
.then(parseError)
|
||||
.then(updatefound)
|
||||
// put more tests here.
|
||||
.then(function() {
|
||||
SimpleTest.finish();
|
||||
|
@ -11,12 +11,13 @@
|
||||
|
||||
class nsPrintProgressParams : public nsIPrintProgressParams
|
||||
{
|
||||
virtual ~nsPrintProgressParams();
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPRINTPROGRESSPARAMS
|
||||
|
||||
nsPrintProgressParams();
|
||||
virtual ~nsPrintProgressParams();
|
||||
|
||||
private:
|
||||
nsString mDocTitle;
|
||||
|
@ -30,9 +30,10 @@ class nsIDialogParamBlock;
|
||||
class nsPrintingPromptService: public nsIPrintingPromptService,
|
||||
public nsIWebProgressListener
|
||||
{
|
||||
virtual ~nsPrintingPromptService();
|
||||
|
||||
public:
|
||||
nsPrintingPromptService();
|
||||
virtual ~nsPrintingPromptService();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
|
@ -220,18 +220,23 @@ DrawTargetCG::CreateSourceSurfaceFromData(unsigned char *aData,
|
||||
static CGImageRef
|
||||
GetRetainedImageFromSourceSurface(SourceSurface *aSurface)
|
||||
{
|
||||
if (aSurface->GetType() == SurfaceType::COREGRAPHICS_IMAGE)
|
||||
return CGImageRetain(static_cast<SourceSurfaceCG*>(aSurface)->GetImage());
|
||||
else if (aSurface->GetType() == SurfaceType::COREGRAPHICS_CGCONTEXT)
|
||||
return CGImageRetain(static_cast<SourceSurfaceCGContext*>(aSurface)->GetImage());
|
||||
switch(aSurface->GetType()) {
|
||||
case SurfaceType::COREGRAPHICS_IMAGE:
|
||||
return CGImageRetain(static_cast<SourceSurfaceCG*>(aSurface)->GetImage());
|
||||
|
||||
if (aSurface->GetType() == SurfaceType::DATA) {
|
||||
DataSourceSurface* dataSource = static_cast<DataSourceSurface*>(aSurface);
|
||||
return CreateCGImage(nullptr, dataSource->GetData(), dataSource->GetSize(),
|
||||
dataSource->Stride(), dataSource->GetFormat());
|
||||
case SurfaceType::COREGRAPHICS_CGCONTEXT:
|
||||
return CGImageRetain(static_cast<SourceSurfaceCGContext*>(aSurface)->GetImage());
|
||||
|
||||
default:
|
||||
{
|
||||
RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();
|
||||
if (!data) {
|
||||
MOZ_CRASH("unsupported source surface");
|
||||
}
|
||||
return CreateCGImage(nullptr, data->GetData(), data->GetSize(),
|
||||
data->Stride(), data->GetFormat());
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_CRASH("unsupported source surface");
|
||||
}
|
||||
|
||||
TemporaryRef<SourceSurface>
|
||||
|
@ -130,7 +130,9 @@ static cairo_user_data_key_t surfaceDataKey;
|
||||
void
|
||||
ReleaseData(void* aData)
|
||||
{
|
||||
static_cast<DataSourceSurface*>(aData)->Release();
|
||||
DataSourceSurface *data = static_cast<DataSourceSurface*>(aData);
|
||||
data->Unmap();
|
||||
data->Release();
|
||||
}
|
||||
|
||||
cairo_surface_t*
|
||||
@ -195,12 +197,17 @@ GetCairoSurfaceForSourceSurface(SourceSurface *aSurface, bool aExistingOnly = fa
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (!data->Map(DataSourceSurface::READ, &map)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cairo_surface_t* surf =
|
||||
cairo_image_surface_create_for_data(data->GetData(),
|
||||
cairo_image_surface_create_for_data(map.mData,
|
||||
GfxFormatToCairoFormat(data->GetFormat()),
|
||||
data->GetSize().width,
|
||||
data->GetSize().height,
|
||||
data->Stride());
|
||||
map.mStride);
|
||||
|
||||
// In certain scenarios, requesting larger than 8k image fails. Bug 803568
|
||||
// covers the details of how to run into it, but the full detailed
|
||||
@ -212,18 +219,22 @@ GetCairoSurfaceForSourceSurface(SourceSurface *aSurface, bool aExistingOnly = fa
|
||||
// a new surface with a stride that cairo chooses. No need to
|
||||
// set user data since we're not dependent on the original
|
||||
// data.
|
||||
return CopyToImageSurface(data->GetData(),
|
||||
data->GetSize(),
|
||||
data->Stride(),
|
||||
data->GetFormat());
|
||||
cairo_surface_t* result =
|
||||
CopyToImageSurface(map.mData,
|
||||
data->GetSize(),
|
||||
map.mStride,
|
||||
data->GetFormat());
|
||||
data->Unmap();
|
||||
return result;
|
||||
}
|
||||
data->Unmap();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cairo_surface_set_user_data(surf,
|
||||
&surfaceDataKey,
|
||||
data.forget().drop(),
|
||||
ReleaseData);
|
||||
&surfaceDataKey,
|
||||
data.forget().drop(),
|
||||
ReleaseData);
|
||||
return surf;
|
||||
}
|
||||
|
||||
|
@ -816,13 +816,26 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex,
|
||||
RefPtr<DataSourceSurface> result =
|
||||
GetDataSurfaceInRect(surface, surfaceRect, aRect, aEdgeMode);
|
||||
|
||||
if (result &&
|
||||
(result->Stride() != GetAlignedStride<16>(result->Stride()) ||
|
||||
reinterpret_cast<uintptr_t>(result->GetData()) % 16 != 0)) {
|
||||
// Align unaligned surface.
|
||||
result = CloneAligned(result);
|
||||
if (result) {
|
||||
// TODO: This isn't safe since we don't have a guarantee
|
||||
// that future Maps will have the same stride
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (result->Map(DataSourceSurface::READ, &map)) {
|
||||
// Unmap immediately since CloneAligned hasn't been updated
|
||||
// to use the Map API yet. We can still read the stride/data
|
||||
// values as long as we don't try to dereference them.
|
||||
result->Unmap();
|
||||
if (map.mStride != GetAlignedStride<16>(map.mStride) ||
|
||||
reinterpret_cast<uintptr_t>(map.mData) % 16 != 0) {
|
||||
// Align unaligned surface.
|
||||
result = CloneAligned(result);
|
||||
}
|
||||
} else {
|
||||
result = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!result) {
|
||||
#ifdef DEBUG_DUMP_SURFACES
|
||||
printf(" -- no input --</section>\n\n");
|
||||
|
@ -37,8 +37,11 @@ class CopyableCanvasLayer : public CanvasLayer
|
||||
{
|
||||
public:
|
||||
CopyableCanvasLayer(LayerManager* aLayerManager, void *aImplData);
|
||||
|
||||
protected:
|
||||
virtual ~CopyableCanvasLayer();
|
||||
|
||||
public:
|
||||
virtual void Initialize(const Data& aData);
|
||||
|
||||
virtual bool IsDataValid(const Data& aData);
|
||||
|
168
gfx/layers/TextureDIB.cpp
Normal file
168
gfx/layers/TextureDIB.cpp
Normal file
@ -0,0 +1,168 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "TextureDIB.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace gfx;
|
||||
|
||||
namespace layers {
|
||||
|
||||
DIBTextureClient::DIBTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags)
|
||||
: TextureClient(aFlags)
|
||||
, mFormat(aFormat)
|
||||
, mIsLocked(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(DIBTextureClient);
|
||||
}
|
||||
|
||||
DIBTextureClient::~DIBTextureClient()
|
||||
{
|
||||
MOZ_COUNT_DTOR(DIBTextureClient);
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClient::Lock(OpenMode)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
if (!IsValid()) {
|
||||
return false;
|
||||
}
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureClient::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked, "Unlocked called while the texture is not locked!");
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget->Flush();
|
||||
mDrawTarget = nullptr;
|
||||
}
|
||||
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
if (!IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(mSurface);
|
||||
// The host will release this ref when it receives the surface descriptor.
|
||||
// We AddRef in case we die before the host receives the pointer.
|
||||
aOutDescriptor = SurfaceDescriptorDIB(reinterpret_cast<uintptr_t>(mSurface.get()));
|
||||
mSurface->AddRef();
|
||||
return true;
|
||||
}
|
||||
|
||||
gfx::DrawTarget*
|
||||
DIBTextureClient::BorrowDrawTarget()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked && IsAllocated());
|
||||
|
||||
if (!mDrawTarget) {
|
||||
mDrawTarget =
|
||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mSurface, mSize);
|
||||
}
|
||||
|
||||
return mDrawTarget;
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureClient::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags aFlags)
|
||||
{
|
||||
MOZ_ASSERT(!IsAllocated());
|
||||
mSize = aSize;
|
||||
|
||||
mSurface = new gfxWindowsSurface(gfxIntSize(aSize.width, aSize.height),
|
||||
SurfaceFormatToImageFormat(mFormat));
|
||||
if (!mSurface || mSurface->CairoStatus())
|
||||
{
|
||||
NS_WARNING("Could not create surface");
|
||||
mSurface = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DIBTextureHost::DIBTextureHost(TextureFlags aFlags,
|
||||
const SurfaceDescriptorDIB& aDescriptor)
|
||||
: TextureHost(aFlags)
|
||||
, mIsLocked(false)
|
||||
{
|
||||
// We added an extra ref for transport, so we shouldn't AddRef now.
|
||||
mSurface =
|
||||
dont_AddRef(reinterpret_cast<gfxWindowsSurface*>(aDescriptor.surface()));
|
||||
MOZ_ASSERT(mSurface);
|
||||
|
||||
mSize = ToIntSize(mSurface->GetSize());
|
||||
mFormat = ImageFormatToSurfaceFormat(
|
||||
gfxPlatform::GetPlatform()->OptimalFormatForContent(mSurface->GetContentType()));
|
||||
}
|
||||
|
||||
NewTextureSource*
|
||||
DIBTextureHost::GetTextureSources()
|
||||
{
|
||||
if (!mTextureSource) {
|
||||
Updated();
|
||||
}
|
||||
|
||||
return mTextureSource;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHost::Updated(const nsIntRegion* aRegion)
|
||||
{
|
||||
if (!mTextureSource) {
|
||||
mTextureSource = mCompositor->CreateDataTextureSource(mFlags);
|
||||
}
|
||||
|
||||
nsRefPtr<gfxImageSurface> imgSurf = mSurface->GetAsImageSurface();
|
||||
|
||||
RefPtr<DataSourceSurface> surf = Factory::CreateWrappingDataSourceSurface(imgSurf->Data(), imgSurf->Stride(), mSize, mFormat);
|
||||
|
||||
if (!mTextureSource->Update(surf, const_cast<nsIntRegion*>(aRegion))) {
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureHost::Lock()
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHost::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked);
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHost::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
mCompositor = aCompositor;
|
||||
}
|
||||
|
||||
void
|
||||
DIBTextureHost::DeallocateDeviceData()
|
||||
{
|
||||
if (mTextureSource) {
|
||||
mTextureSource->DeallocateDeviceData();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
102
gfx/layers/TextureDIB.h
Normal file
102
gfx/layers/TextureDIB.h
Normal file
@ -0,0 +1,102 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* 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_GFX_TEXTUREDIB_H
|
||||
#define MOZILLA_GFX_TEXTUREDIB_H
|
||||
|
||||
#include "mozilla/layers/Compositor.h"
|
||||
#include "mozilla/layers/TextureClient.h"
|
||||
#include "mozilla/layers/TextureHost.h"
|
||||
#include "mozilla/GfxMessageUtils.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
/**
|
||||
* Can only be drawn into through Cairo.
|
||||
* Prefer CairoTextureClient when possible.
|
||||
* The coresponding TextureHost depends on the compositor
|
||||
*/
|
||||
class DIBTextureClient : public TextureClient
|
||||
{
|
||||
public:
|
||||
DIBTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
|
||||
virtual ~DIBTextureClient();
|
||||
|
||||
// TextureClient
|
||||
|
||||
virtual bool IsAllocated() const MOZ_OVERRIDE { return !!mSurface; }
|
||||
|
||||
virtual bool Lock(OpenMode aOpenMode) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE{ return mIsLocked; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual gfx::DrawTarget* BorrowDrawTarget() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool AllocateForSurface(gfx::IntSize aSize,
|
||||
TextureAllocationFlags aFlags = ALLOC_DEFAULT) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
protected:
|
||||
nsRefPtr<gfxWindowsSurface> mSurface;
|
||||
RefPtr<gfx::DrawTarget> mDrawTarget;
|
||||
gfx::IntSize mSize;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
class DIBTextureHost : public TextureHost
|
||||
{
|
||||
public:
|
||||
DIBTextureHost(TextureFlags aFlags,
|
||||
const SurfaceDescriptorDIB& aDescriptor);
|
||||
|
||||
virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE;
|
||||
|
||||
virtual void DeallocateDeviceData() MOZ_OVERRIDE;
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
|
||||
virtual bool Lock() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Updated(const nsIntRegion* aRegion = nullptr) MOZ_OVERRIDE;
|
||||
|
||||
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
|
||||
{
|
||||
return nullptr; // TODO: cf bug 872568
|
||||
}
|
||||
|
||||
protected:
|
||||
nsRefPtr<gfxWindowsSurface> mSurface;
|
||||
RefPtr<DataTextureSource> mTextureSource;
|
||||
RefPtr<Compositor> mCompositor;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
gfx::IntSize mSize;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MOZILLA_GFX_TEXTUREDIB_H */
|
@ -1950,9 +1950,9 @@ void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics)
|
||||
SendAsyncScrollEvent();
|
||||
mPaintThrottler.PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this,
|
||||
UniquePtr<CancelableTask>(NewRunnableMethod(this,
|
||||
&AsyncPanZoomController::DispatchRepaintRequest,
|
||||
aFrameMetrics),
|
||||
aFrameMetrics)),
|
||||
GetFrameTime());
|
||||
|
||||
aFrameMetrics.SetPresShellId(mLastContentPaintMetrics.GetPresShellId());
|
||||
|
@ -18,7 +18,7 @@ TaskThrottler::TaskThrottler(const TimeStamp& aTimeStamp)
|
||||
|
||||
void
|
||||
TaskThrottler::PostTask(const tracked_objects::Location& aLocation,
|
||||
CancelableTask* aTask, const TimeStamp& aTimeStamp)
|
||||
UniquePtr<CancelableTask> aTask, const TimeStamp& aTimeStamp)
|
||||
{
|
||||
aTask->SetBirthPlace(aLocation);
|
||||
|
||||
@ -26,11 +26,10 @@ TaskThrottler::PostTask(const tracked_objects::Location& aLocation,
|
||||
if (mQueuedTask) {
|
||||
mQueuedTask->Cancel();
|
||||
}
|
||||
mQueuedTask = aTask;
|
||||
mQueuedTask = Move(aTask);
|
||||
} else {
|
||||
mStartTime = aTimeStamp;
|
||||
aTask->Run();
|
||||
delete aTask;
|
||||
mOutstanding = true;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "mozilla/TimeStamp.h" // for TimeDuration, TimeStamp
|
||||
#include "mozilla/RollingMean.h" // for RollingMean
|
||||
#include "mozilla/mozalloc.h" // for operator delete
|
||||
#include "nsAutoPtr.h" // for nsAutoPtr
|
||||
#include "mozilla/UniquePtr.h" // for UniquePtr
|
||||
#include "nsTArray.h" // for nsTArray
|
||||
|
||||
namespace tracked_objects {
|
||||
@ -47,7 +47,7 @@ public:
|
||||
* obsolete or the TaskThrottler is destructed.
|
||||
*/
|
||||
void PostTask(const tracked_objects::Location& aLocation,
|
||||
CancelableTask* aTask, const TimeStamp& aTimeStamp);
|
||||
UniquePtr<CancelableTask> aTask, const TimeStamp& aTimeStamp);
|
||||
/**
|
||||
* Mark the task as complete and process the next queued task.
|
||||
*/
|
||||
@ -90,7 +90,7 @@ public:
|
||||
|
||||
private:
|
||||
bool mOutstanding;
|
||||
nsAutoPtr<CancelableTask> mQueuedTask;
|
||||
UniquePtr<CancelableTask> mQueuedTask;
|
||||
TimeStamp mStartTime;
|
||||
RollingMean<TimeDuration, TimeDuration> mMean;
|
||||
};
|
||||
|
@ -32,11 +32,14 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicColorLayer);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~BasicColorLayer()
|
||||
{
|
||||
MOZ_COUNT_DTOR(BasicColorLayer);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
NS_ASSERTION(BasicManager()->InConstruction(),
|
||||
|
@ -42,9 +42,10 @@ class BasicCompositor : public Compositor
|
||||
public:
|
||||
BasicCompositor(nsIWidget *aWidget);
|
||||
|
||||
protected:
|
||||
virtual ~BasicCompositor();
|
||||
|
||||
|
||||
public:
|
||||
virtual bool Initialize() MOZ_OVERRIDE { return true; };
|
||||
|
||||
virtual void Destroy() MOZ_OVERRIDE;
|
||||
|
@ -26,8 +26,10 @@ public:
|
||||
MOZ_COUNT_CTOR(BasicContainerLayer);
|
||||
mSupportsComponentAlphaChildren = true;
|
||||
}
|
||||
protected:
|
||||
virtual ~BasicContainerLayer();
|
||||
|
||||
public:
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
NS_ASSERTION(BasicManager()->InConstruction(),
|
||||
|
@ -32,11 +32,13 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicImageLayer);
|
||||
}
|
||||
protected:
|
||||
virtual ~BasicImageLayer()
|
||||
{
|
||||
MOZ_COUNT_DTOR(BasicImageLayer);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
NS_ASSERTION(BasicManager()->InConstruction(),
|
||||
|
@ -73,8 +73,11 @@ public:
|
||||
* ClearWidget before the widget dies.
|
||||
*/
|
||||
BasicLayerManager(nsIWidget* aWidget);
|
||||
|
||||
protected:
|
||||
virtual ~BasicLayerManager();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Set the default target context that will be used when BeginTransaction
|
||||
* is called. This can only be called outside a transaction.
|
||||
|
@ -55,11 +55,14 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicReadbackLayer);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~BasicReadbackLayer()
|
||||
{
|
||||
MOZ_COUNT_DTOR(BasicReadbackLayer);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
NS_ASSERTION(BasicManager()->InConstruction(),
|
||||
|
@ -37,11 +37,14 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicThebesLayer);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~BasicThebesLayer()
|
||||
{
|
||||
MOZ_COUNT_DTOR(BasicThebesLayer);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
NS_ASSERTION(BasicManager()->InConstruction(),
|
||||
|
@ -44,8 +44,11 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientCanvasLayer);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~ClientCanvasLayer();
|
||||
|
||||
public:
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
NS_ASSERTION(ClientManager()->InConstruction(),
|
||||
|
@ -27,11 +27,14 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientColorLayer);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~ClientColorLayer()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ClientColorLayer);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
NS_ASSERTION(ClientManager()->InConstruction(),
|
||||
|
@ -32,6 +32,8 @@ public:
|
||||
MOZ_COUNT_CTOR(ClientContainerLayer);
|
||||
mSupportsComponentAlphaChildren = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~ClientContainerLayer()
|
||||
{
|
||||
while (mFirstChild) {
|
||||
@ -41,6 +43,7 @@ public:
|
||||
MOZ_COUNT_DTOR(ClientContainerLayer);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void RenderLayer()
|
||||
{
|
||||
if (GetMaskLayer()) {
|
||||
@ -148,11 +151,14 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientRefLayer);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~ClientRefLayer()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ClientRefLayer);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual Layer* AsLayer() { return this; }
|
||||
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
||||
|
||||
|
@ -33,6 +33,8 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientImageLayer);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~ClientImageLayer()
|
||||
{
|
||||
DestroyBackBuffer();
|
||||
|
@ -44,8 +44,11 @@ class ClientLayerManager : public LayerManager
|
||||
|
||||
public:
|
||||
ClientLayerManager(nsIWidget* aWidget);
|
||||
|
||||
protected:
|
||||
virtual ~ClientLayerManager();
|
||||
|
||||
public:
|
||||
virtual ShadowLayerForwarder* AsShadowForwarder()
|
||||
{
|
||||
return mForwarder;
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientThebesLayer);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~ClientThebesLayer()
|
||||
{
|
||||
if (mContentClient) {
|
||||
@ -51,6 +53,7 @@ public:
|
||||
MOZ_COUNT_DTOR(ClientThebesLayer);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
NS_ASSERTION(ClientManager()->InConstruction(),
|
||||
|
@ -43,8 +43,11 @@ class ClientTiledThebesLayer : public ThebesLayer,
|
||||
public:
|
||||
ClientTiledThebesLayer(ClientLayerManager* const aManager,
|
||||
ClientLayerManager::ThebesLayerCreationHint aCreationHint = LayerManager::NONE);
|
||||
|
||||
protected:
|
||||
~ClientTiledThebesLayer();
|
||||
|
||||
public:
|
||||
// Override name to distinguish it from ClientThebesLayer in layer dumps
|
||||
virtual const char* Name() const { return "TiledThebesLayer"; }
|
||||
|
||||
|
@ -39,12 +39,14 @@ public:
|
||||
MOZ_COUNT_CTOR(RemoveTextureFromCompositableTracker);
|
||||
}
|
||||
|
||||
protected:
|
||||
~RemoveTextureFromCompositableTracker()
|
||||
{
|
||||
MOZ_COUNT_DTOR(RemoveTextureFromCompositableTracker);
|
||||
ReleaseTextureClient();
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void Complete() MOZ_OVERRIDE
|
||||
{
|
||||
ReleaseTextureClient();
|
||||
|
@ -140,6 +140,7 @@ public:
|
||||
SimpleTiledContentClient(SimpleClientTiledThebesLayer* aThebesLayer,
|
||||
ClientLayerManager* aManager);
|
||||
|
||||
private:
|
||||
~SimpleTiledContentClient();
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
@ -161,8 +162,10 @@ class SimpleClientTiledThebesLayer : public ThebesLayer,
|
||||
public:
|
||||
SimpleClientTiledThebesLayer(ClientLayerManager* const aManager,
|
||||
ClientLayerManager::ThebesLayerCreationHint aCreationHint = LayerManager::NONE);
|
||||
protected:
|
||||
~SimpleClientTiledThebesLayer();
|
||||
|
||||
public:
|
||||
// Thebes Layer
|
||||
virtual Layer* AsLayer() { return this; }
|
||||
virtual void InvalidateRegion(const nsIntRegion& aRegion) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
#ifdef XP_WIN
|
||||
#include "mozilla/layers/TextureD3D9.h"
|
||||
#include "mozilla/layers/TextureD3D11.h"
|
||||
#include "mozilla/layers/TextureDIB.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#endif
|
||||
@ -263,12 +264,16 @@ CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
|
||||
aSizeHint.width <= maxTextureSize &&
|
||||
aSizeHint.height <= maxTextureSize &&
|
||||
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
|
||||
if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
|
||||
result = new DIBTextureClientD3D9(aFormat, aTextureFlags);
|
||||
} else {
|
||||
if (gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
|
||||
result = new CairoTextureClientD3D9(aFormat, aTextureFlags);
|
||||
}
|
||||
}
|
||||
|
||||
if (!result && aFormat == SurfaceFormat::B8G8R8X8 &&
|
||||
aAllocator->IsSameProcess()) {
|
||||
result = new DIBTextureClient(aFormat, aTextureFlags);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
|
@ -500,8 +500,10 @@ public:
|
||||
ShmemTextureClient(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat aFormat,
|
||||
gfx::BackendType aBackend, TextureFlags aFlags);
|
||||
|
||||
protected:
|
||||
~ShmemTextureClient();
|
||||
|
||||
public:
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool Allocate(uint32_t aSize) MOZ_OVERRIDE;
|
||||
@ -532,8 +534,10 @@ public:
|
||||
MemoryTextureClient(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat aFormat,
|
||||
gfx::BackendType aBackend, TextureFlags aFlags);
|
||||
|
||||
protected:
|
||||
~MemoryTextureClient();
|
||||
|
||||
public:
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool Allocate(uint32_t aSize) MOZ_OVERRIDE;
|
||||
@ -559,8 +563,10 @@ class StreamTextureClient : public TextureClient
|
||||
public:
|
||||
StreamTextureClient(TextureFlags aFlags);
|
||||
|
||||
protected:
|
||||
~StreamTextureClient();
|
||||
|
||||
public:
|
||||
virtual bool IsAllocated() const MOZ_OVERRIDE;
|
||||
|
||||
virtual bool Lock(OpenMode mode) MOZ_OVERRIDE;
|
||||
|
@ -72,8 +72,10 @@ class gfxMemorySharedReadLock : public gfxSharedReadLock {
|
||||
public:
|
||||
gfxMemorySharedReadLock();
|
||||
|
||||
protected:
|
||||
~gfxMemorySharedReadLock();
|
||||
|
||||
public:
|
||||
virtual int32_t ReadLock() MOZ_OVERRIDE;
|
||||
|
||||
virtual int32_t ReadUnlock() MOZ_OVERRIDE;
|
||||
@ -97,8 +99,10 @@ private:
|
||||
public:
|
||||
gfxShmSharedReadLock(ISurfaceAllocator* aAllocator);
|
||||
|
||||
protected:
|
||||
~gfxShmSharedReadLock();
|
||||
|
||||
public:
|
||||
virtual int32_t ReadLock() MOZ_OVERRIDE;
|
||||
|
||||
virtual int32_t ReadUnlock() MOZ_OVERRIDE;
|
||||
@ -465,6 +469,7 @@ public:
|
||||
TiledContentClient(ClientTiledThebesLayer* aThebesLayer,
|
||||
ClientLayerManager* aManager);
|
||||
|
||||
protected:
|
||||
~TiledContentClient()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TiledContentClient);
|
||||
@ -473,6 +478,7 @@ public:
|
||||
mLowPrecisionTiledBuffer.Release();
|
||||
}
|
||||
|
||||
public:
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return TextureInfo(CompositableType::BUFFER_TILED);
|
||||
|
@ -448,7 +448,8 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
|
||||
timing.mFillMode = NS_STYLE_ANIMATION_FILL_MODE_BOTH;
|
||||
|
||||
ComputedTiming computedTiming =
|
||||
ElementAnimation::GetComputedTimingAt(elapsedDuration, timing);
|
||||
ElementAnimation::GetComputedTimingAt(
|
||||
Nullable<TimeDuration>(elapsedDuration), timing);
|
||||
|
||||
NS_ABORT_IF_FALSE(0.0 <= computedTiming.mTimeFraction &&
|
||||
computedTiming.mTimeFraction <= 1.0,
|
||||
|
@ -30,8 +30,10 @@ class CanvasLayerComposite : public CanvasLayer,
|
||||
public:
|
||||
CanvasLayerComposite(LayerManagerComposite* aManager);
|
||||
|
||||
protected:
|
||||
virtual ~CanvasLayerComposite();
|
||||
|
||||
public:
|
||||
// CanvasLayer impl
|
||||
virtual void Initialize(const Data& aData) MOZ_OVERRIDE
|
||||
{
|
||||
|
@ -30,12 +30,15 @@ public:
|
||||
MOZ_COUNT_CTOR(ColorLayerComposite);
|
||||
mImplData = static_cast<LayerComposite*>(this);
|
||||
}
|
||||
|
||||
protected:
|
||||
~ColorLayerComposite()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ColorLayerComposite);
|
||||
Destroy();
|
||||
}
|
||||
|
||||
public:
|
||||
// LayerComposite Implementation
|
||||
virtual Layer* GetLayer() MOZ_OVERRIDE { return this; }
|
||||
|
||||
|
@ -299,6 +299,7 @@ ContainerRender(ContainerT* aContainer,
|
||||
bool surfaceCopyNeeded;
|
||||
aContainer->DefaultComputeSupportsComponentAlphaChildren(&surfaceCopyNeeded);
|
||||
if (needsSurface) {
|
||||
MOZ_PERFORMANCE_WARNING("gfx", "[%p] Container layer requires intermediate surface\n", aContainer);
|
||||
SurfaceInitMode mode = INIT_MODE_CLEAR;
|
||||
gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y,
|
||||
visibleRect.width, visibleRect.height);
|
||||
|
@ -28,8 +28,10 @@ class ContainerLayerComposite : public ContainerLayer,
|
||||
public:
|
||||
ContainerLayerComposite(LayerManagerComposite *aManager);
|
||||
|
||||
protected:
|
||||
~ContainerLayerComposite();
|
||||
|
||||
public:
|
||||
// LayerComposite Implementation
|
||||
virtual Layer* GetLayer() MOZ_OVERRIDE { return this; }
|
||||
|
||||
@ -63,8 +65,11 @@ class RefLayerComposite : public RefLayer,
|
||||
const nsIntRect& aClipRect);
|
||||
public:
|
||||
RefLayerComposite(LayerManagerComposite *aManager);
|
||||
|
||||
protected:
|
||||
~RefLayerComposite();
|
||||
|
||||
public:
|
||||
/** LayerOGL implementation */
|
||||
Layer* GetLayer() MOZ_OVERRIDE { return this; }
|
||||
|
||||
|
@ -33,8 +33,10 @@ class ImageLayerComposite : public ImageLayer,
|
||||
public:
|
||||
ImageLayerComposite(LayerManagerComposite* aManager);
|
||||
|
||||
protected:
|
||||
virtual ~ImageLayerComposite();
|
||||
|
||||
public:
|
||||
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Disconnect() MOZ_OVERRIDE;
|
||||
|
@ -50,6 +50,7 @@
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "SharedSurfaceANGLE.h"
|
||||
#include "mozilla/layers/TextureDIB.h"
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
@ -201,6 +202,7 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
|
||||
switch (aDesc.type()) {
|
||||
case SurfaceDescriptor::TSurfaceDescriptorShmem:
|
||||
case SurfaceDescriptor::TSurfaceDescriptorMemory:
|
||||
case SurfaceDescriptor::TSurfaceDescriptorDIB:
|
||||
return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);
|
||||
|
||||
case SurfaceDescriptor::TSharedTextureDescriptor:
|
||||
@ -227,7 +229,6 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
|
||||
|
||||
#ifdef XP_WIN
|
||||
case SurfaceDescriptor::TSurfaceDescriptorD3D9:
|
||||
case SurfaceDescriptor::TSurfaceDescriptorDIB:
|
||||
return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);
|
||||
|
||||
case SurfaceDescriptor::TSurfaceDescriptorD3D10:
|
||||
@ -264,6 +265,12 @@ CreateBackendIndependentTextureHost(const SurfaceDescriptor& aDesc,
|
||||
aFlags);
|
||||
break;
|
||||
}
|
||||
#ifdef XP_WIN
|
||||
case SurfaceDescriptor::TSurfaceDescriptorDIB: {
|
||||
result = new DIBTextureHost(aFlags, aDesc);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default: {
|
||||
NS_WARNING("No backend independent TextureHost for this descriptor type");
|
||||
}
|
||||
|
@ -148,11 +148,13 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(NewTextureSource);
|
||||
}
|
||||
protected:
|
||||
virtual ~NewTextureSource()
|
||||
{
|
||||
MOZ_COUNT_DTOR(NewTextureSource);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Should be overridden in order to deallocate the data that is associated
|
||||
* with the rendering backend, such as GL textures.
|
||||
@ -285,8 +287,10 @@ class TextureHost
|
||||
public:
|
||||
TextureHost(TextureFlags aFlags);
|
||||
|
||||
protected:
|
||||
virtual ~TextureHost();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Factory method.
|
||||
*/
|
||||
@ -548,8 +552,10 @@ public:
|
||||
ISurfaceAllocator* aDeallocator,
|
||||
TextureFlags aFlags);
|
||||
|
||||
protected:
|
||||
~ShmemTextureHost();
|
||||
|
||||
public:
|
||||
virtual void DeallocateSharedData() MOZ_OVERRIDE;
|
||||
|
||||
virtual void ForgetSharedData() MOZ_OVERRIDE;
|
||||
@ -580,8 +586,10 @@ public:
|
||||
gfx::SurfaceFormat aFormat,
|
||||
TextureFlags aFlags);
|
||||
|
||||
protected:
|
||||
~MemoryTextureHost();
|
||||
|
||||
public:
|
||||
virtual void DeallocateSharedData() MOZ_OVERRIDE;
|
||||
|
||||
virtual void ForgetSharedData() MOZ_OVERRIDE;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user