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 23 matching lines...) Expand all Loading... |
34 #include "core/dom/AXObjectCache.h" | 34 #include "core/dom/AXObjectCache.h" |
35 #include "core/dom/DOMNodeIds.h" | 35 #include "core/dom/DOMNodeIds.h" |
36 #include "core/dom/Fullscreen.h" | 36 #include "core/dom/Fullscreen.h" |
37 #include "core/dom/IntersectionObserverController.h" | 37 #include "core/dom/IntersectionObserverController.h" |
38 #include "core/editing/EditingUtilities.h" | 38 #include "core/editing/EditingUtilities.h" |
39 #include "core/editing/FrameSelection.h" | 39 #include "core/editing/FrameSelection.h" |
40 #include "core/editing/RenderedPosition.h" | 40 #include "core/editing/RenderedPosition.h" |
41 #include "core/editing/markers/DocumentMarkerController.h" | 41 #include "core/editing/markers/DocumentMarkerController.h" |
42 #include "core/events/ErrorEvent.h" | 42 #include "core/events/ErrorEvent.h" |
43 #include "core/fetch/ResourceFetcher.h" | 43 #include "core/fetch/ResourceFetcher.h" |
| 44 #include "core/frame/BrowserControls.h" |
44 #include "core/frame/EventHandlerRegistry.h" | 45 #include "core/frame/EventHandlerRegistry.h" |
45 #include "core/frame/FrameHost.h" | 46 #include "core/frame/FrameHost.h" |
46 #include "core/frame/LocalFrame.h" | 47 #include "core/frame/LocalFrame.h" |
47 #include "core/frame/Location.h" | 48 #include "core/frame/Location.h" |
48 #include "core/frame/PageScaleConstraintsSet.h" | 49 #include "core/frame/PageScaleConstraintsSet.h" |
49 #include "core/frame/Settings.h" | 50 #include "core/frame/Settings.h" |
50 #include "core/frame/TopControls.h" | |
51 #include "core/frame/VisualViewport.h" | 51 #include "core/frame/VisualViewport.h" |
52 #include "core/html/HTMLFrameElement.h" | 52 #include "core/html/HTMLFrameElement.h" |
53 #include "core/html/HTMLPlugInElement.h" | 53 #include "core/html/HTMLPlugInElement.h" |
54 #include "core/html/HTMLTextFormControlElement.h" | 54 #include "core/html/HTMLTextFormControlElement.h" |
55 #include "core/html/parser/TextResourceDecoder.h" | 55 #include "core/html/parser/TextResourceDecoder.h" |
56 #include "core/input/EventHandler.h" | 56 #include "core/input/EventHandler.h" |
57 #include "core/inspector/InspectorInstrumentation.h" | 57 #include "core/inspector/InspectorInstrumentation.h" |
58 #include "core/inspector/InspectorTraceEvents.h" | 58 #include "core/inspector/InspectorTraceEvents.h" |
59 #include "core/layout/LayoutAnalyzer.h" | 59 #include "core/layout/LayoutAnalyzer.h" |
60 #include "core/layout/LayoutCounter.h" | 60 #include "core/layout/LayoutCounter.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 &FrameView::notifyRenderThrottlingObservers)), | 159 &FrameView::notifyRenderThrottlingObservers)), |
160 m_isTransparent(false), | 160 m_isTransparent(false), |
161 m_baseBackgroundColor(Color::white), | 161 m_baseBackgroundColor(Color::white), |
162 m_mediaType(MediaTypeNames::screen), | 162 m_mediaType(MediaTypeNames::screen), |
163 m_safeToPropagateScrollToParent(true), | 163 m_safeToPropagateScrollToParent(true), |
164 m_scrollCorner(nullptr), | 164 m_scrollCorner(nullptr), |
165 m_stickyPositionObjectCount(0), | 165 m_stickyPositionObjectCount(0), |
166 m_inputEventsScaleFactorForEmulation(1), | 166 m_inputEventsScaleFactorForEmulation(1), |
167 m_layoutSizeFixedToFrameSize(true), | 167 m_layoutSizeFixedToFrameSize(true), |
168 m_didScrollTimer(this, &FrameView::didScrollTimerFired), | 168 m_didScrollTimer(this, &FrameView::didScrollTimerFired), |
169 m_topControlsViewportAdjustment(0), | 169 m_browserControlsViewportAdjustment(0), |
170 m_needsUpdateWidgetGeometries(false), | 170 m_needsUpdateWidgetGeometries(false), |
171 m_needsUpdateViewportIntersection(true), | 171 m_needsUpdateViewportIntersection(true), |
172 m_needsUpdateViewportIntersectionInSubtree(true), | 172 m_needsUpdateViewportIntersectionInSubtree(true), |
173 #if ENABLE(ASSERT) | 173 #if ENABLE(ASSERT) |
174 m_hasBeenDisposed(false), | 174 m_hasBeenDisposed(false), |
175 #endif | 175 #endif |
176 m_horizontalScrollbarMode(ScrollbarAuto), | 176 m_horizontalScrollbarMode(ScrollbarAuto), |
177 m_verticalScrollbarMode(ScrollbarAuto), | 177 m_verticalScrollbarMode(ScrollbarAuto), |
178 m_horizontalScrollbarLock(false), | 178 m_horizontalScrollbarLock(false), |
179 m_verticalScrollbarLock(false), | 179 m_verticalScrollbarLock(false), |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 viewportSize.setHeight(layoutViewItem.viewHeight(IncludeScrollbars) / zoom); | 1230 viewportSize.setHeight(layoutViewItem.viewHeight(IncludeScrollbars) / zoom); |
1231 return viewportSize; | 1231 return viewportSize; |
1232 } | 1232 } |
1233 | 1233 |
1234 FloatSize size(layoutSize(IncludeScrollbars)); | 1234 FloatSize size(layoutSize(IncludeScrollbars)); |
1235 | 1235 |
1236 // We use the layoutSize rather than frameRect to calculate viewport units | 1236 // We use the layoutSize rather than frameRect to calculate viewport units |
1237 // so that we get correct results on mobile where the page is laid out into | 1237 // so that we get correct results on mobile where the page is laid out into |
1238 // a rect that may be larger than the viewport (e.g. the 980px fallback | 1238 // a rect that may be larger than the viewport (e.g. the 980px fallback |
1239 // width for desktop pages). Since the layout height is statically set to | 1239 // width for desktop pages). Since the layout height is statically set to |
1240 // be the viewport with top controls showing, we add the top controls | 1240 // be the viewport with browser controls showing, we add the browser controls |
1241 // height, compensating for page scale as well, since we want to use the | 1241 // height, compensating for page scale as well, since we want to use the |
1242 // viewport with top controls hidden for vh (to match Safari). | 1242 // viewport with browser controls hidden for vh (to match Safari). |
1243 TopControls& topControls = m_frame->host()->topControls(); | 1243 BrowserControls& browserControls = m_frame->host()->browserControls(); |
1244 if (m_frame->isMainFrame() && size.width()) { | 1244 if (m_frame->isMainFrame() && size.width()) { |
1245 float pageScaleAtLayoutWidth = | 1245 float pageScaleAtLayoutWidth = |
1246 m_frame->host()->visualViewport().size().width() / size.width(); | 1246 m_frame->host()->visualViewport().size().width() / size.width(); |
1247 size.expand(0, topControls.height() / pageScaleAtLayoutWidth); | 1247 size.expand(0, browserControls.height() / pageScaleAtLayoutWidth); |
1248 } | 1248 } |
1249 | 1249 |
1250 size.scale(1 / zoom); | 1250 size.scale(1 / zoom); |
1251 return size; | 1251 return size; |
1252 } | 1252 } |
1253 | 1253 |
1254 DocumentLifecycle& FrameView::lifecycle() const { | 1254 DocumentLifecycle& FrameView::lifecycle() const { |
1255 return m_frame->document()->lifecycle(); | 1255 return m_frame->document()->lifecycle(); |
1256 } | 1256 } |
1257 | 1257 |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3385 | 3385 |
3386 m_layoutSize = size; | 3386 m_layoutSize = size; |
3387 contentsResized(); | 3387 contentsResized(); |
3388 } | 3388 } |
3389 | 3389 |
3390 void FrameView::didAddScrollbar(Scrollbar& scrollbar, | 3390 void FrameView::didAddScrollbar(Scrollbar& scrollbar, |
3391 ScrollbarOrientation orientation) { | 3391 ScrollbarOrientation orientation) { |
3392 ScrollableArea::didAddScrollbar(scrollbar, orientation); | 3392 ScrollableArea::didAddScrollbar(scrollbar, orientation); |
3393 } | 3393 } |
3394 | 3394 |
3395 void FrameView::setTopControlsViewportAdjustment(float adjustment) { | 3395 void FrameView::setBrowserControlsViewportAdjustment(float adjustment) { |
3396 m_topControlsViewportAdjustment = adjustment; | 3396 m_browserControlsViewportAdjustment = adjustment; |
3397 } | 3397 } |
3398 | 3398 |
3399 IntSize FrameView::maximumScrollOffsetInt() const { | 3399 IntSize FrameView::maximumScrollOffsetInt() const { |
3400 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3400 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
3401 // FIXME: We probably shouldn't be storing the bounds in a float. | 3401 // FIXME: We probably shouldn't be storing the bounds in a float. |
3402 // crbug.com/422331. | 3402 // crbug.com/422331. |
3403 IntSize visibleSize = | 3403 IntSize visibleSize = |
3404 visibleContentSize(ExcludeScrollbars) + topControlsSize(); | 3404 visibleContentSize(ExcludeScrollbars) + browserControlsSize(); |
3405 IntSize contentBounds = contentsSize(); | 3405 IntSize contentBounds = contentsSize(); |
3406 IntSize maximumOffset = | 3406 IntSize maximumOffset = |
3407 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); | 3407 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); |
3408 return maximumOffset.expandedTo(minimumScrollOffsetInt()); | 3408 return maximumOffset.expandedTo(minimumScrollOffsetInt()); |
3409 } | 3409 } |
3410 | 3410 |
3411 void FrameView::addChild(Widget* child) { | 3411 void FrameView::addChild(Widget* child) { |
3412 ASSERT(child != this && !child->parent()); | 3412 ASSERT(child != this && !child->parent()); |
3413 child->setParent(this); | 3413 child->setParent(this); |
3414 m_children.add(child); | 3414 m_children.add(child); |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 DCHECK(m_frame->isMainFrame()); | 4507 DCHECK(m_frame->isMainFrame()); |
4508 return m_initialViewportSize.width(); | 4508 return m_initialViewportSize.width(); |
4509 } | 4509 } |
4510 | 4510 |
4511 int FrameView::initialViewportHeight() const { | 4511 int FrameView::initialViewportHeight() const { |
4512 DCHECK(m_frame->isMainFrame()); | 4512 DCHECK(m_frame->isMainFrame()); |
4513 return m_initialViewportSize.height(); | 4513 return m_initialViewportSize.height(); |
4514 } | 4514 } |
4515 | 4515 |
4516 } // namespace blink | 4516 } // namespace blink |
OLD | NEW |