зеркало из 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
|
void
|
||||||
nsSVGGeometryFrame::SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
nsSVGGeometryFrame::SetupCairoStrokeHitGeometry(cairo_t *aCtx)
|
||||||
cairo_t *aCtx,
|
|
||||||
void **aClosure)
|
|
||||||
{
|
{
|
||||||
SetupCairoStrokeGeometry(aCtx);
|
SetupCairoStrokeGeometry(aCtx);
|
||||||
|
|
||||||
|
@ -394,6 +392,14 @@ nsSVGGeometryFrame::SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
||||||
cairo_set_dash(aCtx, dashArray, count, GetStrokeDashoffset());
|
cairo_set_dash(aCtx, dashArray, count, GetStrokeDashoffset());
|
||||||
delete [] dashArray;
|
delete [] dashArray;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsSVGGeometryFrame::SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
||||||
|
cairo_t *aCtx,
|
||||||
|
void **aClosure)
|
||||||
|
{
|
||||||
|
SetupCairoStrokeHitGeometry(aCtx);
|
||||||
|
|
||||||
if (GetStateBits() & NS_STATE_SVG_STROKE_PSERVER) {
|
if (GetStateBits() & NS_STATE_SVG_STROKE_PSERVER) {
|
||||||
nsSVGPaintServerFrame *ps = NS_STATIC_CAST(nsSVGPaintServerFrame*,
|
nsSVGPaintServerFrame *ps = NS_STATIC_CAST(nsSVGPaintServerFrame*,
|
||||||
|
|
|
@ -96,6 +96,9 @@ public:
|
||||||
// Set up a cairo context for measuring a stroked path
|
// Set up a cairo context for measuring a stroked path
|
||||||
void SetupCairoStrokeGeometry(cairo_t *aCtx);
|
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
|
// Setup/Cleanup a cairo context for stroking path
|
||||||
nsresult SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
nsresult SetupCairoStroke(nsISVGRendererCanvas *aCanvas,
|
||||||
cairo_t *aCtx,
|
cairo_t *aCtx,
|
||||||
|
|
|
@ -339,17 +339,23 @@ nsSVGPathGeometryFrame::GetFrameForPointSVG(float x, float y, nsIFrame** hit)
|
||||||
double xx = x, yy = y;
|
double xx = x, yy = y;
|
||||||
cairo_device_to_user(ctx, &xx, &yy);
|
cairo_device_to_user(ctx, &xx, &yy);
|
||||||
|
|
||||||
if (IsClipChild()) {
|
PRUint32 fillRule;
|
||||||
if (GetClipRule() == NS_STYLE_FILL_RULE_EVENODD)
|
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);
|
cairo_set_fill_rule(ctx, CAIRO_FILL_RULE_EVEN_ODD);
|
||||||
else
|
else
|
||||||
cairo_set_fill_rule(ctx, CAIRO_FILL_RULE_WINDING);
|
cairo_set_fill_rule(ctx, CAIRO_FILL_RULE_WINDING);
|
||||||
}
|
|
||||||
|
|
||||||
if (mask & HITTEST_MASK_FILL)
|
if (mask & HITTEST_MASK_FILL)
|
||||||
isHit = cairo_in_fill(ctx, xx, yy);
|
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);
|
isHit = cairo_in_stroke(ctx, xx, yy);
|
||||||
|
}
|
||||||
|
|
||||||
cairo_destroy(ctx);
|
cairo_destroy(ctx);
|
||||||
|
|
||||||
|
@ -417,30 +423,22 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
|
||||||
{
|
{
|
||||||
mRect.Empty();
|
mRect.Empty();
|
||||||
|
|
||||||
PRBool hasFill = HasFill();
|
|
||||||
PRBool hasStroke = HasStroke();
|
|
||||||
|
|
||||||
if (hasFill || hasStroke) {
|
|
||||||
cairo_t *ctx = cairo_create(nsSVGUtils::GetCairoComputationalSurface());
|
cairo_t *ctx = cairo_create(nsSVGUtils::GetCairoComputationalSurface());
|
||||||
|
|
||||||
GeneratePath(ctx, nsnull);
|
GeneratePath(ctx, nsnull);
|
||||||
|
|
||||||
double xmin, ymin, xmax, ymax;
|
double xmin, ymin, xmax, ymax;
|
||||||
|
|
||||||
if (hasStroke) {
|
|
||||||
SetupCairoStrokeGeometry(ctx);
|
SetupCairoStrokeGeometry(ctx);
|
||||||
cairo_stroke_extents(ctx, &xmin, &ymin, &xmax, &ymax);
|
cairo_stroke_extents(ctx, &xmin, &ymin, &xmax, &ymax);
|
||||||
} else
|
|
||||||
cairo_fill_extents(ctx, &xmin, &ymin, &xmax, &ymax);
|
|
||||||
|
|
||||||
if (!IsDegeneratePath(xmin, ymin, xmax, ymax)) {
|
if (!IsDegeneratePath(xmin, ymin, xmax, ymax)) {
|
||||||
cairo_user_to_device(ctx, &xmin, &ymin);
|
cairo_user_to_device(ctx, &xmin, &ymin);
|
||||||
cairo_user_to_device(ctx, &xmax, &ymax);
|
cairo_user_to_device(ctx, &xmax, &ymax);
|
||||||
|
|
||||||
mRect = nsSVGUtils::ToBoundingPixelRect(xmin, ymin, xmax, ymax);
|
mRect = nsSVGUtils::ToBoundingPixelRect(xmin, ymin, xmax, ymax);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_destroy(ctx);
|
cairo_destroy(ctx);
|
||||||
}
|
|
||||||
|
|
||||||
// Add in markers
|
// Add in markers
|
||||||
mRect = GetCoveredRegion();
|
mRect = GetCoveredRegion();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче