| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 2 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, | 42 SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, |
| 43 Document& document, | 43 Document& document, |
| 44 ConstructionType constructionType) | 44 ConstructionType constructionType) |
| 45 : SVGGraphicsElement(tagName, document, constructionType) {} | 45 : SVGGraphicsElement(tagName, document, constructionType) {} |
| 46 | 46 |
| 47 bool SVGGeometryElement::isPointInFill(SVGPointTearOff* point) const { | 47 bool SVGGeometryElement::isPointInFill(SVGPointTearOff* point) const { |
| 48 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 48 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 49 | 49 |
| 50 // FIXME: Eventually we should support isPointInFill for display:none elements
. | 50 // FIXME: Eventually we should support isPointInFill for display:none |
| 51 // elements. |
| 51 if (!layoutObject() || !layoutObject()->isSVGShape()) | 52 if (!layoutObject() || !layoutObject()->isSVGShape()) |
| 52 return false; | 53 return false; |
| 53 | 54 |
| 54 HitTestRequest request(HitTestRequest::ReadOnly); | 55 HitTestRequest request(HitTestRequest::ReadOnly); |
| 55 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, | 56 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, |
| 56 request, | 57 request, |
| 57 layoutObject()->style()->pointerEvents()); | 58 layoutObject()->style()->pointerEvents()); |
| 58 hitRules.canHitStroke = false; | 59 hitRules.canHitStroke = false; |
| 59 return toLayoutSVGShape(layoutObject()) | 60 return toLayoutSVGShape(layoutObject()) |
| 60 ->nodeAtFloatPointInternal(request, point->target()->value(), hitRules); | 61 ->nodeAtFloatPointInternal(request, point->target()->value(), hitRules); |
| 61 } | 62 } |
| 62 | 63 |
| 63 bool SVGGeometryElement::isPointInStroke(SVGPointTearOff* point) const { | 64 bool SVGGeometryElement::isPointInStroke(SVGPointTearOff* point) const { |
| 64 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 65 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 65 | 66 |
| 66 // FIXME: Eventually we should support isPointInStroke for display:none elemen
ts. | 67 // FIXME: Eventually we should support isPointInStroke for display:none |
| 68 // elements. |
| 67 if (!layoutObject() || !layoutObject()->isSVGShape()) | 69 if (!layoutObject() || !layoutObject()->isSVGShape()) |
| 68 return false; | 70 return false; |
| 69 | 71 |
| 70 HitTestRequest request(HitTestRequest::ReadOnly); | 72 HitTestRequest request(HitTestRequest::ReadOnly); |
| 71 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, | 73 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, |
| 72 request, | 74 request, |
| 73 layoutObject()->style()->pointerEvents()); | 75 layoutObject()->style()->pointerEvents()); |
| 74 hitRules.canHitFill = false; | 76 hitRules.canHitFill = false; |
| 75 return toLayoutSVGShape(layoutObject()) | 77 return toLayoutSVGShape(layoutObject()) |
| 76 ->nodeAtFloatPointInternal(request, point->target()->value(), hitRules); | 78 ->nodeAtFloatPointInternal(request, point->target()->value(), hitRules); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void SVGGeometryElement::toClipPath(Path& path) const { | 81 void SVGGeometryElement::toClipPath(Path& path) const { |
| 80 path = asPath(); | 82 path = asPath(); |
| 81 path.transform(calculateAnimatedLocalTransform()); | 83 path.transform(calculateAnimatedLocalTransform()); |
| 82 | 84 |
| 83 ASSERT(layoutObject()); | 85 ASSERT(layoutObject()); |
| 84 ASSERT(layoutObject()->style()); | 86 ASSERT(layoutObject()->style()); |
| 85 path.setWindRule(layoutObject()->style()->svgStyle().clipRule()); | 87 path.setWindRule(layoutObject()->style()->svgStyle().clipRule()); |
| 86 } | 88 } |
| 87 | 89 |
| 88 LayoutObject* SVGGeometryElement::createLayoutObject(const ComputedStyle&) { | 90 LayoutObject* SVGGeometryElement::createLayoutObject(const ComputedStyle&) { |
| 89 // By default, any subclass is expected to do path-based drawing. | 91 // By default, any subclass is expected to do path-based drawing. |
| 90 return new LayoutSVGPath(this); | 92 return new LayoutSVGPath(this); |
| 91 } | 93 } |
| 92 | 94 |
| 93 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |