зеркало из https://github.com/mozilla/gecko-dev.git
Bug 347374 - pointer events not working on unpainted geometry, events
not respecting fill rule or dasharray. r+sr=roc
This commit is contained in:
Родитель
308c11720f
Коммит
59eacee13b
|
@ -380,10 +380,8 @@ nsSVGGeometryFrame::SetupCairoStrokeGeometry(cairo_t *aCtx)
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGGeometryFrame::SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
||||
cairo_t *aCtx,
|
||||
void **aClosure)
|
||||
void
|
||||
nsSVGGeometryFrame::SetupCairoStrokeHitGeometry(cairo_t *aCtx)
|
||||
{
|
||||
SetupCairoStrokeGeometry(aCtx);
|
||||
|
||||
|
@ -394,6 +392,14 @@ nsSVGGeometryFrame::SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
|||
cairo_set_dash(aCtx, dashArray, count, GetStrokeDashoffset());
|
||||
delete [] dashArray;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGGeometryFrame::SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
||||
cairo_t *aCtx,
|
||||
void **aClosure)
|
||||
{
|
||||
SetupCairoStrokeHitGeometry(aCtx);
|
||||
|
||||
if (GetStateBits() & NS_STATE_SVG_STROKE_PSERVER) {
|
||||
nsSVGPaintServerFrame *ps = NS_STATIC_CAST(nsSVGPaintServerFrame*,
|
||||
|
|
|
@ -96,6 +96,9 @@ public:
|
|||
// Set up a cairo context for measuring a stroked path
|
||||
void SetupCairoStrokeGeometry(cairo_t *aCtx);
|
||||
|
||||
// Set up a cairo context for hit testing a stroked path
|
||||
void SetupCairoStrokeHitGeometry(cairo_t *aCtx);
|
||||
|
||||
// Setup/Cleanup a cairo context for stroking path
|
||||
nsresult SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
||||
cairo_t *aCtx,
|
||||
|
|
|
@ -339,17 +339,23 @@ nsSVGPathGeometryFrame::GetFrameForPointSVG(float x, float y, nsIFrame** hit)
|
|||
double xx = x, yy = y;
|
||||
cairo_device_to_user(ctx, &xx, &yy);
|
||||
|
||||
if (IsClipChild()) {
|
||||
if (GetClipRule() == NS_STYLE_FILL_RULE_EVENODD)
|
||||
PRUint32 fillRule;
|
||||
if (IsClipChild())
|
||||
fillRule = GetClipRule();
|
||||
else
|
||||
fillRule = GetStyleSVG()->mFillRule;
|
||||
|
||||
if (fillRule == NS_STYLE_FILL_RULE_EVENODD)
|
||||
cairo_set_fill_rule(ctx, CAIRO_FILL_RULE_EVEN_ODD);
|
||||
else
|
||||
cairo_set_fill_rule(ctx, CAIRO_FILL_RULE_WINDING);
|
||||
}
|
||||
|
||||
if (mask & HITTEST_MASK_FILL)
|
||||
isHit = cairo_in_fill(ctx, xx, yy);
|
||||
if (!isHit && (mask & HITTEST_MASK_STROKE))
|
||||
if (!isHit && (mask & HITTEST_MASK_STROKE)) {
|
||||
SetupCairoStrokeHitGeometry(ctx);
|
||||
isHit = cairo_in_stroke(ctx, xx, yy);
|
||||
}
|
||||
|
||||
cairo_destroy(ctx);
|
||||
|
||||
|
@ -417,30 +423,22 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
|
|||
{
|
||||
mRect.Empty();
|
||||
|
||||
PRBool hasFill = HasFill();
|
||||
PRBool hasStroke = HasStroke();
|
||||
|
||||
if (hasFill || hasStroke) {
|
||||
cairo_t *ctx = cairo_create(nsSVGUtils::GetCairoComputationalSurface());
|
||||
|
||||
GeneratePath(ctx, nsnull);
|
||||
|
||||
double xmin, ymin, xmax, ymax;
|
||||
|
||||
if (hasStroke) {
|
||||
SetupCairoStrokeGeometry(ctx);
|
||||
cairo_stroke_extents(ctx, &xmin, &ymin, &xmax, &ymax);
|
||||
} else
|
||||
cairo_fill_extents(ctx, &xmin, &ymin, &xmax, &ymax);
|
||||
|
||||
if (!IsDegeneratePath(xmin, ymin, xmax, ymax)) {
|
||||
cairo_user_to_device(ctx, &xmin, &ymin);
|
||||
cairo_user_to_device(ctx, &xmax, &ymax);
|
||||
|
||||
mRect = nsSVGUtils::ToBoundingPixelRect(xmin, ymin, xmax, ymax);
|
||||
}
|
||||
|
||||
cairo_destroy(ctx);
|
||||
}
|
||||
|
||||
// Add in markers
|
||||
mRect = GetCoveredRegion();
|
||||
|
|
Загрузка…
Ссылка в новой задаче