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

Side by Side Diff: Source/core/page/Frame.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/FocusController.cpp ('k') | Source/core/page/FrameView.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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 namespace WebCore { 71 namespace WebCore {
72 72
73 using namespace HTMLNames; 73 using namespace HTMLNames;
74 74
75 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame")); 75 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame"));
76 76
77 static inline Frame* parentFromOwnerElement(HTMLFrameOwnerElement* ownerElement) 77 static inline Frame* parentFromOwnerElement(HTMLFrameOwnerElement* ownerElement)
78 { 78 {
79 if (!ownerElement) 79 if (!ownerElement)
80 return 0; 80 return 0;
81 return ownerElement->document()->frame(); 81 return ownerElement->document().frame();
82 } 82 }
83 83
84 static inline float parentPageZoomFactor(Frame* frame) 84 static inline float parentPageZoomFactor(Frame* frame)
85 { 85 {
86 Frame* parent = frame->tree()->parent(); 86 Frame* parent = frame->tree()->parent();
87 if (!parent) 87 if (!parent)
88 return 1; 88 return 1;
89 return parent->pageZoomFactor(); 89 return parent->pageZoomFactor();
90 } 90 }
91 91
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // https://bugs.webkit.org/show_bug.cgi?id=18585 296 // https://bugs.webkit.org/show_bug.cgi?id=18585
297 if (!object->isRenderPart()) 297 if (!object->isRenderPart())
298 return 0; 298 return 0;
299 return toRenderPart(object); 299 return toRenderPart(object);
300 } 300 }
301 301
302 Frame* Frame::frameForWidget(const Widget* widget) 302 Frame* Frame::frameForWidget(const Widget* widget)
303 { 303 {
304 ASSERT_ARG(widget, widget); 304 ASSERT_ARG(widget, widget);
305 305
306 if (RenderWidget* renderer = RenderWidget::find(widget)) 306 if (RenderWidget* renderer = RenderWidget::find(widget)) {
307 if (Node* node = renderer->node()) 307 if (Node* node = renderer->node())
308 return node->document()->frame(); 308 return node->document().frame();
309 }
309 310
310 // Assume all widgets are either a FrameView or owned by a RenderWidget. 311 // Assume all widgets are either a FrameView or owned by a RenderWidget.
311 // FIXME: That assumption is not right for scroll bars! 312 // FIXME: That assumption is not right for scroll bars!
312 ASSERT_WITH_SECURITY_IMPLICATION(widget->isFrameView()); 313 ASSERT_WITH_SECURITY_IMPLICATION(widget->isFrameView());
313 return toFrameView(widget)->frame(); 314 return toFrameView(widget)->frame();
314 } 315 }
315 316
316 void Frame::clearTimers(FrameView *view, Document *document) 317 void Frame::clearTimers(FrameView *view, Document *document)
317 { 318 {
318 if (view) { 319 if (view) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 Document* Frame::documentAtPoint(const IntPoint& point) 427 Document* Frame::documentAtPoint(const IntPoint& point)
427 { 428 {
428 if (!view()) 429 if (!view())
429 return 0; 430 return 0;
430 431
431 IntPoint pt = view()->windowToContents(point); 432 IntPoint pt = view()->windowToContents(point);
432 HitTestResult result = HitTestResult(pt); 433 HitTestResult result = HitTestResult(pt);
433 434
434 if (contentRenderer()) 435 if (contentRenderer())
435 result = eventHandler()->hitTestResultAtPoint(pt, HitTestRequest::ReadOn ly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent); 436 result = eventHandler()->hitTestResultAtPoint(pt, HitTestRequest::ReadOn ly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
436 return result.innerNode() ? result.innerNode()->document() : 0; 437 return result.innerNode() ? &result.innerNode()->document() : 0;
437 } 438 }
438 439
439 PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint) 440 PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint)
440 { 441 {
441 VisiblePosition position = visiblePositionForPoint(framePoint); 442 VisiblePosition position = visiblePositionForPoint(framePoint);
442 if (position.isNull()) 443 if (position.isNull())
443 return 0; 444 return 0;
444 445
445 VisiblePosition previous = position.previous(); 446 VisiblePosition previous = position.previous();
446 if (previous.isNotNull()) { 447 if (previous.isNotNull()) {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 if (!m_page) 710 if (!m_page)
710 return 0; 711 return 0;
711 712
712 double ratio = m_page->deviceScaleFactor(); 713 double ratio = m_page->deviceScaleFactor();
713 if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled()) 714 if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled())
714 ratio *= pageZoomFactor(); 715 ratio *= pageZoomFactor();
715 return ratio; 716 return ratio;
716 } 717 }
717 718
718 } // namespace WebCore 719 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/FocusController.cpp ('k') | Source/core/page/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698