| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 entries.append(std::make_pair(SVGLengthAdjustSpacing, "spacing")); | 42 entries.append(std::make_pair(SVGLengthAdjustSpacing, "spacing")); |
| 43 entries.append(std::make_pair(SVGLengthAdjustSpacingAndGlyphs, "spacingA
ndGlyphs")); | 43 entries.append(std::make_pair(SVGLengthAdjustSpacingAndGlyphs, "spacingA
ndGlyphs")); |
| 44 } | 44 } |
| 45 return entries; | 45 return entries; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // SVGTextContentElement's 'textLength' attribute needs special handling. | 48 // SVGTextContentElement's 'textLength' attribute needs special handling. |
| 49 // It should return getComputedTextLength() when textLength is not specified man
ually. | 49 // It should return getComputedTextLength() when textLength is not specified man
ually. |
| 50 class SVGAnimatedTextLength final : public SVGAnimatedLength { | 50 class SVGAnimatedTextLength final : public SVGAnimatedLength { |
| 51 public: | 51 public: |
| 52 static PassRefPtrWillBeRawPtr<SVGAnimatedTextLength> create(SVGTextContentEl
ement* contextElement) | 52 static RawPtr<SVGAnimatedTextLength> create(SVGTextContentElement* contextEl
ement) |
| 53 { | 53 { |
| 54 return adoptRefWillBeNoop(new SVGAnimatedTextLength(contextElement)); | 54 return (new SVGAnimatedTextLength(contextElement)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 SVGLengthTearOff* baseVal() override | 57 SVGLengthTearOff* baseVal() override |
| 58 { | 58 { |
| 59 SVGTextContentElement* textContentElement = toSVGTextContentElement(cont
extElement()); | 59 SVGTextContentElement* textContentElement = toSVGTextContentElement(cont
extElement()); |
| 60 if (!textContentElement->textLengthIsSpecifiedByUser()) | 60 if (!textContentElement->textLengthIsSpecifiedByUser()) |
| 61 baseValue()->newValueSpecifiedUnits(CSSPrimitiveValue::UnitType::Num
ber, textContentElement->getComputedTextLength()); | 61 baseValue()->newValueSpecifiedUnits(CSSPrimitiveValue::UnitType::Num
ber, textContentElement->getComputedTextLength()); |
| 62 | 62 |
| 63 return SVGAnimatedLength::baseVal(); | 63 return SVGAnimatedLength::baseVal(); |
| 64 } | 64 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 109 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
| 110 return 0.0f; | 110 return 0.0f; |
| 111 } | 111 } |
| 112 | 112 |
| 113 if (nchars > numberOfChars - charnum) | 113 if (nchars > numberOfChars - charnum) |
| 114 nchars = numberOfChars - charnum; | 114 nchars = numberOfChars - charnum; |
| 115 | 115 |
| 116 return SVGTextQuery(layoutObject()).subStringLength(charnum, nchars); | 116 return SVGTextQuery(layoutObject()).subStringLength(charnum, nchars); |
| 117 } | 117 } |
| 118 | 118 |
| 119 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getStartPositionO
fChar(unsigned charnum, ExceptionState& exceptionState) | 119 RawPtr<SVGPointTearOff> SVGTextContentElement::getStartPositionOfChar(unsigned c
harnum, ExceptionState& exceptionState) |
| 120 { | 120 { |
| 121 document().updateLayoutIgnorePendingStylesheets(); | 121 document().updateLayoutIgnorePendingStylesheets(); |
| 122 | 122 |
| 123 if (charnum >= getNumberOfChars()) { | 123 if (charnum >= getNumberOfChars()) { |
| 124 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 124 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
| 125 return nullptr; | 125 return nullptr; |
| 126 } | 126 } |
| 127 | 127 |
| 128 FloatPoint point = SVGTextQuery(layoutObject()).startPositionOfCharacter(cha
rnum); | 128 FloatPoint point = SVGTextQuery(layoutObject()).startPositionOfCharacter(cha
rnum); |
| 129 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); | 129 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); |
| 130 } | 130 } |
| 131 | 131 |
| 132 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getEndPositionOfC
har(unsigned charnum, ExceptionState& exceptionState) | 132 RawPtr<SVGPointTearOff> SVGTextContentElement::getEndPositionOfChar(unsigned cha
rnum, ExceptionState& exceptionState) |
| 133 { | 133 { |
| 134 document().updateLayoutIgnorePendingStylesheets(); | 134 document().updateLayoutIgnorePendingStylesheets(); |
| 135 | 135 |
| 136 if (charnum >= getNumberOfChars()) { | 136 if (charnum >= getNumberOfChars()) { |
| 137 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 137 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
| 138 return nullptr; | 138 return nullptr; |
| 139 } | 139 } |
| 140 | 140 |
| 141 FloatPoint point = SVGTextQuery(layoutObject()).endPositionOfCharacter(charn
um); | 141 FloatPoint point = SVGTextQuery(layoutObject()).endPositionOfCharacter(charn
um); |
| 142 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); | 142 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); |
| 143 } | 143 } |
| 144 | 144 |
| 145 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(un
signed charnum, ExceptionState& exceptionState) | 145 RawPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(unsigned charnum,
ExceptionState& exceptionState) |
| 146 { | 146 { |
| 147 document().updateLayoutIgnorePendingStylesheets(); | 147 document().updateLayoutIgnorePendingStylesheets(); |
| 148 | 148 |
| 149 if (charnum >= getNumberOfChars()) { | 149 if (charnum >= getNumberOfChars()) { |
| 150 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 150 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
| 151 return nullptr; | 151 return nullptr; |
| 152 } | 152 } |
| 153 | 153 |
| 154 FloatRect rect = SVGTextQuery(layoutObject()).extentOfCharacter(charnum); | 154 FloatRect rect = SVGTextQuery(layoutObject()).extentOfCharacter(charnum); |
| 155 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal
); | 155 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal
); |
| 156 } | 156 } |
| 157 | 157 |
| 158 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState&
exceptionState) | 158 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState&
exceptionState) |
| 159 { | 159 { |
| 160 document().updateLayoutIgnorePendingStylesheets(); | 160 document().updateLayoutIgnorePendingStylesheets(); |
| 161 | 161 |
| 162 if (charnum >= getNumberOfChars()) { | 162 if (charnum >= getNumberOfChars()) { |
| 163 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 163 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
| 164 return 0.0f; | 164 return 0.0f; |
| 165 } | 165 } |
| 166 | 166 |
| 167 return SVGTextQuery(layoutObject()).rotationOfCharacter(charnum); | 167 return SVGTextQuery(layoutObject()).rotationOfCharacter(charnum); |
| 168 } | 168 } |
| 169 | 169 |
| 170 int SVGTextContentElement::getCharNumAtPosition(PassRefPtrWillBeRawPtr<SVGPointT
earOff> point, ExceptionState& exceptionState) | 170 int SVGTextContentElement::getCharNumAtPosition(RawPtr<SVGPointTearOff> point, E
xceptionState& exceptionState) |
| 171 { | 171 { |
| 172 document().updateLayoutIgnorePendingStylesheets(); | 172 document().updateLayoutIgnorePendingStylesheets(); |
| 173 return SVGTextQuery(layoutObject()).characterNumberAtPosition(point->target(
)->value()); | 173 return SVGTextQuery(layoutObject()).characterNumberAtPosition(point->target(
)->value()); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
xceptionState& exceptionState) | 176 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
xceptionState& exceptionState) |
| 177 { | 177 { |
| 178 unsigned numberOfChars = getNumberOfChars(); | 178 unsigned numberOfChars = getNumberOfChars(); |
| 179 if (charnum >= numberOfChars) { | 179 if (charnum >= numberOfChars) { |
| 180 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); | 180 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 if (!layoutObject->isSVGText() && !layoutObject->isSVGInline()) | 258 if (!layoutObject->isSVGText() && !layoutObject->isSVGInline()) |
| 259 return nullptr; | 259 return nullptr; |
| 260 | 260 |
| 261 SVGElement* element = toSVGElement(layoutObject->node()); | 261 SVGElement* element = toSVGElement(layoutObject->node()); |
| 262 ASSERT(element); | 262 ASSERT(element); |
| 263 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element)
: 0; | 263 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element)
: 0; |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |