diff options
Diffstat (limited to 'third_party/WebKit')
37 files changed, 228 insertions, 342 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 2e640bf..8c617da 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -1074,7 +1074,6 @@ crbug.com/252573 [ Mac Win ] fast/forms/empty-textarea-toggle-disabled.html [ Pa crbug.com/253619 fast/loader/subresource-load-failed-crash.html [ Skip ] crbug.com/255359 [ Debug ] fast/events/resize-events-count.html [ Pass Failure ] -crbug.com/255359 [ Debug ] fast/events/resize-events-fixed-layout.html [ Pass Failure ] crbug.com/256226 [ Debug ] webmidi/requestmidiaccess.html [ Crash Pass ] @@ -1155,6 +1154,10 @@ crbug.com/282496 [ Linux Release ] css3/filters/custom/composited/custom-filter- crbug.com/284734 svg/custom/getsvgdocument.html [ Pass Failure ] +crbug.com/285397 fast/dynamic/window-resize-scrollbars-test.html [ NeedsRebaseline ] +crbug.com/285397 virtual/android/fullscreen/parent-flow-inline-with-block-child.html [ NeedsRebaseline ] +crbug.com/285397 virtual/android/fullscreen/full-screen-with-flex-item.html [ NeedsRebaseline ] + # Pre-landing "binary" file (actually UTF-16) - enable with http://crrev.com/23532016 Bug(jsbell) fast/encoding/utf-16-odd-byte.html [ Skip ] 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 a0dadd9..2a63e21 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp @@ -654,7 +654,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); } } @@ -675,7 +675,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/page/Frame.cpp b/third_party/WebKit/Source/core/page/Frame.cpp index 67a19bc..210f0ac 100644 --- a/third_party/WebKit/Source/core/page/Frame.cpp +++ b/third_party/WebKit/Source/core/page/Frame.cpp @@ -433,7 +433,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); @@ -449,8 +449,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/page/Frame.h b/third_party/WebKit/Source/core/page/Frame.h index 0e2f0c7..50cad15 100644 --- a/third_party/WebKit/Source/core/page/Frame.h +++ b/third_party/WebKit/Source/core/page/Frame.h @@ -74,7 +74,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/page/FrameView.cpp b/third_party/WebKit/Source/core/page/FrameView.cpp index 7edc4e1..f8d64d9 100644 --- a/third_party/WebKit/Source/core/page/FrameView.cpp +++ b/third_party/WebKit/Source/core/page/FrameView.cpp @@ -54,6 +54,7 @@ #include "core/page/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" @@ -190,6 +191,7 @@ FrameView::FrameView(Frame* frame) , m_hasSoftwareFilters(false) , m_visibleContentScaleFactor(1) , m_partialLayout() + , m_layoutSizeFixedToFrameSize(true) { ASSERT(m_frame); init(); @@ -212,6 +214,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(); } @@ -1062,7 +1066,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; @@ -1119,7 +1123,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(); @@ -1619,6 +1623,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() { @@ -1735,7 +1750,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 @@ -1744,12 +1759,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(); } } @@ -2406,6 +2425,7 @@ void FrameView::autoSizeIfEnabled() break; resize(newSize.width(), newSize.height()); + setLayoutSize(newSize); // Force the scrollbar state to avoid the scrollbar code adding them and causing them to be needed. For example, // a vertical scrollbar may cause text to wrap and thus increase the height (which is the only reason the scollbar is needed). setVerticalScrollbarLock(false); @@ -3412,4 +3432,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/page/FrameView.h b/third_party/WebKit/Source/core/page/FrameView.h index 45f9731..4d94038 100644 --- a/third_party/WebKit/Source/core/page/FrameView.h +++ b/third_party/WebKit/Source/core/page/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); @@ -355,6 +364,7 @@ private: void reset(); void init(); + virtual void frameRectsChanged(); virtual bool isFrameView() const OVERRIDE { return true; } friend class RenderWidget; @@ -380,7 +390,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. @@ -433,6 +443,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; @@ -542,6 +554,8 @@ private: float m_visibleContentScaleFactor; 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 616dee2..b0904c0 100644 --- a/third_party/WebKit/Source/core/platform/ScrollView.cpp +++ b/third_party/WebKit/Source/core/platform/ScrollView.cpp @@ -49,7 +49,6 @@ ScrollView::ScrollView() , m_inUpdateScrollbars(false) , m_updateScrollbarsPass(0) , m_drawPanScrollIcon(false) - , m_useFixedLayout(false) , m_paintsEntireContents(false) , m_clipsRepaints(true) { @@ -186,63 +185,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; @@ -368,7 +337,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; } @@ -443,12 +412,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 @@ -739,12 +708,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 a9bbf1b..7c4685b 100644 --- a/third_party/WebKit/Source/core/platform/ScrollView.h +++ b/third_party/WebKit/Source/core/platform/ScrollView.h @@ -120,26 +120,16 @@ 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; } - // 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(). @@ -275,7 +265,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); @@ -297,6 +287,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; @@ -314,7 +306,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; @@ -325,7 +316,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 de0780d..e5eb939 100644 --- a/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp +++ b/third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp @@ -1293,6 +1293,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 292bfe7..ade1518 100644 --- a/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp +++ b/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp @@ -395,7 +395,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 ba353e0..1092509 100644 --- a/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.h +++ b/third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.h @@ -95,7 +95,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 72057fc..69a25a1 100644 --- a/third_party/WebKit/Source/core/rendering/RenderView.cpp +++ b/third_party/WebKit/Source/core/rendering/RenderView.cpp @@ -1010,27 +1010,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 5ac228e..d0028bd 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 44cb63c..acb457a 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp @@ -601,7 +601,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/WebDevToolsAgentImpl.cpp b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp index 2ff512f..53454bd 100644 --- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp +++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp @@ -332,9 +332,14 @@ private: int overrideWidth = effectiveEmulatedSize.width + scrollbarDimensions.width; int overrideHeight = effectiveEmulatedSize.height + scrollbarDimensions.height; - if (IntSize(overrideWidth, overrideHeight) != frameView->size()) + if (IntSize(overrideWidth, overrideHeight) != frameView->size()) { frameView->resize(overrideWidth, overrideHeight); + // Since we're resizing the main-frame, we need to resize its layout size too since + // main frames' layout sizes are manually managed by WebViewImpl + frameView->setLayoutSize(IntSize(overrideWidth, overrideHeight)); + } + Document* doc = frameView->frame().document(); doc->styleResolverChanged(RecalcStyleImmediately); doc->updateLayout(); diff --git a/third_party/WebKit/Source/web/WebFrameImpl.cpp b/third_party/WebKit/Source/web/WebFrameImpl.cpp index 3e4ebce..43bb32b 100644 --- a/third_party/WebKit/Source/web/WebFrameImpl.cpp +++ b/third_party/WebKit/Source/web/WebFrameImpl.cpp @@ -2240,7 +2240,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 f9ccfa3..bcf6106 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp @@ -1715,8 +1715,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) @@ -2924,34 +2924,6 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor) m_layerTreeView->setDeviceScaleFactor(scaleFactor); } -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; @@ -3018,7 +2990,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) { @@ -3043,9 +3015,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; @@ -3058,13 +3030,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 @@ -3135,18 +3122,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()) @@ -3163,9 +3138,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, @@ -4192,7 +4167,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: @@ -4202,7 +4177,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 04be195..e0ee278 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); @@ -446,7 +451,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 89a2c70..68a4118 100644 --- a/third_party/WebKit/Source/web/tests/ScrollAnimatorNoneTest.cpp +++ b/third_party/WebKit/Source/web/tests/ScrollAnimatorNoneTest.cpp @@ -62,7 +62,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 3bbbc50..ec4a3f9 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)); @@ -876,7 +874,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)); @@ -903,6 +900,7 @@ TEST_F(WebFrameTest, WideDocumentInitializeAtMinimumScale) TEST_F(WebFrameTest, setLoadWithOverviewModeToFalse) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -912,7 +910,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); @@ -924,6 +921,7 @@ TEST_F(WebFrameTest, setLoadWithOverviewModeToFalse) TEST_F(WebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewport) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("large-div.html"); FixedLayoutTestWebViewClient client; @@ -933,7 +931,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); @@ -946,6 +943,7 @@ TEST_F(WebFrameTest, SetLoadWithOverviewModeToFalseAndNoWideViewport) TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidth) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -955,7 +953,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); @@ -968,6 +965,7 @@ TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidth) TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccountsScale) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -977,13 +975,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()); @@ -991,6 +988,7 @@ TEST_F(WebFrameTest, NoWideViewportIgnoresPageViewportWidthButAccountsScale) TEST_F(WebFrameTest, WideViewportSetsTo980WithoutViewportTag) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("no_viewport_tag.html"); FixedLayoutTestWebViewClient client; @@ -1000,7 +998,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); @@ -1012,6 +1009,7 @@ TEST_F(WebFrameTest, WideViewportSetsTo980WithoutViewportTag) TEST_F(WebFrameTest, NoWideViewportAndHeightInMeta) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-height-1000.html"); FixedLayoutTestWebViewClient client; @@ -1021,7 +1019,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); @@ -1032,6 +1029,7 @@ TEST_F(WebFrameTest, NoWideViewportAndHeightInMeta) TEST_F(WebFrameTest, WideViewportSetsTo980WithAutoWidth) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-2x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1041,7 +1039,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); @@ -1053,6 +1050,7 @@ TEST_F(WebFrameTest, WideViewportSetsTo980WithAutoWidth) TEST_F(WebFrameTest, PageViewportInitialScaleOverridesLoadWithOverviewMode) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1062,7 +1060,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)); @@ -1086,7 +1083,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(); @@ -1106,6 +1102,7 @@ TEST_F(WebFrameTest, setInitialPageScaleFactorPermanently) TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesLoadWithOverviewMode) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-auto-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1116,7 +1113,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); @@ -1127,6 +1123,7 @@ TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesLoadWithOverviewMod TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesPageViewportInitialScale) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1137,7 +1134,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)); @@ -1147,6 +1143,7 @@ TEST_F(WebFrameTest, PermanentInitialPageScaleFactorOverridesPageViewportInitial TEST_F(WebFrameTest, WideViewportInitialScaleDoesNotExpandFixedLayoutWidth) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-device-0.5x-initial-scale.html"); FixedLayoutTestWebViewClient client; @@ -1156,18 +1153,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; @@ -1177,7 +1174,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); @@ -1196,6 +1192,7 @@ TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) TEST_F(WebFrameTest, ZeroValuesQuirk) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-zero-values.html"); FixedLayoutTestWebViewClient client; @@ -1205,7 +1202,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); @@ -1213,12 +1209,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()); } @@ -1263,6 +1259,7 @@ TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) TEST_F(WebFrameTest, NonZeroValuesNoQuirk) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("viewport-nonzero-values.html"); FixedLayoutTestWebViewClient client; @@ -1273,7 +1270,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); @@ -1281,17 +1277,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; @@ -1301,7 +1298,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(); @@ -1309,6 +1305,7 @@ TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate) TEST_F(WebFrameTest, setPageScaleFactorDoesNotLayout) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); FixedLayoutTestWebViewClient client; @@ -1319,7 +1316,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(); @@ -1343,7 +1339,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(); @@ -1372,6 +1367,7 @@ TEST_F(WebFrameTest, setPageScaleFactorBeforeFrameHasView) TEST_F(WebFrameTest, pageScaleFactorWrittenToHistoryItem) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); FixedLayoutTestWebViewClient client; @@ -1381,7 +1377,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(); @@ -1395,6 +1390,7 @@ TEST_F(WebFrameTest, pageScaleFactorWrittenToHistoryItem) TEST_F(WebFrameTest, pageScaleFactorShrinksViewport) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("large-div.html"); FixedLayoutTestWebViewClient client; @@ -1405,7 +1401,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(); @@ -1431,6 +1426,7 @@ TEST_F(WebFrameTest, pageScaleFactorShrinksViewport) TEST_F(WebFrameTest, pageScaleFactorDoesNotApplyCssTransform) { + UseMockScrollbarSettings mockScrollbarSettings; registerMockedHttpURLLoad("fixed_layout.html"); FixedLayoutTestWebViewClient client; @@ -1440,7 +1436,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(); @@ -1470,7 +1465,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); @@ -1479,8 +1473,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); } } @@ -1501,14 +1495,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); } } @@ -1529,15 +1522,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); } } @@ -1553,7 +1545,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); @@ -1561,8 +1552,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(pageZoom * 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 72f83cf..5be46e6 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; |
