Changeset 31338 in webkit
- Timestamp:
- Mar 26, 2008, 6:52:55 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r31337 r31338 1 2008-03-26 David Hyatt <hyatt@apple.com> 2 3 Add support for the rendering and measurement of the <altGlyph> element in SVG. This patch brings 4 is half of what's needed to reach 100/100 on Acid3 and pass the test. Maciej has coded up the other half. :) 5 6 Reviewed by mjs 7 8 Added svg/custom/altGlyph.svg 9 10 * svg/SVGAltGlyphElement.cpp: 11 (WebCore::SVGAltGlyphElement::childShouldCreateRenderer): 12 (WebCore::SVGAltGlyphElement::glyphElement): 13 * svg/SVGAltGlyphElement.h: 14 * svg/SVGFont.cpp: 15 (WebCore::SVGTextRunWalker::walk): 16 * svg/SVGFontFaceElement.cpp: 17 (WebCore::SVGFontFaceElement::insertedIntoDocument): 18 * svg/SVGGlyphElement.cpp: 19 (WebCore::SVGGlyphElement::insertedIntoDocument): 20 (WebCore::SVGGlyphElement::removedFromDocument): 21 1 22 2008-03-26 Adam Roben <aroben@apple.com> 2 23 -
trunk/WebCore/svg/SVGAltGlyphElement.cpp
r31240 r31338 28 28 #include "RenderInline.h" 29 29 #include "RenderSVGTSpan.h" 30 #include "SVGGlyphElement.h" 30 31 #include "SVGNames.h" 32 #include "XLinkNames.h" 31 33 32 34 namespace WebCore { … … 65 67 if (child->isTextNode()) 66 68 return true; 67 68 69 return false; 69 70 } … … 74 75 } 75 76 77 SVGGlyphElement* SVGAltGlyphElement::glyphElement() const 78 { 79 Element* elt = document()->getElementById(getTarget(getAttribute(XLinkNames::hrefAttr))); 80 if (!elt || !elt->hasTagName(SVGNames::glyphTag)) 81 return 0; 82 return static_cast<SVGGlyphElement*>(elt); 83 } 84 76 85 } 77 86 -
trunk/WebCore/svg/SVGAltGlyphElement.h
r31240 r31338 30 30 namespace WebCore 31 31 { 32 class SVGGlyphElement; 33 32 34 class SVGAltGlyphElement : public SVGTextPositioningElement, public SVGURIReference 33 35 { … … 44 46 void setFormat(const AtomicString&, ExceptionCode&); 45 47 48 SVGGlyphElement* glyphElement() const; 49 46 50 protected: 47 51 virtual const SVGElement* contextElement() const { return this; } -
trunk/WebCore/svg/SVGFont.cpp
r31324 r31338 28 28 #include "RenderObject.h" 29 29 #include "SimpleFontData.h" 30 #include "SVGAltGlyphElement.h" 30 31 #include "SVGFontData.h" 31 32 #include "SVGGlyphElement.h" … … 250 251 int endOfScanRange = to + m_walkerData.extraCharsAvailable; 251 252 253 bool haveAltGlyph = false; 254 SVGGlyphIdentifier altGlyphIdentifier; 255 if (RenderObject* renderObject = run.referencingRenderObject()) { 256 if (renderObject->element() && renderObject->element()->hasTagName(SVGNames::altGlyphTag)) { 257 SVGGlyphElement* glyphElement = static_cast<SVGAltGlyphElement*>(renderObject->element())->glyphElement(); 258 if (glyphElement) { 259 haveAltGlyph = true; 260 altGlyphIdentifier = glyphElement->buildGlyphIdentifier(); 261 altGlyphIdentifier.isValid = true; 262 altGlyphIdentifier.nameLength = to - from; 263 } 264 } 265 } 266 252 267 for (int i = from; i < to; ++i) { 253 268 // If characterLookupRange is > 0, then the font defined ligatures (length of unicode property value > 1). … … 257 272 258 273 String lookupString(run.data(run.rtl() ? run.length() - (i + characterLookupRange) : i), characterLookupRange); 259 260 274 Vector<SVGGlyphIdentifier> glyphs; 261 m_fontElement->getGlyphIdentifiersForString(lookupString, glyphs); 275 if (haveAltGlyph) 276 glyphs.append(altGlyphIdentifier); 277 else 278 m_fontElement->getGlyphIdentifiersForString(lookupString, glyphs); 279 262 280 Vector<SVGGlyphIdentifier>::iterator it = glyphs.begin(); 263 281 Vector<SVGGlyphIdentifier>::iterator end = glyphs.end(); -
trunk/WebCore/svg/SVGFontFaceElement.cpp
r31309 r31338 351 351 { 352 352 rebuildFontFace(); 353 SVGElement::insertedIntoDocument(); 353 354 } 354 355 -
trunk/WebCore/svg/SVGGlyphElement.cpp
r29700 r31338 52 52 element->addGlyphToCache(this); 53 53 } 54 SVGStyledElement::insertedIntoDocument(); 54 55 } 55 56 … … 61 62 element->removeGlyphFromCache(this); 62 63 } 64 SVGStyledElement::removedFromDocument(); 63 65 } 64 66
Note:
See TracChangeset
for help on using the changeset viewer.