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

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

Issue 317493002: Change FrameTree to return Frames instead of LocalFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: dcheng's comment addressed Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | Source/core/dom/DocumentInit.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3222 } 3222 }
3223 3223
3224 String Document::outgoingReferrer() 3224 String Document::outgoingReferrer()
3225 { 3225 {
3226 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources 3226 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources
3227 // for why we walk the parent chain for srcdoc documents. 3227 // for why we walk the parent chain for srcdoc documents.
3228 Document* referrerDocument = this; 3228 Document* referrerDocument = this;
3229 if (LocalFrame* frame = m_frame) { 3229 if (LocalFrame* frame = m_frame) {
3230 while (frame->document()->isSrcdocDocument()) { 3230 while (frame->document()->isSrcdocDocument()) {
3231 // Srcdoc documents must be local within the containing frame. 3231 // Srcdoc documents must be local within the containing frame.
3232 frame = frame->tree().parent(); 3232 frame = toLocalFrame(frame->tree().parent());
3233 // Srcdoc documents cannot be top-level documents, by definition, 3233 // Srcdoc documents cannot be top-level documents, by definition,
3234 // because they need to be contained in iframes with the srcdoc. 3234 // because they need to be contained in iframes with the srcdoc.
3235 ASSERT(frame); 3235 ASSERT(frame);
3236 } 3236 }
3237 referrerDocument = frame->document(); 3237 referrerDocument = frame->document();
3238 } 3238 }
3239 return referrerDocument->m_url.strippedForUseAsReferrer(); 3239 return referrerDocument->m_url.strippedForUseAsReferrer();
3240 } 3240 }
3241 3241
3242 String Document::outgoingOrigin() const 3242 String Document::outgoingOrigin() const
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
4442 } 4442 }
4443 4443
4444 void Document::setTransformSource(PassOwnPtr<TransformSource> source) 4444 void Document::setTransformSource(PassOwnPtr<TransformSource> source)
4445 { 4445 {
4446 m_transformSource = source; 4446 m_transformSource = source;
4447 } 4447 }
4448 4448
4449 void Document::setDesignMode(InheritedBool value) 4449 void Document::setDesignMode(InheritedBool value)
4450 { 4450 {
4451 m_designMode = value; 4451 m_designMode = value;
4452 for (LocalFrame* frame = m_frame; frame && frame->document(); frame = frame- >tree().traverseNext(m_frame)) 4452 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra me)) {
4453 frame->document()->setNeedsStyleRecalc(SubtreeStyleChange); 4453 if (!frame->isLocalFrame())
4454 continue;
4455 if (!toLocalFrame(frame)->document())
4456 break;
4457 toLocalFrame(frame)->document()->setNeedsStyleRecalc(SubtreeStyleChange) ;
4458 }
4454 } 4459 }
4455 4460
4456 Document::InheritedBool Document::getDesignMode() const 4461 Document::InheritedBool Document::getDesignMode() const
4457 { 4462 {
4458 return m_designMode; 4463 return m_designMode;
4459 } 4464 }
4460 4465
4461 bool Document::inDesignMode() const 4466 bool Document::inDesignMode() const
4462 { 4467 {
4463 for (const Document* d = this; d; d = d->parentDocument()) { 4468 for (const Document* d = this; d; d = d->parentDocument()) {
(...skipping 17 matching lines...) Expand all
4481 mode = off; 4486 mode = off;
4482 else 4487 else
4483 mode = inherit; 4488 mode = inherit;
4484 setDesignMode(mode); 4489 setDesignMode(mode);
4485 } 4490 }
4486 4491
4487 Document* Document::parentDocument() const 4492 Document* Document::parentDocument() const
4488 { 4493 {
4489 if (!m_frame) 4494 if (!m_frame)
4490 return 0; 4495 return 0;
4491 LocalFrame* parent = m_frame->tree().parent(); 4496 Frame* parent = m_frame->tree().parent();
4492 if (!parent) 4497 if (!parent || !parent->isLocalFrame())
4493 return 0; 4498 return 0;
4494 return parent->document(); 4499 return toLocalFrame(parent)->document();
4495 } 4500 }
4496 4501
4497 Document& Document::topDocument() const 4502 Document& Document::topDocument() const
4498 { 4503 {
4499 // FIXME: Not clear what topDocument() should do in the OOPI case--should it return the topmost 4504 // FIXME: Not clear what topDocument() should do in the OOPI case--should it return the topmost
4500 // available Document, or something else? 4505 // available Document, or something else?
4501 Document* doc = const_cast<Document*>(this); 4506 Document* doc = const_cast<Document*>(this);
4502 Element* element; 4507 Element* element;
4503 while ((element = doc->ownerElement())) 4508 while ((element = doc->ownerElement()))
4504 doc = &element->document(); 4509 doc = &element->document();
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
4846 4851
4847 m_cookieURL = initializer.owner()->cookieURL(); 4852 m_cookieURL = initializer.owner()->cookieURL();
4848 // We alias the SecurityOrigins to match Firefox, see Bug 15313 4853 // We alias the SecurityOrigins to match Firefox, see Bug 15313
4849 // https://bugs.webkit.org/show_bug.cgi?id=15313 4854 // https://bugs.webkit.org/show_bug.cgi?id=15313
4850 setSecurityOrigin(initializer.owner()->securityOrigin()); 4855 setSecurityOrigin(initializer.owner()->securityOrigin());
4851 } 4856 }
4852 4857
4853 void Document::initContentSecurityPolicy(const ContentSecurityPolicyResponseHead ers& headers) 4858 void Document::initContentSecurityPolicy(const ContentSecurityPolicyResponseHead ers& headers)
4854 { 4859 {
4855 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument())) 4860 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument()))
4856 contentSecurityPolicy()->copyStateFrom(m_frame->tree().parent()->documen t()->contentSecurityPolicy()); 4861 contentSecurityPolicy()->copyStateFrom(toLocalFrame(m_frame->tree().pare nt())->document()->contentSecurityPolicy());
4857 contentSecurityPolicy()->didReceiveHeaders(headers); 4862 contentSecurityPolicy()->didReceiveHeaders(headers);
4858 } 4863 }
4859 4864
4860 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con st String& contextURL, const WTF::OrdinalNumber& contextLine) 4865 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con st String& contextURL, const WTF::OrdinalNumber& contextLine)
4861 { 4866 {
4862 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi ne)) 4867 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi ne))
4863 return false; 4868 return false;
4864 4869
4865 // HTML says that inline script needs browsing context to create its executi on environment. 4870 // HTML says that inline script needs browsing context to create its executi on environment.
4866 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#event-handler-attributes 4871 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#event-handler-attributes
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
5833 visitor->trace(m_compositorPendingAnimations); 5838 visitor->trace(m_compositorPendingAnimations);
5834 visitor->trace(m_contextDocument); 5839 visitor->trace(m_contextDocument);
5835 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5840 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5836 DocumentSupplementable::trace(visitor); 5841 DocumentSupplementable::trace(visitor);
5837 TreeScope::trace(visitor); 5842 TreeScope::trace(visitor);
5838 ContainerNode::trace(visitor); 5843 ContainerNode::trace(visitor);
5839 ExecutionContext::trace(visitor); 5844 ExecutionContext::trace(visitor);
5840 } 5845 }
5841 5846
5842 } // namespace WebCore 5847 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | Source/core/dom/DocumentInit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698