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

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

Issue 14839007: Devirtualize Document class type checking (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Try again Created 7 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/html/HTMLDocument.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 static void printNavigationErrorMessage(Frame* frame, const KURL& activeURL, con st char* reason) 366 static void printNavigationErrorMessage(Frame* frame, const KURL& activeURL, con st char* reason)
367 { 367 {
368 String message = "Unsafe JavaScript attempt to initiate navigation for frame with URL '" + frame->document()->url().string() + "' from frame with URL '" + a ctiveURL.string() + "'. " + reason + "\n"; 368 String message = "Unsafe JavaScript attempt to initiate navigation for frame with URL '" + frame->document()->url().string() + "' from frame with URL '" + a ctiveURL.string() + "'. " + reason + "\n";
369 369
370 // FIXME: should we print to the console of the document performing the navi gation instead? 370 // FIXME: should we print to the console of the document performing the navi gation instead?
371 frame->document()->domWindow()->printErrorMessage(message); 371 frame->document()->domWindow()->printErrorMessage(message);
372 } 372 }
373 373
374 uint64_t Document::s_globalTreeVersion = 0; 374 uint64_t Document::s_globalTreeVersion = 0;
375 375
376 Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) 376 Document::Document(Frame* frame, const KURL& url, unsigned documentClass)
377 : ContainerNode(0, CreateDocument) 377 : ContainerNode(0, CreateDocument)
378 , TreeScope(this) 378 , TreeScope(this)
379 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimer Fired) 379 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimer Fired)
380 , m_lastStyleResolverAccessTime(0) 380 , m_lastStyleResolverAccessTime(0)
381 , m_activeParserCount(0) 381 , m_activeParserCount(0)
382 , m_contextFeatures(ContextFeatures::defaultSwitch()) 382 , m_contextFeatures(ContextFeatures::defaultSwitch())
383 , m_compatibilityMode(NoQuirksMode) 383 , m_compatibilityMode(NoQuirksMode)
384 , m_compatibilityModeLocked(false) 384 , m_compatibilityModeLocked(false)
385 , m_domTreeVersion(++s_globalTreeVersion) 385 , m_domTreeVersion(++s_globalTreeVersion)
386 , m_mutationObserverTypes(0) 386 , m_mutationObserverTypes(0)
(...skipping 14 matching lines...) Expand all
401 , m_scriptRunner(ScriptRunner::create(this)) 401 , m_scriptRunner(ScriptRunner::create(this))
402 , m_xmlVersion("1.0") 402 , m_xmlVersion("1.0")
403 , m_xmlStandalone(StandaloneUnspecified) 403 , m_xmlStandalone(StandaloneUnspecified)
404 , m_hasXMLDeclaration(0) 404 , m_hasXMLDeclaration(0)
405 , m_designMode(inherit) 405 , m_designMode(inherit)
406 , m_hasAnnotatedRegions(false) 406 , m_hasAnnotatedRegions(false)
407 , m_annotatedRegionsDirty(false) 407 , m_annotatedRegionsDirty(false)
408 , m_createRenderers(true) 408 , m_createRenderers(true)
409 , m_accessKeyMapValid(false) 409 , m_accessKeyMapValid(false)
410 , m_useSecureKeyboardEntryWhenActive(false) 410 , m_useSecureKeyboardEntryWhenActive(false)
411 , m_isXHTML(isXHTML) 411 , m_documentClass(documentClass)
412 , m_isHTML(isHTML)
413 , m_isViewSource(false) 412 , m_isViewSource(false)
414 , m_sawElementsInKnownNamespaces(false) 413 , m_sawElementsInKnownNamespaces(false)
415 , m_isSrcdocDocument(false) 414 , m_isSrcdocDocument(false)
416 , m_renderer(0) 415 , m_renderer(0)
417 , m_eventQueue(DocumentEventQueue::create(this)) 416 , m_eventQueue(DocumentEventQueue::create(this))
418 , m_weakFactory(this) 417 , m_weakFactory(this)
419 , m_idAttributeName(idAttr) 418 , m_idAttributeName(idAttr)
420 , m_areKeysEnabledInFullScreen(0) 419 , m_areKeysEnabledInFullScreen(0)
421 , m_fullScreenRenderer(0) 420 , m_fullScreenRenderer(0)
422 , m_fullScreenChangeDelayTimer(this, &Document::fullScreenChangeDelayTimerFi red) 421 , m_fullScreenChangeDelayTimer(this, &Document::fullScreenChangeDelayTimerFi red)
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 clearStyleResolver(); 752 clearStyleResolver();
754 } 753 }
755 754
756 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionC ode& ec) 755 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionC ode& ec)
757 { 756 {
758 if (!isValidName(name)) { 757 if (!isValidName(name)) {
759 ec = INVALID_CHARACTER_ERR; 758 ec = INVALID_CHARACTER_ERR;
760 return 0; 759 return 0;
761 } 760 }
762 761
763 if (m_isXHTML) 762 if (isXHTMLDocument())
764 return HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, nam e, xhtmlNamespaceURI), this, 0, false); 763 return HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, nam e, xhtmlNamespaceURI), this, 0, false);
765 764
766 return createElement(QualifiedName(nullAtom, name, nullAtom), false); 765 return createElement(QualifiedName(nullAtom, name, nullAtom), false);
767 } 766 }
768 767
769 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionCode& ec) 768 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionCode& ec)
770 { 769 {
771 if (!isValidName(localName)) { 770 if (!isValidName(localName)) {
772 ec = INVALID_CHARACTER_ERR; 771 ec = INVALID_CHARACTER_ERR;
773 return 0; 772 return 0;
(...skipping 4880 matching lines...) Expand 10 before | Expand all | Expand 10 after
5654 return; 5653 return;
5655 5654
5656 Vector<RefPtr<Element> > associatedFormControls; 5655 Vector<RefPtr<Element> > associatedFormControls;
5657 copyToVector(m_associatedFormControls, associatedFormControls); 5656 copyToVector(m_associatedFormControls, associatedFormControls);
5658 5657
5659 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls); 5658 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls);
5660 m_associatedFormControls.clear(); 5659 m_associatedFormControls.clear();
5661 } 5660 }
5662 5661
5663 } // namespace WebCore 5662 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/html/HTMLDocument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698