Merge m-i to m-c, a=merge

This commit is contained in:
Phil Ringnalda 2014-10-05 09:34:55 -07:00
commit 8c2c4a4fac
299 changed files with 15722 additions and 1486 deletions

View File

@ -60,7 +60,6 @@ if test "$OS_TARGET" = "Android"; then
MOZ_NUWA_PROCESS=1
MOZ_B2G_LOADER=1
fi
MOZ_FOLD_LIBS=1
MOZ_JSDOWNLOADS=1

View File

@ -33,6 +33,7 @@
</ms_asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>

View File

@ -55,9 +55,6 @@ MOZ_PROFILE_MIGRATOR=1
MOZ_APP_STATIC_INI=1
MOZ_WEBAPP_RUNTIME=1
MOZ_MEDIA_NAVIGATOR=1
if test "$OS_TARGET" = "WINNT" -o "$OS_TARGET" = "Darwin"; then
MOZ_FOLD_LIBS=1
fi
MOZ_WEBGL_CONFORMANT=1
# Enable navigator.mozPay
MOZ_PAY=1

View File

@ -21,6 +21,7 @@
</ms_asmv3:trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>

View File

@ -1,5 +1,5 @@
ifndef INCLUDED_AUTOCONF_MK
INCLUDED_AUTOCONF_MK = 1
INCLUDED_AUTOCONF_MK = autoconf-js.mk
include $(DEPTH)/config/emptyvars-js.mk
@ALLSUBSTS@
include $(topsrcdir)/config/baseconfig.mk

View File

@ -1,5 +1,5 @@
ifndef INCLUDED_AUTOCONF_MK
INCLUDED_AUTOCONF_MK = 1
INCLUDED_AUTOCONF_MK = autoconf.mk
include $(DEPTH)/config/emptyvars.mk
@ALLSUBSTS@
include $(topsrcdir)/config/baseconfig.mk

View File

@ -113,14 +113,15 @@ class ExpandArgs(list):
(root, ext) = os.path.splitext(arg)
if ext != conf.LIB_SUFFIX or not os.path.basename(root).startswith(conf.LIB_PREFIX):
return [relativize(arg)]
if len(conf.IMPORT_LIB_SUFFIX):
dll = root + conf.IMPORT_LIB_SUFFIX
else:
if conf.LIB_PREFIX:
dll = root.replace(conf.LIB_PREFIX, conf.DLL_PREFIX, 1) + conf.DLL_SUFFIX
else:
dll = root + conf.DLL_SUFFIX
if os.path.exists(dll):
return [relativize(dll)]
if os.path.exists(arg):
return [relativize(arg)]
if conf.IMPORT_LIB_SUFFIX:
return [relativize(root + conf.IMPORT_LIB_SUFFIX)]
else:
return [relativize(dll)]
return self._expand_desc(arg)
def _expand_desc(self, arg):
@ -136,7 +137,7 @@ class ExpandArgs(list):
for lib in desc['LIBS']:
objs += self._expand(lib)
return objs
return [arg]
return [relativize(arg)]
if __name__ == '__main__':
print " ".join(ExpandArgs(sys.argv[1:]))

View File

@ -16,6 +16,9 @@ if CONFIG['MOZ_UPDATER']:
if not CONFIG['MOZ_NATIVE_BZ2']:
external_dirs += ['modules/libbz2']
# There's no "native brotli" yet, but probably in the future...
external_dirs += ['modules/brotli']
if CONFIG['MOZ_VORBIS']:
external_dirs += ['media/libvorbis']

View File

@ -140,7 +140,7 @@ ifdef REAL_LIBRARY
ifdef FORCE_SHARED_LIB
# ... except when we really want one
ifdef NO_EXPAND_LIBS
LIBRARY := $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
LIBRARY := $(REAL_LIBRARY)
else
LIBRARY := $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
endif
@ -149,9 +149,13 @@ else
ifeq (,$(SDK_LIBRARY)$(DIST_INSTALL)$(NO_EXPAND_LIBS))
LIBRARY := $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
else
ifdef NO_EXPAND_LIBS
LIBRARY := $(REAL_LIBRARY)
else
LIBRARY := $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
endif
endif
endif
endif # REAL_LIBRARY
endif # LIBRARY
@ -568,7 +572,7 @@ STATIC_LIB_DEP = $(if $(wildcard $(1).$(LIBS_DESC_SUFFIX)),$(1).$(LIBS_DESC_SUFF
STATIC_LIBS_DEPS := $(foreach l,$(STATIC_LIBS),$(call STATIC_LIB_DEP,$(l)))
# Dependencies which, if modified, should cause everything to rebuild
GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
GLOBAL_DEPS += Makefile $(addprefix $(DEPTH)/config/,$(INCLUDED_AUTOCONF_MK)) $(topsrcdir)/config/config.mk
##############################################
ifdef COMPILE_ENVIRONMENT
@ -776,7 +780,8 @@ endif
$(filter %.$(LIB_SUFFIX),$(LIBRARY)): $(OBJS) $(STATIC_LIBS_DEPS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS)) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD)
$(RM) $(LIBRARY)
# Always remove both library and library descriptor
$(RM) $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
$(EXPAND_AR) $(AR_FLAGS) $(OBJS) $(STATIC_LIBS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS))
$(filter-out %.$(LIB_SUFFIX),$(LIBRARY)): $(filter %.$(LIB_SUFFIX),$(LIBRARY)) $(OBJS) $(STATIC_LIBS_DEPS) $(filter %.$(LIB_SUFFIX),$(EXTRA_LIBS)) $(EXTRA_DEPS) $(GLOBAL_DEPS)

View File

@ -186,15 +186,15 @@ class TestExpandArgs(TestExpandInit):
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
# When a library exists at the same time as a descriptor, we just use
# the library
# When a library exists at the same time as a descriptor, we still use
# the descriptor.
self.touch([self.tmpfile('libx', Lib('x'))])
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + [self.tmpfile('libx', Lib('x'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
self.touch([self.tmpfile('liby', Lib('y'))])
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
class TestExpandArgsMore(TestExpandInit):
def test_makelist(self):
@ -278,14 +278,15 @@ class TestExpandArgsMore(TestExpandInit):
self.touch([self.tmpfile('liby', Lib('y'))])
for iteration in (1, 2):
with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
files = self.files + self.liby_files + self.libx_files
self.assertRelEqual(args, ['foo', '-bar'] + files)
extracted = {}
# ExpandArgsMore also has an extra method extracting static libraries
# when possible
args.extract()
files = self.files + self.liby_files + self.libx_files
# With AR_EXTRACT, it uses the descriptors when there are, and
# actually
# extracts the remaining libraries

View File

@ -3265,6 +3265,12 @@ if test -n "$MOZ_LINKER"; then
_SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
fi
fi
dnl gold emits wrong sysv-style elf hash tables when building both sysv and
dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
dnl Since the linker only understands the sysv ones, no need to build the
dnl gnu style tables anyways.
LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
fi
dnl The custom linker doesn't support text relocations, but NDK >= r6b
@ -4094,6 +4100,15 @@ AC_SUBST(MOZ_B2G_VERSION)
AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
case "$OS_TARGET" in
WINNT|Darwin|Android)
MOZ_FOLD_LIBS=1
;;
*)
MOZ_FOLD_LIBS=
;;
esac
dnl ========================================================
dnl Check Android SDK version depending on mobile target.
dnl ========================================================
@ -6989,13 +7004,12 @@ elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
else
dnl On other Unix systems, we only want to link executables against mozglue
MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
MOZ_GLUE_PROGRAM_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
dnl On other Unix systems, where mozglue is a static library, jemalloc is
dnl separated for the SDK, so we need to add it here.
if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
fi
MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
if test -n "$GNU_CC"; then
dnl And we need mozglue symbols to be exported.
MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
@ -7159,8 +7173,6 @@ else
DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
fi
rm crtdll.obj
export DLLFLAGS
;;
*)
AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])

View File

