Title: [140555] branches/chromium/1391a/Source

Diff

Modified: branches/chromium/1391a/Source/Platform/chromium/public/WebLayerTreeView.h (140554 => 140555)


--- branches/chromium/1391a/Source/Platform/chromium/public/WebLayerTreeView.h	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/Platform/chromium/public/WebLayerTreeView.h	2013-01-23 19:04:28 UTC (rev 140555)
@@ -102,10 +102,6 @@
     // mode).
     virtual WebSize deviceViewportSize() const = 0;
 
-    // Gives the corrected location for an event, accounting for the pinch-zoom transformation
-    // in the compositor.
-    virtual WebFloatPoint adjustEventPointForPinchZoom(const WebFloatPoint&) const = 0;
-
     virtual void setDeviceScaleFactor(float) = 0;
     virtual float deviceScaleFactor() const = 0;
 

Modified: branches/chromium/1391a/Source/WebCore/loader/HistoryController.cpp (140554 => 140555)


--- branches/chromium/1391a/Source/WebCore/loader/HistoryController.cpp	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebCore/loader/HistoryController.cpp	2013-01-23 19:04:28 UTC (rev 140555)
@@ -87,8 +87,12 @@
     else
         item->setScrollPoint(m_frame->view()->scrollPosition());
 
-    item->setPageScaleFactor(m_frame->frameScaleFactor());
-    
+    Page* page = m_frame->page();
+    if (page && page->mainFrame() == m_frame)
+        item->setPageScaleFactor(page->pageScaleFactor());
+    else
+        item->setPageScaleFactor(1);
+
     // FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client.
     m_frame->loader()->client()->saveViewStateToItem(item);
 }

Modified: branches/chromium/1391a/Source/WebCore/page/FrameView.cpp (140554 => 140555)


--- branches/chromium/1391a/Source/WebCore/page/FrameView.cpp	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebCore/page/FrameView.cpp	2013-01-23 19:04:28 UTC (rev 140555)
@@ -2807,6 +2807,17 @@
     return page->chrome()->windowResizerRect();
 }
 
+float FrameView::visibleContentScaleFactor() const
+{
+    if (!m_frame || !m_frame->page())
+        return 1;
+
+    if (!m_frame->settings()->applyPageScaleFactorInCompositor() || m_frame != m_frame->page()->mainFrame())
+        return 1;
+
+    return m_frame->page()->pageScaleFactor();
+}
+
 void FrameView::setVisibleScrollerThumbRect(const IntRect& scrollerThumb)
 {
     Page* page = m_frame->page();

Modified: branches/chromium/1391a/Source/WebCore/page/FrameView.h (140554 => 140555)


--- branches/chromium/1391a/Source/WebCore/page/FrameView.h	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebCore/page/FrameView.h	2013-01-23 19:04:28 UTC (rev 140555)
@@ -183,6 +183,8 @@
 
     virtual IntRect windowResizerRect() const;
 
+    virtual float visibleContentScaleFactor() const OVERRIDE;
+
     virtual void setFixedVisibleContentRect(const IntRect&) OVERRIDE;
     virtual void setScrollPosition(const IntPoint&) OVERRIDE;
     void scrollPositionChangedViaPlatformWidget();

Modified: branches/chromium/1391a/Source/WebCore/page/Page.cpp (140554 => 140555)


--- branches/chromium/1391a/Source/WebCore/page/Page.cpp	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebCore/page/Page.cpp	2013-01-23 19:04:28 UTC (rev 140555)
@@ -733,13 +733,15 @@
 
     m_pageScaleFactor = scale;
 
-    if (document->renderer())
-        document->renderer()->setNeedsLayout(true);
+    if (!m_settings->applyPageScaleFactorInCompositor()) {
+        if (document->renderer())
+            document->renderer()->setNeedsLayout(true);
 
-    document->recalcStyle(Node::Force);
+        document->recalcStyle(Node::Force);
 
-    // Transform change on RenderView doesn't trigger repaint on non-composited contents.
-    mainFrame()->view()->invalidateRect(IntRect(LayoutRect::infiniteRect()));
+        // Transform change on RenderView doesn't trigger repaint on non-composited contents.
+        mainFrame()->view()->invalidateRect(IntRect(LayoutRect::infiniteRect()));
+    }
 
 #if USE(ACCELERATED_COMPOSITING)
     mainFrame()->deviceOrPageScaleFactorChanged();

Modified: branches/chromium/1391a/Source/WebCore/platform/ScrollView.cpp (140554 => 140555)


--- branches/chromium/1391a/Source/WebCore/platform/ScrollView.cpp	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebCore/platform/ScrollView.cpp	2013-01-23 19:04:28 UTC (rev 140555)
@@ -225,14 +225,13 @@
     delegatesScrollingDidChange();
 }
 
