Commit 9ae65bd6 authored by fs@opera.com's avatar fs@opera.com

Make some use of RenderSVGResourceClipper::clipPathUnits()

Review URL: https://codereview.chromium.org/570583002

git-svn-id: svn://svn.chromium.org/blink/trunk@181909 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0a267291
...@@ -129,7 +129,7 @@ bool RenderSVGResourceClipper::tryPathOnlyClipping(GraphicsContext* context, ...@@ -129,7 +129,7 @@ bool RenderSVGResourceClipper::tryPathOnlyClipping(GraphicsContext* context,
} }
} }
// Only one visible shape/path was found. Directly continue clipping and transform the content to userspace if necessary. // Only one visible shape/path was found. Directly continue clipping and transform the content to userspace if necessary.
if (toSVGClipPathElement(element())->clipPathUnits()->currentValue()->enumValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
AffineTransform transform; AffineTransform transform;
transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
...@@ -162,8 +162,7 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* target, cons ...@@ -162,8 +162,7 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* target, cons
// When drawing a clip for non-SVG elements, the CTM does not include the zoom factor. // When drawing a clip for non-SVG elements, the CTM does not include the zoom factor.
// In this case, we need to apply the zoom scale explicitly - but only for clips with // In this case, we need to apply the zoom scale explicitly - but only for clips with
// userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolved lengths). // userSpaceOnUse units (the zoom is accounted for objectBoundingBox-resolved lengths).
if (!target->isSVG() if (!target->isSVG() && clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
&& toSVGClipPathElement(element())->clipPathUnits()->currentValue()->enumValue() == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
ASSERT(style()); ASSERT(style());
animatedLocalTransform.scale(style()->effectiveZoom()); animatedLocalTransform.scale(style()->effectiveZoom());
} }
...@@ -237,8 +236,7 @@ void RenderSVGResourceClipper::drawClipMaskContent(GraphicsContext* context, con ...@@ -237,8 +236,7 @@ void RenderSVGResourceClipper::drawClipMaskContent(GraphicsContext* context, con
ASSERT(context); ASSERT(context);
AffineTransform contentTransformation; AffineTransform contentTransformation;
SVGUnitTypes::SVGUnitType contentUnits = toSVGClipPathElement(element())->clipPathUnits()->currentValue()->enumValue(); if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox.y()); contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox.y());
contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetBoundingBox.height()); contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetBoundingBox.height());
context->concatCTM(contentTransformation); context->concatCTM(contentTransformation);
...@@ -331,15 +329,14 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin ...@@ -331,15 +329,14 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
if (!SVGRenderSupport::pointInClippingArea(this, point)) if (!SVGRenderSupport::pointInClippingArea(this, point))
return false; return false;
SVGClipPathElement* clipPathElement = toSVGClipPathElement(element()); if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (clipPathElement->clipPathUnits()->currentValue()->enumValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
AffineTransform transform; AffineTransform transform;
transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
point = transform.inverse().mapPoint(point); point = transform.inverse().mapPoint(point);
} }
AffineTransform animatedLocalTransform = clipPathElement->animatedLocalTransform(); AffineTransform animatedLocalTransform = toSVGClipPathElement(element())->animatedLocalTransform();
if (!animatedLocalTransform.isInvertible()) if (!animatedLocalTransform.isInvertible())
return false; return false;
...@@ -369,7 +366,7 @@ FloatRect RenderSVGResourceClipper::resourceBoundingBox(const RenderObject* obje ...@@ -369,7 +366,7 @@ FloatRect RenderSVGResourceClipper::resourceBoundingBox(const RenderObject* obje
if (m_clipBoundaries.isEmpty()) if (m_clipBoundaries.isEmpty())
calculateClipContentPaintInvalidationRect(); calculateClipContentPaintInvalidationRect();
if (toSVGClipPathElement(element())->clipPathUnits()->currentValue()->enumValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
FloatRect objectBoundingBox = object->objectBoundingBox(); FloatRect objectBoundingBox = object->objectBoundingBox();
AffineTransform transform; AffineTransform transform;
transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment