Backed out 6 changesets (bug 1415225) for frequently failing own gfx/layers/apz/test/mochitest/test_group_overrides.html on Windows. r=backout

Backed out changeset 27403a9dec13 (bug 1415225)
Backed out changeset 9e6710586531 (bug 1415225)
Backed out changeset 8cfef302b710 (bug 1415225)
Backed out changeset 8ae80d7421d5 (bug 1415225)
Backed out changeset 5f14fc545115 (bug 1415225)
Backed out changeset 4704645d4e81 (bug 1415225)
This commit is contained in:
Sebastian Hengst 2017-11-09 11:59:04 +02:00
Родитель 31c9d59dfa
Коммит 8916884b22
21 изменённых файлов: 131 добавлений и 169 удалений

Просмотреть файл

@ -404,8 +404,8 @@ public:
{
MOZ_ASSERT(IsValid());
if (mLayer->AsRefLayer()) {
return mLayer->AsRefLayer()->GetEventRegionsOverride();
if (mLayer->AsContainerLayer()) {
return mLayer->AsContainerLayer()->GetEventRegionsOverride();
}
return EventRegionsOverride::NoOverride;
}

Просмотреть файл

@ -840,7 +840,8 @@ ContainerLayer::ContainerLayer(LayerManager* aManager, void* aImplData)
mUseIntermediateSurface(false),
mSupportsComponentAlphaChildren(false),
mMayHaveReadbackChild(false),
mChildrenChanged(false)
mChildrenChanged(false),
mEventRegionsOverride(EventRegionsOverride::NoOverride)
{
}
@ -1034,7 +1035,8 @@ ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{
aAttrs = ContainerLayerAttributes(mPreXScale, mPreYScale,
mInheritedXScale, mInheritedYScale,
mPresShellResolution, mScaleToResolution);
mPresShellResolution, mScaleToResolution,
mEventRegionsOverride);
}
bool
@ -2060,6 +2062,12 @@ ContainerLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
if (mScaleToResolution) {
aStream << nsPrintfCString(" [presShellResolution=%g]", mPresShellResolution).get();
}
if (mEventRegionsOverride & EventRegionsOverride::ForceDispatchToContent) {
aStream << " [force-dtc]";
}
if (mEventRegionsOverride & EventRegionsOverride::ForceEmptyHitRegion) {
aStream << " [force-ehr]";
}
}
void
@ -2236,12 +2244,6 @@ RefLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
if (0 != mId) {
AppendToString(aStream, mId, " [id=", "]");
}
if (mEventRegionsOverride & EventRegionsOverride::ForceDispatchToContent) {
aStream << " [force-dtc]";
}
if (mEventRegionsOverride & EventRegionsOverride::ForceEmptyHitRegion) {
aStream << " [force-ehr]";
}
}
void

Просмотреть файл

