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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 | 629 |
630 SVGLengthContext lengthContext(this); | 630 SVGLengthContext lengthContext(this); |
631 return height()->currentValue()->value(lengthContext); | 631 return height()->currentValue()->value(lengthContext); |
632 } | 632 } |
633 | 633 |
634 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const | 634 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const |
635 { | 635 { |
636 if (!m_useCurrentView || !m_viewSpec) | 636 if (!m_useCurrentView || !m_viewSpec) |
637 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight); | 637 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight); |
638 | 638 |
639 AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(currentViewBox Rect(), m_viewSpec->preserveAspectRatio()->currentValue(), viewWidth, viewHeight ); | 639 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewS pec->preserveAspectRatio()->currentValue(), viewWidth, viewHeight);; |
640 SVGTransformList* transformList = m_viewSpec->transform(); | |
641 if (transformList->isEmpty()) | |
642 return ctm; | |
643 | |
644 AffineTransform transform; | |
645 if (transformList->concatenate(transform)) | |
646 ctm *= transform; | |
647 | |
648 return ctm; | |
649 } | 640 } |
650 | 641 |
651 void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* anchorNode) | 642 void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* anchorNode) |
652 { | 643 { |
653 LayoutObject* layoutObject = this->layoutObject(); | 644 LayoutObject* layoutObject = this->layoutObject(); |
654 SVGViewSpec* view = m_viewSpec.get(); | 645 SVGViewSpec* view = m_viewSpec.get(); |
655 if (view) | 646 if (view) |
656 view->reset(); | 647 view->reset(); |
657 | 648 |
658 bool hadUseCurrentView = m_useCurrentView; | 649 bool hadUseCurrentView = m_useCurrentView; |
659 m_useCurrentView = false; | 650 m_useCurrentView = false; |
660 | 651 |
661 if (fragmentIdentifier.startsWith("svgView(")) { | |
fs
2016/07/21 13:08:27
This is still in the spec AFAIK. the only thing th
foolip
2016/07/22 04:44:39
Hmm, so this gets at the same thing I'm wondering
fs
2016/07/22 08:31:38
Just of the top of my head, some simplifications w
| |
662 if (!view) | |
663 view = currentView(); // Create the SVGViewSpec. | |
664 | |
665 view->inheritViewAttributesFromElement(this); | |
666 | |
667 if (view->parseViewSpec(fragmentIdentifier)) { | |
668 UseCounter::count(document(), UseCounter::SVGSVGElementFragmentSVGVi ew); | |
669 m_useCurrentView = true; | |
670 } else { | |
671 view->reset(); | |
672 } | |
673 | |
674 if (layoutObject && (hadUseCurrentView || m_useCurrentView)) | |
675 markForLayoutAndParentResourceInvalidation(layoutObject); | |
676 return; | |
677 } | |
678 | |
679 // Spec: If the SVG fragment identifier addresses a 'view' element within an SVG document (e.g., MyDrawing.svg#MyView | 652 // Spec: If the SVG fragment identifier addresses a 'view' element within an SVG document (e.g., MyDrawing.svg#MyView |
680 // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor 'svg' element is displayed in the viewport. | 653 // or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor 'svg' element is displayed in the viewport. |
681 // Any view specification attributes included on the given 'view' element ov erride the corresponding view specification | 654 // Any view specification attributes included on the given 'view' element ov erride the corresponding view specification |
682 // attributes on the closest ancestor 'svg' element. | 655 // attributes on the closest ancestor 'svg' element. |
683 // TODO(ed): The spec text above is a bit unclear. | 656 // TODO(ed): The spec text above is a bit unclear. |
684 // Should the transform from outermost svg to nested svg be applied to "disp lay" | 657 // Should the transform from outermost svg to nested svg be applied to "disp lay" |
685 // the inner svg in the viewport, then let the view element override the inn er | 658 // the inner svg in the viewport, then let the view element override the inn er |
686 // svg's view specification attributes. Should it fill/override the outer vi ewport? | 659 // svg's view specification attributes. Should it fill/override the outer vi ewport? |
687 if (isSVGViewElement(anchorNode)) { | 660 if (isSVGViewElement(anchorNode)) { |
688 SVGViewElement& viewElement = toSVGViewElement(*anchorNode); | 661 SVGViewElement& viewElement = toSVGViewElement(*anchorNode); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 visitor->trace(m_width); | 709 visitor->trace(m_width); |
737 visitor->trace(m_height); | 710 visitor->trace(m_height); |
738 visitor->trace(m_translation); | 711 visitor->trace(m_translation); |
739 visitor->trace(m_timeContainer); | 712 visitor->trace(m_timeContainer); |
740 visitor->trace(m_viewSpec); | 713 visitor->trace(m_viewSpec); |
741 SVGGraphicsElement::trace(visitor); | 714 SVGGraphicsElement::trace(visitor); |
742 SVGFitToViewBox::trace(visitor); | 715 SVGFitToViewBox::trace(visitor); |
743 } | 716 } |
744 | 717 |
745 } // namespace blink | 718 } // namespace blink |
OLD | NEW |