Add a log channel for viewports
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Dec 2017 17:55:24 +0000 (17:55 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Dec 2017 17:55:24 +0000 (17:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180295

Reviewed by Zalan Bujtas.

Add a "Viewports" log channel to log viewport scaling information, and enhance the
WebKit "VisibleRects" channel to log additional data for the same reason.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::processViewport):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::finishedParsing):
(WebCore::FrameLoader::completed):
* page/FrameView.cpp:
(WebCore::FrameView::resetScrollbarsAndClearContentsSize):
(WebCore::FrameView::scrollToAnchor):
(WebCore::FrameView::maintainScrollPositionAtAnchor):
(WebCore::FrameView::setScrollPosition):
(WebCore::FrameView::autoSizeIfEnabled):
(WebCore::FrameView::setWasScrolledByUser):
* page/LayoutContext.cpp:
(WebCore::LayoutContext::layout):
* page/Page.cpp:
(WebCore::Page::setPageScaleFactor):
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::setContentsSize):
(WebCore::ViewportConfiguration::setViewportArguments):
(WebCore::ViewportConfiguration::updateConfiguration):
(WebCore::operator<<):
(WebCore::ViewportConfiguration::description const):
(WebCore::ViewportConfiguration::dump const):
* page/ViewportConfiguration.h:
* platform/Logging.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::setFixedLayoutSize):

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCommitLayerTree:]):
(-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
(-[WKWebView _dispatchSetMinimumLayoutSize:]):
(-[WKWebView _endAnimatedResize]):
(-[WKWebView _resizeWhileHidingContentWithUpdates:]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setFixedLayoutSize):
(WebKit::WebPage::mainFrameDidLayout):
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::scaleAfterViewportWidthChange):
(WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
(WebKit::WebPage::dynamicViewportSizeUpdate):
(WebKit::WebPage::resetViewportDefaultConfiguration):
(WebKit::WebPage::viewportConfigurationChanged):
(WebKit::WebPage::updateVisibleContentRects):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225449 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/LayoutContext.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/ViewportConfiguration.cpp
Source/WebCore/page/ViewportConfiguration.h
Source/WebCore/platform/Logging.h
Source/WebCore/platform/ScrollView.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

index e454a4c..cdc0c30 100644 (file)
@@ -1,3 +1,41 @@
+2017-12-02  Simon Fraser  <simon.fraser@apple.com>
+
+        Add a log channel for viewports
+        https://bugs.webkit.org/show_bug.cgi?id=180295
+
+        Reviewed by Zalan Bujtas.
+
+        Add a "Viewports" log channel to log viewport scaling information, and enhance the
+        WebKit "VisibleRects" channel to log additional data for the same reason.
+
+        * dom/Document.cpp:
+        (WebCore::Document::processViewport):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::finishedParsing):
+        (WebCore::FrameLoader::completed):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::resetScrollbarsAndClearContentsSize):
+        (WebCore::FrameView::scrollToAnchor):
+        (WebCore::FrameView::maintainScrollPositionAtAnchor):
+        (WebCore::FrameView::setScrollPosition):
+        (WebCore::FrameView::autoSizeIfEnabled):
+        (WebCore::FrameView::setWasScrolledByUser):
+        * page/LayoutContext.cpp:
+        (WebCore::LayoutContext::layout):
+        * page/Page.cpp:
+        (WebCore::Page::setPageScaleFactor):
+        * page/ViewportConfiguration.cpp:
+        (WebCore::ViewportConfiguration::setContentsSize):
+        (WebCore::ViewportConfiguration::setViewportArguments):
+        (WebCore::ViewportConfiguration::updateConfiguration):
+        (WebCore::operator<<):
+        (WebCore::ViewportConfiguration::description const):
+        (WebCore::ViewportConfiguration::dump const):
+        * page/ViewportConfiguration.h:
+        * platform/Logging.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::setFixedLayoutSize):
+
 2017-12-01  Alicia Boya GarcĂ­a  <aboya@igalia.com>
 
         [MSE] Use correct range end checks in sourceBufferPrivateDidReceiveSample()
index af826c8..feb5f97 100644 (file)
 #include <wtf/SystemTracing.h>
 #include <wtf/UUID.h>
 #include <wtf/text/StringBuffer.h>
+#include <wtf/text/TextStream.h>
 #include <yarr/RegularExpression.h>
 
 #if ENABLE(DEVICE_ORIENTATION)