-#if !PLATFORM(GTK)
-IntRect ScrollView::visibleContentRect(bool includeScrollbars) const
+IntSize ScrollView::unscaledVisibleContentSize(bool includeScrollbars) const
 {
     if (platformWidget())
-        return platformVisibleContentRect(includeScrollbars);
+        return platformVisibleContentRect(includeScrollbars).size();
 
     if (!m_fixedVisibleContentRect.isEmpty())
-        return m_fixedVisibleContentRect;
+        return m_fixedVisibleContentRect.size();
 
     int verticalScrollbarWidth = 0;
     int horizontalScrollbarHeight = 0;
@@ -244,11 +243,23 @@
             horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
     }
 
-    return IntRect(m_scrollOffset.width(),
-                   m_scrollOffset.height(),
-                   max(0, width() - verticalScrollbarWidth), 
+    return IntSize(max(0, width() - verticalScrollbarWidth),
                    max(0, height() - horizontalScrollbarHeight));
 }
+
+#if !PLATFORM(GTK)
+IntRect ScrollView::visibleContentRect(bool includeScrollbars) const
+{
+    if (platformWidget())
+        return platformVisibleContentRect(includeScrollbars);
+
+    if (!m_fixedVisibleContentRect.isEmpty())
+        return m_fixedVisibleContentRect;
+
+    FloatSize visibleContentSize = unscaledVisibleContentSize(includeScrollbars);
+    visibleContentSize.scale(1 / visibleContentScaleFactor());
+    return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize));
+}
 #endif
 
 IntSize ScrollView::layoutSize() const

Modified: branches/chromium/1391a/Source/WebCore/platform/ScrollView.h (140554 => 140555)


--- branches/chromium/1391a/Source/WebCore/platform/ScrollView.h	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebCore/platform/ScrollView.h	2013-01-23 19:04:28 UTC (rev 140555)
@@ -151,6 +151,13 @@
     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.
+    // visibleContentScaleFactor is usually 1, except when the setting applyPageScaleFactorInCompositor is true and the
+    // ScrollView is the main frame; in that case, visibleContentScaleFactor is equal to the page's pageScaleFactor.
+    // Ports that don't use pageScaleFactor can treat unscaledVisibleContentSize and visibleContentRect().size() as equivalent.
+    IntSize unscaledVisibleContentSize(bool includeScrollbars) 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() const;

Modified: branches/chromium/1391a/Source/WebCore/rendering/RenderLayerCompositor.cpp (140554 => 140555)


