class CSSStyleDeclaration;
class CSSStyleSheet;
class CanvasRenderingContext2D;
+class CanvasRenderingContext2DOrWebGLRenderingContext;
class Chrome;
class Comment;
class ConsoleMessage;
class DocumentType;
class Element;
class ElementDataCache;
+class ElementRegistrationOptions;
class Event;
class EventFactoryBase;
class EventListener;
struct AnnotatedRegionValue;
struct IconURL;
-typedef EventWithHitTestResults<PlatformMouseEvent> MouseEventWithHitTestResults;
-typedef int ExceptionCode;
+using MouseEventWithHitTestResults = EventWithHitTestResults<PlatformMouseEvent>;
+using ExceptionCode = int;
enum StyleResolverUpdateMode {
// Discards the StyleResolver and rebuilds it.
XMLDocumentClass = 1 << 6,
};
-typedef unsigned char DocumentClassFlags;
+using DocumentClassFlags = unsigned char;
class Document;
using SecurityContext::contentSecurityPolicy;
using TreeScope::getElementById;
- virtual bool canContainRangeEndPoint() const OVERRIDE { return true; }
+ virtual bool canContainRangeEndPoint() const override { return true; }
SelectorQueryCache& selectorQueryCache();
void setXMLStandalone(bool, ExceptionState&);
void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = hasXMLDeclaration ? 1 : 0; }
- virtual KURL baseURI() const OVERRIDE FINAL;
+ virtual KURL baseURI() const override final;
String visibilityState() const;
bool hidden() const;
ResourceFetcher* fetcher() { return m_fetcher.get(); }
- virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
- virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
+ virtual void attach(const AttachContext& = AttachContext()) override;
+ virtual void detach(const AttachContext& = AttachContext()) override;
void prepareForDestruction();
// If you have a Document, use renderView() instead which is faster.
DocumentLoader* loader() const;
- void open(Document* ownerDocument = 0, ExceptionState& = ASSERT_NO_EXCEPTION);
+ void open(Document* ownerDocument = nullptr, ExceptionState& = ASSERT_NO_EXCEPTION);
PassRefPtrWillBeRawPtr<DocumentParser> implicitOpen();
// close() is the DOM API document.close()
void cancelParsing();
- void write(const SegmentedString& text, Document* ownerDocument = 0, ExceptionState& = ASSERT_NO_EXCEPTION);
- void write(const String& text, Document* ownerDocument = 0, ExceptionState& = ASSERT_NO_EXCEPTION);
- void writeln(const String& text, Document* ownerDocument = 0, ExceptionState& = ASSERT_NO_EXCEPTION);
+ void write(const SegmentedString& text, Document* ownerDocument = nullptr, ExceptionState& = ASSERT_NO_EXCEPTION);
+ void write(const String& text, Document* ownerDocument = nullptr, ExceptionState& = ASSERT_NO_EXCEPTION);
+ void writeln(const String& text, Document* ownerDocument = nullptr, ExceptionState& = ASSERT_NO_EXCEPTION);
bool wellFormed() const { return m_wellFormed; }
KURL completeURL(const String&) const;
KURL completeURLWithOverride(const String&, const KURL& baseURLOverride) const;
- virtual String userAgent(const KURL&) const OVERRIDE FINAL;
- virtual void disableEval(const String& errorMessage) OVERRIDE FINAL;
+ virtual String userAgent(const KURL&) const override final;
+ virtual void disableEval(const String& errorMessage) override final;
bool canNavigate(const Frame& targetFrame);
LocalFrame* findUnsafeParentScrollPropagationBoundary();
void hoveredNodeDetached(Node*);
void activeChainNodeDetached(Node*);
- void updateHoverActiveState(const HitTestRequest&, Element*, const PlatformMouseEvent* = 0);
+ void updateHoverActiveState(const HitTestRequest&, Element*, const PlatformMouseEvent* = nullptr);
// Updates for :target (CSS3 selector).
void setCSSTarget(Element*);
void unregisterNodeList(const LiveNodeListBase*);
void registerNodeListWithIdNameCache(const LiveNodeListBase*);
void unregisterNodeListWithIdNameCache(const LiveNodeListBase*);
- bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const;
+ bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = nullptr) const;
void invalidateNodeListCaches(const QualifiedName* attrName);
void attachNodeIterator(NodeIterator*);
void processReferrerPolicy(const String& policy);
// Returns the owning element in the parent document.
- // Returns 0 if this is the top level document.
+ // Returns nullptr if this is the top level document.
HTMLFrameOwnerElement* ownerElement() const;
// Returns true if this document belongs to a frame that the parent document
// that as the style for the root element, rather than obtaining it on our own. The reason for
// this is that style may not have been associated with the elements yet - in which case it may
// have been calculated on the fly (without associating it with the actual element) somewhere.
- Element* viewportDefiningElement(RenderStyle* rootStyle = 0) const;
+ Element* viewportDefiningElement(RenderStyle* rootStyle = nullptr) const;
DocumentMarkerController& markers() const { return *m_markers; }
void setDirectionSetOnDocumentElement(bool b) { m_directionSetOnDocumentElement = b; }
void setWritingModeSetOnDocumentElement(bool b) { m_writingModeSetOnDocumentElement = b; }
+ bool containsAnyRareWritingMode() const { return m_containsAnyRareWritingMode; }
+ void setContainsAnyRareWritingMode(bool b) { m_containsAnyRareWritingMode = b; }
+
bool execCommand(const String& command, bool userInterface = false, const String& value = String());
bool queryCommandEnabled(const String& command);
bool queryCommandIndeterm(const String& command);
ScriptRunner* scriptRunner() { return m_scriptRunner.get(); }
- HTMLScriptElement* currentScript() const { return !m_currentScriptStack.isEmpty() ? m_currentScriptStack.last().get() : 0; }
+ HTMLScriptElement* currentScript() const { return !m_currentScriptStack.isEmpty() ? m_currentScriptStack.last().get() : nullptr; }
void pushCurrentScript(PassRefPtrWillBeRawPtr<HTMLScriptElement>);
void popCurrentScript();
void cancelFocusAppearanceUpdate();
// Extension for manipulating canvas drawing contexts for use in CSS
- void getCSSCanvasContext(const String& type, const String& name, int width, int height, RefPtrWillBeRawPtr<CanvasRenderingContext2D>&, RefPtrWillBeRawPtr<WebGLRenderingContext>&);
+ void getCSSCanvasContext(const String& type, const String& name, int width, int height, CanvasRenderingContext2DOrWebGLRenderingContext&);
HTMLCanvasElement& getCSSCanvasElement(const String& name);
bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; }
void parseDNSPrefetchControlHeader(const String&);
// FIXME(crbug.com/305497): This should be removed once LocalDOMWindow is an ExecutionContext.
- virtual void postTask(PassOwnPtr<ExecutionContextTask>) OVERRIDE; // Executes the task on context's thread asynchronously.
+ virtual void postTask(PassOwnPtr<ExecutionContextTask>) override; // Executes the task on context's thread asynchronously.
void postInspectorTask(PassOwnPtr<ExecutionContextTask>);
- virtual void tasksWereSuspended() OVERRIDE FINAL;
- virtual void tasksWereResumed() OVERRIDE FINAL;
- virtual void suspendScheduledTasks() OVERRIDE FINAL;
- virtual void resumeScheduledTasks() OVERRIDE FINAL;
- virtual bool tasksNeedSuspension() OVERRIDE FINAL;
+ virtual void tasksWereSuspended() override final;
+ virtual void tasksWereResumed() override final;
+ virtual void suspendScheduledTasks() override final;
+ virtual void resumeScheduledTasks() override final;
+ virtual bool tasksNeedSuspension() override final;
void finishedParsing();
const Vector<AnnotatedRegionValue>& annotatedRegions() const;
void setAnnotatedRegions(const Vector<AnnotatedRegionValue>&);
- virtual void removeAllEventListeners() OVERRIDE FINAL;
+ virtual void removeAllEventListeners() override final;
const SVGDocumentExtensions* svgExtensions();
SVGDocumentExtensions& accessSVGExtensions();
bool processingLoadEvent() const { return m_loadEventProgress == LoadEventInProgress; }
bool loadEventFinished() const { return m_loadEventProgress >= LoadEventCompleted; }
bool unloadStarted() const { return m_loadEventProgress >= PageHideInProgress; }
+ bool processingBeforeUnload() const { return m_loadEventProgress == BeforeUnloadEventInProgress; }
+ void suppressLoadEvent() { m_loadEventProgress = LoadEventCompleted; }
void setContainsPlugins() { m_containsPlugins = true; }
bool containsPlugins() const { return m_containsPlugins; }
- virtual bool isContextThread() const OVERRIDE FINAL;
- virtual bool isJSExecutionForbidden() const OVERRIDE FINAL { return false; }
+ virtual bool isContextThread() const override final;
+ virtual bool isJSExecutionForbidden() const override final { return false; }
bool containsValidityStyleRules() const { return m_containsValidityStyleRules; }
void setContainsValidityStyleRules() { m_containsValidityStyleRules = true; }
void enqueueAnimationFrameEvent(PassRefPtrWillBeRawPtr<Event>);
// Only one event for a target/event type combination will be dispatched per frame.
void enqueueUniqueAnimationFrameEvent(PassRefPtrWillBeRawPtr<Event>);
- void enqueueMediaQueryChangeListeners(WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener> >&);
+ void enqueueMediaQueryChangeListeners(WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener>>&);
void dispatchEventsForPrinting();
void loadPluginsSoon();
PassRefPtrWillBeRawPtr<Touch> createTouch(LocalDOMWindow*, EventTarget*, int identifier, double pageX, double pageY, double screenX, double screenY, double radiusX, double radiusY, float rotationAngle, float force) const;
- PassRefPtrWillBeRawPtr<TouchList> createTouchList(WillBeHeapVector<RefPtrWillBeMember<Touch> >&) const;
+ PassRefPtrWillBeRawPtr<TouchList> createTouchList(WillBeHeapVector<RefPtrWillBeMember<Touch>>&) const;
const DocumentTiming& timing() const { return m_documentTiming; }
void cancelAnimationFrame(int id);
void serviceScriptedAnimations(double monotonicAnimationStartTime);
- virtual EventTarget* errorEventTarget() OVERRIDE FINAL;
- virtual void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack>) OVERRIDE FINAL;
+ virtual EventTarget* errorEventTarget() override final;
+ virtual void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack>) override final;
void initDNSPrefetch();
PassRefPtrWillBeRawPtr<Element> createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState&);
PassRefPtrWillBeRawPtr<Element> createElementNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& typeExtension, ExceptionState&);
ScriptValue registerElement(ScriptState*, const AtomicString& name, ExceptionState&);
- ScriptValue registerElement(ScriptState*, const AtomicString& name, const Dictionary& options, ExceptionState&, CustomElement::NameSet validNames = CustomElement::StandardNames);
+ ScriptValue registerElement(ScriptState*, const AtomicString& name, const ElementRegistrationOptions&, ExceptionState&, CustomElement::NameSet validNames = CustomElement::StandardNames);
CustomElementRegistrationContext* registrationContext() { return m_registrationContext.get(); }
CustomElementMicrotaskRunQueue* customElementMicrotaskRunQueue();
AnimationTimeline& timeline() const { return *m_timeline; }
CompositorPendingAnimations& compositorPendingAnimations() { return m_compositorPendingAnimations; }
- void addToTopLayer(Element*, const Element* before = 0);
+ void addToTopLayer(Element*, const Element* before = nullptr);
void removeFromTopLayer(Element*);
- const WillBeHeapVector<RefPtrWillBeMember<Element> >& topLayerElements() const { return m_topLayerElements; }
+ const WillBeHeapVector<RefPtrWillBeMember<Element>>& topLayerElements() const { return m_topLayerElements; }
HTMLDialogElement* activeModalDialog() const;
// A non-null m_templateDocumentHost implies that |this| was created by ensureTemplateDocument().
void didAssociateFormControl(Element*);
- virtual void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) OVERRIDE FINAL;
+ virtual void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) override final;
- virtual LocalDOMWindow* executingWindow() OVERRIDE FINAL;
+ virtual LocalDOMWindow* executingWindow() override final;
LocalFrame* executingFrame();
DocumentLifecycleNotifier& lifecycleNotifier();
void maybeHandleHttpRefresh(const String&, HttpRefreshType);
void updateSecurityOrigin(PassRefPtr<SecurityOrigin>);
- PassOwnPtr<LifecycleNotifier<Document> > createLifecycleNotifier();
+ PassOwnPtr<LifecycleNotifier<Document>> createLifecycleNotifier();
void setHasViewportUnits() { m_hasViewportUnits = true; }
bool hasViewportUnits() const { return m_hasViewportUnits; }
void updateStyleInvalidationIfNeeded();
- virtual void trace(Visitor*) OVERRIDE;
+ virtual void trace(Visitor*) override;
bool hasSVGFilterElementsRequiringLayerUpdate() const { return m_layerUpdateSVGFilterElements.size(); }
void didRecalculateStyleForElement() { ++m_styleRecalcElementCounter; }
AtomicString convertLocalName(const AtomicString&);
- virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) OVERRIDE;
- virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper, v8::Isolate*) OVERRIDE;
+ virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override;
+ virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper, v8::Isolate*) override;
protected:
Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass);
- virtual void didUpdateSecurityOrigin() OVERRIDE FINAL;
+ virtual void didUpdateSecurityOrigin() override final;
void clearXMLVersion() { m_xmlVersion = String(); }
#if !ENABLE(OILPAN)
- virtual void dispose() OVERRIDE;
+ virtual void dispose() override;
#endif
virtual PassRefPtrWillBeRawPtr<Document> cloneDocumentWithoutChildren();
bool isElementNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check.
ScriptedAnimationController& ensureScriptedAnimationController();
- virtual SecurityContext& securityContext() OVERRIDE FINAL { return *this; }
- virtual EventQueue* eventQueue() const OVERRIDE FINAL;
+ virtual SecurityContext& securityContext() override final { return *this; }
+ virtual EventQueue* eventQueue() const override final;
// FIXME: Rename the StyleRecalc state to RenderTreeUpdate.
bool hasPendingStyleRecalc() const { return m_lifecycle.state() == DocumentLifecycle::VisualUpdatePending; }
void clearWeakMembers(Visitor*);
- virtual bool isDocument() const OVERRIDE FINAL { return true; }
+ virtual bool isDocument() const override final { return true; }
- virtual void childrenChanged(const ChildrenChange&) OVERRIDE;
+ virtual void childrenChanged(const ChildrenChange&) override;
- virtual String nodeName() const OVERRIDE FINAL;
- virtual NodeType nodeType() const OVERRIDE FINAL;
- virtual bool childTypeAllowed(NodeType) const OVERRIDE FINAL;
- virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) OVERRIDE FINAL;
+ virtual String nodeName() const override final;
+ virtual NodeType nodeType() const override final;
+ virtual bool childTypeAllowed(NodeType) const override final;
+ virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) override final;
void cloneDataFromDocument(const Document&);
#if !ENABLE(OILPAN)
- virtual void refExecutionContext() OVERRIDE FINAL { ref(); }
- virtual void derefExecutionContext() OVERRIDE FINAL { deref(); }
+ virtual void refExecutionContext() override final { ref(); }
+ virtual void derefExecutionContext() override final { deref(); }
#endif
- virtual const KURL& virtualURL() const OVERRIDE FINAL; // Same as url(), but needed for ExecutionContext to implement it without a performance loss for direct calls.
- virtual KURL virtualCompleteURL(const String&) const OVERRIDE FINAL; // Same as completeURL() for the same reason as above.
+ virtual const KURL& virtualURL() const override final; // Same as url(), but needed for ExecutionContext to implement it without a performance loss for direct calls.
+ virtual KURL virtualCompleteURL(const String&) const override final; // Same as completeURL() for the same reason as above.
- virtual void reportBlockedScriptExecutionToInspector(const String& directiveText) OVERRIDE FINAL;
+ virtual void reportBlockedScriptExecutionToInspector(const String& directiveText) override final;
- virtual double timerAlignmentInterval() const OVERRIDE FINAL;
+ virtual double timerAlignmentInterval() const override final;
void updateTitle(const String&);
void updateFocusAppearanceTimerFired(Timer<Document>*);
void setHoverNode(PassRefPtrWillBeRawPtr<Node>);
Node* hoverNode() const { return m_hoverNode.get(); }
- typedef HashSet<OwnPtr<EventFactoryBase> > EventFactorySet;
+ using EventFactorySet = HashSet<OwnPtr<EventFactoryBase>>;
static EventFactorySet& eventFactories();
DocumentLifecycle m_lifecycle;
uint64_t m_domTreeVersion;
static uint64_t s_globalTreeVersion;
- WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> > m_nodeIterators;
- typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<Range> > AttachedRangeSet;
+ WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator>> m_nodeIterators;
+ using AttachedRangeSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Range>>;
AttachedRangeSet m_ranges;
unsigned short m_listenerTypes;
OwnPtrWillBeMember<ScriptRunner> m_scriptRunner;
- WillBeHeapVector<RefPtrWillBeMember<HTMLScriptElement> > m_currentScriptStack;
+ WillBeHeapVector<RefPtrWillBeMember<HTMLScriptElement>> m_currentScriptStack;
OwnPtr<TransformSource> m_transformSource;
RefPtrWillBeMember<Document> m_transformSourceDocument;
InheritedBool m_designMode;
- WillBeHeapHashSet<RawPtrWillBeWeakMember<const LiveNodeListBase> > m_listsInvalidatedAtDocument;
+ WillBeHeapHashSet<RawPtrWillBeWeakMember<const LiveNodeListBase>> m_listsInvalidatedAtDocument;
#if ENABLE(OILPAN)
// Oilpan keeps track of all registered NodeLists.
//
// FIXME: Oilpan: improve - only need to know if a NodeList
// is currently alive or not for the different types.
- HeapHashSet<WeakMember<const LiveNodeListBase> > m_nodeLists[numNodeListInvalidationTypes];
+ HeapHashSet<WeakMember<const LiveNodeListBase>> m_nodeLists[numNodeListInvalidationTypes];
#else
unsigned m_nodeListCounts[numNodeListInvalidationTypes];
#endif
bool m_hasAnnotatedRegions;
bool m_annotatedRegionsDirty;
- WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement> > m_cssCanvasElements;
+ WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement>> m_cssCanvasElements;
OwnPtr<SelectorQueryCache> m_selectorQueryCache;
bool m_hasFullscreenSupplement; // For early return in Fullscreen::fromIfExists()
- WillBeHeapVector<RefPtrWillBeMember<Element> > m_topLayerElements;
+ WillBeHeapVector<RefPtrWillBeMember<Element>> m_topLayerElements;
int m_loadEventDelayCount;
Timer<Document> m_loadEventDelayTimer;
bool m_directionSetOnDocumentElement;
bool m_writingModeSetOnDocumentElement;
+ bool m_containsAnyRareWritingMode;
DocumentTiming m_documentTiming;
RefPtrWillBeMember<MediaQueryMatcher> m_mediaQueryMatcher;
bool m_writeRecursionIsTooDeep;
OwnPtrWillBeMember<ElementDataCache> m_elementDataCache;
- typedef HashMap<AtomicString, OwnPtr<Locale> > LocaleIdentifierToLocaleMap;
+ using LocaleIdentifierToLocaleMap = HashMap<AtomicString, OwnPtr<Locale>>;
LocaleIdentifierToLocaleMap m_localeCache;
AnimationClock m_animationClock;
RawPtrWillBeMember<Document> m_templateDocumentHost;
Timer<Document> m_didAssociateFormControlsTimer;
- WillBeHeapHashSet<RefPtrWillBeMember<Element> > m_associatedFormControls;
+ WillBeHeapHashSet<RefPtrWillBeMember<Element>> m_associatedFormControls;
- WillBeHeapHashSet<RawPtrWillBeMember<SVGUseElement> > m_useElementsNeedingUpdate;
- WillBeHeapHashSet<RawPtrWillBeMember<Element> > m_layerUpdateSVGFilterElements;
+ WillBeHeapHashSet<RawPtrWillBeMember<SVGUseElement>> m_useElementsNeedingUpdate;
+ WillBeHeapHashSet<RawPtrWillBeMember<Element>> m_layerUpdateSVGFilterElements;
bool m_hasViewportUnits;
- typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<DocumentVisibilityObserver> > DocumentVisibilityObserverSet;
+ using DocumentVisibilityObserverSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<DocumentVisibilityObserver>>;
DocumentVisibilityObserverSet m_visibilityObservers;
int m_styleRecalcElementCounter;
Node* eventTargetNodeForDocument(Document*);
+DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true);
+
} // namespace blink
#ifndef NDEBUG