mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1023557 - Store the content description in ContainerLayer instead of FrameMetrics. r=kats,BenWa
This commit is contained in:
parent
a84f8ca572
commit
1d35f25a8b
@ -740,46 +740,33 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
WriteParam(aMsg, aParam.mHasScrollgrab);
|
||||
WriteParam(aMsg, aParam.mUpdateScrollOffset);
|
||||
WriteParam(aMsg, aParam.mScrollGeneration);
|
||||
aMsg->WriteBytes(aParam.mContentDescription,
|
||||
sizeof(aParam.mContentDescription));
|
||||
WriteParam(aMsg, aParam.mTransformScale);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
const char* contentDescription;
|
||||
if (!(ReadParam(aMsg, aIter, &aResult->mScrollableRect) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mViewport) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDisplayPort) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDisplayPortMargins) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mUseDisplayPortMargins) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCriticalDisplayPort) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCompositionBounds) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRootCompositionSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mResolution) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCumulativeResolution) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mZoom) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchCaret) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mIsRoot) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHasScrollgrab) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mUpdateScrollOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollGeneration) &&
|
||||
aMsg->ReadBytes(aIter, &contentDescription,
|
||||
sizeof(aResult->mContentDescription)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mTransformScale))) {
|
||||
return false;
|
||||
}
|
||||
// ReadBytes() doesn't actually copy the string, it only points
|
||||
// a pointer to the string in its internal buffer.
|
||||
strncpy(aResult->mContentDescription, contentDescription,
|
||||
sizeof(aResult->mContentDescription));
|
||||
aResult->mContentDescription[sizeof(aResult->mContentDescription) - 1] = '\0';
|
||||
return true;
|
||||
return (ReadParam(aMsg, aIter, &aResult->mScrollableRect) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mViewport) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDisplayPort) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDisplayPortMargins) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mUseDisplayPortMargins) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCriticalDisplayPort) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCompositionBounds) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRootCompositionSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mResolution) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCumulativeResolution) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mZoom) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchCaret) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mIsRoot) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHasScrollgrab) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mUpdateScrollOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollGeneration) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mTransformScale));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define GFX_FRAMEMETRICS_H
|
||||
|
||||
#include <stdint.h> // for uint32_t, uint64_t
|
||||
#include <string> // for std::string
|
||||
#include "Units.h" // for CSSRect, CSSPixel, etc
|
||||
#include "mozilla/gfx/BasePoint.h" // for BasePoint
|
||||
#include "mozilla/gfx/Rect.h" // for RoundedIn
|
||||
@ -92,7 +91,6 @@ public:
|
||||
, mZoom(1)
|
||||
, mUpdateScrollOffset(false)
|
||||
, mScrollGeneration(0)
|
||||
, mContentDescription()
|
||||
, mRootCompositionSize(0, 0)
|
||||
, mDisplayPortMargins(0, 0, 0, 0)
|
||||
, mUseDisplayPortMargins(false)
|
||||
@ -103,8 +101,6 @@ public:
|
||||
|
||||
bool operator==(const FrameMetrics& aOther) const
|
||||
{
|
||||
// mContentDescription is not compared on purpose as it's only used
|
||||
// for debugging.
|
||||
return mCompositionBounds.IsEqualEdges(aOther.mCompositionBounds) &&
|
||||
mRootCompositionSize == aOther.mRootCompositionSize &&
|
||||
mDisplayPort.IsEqualEdges(aOther.mDisplayPort) &&
|
||||
@ -402,18 +398,6 @@ public:
|
||||
return mScrollGeneration;
|
||||
}
|
||||
|
||||
std::string GetContentDescription() const
|
||||
{
|
||||
return std::string(mContentDescription);
|
||||
}
|
||||
|
||||
void SetContentDescription(const std::string& aContentDescription)
|
||||
{
|
||||
strncpy(mContentDescription, aContentDescription.c_str(), sizeof(mContentDescription));
|
||||
// forcibly null-terminate in case aContentDescription is too long
|
||||
mContentDescription[sizeof(mContentDescription) - 1] = '\0';
|
||||
}
|
||||
|
||||
ViewID GetScrollId() const
|
||||
{
|
||||
return mScrollId;
|
||||
@ -503,10 +487,6 @@ private:
|
||||
// The scroll generation counter used to acknowledge the scroll offset update.
|
||||
uint32_t mScrollGeneration;
|
||||
|
||||
// A description of the content element corresponding to this frame.
|
||||
// This is empty unless the apz.printtree pref is turned on.
|
||||
char mContentDescription[20];
|
||||
|
||||
// The size of the root scrollable's composition bounds, but in local CSS pixels.
|
||||
CSSSize mRootCompositionSize;
|
||||
|
||||
|
@ -922,7 +922,7 @@ ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
|
||||
aAttrs = ContainerLayerAttributes(GetFrameMetrics(), mScrollHandoffParentId,
|
||||
mPreXScale, mPreYScale,
|
||||
mInheritedXScale, mInheritedYScale,
|
||||
mBackgroundColor);
|
||||
mBackgroundColor, mContentDescription);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1770,6 +1770,17 @@ public:
|
||||
Mutated();
|
||||
}
|
||||
|
||||
void SetContentDescription(const std::string& aContentDescription)
|
||||
{
|
||||
if (mContentDescription == aContentDescription) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ContentDescription", this));
|
||||
mContentDescription = aContentDescription;
|
||||
Mutated();
|
||||
}
|
||||
|
||||
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
|
||||
|
||||
void SortChildrenBy3DZOrder(nsTArray<Layer*>& aArray);
|
||||
@ -1789,6 +1800,7 @@ public:
|
||||
float GetInheritedYScale() const { return mInheritedYScale; }
|
||||
|
||||
gfxRGBA GetBackgroundColor() const { return mBackgroundColor; }
|
||||
const std::string& GetContentDescription() const { return mContentDescription; }
|
||||
|
||||
MOZ_LAYER_DECL_NAME("ContainerLayer", TYPE_CONTAINER)
|
||||
|
||||
@ -1881,6 +1893,10 @@ protected:
|
||||
// When multi-layer-apz (bug 967844) is implemented, this is likely to move
|
||||
// elsewhere (e.g. to Layer).
|
||||
gfxRGBA mBackgroundColor;
|
||||
// A description of the content element corresponding to this frame.
|
||||
// This is empty unless this ContainerLayer is scrollable and the
|
||||
// apz.printtree pref is turned on.
|
||||
std::string mContentDescription;
|
||||
bool mUseIntermediateSurface;
|
||||
bool mSupportsComponentAlphaChildren;
|
||||
bool mMayHaveReadbackChild;
|
||||
|
@ -269,7 +269,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||
<< "\tsr=" << container->GetFrameMetrics().mScrollableRect
|
||||
<< (aLayer->GetVisibleRegion().IsEmpty() ? "\tscrollinfo" : "")
|
||||
<< (apzc->HasScrollgrab() ? "\tscrollgrab" : "")
|
||||
<< "\t" << container->GetFrameMetrics().GetContentDescription();
|
||||
<< "\t" << container->GetContentDescription();
|
||||
|
||||
// Bind the APZC instance into the tree of APZCs
|
||||
if (aNextSibling) {
|
||||
|
@ -353,6 +353,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
containerLayer->SetPreScale(attrs.preXScale(), attrs.preYScale());
|
||||
containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
|
||||
containerLayer->SetBackgroundColor(attrs.backgroundColor().value());
|
||||
containerLayer->SetContentDescription(attrs.contentDescription());
|
||||
break;
|
||||
}
|
||||
case Specific::TColorLayerAttributes: {
|
||||
|
@ -41,6 +41,7 @@ using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
||||
using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h";
|
||||
using struct mozilla::layers::FenceHandleFromChild from "mozilla/layers/FenceUtils.h";
|
||||
using mozilla::layers::TextureIdentifier from "mozilla/layers/CompositorTypes.h";
|
||||
using std::string from "string";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
@ -227,6 +228,7 @@ struct ContainerLayerAttributes {
|
||||
float inheritedXScale;
|
||||
float inheritedYScale;
|
||||
LayerColor backgroundColor;
|
||||
string contentDescription;
|
||||
};
|
||||
struct ColorLayerAttributes { LayerColor color; nsIntRect bounds; };
|
||||
struct CanvasLayerAttributes { GraphicsFilterType filter; nsIntRect bounds; };
|
||||
|
@ -814,7 +814,7 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||
if (nsIContent* content = frameForCompositionBoundsCalculation->GetContent()) {
|
||||
nsAutoString contentDescription;
|
||||
content->Describe(contentDescription);
|
||||
metrics.SetContentDescription(NS_LossyConvertUTF16toASCII(contentDescription).get());
|
||||
aRoot->SetContentDescription(NS_LossyConvertUTF16toASCII(contentDescription).get());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user