Bug 1667656 - Use ostream operator instead of AppendToString for PointTyped. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D91517
This commit is contained in:
Kartikaya Gupta 2020-09-28 00:36:32 +00:00
Родитель a9cd962def
Коммит 0578ebae47
9 изменённых файлов: 25 добавлений и 31 удалений

Просмотреть файл

@ -51,6 +51,7 @@
#include "mozilla/Telemetry.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/ToString.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/AutoPrintEventDispatcher.h"
#include "mozilla/dom/BrowserBridgeChild.h"
@ -1286,7 +1287,7 @@ void BrowserChild::HandleDoubleTap(const CSSPoint& aPoint,
const ScrollableLayerGuid& aGuid) {
MOZ_LOG(
sApzChildLog, LogLevel::Debug,
("Handling double tap at %s with %p %p\n", Stringify(aPoint).c_str(),
("Handling double tap at %s with %p %p\n", ToString(aPoint).c_str(),
mBrowserChildMessageManager ? mBrowserChildMessageManager->GetWrapper()
: nullptr,
mBrowserChildMessageManager.get()));

Просмотреть файл

@ -165,9 +165,9 @@ void AppendToString(std::stringstream& aStream, const FrameMetrics& m,
aStream << pfx;
AppendToString(aStream, m.GetCompositionBounds(), "{ [cb=");
AppendToString(aStream, m.GetScrollableRect(), "] [sr=");
AppendToString(aStream, m.GetVisualScrollOffset(), "] [s=");
aStream << "] [s=" << m.GetVisualScrollOffset();
if (m.GetVisualScrollUpdateType() != FrameMetrics::eNone) {
AppendToString(aStream, m.GetVisualDestination(), "] [vd=");
aStream << "] [vd=" << m.GetVisualDestination();
}
AppendToString(aStream, m.GetDisplayPort(), "] [dp=");
AppendToString(aStream, m.GetCriticalDisplayPort(), "] [cdp=");

Просмотреть файл

@ -34,13 +34,6 @@ enum class ImageFormat;
namespace layers {
struct ZoomConstraints;
template <class T>
void AppendToString(std::stringstream& aStream,
const mozilla::gfx::PointTyped<T>& p, const char* pfx = "",
const char* sfx = "") {
aStream << pfx << p << sfx;
}
template <class T>
void AppendToString(std::stringstream& aStream,
const mozilla::gfx::Point3DTyped<T>& p,

Просмотреть файл

@ -2798,8 +2798,7 @@ APZCTreeManager::HitTestResult APZCTreeManager::GetAPZCAtPointWR(
return hit;
}
APZCTM_LOG("Hit-testing point %s with WR\n",
Stringify(aHitTestPoint).c_str());
APZCTM_LOG("Hit-testing point %s with WR\n", ToString(aHitTestPoint).c_str());
std::vector<wr::WrHitResult> results =
wr->HitTest(wr::ToWorldPoint(aHitTestPoint));
@ -3036,10 +3035,9 @@ APZCTreeManager::HitTestResult APZCTreeManager::GetAPZCAtPoint(
// are more "in front".
Maybe<LayerPoint> hitTestPoint = aNode->Untransform(
hitTestPointForParent, ComputeTransformForNode(aNode));
APZCTM_LOG(
"Transformed ParentLayer point %s to layer %s\n",
Stringify(hitTestPointForParent).c_str(),
hitTestPoint ? Stringify(hitTestPoint.ref()).c_str() : "nil");
APZCTM_LOG("Transformed ParentLayer point %s to layer %s\n",
ToString(hitTestPointForParent).c_str(),
hitTestPoint ? ToString(hitTestPoint.ref()).c_str() : "nil");
if (!hitTestPoint) {
return TraversalFlag::Skip;
}
@ -3050,7 +3048,7 @@ APZCTreeManager::HitTestResult APZCTreeManager::GetAPZCAtPoint(
CompositorHitTestInfo hitResult = aNode->HitTest(hitTestPoints.top());
hitTestPoints.pop();
APZCTM_LOG("Testing Layer point %s against node %p\n",
Stringify(hitTestPoints.top()).c_str(), aNode);
ToString(hitTestPoints.top()).c_str(), aNode);
if (hitResult != CompositorHitTestInvisibleToHit) {
resultNode = aNode;
hit.mHitResult = hitResult;

Просмотреть файл

@ -998,7 +998,7 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(
scrollOffset.y = scrollPosition;
}
APZC_LOG("%p set scroll offset to %s from scrollbar drag\n", this,
Stringify(scrollOffset).c_str());
ToString(scrollOffset).c_str());
SetVisualScrollOffset(scrollOffset);
ScheduleCompositeAndMaybeRepaint();
UpdateSharedCompositorFrameMetrics();
@ -1943,7 +1943,7 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) {
// the desired physics. Note that SmoothMsdScrollTo() will re-use an
// existing smooth scroll animation if there is one.
APZC_LOG("%p keyboard scrolling to snap point %s\n", this,
Stringify(destination).c_str());
ToString(destination).c_str());
SmoothMsdScrollTo(destination);
return nsEventStatus_eConsumeDoDefault;
}
@ -2225,7 +2225,7 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(
}
APZC_LOG("%p got a scroll-wheel with delta in parent-layer pixels: %s\n",
this, Stringify(delta).c_str());
this, ToString(delta).c_str());
if (adjustedByAutoDir) {
MOZ_ASSERT(delta.x || delta.y,
@ -2310,7 +2310,7 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(
// the desired physics. Note that SmoothMsdScrollTo() will re-use an
// existing smooth scroll animation if there is one.
APZC_LOG("%p wheel scrolling to snap point %s\n", this,
Stringify(startPosition).c_str());
ToString(startPosition).c_str());
SmoothMsdScrollTo(startPosition);
break;
}
@ -3252,7 +3252,7 @@ ParentLayerPoint AsyncPanZoomController::AttemptFling(
// We may have a pre-existing velocity for whatever reason (for example,
// a previously handed off fling). We don't want to clobber that.
APZC_LOG("%p accepting fling with velocity %s\n", this,
Stringify(aHandoffState.mVelocity).c_str());
ToString(aHandoffState.mVelocity).c_str());
ParentLayerPoint residualVelocity = aHandoffState.mVelocity;
if (mX.CanScroll()) {
mX.SetVelocity(mX.GetVelocity() + aHandoffState.mVelocity.x);
@ -3361,7 +3361,7 @@ void AsyncPanZoomController::HandleFlingOverscroll(
ParentLayerPoint residualVelocity =
treeManagerLocal->DispatchFling(this, handoffState);
FLING_LOG("APZC %p left with residual velocity %s\n", this,
Stringify(residualVelocity).c_str());
ToString(residualVelocity).c_str());
if (!IsZero(residualVelocity) && IsPannable() &&
StaticPrefs::apz_overscroll_enabled()) {
// Obey overscroll-behavior.
@ -5385,7 +5385,7 @@ Maybe<CSSPoint> AsyncPanZoomController::FindSnapPointNear(
const CSSPoint& aDestination, ScrollUnit aUnit) {
mRecursiveMutex.AssertCurrentThreadIn();
APZC_LOG("%p scroll snapping near %s\n", this,
Stringify(aDestination).c_str());
ToString(aDestination).c_str());
CSSRect scrollRange = Metrics().CalculateScrollRange();
if (Maybe<nsPoint> snapPoint = ScrollSnapUtils::GetSnapPointForDestination(
mScrollMetadata.GetSnapInfo(), aUnit,
@ -5407,7 +5407,7 @@ void AsyncPanZoomController::ScrollSnapNear(const CSSPoint& aDestination) {
FindSnapPointNear(aDestination, ScrollUnit::DEVICE_PIXELS)) {
if (*snapPoint != Metrics().GetVisualScrollOffset()) {
APZC_LOG("%p smooth scrolling to snap point %s\n", this,
Stringify(*snapPoint).c_str());
ToString(*snapPoint).c_str());
SmoothMsdScrollTo(*snapPoint);
}
}

Просмотреть файл

@ -20,6 +20,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/StaticPrefs_apz.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/ToString.h"
#include "nsThreadUtils.h"
static mozilla::LazyLogModule sApzFlgLog("apz.fling");
@ -190,7 +191,7 @@ class GenericFlingAnimation : public AsyncPanZoomAnimation,
// the lock ordering. Instead we schedule HandleFlingOverscroll() to be
// called after mRecursiveMutex is released.
FLING_LOG("%p fling went into overscroll, handing off with velocity %s\n",
&mApzc, Stringify(velocity).c_str());
&mApzc, ToString(velocity).c_str());
mDeferredTasks.AppendElement(
NewRunnableMethod<ParentLayerPoint,
RefPtr<const OverscrollHandoffChain>,

Просмотреть файл

@ -20,6 +20,7 @@
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/PresShell.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/ToString.h"
#include "mozilla/ViewportUtils.h"
#include "nsContainerFrame.h"
#include "nsContentUtils.h"
@ -169,7 +170,7 @@ static ScreenMargin ScrollFrame(nsIContent* aContent,
if (!APZCCallbackHelper::IsScrollInProgress(sf)) {
if (RefPtr<PresShell> presShell = GetPresShell(aContent)) {
APZCCH_LOG("Setting VV offset to %s on presShell %p\n",
Stringify(aRequest.GetVisualScrollOffset()).c_str(),
ToString(aRequest.GetVisualScrollOffset()).c_str(),
presShell.get());
if (presShell->SetVisualViewportOffset(
CSSPoint::ToAppUnits(aRequest.GetVisualScrollOffset()),
@ -524,7 +525,7 @@ void APZCCallbackHelper::FireSingleTapEvent(const LayoutDevicePoint& aPoint,
return;
}
APZCCH_LOG("Dispatching single-tap component events to %s\n",
Stringify(aPoint).c_str());
ToString(aPoint).c_str());
int time = 0;
DispatchSynthesizedMouseEvent(eMouseMove, time, aPoint, aModifiers,
aClickCount, aWidget);

Просмотреть файл

@ -167,7 +167,7 @@ void APZEventState::ProcessSingleTap(const CSSPoint& aPoint,
const CSSToLayoutDeviceScale& aScale,
Modifiers aModifiers,
int32_t aClickCount) {
APZES_LOG("Handling single tap at %s with %d\n", Stringify(aPoint).c_str(),
APZES_LOG("Handling single tap at %s with %d\n", ToString(aPoint).c_str(),
mTouchEndCancelled);
RefPtr<nsIContent> touchRollup = GetTouchRollup();
@ -253,7 +253,7 @@ void APZEventState::ProcessLongTap(PresShell* aPresShell,
const CSSToLayoutDeviceScale& aScale,
Modifiers aModifiers,
uint64_t aInputBlockId) {
APZES_LOG("Handling long tap at %s\n", Stringify(aPoint).c_str());
APZES_LOG("Handling long tap at %s\n", ToString(aPoint).c_str());
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {

Просмотреть файл

@ -3052,7 +3052,7 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
PAINT_SKIP_LOG(
"New scrollpos %s usingDP %d dpEqual %d scrollableByApz %d plugins"
"%d perspective %d bglocal %d filter %d\n",
Stringify(CSSPoint::FromAppUnits(GetScrollPosition())).c_str(),
ToString(CSSPoint::FromAppUnits(GetScrollPosition())).c_str(),
usingDisplayPort, displayPort.IsEqualEdges(oldDisplayPort),
mScrollableByAPZ, HasPluginFrames(), HasPerspective(),
HasBgAttachmentLocal(), mHasOutOfFlowContentInsideFilter);