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