diff options
| author | vollick@chromium.org <vollick@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-10-17 14:52:56 +0000 |
|---|---|---|
| committer | vollick@chromium.org <vollick@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-10-17 14:52:56 +0000 |
| commit | d83d2819d0d4d1f74abce9b802b36ce007956c54 (patch) | |
| tree | be66874cf562d35b28d73dbbf91712cc85c58fbd | |
| parent | 87cc58c7c648b21eb3c3198e60c65814dfa0f0e6 (diff) | |
| download | chromium_src-d83d2819d0d4d1f74abce9b802b36ce007956c54.zip chromium_src-d83d2819d0d4d1f74abce9b802b36ce007956c54.tar.gz chromium_src-d83d2819d0d4d1f74abce9b802b36ce007956c54.tar.bz2 | |
Revert "Revert 159282 "Refactor fixed layout mode""
This reverts commit 22b76d037bbee7ffff5c06765d5675d60ec1ae85.
This was a speculative revert, but it turned out not to be the problem. Relanding.
TBR=bokan@chromium.org
BUG=306566
Review URL: https://codereview.chromium.org/27697004
git-svn-id: svn://svn.chromium.org/blink/trunk@159880 bbb929c8-8fbe-4397-9dbb-9b2b20218538
36 files changed, 219 insertions, 341 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index c11376b..3c3aa10 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -1008,8 +1008,6 @@ crbug.com/280554 css3/filters/custom/custom-filter-clamp-css-color-matrix.html [ crbug.com/280554 css3/filters/custom/custom-filter-clamp-css-mix-color-negative.html [ ImageOnlyFailure Pass ] crbug.com/280554 css3/filters/custom/custom-filter-clamp-css-mix-color.html [ ImageOnlyFailure Pass ] -Bug(bokan) fast/dynamic/window-resize-scrollbars-test.html [ NeedsRebaseline ] - crbug.com/280658 [ Win7 ] inspector-protocol/layers/get-layers.html [ Pass Failure ] crbug.com/280342 [ Win Release ] http/tests/media/progress-events-generated-correctly.html [ Failure Pass ] crbug.com/280698 inspector/styles/multiple-imports-edit-crash.html [ Pass Failure ] diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-delete-rule.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-delete-rule.html index 0013233..159f35269 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-delete-rule.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-delete-rule.html @@ -9,7 +9,6 @@ </style> <script> if (window.testRunner) { - testRunner.enableFixedLayoutMode(true); internals.settings.setViewportEnabled(true); } @@ -39,7 +38,7 @@ }; </script> </head> -<body> +<body style="overflow: hidden"> <div id="log"></div> </body> </html> diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-invalid-values-001.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-invalid-values-001.html index c7a7422..7753560 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-invalid-values-001.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-invalid-values-001.html @@ -6,7 +6,6 @@ <script src="../../resources/testharnessreport.js"></script> <script> if (window.testRunner) { - testRunner.enableFixedLayoutMode(true); internals.settings.setViewportEnabled(true); } </script> diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-agent-style.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-agent-style.html index d0d9d6f..9b71239 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-agent-style.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-agent-style.html @@ -6,7 +6,6 @@ <script src="../../resources/testharnessreport.js"></script> <script> if (window.testRunner) { - testRunner.enableFixedLayoutMode(true); internals.settings.setViewportEnabled(true); } </script> @@ -14,7 +13,7 @@ html, body { width: 100%; height: 100%; margin: 0 } </style> </head> -<body> +<body style="overflow: hidden;"> <div id="log"></div> <script> test(function(){ diff --git a/third_party/WebKit/LayoutTests/fast/events/resize-events-expected.txt b/third_party/WebKit/LayoutTests/fast/events/resize-events-expected.txt index eedbdc5..ad0a581 100644 --- a/third_party/WebKit/LayoutTests/fast/events/resize-events-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/events/resize-events-expected.txt @@ -1,4 +1,4 @@ -Following actions must not emit resize events: page load, dynamic content generation, page scaling and changing fixed layout size. +Following actions must not emit resize events: page load, dynamic content generation, and page scaling. The spec DOM Level 2 Events states that the resize event occurs when document view size (a.k.a layout size) is changed. Refer to http://www.w3.org/TR/DOM-Level-2-Events/events.html However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242 PASS resizeEventCount is 0 diff --git a/third_party/WebKit/LayoutTests/fast/events/resize-events-fixed-layout-expected.txt b/third_party/WebKit/LayoutTests/fast/events/resize-events-fixed-layout-expected.txt deleted file mode 100644 index e67cd7d..0000000 --- a/third_party/WebKit/LayoutTests/fast/events/resize-events-fixed-layout-expected.txt +++ /dev/null @@ -1,6 +0,0 @@ -Following actions must not emit resize events: page load, dynamic content generation and page scaling. -When fixed layout is enabled, changing fixed layout size must emit resize event. -The spec DOM Level 2 Events states that the resize event occurs when document view size (a.k.a layout size) is changed. Refer to http://www.w3.org/TR/DOM-Level-2-Events/events.html -However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242 -PASS resizeEventCount is 1 - diff --git a/third_party/WebKit/LayoutTests/fast/events/resize-events-fixed-layout.html b/third_party/WebKit/LayoutTests/fast/events/resize-events-fixed-layout.html deleted file mode 100644 index 9b4e055..0000000 --- a/third_party/WebKit/LayoutTests/fast/events/resize-events-fixed-layout.html +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <style> - div.block { height: 400px; border: 1px solid black; margin:10px; } - </style> -</head> -<body> - <div> - Following actions must not emit resize events: page load, dynamic content generation and page scaling.<br/> - - When fixed layout is enabled, changing fixed layout size must emit resize event.<br/> - - The spec DOM Level 2 Events states that the resize event occurs when document view size (a.k.a layout size) is changed. Refer to http://www.w3.org/TR/DOM-Level-2-Events/events.html<br/> - However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242<br/> - </div> - <div id=expandingblock> - </div> - <pre id="console"></pre> - <script src="../js/resources/js-test-pre.js"></script> - <script> - var resizeEventCount = 0; - window.onresize = function() { - resizeEventCount++; - } - - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.enableFixedLayoutMode(true); - testRunner.setFixedLayoutSize(700, 240); - testRunner.waitUntilDone(); - } - function test() { - setTimeout(showScrollbar, 20); - } - // Add many div blocks to increase document height more than view height. - function showScrollbar() { - for (var i = 0; i < 10; i++) { - var el = document.createElement('div'); - el.setAttribute('class','block'); - document.getElementById('expandingblock').appendChild(el); - } - setTimeout(scalePage, 20); - } - function scalePage() { - if (window.eventSender) - window.eventSender.setPageScaleFactor(3, 0, 0); - setTimeout(changeFixedLayoutSize, 20); - } - function changeFixedLayoutSize() { - if (window.testRunner) - testRunner.setFixedLayoutSize(1600, 1600); - setTimeout(finish, 20); - } - function finish() { - // setFixedLayoutSize() must emit a resize event. - shouldBe("resizeEventCount", "1"); - if (window.testRunner) - testRunner.notifyDone(); - } - window.onload = test; - </script> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/fast/events/resize-events.html b/third_party/WebKit/LayoutTests/fast/events/resize-events.html index c5ca3d1..b6f8b72 100644 --- a/third_party/WebKit/LayoutTests/fast/events/resize-events.html +++ b/third_party/WebKit/LayoutTests/fast/events/resize-events.html @@ -7,7 +7,7 @@ </head> <body> <div> - Following actions must not emit resize events: page load, dynamic content generation, page scaling and changing fixed layout size.<br/> + Following actions must not emit resize events: page load, dynamic content generation, and page scaling.<br/> The spec DOM Level 2 Events states that the resize event occurs when document view size (a.k.a layout size) is changed. Refer to http://www.w3.org/TR/DOM-Level-2-Events/events.html<br/> However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242<br/> @@ -41,11 +41,6 @@ function scalePage() { if (window.eventSender) window.eventSender.setPageScaleFactor(3, 0, 0); - setTimeout(changeFixedLayoutSize, 20); - } - function changeFixedLayoutSize() { - if (window.testRunner) - testRunner.setFixedLayoutSize(1600, 1600); setTimeout(finish, 20); } function finish() { diff --git a/third_party/WebKit/LayoutTests/fast/repaint/fixed-layout-360x240-expected.txt b/third_party/WebKit/LayoutTests/fast/repaint/fixed-layout-360x240-expected.txt deleted file mode 100644 index 70bacae..0000000 --- a/third_party/WebKit/LayoutTests/fast/repaint/fixed-layout-360x240-expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -layer at (0,0) size 360x240 - RenderView at (0,0) size 360x240 -layer at (0,0) size 360x240 - RenderBlock {HTML} at (0,0) size 360x240 - RenderBody {BODY} at (8,8) size 344x224 [bgcolor=#008000] diff --git a/third_party/WebKit/LayoutTests/fast/repaint/fixed-layout-360x240.html b/third_party/WebKit/LayoutTests/fast/repaint/fixed-layout-360x240.html deleted file mode 100644 index 0801299..0000000 --- a/third_party/WebKit/LayoutTests/fast/repaint/fixed-layout-360x240.html +++ /dev/null @@ -1,14 +0,0 @@ -<html> -<head> -<script type="text/javascript"> - function layoutTest() - { - if (window.testRunner) { - window.testRunner.enableFixedLayoutMode(true); - window.testRunner.setFixedLayoutSize(360, 240); - } - } -</script> -</head> - <body bgcolor='green' onload='layoutTest();'></body> -</html> diff --git a/third_party/WebKit/LayoutTests/fast/viewport/viewport-enabled.html b/third_party/WebKit/LayoutTests/fast/viewport/viewport-enabled.html index b6d43a3..e3726bd 100644 --- a/third_party/WebKit/LayoutTests/fast/viewport/viewport-enabled.html +++ b/third_party/WebKit/LayoutTests/fast/viewport/viewport-enabled.html @@ -7,7 +7,6 @@ document.write("Width with viewport disabled. (should be 800): " + document.documentElement.offsetWidth + "<br>"); - testRunner.enableFixedLayoutMode(true); internals.settings.setViewportEnabled(true); document.write("Width from meta viewport (should be 320): " + document.documentElement.offsetWidth); diff --git a/third_party/WebKit/LayoutTests/fast/viewport/viewport-legacy-ordering-10.html b/third_party/WebKit/LayoutTests/fast/viewport/viewport-legacy-ordering-10.html index 578f23e..14971e8 100644 --- a/third_party/WebKit/LayoutTests/fast/viewport/viewport-legacy-ordering-10.html +++ b/third_party/WebKit/LayoutTests/fast/viewport/viewport-legacy-ordering-10.html @@ -13,7 +13,7 @@ <meta name="viewport" content="width=5000"> <style>@viewport {}</style> </head> -<body> +<body style="overflow: hidden"> <div id="log"></div> <script> var rootWidth = document.documentElement.offsetWidth; diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index 49bd853..8bc3ccd 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp @@ -650,7 +650,7 @@ int Element::clientWidth() || (inQuirksMode && isHTMLElement() && document().body() == this)) { if (FrameView* view = document().view()) { if (RenderView* renderView = document().renderView()) - return adjustForAbsoluteZoom(view->layoutWidth(), renderView); + return adjustForAbsoluteZoom(view->layoutSize().width(), renderView); } } @@ -671,7 +671,7 @@ int Element::clientHeight() || (inQuirksMode && isHTMLElement() && document().body() == this)) { if (FrameView* view = document().view()) { if (RenderView* renderView = document().renderView()) - return adjustForAbsoluteZoom(view->layoutHeight(), renderView); + return adjustForAbsoluteZoom(view->layoutSize().height(), renderView); } } diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp index 786fd49..cb64fa9 100644 --- a/third_party/WebKit/Source/core/frame/Frame.cpp +++ b/third_party/WebKit/Source/core/frame/Frame.cpp @@ -430,7 +430,7 @@ PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint) } void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent, - const IntSize& fixedLayoutSize, bool useFixedLayout, ScrollbarMode horizontalScrollbarMode, bool horizontalLock, + ScrollbarMode horizontalScrollbarMode, bool horizontalLock, ScrollbarMode verticalScrollbarMode, bool verticalLock) { ASSERT(this); @@ -446,8 +446,9 @@ void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor RefPtr<FrameView> frameView; if (isMainFrame) { frameView = FrameView::create(this, viewportSize); - frameView->setFixedLayoutSize(fixedLayoutSize); - frameView->setUseFixedLayout(useFixedLayout); + + // The layout size is set by WebViewImpl to support @viewport + frameView->setLayoutSizeFixedToFrameSize(false); } else frameView = FrameView::create(this); diff --git a/third_party/WebKit/Source/core/frame/Frame.h b/third_party/WebKit/Source/core/frame/Frame.h index 33eba25..bd0dcce 100644 --- a/third_party/WebKit/Source/core/frame/Frame.h +++ b/third_party/WebKit/Source/core/frame/Frame.h @@ -75,7 +75,7 @@ namespace WebCore { void init(); void setView(PassRefPtr<FrameView>); void createView(const IntSize&, const Color&, bool, - const IntSize& fixedLayoutSize = IntSize(), bool useFixedLayout = false, ScrollbarMode = ScrollbarAuto, bool horizontalLock = false, + ScrollbarMode = ScrollbarAuto, bool horizontalLock = false, ScrollbarMode = ScrollbarAuto, bool verticalLock = false); ~Frame(); diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp index 425a326..46cae50 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.cpp +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp @@ -54,6 +54,7 @@ #include "core/frame/animation/AnimationController.h" #include "core/page/scrolling/ScrollingCoordinator.h" #include "core/platform/ScrollAnimator.h" +#include "core/platform/ScrollbarTheme.h" #include "core/platform/graphics/FontCache.h" #include "core/platform/graphics/GraphicsContext.h" #include "core/rendering/CompositedLayerMapping.h" @@ -191,6 +192,7 @@ FrameView::FrameView(Frame* frame) , m_visibleContentScaleFactor(1) , m_inputEventsScaleFactorForEmulation(1) , m_partialLayout() + , m_layoutSizeFixedToFrameSize(true) { ASSERT(m_frame); init(); @@ -213,6 +215,8 @@ PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize { RefPtr<FrameView> view = adoptRef(new FrameView(frame)); view->Widget::setFrameRect(IntRect(view->location(), initialSize)); + view->setLayoutSizeInternal(initialSize); + view->show(); return view.release(); } @@ -1063,7 +1067,7 @@ void FrameView::layout(bool allowSubtree) LayoutSize oldSize = m_size; - m_size = LayoutSize(layoutWidth(), layoutHeight()); + m_size = LayoutSize(layoutSize().width(), layoutSize().height()); if (oldSize != m_size) { m_doFullRepaint = true; @@ -1120,7 +1124,7 @@ void FrameView::layout(bool allowSubtree) updateCanBlitOnScrollRecursively(); if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) - updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < contentsHeight()); + updateOverflowStatus(layoutSize().width() < contentsWidth(), layoutSize().height() < contentsHeight()); scheduleOrPerformPostLayoutTasks(); @@ -1620,6 +1624,17 @@ void FrameView::setViewportConstrainedObjectsNeedLayout() } } +IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const +{ + return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutSize) : m_layoutSize; +} + +void FrameView::setLayoutSize(const IntSize& size) +{ + ASSERT(!layoutSizeFixedToFrameSize()); + + setLayoutSizeInternal(size); +} void FrameView::scrollPositionChanged() { @@ -1736,7 +1751,7 @@ void FrameView::contentsResized() setNeedsLayout(); } -void FrameView::visibleContentsResized() +void FrameView::scrollbarExistenceDidChange() { // We check to make sure the view is attached to a frame() as this method can // be triggered before the view is attached by Frame::createView(...) setting @@ -1745,12 +1760,16 @@ void FrameView::visibleContentsResized() if (!frame().view()) return; - if (!useFixedLayout() && needsLayout()) + bool useOverlayScrollbars = ScrollbarTheme::theme()->usesOverlayScrollbars(); + + if (!useOverlayScrollbars && needsLayout()) layout(); - if (RenderView* renderView = this->renderView()) { - if (renderView->usesCompositing()) - renderView->compositor()->frameViewDidChangeSize(); + if (renderView() && renderView()->usesCompositing()) { + renderView()->compositor()->frameViewScrollbarsExistenceDidChange(); + + if (!useOverlayScrollbars) + renderView()->compositor()->frameViewDidChangeSize(); } } @@ -3056,11 +3075,13 @@ void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize) return; + m_shouldAutoSize = enable; m_minAutoSize = minSize; m_maxAutoSize = maxSize; m_didRunAutosize = false; + setLayoutSizeFixedToFrameSize(enable); setNeedsLayout(); scheduleRelayout(); if (m_shouldAutoSize) @@ -3428,4 +3449,21 @@ bool FrameView::isMainFrame() const return m_frame->page() && m_frame->page()->mainFrame() == m_frame; } +void FrameView::frameRectsChanged() +{ + if (layoutSizeFixedToFrameSize()) + setLayoutSizeInternal(frameRect().size()); + + ScrollView::frameRectsChanged(); +} + +void FrameView::setLayoutSizeInternal(const IntSize& size) +{ + if (m_layoutSize == size) + return; + + m_layoutSize = size; + contentsResized(); +} + } // namespace WebCore diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h index 670ad89..5c01e10 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.h +++ b/third_party/WebKit/Source/core/frame/FrameView.h @@ -108,6 +108,15 @@ public: void setNeedsLayout(); void setViewportConstrainedObjectsNeedLayout(); + // Methods for getting/setting the size Blink should use to layout the contents. + IntSize layoutSize(IncludeScrollbarsInRect = ExcludeScrollbars) const; + void setLayoutSize(const IntSize&); + + // If this is set to false, the layout size will need to be explicitly set by the owner. + // E.g. WebViewImpl sets its mainFrame's layout size manually + void setLayoutSizeFixedToFrameSize(bool isFixed) { m_layoutSizeFixedToFrameSize = isFixed; } + bool layoutSizeFixedToFrameSize() { return m_layoutSizeFixedToFrameSize; } + bool needsFullRepaint() const { return m_doFullRepaint; } void serviceScriptedAnimations(double monotonicAnimationStartTime); @@ -358,6 +367,7 @@ private: void reset(); void init(); + virtual void frameRectsChanged(); virtual bool isFrameView() const OVERRIDE { return true; } friend class RenderWidget; @@ -383,7 +393,7 @@ private: virtual void repaintContentRectangle(const IntRect&); virtual void contentsResized() OVERRIDE; - virtual void visibleContentsResized(); + virtual void scrollbarExistenceDidChange(); // Override ScrollView methods to do point conversion via renderers, in order to // take transforms into account. @@ -436,6 +446,8 @@ private: bool isMainFrame() const; + void setLayoutSizeInternal(const IntSize&); + static double s_currentFrameTimeStamp; // used for detecting decoded resource thrash in the cache static bool s_inPaintContents; @@ -546,6 +558,8 @@ private: float m_inputEventsScaleFactorForEmulation; PartialLayoutState m_partialLayout; + IntSize m_layoutSize; + bool m_layoutSizeFixedToFrameSize; }; inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) diff --git a/third_party/WebKit/Source/core/platform/ScrollView.cpp b/third_party/WebKit/Source/core/platform/ScrollView.cpp index 384245e..21456c8 100644 --- a/third_party/WebKit/Source/core/platform/ScrollView.cpp +++ b/third_party/WebKit/Source/core/platform/ScrollView.cpp @@ -48,7 +48,6 @@ ScrollView::ScrollView() , m_inUpdateScrollbars(false) , m_updateScrollbarsPass(0) , m_drawPanScrollIcon(false) - , m_useFixedLayout(false) , m_paintsEntireContents(false) , m_clipsRepaints(true) { @@ -185,62 +184,33 @@ void ScrollView::setClipsRepaints(bool clipsRepaints) m_clipsRepaints = clipsRepaints; } -IntSize ScrollView::unscaledVisibleContentSize(VisibleContentRectIncludesScrollbars scrollbarInclusion) const +IntSize ScrollView::unscaledVisibleContentSize(IncludeScrollbarsInRect scrollbarInclusion) const +{ + return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(frameRect().size()) : frameRect().size(); +} + +IntSize ScrollView::excludeScrollbars(const IntSize& size) const { int verticalScrollbarWidth = 0; int horizontalScrollbarHeight = 0; - if (scrollbarInclusion == ExcludeScrollbars) { - if (Scrollbar* verticalBar = verticalScrollbar()) - verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0; - if (Scrollbar* horizontalBar = horizontalScrollbar()) - horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0; - } + if (Scrollbar* verticalBar = verticalScrollbar()) + verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0; + if (Scrollbar* horizontalBar = horizontalScrollbar()) + horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0; + + return IntSize(max(0, size.width() - verticalScrollbarWidth), + max(0, size.height() - horizontalScrollbarHeight)); - return IntSize(max(0, width() - verticalScrollbarWidth), max(0, height() - horizontalScrollbarHeight)); } -IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scollbarInclusion) const +IntRect ScrollView::visibleContentRect(IncludeScrollbarsInRect scollbarInclusion) const { FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion); visibleContentSize.scale(1 / visibleContentScaleFactor()); return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)); } -IntSize ScrollView::layoutSize(VisibleContentRectIncludesScrollbars scrollbarInclusion) const -{ - return m_fixedLayoutSize.isZero() || !m_useFixedLayout ? unscaledVisibleContentSize(scrollbarInclusion) : m_fixedLayoutSize; -} - -IntSize ScrollView::fixedLayoutSize() const -{ - return m_fixedLayoutSize; -} - -void ScrollView::setFixedLayoutSize(const IntSize& newSize) -{ - if (fixedLayoutSize() == newSize) - return; - m_fixedLayoutSize = newSize; - updateScrollbars(scrollOffset()); - if (m_useFixedLayout) - contentsResized(); -} - -bool ScrollView::useFixedLayout() const -{ - return m_useFixedLayout; -} - -void ScrollView::setUseFixedLayout(bool enable) -{ - if (useFixedLayout() == enable) - return; - m_useFixedLayout = enable; - updateScrollbars(scrollOffset()); - contentsResized(); -} - IntSize ScrollView::contentsSize() const { return m_contentsSize; @@ -366,7 +336,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset) // This layout will not re-enter updateScrollbars and does not count towards our max layout pass total. if (!m_scrollbarsSuppressed) { m_inUpdateScrollbars = true; - visibleContentsResized(); + scrollbarExistenceDidChange(); m_inUpdateScrollbars = false; } @@ -441,12 +411,12 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset) if (scrollbarsAreOverlay) { // Synchronize status of scrollbar layers if necessary. m_inUpdateScrollbars = true; - visibleContentsResized(); + scrollbarExistenceDidChange(); m_inUpdateScrollbars = false; } else if (m_updateScrollbarsPass < cMaxUpdateScrollbarsPass) { m_updateScrollbarsPass++; contentsResized(); - visibleContentsResized(); + scrollbarExistenceDidChange(); IntSize newDocSize = contentsSize(); if (newDocSize == docSize) { // The layout with the new scroll state had no impact on @@ -737,12 +707,9 @@ void ScrollView::setFrameRect(const IntRect& newRect) Widget::setFrameRect(newRect); - frameRectsChanged(); - updateScrollbars(scrollOffset()); - if (!m_useFixedLayout && oldRect.size() != newRect.size()) - contentsResized(); + frameRectsChanged(); } void ScrollView::frameRectsChanged() diff --git a/third_party/WebKit/Source/core/platform/ScrollView.h b/third_party/WebKit/Source/core/platform/ScrollView.h index 1418c13..ee4e862 100644 --- a/third_party/WebKit/Source/core/platform/ScrollView.h +++ b/third_party/WebKit/Source/core/platform/ScrollView.h @@ -120,29 +120,19 @@ public: // The visible content rect has a location that is the scrolled offset of the document. The width and height are the viewport width // and height. By default the scrollbars themselves are excluded from this rectangle, but an optional boolean argument allows them to be // included. - virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const OVERRIDE; + virtual IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) const OVERRIDE; IntSize visibleSize() const { return visibleContentRect().size(); } virtual int visibleWidth() const OVERRIDE { return visibleContentRect().width(); } virtual int visibleHeight() const OVERRIDE { return visibleContentRect().height(); } // visibleContentRect().size() is computed from unscaledVisibleContentSize() divided by the value of visibleContentScaleFactor. // For the main frame, visibleContentScaleFactor is equal to the page's pageScaleFactor; it's 1 otherwise. - IntSize unscaledVisibleContentSize(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const; + IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollbars) const; virtual float visibleContentScaleFactor() const { return 1; } // Scale used to convert incoming input events. Usually the same as visibleContentScaleFactor(), unless specifically changed. virtual float inputEventsScaleFactor() const { return visibleContentScaleFactor(); } - // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible - // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead. - IntSize layoutSize(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const; - int layoutWidth(VisibleContentRectIncludesScrollbars scrollbarInclusion = ExcludeScrollbars) const { return layoutSize(scrollbarInclusion).width(); } - int layoutHeight(VisibleContentRectIncludesScrollbars scrollbarInclusion = ExcludeScrollbars) const { return layoutSize(scrollbarInclusion).height(); } - IntSize fixedLayoutSize() const; - void setFixedLayoutSize(const IntSize&); - bool useFixedLayout() const; - void setUseFixedLayout(bool enable); - // Functions for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height // values). virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as the visibleWidth()/visibleHeight(). @@ -281,7 +271,7 @@ protected: virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect); - virtual void visibleContentsResized() = 0; + virtual void scrollbarExistenceDidChange() = 0; // These functions are used to create/destroy scrollbars. void setHasHorizontalScrollbar(bool); void setHasVerticalScrollbar(bool); @@ -303,6 +293,8 @@ protected: // Called to update the scrollbars to accurately reflect the state of the view. void updateScrollbars(const IntSize& desiredOffset); + IntSize excludeScrollbars(const IntSize&) const; + private: RefPtr<Scrollbar> m_horizontalScrollbar; RefPtr<Scrollbar> m_verticalScrollbar; @@ -320,7 +312,6 @@ private: IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but we will wait to make this change until more code is shared. IntPoint m_cachedScrollPosition; - IntSize m_fixedLayoutSize; IntSize m_contentsSize; int m_scrollbarsAvoidingResizer; @@ -331,7 +322,6 @@ private: IntPoint m_panScrollIconPoint; bool m_drawPanScrollIcon; - bool m_useFixedLayout; bool m_paintsEntireContents; bool m_clipsRepaints; diff --git a/third_party/WebKit/Source/core/platform/ScrollableArea.cpp b/third_party/WebKit/Source/core/platform/ScrollableArea.cpp index f65f497..f10a522 100644 --- a/third_party/WebKit/Source/core/platform/ScrollableArea.cpp +++ b/third_party/WebKit/Source/core/platform/ScrollableArea.cpp @@ -379,7 +379,7 @@ void ScrollableArea::serviceScrollAnimations() scrollAnimator->serviceScrollAnimations(); } -IntRect ScrollableArea::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const +IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarInclusion) const { int verticalScrollbarWidth = 0; int horizontalScrollbarHeight = 0; diff --git a/third_party/WebKit/Source/core/platform/ScrollableArea.h b/third_party/WebKit/Source/core/platform/ScrollableArea.h index 4669668..7a756de 100644 --- a/third_party/WebKit/Source/core/platform/ScrollableArea.h +++ b/third_party/WebKit/Source/core/platform/ScrollableArea.h @@ -141,8 +141,8 @@ public: virtual IntPoint minimumScrollPosition() const = 0; virtual IntPoint maximumScrollPosition() const = 0; - enum VisibleContentRectIncludesScrollbars { ExcludeScrollbars, IncludeScrollbars }; - virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const; + enum IncludeScrollbarsInRect { ExcludeScrollbars, IncludeScrollbars }; + virtual IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) const; virtual int visibleHeight() const = 0; virtual int visibleWidth() const = 0; virtual IntSize contentsSize() const = 0; diff --git a/third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp b/third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp index 0a98c86..a2a39b8 100644 --- a/third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp +++ b/third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp @@ -96,7 +96,7 @@ void FramelessScrollView::contentsResized() { } -void FramelessScrollView::visibleContentsResized() +void FramelessScrollView::scrollbarExistenceDidChange() { } diff --git a/third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.h b/third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.h index aed2839..6fb77ad 100644 --- a/third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.h +++ b/third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.h @@ -83,7 +83,7 @@ namespace WebCore { // ScrollView protected methods: virtual void paintContents(GraphicsContext*, const IntRect&); virtual void contentsResized(); - virtual void visibleContentsResized(); + virtual void scrollbarExistenceDidChange(); private: FramelessScrollViewClient* m_client; diff --git a/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp b/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp index 95d11d7..50bbd01 100644 --- a/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp +++ b/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp @@ -1292,6 +1292,12 @@ void RenderLayerCompositor::frameViewDidLayout() { } +void RenderLayerCompositor::frameViewScrollbarsExistenceDidChange() +{ + if (m_containerLayer) + updateOverflowControlsLayers(); +} + void RenderLayerCompositor::rootFixedBackgroundsChanged() { if (!supportsFixedRootBackgroundCompositing()) diff --git a/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.h b/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.h index dbb735c..955d7d6 100644 --- a/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.h +++ b/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.h @@ -172,6 +172,7 @@ public: void frameViewDidChangeSize(); void frameViewDidScroll(); void frameViewDidLayout(); + void frameViewScrollbarsExistenceDidChange(); void rootFixedBackgroundsChanged(); bool scrollingLayerDidChange(RenderLayer*); diff --git a/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp b/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp index 3ed4338..bddefd4 100644 --- a/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp +++ b/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp @@ -400,7 +400,7 @@ IntPoint RenderLayerScrollableArea::maximumScrollPosition() const return -scrollOrigin() + enclosingIntRect(m_overflowRect).size() - enclosingIntRect(m_box->clientBoxRect()).size(); } -IntRect RenderLayerScrollableArea::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const +IntRect RenderLayerScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarInclusion) const { int verticalScrollbarWidth = 0; int horizontalScrollbarHeight = 0; diff --git a/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.h b/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.h index b4a31b3..979e522 100644 --- a/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.h +++ b/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.h @@ -98,7 +98,7 @@ public: virtual IntPoint scrollPosition() const OVERRIDE; virtual IntPoint minimumScrollPosition() const OVERRIDE; virtual IntPoint maximumScrollPosition() const OVERRIDE; - virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars) const OVERRIDE; + virtual IntRect visibleContentRect(IncludeScrollbarsInRect) const OVERRIDE; virtual int visibleHeight() const OVERRIDE; virtual int visibleWidth() const OVERRIDE; virtual IntSize contentsSize() const OVERRIDE; diff --git a/third_party/WebKit/Source/core/rendering/RenderView.cpp b/third_party/WebKit/Source/core/rendering/RenderView.cpp index ac7d5b4..36a178a 100644 --- a/third_party/WebKit/Source/core/rendering/RenderView.cpp +++ b/third_party/WebKit/Source/core/rendering/RenderView.cpp @@ -1051,27 +1051,25 @@ IntRect RenderView::documentRect() const return IntRect(overflowRect); } -int RenderView::viewHeight(ScrollableArea::VisibleContentRectIncludesScrollbars scrollbarInclusion) const +int RenderView::viewHeight(ScrollableArea::IncludeScrollbarsInRect scrollbarInclusion) const { int height = 0; - if (!shouldUsePrintingLayout() && m_frameView) { - height = m_frameView->layoutHeight(scrollbarInclusion); - height = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() * float(height)) : height; - } + if (!shouldUsePrintingLayout() && m_frameView) + height = m_frameView->layoutSize(scrollbarInclusion).height(); + return height; } -int RenderView::viewWidth(ScrollableArea::VisibleContentRectIncludesScrollbars scrollbarInclusion) const +int RenderView::viewWidth(ScrollableArea::IncludeScrollbarsInRect scrollbarInclusion) const { int width = 0; - if (!shouldUsePrintingLayout() && m_frameView) { - width = m_frameView->layoutWidth(scrollbarInclusion); - width = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() * float(width)) : width; - } + if (!shouldUsePrintingLayout() && m_frameView) + width = m_frameView->layoutSize(scrollbarInclusion).width(); + return width; } -int RenderView::viewLogicalHeight(ScrollableArea::VisibleContentRectIncludesScrollbars scrollbarInclusion) const +int RenderView::viewLogicalHeight(ScrollableArea::IncludeScrollbarsInRect scrollbarInclusion) const { int height = style()->isHorizontalWritingMode() ? viewHeight(scrollbarInclusion) : viewWidth(scrollbarInclusion); diff --git a/third_party/WebKit/Source/core/rendering/RenderView.h b/third_party/WebKit/Source/core/rendering/RenderView.h index da64d3f..ad3b6ba 100644 --- a/third_party/WebKit/Source/core/rendering/RenderView.h +++ b/third_party/WebKit/Source/core/rendering/RenderView.h @@ -68,13 +68,13 @@ public: virtual LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const OVERRIDE; // The same as the FrameView's layoutHeight/layoutWidth but with null check guards. - int viewHeight(ScrollableArea::VisibleContentRectIncludesScrollbars scrollbarInclusion = ScrollableArea::ExcludeScrollbars) const; - int viewWidth(ScrollableArea::VisibleContentRectIncludesScrollbars scrollbarInclusion = ScrollableArea::ExcludeScrollbars) const; - int viewLogicalWidth(ScrollableArea::VisibleContentRectIncludesScrollbars scrollbarInclusion = ScrollableArea::ExcludeScrollbars) const + int viewHeight(ScrollableArea::IncludeScrollbarsInRect scrollbarInclusion = ScrollableArea::ExcludeScrollbars) const; + int viewWidth(ScrollableArea::IncludeScrollbarsInRect scrollbarInclusion = ScrollableArea::ExcludeScrollbars) const; + int viewLogicalWidth(ScrollableArea::IncludeScrollbarsInRect scrollbarInclusion = ScrollableArea::ExcludeScrollbars) const { return style()->isHorizontalWritingMode() ? viewWidth(scrollbarInclusion) : viewHeight(scrollbarInclusion); } - int viewLogicalHeight(ScrollableArea::VisibleContentRectIncludesScrollbars scrollbarInclusion = ScrollableArea::ExcludeScrollbars) const; + int viewLogicalHeight(ScrollableArea::IncludeScrollbarsInRect scrollbarInclusion = ScrollableArea::ExcludeScrollbars) const; float zoomFactor() const; diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp index 0cdd627..b67cbf4 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp @@ -604,7 +604,7 @@ void ChromeClientImpl::setToolTip(const String& tooltipText, TextDirection dir) void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportDescription& description) const { - m_webView->updatePageDefinedPageScaleConstraints(description); + m_webView->updatePageDefinedViewportConstraints(description); } void ChromeClientImpl::print(Frame* frame) diff --git a/third_party/WebKit/Source/web/WebFrameImpl.cpp b/third_party/WebKit/Source/web/WebFrameImpl.cpp index f405573..e6c209c 100644 --- a/third_party/WebKit/Source/web/WebFrameImpl.cpp +++ b/third_party/WebKit/Source/web/WebFrameImpl.cpp @@ -2235,7 +2235,7 @@ void WebFrameImpl::createFrameView() if (isMainFrame) webView->suppressInvalidations(true); - frame()->createView(webView->size(), webView->baseBackgroundColor(), webView->isTransparent(), webView->fixedLayoutSize(), isMainFrame ? webView->isFixedLayoutModeEnabled() : 0); + frame()->createView(webView->size(), webView->baseBackgroundColor(), webView->isTransparent()); if (webView->shouldAutoResize() && isMainFrame) frame()->view()->enableAutoSizeMode(true, webView->minAutoSize(), webView->maxAutoSize()); diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index eeed455..5c9a5c6 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp @@ -1720,8 +1720,8 @@ void WebViewImpl::resize(const WebSize& newSize) FloatSize(viewportAnchorXCoord, viewportAnchorYCoord)); } - // Set the fixed layout size from the viewport constraints before resizing. - updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportDescription()); + updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription()); + updateMainFrameLayoutSize(); WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); if (agentPrivate) @@ -2883,34 +2883,6 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor) updateLayerTreeDeviceScaleFactor(); } -bool WebViewImpl::isFixedLayoutModeEnabled() const -{ - if (!page()) - return false; - - Frame* frame = page()->mainFrame(); - if (!frame || !frame->view()) - return false; - - return frame->view()->useFixedLayout(); -} - -void WebViewImpl::enableFixedLayoutMode(bool enable) -{ - if (!page()) - return; - - Frame* frame = page()->mainFrame(); - if (!frame || !frame->view()) - return; - - frame->view()->setUseFixedLayout(enable); - - if (m_isAcceleratedCompositingActive) - updateLayerTreeViewport(); -} - - void WebViewImpl::enableAutoResizeMode(const WebSize& minSize, const WebSize& maxSize) { m_shouldAutoResize = true; @@ -2977,7 +2949,7 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() return; FrameView* view = page()->mainFrame()->view(); - updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportDescription()); + updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription()); m_pageScaleConstraintsSet.computeFinalConstraints(); if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { @@ -3002,9 +2974,9 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout() view->layout(); } -void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportDescription& description) +void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription& description) { - if (!settings()->viewportEnabled() || !isFixedLayoutModeEnabled() || !page() || !m_size.width || !m_size.height) + if (!settings()->viewportEnabled() || !page() || !m_size.width || !m_size.height) return; ViewportDescription adjustedDescription = description; @@ -3017,13 +2989,28 @@ void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportDescriptio m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, m_size); m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settingsImpl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuirkEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOverviewMode()); - WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize); + updateMainFrameLayoutSize(); +} + +void WebViewImpl::updateMainFrameLayoutSize() +{ + if (m_fixedLayoutSizeLock || !mainFrameImpl()) + return; - if (page()->settings().textAutosizingEnabled() && page()->mainFrame() && layoutSize.width != fixedLayoutSize().width) - page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers(); + FrameView* view = mainFrameImpl()->frameView(); + if (!view) + return; - if (page()->mainFrame() && page()->mainFrame()->view() && !m_fixedLayoutSizeLock) - page()->mainFrame()->view()->setFixedLayoutSize(layoutSize); + WebSize layoutSize = m_size; + + if (settings()->viewportEnabled()) { + layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize); + + if (page()->settings().textAutosizingEnabled() && layoutSize.width != view->layoutSize().width()) + page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers(); + } + + view->setLayoutSize(layoutSize); } IntSize WebViewImpl::contentsSize() const @@ -3094,18 +3081,6 @@ void WebViewImpl::resetScrollAndScaleState() resetSavedScrollAndScaleState(); } -WebSize WebViewImpl::fixedLayoutSize() const -{ - if (!page()) - return WebSize(); - - Frame* frame = page()->mainFrame(); - if (!frame || !frame->view()) - return WebSize(); - - return frame->view()->fixedLayoutSize(); -} - void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) { if (!page()) @@ -3122,9 +3097,9 @@ void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) m_fixedLayoutSizeLock = layoutSize.width || layoutSize.height; if (m_fixedLayoutSizeLock) - view->setFixedLayoutSize(layoutSize); + view->setLayoutSize(layoutSize); else - view->setFixedLayoutSize(flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize)); + updateMainFrameLayoutSize(); } void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, @@ -4151,7 +4126,7 @@ void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) bool WebViewImpl::shouldDisableDesktopWorkarounds() { - if (!settings()->viewportEnabled() || !isFixedLayoutModeEnabled()) + if (!settings()->viewportEnabled()) return false; // A document is considered adapted to small screen UAs if one of these holds: @@ -4161,7 +4136,10 @@ bool WebViewImpl::shouldDisableDesktopWorkarounds() const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefinedConstraints(); - return fixedLayoutSize().width == m_size.width + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) + return false; + + return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width || (constraints.minimumScale == constraints.maximumScale && constraints.minimumScale != -1); } diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index 0e64513..ad32056 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h @@ -240,10 +240,15 @@ public: virtual float deviceScaleFactor() const; virtual void setDeviceScaleFactor(float); - virtual bool isFixedLayoutModeEnabled() const; - virtual void enableFixedLayoutMode(bool enable); - virtual WebSize fixedLayoutSize() const; + virtual void setFixedLayoutSize(const WebSize&); + + // DEPRECATED: Will be removed soon. + // See https://codereview.chromium.org/23819019/ + virtual bool isFixedLayoutModeEnabled() const { return true; } + virtual void enableFixedLayoutMode(bool) { } + virtual WebSize fixedLayoutSize() const { return WebSize(); } + virtual void enableAutoResizeMode( const WebSize& minSize, const WebSize& maxSize); @@ -443,7 +448,8 @@ public: return m_maxAutoSize; } - void updatePageDefinedPageScaleConstraints(const WebCore::ViewportDescription&); + void updateMainFrameLayoutSize(); + void updatePageDefinedViewportConstraints(const WebCore::ViewportDescription&); // Start a system drag and drop operation. void startDragging( diff --git a/third_party/WebKit/Source/web/tests/ScrollAnimatorNoneTest.cpp b/third_party/WebKit/Source/web/tests/ScrollAnimatorNoneTest.cpp index 87a16ec..0e44d5a 100644 --- a/third_party/WebKit/Source/web/tests/ScrollAnimatorNoneTest.cpp +++ b/third_party/WebKit/Source/web/tests/ScrollAnimatorNoneTest.cpp @@ -61,7 +61,7 @@ public: MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*()); MOCK_CONST_METHOD0(minimumScrollPosition, IntPoint()); MOCK_CONST_METHOD0(maximumScrollPosition, IntPoint()); - MOCK_CONST_METHOD1(visibleContentRect, IntRect(VisibleContentRectIncludesScrollbars)); + MOCK_CONST_METHOD1(visibleContentRect, IntRect(IncludeScrollbarsInRect)); MOCK_CONST_METHOD0(contentsSize, IntSize()); MOCK_CONST_METHOD0(overhangAmount, IntSize()); MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool()); diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index da88971..c018795 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp @@ -173,7 +173,6 @@ protected: { webViewHelper->initializeAndLoad(url, true); webViewHelper->webView()->settings()->setDefaultFontSize(12); - webViewHelper->webView()->enableFixedLayoutMode(false); webViewHelper->webView()->resize(WebSize(640, 480)); } @@ -587,6 +586,7 @@ class FixedLayoutTestWebViewClient : public WebViewClient { TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); FixedLayoutTestWebViewClient client; @@ -597,12 +597,11 @@ TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize) // only becomes available after the load begins. FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); - webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->setFixedLayoutSize(WebCore::IntSize(100, 100)); + webViewHelper.webViewImpl()->setFixedLayoutSize(WebCore::IntSize(100, 100)); EXPECT_TRUE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needsLayout()); int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutCount(); @@ -614,6 +613,7 @@ TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize) TEST_F(WebFrameTest, ChangeInFixedLayoutTriggersTextAutosizingRecalculate) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); FixedLayoutTestWebViewClient client; @@ -624,7 +624,6 @@ TEST_F(WebFrameTest, ChangeInFixedLayoutTriggersTextAutosizingRecalculate) // only becomes available after the load begins. FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); WebCore::Document* document = webViewHelper.webViewImpl()->page()->mainFrame()->document(); @@ -649,7 +648,7 @@ TEST_F(WebFrameTest, ChangeInFixedLayoutTriggersTextAutosizingRecalculate) // Choose a width that's not going match the viewport width of the loaded document. description.minWidth = WebCore::Length(100, WebCore::Fixed); description.maxWidth = WebCore::Length(100, WebCore::Fixed); - webViewHelper.webViewImpl()->updatePageDefinedPageScaleConstraints(description); + webViewHelper.webViewImpl()->updatePageDefinedViewportConstraints(description); bool multiplierCheckedAtLeastOnce = false; renderer = document->renderer(); @@ -665,6 +664,7 @@ TEST_F(WebFrameTest, ChangeInFixedLayoutTriggersTextAutosizingRecalculate) TEST_F(WebFrameTest, FixedLayoutSizeStopsResizeFromChangingLayoutSize) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); int viewportWidth = 640; @@ -675,18 +675,18 @@ TEST_F(WebFrameTest, FixedLayoutSizeStopsResizeFromChangingLayoutSize) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->setFixedLayoutSize(WebSize(fixedLayoutWidth, fixedLayoutHeight)); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); - EXPECT_EQ(fixedLayoutWidth, webViewHelper.webView()->fixedLayoutSize().width); - EXPECT_EQ(fixedLayoutHeight, webViewHelper.webView()->fixedLayoutSize().height); + EXPECT_EQ(fixedLayoutWidth, webViewHelper.webViewImpl()->page()->mainFrame()->view()->layoutSize().width()); + EXPECT_EQ(fixedLayoutHeight, webViewHelper.webViewImpl()->page()->mainFrame()->view()->layoutSize().height()); } TEST_F(WebFrameTest, FixedLayoutSizePreventsResizeFromChangingPageScale) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); int viewportWidth = 640; @@ -697,7 +697,6 @@ TEST_F(WebFrameTest, FixedLayoutSizePreventsResizeFromChangingPageScale) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->setFixedLayoutSize(WebSize(fixedLayoutWidth, fixedLayoutHeight)); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); @@ -711,6 +710,7 @@ TEST_F(WebFrameTest, FixedLayoutSizePreventsResizeFromChangingPageScale) TEST_F(WebFrameTest, FixedLayoutSizePreventsLayoutFromChangingPageScale) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); int viewportWidth = 640; @@ -721,7 +721,6 @@ TEST_F(WebFrameTest, FixedLayoutSizePreventsLayoutFromChangingPageScale) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->setFixedLayoutSize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); @@ -736,6 +735,7 @@ TEST_F(WebFrameTest, FixedLayoutSizePreventsLayoutFromChangingPageScale) TEST_F(WebFrameTest, PreferredSizeAndContentSizeReportedCorrectlyWithZeroHeightFixedLayout) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("200-by-300.html"); int windowWidth = 100; @@ -750,7 +750,6 @@ TEST_F(WebFrameTest, PreferredSizeAndContentSizeReportedCorrectlyWithZeroHeightF FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(windowWidth, windowHeight)); webViewHelper.webView()->setFixedLayoutSize(WebSize(viewportWidth, viewportHeight)); @@ -765,6 +764,7 @@ TEST_F(WebFrameTest, PreferredSizeAndContentSizeReportedCorrectlyWithZeroHeightF TEST_F(WebFrameTest, DisablingFixedLayoutSizeSetsCorrectLayoutSize) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("no_viewport_tag.html"); FixedLayoutTestWebViewClient client; @@ -775,7 +775,6 @@ TEST_F(WebFrameTest, DisablingFixedLayoutSizeSetsCorrectLayoutSize) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client); webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(true); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); @@ -793,6 +792,7 @@ TEST_F(WebFrameTest, DisablingFixedLayoutSizeSetsCorrectLayoutSize) TEST_F(WebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("no_viewport_tag.html"); int viewportWidth = 640; @@ -805,7 +805,6 @@ TEST_F(WebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag) webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client); webViewHelper.webView()->settings()->setViewportEnabled(true); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -836,7 +835,6 @@ TEST_F(WebFrameTest, FixedLayoutInitializeAtMinimumScale) // only becomes available after the load begins. FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); @@ -875,7 +873,6 @@ TEST_F(WebFrameTest, WideDocumentInitializeAtMinimumScale) // only becomes available after the load begins. FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "wide_document.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); @@ -901,6 +898,7 @@ TEST_F(WebFrameTest, WideDocumentInitializeAtMinimumScale) TEST_F(WebFrameTest, setLoadWithOverviewModeToFalse) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -910,7 +908,6 @@ TEST_F(WebFrameTest, setLoadWithOverviewModeToFalse) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); @@ -922,6 +919,7 @@ TEST_F(WebFrameTest, setLoadWithOverviewModeToFalse) TEST_F(WebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewport) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("large-div.html"); FixedLayoutTestWebViewClient client; @@ -931,7 +929,6 @@ TEST_F(WebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewport) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); @@ -944,6 +941,7 @@ TEST_F(WebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewport) TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidth) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -953,7 +951,6 @@ TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidth) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setUseWideViewport(false); @@ -966,6 +963,7 @@ TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidth) TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccountsScale) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -975,13 +973,12 @@ TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccountsScale) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setUseWideViewport(false); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); - // The page sets viewport width to 3000, but with UseWideViewport == false is must be ignored. + // The page sets viewport width to 3000, but with UseWideViewport == false it must be ignored. // While the initial scale specified by the page must be accounted. EXPECT_EQ(viewportWidth / 2, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().width()); EXPECT_EQ(viewportHeight / 2, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->contentsSize().height()); @@ -989,6 +986,7 @@ TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccountsScale) TEST_F(WebFrameTest, WideViewportSetsTo980WithoutViewportTag) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("no_viewport_tag.html"); FixedLayoutTestWebViewClient client; @@ -998,7 +996,6 @@ TEST_F(WebFrameTest, WideViewportSetsTo980WithoutViewportTag) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->settings()->setViewportEnabled(true); @@ -1010,6 +1007,7 @@ TEST_F(WebFrameTest, WideViewportSetsTo980WithoutViewportTag) TEST_F(WebFrameTest, NoWideViewportAndHeightInMeta) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-height-1000.html"); FixedLayoutTestWebViewClient client; @@ -1019,7 +1017,6 @@ TEST_F(WebFrameTest, NoWideViewportAndHeightInMeta) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-height-1000.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setUseWideViewport(false); webViewHelper.webView()->settings()->setViewportEnabled(true); @@ -1030,6 +1027,7 @@ TEST_F(WebFrameTest, NoWideViewportAndHeightInMeta) TEST_F(WebFrameTest, WideViewportSetsTo980WithAutoWidth) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-2x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1039,7 +1037,6 @@ TEST_F(WebFrameTest, WideViewportSetsTo980WithAutoWidth) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->settings()->setViewportEnabled(true); @@ -1051,6 +1048,7 @@ TEST_F(WebFrameTest, WideViewportSetsTo980WithAutoWidth) TEST_F(WebFrameTest, PageViewportInitialScaleOverridesLoadWithOverviewMode) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1060,7 +1058,6 @@ TEST_F(WebFrameTest, PageViewportInitialScaleOverridesLoadWithOverviewMode) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); @@ -1084,7 +1081,6 @@ TEST_F(WebFrameTest, setInitialPageScaleFactorPermanently) webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->layout(); @@ -1104,6 +1100,7 @@ TEST_F(WebFrameTest, setInitialPageScaleFactorPermanently) TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesLoadWithOverviewMode) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1114,7 +1111,6 @@ TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesLoadWithOverviewMod FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-auto-initial-scale.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScalePactor); @@ -1125,6 +1121,7 @@ TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesLoadWithOverviewMod TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesPageViewportInitialScale) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1135,7 +1132,6 @@ TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesPageViewportInitial FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-wide-2x-initial-scale.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScalePactor); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); @@ -1145,6 +1141,7 @@ TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesPageViewportInitial TEST_F(WebFrameTest, WideViewportInitialScaleDoesNotExpandFixedLayoutWidth) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-device-0.5x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1154,18 +1151,18 @@ TEST_F(WebFrameTest, WideViewportInitialScaleDoesNotExpandFixedLayoutWidth) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-device-0.5x-initial-scale.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->fixedLayoutSize().width()); + EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); } TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("wide_document_width_viewport.html"); FixedLayoutTestWebViewClient client; @@ -1175,7 +1172,6 @@ TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad("about:blank", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setUseWideViewport(true); @@ -1194,6 +1190,7 @@ TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) TEST_F(WebFrameTest, ZeroValuesQuirk) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-zero-values.html"); FixedLayoutTestWebViewClient client; @@ -1203,7 +1200,6 @@ TEST_F(WebFrameTest, ZeroValuesQuirk) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initialize(true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); @@ -1211,12 +1207,12 @@ TEST_F(WebFrameTest, ZeroValuesQuirk) Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->fixedLayoutSize().width()); + EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->layout(); - EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->fixedLayoutSize().width()); + EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); } @@ -1261,6 +1257,7 @@ TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) TEST_F(WebFrameTest, NonZeroValuesNoQuirk) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-nonzero-values.html"); FixedLayoutTestWebViewClient client; @@ -1271,7 +1268,6 @@ TEST_F(WebFrameTest, NonZeroValuesNoQuirk) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initialize(true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); @@ -1279,17 +1275,18 @@ TEST_F(WebFrameTest, NonZeroValuesNoQuirk) Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->fixedLayoutSize().width()); + EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->layout(); - EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->fixedLayoutSize().width()); + EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width()); EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor()); } TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("scale_oscillate.html"); FixedLayoutTestWebViewClient client; @@ -1299,7 +1296,6 @@ TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "scale_oscillate.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -1307,6 +1303,7 @@ TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) TEST_F(WebFrameTest, setPageScaleFactorDoesNotLayout) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); FixedLayoutTestWebViewClient client; @@ -1317,7 +1314,6 @@ TEST_F(WebFrameTest, setPageScaleFactorDoesNotLayout) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -1341,7 +1337,6 @@ TEST_F(WebFrameTest, setPageScaleFactorWithOverlayScrollbarsDoesNotLayout) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -1370,6 +1365,7 @@ TEST_F(WebFrameTest, setPageScaleFactorBeforeFrameHasView) TEST_F(WebFrameTest, pageScaleFactorWrittenToHistoryItem) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); FixedLayoutTestWebViewClient client; @@ -1379,7 +1375,6 @@ TEST_F(WebFrameTest, pageScaleFactorWrittenToHistoryItem) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -1393,6 +1388,7 @@ TEST_F(WebFrameTest, pageScaleFactorWrittenToHistoryItem) TEST_F(WebFrameTest, pageScaleFactorShrinksViewport) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("large-div.html"); FixedLayoutTestWebViewClient client; @@ -1403,7 +1399,6 @@ TEST_F(WebFrameTest, pageScaleFactorShrinksViewport) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -1429,6 +1424,7 @@ TEST_F(WebFrameTest, pageScaleFactorShrinksViewport) TEST_F(WebFrameTest, pageScaleFactorDoesNotApplyCssTransform) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); FixedLayoutTestWebViewClient client; @@ -1438,7 +1434,6 @@ TEST_F(WebFrameTest, pageScaleFactorDoesNotApplyCssTransform) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -1468,7 +1463,6 @@ TEST_F(WebFrameTest, targetDensityDpiHigh) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-high.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(true); @@ -1477,8 +1471,8 @@ TEST_F(WebFrameTest, targetDensityDpiHigh) // We need to account for the fact that logical pixels are unconditionally multiplied by deviceScaleFactor to produce // physical pixels. float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; - EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webView()->fixedLayoutSize().width, 1.0f); - EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webView()->fixedLayoutSize().height, 1.0f); + EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / densityDpiScaleRatio, webViewHelper.webView()->pageScaleFactor(), 0.01f); } } @@ -1499,14 +1493,13 @@ TEST_F(WebFrameTest, targetDensityDpiDevice) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-device.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->fixedLayoutSize().width, 1.0f); - EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->fixedLayoutSize().height, 1.0f); + EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.01f); } } @@ -1527,15 +1520,14 @@ TEST_F(WebFrameTest, targetDensityDpiDeviceAndFixedWidth) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-target-densitydpi-device-and-fixed-width.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(true); webViewHelper.webView()->settings()->setUseWideViewport(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); - EXPECT_NEAR(viewportWidth, webViewHelper.webView()->fixedLayoutSize().width, 1.0f); - EXPECT_NEAR(viewportHeight, webViewHelper.webView()->fixedLayoutSize().height, 1.0f); + EXPECT_NEAR(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); } } @@ -1552,7 +1544,6 @@ TEST_F(WebFrameTest, NoWideViewportAndScaleLessThanOne) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-than-1.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); @@ -1560,8 +1551,8 @@ TEST_F(WebFrameTest, NoWideViewportAndScaleLessThanOne) webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); - EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->fixedLayoutSize().width, 1.0f); - EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->fixedLayoutSize().height, 1.0f); + EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.01f); } @@ -1577,7 +1568,6 @@ TEST_F(WebFrameTest, NoWideViewportAndScaleLessThanOneWithDeviceWidth) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "viewport-initial-scale-less-than-1-device-width.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(true); webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); @@ -1586,8 +1576,8 @@ TEST_F(WebFrameTest, NoWideViewportAndScaleLessThanOneWithDeviceWidth) webViewHelper.webView()->layout(); const float pageZoom = 0.25f; - EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom, webViewHelper.webView()->fixedLayoutSize().width, 1.0f); - EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoom, webViewHelper.webView()->fixedLayoutSize().height, 1.0f); + EXPECT_NEAR(viewportWidth * client.m_screenInfo.deviceScaleFactor / pageZoom, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width(), 1.0f); + EXPECT_NEAR(viewportHeight * client.m_screenInfo.deviceScaleFactor / pageZoom, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height(), 1.0f); EXPECT_NEAR(1.0f / client.m_screenInfo.deviceScaleFactor, webViewHelper.webView()->pageScaleFactor(), 0.01f); } @@ -1606,14 +1596,14 @@ protected: const WebSize scrollOffset, const WebSize viewportSize, const bool shouldScaleRelativeToViewportWidth) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad(url); const float aspectRatio = static_cast<float>(viewportSize.width) / viewportSize.height; FrameTestHelpers::WebViewHelper webViewHelper; - webViewHelper.initializeAndLoad(m_baseURL + url, true); + webViewHelper.initializeAndLoad(m_baseURL + url, true); webViewHelper.webView()->settings()->setViewportEnabled(true); - webViewHelper.webView()->enableFixedLayoutMode(true); // Origin scrollOffsets preserved under resize. { @@ -1721,7 +1711,6 @@ TEST_F(WebFrameTest, pageScaleFactorScalesPaintClip) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -1763,7 +1752,6 @@ TEST_F(WebFrameTest, pageScaleFactorUpdatesScrollbars) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -1791,7 +1779,6 @@ TEST_F(WebFrameTest, CanOverrideScaleLimits) FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "no_scale_for_you.html", true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); @@ -1859,7 +1846,6 @@ TEST_F(WebFrameTest, DivAutoZoomParamsTest) webViewHelper.webView()->setPageScaleFactorLimits(0.01f, 4); webViewHelper.webView()->setPageScaleFactor(0.5f, WebPoint(0, 0)); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->layout(); WebRect wideDiv(200, 100, 400, 150); @@ -1936,7 +1922,6 @@ TEST_F(WebFrameTest, DivAutoZoomWideDivTest) float doubleTapZoomAlreadyLegibleRatio = 1.2f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_wide_div_for_auto_zoom_test.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setPageScaleFactorLimits(1.0f, 4); webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); @@ -1970,7 +1955,7 @@ TEST_F(WebFrameTest, DivAutoZoomVeryTallTest) int viewportHeight = 1280 / deviceScaleFactor; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "very_tall_div.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); + webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setPageScaleFactorLimits(1.0f, 4); webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); @@ -1998,7 +1983,6 @@ TEST_F(WebFrameTest, DivAutoZoomMultipleDivsTest) float doubleTapZoomAlreadyLegibleRatio = 1.2f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom_test.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setPageScaleFactorLimits(0.5f, 4); webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); @@ -2047,7 +2031,6 @@ TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTest) float doubleTapZoomAlreadyLegibleRatio = 1.2f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setDeviceScaleFactor(1.5f); webViewHelper.webView()->layout(); @@ -2110,7 +2093,6 @@ TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTest) float textAutosizingFontScaleFactor = 1.13f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->layout(); @@ -2189,7 +2171,6 @@ TEST_F(WebFrameTest, DivMultipleTargetZoomMultipleDivsTest) float doubleTapZoomAlreadyLegibleRatio = 1.2f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom_test.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setPageScaleFactorLimits(0.5f, 4); webViewHelper.webView()->setDeviceScaleFactor(deviceScaleFactor); @@ -2226,7 +2207,6 @@ TEST_F(WebFrameTest, DivScrollIntoEditableTest) float minReadableCaretHeight = 18.0f; FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html"); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); webViewHelper.webView()->setPageScaleFactorLimits(1, 4); webViewHelper.webView()->layout(); @@ -3515,6 +3495,7 @@ TEST_F(WebFrameTest, DisambiguationPopupNoContainer) TEST_F(WebFrameTest, DisambiguationPopupMobileSite) { + UseMockScrollbarSettings mockScrollbarSettings; const std::string htmlFile = "disambiguation_popup_mobile_site.html"; registerMockedHttpURLLoad(htmlFile); @@ -3524,7 +3505,6 @@ TEST_F(WebFrameTest, DisambiguationPopupMobileSite) // only becomes available after the load begins. FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(1000, 1000)); webViewHelper.webView()->layout(); @@ -3552,6 +3532,7 @@ TEST_F(WebFrameTest, DisambiguationPopupMobileSite) TEST_F(WebFrameTest, DisambiguationPopupViewportSite) { + UseMockScrollbarSettings mockScrollbarSettings; const std::string htmlFile = "disambiguation_popup_viewport_site.html"; registerMockedHttpURLLoad(htmlFile); @@ -3561,7 +3542,6 @@ TEST_F(WebFrameTest, DisambiguationPopupViewportSite) // only becomes available after the load begins. FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client); - webViewHelper.webView()->enableFixedLayoutMode(true); webViewHelper.webView()->settings()->setViewportEnabled(true); webViewHelper.webView()->resize(WebSize(1000, 1000)); webViewHelper.webView()->layout(); diff --git a/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp b/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp index 349283c..0b75176 100644 --- a/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp @@ -98,7 +98,6 @@ TEST(WebInputEventConversionTest, InputEventsScaling) URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("fixed_layout.html")); FrameTestHelpers::WebViewHelper webViewHelper; WebViewImpl* webViewImpl = toWebViewImpl(webViewHelper.initializeAndLoad(baseURL + fileName, true)); - webViewImpl->enableFixedLayoutMode(true); webViewImpl->settings()->setViewportEnabled(true); int pageWidth = 640; int pageHeight = 480; |
