OLD | NEW |
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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 return IntRect(); | 1130 return IntRect(); |
1131 | 1131 |
1132 us.intersect(parentRect); | 1132 us.intersect(parentRect); |
1133 } | 1133 } |
1134 | 1134 |
1135 return us; | 1135 return us; |
1136 } | 1136 } |
1137 | 1137 |
1138 FloatSize FrameView::viewportSizeForViewportUnits() const | 1138 FloatSize FrameView::viewportSizeForViewportUnits() const |
1139 { | 1139 { |
| 1140 float zoom = frame().pageZoomFactor(); |
| 1141 |
| 1142 if (m_frame->settings() && !RuntimeEnabledFeatures::inertTopControlsEnabled(
)) { |
| 1143 FloatSize viewportSize; |
| 1144 |
| 1145 LayoutView* layoutView = this->layoutView(); |
| 1146 if (!layoutView) |
| 1147 return viewportSize; |
| 1148 |
| 1149 viewportSize.setWidth(layoutView->viewWidth(IncludeScrollbars) / zoom); |
| 1150 viewportSize.setHeight(layoutView->viewHeight(IncludeScrollbars) / zoom)
; |
| 1151 return viewportSize; |
| 1152 } |
| 1153 |
1140 FloatSize size(layoutSize(IncludeScrollbars)); | 1154 FloatSize size(layoutSize(IncludeScrollbars)); |
1141 | 1155 |
1142 // We use the layoutSize rather than frameRect to calculate viewport units | 1156 // We use the layoutSize rather than frameRect to calculate viewport units |
1143 // so that we get correct results on mobile where the page is laid out into | 1157 // so that we get correct results on mobile where the page is laid out into |
1144 // a rect that may be larger than the viewport (e.g. the 980px fallback | 1158 // a rect that may be larger than the viewport (e.g. the 980px fallback |
1145 // width for desktop pages). Since the layout height is statically set to | 1159 // width for desktop pages). Since the layout height is statically set to |
1146 // be the viewport with top controls showing, we add the top controls | 1160 // be the viewport with top controls showing, we add the top controls |
1147 // height, compensating for page scale as well, since we want to use the | 1161 // height, compensating for page scale as well, since we want to use the |
1148 // viewport with top controls hidden for vh (to match Safari). | 1162 // viewport with top controls hidden for vh (to match Safari). |
1149 TopControls& topControls = m_frame->host()->topControls(); | 1163 TopControls& topControls = m_frame->host()->topControls(); |
1150 if (m_frame->isMainFrame() && size.width()) { | 1164 if (m_frame->isMainFrame() && size.width()) { |
1151 float pageScaleAtLayoutWidth = | 1165 float pageScaleAtLayoutWidth = |
1152 m_frame->host()->visualViewport().size().width() / size.width(); | 1166 m_frame->host()->visualViewport().size().width() / size.width(); |
1153 size.expand(0, topControls.height() / pageScaleAtLayoutWidth); | 1167 size.expand(0, topControls.height() / pageScaleAtLayoutWidth); |
1154 } | 1168 } |
1155 | 1169 |
1156 float scale = frame().pageZoomFactor(); | 1170 size.scale(1 / zoom); |
1157 size.scale(1 / scale); | |
1158 return size; | 1171 return size; |
1159 } | 1172 } |
1160 | 1173 |
1161 DocumentLifecycle& FrameView::lifecycle() const | 1174 DocumentLifecycle& FrameView::lifecycle() const |
1162 { | 1175 { |
1163 return m_frame->document()->lifecycle(); | 1176 return m_frame->document()->lifecycle(); |
1164 } | 1177 } |
1165 | 1178 |
1166 LayoutBox* FrameView::embeddedContentBox() const | 1179 LayoutBox* FrameView::embeddedContentBox() const |
1167 { | 1180 { |
(...skipping 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4113 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4126 return m_hiddenForThrottling && m_crossOriginForThrottling; |
4114 } | 4127 } |
4115 | 4128 |
4116 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4129 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4117 { | 4130 { |
4118 ASSERT(layoutView()); | 4131 ASSERT(layoutView()); |
4119 return *layoutView(); | 4132 return *layoutView(); |
4120 } | 4133 } |
4121 | 4134 |
4122 } // namespace blink | 4135 } // namespace blink |
OLD | NEW |