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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = | 70 bool newPreserves = |
71 style() ? style()->whiteSpace() == EWhiteSpace::Pre : false; | 71 style() ? style()->whiteSpace() == EWhiteSpace::kPre : false; |
72 bool oldPreserves = | 72 bool oldPreserves = |
73 oldStyle ? oldStyle->whiteSpace() == EWhiteSpace::Pre : false; | 73 oldStyle ? oldStyle->whiteSpace() == EWhiteSpace::kPre : false; |
74 if (oldPreserves != newPreserves) { | 74 if (oldPreserves != newPreserves) { |
75 setText(originalText(), true); | 75 setText(originalText(), true); |
76 return; | 76 return; |
77 } | 77 } |
78 | 78 |
79 if (!diff.needsFullLayout()) | 79 if (!diff.needsFullLayout()) |
80 return; | 80 return; |
81 | 81 |
82 // The text metrics may be influenced by style changes. | 82 // The text metrics may be influenced by style changes. |
83 if (LayoutSVGText* textLayoutObject = | 83 if (LayoutSVGText* textLayoutObject = |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 scaledFont().individualCharacterRanges(run); | 292 scaledFont().individualCharacterRanges(run); |
293 synthesizeGraphemeWidths(run, charRanges); | 293 synthesizeGraphemeWidths(run, charRanges); |
294 | 294 |
295 const SimpleFontData* fontData = scaledFont().primaryFont(); | 295 const SimpleFontData* fontData = scaledFont().primaryFont(); |
296 DCHECK(fontData); | 296 DCHECK(fontData); |
297 if (!fontData) | 297 if (!fontData) |
298 return; | 298 return; |
299 | 299 |
300 const float cachedFontHeight = | 300 const float cachedFontHeight = |
301 fontData->getFontMetrics().floatHeight() / m_scalingFactor; | 301 fontData->getFontMetrics().floatHeight() / m_scalingFactor; |
302 const bool preserveWhiteSpace = styleRef().whiteSpace() == EWhiteSpace::Pre; | 302 const bool preserveWhiteSpace = styleRef().whiteSpace() == EWhiteSpace::kPre; |
303 const unsigned runLength = run.length(); | 303 const unsigned runLength = run.length(); |
304 | 304 |
305 // TODO(pdr): Character-based iteration is ambiguous and error-prone. It | 305 // TODO(pdr): Character-based iteration is ambiguous and error-prone. It |
306 // 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 |
307 unsigned characterIndex = 0; | 307 unsigned characterIndex = 0; |
308 while (characterIndex < runLength) { | 308 while (characterIndex < runLength) { |
309 bool currentCharacterIsWhiteSpace = run[characterIndex] == ' '; | 309 bool currentCharacterIsWhiteSpace = run[characterIndex] == ' '; |
310 if (!preserveWhiteSpace && lastCharacterWasWhiteSpace && | 310 if (!preserveWhiteSpace && lastCharacterWasWhiteSpace && |
311 currentCharacterIsWhiteSpace) { | 311 currentCharacterIsWhiteSpace) { |
312 m_metrics.append(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics)); | 312 m_metrics.append(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics)); |
(...skipping 15 matching lines...) Expand all Loading... |
328 m_metrics.clear(); | 328 m_metrics.clear(); |
329 | 329 |
330 if (!textLength()) | 330 if (!textLength()) |
331 return; | 331 return; |
332 | 332 |
333 TextRun run = | 333 TextRun run = |
334 constructTextRun(*this, 0, textLength(), styleRef().direction()); | 334 constructTextRun(*this, 0, textLength(), styleRef().direction()); |
335 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; | 335 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; |
336 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); | 336 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); |
337 bool bidiOverride = isOverride(styleRef().unicodeBidi()); | 337 bool bidiOverride = isOverride(styleRef().unicodeBidi()); |
338 BidiStatus status(TextDirection::Ltr, bidiOverride); | 338 BidiStatus status(TextDirection::kLtr, bidiOverride); |
339 if (run.is8Bit() || bidiOverride) { | 339 if (run.is8Bit() || bidiOverride) { |
340 WTF::Unicode::CharDirection direction = WTF::Unicode::LeftToRight; | 340 WTF::Unicode::CharDirection direction = WTF::Unicode::LeftToRight; |
341 // If BiDi override is in effect, use the specified direction. | 341 // If BiDi override is in effect, use the specified direction. |
342 if (bidiOverride && !styleRef().isLeftToRightDirection()) | 342 if (bidiOverride && !styleRef().isLeftToRightDirection()) |
343 direction = WTF::Unicode::RightToLeft; | 343 direction = WTF::Unicode::RightToLeft; |
344 bidiRuns.addRun(new BidiCharacterRun( | 344 bidiRuns.addRun(new BidiCharacterRun( |
345 status.context->override(), status.context->level(), 0, | 345 status.context->override(), status.context->level(), 0, |
346 run.charactersLength(), direction, status.context->dir())); | 346 run.charactersLength(), direction, status.context->dir())); |
347 } else { | 347 } else { |
348 status.last = status.lastStrong = WTF::Unicode::OtherNeutral; | 348 status.last = status.lastStrong = WTF::Unicode::OtherNeutral; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 | 416 |
417 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { | 417 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { |
418 RefPtr<StringImpl> result = LayoutText::originalText(); | 418 RefPtr<StringImpl> result = LayoutText::originalText(); |
419 if (!result) | 419 if (!result) |
420 return nullptr; | 420 return nullptr; |
421 return normalizeWhitespace(result); | 421 return normalizeWhitespace(result); |
422 } | 422 } |
423 | 423 |
424 } // namespace blink | 424 } // namespace blink |
OLD | NEW |