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

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

Issue 59573002: Add Frame::isMainFrame and deploy it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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/frame/Frame.h ('k') | Source/core/frame/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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 document()->prepareForDestruction(); 197 document()->prepareForDestruction();
198 } 198 }
199 199
200 if (m_view) 200 if (m_view)
201 m_view->unscheduleRelayout(); 201 m_view->unscheduleRelayout();
202 202
203 eventHandler().clear(); 203 eventHandler().clear();
204 204
205 m_view = view; 205 m_view = view;
206 206
207 if (m_view && m_page && m_page->mainFrame() == this) 207 if (m_view && isMainFrame())
208 m_view->setVisibleContentScaleFactor(m_page->pageScaleFactor()); 208 m_view->setVisibleContentScaleFactor(m_page->pageScaleFactor());
209 } 209 }
210 210
211 #if ENABLE(ORIENTATION_EVENTS) 211 #if ENABLE(ORIENTATION_EVENTS)
212 void Frame::sendOrientationChangeEvent(int orientation) 212 void Frame::sendOrientationChangeEvent(int orientation)
213 { 213 {
214 m_orientation = orientation; 214 m_orientation = orientation;
215 if (DOMWindow* window = domWindow()) 215 if (DOMWindow* window = domWindow())
216 window->dispatchEvent(Event::create(EventTypeNames::orientationchange)); 216 window->dispatchEvent(Event::create(EventTypeNames::orientationchange));
217 } 217 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 if (ownerElement()) { 351 if (ownerElement()) {
352 if (Document* doc = document()) 352 if (Document* doc = document())
353 doc->topDocument()->clearAXObjectCache(); 353 doc->topDocument()->clearAXObjectCache();
354 ownerElement()->clearContentFrame(); 354 ownerElement()->clearContentFrame();
355 if (m_page) 355 if (m_page)
356 m_page->decrementSubframeCount(); 356 m_page->decrementSubframeCount();
357 } 357 }
358 m_frameInit->setOwnerElement(0); 358 m_frameInit->setOwnerElement(0);
359 } 359 }
360 360
361 bool Frame::isMainFrame() const
362 {
363 return m_page && this == m_page->mainFrame();
364 }
365
361 String Frame::documentTypeString() const 366 String Frame::documentTypeString() const
362 { 367 {
363 if (DocumentType* doctype = document()->doctype()) 368 if (DocumentType* doctype = document()->doctype())
364 return createMarkup(doctype); 369 return createMarkup(doctype);
365 370
366 return String(); 371 return String();
367 } 372 }
368 373
369 String Frame::selectedText() const 374 String Frame::selectedText() const
370 { 375 {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 return 0; 433 return 0;
429 } 434 }
430 435
431 void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor , bool transparent, 436 void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor , bool transparent,
432 ScrollbarMode horizontalScrollbarMode, bool horizontalLock, 437 ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
433 ScrollbarMode verticalScrollbarMode, bool verticalLock) 438 ScrollbarMode verticalScrollbarMode, bool verticalLock)
434 { 439 {
435 ASSERT(this); 440 ASSERT(this);
436 ASSERT(m_page); 441 ASSERT(m_page);
437 442
438 bool isMainFrame = this == m_page->mainFrame(); 443 bool isMainFrame = this->isMainFrame();
439 444
440 if (isMainFrame && view()) 445 if (isMainFrame && view())
441 view()->setParentVisible(false); 446 view()->setParentVisible(false);
442 447
443 setView(0); 448 setView(0);
444 449
445 RefPtr<FrameView> frameView; 450 RefPtr<FrameView> frameView;
446 if (isMainFrame) { 451 if (isMainFrame) {
447 frameView = FrameView::create(this, viewportSize); 452 frameView = FrameView::create(this, viewportSize);
448 453
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 545
541 void Frame::deviceOrPageScaleFactorChanged() 546 void Frame::deviceOrPageScaleFactorChanged()
542 { 547 {
543 for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree() .nextSibling()) 548 for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree() .nextSibling())
544 child->deviceOrPageScaleFactorChanged(); 549 child->deviceOrPageScaleFactorChanged();
545 } 550 }
546 551
547 void Frame::notifyChromeClientWheelEventHandlerCountChanged() const 552 void Frame::notifyChromeClientWheelEventHandlerCountChanged() const
548 { 553 {
549 // Ensure that this method is being called on the main frame of the page. 554 // Ensure that this method is being called on the main frame of the page.
550 ASSERT(m_page && m_page->mainFrame() == this); 555 ASSERT(isMainFrame());
551 556
552 unsigned count = 0; 557 unsigned count = 0;
553 for (const Frame* frame = this; frame; frame = frame->tree().traverseNext()) { 558 for (const Frame* frame = this; frame; frame = frame->tree().traverseNext()) {
554 if (frame->document()) 559 if (frame->document())
555 count += WheelController::from(frame->document())->wheelEventHandler Count(); 560 count += WheelController::from(frame->document())->wheelEventHandler Count();
556 } 561 }
557 562
558 m_page->chrome().client().numWheelEventHandlersChanged(count); 563 m_page->chrome().client().numWheelEventHandlersChanged(count);
559 } 564 }
560 565
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 if (!m_page) 681 if (!m_page)
677 return 0; 682 return 0;
678 683
679 double ratio = m_page->deviceScaleFactor(); 684 double ratio = m_page->deviceScaleFactor();
680 if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled()) 685 if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled())
681 ratio *= pageZoomFactor(); 686 ratio *= pageZoomFactor();
682 return ratio; 687 return ratio;
683 } 688 }
684 689
685 } // namespace WebCore 690 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/Frame.h ('k') | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698