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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 1573283002: Don't change layout size due to top control show/hide (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant call to viewportSizeForViewportUnits Created 4 years, 11 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
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 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 22 matching lines...) Expand all
33 #include "core/dom/AXObjectCache.h" 33 #include "core/dom/AXObjectCache.h"
34 #include "core/dom/Fullscreen.h" 34 #include "core/dom/Fullscreen.h"
35 #include "core/dom/IntersectionObserverController.h" 35 #include "core/dom/IntersectionObserverController.h"
36 #include "core/editing/EditingUtilities.h" 36 #include "core/editing/EditingUtilities.h"
37 #include "core/editing/FrameSelection.h" 37 #include "core/editing/FrameSelection.h"
38 #include "core/editing/RenderedPosition.h" 38 #include "core/editing/RenderedPosition.h"
39 #include "core/editing/markers/DocumentMarkerController.h" 39 #include "core/editing/markers/DocumentMarkerController.h"
40 #include "core/fetch/ResourceFetcher.h" 40 #include "core/fetch/ResourceFetcher.h"
41 #include "core/frame/FrameHost.h" 41 #include "core/frame/FrameHost.h"
42 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
43 #include "core/frame/PageScaleConstraintsSet.h"
43 #include "core/frame/Settings.h" 44 #include "core/frame/Settings.h"
45 #include "core/frame/TopControls.h"
44 #include "core/html/HTMLFrameElement.h" 46 #include "core/html/HTMLFrameElement.h"
45 #include "core/html/HTMLPlugInElement.h" 47 #include "core/html/HTMLPlugInElement.h"
46 #include "core/html/HTMLTextFormControlElement.h" 48 #include "core/html/HTMLTextFormControlElement.h"
47 #include "core/html/parser/TextResourceDecoder.h" 49 #include "core/html/parser/TextResourceDecoder.h"
48 #include "core/input/EventHandler.h" 50 #include "core/input/EventHandler.h"
49 #include "core/inspector/InspectorInstrumentation.h" 51 #include "core/inspector/InspectorInstrumentation.h"
50 #include "core/inspector/InspectorTraceEvents.h" 52 #include "core/inspector/InspectorTraceEvents.h"
51 #include "core/layout/LayoutAnalyzer.h" 53 #include "core/layout/LayoutAnalyzer.h"
52 #include "core/layout/LayoutCounter.h" 54 #include "core/layout/LayoutCounter.h"
53 #include "core/layout/LayoutEmbeddedObject.h" 55 #include "core/layout/LayoutEmbeddedObject.h"
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 IntRect parentRect = parent->computeVisibleArea(); 1105 IntRect parentRect = parent->computeVisibleArea();
1104 if (parentRect.isEmpty()) 1106 if (parentRect.isEmpty())
1105 return IntRect(); 1107 return IntRect();
1106 1108
1107 us.intersect(parentRect); 1109 us.intersect(parentRect);
1108 } 1110 }
1109 1111
1110 return us; 1112 return us;
1111 } 1113 }
1112 1114
1115 FloatSize FrameView::viewportSizeForViewportUnits() const
1116 {
1117 FloatSize size(layoutSize(IncludeScrollbars));
1118
1119 // We use the layoutSize rather than frameRect to calculate viewport units
1120 // so that we get correct results on mobile where the page is laid out into
1121 // a rect that may be larger than the viewport (e.g. the 980px fallback
1122 // width for desktop pages). Since the layout height is statically set to
1123 // be the viewport with top controls showing, we add the top controls
1124 // height, compensating for page scale as well, since we want to use the
1125 // viewport with top controls hidden for vh (to match Safari).
1126 TopControls& topControls = m_frame->host()->topControls();
1127 if (m_frame->isMainFrame() && size.width()) {
1128 float pageScaleAtLayoutWidth =
1129 m_frame->host()->visualViewport().size().width() / size.width();
1130 size.expand(0, topControls.height() / pageScaleAtLayoutWidth);
1131 }
1132
1133 float scale = frame().pageZoomFactor();
1134 size.scale(1 / scale);
1135 return size;
1136 }
1137
1113 DocumentLifecycle& FrameView::lifecycle() const 1138 DocumentLifecycle& FrameView::lifecycle() const
1114 { 1139 {
1115 return m_frame->document()->lifecycle(); 1140 return m_frame->document()->lifecycle();
1116 } 1141 }
1117 1142
1118 LayoutBox* FrameView::embeddedContentBox() const 1143 LayoutBox* FrameView::embeddedContentBox() const
1119 { 1144 {
1120 LayoutView* layoutView = this->layoutView(); 1145 LayoutView* layoutView = this->layoutView();
1121 if (!layoutView) 1146 if (!layoutView)
1122 return nullptr; 1147 return nullptr;
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after
4020 return m_hiddenForThrottling && m_crossOriginForThrottling; 4045 return m_hiddenForThrottling && m_crossOriginForThrottling;
4021 } 4046 }
4022 4047
4023 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4048 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4024 { 4049 {
4025 ASSERT(layoutView()); 4050 ASSERT(layoutView());
4026 return *layoutView(); 4051 return *layoutView();
4027 } 4052 }
4028 4053
4029 } // namespace blink 4054 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698