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

Unified Diff: Source/core/dom/Document.cpp

Issue 33353003: Have Frame::tree() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 38504b3de8f04428b99f5883625c01a2e05d28a0..5470034f15535910b3b3c541f60dc2329a7fe861 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -318,7 +318,7 @@ static bool canAccessAncestor(const SecurityOrigin* activeSecurityOrigin, Frame*
return false;
const bool isLocalActiveOrigin = activeSecurityOrigin->isLocal();
- for (Frame* ancestorFrame = targetFrame; ancestorFrame; ancestorFrame = ancestorFrame->tree()->parent()) {
+ for (Frame* ancestorFrame = targetFrame; ancestorFrame; ancestorFrame = ancestorFrame->tree().parent()) {
Document* ancestorDocument = ancestorFrame->document();
// FIXME: Should be an ASSERT? Frames should alway have documents.
if (!ancestorDocument)
@@ -952,7 +952,7 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& es
if (source->isFrameOwnerElement()) {
HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(source.get());
- if (frame() && frame()->tree()->isDescendantOf(frameOwnerElement->contentFrame())) {
+ if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->contentFrame())) {
es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
return 0;
}
@@ -2728,15 +2728,15 @@ bool Document::canNavigate(Frame* targetFrame)
return true;
// Frame-busting is generally allowed, but blocked for sandboxed frames lacking the 'allow-top-navigation' flag.
- if (!isSandboxed(SandboxTopNavigation) && targetFrame == m_frame->tree()->top())
+ if (!isSandboxed(SandboxTopNavigation) && targetFrame == m_frame->tree().top())
return true;
if (isSandboxed(SandboxNavigation)) {
- if (targetFrame->tree()->isDescendantOf(m_frame))
+ if (targetFrame->tree().isDescendantOf(m_frame))
return true;
const char* reason = "The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors.";
- if (isSandboxed(SandboxTopNavigation) && targetFrame == m_frame->tree()->top())
+ if (isSandboxed(SandboxTopNavigation) && targetFrame == m_frame->tree().top())
reason = "The frame attempting navigation of the top-level window is sandboxed, but the 'allow-top-navigation' flag is not set.";
printNavigationErrorMessage(targetFrame, url(), reason);
@@ -2764,7 +2764,7 @@ bool Document::canNavigate(Frame* targetFrame)
// some way related to the frame being navigate (e.g., by the "opener"
// and/or "parent" relation). Requiring some sort of relation prevents a
// document from navigating arbitrary, unrelated top-level frames.
- if (!targetFrame->tree()->parent()) {
+ if (!targetFrame->tree().parent()) {
if (targetFrame == m_frame->loader()->opener())
return true;
@@ -2779,13 +2779,13 @@ bool Document::canNavigate(Frame* targetFrame)
Frame* Document::findUnsafeParentScrollPropagationBoundary()
{
Frame* currentFrame = m_frame;
- Frame* ancestorFrame = currentFrame->tree()->parent();
+ Frame* ancestorFrame = currentFrame->tree().parent();
while (ancestorFrame) {
if (!ancestorFrame->document()->securityOrigin()->canAccess(securityOrigin()))
return currentFrame;
currentFrame = ancestorFrame;
- ancestorFrame = ancestorFrame->tree()->parent();
+ ancestorFrame = ancestorFrame->tree().parent();
}
return 0;
}
@@ -3211,7 +3211,7 @@ void Document::notifySeamlessChildDocumentsOfStylesheetUpdate() const
return;
// Seamless child frames are expected to notify their seamless children recursively, so we only do direct children.
- for (Frame* child = frame()->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
+ for (Frame* child = frame()->tree().firstChild(); child; child = child->tree().nextSibling()) {
Document* childDocument = child->document();
if (childDocument->shouldDisplaySeamlesslyWithParent()) {
ASSERT(childDocument->seamlessParentIFrame()->document() == this);
@@ -4118,7 +4118,7 @@ KURL Document::openSearchDescriptionURL()
static const char* const openSearchRelation = "search";
// FIXME: Why do only top-level frames have openSearchDescriptionURLs?
- if (!frame() || frame()->tree()->parent())
+ if (!frame() || frame()->tree().parent())
return KURL();
// FIXME: Why do we need to wait for FrameStateComplete?
@@ -4180,7 +4180,7 @@ void Document::setTransformSource(PassOwnPtr<TransformSource> source)
void Document::setDesignMode(InheritedBool value)
{
m_designMode = value;
- for (Frame* frame = m_frame; frame && frame->document(); frame = frame->tree()->traverseNext(m_frame))
+ for (Frame* frame = m_frame; frame && frame->document(); frame = frame->tree().traverseNext(m_frame))
frame->document()->setNeedsStyleRecalc();
}
@@ -4202,7 +4202,7 @@ Document* Document::parentDocument() const
{
if (!m_frame)
return 0;
- Frame* parent = m_frame->tree()->parent();
+ Frame* parent = m_frame->tree().parent();
if (!parent)
return 0;
return parent->document();
@@ -4536,8 +4536,8 @@ void Document::initSecurityContext(const DocumentInit& initializer)
void Document::initContentSecurityPolicy(const ContentSecurityPolicyResponseHeaders& headers)
{
- if (m_frame && m_frame->tree()->parent() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument()))
- contentSecurityPolicy()->copyStateFrom(m_frame->tree()->parent()->document()->contentSecurityPolicy());
+ if (m_frame && m_frame->tree().parent() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument()))
+ contentSecurityPolicy()->copyStateFrom(m_frame->tree().parent()->document()->contentSecurityPolicy());
contentSecurityPolicy()->didReceiveHeaders(headers);
}
@@ -4974,7 +4974,7 @@ void Document::didRemoveTouchEventHandler(Node* handler)
scrollingCoordinator->touchEventTargetRectsDidChange(this);
if (m_touchEventTargets->size())
return;
- for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (frame->document() && frame->document()->hasTouchEventHandlers())
return;
}
« 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