Changeset 24349 in webkit
- Timestamp:
- Jul 16, 2007 9:07:37 PM (17 years ago)
- Location:
- branches/feature-branch
- Files:
-
- 31 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-branch/LayoutTests/ChangeLog
r24320 r24349 1 2007-07-17 Rob Buis <buis@kde.org> 2 3 Reviewed by Nikolas. 4 5 http://bugs.webkit.org/show_bug.cgi?id=5996 6 SVG <view> is unimplemented 7 8 Testcases for each possible viewSpec fragment and a test that 9 uses all fragments. 10 11 * svg/custom/linking-a-03-b-all-expected.checksum: Added. 12 * svg/custom/linking-a-03-b-all-expected.png: Added. 13 * svg/custom/linking-a-03-b-all-expected.txt: Added. 14 * svg/custom/linking-a-03-b-all.svg: Added. 15 * svg/custom/linking-a-03-b-preserveAspectRatio-expected.checksum: Added. 16 * svg/custom/linking-a-03-b-preserveAspectRatio-expected.png: Added. 17 * svg/custom/linking-a-03-b-preserveAspectRatio-expected.txt: Added. 18 * svg/custom/linking-a-03-b-preserveAspectRatio.svg: Added. 19 * svg/custom/linking-a-03-b-transform-expected.checksum: Added. 20 * svg/custom/linking-a-03-b-transform-expected.png: Added. 21 * svg/custom/linking-a-03-b-transform-expected.txt: Added. 22 * svg/custom/linking-a-03-b-transform.svg: Added. 23 * svg/custom/linking-a-03-b-viewBox-expected.checksum: Added. 24 * svg/custom/linking-a-03-b-viewBox-expected.png: Added. 25 * svg/custom/linking-a-03-b-viewBox-expected.txt: Added. 26 * svg/custom/linking-a-03-b-viewBox-transform-expected.checksum: Added. 27 * svg/custom/linking-a-03-b-viewBox-transform-expected.png: Added. 28 * svg/custom/linking-a-03-b-viewBox-transform-expected.txt: Added. 29 * svg/custom/linking-a-03-b-viewBox-transform.svg: Added. 30 * svg/custom/linking-a-03-b-viewBox.svg: Added. 31 * svg/custom/linking-a-03-b-viewTarget-expected.checksum: Added. 32 * svg/custom/linking-a-03-b-viewTarget-expected.png: Added. 33 * svg/custom/linking-a-03-b-viewTarget-expected.txt: Added. 34 * svg/custom/linking-a-03-b-viewTarget.svg: Added. 35 * svg/custom/linking-a-03-b-zoomAndPan-expected.checksum: Added. 36 * svg/custom/linking-a-03-b-zoomAndPan-expected.png: Added. 37 * svg/custom/linking-a-03-b-zoomAndPan-expected.txt: Added. 38 * svg/custom/linking-a-03-b-zoomAndPan.svg: Added. 39 * svg/custom/resources/linkingCircle-f.svg: Added. 40 1 41 2007-07-16 Nikolas Zimmermann <zimmermann@kde.org> 2 42 -
branches/feature-branch/WebCore/ChangeLog
r24320 r24349 1 2007-07-17 Rob Buis <buis@kde.org> 2 3 Reviewed by Nikolas. 4 5 http://bugs.webkit.org/show_bug.cgi?id=5996 6 SVG <view> is unimplemented 7 8 Implement <view> and refactor the code in the svg renderer container classes. 9 10 * WebCore.xcodeproj/project.pbxproj: 11 * ksvg2/svg/SVGDocument.cpp: 12 (WebCore::SVGDocument::zoomAndPanEnabled): Take into account currentView for zoom/pan 13 * ksvg2/svg/SVGDocument.h: 14 * ksvg2/svg/SVGFEImageElement.cpp: 15 (WebCore::SVGFEImageElement::parseMappedAttribute): 16 * ksvg2/svg/SVGFitToViewBox.cpp: 17 (WebCore::SVGFitToViewBox::parseViewBox): 18 (WebCore::SVGFitToViewBox::parseMappedAttribute): 19 * ksvg2/svg/SVGFitToViewBox.h: 20 * ksvg2/svg/SVGImageElement.cpp: 21 (WebCore::SVGImageElement::parseMappedAttribute): 22 * ksvg2/svg/SVGLocatable.h: 23 * ksvg2/svg/SVGMarkerElement.cpp: 24 (WebCore::SVGMarkerElement::createRenderer): 25 (WebCore::SVGMarkerElement::notifyAttributeChange): 26 * ksvg2/svg/SVGPreserveAspectRatio.cpp: 27 (WebCore::SVGPreserveAspectRatio::parsePreserveAspectRatio): 28 * ksvg2/svg/SVGPreserveAspectRatio.h: 29 * ksvg2/svg/SVGSVGElement.cpp: 30 (WebCore::SVGSVGElement::SVGSVGElement): 31 (WebCore::SVGSVGElement::currentView): 32 (WebCore::SVGSVGElement::parseMappedAttribute): 33 (WebCore::SVGSVGElement::createRenderer): 34 (WebCore::SVGSVGElement::viewBoxToViewTransform): 35 (WebCore::SVGSVGElement::inheritViewAttributes): 36 * ksvg2/svg/SVGSVGElement.h: 37 * ksvg2/svg/SVGTransformable.cpp: 38 (WebCore::SVGTransformable::parseTransformAttribute): 39 * ksvg2/svg/SVGTransformable.h: 40 * ksvg2/svg/SVGViewElement.cpp: 41 (WebCore::SVGViewElement::parseMappedAttribute): 42 * ksvg2/svg/SVGViewElement.h: 43 * ksvg2/svg/SVGViewSpec.cpp: Added. 44 (WebCore::SVGViewSpec::SVGViewSpec): 45 (WebCore::SVGViewSpec::~SVGViewSpec): 46 (WebCore::SVGViewSpec::setTransform): 47 (WebCore::SVGViewSpec::setViewBoxString): 48 (WebCore::SVGViewSpec::setPreserveAspectRatioString): 49 (WebCore::SVGViewSpec::setViewTargetString): 50 (WebCore::SVGViewSpec::viewTarget): 51 (WebCore::SVGViewSpec::contextElement): 52 (WebCore::): 53 (WebCore::SVGViewSpec::parseViewSpec): 54 * ksvg2/svg/SVGViewSpec.h: Added. 55 (WebCore::SVGViewSpec::transform): 56 (WebCore::SVGViewSpec::viewTargetString): 57 * ksvg2/svg/SVGZoomAndPan.cpp: 58 (WebCore::SVGZoomAndPan::parseMappedAttribute): 59 (WebCore::): 60 (WebCore::SVGZoomAndPan::parseZoomAndPan): 61 * ksvg2/svg/SVGZoomAndPan.h: 62 * loader/FrameLoader.cpp: 63 (WebCore::FrameLoader::gotoAnchor): 64 * page/Frame.cpp: 65 (WebCore::Frame::setZoomFactor): do not zoom when it is disabled 66 * rendering/RenderSVGContainer.cpp: 67 (WebCore::RenderSVGContainer::RenderSVGContainer): 68 (WebCore::RenderSVGContainer::paint): 69 (WebCore::RenderSVGContainer::viewportTransform): 70 * rendering/RenderSVGContainer.h: 71 * rendering/RenderSVGRoot.cpp: 72 (WebCore::RenderSVGRoot::RenderSVGRoot): 73 (WebCore::RenderSVGRoot::applyContentTransforms): 74 (WebCore::RenderSVGRoot::paint): 75 (WebCore::RenderSVGRoot::absoluteTransform): 76 (WebCore::RenderSVGRoot::localTransform): 77 * rendering/RenderSVGRoot.h: 78 1 79 2007-07-16 Nikolas Zimmermann <zimmermann@kde.org> 2 80 -
branches/feature-branch/WebCore/WebCore.xcodeproj/project.pbxproj
r24169 r24349 2259 2259 AA31B5B40C1DFD1000AE7083 /* RenderSVGRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */; }; 2260 2260 AA31B5B50C1DFD1000AE7083 /* RenderSVGRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */; }; 2261 AA4038900C4C0D8B00DB56DC /* SVGViewSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA40388E0C4C0D8B00DB56DC /* SVGViewSpec.cpp */; }; 2262 AA4038910C4C0D8B00DB56DC /* SVGViewSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = AA40388F0C4C0D8B00DB56DC /* SVGViewSpec.h */; }; 2261 2263 AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA4C3A740B2B1679002334A2 /* StyleElement.cpp */; }; 2262 2264 AA4C3A770B2B1679002334A2 /* StyleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* StyleElement.h */; }; … … 5396 5398 AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGRoot.cpp; sourceTree = "<group>"; }; 5397 5399 AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderSVGRoot.h; sourceTree = "<group>"; }; 5400 AA40388E0C4C0D8B00DB56DC /* SVGViewSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGViewSpec.cpp; sourceTree = "<group>"; }; 5401 AA40388F0C4C0D8B00DB56DC /* SVGViewSpec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGViewSpec.h; sourceTree = "<group>"; }; 5398 5402 AA4C3A740B2B1679002334A2 /* StyleElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyleElement.cpp; sourceTree = "<group>"; }; 5399 5403 AA4C3A750B2B1679002334A2 /* StyleElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyleElement.h; sourceTree = "<group>"; }; … … 8483 8487 isa = PBXGroup; 8484 8488 children = ( 8489 AA40388E0C4C0D8B00DB56DC /* SVGViewSpec.cpp */, 8490 AA40388F0C4C0D8B00DB56DC /* SVGViewSpec.h */, 8485 8491 A84942D80B64A9CA0069F00F /* ColorDistance.cpp */, 8486 8492 A84942D70B64A9CA0069F00F /* ColorDistance.h */, … … 11467 11473 B223622E0C3AF0710008CA9B /* DOMSVGTextPathElement.h in Headers */, 11468 11474 B223622F0C3AF0710008CA9B /* DOMSVGTextPathElementInternal.h in Headers */, 11475 AA4038910C4C0D8B00DB56DC /* SVGViewSpec.h in Headers */, 11469 11476 ); 11470 11477 runOnlyForDeploymentPostprocessing = 0; … … 12866 12873 B22362280C3AF04A0008CA9B /* JSSVGTextPathElement.cpp in Sources */, 12867 12874 B2AE9B9D0C3AF27400F23F7F /* DOMSVGTextPathElement.mm in Sources */, 12875 AA4038900C4C0D8B00DB56DC /* SVGViewSpec.cpp in Sources */, 12868 12876 ); 12869 12877 runOnlyForDeploymentPostprocessing = 0; -
branches/feature-branch/WebCore/ksvg2/svg/SVGDocument.cpp
r21895 r24349 32 32 #include "SVGNames.h" 33 33 #include "SVGSVGElement.h" 34 #include "SVGViewSpec.h" 34 35 #include "SVGZoomEvent.h" 35 36 #include "SVGZoomAndPan.h" … … 80 81 bool SVGDocument::zoomAndPanEnabled() const 81 82 { 82 if (rootElement()) 83 return rootElement()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY; 83 if (rootElement()) { 84 if (rootElement()->useCurrentView()) { 85 if (rootElement()->currentView()) 86 return rootElement()->currentView()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY; 87 } else 88 return rootElement()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY; 89 } 84 90 85 91 return false; -
branches/feature-branch/WebCore/ksvg2/svg/SVGDocument.h
r21895 r24349 44 44 45 45 virtual PassRefPtr<Element> createElement(const String& tagName, ExceptionCode&); 46 46 47 47 void dispatchZoomEvent(float prevScale, float newScale); 48 48 void dispatchScrollEvent(); 49 49 50 virtualbool zoomAndPanEnabled() const;50 bool zoomAndPanEnabled() const; 51 51 52 52 void startPan(const FloatPoint& start); -
branches/feature-branch/WebCore/ksvg2/svg/SVGFEImageElement.cpp
r24194 r24349 60 60 { 61 61 const String& value = attr->value(); 62 if (attr->name() == SVGNames::preserveAspectRatioAttr) 63 preserveAspectRatioBaseValue()->parsePreserveAspectRatio(value); 64 else { 62 if (attr->name() == SVGNames::preserveAspectRatioAttr) { 63 const UChar* c = value.characters(); 64 const UChar* end = c + value.length(); 65 preserveAspectRatioBaseValue()->parsePreserveAspectRatio(c, end); 66 } else { 65 67 if (SVGURIReference::parseMappedAttribute(attr)) { 66 68 if (!href().startsWith("#")) { -
branches/feature-branch/WebCore/ksvg2/svg/SVGFitToViewBox.cpp
r24194 r24349 48 48 ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio, PreserveAspectRatio, preserveAspectRatio, SVGNames::preserveAspectRatioAttr.localName(), m_preserveAspectRatio.get()) 49 49 50 void SVGFitToViewBox::parseViewBox(const String& str)50 bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, double& x, double& y, double& w, double& h, bool validate) 51 51 { 52 double x = 0, y = 0, w = 0, h = 0;53 const UChar* c = str.characters();54 const UChar* end = c + str.length();55 52 Document* doc = contextElement()->document(); 53 String str(c, end - c); 56 54 57 55 skipOptionalSpaces(c, end); 58 56 59 if (!(parseNumber(c, end, x) && parseNumber(c, end, y) && 60 parseNumber(c, end, w) && parseNumber(c, end, h, false))) { 57 bool valid = (parseNumber(c, end, x) && parseNumber(c, end, y) && 58 parseNumber(c, end, w) && parseNumber(c, end, h, false)); 59 if (!validate) 60 return true; 61 if (!valid) { 61 62 doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\""); 62 return ;63 return false; 63 64 } 64 65 65 if (w < 0.0) // check that width is positive66 if (w < 0.0) { // check that width is positive 66 67 doc->accessSVGExtensions()->reportError("A negative value for ViewBox width is not allowed"); 67 else if (h < 0.0) // check that height is positive 68 return false; 69 } else if (h < 0.0) { // check that height is positive 68 70 doc->accessSVGExtensions()->reportError("A negative value for ViewBox height is not allowed"); 69 else { 71 return false; 72 } else { 70 73 skipOptionalSpaces(c, end); 71 if (c < end) // nothing should come after the last, fourth number74 if (c < end) { // nothing should come after the last, fourth number 72 75 doc->accessSVGExtensions()->reportWarning("Problem parsing viewBox=\"" + str + "\""); 73 else74 setViewBoxBaseValue(FloatRect(x, y, w, h));76 return false; 77 } 75 78 } 79 80 return true; 76 81 } 77 82 … … 90 95 { 91 96 if (attr->name() == SVGNames::viewBoxAttr) { 92 parseViewBox(attr->value()); 97 double x = 0, y = 0, w = 0, h = 0; 98 const UChar* c = attr->value().characters(); 99 const UChar* end = c + attr->value().length(); 100 if (parseViewBox(c, end, x, y, w, h)) 101 setViewBoxBaseValue(FloatRect(x, y, w, h)); 93 102 return true; 94 103 } else if (attr->name() == SVGNames::preserveAspectRatioAttr) { 95 preserveAspectRatioBaseValue()->parsePreserveAspectRatio(attr->value()); 104 const UChar* c = attr->value().characters(); 105 const UChar* end = c + attr->value().length(); 106 preserveAspectRatioBaseValue()->parsePreserveAspectRatio(c, end); 96 107 return true; 97 108 } -
branches/feature-branch/WebCore/ksvg2/svg/SVGFitToViewBox.h
r19855 r24349 1 1 /* 2 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 3 2004, 2005, 2006 Rob Buis <buis@kde.org>3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 5 5 This file is part of the KDE project … … 37 37 38 38 // 'SVGFitToViewBox' functions 39 void parseViewBox(const String&);40 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;39 bool parseViewBox(const UChar*& start, const UChar* end, double& x, double& y, double& w, double& h, bool validate = true); 40 virtual AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; 41 41 42 42 bool parseMappedAttribute(MappedAttribute*); -
branches/feature-branch/WebCore/ksvg2/svg/SVGImageElement.cpp
r24194 r24349 70 70 else if (attr->name() == SVGNames::yAttr) 71 71 setYBaseValue(SVGLength(this, LengthModeHeight, attr->value())); 72 else if (attr->name() == SVGNames::preserveAspectRatioAttr) 73 preserveAspectRatioBaseValue()->parsePreserveAspectRatio(attr->value()); 74 else if (attr->name() == SVGNames::widthAttr) { 72 else if (attr->name() == SVGNames::preserveAspectRatioAttr) { 73 const UChar* c = attr->value().characters(); 74 const UChar* end = c + attr->value().length(); 75 preserveAspectRatioBaseValue()->parsePreserveAspectRatio(c, end); 76 } else if (attr->name() == SVGNames::widthAttr) { 75 77 setWidthBaseValue(SVGLength(this, LengthModeWidth, attr->value())); 76 78 addCSSProperty(attr, CSS_PROP_WIDTH, attr->value()); -
branches/feature-branch/WebCore/ksvg2/svg/SVGLocatable.h
r19855 r24349 1 1 /* 2 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 3 2004, 2005 Rob Buis <buis@kde.org>3 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 4 5 5 This file is part of the KDE project … … 49 49 AffineTransform getTransformToElement(SVGElement*, ExceptionCode&) const; 50 50 51 protected:52 51 static SVGElement* nearestViewportElement(const SVGStyledElement*); 53 52 static SVGElement* farthestViewportElement(const SVGStyledElement*); 53 54 protected: 54 55 static FloatRect getBBox(const SVGStyledElement*); 55 56 static AffineTransform getCTM(const SVGElement*); -
branches/feature-branch/WebCore/ksvg2/svg/SVGMarkerElement.cpp
r24194 r24349 137 137 { 138 138 RenderSVGContainer* markerContainer = new (arena) RenderSVGContainer(this); 139 markerContainer->setViewBox(viewBox());140 markerContainer->setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType(preserveAspectRatio()->align()));141 markerContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE);142 139 markerContainer->setDrawsContents(false); // Marker contents will be explicitly drawn. 143 140 return markerContainer; … … 152 149 153 150 // NOTE: This is a typical case, where proper "attributeChanged" usage would reduce the number of updates needed. 154 if (markerContainer) { 155 markerContainer->setViewBox(viewBox()); 156 markerContainer->setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType(preserveAspectRatio()->align())); 157 markerContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); 158 } 151 if (markerContainer) 152 markerContainer->setNeedsLayout(true); 159 153 160 154 m_marker->invalidate(); -
branches/feature-branch/WebCore/ksvg2/svg/SVGPreserveAspectRatio.cpp
r24194 r24349 1 1 /* 2 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 3 2004, 2005, 2006 Rob Buis <buis@kde.org>3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 5 5 This file is part of the KDE project … … 62 62 } 63 63 64 void SVGPreserveAspectRatio::parsePreserveAspectRatio(const String& string)64 bool SVGPreserveAspectRatio::parsePreserveAspectRatio(const UChar*& currParam, const UChar* end, bool validate) 65 65 { 66 66 SVGPreserveAspectRatioType align = SVG_PRESERVEASPECTRATIO_NONE; 67 67 SVGMeetOrSliceType meetOrSlice = SVG_MEETORSLICE_MEET; 68 69 const UChar* currParam = string.characters(); 70 const UChar* end = currParam + string.length(); 68 bool ret = false; 71 69 72 70 if (!skipOptionalSpaces(currParam, end)) … … 150 148 } 151 149 152 if (end != currParam ) {150 if (end != currParam && validate) { 153 151 bail_out: 154 152 // FIXME: Should the two values be set to UNKNOWN instead? 155 153 align = SVG_PRESERVEASPECTRATIO_NONE; 156 154 meetOrSlice = SVG_MEETORSLICE_MEET; 157 } 155 } else 156 ret = true; 158 157 159 158 if (m_align == align && m_meetOrSlice == meetOrSlice) 160 return ;159 return ret; 161 160 162 161 m_align = align; 163 162 m_meetOrSlice = meetOrSlice; 163 return ret; 164 164 } 165 165 -
branches/feature-branch/WebCore/ksvg2/svg/SVGPreserveAspectRatio.h
r24194 r24349 1 1 /* 2 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 3 2004, 2005, 2006 Rob Buis <buis@kde.org>3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 5 5 This file is part of the KDE project … … 27 27 28 28 #include "Shared.h" 29 #include <PlatformString.h> 29 30 30 31 namespace WebCore { … … 71 72 72 73 // Helper 73 void parsePreserveAspectRatio(const String&);74 bool parsePreserveAspectRatio(const UChar*& currParam, const UChar* end, bool validate = true); 74 75 75 76 protected: -
branches/feature-branch/WebCore/ksvg2/svg/SVGSVGElement.cpp
r24292 r24349 41 41 #include "SVGPreserveAspectRatio.h" 42 42 #include "SVGTransform.h" 43 #include "SVGTransformList.h" 44 #include "SVGViewElement.h" 45 #include "SVGViewSpec.h" 43 46 #include "SVGZoomEvent.h" 44 47 #include "SelectionController.h" … … 65 68 , m_useCurrentView(false) 66 69 , m_timeScheduler(new TimeScheduler(doc)) 70 , m_viewSpec(0) 67 71 { 68 72 setWidthBaseValue(SVGLength(this, LengthModeWidth, "100%")); … … 151 155 { 152 156 m_useCurrentView = currentView; 157 } 158 159 SVGViewSpec* SVGSVGElement::currentView() const 160 { 161 if (!m_viewSpec) 162 m_viewSpec = new SVGViewSpec(this); 163 164 return m_viewSpec; 153 165 } 154 166 … … 226 238 return; 227 239 if (SVGFitToViewBox::parseMappedAttribute(attr) && renderer()) { 228 if (renderer()->isSVGContainer()) 229 static_cast<RenderSVGContainer*>(renderer())->setViewBox(viewBox()); 230 else 231 static_cast<RenderSVGRoot*>(renderer())->setViewBox(viewBox()); 240 renderer()->setNeedsLayout(true); 232 241 return; 233 242 } … … 362 371 RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*) 363 372 { 364 if (!parentNode()->isSVGElement()) { 365 RenderSVGRoot* rootContainer = new (arena) RenderSVGRoot(this); 366 // FIXME: All this setup should be done after attributesChanged, not here. 367 rootContainer->setViewBox(viewBox()); 368 rootContainer->setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType(preserveAspectRatio()->align())); 369 rootContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); 370 return rootContainer; 371 } else { 372 RenderSVGContainer* rootContainer = new (arena) RenderSVGContainer(this); 373 374 // FIXME: All this setup should be done after attributesChanged, not here. 375 rootContainer->setViewBox(viewBox()); 376 rootContainer->setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType(preserveAspectRatio()->align())); 377 rootContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); 378 return rootContainer; 379 } 373 // FIXME: All this setup should be done after attributesChanged, not here. 374 if (!parentNode()->isSVGElement()) 375 return new (arena) RenderSVGRoot(this); 376 else 377 return new (arena) RenderSVGContainer(this); 380 378 } 381 379 … … 437 435 } 438 436 437 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const 438 { 439 FloatRect viewBoxRect; 440 if (useCurrentView()) { 441 if (currentView()) // what if we should use it but it is not set? 442 viewBoxRect = currentView()->viewBox(); 443 } else 444 viewBoxRect = viewBox(); 445 if (!viewBoxRect.width() || !viewBoxRect.height()) 446 return AffineTransform(); 447 448 AffineTransform ctm = preserveAspectRatio()->getCTM(viewBoxRect.x(), 449 viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), 450 0, 0, viewWidth, viewHeight); 451 452 if (useCurrentView() && currentView()) 453 return currentView()->transform()->concatenate().matrix() * ctm; 454 455 return ctm; 456 } 457 458 void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement) 459 { 460 setUseCurrentView(true); 461 if (viewElement->hasAttribute(SVGNames::viewBoxAttr)) 462 currentView()->setViewBox(viewElement->viewBox()); 463 else 464 currentView()->setViewBox(viewBox()); 465 if (viewElement->hasAttribute(SVGNames::preserveAspectRatioAttr)) { 466 currentView()->preserveAspectRatio()->setAlign(viewElement->preserveAspectRatio()->align()); 467 currentView()->preserveAspectRatio()->setMeetOrSlice(viewElement->preserveAspectRatio()->meetOrSlice()); 468 } else { 469 currentView()->preserveAspectRatio()->setAlign(preserveAspectRatio()->align()); 470 currentView()->preserveAspectRatio()->setMeetOrSlice(preserveAspectRatio()->meetOrSlice()); 471 } 472 if (viewElement->hasAttribute(SVGNames::zoomAndPanAttr)) 473 currentView()->setZoomAndPan(viewElement->zoomAndPan()); 474 renderer()->setNeedsLayout(true); 475 } 476 439 477 } 440 478 -
branches/feature-branch/WebCore/ksvg2/svg/SVGSVGElement.h
r23509 r24349 38 38 class SVGLength; 39 39 class SVGTransform; 40 class SVGLength; 40 class SVGViewSpec; 41 class SVGViewElement; 41 42 class TimeScheduler; 42 43 class SVGSVGElement : public SVGStyledLocatableElement, … … 72 73 void setUseCurrentView(bool currentView); 73 74 74 //SVGViewSpec* currentView() const;75 SVGViewSpec* currentView() const; 75 76 76 77 float currentScale() const; … … 123 124 virtual void attributeChanged(Attribute*, bool preserveDecls = false); 124 125 126 virtual AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; 127 128 void inheritViewAttributes(SVGViewElement*); 129 125 130 protected: 126 131 virtual const SVGElement* contextElement() const { return this; } … … 145 150 TimeScheduler* m_timeScheduler; 146 151 FloatPoint m_translation; 152 mutable SVGViewSpec* m_viewSpec; 147 153 }; 148 154 -
branches/feature-branch/WebCore/ksvg2/svg/SVGTransformable.cpp
r22021 r24349 189 189 bool SVGTransformable::parseTransformAttribute(SVGTransformList* list, const AtomicString& transform) 190 190 { 191 const UChar* currTransform = transform.characters(); 192 const UChar* end = currTransform + transform.length(); 193 191 const UChar* start = transform.characters(); 192 const UChar* end = start + transform.length(); 193 return parseTransformAttribute(list, start, end); 194 } 195 196 bool SVGTransformable::parseTransformAttribute(SVGTransformList* list, const UChar*& currTransform, const UChar* end) 197 { 194 198 bool delimParsed = false; 195 199 while (currTransform < end) { -
branches/feature-branch/WebCore/ksvg2/svg/SVGTransformable.h
r22021 r24349 1 1 /* 2 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 3 2004, 2005, 2006 Rob Buis <buis@kde.org>3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 5 5 This file is part of the KDE project … … 46 46 47 47 static bool parseTransformAttribute(SVGTransformList*, const AtomicString& transform); 48 static bool parseTransformAttribute(SVGTransformList*, const UChar*& ptr, const UChar* end); 48 49 static bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&); 49 50 AffineTransform getCTM(const SVGElement*) const; -
branches/feature-branch/WebCore/ksvg2/svg/SVGViewElement.cpp
r21272 r24349 59 59 viewTarget()->reset(attr->value()); 60 60 else { 61 if (SVGExternalResourcesRequired::parseMappedAttribute(attr)61 if (SVGExternalResourcesRequired::parseMappedAttribute(attr) 62 62 || SVGFitToViewBox::parseMappedAttribute(attr) 63 63 || SVGZoomAndPan::parseMappedAttribute(attr)) -
branches/feature-branch/WebCore/ksvg2/svg/SVGViewElement.h
r19908 r24349 1 1 /* 2 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 3 2004, 2005 Rob Buis <buis@kde.org>3 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 4 5 5 This file is part of the KDE project … … 34 34 class SVGStringList; 35 35 class SVGViewElement : public SVGStyledElement, 36 37 38 36 public SVGExternalResourcesRequired, 37 public SVGFitToViewBox, 38 public SVGZoomAndPan 39 39 { 40 40 public: -
branches/feature-branch/WebCore/ksvg2/svg/SVGZoomAndPan.cpp
r21272 r24349 27 27 #include "MappedAttribute.h" 28 28 #include "SVGNames.h" 29 #include "SVGParserUtilities.h" 29 30 30 31 namespace WebCore { … … 52 53 { 53 54 if (attr->name() == SVGNames::zoomAndPanAttr) { 54 if (attr->value() == "disable") 55 setZoomAndPan(SVG_ZOOMANDPAN_DISABLE); 56 else if (attr->value() == "magnify") 57 setZoomAndPan(SVG_ZOOMANDPAN_MAGNIFY); 55 const UChar* start = attr->value().characters(); 56 const UChar* end = start + attr->value().length(); 57 parseZoomAndPan(start, end); 58 58 return true; 59 59 } 60 60 61 61 return false; 62 } 63 64 static const UChar disable[] = {'d', 'i', 's', 'a', 'b', 'l', 'e'}; 65 static const UChar magnify[] = {'m', 'a', 'g', 'n', 'i', 'f', 'y'}; 66 67 bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end) 68 { 69 if (skipString(start, end, disable, sizeof(disable) / sizeof(UChar))) 70 setZoomAndPan(SVG_ZOOMANDPAN_DISABLE); 71 else if (skipString(start, end, magnify, sizeof(magnify) / sizeof(UChar))) 72 setZoomAndPan(SVG_ZOOMANDPAN_MAGNIFY); 73 else 74 return false; 75 76 return true; 62 77 } 63 78 -
branches/feature-branch/WebCore/ksvg2/svg/SVGZoomAndPan.h
r19855 r24349 1 1 /* 2 2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> 3 2004, 2005, 2006 Rob Buis <buis@kde.org>3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 5 5 This file is part of the KDE project … … 25 25 #if ENABLE(SVG) 26 26 27 #include "PlatformString.h" 28 27 29 namespace WebCore { 28 30 … … 46 48 bool parseMappedAttribute(MappedAttribute*); 47 49 50 bool parseZoomAndPan(const UChar*& start, const UChar* end); 51 48 52 private: 49 53 unsigned short m_zoomAndPan; -
branches/feature-branch/WebCore/loader/FrameLoader.cpp
r23871 r24349 82 82 #include <kjs/object.h> 83 83 84 #if ENABLE(SVG) 85 #include "SVGDocument.h" 86 #include "SVGLocatable.h" 87 #include "SVGNames.h" 88 #include "SVGPreserveAspectRatio.h" 89 #include "SVGSVGElement.h" 90 #include "SVGViewElement.h" 91 #include "SVGViewSpec.h" 92 #endif 93 84 94 using KJS::UString; 85 95 using KJS::JSLock; … … 88 98 namespace WebCore { 89 99 100 using namespace SVGNames; 90 101 using namespace HTMLNames; 91 102 using namespace EventNames; … … 1368 1379 if (!anchorNode) 1369 1380 anchorNode = m_frame->document()->anchors()->namedItem(name, !m_frame->document()->inCompatMode()); 1381 1382 if (m_frame->document()->isSVGDocument()) { 1383 if (name.startsWith("xpointer(")) { 1384 // We need to parse the xpointer reference here 1385 } else if (name.startsWith("svgView(")) { 1386 RefPtr<SVGSVGElement> svg = static_cast<SVGDocument*>(m_frame->document())->rootElement(); 1387 if (!svg->currentView()->parseViewSpec(name)) 1388 return false; 1389 svg->setUseCurrentView(true); 1390 } else { 1391 if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) { 1392 RefPtr<SVGViewElement> viewElement = anchorNode->hasTagName(SVGNames::viewTag) ? static_cast<SVGViewElement*>(anchorNode) : 0; 1393 if (viewElement.get()) { 1394 RefPtr<SVGSVGElement> svg = static_cast<SVGSVGElement*>(SVGLocatable::nearestViewportElement(viewElement.get())); 1395 svg->inheritViewAttributes(viewElement.get()); 1396 } 1397 } 1398 } 1399 // FIXME: need to decide which <svg> to focus on, and zoom to that one 1400 // FIXME: need to actually "highlight" the viewTarget(s) 1401 } 1370 1402 1371 1403 m_frame->document()->setCSSTarget(anchorNode); // Setting to null will clear the current target. -
branches/feature-branch/WebCore/page/Frame.cpp
r21895 r24349 105 105 106 106 #if ENABLE(SVG) 107 #include "SVGNames.h"108 107 #include "XLinkNames.h" 109 108 #include "SVGDocument.h" 110 109 #include "SVGDocumentExtensions.h" 110 #include "SVGNames.h" 111 111 #endif 112 112 … … 683 683 return; 684 684 685 #if ENABLE(SVG) 686 if (d->m_doc && d->m_doc->isSVGDocument()) { 687 if (!static_cast<SVGDocument*>(d->m_doc.get())->zoomAndPanEnabled()) 688 return; 689 d->m_zoomFactor = percent; 690 if (d->m_doc->renderer()) 691 d->m_doc->renderer()->repaint(); 692 return; 693 } 694 #endif 685 695 d->m_zoomFactor = percent; 686 if (d->m_doc) { 687 #if ENABLE(SVG) 688 if (d->m_doc->isSVGDocument()) { 689 if (d->m_doc->renderer()) 690 d->m_doc->renderer()->repaint(); 691 return; 692 } 693 #endif 696 if (d->m_doc) 694 697 d->m_doc->recalcStyle(Node::Force); 695 }696 698 697 699 for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) -
branches/feature-branch/WebCore/rendering/RenderSVGContainer.cpp
r24292 r24349 30 30 #include "GraphicsContext.h" 31 31 #include "RenderView.h" 32 #include "SVGFitToViewBox.h" 32 33 #include "SVGLength.h" 33 34 #include "SVGMarkerElement.h" … … 49 50 , m_height(0) 50 51 , m_drawsContents(true) 51 , m_slice(false)52 52 { 53 53 setReplaced(true); … … 357 357 } 358 358 359 if (!viewBox().isEmpty()) 360 paintInfo.context->concatCTM(viewportTransform()); 359 paintInfo.context->concatCTM(viewportTransform()); 361 360 362 361 // default implementation. Just pass paint through to the children … … 412 411 } 413 412 414 void RenderSVGContainer::setViewBox(const FloatRect& viewBox)415 {416 m_viewBox = viewBox;417 418 if (style())419 setNeedsLayout(true);420 }421 422 FloatRect RenderSVGContainer::viewBox() const423 {424 return m_viewBox;425 }426 427 void RenderSVGContainer::setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType align)428 {429 m_align = align;430 if (style())431 setNeedsLayout(true);432 }433 434 SVGPreserveAspectRatio::SVGPreserveAspectRatioType RenderSVGContainer::align() const435 {436 return m_align;437 }438 439 413 AffineTransform RenderSVGContainer::viewportTransform() const 440 414 { 441 // FIXME: The method name is confusing, since it does not 442 // do viewport translating anymore. Look into this while 443 // fixing bug 12207. 444 if (!viewBox().isEmpty()) 445 return getAspectRatio(viewBox(), viewport()); 446 447 return AffineTransform(); 415 if (element()->hasTagName(SVGNames::svgTag)) { 416 SVGSVGElement* svg = static_cast<SVGSVGElement*>(element()); 417 return svg->viewBoxToViewTransform(viewport().width(), viewport().height()); 418 } else if (element()->hasTagName(SVGNames::markerTag)) { 419 SVGMarkerElement* marker = static_cast<SVGMarkerElement*>(element()); 420 return marker->viewBoxToViewTransform(viewport().width(), viewport().height()); 421 } 422 423 return AffineTransform(); 448 424 } 449 425 … … 520 496 521 497 return rect; 522 }523 524 void RenderSVGContainer::setSlice(bool slice)525 {526 m_slice = slice;527 528 if (style())529 setNeedsLayout(true);530 }531 532 bool RenderSVGContainer::slice() const533 {534 return m_slice;535 }536 537 AffineTransform RenderSVGContainer::getAspectRatio(const FloatRect& logical, const FloatRect& physical) const538 {539 AffineTransform temp;540 541 float logicX = logical.x();542 float logicY = logical.y();543 float logicWidth = logical.width();544 float logicHeight = logical.height();545 float physWidth = physical.width();546 float physHeight = physical.height();547 548 float vpar = logicWidth / logicHeight;549 float svgar = physWidth / physHeight;550 551 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) {552 temp.scale(physWidth / logicWidth, physHeight / logicHeight);553 temp.translate(-logicX, -logicY);554 } else if ((vpar < svgar && !slice()) || (vpar >= svgar && slice())) {555 temp.scale(physHeight / logicHeight, physHeight / logicHeight);556 557 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMAX)558 temp.translate(-logicX, -logicY);559 else if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX)560 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight) / 2, -logicY);561 else562 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight), -logicY);563 } else {564 temp.scale(physWidth / logicWidth, physWidth / logicWidth);565 566 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMIN)567 temp.translate(-logicX, -logicY);568 else if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID)569 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth) / 2);570 else571 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth));572 }573 574 return temp;575 498 } 576 499 -
branches/feature-branch/WebCore/rendering/RenderSVGContainer.h
r24292 r24349 1 1 /* 2 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 2004, 2005 Rob Buis <buis@kde.org>3 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 4 5 5 This file is part of the KDE project … … 92 92 FloatRect viewport() const; 93 93 94 void setViewBox(const FloatRect&);95 FloatRect viewBox() const;96 97 void setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType);98 SVGPreserveAspectRatio::SVGPreserveAspectRatioType align() const;99 100 void setSlice(bool);101 bool slice() const;102 103 94 AffineTransform viewportTransform() const; 104 95 … … 110 101 int calcReplacedHeight() const; 111 102 112 AffineTransform getAspectRatio(const FloatRect& logical, const FloatRect& physical) const;113 103 void applyContentTransforms(PaintInfo&); 114 104 … … 120 110 121 111 bool m_drawsContents : 1; 122 bool m_slice : 1;123 112 124 113 AffineTransform m_matrix; 125 114 126 115 FloatRect m_viewport; 127 FloatRect m_viewBox;128 SVGPreserveAspectRatio::SVGPreserveAspectRatioType m_align;129 116 IntRect m_absoluteBounds; 130 117 }; -
branches/feature-branch/WebCore/rendering/RenderSVGRoot.cpp
r24296 r24349 28 28 29 29 #include "GraphicsContext.h" 30 #include "RenderPath.h" 30 31 #include "RenderView.h" 31 32 #include "SVGLength.h" … … 42 43 RenderSVGRoot::RenderSVGRoot(SVGStyledElement* node) 43 44 : RenderContainer(node) 44 , m_slice(false)45 45 { 46 46 setReplaced(true); … … 49 49 RenderSVGRoot::~RenderSVGRoot() 50 50 { 51 }52 53 AffineTransform RenderSVGRoot::localTransform() const54 {55 return m_matrix;56 }57 58 void RenderSVGRoot::setLocalTransform(const AffineTransform& matrix)59 {60 m_matrix = matrix;61 51 } 62 52 … … 142 132 } 143 133 144 if (!localTransform().isIdentity())145 paintInfo.context->concatCTM(localTransform());146 147 134 paintInfo.context->concatCTM(AffineTransform().translate(svg->currentTranslate().x(), svg->currentTranslate().y())); 148 135 } … … 158 145 calcViewport(); 159 146 147 SVGSVGElement* svg = static_cast<SVGSVGElement*>(element()); 160 148 // A value of zero disables rendering of the element. 161 149 if (viewport().width() <= 0. || viewport().height() <= 0.) … … 198 186 } 199 187 200 if (!viewBox().isEmpty()) 201 childPaintInfo.context->concatCTM(viewportTransform()); 188 paintInfo.context->concatCTM(svg->viewBoxToViewTransform(width(), height())); 202 189 203 190 RenderContainer::paint(childPaintInfo, 0, 0); … … 239 226 m_viewport = FloatRect(x, y, w, h); 240 227 } 241 }242 243 void RenderSVGRoot::setViewBox(const FloatRect& viewBox)244 {245 m_viewBox = viewBox;246 247 if (style())248 setNeedsLayout(true);249 }250 251 FloatRect RenderSVGRoot::viewBox() const252 {253 return m_viewBox;254 }255 256 void RenderSVGRoot::setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType align)257 {258 m_align = align;259 if (style())260 setNeedsLayout(true);261 }262 263 SVGPreserveAspectRatio::SVGPreserveAspectRatioType RenderSVGRoot::align() const264 {265 return m_align;266 }267 268 AffineTransform RenderSVGRoot::viewportTransform() const269 {270 // FIXME: The method name is confusing, since it does not271 // do viewport translating anymore. Look into this while272 // fixing bug 12207.273 if (!viewBox().isEmpty()) {274 FloatRect viewportRect = viewport();275 viewportRect = FloatRect(viewport().x(), viewport().y(), width(), height());276 277 return getAspectRatio(viewBox(), viewportRect);278 }279 280 return AffineTransform();281 228 } 282 229 … … 316 263 ctm.translate(svg->currentTranslate().x(), svg->currentTranslate().y()); 317 264 ctm.translate(viewport().x(), viewport().y()); 318 return viewportTransform() * ctm;265 return svg->viewBoxToViewTransform(width(), height()) * ctm; 319 266 } 320 267 … … 359 306 } 360 307 361 void RenderSVGRoot::setSlice(bool slice) 362 { 363 m_slice = slice; 364 365 if (style()) 366 setNeedsLayout(true); 367 } 368 369 bool RenderSVGRoot::slice() const 370 { 371 return m_slice; 372 } 373 374 AffineTransform RenderSVGRoot::getAspectRatio(const FloatRect& logical, const FloatRect& physical) const 375 { 376 AffineTransform temp; 377 378 float logicX = logical.x(); 379 float logicY = logical.y(); 380 float logicWidth = logical.width(); 381 float logicHeight = logical.height(); 382 float physWidth = physical.width(); 383 float physHeight = physical.height(); 384 385 float vpar = logicWidth / logicHeight; 386 float svgar = physWidth / physHeight; 387 388 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) { 389 temp.scale(physWidth / logicWidth, physHeight / logicHeight); 390 temp.translate(-logicX, -logicY); 391 } else if ((vpar < svgar && !slice()) || (vpar >= svgar && slice())) { 392 temp.scale(physHeight / logicHeight, physHeight / logicHeight); 393 394 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMAX) 395 temp.translate(-logicX, -logicY); 396 else if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX) 397 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight) / 2, -logicY); 398 else 399 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight), -logicY); 400 } else { 401 temp.scale(physWidth / logicWidth, physWidth / logicWidth); 402 403 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMIN) 404 temp.translate(-logicX, -logicY); 405 else if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID) 406 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth) / 2); 407 else 408 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth)); 409 } 410 411 return temp; 308 AffineTransform RenderSVGRoot::localTransform() const 309 { 310 return AffineTransform(); 412 311 } 413 312 -
branches/feature-branch/WebCore/rendering/RenderSVGRoot.h
r24292 r24349 26 26 #if ENABLE(SVG) 27 27 #include "RenderContainer.h" 28 #include "RenderPath.h" 29 #include "SVGPreserveAspectRatio.h" 28 #include "FloatRect.h" 30 29 31 30 namespace WebCore { 32 31 33 class SVGElement; 32 class SVGStyledElement; 33 class AffineTransform; 34 34 35 35 class RenderSVGRoot : public RenderContainer { … … 58 58 59 59 virtual AffineTransform localTransform() const; 60 void setLocalTransform(const AffineTransform&);61 60 62 61 FloatRect viewport() const; 63 62 64 void setViewBox(const FloatRect&);65 FloatRect viewBox() const;66 67 void setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType);68 SVGPreserveAspectRatio::SVGPreserveAspectRatioType align() const;69 70 void setSlice(bool);71 bool slice() const;72 73 AffineTransform viewportTransform() const;74 75 63 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); 76 64 77 65 private: 78 66 void calcViewport(); 79 AffineTransform getAspectRatio(const FloatRect& logical, const FloatRect& physical) const;80 67 void applyContentTransforms(PaintInfo&, int parentX, int parentY); 81 68 82 bool m_slice : 1;83 AffineTransform m_matrix;84 85 69 FloatRect m_viewport; 86 FloatRect m_viewBox;87 SVGPreserveAspectRatio::SVGPreserveAspectRatioType m_align;88 70 IntRect m_absoluteBounds; 89 71 };
Note: See TracChangeset
for help on using the changeset viewer.