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

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

Issue 2390773004: reflow comments in core/svg/ (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 SVGZoomAndPan::isKnownAttribute(attrName)) { 299 SVGZoomAndPan::isKnownAttribute(attrName)) {
300 SVGElement::InvalidationGuard invalidationGuard(this); 300 SVGElement::InvalidationGuard invalidationGuard(this);
301 if (layoutObject()) 301 if (layoutObject())
302 markForLayoutAndParentResourceInvalidation(layoutObject()); 302 markForLayoutAndParentResourceInvalidation(layoutObject());
303 return; 303 return;
304 } 304 }
305 305
306 SVGGraphicsElement::svgAttributeChanged(attrName); 306 SVGGraphicsElement::svgAttributeChanged(attrName);
307 } 307 }
308 308
309 // FloatRect::intersects does not consider horizontal or vertical lines (because of isEmpty()). 309 // FloatRect::intersects does not consider horizontal or vertical lines (because
310 // of isEmpty()).
310 static bool intersectsAllowingEmpty(const FloatRect& r1, const FloatRect& r2) { 311 static bool intersectsAllowingEmpty(const FloatRect& r1, const FloatRect& r2) {
311 if (r1.width() < 0 || r1.height() < 0 || r2.width() < 0 || r2.height() < 0) 312 if (r1.width() < 0 || r1.height() < 0 || r2.width() < 0 || r2.height() < 0)
312 return false; 313 return false;
313 314
314 return r1.x() < r2.maxX() && r2.x() < r1.maxX() && r1.y() < r2.maxY() && 315 return r1.x() < r2.maxX() && r2.x() < r1.maxX() && r1.y() < r2.maxY() &&
315 r2.y() < r1.maxY(); 316 r2.y() < r1.maxY();
316 } 317 }
317 318
318 // One of the element types that can cause graphics to be drawn onto the target canvas. 319 // One of the element types that can cause graphics to be drawn onto the target
319 // Specifically: circle, ellipse, image, line, path, polygon, polyline, rect, te xt and use. 320 // canvas. Specifically: circle, ellipse, image, line, path, polygon, polyline,
321 // rect, text and use.
320 static bool isIntersectionOrEnclosureTarget(LayoutObject* layoutObject) { 322 static bool isIntersectionOrEnclosureTarget(LayoutObject* layoutObject) {
321 return layoutObject->isSVGShape() || layoutObject->isSVGText() || 323 return layoutObject->isSVGShape() || layoutObject->isSVGText() ||
322 layoutObject->isSVGImage() || isSVGUseElement(*layoutObject->node()); 324 layoutObject->isSVGImage() || isSVGUseElement(*layoutObject->node());
323 } 325 }
324 326
325 bool SVGSVGElement::checkIntersectionOrEnclosure( 327 bool SVGSVGElement::checkIntersectionOrEnclosure(
326 const SVGElement& element, 328 const SVGElement& element,
327 const FloatRect& rect, 329 const FloatRect& rect,
328 CheckIntersectionOrEnclosure mode) const { 330 CheckIntersectionOrEnclosure mode) const {
329 LayoutObject* layoutObject = element.layoutObject(); 331 LayoutObject* layoutObject = element.layoutObject();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 AffineTransform transform; 470 AffineTransform transform;
469 if (!isOutermostSVGSVGElement()) { 471 if (!isOutermostSVGSVGElement()) {
470 SVGLengthContext lengthContext(this); 472 SVGLengthContext lengthContext(this);
471 transform.translate(m_x->currentValue()->value(lengthContext), 473 transform.translate(m_x->currentValue()->value(lengthContext),
472 m_y->currentValue()->value(lengthContext)); 474 m_y->currentValue()->value(lengthContext));
473 } else if (mode == SVGElement::ScreenScope) { 475 } else if (mode == SVGElement::ScreenScope) {
474 if (LayoutObject* layoutObject = this->layoutObject()) { 476 if (LayoutObject* layoutObject = this->layoutObject()) {
475 FloatPoint location; 477 FloatPoint location;
476 float zoomFactor = 1; 478 float zoomFactor = 1;
477 479
478 // At the SVG/HTML boundary (aka LayoutSVGRoot), we apply the localToBorde rBoxTransform 480 // At the SVG/HTML boundary (aka LayoutSVGRoot), we apply the
479 // to map an element from SVG viewport coordinates to CSS box coordinates. 481 // localToBorderBoxTransform to map an element from SVG viewport
480 // LayoutSVGRoot's localToAbsolute method expects CSS box coordinates. 482 // coordinates to CSS box coordinates. LayoutSVGRoot's localToAbsolute
481 // We also need to adjust for the zoom level factored into CSS coordinates (bug #96361). 483 // method expects CSS box coordinates. We also need to adjust for the
484 // zoom level factored into CSS coordinates (bug #96361).
482 if (layoutObject->isSVGRoot()) { 485 if (layoutObject->isSVGRoot()) {
483 location = toLayoutSVGRoot(layoutObject) 486 location = toLayoutSVGRoot(layoutObject)
484 ->localToBorderBoxTransform() 487 ->localToBorderBoxTransform()
485 .mapPoint(location); 488 .mapPoint(location);
486 zoomFactor = 1 / layoutObject->style()->effectiveZoom(); 489 zoomFactor = 1 / layoutObject->style()->effectiveZoom();
487 } 490 }
488 491
489 // Translate in our CSS parent coordinate space 492 // Translate in our CSS parent coordinate space
490 // FIXME: This doesn't work correctly with CSS transforms. 493 // FIXME: This doesn't work correctly with CSS transforms.
491 location = layoutObject->localToAbsolute(location, UseTransforms); 494 location = layoutObject->localToAbsolute(location, UseTransforms);
492 location.scale(zoomFactor, zoomFactor); 495 location.scale(zoomFactor, zoomFactor);
493 496
494 // Be careful here! localToBorderBoxTransform() included the x/y offset co ming from the viewBoxToViewTransform(), 497 // Be careful here! localToBorderBoxTransform() included the x/y offset
495 // so we have to subtract it here (original cause of bug #27183) 498 // coming from the viewBoxToViewTransform(), so we have to subtract it
499 // here (original cause of bug #27183)
496 transform.translate(location.x() - viewBoxTransform.e(), 500 transform.translate(location.x() - viewBoxTransform.e(),
497 location.y() - viewBoxTransform.f()); 501 location.y() - viewBoxTransform.f());
498 502
499 // Respect scroll offset. 503 // Respect scroll offset.
500 if (FrameView* view = document().view()) { 504 if (FrameView* view = document().view()) {
501 LayoutSize scrollOffset(view->scrollOffset()); 505 LayoutSize scrollOffset(view->scrollOffset());
502 scrollOffset.scale(zoomFactor); 506 scrollOffset.scale(zoomFactor);
503 transform.translate(-scrollOffset.width(), -scrollOffset.height()); 507 transform.translate(-scrollOffset.width(), -scrollOffset.height());
504 } 508 }
505 } 509 }
(...skipping 22 matching lines...) Expand all
528 Node::InsertionNotificationRequest SVGSVGElement::insertedInto( 532 Node::InsertionNotificationRequest SVGSVGElement::insertedInto(
529 ContainerNode* rootParent) { 533 ContainerNode* rootParent) {
530 if (rootParent->isConnected()) { 534 if (rootParent->isConnected()) {
531 UseCounter::count(document(), UseCounter::SVGSVGElementInDocument); 535 UseCounter::count(document(), UseCounter::SVGSVGElementInDocument);
532 if (rootParent->document().isXMLDocument()) 536 if (rootParent->document().isXMLDocument())
533 UseCounter::count(document(), UseCounter::SVGSVGElementInXMLDocument); 537 UseCounter::count(document(), UseCounter::SVGSVGElementInXMLDocument);
534 538
535 if (RuntimeEnabledFeatures::smilEnabled()) { 539 if (RuntimeEnabledFeatures::smilEnabled()) {
536 document().accessSVGExtensions().addTimeContainer(this); 540 document().accessSVGExtensions().addTimeContainer(this);
537 541
538 // Animations are started at the end of document parsing and after firing the load event, 542 // Animations are started at the end of document parsing and after firing
539 // but if we miss that train (deferred programmatic element insertion for example) we need 543 // the load event, but if we miss that train (deferred programmatic
540 // to initialize the time container here. 544 // element insertion for example) we need to initialize the time container
545 // here.
541 if (!document().parsing() && !document().processingLoadEvent() && 546 if (!document().parsing() && !document().processingLoadEvent() &&
542 document().loadEventFinished() && !timeContainer()->isStarted()) 547 document().loadEventFinished() && !timeContainer()->isStarted())
543 timeContainer()->start(); 548 timeContainer()->start();
544 } 549 }
545 } 550 }
546 return SVGGraphicsElement::insertedInto(rootParent); 551 return SVGGraphicsElement::insertedInto(rootParent);
547 } 552 }
548 553
549 void SVGSVGElement::removedFrom(ContainerNode* rootParent) { 554 void SVGSVGElement::removedFrom(ContainerNode* rootParent) {
550 if (rootParent->isConnected()) { 555 if (rootParent->isConnected()) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 } 773 }
769 774
770 void SVGSVGElement::finishParsingChildren() { 775 void SVGSVGElement::finishParsingChildren() {
771 SVGGraphicsElement::finishParsingChildren(); 776 SVGGraphicsElement::finishParsingChildren();
772 777
773 // The outermost SVGSVGElement SVGLoad event is fired through 778 // The outermost SVGSVGElement SVGLoad event is fired through
774 // LocalDOMWindow::dispatchWindowLoadEvent. 779 // LocalDOMWindow::dispatchWindowLoadEvent.
775 if (isOutermostSVGSVGElement()) 780 if (isOutermostSVGSVGElement())
776 return; 781 return;
777 782
778 // finishParsingChildren() is called when the close tag is reached for an elem ent (e.g. </svg>) 783 // finishParsingChildren() is called when the close tag is reached for an
779 // we send SVGLoad events here if we can, otherwise they'll be sent when any r equired loads finish 784 // element (e.g. </svg>) we send SVGLoad events here if we can, otherwise
785 // they'll be sent when any required loads finish
780 sendSVGLoadEventIfPossible(); 786 sendSVGLoadEventIfPossible();
781 } 787 }
782 788
783 DEFINE_TRACE(SVGSVGElement) { 789 DEFINE_TRACE(SVGSVGElement) {
784 visitor->trace(m_x); 790 visitor->trace(m_x);
785 visitor->trace(m_y); 791 visitor->trace(m_y);
786 visitor->trace(m_width); 792 visitor->trace(m_width);
787 visitor->trace(m_height); 793 visitor->trace(m_height);
788 visitor->trace(m_translation); 794 visitor->trace(m_translation);
789 visitor->trace(m_timeContainer); 795 visitor->trace(m_timeContainer);
790 visitor->trace(m_viewSpec); 796 visitor->trace(m_viewSpec);
791 SVGGraphicsElement::trace(visitor); 797 SVGGraphicsElement::trace(visitor);
792 SVGFitToViewBox::trace(visitor); 798 SVGFitToViewBox::trace(visitor);
793 } 799 }
794 800
795 } // namespace blink 801 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGRect.cpp ('k') | third_party/WebKit/Source/core/svg/SVGStaticStringList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698