Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 for (size_t i = 0, size = wordMeasurements.size(); i < size && lastEndOf fset < run->m_stop; ++i) { | 488 for (size_t i = 0, size = wordMeasurements.size(); i < size && lastEndOf fset < run->m_stop; ++i) { |
| 489 const WordMeasurement& wordMeasurement = wordMeasurements[i]; | 489 const WordMeasurement& wordMeasurement = wordMeasurements[i]; |
| 490 if (wordMeasurement.width <=0 || wordMeasurement.startOffset == word Measurement.endOffset) | 490 if (wordMeasurement.width <=0 || wordMeasurement.startOffset == word Measurement.endOffset) |
| 491 continue; | 491 continue; |
| 492 if (wordMeasurement.renderer != renderer || wordMeasurement.startOff set != lastEndOffset || wordMeasurement.endOffset > run->m_stop) | 492 if (wordMeasurement.renderer != renderer || wordMeasurement.startOff set != lastEndOffset || wordMeasurement.endOffset > run->m_stop) |
| 493 continue; | 493 continue; |
| 494 | 494 |
| 495 lastEndOffset = wordMeasurement.endOffset; | 495 lastEndOffset = wordMeasurement.endOffset; |
| 496 if (kerningIsEnabled && lastEndOffset == run->m_stop) { | 496 if (kerningIsEnabled && lastEndOffset == run->m_stop) { |
| 497 int wordLength = lastEndOffset - wordMeasurement.startOffset; | 497 int wordLength = lastEndOffset - wordMeasurement.startOffset; |
| 498 measuredWidth += renderer->width(wordMeasurement.startOffset, wo rdLength, xPos, lineInfo.isFirstLine()); | 498 measuredWidth += renderer->width(wordMeasurement.startOffset, wo rdLength, xPos, LTR, lineInfo.isFirstLine()); |
|
leviw_travelin_and_unemployed
2014/01/07 01:57:33
Why is this different than the call below?
| |
| 499 if (i > 0 && wordLength == 1 && renderer->characterAt(wordMeasur ement.startOffset) == ' ') | 499 if (i > 0 && wordLength == 1 && renderer->characterAt(wordMeasur ement.startOffset) == ' ') |
| 500 measuredWidth += renderer->style()->wordSpacing(); | 500 measuredWidth += renderer->style()->wordSpacing(); |
| 501 } else | 501 } else |
| 502 measuredWidth += wordMeasurement.width; | 502 measuredWidth += wordMeasurement.width; |
| 503 if (!wordMeasurement.fallbackFonts.isEmpty()) { | 503 if (!wordMeasurement.fallbackFonts.isEmpty()) { |
| 504 HashSet<const SimpleFontData*>::const_iterator end = wordMeasure ment.fallbackFonts.end(); | 504 HashSet<const SimpleFontData*>::const_iterator end = wordMeasure ment.fallbackFonts.end(); |
| 505 for (HashSet<const SimpleFontData*>::const_iterator it = wordMea surement.fallbackFonts.begin(); it != end; ++it) | 505 for (HashSet<const SimpleFontData*>::const_iterator it = wordMea surement.fallbackFonts.begin(); it != end; ++it) |
| 506 fallbackFonts.add(*it); | 506 fallbackFonts.add(*it); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 if (measuredWidth && lastEndOffset != run->m_stop) { | 509 if (measuredWidth && lastEndOffset != run->m_stop) { |
| 510 // If we don't have enough cached data, we'll measure the run again. | 510 // If we don't have enough cached data, we'll measure the run again. |
| 511 measuredWidth = 0; | 511 measuredWidth = 0; |
| 512 fallbackFonts.clear(); | 512 fallbackFonts.clear(); |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 | 515 |
| 516 if (!measuredWidth) | 516 if (!measuredWidth) |
| 517 measuredWidth = renderer->width(run->m_start, run->m_stop - run->m_start , xPos, lineInfo.isFirstLine(), &fallbackFonts, &glyphOverflow); | 517 measuredWidth = renderer->width(run->m_start, run->m_stop - run->m_start , xPos, run->reversed(false) ? RTL : LTR, lineInfo.isFirstLine(), &fallbackFonts , &glyphOverflow); |
|
eseidel
2014/01/07 02:52:57
I thought that run had a direction() accessor in a
| |
| 518 | 518 |
| 519 run->m_box->setLogicalWidth(measuredWidth + hyphenWidth); | 519 run->m_box->setLogicalWidth(measuredWidth + hyphenWidth); |
| 520 if (!fallbackFonts.isEmpty()) { | 520 if (!fallbackFonts.isEmpty()) { |
| 521 ASSERT(run->m_box->isText()); | 521 ASSERT(run->m_box->isText()); |
| 522 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(toInl ineTextBox(run->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow ())).iterator; | 522 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(toInl ineTextBox(run->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow ())).iterator; |
| 523 ASSERT(it->value.first.isEmpty()); | 523 ASSERT(it->value.first.isEmpty()); |
| 524 copyToVector(fallbackFonts, it->value.first); | 524 copyToVector(fallbackFonts, it->value.first); |
| 525 run->m_box->parent()->clearDescendantsHaveSameLineHeightAndBaseline(); | 525 run->m_box->parent()->clearDescendantsHaveSameLineHeightAndBaseline(); |
| 526 } | 526 } |
| 527 if ((glyphOverflow.top || glyphOverflow.bottom || glyphOverflow.left || glyp hOverflow.right)) { | 527 if ((glyphOverflow.top || glyphOverflow.bottom || glyphOverflow.left || glyp hOverflow.right)) { |
| (...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2415 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); | 2415 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); |
| 2416 | 2416 |
| 2417 setLineGridBox(lineGridBox); | 2417 setLineGridBox(lineGridBox); |
| 2418 | 2418 |
| 2419 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying | 2419 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying |
| 2420 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping | 2420 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping |
| 2421 // to this grid. | 2421 // to this grid. |
| 2422 } | 2422 } |
| 2423 | 2423 |
| 2424 } | 2424 } |
| OLD | NEW |