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

Side by Side Diff: Source/core/frame/DOMWindow.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/dom/Document.cpp ('k') | Source/core/frame/Frame.h » ('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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 if (set.isEmpty()) 231 if (set.isEmpty())
232 enableSuddenTermination(); 232 enableSuddenTermination();
233 } 233 }
234 234
235 static bool allowsBeforeUnloadListeners(DOMWindow* window) 235 static bool allowsBeforeUnloadListeners(DOMWindow* window)
236 { 236 {
237 ASSERT_ARG(window, window); 237 ASSERT_ARG(window, window);
238 Frame* frame = window->frame(); 238 Frame* frame = window->frame();
239 if (!frame) 239 if (!frame)
240 return false; 240 return false;
241 Page* page = frame->page(); 241 return frame->isMainFrame();
242 if (!page)
243 return false;
244 return frame == page->mainFrame();
245 } 242 }
246 243
247 unsigned DOMWindow::pendingUnloadEventListeners() const 244 unsigned DOMWindow::pendingUnloadEventListeners() const
248 { 245 {
249 return windowsWithUnloadEventListeners().count(const_cast<DOMWindow*>(this)) ; 246 return windowsWithUnloadEventListeners().count(const_cast<DOMWindow*>(this)) ;
250 } 247 }
251 248
252 // This function: 249 // This function:
253 // 1) Validates the pending changes are not changing any value to NaN; in that c ase keep original value. 250 // 1) Validates the pending changes are not changing any value to NaN; in that c ase keep original value.
254 // 2) Constrains the window rect to the minimum window size and no bigger than t he float rect's dimensions. 251 // 2) Constrains the window rect to the minimum window size and no bigger than t he float rect's dimensions.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 if (m_frame->page() && m_frame->view()) { 393 if (m_frame->page() && m_frame->view()) {
397 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) { 394 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) {
398 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), HorizontalScrollbar); 395 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), HorizontalScrollbar);
399 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), VerticalScrollbar); 396 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), VerticalScrollbar);
400 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->vi ew()); 397 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->vi ew());
401 } 398 }
402 } 399 }
403 400
404 m_frame->selection().updateSecureKeyboardEntryIfActive(); 401 m_frame->selection().updateSecureKeyboardEntryIfActive();
405 402
406 if (m_frame->page() && m_frame->page()->mainFrame() == m_frame) { 403 if (m_frame->isMainFrame()) {
407 m_frame->page()->mainFrame()->notifyChromeClientWheelEventHandlerCountCh anged(); 404 m_frame->page()->mainFrame()->notifyChromeClientWheelEventHandlerCountCh anged();
408 if (m_document->hasTouchEventHandlers()) 405 if (m_document->hasTouchEventHandlers())
409 m_frame->page()->chrome().client().needTouchEvents(true); 406 m_frame->page()->chrome().client().needTouchEvents(true);
410 } 407 }
411 408
412 return m_document; 409 return m_document;
413 } 410 }
414 411
415 EventQueue* DOMWindow::eventQueue() const 412 EventQueue* DOMWindow::eventQueue() const
416 { 413 {
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 933
937 bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed(); 934 bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed();
938 if (context) { 935 if (context) {
939 ASSERT(isMainThread()); 936 ASSERT(isMainThread());
940 Document* activeDocument = toDocument(context); 937 Document* activeDocument = toDocument(context);
941 if (opener() && opener() != this && activeDocument->domWindow() == opene r()) 938 if (opener() && opener() != this && activeDocument->domWindow() == opene r())
942 allowFocus = true; 939 allowFocus = true;
943 } 940 }
944 941
945 // If we're a top level window, bring the window to the front. 942 // If we're a top level window, bring the window to the front.
946 if (m_frame == page->mainFrame() && allowFocus) 943 if (m_frame->isMainFrame() && allowFocus)
947 page->chrome().focus(); 944 page->chrome().focus();
948 945
949 if (!m_frame) 946 if (!m_frame)
950 return; 947 return;
951 948
952 m_frame->eventHandler().focusDocumentView(); 949 m_frame->eventHandler().focusDocumentView();
953 } 950 }
954 951
955 void DOMWindow::blur() 952 void DOMWindow::blur()
956 { 953 {
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext::lifecycleN otifier()); 1864 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext::lifecycleN otifier());
1868 } 1865 }
1869 1866
1870 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() 1867 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier()
1871 { 1868 {
1872 return DOMWindowLifecycleNotifier::create(this); 1869 return DOMWindowLifecycleNotifier::create(this);
1873 } 1870 }
1874 1871
1875 1872
1876 } // namespace WebCore 1873 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/frame/Frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698