зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1666802
- Modify the ScrollPositionUpdate serializer to write to an ostream directly. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D93142
This commit is contained in:
Родитель
623306a175
Коммит
deb6ba5e6c
|
@ -191,14 +191,6 @@ void AppendToString(std::stringstream& aStream, ImageFormat format,
|
|||
aStream << sfx;
|
||||
}
|
||||
|
||||
void AppendToString(std::stringstream& aStream,
|
||||
const mozilla::ScrollPositionUpdate& aUpdate,
|
||||
const char* pfx, const char* sfx) {
|
||||
aStream << pfx;
|
||||
aUpdate.AppendToString(aStream);
|
||||
aStream << sfx;
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -45,10 +45,6 @@ void AppendToString(std::stringstream& aStream, gfx::SurfaceType format,
|
|||
void AppendToString(std::stringstream& aStream, ImageFormat format,
|
||||
const char* pfx = "", const char* sfx = "");
|
||||
|
||||
void AppendToString(std::stringstream& aStream,
|
||||
const mozilla::ScrollPositionUpdate& aUpdate,
|
||||
const char* pfx = "", const char* sfx = "");
|
||||
|
||||
// Sometimes, you just want a string from a single value.
|
||||
template <typename T>
|
||||
std::string Stringify(const T& obj) {
|
||||
|
|
|
@ -4706,7 +4706,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(
|
|||
bool scrollOffsetUpdated = false;
|
||||
for (const auto& scrollUpdate : aScrollMetadata.GetScrollUpdates()) {
|
||||
APZC_LOG("%p processing scroll update %s\n", this,
|
||||
Stringify(scrollUpdate).c_str());
|
||||
ToString(scrollUpdate).c_str());
|
||||
if (scrollUpdate.GetGeneration() <= Metrics().GetScrollGeneration()) {
|
||||
// This is stale, let's ignore it
|
||||
// XXX maybe use a 64-bit value for the scroll generation, or add some
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "ScrollPositionUpdate.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -117,12 +119,15 @@ CSSPoint ScrollPositionUpdate::GetDelta() const {
|
|||
return mDelta;
|
||||
}
|
||||
|
||||
void ScrollPositionUpdate::AppendToString(std::stringstream& aStream) const {
|
||||
aStream << "ScrollPositionUpdate(gen=" << mScrollGeneration
|
||||
<< ", type=" << (int)mType << ", mode=" << (int)mScrollMode
|
||||
<< ", origin=" << (int)mScrollOrigin << ", dst=" << mDestination.x
|
||||
<< "," << mDestination.y << ", src=" << mSource.x << "," << mSource.y
|
||||
<< ", delta=" << mDelta.x << "," << mDelta.y << ")";
|
||||
std::ostream& operator<<(std::ostream& aStream,
|
||||
const ScrollPositionUpdate& aUpdate) {
|
||||
aStream << "{ gen=" << aUpdate.mScrollGeneration
|
||||
<< ", type=" << (int)aUpdate.mType
|
||||
<< ", mode=" << (int)aUpdate.mScrollMode
|
||||
<< ", origin=" << (int)aUpdate.mScrollOrigin
|
||||
<< ", dst=" << aUpdate.mDestination << ", src=" << aUpdate.mSource
|
||||
<< ", delta=" << aUpdate.mDelta << " }";
|
||||
return aStream;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define mozilla_ScrollPositionUpdate_h_
|
||||
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
|
||||
#include "nsPoint.h"
|
||||
#include "mozilla/ScrollOrigin.h"
|
||||
|
@ -83,7 +84,8 @@ class ScrollPositionUpdate {
|
|||
// GetDelta is only valid for the PureRelative type; it asserts otherwise.
|
||||
CSSPoint GetDelta() const;
|
||||
|
||||
void AppendToString(std::stringstream& aStream) const;
|
||||
friend std::ostream& operator<<(std::ostream& aStream,
|
||||
const ScrollPositionUpdate& aUpdate);
|
||||
|
||||
private:
|
||||
uint32_t mScrollGeneration;
|
||||
|
|
Загрузка…
Ссылка в новой задаче