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

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

Issue 1611693002: Revert of 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"
44 #include "core/frame/Settings.h" 43 #include "core/frame/Settings.h"
45 #include "core/frame/TopControls.h"
46 #include "core/html/HTMLFrameElement.h" 44 #include "core/html/HTMLFrameElement.h"
47 #include "core/html/HTMLPlugInElement.h" 45 #include "core/html/HTMLPlugInElement.h"
48 #include "core/html/HTMLTextFormControlElement.h" 46 #include "core/html/HTMLTextFormControlElement.h"
49 #include "core/html/parser/TextResourceDecoder.h" 47 #include "core/html/parser/TextResourceDecoder.h"
50 #include "core/input/EventHandler.h" 48 #include "core/input/EventHandler.h"
51 #include "core/inspector/InspectorInstrumentation.h" 49 #include "core/inspector/InspectorInstrumentation.h"
52 #include "core/inspector/InspectorTraceEvents.h" 50 #include "core/inspector/InspectorTraceEvents.h"
53 #include "core/layout/LayoutAnalyzer.h" 51 #include "core/layout/LayoutAnalyzer.h"
54 #include "core/layout/LayoutCounter.h" 52 #include "core/layout/LayoutCounter.h"
55 #include "core/layout/LayoutEmbeddedObject.h" 53 #include "core/layout/LayoutEmbeddedObject.h"
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 IntRect parentRect = parent->computeVisibleArea(); 1103 IntRect parentRect = parent->computeVisibleArea();
1106 if (parentRect.isEmpty()) 1104 if (parentRect.isEmpty())
1107 return IntRect(); 1105 return IntRect();
1108 1106
1109 us.intersect(parentRect); 1107 us.intersect(parentRect);
1110 } 1108 }
1111 1109
1112 return us; 1110 return us;
1113 } 1111 }
1114 1112
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
1138 DocumentLifecycle& FrameView::lifecycle() const 1113 DocumentLifecycle& FrameView::lifecycle() const
1139 { 1114 {
1140 return m_frame->document()->lifecycle(); 1115 return m_frame->document()->lifecycle();
1141 } 1116 }
1142 1117
1143 LayoutBox* FrameView::embeddedContentBox() const 1118 LayoutBox* FrameView::embeddedContentBox() const
1144 { 1119 {
1145 LayoutView* layoutView = this->layoutView(); 1120 LayoutView* layoutView = this->layoutView();
1146 if (!layoutView) 1121 if (!layoutView)
1147 return nullptr; 1122 return nullptr;
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after
4045 return m_hiddenForThrottling && m_crossOriginForThrottling; 4020 return m_hiddenForThrottling && m_crossOriginForThrottling;
4046 } 4021 }
4047 4022
4048 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4023 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4049 { 4024 {
4050 ASSERT(layoutView()); 4025 ASSERT(layoutView());
4051 return *layoutView(); 4026 return *layoutView();
4052 } 4027 }
4053 4028
4054 } // namespace blink 4029 } // 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