mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 744901 - Store the page size in FrameMetrics in CSS pixels in addition to device pixels. r=cjones
--HG-- extra : rebase_source : ac38e2ff9dda55bd5dc44d757b67cb1550da1eaa
This commit is contained in:
parent
ef71c94678
commit
75f19e9b5e
@ -109,6 +109,7 @@ public:
|
||||
, mContentSize(0, 0)
|
||||
, mViewportScrollOffset(0, 0)
|
||||
, mScrollId(NULL_SCROLL_ID)
|
||||
, mCSSContentSize(0, 0)
|
||||
{}
|
||||
|
||||
// Default copy ctor and operator= are fine
|
||||
@ -146,6 +147,10 @@ public:
|
||||
nsIntPoint mViewportScrollOffset;
|
||||
nsIntRect mDisplayPort;
|
||||
ViewID mScrollId;
|
||||
|
||||
// Consumers often want to know the size before scaling to pixels
|
||||
// so we record this size as well.
|
||||
gfx::Size mCSSContentSize;
|
||||
};
|
||||
|
||||
#define MOZ_LAYER_DECL_NAME(n, e) \
|
||||
|
@ -67,6 +67,7 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mCSSContentSize);
|
||||
WriteParam(aMsg, aParam.mViewport);
|
||||
WriteParam(aMsg, aParam.mContentSize);
|
||||
WriteParam(aMsg, aParam.mViewportScrollOffset);
|
||||
@ -76,7 +77,8 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return (ReadParam(aMsg, aIter, &aResult->mViewport) &&
|
||||
return (ReadParam(aMsg, aIter, &aResult->mCSSContentSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mViewport) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mContentSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mViewportScrollOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDisplayPort) &&
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "chrome/common/ipc_message_utils.h"
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsID.h"
|
||||
@ -751,6 +752,25 @@ struct ParamTraits<nsIntSize>
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::gfx::Size>
|
||||
{
|
||||
typedef mozilla::gfx::Size paramType;
|
||||
|
||||
static void Write(Message* msg, const paramType& param)
|
||||
{
|
||||
WriteParam(msg, param.width);
|
||||
WriteParam(msg, param.height);
|
||||
}
|
||||
|
||||
static bool Read(const Message* msg, void** iter, paramType* result)
|
||||
{
|
||||
return (ReadParam(msg, iter, &result->width) &&
|
||||
ReadParam(msg, iter, &result->height));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsRect>
|
||||
{
|
||||
|
@ -233,6 +233,8 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||
nsSize contentSize =
|
||||
scrollableFrame->GetScrollRange().Size() +
|
||||
scrollableFrame->GetScrollPortRect().Size();
|
||||
metrics.mCSSContentSize = gfx::Size(nsPresContext::AppUnitsToFloatCSSPixels(contentSize.width),
|
||||
nsPresContext::AppUnitsToFloatCSSPixels(contentSize.height));
|
||||
metrics.mContentSize = contentSize.ScaleToNearestPixels(
|
||||
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel);
|
||||
metrics.mViewportScrollOffset = scrollableFrame->GetScrollPosition().ScaleToNearestPixels(
|
||||
@ -240,6 +242,8 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||
}
|
||||
else {
|
||||
nsSize contentSize = aForFrame->GetSize();
|
||||
metrics.mCSSContentSize = gfx::Size(nsPresContext::AppUnitsToFloatCSSPixels(contentSize.width),
|
||||
nsPresContext::AppUnitsToFloatCSSPixels(contentSize.height));
|
||||
metrics.mContentSize = contentSize.ScaleToNearestPixels(
|
||||
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel);
|
||||
}
|
||||
|
@ -411,8 +411,8 @@ BuildViewMap(ViewMap& oldContentViews, ViewMap& newContentViews,
|
||||
NSIntPixelsToAppUnits(metrics.mViewport.width, auPerDevPixel) * aXScale,
|
||||
NSIntPixelsToAppUnits(metrics.mViewport.height, auPerDevPixel) * aYScale);
|
||||
view->mContentSize = nsSize(
|
||||
NSIntPixelsToAppUnits(metrics.mContentSize.width, auPerDevPixel) * aXScale,
|
||||
NSIntPixelsToAppUnits(metrics.mContentSize.height, auPerDevPixel) * aYScale);
|
||||
nsPresContext::CSSPixelsToAppUnits(metrics.mCSSContentSize.width) * aXScale,
|
||||
nsPresContext::CSSPixelsToAppUnits(metrics.mCSSContentSize.height) * aYScale);
|
||||
|
||||
newContentViews[scrollId] = view;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user