| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * (C) 1999 Lars Knoll (knoll@kde.org) | 2  * (C) 1999 Lars Knoll (knoll@kde.org) | 
| 3  * (C) 2000 Dirk Mueller (mueller@kde.org) | 3  * (C) 2000 Dirk Mueller (mueller@kde.org) | 
| 4  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
     ights reserved. | 4  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. | 
|  | 5  *               All rights reserved. | 
| 5  * | 6  * | 
| 6  * This library is free software; you can redistribute it and/or | 7  * This library is free software; you can redistribute it and/or | 
| 7  * modify it under the terms of the GNU Library General Public | 8  * modify it under the terms of the GNU Library General Public | 
| 8  * License as published by the Free Software Foundation; either | 9  * License as published by the Free Software Foundation; either | 
| 9  * version 2 of the License, or (at your option) any later version. | 10  * version 2 of the License, or (at your option) any later version. | 
| 10  * | 11  * | 
| 11  * This library is distributed in the hope that it will be useful, | 12  * This library is distributed in the hope that it will be useful, | 
| 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
| 14  * Library General Public License for more details. | 15  * Library General Public License for more details. | 
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 170     else if (state == SelectionBoth) | 171     else if (state == SelectionBoth) | 
| 171       state = SelectionNone; | 172       state = SelectionNone; | 
| 172   } | 173   } | 
| 173 | 174 | 
| 174   // If there are ellipsis following, make sure their selection is updated. | 175   // If there are ellipsis following, make sure their selection is updated. | 
| 175   if (m_truncation != cNoTruncation && root().ellipsisBox()) { | 176   if (m_truncation != cNoTruncation && root().ellipsisBox()) { | 
| 176     EllipsisBox* ellipsis = root().ellipsisBox(); | 177     EllipsisBox* ellipsis = root().ellipsisBox(); | 
| 177     if (state != SelectionNone) { | 178     if (state != SelectionNone) { | 
| 178       int start, end; | 179       int start, end; | 
| 179       selectionStartEnd(start, end); | 180       selectionStartEnd(start, end); | 
| 180       // The ellipsis should be considered to be selected if the end of | 181       // The ellipsis should be considered to be selected if the end of the | 
| 181       // the selection is past the beginning of the truncation and the | 182       // selection is past the beginning of the truncation and the beginning of | 
| 182       // beginning of the selection is before or at the beginning of the | 183       // the selection is before or at the beginning of the truncation. | 
| 183       // truncation. |  | 
| 184       ellipsis->setSelectionState(end >= m_truncation && start <= m_truncation | 184       ellipsis->setSelectionState(end >= m_truncation && start <= m_truncation | 
| 185                                       ? SelectionInside | 185                                       ? SelectionInside | 
| 186                                       : SelectionNone); | 186                                       : SelectionNone); | 
| 187     } else { | 187     } else { | 
| 188       ellipsis->setSelectionState(SelectionNone); | 188       ellipsis->setSelectionState(SelectionNone); | 
| 189     } | 189     } | 
| 190   } | 190   } | 
| 191 | 191 | 
| 192   return state; | 192   return state; | 
| 193 } | 193 } | 
| 194 | 194 | 
| 195 bool InlineTextBox::hasWrappedSelectionNewline() const { | 195 bool InlineTextBox::hasWrappedSelectionNewline() const { | 
| 196   // TODO(wkorman): We shouldn't need layout at this point and it should | 196   // TODO(wkorman): We shouldn't need layout at this point and it should be | 
| 197   // be enforced by DocumentLifecycle. http://crbug.com/537821 | 197   // enforced by DocumentLifecycle. http://crbug.com/537821 | 
| 198   // Bail out as currently looking up selection state can cause the editing | 198   // Bail out as currently looking up selection state can cause the editing code | 
| 199   // code can force a re-layout while scrutinizing the editing position, and | 199   // can force a re-layout while scrutinizing the editing position, and | 
| 200   // InlineTextBox instances are not guaranteed to survive a re-layout. | 200   // InlineTextBox instances are not guaranteed to survive a re-layout. | 
| 201   if (getLineLayoutItem().needsLayout()) | 201   if (getLineLayoutItem().needsLayout()) | 
| 202     return false; | 202     return false; | 
| 203 | 203 | 
| 204   SelectionState state = getSelectionState(); | 204   SelectionState state = getSelectionState(); | 
| 205   return (state == SelectionStart || state == SelectionInside) | 205   return (state == SelectionStart || state == SelectionInside) | 
| 206          // Checking last leaf child can be slow, so we make sure to do this onl
     y | 206          // Checking last leaf child can be slow, so we make sure to do this | 
| 207          // after the other simple conditionals. | 207          // only after the other simple conditionals. | 
| 208          && (root().lastLeafChild() == this) | 208          && (root().lastLeafChild() == this) | 
| 209          // It's possible to have mixed LTR/RTL on a single line, and we only | 209          // It's possible to have mixed LTR/RTL on a single line, and we only | 
| 210          // want to paint a newline when we're the last leaf child and we make | 210          // want to paint a newline when we're the last leaf child and we make | 
| 211          // sure there isn't a differently-directioned box following us. | 211          // sure there isn't a differently-directioned box following us. | 
| 212          && ((!isLeftToRightDirection() && root().firstSelectedBox() == this) || | 212          && ((!isLeftToRightDirection() && root().firstSelectedBox() == this) || | 
| 213              (isLeftToRightDirection() && root().lastSelectedBox() == this)); | 213              (isLeftToRightDirection() && root().lastSelectedBox() == this)); | 
| 214 } | 214 } | 
| 215 | 215 | 
| 216 float InlineTextBox::newlineSpaceWidth() const { | 216 float InlineTextBox::newlineSpaceWidth() const { | 
| 217   const ComputedStyle& styleToUse = | 217   const ComputedStyle& styleToUse = | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 237   StringBuilder charactersWithHyphen; | 237   StringBuilder charactersWithHyphen; | 
| 238   bool respectHyphen = ePos == m_len && hasHyphen(); | 238   bool respectHyphen = ePos == m_len && hasHyphen(); | 
| 239   TextRun textRun = | 239   TextRun textRun = | 
| 240       constructTextRun(styleToUse, respectHyphen ? &charactersWithHyphen : 0); | 240       constructTextRun(styleToUse, respectHyphen ? &charactersWithHyphen : 0); | 
| 241 | 241 | 
| 242   LayoutPoint startingPoint = LayoutPoint(logicalLeft(), selTop); | 242   LayoutPoint startingPoint = LayoutPoint(logicalLeft(), selTop); | 
| 243   LayoutRect r; | 243   LayoutRect r; | 
| 244   if (sPos || ePos != static_cast<int>(m_len)) { | 244   if (sPos || ePos != static_cast<int>(m_len)) { | 
| 245     r = LayoutRect(enclosingIntRect(font.selectionRectForText( | 245     r = LayoutRect(enclosingIntRect(font.selectionRectForText( | 
| 246         textRun, FloatPoint(startingPoint), selHeight.toInt(), sPos, ePos))); | 246         textRun, FloatPoint(startingPoint), selHeight.toInt(), sPos, ePos))); | 
| 247   } else {  // Avoid computing the font width when the entire line box is select
     ed as an optimization. | 247   } else { | 
|  | 248     // Avoid computing the font width when the entire line box is selected as an | 
|  | 249     // optimization. | 
| 248     r = LayoutRect(enclosingIntRect( | 250     r = LayoutRect(enclosingIntRect( | 
| 249         LayoutRect(startingPoint, LayoutSize(m_logicalWidth, selHeight)))); | 251         LayoutRect(startingPoint, LayoutSize(m_logicalWidth, selHeight)))); | 
| 250   } | 252   } | 
| 251 | 253 | 
| 252   LayoutUnit logicalWidth = r.width(); | 254   LayoutUnit logicalWidth = r.width(); | 
| 253   if (r.x() > logicalRight()) | 255   if (r.x() > logicalRight()) | 
| 254     logicalWidth = LayoutUnit(); | 256     logicalWidth = LayoutUnit(); | 
| 255   else if (r.maxX() > logicalRight()) | 257   else if (r.maxX() > logicalRight()) | 
| 256     logicalWidth = logicalRight() - r.x(); | 258     logicalWidth = logicalRight() - r.x(); | 
| 257 | 259 | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 315                                            LayoutUnit visibleLeftEdge, | 317                                            LayoutUnit visibleLeftEdge, | 
| 316                                            LayoutUnit visibleRightEdge, | 318                                            LayoutUnit visibleRightEdge, | 
| 317                                            LayoutUnit ellipsisWidth, | 319                                            LayoutUnit ellipsisWidth, | 
| 318                                            LayoutUnit& truncatedWidth, | 320                                            LayoutUnit& truncatedWidth, | 
| 319                                            bool& foundBox) { | 321                                            bool& foundBox) { | 
| 320   if (foundBox) { | 322   if (foundBox) { | 
| 321     setTruncation(cFullTruncation); | 323     setTruncation(cFullTruncation); | 
| 322     return LayoutUnit(-1); | 324     return LayoutUnit(-1); | 
| 323   } | 325   } | 
| 324 | 326 | 
| 325   // For LTR this is the left edge of the box, for RTL, the right edge in parent
      coordinates. | 327   // For LTR this is the left edge of the box, for RTL, the right edge in parent | 
|  | 328   // coordinates. | 
| 326   LayoutUnit ellipsisX = flowIsLTR ? visibleRightEdge - ellipsisWidth | 329   LayoutUnit ellipsisX = flowIsLTR ? visibleRightEdge - ellipsisWidth | 
| 327                                    : visibleLeftEdge + ellipsisWidth; | 330                                    : visibleLeftEdge + ellipsisWidth; | 
| 328 | 331 | 
| 329   // Criteria for full truncation: | 332   // Criteria for full truncation: | 
| 330   // LTR: the left edge of the ellipsis is to the left of our text run. | 333   // LTR: the left edge of the ellipsis is to the left of our text run. | 
| 331   // RTL: the right edge of the ellipsis is to the right of our text run. | 334   // RTL: the right edge of the ellipsis is to the right of our text run. | 
| 332   bool ltrFullTruncation = flowIsLTR && ellipsisX <= logicalLeft(); | 335   bool ltrFullTruncation = flowIsLTR && ellipsisX <= logicalLeft(); | 
| 333   bool rtlFullTruncation = | 336   bool rtlFullTruncation = | 
| 334       !flowIsLTR && ellipsisX >= logicalLeft() + logicalWidth(); | 337       !flowIsLTR && ellipsisX >= logicalLeft() + logicalWidth(); | 
| 335   if (ltrFullTruncation || rtlFullTruncation) { | 338   if (ltrFullTruncation || rtlFullTruncation) { | 
| 336     // Too far.  Just set full truncation, but return -1 and let the ellipsis ju
     st be placed at the edge of the box. | 339     // Too far.  Just set full truncation, but return -1 and let the ellipsis | 
|  | 340     // just be placed at the edge of the box. | 
| 337     setTruncation(cFullTruncation); | 341     setTruncation(cFullTruncation); | 
| 338     foundBox = true; | 342     foundBox = true; | 
| 339     return LayoutUnit(-1); | 343     return LayoutUnit(-1); | 
| 340   } | 344   } | 
| 341 | 345 | 
| 342   bool ltrEllipsisWithinBox = flowIsLTR && (ellipsisX < logicalRight()); | 346   bool ltrEllipsisWithinBox = flowIsLTR && (ellipsisX < logicalRight()); | 
| 343   bool rtlEllipsisWithinBox = !flowIsLTR && (ellipsisX > logicalLeft()); | 347   bool rtlEllipsisWithinBox = !flowIsLTR && (ellipsisX > logicalLeft()); | 
| 344   if (ltrEllipsisWithinBox || rtlEllipsisWithinBox) { | 348   if (ltrEllipsisWithinBox || rtlEllipsisWithinBox) { | 
| 345     foundBox = true; | 349     foundBox = true; | 
| 346 | 350 | 
| 347     // The inline box may have different directionality than it's parent.  Since
      truncation | 351     // The inline box may have different directionality than it's parent. Since | 
| 348     // behavior depends both on both the parent and the inline block's direction
     ality, we | 352     // truncation behavior depends both on both the parent and the inline | 
| 349     // must keep track of these separately. | 353     // block's directionality, we must keep track of these separately. | 
| 350     bool ltr = isLeftToRightDirection(); | 354     bool ltr = isLeftToRightDirection(); | 
| 351     if (ltr != flowIsLTR) { | 355     if (ltr != flowIsLTR) { | 
| 352       // Width in pixels of the visible portion of the box, excluding the ellips
     is. | 356       // Width in pixels of the visible portion of the box, excluding the | 
|  | 357       // ellipsis. | 
| 353       int visibleBoxWidth = | 358       int visibleBoxWidth = | 
| 354           (visibleRightEdge - visibleLeftEdge - ellipsisWidth).toInt(); | 359           (visibleRightEdge - visibleLeftEdge - ellipsisWidth).toInt(); | 
| 355       ellipsisX = flowIsLTR ? logicalLeft() + visibleBoxWidth | 360       ellipsisX = flowIsLTR ? logicalLeft() + visibleBoxWidth | 
| 356                             : logicalRight() - visibleBoxWidth; | 361                             : logicalRight() - visibleBoxWidth; | 
| 357     } | 362     } | 
| 358 | 363 | 
| 359     int offset = offsetForPosition(ellipsisX, false); | 364     int offset = offsetForPosition(ellipsisX, false); | 
| 360     if (offset == 0 && ltr == flowIsLTR) { | 365     if (offset == 0 && ltr == flowIsLTR) { | 
| 361       // No characters should be laid out.  Set ourselves to full truncation and
      place the ellipsis at the min of our start | 366       // No characters should be laid out.  Set ourselves to full truncation and | 
| 362       // and the ellipsis edge. | 367       // place the ellipsis at the min of our start and the ellipsis edge. | 
| 363       setTruncation(cFullTruncation); | 368       setTruncation(cFullTruncation); | 
| 364       truncatedWidth += ellipsisWidth; | 369       truncatedWidth += ellipsisWidth; | 
| 365       return std::min(ellipsisX, logicalLeft()); | 370       return std::min(ellipsisX, logicalLeft()); | 
| 366     } | 371     } | 
| 367 | 372 | 
| 368     // Set the truncation index on the text run. | 373     // Set the truncation index on the text run. | 
| 369     setTruncation(offset); | 374     setTruncation(offset); | 
| 370 | 375 | 
| 371     // If we got here that means that we were only partially truncated and we ne
     ed to return the pixel offset at which | 376     // If we got here that means that we were only partially truncated and we | 
| 372     // to place the ellipsis. Where the text and its flow have opposite directio
     ns then our offset into the text is at | 377     // need to return the pixel offset at which to place the ellipsis. Where the | 
| 373     // the start of the part that will be visible. | 378     // text and its flow have opposite directions then our offset into the text | 
|  | 379     // is at the start of the part that will be visible. | 
| 374     LayoutUnit widthOfVisibleText(getLineLayoutItem().width( | 380     LayoutUnit widthOfVisibleText(getLineLayoutItem().width( | 
| 375         ltr == flowIsLTR ? m_start : offset, | 381         ltr == flowIsLTR ? m_start : offset, | 
| 376         ltr == flowIsLTR ? offset : m_len - offset, textPos(), | 382         ltr == flowIsLTR ? offset : m_len - offset, textPos(), | 
| 377         flowIsLTR ? LTR : RTL, isFirstLineStyle())); | 383         flowIsLTR ? LTR : RTL, isFirstLineStyle())); | 
| 378 | 384 | 
| 379     // The ellipsis needs to be placed just after the last visible character. | 385     // The ellipsis needs to be placed just after the last visible character. | 
| 380     // Where "after" is defined by the flow directionality, not the inline | 386     // Where "after" is defined by the flow directionality, not the inline | 
| 381     // box directionality. | 387     // box directionality. | 
| 382     // e.g. In the case of an LTR inline box truncated in an RTL flow then we ca
     n | 388     // e.g. In the case of an LTR inline box truncated in an RTL flow then we | 
| 383     // have a situation such as |Hello| -> |...He| | 389     // can have a situation such as |Hello| -> |...He| | 
| 384     truncatedWidth += widthOfVisibleText + ellipsisWidth; | 390     truncatedWidth += widthOfVisibleText + ellipsisWidth; | 
| 385     if (flowIsLTR) | 391     if (flowIsLTR) | 
| 386       return logicalLeft() + widthOfVisibleText; | 392       return logicalLeft() + widthOfVisibleText; | 
| 387     return logicalRight() - widthOfVisibleText - ellipsisWidth; | 393     return logicalRight() - widthOfVisibleText - ellipsisWidth; | 
| 388   } | 394   } | 
| 389   truncatedWidth += logicalWidth(); | 395   truncatedWidth += logicalWidth(); | 
| 390   return LayoutUnit(-1); | 396   return LayoutUnit(-1); | 
| 391 } | 397 } | 
| 392 | 398 | 
| 393 bool InlineTextBox::isLineBreak() const { | 399 bool InlineTextBox::isLineBreak() const { | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 416                                             locationInContainer, | 422                                             locationInContainer, | 
| 417                                             rect) == StopHitTesting) | 423                                             rect) == StopHitTesting) | 
| 418       return true; | 424       return true; | 
| 419   } | 425   } | 
| 420   return false; | 426   return false; | 
| 421 } | 427 } | 
| 422 | 428 | 
| 423 bool InlineTextBox::getEmphasisMarkPosition( | 429 bool InlineTextBox::getEmphasisMarkPosition( | 
| 424     const ComputedStyle& style, | 430     const ComputedStyle& style, | 
| 425     TextEmphasisPosition& emphasisPosition) const { | 431     TextEmphasisPosition& emphasisPosition) const { | 
| 426   // This function returns true if there are text emphasis marks and they are su
     ppressed by ruby text. | 432   // This function returns true if there are text emphasis marks and they are | 
|  | 433   // suppressed by ruby text. | 
| 427   if (style.getTextEmphasisMark() == TextEmphasisMarkNone) | 434   if (style.getTextEmphasisMark() == TextEmphasisMarkNone) | 
| 428     return false; | 435     return false; | 
| 429 | 436 | 
| 430   emphasisPosition = style.getTextEmphasisPosition(); | 437   emphasisPosition = style.getTextEmphasisPosition(); | 
|  | 438   // Ruby text is always over, so it cannot suppress emphasis marks under. | 
| 431   if (emphasisPosition == TextEmphasisPositionUnder) | 439   if (emphasisPosition == TextEmphasisPositionUnder) | 
| 432     return true;  // Ruby text is always over, so it cannot suppress emphasis ma
     rks under. | 440     return true; | 
| 433 | 441 | 
| 434   LineLayoutBox containingBlock = getLineLayoutItem().containingBlock(); | 442   LineLayoutBox containingBlock = getLineLayoutItem().containingBlock(); | 
|  | 443   // This text is not inside a ruby base, so it does not have ruby text over it. | 
| 435   if (!containingBlock.isRubyBase()) | 444   if (!containingBlock.isRubyBase()) | 
| 436     return true;  // This text is not inside a ruby base, so it does not have ru
     by text over it. | 445     return true; | 
| 437 | 446 | 
|  | 447   // Cannot get the ruby text. | 
| 438   if (!containingBlock.parent().isRubyRun()) | 448   if (!containingBlock.parent().isRubyRun()) | 
| 439     return true;  // Cannot get the ruby text. | 449     return true; | 
| 440 | 450 | 
| 441   LineLayoutRubyText rubyText = | 451   LineLayoutRubyText rubyText = | 
| 442       LineLayoutRubyRun(containingBlock.parent()).rubyText(); | 452       LineLayoutRubyRun(containingBlock.parent()).rubyText(); | 
| 443 | 453 | 
| 444   // The emphasis marks over are suppressed only if there is a ruby text box and
      it not empty. | 454   // The emphasis marks over are suppressed only if there is a ruby text box and | 
|  | 455   // it not empty. | 
| 445   return !rubyText || !rubyText.firstLineBox(); | 456   return !rubyText || !rubyText.firstLineBox(); | 
| 446 } | 457 } | 
| 447 | 458 | 
| 448 void InlineTextBox::paint(const PaintInfo& paintInfo, | 459 void InlineTextBox::paint(const PaintInfo& paintInfo, | 
| 449                           const LayoutPoint& paintOffset, | 460                           const LayoutPoint& paintOffset, | 
| 450                           LayoutUnit /*lineTop*/, | 461                           LayoutUnit /*lineTop*/, | 
| 451                           LayoutUnit /*lineBottom*/) const { | 462                           LayoutUnit /*lineBottom*/) const { | 
| 452   InlineTextBoxPainter(*this).paint(paintInfo, paintOffset); | 463   InlineTextBoxPainter(*this).paint(paintInfo, paintOffset); | 
| 453 } | 464 } | 
| 454 | 465 | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 499 | 510 | 
| 500 int InlineTextBox::caretMinOffset() const { | 511 int InlineTextBox::caretMinOffset() const { | 
| 501   return m_start; | 512   return m_start; | 
| 502 } | 513 } | 
| 503 | 514 | 
| 504 int InlineTextBox::caretMaxOffset() const { | 515 int InlineTextBox::caretMaxOffset() const { | 
| 505   return m_start + m_len; | 516   return m_start + m_len; | 
| 506 } | 517 } | 
| 507 | 518 | 
| 508 LayoutUnit InlineTextBox::textPos() const { | 519 LayoutUnit InlineTextBox::textPos() const { | 
| 509   // When computing the width of a text run, LayoutBlock::computeInlineDirection
     PositionsForLine() doesn't include the actual offset | 520   // When computing the width of a text run, LayoutBlock:: | 
| 510   // from the containing block edge in its measurement. textPos() should be cons
     istent so the text are laid out in the same width. | 521   // computeInlineDirectionPositionsForLine() doesn't include the actual offset | 
|  | 522   // from the containing block edge in its measurement. textPos() should be | 
|  | 523   // consistent so the text are laid out in the same width. | 
| 511   if (logicalLeft() == 0) | 524   if (logicalLeft() == 0) | 
| 512     return LayoutUnit(); | 525     return LayoutUnit(); | 
| 513   return logicalLeft() - root().logicalLeft(); | 526   return logicalLeft() - root().logicalLeft(); | 
| 514 } | 527 } | 
| 515 | 528 | 
| 516 int InlineTextBox::offsetForPosition(LayoutUnit lineOffset, | 529 int InlineTextBox::offsetForPosition(LayoutUnit lineOffset, | 
| 517                                      bool includePartialGlyphs) const { | 530                                      bool includePartialGlyphs) const { | 
| 518   if (isLineBreak()) | 531   if (isLineBreak()) | 
| 519     return 0; | 532     return 0; | 
| 520 | 533 | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 562     return true; | 575     return true; | 
| 563 | 576 | 
| 564   // Offsets outside the box are always "out". | 577   // Offsets outside the box are always "out". | 
| 565   if (offset > pastEnd) | 578   if (offset > pastEnd) | 
| 566     return false; | 579     return false; | 
| 567 | 580 | 
| 568   // Offsets at the end are "out" for line breaks (they are on the next line). | 581   // Offsets at the end are "out" for line breaks (they are on the next line). | 
| 569   if (isLineBreak()) | 582   if (isLineBreak()) | 
| 570     return false; | 583     return false; | 
| 571 | 584 | 
| 572   // Offsets at the end are "in" for normal boxes (but the caller has to check a
     ffinity). | 585   // Offsets at the end are "in" for normal boxes (but the caller has to check | 
|  | 586   // affinity). | 
| 573   return true; | 587   return true; | 
| 574 } | 588 } | 
| 575 | 589 | 
| 576 void InlineTextBox::characterWidths(Vector<float>& widths) const { | 590 void InlineTextBox::characterWidths(Vector<float>& widths) const { | 
| 577   if (!m_len) | 591   if (!m_len) | 
| 578     return; | 592     return; | 
| 579 | 593 | 
| 580   FontCachePurgePreventer fontCachePurgePreventer; | 594   FontCachePurgePreventer fontCachePurgePreventer; | 
| 581   ASSERT(getLineLayoutItem().text()); | 595   ASSERT(getLineLayoutItem().text()); | 
| 582 | 596 | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 621     maximumLength = string.length(); | 635     maximumLength = string.length(); | 
| 622   } | 636   } | 
| 623 | 637 | 
| 624   ASSERT(maximumLength >= static_cast<int>(string.length())); | 638   ASSERT(maximumLength >= static_cast<int>(string.length())); | 
| 625 | 639 | 
| 626   TextRun run(string, textPos().toFloat(), expansion(), expansionBehavior(), | 640   TextRun run(string, textPos().toFloat(), expansion(), expansionBehavior(), | 
| 627               direction(), dirOverride() || style.rtlOrdering() == VisualOrder); | 641               direction(), dirOverride() || style.rtlOrdering() == VisualOrder); | 
| 628   run.setTabSize(!style.collapseWhiteSpace(), style.getTabSize()); | 642   run.setTabSize(!style.collapseWhiteSpace(), style.getTabSize()); | 
| 629   run.setTextJustify(style.getTextJustify()); | 643   run.setTextJustify(style.getTextJustify()); | 
| 630 | 644 | 
| 631   // Propagate the maximum length of the characters buffer to the TextRun, even 
     when we're only processing a substring. | 645   // Propagate the maximum length of the characters buffer to the TextRun, even | 
