Bug 664130 - Rename GetHittestMask to GetHitTestFlags to avoid confusion about masking. r=longsonr.

This commit is contained in:
Jonathan Watt 2011-07-08 14:20:14 +01:00
Родитель b03c82c328
Коммит 83f4467feb
5 изменённых файлов: 45 добавлений и 38 удалений

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

@ -338,9 +338,9 @@ nsSVGGeometryFrame::SetupCairoStroke(gfxContext *aContext)
}
PRUint16
nsSVGGeometryFrame::GetHittestMask()
nsSVGGeometryFrame::GetHitTestFlags()
{
PRUint16 mask = 0;
PRUint16 flags = 0;
switch(GetStyleVisibility()->mPointerEvents) {
case NS_STYLE_POINTER_EVENTS_NONE:
@ -349,49 +349,49 @@ nsSVGGeometryFrame::GetHittestMask()
case NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED:
if (GetStyleVisibility()->IsVisible()) {
if (GetStyleSVG()->mFill.mType != eStyleSVGPaintType_None)
mask |= HITTEST_MASK_FILL;
flags |= SVG_HIT_TEST_FILL;
if (GetStyleSVG()->mStroke.mType != eStyleSVGPaintType_None)
mask |= HITTEST_MASK_STROKE;
flags |= SVG_HIT_TEST_STROKE;
if (GetStyleSVG()->mStrokeOpacity > 0)
mask |= HITTEST_MASK_CHECK_MRECT;
flags |= SVG_HIT_TEST_CHECK_MRECT;
}
break;
case NS_STYLE_POINTER_EVENTS_VISIBLEFILL:
if (GetStyleVisibility()->IsVisible()) {
mask |= HITTEST_MASK_FILL;
flags |= SVG_HIT_TEST_FILL;
}
break;
case NS_STYLE_POINTER_EVENTS_VISIBLESTROKE:
if (GetStyleVisibility()->IsVisible()) {
mask |= HITTEST_MASK_STROKE;
flags |= SVG_HIT_TEST_STROKE;
}
break;
case NS_STYLE_POINTER_EVENTS_VISIBLE:
if (GetStyleVisibility()->IsVisible()) {
mask |= HITTEST_MASK_FILL | HITTEST_MASK_STROKE;
flags |= SVG_HIT_TEST_FILL | SVG_HIT_TEST_STROKE;
}
break;
case NS_STYLE_POINTER_EVENTS_PAINTED:
if (GetStyleSVG()->mFill.mType != eStyleSVGPaintType_None)
mask |= HITTEST_MASK_FILL;
flags |= SVG_HIT_TEST_FILL;
if (GetStyleSVG()->mStroke.mType != eStyleSVGPaintType_None)
mask |= HITTEST_MASK_STROKE;
flags |= SVG_HIT_TEST_STROKE;
if (GetStyleSVG()->mStrokeOpacity)
mask |= HITTEST_MASK_CHECK_MRECT;
flags |= SVG_HIT_TEST_CHECK_MRECT;
break;
case NS_STYLE_POINTER_EVENTS_FILL:
mask |= HITTEST_MASK_FILL;
flags |= SVG_HIT_TEST_FILL;
break;
case NS_STYLE_POINTER_EVENTS_STROKE:
mask |= HITTEST_MASK_STROKE;
flags |= SVG_HIT_TEST_STROKE;
break;
case NS_STYLE_POINTER_EVENTS_ALL:
mask |= HITTEST_MASK_FILL | HITTEST_MASK_STROKE;
flags |= SVG_HIT_TEST_FILL | SVG_HIT_TEST_STROKE;
break;
default:
NS_ERROR("not reached");
break;
}
return mask;
return flags;
}

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

@ -46,9 +46,9 @@ class gfxContext;
typedef nsFrame nsSVGGeometryFrameBase;
#define HITTEST_MASK_FILL 0x01
#define HITTEST_MASK_STROKE 0x02
#define HITTEST_MASK_CHECK_MRECT 0x04
#define SVG_HIT_TEST_FILL 0x01
#define SVG_HIT_TEST_STROKE 0x02
#define SVG_HIT_TEST_CHECK_MRECT 0x04
/* nsSVGGeometryFrame is a base class for SVG objects that directly
* have geometry (circle, ellipse, line, polyline, polygon, path, and
@ -106,7 +106,14 @@ public:
protected:
nsSVGPaintServerFrame *GetPaintServer(const nsStyleSVGPaint *aPaint,
const FramePropertyDescriptor *aProperty);
virtual PRUint16 GetHittestMask();
/**
* This function returns a set of bit flags indicating which parts of the
* element (fill, stroke, bounds) should intercept pointer events. It takes
* into account the type of element and the value of the 'pointer-events'
* property on the element.
*/
virtual PRUint16 GetHitTestFlags();
private:
nsresult GetStrokeDashArray(double **arr, PRUint32 *count);

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