@ -2315,6 +2315,20 @@ public:
mChildrenChanged = aVal;
}
void SetEventRegionsOverride(EventRegionsOverride aVal) {
if (mEventRegionsOverride == aVal) {
return;
}
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) EventRegionsOverride", this));
mEventRegionsOverride = aVal;
Mutated();
}
EventRegionsOverride GetEventRegionsOverride() const {
return mEventRegionsOverride;
}
// If |aRect| is null, the entire layer should be considered invalid for
// compositing.
virtual void SetInvalidCompositeRect(const gfx::IntRect* aRect) {}
@ -2404,6 +2418,7 @@ protected:
// This is updated by ComputeDifferences. This will be true if we need to invalidate
// the intermediate surface.
bool mChildrenChanged;
EventRegionsOverride mEventRegionsOverride;
};
/**
@ -2822,25 +2837,6 @@ public:
aLayer->SetParent(this);
}
/**
* CONSTRUCTION PHASE ONLY
* Set flags that indicate how event regions in the child layer tree need
* to be overridden because of properties of the parent layer tree.
*/
void SetEventRegionsOverride(EventRegionsOverride aVal) {
if (mEventRegionsOverride == aVal) {
return;
}
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) EventRegionsOverride", this));
mEventRegionsOverride = aVal;
Mutated();
}
EventRegionsOverride GetEventRegionsOverride() const {
return mEventRegionsOverride;
}
/**
* DRAWING PHASE ONLY
* |aLayer| is the same as the argument to ConnectReferentLayer().
@ -2865,9 +2861,7 @@ public:
protected:
RefLayer(LayerManager* aManager, void* aImplData)
: ContainerLayer(aManager, aImplData)
, mId(0)
, mEventRegionsOverride(EventRegionsOverride::NoOverride)
: ContainerLayer(aManager, aImplData) , mId(0)
{}
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
@ -2876,7 +2870,6 @@ protected:
// 0 is a special value that means "no ID".
uint64_t mId;
EventRegionsOverride mEventRegionsOverride;
};
void SetAntialiasingFlags(Layer* aLayer, gfx::DrawTarget* aTarget);

Просмотреть файл

@ -203,7 +203,7 @@ struct EventRegions {
}
};
// Bit flags that go on a RefLayer and override the
// Bit flags that go on a ContainerLayer (or RefLayer) and override the
// event regions in the entire subtree below. This is needed for propagating
// various flags across processes since the child-process layout code doesn't
// know about parent-process listeners or CSS rules.

Просмотреть файл

@ -651,10 +651,6 @@ GetEventRegionsOverride(HitTestingTreeNode* aParent,
// layer in the hit-test tree. This saves having to walk up the tree every
// we want to see if a hit-test node is affected by this flag.
EventRegionsOverride result = aLayer.GetEventRegionsOverride();
if (result != EventRegionsOverride::NoOverride) {
// Overrides should only ever get set for ref layers.
MOZ_ASSERT(aLayer.GetReferentId());
}
if (aParent) {
result |= aParent->GetEventRegionsOverride();
}

Просмотреть файл

@ -1,60 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Simple wheel scroll cancellation</title>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
// Add a non-passive listener on the document, so that we have a document-level
// APZ-aware listener, and the entire document is put in the dispatch-to-content
// region
document.addEventListener('wheel', function(e) {
dump("Wheel listener running...\n");
// spin for 2 seconds to give APZ time to scroll, if the event region override
// is broken and it decides not to wait for the main thread. Note that it's
// possible the APZ controller thread is busy for whatever reason so APZ
// may not scroll. That might cause this test to only fail intermittently
// instead of consistently if the behaviour being tested regresses.
var now = Date.now();
while (Date.now() - now < 2000);
// Cancel the scroll. If this works then we know APZ waited for this listener
// to run.
e.preventDefault();
setTimeout(function() {
flushApzRepaints(checkScroll);
}, 0);
}, false);
function scrollPage() {
synthesizeNativeWheel(document.body, 100, 100, 0, -50);
dump("Finished native wheel, waiting for listener to run...\n");
}
function checkScroll() {
is(window.scrollY, 0, "check that the window didn't scroll");
subtestDone();
}
if (window.top != window) {
dump("Running inside an iframe! stealing functions from window.top...\n");
window.subtestDone = window.top.subtestDone;
window.SimpleTest = window.top.SimpleTest;
window.is = window.top.is;
window.ok = window.top.ok;
}
waitUntilApzStable().then(scrollPage);
</script>
</head>
<body style="height: 5000px; background-image: linear-gradient(green,red);">
This page should not be wheel-scrollable.
</body>
</html>

Просмотреть файл

@ -1,15 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Wheel scroll cancellation inside iframe</title>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
</head>
<body>
This just loads helper_override_root in an iframe, so that we test event
regions overriding on in-process subdocuments.
<iframe src="helper_override_root.html"></iframe>
</body>
</html>

Просмотреть файл

@ -21,8 +21,6 @@
helper_iframe2.html
helper_key_scroll.html
helper_long_tap.html
helper_override_root.html
helper_override_subdoc.html
helper_scroll_inactive_perspective.html
helper_scroll_inactive_zindex.html
helper_scroll_on_position_fixed.html
@ -74,5 +72,3 @@ skip-if = os == 'win' && os_version == '10.0' # Bug 1404836
skip-if = (os == 'android') # wheel events not supported on mobile
[test_wheel_transactions.html]
skip-if = (os == 'android') # wheel events not supported on mobile
[test_group_overrides.html]
skip-if = (os == 'android') # wheel events not supported on mobile

Просмотреть файл

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Various tests for event regions overrides</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
var prefs = [
// turn off smooth scrolling so that we don't have to wait for
// APZ animations to finish before sampling the scroll offset
['general.smoothScroll', false],
// Increase the content response timeout because these tests do preventDefault
// and we want to make sure APZ actually waits for them.
['apz.content_response_timeout', 10000],
]
var subtests = [
{'file': 'helper_override_root.html', 'prefs': prefs},
{'file': 'helper_override_subdoc.html', 'prefs': prefs},
];
if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();
window.onload = function() {
runSubtestsSeriallyInFreshWindows(subtests)
.then(SimpleTest.finish);
};
}
</script>
</head>
<body>
</body>
</html>

Просмотреть файл

@ -609,6 +609,10 @@ LayerTransactionParent::SetLayerAttributes(const OpSetLayerAttributes& aOp)
containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
containerLayer->SetScaleToResolution(attrs.scaleToResolution(),
attrs.presShellResolution());
if (attrs.eventRegionsOverride() != containerLayer->GetEventRegionsOverride()) {
UpdateHitTestingTree(layer, "event regions override changed");
containerLayer->SetEventRegionsOverride(attrs.eventRegionsOverride());
}
break;
}
case Specific::TColorLayerAttributes: {

Просмотреть файл

@ -287,6 +287,7 @@ struct ContainerLayerAttributes {
float inheritedYScale;
float presShellResolution;
bool scaleToResolution;
EventRegionsOverride eventRegionsOverride;
};
struct GlyphArray
@ -302,6 +303,8 @@ struct ColorLayerAttributes { LayerColor color; IntRect bounds; };
struct CanvasLayerAttributes { SamplingFilter samplingFilter; IntRect bounds; };
struct RefLayerAttributes {
uint64_t id;
// TODO: Once bug 1132895 is fixed we shouldn't need to propagate the override
// explicitly here.
EventRegionsOverride eventRegionsOverride;
};
struct ImageLayerAttributes { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };

Просмотреть файл

@ -80,6 +80,12 @@ WebRenderCommandBuilder::BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder
// Make a "root" layer data that has everything else as descendants
mLayerScrollData.emplace_back();
mLayerScrollData.back().InitializeRoot(mLayerScrollData.size() - 1);
if (aDisplayListBuilder->IsBuildingLayerEventRegions()) {
nsIPresShell* shell = aDisplayListBuilder->RootReferenceFrame()->PresContext()->PresShell();
if (nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(shell)) {
mLayerScrollData.back().SetEventRegionsOverride(EventRegionsOverride::ForceDispatchToContent);
}
}
auto callback = [&aScrollData](FrameMetrics::ViewID aScrollId) -> bool {
return aScrollData.HasMetadataFor(aScrollId);
};

Просмотреть файл

@ -225,6 +225,24 @@ WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags)
return true;
}
/*static*/ int32_t
PopulateScrollData(WebRenderScrollData& aTarget, Layer* aLayer)
{
MOZ_ASSERT(aLayer);
// We want to allocate a WebRenderLayerScrollData object for this layer,
// but don't keep a pointer to it since it might get memmove'd during the
// recursion below. Instead keep the index and get the pointer later.
size_t index = aTarget.AddNewLayerData();
int32_t descendants = 0;
for (Layer* child = aLayer->GetLastChild(); child; child = child->GetPrevSibling()) {
descendants += PopulateScrollData(aTarget, child);
}
aTarget.GetLayerDataMutable(index)->Initialize(aTarget, aLayer, descendants);
return descendants + 1;
}
void
WebRenderLayerManager::EndTransaction(DrawPaintedLayerCallback aCallback,
void* aCallbackData,

Просмотреть файл

@ -32,6 +32,37 @@ WebRenderLayerScrollData::~WebRenderLayerScrollData()
{
}
void
WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner,
Layer* aLayer,
int32_t aDescendantCount)
{
MOZ_ASSERT(aDescendantCount >= 0); // Ensure value is valid
MOZ_ASSERT(mDescendantCount == -1); // Don't allow re-setting an already set value
mDescendantCount = aDescendantCount;
MOZ_ASSERT(aLayer);
for (uint32_t i = 0; i < aLayer->GetScrollMetadataCount(); i++) {
mScrollIds.AppendElement(aOwner.AddMetadata(aLayer->GetScrollMetadata(i)));
}
mTransform = aLayer->GetTransform();
mTransformIsPerspective = aLayer->GetTransformIsPerspective();
mEventRegions = aLayer->GetEventRegions();
mVisibleRegion = aLayer->GetVisibleRegion();
mReferentId = aLayer->AsRefLayer()
? Some(aLayer->AsRefLayer()->GetReferentId())
: Nothing();
mEventRegionsOverride = aLayer->AsContainerLayer()
? aLayer->AsContainerLayer()->GetEventRegionsOverride()
: EventRegionsOverride::NoOverride;
mScrollThumbData = aLayer->GetScrollThumbData();
mScrollbarAnimationId = aLayer->GetCompositorAnimationsId();
mScrollbarTargetContainerId = aLayer->GetScrollbarTargetContainerId();
mIsScrollbarContainer = aLayer->IsScrollbarContainer();
mFixedPosScrollContainerId = aLayer->GetFixedPositionScrollContainerId();
}
void
WebRenderLayerScrollData::InitializeRoot(int32_t aDescendantCount)
{

Просмотреть файл

@ -42,6 +42,12 @@ public:
WebRenderLayerScrollData(); // needed for IPC purposes
~WebRenderLayerScrollData();
// Actually initialize the object. This is not done during the constructor
// for optimization purposes (the call site is hard to write efficiently
// if we do this in the constructor).
void Initialize(WebRenderScrollData& aOwner,
Layer* aLayer,
int32_t aDescendantCount);
void InitializeRoot(int32_t aDescendantCount);
void Initialize(WebRenderScrollData& aOwner,
nsDisplayItem* aItem,

Просмотреть файл

@ -3781,9 +3781,6 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
builder.SetVisibleRect(visibleRect);
builder.SetIsBuilding(true);
builder.SetAncestorHasApzAwareEventHandler(
builder.IsBuildingLayerEventRegions() &&
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell));
const bool paintedPreviously =
aFrame->HasProperty(nsIFrame::ModifiedFrameList());

Просмотреть файл

@ -2528,10 +2528,6 @@ public:
static void
CheckForApzAwareEventHandlers(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
{
if (aBuilder->GetAncestorHasApzAwareEventHandler()) {
return;
}
nsIContent* content = aFrame->GetContent();
if (!content) {
return;

Просмотреть файл

@ -447,6 +447,12 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
needsOwnLayer = true;
}
if (!needsOwnLayer && aBuilder->IsBuildingLayerEventRegions() &&
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell))
{
needsOwnLayer = true;
}
if (aBuilder->IsRetainingDisplayList()) {
// The value of needsOwnLayer can change between builds without
// an invalidation recorded for this frame (like if the root
@ -499,11 +505,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
? nsLayoutUtils::FindOrCreateIDFor(rootScrollFrame->GetContent())
: aBuilder->GetCurrentScrollParentId());
bool hasDocumentLevelListenersForApzAwareEvents =
aBuilder->IsBuildingLayerEventRegions() &&
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell);
aBuilder->SetAncestorHasApzAwareEventHandler(hasDocumentLevelListenersForApzAwareEvents);
aBuilder->SetAncestorHasApzAwareEventHandler(false);
subdocRootFrame->
BuildDisplayListForStackingContext(aBuilder, &childItems);
}

