| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
| 3 * Copyright (C) 2006 Apple Computer Inc. | 3 * Copyright (C) 2006 Apple Computer Inc. |
| 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 5 * Copyright (C) 2008 Rob Buis <buis@kde.org> | 5 * Copyright (C) 2008 Rob Buis <buis@kde.org> |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 | 25 |
| 26 #include "core/layout/svg/LayoutSVGInlineText.h" | 26 #include "core/layout/svg/LayoutSVGInlineText.h" |
| 27 | 27 |
| 28 #include "core/css/CSSFontSelector.h" | 28 #include "core/css/CSSFontSelector.h" |
| 29 #include "core/css/FontSize.h" | 29 #include "core/css/FontSize.h" |
| 30 #include "core/dom/StyleEngine.h" | 30 #include "core/dom/StyleEngine.h" |
| 31 #include "core/editing/TextAffinity.h" |
| 31 #include "core/editing/VisiblePosition.h" | 32 #include "core/editing/VisiblePosition.h" |
| 32 #include "core/layout/svg/LayoutSVGText.h" | 33 #include "core/layout/svg/LayoutSVGText.h" |
| 33 #include "core/layout/svg/SVGLayoutSupport.h" | 34 #include "core/layout/svg/SVGLayoutSupport.h" |
| 34 #include "core/layout/svg/line/SVGInlineTextBox.h" | 35 #include "core/layout/svg/line/SVGInlineTextBox.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 static PassRefPtr<StringImpl> applySVGWhitespaceRules(PassRefPtr<StringImpl> str
ing, bool preserveWhiteSpace) | 39 static PassRefPtr<StringImpl> applySVGWhitespaceRules(PassRefPtr<StringImpl> str
ing, bool preserveWhiteSpace) |
| 39 { | 40 { |
| 40 if (preserveWhiteSpace) { | 41 if (preserveWhiteSpace) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 closestDistanceFragment = &fragment; | 205 closestDistanceFragment = &fragment; |
| 205 closestDistancePosition = fragmentRect.x(); | 206 closestDistancePosition = fragmentRect.x(); |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 } | 209 } |
| 209 | 210 |
| 210 if (!closestDistanceFragment) | 211 if (!closestDistanceFragment) |
| 211 return createPositionWithAffinity(0); | 212 return createPositionWithAffinity(0); |
| 212 | 213 |
| 213 int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanc
eFragment, absolutePoint.x() - closestDistancePosition, true); | 214 int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanc
eFragment, absolutePoint.x() - closestDistancePosition, true); |
| 214 return createPositionWithAffinity(offset + closestDistanceBox->start(), offs
et > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM); | 215 return createPositionWithAffinity(offset + closestDistanceBox->start(), offs
et > 0 ? VP_UPSTREAM_IF_POSSIBLE : TextAffinity::Downstream); |
| 215 } | 216 } |
| 216 | 217 |
| 217 void LayoutSVGInlineText::updateScaledFont() | 218 void LayoutSVGInlineText::updateScaledFont() |
| 218 { | 219 { |
| 219 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont); | 220 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont); |
| 220 } | 221 } |
| 221 | 222 |
| 222 void LayoutSVGInlineText::computeNewScaledFontForStyle(LayoutObject* layoutObjec
t, const ComputedStyle* style, float& scalingFactor, Font& scaledFont) | 223 void LayoutSVGInlineText::computeNewScaledFontForStyle(LayoutObject* layoutObjec
t, const ComputedStyle* style, float& scalingFactor, Font& scaledFont) |
| 223 { | 224 { |
| 224 ASSERT(style); | 225 ASSERT(style); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 255 | 256 |
| 256 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const | 257 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const |
| 257 { | 258 { |
| 258 RefPtr<StringImpl> result = LayoutText::originalText(); | 259 RefPtr<StringImpl> result = LayoutText::originalText(); |
| 259 if (!result) | 260 if (!result) |
| 260 return nullptr; | 261 return nullptr; |
| 261 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P
RE); | 262 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P
RE); |
| 262 } | 263 } |
| 263 | 264 |
| 264 } | 265 } |
| OLD | NEW |