Closed Bug 1142211 Opened 9 years ago Closed 9 years ago

Allow reftests to test whether an element is part of an opaque layer, and whether two elements share the same layer

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: mstange, Assigned: mstange)

Details

Attachments

(1 file, 1 obsolete file)

I'd like to make changes to the way we split and merge layers in the face of different animated geometry roots that interleave the display items in z-order, and to the way we decide to pull up opaque background colors when there are differing animated geometry roots.
However, at the moment I can't really test the things I'd like to guarantee. There are three objectives to optimize for:
 - Splitting layers has the goal of avoiding invalidations during animations (e.g. scrolling), regardless of whether those animations are async or driven from the main thread.
 - Merging layers has the goal of reducing memory consumption and overdraw.
 - Pulling opaque background colors into layers has the goal of making layers opaque, which makes them more efficient to draw and means they don't need component alpha.

At the moment, only the first goal is testable by reftests. For example, nothing will fail if we start putting every display item into its own layer (except for fuzzable differences in blending, maybe).
/r/5203 - Bug 1142211 - Add layerization testing mechanisms to reftest. r=roc

Pull down this commit:

hg pull review -r 6e8413934bdcd7680566b2cfedf6606022e352c4
Attachment #8576188 - Flags: review?(roc)
This patch adds support to the reftest framework for testing the other two goals: You can set class="reftest-opaque-layer" on elements that should be part of an opaque PaintedLayer, and you can set reftest-assigned-layer="page-background" on two elements that should end up in the same PaintedLayer.
The patch also adds support for testing whether elements are assigned to different PaintedLayers, if those elements have different reftest-assigned-layer values, but only because it's a natural extension of the same-layer test method. I don't think we should make much use of that capability - the point of splitting stuff into different layers is to avoid invalidation, so we should be using class="reftest-no-paint" to test for those invalidations instead.
Comment on attachment 8576188 [details]
MozReview Request: bz://1142211/mstange

https://reviewboard.mozilla.org/r/5201/#review4237

Great stuff!

::: layout/base/FrameLayerBuilder.cpp
(Diff revision 1)
> +/* static */ Layer*
> +FrameLayerBuilder::GetDebugSingleOldLayerForFrame(nsIFrame* aFrame)
> +{
> +  nsTArray<DisplayItemData*> *array =
> +    reinterpret_cast<nsTArray<DisplayItemData*>*>(aFrame->Properties().Get(LayerManagerDataProperty()));
> +
> +  if (!array) {
> +    return nullptr;
> +  }
> +
> +  Layer* layer = nullptr;
> +  for (DisplayItemData *data : *array) {
> +    if (layer && layer != data->mLayer) {
> +      // More than one layer assigned, bail.
> +      return nullptr;
> +    }
> +    layer = data->mLayer;
> +  }
> +  return layer;
> +}
> +

Great stuff!

::: layout/base/FrameLayerBuilder.cpp
(Diff revision 1)
> +  nsTArray<DisplayItemData*> *array =

nsTArray<DisplayItemData\*>\* array

::: layout/base/FrameLayerBuilder.cpp
(Diff revision 1)
> +  for (DisplayItemData *data : *array) {

DisplayItemData\* data : \*array
Attachment #8576188 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/9b17a03fe1b5
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Attachment #8576188 - Attachment is obsolete: true
Attachment #8619733 - Flags: review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: