| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. | 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), ru
n.length()); | 350 stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), ru
n.length()); |
| 351 source = stringFor8BitRun.characters16(); | 351 source = stringFor8BitRun.characters16(); |
| 352 } else | 352 } else |
| 353 source = run.characters16(); | 353 source = run.characters16(); |
| 354 | 354 |
| 355 *destinationLength = 0; | 355 *destinationLength = 0; |
| 356 while (position < length) { | 356 while (position < length) { |
| 357 UChar32 character; | 357 UChar32 character; |
| 358 U16_NEXT(source, position, length, character); | 358 U16_NEXT(source, position, length, character); |
| 359 // Don't normalize tabs as they are not treated as spaces for word-end. | 359 // Don't normalize tabs as they are not treated as spaces for word-end. |
| 360 if (Character::treatAsSpace(character) && character != '\t') | 360 if (Character::treatAsSpace(character) && character != tabulationCharact
er) |
| 361 character = ' '; | 361 character = space; |
| 362 else if (Character::treatAsZeroWidthSpaceInComplexScript(character)) | 362 else if (Character::treatAsZeroWidthSpaceInComplexScript(character)) |
| 363 character = zeroWidthSpace; | 363 character = zeroWidthSpace; |
| 364 U16_APPEND(destination, *destinationLength, length, character, error); | 364 U16_APPEND(destination, *destinationLength, length, character, error); |
| 365 ASSERT_UNUSED(error, !error); | 365 ASSERT_UNUSED(error, !error); |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run, ForTextEmph
asisOrNot forTextEmphasis) | 369 HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run, ForTextEmph
asisOrNot forTextEmphasis) |
| 370 : m_font(font) | 370 : m_font(font) |
| 371 , m_normalizedBufferLength(0) | 371 , m_normalizedBufferLength(0) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 382 { | 382 { |
| 383 m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); | 383 m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); |
| 384 normalizeCharacters(m_run, m_run.length(), m_normalizedBuffer.get(), &m_norm
alizedBufferLength); | 384 normalizeCharacters(m_run, m_run.length(), m_normalizedBuffer.get(), &m_norm
alizedBufferLength); |
| 385 setPadding(m_run.expansion()); | 385 setPadding(m_run.expansion()); |
| 386 setFontFeatures(); | 386 setFontFeatures(); |
| 387 } | 387 } |
| 388 | 388 |
| 389 // In complex text word-spacing affects each line-break, space (U+0020) and non-
breaking space (U+00A0). | 389 // In complex text word-spacing affects each line-break, space (U+0020) and non-
breaking space (U+00A0). |
| 390 static inline bool isCodepointSpace(UChar c) | 390 static inline bool isCodepointSpace(UChar c) |
| 391 { | 391 { |
| 392 return c == ' ' || c == noBreakSpace || c == '\n'; | 392 return c == space || c == noBreakSpace || c == newlineCharacter; |
| 393 } | 393 } |
| 394 | 394 |
| 395 static inline bool isWordEnd(const UChar* normalizedBuffer, unsigned index) | 395 static inline bool isWordEnd(const UChar* normalizedBuffer, unsigned index) |
| 396 { | 396 { |
| 397 // This could refer a high-surrogate, but should work. | 397 // This could refer a high-surrogate, but should work. |
| 398 return index && isCodepointSpace(normalizedBuffer[index]); | 398 return index && isCodepointSpace(normalizedBuffer[index]); |
| 399 } | 399 } |
| 400 | 400 |
| 401 int HarfBuzzShaper::determineWordBreakSpacing() | 401 int HarfBuzzShaper::determineWordBreakSpacing() |
| 402 { | 402 { |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 point.x() + fromX, point.x() + toX, | 1140 point.x() + fromX, point.x() + toX, |
| 1141 point.y(), height); | 1141 point.y(), height); |
| 1142 } | 1142 } |
| 1143 | 1143 |
| 1144 return Font::pixelSnappedSelectionRect( | 1144 return Font::pixelSnappedSelectionRect( |
| 1145 point.x() + toX, point.x() + fromX, | 1145 point.x() + toX, point.x() + fromX, |
| 1146 point.y(), height); | 1146 point.y(), height); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 } // namespace blink | 1149 } // namespace blink |
| OLD | NEW |