@ -415,8 +415,8 @@ nsSVGGlyphFrame::PaintSVG(nsSVGRenderState *aContext,
NS_IMETHODIMP_(nsIFrame*)
nsSVGGlyphFrame::GetFrameForPoint(const nsPoint &aPoint)
{
PRUint16 mask = GetHittestMask();
if (!mask) {
PRUint16 hitTestFlags = GetHitTestFlags();
if (!hitTestFlags) {
return nsnull;
}
@ -431,7 +431,7 @@ nsSVGGlyphFrame::GetFrameForPoint(const nsPoint &aPoint)
//
// http://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty
//
// Currently we just test the character cells if GetHittestMask says we're
// Currently we just test the character cells if GetHitTestFlags says we're
// supposed to be testing either the fill OR the stroke:
PRInt32 i;
@ -448,7 +448,7 @@ nsSVGGlyphFrame::GetFrameForPoint(const nsPoint &aPoint)
PresContext()->AppUnitsToGfxUnits(aPoint.y)));
PRBool isHit = PR_FALSE;
if (mask & HITTEST_MASK_FILL || mask & HITTEST_MASK_STROKE) {
if (hitTestFlags & SVG_HIT_TEST_FILL || hitTestFlags & SVG_HIT_TEST_STROKE) {
isHit = context->PointInFill(userSpacePoint);
}

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

@ -91,7 +91,7 @@ public:
// nsSVGPathGeometryFrame methods:
NS_IMETHOD UpdateCoveredRegion();
virtual PRUint16 GetHittestMask();
virtual PRUint16 GetHitTestFlags();
// nsIFrame interface:
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
@ -460,9 +460,9 @@ nsSVGImageFrame::UpdateCoveredRegion()
}
PRUint16
nsSVGImageFrame::GetHittestMask()
nsSVGImageFrame::GetHitTestFlags()
{
PRUint16 mask = 0;
PRUint16 flags = 0;
switch(GetStyleVisibility()->mPointerEvents) {
case NS_STYLE_POINTER_EVENTS_NONE:
@ -471,31 +471,31 @@ nsSVGImageFrame::GetHittestMask()
case NS_STYLE_POINTER_EVENTS_AUTO:
if (GetStyleVisibility()->IsVisible()) {
/* XXX: should check pixel transparency */
mask |= HITTEST_MASK_FILL;
flags |= SVG_HIT_TEST_FILL;
}
break;
case NS_STYLE_POINTER_EVENTS_VISIBLEFILL:
case NS_STYLE_POINTER_EVENTS_VISIBLESTROKE:
case NS_STYLE_POINTER_EVENTS_VISIBLE:
if (GetStyleVisibility()->IsVisible()) {
mask |= HITTEST_MASK_FILL;
flags |= SVG_HIT_TEST_FILL;
}
break;
case NS_STYLE_POINTER_EVENTS_PAINTED:
/* XXX: should check pixel transparency */
mask |= HITTEST_MASK_FILL;
flags |= SVG_HIT_TEST_FILL;
break;
case NS_STYLE_POINTER_EVENTS_FILL:
case NS_STYLE_POINTER_EVENTS_STROKE:
case NS_STYLE_POINTER_EVENTS_ALL:
mask |= HITTEST_MASK_FILL;
flags |= SVG_HIT_TEST_FILL;
break;
default:
NS_ERROR("not reached");
break;
}
return mask;
return flags;
}
//----------------------------------------------------------------------

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

@ -153,13 +153,13 @@ nsSVGPathGeometryFrame::PaintSVG(nsSVGRenderState *aContext,
NS_IMETHODIMP_(nsIFrame*)
nsSVGPathGeometryFrame::GetFrameForPoint(const nsPoint &aPoint)
{
PRUint16 fillRule, mask;
PRUint16 fillRule, hitTestFlags;
if (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) {
mask = HITTEST_MASK_FILL;
hitTestFlags = SVG_HIT_TEST_FILL;
fillRule = GetClipRule();
} else {
mask = GetHittestMask();
if (!mask || ((mask & HITTEST_MASK_CHECK_MRECT) &&
hitTestFlags = GetHitTestFlags();
if (!hitTestFlags || ((hitTestFlags & SVG_HIT_TEST_CHECK_MRECT) &&
!mRect.Contains(aPoint)))
return nsnull;
fillRule = GetStyleSVG()->mFillRule;
@ -180,9 +180,9 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const nsPoint &aPoint)
else
context->SetFillRule(gfxContext::FILL_RULE_WINDING);
if (mask & HITTEST_MASK_FILL)
if (hitTestFlags & SVG_HIT_TEST_FILL)
isHit = context->PointInFill(userSpacePoint);
if (!isHit && (mask & HITTEST_MASK_STROKE)) {
if (!isHit && (hitTestFlags & SVG_HIT_TEST_STROKE)) {
SetupCairoStrokeHitGeometry(context);
isHit = context->PointInStroke(userSpacePoint);
}