| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (LayoutSVGText* textLayoutObject = | 60 if (LayoutSVGText* textLayoutObject = |
| 61 LayoutSVGText::locateLayoutSVGTextAncestor(this)) | 61 LayoutSVGText::locateLayoutSVGTextAncestor(this)) |
| 62 textLayoutObject->subtreeTextDidChange(); | 62 textLayoutObject->subtreeTextDidChange(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void LayoutSVGInlineText::styleDidChange(StyleDifference diff, | 65 void LayoutSVGInlineText::styleDidChange(StyleDifference diff, |
| 66 const ComputedStyle* oldStyle) { | 66 const ComputedStyle* oldStyle) { |
| 67 LayoutText::styleDidChange(diff, oldStyle); | 67 LayoutText::styleDidChange(diff, oldStyle); |
| 68 updateScaledFont(); | 68 updateScaledFont(); |
| 69 | 69 |
| 70 bool newPreserves = style() ? style()->whiteSpace() == PRE : false; | 70 bool newPreserves = |
| 71 bool oldPreserves = oldStyle ? oldStyle->whiteSpace() == PRE : false; | 71 style() ? style()->whiteSpace() == EWhiteSpace::Pre : false; |
| 72 bool oldPreserves = |
| 73 oldStyle ? oldStyle->whiteSpace() == EWhiteSpace::Pre : false; |
| 72 if (oldPreserves != newPreserves) { | 74 if (oldPreserves != newPreserves) { |
| 73 setText(originalText(), true); | 75 setText(originalText(), true); |
| 74 return; | 76 return; |
| 75 } | 77 } |
| 76 | 78 |
| 77 if (!diff.needsFullLayout()) | 79 if (!diff.needsFullLayout()) |
| 78 return; | 80 return; |
| 79 | 81 |
| 80 // The text metrics may be influenced by style changes. | 82 // The text metrics may be influenced by style changes. |
| 81 if (LayoutSVGText* textLayoutObject = | 83 if (LayoutSVGText* textLayoutObject = |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 scaledFont().individualCharacterRanges(run); | 292 scaledFont().individualCharacterRanges(run); |
| 291 synthesizeGraphemeWidths(run, charRanges); | 293 synthesizeGraphemeWidths(run, charRanges); |
| 292 | 294 |
| 293 const SimpleFontData* fontData = scaledFont().primaryFont(); | 295 const SimpleFontData* fontData = scaledFont().primaryFont(); |
| 294 DCHECK(fontData); | 296 DCHECK(fontData); |
| 295 if (!fontData) | 297 if (!fontData) |
| 296 return; | 298 return; |
| 297 | 299 |
| 298 const float cachedFontHeight = | 300 const float cachedFontHeight = |
| 299 fontData->getFontMetrics().floatHeight() / m_scalingFactor; | 301 fontData->getFontMetrics().floatHeight() / m_scalingFactor; |
| 300 const bool preserveWhiteSpace = styleRef().whiteSpace() == PRE; | 302 const bool preserveWhiteSpace = styleRef().whiteSpace() == EWhiteSpace::Pre; |
| 301 const unsigned runLength = run.length(); | 303 const unsigned runLength = run.length(); |
| 302 | 304 |
| 303 // TODO(pdr): Character-based iteration is ambiguous and error-prone. It | 305 // TODO(pdr): Character-based iteration is ambiguous and error-prone. It |
| 304 // should be unified under a single concept. See: https://crbug.com/593570 | 306 // should be unified under a single concept. See: https://crbug.com/593570 |
| 305 unsigned characterIndex = 0; | 307 unsigned characterIndex = 0; |
| 306 while (characterIndex < runLength) { | 308 while (characterIndex < runLength) { |
| 307 bool currentCharacterIsWhiteSpace = run[characterIndex] == ' '; | 309 bool currentCharacterIsWhiteSpace = run[characterIndex] == ' '; |
| 308 if (!preserveWhiteSpace && lastCharacterWasWhiteSpace && | 310 if (!preserveWhiteSpace && lastCharacterWasWhiteSpace && |
| 309 currentCharacterIsWhiteSpace) { | 311 currentCharacterIsWhiteSpace) { |
| 310 m_metrics.append(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics)); | 312 m_metrics.append(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics)); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } | 413 } |
| 412 | 414 |
| 413 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { | 415 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { |
| 414 RefPtr<StringImpl> result = LayoutText::originalText(); | 416 RefPtr<StringImpl> result = LayoutText::originalText(); |
| 415 if (!result) | 417 if (!result) |
| 416 return nullptr; | 418 return nullptr; |
| 417 return normalizeWhitespace(result); | 419 return normalizeWhitespace(result); |
| 418 } | 420 } |
| 419 | 421 |
| 420 } // namespace blink | 422 } // namespace blink |
| OLD | NEW |