@ -1275,6 +1275,21 @@ private:
EventStates mState;
};
class RemoveFromBindingManagerRunnable : public nsRunnable
{
public:
RemoveFromBindingManagerRunnable(nsBindingManager* aManager,
nsIContent* aContent,
nsIDocument* aDoc);
NS_IMETHOD Run();
private:
virtual ~RemoveFromBindingManagerRunnable();
nsRefPtr<nsBindingManager> mManager;
nsRefPtr<nsIContent> mContent;
nsCOMPtr<nsIDocument> mDoc;
};
class DestinationInsertionPointList : public nsINodeList
{
public:

View File

@ -430,7 +430,7 @@ Element::WrapObject(JSContext *aCx)
doc = OwnerDoc();
}
else {
doc = GetCurrentDoc();
doc = GetComposedDoc();
}
if (!doc) {
@ -593,7 +593,7 @@ Element::ScrollIntoView()
void
Element::ScrollIntoView(bool aTop, const ScrollOptions &aOptions)
{
nsIDocument *document = GetCurrentDoc();
nsIDocument *document = GetComposedDoc();
if (!document) {
return;
}
@ -767,7 +767,7 @@ Element::AddToIdTable(nsIAtom* aId)
ShadowRoot* containingShadow = GetContainingShadow();
containingShadow->AddToIdTable(this, aId);
} else {
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
doc->AddToIdTable(this, aId);
}
@ -790,7 +790,7 @@ Element::RemoveFromIdTable()
containingShadow->RemoveFromIdTable(this, id);
}
} else {
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
doc->RemoveFromIdTable(this, id);
}
@ -1197,9 +1197,9 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION((NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc()),
"Must have the same owner document");
NS_PRECONDITION(!aParent || aDocument == aParent->GetCurrentDoc(),
NS_PRECONDITION(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
NS_PRECONDITION(!GetCurrentDoc(), "Already have a document. Unbind first!");
NS_PRECONDITION(!GetUncomposedDoc(), "Already have a document. Unbind first!");
// Note that as we recurse into the kids, they'll have a non-null parent. So
// only assert if our parent is _changing_ while we have a parent.
NS_PRECONDITION(!GetParent() || aParent == GetParent(),
@ -1406,7 +1406,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// XXXbz script execution during binding can trigger some of these
// postcondition asserts.... But we do want that, since things will
// generally be quite broken when that happens.
NS_POSTCONDITION(aDocument == GetCurrentDoc(), "Bound to wrong document");
NS_POSTCONDITION(aDocument == GetUncomposedDoc(), "Bound to wrong document");
NS_POSTCONDITION(aParent == GetParent(), "Bound to wrong parent");
NS_POSTCONDITION(aBindingParent == GetBindingParent(),
"Bound to wrong binding parent");
@ -1414,48 +1414,45 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
return NS_OK;
}
class RemoveFromBindingManagerRunnable : public nsRunnable {
public:
RemoveFromBindingManagerRunnable(nsBindingManager* aManager,
Element* aElement,
nsIDocument* aDoc):
mManager(aManager), mElement(aElement), mDoc(aDoc)
{}
RemoveFromBindingManagerRunnable::RemoveFromBindingManagerRunnable(nsBindingManager* aManager,
nsIContent* aContent,
nsIDocument* aDoc):
mManager(aManager), mContent(aContent), mDoc(aDoc)
{}
NS_IMETHOD Run()
{
// It may be the case that the element was removed from the
// DOM, causing this runnable to be created, then inserted back
// into the document before the this runnable had a chance to
// tear down the binding. Only tear down the binding if the element
// is still no longer in the DOM. nsXBLService::LoadBinding tears
// down the old binding if the element is inserted back into the
// DOM and loads a different binding.
if (!mElement->IsInDoc()) {
mManager->RemovedFromDocumentInternal(mElement, mDoc);
}
RemoveFromBindingManagerRunnable::~RemoveFromBindingManagerRunnable() {}
return NS_OK;
NS_IMETHODIMP
RemoveFromBindingManagerRunnable::Run()
{
// It may be the case that the element was removed from the
// DOM, causing this runnable to be created, then inserted back
// into the document before the this runnable had a chance to
// tear down the binding. Only tear down the binding if the element
// is still no longer in the DOM. nsXBLService::LoadBinding tears
// down the old binding if the element is inserted back into the
// DOM and loads a different binding.
if (!mContent->IsInComposedDoc()) {
mManager->RemovedFromDocumentInternal(mContent, mDoc);
}
private:
nsRefPtr<nsBindingManager> mManager;
nsRefPtr<Element> mElement;
nsCOMPtr<nsIDocument> mDoc;
};
return NS_OK;
}
void
Element::UnbindFromTree(bool aDeep, bool aNullParent)
{
NS_PRECONDITION(aDeep || (!GetCurrentDoc() && !GetBindingParent()),
NS_PRECONDITION(aDeep || (!GetUncomposedDoc() && !GetBindingParent()),
"Shallow unbind won't clear document and binding parent on "
"kids!");
RemoveFromIdTable();
// Make sure to unbind this node before doing the kids
nsIDocument *document =
HasFlag(NODE_FORCE_XBL_BINDINGS) ? OwnerDoc() : GetCurrentDoc();
nsIDocument* document =
HasFlag(NODE_FORCE_XBL_BINDINGS) || IsInShadowTree() ?
OwnerDoc() : GetUncomposedDoc();
if (aNullParent) {
if (IsFullScreenAncestor()) {
@ -1492,7 +1489,9 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
if (document) {
// Notify XBL- & nsIAnonymousContentCreator-generated
// anonymous content that the document is changing.
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
// Unlike XBL, bindings for web components shadow DOM
// do not get uninstalled.
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR) && !GetShadowRoot()) {
nsContentUtils::AddScriptRunner(
new RemoveFromBindingManagerRunnable(document->BindingManager(), this,
document));
@ -1602,7 +1601,7 @@ Element::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
slots->mSMILOverrideStyleRule = aStyleRule;
if (aNotify) {
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
// Only need to request a restyle if we're in a document. (We might not
// be in a document, if we're clearing animation effects on a target node
// that's been detached since the previous animation sample.)
@ -2020,7 +2019,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
{
nsresult rv;
nsIDocument* document = GetCurrentDoc();
nsIDocument* document = GetComposedDoc();
mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
nsMutationGuard::DidMutate();
@ -2233,7 +2232,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsresult rv = BeforeSetAttr(aNameSpaceID, aName, nullptr, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument *document = GetCurrentDoc();
nsIDocument *document = GetComposedDoc();
mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
if (aNotify) {
@ -2622,7 +2621,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
WidgetMouseEvent::eLeftButton) {
// don't make the link grab the focus if there is no link handler
nsILinkHandler *handler = aVisitor.mPresContext->GetLinkHandler();
nsIDocument *document = GetCurrentDoc();
nsIDocument *document = GetComposedDoc();
if (handler && document) {
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {

View File

@ -203,7 +203,7 @@ nsIContent::GetDesiredIMEState()
if (editableAncestor && editableAncestor != this) {
return editableAncestor->GetDesiredIMEState();
}
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (!doc) {
return IMEState(IMEState::DISABLED);
}
@ -238,10 +238,10 @@ nsIContent::GetEditingHost()
// If this isn't editable, return nullptr.
NS_ENSURE_TRUE(IsEditableInternal(), nullptr);
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
NS_ENSURE_TRUE(doc, nullptr);
// If this is in designMode, we should return <body>
if (doc->HasFlag(NODE_IS_EDITABLE)) {
if (doc->HasFlag(NODE_IS_EDITABLE) && !IsInShadowTree()) {
return doc->GetBodyElement();
}
@ -1501,7 +1501,9 @@ FragmentOrElement::CanSkipInCC(nsINode* aNode)
return false;
}
nsIDocument* currentDoc = aNode->GetCurrentDoc();
//XXXsmaug Need to figure out in which cases Shadow DOM can be optimized out
// from the CC graph.
nsIDocument* currentDoc = aNode->GetUncomposedDoc();
if (currentDoc &&
nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration())) {
return !NeedsScriptTraverse(aNode);
@ -1678,7 +1680,7 @@ FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed)
}
bool unoptimizable = aNode->UnoptimizableCCNode();
nsIDocument* currentDoc = aNode->GetCurrentDoc();
nsIDocument* currentDoc = aNode->GetUncomposedDoc();
if (currentDoc &&
nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration()) &&
(!unoptimizable || NodeHasActiveFrame(currentDoc, aNode) ||
@ -1807,7 +1809,7 @@ FragmentOrElement::CanSkipThis(nsINode* aNode)
if (aNode->IsBlack()) {
return true;
}
nsIDocument* c = aNode->GetCurrentDoc();
nsIDocument* c = aNode->GetUncomposedDoc();
return
((c && nsCCUncollectableMarker::InGeneration(c->GetMarkedCCGeneration())) ||
aNode->InCCBlackTree()) && !NeedsScriptTraverse(aNode);

View File

@ -77,7 +77,7 @@ Link::LinkState() const
// If we have not yet registered for notifications and need to,
// due to our href changing, register now!
if (!mRegistered && mNeedsRegistration && element->IsInDoc()) {
if (!mRegistered && mNeedsRegistration && element->IsInComposedDoc()) {
// Only try and register once.
self->mNeedsRegistration = false;
@ -94,7 +94,7 @@ Link::LinkState() const
self->mRegistered = true;
// And make sure we are in the document's link map.
element->GetCurrentDoc()->AddStyleRelevantLink(self);
element->GetComposedDoc()->AddStyleRelevantLink(self);
}
}
}
@ -469,7 +469,7 @@ Link::ResetLinkState(bool aNotify, bool aHasHref)
// currently registered; in either case, we should remove ourself
// from the doc and the history.
if (!mNeedsRegistration && mLinkState != eLinkState_NotLink) {
nsIDocument *doc = mElement->GetCurrentDoc();
nsIDocument *doc = mElement->GetComposedDoc();
if (doc && (mRegistered || mLinkState == eLinkState_Visited)) {
// Tell the document to forget about this link if we've registered
// with it before.

View File

@ -78,7 +78,7 @@ nsCCUncollectableMarker::Init()
static void
MarkUserData(void* aNode, nsIAtom* aKey, void* aValue, void* aData)
{
nsIDocument* d = static_cast<nsINode*>(aNode)->GetCurrentDoc();
nsIDocument* d = static_cast<nsINode*>(aNode)->GetUncomposedDoc();
if (d && nsCCUncollectableMarker::InGeneration(d->GetMarkedCCGeneration())) {
Element::MarkUserData(aNode, aKey, aValue, aData);
}

View File

@ -431,10 +431,10 @@ nsContentList::nsContentList(nsINode* aRootNode,
// We only need to flush if we're in an non-HTML document, since the
// HTML5 parser doesn't need flushing. Further, if we're not in a
// document at all right now (in the GetCurrentDoc() sense), we're
// document at all right now (in the GetUncomposedDoc() sense), we're
// not parser-created and don't need to be flushing stuff under us
// to get our kids right.
nsIDocument* doc = mRootNode->GetCurrentDoc();
nsIDocument* doc = mRootNode->GetUncomposedDoc();
mFlushesNeeded = doc && !doc->IsHTML();
}
@ -464,10 +464,10 @@ nsContentList::nsContentList(nsINode* aRootNode,
// We only need to flush if we're in an non-HTML document, since the
// HTML5 parser doesn't need flushing. Further, if we're not in a
// document at all right now (in the GetCurrentDoc() sense), we're
// document at all right now (in the GetUncomposedDoc() sense), we're
// not parser-created and don't need to be flushing stuff under us
// to get our kids right.
nsIDocument* doc = mRootNode->GetCurrentDoc();
nsIDocument* doc = mRootNode->GetUncomposedDoc();
mFlushesNeeded = doc && !doc->IsHTML();
}
@ -507,7 +507,7 @@ nsContentList::Item(uint32_t aIndex, bool aDoFlush)
{
if (mRootNode && aDoFlush && mFlushesNeeded) {
// XXX sXBL/XBL2 issue
nsIDocument* doc = mRootNode->GetCurrentDoc();
nsIDocument* doc = mRootNode->GetUncomposedDoc();
if (doc) {
// Flush pending content changes Bug 4891.
doc->FlushPendingNotifications(Flush_ContentAndNotify);
@ -1004,7 +1004,7 @@ nsContentList::BringSelfUpToDate(bool aDoFlush)
{
if (mRootNode && aDoFlush && mFlushesNeeded) {
// XXX sXBL/XBL2 issue
nsIDocument* doc = mRootNode->GetCurrentDoc();
nsIDocument* doc = mRootNode->GetUncomposedDoc();
if (doc) {
// Flush pending content changes Bug 4891.
doc->FlushPendingNotifications(Flush_ContentAndNotify);

View File

@ -1183,7 +1183,7 @@ nsContentSink::StartLayout(bool aIgnorePendingSheets)
void
nsContentSink::NotifyAppend(nsIContent* aContainer, uint32_t aStartIndex)
{
if (aContainer->GetCurrentDoc() != mDocument) {
if (aContainer->GetUncomposedDoc() != mDocument) {
// aContainer is not actually in our document anymore.... Just bail out of
// here; notifying on our document for this append would be wrong.
return;

View File

@ -2453,7 +2453,8 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
return NS_OK;
}
nsCOMPtr<nsIHTMLDocument> htmlDocument(do_QueryInterface(aContent->GetCurrentDoc()));
nsCOMPtr<nsIHTMLDocument> htmlDocument =
do_QueryInterface(aContent->GetUncomposedDoc());
KeyAppendInt(partID, aKey); // first append a partID
bool generatedUniqueKey = false;
@ -2463,7 +2464,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
// If this becomes unnecessary and the following line is removed,
// please also remove the corresponding flush operation from
// nsHtml5TreeBuilderCppSupplement.h. (Look for "See bug 497861." there.)
aContent->GetCurrentDoc()->FlushPendingNotifications(Flush_Content);
aContent->GetUncomposedDoc()->FlushPendingNotifications(Flush_Content);
nsContentList *htmlForms = htmlDocument->GetForms();
nsContentList *htmlFormControls = htmlDocument->GetFormControls();
@ -2847,7 +2848,7 @@ nsContentUtils::SplitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix,
nsPresContext*
nsContentUtils::GetContextForContent(const nsIContent* aContent)
{
nsIDocument* doc = aContent->GetCurrentDoc();
nsIDocument* doc = aContent->GetComposedDoc();
if (doc) {
nsIPresShell *presShell = doc->GetShell();
if (presShell) {
@ -4404,7 +4405,7 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent,
// Might as well stick a batch around this since we're performing several
// mutations.
mozAutoDocUpdate updateBatch(aContent->GetCurrentDoc(),
mozAutoDocUpdate updateBatch(aContent->GetComposedDoc(),
UPDATE_CONTENT_MODEL, true);
nsAutoMutationBatch mb;
@ -6104,7 +6105,9 @@ nsContentUtils::IsFocusedContent(const nsIContent* aContent)
bool
nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent)
{
nsIDocument* doc = aContent->GetCurrentDoc();
//XXXsmaug Shadow DOM spec issue!
// We may need to change this to GetComposedDoc().
nsIDocument* doc = aContent->GetUncomposedDoc();
if (!doc) {
return false;
}

View File

@ -6056,7 +6056,8 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
}
EnqueueLifecycleCallback(nsIDocument::eCreated, elem, nullptr, definition);
if (elem->GetCurrentDoc()) {
//XXXsmaug It is unclear if we should use GetComposedDoc() here.
if (elem->GetUncomposedDoc()) {
// Normally callbacks can not be enqueued until the created
// callback has been invoked, however, the attached callback
// in element upgrade is an exception so pretend the created
@ -11527,7 +11528,7 @@ public:
nsCOMPtr<Element> e = do_QueryReferent(mElement);
nsCOMPtr<nsIDocument> d = do_QueryReferent(mDocument);
if (!e || !d || gPendingPointerLockRequest != this ||
e->GetCurrentDoc() != d) {
e->GetUncomposedDoc() != d) {
Handled();
DispatchPointerLockError(d);
return NS_OK;
@ -11642,7 +11643,7 @@ nsPointerLockPermissionRequest::Allow(JS::HandleValue aChoices)
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
nsDocument* d = static_cast<nsDocument*>(doc.get());
if (!e || !d || gPendingPointerLockRequest != this ||
e->GetCurrentDoc() != d ||
e->GetUncomposedDoc() != d ||
(!mUserInputOrChromeCaller && !d->mIsApprovedForFullscreen)) {
Handled();
DispatchPointerLockError(d);
@ -11709,7 +11710,7 @@ nsDocument::Observe(nsISupports *aSubject,
bool userInputOrChromeCaller =
gPendingPointerLockRequest->mUserInputOrChromeCaller;
gPendingPointerLockRequest->Handled();
if (doc == this && el && el->GetCurrentDoc() == doc) {
if (doc == this && el && el->GetUncomposedDoc() == doc) {
nsPointerLockPermissionRequest* clone =
new nsPointerLockPermissionRequest(el, userInputOrChromeCaller);
gPendingPointerLockRequest = clone;

View File

@ -332,7 +332,7 @@ IsInvisibleBreak(nsINode *aNode) {
}
// Grab the editor associated with the document
nsIDocument *doc = aNode->GetCurrentDoc();
nsIDocument *doc = aNode->GetComposedDoc();
if (doc) {
nsPIDOMWindow *window = doc->GetWindow();
if (window) {

View File

@ -192,7 +192,7 @@ nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
NS_ENSURE_TRUE(aOwner, nullptr);
nsIDocument* doc = aOwner->OwnerDoc();
NS_ENSURE_TRUE(!doc->IsResourceDoc() &&
((!doc->IsLoadedAsData() && aOwner->GetCurrentDoc()) ||
((!doc->IsLoadedAsData() && aOwner->GetUncomposedDoc()) ||
doc->IsStaticDocument()),
nullptr);
@ -873,12 +873,12 @@ nsFrameLoader::ShowRemoteFrame(const nsIntSize& size,
// want here. For now, hack.
if (!mRemoteBrowserShown) {
if (!mOwnerContent ||
!mOwnerContent->GetCurrentDoc()) {
!mOwnerContent->GetUncomposedDoc()) {
return false;
}
nsRefPtr<layers::LayerManager> layerManager =
nsContentUtils::LayerManagerForDocument(mOwnerContent->GetCurrentDoc());
nsContentUtils::LayerManagerForDocument(mOwnerContent->GetUncomposedDoc());
if (!layerManager) {
// This is just not going to work.
return false;
@ -1073,8 +1073,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
otherChildDocument->GetParentDocument();
// Make sure to swap docshells between the two frames.
nsIDocument* ourDoc = ourContent->GetCurrentDoc();
nsIDocument* otherDoc = otherContent->GetCurrentDoc();
nsIDocument* ourDoc = ourContent->GetUncomposedDoc();
nsIDocument* otherDoc = otherContent->GetUncomposedDoc();
if (!ourDoc || !otherDoc) {
// Again, how odd, given that we had docshells
return NS_ERROR_NOT_IMPLEMENTED;

View File

@ -297,7 +297,7 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
return NS_ERROR_OUT_OF_MEMORY;
}
nsIDocument *document = GetCurrentDoc();
nsIDocument *document = GetComposedDoc();
mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
bool haveMutationListeners = aNotify &&
@ -465,9 +465,9 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION(NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc(),
"Must have the same owner document");
NS_PRECONDITION(!aParent || aDocument == aParent->GetCurrentDoc(),
NS_PRECONDITION(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
NS_PRECONDITION(!GetCurrentDoc() && !IsInDoc(),
NS_PRECONDITION(!GetUncomposedDoc() && !IsInDoc(),
"Already have a document. Unbind first!");
// Note that as we recurse into the kids, they'll have a non-null parent. So
// only assert if our parent is _changing_ while we have a parent.
@ -550,7 +550,7 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
UpdateEditableState(false);
NS_POSTCONDITION(aDocument == GetCurrentDoc(), "Bound to wrong document");
NS_POSTCONDITION(aDocument == GetUncomposedDoc(), "Bound to wrong document");
NS_POSTCONDITION(aParent == GetParent(), "Bound to wrong parent");
NS_POSTCONDITION(aBindingParent == GetBindingParent(),
"Bound to wrong binding parent");
@ -564,14 +564,10 @@ nsGenericDOMDataNode::UnbindFromTree(bool aDeep, bool aNullParent)
// Unset frame flags; if we need them again later, they'll get set again.
UnsetFlags(NS_CREATE_FRAME_IF_NON_WHITESPACE |
NS_REFRAME_IF_WHITESPACE);
nsIDocument *document = GetCurrentDoc();
if (document) {
// Notify XBL- & nsIAnonymousContentCreator-generated
// anonymous content that the document is changing.
// This is needed to update the insertion point.
document->BindingManager()->RemovedFromDocument(this, document);
}
nsIDocument* document =
HasFlag(NODE_FORCE_XBL_BINDINGS) || IsInShadowTree() ?
OwnerDoc() : GetUncomposedDoc();
if (aNullParent) {
if (GetParent()) {
@ -590,6 +586,18 @@ nsGenericDOMDataNode::UnbindFromTree(bool aDeep, bool aNullParent)
SetSubtreeRootPointer(aNullParent ? this : mParent->SubtreeRoot());
}
if (document && !GetContainingShadow()) {
// Notify XBL- & nsIAnonymousContentCreator-generated
// anonymous content that the document is changing.
// Unlike XBL, bindings for web components shadow DOM
// do not get uninstalled.
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
nsContentUtils::AddScriptRunner(
new RemoveFromBindingManagerRunnable(document->BindingManager(), this,
document));
}
}
nsDataSlots *slots = GetExistingDataSlots();
if (slots) {
slots->mBindingParent = nullptr;
@ -855,7 +863,7 @@ nsGenericDOMDataNode::SplitData(uint32_t aOffset, nsIContent** aReturn,
return rv;
}
nsIDocument* document = GetCurrentDoc();
nsIDocument* document = GetComposedDoc();
mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, true);
// Use Clone for creating the new node so that the new node is of same class

View File

@ -199,7 +199,7 @@ nsINode::IsEditableInternal() const
return true;
}
nsIDocument *doc = GetCurrentDoc();
nsIDocument *doc = GetUncomposedDoc();
// Check if the node is in a document and the document is in designMode.
return doc && doc->HasFlag(NODE_IS_EDITABLE);
@ -1336,7 +1336,7 @@ bool
nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
{
if (MOZ_LIKELY(!cb.WantAllTraces())) {
nsIDocument *currentDoc = tmp->GetCurrentDoc();
nsIDocument *currentDoc = tmp->GetUncomposedDoc();
if (currentDoc &&
nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration())) {
return false;
@ -1498,7 +1498,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
nsMutationGuard::DidMutate();
// Do this before checking the child-count since this could cause mutations
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
mozAutoDocUpdate updateBatch(GetCrossShadowCurrentDoc(), UPDATE_CONTENT_MODEL, aNotify);
if (OwnerDoc() != aKid->OwnerDoc()) {
@ -1928,7 +1928,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// Scope for the mutation batch and scriptblocker, so they go away
// while kungFuDeathGrip is still alive.
{
mozAutoDocUpdate batch(newContent->GetCurrentDoc(),
mozAutoDocUpdate batch(newContent->GetComposedDoc(),
UPDATE_CONTENT_MODEL, true);
nsAutoMutationBatch mb(oldParent, true, true);
oldParent->RemoveChildAt(removeIndex, true);
@ -1993,7 +1993,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
for (nsIContent* child = newContent->GetFirstChild();
child;
child = child->GetNextSibling()) {
NS_ASSERTION(child->GetCurrentDoc() == nullptr,
NS_ASSERTION(child->GetComposedDoc() == nullptr,
"How did we get a child with a current doc?");
fragChildren->AppendElement(child);
}
@ -2006,7 +2006,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// Scope for the mutation batch and scriptblocker, so they go away
// while kungFuDeathGrip is still alive.
{
mozAutoDocUpdate batch(newContent->GetCurrentDoc(),
mozAutoDocUpdate batch(newContent->GetComposedDoc(),
UPDATE_CONTENT_MODEL, true);
nsAutoMutationBatch mb(newContent, false, true);

View File

@ -1063,7 +1063,7 @@ nsImageLoadingContent::GetOurCurrentDoc()
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ENSURE_TRUE(thisContent, nullptr);
return thisContent->GetCurrentDoc();
return thisContent->GetComposedDoc();
}
nsIFrame*

View File

@ -20,7 +20,7 @@ nsMappedAttributeElement::SetMappedAttribute(nsIDocument* aDocument,
nsAttrValue& aValue,
nsresult* aRetval)
{
NS_PRECONDITION(aDocument == GetCurrentDoc(), "Unexpected document");
NS_PRECONDITION(aDocument == GetComposedDoc(), "Unexpected document");
nsHTMLStyleSheet* sheet = aDocument ?
aDocument->GetAttributeStyleSheet() : nullptr;

View File

@ -209,9 +209,9 @@ CheckPluginStopEvent::Run()
// In an active document, but still no frame. Flush layout to see if we can
// regain a frame now.
LOG(("OBJLC [%p]: CheckPluginStopEvent - No frame, flushing layout", this));
nsIDocument* currentDoc = content->GetCurrentDoc();
if (currentDoc) {
currentDoc->FlushPendingNotifications(Flush_Layout);
nsIDocument* composedDoc = content->GetComposedDoc();
if (composedDoc) {
composedDoc->FlushPendingNotifications(Flush_Layout);
if (objLC->mPendingCheckPluginStopEvent != this) {
LOG(("OBJLC [%p]: CheckPluginStopEvent - superseded in layout flush",
this));
@ -239,7 +239,7 @@ class nsSimplePluginEvent : public nsRunnable {
public:
nsSimplePluginEvent(nsIContent* aTarget, const nsAString &aEvent)
: mTarget(aTarget)
, mDocument(aTarget->GetCurrentDoc())
, mDocument(aTarget->GetComposedDoc())
, mEvent(aEvent)
{
MOZ_ASSERT(aTarget && mDocument);
@ -661,7 +661,7 @@ nsObjectLoadingContent::IsSupportedDocument(const nsCString& aMimeType)
}
nsCOMPtr<nsIWebNavigation> webNav;
nsIDocument* currentDoc = thisContent->GetCurrentDoc();
nsIDocument* currentDoc = thisContent->GetComposedDoc();
if (currentDoc) {
webNav = do_GetInterface(currentDoc->GetWindow());
}
@ -730,7 +730,7 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
/// would keep the docshell around, but trash the frameloader
UnloadObject();
}
nsIDocument* doc = thisContent->GetCurrentDoc();
nsIDocument* doc = thisContent->GetComposedDoc();
if (doc && doc->IsActive()) {
nsCOMPtr<nsIRunnable> ev = new nsSimplePluginEvent(doc,
NS_LITERAL_STRING("PluginRemoved"));
@ -786,7 +786,7 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent *>(this));
nsCOMPtr<nsIDocument> doc = thisContent->GetCurrentDoc();
nsCOMPtr<nsIDocument> doc = thisContent->GetComposedDoc();
if (!doc || !InActiveDocument(thisContent)) {
NS_ERROR("Shouldn't be calling "
"InstantiatePluginInstance without an active document");
@ -1178,8 +1178,8 @@ nsObjectLoadingContent::OnStopRequest(nsIRequest *aRequest,
if (aStatusCode == NS_ERROR_TRACKING_URI) {
nsCOMPtr<nsIContent> thisNode =
do_QueryInterface(static_cast<nsIObjectLoadingContent*>(this));
if (thisNode) {
thisNode->GetCurrentDoc()->AddBlockedTrackingNode(thisNode);
if (thisNode && thisNode->IsInComposedDoc()) {
thisNode->GetComposedDoc()->AddBlockedTrackingNode(thisNode);
}
}
@ -2660,7 +2660,7 @@ nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
return;
}
nsIDocument* doc = thisContent->GetCurrentDoc();
nsIDocument* doc = thisContent->GetComposedDoc();
if (!doc) {
return; // Nothing to do
}
@ -3349,7 +3349,7 @@ nsObjectLoadingContent::GetContentDocument()
return nullptr;
}
// XXXbz should this use GetCurrentDoc()? sXBL/XBL2 issue!
// XXXbz should this use GetComposedDoc()? sXBL/XBL2 issue!
nsIDocument *sub_doc = thisContent->OwnerDoc()->GetSubDocumentFor(thisContent);
if (!sub_doc) {
return nullptr;

View File

@ -1084,7 +1084,7 @@ nsRange::IsValidBoundary(nsINode* aNode)
// Elements etc. must be in document or in document fragment,
// text nodes in document, in document fragment or in attribute.
nsINode* root = aNode->GetCurrentDoc();
nsINode* root = aNode->GetUncomposedDoc();
if (root) {
return root;
}
@ -1092,7 +1092,7 @@ nsRange::IsValidBoundary(nsINode* aNode)
root = aNode->SubtreeRoot();
NS_ASSERTION(!root->IsNodeOfType(nsINode::eDOCUMENT),
"GetCurrentDoc should have returned a doc");
"GetUncomposedDoc should have returned a doc");
// We allow this because of backward compatibility.
return root;

View File

@ -47,7 +47,7 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
return;
// Get the current document
nsIDocument *doc = aFromContent->GetCurrentDoc();
nsIDocument *doc = aFromContent->GetComposedDoc();
if (!doc)
return;
@ -124,7 +124,7 @@ void
nsReferencedElement::ResetWithID(nsIContent* aFromContent, const nsString& aID,
bool aWatch)
{
nsIDocument *doc = aFromContent->GetCurrentDoc();
nsIDocument *doc = aFromContent->GetComposedDoc();
if (!doc)
return;

View File

@ -150,8 +150,9 @@ HTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_ENSURE_SUCCESS(rv, rv);
// Prefetch links
if (aDocument) {
aDocument->RegisterPendingLinkUpdate(this);
nsIDocument* doc = GetComposedDoc();
if (doc) {
doc->RegisterPendingLinkUpdate(this);
if (nsHTMLDNSPrefetch::IsAllowed(OwnerDoc())) {
nsHTMLDNSPrefetch::PrefetchLow(this);
}
@ -181,8 +182,10 @@ HTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
// If this link is ever reinserted into a document, it might
// be under a different xml:base, so forget the cached state now.
Link::ResetLinkState(false, Link::ElementHasHref());
nsIDocument* doc = GetCurrentDoc();
// Note, we need to use OwnerDoc() here, since GetComposedDoc() might
// return null.
nsIDocument* doc = OwnerDoc();
if (doc) {
doc->UnregisterPendingLinkUpdate(this);
}

View File

@ -135,13 +135,16 @@ HTMLAreaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
bool aCompileEventHandlers)
{
Link::ResetLinkState(false, Link::ElementHasHref());
if (aDocument) {
aDocument->RegisterPendingLinkUpdate(this);
}
return nsGenericHTMLElement::BindToTree(aDocument, aParent,
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
aBindingParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument* doc = GetComposedDoc();
if (doc) {
doc->RegisterPendingLinkUpdate(this);
}
return rv;
}
void
@ -150,8 +153,10 @@ HTMLAreaElement::UnbindFromTree(bool aDeep, bool aNullParent)
// If this link is ever reinserted into a document, it might
// be under a different xml:base, so forget the cached state now.
Link::ResetLinkState(false, Link::ElementHasHref());
nsIDocument* doc = GetCurrentDoc();
// Note, we need to use OwnerDoc() here, since GetComposedDoc() might
// return null.
nsIDocument* doc = OwnerDoc();
if (doc) {
doc->UnregisterPendingLinkUpdate(this);
}

View File

@ -401,7 +401,7 @@ HTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
if (!mContentStyleRule && IsInDoc()) {
// XXXbz should this use OwnerDoc() or GetCurrentDoc()?
// XXXbz should this use OwnerDoc() or GetComposedDoc()?
// sXBL/XBL2 issue!
mContentStyleRule = new BodyRule(this);
}

View File

@ -113,7 +113,7 @@ void
HTMLFormControlsCollection::FlushPendingNotifications()
{
if (mForm) {
nsIDocument* doc = mForm->GetCurrentDoc();
nsIDocument* doc = mForm->GetUncomposedDoc();
if (doc) {
doc->FlushPendingNotifications(Flush_Content);
}

View File

@ -446,7 +446,7 @@ CollectOrphans(nsINode* aRemovalRoot,
void
HTMLFormElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
nsCOMPtr<nsIHTMLDocument> oldDocument = do_QueryInterface(GetCurrentDoc());
nsCOMPtr<nsIHTMLDocument> oldDocument = do_QueryInterface(GetUncomposedDoc());
// Mark all of our controls as maybe being orphans
MarkOrphans(mControls->mElements);
@ -583,7 +583,7 @@ HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
int32_t aMessage)
{
// Make sure the presentation is up-to-date
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (doc) {
doc->FlushPendingNotifications(Flush_ContentAndNotify);
}
@ -633,7 +633,7 @@ HTMLFormElement::DoReset()
nsresult
HTMLFormElement::DoSubmit(WidgetEvent* aEvent)
{
NS_ASSERTION(GetCurrentDoc(), "Should never get here without a current doc");
NS_ASSERTION(GetComposedDoc(), "Should never get here without a current doc");
if (mIsSubmitting) {
NS_WARNING("Preventing double form submission");
@ -741,7 +741,7 @@ HTMLFormElement::SubmitSubmission(nsFormSubmission* aFormSubmission)
}
// If there is no link handler, then we won't actually be able to submit.
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
nsCOMPtr<nsISupports> container = doc ? doc->GetContainer() : nullptr;
nsCOMPtr<nsILinkHandler> linkHandler(do_QueryInterface(container));
if (!linkHandler || IsEditable()) {
@ -1801,7 +1801,7 @@ HTMLFormElement::CheckValidFormSubmission()
// Don't do validation for a form submit done by a sandboxed document that
// doesn't have 'allow-forms', the submit will have been blocked and the
// HTML5 spec says we shouldn't validate in this case.
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (doc && (doc->GetSandboxFlags() & SANDBOXED_FORMS)) {
return true;
}

View File

@ -1858,7 +1858,8 @@ HTMLInputElement::GetList() const
return nullptr;
}
nsIDocument* doc = GetCurrentDoc();
//XXXsmaug How should this all work in case input element is in Shadow DOM.
nsIDocument* doc = GetUncomposedDoc();
if (!doc) {
return nullptr;
}
@ -2262,8 +2263,8 @@ HTMLInputElement::StepUp(int32_t n, uint8_t optional_argc)
void
HTMLInputElement::FlushFrames()
{
if (GetCurrentDoc()) {
GetCurrentDoc()->FlushPendingNotifications(Flush_Frames);
if (GetComposedDoc()) {
GetComposedDoc()->FlushPendingNotifications(Flush_Frames);
}
}
@ -3029,7 +3030,8 @@ HTMLInputElement::GetRadioGroupContainer() const
return mForm;
}
return static_cast<nsDocument*>(GetCurrentDoc());
//XXXsmaug It isn't clear how this should work in Shadow DOM.
return static_cast<nsDocument*>(GetUncomposedDoc());
}
already_AddRefed<nsIDOMHTMLInputElement>
@ -3964,7 +3966,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (fm && IsSingleLineTextControl(false) &&
!aVisitor.mEvent->AsFocusEvent()->fromRaise &&
SelectTextFieldOnFocus()) {
nsIDocument* document = GetCurrentDoc();
nsIDocument* document = GetComposedDoc();
if (document) {
uint32_t lastFocusMethod;
fm->GetLastFocusMethod(document->GetWindow(), &lastFocusMethod);

View File

@ -246,7 +246,10 @@ HTMLLabelElement::GetLabeledElement() const
// We have a @for. The id has to be linked to an element in the same document
// and this element should be a labelable form control.
nsIDocument* doc = GetCurrentDoc();
//XXXsmaug It is unclear how this should work in case the element is in
// Shadow DOM.
// See https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365.
nsIDocument* doc = GetUncomposedDoc();
if (!doc) {
return nullptr;
}

View File

@ -177,18 +177,15 @@ HTMLLinkElement::UnbindFromTree(bool aDeep, bool aNullParent)
// be under a different xml:base, so forget the cached state now.
Link::ResetLinkState(false, Link::ElementHasHref());
// Once we have XPCOMGC we shouldn't need to call UnbindFromTree during Unlink
// and so this messy event dispatch can go away.
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
// Check for a ShadowRoot because link elements are inert in a
// ShadowRoot.
ShadowRoot* oldShadowRoot = GetBindingParent() ?
GetBindingParent()->GetShadowRoot() : nullptr;
if (oldDoc && !oldShadowRoot) {
oldDoc->UnregisterPendingLinkUpdate(this);
}
OwnerDoc()->UnregisterPendingLinkUpdate(this);
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMLinkRemoved"));
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
@ -251,7 +248,7 @@ void
HTMLLinkElement::UpdateImport()
{
// 1. link node should be attached to the document.
nsCOMPtr<nsIDocument> doc = GetCurrentDoc();
nsCOMPtr<nsIDocument> doc = GetUncomposedDoc();
if (!doc) {
// We might have been just removed from the document, so
// let's remove ourself from the list of link nodes of

View File

@ -2843,6 +2843,8 @@ void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
GetSrcMediaStream()->AddVideoOutput(container);
}
// Note: we must call DisconnectTrackListListeners(...) before dropping
// mSrcStream
mSrcStream->ConstructMediaTracks(AudioTracks(), VideoTracks());
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
@ -2859,6 +2861,8 @@ void HTMLMediaElement::EndSrcMediaStreamPlayback()
if (stream) {
stream->RemoveListener(mSrcStreamListener);
}
mSrcStream->DisconnectTrackListListeners(AudioTracks(), VideoTracks());
// Kill its reference to this element
mSrcStreamListener->Forget();
mSrcStreamListener = nullptr;
@ -3095,14 +3099,6 @@ void HTMLMediaElement::UpdateReadyStateForData(MediaDecoderOwner::NextFrameStatu
return;
}
// Section 2.4.3.1 of the Media Source Extensions spec requires
// changing to HAVE_METADATA when seeking into an unbuffered
// range.
if (aNextFrame == MediaDecoderOwner::NEXT_FRAME_WAIT_FOR_MSE_DATA) {
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
return;
}
if (aNextFrame == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING) {
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
return;

View File

@ -70,7 +70,7 @@ HTMLMenuElement::SendShowEvent()
{
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
nsCOMPtr<nsIDocument> document = GetCurrentDoc();
nsCOMPtr<nsIDocument> document = GetComposedDoc();
if (!document) {
return NS_ERROR_FAILURE;
}

View File

@ -54,7 +54,7 @@ HTMLMetaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::content) {
nsIDocument *document = GetCurrentDoc();
nsIDocument *document = GetUncomposedDoc();
CreateAndDispatchEvent(document, NS_LITERAL_STRING("DOMMetaChanged"));
}
}
@ -86,7 +86,7 @@ HTMLMetaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
void
HTMLMetaElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMMetaRemoved"));
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}

View File

@ -200,7 +200,7 @@ HTMLObjectElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool
HTMLObjectElement::IsFocusableForTabIndex()
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
return false;
}
@ -216,7 +216,7 @@ HTMLObjectElement::IsHTMLFocusable(bool aWithMouse,
{
// TODO: this should probably be managed directly by IsHTMLFocusable.
// See bug 597242.
nsIDocument *doc = GetCurrentDoc();
nsIDocument *doc = GetComposedDoc();
if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
if (aTabIndex) {
GetTabIndex(aTabIndex);

View File

@ -43,7 +43,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
HTMLPropertiesCollection::HTMLPropertiesCollection(nsGenericHTMLElement* aRoot)
: mRoot(aRoot)
, mDoc(aRoot->GetCurrentDoc())
, mDoc(aRoot->GetUncomposedDoc())
, mIsDirty(true)
{
SetIsDOMBinding();
@ -248,7 +248,7 @@ GetElementByIdForConnectedSubtree(nsIContent* aContent, const nsIAtom* aId)
void
HTMLPropertiesCollection::CrawlProperties()
{
nsIDocument* doc = mRoot->GetCurrentDoc();
nsIDocument* doc = mRoot->GetUncomposedDoc();
const nsAttrValue* attr = mRoot->GetParsedAttr(nsGkAtoms::itemref);
if (attr) {
@ -306,7 +306,7 @@ HTMLPropertiesCollection::GetSupportedNames(unsigned, nsTArray<nsString>& aNames
PropertyNodeList::PropertyNodeList(HTMLPropertiesCollection* aCollection,
nsIContent* aParent, const nsAString& aName)
: mName(aName),
mDoc(aParent->GetCurrentDoc()),
mDoc(aParent->GetUncomposedDoc()),
mCollection(aCollection),
mParent(aParent),
mIsDirty(true)

View File

@ -227,9 +227,9 @@ HTMLSharedElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
aNameSpaceID == kNameSpaceID_None &&
IsInDoc()) {
if (aName == nsGkAtoms::href) {
SetBaseURIUsingFirstBaseWithHref(GetCurrentDoc(), this);
SetBaseURIUsingFirstBaseWithHref(GetUncomposedDoc(), this);
} else if (aName == nsGkAtoms::target) {
SetBaseTargetUsingFirstBaseWithTarget(GetCurrentDoc(), this);
SetBaseTargetUsingFirstBaseWithTarget(GetUncomposedDoc(), this);
}
}
@ -250,9 +250,9 @@ HTMLSharedElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
aNameSpaceID == kNameSpaceID_None &&
IsInDoc()) {
if (aName == nsGkAtoms::href) {
SetBaseURIUsingFirstBaseWithHref(GetCurrentDoc(), nullptr);
SetBaseURIUsingFirstBaseWithHref(GetUncomposedDoc(), nullptr);
} else if (aName == nsGkAtoms::target) {
SetBaseTargetUsingFirstBaseWithTarget(GetCurrentDoc(), nullptr);
SetBaseTargetUsingFirstBaseWithTarget(GetUncomposedDoc(), nullptr);
}
}
@ -287,7 +287,7 @@ HTMLSharedElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
void
HTMLSharedElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);

View File

@ -896,7 +896,7 @@ HTMLTableElement::BuildInheritedAttributes()
{
NS_ASSERTION(mTableInheritedAttributes == TABLE_ATTRS_DIRTY,
"potential leak, plus waste of work");
nsIDocument *document = GetCurrentDoc();
nsIDocument *document = GetComposedDoc();
nsHTMLStyleSheet* sheet = document ?
document->GetAttributeStyleSheet() : nullptr;
nsRefPtr<nsMappedAttributes> newAttrs;

View File

@ -127,7 +127,7 @@ HTMLTitleElement::DoneAddingChildren(bool aHaveNotified)
void
HTMLTitleElement::SendTitleChangeEvent(bool aBound)
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
if (doc) {
doc->NotifyPossibleTitleChange(aBound);
}

View File

@ -820,7 +820,7 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
nsFormSubmission** aFormSubmission)
{
// Get all the information necessary to encode the form data
NS_ASSERTION(aForm->GetCurrentDoc(),
NS_ASSERTION(aForm->GetComposedDoc(),
"Should have doc if we're building submission!");
// Get encoding type (default: urlencoded)

View File

@ -580,7 +580,8 @@ nsGenericHTMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
RemoveFromNameTable();
if (GetContentEditableValue() == eTrue) {
nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(GetCurrentDoc());
//XXXsmaug Fix this for Shadow DOM, bug 1066965.
nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(GetUncomposedDoc());
if (htmlDocument) {
htmlDocument->ChangeContentEditableCount(this, -1);
}
@ -780,7 +781,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
// If we have a document, and it has a window, add the event
// listener on the window (the inner window). If not, proceed as
// normal.
// XXXbz sXBL/XBL2 issue: should we instead use GetCurrentDoc() here,
// XXXbz sXBL/XBL2 issue: should we instead use GetComposedDoc() here,
// override BindToTree for those classes and munge event listeners there?
nsIDocument *document = OwnerDoc();
@ -1772,7 +1773,8 @@ nsGenericHTMLElement::GetContextMenu() const
nsAutoString value;
GetHTMLAttr(nsGkAtoms::contextmenu, value);
if (!value.IsEmpty()) {
nsIDocument* doc = GetCurrentDoc();
//XXXsmaug How should this work in Shadow DOM?
nsIDocument* doc = GetUncomposedDoc();
if (doc) {
return HTMLMenuElement::FromContentOrNull(doc->GetElementById(value));
}
@ -2030,7 +2032,7 @@ nsGenericHTMLFormElement::BindToTree(nsIDocument* aDocument,
// wouldn't be possible to find a form ancestor.
// We should not call UpdateFormOwner if none of these conditions are
// fulfilled.
if (HasAttr(kNameSpaceID_None, nsGkAtoms::form) ? !!GetCurrentDoc()
if (HasAttr(kNameSpaceID_None, nsGkAtoms::form) ? !!GetUncomposedDoc()
: !!aParent) {
UpdateFormOwner(true, nullptr);
}
@ -2182,7 +2184,8 @@ nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
if (aName == nsGkAtoms::form) {
// We need a new form id observer.
nsIDocument* doc = GetCurrentDoc();
//XXXsmaug How should this work in Shadow DOM?
nsIDocument* doc = GetUncomposedDoc();
if (doc) {
Element* formIdElement = nullptr;
if (aValue && !aValue->IsEmptyString()) {
@ -2348,8 +2351,8 @@ nsGenericHTMLFormElement::FocusState()
Element*
nsGenericHTMLFormElement::AddFormIdObserver()
{
NS_ASSERTION(GetCurrentDoc(), "When adding a form id observer, "
"we should be in a document!");
NS_ASSERTION(GetUncomposedDoc(), "When adding a form id observer, "
"we should be in a document!");
nsAutoString formId;
nsIDocument* doc = OwnerDoc();
@ -2369,8 +2372,8 @@ nsGenericHTMLFormElement::RemoveFormIdObserver()
* element actually being in the tree. If it is not and @form value changes,
* this method will be called for nothing but removing an observer which does
* not exist doesn't cost so much (no entry in the hash table) so having a
* boolean for GetCurrentDoc()/GetOwnerDoc() would make everything look more
* complex for nothing.
* boolean for GetUncomposedDoc()/GetOwnerDoc() would make everything look
* more complex for nothing.
*/
nsIDocument* doc = OwnerDoc();
@ -2449,10 +2452,10 @@ nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
element = aFormIdElement;
}
NS_ASSERTION(GetCurrentDoc(), "The element should be in a document "
"when UpdateFormOwner is called!");
NS_ASSERTION(!GetCurrentDoc() ||
element == GetCurrentDoc()->GetElementById(formId),
NS_ASSERTION(GetUncomposedDoc(), "The element should be in a document "
"when UpdateFormOwner is called!");
NS_ASSERTION(!GetUncomposedDoc() ||
element == GetUncomposedDoc()->GetElementById(formId),
"element should be equals to the current element "
"associated with the id in @form!");
@ -2765,7 +2768,7 @@ nsGenericHTMLElement::IsCurrentBodyElement()
}
nsCOMPtr<nsIDOMHTMLDocument> htmlDocument =
do_QueryInterface(GetCurrentDoc());
do_QueryInterface(GetUncomposedDoc());
if (!htmlDocument) {
return false;
}
@ -2822,7 +2825,7 @@ nsGenericHTMLElement::RecompileScriptEventListeners()
bool
nsGenericHTMLElement::IsEditableRoot() const
{
nsIDocument *document = GetCurrentDoc();
nsIDocument *document = GetComposedDoc();
if (!document) {
return false;
}
@ -2868,7 +2871,8 @@ MakeContentDescendantsEditable(nsIContent *aContent, nsIDocument *aDocument)
void
nsGenericHTMLElement::ChangeEditableState(int32_t aChange)
{
nsIDocument* document = GetCurrentDoc();
//XXXsmaug Fix this for Shadow DOM, bug 1066965.
nsIDocument* document = GetUncomposedDoc();
if (!document) {
return;
}

View File

@ -1056,7 +1056,7 @@ HTMLContentSink::NotifyInsert(nsIContent* aContent,
nsIContent* aChildContent,
int32_t aIndexInContainer)
{
if (aContent && aContent->GetCurrentDoc() != mDocument) {
if (aContent && aContent->GetUncomposedDoc() != mDocument) {
// aContent is not actually in our document anymore.... Just bail out of
// here; notifying on our document for this insert would be wrong.
return;

View File

@ -1119,7 +1119,7 @@ bool
nsHTMLDocument::MatchLinks(nsIContent *aContent, int32_t aNamespaceID,
nsIAtom* aAtom, void* aData)
{
nsIDocument* doc = aContent->GetCurrentDoc();
nsIDocument* doc = aContent->GetUncomposedDoc();
if (doc) {
NS_ASSERTION(aContent->IsInDoc(),
@ -1128,7 +1128,7 @@ nsHTMLDocument::MatchLinks(nsIContent *aContent, int32_t aNamespaceID,
#ifdef DEBUG
{
nsCOMPtr<nsIHTMLDocument> htmldoc =
do_QueryInterface(aContent->GetCurrentDoc());
do_QueryInterface(aContent->GetUncomposedDoc());
NS_ASSERTION(htmldoc,
"Huh, how did this happen? This should only be used with "
"HTML documents!");
@ -1173,7 +1173,7 @@ nsHTMLDocument::MatchAnchors(nsIContent *aContent, int32_t aNamespaceID,
#ifdef DEBUG
{
nsCOMPtr<nsIHTMLDocument> htmldoc =
do_QueryInterface(aContent->GetCurrentDoc());
do_QueryInterface(aContent->GetUncomposedDoc());
NS_ASSERTION(htmldoc,
"Huh, how did this happen? This should only be used with "
"HTML documents!");

View File

@ -452,6 +452,19 @@ DOMMediaStream::ConstructMediaTracks(AudioTrackList* aAudioTrackList,
}
}
void
DOMMediaStream::DisconnectTrackListListeners(const AudioTrackList* aAudioTrackList,
const VideoTrackList* aVideoTrackList)
{
for (auto i = mMediaTrackListListeners.Length(); i > 0; ) { // unsigned!
--i; // 0 ... Length()-1 range
if (mMediaTrackListListeners[i].mMediaTrackList == aAudioTrackList ||
mMediaTrackListListeners[i].mMediaTrackList == aVideoTrackList) {
mMediaTrackListListeners.RemoveElementAt(i);
}
}
}
void
DOMMediaStream::NotifyMediaStreamTrackCreated(MediaStreamTrack* aTrack)
{

View File

@ -242,6 +242,12 @@ public:
void ConstructMediaTracks(AudioTrackList* aAudioTrackList,
VideoTrackList* aVideoTrackList);
/**
* MUST call this before the AudioTrackList or VideoTrackList go away
*/
void DisconnectTrackListListeners(const AudioTrackList* aAudioTrackList,
const VideoTrackList* aVideoTrackList);
virtual void NotifyMediaStreamTrackCreated(MediaStreamTrack* aTrack);
virtual void NotifyMediaStreamTrackEnded(MediaStreamTrack* aTrack);

View File

@ -114,9 +114,6 @@ public:
NEXT_FRAME_UNAVAILABLE_SEEKING,
// The next frame of audio/video is unavailable for some other reasons
NEXT_FRAME_UNAVAILABLE,
// The next frame is unavailable due to waiting for more Media Source
// Extensions data to become available.
NEXT_FRAME_WAIT_FOR_MSE_DATA,
// Sentinel value
NEXT_FRAME_UNINITIALIZED
};

View File

@ -10,6 +10,8 @@
#include "mozilla/DOMEventTargetHelper.h"
namespace mozilla {
class DOMMediaStream;
namespace dom {
class HTMLMediaElement;
@ -28,6 +30,8 @@ class MediaTrackList;
class MediaTrackListListener
{
public:
friend class mozilla::DOMMediaStream;
explicit MediaTrackListListener(MediaTrackList* aMediaTrackList)
: mMediaTrackList(aMediaTrackList) {};

View File

@ -371,25 +371,6 @@ MediaSourceReader::OnTrackBufferConfigured(TrackBuffer* aTrackBuffer, const Medi
mDecoder->NotifyWaitingForResourcesStatusChanged();
}
class ChangeToHaveMetadata : public nsRunnable {
public:
explicit ChangeToHaveMetadata(AbstractMediaDecoder* aDecoder) :
mDecoder(aDecoder)
{
}
NS_IMETHOD Run() MOZ_OVERRIDE MOZ_FINAL {
auto owner = mDecoder->GetOwner();
if (owner) {
owner->UpdateReadyStateForData(MediaDecoderOwner::NEXT_FRAME_WAIT_FOR_MSE_DATA);
}
return NS_OK;
}
private:
nsRefPtr<AbstractMediaDecoder> mDecoder;
};
void
MediaSourceReader::WaitForTimeRange(int64_t aTime)
{
@ -434,11 +415,6 @@ MediaSourceReader::Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime,
mLastAudioTime = aTime;
mLastVideoTime = aTime;
if (!TrackBuffersContainTime(aTime)) {
MSE_DEBUG("MediaSourceReader(%p)::Seek no active buffer contains target=%lld", this, aTime);
NS_DispatchToMainThread(new ChangeToHaveMetadata(mDecoder));
}
WaitForTimeRange(aTime);
if (IsShutdown()) {

View File

@ -53,7 +53,7 @@ TrackBuffer::~TrackBuffer()
class ReleaseDecoderTask : public nsRunnable {
public:
explicit ReleaseDecoderTask(nsRefPtr<SourceBufferDecoder> aDecoder)
explicit ReleaseDecoderTask(SourceBufferDecoder* aDecoder)
{
mDecoders.AppendElement(aDecoder);
}
@ -237,40 +237,43 @@ TrackBuffer::NewDecoder()
}
bool
TrackBuffer::QueueInitializeDecoder(nsRefPtr<SourceBufferDecoder> aDecoder)
TrackBuffer::QueueInitializeDecoder(SourceBufferDecoder* aDecoder)
{
RefPtr<nsIRunnable> task =
NS_NewRunnableMethodWithArg<nsRefPtr<SourceBufferDecoder>>(this,
&TrackBuffer::InitializeDecoder,
aDecoder);
NS_NewRunnableMethodWithArg<SourceBufferDecoder*>(this,
&TrackBuffer::InitializeDecoder,
aDecoder);
aDecoder->SetTaskQueue(mTaskQueue);
if (NS_FAILED(mTaskQueue->Dispatch(task))) {
MSE_DEBUG("MediaSourceReader(%p): Failed to enqueue decoder initialization task", this);
RemoveDecoder(aDecoder);
return false;
}
return true;
}
void
TrackBuffer::InitializeDecoder(nsRefPtr<SourceBufferDecoder> aDecoder)
TrackBuffer::InitializeDecoder(SourceBufferDecoder* aDecoder)
{
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
// ReadMetadata may block the thread waiting on data, so it must not be
// called with the monitor held.
mParentDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn();
MediaDecoderReader* reader = aDecoder->GetReader();
MSE_DEBUG("TrackBuffer(%p): Initializing subdecoder %p reader %p",
this, aDecoder.get(), reader);
this, aDecoder, reader);
MediaInfo mi;
nsAutoPtr<MetadataTags> tags; // TODO: Handle metadata.
nsresult rv = reader->ReadMetadata(&mi, getter_Transfers(tags));
aDecoder->SetTaskQueue(nullptr);
reader->SetIdle();
if (NS_FAILED(rv) || (!mi.HasVideo() && !mi.HasAudio())) {
// XXX: Need to signal error back to owning SourceBuffer.
MSE_DEBUG("TrackBuffer(%p): Reader %p failed to initialize rv=%x audio=%d video=%d",
this, reader, rv, mi.HasAudio(), mi.HasVideo());
aDecoder->SetTaskQueue(nullptr);
RemoveDecoder(aDecoder);
return;
}
@ -314,10 +317,9 @@ TrackBuffer::ValidateTrackFormats(const MediaInfo& aInfo)
}
bool
TrackBuffer::RegisterDecoder(nsRefPtr<SourceBufferDecoder> aDecoder)
TrackBuffer::RegisterDecoder(SourceBufferDecoder* aDecoder)
{
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
aDecoder->SetTaskQueue(nullptr);
const MediaInfo& info = aDecoder->GetReader()->GetMediaInfo();
// Initialize the track info since this is the first decoder.
if (mInitializedDecoders.IsEmpty()) {
@ -428,12 +430,19 @@ TrackBuffer::Dump(const char* aPath)
#endif
void
TrackBuffer::RemoveDecoder(nsRefPtr<SourceBufferDecoder> aDecoder)
TrackBuffer::RemoveDecoder(SourceBufferDecoder* aDecoder)
{
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
MOZ_ASSERT(!mInitializedDecoders.Contains(aDecoder));
mDecoders.RemoveElement(aDecoder);
NS_DispatchToMainThread(new ReleaseDecoderTask(aDecoder));
RefPtr<nsIRunnable> task = new ReleaseDecoderTask(aDecoder);
{
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
MOZ_ASSERT(!mInitializedDecoders.Contains(aDecoder));
mDecoders.RemoveElement(aDecoder);
if (mCurrentDecoder == aDecoder) {
DiscardDecoder();
}
}
// At this point, task should be holding the only reference to aDecoder.
NS_DispatchToMainThread(task);
}
} // namespace mozilla

View File

@ -90,17 +90,17 @@ private:
bool AppendDataToCurrentResource(const uint8_t* aData, uint32_t aLength);
// Queue execution of InitializeDecoder on mTaskQueue.
bool QueueInitializeDecoder(nsRefPtr<SourceBufferDecoder> aDecoder);
bool QueueInitializeDecoder(SourceBufferDecoder* aDecoder);
// Runs decoder initialization including calling ReadMetadata. Runs as an
// event on the decode thread pool.
void InitializeDecoder(nsRefPtr<SourceBufferDecoder> aDecoder);
void InitializeDecoder(SourceBufferDecoder* aDecoder);
// Adds a successfully initialized decoder to mDecoders and (if it's the
// first decoder initialized), initializes mHasAudio/mHasVideo. Called
// from the decode thread pool. Return true if the decoder was
// successfully registered.
bool RegisterDecoder(nsRefPtr<SourceBufferDecoder> aDecoder);
bool RegisterDecoder(SourceBufferDecoder* aDecoder);
// Returns true if aInfo is considered a supported or the same format as
// the TrackBuffer was initialized as.
@ -110,7 +110,7 @@ private:
// to clean up the decoder. If aDecoder was added to
// mInitializedDecoders, it must have been removed before calling this
// function.
void RemoveDecoder(nsRefPtr<SourceBufferDecoder> aDecoder);
void RemoveDecoder(SourceBufferDecoder* aDecoder);
nsAutoPtr<ContainerParser> mParser;

View File

@ -5,10 +5,11 @@ support-files =
seek.webm seek.webm^headers^
seek_lowres.webm seek_lowres.webm^headers^
[test_BufferedSeek.html]
[test_FrameSelection.html]
[test_MediaSource.html]
[test_MediaSource_disabled.html]
[test_BufferedSeek.html]
[test_FrameSelection.html]
[test_HaveMetadataUnbufferedSeek.html]
[test_SeekableAfterEndOfStream.html]
[test_SeekableAfterEndOfStreamSplit.html]
[test_SeekableBeforeEndOfStream.html]

View File

@ -38,12 +38,12 @@ runWithMSE(function (ms, v) {
v.addEventListener("seeking", function () {
wasSeeking = true;
is(v.currentTime, target, "Video currentTime not at target");
is(v.currentTime, target, "Video currentTime at target");
});
v.addEventListener("seeked", function () {
ok(wasSeeking, "Received expected seeking and seeked events");
is(v.currentTime, target, "Video currentTime not at target");
is(v.currentTime, target, "Video currentTime at target");
SimpleTest.finish();
});
});

View File

@ -27,9 +27,9 @@ runWithMSE(function (ms, v) {
var target;
v.addEventListener("loadedmetadata", function () {
is(v.currentTime, 0, "currentTime has incorrect initial value");
is(v.videoWidth, 320, "videoWidth has incorrect initial value");
is(v.videoHeight, 240, "videoHeight has incorrect initial value");
is(v.currentTime, 0, "currentTime has correct initial value");
is(v.videoWidth, 320, "videoWidth has correct initial value");
is(v.videoHeight, 240, "videoHeight has correct initial value");
fetchWithXHR("seek_lowres.webm", function (arrayBuffer) {
// Append initialization segment.
@ -50,10 +50,10 @@ runWithMSE(function (ms, v) {
});
v.addEventListener("seeked", function () {
is(v.currentTime, target.currentTime, "Video currentTime not at target");
is(v.currentTime, target.currentTime, "Video currentTime at target");
is(v.videoWidth, target.videoWidth, "videoWidth has incorrect final value");
is(v.videoHeight, target.videoHeight, "videoHeight has incorrect final value");
is(v.videoWidth, target.videoWidth, "videoWidth has correct final value");
is(v.videoHeight, target.videoHeight, "videoHeight has correct final value");
target = targets.shift();
if (target) {

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<head>
<title>MSE: seekable attribute before end of stream</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(function (ms, v) {
ms.addEventListener("sourceopen", function () {
var sb = ms.addSourceBuffer("video/webm");
fetchWithXHR("seek.webm", function (arrayBuffer) {
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 67833));
});
var target = 2;
v.addEventListener("canplay", function oncanplay() {
v.removeEventListener("canplay", oncanplay);
ok(v.readyState >= v.HAVE_FUTURE_DATA, "readyState is >= FUTURE_DATA");
v.currentTime = target;
});
v.addEventListener("seeking", function () {
is(v.readyState, v.HAVE_METADATA, "readyState is HAVE_METADATA");
fetchWithXHR("seek.webm", function (arrayBuffer) {
sb.appendBuffer(new Uint8Array(arrayBuffer, 67833));
});
});
v.addEventListener("seeked", function () {
ok(v.readyState >= v.HAVE_FUTURE_DATA, "readyState is >= FUTURE_DATA");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>

View File

@ -180,7 +180,6 @@ DOMSVGPathSeg::IndexIsValid()
} \
AutoChangePathSegNotifier notifier(this); \
InternalItem()[1+index] = float(a##propName); \
InvalidateCachedList(); \
} else { \
mArgs[index] = float(a##propName); \
} \

View File

@ -209,10 +209,6 @@ protected:
*/
float* InternalItem();
void InvalidateCachedList() {
mList->InternalList().mCachedPath = nullptr;
}
virtual float* PtrToMemberArgs() = 0;
#ifdef DEBUG

View File

@ -383,7 +383,6 @@ DOMSVGPathSegList::InsertItemBefore(DOMSVGPathSeg& aNewItem,
domItem->ToSVGPathSegEncodedData(segAsRaw);
InternalList().mData.InsertElementsAt(internalIndex, segAsRaw, 1 + argCount);
InternalList().mCachedPath = nullptr;
mItems.InsertElementAt(aIndex, ItemProxy(domItem.get(), internalIndex));
// This MUST come after the insertion into InternalList(), or else under the
@ -440,7 +439,6 @@ DOMSVGPathSegList::ReplaceItem(DOMSVGPathSeg& aNewItem,
bool ok = !!InternalList().mData.ReplaceElementsAt(
internalIndex, 1 + oldArgCount,
segAsRaw, 1 + newArgCount);
InternalList().mCachedPath = nullptr;
if (!ok) {
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
@ -495,7 +493,6 @@ DOMSVGPathSegList::RemoveItem(uint32_t aIndex,
MaybeRemoveItemFromAnimValListAt(aIndex, argCount);
InternalList().mData.RemoveElementsAt(internalIndex, 1 + argCount);
InternalList().mCachedPath = nullptr;
mItems.RemoveElementAt(aIndex);
UpdateListIndicesFromIndex(aIndex, -(argCount + 1));

View File

@ -134,8 +134,9 @@ SVGAElement::BindToTree(nsIDocument *aDocument, nsIContent *aParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
if (aDocument) {
aDocument->RegisterPendingLinkUpdate(this);
nsIDocument* doc = GetComposedDoc();
if (doc) {
doc->RegisterPendingLinkUpdate(this);
}
return NS_OK;
@ -148,7 +149,9 @@ SVGAElement::UnbindFromTree(bool aDeep, bool aNullParent)
// be under a different xml:base, so forget the cached state now.
Link::ResetLinkState(false, Link::ElementHasHref());
nsIDocument* doc = GetCurrentDoc();
// Note, we need to use OwnerDoc() here since GetComposedDoc() may
// return null already at this point.
nsIDocument* doc = OwnerDoc();
if (doc) {
doc->UnregisterPendingLinkUpdate(this);
}

View File

@ -221,7 +221,7 @@ SVGAnimationElement::BindToTree(nsIDocument* aDocument,
href->ToString(hrefStr);
// Pass in |aParent| instead of |this| -- first argument is only used
// for a call to GetCurrentDoc(), and |this| might not have a current
// for a call to GetComposedDoc(), and |this| might not have a current
// document yet.
UpdateHrefTarget(aParent, hrefStr);
}

View File

@ -91,11 +91,9 @@ SVGCircleElement::BuildPath(PathBuilder* aBuilder)
return nullptr;
}
RefPtr<PathBuilder> pathBuilder = aBuilder ? aBuilder : CreatePathBuilder();
aBuilder->Arc(Point(x, y), r, 0, Float(2*M_PI));
pathBuilder->Arc(Point(x, y), r, 0, Float(2*M_PI));
return pathBuilder->Finish();
return aBuilder->Finish();
}
} // namespace dom

View File

@ -30,7 +30,7 @@ public:
virtual bool HasValidDimensions() const MOZ_OVERRIDE;
// nsSVGPathGeometryElement methods:
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;

View File

@ -426,7 +426,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
// XXX this does not take into account CSS transform, or that the non-SVG
// content that we've hit may itself be inside an SVG foreignObject higher up
nsIDocument* currentDoc = aElement->GetCurrentDoc();
nsIDocument* currentDoc = aElement->GetComposedDoc();
float x = 0.0f, y = 0.0f;
if (currentDoc && element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG)) {
nsIPresShell *presShell = currentDoc->GetShell();

View File

@ -102,11 +102,9 @@ SVGEllipseElement::BuildPath(PathBuilder* aBuilder)
return nullptr;
}
RefPtr<PathBuilder> pathBuilder = aBuilder ? aBuilder : CreatePathBuilder();
EllipseToBezier(aBuilder, Point(x, y), Size(rx, ry));
EllipseToBezier(pathBuilder.get(), Point(x, y), Size(rx, ry));
return pathBuilder->Finish();
return aBuilder->Finish();
}
} // namespace dom

View File

@ -30,7 +30,7 @@ public:
virtual bool HasValidDimensions() const MOZ_OVERRIDE;
// nsSVGPathGeometryElement methods:
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;

View File

@ -239,16 +239,14 @@ SVGImageElement::BuildPath(PathBuilder* aBuilder)
return nullptr;
}
RefPtr<PathBuilder> pathBuilder = aBuilder ? aBuilder : CreatePathBuilder();
Rect r(x, y, width, height);
pathBuilder->MoveTo(r.TopLeft());
pathBuilder->LineTo(r.TopRight());
pathBuilder->LineTo(r.BottomRight());
pathBuilder->LineTo(r.BottomLeft());
pathBuilder->Close();
aBuilder->MoveTo(r.TopLeft());
aBuilder->LineTo(r.TopRight());
aBuilder->LineTo(r.BottomRight());
aBuilder->LineTo(r.BottomLeft());
aBuilder->Close();
return pathBuilder->Finish();
return aBuilder->Finish();
}
//----------------------------------------------------------------------

View File

@ -53,7 +53,7 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const MOZ_OVERRIDE;
// nsSVGPathGeometryElement methods:
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const MOZ_OVERRIDE;

View File

@ -109,15 +109,13 @@ SVGLineElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks) {
TemporaryRef<Path>
SVGLineElement::BuildPath(PathBuilder* aBuilder)
{
RefPtr<PathBuilder> pathBuilder = aBuilder ? aBuilder : CreatePathBuilder();
float x1, y1, x2, y2;
GetAnimatedLengthValues(&x1, &y1, &x2, &y2, nullptr);
pathBuilder->MoveTo(Point(x1, y1));
pathBuilder->LineTo(Point(x2, y2));
aBuilder->MoveTo(Point(x1, y1));
aBuilder->LineTo(Point(x2, y2));
return pathBuilder->Finish();
return aBuilder->Finish();
}
} // namespace dom

View File

@ -32,7 +32,7 @@ public:
// nsSVGPathGeometryElement methods:
virtual bool IsMarkable() MOZ_OVERRIDE { return true; }
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;

View File

@ -213,7 +213,7 @@ SVGMPathElement::UpdateHrefTarget(nsIContent* aParent,
if (aParent) {
// Pass in |aParent| instead of |this| -- first argument is only used
// for a call to GetCurrentDoc(), and |this| might not have a current
// for a call to GetComposedDoc(), and |this| might not have a current
// document yet (if our caller is BindToTree).
mHrefTarget.Reset(aParent, targetURI);
} else {

View File

@ -227,7 +227,7 @@ SVGMotionSMILAnimationFunction::
bool ok =
path.GetDistancesFromOriginToEndsOfVisibleSegments(&mPathVertices);
if (ok && mPathVertices.Length()) {
mPath = pathElem->GetPathForLengthOrPositionMeasuring();
mPath = pathElem->GetOrBuildPathForMeasuring();
}
}
}
@ -252,7 +252,7 @@ SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromPathAttr()
return;
}
mPath = path.ToPathForLengthOrPositionMeasuring();
mPath = path.BuildPathForMeasuring();
bool ok = path.GetDistancesFromOriginToEndsOfVisibleSegments(&mPathVertices);
if (!ok || !mPathVertices.Length()) {
mPath = nullptr;

View File

@ -37,7 +37,6 @@ SVGPathData::CopyFrom(const SVGPathData& rhs)
// Yes, we do want fallible alloc here
return NS_ERROR_OUT_OF_MEMORY;
}
mCachedPath = nullptr;
mData = rhs.mData;
return NS_OK;
}
@ -72,7 +71,6 @@ SVGPathData::SetValueFromString(const nsAString& aValue)
// the first error. We still return any error though so that callers know if
// there's a problem.
mCachedPath = nullptr;
nsSVGPathDataParser pathParser(aValue, this);
return pathParser.Parse() ? NS_OK : NS_ERROR_DOM_SYNTAX_ERR;
}
@ -85,7 +83,6 @@ SVGPathData::AppendSeg(uint32_t aType, ...)
if (!mData.SetLength(newLength)) {
return NS_ERROR_OUT_OF_MEMORY;
}
mCachedPath = nullptr;
mData[oldLength] = SVGPathSegUtils::EncodeType(aType);
va_list args;
@ -510,7 +507,7 @@ SVGPathData::BuildPath(PathBuilder* builder,
}
TemporaryRef<Path>
SVGPathData::ToPathForLengthOrPositionMeasuring() const
SVGPathData::BuildPathForMeasuring() const
{
// Since the path that we return will not be used for painting it doesn't
// matter what we pass to CreatePathBuilder as aFillRule. Hawever, we do want
@ -520,15 +517,11 @@ SVGPathData::ToPathForLengthOrPositionMeasuring() const
// pass as aStrokeWidth doesn't matter (since it's only used to determine the
// length of those extra little lines).
if (!mCachedPath) {
RefPtr<DrawTarget> drawTarget =
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
RefPtr<PathBuilder> builder =
drawTarget->CreatePathBuilder(FillRule::FILL_WINDING);
mCachedPath = BuildPath(builder, NS_STYLE_STROKE_LINECAP_BUTT, 0);
}
return mCachedPath;
RefPtr<DrawTarget> drawTarget =
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
RefPtr<PathBuilder> builder =
drawTarget->CreatePathBuilder(FillRule::FILL_WINDING);
return BuildPath(builder, NS_STYLE_STROKE_LINECAP_BUTT, 0);
}
static double

View File

@ -163,7 +163,7 @@ public:
* ApproximateZeroLengthSubpathSquareCaps can insert if we have square-caps.
* See the comment for that function for more info on that.
*/
TemporaryRef<Path> ToPathForLengthOrPositionMeasuring() const;
TemporaryRef<Path> BuildPathForMeasuring() const;
TemporaryRef<Path> BuildPath(PathBuilder* aBuilder,
uint8_t aCapStyle,
@ -193,7 +193,6 @@ protected:
nsresult CopyFrom(const SVGPathData& rhs);
float& operator[](uint32_t aIndex) {
mCachedPath = nullptr;
return mData[aIndex];
}
@ -202,14 +201,12 @@ protected:
* increased, in which case the list will be left unmodified.
*/
bool SetLength(uint32_t aLength) {
mCachedPath = nullptr;
return mData.SetLength(aLength);
}
nsresult SetValueFromString(const nsAString& aValue);
void Clear() {
mCachedPath = nullptr;
mData.Clear();
}
@ -223,11 +220,10 @@ protected:
nsresult AppendSeg(uint32_t aType, ...); // variable number of float args
iterator begin() { mCachedPath = nullptr; return mData.Elements(); }
iterator end() { mCachedPath = nullptr; return mData.Elements() + mData.Length(); }
iterator begin() { return mData.Elements(); }
iterator end() { return mData.Elements() + mData.Length(); }
FallibleTArray<float> mData;
mutable RefPtr<gfx::Path> mCachedPath;
};

View File

@ -70,14 +70,14 @@ SVGPathElement::PathLength()
float
SVGPathElement::GetTotalLength()
{
RefPtr<Path> flat = GetPathForLengthOrPositionMeasuring();
RefPtr<Path> flat = GetOrBuildPathForMeasuring();
return flat ? flat->ComputeLength() : 0.f;
}
already_AddRefed<nsISVGPoint>
SVGPathElement::GetPointAtLength(float distance, ErrorResult& rv)
{
RefPtr<Path> path = GetPathForLengthOrPositionMeasuring();
RefPtr<Path> path = GetOrBuildPathForMeasuring();
if (!path) {
rv.Throw(NS_ERROR_FAILURE);
return nullptr;
@ -305,9 +305,9 @@ SVGPathElement::IsAttributeMapped(const nsIAtom* name) const
}
TemporaryRef<Path>
SVGPathElement::GetPathForLengthOrPositionMeasuring()
SVGPathElement::GetOrBuildPathForMeasuring()
{
return mD.GetAnimValue().ToPathForLengthOrPositionMeasuring();
return mD.GetAnimValue().BuildPathForMeasuring();
}
//----------------------------------------------------------------------
@ -340,7 +340,7 @@ SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor)
if (mPathLength.IsExplicitlySet()) {
float authorsPathLengthEstimate = mPathLength.GetAnimValue();
if (authorsPathLengthEstimate > 0) {
RefPtr<Path> path = GetPathForLengthOrPositionMeasuring();
RefPtr<Path> path = GetOrBuildPathForMeasuring();
if (!path) {
// The path is empty or invalid so its length must be zero and
// we know that 0 / authorsPathLengthEstimate = 0.
@ -390,24 +390,7 @@ SVGPathElement::BuildPath(PathBuilder* aBuilder)
}
}
RefPtr<PathBuilder> builder;
if (aBuilder) {
builder = aBuilder;
} else {
RefPtr<DrawTarget> drawTarget =
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
// The fill rule that we pass must be the current computed value of our
// CSS 'fill-rule' property if the path that we return will be used for
// painting or hit-testing. For all other uses (bounds calculatons, length
// measurement, position-at-offset calculations) the fill rule that we pass
// doesn't matter. As a result we can just pass the current computed value
// regardless of who's calling us, or what they're going to do with the
// path that we return.
RefPtr<PathBuilder> builder =
drawTarget->CreatePathBuilder(GetFillRule());
}
return mD.GetAnimValue().BuildPath(builder, strokeLineCap, strokeWidth);
return mD.GetAnimValue().BuildPath(aBuilder, strokeLineCap, strokeWidth);
}
} // namespace dom

View File

@ -50,15 +50,14 @@ public:
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) MOZ_OVERRIDE;
virtual bool IsMarkable() MOZ_OVERRIDE;
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
/**
* This returns a path without the extra little line segments that
* ApproximateZeroLengthSubpathSquareCaps can insert if we have square-caps.
* See the comment for that function for more info on that.
*/
virtual TemporaryRef<Path>
GetPathForLengthOrPositionMeasuring() MOZ_OVERRIDE;
virtual TemporaryRef<Path> GetOrBuildPathForMeasuring() MOZ_OVERRIDE;
// nsIContent interface
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;

View File

@ -118,19 +118,17 @@ SVGRectElement::BuildPath(PathBuilder* aBuilder)
return nullptr;
}
RefPtr<PathBuilder> pathBuilder = aBuilder ? aBuilder : CreatePathBuilder();
rx = std::max(rx, 0.0f);
ry = std::max(ry, 0.0f);
if (rx == 0 && ry == 0) {
// Optimization for the no rounded corners case.
Rect r(x, y, width, height);
pathBuilder->MoveTo(r.TopLeft());
pathBuilder->LineTo(r.TopRight());
pathBuilder->LineTo(r.BottomRight());
pathBuilder->LineTo(r.BottomLeft());
pathBuilder->Close();
aBuilder->MoveTo(r.TopLeft());
aBuilder->LineTo(r.TopRight());
aBuilder->LineTo(r.BottomRight());
aBuilder->LineTo(r.BottomLeft());
aBuilder->Close();
} else {
// If either the 'rx' or the 'ry' attribute isn't set, then we have to
// set it to the value of the other:
@ -150,10 +148,10 @@ SVGRectElement::BuildPath(PathBuilder* aBuilder)
Size cornerRadii(rx, ry);
Size radii[] = { cornerRadii, cornerRadii, cornerRadii, cornerRadii };
AppendRoundedRectToPath(pathBuilder, Rect(x, y, width, height), radii);
AppendRoundedRectToPath(aBuilder, Rect(x, y, width, height), radii);
}
return pathBuilder->Finish();
return aBuilder->Finish();
}
} // namespace dom

View File

@ -307,7 +307,7 @@ SVGSVGElement::UnsuspendRedrawAll()
void
SVGSVGElement::ForceRedraw(ErrorResult& rv)
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (!doc) {
rv.Throw(NS_ERROR_FAILURE);
return;
@ -514,7 +514,7 @@ SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
mCurrentTranslate = SVGPoint(x, y);
// now dispatch the appropriate event if we are the root element
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
if (doc) {
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
if (presShell && IsRoot()) {
@ -831,7 +831,8 @@ SVGViewElement*
SVGSVGElement::GetCurrentViewElement() const
{
if (mCurrentViewID) {
nsIDocument* doc = GetCurrentDoc();
//XXXsmaug It is unclear how this should work in case we're in Shadow DOM.
nsIDocument* doc = GetUncomposedDoc();
if (doc) {
Element *element = doc->GetElementById(*mCurrentViewID);
if (element && element->IsSVG(nsGkAtoms::view)) {
@ -874,7 +875,7 @@ SVGSVGElement::GetViewBoxWithSynthesis(
SVGPreserveAspectRatio
SVGSVGElement::GetPreserveAspectRatioWithOverride() const
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
if (doc && doc->IsBeingUsedAsImage()) {
const SVGPreserveAspectRatio *pAROverridePtr = GetPreserveAspectRatioProperty();
if (pAROverridePtr) {
@ -1037,7 +1038,7 @@ SVGSVGElement::ShouldSynthesizeViewBox() const
NS_ABORT_IF_FALSE(!HasViewBoxRect(),
"Should only be called if we lack a viewBox");
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
return doc &&
doc->IsBeingUsedAsImage() &&
!mIsPaintingSVGImageElement &&
@ -1086,7 +1087,7 @@ SVGSVGElement::
SetImageOverridePreserveAspectRatio(const SVGPreserveAspectRatio& aPAR)
{
#ifdef DEBUG
NS_ABORT_IF_FALSE(GetCurrentDoc()->IsBeingUsedAsImage(),
NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(),
"should only override preserveAspectRatio in images");
#endif
@ -1116,7 +1117,7 @@ void
SVGSVGElement::ClearImageOverridePreserveAspectRatio()
{
#ifdef DEBUG
NS_ABORT_IF_FALSE(GetCurrentDoc()->IsBeingUsedAsImage(),
NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(),
"should only override image preserveAspectRatio in images");
#endif
@ -1137,7 +1138,7 @@ void
SVGSVGElement::FlushImageTransformInvalidation()
{
NS_ABORT_IF_FALSE(!GetParent(), "Should only be called on root node");
NS_ABORT_IF_FALSE(GetCurrentDoc()->IsBeingUsedAsImage(),
NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(),
"Should only be called on image documents");
if (mImageNeedsTransformInvalidation) {

View File

@ -85,7 +85,7 @@ SVGStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
void
SVGStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
ShadowRoot* oldShadow = GetContainingShadow();
SVGStyleElementBase::UnbindFromTree(aDeep, aNullParent);
UpdateStyleSheetInternal(oldDoc, oldShadow);

View File

@ -111,7 +111,7 @@ SVGTitleElement::DoneAddingChildren(bool aHaveNotified)
void
SVGTitleElement::SendTitleChangeEvent(bool aBound)
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
if (doc) {
doc->NotifyPossibleTitleChange(aBound);
}

View File

@ -225,7 +225,7 @@ SVGTransformableElement::GetBBox(const SVGBoundingBoxOptions& aOptions,
already_AddRefed<SVGMatrix>
SVGTransformableElement::GetCTM()
{
nsIDocument* currentDoc = GetCurrentDoc();
nsIDocument* currentDoc = GetComposedDoc();
if (currentDoc) {
// Flush all pending notifications so that our frames are up to date
currentDoc->FlushPendingNotifications(Flush_Layout);
@ -238,7 +238,7 @@ SVGTransformableElement::GetCTM()
already_AddRefed<SVGMatrix>
SVGTransformableElement::GetScreenCTM()
{
nsIDocument* currentDoc = GetCurrentDoc();
nsIDocument* currentDoc = GetComposedDoc();
if (currentDoc) {
// Flush all pending notifications so that our frames are up to date
currentDoc->FlushPendingNotifications(Flush_Layout);

View File

@ -269,7 +269,7 @@ SVGUseElement::CreateAnonymousContent()
return nullptr;
if (newcontent->IsSVG(nsGkAtoms::symbol)) {
nsIDocument *document = GetCurrentDoc();
nsIDocument *document = GetComposedDoc();
if (!document)
return nullptr;
@ -392,7 +392,7 @@ SVGUseElement::LookupHref()
nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> baseURI = mOriginal ? mOriginal->GetBaseURI() : GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
GetCurrentDoc(), baseURI);
GetComposedDoc(), baseURI);
mSource.Reset(this, targetURI);
}
@ -400,7 +400,7 @@ SVGUseElement::LookupHref()
void
SVGUseElement::TriggerReclone()
{
nsIDocument *doc = GetCurrentDoc();
nsIDocument *doc = GetComposedDoc();
if (!doc)
return;
nsIPresShell *presShell = doc->GetShell();

View File

@ -15,6 +15,7 @@
#include "nsICSSDeclaration.h"
#include "nsIDocument.h"
#include "nsIDOMMutationEvent.h"
#include "nsSVGPathGeometryElement.h"
#include "mozilla/InternalMutationEvent.h"
#include "nsError.h"
#include "nsIPresShell.h"
@ -1605,6 +1606,8 @@ nsSVGElement::DidChangeLength(uint8_t aAttrEnum,
void
nsSVGElement::DidAnimateLength(uint8_t aAttrEnum)
{
ClearAnyCachedPath();
nsIFrame* frame = GetPrimaryFrame();
if (frame) {
@ -1850,6 +1853,8 @@ nsSVGElement::DidAnimatePointList()
NS_ABORT_IF_FALSE(GetPointListAttrName(),
"Animating non-existent path data?");
ClearAnyCachedPath();
nsIFrame* frame = GetPrimaryFrame();
if (frame) {
@ -1885,6 +1890,8 @@ nsSVGElement::DidAnimatePathSegList()
NS_ABORT_IF_FALSE(GetPathDataAttrName(),
"Animating non-existent path data?");
ClearAnyCachedPath();
nsIFrame* frame = GetPrimaryFrame();
if (frame) {
@ -2705,7 +2712,7 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName)
void
nsSVGElement::AnimationNeedsResample()
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (doc && doc->HasAnimationController()) {
doc->GetAnimationController()->SetResampleNeeded();
}
@ -2714,7 +2721,7 @@ nsSVGElement::AnimationNeedsResample()
void
nsSVGElement::FlushAnimations()
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (doc && doc->HasAnimationController()) {
doc->GetAnimationController()->FlushResampleRequests();
}

View File

@ -33,6 +33,7 @@ class nsSVGIntegerPair;
class nsSVGLength2;
class nsSVGNumber2;
class nsSVGNumberPair;
class nsSVGPathGeometryElement;
class nsSVGString;
class nsSVGViewBox;
@ -313,6 +314,7 @@ public:
return mClassAnimAttr;
}
virtual void ClearAnyCachedPath() {}
virtual nsIDOMNode* AsDOMNode() MOZ_FINAL MOZ_OVERRIDE { return this; }
virtual bool IsTransformable() { return false; }

View File

@ -25,7 +25,7 @@ nsSVGFeatures::HasFeature(nsISupports* aObject, const nsAString& aFeature)
if (aFeature.EqualsLiteral("http://www.w3.org/TR/SVG11/feature#Script")) {
nsCOMPtr<nsIContent> content(do_QueryInterface(aObject));
if (content) {
nsIDocument *doc = content->GetCurrentDoc();
nsIDocument* doc = content->GetUncomposedDoc();
if (doc && doc->IsResourceDoc()) {
// no scripting in SVG images or external resource documents
return false;

View File

@ -8,6 +8,7 @@
#include "gfxPlatform.h"
#include "mozilla/gfx/2D.h"
#include "nsComputedDOMStyle.h"
#include "nsSVGUtils.h"
#include "nsSVGLength2.h"
#include "SVGContentUtils.h"
@ -22,6 +23,19 @@ nsSVGPathGeometryElement::nsSVGPathGeometryElement(already_AddRefed<mozilla::dom
{
}
nsresult
nsSVGPathGeometryElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify)
{
if (mCachedPath &&
aNamespaceID == kNameSpaceID_None &&
AttributeDefinesGeometry(aName)) {
mCachedPath = nullptr;
}
return nsSVGPathGeometryElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aNotify);
}
bool
nsSVGPathGeometryElement::AttributeDefinesGeometry(const nsIAtom *aName)
{
@ -61,29 +75,32 @@ nsSVGPathGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
}
TemporaryRef<Path>
nsSVGPathGeometryElement::GetPathForLengthOrPositionMeasuring()
nsSVGPathGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
FillRule aFillRule)
{
return nullptr;
// We only cache the path if it matches the backend used for screen painting:
bool cacheable = aDrawTarget.GetBackendType() ==
gfxPlatform::GetPlatform()->GetContentBackend();
// Checking for and returning mCachedPath before checking the pref means
// that the pref is only live on page reload (or app restart for SVG in
// chrome). The benefit is that we avoid causing a CPU memory cache miss by
// looking at the global variable that the pref's stored in.
if (cacheable && mCachedPath) {
return mCachedPath;
}
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder(aFillRule);
RefPtr<Path> path = BuildPath(builder);
if (cacheable && NS_SVGPathCachingEnabled()) {
mCachedPath = path;
}
return path.forget();
}
TemporaryRef<PathBuilder>
nsSVGPathGeometryElement::CreatePathBuilder()
TemporaryRef<Path>
nsSVGPathGeometryElement::GetOrBuildPathForMeasuring()
{
RefPtr<DrawTarget> drawTarget =
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
NS_ASSERTION(gfxPlatform::GetPlatform()->
SupportsAzureContentForDrawTarget(drawTarget),
"Should support Moz2D content drawing");
// The fill rule that we pass to CreatePathBuilder must be the current
// computed value of our CSS 'fill-rule' property if the path that we return
// will be used for painting or hit-testing. For all other uses (bounds
// calculatons, length measurement, position-at-offset calculations) the fill
// rule that we pass doesn't matter. As a result we can just pass the current
// computed value regardless of who's calling us, or what they're going to do
// with the path that we return.
return drawTarget->CreatePathBuilder(GetFillRule());
return nullptr;
}
FillRule

View File

@ -31,6 +31,7 @@ typedef mozilla::dom::SVGGraphicsElement nsSVGPathGeometryElementBase;
class nsSVGPathGeometryElement : public nsSVGPathGeometryElementBase
{
protected:
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::gfx::FillRule FillRule;
typedef mozilla::gfx::Float Float;
typedef mozilla::gfx::Path Path;
@ -39,6 +40,17 @@ protected:
public:
explicit nsSVGPathGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
/**
* Causes this element to discard any Path object that GetOrBuildPath may
* have cached.
*/
virtual void ClearAnyCachedPath() MOZ_OVERRIDE MOZ_FINAL {
mCachedPath = nullptr;
}
virtual bool AttributeDefinesGeometry(const nsIAtom *aName);
/**
@ -57,23 +69,44 @@ public:
/**
* Returns a Path that can be used to paint, hit-test or calculate bounds for
* this element. May return nullptr if there is no [valid] path.
* this element. May return nullptr if there is no [valid] path. The path
* that is created may be cached and returned on subsequent calls.
*/
virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) = 0;
virtual mozilla::TemporaryRef<Path> GetPathForLengthOrPositionMeasuring();
virtual mozilla::TemporaryRef<Path> GetOrBuildPath(const DrawTarget& aDrawTarget,
FillRule fillRule);
/**
* Returns a PathBuilder object created using the current computed value of
* the CSS property 'fill-rule' for this element.
* The same as GetOrBuildPath, but bypasses the cache (neither returns any
* previously cached Path, nor caches the Path that in does return).
* this element. May return nullptr if there is no [valid] path.
*/
mozilla::TemporaryRef<PathBuilder> CreatePathBuilder();
virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) = 0;
/**
* Returns a Path that can be used to measure the length of this elements
* path, or to find the position at a given distance along it.
*
* This is currently equivalent to calling GetOrBuildPath, but it may not be
* in the future. The reason for this function to be separate from
* GetOrBuildPath is because SVGPathData::BuildPath inserts small lines into
* the path if zero length subpaths are encountered, in order to implement
* the SVG specifications requirements that zero length subpaths should
* render circles/squares if stroke-linecap is round/square, respectively.
* In principle these inserted lines could interfere with path measurement,
* so we keep callers that are looking to do measurement separate in case we
* run into problems with the inserted lines negatively affecting measuring
* for content.
*/
virtual mozilla::TemporaryRef<Path> GetOrBuildPathForMeasuring();
/**
* Returns the current computed value of the CSS property 'fill-rule' for
* this element.
*/
FillRule GetFillRule();
protected:
mutable mozilla::RefPtr<Path> mCachedPath;
};
#endif

View File

@ -129,12 +129,10 @@ nsSVGPolyElement::BuildPath(PathBuilder* aBuilder)
return nullptr;
}
RefPtr<PathBuilder> pathBuilder = aBuilder ? aBuilder : CreatePathBuilder();
pathBuilder->MoveTo(points[0]);
aBuilder->MoveTo(points[0]);
for (uint32_t i = 1; i < points.Length(); ++i) {
pathBuilder->LineTo(points[i]);
aBuilder->LineTo(points[i]);
}
return pathBuilder->Finish();
return aBuilder->Finish();
}

View File

@ -45,7 +45,7 @@ public:
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) MOZ_OVERRIDE;
virtual bool IsMarkable() MOZ_OVERRIDE { return true; }
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
// WebIDL
already_AddRefed<mozilla::DOMSVGPointList> Points();

View File

@ -500,7 +500,7 @@ nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
EventListenerManager*
nsXULElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer)
{
// XXXbz sXBL/XBL2 issue: should we instead use GetCurrentDoc()
// XXXbz sXBL/XBL2 issue: should we instead use GetComposedDoc()
// here, override BindToTree for those classes and munge event
// listeners there?
nsIDocument* doc = OwnerDoc();
@ -637,8 +637,10 @@ nsXULElement::PerformAccesskey(bool aKeyCausesActivation,
nsAutoString control;
GetAttr(kNameSpaceID_None, nsGkAtoms::control, control);
if (!control.IsEmpty()) {
//XXXsmaug Should we use ShadowRoot::GetElementById in case
// content is in Shadow DOM?
nsCOMPtr<nsIDOMDocument> domDocument =
do_QueryInterface(content->GetCurrentDoc());
do_QueryInterface(content->GetUncomposedDoc());
if (domDocument)
domDocument->GetElementById(control, getter_AddRefs(element));
}
@ -1003,7 +1005,7 @@ nsXULElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
}
nsIDocument* doc;
if (fireSelectionHandler && (doc = GetCurrentDoc())) {
if (fireSelectionHandler && (doc = GetComposedDoc())) {
nsContentUtils::DispatchTrustedEvent(doc,
static_cast<nsIContent*>(this),
NS_LITERAL_STRING("select"),
@ -1017,7 +1019,7 @@ nsXULElement::UnregisterAccessKey(const nsAString& aOldValue)
{
// If someone changes the accesskey, unregister the old one
//
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (doc && !aOldValue.IsEmpty()) {
nsIPresShell *shell = doc->GetShell();
@ -1098,7 +1100,7 @@ nsXULElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
}
nsIDocument *document = GetCurrentDoc();
nsIDocument* document = GetUncomposedDoc();
// Hide chrome if needed
if (mNodeInfo->Equals(nsGkAtoms::window)) {
@ -1173,7 +1175,7 @@ nsXULElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
}
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
if (doc && doc->GetRootElement() == this) {
if ((aName == nsGkAtoms::activetitlebarcolor ||
aName == nsGkAtoms::inactivetitlebarcolor)) {
@ -1309,7 +1311,7 @@ nsXULElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
aVisitor.mAutomaticChromeDispatch = false;
// XXX sXBL/XBL2 issue! Owner or current document?
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(GetCurrentDoc()));
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(GetUncomposedDoc()));
NS_ENSURE_STATE(domDoc);
nsCOMPtr<nsIDOMElement> commandElt;
domDoc->GetElementById(command, getter_AddRefs(commandElt));
@ -1413,7 +1415,7 @@ already_AddRefed<nsIXULTemplateBuilder>
nsXULElement::GetBuilder()
{
// XXX sXBL/XBL2 issue! Owner or current document?
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(GetCurrentDoc());
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(GetUncomposedDoc());
if (!xuldoc) {
return nullptr;
}
@ -1703,7 +1705,7 @@ nsXULElement::Blur(ErrorResult& rv)
if (!ShouldBlur(this))
return;
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (!doc)
return;
@ -1732,7 +1734,7 @@ nsXULElement::ClickWithInputSource(uint16_t aInputSource)
if (BoolAttrIsTrue(nsGkAtoms::disabled))
return NS_OK;
nsCOMPtr<nsIDocument> doc = GetCurrentDoc(); // Strong just in case
nsCOMPtr<nsIDocument> doc = GetComposedDoc(); // Strong just in case
if (doc) {
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
if (shell) {
@ -1774,7 +1776,7 @@ nsXULElement::ClickWithInputSource(uint16_t aInputSource)
NS_IMETHODIMP
nsXULElement::DoCommand()
{
nsCOMPtr<nsIDocument> doc = GetCurrentDoc(); // strong just in case
nsCOMPtr<nsIDocument> doc = GetComposedDoc(); // strong just in case
if (doc) {
nsContentUtils::DispatchXULCommand(this, true);
}
@ -1886,7 +1888,7 @@ nsXULElement::MakeHeavyweight(nsXULPrototypeElement* aPrototype)
nsresult
nsXULElement::HideWindowChrome(bool aShouldHide)
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetUncomposedDoc();
if (!doc || doc->GetRootElement() != this)
return NS_ERROR_UNEXPECTED;
@ -1918,7 +1920,7 @@ nsXULElement::HideWindowChrome(bool aShouldHide)
nsIWidget*
nsXULElement::GetWindowWidget()
{
nsIDocument* doc = GetCurrentDoc();
nsIDocument* doc = GetComposedDoc();
// only top level chrome documents can set the titlebar color
if (doc && doc->IsRootDisplayDocument()) {

View File

@ -1707,7 +1707,7 @@ XULDocument::AddElementToDocumentPost(Element* aElement)
NS_IMETHODIMP
XULDocument::AddSubtreeToDocument(nsIContent* aContent)
{
NS_ASSERTION(aContent->GetCurrentDoc() == this, "Element not in doc!");
NS_ASSERTION(aContent->GetUncomposedDoc() == this, "Element not in doc!");
// From here on we only care about elements.
if (!aContent->IsElement()) {
return NS_OK;
@ -3738,7 +3738,7 @@ XULDocument::CreateTemplateBuilder(nsIContent* aElement)
// return successful if the element is not is a document, as an inline
// script could have removed it
nsIDocument *document = aElement->GetCurrentDoc();
nsIDocument* document = aElement->GetUncomposedDoc();
NS_ENSURE_TRUE(document, NS_OK);
int32_t nameSpaceID;
@ -3878,7 +3878,7 @@ XULDocument::OverlayForwardReference::Resolve()
}
// Check if 'target' is still in our document --- it might not be!
if (!notify && target->GetCurrentDoc() == mDocument) {
if (!notify && target->GetUncomposedDoc() == mDocument) {
// Add child and any descendants to the element map
// XXX this is bogus, the content in 'target' might already be
// in the document

View File

@ -1057,7 +1057,7 @@ nsXULContentBuilder::CreateContainerContents(nsIContent* aElement,
}
if (aNotifyAtEnd && container) {
MOZ_AUTO_DOC_UPDATE(container->GetCurrentDoc(), UPDATE_CONTENT_MODEL,
MOZ_AUTO_DOC_UPDATE(container->GetUncomposedDoc(), UPDATE_CONTENT_MODEL,
true);
nsNodeUtils::ContentAppended(container,
container->GetChildAt(newIndexInContainer),

View File

@ -154,7 +154,7 @@ nsXULTemplateQueryProcessorXML::GetDatasource(nsIArray* aDataSources,
if (!root)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDocument> doc = root->GetCurrentDoc();
nsCOMPtr<nsIDocument> doc = root->GetUncomposedDoc();
if (!doc)
return NS_ERROR_UNEXPECTED;

View File

@ -187,6 +187,7 @@
#include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/MessagePortBinding.h"
#include "mozilla/dom/indexedDB/IDBFactory.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/StructuredCloneTags.h"
@ -6370,6 +6371,14 @@ nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
return rv.ErrorCode();
}
already_AddRefed<Promise>
nsGlobalWindow::Fetch(const RequestOrScalarValueString& aInput,
const RequestInit& aInit, ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return nullptr;
}
void
nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
nsAString& aReturn, ErrorResult& aError)

View File

@ -38,8 +38,10 @@
#include "nsSize.h"
#include "mozFlushType.h"
#include "prclist.h"
#include "mozilla/dom/RequestBinding.h"
#include "mozilla/dom/StorageEvent.h"
#include "mozilla/dom/StorageEventBinding.h"
#include "mozilla/dom/UnionTypes.h"
#include "nsFrameMessageManager.h"
#include "mozilla/LinkedList.h"
#include "mozilla/TimeStamp.h"
@ -107,6 +109,7 @@ class MediaQueryList;
class MozSelfSupport;
class Navigator;
class OwningExternalOrWindowProxy;
class Promise;
class Selection;
class SpeechSynthesis;
class WakeLock;
@ -850,6 +853,9 @@ public:
void Alert(mozilla::ErrorResult& aError);
void Alert(const nsAString& aMessage, mozilla::ErrorResult& aError);
bool Confirm(const nsAString& aMessage, mozilla::ErrorResult& aError);
already_AddRefed<mozilla::dom::Promise> Fetch(const mozilla::dom::RequestOrScalarValueString& aInput,
const mozilla::dom::RequestInit& aInit,
mozilla::ErrorResult& aRv);
void Prompt(const nsAString& aMessage, const nsAString& aInitial,
nsAString& aReturn, mozilla::ErrorResult& aError);
void Print(mozilla::ErrorResult& aError);

View File

@ -883,6 +883,14 @@ DOMInterfaces = {
'nativeType': 'nsDOMCSSRect',
},
'Request': {
'binaryNames': { 'headers': 'headers_' },
},
'Response': {
'binaryNames': { 'headers': 'headers_' },
},
'RGBColor': {
'nativeType': 'nsDOMCSSRGBColor',
},

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