--- branches/chromium/1391a/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-01-23 19:04:28 UTC (rev 140555)
@@ -1163,7 +1163,7 @@
 {
     if (m_clipLayer) {
         FrameView* frameView = m_renderView->frameView();
-        m_clipLayer->setSize(frameView->visibleContentRect(false /* exclude scrollbars */).size());
+        m_clipLayer->setSize(frameView->unscaledVisibleContentSize(false /* exclude scrollbars */));
 
         frameViewDidScroll();
         updateOverflowControlsLayers();
@@ -1523,7 +1523,7 @@
     }
     if (m_clipLayer) {
         FrameView* frameView = m_renderView->frameView();
-        m_clipLayer->setSize(frameView->visibleContentRect(false /* exclude scrollbars */).size());
+        m_clipLayer->setSize(frameView->unscaledVisibleContentSize(false /* exclude scrollbars */));
     }
 
 #if ENABLE(RUBBER_BANDING)

Modified: branches/chromium/1391a/Source/WebCore/rendering/TextAutosizer.cpp (140554 => 140555)


--- branches/chromium/1391a/Source/WebCore/rendering/TextAutosizer.cpp	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebCore/rendering/TextAutosizer.cpp	2013-01-23 19:04:28 UTC (rev 140555)
@@ -84,7 +84,7 @@
     windowInfo.windowSize = m_document->settings()->textAutosizingWindowSizeOverride();
     if (windowInfo.windowSize.isEmpty()) {
         bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(mainFrame);
-        windowInfo.windowSize = mainFrame->view()->visibleContentRect(includeScrollbars).size();
+        windowInfo.windowSize = mainFrame->view()->unscaledVisibleContentSize(includeScrollbars);
         if (!m_document->settings()->applyDeviceScaleFactorInCompositor())
             windowInfo.windowSize.scale(1 / m_document->page()->deviceScaleFactor());
     }

Modified: branches/chromium/1391a/Source/WebKit/chromium/src/WebViewImpl.cpp (140554 => 140555)


--- branches/chromium/1391a/Source/WebKit/chromium/src/WebViewImpl.cpp	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebKit/chromium/src/WebViewImpl.cpp	2013-01-23 19:04:28 UTC (rev 140555)
@@ -1602,11 +1602,15 @@
         pluginContainer->willStartLiveResize();
 }
 
+IntSize WebViewImpl::scaledSize(float pageScaleFactor) const
+{
+    FloatSize scaledSize = dipSize();
+    scaledSize.scale(1 / pageScaleFactor);
+    return expandedIntSize(scaledSize);
+}
+
 WebSize WebViewImpl::size()
 {
-    if (isFixedLayoutModeEnabled() && settingsImpl()->applyPageScaleFactorInCompositor())
-        return layoutSize();
-
     return m_size;
 }
 
@@ -1637,7 +1641,7 @@
     if (!agentPrivate || !agentPrivate->metricsOverridden()) {
         WebFrameImpl* webFrame = mainFrameImpl();
         if (webFrame->frameView())
-            webFrame->frameView()->resize(size());
+            webFrame->frameView()->resize(m_size);
     }
 
 #if ENABLE(VIEWPORT)
@@ -2073,30 +2077,24 @@
         return true;
     }
 
-    if (!m_layerTreeView)
-        return PageWidgetDelegate::handleInputEvent(m_page.get(), *this, inputEvent);
-
     const WebInputEvent* inputEventTransformed = &inputEvent;
