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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 VisiblePosition start = VisiblePosition::firstPositionInNode( | 218 VisiblePosition start = VisiblePosition::firstPositionInNode( |
219 const_cast<SVGTextContentElement*>(this)); | 219 const_cast<SVGTextContentElement*>(this)); |
220 for (unsigned i = 0; i < charnum; ++i) | 220 for (unsigned i = 0; i < charnum; ++i) |
221 start = nextPositionOf(start); | 221 start = nextPositionOf(start); |
222 | 222 |
223 // Find selection end | 223 // Find selection end |
224 VisiblePosition end(start); | 224 VisiblePosition end(start); |
225 for (unsigned i = 0; i < nchars; ++i) | 225 for (unsigned i = 0; i < nchars; ++i) |
226 end = nextPositionOf(end); | 226 end = nextPositionOf(end); |
227 | 227 |
| 228 // TODO(editing-dev): We assume |start| and |end| are not null and we don't |
| 229 // known when |start| and |end| are null. Once we get a such case, we check |
| 230 // null for |start| and |end|. |
228 document().frame()->selection().setSelection( | 231 document().frame()->selection().setSelection( |
229 createVisibleSelection(start, end)); | 232 SelectionInDOMTree::Builder() |
| 233 .setBaseAndExtent(start.deepEquivalent(), end.deepEquivalent()) |
| 234 .setAffinity(start.affinity()) |
| 235 .build()); |
230 } | 236 } |
231 | 237 |
232 bool SVGTextContentElement::isPresentationAttribute( | 238 bool SVGTextContentElement::isPresentationAttribute( |
233 const QualifiedName& name) const { | 239 const QualifiedName& name) const { |
234 if (name.matches(XMLNames::spaceAttr)) | 240 if (name.matches(XMLNames::spaceAttr)) |
235 return true; | 241 return true; |
236 return SVGGraphicsElement::isPresentationAttribute(name); | 242 return SVGGraphicsElement::isPresentationAttribute(name); |
237 } | 243 } |
238 | 244 |
239 void SVGTextContentElement::collectStyleForPresentationAttribute( | 245 void SVGTextContentElement::collectStyleForPresentationAttribute( |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 (!lineLayoutItem.isSVGText() && !lineLayoutItem.isSVGInline())) | 295 (!lineLayoutItem.isSVGText() && !lineLayoutItem.isSVGInline())) |
290 return nullptr; | 296 return nullptr; |
291 | 297 |
292 SVGElement* element = toSVGElement(lineLayoutItem.node()); | 298 SVGElement* element = toSVGElement(lineLayoutItem.node()); |
293 ASSERT(element); | 299 ASSERT(element); |
294 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element) | 300 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element) |
295 : 0; | 301 : 0; |
296 } | 302 } |
297 | 303 |
298 } // namespace blink | 304 } // namespace blink |
OLD | NEW |