| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2014 Google, Inc. | 5 * Copyright (C) 2014 Google, Inc. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 SVGSVGElement::~SVGSVGElement() {} | 100 SVGSVGElement::~SVGSVGElement() {} |
| 101 | 101 |
| 102 float SVGSVGElement::currentScale() const { | 102 float SVGSVGElement::currentScale() const { |
| 103 if (!isConnected() || !isOutermostSVGSVGElement()) | 103 if (!isConnected() || !isOutermostSVGSVGElement()) |
| 104 return 1; | 104 return 1; |
| 105 | 105 |
| 106 return m_currentScale; | 106 return m_currentScale; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void SVGSVGElement::setCurrentScale(float scale) { | 109 void SVGSVGElement::setCurrentScale(float scale) { |
| 110 ASSERT(std::isfinite(scale)); | 110 DCHECK(std::isfinite(scale)); |
| 111 if (!isConnected() || !isOutermostSVGSVGElement()) | 111 if (!isConnected() || !isOutermostSVGSVGElement()) |
| 112 return; | 112 return; |
| 113 | 113 |
| 114 m_currentScale = scale; | 114 m_currentScale = scale; |
| 115 updateUserTransform(); | 115 updateUserTransform(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 class SVGCurrentTranslateTearOff : public SVGPointTearOff { | 118 class SVGCurrentTranslateTearOff : public SVGPointTearOff { |
| 119 public: | 119 public: |
| 120 static SVGCurrentTranslateTearOff* create(SVGSVGElement* contextElement) { | 120 static SVGCurrentTranslateTearOff* create(SVGSVGElement* contextElement) { |
| 121 return new SVGCurrentTranslateTearOff(contextElement); | 121 return new SVGCurrentTranslateTearOff(contextElement); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void commitChange() override { | 124 void commitChange() override { |
| 125 ASSERT(contextElement()); | 125 DCHECK(contextElement()); |
| 126 toSVGSVGElement(contextElement())->updateUserTransform(); | 126 toSVGSVGElement(contextElement())->updateUserTransform(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 SVGCurrentTranslateTearOff(SVGSVGElement* contextElement) | 130 SVGCurrentTranslateTearOff(SVGSVGElement* contextElement) |
| 131 : SVGPointTearOff(contextElement->m_translation, | 131 : SVGPointTearOff(contextElement->m_translation, |
| 132 contextElement, | 132 contextElement, |
| 133 PropertyIsNotAnimVal) {} | 133 PropertyIsNotAnimVal) {} |
| 134 }; | 134 }; |
| 135 | 135 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 static bool isIntersectionOrEnclosureTarget(LayoutObject* layoutObject) { | 312 static bool isIntersectionOrEnclosureTarget(LayoutObject* layoutObject) { |
| 313 return layoutObject->isSVGShape() || layoutObject->isSVGText() || | 313 return layoutObject->isSVGShape() || layoutObject->isSVGText() || |
| 314 layoutObject->isSVGImage() || isSVGUseElement(*layoutObject->node()); | 314 layoutObject->isSVGImage() || isSVGUseElement(*layoutObject->node()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 bool SVGSVGElement::checkIntersectionOrEnclosure( | 317 bool SVGSVGElement::checkIntersectionOrEnclosure( |
| 318 const SVGElement& element, | 318 const SVGElement& element, |
| 319 const FloatRect& rect, | 319 const FloatRect& rect, |
| 320 GeometryMatchingMode mode) const { | 320 GeometryMatchingMode mode) const { |
| 321 LayoutObject* layoutObject = element.layoutObject(); | 321 LayoutObject* layoutObject = element.layoutObject(); |
| 322 ASSERT(!layoutObject || layoutObject->style()); | 322 DCHECK(!layoutObject || layoutObject->style()); |
| 323 if (!layoutObject || | 323 if (!layoutObject || |
| 324 layoutObject->style()->pointerEvents() == EPointerEvents::kNone) | 324 layoutObject->style()->pointerEvents() == EPointerEvents::kNone) |
| 325 return false; | 325 return false; |
| 326 | 326 |
| 327 if (!isIntersectionOrEnclosureTarget(layoutObject)) | 327 if (!isIntersectionOrEnclosureTarget(layoutObject)) |
| 328 return false; | 328 return false; |
| 329 | 329 |
| 330 AffineTransform ctm = toSVGGraphicsElement(element).computeCTM( | 330 AffineTransform ctm = toSVGGraphicsElement(element).computeCTM( |
| 331 AncestorScope, DisallowStyleUpdate, this); | 331 AncestorScope, DisallowStyleUpdate, this); |
| 332 FloatRect mappedRepaintRect = | 332 FloatRect mappedRepaintRect = |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 SVGRectTearOff* rect, | 387 SVGRectTearOff* rect, |
| 388 SVGElement* referenceElement) const { | 388 SVGElement* referenceElement) const { |
| 389 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 389 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 390 | 390 |
| 391 return collectIntersectionOrEnclosureList(rect->target()->value(), | 391 return collectIntersectionOrEnclosureList(rect->target()->value(), |
| 392 referenceElement, CheckEnclosure); | 392 referenceElement, CheckEnclosure); |
| 393 } | 393 } |
| 394 | 394 |
| 395 bool SVGSVGElement::checkIntersection(SVGElement* element, | 395 bool SVGSVGElement::checkIntersection(SVGElement* element, |
| 396 SVGRectTearOff* rect) const { | 396 SVGRectTearOff* rect) const { |
| 397 ASSERT(element); | 397 DCHECK(element); |
| 398 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 398 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 399 | 399 |
| 400 return checkIntersectionOrEnclosure(*element, rect->target()->value(), | 400 return checkIntersectionOrEnclosure(*element, rect->target()->value(), |
| 401 CheckIntersection); | 401 CheckIntersection); |
| 402 } | 402 } |
| 403 | 403 |
| 404 bool SVGSVGElement::checkEnclosure(SVGElement* element, | 404 bool SVGSVGElement::checkEnclosure(SVGElement* element, |
| 405 SVGRectTearOff* rect) const { | 405 SVGRectTearOff* rect) const { |
| 406 ASSERT(element); | 406 DCHECK(element); |
| 407 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 407 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 408 | 408 |
| 409 return checkIntersectionOrEnclosure(*element, rect->target()->value(), | 409 return checkIntersectionOrEnclosure(*element, rect->target()->value(), |
| 410 CheckEnclosure); | 410 CheckEnclosure); |
| 411 } | 411 } |
| 412 | 412 |
| 413 void SVGSVGElement::deselectAll() { | 413 void SVGSVGElement::deselectAll() { |
| 414 if (LocalFrame* frame = document().frame()) | 414 if (LocalFrame* frame = document().frame()) |
| 415 frame->selection().clear(); | 415 frame->selection().clear(); |
| 416 } | 416 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 528 |
| 529 bool SVGSVGElement::animationsPaused() const { | 529 bool SVGSVGElement::animationsPaused() const { |
| 530 return m_timeContainer->isPaused(); | 530 return m_timeContainer->isPaused(); |
| 531 } | 531 } |
| 532 | 532 |
| 533 float SVGSVGElement::getCurrentTime() const { | 533 float SVGSVGElement::getCurrentTime() const { |
| 534 return clampTo<float>(m_timeContainer->elapsed()); | 534 return clampTo<float>(m_timeContainer->elapsed()); |
| 535 } | 535 } |
| 536 | 536 |
| 537 void SVGSVGElement::setCurrentTime(float seconds) { | 537 void SVGSVGElement::setCurrentTime(float seconds) { |
| 538 ASSERT(std::isfinite(seconds)); | 538 DCHECK(std::isfinite(seconds)); |
| 539 seconds = max(seconds, 0.0f); | 539 seconds = max(seconds, 0.0f); |
| 540 m_timeContainer->setElapsed(seconds); | 540 m_timeContainer->setElapsed(seconds); |
| 541 } | 541 } |
| 542 | 542 |
| 543 bool SVGSVGElement::selfHasRelativeLengths() const { | 543 bool SVGSVGElement::selfHasRelativeLengths() const { |
| 544 return m_x->currentValue()->isRelative() || | 544 return m_x->currentValue()->isRelative() || |
| 545 m_y->currentValue()->isRelative() || | 545 m_y->currentValue()->isRelative() || |
| 546 m_width->currentValue()->isRelative() || | 546 m_width->currentValue()->isRelative() || |
| 547 m_height->currentValue()->isRelative(); | 547 m_height->currentValue()->isRelative(); |
| 548 } | 548 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 visitor->trace(m_width); | 724 visitor->trace(m_width); |
| 725 visitor->trace(m_height); | 725 visitor->trace(m_height); |
| 726 visitor->trace(m_translation); | 726 visitor->trace(m_translation); |
| 727 visitor->trace(m_timeContainer); | 727 visitor->trace(m_timeContainer); |
| 728 visitor->trace(m_viewSpec); | 728 visitor->trace(m_viewSpec); |
| 729 SVGGraphicsElement::trace(visitor); | 729 SVGGraphicsElement::trace(visitor); |
| 730 SVGFitToViewBox::trace(visitor); | 730 SVGFitToViewBox::trace(visitor); |
| 731 } | 731 } |
| 732 | 732 |
| 733 } // namespace blink | 733 } // namespace blink |
| OLD | NEW |