-    WebMouseEvent mouseEvent;
-    WebGestureEvent gestureEvent;
-    if (WebInputEvent::isMouseEventType(inputEvent.type)) {
-        mouseEvent = *static_cast<const WebMouseEvent*>(&inputEvent);
-
-        IntPoint transformedLocation = roundedIntPoint(m_layerTreeView->adjustEventPointForPinchZoom(WebFloatPoint(mouseEvent.x, mouseEvent.y)));
-        mouseEvent.x = transformedLocation.x();
-        mouseEvent.y = transformedLocation.y();
-        inputEventTransformed = static_cast<const WebInputEvent*>(&mouseEvent);
-    } else if (WebInputEvent::isGestureEventType(inputEvent.type)) {
-        gestureEvent = *static_cast<const WebGestureEvent*>(&inputEvent);
-
-        IntPoint transformedLocation = roundedIntPoint(m_layerTreeView->adjustEventPointForPinchZoom(WebFloatPoint(gestureEvent.x, gestureEvent.y)));
-        gestureEvent.x = transformedLocation.x();
-        gestureEvent.y = transformedLocation.y();
-        inputEventTransformed = static_cast<const WebInputEvent*>(&gestureEvent);
+    if (m_page->settings()->applyPageScaleFactorInCompositor()) {
+        WebMouseEvent mouseEvent;
+        WebGestureEvent gestureEvent;
+        if (WebInputEvent::isMouseEventType(inputEvent.type)) {
+            mouseEvent = *static_cast<const WebMouseEvent*>(&inputEvent);
+            mouseEvent.x = mouseEvent.x / pageScaleFactor();
+            mouseEvent.y = mouseEvent.y / pageScaleFactor();
+            inputEventTransformed = static_cast<const WebInputEvent*>(&mouseEvent);
+        } else if (WebInputEvent::isGestureEventType(inputEvent.type)) {
+            gestureEvent = *static_cast<const WebGestureEvent*>(&inputEvent);
+            gestureEvent.x = gestureEvent.x / pageScaleFactor();
+            gestureEvent.y = gestureEvent.y / pageScaleFactor();
+            inputEventTransformed = static_cast<const WebInputEvent*>(&gestureEvent);
+        }
     }
 
-    bool handled = PageWidgetDelegate::handleInputEvent(m_page.get(), *this, *inputEventTransformed);
-    return handled;
+    return PageWidgetDelegate::handleInputEvent(m_page.get(), *this, *inputEventTransformed);
 }
 
 void WebViewImpl::mouseCaptureLost()
@@ -2776,42 +2774,50 @@
     // Pick a scale which is reasonably readable. This is the scale at which
     // the caret height will become minReadableCaretHeight (adjusted for dpi
     // and font scale factor).
-    float targetScale = deviceScaleFactor();
+    float targetScale = settingsImpl()->applyDeviceScaleFactorInCompositor() ? 1 : deviceScaleFactor();
 #if ENABLE(TEXT_AUTOSIZING)
     if (page() && page()->settings())
         targetScale *= page()->settings()->textAutosizingFontScaleFactor();
 #endif
-    const float newScale = clampPageScaleFactorToLimits(pageScaleFactor() * minReadableCaretHeight * targetScale / caret.height);
+    const float caretHeight = settingsImpl()->applyPageScaleFactorInCompositor() ? caret.height : caret.height * pageScaleFactor();
+    const float newScale = clampPageScaleFactorToLimits(targetScale * minReadableCaretHeight / caretHeight);
     const float deltaScale = newScale / pageScaleFactor();
 
     // Convert the rects to absolute space in the new scale.
     IntRect textboxRectInDocumentCoordinates = textboxRect;
     textboxRectInDocumentCoordinates.move(mainFrame()->scrollOffset());
-    textboxRectInDocumentCoordinates.scale(deltaScale);
     IntRect caretInDocumentCoordinates = caret;
     caretInDocumentCoordinates.move(mainFrame()->scrollOffset());
-    caretInDocumentCoordinates.scale(deltaScale);
+    int viewWidth = m_size.width;
+    int viewHeight = m_size.height;
+    if (settingsImpl()->applyPageScaleFactorInCompositor()) {
+        viewWidth /= newScale;
+        viewHeight /= newScale;
+    } else {
+        textboxRectInDocumentCoordinates.scale(deltaScale);
+        caretInDocumentCoordinates.scale(deltaScale);
+    }
 
     IntPoint newOffset;
