Chromium Code Reviews| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2461 FrameNavigationDisabler navigationDisabler(*m_frame); | 2461 FrameNavigationDisabler navigationDisabler(*m_frame); |
| 2462 // Defer FrameViewBase updates to avoid plugins trying to run script inside | 2462 // Defer FrameViewBase updates to avoid plugins trying to run script inside |
| 2463 // ScriptForbiddenScope, which will crash the renderer after | 2463 // ScriptForbiddenScope, which will crash the renderer after |
| 2464 // https://crrev.com/200984 | 2464 // https://crrev.com/200984 |
| 2465 HTMLFrameOwnerElement::UpdateSuspendScope | 2465 HTMLFrameOwnerElement::UpdateSuspendScope |
| 2466 suspendFrameViewBaseHierarchyUpdates; | 2466 suspendFrameViewBaseHierarchyUpdates; |
| 2467 // Don't allow script to run in the middle of detachLayoutTree() because a | 2467 // Don't allow script to run in the middle of detachLayoutTree() because a |
| 2468 // detaching Document is not in a consistent state. | 2468 // detaching Document is not in a consistent state. |
| 2469 ScriptForbiddenScope forbidScript; | 2469 ScriptForbiddenScope forbidScript; |
| 2470 | 2470 |
| 2471 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); | |
| 2471 view()->dispose(); | 2472 view()->dispose(); |
| 2472 | 2473 |
| 2473 // If the FrameViewBase of the document's frame owner doesn't match view() | 2474 // If the FrameViewBase of the document's frame owner doesn't match view() |
| 2474 // then FrameView::dispose() didn't clear the owner's FrameViewBase. If we | 2475 // then FrameView::dispose() didn't clear the owner's FrameViewBase. If we |
| 2475 // don't clear it here, it may be clobbered later in LocalFrame::createView(). | 2476 // don't clear it here, it may be clobbered later in LocalFrame::createView(). |
| 2476 // See also https://crbug.com/673170 and the comment in FrameView::dispose(). | 2477 // See also https://crbug.com/673170 and the comment in FrameView::dispose(). |
| 2477 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 2478 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
| 2478 if (ownerElement) | 2479 if (ownerElement) |
| 2479 ownerElement->setWidget(nullptr); | 2480 ownerElement->setWidget(nullptr); |
| 2480 | 2481 |
| 2481 m_markers->prepareForDestruction(); | 2482 m_markers->prepareForDestruction(); |
| 2482 | 2483 |
| 2483 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); | |
| 2484 | |
| 2485 if (page()) | 2484 if (page()) |
| 2486 page()->documentDetached(this); | 2485 page()->documentDetached(this); |
| 2487 probe::documentDetached(this); | 2486 probe::documentDetached(this); |
| 2488 | 2487 |
| 2489 if (m_frame->loader().client()->sharedWorkerRepositoryClient()) | 2488 if (m_frame->loader().client()->sharedWorkerRepositoryClient()) |
| 2490 m_frame->loader() | 2489 m_frame->loader() |
| 2491 .client() | 2490 .client() |
| 2492 ->sharedWorkerRepositoryClient() | 2491 ->sharedWorkerRepositoryClient() |
| 2493 ->documentDetached(this); | 2492 ->documentDetached(this); |
| 2494 | 2493 |
| (...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4557 HTMLFrameOwnerElement* Document::localOwner() const { | 4556 HTMLFrameOwnerElement* Document::localOwner() const { |
| 4558 if (!frame()) | 4557 if (!frame()) |
| 4559 return 0; | 4558 return 0; |
| 4560 // FIXME: This probably breaks the attempts to layout after a load is finished | 4559 // FIXME: This probably breaks the attempts to layout after a load is finished |
| 4561 // in implicitClose(), and probably tons of other things... | 4560 // in implicitClose(), and probably tons of other things... |
| 4562 return frame()->deprecatedLocalOwner(); | 4561 return frame()->deprecatedLocalOwner(); |
| 4563 } | 4562 } |
| 4564 | 4563 |
| 4565 void Document::willChangeFrameOwnerProperties(int marginWidth, | 4564 void Document::willChangeFrameOwnerProperties(int marginWidth, |
| 4566 int marginHeight, | 4565 int marginHeight, |
| 4567 ScrollbarMode scrollingMode) { | 4566 ScrollbarMode scrollingMode, |
| 4567 bool isDisplayNone) { | |
| 4568 DCHECK(frame() && frame()->owner()); | |
| 4569 FrameOwner* owner = frame()->owner(); | |
| 4570 | |
| 4571 if (documentElement()) { | |
| 4572 if (isDisplayNone != owner->isDisplayNone()) { | |
| 4573 if (m_lifecycle.state() < DocumentLifecycle::Stopping) | |
|
esprehn
2017/03/28 21:49:24
remove this, lazyReattachIfAttached() checks inAct
erikchen
2017/03/29 20:16:54
Done.
| |
| 4574 documentElement()->lazyReattachIfAttached(); | |
| 4575 } | |
| 4576 } | |
| 4577 | |
| 4568 if (!body()) | 4578 if (!body()) |
| 4569 return; | 4579 return; |
| 4570 | 4580 |
| 4571 DCHECK(frame() && frame()->owner()); | |
| 4572 FrameOwner* owner = frame()->owner(); | |
| 4573 | |
| 4574 if (marginWidth != owner->marginWidth()) | 4581 if (marginWidth != owner->marginWidth()) |
| 4575 body()->setIntegralAttribute(marginwidthAttr, marginWidth); | 4582 body()->setIntegralAttribute(marginwidthAttr, marginWidth); |
| 4576 if (marginHeight != owner->marginHeight()) | 4583 if (marginHeight != owner->marginHeight()) |
| 4577 body()->setIntegralAttribute(marginheightAttr, marginHeight); | 4584 body()->setIntegralAttribute(marginheightAttr, marginHeight); |
| 4578 if (scrollingMode != owner->scrollingMode() && view()) | 4585 if (scrollingMode != owner->scrollingMode() && view()) |
| 4579 view()->setNeedsLayout(); | 4586 view()->setNeedsLayout(); |
| 4580 } | 4587 } |
| 4581 | 4588 |
| 4582 bool Document::isInInvisibleSubframe() const { | 4589 bool Document::isInInvisibleSubframe() const { |
| 4583 if (!localOwner()) | 4590 if (!localOwner()) |
| (...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6678 } | 6685 } |
| 6679 | 6686 |
| 6680 void showLiveDocumentInstances() { | 6687 void showLiveDocumentInstances() { |
| 6681 WeakDocumentSet& set = liveDocumentSet(); | 6688 WeakDocumentSet& set = liveDocumentSet(); |
| 6682 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6689 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6683 for (blink::Document* document : set) | 6690 for (blink::Document* document : set) |
| 6684 fprintf(stderr, "- Document %p URL: %s\n", document, | 6691 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6685 document->url().getString().utf8().data()); | 6692 document->url().getString().utf8().data()); |
| 6686 } | 6693 } |
| 6687 #endif | 6694 #endif |
| OLD | NEW |