From fb11b16545e2862fd5da3662649d1509f5d16489 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 7 Oct 2015 12:08:53 -0700 Subject: [PATCH] Fix inactive scroll frames sometimes creating very large, incorrect hit regions. (bug 1190112, r=tn) --- gfx/layers/apz/test/mochitest/mochitest.ini | 2 + .../test_scroll_inactive_bug1190112.html | 542 ++++++++++++++++++ layout/base/nsDisplayList.cpp | 1 + layout/base/nsDisplayList.h | 1 - layout/generic/nsFrame.cpp | 3 + 5 files changed, 548 insertions(+), 1 deletion(-) create mode 100644 gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html diff --git a/gfx/layers/apz/test/mochitest/mochitest.ini b/gfx/layers/apz/test/mochitest/mochitest.ini index 6af4a619b3c4..cd3862004703 100644 --- a/gfx/layers/apz/test/mochitest/mochitest.ini +++ b/gfx/layers/apz/test/mochitest/mochitest.ini @@ -27,3 +27,5 @@ skip-if = (os == 'android') || (os == 'b2g') # uses wheel events which are not s skip-if = toolkit != 'gonk' [test_scroll_inactive_flattened_frame.html] skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet +[test_scroll_inactive_bug1190112.html] +skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet diff --git a/gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html b/gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html new file mode 100644 index 000000000000..b4a3a081f398 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html @@ -0,0 +1,542 @@ + + + + Test scrolling flattened inactive frames + + + + + + + +
+
+
+
+

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+ +

+
+ + + diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 56a60befa0c9..2370c2bf0927 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3235,6 +3235,7 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder, void nsDisplayLayerEventRegions::AddInactiveScrollPort(const nsRect& aRect) { + mHitRegion.Or(mHitRegion, aRect); mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aRect); } diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 898e4e35d8c1..f78db61f3d8a 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -2920,7 +2920,6 @@ public: : nsDisplayItem(aBuilder, aFrame) { MOZ_COUNT_CTOR(nsDisplayLayerEventRegions); - AddFrame(aBuilder, aFrame); } #ifdef NS_BUILD_REFCNT_LOGGING virtual ~nsDisplayLayerEventRegions() { diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 8ee469281657..ebffd6d3ca8b 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2043,6 +2043,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, if (aBuilder->IsBuildingLayerEventRegions()) { nsDisplayLayerEventRegions* eventRegions = new (aBuilder) nsDisplayLayerEventRegions(aBuilder, this); + eventRegions->AddFrame(aBuilder, this); aBuilder->SetLayerEventRegions(eventRegions); set.BorderBackground()->AppendNewToTop(eventRegions); } @@ -2505,6 +2506,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, if (animatedGeometryRoot != buildingForChild.GetPrevAnimatedGeometryRoot()) { nsDisplayLayerEventRegions* eventRegions = new (aBuilder) nsDisplayLayerEventRegions(aBuilder, child); + eventRegions->AddFrame(aBuilder, child); aBuilder->SetLayerEventRegions(eventRegions); aLists.BorderBackground()->AppendNewToTop(eventRegions); } @@ -2531,6 +2533,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, if (aBuilder->IsBuildingLayerEventRegions()) { nsDisplayLayerEventRegions* eventRegions = new (aBuilder) nsDisplayLayerEventRegions(aBuilder, child); + eventRegions->AddFrame(aBuilder, child); aBuilder->SetLayerEventRegions(eventRegions); pseudoStack.BorderBackground()->AppendNewToTop(eventRegions); }