Changeset 152404 in webkit
- Timestamp:
- Jul 4, 2013 11:48:51 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r152394 r152404 1 2013-07-04 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 3 Have SVGTextContentElement inherit SVGGraphicsElement 4 https://bugs.webkit.org/show_bug.cgi?id=118351 5 6 Reviewed by Dirk Schulze. 7 8 Fix conversion to absolute (user agent) coordinates in the svg/text 9 tests to use SVGGraphicsElement::getScreenCTM() instead of 10 SVGGraphicsElement::getTransformToElement(). The previous code was 11 working until now due to a bug in getTransformToElement(), which 12 was not taking into consideration the CTM of the SVGTextElement (as 13 it was not recognized as a "locatable" element). Now that 14 SVGTextElement inherits from SVGGraphicsElement, it is properly 15 recognized as a "locatable" element by getTransformToElement(). 16 17 * svg/text/resources/SelectionTestCase.js: 18 (toAbsoluteCoordinates): 19 * svg/text/selection-doubleclick.svg: 20 1 21 2013-07-04 KyungTae Kim <ktf.kim@samsung.com> 2 22 -
trunk/LayoutTests/svg/text/resources/SelectionTestCase.js
r124380 r152404 30 30 31 31 function toAbsoluteCoordinates(point, element) { 32 return transformPoint(point, document.rootElement.getTransformToElement(element)); 32 // getScreenCTM() returns the transformation matrix from current user units (i.e., after application of the ‘transform’ property) 33 // to the parent user agent's notice of a "pixel". 34 return transformPoint(point, element.getScreenCTM()); 33 35 } 34 36 -
trunk/LayoutTests/svg/text/selection-doubleclick.svg
r124380 r152404 5 5 var line1 = document.getElementById("line1"); 6 6 var center = document.rootElement.createSVGPoint(); 7 var matrix = document.rootElement.getTransformToElement(line1);7 var matrix = line1.getScreenCTM(); 8 8 var bbox = line1.getBBox(); 9 9 -
trunk/Source/WebCore/ChangeLog
r152402 r152404 1 2013-07-04 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 3 Have SVGTextContentElement inherit SVGGraphicsElement 4 https://bugs.webkit.org/show_bug.cgi?id=118351 5 6 Reviewed by Dirk Schulze. 7 8 Have SVGTextContentElement inherit SVGGraphicsElement instead of 9 SVGStyledElement in order to match the latest SVG2 specification: 10 https://svgwg.org/svg2-draft/text.html#InterfaceSVGTextContentElement 11 12 This patch also removes the SVGTransformable and SVGLocatable IDL 13 interfaces as they are no longer needed (were merged into 14 SVGGraphicsElement in the latest specification). 15 16 This is one step towards getting rid of multiple inheritance in 17 SVG, and complying with the latest SVG2 specification. 18 19 No new tests, covered by existing tests. 20 21 * DerivedSources.make: 22 * WebCore.xcodeproj/project.pbxproj: 23 * bindings/scripts/CodeGeneratorJS.pm: 24 (GetGnuVTableOffsetForType): 25 * bindings/scripts/CodeGeneratorObjC.pm: 26 * svg/SVGAnimateMotionElement.cpp: 27 (WebCore::SVGAnimateMotionElement::hasValidAttributeType): 28 * svg/SVGElement.cpp: 29 (WebCore::SVGElement::getBoundingBox): 30 * svg/SVGLocatable.idl: Removed. 31 * svg/SVGTextContentElement.cpp: 32 (WebCore::SVGTextContentElement::SVGTextContentElement): 33 (WebCore::SVGTextContentElement::isSupportedAttribute): 34 (WebCore::SVGTextContentElement::isPresentationAttribute): 35 (WebCore::SVGTextContentElement::collectStyleForPresentationAttribute): 36 (WebCore::SVGTextContentElement::parseAttribute): 37 (WebCore::SVGTextContentElement::svgAttributeChanged): 38 * svg/SVGTextContentElement.h: 39 * svg/SVGTextContentElement.idl: 40 * svg/SVGTextElement.cpp: 41 (WebCore::SVGTextElement::SVGTextElement): 42 (WebCore::SVGTextElement::animatedLocalTransform): 43 * svg/SVGTextElement.h: 44 * svg/SVGTextElement.idl: 45 * svg/SVGTransformable.idl: Removed. 46 1 47 2013-07-03 Gavin Barraclough <barraclough@apple.com> 2 48 -
trunk/Source/WebCore/DerivedSources.make
r152167 r152404 556 556 $(WebCore)/svg/SVGLineElement.idl \ 557 557 $(WebCore)/svg/SVGLinearGradientElement.idl \ 558 $(WebCore)/svg/SVGLocatable.idl \559 558 $(WebCore)/svg/SVGMPathElement.idl \ 560 559 $(WebCore)/svg/SVGMarkerElement.idl \ … … 617 616 $(WebCore)/svg/SVGTransform.idl \ 618 617 $(WebCore)/svg/SVGTransformList.idl \ 619 $(WebCore)/svg/SVGTransformable.idl \620 618 $(WebCore)/svg/SVGURIReference.idl \ 621 619 $(WebCore)/svg/SVGUnitTypes.idl \ -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r152299 r152404 10629 10629 B22278AA0D00BF200071B782 /* SVGLocatable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLocatable.cpp; sourceTree = "<group>"; }; 10630 10630 B22278AB0D00BF200071B782 /* SVGLocatable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGLocatable.h; sourceTree = "<group>"; }; 10631 B22278AC0D00BF200071B782 /* SVGLocatable.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGLocatable.idl; sourceTree = "<group>"; };10632 10631 B22278AD0D00BF200071B782 /* SVGMarkerElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGMarkerElement.cpp; sourceTree = "<group>"; }; 10633 10632 B22278AE0D00BF200071B782 /* SVGMarkerElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGMarkerElement.h; sourceTree = "<group>"; }; … … 10768 10767 B22279430D00BF210071B782 /* SVGTransformable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformable.cpp; sourceTree = "<group>"; }; 10769 10768 B22279440D00BF210071B782 /* SVGTransformable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGTransformable.h; sourceTree = "<group>"; }; 10770 B22279450D00BF210071B782 /* SVGTransformable.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGTransformable.idl; sourceTree = "<group>"; };10771 10769 B22279460D00BF210071B782 /* SVGTransformDistance.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformDistance.cpp; sourceTree = "<group>"; }; 10772 10770 B22279470D00BF210071B782 /* SVGTransformDistance.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGTransformDistance.h; sourceTree = "<group>"; }; … … 18000 17998 B22278AA0D00BF200071B782 /* SVGLocatable.cpp */, 18001 17999 B22278AB0D00BF200071B782 /* SVGLocatable.h */, 18002 B22278AC0D00BF200071B782 /* SVGLocatable.idl */,18003 18000 B22278AD0D00BF200071B782 /* SVGMarkerElement.cpp */, 18004 18001 B22278AE0D00BF200071B782 /* SVGMarkerElement.h */, … … 18172 18169 B22279430D00BF210071B782 /* SVGTransformable.cpp */, 18173 18170 B22279440D00BF210071B782 /* SVGTransformable.h */, 18174 B22279450D00BF210071B782 /* SVGTransformable.idl */,18175 18171 B22279460D00BF210071B782 /* SVGTransformDistance.cpp */, 18176 18172 B22279470D00BF210071B782 /* SVGTransformDistance.h */, -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r152299 r152404 1505 1505 || $typename eq "SVGSwitchElement" 1506 1506 || $typename eq "SVGTextElement" 1507 || $typename eq "SVGTransformable"1508 1507 || $typename eq "SVGUseElement") { 1509 1508 return "3"; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm
r151619 r152404 56 56 # Hashes 57 57 my %protocolTypeHash = ("XPathNSResolver" => 1, "EventListener" => 1, "EventTarget" => 1, "NodeFilter" => 1, 58 "SVG Locatable" => 1, "SVGTransformable" => 1, "SVGFilterPrimitiveStandardAttributes" => 1,58 "SVGFilterPrimitiveStandardAttributes" => 1, 59 59 "SVGTests" => 1, "SVGLangSpace" => 1, "SVGExternalResourcesRequired" => 1, "SVGURIReference" => 1, 60 60 "SVGZoomAndPan" => 1, "SVGFitToViewBox" => 1, "SVGAnimatedPathData" => 1, "ElementTimeControl" => 1); -
trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp
r152167 r152404 63 63 64 64 // We don't have a special attribute name to verify the animation type. Check the element name instead. 65 if (!targetElement->isSVGGraphicsElement() && !targetElement->hasTagName(SVGNames::textTag))65 if (!targetElement->isSVGGraphicsElement()) 66 66 return false; 67 67 // Spec: SVG 1.1 section 19.2.15 -
trunk/Source/WebCore/svg/SVGElement.cpp
r152346 r152404 41 41 #include "SVGNames.h" 42 42 #include "SVGSVGElement.h" 43 #include "SVGTextElement.h"44 43 #include "ScriptEventListener.h" 45 44 #include "XMLNames.h" … … 258 257 if (isSVGGraphicsElement()) { 259 258 rect = toSVGGraphicsElement(this)->getBBox(styleUpdateStrategy); 260 return true;261 }262 if (hasTagName(SVGNames::textTag)) {263 rect = static_cast<SVGTextElement*>(this)->getBBox(styleUpdateStrategy);264 259 return true; 265 260 } -
trunk/Source/WebCore/svg/SVGTextContentElement.cpp
r152284 r152404 62 62 REGISTER_LOCAL_ANIMATED_PROPERTY(lengthAdjust) 63 63 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 64 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement) 65 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) 64 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) 66 65 END_REGISTER_ANIMATED_PROPERTIES 67 66 68 67 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document* document) 69 : SVG StyledElement(tagName, document)68 : SVGGraphicsElement(tagName, document) 70 69 , m_textLength(LengthModeOther) 71 70 , m_specifiedTextLength(LengthModeOther) … … 218 217 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 219 218 if (supportedAttributes.isEmpty()) { 220 SVGTests::addSupportedAttributes(supportedAttributes);221 219 SVGLangSpace::addSupportedAttributes(supportedAttributes); 222 220 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); … … 231 229 if (name.matches(XMLNames::spaceAttr)) 232 230 return true; 233 return SVG StyledElement::isPresentationAttribute(name);231 return SVGGraphicsElement::isPresentationAttribute(name); 234 232 } 235 233 … … 237 235 { 238 236 if (!isSupportedAttribute(name)) 239 SVG StyledElement::collectStyleForPresentationAttribute(name, value, style);237 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style); 240 238 else if (name.matches(XMLNames::spaceAttr)) { 241 239 DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve", AtomicString::ConstructFromLiteral)); … … 253 251 254 252 if (!isSupportedAttribute(name)) 255 SVG StyledElement::parseAttribute(name, value);253 SVGGraphicsElement::parseAttribute(name, value); 256 254 else if (name == SVGNames::lengthAdjustAttr) { 257 255 SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustType>::fromString(value); … … 260 258 } else if (name == SVGNames::textLengthAttr) { 261 259 m_textLength.value = SVGLength::construct(LengthModeOther, value, parseError, ForbidNegativeLengths); 262 } else if (SVGTests::parseAttribute(name, value) 263 || SVGExternalResourcesRequired::parseAttribute(name, value)) { 260 } else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { 264 261 } else if (SVGLangSpace::parseAttribute(name, value)) { 265 262 } else … … 272 269 { 273 270 if (!isSupportedAttribute(attrName)) { 274 SVG StyledElement::svgAttributeChanged(attrName);271 SVGGraphicsElement::svgAttributeChanged(attrName); 275 272 return; 276 273 } 277 274 278 275 SVGElementInstance::InvalidationGuard invalidationGuard(this); 279 280 if (SVGTests::handleAttributeChange(this, attrName))281 return;282 276 283 277 if (attrName == SVGNames::textLengthAttr) -
trunk/Source/WebCore/svg/SVGTextContentElement.h
r152156 r152404 27 27 #include "SVGAnimatedLength.h" 28 28 #include "SVGExternalResourcesRequired.h" 29 #include "SVGStyledElement.h" 30 #include "SVGTests.h" 29 #include "SVGGraphicsElement.h" 31 30 32 31 namespace WebCore { … … 67 66 }; 68 67 69 class SVGTextContentElement : public SVGStyledElement, 70 public SVGTests, 68 class SVGTextContentElement : public SVGGraphicsElement, 71 69 public SVGExternalResourcesRequired { 72 70 public: … … 122 120 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) 123 121 END_DECLARE_ANIMATED_PROPERTIES 124 125 // SVGTests126 virtual void synchronizeRequiredFeatures() { SVGTests::synchronizeRequiredFeatures(this); }127 virtual void synchronizeRequiredExtensions() { SVGTests::synchronizeRequiredExtensions(this); }128 virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }129 122 }; 130 123 -
trunk/Source/WebCore/svg/SVGTextContentElement.idl
r152156 r152404 26 26 [ 27 27 Conditional=SVG 28 ] interface SVGTextContentElement : SVG StyledElement {28 ] interface SVGTextContentElement : SVGGraphicsElement { 29 29 // lengthAdjust Types 30 30 const unsigned short LENGTHADJUST_UNKNOWN = 0; … … 48 48 }; 49 49 50 // FIXME: SVGTextContentElement is not supposed to implement SVGExternalResourcesRequired. 50 51 SVGTextContentElement implements SVGExternalResourcesRequired; 51 SVGTextContentElement implements SVGTests; -
trunk/Source/WebCore/svg/SVGTextElement.cpp
r151800 r152404 24 24 #include "SVGTextElement.h" 25 25 26 #include "AffineTransform.h"27 26 #include "Attribute.h" 28 #include "FloatRect.h"29 27 #include "NodeRenderingContext.h" 30 28 #include "RenderSVGResource.h" … … 37 35 namespace WebCore { 38 36 39 // Animated property definitions40 DEFINE_ANIMATED_TRANSFORM_LIST(SVGTextElement, SVGNames::transformAttr, Transform, transform)41 42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextElement)43 REGISTER_LOCAL_ANIMATED_PROPERTY(transform)44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement)45 END_REGISTER_ANIMATED_PROPERTIES46 47 37 inline SVGTextElement::SVGTextElement(const QualifiedName& tagName, Document* doc) 48 38 : SVGTextPositioningElement(tagName, doc) 49 39 { 50 40 ASSERT(hasTagName(SVGNames::textTag)); 51 registerAnimatedPropertiesForSVGTextElement();52 41 } 53 42 … … 57 46 } 58 47 59 bool SVGTextElement::isSupportedAttribute(const QualifiedName& attrName) 60 { 61 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 62 if (supportedAttributes.isEmpty()) 63 supportedAttributes.add(SVGNames::transformAttr); 64 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 65 } 66 67 void SVGTextElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 68 { 69 if (!isSupportedAttribute(name)) { 70 SVGTextPositioningElement::parseAttribute(name, value); 71 return; 72 } 73 74 if (name == SVGNames::transformAttr) { 75 SVGTransformList newList; 76 newList.parse(value); 77 detachAnimatedTransformListWrappers(newList.size()); 78 setTransformBaseValue(newList); 79 return; 80 } 81 82 ASSERT_NOT_REACHED(); 83 } 84 85 SVGElement* SVGTextElement::nearestViewportElement() const 86 { 87 return SVGTransformable::nearestViewportElement(this); 88 } 89 90 SVGElement* SVGTextElement::farthestViewportElement() const 91 { 92 return SVGTransformable::farthestViewportElement(this); 93 } 94 95 FloatRect SVGTextElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) 96 { 97 return SVGTransformable::getBBox(this, styleUpdateStrategy); 98 } 99 100 AffineTransform SVGTextElement::getCTM(StyleUpdateStrategy styleUpdateStrategy) 101 { 102 return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy); 103 } 104 105 AffineTransform SVGTextElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy) 106 { 107 return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy); 108 } 109 48 // We override SVGGraphics::animatedLocalTransform() so that the transform-origin 49 // is not taken into account. 110 50 AffineTransform SVGTextElement::animatedLocalTransform() const 111 51 { … … 124 64 transform().concatenate(matrix); 125 65 126 if (m_supplementalTransform) 127 return *m_supplementalTransform * matrix; 66 const AffineTransform* transform = const_cast<SVGTextElement*>(this)->supplementalTransform(); 67 if (transform) 68 return *transform * matrix; 128 69 return matrix; 129 }130 131 AffineTransform* SVGTextElement::supplementalTransform()132 {133 if (!m_supplementalTransform)134 m_supplementalTransform = adoptPtr(new AffineTransform);135 return m_supplementalTransform.get();136 70 } 137 71 … … 156 90 } 157 91 158 void SVGTextElement::svgAttributeChanged(const QualifiedName& attrName)159 {160 if (!isSupportedAttribute(attrName)) {161 SVGTextPositioningElement::svgAttributeChanged(attrName);162 return;163 }164 165 SVGElementInstance::InvalidationGuard invalidationGuard(this);166 167 RenderObject* renderer = this->renderer();168 if (!renderer)169 return;170 171 if (attrName == SVGNames::transformAttr) {172 renderer->setNeedsTransformUpdate();173 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);174 return;175 }176 177 ASSERT_NOT_REACHED();178 }179 180 92 } 181 93 -
trunk/Source/WebCore/svg/SVGTextElement.h
r150710 r152404 25 25 #include "SVGAnimatedTransformList.h" 26 26 #include "SVGTextPositioningElement.h" 27 #include "SVGTransformable.h"28 27 29 28 namespace WebCore { 30 29 31 class SVGTextElement FINAL : public SVGTextPositioningElement, 32 public SVGTransformable { 30 class SVGTextElement FINAL : public SVGTextPositioningElement { 33 31 public: 34 32 static PassRefPtr<SVGTextElement> create(const QualifiedName&, Document*); 35 33 36 virtual SVGElement* nearestViewportElement() const;37 virtual SVGElement* farthestViewportElement() const;38 39 virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate);40 virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate);41 virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate);42 34 virtual AffineTransform animatedLocalTransform() const; 43 35 … … 47 39 virtual bool supportsFocus() const OVERRIDE { return true; } 48 40 49 bool isSupportedAttribute(const QualifiedName&);50 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;51 52 virtual AffineTransform* supplementalTransform();53 virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); }54 55 41 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 56 42 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const; 57 58 virtual void svgAttributeChanged(const QualifiedName&);59 60 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextElement)61 DECLARE_ANIMATED_TRANSFORM_LIST(Transform, transform)62 END_DECLARE_ANIMATED_PROPERTIES63 64 // Used by <animateMotion>65 OwnPtr<AffineTransform> m_supplementalTransform;66 43 }; 67 44 -
trunk/Source/WebCore/svg/SVGTextElement.idl
r131172 r152404 26 26 [ 27 27 Conditional=SVG 28 ] interface SVGTextElement : SVGTextPositioningElement, 29 SVGTransformable { 28 ] interface SVGTextElement : SVGTextPositioningElement { 30 29 }; 31 30
Note: See TracChangeset
for help on using the changeset viewer.