-    if (textboxRectInDocumentCoordinates.width() <= m_size.width) {
+    if (textboxRectInDocumentCoordinates.width() <= viewWidth) {
         // Field is narrower than screen. Try to leave padding on left so field's
         // label is visible, but it's more important to ensure entire field is
         // onscreen.
-        int idealLeftPadding = m_size.width * leftBoxRatio;
-        int maxLeftPaddingKeepingBoxOnscreen = m_size.width - textboxRectInDocumentCoordinates.width();
+        int idealLeftPadding = viewWidth * leftBoxRatio;
+        int maxLeftPaddingKeepingBoxOnscreen = viewWidth - textboxRectInDocumentCoordinates.width();
         newOffset.setX(textboxRectInDocumentCoordinates.x() - min<int>(idealLeftPadding, maxLeftPaddingKeepingBoxOnscreen));
     } else {
         // Field is wider than screen. Try to left-align field, unless caret would
         // be offscreen, in which case right-align the caret.
-        newOffset.setX(max<int>(textboxRectInDocumentCoordinates.x(), caretInDocumentCoordinates.x() + caretInDocumentCoordinates.width() + caretPadding - m_size.width));
+        newOffset.setX(max<int>(textboxRectInDocumentCoordinates.x(), caretInDocumentCoordinates.x() + caretInDocumentCoordinates.width() + caretPadding - viewWidth));
     }
-    if (textboxRectInDocumentCoordinates.height() <= m_size.height) {
+    if (textboxRectInDocumentCoordinates.height() <= viewHeight) {
         // Field is shorter than screen. Vertically center it.
-        newOffset.setY(textboxRectInDocumentCoordinates.y() - (m_size.height - textboxRectInDocumentCoordinates.height()) / 2);
+        newOffset.setY(textboxRectInDocumentCoordinates.y() - (viewHeight - textboxRectInDocumentCoordinates.height()) / 2);
     } else {
         // Field is taller than screen. Try to top align field, unless caret would
         // be offscreen, in which case bottom-align the caret.
-        newOffset.setY(max<int>(textboxRectInDocumentCoordinates.y(), caretInDocumentCoordinates.y() + caretInDocumentCoordinates.height() + caretPadding - m_size.height));
+        newOffset.setY(max<int>(textboxRectInDocumentCoordinates.y(), caretInDocumentCoordinates.y() + caretInDocumentCoordinates.height() + caretPadding - viewHeight)); 
     }
 
     bool needAnimation = false;
@@ -2819,7 +2825,7 @@
     if (deltaScale > minScaleChangeToTriggerZoom)
         needAnimation = true;
     // If the caret is offscreen, then animate.
-    IntRect sizeRect(0, 0, m_size.width, m_size.height);
+    IntRect sizeRect(0, 0, viewWidth, viewHeight);
     if (!sizeRect.contains(caret))
         needAnimation = true;
     // If the box is partially offscreen and it's possible to bring it fully
@@ -2911,34 +2917,40 @@
     return min(max(scaleFactor, m_minimumPageScaleFactor), m_maximumPageScaleFactor);
 }
 
-WebPoint WebViewImpl::clampOffsetAtScale(const WebPoint& offset, float scale)
+IntPoint WebViewImpl::clampOffsetAtScale(const IntPoint& offset, float scale) const
 {
-    // This is the scaled content size. We need to convert it to the new scale factor.
-    WebSize contentSize = mainFrame()->contentsSize();
-    float deltaScale = scale / pageScaleFactor();
-    int docWidthAtNewScale = contentSize.width * deltaScale;
-    int docHeightAtNewScale = contentSize.height * deltaScale;
-    int viewWidth = m_size.width;
-    int viewHeight = m_size.height;
+    IntPoint clampedOffset = offset;
+    if (!m_page->settings()->applyPageScaleFactorInCompositor()) {
+        // This is the scaled content size. We need to convert it to the new scale factor.
+        WebSize contentSize = unscaledContentsSize();
+        int docWidthAtNewScale = contentSize.width * scale;
+        int docHeightAtNewScale = contentSize.height * scale;
+        int viewWidth = m_size.width;
+        int viewHeight = m_size.height;
 
-    // Enforce the maximum and minimum scroll positions at the new scale.
-    IntPoint clampedOffset = offset;
-    clampedOffset = clampedOffset.shrunkTo(IntPoint(docWidthAtNewScale - viewWidth, docHeightAtNewScale - viewHeight));
-    clampedOffset.clampNegativeToZero();
+        // Enforce the maximum and minimum scroll positions at the new scale.
+        clampedOffset = clampedOffset.shrunkTo(IntPoint(docWidthAtNewScale - viewWidth, docHeightAtNewScale - viewHeight));
+        clampedOffset.clampNegativeToZero();
+    } else {
+        clampedOffset = clampedOffset.shrunkTo(IntPoint(unscaledContentsSize() - scaledSize(scale)));
+        clampedOffset.clampNegativeToZero();
+    }
+
     return clampedOffset;
 }
 
 void WebViewImpl::setPageScaleFactorPreservingScrollOffset(float scaleFactor)
 {
-    // Pick a scale factor that is within the expected limits
     scaleFactor = clampPageScaleFactorToLimits(scaleFactor);
 
-    IntPoint scrollOffsetAtNewScale(mainFrame()->scrollOffset().width, mainFrame()->scrollOffset().height);
-    float deltaScale = scaleFactor / pageScaleFactor();
-    scrollOffsetAtNewScale.scale(deltaScale, deltaScale);
+    IntPoint scrollOffset(mainFrame()->scrollOffset().width, mainFrame()->scrollOffset().height);
+    if (!m_page->settings()->applyPageScaleFactorInCompositor()) {
+        float deltaScale = scaleFactor / pageScaleFactor();
+        scrollOffset.scale(deltaScale, deltaScale);
+    }
+    scrollOffset = clampOffsetAtScale(scrollOffset, scaleFactor);
 
-    WebPoint clampedOffsetAtNewScale = clampOffsetAtScale(scrollOffsetAtNewScale, scaleFactor);
-    setPageScaleFactor(scaleFactor, clampedOffsetAtNewScale);
+    setPageScaleFactor(scaleFactor, scrollOffset);
 }
 
 void WebViewImpl::setPageScaleFactor(float scaleFactor, const WebPoint& origin)
@@ -2949,22 +2961,17 @@
     if (!scaleFactor)
         scaleFactor = 1;
 
+    IntPoint scrollOffset = origin;
     scaleFactor = clampPageScaleFactorToLimits(scaleFactor);
-    WebPoint scrollOffset;
-    if (!m_page->settings()->applyPageScaleFactorInCompositor()) {
-        // If page scale is not applied in the compositor, then the scroll offsets should
-        // be modified by the scale factor.
-        scrollOffset = clampOffsetAtScale(origin, scaleFactor);
-    } else {
-        IntPoint offset = origin;
-        WebSize contentSize = mainFrame()->contentsSize();
-        offset.shrunkTo(IntPoint(contentSize.width - m_size.width, contentSize.height - m_size.height));
-        offset.clampNegativeToZero();
-        scrollOffset = offset;
-    }
+    scrollOffset = clampOffsetAtScale(scrollOffset, scaleFactor);
 
-    page()->setPageScaleFactor(scaleFactor, scrollOffset);
+    page()->setPageScaleFactor(scaleFactor, IntPoint(scrollOffset));
+
     m_pageScaleFactorIsSet = true;
+
+#if USE(ACCELERATED_COMPOSITING)
+    updateLayerTreeViewport();
+#endif
 }
 
 float WebViewImpl::deviceScaleFactor() const
