Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGSVGElement.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // There are cases where removedFromDocument() is not called. 91 // There are cases where removedFromDocument() is not called.
92 // see ContainerNode::removeAllChildren, called by its destructor. 92 // see ContainerNode::removeAllChildren, called by its destructor.
93 // With Oilpan, either removedFrom is called or the document 93 // With Oilpan, either removedFrom is called or the document
94 // is dead as well and there is no reason to clear the extensions. 94 // is dead as well and there is no reason to clear the extensions.
95 document().accessSVGExtensions().removeTimeContainer(this); 95 document().accessSVGExtensions().removeTimeContainer(this);
96 96
97 ASSERT(inDocument() || !accessDocumentSVGExtensions().isSVGRootWithRelativeL engthDescendents(this)); 97 ASSERT(inDocument() || !accessDocumentSVGExtensions().isSVGRootWithRelativeL engthDescendents(this));
98 #endif 98 #endif
99 } 99 }
100 100
101 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGSVGElement::viewport() const 101 RawPtr<SVGRectTearOff> SVGSVGElement::viewport() const
102 { 102 {
103 // FIXME: This method doesn't follow the spec and is basically untested. Par ent documents are not considered here. 103 // FIXME: This method doesn't follow the spec and is basically untested. Par ent documents are not considered here.
104 // As we have no test coverage for this, we're going to disable it completly for now. 104 // As we have no test coverage for this, we're going to disable it completly for now.
105 return SVGRectTearOff::create(SVGRect::create(), 0, PropertyIsNotAnimVal); 105 return SVGRectTearOff::create(SVGRect::create(), 0, PropertyIsNotAnimVal);
106 } 106 }
107 107
108 SVGViewSpec* SVGSVGElement::currentView() 108 SVGViewSpec* SVGSVGElement::currentView()
109 { 109 {
110 if (!m_viewSpec) 110 if (!m_viewSpec)
111 m_viewSpec = SVGViewSpec::create(this); 111 m_viewSpec = SVGViewSpec::create(this);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // We choose the ignore this call, it's pretty useless to support calling se tCurrentScale() from within 145 // We choose the ignore this call, it's pretty useless to support calling se tCurrentScale() from within
146 // an embedded SVG document, for the same reasons as in currentScale() - nee ds resolution by SVG WG. 146 // an embedded SVG document, for the same reasons as in currentScale() - nee ds resolution by SVG WG.
147 if (frameTree.parent()) 147 if (frameTree.parent())
148 return; 148 return;
149 149
150 frame->setPageZoomFactor(scale); 150 frame->setPageZoomFactor(scale);
151 } 151 }
152 152
153 class SVGCurrentTranslateTearOff : public SVGPointTearOff { 153 class SVGCurrentTranslateTearOff : public SVGPointTearOff {
154 public: 154 public:
155 static PassRefPtrWillBeRawPtr<SVGCurrentTranslateTearOff> create(SVGSVGEleme nt* contextElement) 155 static RawPtr<SVGCurrentTranslateTearOff> create(SVGSVGElement* contextEleme nt)
156 { 156 {
157 return adoptRefWillBeNoop(new SVGCurrentTranslateTearOff(contextElement) ); 157 return (new SVGCurrentTranslateTearOff(contextElement));
158 } 158 }
159 159
160 void commitChange() override 160 void commitChange() override
161 { 161 {
162 ASSERT(contextElement()); 162 ASSERT(contextElement());
163 toSVGSVGElement(contextElement())->updateCurrentTranslate(); 163 toSVGSVGElement(contextElement())->updateCurrentTranslate();
164 } 164 }
165 165
166 private: 166 private:
167 SVGCurrentTranslateTearOff(SVGSVGElement* contextElement) 167 SVGCurrentTranslateTearOff(SVGSVGElement* contextElement)
168 : SVGPointTearOff(contextElement->m_translation, contextElement, Propert yIsNotAnimVal) 168 : SVGPointTearOff(contextElement->m_translation, contextElement, Propert yIsNotAnimVal)
169 { 169 {
170 } 170 }
171 }; 171 };
172 172
173 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGSVGElement::currentTranslateFromJavas cript() 173 RawPtr<SVGPointTearOff> SVGSVGElement::currentTranslateFromJavascript()
174 { 174 {
175 return SVGCurrentTranslateTearOff::create(this); 175 return SVGCurrentTranslateTearOff::create(this);
176 } 176 }
177 177
178 void SVGSVGElement::setCurrentTranslate(const FloatPoint& point) 178 void SVGSVGElement::setCurrentTranslate(const FloatPoint& point)
179 { 179 {
180 m_translation->setValue(point); 180 m_translation->setValue(point);
181 updateCurrentTranslate(); 181 updateCurrentTranslate();
182 } 182 }
183 183
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 result = rect.contains(mappedRepaintRect); 348 result = rect.contains(mappedRepaintRect);
349 break; 349 break;
350 default: 350 default:
351 ASSERT_NOT_REACHED(); 351 ASSERT_NOT_REACHED();
352 break; 352 break;
353 } 353 }
354 354
355 return result; 355 return result;
356 } 356 }
357 357
358 PassRefPtrWillBeRawPtr<StaticNodeList> SVGSVGElement::collectIntersectionOrEnclo sureList(const FloatRect& rect, 358 RawPtr<StaticNodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const F loatRect& rect,
359 SVGElement* referenceElement, CheckIntersectionOrEnclosure mode) const 359 SVGElement* referenceElement, CheckIntersectionOrEnclosure mode) const
360 { 360 {
361 WillBeHeapVector<RefPtrWillBeMember<Node>> nodes; 361 HeapVector<Member<Node>> nodes;
362 362
363 const SVGElement* root = this; 363 const SVGElement* root = this;
364 if (referenceElement) { 364 if (referenceElement) {
365 // Only the common subtree needs to be traversed. 365 // Only the common subtree needs to be traversed.
366 if (contains(referenceElement)) { 366 if (contains(referenceElement)) {
367 root = referenceElement; 367 root = referenceElement;
368 } else if (!isDescendantOf(referenceElement)) { 368 } else if (!isDescendantOf(referenceElement)) {
369 // No common subtree. 369 // No common subtree.
370 return StaticNodeList::adopt(nodes); 370 return StaticNodeList::adopt(nodes);
371 } 371 }
372 } 372 }
373 373
374 for (SVGGraphicsElement& element : Traversal<SVGGraphicsElement>::descendant sOf(*root)) { 374 for (SVGGraphicsElement& element : Traversal<SVGGraphicsElement>::descendant sOf(*root)) {
375 if (checkIntersectionOrEnclosure(element, rect, mode)) 375 if (checkIntersectionOrEnclosure(element, rect, mode))
376 nodes.append(&element); 376 nodes.append(&element);
377 } 377 }
378 378
379 return StaticNodeList::adopt(nodes); 379 return StaticNodeList::adopt(nodes);
380 } 380 }
381 381
382 PassRefPtrWillBeRawPtr<StaticNodeList> SVGSVGElement::getIntersectionList(PassRe fPtrWillBeRawPtr<SVGRectTearOff> rect, SVGElement* referenceElement) const 382 RawPtr<StaticNodeList> SVGSVGElement::getIntersectionList(RawPtr<SVGRectTearOff> rect, SVGElement* referenceElement) const
383 { 383 {
384 document().updateLayoutIgnorePendingStylesheets(); 384 document().updateLayoutIgnorePendingStylesheets();
385 385
386 return collectIntersectionOrEnclosureList(rect->target()->value(), reference Element, CheckIntersection); 386 return collectIntersectionOrEnclosureList(rect->target()->value(), reference Element, CheckIntersection);
387 } 387 }
388 388
389 PassRefPtrWillBeRawPtr<StaticNodeList> SVGSVGElement::getEnclosureList(PassRefPt rWillBeRawPtr<SVGRectTearOff> rect, SVGElement* referenceElement) const 389 RawPtr<StaticNodeList> SVGSVGElement::getEnclosureList(RawPtr<SVGRectTearOff> re ct, SVGElement* referenceElement) const
390 { 390 {
391 document().updateLayoutIgnorePendingStylesheets(); 391 document().updateLayoutIgnorePendingStylesheets();
392 392
393 return collectIntersectionOrEnclosureList(rect->target()->value(), reference Element, CheckEnclosure); 393 return collectIntersectionOrEnclosureList(rect->target()->value(), reference Element, CheckEnclosure);
394 } 394 }
395 395
396 bool SVGSVGElement::checkIntersection(SVGElement* element, PassRefPtrWillBeRawPt r<SVGRectTearOff> rect) const 396 bool SVGSVGElement::checkIntersection(SVGElement* element, RawPtr<SVGRectTearOff > rect) const
397 { 397 {
398 ASSERT(element); 398 ASSERT(element);
399 document().updateLayoutIgnorePendingStylesheets(); 399 document().updateLayoutIgnorePendingStylesheets();
400 400
401 return checkIntersectionOrEnclosure(*element, rect->target()->value(), Check Intersection); 401 return checkIntersectionOrEnclosure(*element, rect->target()->value(), Check Intersection);
402 } 402 }
403 403
404 bool SVGSVGElement::checkEnclosure(SVGElement* element, PassRefPtrWillBeRawPtr<S VGRectTearOff> rect) const 404 bool SVGSVGElement::checkEnclosure(SVGElement* element, RawPtr<SVGRectTearOff> r ect) const
405 { 405 {
406 ASSERT(element); 406 ASSERT(element);
407 document().updateLayoutIgnorePendingStylesheets(); 407 document().updateLayoutIgnorePendingStylesheets();
408 408
409 return checkIntersectionOrEnclosure(*element, rect->target()->value(), Check Enclosure); 409 return checkIntersectionOrEnclosure(*element, rect->target()->value(), Check Enclosure);
410 } 410 }
411 411
412 void SVGSVGElement::deselectAll() 412 void SVGSVGElement::deselectAll()
413 { 413 {
414 if (LocalFrame* frame = document().frame()) 414 if (LocalFrame* frame = document().frame())
415 frame->selection().clear(); 415 frame->selection().clear();
416 } 416 }
417 417
418 PassRefPtrWillBeRawPtr<SVGNumberTearOff> SVGSVGElement::createSVGNumber() 418 RawPtr<SVGNumberTearOff> SVGSVGElement::createSVGNumber()
419 { 419 {
420 return SVGNumberTearOff::create(SVGNumber::create(0.0f), 0, PropertyIsNotAni mVal); 420 return SVGNumberTearOff::create(SVGNumber::create(0.0f), 0, PropertyIsNotAni mVal);
421 } 421 }
422 422
423 PassRefPtrWillBeRawPtr<SVGLengthTearOff> SVGSVGElement::createSVGLength() 423 RawPtr<SVGLengthTearOff> SVGSVGElement::createSVGLength()
424 { 424 {
425 return SVGLengthTearOff::create(SVGLength::create(), 0, PropertyIsNotAnimVal ); 425 return SVGLengthTearOff::create(SVGLength::create(), 0, PropertyIsNotAnimVal );
426 } 426 }
427 427
428 PassRefPtrWillBeRawPtr<SVGAngleTearOff> SVGSVGElement::createSVGAngle() 428 RawPtr<SVGAngleTearOff> SVGSVGElement::createSVGAngle()
429 { 429 {
430 return SVGAngleTearOff::create(SVGAngle::create(), 0, PropertyIsNotAnimVal); 430 return SVGAngleTearOff::create(SVGAngle::create(), 0, PropertyIsNotAnimVal);
431 } 431 }
432 432
433 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGSVGElement::createSVGPoint() 433 RawPtr<SVGPointTearOff> SVGSVGElement::createSVGPoint()
434 { 434 {
435 return SVGPointTearOff::create(SVGPoint::create(), 0, PropertyIsNotAnimVal); 435 return SVGPointTearOff::create(SVGPoint::create(), 0, PropertyIsNotAnimVal);
436 } 436 }
437 437
438 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> SVGSVGElement::createSVGMatrix() 438 RawPtr<SVGMatrixTearOff> SVGSVGElement::createSVGMatrix()
439 { 439 {
440 return SVGMatrixTearOff::create(AffineTransform()); 440 return SVGMatrixTearOff::create(AffineTransform());
441 } 441 }
442 442
443 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGSVGElement::createSVGRect() 443 RawPtr<SVGRectTearOff> SVGSVGElement::createSVGRect()
444 { 444 {
445 return SVGRectTearOff::create(SVGRect::create(), 0, PropertyIsNotAnimVal); 445 return SVGRectTearOff::create(SVGRect::create(), 0, PropertyIsNotAnimVal);
446 } 446 }
447 447
448 PassRefPtrWillBeRawPtr<SVGTransformTearOff> SVGSVGElement::createSVGTransform() 448 RawPtr<SVGTransformTearOff> SVGSVGElement::createSVGTransform()
449 { 449 {
450 return SVGTransformTearOff::create(SVGTransform::create(SVG_TRANSFORM_MATRIX ), 0, PropertyIsNotAnimVal); 450 return SVGTransformTearOff::create(SVGTransform::create(SVG_TRANSFORM_MATRIX ), 0, PropertyIsNotAnimVal);
451 } 451 }
452 452
453 PassRefPtrWillBeRawPtr<SVGTransformTearOff> SVGSVGElement::createSVGTransformFro mMatrix(PassRefPtrWillBeRawPtr<SVGMatrixTearOff> matrix) 453 RawPtr<SVGTransformTearOff> SVGSVGElement::createSVGTransformFromMatrix(RawPtr<S VGMatrixTearOff> matrix)
454 { 454 {
455 return SVGTransformTearOff::create(SVGTransform::create(matrix->value()), 0, PropertyIsNotAnimVal); 455 return SVGTransformTearOff::create(SVGTransform::create(matrix->value()), 0, PropertyIsNotAnimVal);
456 } 456 }
457 457
458 AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGElement::CTMScop e mode) const 458 AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGElement::CTMScop e mode) const
459 { 459 {
460 AffineTransform viewBoxTransform; 460 AffineTransform viewBoxTransform;
461 if (!hasEmptyViewBox()) { 461 if (!hasEmptyViewBox()) {
462 FloatSize size = currentViewportSize(); 462 FloatSize size = currentViewportSize();
463 viewBoxTransform = viewBoxToViewTransform(size.width(), size.height()); 463 viewBoxTransform = viewBoxToViewTransform(size.width(), size.height());
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 SVGLengthContext lengthContext(this); 653 SVGLengthContext lengthContext(this);
654 return Length(height()->currentValue()->value(lengthContext), Fixed); 654 return Length(height()->currentValue()->value(lengthContext), Fixed);
655 } 655 }
656 656
657 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const 657 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const
658 { 658 {
659 if (!m_useCurrentView || !m_viewSpec) 659 if (!m_useCurrentView || !m_viewSpec)
660 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight); 660 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight);
661 661
662 AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(currentViewBox Rect(), m_viewSpec->preserveAspectRatio()->currentValue(), viewWidth, viewHeight ); 662 AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(currentViewBox Rect(), m_viewSpec->preserveAspectRatio()->currentValue(), viewWidth, viewHeight );
663 RefPtrWillBeRawPtr<SVGTransformList> transformList = m_viewSpec->transform() ; 663 RawPtr<SVGTransformList> transformList = m_viewSpec->transform();
664 if (transformList->isEmpty()) 664 if (transformList->isEmpty())
665 return ctm; 665 return ctm;
666 666
667 AffineTransform transform; 667 AffineTransform transform;
668 if (transformList->concatenate(transform)) 668 if (transformList->concatenate(transform))
669 ctm *= transform; 669 ctm *= transform;
670 670
671 return ctm; 671 return ctm;
672 } 672 }
673 673
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 visitor->trace(m_width); 759 visitor->trace(m_width);
760 visitor->trace(m_height); 760 visitor->trace(m_height);
761 visitor->trace(m_translation); 761 visitor->trace(m_translation);
762 visitor->trace(m_timeContainer); 762 visitor->trace(m_timeContainer);
763 visitor->trace(m_viewSpec); 763 visitor->trace(m_viewSpec);
764 SVGGraphicsElement::trace(visitor); 764 SVGGraphicsElement::trace(visitor);
765 SVGFitToViewBox::trace(visitor); 765 SVGFitToViewBox::trace(visitor);
766 } 766 }
767 767
768 } // namespace blink 768 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698