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

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

Issue 16314002: Revert "Clean up the initializer mess in Document." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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') | no next file » | 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 if (!document->focusedNode()->isFocusable()) 393 if (!document->focusedNode()->isFocusable())
394 document->setFocusedNode(0); 394 document->setFocusedNode(0);
395 } 395 }
396 }; 396 };
397 397
398 Document::Document(Frame* frame, const KURL& url, DocumentClassFlags documentCla sses) 398 Document::Document(Frame* frame, const KURL& url, DocumentClassFlags documentCla sses)
399 : ContainerNode(0, CreateDocument) 399 : ContainerNode(0, CreateDocument)
400 , TreeScope(this) 400 , TreeScope(this)
401 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimer Fired) 401 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimer Fired)
402 , m_lastStyleResolverAccessTime(0) 402 , m_lastStyleResolverAccessTime(0)
403 , m_didCalculateStyleResolver(false)
404 , m_ignorePendingStylesheets(false)
405 , m_needsNotifyRemoveAllPendingStylesheet(false)
406 , m_hasNodesWithPlaceholderStyle(false)
407 , m_pendingSheetLayout(NoLayoutWithPendingSheets)
408 , m_frame(frame)
409 , m_activeParserCount(0) 403 , m_activeParserCount(0)
410 , m_contextFeatures(ContextFeatures::defaultSwitch()) 404 , m_contextFeatures(ContextFeatures::defaultSwitch())
411 , m_wellFormed(false)
412 , m_printing(false)
413 , m_paginatedForScreen(false)
414 , m_ignoreAutofocus(false)
415 , m_compatibilityMode(NoQuirksMode) 405 , m_compatibilityMode(NoQuirksMode)
416 , m_compatibilityModeLocked(false) 406 , m_compatibilityModeLocked(false)
417 , m_textColor(Color::black)
418 , m_didPostCheckFocusedNodeTask(false) 407 , m_didPostCheckFocusedNodeTask(false)
419 , m_domTreeVersion(++s_globalTreeVersion) 408 , m_domTreeVersion(++s_globalTreeVersion)
420 , m_listenerTypes(0)
421 , m_mutationObserverTypes(0) 409 , m_mutationObserverTypes(0)
422 , m_styleSheetCollection(DocumentStyleSheetCollection::create(this)) 410 , m_styleSheetCollection(DocumentStyleSheetCollection::create(this))
423 , m_visitedLinkState(VisitedLinkState::create(this)) 411 , m_visitedLinkState(VisitedLinkState::create(this))
424 , m_visuallyOrdered(false)
425 , m_readyState(Complete) 412 , m_readyState(Complete)
426 , m_bParsing(false)
427 , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired) 413 , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired)
428 , m_inStyleRecalc(false)
429 , m_closeAfterStyleRecalc(false)
430 , m_gotoAnchorNeededAfterStylesheetsLoad(false)
431 , m_pendingStyleRecalcShouldForce(false) 414 , m_pendingStyleRecalcShouldForce(false)
432 , m_frameElementsShouldIgnoreScrolling(false) 415 , m_frameElementsShouldIgnoreScrolling(false)
433 , m_containsValidityStyleRules(false) 416 , m_containsValidityStyleRules(false)
434 , m_updateFocusAppearanceRestoresSelection(false) 417 , m_updateFocusAppearanceRestoresSelection(false)
435 , m_ignoreDestructiveWriteCount(0) 418 , m_ignoreDestructiveWriteCount(0)
436 , m_titleSetExplicitly(false) 419 , m_titleSetExplicitly(false)
437 , m_markers(adoptPtr(new DocumentMarkerController))
438 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi red) 420 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi red)
439 , m_cssTarget(0)
440 , m_processingLoadEvent(false)
441 , m_loadEventFinished(false) 421 , m_loadEventFinished(false)
442 , m_startTime(currentTime()) 422 , m_startTime(currentTime())
443 , m_overMinimumLayoutThreshold(false) 423 , m_overMinimumLayoutThreshold(false)
444 , m_scriptRunner(ScriptRunner::create(this)) 424 , m_scriptRunner(ScriptRunner::create(this))
445 , m_xmlVersion("1.0") 425 , m_xmlVersion("1.0")
446 , m_xmlStandalone(StandaloneUnspecified) 426 , m_xmlStandalone(StandaloneUnspecified)
447 , m_hasXMLDeclaration(0) 427 , m_hasXMLDeclaration(0)
448 , m_designMode(inherit) 428 , m_designMode(inherit)
449 , m_hasAnnotatedRegions(false) 429 , m_hasAnnotatedRegions(false)
450 , m_annotatedRegionsDirty(false) 430 , m_annotatedRegionsDirty(false)
(...skipping 14 matching lines...) Expand all
465 , m_isAnimatingFullScreen(false) 445 , m_isAnimatingFullScreen(false)
466 , m_loadEventDelayCount(0) 446 , m_loadEventDelayCount(0)
467 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) 447 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
468 , m_referrerPolicy(ReferrerPolicyDefault) 448 , m_referrerPolicy(ReferrerPolicyDefault)
469 , m_directionSetOnDocumentElement(false) 449 , m_directionSetOnDocumentElement(false)
470 , m_writingModeSetOnDocumentElement(false) 450 , m_writingModeSetOnDocumentElement(false)
471 , m_writeRecursionIsTooDeep(false) 451 , m_writeRecursionIsTooDeep(false)
472 , m_writeRecursionDepth(0) 452 , m_writeRecursionDepth(0)
473 , m_wheelEventHandlerCount(0) 453 , m_wheelEventHandlerCount(0)
474 , m_lastHandledUserGestureTimestamp(0) 454 , m_lastHandledUserGestureTimestamp(0)
475 , m_prerenderer(Prerenderer::create(this))
476 , m_textAutosizer(TextAutosizer::create(this))
477 , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired) 455 , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired)
478 , m_scheduledTasksAreSuspended(false) 456 , m_scheduledTasksAreSuspended(false)
479 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi red) 457 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi red)
480 #ifndef NDEBUG 458 #ifndef NDEBUG
481 , m_didDispatchViewportPropertiesChanged(false) 459 , m_didDispatchViewportPropertiesChanged(false)
482 #endif 460 #endif
483 , m_timeline(DocumentTimeline::create(this)) 461 , m_timeline(DocumentTimeline::create(this))
484 , m_templateDocumentHost(0) 462 , m_templateDocumentHost(0)
485 , m_fontloader(0) 463 , m_fontloader(0)
486 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) 464 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired)
487 { 465 {
488 ScriptWrappable::init(this); 466 ScriptWrappable::init(this);
467 m_printing = false;
468 m_paginatedForScreen = false;
489 469
490 if (m_frame) { 470 m_ignoreAutofocus = false;
471
472 m_frame = frame;
473 if (m_frame)
491 provideContextFeaturesToDocumentFrom(this, m_frame->page()); 474 provideContextFeaturesToDocumentFrom(this, m_frame->page());
492 475
493 // We depend on the url getting immediately set in subframes, but we 476 // We depend on the url getting immediately set in subframes, but we
494 // also depend on the url NOT getting immediately set in opened windows. 477 // also depend on the url NOT getting immediately set in opened windows.
495 // See fast/dom/early-frame-url.html 478 // See fast/dom/early-frame-url.html
496 // and fast/dom/location-new-window-no-crash.html, respectively. 479 // and fast/dom/location-new-window-no-crash.html, respectively.
497 // FIXME: Can/should we unify this behavior? 480 // FIXME: Can/should we unify this behavior?
498 if (m_frame->ownerElement() || !url.isEmpty()) 481 if ((frame && frame->ownerElement()) || !url.isEmpty())
499 setURL(url); 482 setURL(url);
500 483
484 m_markers = adoptPtr(new DocumentMarkerController);
485
486 if (m_frame)
501 m_cachedResourceLoader = m_frame->loader()->activeDocumentLoader()->cach edResourceLoader(); 487 m_cachedResourceLoader = m_frame->loader()->activeDocumentLoader()->cach edResourceLoader();
502 }
503
504 if (!m_cachedResourceLoader) 488 if (!m_cachedResourceLoader)
505 m_cachedResourceLoader = CachedResourceLoader::create(0); 489 m_cachedResourceLoader = CachedResourceLoader::create(0);
506 m_cachedResourceLoader->setDocument(this); 490 m_cachedResourceLoader->setDocument(this);
507 491
492 m_prerenderer = Prerenderer::create(this);
493 m_textAutosizer = TextAutosizer::create(this);
494 m_visuallyOrdered = false;
495 m_bParsing = false;
496 m_wellFormed = false;
497
498 m_textColor = Color::black;
499 m_listenerTypes = 0;
500 m_inStyleRecalc = false;
501 m_closeAfterStyleRecalc = false;
502
503 m_gotoAnchorNeededAfterStylesheetsLoad = false;
504
505 m_didCalculateStyleResolver = false;
506 m_ignorePendingStylesheets = false;
507 m_needsNotifyRemoveAllPendingStylesheet = false;
508 m_hasNodesWithPlaceholderStyle = false;
509 m_pendingSheetLayout = NoLayoutWithPendingSheets;
510
511 m_cssTarget = 0;
512
508 resetLinkColor(); 513 resetLinkColor();
509 resetVisitedLinkColor(); 514 resetVisitedLinkColor();
510 resetActiveLinkColor(); 515 resetActiveLinkColor();
511 516
517 m_processingLoadEvent = false;
518
512 initSecurityContext(); 519 initSecurityContext();
513 initDNSPrefetch(); 520 initDNSPrefetch();
514 521
522 static int docID = 0;
523 m_docID = docID++;
524
515 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) 525 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++)
516 m_nodeListCounts[i] = 0; 526 m_nodeListCounts[i] = 0;
517 527
518 InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter); 528 InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter);
519 } 529 }
520 530
521 static void histogramMutationEventUsage(const unsigned short& listenerTypes) 531 static void histogramMutationEventUsage(const unsigned short& listenerTypes)
522 { 532 {
523 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODI FIED_LISTENER), 2); 533 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODI FIED_LISTENER), 2);
524 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_L ISTENER), 2); 534 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_L ISTENER), 2);
(...skipping 5091 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 return; 5626 return;
5617 5627
5618 Vector<RefPtr<Element> > associatedFormControls; 5628 Vector<RefPtr<Element> > associatedFormControls;
5619 copyToVector(m_associatedFormControls, associatedFormControls); 5629 copyToVector(m_associatedFormControls, associatedFormControls);
5620 5630
5621 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC ontrols); 5631 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC ontrols);
5622 m_associatedFormControls.clear(); 5632 m_associatedFormControls.clear();
5623 } 5633 }
5624 5634
5625 } // namespace WebCore 5635 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698