OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
6 * Copyright (C) 2012 University of Szeged | 6 * Copyright (C) 2012 University of Szeged |
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 || isSVGEllipseElement(element) | 475 || isSVGEllipseElement(element) |
476 || isSVGPolygonElement(element) | 476 || isSVGPolygonElement(element) |
477 || isSVGPolylineElement(element) | 477 || isSVGPolylineElement(element) |
478 || isSVGTextElement(element); | 478 || isSVGTextElement(element); |
479 } | 479 } |
480 | 480 |
481 void SVGUseElement::toClipPath(Path& path) const | 481 void SVGUseElement::toClipPath(Path& path) const |
482 { | 482 { |
483 ASSERT(path.isEmpty()); | 483 ASSERT(path.isEmpty()); |
484 | 484 |
485 const SVGGraphicsElement* element = targetGraphicsElementForClipping(); | 485 const SVGGraphicsElement* element = visibleTargetGraphicsElementForClipping(
); |
486 | 486 |
487 if (!element || !element->layoutObject()) | 487 if (!element) |
488 return; | 488 return; |
489 | 489 |
490 if (element->isSVGGeometryElement()) { | 490 if (element->isSVGGeometryElement()) { |
491 toSVGGeometryElement(*element).toClipPath(path); | 491 toSVGGeometryElement(*element).toClipPath(path); |
492 // FIXME: Avoid manual resolution of x/y here. Its potentially harmful. | 492 // FIXME: Avoid manual resolution of x/y here. Its potentially harmful. |
493 SVGLengthContext lengthContext(this); | 493 SVGLengthContext lengthContext(this); |
494 path.translate(FloatSize(m_x->currentValue()->value(lengthContext), m_y-
>currentValue()->value(lengthContext))); | 494 path.translate(FloatSize(m_x->currentValue()->value(lengthContext), m_y-
>currentValue()->value(lengthContext))); |
495 path.transform(calculateAnimatedLocalTransform()); | 495 path.transform(calculateAnimatedLocalTransform()); |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const | 499 SVGGraphicsElement* SVGUseElement::visibleTargetGraphicsElementForClipping() con
st |
500 { | 500 { |
501 Node* n = userAgentShadowRoot()->firstChild(); | 501 Node* n = userAgentShadowRoot()->firstChild(); |
502 if (!n || !n->isSVGElement()) | 502 if (!n || !n->isSVGElement()) |
503 return nullptr; | 503 return nullptr; |
504 | 504 |
505 SVGElement& element = toSVGElement(*n); | 505 SVGElement& element = toSVGElement(*n); |
506 | 506 |
507 if (!element.isSVGGraphicsElement()) | 507 if (!element.isSVGGraphicsElement()) |
508 return nullptr; | 508 return nullptr; |
509 | 509 |
| 510 if (!element.layoutObject()) |
| 511 return nullptr; |
| 512 |
| 513 const ComputedStyle* style = element.layoutObject()->style(); |
| 514 if (!style || style->visibility() != VISIBLE) |
| 515 return nullptr; |
| 516 |
510 // Spec: "If a <use> element is a child of a clipPath element, it must direc
tly | 517 // Spec: "If a <use> element is a child of a clipPath element, it must direc
tly |
511 // reference <path>, <text> or basic shapes elements. Indirect references ar
e an | 518 // reference <path>, <text> or basic shapes elements. Indirect references ar
e an |
512 // error and the clipPath element must be ignored." | 519 // error and the clipPath element must be ignored." |
513 // http://dev.w3.org/fxtf/css-masking-1/#the-clip-path | 520 // http://dev.w3.org/fxtf/css-masking-1/#the-clip-path |
514 if (!isDirectReference(element)) { | 521 if (!isDirectReference(element)) { |
515 // Spec: Indirect references are an error (14.3.5) | 522 // Spec: Indirect references are an error (14.3.5) |
516 document().accessSVGExtensions().reportError("Not allowed to use indirec
t reference in <clip-path>"); | |
517 return nullptr; | 523 return nullptr; |
518 } | 524 } |
519 | 525 |
520 return &toSVGGraphicsElement(element); | 526 return &toSVGGraphicsElement(element); |
521 } | 527 } |
522 | 528 |
523 void SVGUseElement::addReferencesToFirstDegreeNestedUseElements(SVGElement& targ
et) | 529 void SVGUseElement::addReferencesToFirstDegreeNestedUseElements(SVGElement& targ
et) |
524 { | 530 { |
525 // Don't track references to external documents. | 531 // Don't track references to external documents. |
526 if (isStructurallyExternal()) | 532 if (isStructurallyExternal()) |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 748 |
743 if (m_resource) | 749 if (m_resource) |
744 m_resource->removeClient(this); | 750 m_resource->removeClient(this); |
745 | 751 |
746 m_resource = resource; | 752 m_resource = resource; |
747 if (m_resource) | 753 if (m_resource) |
748 m_resource->addClient(this); | 754 m_resource->addClient(this); |
749 } | 755 } |
750 | 756 |
751 } // namespace blink | 757 } // namespace blink |
OLD | NEW |