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

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

Issue 19096011: Get rid of SVGRect special case from the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGSVGElement.h ('k') | Source/core/svg/SVGTextContentElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/css", AtomicStr ing::ConstructFromLiteral)); 124 DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/css", AtomicStr ing::ConstructFromLiteral));
125 const AtomicString& n = fastGetAttribute(SVGNames::contentStyleTypeAttr); 125 const AtomicString& n = fastGetAttribute(SVGNames::contentStyleTypeAttr);
126 return n.isNull() ? defaultValue : n; 126 return n.isNull() ? defaultValue : n;
127 } 127 }
128 128
129 void SVGSVGElement::setContentStyleType(const AtomicString& type) 129 void SVGSVGElement::setContentStyleType(const AtomicString& type)
130 { 130 {
131 setAttribute(SVGNames::contentStyleTypeAttr, type); 131 setAttribute(SVGNames::contentStyleTypeAttr, type);
132 } 132 }
133 133
134 FloatRect SVGSVGElement::viewport() const 134 SVGRect SVGSVGElement::viewport() const
135 { 135 {
136 // FIXME: This method doesn't follow the spec and is basically untested. Par ent documents are not considered here. 136 // FIXME: This method doesn't follow the spec and is basically untested. Par ent documents are not considered here.
137 // As we have no test coverage for this, we're going to disable it completly for now. 137 // As we have no test coverage for this, we're going to disable it completly for now.
138 return FloatRect(); 138 return SVGRect();
139 } 139 }
140 140
141 float SVGSVGElement::pixelUnitToMillimeterX() const 141 float SVGSVGElement::pixelUnitToMillimeterX() const
142 { 142 {
143 // 2.54 / cssPixelsPerInch gives CM. 143 // 2.54 / cssPixelsPerInch gives CM.
144 return (2.54f / cssPixelsPerInch) * 10.0f; 144 return (2.54f / cssPixelsPerInch) * 10.0f;
145 } 145 }
146 146
147 float SVGSVGElement::pixelUnitToMillimeterY() const 147 float SVGSVGElement::pixelUnitToMillimeterY() const
148 { 148 {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 void SVGSVGElement::unsuspendRedrawAll() 320 void SVGSVGElement::unsuspendRedrawAll()
321 { 321 {
322 // FIXME: Implement me (see bug 11275) 322 // FIXME: Implement me (see bug 11275)
323 } 323 }
324 324
325 void SVGSVGElement::forceRedraw() 325 void SVGSVGElement::forceRedraw()
326 { 326 {
327 // FIXME: Implement me (see bug 11275) 327 // FIXME: Implement me (see bug 11275)
328 } 328 }
329 329
330 PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const Flo atRect& rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure colle ct) const 330 PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const SVG Rect& rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure collect ) const
331 { 331 {
332 Vector<RefPtr<Node> > nodes; 332 Vector<RefPtr<Node> > nodes;
333 Element* element = ElementTraversal::next(referenceElement ? referenceElemen t : this); 333 Element* element = ElementTraversal::next(referenceElement ? referenceElemen t : this);
334 while (element) { 334 while (element) {
335 if (element->isSVGElement()) { 335 if (element->isSVGElement()) {
336 SVGElement* svgElement = toSVGElement(element); 336 SVGElement* svgElement = toSVGElement(element);
337 if (collect == CollectIntersectionList) { 337 if (collect == CollectIntersectionList) {
338 if (checkIntersection(svgElement, rect)) 338 if (checkIntersection(svgElement, rect))
339 nodes.append(element); 339 nodes.append(element);
340 } else { 340 } else {
341 if (checkEnclosure(svgElement, rect)) 341 if (checkEnclosure(svgElement, rect))
342 nodes.append(element); 342 nodes.append(element);
343 } 343 }
344 } 344 }
345 345
346 element = ElementTraversal::next(element, referenceElement ? referenceEl ement : this); 346 element = ElementTraversal::next(element, referenceElement ? referenceEl ement : this);
347 } 347 }
348 return StaticNodeList::adopt(nodes); 348 return StaticNodeList::adopt(nodes);
349 } 349 }
350 350
351 PassRefPtr<NodeList> SVGSVGElement::getIntersectionList(const FloatRect& rect, S VGElement* referenceElement) const 351 PassRefPtr<NodeList> SVGSVGElement::getIntersectionList(const SVGRect& rect, SVG Element* referenceElement) const
352 { 352 {
353 return collectIntersectionOrEnclosureList(rect, referenceElement, CollectInt ersectionList); 353 return collectIntersectionOrEnclosureList(rect, referenceElement, CollectInt ersectionList);
354 } 354 }
355 355
356 PassRefPtr<NodeList> SVGSVGElement::getEnclosureList(const FloatRect& rect, SVGE lement* referenceElement) const 356 PassRefPtr<NodeList> SVGSVGElement::getEnclosureList(const SVGRect& rect, SVGEle ment* referenceElement) const
357 { 357 {
358 return collectIntersectionOrEnclosureList(rect, referenceElement, CollectEnc losureList); 358 return collectIntersectionOrEnclosureList(rect, referenceElement, CollectEnc losureList);
359 } 359 }
360 360
361 bool SVGSVGElement::checkIntersection(SVGElement* element, const FloatRect& rect ) const 361 bool SVGSVGElement::checkIntersection(SVGElement* element, const SVGRect& rect) const
362 { 362 {
363 if (!element) 363 if (!element)
364 return false; 364 return false;
365 return RenderSVGModelObject::checkIntersection(element->renderer(), rect); 365 return RenderSVGModelObject::checkIntersection(element->renderer(), rect);
366 } 366 }
367 367
368 bool SVGSVGElement::checkEnclosure(SVGElement* element, const FloatRect& rect) c onst 368 bool SVGSVGElement::checkEnclosure(SVGElement* element, const SVGRect& rect) con st
369 { 369 {
370 if (!element) 370 if (!element)
371 return false; 371 return false;
372 return RenderSVGModelObject::checkEnclosure(element->renderer(), rect); 372 return RenderSVGModelObject::checkEnclosure(element->renderer(), rect);
373 } 373 }
374 374
375 void SVGSVGElement::deselectAll() 375 void SVGSVGElement::deselectAll()
376 { 376 {
377 if (Frame* frame = document()->frame()) 377 if (Frame* frame = document()->frame())
378 frame->selection()->clear(); 378 frame->selection()->clear();
(...skipping 17 matching lines...) Expand all
396 SVGPoint SVGSVGElement::createSVGPoint() 396 SVGPoint SVGSVGElement::createSVGPoint()
397 { 397 {
398 return SVGPoint(); 398 return SVGPoint();
399 } 399 }
400 400
401 SVGMatrix SVGSVGElement::createSVGMatrix() 401 SVGMatrix SVGSVGElement::createSVGMatrix()
402 { 402 {
403 return SVGMatrix(); 403 return SVGMatrix();
404 } 404 }
405 405
406 FloatRect SVGSVGElement::createSVGRect() 406 SVGRect SVGSVGElement::createSVGRect()
407 { 407 {
408 return FloatRect(); 408 return SVGRect();
409 } 409 }
410 410
411 SVGTransform SVGSVGElement::createSVGTransform() 411 SVGTransform SVGSVGElement::createSVGTransform()
412 { 412 {
413 return SVGTransform(SVGTransform::SVG_TRANSFORM_MATRIX); 413 return SVGTransform(SVGTransform::SVG_TRANSFORM_MATRIX);
414 } 414 }
415 415
416 SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix& matrix ) 416 SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix& matrix )
417 { 417 {
418 return SVGTransform(static_cast<const AffineTransform&>(matrix)); 418 return SVGTransform(static_cast<const AffineTransform&>(matrix));
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 bool SVGSVGElement::selfHasRelativeLengths() const 538 bool SVGSVGElement::selfHasRelativeLengths() const
539 { 539 {
540 return xCurrentValue().isRelative() 540 return xCurrentValue().isRelative()
541 || yCurrentValue().isRelative() 541 || yCurrentValue().isRelative()
542 || widthCurrentValue().isRelative() 542 || widthCurrentValue().isRelative()
543 || heightCurrentValue().isRelative() 543 || heightCurrentValue().isRelative()
544 || hasAttribute(SVGNames::viewBoxAttr); 544 || hasAttribute(SVGNames::viewBoxAttr);
545 } 545 }
546 546
547 FloatRect SVGSVGElement::currentViewBoxRect() const 547 SVGRect SVGSVGElement::currentViewBoxRect() const
548 { 548 {
549 if (m_useCurrentView) 549 if (m_useCurrentView)
550 return m_viewSpec ? m_viewSpec->viewBoxCurrentValue() : FloatRect(); 550 return m_viewSpec ? m_viewSpec->viewBoxCurrentValue() : SVGRect();
551 551
552 FloatRect useViewBox = viewBoxCurrentValue(); 552 FloatRect useViewBox = viewBoxCurrentValue();
553 if (!useViewBox.isEmpty()) 553 if (!useViewBox.isEmpty())
554 return useViewBox; 554 return useViewBox;
555 if (!renderer() || !renderer()->isSVGRoot()) 555 if (!renderer() || !renderer()->isSVGRoot())
556 return FloatRect(); 556 return SVGRect();
557 if (!toRenderSVGRoot(renderer())->isEmbeddedThroughSVGImage()) 557 if (!toRenderSVGRoot(renderer())->isEmbeddedThroughSVGImage())
558 return FloatRect(); 558 return SVGRect();
559 559
560 Length intrinsicWidth = this->intrinsicWidth(); 560 Length intrinsicWidth = this->intrinsicWidth();
561 Length intrinsicHeight = this->intrinsicHeight(); 561 Length intrinsicHeight = this->intrinsicHeight();
562 if (!intrinsicWidth.isFixed() || !intrinsicHeight.isFixed()) 562 if (!intrinsicWidth.isFixed() || !intrinsicHeight.isFixed())
563 return FloatRect(); 563 return SVGRect();
564 564
565 // If no viewBox is specified but non-relative width/height values, then we 565 // If no viewBox is specified but non-relative width/height values, then we
566 // should always synthesize a viewBox if we're embedded through a SVGImage. 566 // should always synthesize a viewBox if we're embedded through a SVGImage.
567 return FloatRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0))); 567 return SVGRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0 ), floatValueForLength(intrinsicHeight, 0)));
568 } 568 }
569 569
570 FloatSize SVGSVGElement::currentViewportSize() const 570 FloatSize SVGSVGElement::currentViewportSize() const
571 { 571 {
572 Length intrinsicWidth = this->intrinsicWidth(); 572 Length intrinsicWidth = this->intrinsicWidth();
573 Length intrinsicHeight = this->intrinsicHeight(); 573 Length intrinsicHeight = this->intrinsicHeight();
574 if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed()) 574 if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed())
575 return FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLe ngth(intrinsicHeight, 0)); 575 return FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLe ngth(intrinsicHeight, 0));
576 576
577 if (!renderer()) 577 if (!renderer())
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 continue; 768 continue;
769 769
770 Element* element = toElement(node); 770 Element* element = toElement(node);
771 if (element->getIdAttribute() == id) 771 if (element->getIdAttribute() == id)
772 return element; 772 return element;
773 } 773 }
774 return 0; 774 return 0;
775 } 775 }
776 776
777 } 777 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGSVGElement.h ('k') | Source/core/svg/SVGTextContentElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698