Просмотреть файл

@ -374,8 +374,8 @@ nsDisplayRemote::BuildLayer(nsDisplayListBuilder* aBuilder,
const ContainerLayerParameters& aContainerParameters)
{
RefPtr<Layer> layer = mRemoteFrame->BuildLayer(aBuilder, mFrame, aManager, this, aContainerParameters);
if (layer && layer->AsRefLayer()) {
layer->AsRefLayer()->SetEventRegionsOverride(mEventRegionsOverride);
if (layer && layer->AsContainerLayer()) {
layer->AsContainerLayer()->SetEventRegionsOverride(mEventRegionsOverride);
}
return layer.forget();
}

Просмотреть файл

@ -2481,6 +2481,12 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
1.0f/containerParameters.mYScale);
root->SetScaleToResolution(presShell->ScaleToResolution(),
containerParameters.mXScale);
if (aBuilder->IsBuildingLayerEventRegions() &&
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell)) {
root->SetEventRegionsOverride(EventRegionsOverride::ForceDispatchToContent);
} else {
root->SetEventRegionsOverride(EventRegionsOverride::NoOverride);
}
auto callback = [root](FrameMetrics::ViewID aScrollId) -> bool {
return nsLayoutUtils::ContainsMetricsWithId(root, aScrollId);
@ -6855,6 +6861,9 @@ nsDisplaySubDocument::nsDisplaySubDocument(nsDisplayListBuilder* aBuilder,
, mSubDocFrame(aSubDocFrame)
{
MOZ_COUNT_CTOR(nsDisplaySubDocument);
mForceDispatchToContentRegion =
aBuilder->IsBuildingLayerEventRegions() &&
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(aFrame->PresContext()->PresShell());
// The SubDocument display item is conceptually outside the viewport frame,
// so in cases where the viewport frame is an AGR, the SubDocument's AGR
@ -6870,6 +6879,17 @@ nsDisplaySubDocument::~nsDisplaySubDocument() {
}
#endif
already_AddRefed<Layer>
nsDisplaySubDocument::BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters) {
RefPtr<Layer> layer = nsDisplayOwnLayer::BuildLayer(aBuilder, aManager, aContainerParameters);
layer->AsContainerLayer()->SetEventRegionsOverride(mForceDispatchToContentRegion
? EventRegionsOverride::ForceDispatchToContent
: EventRegionsOverride::NoOverride);
return layer.forget();
}
UniquePtr<ScrollMetadata>
nsDisplaySubDocument::ComputeScrollMetadata(LayerManager* aLayerManager,
const ContainerLayerParameters& aContainerParameters)

Просмотреть файл

@ -701,7 +701,7 @@ public:
return CurrentPresShellState()->mInsidePointerEventsNoneDoc;
}
bool GetAncestorHasApzAwareEventHandler() const { return mAncestorHasApzAwareEventHandler; }
bool GetAncestorHasApzAwareEventHandler() { return mAncestorHasApzAwareEventHandler; }
void SetAncestorHasApzAwareEventHandler(bool aValue)
{
mAncestorHasApzAwareEventHandler = aValue;
@ -5111,6 +5111,10 @@ public:
virtual ~nsDisplaySubDocument();
#endif
virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters) override;
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
bool* aSnap) const override;