From f4c6658819f694f3dee2fbcf65b2324227e356f1 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Tue, 29 Sep 2020 11:54:33 +0000 Subject: [PATCH] Bug 1667863 - Replace AppendToString of SizeTyped with ostream usage. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D91655 --- gfx/layers/LayersLogging.cpp | 4 ++-- gfx/layers/LayersLogging.h | 9 --------- gfx/layers/d3d11/MLGDeviceD3D11.cpp | 3 +-- layout/base/MobileViewportManager.cpp | 14 +++++++------- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/gfx/layers/LayersLogging.cpp b/gfx/layers/LayersLogging.cpp index 98a3f3fe768f..22c422252ce3 100644 --- a/gfx/layers/LayersLogging.cpp +++ b/gfx/layers/LayersLogging.cpp @@ -90,8 +90,8 @@ void AppendToString(std::stringstream& aStream, const FrameMetrics& m, } AppendToString(aStream, m.GetZoom(), "] [z=", "] }"); } else { - AppendToString(aStream, m.GetRootCompositionSize(), "] [rcs="); - aStream << "] [v=" << m.GetLayoutViewport() + aStream << "] [rcs=" << m.GetRootCompositionSize() + << "] [v=" << m.GetLayoutViewport() << nsPrintfCString("] [z=(ld=%.3f r=%.3f", m.GetDevPixelsPerCSSPixel().scale, m.GetPresShellResolution()) diff --git a/gfx/layers/LayersLogging.h b/gfx/layers/LayersLogging.h index b6568f666c47..1d7c5ab2b459 100644 --- a/gfx/layers/LayersLogging.h +++ b/gfx/layers/LayersLogging.h @@ -56,15 +56,6 @@ void AppendToString(std::stringstream& aStream, const FrameMetrics& m, void AppendToString(std::stringstream& aStream, const ZoomConstraints& z, const char* pfx = "", const char* sfx = ""); -template -void AppendToString(std::stringstream& aStream, - const mozilla::gfx::SizeTyped& sz, const char* pfx = "", - const char* sfx = "") { - aStream << pfx; - aStream << nsPrintfCString("(w=%f, h=%f)", sz.width, sz.height).get(); - aStream << sfx; -} - template void AppendToString(std::stringstream& aStream, const mozilla::gfx::IntSizeTyped& sz, diff --git a/gfx/layers/d3d11/MLGDeviceD3D11.cpp b/gfx/layers/d3d11/MLGDeviceD3D11.cpp index bd44efa0fa9a..8ea7c561d8f8 100644 --- a/gfx/layers/d3d11/MLGDeviceD3D11.cpp +++ b/gfx/layers/d3d11/MLGDeviceD3D11.cpp @@ -1898,8 +1898,7 @@ void MLGDeviceD3D11::CopyTexture(MLGTexture* aDest, IntRect destBounds(IntPoint(0, 0), aDest->GetSize()); if (!destBounds.Contains(IntRect(aTarget, aRect.Size()))) { gfxWarning() << "Attempt to write out-of-bounds in CopySubresourceRegion: " - << destBounds << ", " << aTarget << ", " - << Stringify(aRect.Size()); + << destBounds << ", " << aTarget << ", " << aRect.Size(); return; } diff --git a/layout/base/MobileViewportManager.cpp b/layout/base/MobileViewportManager.cpp index 5463c92fce1c..d72552451454 100644 --- a/layout/base/MobileViewportManager.cpp +++ b/layout/base/MobileViewportManager.cpp @@ -6,8 +6,8 @@ #include "MobileViewportManager.h" -#include "LayersLogging.h" #include "mozilla/PresShell.h" +#include "mozilla/ToString.h" #include "mozilla/dom/Document.h" #include "mozilla/dom/Event.h" #include "mozilla/dom/EventTarget.h" @@ -500,7 +500,7 @@ void MobileViewportManager::UpdateVisualViewportSize( ScreenSize compositionSize = ScreenSize(GetCompositionSize(aDisplaySize)); CSSSize compSize = compositionSize / aZoom; - MVM_LOG("%p: Setting VVPS %s\n", this, Stringify(compSize).c_str()); + MVM_LOG("%p: Setting VVPS %s\n", this, ToString(compSize).c_str()); mContext->SetVisualViewportSize(compSize); } @@ -566,7 +566,7 @@ void MobileViewportManager::UpdateSizesBeforeReflow() { mDisplaySize = *newDisplaySize; MVM_LOG("%p: Reflow starting, display size updated to %s\n", this, - Stringify(mDisplaySize).c_str()); + ToString(mDisplaySize).c_str()); if (mDisplaySize.width == 0 || mDisplaySize.height == 0) { return; @@ -577,7 +577,7 @@ void MobileViewportManager::UpdateSizesBeforeReflow() { nsViewportInfo viewportInfo = mContext->GetViewportInfo(displaySize); mMobileViewportSize = viewportInfo.GetSize(); MVM_LOG("%p: MVSize updated to %s\n", this, - Stringify(mMobileViewportSize).c_str()); + ToString(mMobileViewportSize).c_str()); } } @@ -637,7 +637,7 @@ void MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution) { viewportInfo.IsDefaultZoomValid()); CSSSize viewport = viewportInfo.GetSize(); - MVM_LOG("%p: Computed CSS viewport %s\n", this, Stringify(viewport).c_str()); + MVM_LOG("%p: Computed CSS viewport %s\n", this, ToString(viewport).c_str()); if (!mIsFirstPaint && mMobileViewportSize == viewport) { // Nothing changed, so no need to do a reflow @@ -680,7 +680,7 @@ void MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution) { // Kick off a reflow. MVM_LOG("%p: Triggering reflow with viewport %s\n", this, - Stringify(viewport).c_str()); + ToString(viewport).c_str()); mContext->Reflow(viewport); // We are going to fit the content to the display width if the initial-scale @@ -713,7 +713,7 @@ void MobileViewportManager::ShrinkToDisplaySizeIfNeeded() { if (Maybe scrollableRect = mContext->CalculateScrollableRectForRSF()) { MVM_LOG("%p: ShrinkToDisplaySize using scrollableRect %s\n", this, - Stringify(scrollableRect->Size()).c_str()); + ToString(scrollableRect->Size()).c_str()); UpdateResolutionForContentSizeChange(scrollableRect->Size()); } }