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

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: Nit: Remove useless change 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() && size.width()) {
1130 float pageScaleAtLayoutWidth =
1131 m_frame->host()->visualViewport().size().width() / size.width();
1132 size.expand(0, topControls.height() / pageScaleAtLayoutWidth);
1133 }
1134
1135 float scale = frame().pageZoomFactor();
1136 size.scale(1 / scale);
1137 return size;
1138 }
1139
1115 DocumentLifecycle& FrameView::lifecycle() const 1140 DocumentLifecycle& FrameView::lifecycle() const
1116 { 1141 {
1117 return m_frame->document()->lifecycle(); 1142 return m_frame->document()->lifecycle();
1118 } 1143 }
1119 1144
1120 LayoutBox* FrameView::embeddedContentBox() const 1145 LayoutBox* FrameView::embeddedContentBox() const
1121 { 1146 {
1122 LayoutView* layoutView = this->layoutView(); 1147 LayoutView* layoutView = this->layoutView();
1123 if (!layoutView) 1148 if (!layoutView)
1124 return nullptr; 1149 return nullptr;
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after
4032 return m_hiddenForThrottling && m_crossOriginForThrottling; 4057 return m_hiddenForThrottling && m_crossOriginForThrottling;
4033 } 4058 }
4034 4059
4035 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4060 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4036 { 4061 {
4037 ASSERT(layoutView()); 4062 ASSERT(layoutView());
4038 return *layoutView(); 4063 return *layoutView();
4039 } 4064 }
4040 4065
4041 } // namespace blink 4066 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698