| OLD | NEW |
| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 static Widget* widgetForElement(const Element& focusedElement) | 335 static Widget* widgetForElement(const Element& focusedElement) |
| 336 { | 336 { |
| 337 LayoutObject* layoutObject = focusedElement.layoutObject(); | 337 LayoutObject* layoutObject = focusedElement.layoutObject(); |
| 338 if (!layoutObject || !layoutObject->isLayoutPart()) | 338 if (!layoutObject || !layoutObject->isLayoutPart()) |
| 339 return 0; | 339 return 0; |
| 340 return toLayoutPart(layoutObject)->widget(); | 340 return toLayoutPart(layoutObject)->widget(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 static bool acceptsEditingFocus(const Element& element) | 343 static bool acceptsEditingFocus(const Element& element) |
| 344 { | 344 { |
| 345 ASSERT(element.hasEditableStyle()); | 345 DCHECK(element.hasEditableStyle()); |
| 346 | 346 |
| 347 return element.document().frame() && element.rootEditableElement(); | 347 return element.document().frame() && element.rootEditableElement(); |
| 348 } | 348 } |
| 349 | 349 |
| 350 static bool isOriginPotentiallyTrustworthy(SecurityOrigin* origin, String* error
Message) | 350 static bool isOriginPotentiallyTrustworthy(SecurityOrigin* origin, String* error
Message) |
| 351 { | 351 { |
| 352 if (origin->isPotentiallyTrustworthy()) | 352 if (origin->isPotentiallyTrustworthy()) |
| 353 return true; | 353 return true; |
| 354 if (errorMessage) | 354 if (errorMessage) |
| 355 *errorMessage = origin->isPotentiallyTrustworthyErrorMessage(); | 355 *errorMessage = origin->isPotentiallyTrustworthyErrorMessage(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 , m_timeline(AnimationTimeline::create(this)) | 456 , m_timeline(AnimationTimeline::create(this)) |
| 457 , m_compositorPendingAnimations(new CompositorPendingAnimations()) | 457 , m_compositorPendingAnimations(new CompositorPendingAnimations()) |
| 458 , m_templateDocumentHost(nullptr) | 458 , m_templateDocumentHost(nullptr) |
| 459 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) | 459 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) |
| 460 , m_timers(timerTaskRunner()->adoptClone()) | 460 , m_timers(timerTaskRunner()->adoptClone()) |
| 461 , m_hasViewportUnits(false) | 461 , m_hasViewportUnits(false) |
| 462 , m_parserSyncPolicy(AllowAsynchronousParsing) | 462 , m_parserSyncPolicy(AllowAsynchronousParsing) |
| 463 , m_nodeCount(0) | 463 , m_nodeCount(0) |
| 464 { | 464 { |
| 465 if (m_frame) { | 465 if (m_frame) { |
| 466 ASSERT(m_frame->page()); | 466 DCHECK(m_frame->page()); |
| 467 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); | 467 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); |
| 468 | 468 |
| 469 m_fetcher = m_frame->loader().documentLoader()->fetcher(); | 469 m_fetcher = m_frame->loader().documentLoader()->fetcher(); |
| 470 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); | 470 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); |
| 471 } else if (m_importsController) { | 471 } else if (m_importsController) { |
| 472 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr, this); | 472 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr, this); |
| 473 } else { | 473 } else { |
| 474 m_fetcher = ResourceFetcher::create(nullptr); | 474 m_fetcher = ResourceFetcher::create(nullptr); |
| 475 } | 475 } |
| 476 | 476 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 496 | 496 |
| 497 // Since CSSFontSelector requires Document::m_fetcher and StyleEngine owns | 497 // Since CSSFontSelector requires Document::m_fetcher and StyleEngine owns |
| 498 // CSSFontSelector, need to initialize m_styleEngine after initializing | 498 // CSSFontSelector, need to initialize m_styleEngine after initializing |
| 499 // m_fetcher. | 499 // m_fetcher. |
| 500 m_styleEngine = StyleEngine::create(*this); | 500 m_styleEngine = StyleEngine::create(*this); |
| 501 | 501 |
| 502 // The parent's parser should be suspended together with all the other objec
ts, | 502 // The parent's parser should be suspended together with all the other objec
ts, |
| 503 // else this new Document would have a new ExecutionContext which suspended
state | 503 // else this new Document would have a new ExecutionContext which suspended
state |
| 504 // would not match the one from the parent, and could start loading resource
s | 504 // would not match the one from the parent, and could start loading resource
s |
| 505 // ignoring the defersLoading flag. | 505 // ignoring the defersLoading flag. |
| 506 ASSERT(!parentDocument() || !parentDocument()->activeDOMObjectsAreSuspended(
)); | 506 DCHECK(!parentDocument() || !parentDocument()->activeDOMObjectsAreSuspended(
)); |
| 507 | 507 |
| 508 liveDocumentSet().add(this); | 508 liveDocumentSet().add(this); |
| 509 } | 509 } |
| 510 | 510 |
| 511 Document::~Document() | 511 Document::~Document() |
| 512 { | 512 { |
| 513 ASSERT(!layoutView()); | 513 DCHECK(!layoutView()); |
| 514 ASSERT(!parentTreeScope()); | 514 DCHECK(!parentTreeScope()); |
| 515 // If a top document with a cache, verify that it was comprehensively | 515 // If a top document with a cache, verify that it was comprehensively |
| 516 // cleared during detach. | 516 // cleared during detach. |
| 517 ASSERT(!m_axObjectCache); | 517 DCHECK(!m_axObjectCache); |
| 518 #if !ENABLE(OILPAN) | 518 #if !ENABLE(OILPAN) |
| 519 ASSERT(m_ranges.isEmpty()); | 519 DCHECK(m_ranges.isEmpty()); |
| 520 ASSERT(!hasGuardRefCount()); | 520 DCHECK(!hasGuardRefCount()); |
| 521 ASSERT(!m_importsController); | 521 DCHECK(!m_importsController); |
| 522 // With Oilpan, either the document outlives the visibility observers | 522 // With Oilpan, either the document outlives the visibility observers |
| 523 // or the visibility observers and the document die in the same GC round. | 523 // or the visibility observers and the document die in the same GC round. |
| 524 // When they die in the same GC round, the list of visibility observers | 524 // When they die in the same GC round, the list of visibility observers |
| 525 // will not be empty on Document destruction. | 525 // will not be empty on Document destruction. |
| 526 ASSERT(m_visibilityObservers.isEmpty()); | 526 DCHECK(m_visibilityObservers.isEmpty()); |
| 527 | 527 |
| 528 if (m_templateDocument) | 528 if (m_templateDocument) |
| 529 m_templateDocument->m_templateDocumentHost = nullptr; // balanced in ens
ureTemplateDocument(). | 529 m_templateDocument->m_templateDocumentHost = nullptr; // balanced in ens
ureTemplateDocument(). |
| 530 | 530 |
| 531 m_scriptRunner.clear(); | 531 m_scriptRunner.clear(); |
| 532 | 532 |
| 533 // FIXME: Oilpan: Not removing event listeners here also means that we do | 533 // FIXME: Oilpan: Not removing event listeners here also means that we do |
| 534 // not notify the inspector instrumentation that the event listeners are | 534 // not notify the inspector instrumentation that the event listeners are |
| 535 // gone. The Document and all the nodes in the document are gone, so maybe | 535 // gone. The Document and all the nodes in the document are gone, so maybe |
| 536 // that is OK? | 536 // that is OK? |
| 537 removeAllEventListenersRecursively(); | 537 removeAllEventListenersRecursively(); |
| 538 | 538 |
| 539 // Currently we believe that Document can never outlive the parser. | 539 // Currently we believe that Document can never outlive the parser. |
| 540 // Although the Document may be replaced synchronously, DocumentParsers | 540 // Although the Document may be replaced synchronously, DocumentParsers |
| 541 // generally keep at least one reference to an Element which would in turn | 541 // generally keep at least one reference to an Element which would in turn |
| 542 // has a reference to the Document. If you hit this ASSERT, then that | 542 // has a reference to the Document. If you hit this ASSERT, then that |
| 543 // assumption is wrong. DocumentParser::detach() should ensure that even | 543 // assumption is wrong. DocumentParser::detach() should ensure that even |
| 544 // if the DocumentParser outlives the Document it won't cause badness. | 544 // if the DocumentParser outlives the Document it won't cause badness. |
| 545 ASSERT(!m_parser || m_parser->refCount() == 1); | 545 DCHECK(!m_parser || m_parser->refCount() == 1); |
| 546 detachParser(); | 546 detachParser(); |
| 547 | 547 |
| 548 if (m_styleSheetList) | 548 if (m_styleSheetList) |
| 549 m_styleSheetList->detachFromDocument(); | 549 m_styleSheetList->detachFromDocument(); |
| 550 | 550 |
| 551 m_timeline->detachFromDocument(); | 551 m_timeline->detachFromDocument(); |
| 552 | 552 |
| 553 // We need to destroy CSSFontSelector before destroying m_fetcher. | 553 // We need to destroy CSSFontSelector before destroying m_fetcher. |
| 554 m_styleEngine->detachFromDocument(); | 554 m_styleEngine->detachFromDocument(); |
| 555 | 555 |
| 556 if (m_elemSheet) | 556 if (m_elemSheet) |
| 557 m_elemSheet->clearOwnerNode(); | 557 m_elemSheet->clearOwnerNode(); |
| 558 | 558 |
| 559 // We must call clearRareData() here since a Document class inherits TreeSco
pe | 559 // We must call clearRareData() here since a Document class inherits TreeSco
pe |
| 560 // as well as Node. See a comment on TreeScope.h for the reason. | 560 // as well as Node. See a comment on TreeScope.h for the reason. |
| 561 if (hasRareData()) | 561 if (hasRareData()) |
| 562 clearRareData(); | 562 clearRareData(); |
| 563 | 563 |
| 564 ASSERT(m_listsInvalidatedAtDocument.isEmpty()); | 564 DCHECK(m_listsInvalidatedAtDocument.isEmpty()); |
| 565 | 565 |
| 566 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i) | 566 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i) |
| 567 ASSERT(!m_nodeListCounts[i]); | 567 DCHECK(!m_nodeListCounts[i]); |
| 568 | 568 |
| 569 liveDocumentSet().remove(this); | 569 liveDocumentSet().remove(this); |
| 570 #endif | 570 #endif |
| 571 | 571 |
| 572 InstanceCounters::decrementCounter(InstanceCounters::DocumentCounter); | 572 InstanceCounters::decrementCounter(InstanceCounters::DocumentCounter); |
| 573 } | 573 } |
| 574 | 574 |
| 575 #if !ENABLE(OILPAN) | 575 #if !ENABLE(OILPAN) |
| 576 void Document::dispose() | 576 void Document::dispose() |
| 577 { | 577 { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 656 } |
| 657 | 657 |
| 658 String Document::compatMode() const | 658 String Document::compatMode() const |
| 659 { | 659 { |
| 660 return inQuirksMode() ? "BackCompat" : "CSS1Compat"; | 660 return inQuirksMode() ? "BackCompat" : "CSS1Compat"; |
| 661 } | 661 } |
| 662 | 662 |
| 663 void Document::setDoctype(RawPtr<DocumentType> docType) | 663 void Document::setDoctype(RawPtr<DocumentType> docType) |
| 664 { | 664 { |
| 665 // This should never be called more than once. | 665 // This should never be called more than once. |
| 666 ASSERT(!m_docType || !docType); | 666 DCHECK(!m_docType || !docType); |
| 667 m_docType = docType; | 667 m_docType = docType; |
| 668 if (m_docType) { | 668 if (m_docType) { |
| 669 this->adoptIfNeeded(*m_docType); | 669 this->adoptIfNeeded(*m_docType); |
| 670 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.",
TextCaseInsensitive)) | 670 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.",
TextCaseInsensitive)) |
| 671 m_isMobileDocument = true; | 671 m_isMobileDocument = true; |
| 672 } | 672 } |
| 673 // Doctype affects the interpretation of the stylesheets. | 673 // Doctype affects the interpretation of the stylesheets. |
| 674 styleEngine().clearResolver(); | 674 styleEngine().clearResolver(); |
| 675 } | 675 } |
| 676 | 676 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 | 799 |
| 800 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() | 800 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() |
| 801 { | 801 { |
| 802 if (!m_customElementMicrotaskRunQueue) | 802 if (!m_customElementMicrotaskRunQueue) |
| 803 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat
e(); | 803 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat
e(); |
| 804 return m_customElementMicrotaskRunQueue.get(); | 804 return m_customElementMicrotaskRunQueue.get(); |
| 805 } | 805 } |
| 806 | 806 |
| 807 void Document::setImportsController(HTMLImportsController* controller) | 807 void Document::setImportsController(HTMLImportsController* controller) |
| 808 { | 808 { |
| 809 ASSERT(!m_importsController || !controller); | 809 DCHECK(!m_importsController || !controller); |
| 810 m_importsController = controller; | 810 m_importsController = controller; |
| 811 if (!m_importsController && !loader()) | 811 if (!m_importsController && !loader()) |
| 812 m_fetcher->clearContext(); | 812 m_fetcher->clearContext(); |
| 813 } | 813 } |
| 814 | 814 |
| 815 HTMLImportLoader* Document::importLoader() const | 815 HTMLImportLoader* Document::importLoader() const |
| 816 { | 816 { |
| 817 if (!m_importsController) | 817 if (!m_importsController) |
| 818 return 0; | 818 return 0; |
| 819 return m_importsController->loaderFor(*this); | 819 return m_importsController->loaderFor(*this); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 e = SVGElementFactory::createSVGElement(qName.localName(), *this, create
dByParser); | 1042 e = SVGElementFactory::createSVGElement(qName.localName(), *this, create
dByParser); |
| 1043 | 1043 |
| 1044 if (e) | 1044 if (e) |
| 1045 m_sawElementsInKnownNamespaces = true; | 1045 m_sawElementsInKnownNamespaces = true; |
| 1046 else | 1046 else |
| 1047 e = Element::create(qName, this); | 1047 e = Element::create(qName, this); |
| 1048 | 1048 |
| 1049 if (e->prefix() != qName.prefix()) | 1049 if (e->prefix() != qName.prefix()) |
| 1050 e->setTagNameForCreateElementNS(qName); | 1050 e->setTagNameForCreateElementNS(qName); |
| 1051 | 1051 |
| 1052 ASSERT(qName == e->tagQName()); | 1052 DCHECK(qName == e->tagQName()); |
| 1053 | 1053 |
| 1054 return e.release(); | 1054 return e.release(); |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 String Document::readyState() const | 1057 String Document::readyState() const |
| 1058 { | 1058 { |
| 1059 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); | 1059 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); |
| 1060 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); | 1060 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); |
| 1061 DEFINE_STATIC_LOCAL(const String, complete, ("complete")); | 1061 DEFINE_STATIC_LOCAL(const String, complete, ("complete")); |
| 1062 | 1062 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 | 1420 |
| 1421 if (state == PageVisibilityStateVisible) | 1421 if (state == PageVisibilityStateVisible) |
| 1422 timeline().setAllCompositorPending(); | 1422 timeline().setAllCompositorPending(); |
| 1423 | 1423 |
| 1424 if (hidden() && m_canvasFontCache) | 1424 if (hidden() && m_canvasFontCache) |
| 1425 m_canvasFontCache->pruneAll(); | 1425 m_canvasFontCache->pruneAll(); |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 void Document::registerVisibilityObserver(DocumentVisibilityObserver* observer) | 1428 void Document::registerVisibilityObserver(DocumentVisibilityObserver* observer) |
| 1429 { | 1429 { |
| 1430 ASSERT(!m_visibilityObservers.contains(observer)); | 1430 DCHECK(!m_visibilityObservers.contains(observer)); |
| 1431 m_visibilityObservers.add(observer); | 1431 m_visibilityObservers.add(observer); |
| 1432 } | 1432 } |
| 1433 | 1433 |
| 1434 void Document::unregisterVisibilityObserver(DocumentVisibilityObserver* observer
) | 1434 void Document::unregisterVisibilityObserver(DocumentVisibilityObserver* observer
) |
| 1435 { | 1435 { |
| 1436 ASSERT(m_visibilityObservers.contains(observer)); | 1436 DCHECK(m_visibilityObservers.contains(observer)); |
| 1437 m_visibilityObservers.remove(observer); | 1437 m_visibilityObservers.remove(observer); |
| 1438 } | 1438 } |
| 1439 | 1439 |
| 1440 String Document::nodeName() const | 1440 String Document::nodeName() const |
| 1441 { | 1441 { |
| 1442 return "#document"; | 1442 return "#document"; |
| 1443 } | 1443 } |
| 1444 | 1444 |
| 1445 Node::NodeType Document::getNodeType() const | 1445 Node::NodeType Document::getNodeType() const |
| 1446 { | 1446 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 return m_frame ? m_frame->settings() : 0; | 1491 return m_frame ? m_frame->settings() : 0; |
| 1492 } | 1492 } |
| 1493 | 1493 |
| 1494 RawPtr<Range> Document::createRange() | 1494 RawPtr<Range> Document::createRange() |
| 1495 { | 1495 { |
| 1496 return Range::create(*this); | 1496 return Range::create(*this); |
| 1497 } | 1497 } |
| 1498 | 1498 |
| 1499 RawPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToSho
w, RawPtr<NodeFilter> filter) | 1499 RawPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToSho
w, RawPtr<NodeFilter> filter) |
| 1500 { | 1500 { |
| 1501 ASSERT(root); | 1501 DCHECK(root); |
| 1502 return NodeIterator::create(root, whatToShow, filter); | 1502 return NodeIterator::create(root, whatToShow, filter); |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 RawPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, R
awPtr<NodeFilter> filter) | 1505 RawPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, R
awPtr<NodeFilter> filter) |
| 1506 { | 1506 { |
| 1507 ASSERT(root); | 1507 DCHECK(root); |
| 1508 return TreeWalker::create(root, whatToShow, filter); | 1508 return TreeWalker::create(root, whatToShow, filter); |
| 1509 } | 1509 } |
| 1510 | 1510 |
| 1511 bool Document::needsLayoutTreeUpdate() const | 1511 bool Document::needsLayoutTreeUpdate() const |
| 1512 { | 1512 { |
| 1513 if (!isActive() || !view()) | 1513 if (!isActive() || !view()) |
| 1514 return false; | 1514 return false; |
| 1515 if (needsFullLayoutTreeUpdate()) | 1515 if (needsFullLayoutTreeUpdate()) |
| 1516 return true; | 1516 return true; |
| 1517 if (childNeedsStyleRecalc()) | 1517 if (childNeedsStyleRecalc()) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 // InPreLayout will recalc style itself. There's no reason to schedule anoth
er recalc. | 1552 // InPreLayout will recalc style itself. There's no reason to schedule anoth
er recalc. |
| 1553 if (m_lifecycle.state() == DocumentLifecycle::InPreLayout) | 1553 if (m_lifecycle.state() == DocumentLifecycle::InPreLayout) |
| 1554 return false; | 1554 return false; |
| 1555 if (!shouldScheduleLayout()) | 1555 if (!shouldScheduleLayout()) |
| 1556 return false; | 1556 return false; |
| 1557 return true; | 1557 return true; |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 void Document::scheduleLayoutTreeUpdate() | 1560 void Document::scheduleLayoutTreeUpdate() |
| 1561 { | 1561 { |
| 1562 ASSERT(!hasPendingVisualUpdate()); | 1562 DCHECK(!hasPendingVisualUpdate()); |
| 1563 ASSERT(shouldScheduleLayoutTreeUpdate()); | 1563 DCHECK(shouldScheduleLayoutTreeUpdate()); |
| 1564 ASSERT(needsLayoutTreeUpdate()); | 1564 DCHECK(needsLayoutTreeUpdate()); |
| 1565 | 1565 |
| 1566 if (!view()->canThrottleRendering()) | 1566 if (!view()->canThrottleRendering()) |
| 1567 page()->animator().scheduleVisualUpdate(frame()); | 1567 page()->animator().scheduleVisualUpdate(frame()); |
| 1568 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); | 1568 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); |
| 1569 | 1569 |
| 1570 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Schedu
leStyleRecalculation", TRACE_EVENT_SCOPE_THREAD, "data", InspectorRecalculateSty
lesEvent::data(frame())); | 1570 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Schedu
leStyleRecalculation", TRACE_EVENT_SCOPE_THREAD, "data", InspectorRecalculateSty
lesEvent::data(frame())); |
| 1571 InspectorInstrumentation::didScheduleStyleRecalculation(this); | 1571 InspectorInstrumentation::didScheduleStyleRecalculation(this); |
| 1572 | 1572 |
| 1573 ++m_styleVersion; | 1573 ++m_styleVersion; |
| 1574 } | 1574 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1592 | 1592 |
| 1593 void Document::setupFontBuilder(ComputedStyle& documentStyle) | 1593 void Document::setupFontBuilder(ComputedStyle& documentStyle) |
| 1594 { | 1594 { |
| 1595 FontBuilder fontBuilder(*this); | 1595 FontBuilder fontBuilder(*this); |
| 1596 RawPtr<CSSFontSelector> selector = styleEngine().fontSelector(); | 1596 RawPtr<CSSFontSelector> selector = styleEngine().fontSelector(); |
| 1597 fontBuilder.createFontForDocument(selector, documentStyle); | 1597 fontBuilder.createFontForDocument(selector, documentStyle); |
| 1598 } | 1598 } |
| 1599 | 1599 |
| 1600 void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) | 1600 void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) |
| 1601 { | 1601 { |
| 1602 ASSERT(inStyleRecalc()); | 1602 DCHECK(inStyleRecalc()); |
| 1603 ASSERT(documentElement()); | 1603 DCHECK(documentElement()); |
| 1604 | 1604 |
| 1605 bool didRecalcDocumentElement = false; | 1605 bool didRecalcDocumentElement = false; |
| 1606 RefPtr<ComputedStyle> documentElementStyle = documentElement()->mutableCompu
tedStyle(); | 1606 RefPtr<ComputedStyle> documentElementStyle = documentElement()->mutableCompu
tedStyle(); |
| 1607 if (change == Force) | 1607 if (change == Force) |
| 1608 documentElement()->clearAnimationStyleChange(); | 1608 documentElement()->clearAnimationStyleChange(); |
| 1609 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) { | 1609 if (!documentElementStyle || documentElement()->needsStyleRecalc() || change
== Force) { |
| 1610 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); | 1610 documentElementStyle = ensureStyleResolver().styleForElement(documentEle
ment()); |
| 1611 didRecalcDocumentElement = true; | 1611 didRecalcDocumentElement = true; |
| 1612 } | 1612 } |
| 1613 | 1613 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 if (currentLayer->attachment() == ScrollBackgroundAttachment) | 1646 if (currentLayer->attachment() == ScrollBackgroundAttachment) |
| 1647 currentLayer->setAttachment(LocalBackgroundAttachment); | 1647 currentLayer->setAttachment(LocalBackgroundAttachment); |
| 1648 } | 1648 } |
| 1649 EImageRendering imageRendering = backgroundStyle->imageRendering(); | 1649 EImageRendering imageRendering = backgroundStyle->imageRendering(); |
| 1650 | 1650 |
| 1651 const ComputedStyle* overflowStyle = nullptr; | 1651 const ComputedStyle* overflowStyle = nullptr; |
| 1652 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ | 1652 if (Element* element = viewportDefiningElement(documentElementStyle.get()))
{ |
| 1653 if (element == body) { | 1653 if (element == body) { |
| 1654 overflowStyle = bodyStyle.get(); | 1654 overflowStyle = bodyStyle.get(); |
| 1655 } else { | 1655 } else { |
| 1656 ASSERT(element == documentElement()); | 1656 DCHECK_EQ(element, documentElement()); |
| 1657 overflowStyle = documentElementStyle.get(); | 1657 overflowStyle = documentElementStyle.get(); |
| 1658 | 1658 |
| 1659 // The body element has its own scrolling box, independent from the
viewport. | 1659 // The body element has its own scrolling box, independent from the
viewport. |
| 1660 // This is a bit of a weird edge case in the CSS spec that we might
want to try to | 1660 // This is a bit of a weird edge case in the CSS spec that we might
want to try to |
| 1661 // eliminate some day (eg. for ScrollTopLeftInterop - see http://crb
ug.com/157855). | 1661 // eliminate some day (eg. for ScrollTopLeftInterop - see http://crb
ug.com/157855). |
| 1662 if (bodyStyle && !bodyStyle->isOverflowVisible()) | 1662 if (bodyStyle && !bodyStyle->isOverflowVisible()) |
| 1663 UseCounter::count(*this, UseCounter::BodyScrollsInAdditionToView
port); | 1663 UseCounter::count(*this, UseCounter::BodyScrollsInAdditionToView
port); |
| 1664 } | 1664 } |
| 1665 } | 1665 } |
| 1666 | 1666 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); | 1720 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::WritingModeChange)); |
| 1721 } | 1721 } |
| 1722 } | 1722 } |
| 1723 | 1723 |
| 1724 if (const ComputedStyle* style = documentElement()->computedStyle()) { | 1724 if (const ComputedStyle* style = documentElement()->computedStyle()) { |
| 1725 if (style->direction() != rootDirection || style->getWritingMode() != ro
otWritingMode) | 1725 if (style->direction() != rootDirection || style->getWritingMode() != ro
otWritingMode) |
| 1726 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); | 1726 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan
geReasonForTracing::create(StyleChangeReason::WritingModeChange)); |
| 1727 } | 1727 } |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 #if ENABLE(ASSERT) | 1730 #if DCHECK_IS_ON() |
| 1731 static void assertLayoutTreeUpdated(Node& root) | 1731 static void assertLayoutTreeUpdated(Node& root) |
| 1732 { | 1732 { |
| 1733 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { | 1733 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
| 1734 // We leave some nodes with dirty bits in the tree because they don't | 1734 // We leave some nodes with dirty bits in the tree because they don't |
| 1735 // matter like Comment and ProcessingInstruction nodes. | 1735 // matter like Comment and ProcessingInstruction nodes. |
| 1736 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the | 1736 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the |
| 1737 // first place. | 1737 // first place. |
| 1738 if (!node.isElementNode() | 1738 if (!node.isElementNode() |
| 1739 && !node.isTextNode() | 1739 && !node.isTextNode() |
| 1740 && !node.isShadowRoot() | 1740 && !node.isShadowRoot() |
| 1741 && !node.isDocumentNode()) | 1741 && !node.isDocumentNode()) |
| 1742 continue; | 1742 continue; |
| 1743 ASSERT(!node.needsStyleRecalc()); | 1743 DCHECK(!node.needsStyleRecalc()); |
| 1744 ASSERT(!node.childNeedsStyleRecalc()); | 1744 DCHECK(!node.childNeedsStyleRecalc()); |
| 1745 ASSERT(!node.childNeedsDistributionRecalc()); | 1745 DCHECK(!node.childNeedsDistributionRecalc()); |
| 1746 ASSERT(!node.needsStyleInvalidation()); | 1746 DCHECK(!node.needsStyleInvalidation()); |
| 1747 ASSERT(!node.childNeedsStyleInvalidation()); | 1747 DCHECK(!node.childNeedsStyleInvalidation()); |
| 1748 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; sha
dowRoot = shadowRoot->olderShadowRoot()) | 1748 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; sha
dowRoot = shadowRoot->olderShadowRoot()) |
| 1749 assertLayoutTreeUpdated(*shadowRoot); | 1749 assertLayoutTreeUpdated(*shadowRoot); |
| 1750 } | 1750 } |
| 1751 } | 1751 } |
| 1752 #endif | 1752 #endif |
| 1753 | 1753 |
| 1754 void Document::updateLayoutTree() | 1754 void Document::updateLayoutTree() |
| 1755 { | 1755 { |
| 1756 ASSERT(isMainThread()); | 1756 DCHECK(isMainThread()); |
| 1757 | 1757 |
| 1758 ScriptForbiddenScope forbidScript; | 1758 ScriptForbiddenScope forbidScript; |
| 1759 // We should forbid script execution for plugins here because update while l
ayout is changing, | 1759 // We should forbid script execution for plugins here because update while l
ayout is changing, |
| 1760 // HTMLPlugin element can be reattached and plugin can be destroyed. Plugin
can execute scripts | 1760 // HTMLPlugin element can be reattached and plugin can be destroyed. Plugin
can execute scripts |
| 1761 // on destroy. It produces crash without PluginScriptForbiddenScope: crbug.c
om/550427. | 1761 // on destroy. It produces crash without PluginScriptForbiddenScope: crbug.c
om/550427. |
| 1762 PluginScriptForbiddenScope pluginForbidScript; | 1762 PluginScriptForbiddenScope pluginForbidScript; |
| 1763 | 1763 |
| 1764 if (!view() || !isActive()) | 1764 if (!view() || !isActive()) |
| 1765 return; | 1765 return; |
| 1766 | 1766 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 // As a result of the style recalculation, the currently hovered element mig
ht have been | 1821 // As a result of the style recalculation, the currently hovered element mig
ht have been |
| 1822 // detached (for example, by setting display:none in the :hover style), sche
dule another mouseMove event | 1822 // detached (for example, by setting display:none in the :hover style), sche
dule another mouseMove event |
| 1823 // to check if any other elements ended up under the mouse pointer due to re
-layout. | 1823 // to check if any other elements ended up under the mouse pointer due to re
-layout. |
| 1824 if (hoverNode() && !hoverNode()->layoutObject() && frame()) | 1824 if (hoverNode() && !hoverNode()->layoutObject() && frame()) |
| 1825 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); | 1825 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); |
| 1826 | 1826 |
| 1827 if (m_focusedElement && !m_focusedElement->isFocusable()) | 1827 if (m_focusedElement && !m_focusedElement->isFocusable()) |
| 1828 clearFocusedElementSoon(); | 1828 clearFocusedElementSoon(); |
| 1829 layoutView()->clearHitTestCache(); | 1829 layoutView()->clearHitTestCache(); |
| 1830 | 1830 |
| 1831 ASSERT(!DocumentAnimations::needsAnimationTimingUpdate(*this)); | 1831 DCHECK(!DocumentAnimations::needsAnimationTimingUpdate(*this)); |
| 1832 | 1832 |
| 1833 unsigned elementCount = styleEngine().styleForElementCount() - startElementC
ount; | 1833 unsigned elementCount = styleEngine().styleForElementCount() - startElementC
ount; |
| 1834 | 1834 |
| 1835 TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCoun
t", elementCount); | 1835 TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCoun
t", elementCount); |
| 1836 InspectorInstrumentation::didRecalculateStyle(cookie, elementCount); | 1836 InspectorInstrumentation::didRecalculateStyle(cookie, elementCount); |
| 1837 | 1837 |
| 1838 #if ENABLE(ASSERT) | 1838 #if DCHECK_IS_ON() |
| 1839 assertLayoutTreeUpdated(*this); | 1839 assertLayoutTreeUpdated(*this); |
| 1840 #endif | 1840 #endif |
| 1841 } | 1841 } |
| 1842 | 1842 |
| 1843 void Document::updateStyle() | 1843 void Document::updateStyle() |
| 1844 { | 1844 { |
| 1845 ASSERT(!view()->shouldThrottleRendering()); | 1845 DCHECK(!view()->shouldThrottleRendering()); |
| 1846 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); | 1846 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); |
| 1847 unsigned initialElementCount = styleEngine().styleForElementCount(); | 1847 unsigned initialElementCount = styleEngine().styleForElementCount(); |
| 1848 | 1848 |
| 1849 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 1849 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| 1850 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); | 1850 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); |
| 1851 | 1851 |
| 1852 StyleRecalcChange change = NoChange; | 1852 StyleRecalcChange change = NoChange; |
| 1853 if (getStyleChangeType() >= SubtreeStyleChange) | 1853 if (getStyleChangeType() >= SubtreeStyleChange) |
| 1854 change = Force; | 1854 change = Force; |
| 1855 | 1855 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 | 1887 |
| 1888 view()->recalcOverflowAfterStyleChange(); | 1888 view()->recalcOverflowAfterStyleChange(); |
| 1889 view()->setFrameTimingRequestsDirty(true); | 1889 view()->setFrameTimingRequestsDirty(true); |
| 1890 | 1890 |
| 1891 clearChildNeedsStyleRecalc(); | 1891 clearChildNeedsStyleRecalc(); |
| 1892 | 1892 |
| 1893 resolver.clearStyleSharingList(); | 1893 resolver.clearStyleSharingList(); |
| 1894 | 1894 |
| 1895 m_wasPrinting = m_printing; | 1895 m_wasPrinting = m_printing; |
| 1896 | 1896 |
| 1897 ASSERT(!needsStyleRecalc()); | 1897 DCHECK(!needsStyleRecalc()); |
| 1898 ASSERT(!childNeedsStyleRecalc()); | 1898 DCHECK(!childNeedsStyleRecalc()); |
| 1899 ASSERT(inStyleRecalc()); | 1899 DCHECK(inStyleRecalc()); |
| 1900 ASSERT(styleResolver() == &resolver); | 1900 DCHECK_EQ(styleResolver(), &resolver); |
| 1901 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 1901 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 1902 if (shouldRecordStats) { | 1902 if (shouldRecordStats) { |
| 1903 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", | 1903 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", |
| 1904 "resolverAccessCount", styleEngine().styleForElementCount() - initia
lElementCount, | 1904 "resolverAccessCount", styleEngine().styleForElementCount() - initia
lElementCount, |
| 1905 "counters", styleEngine().stats()->toTracedValue()); | 1905 "counters", styleEngine().stats()->toTracedValue()); |
| 1906 } else { | 1906 } else { |
| 1907 TRACE_EVENT_END1("blink,blink_style", "Document::updateStyle", | 1907 TRACE_EVENT_END1("blink,blink_style", "Document::updateStyle", |
| 1908 "resolverAccessCount", styleEngine().styleForElementCount() - initia
lElementCount); | 1908 "resolverAccessCount", styleEngine().styleForElementCount() - initia
lElementCount); |
| 1909 } | 1909 } |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 void Document::notifyLayoutTreeOfSubtreeChanges() | 1912 void Document::notifyLayoutTreeOfSubtreeChanges() |
| 1913 { | 1913 { |
| 1914 if (!layoutView()->wasNotifiedOfSubtreeChange()) | 1914 if (!layoutView()->wasNotifiedOfSubtreeChange()) |
| 1915 return; | 1915 return; |
| 1916 | 1916 |
| 1917 m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange); | 1917 m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange); |
| 1918 | 1918 |
| 1919 layoutView()->handleSubtreeModifications(); | 1919 layoutView()->handleSubtreeModifications(); |
| 1920 ASSERT(!layoutView()->wasNotifiedOfSubtreeChange()); | 1920 DCHECK(!layoutView()->wasNotifiedOfSubtreeChange()); |
| 1921 | 1921 |
| 1922 m_lifecycle.advanceTo(DocumentLifecycle::LayoutSubtreeChangeClean); | 1922 m_lifecycle.advanceTo(DocumentLifecycle::LayoutSubtreeChangeClean); |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 bool Document::needsLayoutTreeUpdateForNode(const Node& node) const | 1925 bool Document::needsLayoutTreeUpdateForNode(const Node& node) const |
| 1926 { | 1926 { |
| 1927 if (!node.canParticipateInFlatTree()) | 1927 if (!node.canParticipateInFlatTree()) |
| 1928 return false; | 1928 return false; |
| 1929 if (!needsLayoutTreeUpdate()) | 1929 if (!needsLayoutTreeUpdate()) |
| 1930 return false; | 1930 return false; |
| 1931 if (!node.inShadowIncludingDocument()) | 1931 if (!node.inShadowIncludingDocument()) |
| 1932 return false; | 1932 return false; |
| 1933 | 1933 |
| 1934 if (needsFullLayoutTreeUpdate() || node.needsStyleRecalc() || node.needsStyl
eInvalidation()) | 1934 if (needsFullLayoutTreeUpdate() || node.needsStyleRecalc() || node.needsStyl
eInvalidation()) |
| 1935 return true; | 1935 return true; |
| 1936 for (const ContainerNode* ancestor = LayoutTreeBuilderTraversal::parent(node
); ancestor; ancestor = LayoutTreeBuilderTraversal::parent(*ancestor)) { | 1936 for (const ContainerNode* ancestor = LayoutTreeBuilderTraversal::parent(node
); ancestor; ancestor = LayoutTreeBuilderTraversal::parent(*ancestor)) { |
| 1937 if (ancestor->needsStyleRecalc() || ancestor->needsStyleInvalidation() |
| ancestor->needsAdjacentStyleRecalc()) | 1937 if (ancestor->needsStyleRecalc() || ancestor->needsStyleInvalidation() |
| ancestor->needsAdjacentStyleRecalc()) |
| 1938 return true; | 1938 return true; |
| 1939 } | 1939 } |
| 1940 return false; | 1940 return false; |
| 1941 } | 1941 } |
| 1942 | 1942 |
| 1943 void Document::updateLayoutTreeForNode(Node* node) | 1943 void Document::updateLayoutTreeForNode(Node* node) |
| 1944 { | 1944 { |
| 1945 ASSERT(node); | 1945 DCHECK(node); |
| 1946 if (!needsLayoutTreeUpdateForNode(*node)) | 1946 if (!needsLayoutTreeUpdateForNode(*node)) |
| 1947 return; | 1947 return; |
| 1948 updateLayoutTree(); | 1948 updateLayoutTree(); |
| 1949 } | 1949 } |
| 1950 | 1950 |
| 1951 void Document::updateLayoutIgnorePendingStylesheetsForNode(Node* node) | 1951 void Document::updateLayoutIgnorePendingStylesheetsForNode(Node* node) |
| 1952 { | 1952 { |
| 1953 ASSERT(node); | 1953 DCHECK(node); |
| 1954 if (!node->inActiveDocument()) | 1954 if (!node->inActiveDocument()) |
| 1955 return; | 1955 return; |
| 1956 updateLayoutIgnorePendingStylesheets(); | 1956 updateLayoutIgnorePendingStylesheets(); |
| 1957 } | 1957 } |
| 1958 | 1958 |
| 1959 void Document::updateLayout() | 1959 void Document::updateLayout() |
| 1960 { | 1960 { |
| 1961 ASSERT(isMainThread()); | 1961 DCHECK(isMainThread()); |
| 1962 | 1962 |
| 1963 ScriptForbiddenScope forbidScript; | 1963 ScriptForbiddenScope forbidScript; |
| 1964 | 1964 |
| 1965 RawPtr<FrameView> frameView = view(); | 1965 RawPtr<FrameView> frameView = view(); |
| 1966 if (frameView && frameView->isInPerformLayout()) { | 1966 if (frameView && frameView->isInPerformLayout()) { |
| 1967 // View layout should not be re-entrant. | 1967 // View layout should not be re-entrant. |
| 1968 ASSERT_NOT_REACHED(); | 1968 ASSERT_NOT_REACHED(); |
| 1969 return; | 1969 return; |
| 1970 } | 1970 } |
| 1971 | 1971 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 return m_styleEngine->resolver(); | 2190 return m_styleEngine->resolver(); |
| 2191 } | 2191 } |
| 2192 | 2192 |
| 2193 StyleResolver& Document::ensureStyleResolver() const | 2193 StyleResolver& Document::ensureStyleResolver() const |
| 2194 { | 2194 { |
| 2195 return m_styleEngine->ensureResolver(); | 2195 return m_styleEngine->ensureResolver(); |
| 2196 } | 2196 } |
| 2197 | 2197 |
| 2198 void Document::attach(const AttachContext& context) | 2198 void Document::attach(const AttachContext& context) |
| 2199 { | 2199 { |
| 2200 ASSERT(m_lifecycle.state() == DocumentLifecycle::Inactive); | 2200 DCHECK_EQ(m_lifecycle.state(), DocumentLifecycle::Inactive); |
| 2201 ASSERT(!m_axObjectCache || this != &axObjectCacheOwner()); | 2201 DCHECK(!m_axObjectCache || this != &axObjectCacheOwner()); |
| 2202 | 2202 |
| 2203 m_layoutView = new LayoutView(this); | 2203 m_layoutView = new LayoutView(this); |
| 2204 setLayoutObject(m_layoutView); | 2204 setLayoutObject(m_layoutView); |
| 2205 | 2205 |
| 2206 m_layoutView->setIsInWindow(true); | 2206 m_layoutView->setIsInWindow(true); |
| 2207 m_layoutView->setStyle(StyleResolver::styleForDocument(*this)); | 2207 m_layoutView->setStyle(StyleResolver::styleForDocument(*this)); |
| 2208 m_layoutView->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter
CompositingInputChange); | 2208 m_layoutView->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter
CompositingInputChange); |
| 2209 | 2209 |
| 2210 ContainerNode::attach(context); | 2210 ContainerNode::attach(context); |
| 2211 | 2211 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2355 if (LocalDOMWindow* domWindow = this->domWindow()) | 2355 if (LocalDOMWindow* domWindow = this->domWindow()) |
| 2356 domWindow->removeAllEventListeners(); | 2356 domWindow->removeAllEventListeners(); |
| 2357 } | 2357 } |
| 2358 | 2358 |
| 2359 Document& Document::axObjectCacheOwner() const | 2359 Document& Document::axObjectCacheOwner() const |
| 2360 { | 2360 { |
| 2361 // Every document has its own axObjectCache if accessibility is enabled, | 2361 // Every document has its own axObjectCache if accessibility is enabled, |
| 2362 // except for page popups, which share the axObjectCache of their owner. | 2362 // except for page popups, which share the axObjectCache of their owner. |
| 2363 Document* doc = const_cast<Document*>(this); | 2363 Document* doc = const_cast<Document*>(this); |
| 2364 if (doc->frame() && doc->frame()->pagePopupOwner()) { | 2364 if (doc->frame() && doc->frame()->pagePopupOwner()) { |
| 2365 ASSERT(!doc->m_axObjectCache); | 2365 DCHECK(!doc->m_axObjectCache); |
| 2366 return doc->frame()->pagePopupOwner()->document().axObjectCacheOwner(); | 2366 return doc->frame()->pagePopupOwner()->document().axObjectCacheOwner(); |
| 2367 } | 2367 } |
| 2368 return *doc; | 2368 return *doc; |
| 2369 } | 2369 } |
| 2370 | 2370 |
| 2371 void Document::clearAXObjectCache() | 2371 void Document::clearAXObjectCache() |
| 2372 { | 2372 { |
| 2373 ASSERT(&axObjectCacheOwner() == this); | 2373 DCHECK_EQ(&axObjectCacheOwner(), this); |
| 2374 // Clear the cache member variable before calling delete because attempts | 2374 // Clear the cache member variable before calling delete because attempts |
| 2375 // are made to access it during destruction. | 2375 // are made to access it during destruction. |
| 2376 if (m_axObjectCache) | 2376 if (m_axObjectCache) |
| 2377 m_axObjectCache->dispose(); | 2377 m_axObjectCache->dispose(); |
| 2378 m_axObjectCache.clear(); | 2378 m_axObjectCache.clear(); |
| 2379 } | 2379 } |
| 2380 | 2380 |
| 2381 AXObjectCache* Document::existingAXObjectCache() const | 2381 AXObjectCache* Document::existingAXObjectCache() const |
| 2382 { | 2382 { |
| 2383 // If the layoutObject is gone then we are in the process of destruction. | 2383 // If the layoutObject is gone then we are in the process of destruction. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2397 // The only document that actually has a AXObjectCache is the top-level | 2397 // The only document that actually has a AXObjectCache is the top-level |
| 2398 // document. This is because we need to be able to get from any WebCoreAXOb
ject | 2398 // document. This is because we need to be able to get from any WebCoreAXOb
ject |
| 2399 // to any other WebCoreAXObject on the same page. Using a single cache allo
ws | 2399 // to any other WebCoreAXObject on the same page. Using a single cache allo
ws |
| 2400 // lookups across nested webareas (i.e. multiple documents). | 2400 // lookups across nested webareas (i.e. multiple documents). |
| 2401 Document& cacheOwner = this->axObjectCacheOwner(); | 2401 Document& cacheOwner = this->axObjectCacheOwner(); |
| 2402 | 2402 |
| 2403 // If the document has already been detached, do not make a new axObjectCach
e. | 2403 // If the document has already been detached, do not make a new axObjectCach
e. |
| 2404 if (!cacheOwner.layoutView()) | 2404 if (!cacheOwner.layoutView()) |
| 2405 return 0; | 2405 return 0; |
| 2406 | 2406 |
| 2407 ASSERT(&cacheOwner == this || !m_axObjectCache); | 2407 DCHECK(&cacheOwner == this || !m_axObjectCache); |
| 2408 if (!cacheOwner.m_axObjectCache) | 2408 if (!cacheOwner.m_axObjectCache) |
| 2409 cacheOwner.m_axObjectCache = AXObjectCache::create(cacheOwner); | 2409 cacheOwner.m_axObjectCache = AXObjectCache::create(cacheOwner); |
| 2410 return cacheOwner.m_axObjectCache.get(); | 2410 return cacheOwner.m_axObjectCache.get(); |
| 2411 } | 2411 } |
| 2412 | 2412 |
| 2413 CanvasFontCache* Document::canvasFontCache() | 2413 CanvasFontCache* Document::canvasFontCache() |
| 2414 { | 2414 { |
| 2415 if (!m_canvasFontCache) | 2415 if (!m_canvasFontCache) |
| 2416 m_canvasFontCache = CanvasFontCache::create(*this); | 2416 m_canvasFontCache = CanvasFontCache::create(*this); |
| 2417 | 2417 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2460 setSecurityOrigin(enteredDocument->getSecurityOrigin()); | 2460 setSecurityOrigin(enteredDocument->getSecurityOrigin()); |
| 2461 setURL(enteredDocument->url()); | 2461 setURL(enteredDocument->url()); |
| 2462 m_cookieURL = enteredDocument->cookieURL(); | 2462 m_cookieURL = enteredDocument->cookieURL(); |
| 2463 } | 2463 } |
| 2464 | 2464 |
| 2465 open(); | 2465 open(); |
| 2466 } | 2466 } |
| 2467 | 2467 |
| 2468 void Document::open() | 2468 void Document::open() |
| 2469 { | 2469 { |
| 2470 ASSERT(!importLoader()); | 2470 DCHECK(!importLoader()); |
| 2471 | 2471 |
| 2472 if (m_frame) { | 2472 if (m_frame) { |
| 2473 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) { | 2473 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) { |
| 2474 if (parser->isParsing()) { | 2474 if (parser->isParsing()) { |
| 2475 // FIXME: HTML5 doesn't tell us to check this, it might not be c
orrect. | 2475 // FIXME: HTML5 doesn't tell us to check this, it might not be c
orrect. |
| 2476 if (parser->isExecutingScript()) | 2476 if (parser->isExecutingScript()) |
| 2477 return; | 2477 return; |
| 2478 | 2478 |
| 2479 if (!parser->wasCreatedByScript() && parser->hasInsertionPoint()
) | 2479 if (!parser->wasCreatedByScript() && parser->hasInsertionPoint()
) |
| 2480 return; | 2480 return; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2510 detachParser(); | 2510 detachParser(); |
| 2511 setParsingState(FinishedParsing); | 2511 setParsingState(FinishedParsing); |
| 2512 setReadyState(Complete); | 2512 setReadyState(Complete); |
| 2513 } | 2513 } |
| 2514 | 2514 |
| 2515 RawPtr<DocumentParser> Document::implicitOpen(ParserSynchronizationPolicy parser
SyncPolicy) | 2515 RawPtr<DocumentParser> Document::implicitOpen(ParserSynchronizationPolicy parser
SyncPolicy) |
| 2516 { | 2516 { |
| 2517 detachParser(); | 2517 detachParser(); |
| 2518 | 2518 |
| 2519 removeChildren(); | 2519 removeChildren(); |
| 2520 ASSERT(!m_focusedElement); | 2520 DCHECK(!m_focusedElement); |
| 2521 | 2521 |
| 2522 setCompatibilityMode(NoQuirksMode); | 2522 setCompatibilityMode(NoQuirksMode); |
| 2523 | 2523 |
| 2524 if (!threadedParsingEnabledForTesting()) | 2524 if (!threadedParsingEnabledForTesting()) |
| 2525 parserSyncPolicy = ForceSynchronousParsing; | 2525 parserSyncPolicy = ForceSynchronousParsing; |
| 2526 | 2526 |
| 2527 m_parserSyncPolicy = parserSyncPolicy; | 2527 m_parserSyncPolicy = parserSyncPolicy; |
| 2528 m_parser = createParser(); | 2528 m_parser = createParser(); |
| 2529 DocumentParserTiming::from(*this).markParserStart(); | 2529 DocumentParserTiming::from(*this).markParserStart(); |
| 2530 setParsingState(Parsing); | 2530 setParsingState(Parsing); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 // the load event prematurely <http://bugs.webkit.org/show_bug.cgi?id=14
568>. | 2650 // the load event prematurely <http://bugs.webkit.org/show_bug.cgi?id=14
568>. |
| 2651 implicitClose(); | 2651 implicitClose(); |
| 2652 return; | 2652 return; |
| 2653 } | 2653 } |
| 2654 | 2654 |
| 2655 m_frame->loader().checkCompleted(); | 2655 m_frame->loader().checkCompleted(); |
| 2656 } | 2656 } |
| 2657 | 2657 |
| 2658 void Document::implicitClose() | 2658 void Document::implicitClose() |
| 2659 { | 2659 { |
| 2660 ASSERT(!inStyleRecalc()); | 2660 DCHECK(!inStyleRecalc()); |
| 2661 if (processingLoadEvent() || !m_parser) | 2661 if (processingLoadEvent() || !m_parser) |
| 2662 return; | 2662 return; |
| 2663 if (frame() && frame()->navigationScheduler().locationChangePending()) { | 2663 if (frame() && frame()->navigationScheduler().locationChangePending()) { |
| 2664 suppressLoadEvent(); | 2664 suppressLoadEvent(); |
| 2665 return; | 2665 return; |
| 2666 } | 2666 } |
| 2667 | 2667 |
| 2668 // The call to dispatchWindowLoadEvent (from documentWasClosed()) can detach | 2668 // The call to dispatchWindowLoadEvent (from documentWasClosed()) can detach |
| 2669 // the LocalDOMWindow and cause it (and its attached Document) to be | 2669 // the LocalDOMWindow and cause it (and its attached Document) to be |
| 2670 // destroyed. | 2670 // destroyed. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2813 return; | 2813 return; |
| 2814 | 2814 |
| 2815 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed | 2815 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed |
| 2816 // while dispatching the event, so protect it to prevent writing the
end | 2816 // while dispatching the event, so protect it to prevent writing the
end |
| 2817 // time into freed memory. | 2817 // time into freed memory. |
| 2818 RawPtr<DocumentLoader> documentLoader = m_frame->loader().provisiona
lDocumentLoader(); | 2818 RawPtr<DocumentLoader> documentLoader = m_frame->loader().provisiona
lDocumentLoader(); |
| 2819 m_loadEventProgress = UnloadEventInProgress; | 2819 m_loadEventProgress = UnloadEventInProgress; |
| 2820 RawPtr<Event> unloadEvent(Event::create(EventTypeNames::unload)); | 2820 RawPtr<Event> unloadEvent(Event::create(EventTypeNames::unload)); |
| 2821 if (documentLoader && !documentLoader->timing().unloadEventStart() &
& !documentLoader->timing().unloadEventEnd()) { | 2821 if (documentLoader && !documentLoader->timing().unloadEventStart() &
& !documentLoader->timing().unloadEventEnd()) { |
| 2822 DocumentLoadTiming& timing = documentLoader->timing(); | 2822 DocumentLoadTiming& timing = documentLoader->timing(); |
| 2823 ASSERT(timing.navigationStart()); | 2823 DCHECK(timing.navigationStart()); |
| 2824 timing.markUnloadEventStart(); | 2824 timing.markUnloadEventStart(); |
| 2825 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, this); | 2825 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, this); |
| 2826 timing.markUnloadEventEnd(); | 2826 timing.markUnloadEventEnd(); |
| 2827 } else { | 2827 } else { |
| 2828 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->d
ocument()); | 2828 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->d
ocument()); |
| 2829 } | 2829 } |
| 2830 } | 2830 } |
| 2831 m_loadEventProgress = UnloadEventHandled; | 2831 m_loadEventProgress = UnloadEventHandled; |
| 2832 } | 2832 } |
| 2833 | 2833 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2924 bool hasInsertionPoint = m_parser && m_parser->hasInsertionPoint(); | 2924 bool hasInsertionPoint = m_parser && m_parser->hasInsertionPoint(); |
| 2925 | 2925 |
| 2926 if (!hasInsertionPoint && m_ignoreDestructiveWriteCount) { | 2926 if (!hasInsertionPoint && m_ignoreDestructiveWriteCount) { |
| 2927 addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessage
Level, ExceptionMessages::failedToExecute("write", "Document", "It isn't possibl
e to write into a document from an asynchronously-loaded external script unless
it is explicitly opened."))); | 2927 addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessage
Level, ExceptionMessages::failedToExecute("write", "Document", "It isn't possibl
e to write into a document from an asynchronously-loaded external script unless
it is explicitly opened."))); |
| 2928 return; | 2928 return; |
| 2929 } | 2929 } |
| 2930 | 2930 |
| 2931 if (!hasInsertionPoint) | 2931 if (!hasInsertionPoint) |
| 2932 open(enteredDocument, ASSERT_NO_EXCEPTION); | 2932 open(enteredDocument, ASSERT_NO_EXCEPTION); |
| 2933 | 2933 |
| 2934 ASSERT(m_parser); | 2934 DCHECK(m_parser); |
| 2935 m_parser->insert(text); | 2935 m_parser->insert(text); |
| 2936 } | 2936 } |
| 2937 | 2937 |
| 2938 void Document::write(const String& text, Document* enteredDocument, ExceptionSta
te& exceptionState) | 2938 void Document::write(const String& text, Document* enteredDocument, ExceptionSta
te& exceptionState) |
| 2939 { | 2939 { |
| 2940 write(SegmentedString(text), enteredDocument, exceptionState); | 2940 write(SegmentedString(text), enteredDocument, exceptionState); |
| 2941 } | 2941 } |
| 2942 | 2942 |
| 2943 void Document::writeln(const String& text, Document* enteredDocument, ExceptionS
tate& exceptionState) | 2943 void Document::writeln(const String& text, Document* enteredDocument, ExceptionS
tate& exceptionState) |
| 2944 { | 2944 { |
| 2945 write(text, enteredDocument, exceptionState); | 2945 write(text, enteredDocument, exceptionState); |
| 2946 if (exceptionState.hadException()) | 2946 if (exceptionState.hadException()) |
| 2947 return; | 2947 return; |
| 2948 write("\n", enteredDocument); | 2948 write("\n", enteredDocument); |
| 2949 } | 2949 } |
| 2950 | 2950 |
| 2951 void Document::write(LocalDOMWindow* callingWindow, const Vector<String>& text,
ExceptionState& exceptionState) | 2951 void Document::write(LocalDOMWindow* callingWindow, const Vector<String>& text,
ExceptionState& exceptionState) |
| 2952 { | 2952 { |
| 2953 ASSERT(callingWindow); | 2953 DCHECK(callingWindow); |
| 2954 StringBuilder builder; | 2954 StringBuilder builder; |
| 2955 for (const String& string : text) | 2955 for (const String& string : text) |
| 2956 builder.append(string); | 2956 builder.append(string); |
| 2957 write(builder.toString(), callingWindow->document(), exceptionState); | 2957 write(builder.toString(), callingWindow->document(), exceptionState); |
| 2958 } | 2958 } |
| 2959 | 2959 |
| 2960 void Document::writeln(LocalDOMWindow* callingWindow, const Vector<String>& text
, ExceptionState& exceptionState) | 2960 void Document::writeln(LocalDOMWindow* callingWindow, const Vector<String>& text
, ExceptionState& exceptionState) |
| 2961 { | 2961 { |
| 2962 ASSERT(callingWindow); | 2962 DCHECK(callingWindow); |
| 2963 StringBuilder builder; | 2963 StringBuilder builder; |
| 2964 for (const String& string : text) | 2964 for (const String& string : text) |
| 2965 builder.append(string); | 2965 builder.append(string); |
| 2966 writeln(builder.toString(), callingWindow->document(), exceptionState); | 2966 writeln(builder.toString(), callingWindow->document(), exceptionState); |
| 2967 } | 2967 } |
| 2968 | 2968 |
| 2969 const KURL& Document::virtualURL() const | 2969 const KURL& Document::virtualURL() const |
| 2970 { | 2970 { |
| 2971 return m_url; | 2971 return m_url; |
| 2972 } | 2972 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3019 else | 3019 else |
| 3020 m_baseURL = m_url; | 3020 m_baseURL = m_url; |
| 3021 | 3021 |
| 3022 selectorQueryCache().invalidate(); | 3022 selectorQueryCache().invalidate(); |
| 3023 | 3023 |
| 3024 if (!m_baseURL.isValid()) | 3024 if (!m_baseURL.isValid()) |
| 3025 m_baseURL = KURL(); | 3025 m_baseURL = KURL(); |
| 3026 | 3026 |
| 3027 if (m_elemSheet) { | 3027 if (m_elemSheet) { |
| 3028 // Element sheet is silly. It never contains anything. | 3028 // Element sheet is silly. It never contains anything. |
| 3029 ASSERT(!m_elemSheet->contents()->ruleCount()); | 3029 DCHECK(!m_elemSheet->contents()->ruleCount()); |
| 3030 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); | 3030 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); |
| 3031 } | 3031 } |
| 3032 | 3032 |
| 3033 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { | 3033 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { |
| 3034 // Base URL change changes any relative visited links. | 3034 // Base URL change changes any relative visited links. |
| 3035 // FIXME: There are other URLs in the tree that would need to be re-eval
uated on dynamic base URL change. Style should be invalidated too. | 3035 // FIXME: There are other URLs in the tree that would need to be re-eval
uated on dynamic base URL change. Style should be invalidated too. |
| 3036 for (HTMLAnchorElement& anchor : Traversal<HTMLAnchorElement>::startsAft
er(*this)) | 3036 for (HTMLAnchorElement& anchor : Traversal<HTMLAnchorElement>::startsAft
er(*this)) |
| 3037 anchor.invalidateCachedVisitedLinkHash(); | 3037 anchor.invalidateCachedVisitedLinkHash(); |
| 3038 } | 3038 } |
| 3039 } | 3039 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 | 3229 |
| 3230 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources | 3230 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources |
| 3231 // for why we walk the parent chain for srcdoc documents. | 3231 // for why we walk the parent chain for srcdoc documents. |
| 3232 const Document* referrerDocument = this; | 3232 const Document* referrerDocument = this; |
| 3233 if (LocalFrame* frame = m_frame) { | 3233 if (LocalFrame* frame = m_frame) { |
| 3234 while (frame->document()->isSrcdocDocument()) { | 3234 while (frame->document()->isSrcdocDocument()) { |
| 3235 // Srcdoc documents must be local within the containing frame. | 3235 // Srcdoc documents must be local within the containing frame. |
| 3236 frame = toLocalFrame(frame->tree().parent()); | 3236 frame = toLocalFrame(frame->tree().parent()); |
| 3237 // Srcdoc documents cannot be top-level documents, by definition, | 3237 // Srcdoc documents cannot be top-level documents, by definition, |
| 3238 // because they need to be contained in iframes with the srcdoc. | 3238 // because they need to be contained in iframes with the srcdoc. |
| 3239 ASSERT(frame); | 3239 DCHECK(frame); |
| 3240 } | 3240 } |
| 3241 referrerDocument = frame->document(); | 3241 referrerDocument = frame->document(); |
| 3242 } | 3242 } |
| 3243 return referrerDocument->m_url.strippedForUseAsReferrer(); | 3243 return referrerDocument->m_url.strippedForUseAsReferrer(); |
| 3244 } | 3244 } |
| 3245 | 3245 |
| 3246 MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& r
equest, const LayoutPoint& documentPoint, const PlatformMouseEvent& event) | 3246 MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& r
equest, const LayoutPoint& documentPoint, const PlatformMouseEvent& event) |
| 3247 { | 3247 { |
| 3248 ASSERT(!layoutView() || layoutView()->isLayoutView()); | 3248 DCHECK(!layoutView() || layoutView()->isLayoutView()); |
| 3249 | 3249 |
| 3250 // LayoutView::hitTest causes a layout, and we don't want to hit that until
the first | 3250 // LayoutView::hitTest causes a layout, and we don't want to hit that until
the first |
| 3251 // layout because until then, there is nothing shown on the screen - the use
r can't | 3251 // layout because until then, there is nothing shown on the screen - the use
r can't |
| 3252 // have intentionally clicked on something belonging to this page. Furthermo
re, | 3252 // have intentionally clicked on something belonging to this page. Furthermo
re, |
| 3253 // mousemove events before the first layout should not lead to a premature l
ayout() | 3253 // mousemove events before the first layout should not lead to a premature l
ayout() |
| 3254 // happening, which could show a flash of white. | 3254 // happening, which could show a flash of white. |
| 3255 // See also the similar code in EventHandler::hitTestResultAtPoint. | 3255 // See also the similar code in EventHandler::hitTestResultAtPoint. |
| 3256 if (!layoutView() || !view() || !view()->didFirstLayout()) | 3256 if (!layoutView() || !view() || !view()->didFirstLayout()) |
| 3257 return MouseEventWithHitTestResults(event, HitTestResult(request, Layout
Point())); | 3257 return MouseEventWithHitTestResults(event, HitTestResult(request, Layout
Point())); |
| 3258 | 3258 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3507 | 3507 |
| 3508 void Document::styleResolverMayHaveChanged() | 3508 void Document::styleResolverMayHaveChanged() |
| 3509 { | 3509 { |
| 3510 styleEngine().resolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpda
te : AnalyzedStyleUpdate); | 3510 styleEngine().resolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpda
te : AnalyzedStyleUpdate); |
| 3511 | 3511 |
| 3512 if (didLayoutWithPendingStylesheets() && !styleEngine().hasPendingSheets())
{ | 3512 if (didLayoutWithPendingStylesheets() && !styleEngine().hasPendingSheets())
{ |
| 3513 // We need to manually repaint because we avoid doing all repaints in la
yout or style | 3513 // We need to manually repaint because we avoid doing all repaints in la
yout or style |
| 3514 // recalc while sheets are still loading to avoid FOUC. | 3514 // recalc while sheets are still loading to avoid FOUC. |
| 3515 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; | 3515 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; |
| 3516 | 3516 |
| 3517 ASSERT(layoutView() || importsController()); | 3517 DCHECK(layoutView() || importsController()); |
| 3518 if (layoutView()) | 3518 if (layoutView()) |
| 3519 layoutView()->invalidatePaintForViewAndCompositedLayers(); | 3519 layoutView()->invalidatePaintForViewAndCompositedLayers(); |
| 3520 } | 3520 } |
| 3521 } | 3521 } |
| 3522 | 3522 |
| 3523 void Document::setHoverNode(RawPtr<Node> newHoverNode) | 3523 void Document::setHoverNode(RawPtr<Node> newHoverNode) |
| 3524 { | 3524 { |
| 3525 m_hoverNode = newHoverNode; | 3525 m_hoverNode = newHoverNode; |
| 3526 } | 3526 } |
| 3527 | 3527 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3592 } | 3592 } |
| 3593 | 3593 |
| 3594 void Document::setAnnotatedRegions(const Vector<AnnotatedRegionValue>& regions) | 3594 void Document::setAnnotatedRegions(const Vector<AnnotatedRegionValue>& regions) |
| 3595 { | 3595 { |
| 3596 m_annotatedRegions = regions; | 3596 m_annotatedRegions = regions; |
| 3597 setAnnotatedRegionsDirty(false); | 3597 setAnnotatedRegionsDirty(false); |
| 3598 } | 3598 } |
| 3599 | 3599 |
| 3600 bool Document::setFocusedElement(RawPtr<Element> prpNewFocusedElement, const Foc
usParams& params) | 3600 bool Document::setFocusedElement(RawPtr<Element> prpNewFocusedElement, const Foc
usParams& params) |
| 3601 { | 3601 { |
| 3602 ASSERT(!m_lifecycle.inDetach()); | 3602 DCHECK(!m_lifecycle.inDetach()); |
| 3603 | 3603 |
| 3604 m_clearFocusedElementTimer.stop(); | 3604 m_clearFocusedElementTimer.stop(); |
| 3605 | 3605 |
| 3606 RawPtr<Element> newFocusedElement = prpNewFocusedElement; | 3606 RawPtr<Element> newFocusedElement = prpNewFocusedElement; |
| 3607 | 3607 |
| 3608 // Make sure newFocusedNode is actually in this document | 3608 // Make sure newFocusedNode is actually in this document |
| 3609 if (newFocusedElement && (newFocusedElement->document() != this)) | 3609 if (newFocusedElement && (newFocusedElement->document() != this)) |
| 3610 return true; | 3610 return true; |
| 3611 | 3611 |
| 3612 if (NodeChildRemovalTracker::isBeingRemoved(newFocusedElement.get())) | 3612 if (NodeChildRemovalTracker::isBeingRemoved(newFocusedElement.get())) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3750 } | 3750 } |
| 3751 | 3751 |
| 3752 void Document::setSequentialFocusNavigationStartingPoint(Node* node) | 3752 void Document::setSequentialFocusNavigationStartingPoint(Node* node) |
| 3753 { | 3753 { |
| 3754 if (!m_frame) | 3754 if (!m_frame) |
| 3755 return; | 3755 return; |
| 3756 if (!node) { | 3756 if (!node) { |
| 3757 m_sequentialFocusNavigationStartingPoint = nullptr; | 3757 m_sequentialFocusNavigationStartingPoint = nullptr; |
| 3758 return; | 3758 return; |
| 3759 } | 3759 } |
| 3760 ASSERT(node->document() == this); | 3760 DCHECK_EQ(node->document(), this); |
| 3761 if (!m_sequentialFocusNavigationStartingPoint) | 3761 if (!m_sequentialFocusNavigationStartingPoint) |
| 3762 m_sequentialFocusNavigationStartingPoint = Range::create(*this); | 3762 m_sequentialFocusNavigationStartingPoint = Range::create(*this); |
| 3763 m_sequentialFocusNavigationStartingPoint->selectNodeContents(node, ASSERT_NO
_EXCEPTION); | 3763 m_sequentialFocusNavigationStartingPoint->selectNodeContents(node, ASSERT_NO
_EXCEPTION); |
| 3764 } | 3764 } |
| 3765 | 3765 |
| 3766 Element* Document::sequentialFocusNavigationStartingPoint(WebFocusType type) con
st | 3766 Element* Document::sequentialFocusNavigationStartingPoint(WebFocusType type) con
st |
| 3767 { | 3767 { |
| 3768 if (m_focusedElement) | 3768 if (m_focusedElement) |
| 3769 return m_focusedElement.get(); | 3769 return m_focusedElement.get(); |
| 3770 if (!m_sequentialFocusNavigationStartingPoint) | 3770 if (!m_sequentialFocusNavigationStartingPoint) |
| 3771 return nullptr; | 3771 return nullptr; |
| 3772 if (!m_sequentialFocusNavigationStartingPoint->collapsed()) { | 3772 if (!m_sequentialFocusNavigationStartingPoint->collapsed()) { |
| 3773 Node* node = m_sequentialFocusNavigationStartingPoint->startContainer(); | 3773 Node* node = m_sequentialFocusNavigationStartingPoint->startContainer(); |
| 3774 ASSERT(node == m_sequentialFocusNavigationStartingPoint->endContainer())
; | 3774 DCHECK_EQ(node, m_sequentialFocusNavigationStartingPoint->endContainer()
); |
| 3775 if (node->isElementNode()) | 3775 if (node->isElementNode()) |
| 3776 return toElement(node); | 3776 return toElement(node); |
| 3777 if (Element* neighborElement = type == WebFocusTypeForward ? ElementTrav
ersal::previous(*node) : ElementTraversal::next(*node)) | 3777 if (Element* neighborElement = type == WebFocusTypeForward ? ElementTrav
ersal::previous(*node) : ElementTraversal::next(*node)) |
| 3778 return neighborElement; | 3778 return neighborElement; |
| 3779 return node->parentOrShadowHostElement(); | 3779 return node->parentOrShadowHostElement(); |
| 3780 } | 3780 } |
| 3781 | 3781 |
| 3782 // Range::selectNodeContents didn't select contents because the element had | 3782 // Range::selectNodeContents didn't select contents because the element had |
| 3783 // no children. | 3783 // no children. |
| 3784 if (m_sequentialFocusNavigationStartingPoint->startContainer()->isElementNod
e() | 3784 if (m_sequentialFocusNavigationStartingPoint->startContainer()->isElementNod
e() |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3803 if (m_cssTarget) | 3803 if (m_cssTarget) |
| 3804 m_cssTarget->pseudoStateChanged(CSSSelector::PseudoTarget); | 3804 m_cssTarget->pseudoStateChanged(CSSSelector::PseudoTarget); |
| 3805 m_cssTarget = newTarget; | 3805 m_cssTarget = newTarget; |
| 3806 if (m_cssTarget) | 3806 if (m_cssTarget) |
| 3807 m_cssTarget->pseudoStateChanged(CSSSelector::PseudoTarget); | 3807 m_cssTarget->pseudoStateChanged(CSSSelector::PseudoTarget); |
| 3808 } | 3808 } |
| 3809 | 3809 |
| 3810 void Document::registerNodeList(const LiveNodeListBase* list) | 3810 void Document::registerNodeList(const LiveNodeListBase* list) |
| 3811 { | 3811 { |
| 3812 #if ENABLE(OILPAN) | 3812 #if ENABLE(OILPAN) |
| 3813 ASSERT(!m_nodeLists[list->invalidationType()].contains(list)); | 3813 DCHECK(!m_nodeLists[list->invalidationType()].contains(list)); |
| 3814 m_nodeLists[list->invalidationType()].add(list); | 3814 m_nodeLists[list->invalidationType()].add(list); |
| 3815 #else | 3815 #else |
| 3816 m_nodeListCounts[list->invalidationType()]++; | 3816 m_nodeListCounts[list->invalidationType()]++; |
| 3817 #endif | 3817 #endif |
| 3818 if (list->isRootedAtTreeScope()) | 3818 if (list->isRootedAtTreeScope()) |
| 3819 m_listsInvalidatedAtDocument.add(list); | 3819 m_listsInvalidatedAtDocument.add(list); |
| 3820 } | 3820 } |
| 3821 | 3821 |
| 3822 void Document::unregisterNodeList(const LiveNodeListBase* list) | 3822 void Document::unregisterNodeList(const LiveNodeListBase* list) |
| 3823 { | 3823 { |
| 3824 #if ENABLE(OILPAN) | 3824 #if ENABLE(OILPAN) |
| 3825 ASSERT(m_nodeLists[list->invalidationType()].contains(list)); | 3825 DCHECK(m_nodeLists[list->invalidationType()].contains(list)); |
| 3826 m_nodeLists[list->invalidationType()].remove(list); | 3826 m_nodeLists[list->invalidationType()].remove(list); |
| 3827 #else | 3827 #else |
| 3828 m_nodeListCounts[list->invalidationType()]--; | 3828 m_nodeListCounts[list->invalidationType()]--; |
| 3829 #endif | 3829 #endif |
| 3830 if (list->isRootedAtTreeScope()) { | 3830 if (list->isRootedAtTreeScope()) { |
| 3831 ASSERT(m_listsInvalidatedAtDocument.contains(list)); | 3831 DCHECK(m_listsInvalidatedAtDocument.contains(list)); |
| 3832 m_listsInvalidatedAtDocument.remove(list); | 3832 m_listsInvalidatedAtDocument.remove(list); |
| 3833 } | 3833 } |
| 3834 } | 3834 } |
| 3835 | 3835 |
| 3836 void Document::registerNodeListWithIdNameCache(const LiveNodeListBase* list) | 3836 void Document::registerNodeListWithIdNameCache(const LiveNodeListBase* list) |
| 3837 { | 3837 { |
| 3838 #if ENABLE(OILPAN) | 3838 #if ENABLE(OILPAN) |
| 3839 ASSERT(!m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); | 3839 DCHECK(!m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); |
| 3840 m_nodeLists[InvalidateOnIdNameAttrChange].add(list); | 3840 m_nodeLists[InvalidateOnIdNameAttrChange].add(list); |
| 3841 #else | 3841 #else |
| 3842 m_nodeListCounts[InvalidateOnIdNameAttrChange]++; | 3842 m_nodeListCounts[InvalidateOnIdNameAttrChange]++; |
| 3843 #endif | 3843 #endif |
| 3844 } | 3844 } |
| 3845 | 3845 |
| 3846 void Document::unregisterNodeListWithIdNameCache(const LiveNodeListBase* list) | 3846 void Document::unregisterNodeListWithIdNameCache(const LiveNodeListBase* list) |
| 3847 { | 3847 { |
| 3848 #if ENABLE(OILPAN) | 3848 #if ENABLE(OILPAN) |
| 3849 ASSERT(m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); | 3849 DCHECK(m_nodeLists[InvalidateOnIdNameAttrChange].contains(list)); |
| 3850 m_nodeLists[InvalidateOnIdNameAttrChange].remove(list); | 3850 m_nodeLists[InvalidateOnIdNameAttrChange].remove(list); |
| 3851 #else | 3851 #else |
| 3852 ASSERT(m_nodeListCounts[InvalidateOnIdNameAttrChange] > 0); | 3852 DCHECK_GT(m_nodeListCounts[InvalidateOnIdNameAttrChange], 0); |
| 3853 m_nodeListCounts[InvalidateOnIdNameAttrChange]--; | 3853 m_nodeListCounts[InvalidateOnIdNameAttrChange]--; |
| 3854 #endif | 3854 #endif |
| 3855 } | 3855 } |
| 3856 | 3856 |
| 3857 void Document::attachNodeIterator(NodeIterator* ni) | 3857 void Document::attachNodeIterator(NodeIterator* ni) |
| 3858 { | 3858 { |
| 3859 m_nodeIterators.add(ni); | 3859 m_nodeIterators.add(ni); |
| 3860 } | 3860 } |
| 3861 | 3861 |
| 3862 void Document::detachNodeIterator(NodeIterator* ni) | 3862 void Document::detachNodeIterator(NodeIterator* ni) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3878 } | 3878 } |
| 3879 | 3879 |
| 3880 void Document::updateRangesAfterChildrenChanged(ContainerNode* container) | 3880 void Document::updateRangesAfterChildrenChanged(ContainerNode* container) |
| 3881 { | 3881 { |
| 3882 for (Range* range : m_ranges) | 3882 for (Range* range : m_ranges) |
| 3883 range->nodeChildrenChanged(container); | 3883 range->nodeChildrenChanged(container); |
| 3884 } | 3884 } |
| 3885 | 3885 |
| 3886 void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node) | 3886 void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node) |
| 3887 { | 3887 { |
| 3888 ASSERT(node.document() != this); | 3888 DCHECK_NE(node.document(), this); |
| 3889 if (m_ranges.isEmpty()) | 3889 if (m_ranges.isEmpty()) |
| 3890 return; | 3890 return; |
| 3891 | 3891 |
| 3892 AttachedRangeSet ranges = m_ranges; | 3892 AttachedRangeSet ranges = m_ranges; |
| 3893 for (Range* range : ranges) | 3893 for (Range* range : ranges) |
| 3894 range->updateOwnerDocumentIfNeeded(); | 3894 range->updateOwnerDocumentIfNeeded(); |
| 3895 } | 3895 } |
| 3896 | 3896 |
| 3897 void Document::nodeChildrenWillBeRemoved(ContainerNode& container) | 3897 void Document::nodeChildrenWillBeRemoved(ContainerNode& container) |
| 3898 { | 3898 { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4047 const OriginAccessEntry& Document::accessEntryFromURL() | 4047 const OriginAccessEntry& Document::accessEntryFromURL() |
| 4048 { | 4048 { |
| 4049 if (!m_accessEntryFromURL) { | 4049 if (!m_accessEntryFromURL) { |
| 4050 m_accessEntryFromURL = adoptPtr(new OriginAccessEntry(url().protocol(),
url().host(), OriginAccessEntry::AllowRegisterableDomains)); | 4050 m_accessEntryFromURL = adoptPtr(new OriginAccessEntry(url().protocol(),
url().host(), OriginAccessEntry::AllowRegisterableDomains)); |
| 4051 } | 4051 } |
| 4052 return *m_accessEntryFromURL; | 4052 return *m_accessEntryFromURL; |
| 4053 } | 4053 } |
| 4054 | 4054 |
| 4055 void Document::registerEventFactory(PassOwnPtr<EventFactoryBase> eventFactory) | 4055 void Document::registerEventFactory(PassOwnPtr<EventFactoryBase> eventFactory) |
| 4056 { | 4056 { |
| 4057 ASSERT(!eventFactories().contains(eventFactory.get())); | 4057 DCHECK(!eventFactories().contains(eventFactory.get())); |
| 4058 eventFactories().add(eventFactory); | 4058 eventFactories().add(eventFactory); |
| 4059 } | 4059 } |
| 4060 | 4060 |
| 4061 RawPtr<Event> Document::createEvent(ExecutionContext* executionContext, const St
ring& eventType, ExceptionState& exceptionState) | 4061 RawPtr<Event> Document::createEvent(ExecutionContext* executionContext, const St
ring& eventType, ExceptionState& exceptionState) |
| 4062 { | 4062 { |
| 4063 RawPtr<Event> event = nullptr; | 4063 RawPtr<Event> event = nullptr; |
| 4064 for (const auto& factory : eventFactories()) { | 4064 for (const auto& factory : eventFactories()) { |
| 4065 event = factory->create(executionContext, eventType); | 4065 event = factory->create(executionContext, eventType); |
| 4066 if (event) | 4066 if (event) |
| 4067 return event.release(); | 4067 return event.release(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4119 return 0; | 4119 return 0; |
| 4120 // FIXME: This probably breaks the attempts to layout after a load is finish
ed in implicitClose(), and probably tons of other things... | 4120 // FIXME: This probably breaks the attempts to layout after a load is finish
ed in implicitClose(), and probably tons of other things... |
| 4121 return frame()->deprecatedLocalOwner(); | 4121 return frame()->deprecatedLocalOwner(); |
| 4122 } | 4122 } |
| 4123 | 4123 |
| 4124 bool Document::isInInvisibleSubframe() const | 4124 bool Document::isInInvisibleSubframe() const |
| 4125 { | 4125 { |
| 4126 if (!ownerElement()) | 4126 if (!ownerElement()) |
| 4127 return false; // this is the root element | 4127 return false; // this is the root element |
| 4128 | 4128 |
| 4129 ASSERT(frame()); | 4129 DCHECK(frame()); |
| 4130 return !frame()->ownerLayoutObject(); | 4130 return !frame()->ownerLayoutObject(); |
| 4131 } | 4131 } |
| 4132 | 4132 |
| 4133 String Document::cookie(ExceptionState& exceptionState) const | 4133 String Document::cookie(ExceptionState& exceptionState) const |
| 4134 { | 4134 { |
| 4135 if (settings() && !settings()->cookieEnabled()) | 4135 if (settings() && !settings()->cookieEnabled()) |
| 4136 return String(); | 4136 return String(); |
| 4137 | 4137 |
| 4138 // FIXME: The HTML5 DOM spec states that this attribute can raise an | 4138 // FIXME: The HTML5 DOM spec states that this attribute can raise an |
| 4139 // InvalidStateError exception on getting if the Document has no | 4139 // InvalidStateError exception on getting if the Document has no |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4266 // Sandboxing a document into a unique origin shouldn't effect first-/third-
party status for | 4266 // Sandboxing a document into a unique origin shouldn't effect first-/third-
party status for |
| 4267 // cookies and site data. | 4267 // cookies and site data. |
| 4268 const OriginAccessEntry& accessEntry = frame()->tree().top()->isLocalFrame() | 4268 const OriginAccessEntry& accessEntry = frame()->tree().top()->isLocalFrame() |
| 4269 ? topDocument().accessEntryFromURL() | 4269 ? topDocument().accessEntryFromURL() |
| 4270 : OriginAccessEntry(topDocumentURL.protocol(), topDocumentURL.host(), Or
iginAccessEntry::AllowRegisterableDomains); | 4270 : OriginAccessEntry(topDocumentURL.protocol(), topDocumentURL.host(), Or
iginAccessEntry::AllowRegisterableDomains); |
| 4271 const Frame* currentFrame = frame(); | 4271 const Frame* currentFrame = frame(); |
| 4272 while (currentFrame) { | 4272 while (currentFrame) { |
| 4273 // Skip over srcdoc documents, as they are always same-origin with their
closest non-srcdoc parent. | 4273 // Skip over srcdoc documents, as they are always same-origin with their
closest non-srcdoc parent. |
| 4274 while (currentFrame->isLocalFrame() && toLocalFrame(currentFrame)->docum
ent()->isSrcdocDocument()) | 4274 while (currentFrame->isLocalFrame() && toLocalFrame(currentFrame)->docum
ent()->isSrcdocDocument()) |
| 4275 currentFrame = currentFrame->tree().parent(); | 4275 currentFrame = currentFrame->tree().parent(); |
| 4276 ASSERT(currentFrame); | 4276 DCHECK(currentFrame); |
| 4277 | 4277 |
| 4278 // We use 'matchesDomain' here, as it turns out that some folks embed HT
TPS login forms | 4278 // We use 'matchesDomain' here, as it turns out that some folks embed HT
TPS login forms |
| 4279 // into HTTP pages; we should allow this kind of upgrade. | 4279 // into HTTP pages; we should allow this kind of upgrade. |
| 4280 if (accessEntry.matchesDomain(*currentFrame->securityContext()->getSecur
ityOrigin()) == OriginAccessEntry::DoesNotMatchOrigin) | 4280 if (accessEntry.matchesDomain(*currentFrame->securityContext()->getSecur
ityOrigin()) == OriginAccessEntry::DoesNotMatchOrigin) |
| 4281 return SecurityOrigin::urlWithUniqueSecurityOrigin(); | 4281 return SecurityOrigin::urlWithUniqueSecurityOrigin(); |
| 4282 | 4282 |
| 4283 currentFrame = currentFrame->tree().parent(); | 4283 currentFrame = currentFrame->tree().parent(); |
| 4284 } | 4284 } |
| 4285 | 4285 |
| 4286 return topDocumentURL; | 4286 return topDocumentURL; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4439 message.appendLiteral("contains the invalid name-start character '"); | 4439 message.appendLiteral("contains the invalid name-start character '"); |
| 4440 message.append(returnValue.character); | 4440 message.append(returnValue.character); |
| 4441 message.appendLiteral("'."); | 4441 message.appendLiteral("'."); |
| 4442 } else if (returnValue.status == QNInvalidChar) { | 4442 } else if (returnValue.status == QNInvalidChar) { |
| 4443 message.appendLiteral("contains the invalid character '"); | 4443 message.appendLiteral("contains the invalid character '"); |
| 4444 message.append(returnValue.character); | 4444 message.append(returnValue.character); |
| 4445 message.appendLiteral("'."); | 4445 message.appendLiteral("'."); |
| 4446 } else if (returnValue.status == QNEmptyPrefix) { | 4446 } else if (returnValue.status == QNEmptyPrefix) { |
| 4447 message.appendLiteral("has an empty namespace prefix."); | 4447 message.appendLiteral("has an empty namespace prefix."); |
| 4448 } else { | 4448 } else { |
| 4449 ASSERT(returnValue.status == QNEmptyLocalName); | 4449 DCHECK_EQ(returnValue.status, QNEmptyLocalName); |
| 4450 message.appendLiteral("has an empty local name."); | 4450 message.appendLiteral("has an empty local name."); |
| 4451 } | 4451 } |
| 4452 | 4452 |
| 4453 if (returnValue.status == QNInvalidStartChar || returnValue.status == QNInva
lidChar) | 4453 if (returnValue.status == QNInvalidStartChar || returnValue.status == QNInva
lidChar) |
| 4454 exceptionState.throwDOMException(InvalidCharacterError, message.toString
()); | 4454 exceptionState.throwDOMException(InvalidCharacterError, message.toString
()); |
| 4455 else | 4455 else |
| 4456 exceptionState.throwDOMException(NamespaceError, message.toString()); | 4456 exceptionState.throwDOMException(NamespaceError, message.toString()); |
| 4457 return false; | 4457 return false; |
| 4458 } | 4458 } |
| 4459 | 4459 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4470 && !ElementTraversal::firstWithin(*m_titleElement) | 4470 && !ElementTraversal::firstWithin(*m_titleElement) |
| 4471 && encoding() == Latin1Encoding() | 4471 && encoding() == Latin1Encoding() |
| 4472 && m_titleElement->textContent().containsOnlyLatin1()) { | 4472 && m_titleElement->textContent().containsOnlyLatin1()) { |
| 4473 | 4473 |
| 4474 CString originalBytes = m_titleElement->textContent().latin1(); | 4474 CString originalBytes = m_titleElement->textContent().latin1(); |
| 4475 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); | 4475 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); |
| 4476 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), DataEOF); | 4476 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), DataEOF); |
| 4477 m_titleElement->setTextContent(correctlyDecodedTitle); | 4477 m_titleElement->setTextContent(correctlyDecodedTitle); |
| 4478 } | 4478 } |
| 4479 | 4479 |
| 4480 ASSERT(newData.encoding().isValid()); | 4480 DCHECK(newData.encoding().isValid()); |
| 4481 m_encodingData = newData; | 4481 m_encodingData = newData; |
| 4482 | 4482 |
| 4483 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 | 4483 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 |
| 4484 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); | 4484 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); |
| 4485 if (shouldUseVisualOrdering != m_visuallyOrdered) { | 4485 if (shouldUseVisualOrdering != m_visuallyOrdered) { |
| 4486 m_visuallyOrdered = shouldUseVisualOrdering; | 4486 m_visuallyOrdered = shouldUseVisualOrdering; |
| 4487 // FIXME: How is possible to not have a layoutObject here? | 4487 // FIXME: How is possible to not have a layoutObject here? |
| 4488 if (layoutView()) | 4488 if (layoutView()) |
| 4489 layoutView()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? V
isualOrder : LogicalOrder); | 4489 layoutView()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? V
isualOrder : LogicalOrder); |
| 4490 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ate(StyleChangeReason::VisuallyOrdered)); | 4490 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::cre
ate(StyleChangeReason::VisuallyOrdered)); |
| 4491 } | 4491 } |
| 4492 } | 4492 } |
| 4493 | 4493 |
| 4494 KURL Document::completeURL(const String& url) const | 4494 KURL Document::completeURL(const String& url) const |
| 4495 { | 4495 { |
| 4496 return completeURLWithOverride(url, m_baseURL); | 4496 return completeURLWithOverride(url, m_baseURL); |
| 4497 } | 4497 } |
| 4498 | 4498 |
| 4499 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const | 4499 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const |
| 4500 { | 4500 { |
| 4501 ASSERT(baseURLOverride.isEmpty() || baseURLOverride.isValid()); | 4501 DCHECK(baseURLOverride.isEmpty() || baseURLOverride.isValid()); |
| 4502 | 4502 |
| 4503 // Always return a null URL when passed a null string. | 4503 // Always return a null URL when passed a null string. |
| 4504 // FIXME: Should we change the KURL constructor to have this behavior? | 4504 // FIXME: Should we change the KURL constructor to have this behavior? |
| 4505 // See also [CSS]StyleSheet::completeURL(const String&) | 4505 // See also [CSS]StyleSheet::completeURL(const String&) |
| 4506 if (url.isNull()) | 4506 if (url.isNull()) |
| 4507 return KURL(); | 4507 return KURL(); |
| 4508 // This logic is deliberately spread over many statements in an attempt to t
rack down http://crbug.com/312410. | 4508 // This logic is deliberately spread over many statements in an attempt to t
rack down http://crbug.com/312410. |
| 4509 const KURL& baseURL = baseURLForOverride(baseURLOverride); | 4509 const KURL& baseURL = baseURLForOverride(baseURLOverride); |
| 4510 if (!encoding().isValid()) | 4510 if (!encoding().isValid()) |
| 4511 return KURL(baseURL, url); | 4511 return KURL(baseURL, url); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4651 | 4651 |
| 4652 HTMLScriptElement* Document::currentScriptForBinding() const | 4652 HTMLScriptElement* Document::currentScriptForBinding() const |
| 4653 { | 4653 { |
| 4654 if (HTMLScriptElement* script = currentScript()) | 4654 if (HTMLScriptElement* script = currentScript()) |
| 4655 return script->isInV1ShadowTree() ? nullptr : script; | 4655 return script->isInV1ShadowTree() ? nullptr : script; |
| 4656 return nullptr; | 4656 return nullptr; |
| 4657 } | 4657 } |
| 4658 | 4658 |
| 4659 void Document::pushCurrentScript(RawPtr<HTMLScriptElement> newCurrentScript) | 4659 void Document::pushCurrentScript(RawPtr<HTMLScriptElement> newCurrentScript) |
| 4660 { | 4660 { |
| 4661 ASSERT(newCurrentScript); | 4661 DCHECK(newCurrentScript); |
| 4662 m_currentScriptStack.append(newCurrentScript); | 4662 m_currentScriptStack.append(newCurrentScript); |
| 4663 } | 4663 } |
| 4664 | 4664 |
| 4665 void Document::popCurrentScript() | 4665 void Document::popCurrentScript() |
| 4666 { | 4666 { |
| 4667 ASSERT(!m_currentScriptStack.isEmpty()); | 4667 DCHECK(!m_currentScriptStack.isEmpty()); |
| 4668 m_currentScriptStack.removeLast(); | 4668 m_currentScriptStack.removeLast(); |
| 4669 } | 4669 } |
| 4670 | 4670 |
| 4671 void Document::setTransformSource(PassOwnPtr<TransformSource> source) | 4671 void Document::setTransformSource(PassOwnPtr<TransformSource> source) |
| 4672 { | 4672 { |
| 4673 m_transformSource = source; | 4673 m_transformSource = source; |
| 4674 } | 4674 } |
| 4675 | 4675 |
| 4676 String Document::designMode() const | 4676 String Document::designMode() const |
| 4677 { | 4677 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4704 } | 4704 } |
| 4705 | 4705 |
| 4706 Document& Document::topDocument() const | 4706 Document& Document::topDocument() const |
| 4707 { | 4707 { |
| 4708 // FIXME: Not clear what topDocument() should do in the OOPI case--should it
return the topmost | 4708 // FIXME: Not clear what topDocument() should do in the OOPI case--should it
return the topmost |
| 4709 // available Document, or something else? | 4709 // available Document, or something else? |
| 4710 Document* doc = const_cast<Document*>(this); | 4710 Document* doc = const_cast<Document*>(this); |
| 4711 for (HTMLFrameOwnerElement* element = doc->ownerElement(); element; element
= doc->ownerElement()) | 4711 for (HTMLFrameOwnerElement* element = doc->ownerElement(); element; element
= doc->ownerElement()) |
| 4712 doc = &element->document(); | 4712 doc = &element->document(); |
| 4713 | 4713 |
| 4714 ASSERT(doc); | 4714 DCHECK(doc); |
| 4715 return *doc; | 4715 return *doc; |
| 4716 } | 4716 } |
| 4717 | 4717 |
| 4718 RawPtr<Document> Document::contextDocument() | 4718 RawPtr<Document> Document::contextDocument() |
| 4719 { | 4719 { |
| 4720 if (m_contextDocument) | 4720 if (m_contextDocument) |
| 4721 return m_contextDocument; | 4721 return m_contextDocument; |
| 4722 if (m_frame) { | 4722 if (m_frame) { |
| 4723 return createWeakPtr(); | 4723 return createWeakPtr(); |
| 4724 } | 4724 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4816 return ensureCachedCollection<WindowNameCollection>(WindowNamedItems, name); | 4816 return ensureCachedCollection<WindowNameCollection>(WindowNamedItems, name); |
| 4817 } | 4817 } |
| 4818 | 4818 |
| 4819 RawPtr<DocumentNameCollection> Document::documentNamedItems(const AtomicString&
name) | 4819 RawPtr<DocumentNameCollection> Document::documentNamedItems(const AtomicString&
name) |
| 4820 { | 4820 { |
| 4821 return ensureCachedCollection<DocumentNameCollection>(DocumentNamedItems, na
me); | 4821 return ensureCachedCollection<DocumentNameCollection>(DocumentNamedItems, na
me); |
| 4822 } | 4822 } |
| 4823 | 4823 |
| 4824 void Document::finishedParsing() | 4824 void Document::finishedParsing() |
| 4825 { | 4825 { |
| 4826 ASSERT(!scriptableDocumentParser() || !m_parser->isParsing()); | 4826 DCHECK(!scriptableDocumentParser() || !m_parser->isParsing()); |
| 4827 ASSERT(!scriptableDocumentParser() || m_readyState != Loading); | 4827 DCHECK(!scriptableDocumentParser() || m_readyState != Loading); |
| 4828 setParsingState(InDOMContentLoaded); | 4828 setParsingState(InDOMContentLoaded); |
| 4829 DocumentParserTiming::from(*this).markParserStop(); | 4829 DocumentParserTiming::from(*this).markParserStop(); |
| 4830 | 4830 |
| 4831 // FIXME: DOMContentLoaded is dispatched synchronously, but this should be d
ispatched in a queued task, | 4831 // FIXME: DOMContentLoaded is dispatched synchronously, but this should be d
ispatched in a queued task, |
| 4832 // See https://crbug.com/425790 | 4832 // See https://crbug.com/425790 |
| 4833 if (!m_documentTiming.domContentLoadedEventStart()) | 4833 if (!m_documentTiming.domContentLoadedEventStart()) |
| 4834 m_documentTiming.markDomContentLoadedEventStart(); | 4834 m_documentTiming.markDomContentLoadedEventStart(); |
| 4835 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); | 4835 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); |
| 4836 if (!m_documentTiming.domContentLoadedEventEnd()) | 4836 if (!m_documentTiming.domContentLoadedEventEnd()) |
| 4837 m_documentTiming.markDomContentLoadedEventEnd(); | 4837 m_documentTiming.markDomContentLoadedEventEnd(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4966 m_frame->selection().updateSecureKeyboardEntryIfActive(); | 4966 m_frame->selection().updateSecureKeyboardEntryIfActive(); |
| 4967 } | 4967 } |
| 4968 | 4968 |
| 4969 bool Document::useSecureKeyboardEntryWhenActive() const | 4969 bool Document::useSecureKeyboardEntryWhenActive() const |
| 4970 { | 4970 { |
| 4971 return m_useSecureKeyboardEntryWhenActive; | 4971 return m_useSecureKeyboardEntryWhenActive; |
| 4972 } | 4972 } |
| 4973 | 4973 |
| 4974 void Document::initSecurityContext(const DocumentInit& initializer) | 4974 void Document::initSecurityContext(const DocumentInit& initializer) |
| 4975 { | 4975 { |
| 4976 ASSERT(!getSecurityOrigin()); | 4976 DCHECK(!getSecurityOrigin()); |
| 4977 | 4977 |
| 4978 if (!initializer.hasSecurityContext()) { | 4978 if (!initializer.hasSecurityContext()) { |
| 4979 // No source for a security context. | 4979 // No source for a security context. |
| 4980 // This can occur via document.implementation.createDocument(). | 4980 // This can occur via document.implementation.createDocument(). |
| 4981 m_cookieURL = KURL(ParsedURLString, emptyString()); | 4981 m_cookieURL = KURL(ParsedURLString, emptyString()); |
| 4982 setSecurityOrigin(SecurityOrigin::createUnique()); | 4982 setSecurityOrigin(SecurityOrigin::createUnique()); |
| 4983 initContentSecurityPolicy(); | 4983 initContentSecurityPolicy(); |
| 4984 // Unique security origins cannot have a suborigin | 4984 // Unique security origins cannot have a suborigin |
| 4985 return; | 4985 return; |
| 4986 } | 4986 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5174 Element* element = focusedElement(); | 5174 Element* element = focusedElement(); |
| 5175 if (!element) | 5175 if (!element) |
| 5176 return; | 5176 return; |
| 5177 updateLayout(); | 5177 updateLayout(); |
| 5178 if (element->isFocusable()) | 5178 if (element->isFocusable()) |
| 5179 element->updateFocusAppearance(m_updateFocusAppearanceSelectionBahavior)
; | 5179 element->updateFocusAppearance(m_updateFocusAppearanceSelectionBahavior)
; |
| 5180 } | 5180 } |
| 5181 | 5181 |
| 5182 void Document::attachRange(Range* range) | 5182 void Document::attachRange(Range* range) |
| 5183 { | 5183 { |
| 5184 ASSERT(!m_ranges.contains(range)); | 5184 DCHECK(!m_ranges.contains(range)); |
| 5185 m_ranges.add(range); | 5185 m_ranges.add(range); |
| 5186 } | 5186 } |
| 5187 | 5187 |
| 5188 void Document::detachRange(Range* range) | 5188 void Document::detachRange(Range* range) |
| 5189 { | 5189 { |
| 5190 // We don't ASSERT m_ranges.contains(range) to allow us to call this | 5190 // We don't ASSERT m_ranges.contains(range) to allow us to call this |
| 5191 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044 | 5191 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044 |
| 5192 m_ranges.remove(range); | 5192 m_ranges.remove(range); |
| 5193 } | 5193 } |
| 5194 | 5194 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5324 { | 5324 { |
| 5325 Page* page = this->page(); | 5325 Page* page = this->page(); |
| 5326 return page && page->defersLoading(); | 5326 return page && page->defersLoading(); |
| 5327 } | 5327 } |
| 5328 | 5328 |
| 5329 void Document::addToTopLayer(Element* element, const Element* before) | 5329 void Document::addToTopLayer(Element* element, const Element* before) |
| 5330 { | 5330 { |
| 5331 if (element->isInTopLayer()) | 5331 if (element->isInTopLayer()) |
| 5332 return; | 5332 return; |
| 5333 | 5333 |
| 5334 ASSERT(!m_topLayerElements.contains(element)); | 5334 DCHECK(!m_topLayerElements.contains(element)); |
| 5335 ASSERT(!before || m_topLayerElements.contains(before)); | 5335 DCHECK(!before || m_topLayerElements.contains(before)); |
| 5336 if (before) { | 5336 if (before) { |
| 5337 size_t beforePosition = m_topLayerElements.find(before); | 5337 size_t beforePosition = m_topLayerElements.find(before); |
| 5338 m_topLayerElements.insert(beforePosition, element); | 5338 m_topLayerElements.insert(beforePosition, element); |
| 5339 } else { | 5339 } else { |
| 5340 m_topLayerElements.append(element); | 5340 m_topLayerElements.append(element); |
| 5341 } | 5341 } |
| 5342 element->setIsInTopLayer(true); | 5342 element->setIsInTopLayer(true); |
| 5343 } | 5343 } |
| 5344 | 5344 |
| 5345 void Document::removeFromTopLayer(Element* element) | 5345 void Document::removeFromTopLayer(Element* element) |
| 5346 { | 5346 { |
| 5347 if (!element->isInTopLayer()) | 5347 if (!element->isInTopLayer()) |
| 5348 return; | 5348 return; |
| 5349 size_t position = m_topLayerElements.find(element); | 5349 size_t position = m_topLayerElements.find(element); |
| 5350 ASSERT(position != kNotFound); | 5350 DCHECK_NE(position, kNotFound); |
| 5351 m_topLayerElements.remove(position); | 5351 m_topLayerElements.remove(position); |
| 5352 element->setIsInTopLayer(false); | 5352 element->setIsInTopLayer(false); |
| 5353 } | 5353 } |
| 5354 | 5354 |
| 5355 HTMLDialogElement* Document::activeModalDialog() const | 5355 HTMLDialogElement* Document::activeModalDialog() const |
| 5356 { | 5356 { |
| 5357 if (m_topLayerElements.isEmpty()) | 5357 if (m_topLayerElements.isEmpty()) |
| 5358 return 0; | 5358 return 0; |
| 5359 return toHTMLDialogElement(m_topLayerElements.last().get()); | 5359 return toHTMLDialogElement(m_topLayerElements.last().get()); |
| 5360 } | 5360 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5382 } | 5382 } |
| 5383 | 5383 |
| 5384 void Document::suppressLoadEvent() | 5384 void Document::suppressLoadEvent() |
| 5385 { | 5385 { |
| 5386 if (!loadEventFinished()) | 5386 if (!loadEventFinished()) |
| 5387 m_loadEventProgress = LoadEventCompleted; | 5387 m_loadEventProgress = LoadEventCompleted; |
| 5388 } | 5388 } |
| 5389 | 5389 |
| 5390 void Document::decrementLoadEventDelayCount() | 5390 void Document::decrementLoadEventDelayCount() |
| 5391 { | 5391 { |
| 5392 ASSERT(m_loadEventDelayCount); | 5392 DCHECK(m_loadEventDelayCount); |
| 5393 --m_loadEventDelayCount; | 5393 --m_loadEventDelayCount; |
| 5394 | 5394 |
| 5395 if (!m_loadEventDelayCount) | 5395 if (!m_loadEventDelayCount) |
| 5396 checkLoadEventSoon(); | 5396 checkLoadEventSoon(); |
| 5397 } | 5397 } |
| 5398 | 5398 |
| 5399 void Document::checkLoadEventSoon() | 5399 void Document::checkLoadEventSoon() |
| 5400 { | 5400 { |
| 5401 if (frame() && !m_loadEventDelayTimer.isActive()) | 5401 if (frame() && !m_loadEventDelayTimer.isActive()) |
| 5402 m_loadEventDelayTimer.startOneShot(0, BLINK_FROM_HERE); | 5402 m_loadEventDelayTimer.startOneShot(0, BLINK_FROM_HERE); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5598 if (currObj1 == currObj2) | 5598 if (currObj1 == currObj2) |
| 5599 return currObj1; | 5599 return currObj1; |
| 5600 } | 5600 } |
| 5601 } | 5601 } |
| 5602 | 5602 |
| 5603 return 0; | 5603 return 0; |
| 5604 } | 5604 } |
| 5605 | 5605 |
| 5606 void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
nerElement) | 5606 void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
nerElement) |
| 5607 { | 5607 { |
| 5608 ASSERT(!request.readOnly()); | 5608 DCHECK(!request.readOnly()); |
| 5609 | 5609 |
| 5610 if (request.active() && m_frame) | 5610 if (request.active() && m_frame) |
| 5611 m_frame->eventHandler().notifyElementActivated(); | 5611 m_frame->eventHandler().notifyElementActivated(); |
| 5612 | 5612 |
| 5613 Element* innerElementInDocument = innerElement; | 5613 Element* innerElementInDocument = innerElement; |
| 5614 while (innerElementInDocument && innerElementInDocument->document() != this)
{ | 5614 while (innerElementInDocument && innerElementInDocument->document() != this)
{ |
| 5615 innerElementInDocument->document().updateHoverActiveState(request, inner
ElementInDocument); | 5615 innerElementInDocument->document().updateHoverActiveState(request, inner
ElementInDocument); |
| 5616 innerElementInDocument = innerElementInDocument->document().ownerElement
(); | 5616 innerElementInDocument = innerElementInDocument->document().ownerElement
(); |
| 5617 } | 5617 } |
| 5618 | 5618 |
| 5619 updateDistribution(); | 5619 updateDistribution(); |
| 5620 Element* oldActiveElement = activeHoverElement(); | 5620 Element* oldActiveElement = activeHoverElement(); |
| 5621 if (oldActiveElement && !request.active()) { | 5621 if (oldActiveElement && !request.active()) { |
| 5622 // The oldActiveElement layoutObject is null, dropped on :active by sett
ing display: none, | 5622 // The oldActiveElement layoutObject is null, dropped on :active by sett
ing display: none, |
| 5623 // for instance. We still need to clear the ActiveChain as the mouse is
released. | 5623 // for instance. We still need to clear the ActiveChain as the mouse is
released. |
| 5624 for (RawPtr<Node> node = oldActiveElement; node; node = FlatTreeTraversa
l::parent(*node)) { | 5624 for (RawPtr<Node> node = oldActiveElement; node; node = FlatTreeTraversa
l::parent(*node)) { |
| 5625 ASSERT(!node->isTextNode()); | 5625 DCHECK(!node->isTextNode()); |
| 5626 node->setActive(false); | 5626 node->setActive(false); |
| 5627 m_userActionElements.setInActiveChain(node.get(), false); | 5627 m_userActionElements.setInActiveChain(node.get(), false); |
| 5628 } | 5628 } |
| 5629 setActiveHoverElement(nullptr); | 5629 setActiveHoverElement(nullptr); |
| 5630 } else { | 5630 } else { |
| 5631 Element* newActiveElement = innerElementInDocument; | 5631 Element* newActiveElement = innerElementInDocument; |
| 5632 if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabl
edFormControl() && request.active() && !request.touchMove()) { | 5632 if (!oldActiveElement && newActiveElement && !newActiveElement->isDisabl
edFormControl() && request.active() && !request.touchMove()) { |
| 5633 // We are setting the :active chain and freezing it. If future moves
happen, they | 5633 // We are setting the :active chain and freezing it. If future moves
happen, they |
| 5634 // will need to reference this chain. | 5634 // will need to reference this chain. |
| 5635 for (Node* node = newActiveElement; node; node = FlatTreeTraversal::
parent(*node)) { | 5635 for (Node* node = newActiveElement; node; node = FlatTreeTraversal::
parent(*node)) { |
| 5636 ASSERT(!node->isTextNode()); | 5636 DCHECK(!node->isTextNode()); |
| 5637 m_userActionElements.setInActiveChain(node, true); | 5637 m_userActionElements.setInActiveChain(node, true); |
| 5638 } | 5638 } |
| 5639 setActiveHoverElement(newActiveElement); | 5639 setActiveHoverElement(newActiveElement); |
| 5640 } | 5640 } |
| 5641 } | 5641 } |
| 5642 // If the mouse has just been pressed, set :active on the chain. Those (and
only those) | 5642 // If the mouse has just been pressed, set :active on the chain. Those (and
only those) |
| 5643 // nodes should remain :active until the mouse is released. | 5643 // nodes should remain :active until the mouse is released. |
| 5644 bool allowActiveChanges = !oldActiveElement && activeHoverElement(); | 5644 bool allowActiveChanges = !oldActiveElement && activeHoverElement(); |
| 5645 | 5645 |
| 5646 // If the mouse is down and if this is a mouse move event, we want to restri
ct changes in | 5646 // If the mouse is down and if this is a mouse move event, we want to restri
ct changes in |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5727 if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormContr
olUIEnabled()) | 5727 if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormContr
olUIEnabled()) |
| 5728 return Locale::defaultLocale(); | 5728 return Locale::defaultLocale(); |
| 5729 LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey,
nullptr); | 5729 LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey,
nullptr); |
| 5730 if (result.isNewEntry) | 5730 if (result.isNewEntry) |
| 5731 result.storedValue->value = Locale::create(localeKey); | 5731 result.storedValue->value = Locale::create(localeKey); |
| 5732 return *(result.storedValue->value); | 5732 return *(result.storedValue->value); |
| 5733 } | 5733 } |
| 5734 | 5734 |
| 5735 AnimationClock& Document::animationClock() | 5735 AnimationClock& Document::animationClock() |
| 5736 { | 5736 { |
| 5737 ASSERT(page()); | 5737 DCHECK(page()); |
| 5738 return page()->animator().clock(); | 5738 return page()->animator().clock(); |
| 5739 } | 5739 } |
| 5740 | 5740 |
| 5741 Document& Document::ensureTemplateDocument() | 5741 Document& Document::ensureTemplateDocument() |
| 5742 { | 5742 { |
| 5743 if (isTemplateDocument()) | 5743 if (isTemplateDocument()) |
| 5744 return *this; | 5744 return *this; |
| 5745 | 5745 |
| 5746 if (m_templateDocument) | 5746 if (m_templateDocument) |
| 5747 return *m_templateDocument; | 5747 return *m_templateDocument; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5804 | 5804 |
| 5805 void Document::setAutofocusElement(Element* element) | 5805 void Document::setAutofocusElement(Element* element) |
| 5806 { | 5806 { |
| 5807 if (!element) { | 5807 if (!element) { |
| 5808 m_autofocusElement = nullptr; | 5808 m_autofocusElement = nullptr; |
| 5809 return; | 5809 return; |
| 5810 } | 5810 } |
| 5811 if (m_hasAutofocused) | 5811 if (m_hasAutofocused) |
| 5812 return; | 5812 return; |
| 5813 m_hasAutofocused = true; | 5813 m_hasAutofocused = true; |
| 5814 ASSERT(!m_autofocusElement); | 5814 DCHECK(!m_autofocusElement); |
| 5815 m_autofocusElement = element; | 5815 m_autofocusElement = element; |
| 5816 m_taskRunner->postTask(BLINK_FROM_HERE, AutofocusTask::create()); | 5816 m_taskRunner->postTask(BLINK_FROM_HERE, AutofocusTask::create()); |
| 5817 } | 5817 } |
| 5818 | 5818 |
| 5819 Element* Document::activeElement() const | 5819 Element* Document::activeElement() const |
| 5820 { | 5820 { |
| 5821 if (Element* element = adjustedFocusedElement()) | 5821 if (Element* element = adjustedFocusedElement()) |
| 5822 return element; | 5822 return element; |
| 5823 return body(); | 5823 return body(); |
| 5824 } | 5824 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5894 styleEngine().platformColorsChanged(); | 5894 styleEngine().platformColorsChanged(); |
| 5895 } | 5895 } |
| 5896 | 5896 |
| 5897 v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate, v8::Local<v8::Object>
creationContext) | 5897 v8::Local<v8::Object> Document::wrap(v8::Isolate* isolate, v8::Local<v8::Object>
creationContext) |
| 5898 { | 5898 { |
| 5899 // It's possible that no one except for the new wrapper owns this object at | 5899 // It's possible that no one except for the new wrapper owns this object at |
| 5900 // this moment, so we have to prevent GC to collect this object until the | 5900 // this moment, so we have to prevent GC to collect this object until the |
| 5901 // object gets associated with the wrapper. | 5901 // object gets associated with the wrapper. |
| 5902 RawPtr<Document> protect(this); | 5902 RawPtr<Document> protect(this); |
| 5903 | 5903 |
| 5904 ASSERT(!DOMDataStore::containsWrapper(this, isolate)); | 5904 DCHECK(!DOMDataStore::containsWrapper(this, isolate)); |
| 5905 | 5905 |
| 5906 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); | 5906 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); |
| 5907 | 5907 |
| 5908 if (frame() && frame()->script().initializeMainWorld()) { | 5908 if (frame() && frame()->script().initializeMainWorld()) { |
| 5909 // initializeMainWorld may have created a wrapper for the object, retry
from the start. | 5909 // initializeMainWorld may have created a wrapper for the object, retry
from the start. |
| 5910 v8::Local<v8::Object> wrapper = DOMDataStore::getWrapper(this, isolate); | 5910 v8::Local<v8::Object> wrapper = DOMDataStore::getWrapper(this, isolate); |
| 5911 if (!wrapper.IsEmpty()) | 5911 if (!wrapper.IsEmpty()) |
| 5912 return wrapper; | 5912 return wrapper; |
| 5913 } | 5913 } |
| 5914 | 5914 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6045 #ifndef NDEBUG | 6045 #ifndef NDEBUG |
| 6046 using namespace blink; | 6046 using namespace blink; |
| 6047 void showLiveDocumentInstances() | 6047 void showLiveDocumentInstances() |
| 6048 { | 6048 { |
| 6049 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 6049 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 6050 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6050 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6051 for (Document* document : set) | 6051 for (Document* document : set) |
| 6052 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6052 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
| 6053 } | 6053 } |
| 6054 #endif | 6054 #endif |
| OLD | NEW |