Bug 1326163 part 1. The fieldset's border drawing display item shouldn't participate in hit-testing. That's handled by its background item already. r=dbaron

This commit is contained in:
Boris Zbarsky
2016-12-29 18:10:22 -08:00
parent 5f96192eba
commit 6362ba32b8
2 changed files with 22 additions and 12 deletions

View File

@@ -101,9 +101,6 @@ public:
MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground); MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground);
} }
#endif #endif
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState,
nsTArray<nsIFrame*> *aOutFrames) override;
virtual void Paint(nsDisplayListBuilder* aBuilder, virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) override; nsRenderingContext* aCtx) override;
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override; virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override;
@@ -114,15 +111,6 @@ public:
NS_DISPLAY_DECL_NAME("FieldSetBorderBackground", TYPE_FIELDSET_BORDER_BACKGROUND) NS_DISPLAY_DECL_NAME("FieldSetBorderBackground", TYPE_FIELDSET_BORDER_BACKGROUND)
}; };
void nsDisplayFieldSetBorderBackground::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
{
// aPt is guaranteed to be in this item's bounds. We do the hit test based on the
// frame bounds even though our background doesn't cover the whole frame.
// It's not clear whether this is correct.
aOutFrames->AppendElement(mFrame);
}
void void
nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder, nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) nsRenderingContext* aCtx)

View File

@@ -52,6 +52,19 @@
<area id="rectG" shape="rect" coords="0,0,90,100" href="#" alt="area 1"/> <area id="rectG" shape="rect" coords="0,0,90,100" href="#" alt="area 1"/>
<area id="circleO" shape="circle" coords="120,60,30" href="#" alt="area 2"/> <area id="circleO" shape="circle" coords="120,60,30" href="#" alt="area 2"/>
<area id="polyLE" shape="poly" coords="280,0,310,0,360,30,360,90,280,90" href="#" alt="area 3"/> <area id="polyLE" shape="poly" coords="280,0,310,0,360,30,360,90,280,90" href="#" alt="area 3"/>
<!-- Test for fieldsets not doing weird things. Use a 200x200 div to hold
all the bits for this test. Also, place it top/right, so it is not below
the bottom edge of the viewport. -->
<div style="position: absolute; width: 200px; height: 200px; right: 0; top: 0">
<div id="fieldset-div"
class="size" style="position: absolute; top: 0; left: 0">
</div>
<fieldset class="size" style="position: absolute; top: 100px; left: 100px">
<!-- Place the child span so the overflow area of the fieldset overlaps
the div -->
<span style="position: absolute; top: -100px; left: -100px; height: 1px; width: 1px"></span>
</fieldset>
</div>
<script> <script>
setup({explicit_done:true}); setup({explicit_done:true});
window.onload = function () { window.onload = function () {
@@ -152,6 +165,15 @@
area, area,
"Should have returned the image element"); "Should have returned the image element");
}, "Image Maps"); }, "Image Maps");
test(function(){
var fieldsetDiv = document.getElementById("fieldset-div");
var divRect = fieldsetDiv.getBoundingClientRect();
assert_equals(document.elementFromPoint(divRect.left + divRect.width/2,
divRect.top + divRect.height/2),
fieldsetDiv,
"The fieldset should not cover up the div it doesn't even overlap");
}, "Fieldsets");
done(); done();
} }
</script> </script>