2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-03-30 12:03:04 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Base class for all our document implementations.
|
|
|
|
*/
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsDocument_h___
|
|
|
|
#define nsDocument_h___
|
|
|
|
|
2013-08-22 10:30:44 +04:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
|
2018-03-11 22:07:33 +03:00
|
|
|
#include "jsfriendapi.h"
|
2003-03-26 10:41:30 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCRT.h"
|
1999-08-25 14:51:55 +04:00
|
|
|
#include "nsWeakReference.h"
|
1999-09-21 10:44:56 +04:00
|
|
|
#include "nsWeakPtr.h"
|
2009-03-20 11:15:35 +03:00
|
|
|
#include "nsTArray.h"
|
2017-06-20 16:57:08 +03:00
|
|
|
#include "nsIdentifierMapEntry.h"
|
2016-09-28 22:46:44 +03:00
|
|
|
#include "nsIDOMDocument.h"
|
2004-01-29 00:04:33 +03:00
|
|
|
#include "nsStubDocumentObserver.h"
|
1999-12-03 12:24:22 +03:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
1998-08-28 19:57:59 +04:00
|
|
|
#include "nsIContent.h"
|
1999-08-30 01:58:42 +04:00
|
|
|
#include "nsIPrincipal.h"
|
2005-04-28 20:57:24 +04:00
|
|
|
#include "nsIParser.h"
|
2007-02-17 02:02:08 +03:00
|
|
|
#include "nsBindingManager.h"
|
2017-06-24 20:23:08 +03:00
|
|
|
#include "nsRefPtrHashtable.h"
|
2013-06-18 14:00:38 +04:00
|
|
|
#include "nsJSThingHashtable.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
2002-07-21 03:09:24 +04:00
|
|
|
#include "nsIRadioGroupContainer.h"
|
2005-05-13 00:53:33 +04:00
|
|
|
#include "nsILayoutHistoryState.h"
|
2005-05-13 23:54:28 +04:00
|
|
|
#include "nsIRequest.h"
|
|
|
|
#include "nsILoadGroup.h"
|
2006-06-28 21:36:56 +04:00
|
|
|
#include "nsTObserverArray.h"
|
2006-07-02 11:23:10 +04:00
|
|
|
#include "nsStubMutationObserver.h"
|
2006-10-25 01:47:40 +04:00
|
|
|
#include "nsIChannel.h"
|
2007-01-05 01:31:26 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2008-06-23 03:12:40 +04:00
|
|
|
#include "nsContentList.h"
|
2008-08-18 06:10:28 +04:00
|
|
|
#include "nsGkAtoms.h"
|
2015-09-16 06:49:53 +03:00
|
|
|
#include "PLDHashTable.h"
|
2006-07-29 20:02:11 +04:00
|
|
|
#include "nsDOMAttributeMap.h"
|
2009-07-08 09:23:20 +04:00
|
|
|
#include "imgIRequest.h"
|
2014-04-03 08:18:36 +04:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2015-04-21 04:22:09 +03:00
|
|
|
#include "mozilla/PendingAnimationTracker.h"
|
2017-06-24 20:23:08 +03:00
|
|
|
#include "mozilla/dom/BoxObject.h"
|
2012-12-22 12:27:27 +04:00
|
|
|
#include "mozilla/dom/DOMImplementation.h"
|
2017-05-08 09:24:22 +03:00
|
|
|
#include "mozilla/dom/ScriptLoader.h"
|
2014-04-12 12:15:59 +04:00
|
|
|
#include "mozilla/dom/StyleSheetList.h"
|
2011-08-11 17:29:50 +04:00
|
|
|
#include "nsDataHashtable.h"
|
2011-09-16 03:47:29 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2015-06-19 03:09:52 +03:00
|
|
|
#include "mozilla/LinkedList.h"
|
2016-10-12 10:26:02 +03:00
|
|
|
#include "CustomElementRegistry.h"
|
2016-10-28 17:24:00 +03:00
|
|
|
#include "mozilla/dom/Performance.h"
|
2017-03-10 21:50:21 +03:00
|
|
|
#include "mozilla/Maybe.h"
|
2017-08-14 09:05:23 +03:00
|
|
|
#include "nsIURIClassifier.h"
|
2011-06-23 14:39:48 +04:00
|
|
|
|
2003-04-19 04:28:09 +04:00
|
|
|
#define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0)
|
|
|
|
#define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1)
|
|
|
|
#define XML_DECLARATION_BITS_STANDALONE_EXISTS (1 << 2)
|
|
|
|
#define XML_DECLARATION_BITS_STANDALONE_YES (1 << 3)
|
|
|
|
|
|
|
|
|
2007-01-11 22:32:31 +03:00
|
|
|
class nsDOMStyleSheetSetList;
|
1999-04-01 00:49:25 +04:00
|
|
|
class nsDocument;
|
2002-07-21 03:09:24 +04:00
|
|
|
class nsIRadioVisitor;
|
|
|
|
class nsIFormControl;
|
|
|
|
struct nsRadioGroupStruct;
|
2005-05-13 23:54:28 +04:00
|
|
|
class nsOnloadBlocker;
|
2011-06-23 14:39:48 +04:00
|
|
|
class nsDOMNavigationTiming;
|
2012-02-02 01:58:01 +04:00
|
|
|
class nsWindowSizes;
|
2012-03-24 15:34:42 +04:00
|
|
|
class nsHtml5TreeOpExecutor;
|
2013-01-24 13:09:06 +04:00
|
|
|
class nsDocumentOnStack;
|
2013-07-26 19:37:03 +04:00
|
|
|
class nsISecurityConsoleMessage;
|
2005-08-11 00:21:44 +04:00
|
|
|
|
2013-01-04 10:54:26 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:19 +04:00
|
|
|
class EventChainPreVisitor;
|
2013-01-04 10:54:26 +04:00
|
|
|
namespace dom {
|
2016-10-13 10:04:15 +03:00
|
|
|
class ImageTracker;
|
2014-06-19 04:57:51 +04:00
|
|
|
struct LifecycleCallbacks;
|
2014-02-24 01:01:26 +04:00
|
|
|
class CallbackFunction;
|
2016-10-28 17:24:00 +03:00
|
|
|
class DOMIntersectionObserver;
|
|
|
|
class Performance;
|
2015-06-19 03:09:52 +03:00
|
|
|
|
|
|
|
struct FullscreenRequest : public LinkedListElement<FullscreenRequest>
|
|
|
|
{
|
|
|
|
explicit FullscreenRequest(Element* aElement);
|
2015-08-27 04:21:29 +03:00
|
|
|
FullscreenRequest(const FullscreenRequest&) = delete;
|
2015-06-19 03:09:52 +03:00
|
|
|
~FullscreenRequest();
|
|
|
|
|
2015-06-19 03:09:52 +03:00
|
|
|
Element* GetElement() const { return mElement; }
|
2018-03-10 08:15:28 +03:00
|
|
|
nsIDocument* GetDocument() const { return mDocument; }
|
2015-06-19 03:09:52 +03:00
|
|
|
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<Element> mElement;
|
2018-03-10 08:15:28 +03:00
|
|
|
RefPtr<nsIDocument> mDocument;
|
2015-06-19 03:09:52 +03:00
|
|
|
|
2015-06-19 03:09:52 +03:00
|
|
|
public:
|
2015-06-19 03:09:52 +03:00
|
|
|
// This value should be true if the fullscreen request is
|
|
|
|
// originated from chrome code.
|
|
|
|
bool mIsCallerChrome = false;
|
|
|
|
// This value denotes whether we should trigger a NewOrigin event if
|
|
|
|
// requesting fullscreen in its document causes the origin which is
|
|
|
|
// fullscreen to change. We may want *not* to trigger that event if
|
|
|
|
// we're calling RequestFullScreen() as part of a continuation of a
|
|
|
|
// request in a subdocument in different process, whereupon the caller
|
|
|
|
// need to send some notification itself with the real origin.
|
|
|
|
bool mShouldNotifyNewOrigin = true;
|
|
|
|
};
|
2015-07-13 18:25:42 +03:00
|
|
|
|
2015-06-19 03:09:52 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2013-01-04 10:54:26 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsOnloadBlocker final : public nsIRequest
|
2005-05-13 23:54:28 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsOnloadBlocker() {}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIREQUEST
|
|
|
|
|
|
|
|
private:
|
|
|
|
~nsOnloadBlocker() {}
|
|
|
|
};
|
2002-04-17 08:17:16 +04:00
|
|
|
|
2001-10-26 06:23:56 +04:00
|
|
|
// Base class for our document implementations.
|
2003-03-26 10:41:30 +03:00
|
|
|
class nsDocument : public nsIDocument,
|
2016-09-28 22:46:44 +03:00
|
|
|
public nsIDOMDocument,
|
1999-09-21 18:18:52 +04:00
|
|
|
public nsSupportsWeakReference,
|
2002-07-21 03:09:24 +04:00
|
|
|
public nsIScriptObjectPrincipal,
|
2011-07-19 13:44:55 +04:00
|
|
|
public nsIRadioGroupContainer,
|
2008-08-27 03:09:02 +04:00
|
|
|
public nsIApplicationCacheContainer,
|
2018-02-05 08:05:45 +03:00
|
|
|
public nsStubMutationObserver
|
1998-12-18 20:34:34 +03:00
|
|
|
{
|
2014-05-24 22:46:38 +04:00
|
|
|
friend class nsIDocument;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2010-06-23 13:31:35 +04:00
|
|
|
typedef mozilla::dom::Element Element;
|
2015-01-05 20:42:31 +03:00
|
|
|
typedef mozilla::net::ReferrerPolicy ReferrerPolicy;
|
2010-06-23 13:31:35 +04:00
|
|
|
|
2007-01-05 01:31:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2012-02-02 01:58:01 +04:00
|
|
|
|
Bug 1387956 - Overhaul ComputedValues measurement, and add style structs measurement. r=bholley.
This patch moves measurement of ComputedValues objects from Rust to C++.
Measurement now happens (a) via DOM elements and (b) remaining elements via
the frame tree. Likewise for the style structs hanging off ComputedValues
objects.
Here is an example of the output.
> ├──27,600,448 B (26.49%) -- active/window(https://en.wikipedia.org/wiki/Barack_Obama)
> │ ├──12,772,544 B (12.26%) -- layout
> │ │ ├───4,483,744 B (04.30%) -- frames
> │ │ │ ├──1,653,552 B (01.59%) ── nsInlineFrame
> │ │ │ ├──1,415,760 B (01.36%) ── nsTextFrame
> │ │ │ ├────431,376 B (00.41%) ── nsBlockFrame
> │ │ │ ├────340,560 B (00.33%) ── nsHTMLScrollFrame
> │ │ │ ├────302,544 B (00.29%) ── nsContinuingTextFrame
> │ │ │ ├────156,408 B (00.15%) ── nsBulletFrame
> │ │ │ ├─────73,024 B (00.07%) ── nsPlaceholderFrame
> │ │ │ ├─────27,656 B (00.03%) ── sundries
> │ │ │ ├─────23,520 B (00.02%) ── nsTableCellFrame
> │ │ │ ├─────16,704 B (00.02%) ── nsImageFrame
> │ │ │ ├─────15,488 B (00.01%) ── nsTableRowFrame
> │ │ │ ├─────13,776 B (00.01%) ── nsTableColFrame
> │ │ │ └─────13,376 B (00.01%) ── nsTableFrame
> │ │ ├───3,412,192 B (03.28%) -- servo-style-structs
> │ │ │ ├──1,288,224 B (01.24%) ── Display
> │ │ │ ├────742,400 B (00.71%) ── Position
> │ │ │ ├────308,736 B (00.30%) ── Font
> │ │ │ ├────226,512 B (00.22%) ── Background
> │ │ │ ├────218,304 B (00.21%) ── TextReset
> │ │ │ ├────214,896 B (00.21%) ── Text
> │ │ │ ├────130,560 B (00.13%) ── Border
> │ │ │ ├─────81,408 B (00.08%) ── UIReset
> │ │ │ ├─────61,440 B (00.06%) ── Padding
> │ │ │ ├─────38,176 B (00.04%) ── UserInterface
> │ │ │ ├─────29,232 B (00.03%) ── Margin
> │ │ │ ├─────21,824 B (00.02%) ── sundries
> │ │ │ ├─────20,080 B (00.02%) ── Color
> │ │ │ ├─────20,080 B (00.02%) ── Column
> │ │ │ └─────10,320 B (00.01%) ── Effects
> │ │ ├───2,227,680 B (02.14%) -- computed-values
> │ │ │ ├──1,182,928 B (01.14%) ── non-dom
> │ │ │ └──1,044,752 B (01.00%) ── dom
> │ │ ├───1,500,016 B (01.44%) ── text-runs
> │ │ ├─────492,640 B (00.47%) ── line-boxes
> │ │ ├─────326,688 B (00.31%) ── frame-properties
> │ │ ├─────301,760 B (00.29%) ── pres-shell
> │ │ ├──────27,648 B (00.03%) ── pres-contexts
> │ │ └─────────176 B (00.00%) ── style-sets
The 'servo-style-structs' and 'computed-values' sub-trees are new. (Prior to
this patch, ComputedValues under DOM elements were tallied under the the
'dom/element-nodes' sub-tree, and ComputedValues not under DOM element were
ignored.) 'servo-style-structs/sundries' aggregates all the style structs that
are smaller than 8 KiB.
Other notable things done by the patch are as follows.
- It significantly changes the signatures of the methods measuring nsINode and
its subclasses, in order to handle the tallying of style structs separately
from element-nodes. Likewise for nsIFrame.
- It renames the 'layout/style-structs' sub-tree as
'layout/gecko-style-structs', to clearly distinguish it from the new
'layout/servo-style-structs' sub-tree.
- It adds some FFI functions to access various Rust-side data structures from
C++ code.
- There is a nasty hack used twice to measure Arcs, by stepping backwards from
an interior pointer to a base pointer. It works, but I want to replace it
with something better eventually. The "XXX WARNING" comments have details.
- It makes DMD print a line to the console if it sees a pointer it doesn't
recognise. This is useful for detecting when we are measuring an interior
pointer instead of a base pointer, which is bad but easy to do when Arcs are
involved.
- It removes the Rust code for measuring CVs, because it's now all done on the
C++ side.
MozReview-Commit-ID: BKebACLKtCi
--HG--
extra : rebase_source : 4d9a8c6b198a0ff025b811759a6bfa9f33a260ba
2017-08-11 09:37:33 +03:00
|
|
|
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2006-01-27 04:03:06 +03:00
|
|
|
// StartDocumentLoad is pure virtual so that subclasses must override it.
|
|
|
|
// The nsDocument StartDocumentLoad does some setup, but does NOT set
|
|
|
|
// *aDocListener; this is the job of subclasses.
|
2004-01-10 02:54:21 +03:00
|
|
|
virtual nsresult StartDocumentLoad(const char* aCommand,
|
|
|
|
nsIChannel* aChannel,
|
|
|
|
nsILoadGroup* aLoadGroup,
|
|
|
|
nsISupports* aContainer,
|
|
|
|
nsIStreamListener **aDocListener,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aReset = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIContentSink* aContentSink = nullptr) override = 0;
|
1999-01-06 03:32:41 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void StopDocumentLoad() override;
|
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me
[1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner
[2] Cutting down the size of content. Made nsITextContent inherit from nsIContent.
[3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done.
dom/public/nsDOMPropEnums.h,v - bug 12559
dom/public/nsIJSScriptObject.h,v - [1]
dom/public/html/MANIFEST,v - bug 12559
dom/public/html/Makefile.in,v - bug 12559
dom/public/html/makefile.win,v - bug 12559
dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544
dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559
dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559
dom/public/idl/html/HTMLInputElement.idl,v - bug 17544
dom/src/base/nsGlobalWindow.cpp,v - bug 30700
dom/src/base/nsGlobalWindow.h,v - [1]
dom/src/base/nsLocation.cpp,v - [1]
dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544
layout/base/public/nsIDocument.h,v - bug 27953
layout/base/public/nsITextContent.h,v - [2]
layout/base/src/nsCommentNode.cpp,v - [2]
layout/base/src/nsDocument.cpp,v - bug 27953
layout/base/src/nsDocument.h,v - bug 27953
layout/base/src/nsDocumentViewer.cpp,v - bug 27953
layout/base/src/nsGenericDOMDataNode.cpp,v - [3]
layout/base/src/nsGenericDOMDataNode.h,v - [3]
layout/base/src/nsGenericElement.cpp,v - [3]
layout/base/src/nsGenericElement.h,v - [3]
layout/base/src/nsNameSpaceManager.cpp,v - bug 7834
layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow
layout/base/src/nsTextNode.cpp,v - [2]
layout/events/src/nsEventListenerManager.cpp,v - [3]
layout/events/src/nsEventListenerManager.h,v - [3]
layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString
layout/html/content/src/nsAttributeContent.cpp,v - [2]
layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLModElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3]
layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953
layout/html/document/src/nsHTMLDocument.h,v - bug 27953
layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2]
layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2]
layout/xml/content/src/nsXMLElement.h,v - [1][2]
layout/xml/content/src/nsXMLEntity.cpp,v - [1][2]
layout/xml/content/src/nsXMLNotation.cpp,v - [1][2]
layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2]
layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString
layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString
netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString
rdf/content/src/nsXULDocument.cpp,v - bug 27953
rdf/content/src/nsXULDocument.h,v - bug 27953
rdf/content/src/nsXULElement.h,v - [1]
xpcom/base/IIDS.h,v - bug 12559
2000-03-17 16:27:00 +03:00
|
|
|
|
2018-03-05 11:20:34 +03:00
|
|
|
static bool CallerIsTrustedAboutPage(JSContext* aCx, JSObject* aObject);
|
2016-04-18 03:16:04 +03:00
|
|
|
static bool IsElementAnimateEnabled(JSContext* aCx, JSObject* aObject);
|
2015-01-08 07:53:24 +03:00
|
|
|
static bool IsWebAnimationsEnabled(JSContext* aCx, JSObject* aObject);
|
2017-11-20 08:18:43 +03:00
|
|
|
static bool IsWebAnimationsEnabled(mozilla::dom::CallerType aCallerType);
|
2014-05-13 11:22:12 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void EndUpdate(nsUpdateType aUpdateType) override;
|
|
|
|
virtual void BeginLoad() override;
|
|
|
|
virtual void EndLoad() override;
|
2009-01-09 20:12:09 +03:00
|
|
|
|
2002-07-21 03:09:24 +04:00
|
|
|
// nsIRadioGroupContainer
|
|
|
|
NS_IMETHOD WalkRadioGroup(const nsAString& aName,
|
2006-02-08 08:56:13 +03:00
|
|
|
nsIRadioVisitor* aVisitor,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aFlushContent) override;
|
2013-08-10 05:17:51 +04:00
|
|
|
virtual void
|
|
|
|
SetCurrentRadioButton(const nsAString& aName,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::dom::HTMLInputElement* aRadio) override;
|
2013-08-10 05:17:51 +04:00
|
|
|
virtual mozilla::dom::HTMLInputElement*
|
2015-03-21 19:28:04 +03:00
|
|
|
GetCurrentRadioButton(const nsAString& aName) override;
|
2013-08-10 05:17:51 +04:00
|
|
|
NS_IMETHOD
|
|
|
|
GetNextRadioButton(const nsAString& aName,
|
|
|
|
const bool aPrevious,
|
|
|
|
mozilla::dom::HTMLInputElement* aFocusedRadio,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::dom::HTMLInputElement** aRadioOut) override;
|
2012-08-03 14:38:52 +04:00
|
|
|
virtual void AddToRadioGroup(const nsAString& aName,
|
2017-08-03 09:39:00 +03:00
|
|
|
mozilla::dom::HTMLInputElement* aRadio) override;
|
2012-08-03 14:38:52 +04:00
|
|
|
virtual void RemoveFromRadioGroup(const nsAString& aName,
|
2017-08-03 09:39:00 +03:00
|
|
|
mozilla::dom::HTMLInputElement* aRadio) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t GetRequiredRadioCount(const nsAString& aName) const override;
|
2014-11-28 04:40:00 +03:00
|
|
|
virtual void RadioRequiredWillChange(const nsAString& aName,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aRequiredAdded) override;
|
|
|
|
virtual bool GetValueMissingState(const nsAString& aName) const override;
|
|
|
|
virtual void SetValueMissingState(const nsAString& aName, bool aValue) override;
|
2003-03-26 10:41:30 +03:00
|
|
|
|
2002-07-21 03:09:24 +04:00
|
|
|
// for radio group
|
2012-08-04 11:44:00 +04:00
|
|
|
nsRadioGroupStruct* GetRadioGroup(const nsAString& aName) const;
|
|
|
|
nsRadioGroupStruct* GetOrCreateRadioGroup(const nsAString& aName);
|
2002-07-21 03:09:24 +04:00
|
|
|
|
2018-01-16 12:42:00 +03:00
|
|
|
// Check whether shadow DOM is enabled for the global of aObject.
|
|
|
|
static bool IsShadowDOMEnabled(JSContext* aCx, JSObject* aObject);
|
|
|
|
// Check whether shadow DOM is enabled for the document this node belongs to.
|
|
|
|
static bool IsShadowDOMEnabled(const nsINode* aNode);
|
2012-08-04 11:44:00 +04:00
|
|
|
|
|
|
|
public:
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
// nsIDOMDocument
|
|
|
|
NS_DECL_NSIDOMDOCUMENT
|
2001-10-26 06:23:56 +04:00
|
|
|
|
2017-12-21 01:29:21 +03:00
|
|
|
using mozilla::dom::DocumentOrShadowRoot::GetElementById;
|
|
|
|
using mozilla::dom::DocumentOrShadowRoot::GetElementsByTagName;
|
|
|
|
using mozilla::dom::DocumentOrShadowRoot::GetElementsByTagNameNS;
|
|
|
|
using mozilla::dom::DocumentOrShadowRoot::GetElementsByClassName;
|
2017-12-20 08:46:01 +03:00
|
|
|
|
2018-04-05 20:42:41 +03:00
|
|
|
// EventTarget
|
|
|
|
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager*
|
2015-03-21 19:28:04 +03:00
|
|
|
GetOrCreateListenerManager() override;
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager*
|
2015-03-21 19:28:04 +03:00
|
|
|
GetExistingListenerManager() const override;
|
1999-03-29 02:22:54 +04:00
|
|
|
|
2003-10-22 10:09:48 +04:00
|
|
|
// nsIScriptObjectPrincipal
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIPrincipal* GetPrincipal() override;
|
2003-10-22 10:09:48 +04:00
|
|
|
|
2008-08-27 03:09:02 +04:00
|
|
|
// nsIApplicationCacheContainer
|
|
|
|
NS_DECL_NSIAPPLICATIONCACHECONTAINER
|
|
|
|
|
2002-01-25 09:37:35 +03:00
|
|
|
virtual nsresult Init();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Destroy() override;
|
|
|
|
virtual void RemovedFromDocShell() override;
|
2005-05-05 00:22:32 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void BlockOnload() override;
|
|
|
|
virtual void UnblockOnload(bool aFireSync) override;
|
2005-05-13 23:54:28 +04:00
|
|
|
|
2012-01-31 00:08:13 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDocument,
|
|
|
|
nsIDocument)
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetLoadedAsData(bool aLoadedAsData) { mLoadedAsData = aLoadedAsData; }
|
2011-11-04 00:39:08 +04:00
|
|
|
void SetLoadedAsInteractiveData(bool aLoadedAsInteractiveData)
|
|
|
|
{
|
|
|
|
mLoadedAsInteractiveData = aLoadedAsInteractiveData;
|
|
|
|
}
|
2008-09-18 15:15:47 +04:00
|
|
|
|
2017-04-20 22:57:48 +03:00
|
|
|
nsresult CloneDocHelper(nsDocument* clone, bool aPreallocateChildren) const;
|
2008-09-18 15:15:47 +04:00
|
|
|
|
2010-04-27 13:48:52 +04:00
|
|
|
// Only BlockOnload should call this!
|
|
|
|
void AsyncBlockOnload();
|
|
|
|
|
2017-08-10 07:13:22 +03:00
|
|
|
virtual void DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const override;
|
2013-10-01 03:20:23 +04:00
|
|
|
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
|
2012-01-03 06:19:14 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIDOMNode* AsDOMNode() override { return this; }
|
2012-12-22 12:27:27 +04:00
|
|
|
|
1998-07-18 03:00:54 +04:00
|
|
|
protected:
|
2009-09-10 17:23:40 +04:00
|
|
|
friend class nsNodeUtils;
|
2008-06-23 03:12:40 +04:00
|
|
|
|
2004-01-29 23:52:06 +03:00
|
|
|
void RetrieveRelevantHeaders(nsIChannel *aChannel);
|
2003-04-19 20:53:44 +04:00
|
|
|
|
2013-01-18 18:27:03 +04:00
|
|
|
void TryChannelCharset(nsIChannel *aChannel,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t& aCharsetSource,
|
2017-06-18 14:37:50 +03:00
|
|
|
NotNull<const Encoding*>& aEncoding,
|
2012-03-24 15:34:42 +04:00
|
|
|
nsHtml5TreeOpExecutor* aExecutor);
|
2009-09-25 20:50:26 +04:00
|
|
|
|
|
|
|
nsIContent* GetFirstBaseNodeWithHref();
|
|
|
|
nsresult SetFirstBaseNodeWithHref(nsIContent *node);
|
|
|
|
|
2017-12-06 07:26:32 +03:00
|
|
|
#define NS_DOCUMENT_NOTIFY_OBSERVERS(func_, params_) do { \
|
|
|
|
NS_OBSERVER_ARRAY_NOTIFY_XPCOM_OBSERVERS(mObservers, nsIDocumentObserver, \
|
|
|
|
func_, params_); \
|
|
|
|
/* FIXME(emilio): Apparently we can keep observing from the BFCache? That \
|
|
|
|
looks bogus. */ \
|
|
|
|
if (nsIPresShell* shell = GetObservingShell()) { \
|
|
|
|
shell->func_ params_; \
|
|
|
|
} \
|
|
|
|
} while(0)
|
2013-04-22 05:25:28 +04:00
|
|
|
|
2006-03-23 11:21:21 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
void VerifyRootContentState();
|
|
|
|
#endif
|
|
|
|
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit nsDocument(const char* aContentType);
|
2003-03-26 10:41:30 +03:00
|
|
|
virtual ~nsDocument();
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2014-02-24 01:01:26 +04:00
|
|
|
public:
|
2018-03-11 22:07:33 +03:00
|
|
|
// FIXME(emilio): This needs to be here instead of in nsIDocument because Rust
|
|
|
|
// can't represent alignas(8) values on 32-bit architectures, which would
|
|
|
|
// cause nsIDocument's layout to be wrong in the Rust side.
|
|
|
|
//
|
|
|
|
// This can be fixed after updating to rust 1.25 and updating bindgen to
|
|
|
|
// include https://github.com/rust-lang-nursery/rust-bindgen/pull/1271.
|
|
|
|
js::ExpandoAndGeneration mExpandoAndGeneration;
|
|
|
|
|
2007-09-27 22:17:32 +04:00
|
|
|
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
|
2002-07-21 03:09:24 +04:00
|
|
|
|
2013-03-24 14:32:44 +04:00
|
|
|
friend class nsCallRequestFullScreen;
|
|
|
|
|
2008-08-27 03:09:02 +04:00
|
|
|
// The application cache that this document is associated with, if
|
|
|
|
// any. This can change during the lifetime of the document.
|
|
|
|
nsCOMPtr<nsIApplicationCache> mApplicationCache;
|
|
|
|
|
2009-09-25 20:50:26 +04:00
|
|
|
nsCOMPtr<nsIContent> mFirstBaseNodeWithHref;
|
2008-02-21 23:39:20 +03:00
|
|
|
private:
|
2006-05-10 21:30:15 +04:00
|
|
|
friend class nsUnblockOnloadEvent;
|
|
|
|
|
2001-01-25 17:19:38 +03:00
|
|
|
// These are not implemented and not supported.
|
|
|
|
nsDocument(const nsDocument& aOther);
|
|
|
|
nsDocument& operator=(const nsDocument& aOther);
|
2008-08-18 06:10:28 +04:00
|
|
|
};
|
2008-08-16 15:27:40 +04:00
|
|
|
|
2013-01-24 13:09:06 +04:00
|
|
|
class nsDocumentOnStack
|
|
|
|
{
|
|
|
|
public:
|
2018-03-06 19:59:45 +03:00
|
|
|
explicit nsDocumentOnStack(nsIDocument* aDoc) : mDoc(aDoc)
|
2013-01-24 13:09:06 +04:00
|
|
|
{
|
|
|
|
mDoc->IncreaseStackRefCnt();
|
|
|
|
}
|
|
|
|
~nsDocumentOnStack()
|
|
|
|
{
|
|
|
|
mDoc->DecreaseStackRefCnt();
|
|
|
|
}
|
|
|
|
private:
|
2018-03-06 19:59:45 +03:00
|
|
|
nsIDocument* mDoc;
|
2013-01-24 13:09:06 +04:00
|
|
|
};
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif /* nsDocument_h___ */
|