Bug 1019737 - Only layerize the scrollbar thumb if the target scroll frame has active scrolling. r=roc
This commit is contained in:
@@ -1604,6 +1604,21 @@ nsLayoutUtils::IsFixedPosFrameInDisplayPort(const nsIFrame* aFrame, nsRect* aDis
|
|||||||
return ViewportHasDisplayPort(aFrame->PresContext(), aDisplayPort);
|
return ViewportHasDisplayPort(aFrame->PresContext(), aDisplayPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_DECLARE_FRAME_PROPERTY(ScrollbarThumbLayerized, nullptr)
|
||||||
|
|
||||||
|
/* static */ void
|
||||||
|
nsLayoutUtils::SetScrollbarThumbLayerization(nsIFrame* aThumbFrame, bool aLayerize)
|
||||||
|
{
|
||||||
|
aThumbFrame->Properties().Set(ScrollbarThumbLayerized(),
|
||||||
|
reinterpret_cast<void*>(intptr_t(aLayerize)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsScrollbarThumbLayerized(nsIFrame* aThumbFrame)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<intptr_t>(aThumbFrame->Properties().Get(ScrollbarThumbLayerized()));
|
||||||
|
}
|
||||||
|
|
||||||
static nsIFrame*
|
static nsIFrame*
|
||||||
GetAnimatedGeometryRootForFrame(nsIFrame* aFrame,
|
GetAnimatedGeometryRootForFrame(nsIFrame* aFrame,
|
||||||
const nsIFrame* aStopAtAncestor)
|
const nsIFrame* aStopAtAncestor)
|
||||||
@@ -1625,10 +1640,11 @@ GetAnimatedGeometryRootForFrame(nsIFrame* aFrame,
|
|||||||
if (!parent)
|
if (!parent)
|
||||||
break;
|
break;
|
||||||
nsIAtom* parentType = parent->GetType();
|
nsIAtom* parentType = parent->GetType();
|
||||||
// Treat the slider thumb as being as an active scrolled root
|
// Treat the slider thumb as being as an active scrolled root when it wants
|
||||||
// so that it can move without repainting.
|
// its own layer so that it can move without repainting.
|
||||||
if (parentType == nsGkAtoms::sliderFrame)
|
if (parentType == nsGkAtoms::sliderFrame && IsScrollbarThumbLayerized(f)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
// Sticky frames are active if their nearest scrollable frame
|
// Sticky frames are active if their nearest scrollable frame
|
||||||
// is also active, just keep a record of sticky frames that we
|
// is also active, just keep a record of sticky frames that we
|
||||||
// encounter for now.
|
// encounter for now.
|
||||||
|
|||||||
@@ -480,6 +480,12 @@ public:
|
|||||||
static bool IsFixedPosFrameInDisplayPort(const nsIFrame* aFrame,
|
static bool IsFixedPosFrameInDisplayPort(const nsIFrame* aFrame,
|
||||||
nsRect* aDisplayPort = nullptr);
|
nsRect* aDisplayPort = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store whether aThumbFrame wants its own layer. This sets a property on
|
||||||
|
* the frame.
|
||||||
|
*/
|
||||||
|
static void SetScrollbarThumbLayerization(nsIFrame* aThumbFrame, bool aLayerize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the nearest ancestor frame to aItem that is considered to have (or
|
* Finds the nearest ancestor frame to aItem that is considered to have (or
|
||||||
* will have) "animated geometry". For example the scrolled frames of
|
* will have) "animated geometry". For example the scrolled frames of
|
||||||
|
|||||||
@@ -2179,8 +2179,9 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|||||||
scrollParts.AppendElement(kid);
|
scrollParts.AppendElement(kid);
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::layers::FrameMetrics::ViewID scrollTargetId =
|
mozilla::layers::FrameMetrics::ViewID scrollTargetId = IsScrollingActive()
|
||||||
nsLayoutUtils::FindOrCreateIDFor(mScrolledFrame->GetContent());
|
? nsLayoutUtils::FindOrCreateIDFor(mScrolledFrame->GetContent())
|
||||||
|
: mozilla::layers::FrameMetrics::NULL_SCROLL_ID;
|
||||||
|
|
||||||
scrollParts.Sort(HoveredStateComparator());
|
scrollParts.Sort(HoveredStateComparator());
|
||||||
|
|
||||||
|
|||||||
@@ -1311,8 +1311,9 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
} else {
|
} else {
|
||||||
nsIFrame* parent = GetParentBox(this);
|
nsIFrame* parent = GetParentBox(this);
|
||||||
if (parent && parent->GetType() == nsGkAtoms::sliderFrame) {
|
if (parent && parent->GetType() == nsGkAtoms::sliderFrame) {
|
||||||
forceLayer = true;
|
|
||||||
aBuilder->GetScrollbarInfo(&scrollTargetId, &flags);
|
aBuilder->GetScrollbarInfo(&scrollTargetId, &flags);
|
||||||
|
forceLayer = (scrollTargetId != layers::FrameMetrics::NULL_SCROLL_ID);
|
||||||
|
nsLayoutUtils::SetScrollbarThumbLayerization(this, forceLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check for frames that are marked as a part of the region used
|
// Check for frames that are marked as a part of the region used
|
||||||
|
|||||||
Reference in New Issue
Block a user