Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1461193003: Revert of [Oilpan] Prepare full definition of classes before using Member (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make patch applicable Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 m_docType = docType; 652 m_docType = docType;
653 if (m_docType) { 653 if (m_docType) {
654 this->adoptIfNeeded(*m_docType); 654 this->adoptIfNeeded(*m_docType);
655 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", TextCaseInsensitive)) 655 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", TextCaseInsensitive))
656 m_isMobileDocument = true; 656 m_isMobileDocument = true;
657 } 657 }
658 // Doctype affects the interpretation of the stylesheets. 658 // Doctype affects the interpretation of the stylesheets.
659 styleEngine().clearResolver(); 659 styleEngine().clearResolver();
660 } 660 }
661 661
662 DocumentType* Document::doctype() const
663 {
664 return m_docType.get();
665 }
666
667 DOMImplementation& Document::implementation() 662 DOMImplementation& Document::implementation()
668 { 663 {
669 if (!m_implementation) 664 if (!m_implementation)
670 m_implementation = DOMImplementation::create(*this); 665 m_implementation = DOMImplementation::create(*this);
671 return *m_implementation; 666 return *m_implementation;
672 } 667 }
673 668
674 Element* Document::documentElement() const
675 {
676 return m_documentElement.get();
677 }
678
679 bool Document::hasAppCacheManifest() const 669 bool Document::hasAppCacheManifest() const
680 { 670 {
681 return isHTMLHtmlElement(documentElement()) && documentElement()->hasAttribu te(manifestAttr); 671 return isHTMLHtmlElement(documentElement()) && documentElement()->hasAttribu te(manifestAttr);
682 } 672 }
683 673
684 Location* Document::location() const 674 Location* Document::location() const
685 { 675 {
686 if (!frame()) 676 if (!frame())
687 return 0; 677 return 0;
688 678
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 if (!registrationContext()) { 775 if (!registrationContext()) {
786 exceptionState.throwDOMException(NotSupportedError, "No element registra tion context is available."); 776 exceptionState.throwDOMException(NotSupportedError, "No element registra tion context is available.");
787 return ScriptValue(); 777 return ScriptValue();
788 } 778 }
789 779
790 CustomElementConstructorBuilder constructorBuilder(scriptState, options); 780 CustomElementConstructorBuilder constructorBuilder(scriptState, options);
791 registrationContext()->registerElement(this, &constructorBuilder, name, vali dNames, exceptionState); 781 registrationContext()->registerElement(this, &constructorBuilder, name, vali dNames, exceptionState);
792 return constructorBuilder.bindingsReturnValue(); 782 return constructorBuilder.bindingsReturnValue();
793 } 783 }
794 784
795 CustomElementRegistrationContext* Document::registrationContext() const
796 {
797 return m_registrationContext.get();
798 }
799
800 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() 785 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue()
801 { 786 {
802 if (!m_customElementMicrotaskRunQueue) 787 if (!m_customElementMicrotaskRunQueue)
803 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat e(); 788 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat e();
804 return m_customElementMicrotaskRunQueue.get(); 789 return m_customElementMicrotaskRunQueue.get();
805 } 790 }
806 791
807 void Document::setImportsController(HTMLImportsController* controller) 792 void Document::setImportsController(HTMLImportsController* controller)
808 { 793 {
809 ASSERT(!m_importsController || !controller); 794 ASSERT(!m_importsController || !controller);
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 } else { 1313 } else {
1329 m_titleElement = titleElement; 1314 m_titleElement = titleElement;
1330 } 1315 }
1331 1316
1332 if (isHTMLTitleElement(m_titleElement)) 1317 if (isHTMLTitleElement(m_titleElement))
1333 updateTitle(toHTMLTitleElement(m_titleElement)->text()); 1318 updateTitle(toHTMLTitleElement(m_titleElement)->text());
1334 else if (isSVGTitleElement(m_titleElement)) 1319 else if (isSVGTitleElement(m_titleElement))
1335 updateTitle(toSVGTitleElement(m_titleElement)->textContent()); 1320 updateTitle(toSVGTitleElement(m_titleElement)->textContent());
1336 } 1321 }
1337 1322
1338 Element* Document::titleElement() const
1339 {
1340 return m_titleElement.get();
1341 }
1342
1343 void Document::removeTitle(Element* titleElement) 1323 void Document::removeTitle(Element* titleElement)
1344 { 1324 {
1345 if (m_titleElement != titleElement) 1325 if (m_titleElement != titleElement)
1346 return; 1326 return;
1347 1327
1348 m_titleElement = nullptr; 1328 m_titleElement = nullptr;
1349 1329
1350 // Update title based on first title element in the document, if one exists. 1330 // Update title based on first title element in the document, if one exists.
1351 if (isHTMLDocument() || isXHTMLDocument()) { 1331 if (isHTMLDocument() || isXHTMLDocument()) {
1352 if (HTMLTitleElement* title = Traversal<HTMLTitleElement>::firstWithin(* this)) 1332 if (HTMLTitleElement* title = Traversal<HTMLTitleElement>::firstWithin(* this))
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 { 1976 {
1997 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::createWit hExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); 1977 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::createWit hExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus));
1998 } 1978 }
1999 1979
2000 void Document::clearFocusedElementSoon() 1980 void Document::clearFocusedElementSoon()
2001 { 1981 {
2002 if (!m_clearFocusedElementTimer.isActive()) 1982 if (!m_clearFocusedElementTimer.isActive())
2003 m_clearFocusedElementTimer.startOneShot(0, BLINK_FROM_HERE); 1983 m_clearFocusedElementTimer.startOneShot(0, BLINK_FROM_HERE);
2004 } 1984 }
2005 1985
2006 Element* Document::focusedElement() const
2007 {
2008 return m_focusedElement.get();
2009 }
2010
2011 void Document::clearFocusedElementTimerFired(Timer<Document>*) 1986 void Document::clearFocusedElementTimerFired(Timer<Document>*)
2012 { 1987 {
2013 updateLayoutTreeIfNeeded(); 1988 updateLayoutTreeIfNeeded();
2014 m_clearFocusedElementTimer.stop(); 1989 m_clearFocusedElementTimer.stop();
2015 1990
2016 if (m_focusedElement && !m_focusedElement->isFocusable()) 1991 if (m_focusedElement && !m_focusedElement->isFocusable())
2017 m_focusedElement->blur(); 1992 m_focusedElement->blur();
2018 } 1993 }
2019 1994
2020 // FIXME: This is a bad idea and needs to be removed eventually. 1995 // FIXME: This is a bad idea and needs to be removed eventually.
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
3038 } 3013 }
3039 3014
3040 void Document::disableEval(const String& errorMessage) 3015 void Document::disableEval(const String& errorMessage)
3041 { 3016 {
3042 if (!frame()) 3017 if (!frame())
3043 return; 3018 return;
3044 3019
3045 frame()->script().disableEval(errorMessage); 3020 frame()->script().disableEval(errorMessage);
3046 } 3021 }
3047 3022
3048 ElementDataCache* Document::elementDataCache() const
3049 {
3050 return m_elementDataCache.get();
3051 }
3052 3023
3053 void Document::didLoadAllImports() 3024 void Document::didLoadAllImports()
3054 { 3025 {
3055 if (!haveStylesheetsLoaded()) 3026 if (!haveStylesheetsLoaded())
3056 return; 3027 return;
3057 if (!importLoader()) 3028 if (!importLoader())
3058 styleResolverMayHaveChanged(); 3029 styleResolverMayHaveChanged();
3059 didLoadAllScriptBlockingResources(); 3030 didLoadAllScriptBlockingResources();
3060 } 3031 }
3061 3032
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 setMimeType(other.contentType()); 3332 setMimeType(other.contentType());
3362 } 3333 }
3363 3334
3364 StyleSheetList* Document::styleSheets() 3335 StyleSheetList* Document::styleSheets()
3365 { 3336 {
3366 if (!m_styleSheetList) 3337 if (!m_styleSheetList)
3367 m_styleSheetList = StyleSheetList::create(this); 3338 m_styleSheetList = StyleSheetList::create(this);
3368 return m_styleSheetList.get(); 3339 return m_styleSheetList.get();
3369 } 3340 }
3370 3341
3371 StyleEngine& Document::styleEngine()
3372 {
3373 ASSERT(m_styleEngine.get());
3374 return *m_styleEngine.get();
3375 }
3376
3377 String Document::preferredStylesheetSet() const 3342 String Document::preferredStylesheetSet() const
3378 { 3343 {
3379 return m_styleEngine->preferredStylesheetSetName(); 3344 return m_styleEngine->preferredStylesheetSetName();
3380 } 3345 }
3381 3346
3382 String Document::selectedStylesheetSet() const 3347 String Document::selectedStylesheetSet() const
3383 { 3348 {
3384 return m_styleEngine->selectedStylesheetSetName(); 3349 return m_styleEngine->selectedStylesheetSetName();
3385 } 3350 }
3386 3351
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3442 void Document::setActiveHoverElement(PassRefPtrWillBeRawPtr<Element> newActiveEl ement) 3407 void Document::setActiveHoverElement(PassRefPtrWillBeRawPtr<Element> newActiveEl ement)
3443 { 3408 {
3444 if (!newActiveElement) { 3409 if (!newActiveElement) {
3445 m_activeHoverElement.clear(); 3410 m_activeHoverElement.clear();
3446 return; 3411 return;
3447 } 3412 }
3448 3413
3449 m_activeHoverElement = newActiveElement; 3414 m_activeHoverElement = newActiveElement;
3450 } 3415 }
3451 3416
3452 Element* Document::activeHoverElement() const
3453 {
3454 return m_activeHoverElement.get();
3455 }
3456
3457 Node* Document::hoverNode() const
3458 {
3459 return m_hoverNode.get();
3460 }
3461
3462 void Document::removeFocusedElementOfSubtree(Node* node, bool amongChildrenOnly) 3417 void Document::removeFocusedElementOfSubtree(Node* node, bool amongChildrenOnly)
3463 { 3418 {
3464 if (!m_focusedElement) 3419 if (!m_focusedElement)
3465 return; 3420 return;
3466 3421
3467 // We can't be focused if we're not in the document. 3422 // We can't be focused if we're not in the document.
3468 if (!node->inDocument()) 3423 if (!node->inDocument())
3469 return; 3424 return;
3470 bool contains = node->containsIncludingShadowDOM(m_focusedElement.get()); 3425 bool contains = node->containsIncludingShadowDOM(m_focusedElement.get());
3471 if (contains && (m_focusedElement != node || !amongChildrenOnly)) 3426 if (contains && (m_focusedElement != node || !amongChildrenOnly))
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
4487 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation)) 4442 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation))
4488 continue; 4443 continue;
4489 if (linkElement->href().isEmpty()) 4444 if (linkElement->href().isEmpty())
4490 continue; 4445 continue;
4491 return linkElement->href(); 4446 return linkElement->href();
4492 } 4447 }
4493 4448
4494 return KURL(); 4449 return KURL();
4495 } 4450 }
4496 4451
4497 HTMLScriptElement* Document::currentScript() const
4498 {
4499 return !m_currentScriptStack.isEmpty() ? m_currentScriptStack.last().get() : nullptr;
4500 }
4501
4502 void Document::pushCurrentScript(PassRefPtrWillBeRawPtr<HTMLScriptElement> newCu rrentScript) 4452 void Document::pushCurrentScript(PassRefPtrWillBeRawPtr<HTMLScriptElement> newCu rrentScript)
4503 { 4453 {
4504 ASSERT(newCurrentScript); 4454 ASSERT(newCurrentScript);
4505 m_currentScriptStack.append(newCurrentScript); 4455 m_currentScriptStack.append(newCurrentScript);
4506 } 4456 }
4507 4457
4508 void Document::popCurrentScript() 4458 void Document::popCurrentScript()
4509 { 4459 {
4510 ASSERT(!m_currentScriptStack.isEmpty()); 4460 ASSERT(!m_currentScriptStack.isEmpty());
4511 m_currentScriptStack.removeLast(); 4461 m_currentScriptStack.removeLast();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4563 if (m_frame) { 4513 if (m_frame) {
4564 #if ENABLE(OILPAN) 4514 #if ENABLE(OILPAN)
4565 return this; 4515 return this;
4566 #else 4516 #else
4567 return m_weakFactory.createWeakPtr(); 4517 return m_weakFactory.createWeakPtr();
4568 #endif 4518 #endif
4569 } 4519 }
4570 return nullptr; 4520 return nullptr;
4571 } 4521 }
4572 4522
4573 ScriptRunner* Document::scriptRunner() const
4574 {
4575 return m_scriptRunner.get();
4576 }
4577
4578 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) 4523 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState)
4579 { 4524 {
4580 if (isHTMLDocument() && name != name.lower()) 4525 if (isHTMLDocument() && name != name.lower())
4581 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); 4526 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase);
4582 return createAttributeNS(nullAtom, name, exceptionState, true); 4527 return createAttributeNS(nullAtom, name, exceptionState, true);
4583 } 4528 }
4584 4529
4585 PassRefPtrWillBeRawPtr<Attr> Document::createAttributeNS(const AtomicString& nam espaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState, bo ol shouldIgnoreNamespaceChecks) 4530 PassRefPtrWillBeRawPtr<Attr> Document::createAttributeNS(const AtomicString& nam espaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState, bo ol shouldIgnoreNamespaceChecks)
4586 { 4531 {
4587 AtomicString prefix, localName; 4532 AtomicString prefix, localName;
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
5636 return; 5581 return;
5637 } 5582 }
5638 if (m_hasAutofocused) 5583 if (m_hasAutofocused)
5639 return; 5584 return;
5640 m_hasAutofocused = true; 5585 m_hasAutofocused = true;
5641 ASSERT(!m_autofocusElement); 5586 ASSERT(!m_autofocusElement);
5642 m_autofocusElement = element; 5587 m_autofocusElement = element;
5643 m_taskRunner->postTask(BLINK_FROM_HERE, AutofocusTask::create()); 5588 m_taskRunner->postTask(BLINK_FROM_HERE, AutofocusTask::create());
5644 } 5589 }
5645 5590
5646 Element* Document::autofocusElement() const
5647 {
5648 return m_autofocusElement.get();
5649 }
5650
5651 Element* Document::activeElement() const 5591 Element* Document::activeElement() const
5652 { 5592 {
5653 if (Element* element = adjustedFocusedElement()) 5593 if (Element* element = adjustedFocusedElement())
5654 return element; 5594 return element;
5655 return body(); 5595 return body();
5656 } 5596 }
5657 5597
5658 bool Document::hasFocus() const 5598 bool Document::hasFocus() const
5659 { 5599 {
5660 return page() && page()->focusController().isDocumentFocused(*this); 5600 return page() && page()->focusController().isDocumentFocused(*this);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
5908 #ifndef NDEBUG 5848 #ifndef NDEBUG
5909 using namespace blink; 5849 using namespace blink;
5910 void showLiveDocumentInstances() 5850 void showLiveDocumentInstances()
5911 { 5851 {
5912 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5852 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5913 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5853 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5914 for (Document* document : set) 5854 for (Document* document : set)
5915 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5855 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5916 } 5856 }
5917 #endif 5857 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/DocumentOrderedMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698