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

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

Issue 23187005: [DevTools] Use device metrics emulation implemented in content. (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Reupload 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 unified diff | Download patch | Annotate | Revision Log
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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 return 0; 994 return 0;
995 995
996 FrameView* view = m_frame->view(); 996 FrameView* view = m_frame->view();
997 if (!view) 997 if (!view)
998 return 0; 998 return 0;
999 999
1000 // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer. 1000 // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
1001 if (Frame* parent = m_frame->tree()->parent()) 1001 if (Frame* parent = m_frame->tree()->parent())
1002 parent->document()->updateLayoutIgnorePendingStylesheets(); 1002 parent->document()->updateLayoutIgnorePendingStylesheets();
1003 1003
1004 // If the device height is overridden, do not include the horizontal scrollb ar into the innerHeight (since it is absent on the real device). 1004 return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRe ct(ScrollableArea::IncludeScrollbars).height()));
1005 bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenHeightO verride(m_frame);
1006 return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRe ct(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::Exclu deScrollbars).height()));
1007 } 1005 }
1008 1006
1009 int DOMWindow::innerWidth() const 1007 int DOMWindow::innerWidth() const
1010 { 1008 {
1011 if (!m_frame) 1009 if (!m_frame)
1012 return 0; 1010 return 0;
1013 1011
1014 FrameView* view = m_frame->view(); 1012 FrameView* view = m_frame->view();
1015 if (!view) 1013 if (!view)
1016 return 0; 1014 return 0;
1017 1015
1018 // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer. 1016 // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
1019 if (Frame* parent = m_frame->tree()->parent()) 1017 if (Frame* parent = m_frame->tree()->parent())
1020 parent->document()->updateLayoutIgnorePendingStylesheets(); 1018 parent->document()->updateLayoutIgnorePendingStylesheets();
1021 1019
1022 // If the device width is overridden, do not include the vertical scrollbar into the innerWidth (since it is absent on the real device). 1020 return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRe ct(ScrollableArea::IncludeScrollbars).width()));
1023 bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOv erride(m_frame);
1024 return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRe ct(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::Exclu deScrollbars).width()));
1025 } 1021 }
1026 1022
1027 int DOMWindow::screenX() const 1023 int DOMWindow::screenX() const
1028 { 1024 {
1029 if (!m_frame) 1025 if (!m_frame)
1030 return 0; 1026 return 0;
1031 1027
1032 Page* page = m_frame->page(); 1028 Page* page = m_frame->page();
1033 if (!page) 1029 if (!page)
1034 return 0; 1030 return 0;
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN otifier()); 1748 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN otifier());
1753 } 1749 }
1754 1750
1755 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() 1751 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier()
1756 { 1752 {
1757 return DOMWindowLifecycleNotifier::create(this); 1753 return DOMWindowLifecycleNotifier::create(this);
1758 } 1754 }
1759 1755
1760 1756
1761 } // namespace WebCore 1757 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698