@@ -3048,12 +3055,16 @@
     m_page->chrome()->client()->dispatchViewportPropertiesDidChange(page()->mainFrame()->document()->viewportArguments());
 }
 
-static IntSize unscaledContentsSize(Frame* frame)
+IntSize WebViewImpl::unscaledContentsSize() const
 {
+    Frame* frame = page()->mainFrame();
     RenderView* root = frame->contentRenderer();
     if (!root)
         return IntSize();
-    return root->unscaledDocumentRect().size();
+
+    if (!m_page->settings()->applyPageScaleFactorInCompositor())
+        return root->unscaledDocumentRect().size();
+    return root->documentRect().size();
 }
 
 IntSize WebViewImpl::layoutSize() const
@@ -3061,7 +3072,8 @@
     if (!isFixedLayoutModeEnabled())
         return m_size;
 
-    IntSize contentSize = unscaledContentsSize(page()->mainFrame());
+    IntSize contentSize = unscaledContentsSize();
+
     if (fixedLayoutSize().width >= contentSize.width())
         return fixedLayoutSize();
 
@@ -3089,7 +3101,7 @@
     int viewWidthNotIncludingScrollbars = m_size.width;
     if (viewWidthNotIncludingScrollbars && view->verticalScrollbar() && !view->verticalScrollbar()->isOverlayScrollbar())
         viewWidthNotIncludingScrollbars -= view->verticalScrollbar()->width();
