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

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: Another rebase 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
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.cpp ('k') | Source/core/page/FrameView.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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 return 0; 1004 return 0;
1005 1005
1006 FrameView* view = m_frame->view(); 1006 FrameView* view = m_frame->view();
1007 if (!view) 1007 if (!view)
1008 return 0; 1008 return 0;
1009 1009
1010 // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer. 1010 // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
1011 if (Frame* parent = m_frame->tree()->parent()) 1011 if (Frame* parent = m_frame->tree()->parent())
1012 parent->document()->updateLayoutIgnorePendingStylesheets(); 1012 parent->document()->updateLayoutIgnorePendingStylesheets();
1013 1013
1014 // If the device height is overridden, do not include the horizontal scrollb ar into the innerHeight (since it is absent on the real device). 1014 return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRe ct(ScrollableArea::IncludeScrollbars).height()));
1015 bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenHeightO verride(m_frame);
1016 return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRe ct(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::Exclu deScrollbars).height()));
1017 } 1015 }
1018 1016
1019 int DOMWindow::innerWidth() const 1017 int DOMWindow::innerWidth() const
1020 { 1018 {
1021 if (!m_frame) 1019 if (!m_frame)
1022 return 0; 1020 return 0;
1023 1021
1024 FrameView* view = m_frame->view(); 1022 FrameView* view = m_frame->view();
1025 if (!view) 1023 if (!view)
1026 return 0; 1024 return 0;
1027 1025
1028 // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer. 1026 // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
1029 if (Frame* parent = m_frame->tree()->parent()) 1027 if (Frame* parent = m_frame->tree()->parent())
1030 parent->document()->updateLayoutIgnorePendingStylesheets(); 1028 parent->document()->updateLayoutIgnorePendingStylesheets();
1031 1029
1032 // If the device width is overridden, do not include the vertical scrollbar into the innerWidth (since it is absent on the real device). 1030 return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRe ct(ScrollableArea::IncludeScrollbars).width()));
1033 bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOv erride(m_frame);
1034 return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRe ct(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::Exclu deScrollbars).width()));
1035 } 1031 }
1036 1032
1037 int DOMWindow::screenX() const 1033 int DOMWindow::screenX() const
1038 { 1034 {
1039 if (!m_frame) 1035 if (!m_frame)
1040 return 0; 1036 return 0;
1041 1037
1042 Page* page = m_frame->page(); 1038 Page* page = m_frame->page();
1043 if (!page) 1039 if (!page)
1044 return 0; 1040 return 0;
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN otifier()); 1768 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN otifier());
1773 } 1769 }
1774 1770
1775 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() 1771 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier()
1776 { 1772 {
1777 return DOMWindowLifecycleNotifier::create(this); 1773 return DOMWindowLifecycleNotifier::create(this);
1778 } 1774 }
1779 1775
1780 1776
1781 } // namespace WebCore 1777 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.cpp ('k') | Source/core/page/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698