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

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: 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 IntRect parentRect = parent->computeVisibleArea(); 1107 IntRect parentRect = parent->computeVisibleArea();
1106 if (parentRect.isEmpty()) 1108 if (parentRect.isEmpty())
1107 return IntRect(); 1109 return IntRect();
1108 1110
1109 us.intersect(parentRect); 1111 us.intersect(parentRect);
1110 } 1112 }
1111 1113
1112 return us; 1114 return us;
1113 } 1115 }
1114 1116
1117 FloatSize FrameView::viewportSizeForViewportUnits() const
1118 {
1119 FloatSize size(layoutSize(IncludeScrollbars));
1120
1121 // We use the layoutSize rather than frameRect to calculate viewport units
1122 // so that we get correct results on mobile where the page is laid out into
1123 // a rect that may be larger than the viewport (e.g. the 980px fallback
1124 // width for desktop pages). Since the layout height is statically set to
1125 // be the viewport with top controls showing, we add the top controls
1126 // height, compensating for page scale as well, since we want to use the
1127 // viewport with top controls hidden for vh (to match Safari).
1128 TopControls& topControls = m_frame->host()->topControls();
1129 if (m_frame->isMainFrame()) {
1130 float pageScale = m_frame->host()->pageScaleConstraintsSet().finalConstr aints().minimumScale;
aelias_OOO_until_Jul13 2016/01/16 04:17:38 This is because of how minimum-scale is also used
bokan 2016/01/19 00:05:31 We say 100vh is the viewport size when top control
aelias_OOO_until_Jul13 2016/01/19 20:26:32 Sounds good, I was going to suggest the same thing
1131 size.expand(0, topControls.height() / pageScale);
1132 }
1133
1134 float scale = frame().pageZoomFactor();
1135 size.scale(1 / scale);
1136 return size;
1137 }
1138
1115 DocumentLifecycle& FrameView::lifecycle() const 1139 DocumentLifecycle& FrameView::lifecycle() const
1116 { 1140 {
1117 return m_frame->document()->lifecycle(); 1141 return m_frame->document()->lifecycle();
1118 } 1142 }
1119 1143
1120 LayoutBox* FrameView::embeddedContentBox() const 1144 LayoutBox* FrameView::embeddedContentBox() const
1121 { 1145 {
1122 LayoutView* layoutView = this->layoutView(); 1146 LayoutView* layoutView = this->layoutView();
1123 if (!layoutView) 1147 if (!layoutView)
1124 return nullptr; 1148 return nullptr;
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after
4032 return m_hiddenForThrottling && m_crossOriginForThrottling; 4056 return m_hiddenForThrottling && m_crossOriginForThrottling;
4033 } 4057 }
4034 4058
4035 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4059 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4036 { 4060 {
4037 ASSERT(layoutView()); 4061 ASSERT(layoutView());
4038 return *layoutView(); 4062 return *layoutView();
4039 } 4063 }
4040 4064
4041 } // namespace blink 4065 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698