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

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: Fixed conflicts 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
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 3210 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 } 3221 }
3222 3222
3223 String Document::outgoingReferrer() 3223 String Document::outgoingReferrer()
3224 { 3224 {
3225 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources 3225 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources
3226 // for why we walk the parent chain for srcdoc documents. 3226 // for why we walk the parent chain for srcdoc documents.
3227 Document* referrerDocument = this; 3227 Document* referrerDocument = this;
3228 if (LocalFrame* frame = m_frame) { 3228 if (LocalFrame* frame = m_frame) {
3229 while (frame->document()->isSrcdocDocument()) { 3229 while (frame->document()->isSrcdocDocument()) {
3230 // Srcdoc documents must be local within the containing frame. 3230 // Srcdoc documents must be local within the containing frame.
3231 frame = frame->tree().parent(); 3231 frame = toLocalFrame(frame->tree().parent());
3232 // Srcdoc documents cannot be top-level documents, by definition, 3232 // Srcdoc documents cannot be top-level documents, by definition,
3233 // because they need to be contained in iframes with the srcdoc. 3233 // because they need to be contained in iframes with the srcdoc.
3234 ASSERT(frame); 3234 ASSERT(frame);
3235 } 3235 }
3236 referrerDocument = frame->document(); 3236 referrerDocument = frame->document();
3237 } 3237 }
3238 return referrerDocument->m_url.strippedForUseAsReferrer(); 3238 return referrerDocument->m_url.strippedForUseAsReferrer();
3239 } 3239 }
3240 3240
3241 String Document::outgoingOrigin() const 3241 String Document::outgoingOrigin() const
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
4441 } 4441 }
4442 4442
4443 void Document::setTransformSource(PassOwnPtr<TransformSource> source) 4443 void Document::setTransformSource(PassOwnPtr<TransformSource> source)
4444 { 4444 {
4445 m_transformSource = source; 4445 m_transformSource = source;
4446 } 4446 }
4447 4447
4448 void Document::setDesignMode(InheritedBool value) 4448 void Document::setDesignMode(InheritedBool value)
4449 { 4449 {
4450 m_designMode = value; 4450 m_designMode = value;
4451 for (LocalFrame* frame = m_frame; frame && frame->document(); frame = frame- >tree().traverseNext(m_frame)) 4451 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra me)) {
4452 frame->document()->setNeedsStyleRecalc(SubtreeStyleChange); 4452 if (!frame->isLocalFrame())
4453 continue;
4454 if (!toLocalFrame(frame)->document())
4455 break;
4456 toLocalFrame(frame)->document()->setNeedsStyleRecalc(SubtreeStyleChange) ;
4457 }
4453 } 4458 }
4454 4459
4455 Document::InheritedBool Document::getDesignMode() const 4460 Document::InheritedBool Document::getDesignMode() const
4456 { 4461 {
4457 return m_designMode; 4462 return m_designMode;
4458 } 4463 }
4459 4464
4460 bool Document::inDesignMode() const 4465 bool Document::inDesignMode() const
4461 { 4466 {
4462 for (const Document* d = this; d; d = d->parentDocument()) { 4467 for (const Document* d = this; d; d = d->parentDocument()) {
(...skipping 17 matching lines...) Expand all
4480 mode = off; 4485 mode = off;
4481 else 4486 else
4482 mode = inherit; 4487 mode = inherit;
4483 setDesignMode(mode); 4488 setDesignMode(mode);
4484 } 4489 }
4485 4490
4486 Document* Document::parentDocument() const 4491 Document* Document::parentDocument() const
4487 { 4492 {
4488 if (!m_frame) 4493 if (!m_frame)
4489 return 0; 4494 return 0;
4490 LocalFrame* parent = m_frame->tree().parent(); 4495 Frame* parent = m_frame->tree().parent();
4491 if (!parent) 4496 if (!parent || !parent->isLocalFrame())
4492 return 0; 4497 return 0;
4493 return parent->document(); 4498 return toLocalFrame(parent)->document();
4494 } 4499 }
4495 4500
4496 Document& Document::topDocument() const 4501 Document& Document::topDocument() const
4497 { 4502 {
4498 // FIXME: Not clear what topDocument() should do in the OOPI case--should it return the topmost 4503 // FIXME: Not clear what topDocument() should do in the OOPI case--should it return the topmost
4499 // available Document, or something else? 4504 // available Document, or something else?
4500 Document* doc = const_cast<Document*>(this); 4505 Document* doc = const_cast<Document*>(this);
4501 Element* element; 4506 Element* element;
4502 while ((element = doc->ownerElement())) 4507 while ((element = doc->ownerElement()))
4503 doc = &element->document(); 4508 doc = &element->document();
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
4845 4850
4846 m_cookieURL = initializer.owner()->cookieURL(); 4851 m_cookieURL = initializer.owner()->cookieURL();
4847 // We alias the SecurityOrigins to match Firefox, see Bug 15313 4852 // We alias the SecurityOrigins to match Firefox, see Bug 15313
4848 // https://bugs.webkit.org/show_bug.cgi?id=15313 4853 // https://bugs.webkit.org/show_bug.cgi?id=15313
4849 setSecurityOrigin(initializer.owner()->securityOrigin()); 4854 setSecurityOrigin(initializer.owner()->securityOrigin());
4850 } 4855 }
4851 4856
4852 void Document::initContentSecurityPolicy(const ContentSecurityPolicyResponseHead ers& headers) 4857 void Document::initContentSecurityPolicy(const ContentSecurityPolicyResponseHead ers& headers)
4853 { 4858 {
4854 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument())) 4859 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument()))
4855 contentSecurityPolicy()->copyStateFrom(m_frame->tree().parent()->documen t()->contentSecurityPolicy()); 4860 contentSecurityPolicy()->copyStateFrom(toLocalFrame(m_frame->tree().pare nt())->document()->contentSecurityPolicy());
4856 contentSecurityPolicy()->didReceiveHeaders(headers); 4861 contentSecurityPolicy()->didReceiveHeaders(headers);
4857 } 4862 }
4858 4863
4859 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con st String& contextURL, const WTF::OrdinalNumber& contextLine) 4864 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con st String& contextURL, const WTF::OrdinalNumber& contextLine)
4860 { 4865 {
4861 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi ne)) 4866 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi ne))
4862 return false; 4867 return false;
4863 4868
4864 // HTML says that inline script needs browsing context to create its executi on environment. 4869 // HTML says that inline script needs browsing context to create its executi on environment.
4865 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#event-handler-attributes 4870 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#event-handler-attributes
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
5812 visitor->trace(m_compositorPendingAnimations); 5817 visitor->trace(m_compositorPendingAnimations);
5813 visitor->trace(m_contextDocument); 5818 visitor->trace(m_contextDocument);
5814 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5819 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5815 DocumentSupplementable::trace(visitor); 5820 DocumentSupplementable::trace(visitor);
5816 TreeScope::trace(visitor); 5821 TreeScope::trace(visitor);
5817 ContainerNode::trace(visitor); 5822 ContainerNode::trace(visitor);
5818 ExecutionContext::trace(visitor); 5823 ExecutionContext::trace(visitor);
5819 } 5824 }
5820 5825
5821 } // namespace WebCore 5826 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698