@@ -3381,11 +3382,15 @@ void Document::processViewport(const String& features, ViewportArguments::Type o
 {
     ASSERT(!features.isNull());
 
+    LOG_WITH_STREAM(Viewports, stream << "Document::processViewport " << features);
+
     if (origin < m_viewportArguments.type)
         return;
 
     m_viewportArguments = ViewportArguments(origin);
 
+    LOG_WITH_STREAM(Viewports, stream  << " resolved to " << m_viewportArguments);
+
     processFeaturesString(features, FeatureMode::Viewport, [this](StringView key, StringView value) {
         setViewportFeature(m_viewportArguments, *this, key, value);
     });
index 10d24a2..a061819 100644 (file)
@@ -744,6 +744,8 @@ void FrameLoader::didBeginDocument(bool dispatch)
 
 void FrameLoader::finishedParsing()
 {
+    LOG(Loading, "WebCoreLoading %s: Finished parsing", m_frame.tree().uniqueName().string().utf8().data());
+
     m_frame.injectUserScripts(InjectAtDocumentEnd);
 
     if (m_stateMachine.creatingInitialEmptyDocument())
index e4e3525..567b77a 100644 (file)
@@ -301,6 +301,8 @@ void FrameView::resetScrollbarsAndClearContentsSize()
 {
     resetScrollbars();
 
+    LOG(Layout, "FrameView %p resetScrollbarsAndClearContentsSize", this);
+
     setScrollbarsSuppressed(true);
     setContentsSize(IntSize());
     setScrollbarsSuppressed(false);
@@ -2103,6 +2105,8 @@ bool FrameView::scrollToFragment(const URL& url)
 
 bool FrameView::scrollToAnchor(const String& fragmentIdentifier)
 {
+    LOG(Scrolling, "FrameView::scrollToAnchor %s", fragmentIdentifier.utf8().data());
+
     // If our URL has no ref, then we have no place we need to jump to.
     if (fragmentIdentifier.isNull())
         return false;
@@ -2119,6 +2123,8 @@ bool FrameView::scrollToAnchor(const String& fragmentIdentifier)
 
     Element* anchorElement = document.findAnchor(fragmentIdentifier);
 
+    LOG(Scrolling, " anchorElement is %p", anchorElement);
+
     // Setting to null will clear the current target.
     document.setCSSTarget(anchorElement);
 
@@ -2157,6 +2163,8 @@ bool FrameView::scrollToAnchor(const String& fragmentIdentifier)
 
 void FrameView::maintainScrollPositionAtAnchor(ContainerNode* anchorNode)
 {
+    LOG(Scrolling, "FrameView::maintainScrollPositionAtAnchor at %p", anchorNode);
+
     m_maintainScrollPositionAnchor = anchorNode;
     if (!m_maintainScrollPositionAnchor)
         return;
@@ -2186,6 +2194,8 @@ void FrameView::scrollElementToRect(const Element& element, const IntRect& rect)
 
 void FrameView::setScrollPosition(const ScrollPosition& scrollPosition)
 {
+    LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor");
+
     SetForScope<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
     m_maintainScrollPositionAnchor = nullptr;
     Page* page = frame().page();
@@ -2949,6 +2959,9 @@ bool FrameView::shouldUpdate() const
 void FrameView::scrollToAnchor()
 {
     RefPtr<ContainerNode> anchorNode = m_maintainScrollPositionAnchor;
+
+    LOG_WITH_STREAM(Scrolling, stream << "FrameView::scrollToAnchor() " << anchorNode.get());
+
     if (!anchorNode)
         return;
 
@@ -2960,6 +2973,8 @@ void FrameView::scrollToAnchor()
     if (anchorNode != frame().document() && anchorNode->renderer())
         rect = anchorNode->renderer()->absoluteAnchorRect(&insideFixed);
 
+    LOG_WITH_STREAM(Scrolling, stream << " anchor node rect " << rect);
+
     // Scroll nested layers and frames to reveal the anchor.
     // Align to the top and to the closest side (this matches other browsers).
     if (anchorNode->renderer()->style().isHorizontalWritingMode())
@@ -2973,6 +2988,7 @@ void FrameView::scrollToAnchor()
         cache->handleScrolledToAnchor(anchorNode.get());
 
     // scrollRectToVisible can call into setScrollPosition(), which resets m_maintainScrollPositionAnchor.
+    LOG_WITH_STREAM(Scrolling, stream << " restoring anchor node to " << anchorNode.get());
     m_maintainScrollPositionAnchor = anchorNode;
 }
 
@@ -3305,6 +3321,8 @@ void FrameView::autoSizeIfEnabled()
         document->updateLayoutIgnorePendingStylesheets();
     }
     m_didRunAutosize = true;
+
+    LOG_WITH_STREAM(Layout, stream << "FrameView " << this << " autoSizeIfEnabled() changed size from " << size << " to " << frameRect().size());
 }
 
 void FrameView::setAutoSizeFixedMinimumHeight(int fixedMinimumHeight)
@@ -3882,6 +3900,8 @@ bool FrameView::wasScrolledByUser() const
 
 void FrameView::setWasScrolledByUser(bool wasScrolledByUser)
 {
+    LOG(Scrolling, "FrameView::setWasScrolledByUser at %d", wasScrolledByUser);
+
     if (m_inProgrammaticScroll)
         return;
     m_maintainScrollPositionAnchor = nullptr;
index 0cce291..6dedeef 100644 (file)
@@ -119,6 +119,8 @@ LayoutContext::LayoutContext(FrameView& frameView)
 
 void LayoutContext::layout()
 {
+    LOG_WITH_STREAM(Layout, stream << "FrameView " << &view() << " LayoutContext::layout() with size " << view().layoutSize());
+
     RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!frame().document()->inRenderTreeUpdate());
     ASSERT(!view().isPainting());
     ASSERT(frame().view() == &view());
@@ -142,7 +144,7 @@ void LayoutContext::layout()
 
 #if !LOG_DISABLED
     if (m_firstLayout && !frame().ownerElement())
-        LOG(Layout, "FrameView %p elapsed time before first layout: %.3fs\n", this, document()->timeSinceDocumentCreation().value());
+        LOG(Layout, "FrameView %p elapsed time before first layout: %.3fs", this, document()->timeSinceDocumentCreation().value());
 #endif
 #if PLATFORM(IOS)
     if (view().updateFixedPositionLayoutRect() && subtreeLayoutRoot())
index 14c0264..753e338 100644 (file)
@@ -797,6 +797,8 @@ void Page::setZoomedOutPageScaleFactor(float scale)
 
 void Page::setPageScaleFactor(float scale, const IntPoint& origin, bool inStableState)
 {
+    LOG(Viewports, "Page::setPageScaleFactor %.2f - inStableState %d", scale, inStableState);
+
     Document* document = mainFrame().document();
     FrameView* view = document->view();
 
index 2fdfddb..ae3c9bb 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "ViewportConfiguration.h"
 
+#include "Logging.h"
 #include <wtf/Assertions.h>
 #include <wtf/MathExtras.h>
 #include <wtf/text/CString.h>
@@ -74,6 +75,8 @@ bool ViewportConfiguration::setContentsSize(const IntSize& contentSize)
     if (m_contentSize == contentSize)
         return false;
 
+    LOG_WITH_STREAM(Viewports, stream << "ViewportConfiguration::setContentsSize " << contentSize << " (was " << m_contentSize << ")");
+
     m_contentSize = contentSize;
     updateConfiguration();
     return true;
@@ -94,6 +97,7 @@ bool ViewportConfiguration::setViewportArguments(const ViewportArguments& viewpo
     if (m_viewportArguments == viewportArguments)
         return false;
 
+    LOG_WITH_STREAM(Viewports, stream << "ViewportConfiguration::setViewportArguments " << viewportArguments);
     m_viewportArguments = viewportArguments;
     updateConfiguration();
     return true;
@@ -341,6 +345,8 @@ void ViewportConfiguration::updateConfiguration()
         m_configuration.allowsShrinkToFit = m_viewportArguments.shrinkToFit != 0.;
 
     m_configuration.avoidsUnsafeArea = m_viewportArguments.viewportFit != ViewportFit::Cover;
+
+    LOG_WITH_STREAM(Viewports, stream << "ViewportConfiguration " << this << " updateConfiguration " << *this << " gives initial scale " << initialScale() << " based on contentSize " << m_contentSize << " and layout size " << layoutWidth() << "x" << layoutHeight());
 }
 
 double ViewportConfiguration::viewportArgumentsLength(double length) const
@@ -449,7 +455,12 @@ TextStream& operator<<(TextStream& ts, const ViewportConfiguration::Parameters&
     return ts;
 }
 
-CString ViewportConfiguration::description() const
+TextStream& operator<<(TextStream& ts, const ViewportConfiguration& config)
+{
+    return ts << config.description();
+}
+
+String ViewportConfiguration::description() const
 {
     TextStream ts;
 
@@ -482,12 +493,12 @@ CString ViewportConfiguration::description() const
     
     ts.endGroup();
 
-    return ts.release().utf8();
+    return ts.release();
 }
 
 void ViewportConfiguration::dump() const
 {
-    WTFLogAlways("%s", description().data());
+    WTFLogAlways("%s", description().utf8().data());
 }
 
 #endif
index 6b6c4fc..3ed7678 100644 (file)
@@ -101,7 +101,7 @@ public:
     WEBCORE_EXPORT static Parameters testingParameters();
     
 #ifndef NDEBUG
-    WTF::CString description() const;
+    String description() const;
     WEBCORE_EXPORT void dump() const;
 #endif
 
@@ -127,5 +127,6 @@ private:
 };
 
 WTF::TextStream& operator<<(WTF::TextStream&, const ViewportConfiguration::Parameters&);
+WTF::TextStream& operator<<(WTF::TextStream&, const ViewportConfiguration&);
 
 } // namespace WebCore
index 8296a1e..bad8ae0 100644 (file)
@@ -92,6 +92,7 @@ namespace WebCore {
     M(Tiling) \
     M(Threading) \
     M(URLParser) \
+    M(Viewports) \
     M(WebAudio) \
     M(WebGL) \
     M(WebGPU) \
index f8d7fa0..4f53ad7 100644 (file)
@@ -301,6 +301,8 @@ void ScrollView::setFixedLayoutSize(const IntSize& newSize)
 {
     if (fixedLayoutSize() == newSize)
         return;
+
+    LOG_WITH_STREAM(Layout, stream << "ScrollView " << this << " setFixedLayoutSize " << newSize);
     m_fixedLayoutSize = newSize;
     if (m_useFixedLayout)
         availableContentSizeChanged(AvailableSizeChangeReason::AreaSizeChanged);
index 2cf840d..f5726eb 100644 (file)
@@ -1,3 +1,31 @@
+2017-12-02  Simon Fraser  <simon.fraser@apple.com>
+
+        Add a log channel for viewports
+        https://bugs.webkit.org/show_bug.cgi?id=180295
+
+        Reviewed by Zalan Bujtas.
+
+        Add a "Viewports" log channel to log viewport scaling information, and enhance the
+        WebKit "VisibleRects" channel to log additional data for the same reason.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _didCommitLayerTree:]):
+        (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
+        (-[WKWebView _dispatchSetMinimumLayoutSize:]):
+        (-[WKWebView _endAnimatedResize]):
+        (-[WKWebView _resizeWhileHidingContentWithUpdates:]):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setFixedLayoutSize):
+        (WebKit::WebPage::mainFrameDidLayout):
+        (WebKit::WebPage::didCommitLoad):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::scaleAfterViewportWidthChange):
+        (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
+        (WebKit::WebPage::dynamicViewportSizeUpdate):
+        (WebKit::WebPage::resetViewportDefaultConfiguration):
+        (WebKit::WebPage::viewportConfigurationChanged):
+        (WebKit::WebPage::updateVisibleContentRects):
+
 2017-12-02  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         WebDriver: handle user prompts shown while executing scripts
index 1de3fea..4d2403c 100644 (file)
@@ -1661,7 +1661,7 @@ static inline bool areEssentiallyEqualAsFloat(float a, float b)
     if (![self usesStandardContentView])
         return;
 
-    LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView _didCommitLayerTree:] transactionID " <<  layerTreeTransaction.transactionID() << " _dynamicViewportUpdateMode " << (int)_dynamicViewportUpdateMode);
+    LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView " << _page->pageID() << " _didCommitLayerTree:] transactionID " <<  layerTreeTransaction.transactionID() << " _dynamicViewportUpdateMode " << (int)_dynamicViewportUpdateMode);
 
     bool needUpdateVisibleContentRects = _page->updateLayoutViewportParameters(layerTreeTransaction);
 
@@ -1686,8 +1686,10 @@ static inline bool areEssentiallyEqualAsFloat(float a, float b)
     [_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()];
     [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()];
     [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()];
-    if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing] && ![_scrollView _isAnimatingZoom] && [_scrollView zoomScale] != layerTreeTransaction.pageScaleFactor())
+    if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing] && ![_scrollView _isAnimatingZoom] && [_scrollView zoomScale] != layerTreeTransaction.pageScaleFactor()) {
+        LOG_WITH_STREAM(VisibleRects, stream << " updating scroll view with pageScaleFactor " << layerTreeTransaction.pageScaleFactor());
         [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
+    }
 
     _viewportMetaTagWidth = layerTreeTransaction.viewportMetaTagWidth();
     _viewportMetaTagWidthWasExplicit = layerTreeTransaction.viewportMetaTagWidthWasExplicit();
@@ -1776,6 +1778,8 @@ static inline bool areEssentiallyEqualAsFloat(float a, float b)
 
 - (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID
 {
+    LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView " << _page->pageID() << " _dynamicViewportUpdateChangedTargetToScale:] " <<  newScale << " _dynamicViewportUpdateMode " << (int)_dynamicViewportUpdateMode);
+
     if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing) {
         CGFloat animatingScaleTarget = [[_resizeAnimationView layer] transform].m11;
         double currentTargetScale = animatingScaleTarget * [[_contentView layer] transform].m11;
@@ -2452,6 +2456,7 @@ static WebCore::FloatSize activeMinimumLayoutSize(WKWebView *webView, const CGRe
     if (_lastSentMinimumLayoutSize && CGSizeEqualToSize(_lastSentMinimumLayoutSize.value(), minimumLayoutSize))
         return;
 
+    LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView " << _page->pageID() << " _dispatchSetMinimumLayoutSize:] " << minimumLayoutSize << " contentZoomScale " << contentZoomScale(self));
     _page->setViewportConfigurationMinimumLayoutSize(minimumLayoutSize);
     _lastSentMinimumLayoutSize = minimumLayoutSize;
 }
@@ -5096,6 +5101,8 @@ static inline WebKit::FindOptions toFindOptions(_WKFindOptions wkFindOptions)
 
 - (void)_endAnimatedResize
 {
+    LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView " << _page->pageID() << " _endAnimatedResize:] " << " _dynamicViewportUpdateMode " << (int)_dynamicViewportUpdateMode);
+
     if (_dynamicViewportUpdateMode == DynamicViewportUpdateMode::NotResizing)
         return;
 
@@ -5169,6 +5176,7 @@ static inline WebKit::FindOptions toFindOptions(_WKFindOptions wkFindOptions)
 
 - (void)_resizeWhileHidingContentWithUpdates:(void (^)(void))updateBlock
 {
+    LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView " << _page->pageID() << " _resizeWhileHidingContentWithUpdates:]");
     [self _beginAnimatedResizeWithUpdates:updateBlock];
     if (_dynamicViewportUpdateMode == DynamicViewportUpdateMode::ResizingWithAnimation) {
         [_contentView setHidden:YES];
index 1029494..30229ba 100644 (file)
 #include <runtime/SamplingProfiler.h>
 #include <wtf/RunLoop.h>
 #include <wtf/SetForScope.h>
+#include <wtf/text/TextStream.h>
 
 #if ENABLE(DATA_DETECTION)
 #include "DataDetectionResult.h"
@@ -1746,6 +1747,7 @@ bool WebPage::setFixedLayoutSize(const IntSize& size)
     if (!view || view->fixedLayoutSize() == size)
         return false;
 
+    LOG_WITH_STREAM(VisibleRects, stream << "WebPage " << m_pageID << " setFixedLayoutSize " << size);
     view->setFixedLayoutSize(size);
 
     send(Messages::WebPageProxy::FixedLayoutSizeDidChange(size));
@@ -3781,6 +3783,7 @@ void WebPage::mainFrameDidLayout()
 #if PLATFORM(IOS)
     if (FrameView* frameView = mainFrameView()) {
         IntSize newContentSize = frameView->contentsSize();
+        LOG_WITH_STREAM(VisibleRects, stream << "WebPage " << m_pageID << " mainFrameDidLayout setting content size to " << newContentSize);
         if (m_viewportConfiguration.setContentsSize(newContentSize))
             viewportConfigurationChanged();
     }
@@ -5085,6 +5088,8 @@ void WebPage::didCommitLoad(WebFrame* frame)
     const Frame* coreFrame = frame->coreFrame();
     
     bool viewportChanged = false;
+
+    LOG_WITH_STREAM(VisibleRects, stream << "WebPage " << m_pageID << " didCommitLoad setting content size to " << coreFrame->view()->contentsSize());
     if (m_viewportConfiguration.setContentsSize(coreFrame->view()->contentsSize()))
         viewportChanged = true;
 
index d5df2e4..6bf9eb5 100644 (file)
@@ -270,6 +270,8 @@ static double scaleAfterViewportWidthChange(double currentScale, bool userHasCha
     else
         scale = std::max(std::min(currentScale, viewportConfiguration.maximumScale()), viewportConfiguration.minimumScale());
 
+    LOG(VisibleRects, "scaleAfterViewportWidthChange getting scale %.2f", scale);
+
     if (userHasChangedPageScaleFactor) {
         // When the content size changes, we keep the same relative horizontal content width in view, otherwise we would
         // end up zoomed too far in landscape->portrait, and too close in portrait->landscape.
@@ -2373,6 +2375,7 @@ void WebPage::autofillLoginCredentials(const String& username, const String& pas
 
 void WebPage::setViewportConfigurationMinimumLayoutSize(const FloatSize& size)
 {
+    LOG_WITH_STREAM(VisibleRects, stream << "WebPage " << m_pageID << " setViewportConfigurationMinimumLayoutSize " << size);
     if (m_viewportConfiguration.setMinimumLayoutSize(size))
         viewportConfigurationChanged();
 }
@@ -2413,7 +2416,7 @@ void WebPage::dynamicViewportSizeUpdate(const FloatSize& minimumLayoutSize, cons
     SetForScope<bool> dynamicSizeUpdateGuard(m_inDynamicSizeUpdate, true);
     // FIXME: this does not handle the cases where the content would change the content size or scroll position from JavaScript.
     // To handle those cases, we would need to redo this computation on every change until the next visible content rect update.
-    LOG_WITH_STREAM(VisibleRects, stream << "\nWebPage::dynamicViewportSizeUpdate - targetUnobscuredRect " << targetUnobscuredRect << " targetExposedContentRect " << targetExposedContentRect << " targetScale " << targetScale);
+    LOG_WITH_STREAM(VisibleRects, stream << "\nWebPage::dynamicViewportSizeUpdate - minimumLayoutSize " << minimumLayoutSize << " targetUnobscuredRect " << targetUnobscuredRect << " targetExposedContentRect " << targetExposedContentRect << " targetScale " << targetScale);
 
     FrameView& frameView = *m_page->mainFrame().view();
     IntSize oldContentSize = frameView.contentsSize();
@@ -2445,6 +2448,7 @@ void WebPage::dynamicViewportSizeUpdate(const FloatSize& minimumLayoutSize, cons
         }
     }
 
+    LOG_WITH_STREAM(VisibleRects, stream << "WebPage::dynamicViewportSizeUpdate setting minimum layout size to " << minimumLayoutSize);
     m_viewportConfiguration.setMinimumLayoutSize(minimumLayoutSize);
     IntSize newLayoutSize = m_viewportConfiguration.layoutSize();
 
@@ -2594,6 +2598,7 @@ void WebPage::synchronizeDynamicViewportUpdate(double& newTargetScale, FloatPoin
 
 void WebPage::resetViewportDefaultConfiguration(WebFrame* frame, bool hasMobileDocType)
 {
+    LOG_WITH_STREAM(VisibleRects, stream << "WebPage " << m_pageID << " resetViewportDefaultConfiguration");
     if (m_useTestingViewportConfiguration) {
         m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::testingParameters());
         return;
@@ -2630,6 +2635,8 @@ void WebPage::viewportConfigurationChanged()
     else
         scale = initialScale;
 
+    LOG_WITH_STREAM(VisibleRects, stream << "WebPage " << m_pageID << " viewportConfigurationChanged - setting zoomedOutPageScaleFactor to " << m_viewportConfiguration.minimumScale() << " and scale to " << scale);
+
     m_page->setZoomedOutPageScaleFactor(m_viewportConfiguration.minimumScale());
 
     updateViewportSizeForCSSViewportUnits();
@@ -2769,7 +2776,7 @@ static bool selectionIsInsideFixedPositionContainer(Frame& frame)
 
 void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo, MonotonicTime oldestTimestamp)
 {
-    LOG_WITH_STREAM(VisibleRects, stream << "\nWebPage::updateVisibleContentRects " << visibleContentRectUpdateInfo);
+    LOG_WITH_STREAM(VisibleRects, stream << "\nWebPage " << m_pageID << " updateVisibleContentRects " << visibleContentRectUpdateInfo);
 
     // Skip any VisibleContentRectUpdate that have been queued before DidCommitLoad suppresses the updates in the UIProcess.
     if (visibleContentRectUpdateInfo.lastLayerTreeTransactionID() < m_mainFrame->firstLayerTreeTransactionIDAfterDidCommitLoad() && !visibleContentRectUpdateInfo.isFirstUpdateForNewViewSize())