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

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

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