Chromium Code Reviews| 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 SelectionInDOMTree::Builder builder; | |
|
Xiaocheng
2016/10/21 11:18:36
How about just setBaseAndExtentDeprecated?
Since
yosin_UTC9
2016/10/24 06:19:44
Done.
| |
| 229 if (start.isNotNull() && end.isNotNull()) { | |
| 230 builder.collapse(start.toPositionWithAffinity()) | |
| 231 .extend(end.deepEquivalent()); | |
| 232 } else if (start.isNotNull()) { | |
| 233 builder.collapse(start.toPositionWithAffinity()); | |
| 234 } else if (end.isNotNull()) { | |
| 235 builder.collapse(end.toPositionWithAffinity()); | |
| 236 } | |
| 237 | |
| 228 document().frame()->selection().setSelection( | 238 document().frame()->selection().setSelection( |
|
Xiaocheng
2016/10/21 11:18:36
We should use the FrameSelection::setSelection(Sel
yosin_UTC9
2016/10/24 06:19:44
Good catch!
| |
| 229 createVisibleSelection(start, end)); | 239 createVisibleSelection(builder.build())); |
| 230 } | 240 } |
| 231 | 241 |
| 232 bool SVGTextContentElement::isPresentationAttribute( | 242 bool SVGTextContentElement::isPresentationAttribute( |
| 233 const QualifiedName& name) const { | 243 const QualifiedName& name) const { |
| 234 if (name.matches(XMLNames::spaceAttr)) | 244 if (name.matches(XMLNames::spaceAttr)) |
| 235 return true; | 245 return true; |
| 236 return SVGGraphicsElement::isPresentationAttribute(name); | 246 return SVGGraphicsElement::isPresentationAttribute(name); |
| 237 } | 247 } |
| 238 | 248 |
| 239 void SVGTextContentElement::collectStyleForPresentationAttribute( | 249 void SVGTextContentElement::collectStyleForPresentationAttribute( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 (!lineLayoutItem.isSVGText() && !lineLayoutItem.isSVGInline())) | 299 (!lineLayoutItem.isSVGText() && !lineLayoutItem.isSVGInline())) |
| 290 return nullptr; | 300 return nullptr; |
| 291 | 301 |
| 292 SVGElement* element = toSVGElement(lineLayoutItem.node()); | 302 SVGElement* element = toSVGElement(lineLayoutItem.node()); |
| 293 ASSERT(element); | 303 ASSERT(element); |
| 294 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element) | 304 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element) |
| 295 : 0; | 305 : 0; |
| 296 } | 306 } |
| 297 | 307 |
| 298 } // namespace blink | 308 } // namespace blink |
| OLD | NEW |