-    int unscaledContentsWidth = unscaledContentsSize(page()->mainFrame()).width();
+    int unscaledContentsWidth = unscaledContentsSize().width();
     if (viewWidthNotIncludingScrollbars && unscaledContentsWidth) {
         // Limit page scaling down to the document width.
         m_minimumPageScaleFactor = max(m_minimumPageScaleFactor, static_cast<float>(viewWidthNotIncludingScrollbars) / unscaledContentsWidth);
@@ -3750,15 +3762,10 @@
     } else
         mayNeedLayout = computePageScaleFactorLimits();
 
-    FrameView* view = mainFrameImpl()->frameView();
-    if (settingsImpl()->applyPageScaleFactorInCompositor() && view && view->visibleContentRect(true).width() != layoutSize().width()) {
-        view->resize(layoutSize());
-        mayNeedLayout = true;
-    }
-
     // didChangeContentsSize() may be called from FrameView::layout; we need to
     // relayout to avoid triggering the assertion that needsLayout() isn't set
     // at the end of a layout.
+    FrameView* view = mainFrameImpl()->frameView();
     if (mayNeedLayout && view && view->needsLayout())
         view->layout();
 #endif
@@ -4230,16 +4237,14 @@
         return;
 
     FrameView* view = page()->mainFrame()->view();
-    IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
-    IntPoint scroll(view->scrollX(), view->scrollY());
 
-    m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, view->scrollOrigin());
-
-    IntSize layoutViewportSize = visibleRect.size();
+    IntSize layoutViewportSize = layoutSize();
     IntSize deviceViewportSize = m_size;
     if (m_webSettings->applyDeviceScaleFactorInCompositor())
         deviceViewportSize.scale(deviceScaleFactor());
 
+    m_nonCompositedContentHost->setViewport(deviceViewportSize, view->contentsSize(), view->scrollPosition(), view->scrollOrigin());
+
     m_layerTreeView->setViewportSize(layoutViewportSize, deviceViewportSize);
     m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
 }

Modified: branches/chromium/1391a/Source/WebKit/chromium/src/WebViewImpl.h (140554 => 140555)


--- branches/chromium/1391a/Source/WebKit/chromium/src/WebViewImpl.h	2013-01-23 18:54:56 UTC (rev 140554)
+++ branches/chromium/1391a/Source/WebKit/chromium/src/WebViewImpl.h	2013-01-23 19:04:28 UTC (rev 140555)
@@ -461,6 +461,7 @@
 
     WebCore::IntSize dipSize() const;
     WebCore::IntSize layoutSize() const;
+    WebCore::IntSize scaledSize(float) const;
 
     // Set the disposition for how this webview is to be initially shown.
     void setInitialNavigationPolicy(WebNavigationPolicy policy)
@@ -611,7 +612,8 @@
 private:
     bool computePageScaleFactorLimits();
     float clampPageScaleFactorToLimits(float scale);
-    WebPoint clampOffsetAtScale(const WebPoint& offset, float scale);
+    WebCore::IntPoint clampOffsetAtScale(const WebCore::IntPoint& offset, float scale) const;
+    WebCore::IntSize unscaledContentsSize() const;
 
     void resetSavedScrollAndScaleState();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to