|  | 646   // when we're only processing a substring. | 
| 632   run.setCharactersLength(maximumLength); | 647   run.setCharactersLength(maximumLength); | 
| 633   ASSERT(run.charactersLength() >= run.length()); | 648   ASSERT(run.charactersLength() >= run.length()); | 
| 634   return run; | 649   return run; | 
| 635 } | 650 } | 
| 636 | 651 | 
| 637 TextRun InlineTextBox::constructTextRunForInspector( | 652 TextRun InlineTextBox::constructTextRunForInspector( | 
| 638     const ComputedStyle& style) const { | 653     const ComputedStyle& style) const { | 
| 639   return InlineTextBox::constructTextRun(style); | 654   return InlineTextBox::constructTextRun(style); | 
| 640 } | 655 } | 
| 641 | 656 | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 666   const int layoutObjectCharacterOffset = 75; | 681   const int layoutObjectCharacterOffset = 75; | 
| 667   for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) | 682   for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) | 
| 668     fputc(' ', stderr); | 683     fputc(' ', stderr); | 
| 669   fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), | 684   fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), | 
| 670           value.utf8().data()); | 685           value.utf8().data()); | 
| 671 } | 686 } | 
| 672 | 687 | 
| 673 #endif | 688 #endif | 
| 674 | 689 | 
| 675 }  // namespace blink | 690 }  // namespace blink | 
| OLD | NEW | 
|---|