Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: Source/core/layout/line/InlineTextBox.cpp

Issue 1043643002: Switch line layout to LayoutUnit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More TestExpectations tweaks Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/line/InlineTextBox.h ('k') | Source/core/layout/line/RootInlineBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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. All r ights 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 m_start = 0; 77 m_start = 0;
78 InlineBox::markDirty(); 78 InlineBox::markDirty();
79 } 79 }
80 80
81 LayoutRect InlineTextBox::logicalOverflowRect() const 81 LayoutRect InlineTextBox::logicalOverflowRect() const
82 { 82 {
83 if (knownToHaveNoOverflow() || !gTextBoxesWithOverflow) { 83 if (knownToHaveNoOverflow() || !gTextBoxesWithOverflow) {
84 // FIXME: the call to rawValue() below is temporary and should be remove d once the transition 84 // FIXME: the call to rawValue() below is temporary and should be remove d once the transition
85 // to LayoutUnit-based types is complete (crbug.com/321237). The call to enclosingIntRect() 85 // to LayoutUnit-based types is complete (crbug.com/321237). The call to enclosingIntRect()
86 // should also likely be switched to LayoutUnit pixel-snapping. 86 // should also likely be switched to LayoutUnit pixel-snapping.
87 return LayoutRect(enclosingIntRect(logicalFrameRect().rawValue())); 87 return LayoutRect(enclosingIntRect(logicalFrameRect()));
88 } 88 }
89 89
90 return gTextBoxesWithOverflow->get(this); 90 return gTextBoxesWithOverflow->get(this);
91 } 91 }
92 92
93 void InlineTextBox::setLogicalOverflowRect(const LayoutRect& rect) 93 void InlineTextBox::setLogicalOverflowRect(const LayoutRect& rect)
94 { 94 {
95 ASSERT(!knownToHaveNoOverflow()); 95 ASSERT(!knownToHaveNoOverflow());
96 if (!gTextBoxesWithOverflow) 96 if (!gTextBoxesWithOverflow)
97 gTextBoxesWithOverflow = new InlineTextBoxOverflowMap; 97 gTextBoxesWithOverflow = new InlineTextBoxOverflowMap;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 LayoutUnit selTop = root().selectionTop(); 187 LayoutUnit selTop = root().selectionTop();
188 LayoutUnit selHeight = root().selectionHeight(); 188 LayoutUnit selHeight = root().selectionHeight();
189 const ComputedStyle& styleToUse = layoutObject().styleRef(isFirstLineStyle() ); 189 const ComputedStyle& styleToUse = layoutObject().styleRef(isFirstLineStyle() );
190 const Font& font = styleToUse.font(); 190 const Font& font = styleToUse.font();
191 191
192 StringBuilder charactersWithHyphen; 192 StringBuilder charactersWithHyphen;
193 bool respectHyphen = ePos == m_len && hasHyphen(); 193 bool respectHyphen = ePos == m_len && hasHyphen();
194 TextRun textRun = constructTextRun(styleToUse, font, respectHyphen ? &charac tersWithHyphen : 0); 194 TextRun textRun = constructTextRun(styleToUse, font, respectHyphen ? &charac tersWithHyphen : 0);
195 195
196 FloatPointWillBeLayoutPoint startingPoint = FloatPointWillBeLayoutPoint(logi calLeft(), selTop.toFloat()); 196 LayoutPoint startingPoint = LayoutPoint(logicalLeft(), selTop.toFloat());
197 LayoutRect r; 197 LayoutRect r;
198 if (sPos || ePos != static_cast<int>(m_len)) { 198 if (sPos || ePos != static_cast<int>(m_len)) {
199 r = LayoutRect(enclosingIntRect(font.selectionRectForText(textRun, start ingPoint.toFloatPoint(), selHeight, sPos, ePos))); 199 r = LayoutRect(enclosingIntRect(font.selectionRectForText(textRun, Float Point(startingPoint), selHeight, sPos, ePos)));
200 } else { // Avoid computing the font width when the entire line box is selec ted as an optimization. 200 } else { // Avoid computing the font width when the entire line box is selec ted as an optimization.
201 // FIXME: the call to rawValue() below is temporary and should be remove d once the transition 201 // FIXME: the call to rawValue() below is temporary and should be remove d once the transition
202 // to LayoutUnit-based types is complete (crbug.com/321237) 202 // to LayoutUnit-based types is complete (crbug.com/321237)
203 r = LayoutRect(enclosingIntRect(FloatRectWillBeLayoutRect(startingPoint, FloatSizeWillBeLayoutSize(m_logicalWidth, selHeight.toFloat())).rawValue())); 203 r = LayoutRect(enclosingIntRect(LayoutRect(startingPoint, LayoutSize(m_l ogicalWidth, selHeight.toFloat()))));
204 } 204 }
205 205
206 LayoutUnit logicalWidth = r.width(); 206 LayoutUnit logicalWidth = r.width();
207 if (r.x() > logicalRight()) 207 if (r.x() > logicalRight())
208 logicalWidth = 0; 208 logicalWidth = 0;
209 else if (r.maxX() > logicalRight()) 209 else if (r.maxX() > logicalRight())
210 logicalWidth = logicalRight() - r.x(); 210 logicalWidth = logicalRight() - r.x();
211 211
212 LayoutPoint topPoint = isHorizontal() ? LayoutPoint(r.x(), selTop) : LayoutP oint(selTop, r.x()); 212 LayoutPoint topPoint = isHorizontal() ? LayoutPoint(r.x(), selTop) : LayoutP oint(selTop, r.x());
213 LayoutUnit width = isHorizontal() ? logicalWidth : selHeight; 213 LayoutUnit width = isHorizontal() ? logicalWidth : selHeight;
(...skipping 17 matching lines...) Expand all
231 } 231 }
232 232
233 void InlineTextBox::attachLine() 233 void InlineTextBox::attachLine()
234 { 234 {
235 if (!extracted()) 235 if (!extracted())
236 return; 236 return;
237 237
238 layoutObject().attachTextBox(this); 238 layoutObject().attachTextBox(this);
239 } 239 }
240 240
241 FloatWillBeLayoutUnit InlineTextBox::placeEllipsisBox(bool flowIsLTR, FloatWillB eLayoutUnit visibleLeftEdge, FloatWillBeLayoutUnit visibleRightEdge, FloatWillBe LayoutUnit ellipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool& foundBox) 241 LayoutUnit InlineTextBox::placeEllipsisBox(bool flowIsLTR, LayoutUnit visibleLef tEdge, LayoutUnit visibleRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &trunca tedWidth, bool& foundBox)
242 { 242 {
243 if (foundBox) { 243 if (foundBox) {
244 m_truncation = cFullTruncation; 244 m_truncation = cFullTruncation;
245 return -1; 245 return -1;
246 } 246 }
247 247
248 // For LTR this is the left edge of the box, for RTL, the right edge in pare nt coordinates. 248 // For LTR this is the left edge of the box, for RTL, the right edge in pare nt coordinates.
249 FloatWillBeLayoutUnit ellipsisX = flowIsLTR ? visibleRightEdge - ellipsisWid th : visibleLeftEdge + ellipsisWidth; 249 LayoutUnit ellipsisX = flowIsLTR ? visibleRightEdge - ellipsisWidth : visibl eLeftEdge + ellipsisWidth;
250 250
251 // Criteria for full truncation: 251 // Criteria for full truncation:
252 // LTR: the left edge of the ellipsis is to the left of our text run. 252 // LTR: the left edge of the ellipsis is to the left of our text run.
253 // RTL: the right edge of the ellipsis is to the right of our text run. 253 // RTL: the right edge of the ellipsis is to the right of our text run.
254 bool ltrFullTruncation = flowIsLTR && ellipsisX <= logicalLeft(); 254 bool ltrFullTruncation = flowIsLTR && ellipsisX <= logicalLeft();
255 bool rtlFullTruncation = !flowIsLTR && ellipsisX >= logicalLeft() + logicalW idth(); 255 bool rtlFullTruncation = !flowIsLTR && ellipsisX >= logicalLeft() + logicalW idth();
256 if (ltrFullTruncation || rtlFullTruncation) { 256 if (ltrFullTruncation || rtlFullTruncation) {
257 // Too far. Just set full truncation, but return -1 and let the ellipsi s just be placed at the edge of the box. 257 // Too far. Just set full truncation, but return -1 and let the ellipsi s just be placed at the edge of the box.
258 m_truncation = cFullTruncation; 258 m_truncation = cFullTruncation;
259 foundBox = true; 259 foundBox = true;
(...skipping 22 matching lines...) Expand all
282 m_truncation = cFullTruncation; 282 m_truncation = cFullTruncation;
283 truncatedWidth += ellipsisWidth; 283 truncatedWidth += ellipsisWidth;
284 return std::min(ellipsisX, logicalLeft()); 284 return std::min(ellipsisX, logicalLeft());
285 } 285 }
286 286
287 // Set the truncation index on the text run. 287 // Set the truncation index on the text run.
288 m_truncation = offset; 288 m_truncation = offset;
289 289
290 // If we got here that means that we were only partially truncated and w e need to return the pixel offset at which 290 // If we got here that means that we were only partially truncated and w e need to return the pixel offset at which
291 // to place the ellipsis. 291 // to place the ellipsis.
292 FloatWillBeLayoutUnit widthOfVisibleText = layoutObject().width(m_start, offset, textPos(), flowIsLTR ? LTR : RTL, isFirstLineStyle()); 292 LayoutUnit widthOfVisibleText = layoutObject().width(m_start, offset, te xtPos(), flowIsLTR ? LTR : RTL, isFirstLineStyle());
293 293
294 // The ellipsis needs to be placed just after the last visible character . 294 // The ellipsis needs to be placed just after the last visible character .
295 // Where "after" is defined by the flow directionality, not the inline 295 // Where "after" is defined by the flow directionality, not the inline
296 // box directionality. 296 // box directionality.
297 // e.g. In the case of an LTR inline box truncated in an RTL flow then w e can 297 // e.g. In the case of an LTR inline box truncated in an RTL flow then w e can
298 // have a situation such as |Hello| -> |...He| 298 // have a situation such as |Hello| -> |...He|
299 truncatedWidth += widthOfVisibleText + ellipsisWidth; 299 truncatedWidth += widthOfVisibleText + ellipsisWidth;
300 if (flowIsLTR) 300 if (flowIsLTR)
301 return logicalLeft() + widthOfVisibleText; 301 return logicalLeft() + widthOfVisibleText;
302 return logicalRight() - widthOfVisibleText - ellipsisWidth; 302 return logicalRight() - widthOfVisibleText - ellipsisWidth;
303 } 303 }
304 truncatedWidth += logicalWidth(); 304 truncatedWidth += logicalWidth();
305 return -1; 305 return -1;
306 } 306 }
307 307
308 bool InlineTextBox::isLineBreak() const 308 bool InlineTextBox::isLineBreak() const
309 { 309 {
310 return layoutObject().isBR() || (layoutObject().style()->preserveNewline() & & len() == 1 && (*layoutObject().text().impl())[start()] == '\n'); 310 return layoutObject().isBR() || (layoutObject().style()->preserveNewline() & & len() == 1 && (*layoutObject().text().impl())[start()] == '\n');
311 } 311 }
312 312
313 bool InlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo cationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop * /, LayoutUnit /*lineBottom*/) 313 bool InlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo cationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop * /, LayoutUnit /*lineBottom*/)
314 { 314 {
315 if (isLineBreak()) 315 if (isLineBreak())
316 return false; 316 return false;
317 317
318 FloatPointWillBeLayoutPoint boxOrigin = locationIncludingFlipping(); 318 LayoutPoint boxOrigin = locationIncludingFlipping();
319 boxOrigin.moveBy(accumulatedOffset); 319 boxOrigin.moveBy(accumulatedOffset);
320 FloatRectWillBeLayoutRect rect(boxOrigin, size()); 320 LayoutRect rect(boxOrigin, size());
321 // FIXME: both calls to rawValue() below is temporary and should be removed once the transition 321 // FIXME: both calls to rawValue() below is temporary and should be removed once the transition
322 // to LayoutUnit-based types is complete (crbug.com/321237) 322 // to LayoutUnit-based types is complete (crbug.com/321237)
323 if (m_truncation != cFullTruncation && visibleToHitTestRequest(result.hitTes tRequest()) && locationInContainer.intersects(rect.rawValue())) { 323 if (m_truncation != cFullTruncation && visibleToHitTestRequest(result.hitTes tRequest()) && locationInContainer.intersects(rect)) {
324 layoutObject().updateHitTestResult(result, flipForWritingMode(locationIn Container.point() - toLayoutSize(accumulatedOffset))); 324 layoutObject().updateHitTestResult(result, flipForWritingMode(locationIn Container.point() - toLayoutSize(accumulatedOffset)));
325 if (!result.addNodeToListBasedTestResult(layoutObject().node(), location InContainer, rect.rawValue())) 325 if (!result.addNodeToListBasedTestResult(layoutObject().node(), location InContainer, rect))
326 return true; 326 return true;
327 } 327 }
328 return false; 328 return false;
329 } 329 }
330 330
331 bool InlineTextBox::getEmphasisMarkPosition(const ComputedStyle& style, TextEmph asisPosition& emphasisPosition) const 331 bool InlineTextBox::getEmphasisMarkPosition(const ComputedStyle& style, TextEmph asisPosition& emphasisPosition) const
332 { 332 {
333 // This function returns true if there are text emphasis marks and they are suppressed by ruby text. 333 // This function returns true if there are text emphasis marks and they are suppressed by ruby text.
334 if (style.textEmphasisMark() == TextEmphasisMarkNone) 334 if (style.textEmphasisMark() == TextEmphasisMarkNone)
335 return false; 335 return false;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 if (layoutObject().selectionState() == LayoutObject::SelectionStart) 367 if (layoutObject().selectionState() == LayoutObject::SelectionStart)
368 endPos = layoutObject().textLength(); 368 endPos = layoutObject().textLength();
369 else if (layoutObject().selectionState() == LayoutObject::SelectionEnd) 369 else if (layoutObject().selectionState() == LayoutObject::SelectionEnd)
370 startPos = 0; 370 startPos = 0;
371 } 371 }
372 372
373 sPos = std::max(startPos - m_start, 0); 373 sPos = std::max(startPos - m_start, 0);
374 ePos = std::min(endPos - m_start, (int)m_len); 374 ePos = std::min(endPos - m_start, (int)m_len);
375 } 375 }
376 376
377 void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const FloatPointWil lBeLayoutPoint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, c onst Font& font, bool grammar) 377 void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const LayoutPoint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font& font, bool grammar)
378 { 378 {
379 InlineTextBoxPainter(*this).paintDocumentMarker(pt, boxOrigin.toFloatPoint() , marker, style, font, grammar); 379 InlineTextBoxPainter(*this).paintDocumentMarker(pt, boxOrigin, marker, style , font, grammar);
380 } 380 }
381 381
382 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPointWi llBeLayoutPoint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font& font) 382 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const LayoutPoint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font& font )
383 { 383 {
384 InlineTextBoxPainter(*this).paintTextMatchMarker(pt, boxOrigin.toFloatPoint( ), marker, style, font); 384 InlineTextBoxPainter(*this).paintTextMatchMarker(pt, boxOrigin, marker, styl e, font);
385 } 385 }
386 386
387 int InlineTextBox::caretMinOffset() const 387 int InlineTextBox::caretMinOffset() const
388 { 388 {
389 return m_start; 389 return m_start;
390 } 390 }
391 391
392 int InlineTextBox::caretMaxOffset() const 392 int InlineTextBox::caretMaxOffset() const
393 { 393 {
394 return m_start + m_len; 394 return m_start + m_len;
395 } 395 }
396 396
397 FloatWillBeLayoutUnit InlineTextBox::textPos() const 397 LayoutUnit InlineTextBox::textPos() const
398 { 398 {
399 // When computing the width of a text run, LayoutBlock::computeInlineDirecti onPositionsForLine() doesn't include the actual offset 399 // When computing the width of a text run, LayoutBlock::computeInlineDirecti onPositionsForLine() doesn't include the actual offset
400 // from the containing block edge in its measurement. textPos() should be co nsistent so the text are laid out in the same width. 400 // from the containing block edge in its measurement. textPos() should be co nsistent so the text are laid out in the same width.
401 if (logicalLeft() == 0) 401 if (logicalLeft() == 0)
402 return 0; 402 return 0;
403 return logicalLeft() - root().logicalLeft(); 403 return logicalLeft() - root().logicalLeft();
404 } 404 }
405 405
406 int InlineTextBox::offsetForPosition(FloatWillBeLayoutUnit lineOffset, bool incl udePartialGlyphs) const 406 int InlineTextBox::offsetForPosition(LayoutUnit lineOffset, bool includePartialG lyphs) const
407 { 407 {
408 if (isLineBreak()) 408 if (isLineBreak())
409 return 0; 409 return 0;
410 410
411 if (lineOffset - logicalLeft() > logicalWidth()) 411 if (lineOffset - logicalLeft() > logicalWidth())
412 return isLeftToRightDirection() ? len() : 0; 412 return isLeftToRightDirection() ? len() : 0;
413 if (lineOffset - logicalLeft() < 0) 413 if (lineOffset - logicalLeft() < 0)
414 return isLeftToRightDirection() ? 0 : len(); 414 return isLeftToRightDirection() ? 0 : len();
415 415
416 LayoutText& text = layoutObject(); 416 LayoutText& text = layoutObject();
417 const ComputedStyle& style = text.styleRef(isFirstLineStyle()); 417 const ComputedStyle& style = text.styleRef(isFirstLineStyle());
418 const Font& font = style.font(); 418 const Font& font = style.font();
419 return font.offsetForPosition(constructTextRun(style, font), lineOffset - lo gicalLeft(), includePartialGlyphs); 419 return font.offsetForPosition(constructTextRun(style, font), (lineOffset - l ogicalLeft()).toFloat(), includePartialGlyphs);
420 } 420 }
421 421
422 FloatWillBeLayoutUnit InlineTextBox::positionForOffset(int offset) const 422 LayoutUnit InlineTextBox::positionForOffset(int offset) const
423 { 423 {
424 ASSERT(offset >= m_start); 424 ASSERT(offset >= m_start);
425 ASSERT(offset <= m_start + m_len); 425 ASSERT(offset <= m_start + m_len);
426 426
427 if (isLineBreak()) 427 if (isLineBreak())
428 return logicalLeft(); 428 return logicalLeft();
429 429
430 LayoutText& text = layoutObject(); 430 LayoutText& text = layoutObject();
431 const ComputedStyle& styleToUse = text.styleRef(isFirstLineStyle()); 431 const ComputedStyle& styleToUse = text.styleRef(isFirstLineStyle());
432 const Font& font = styleToUse.font(); 432 const Font& font = styleToUse.font();
(...skipping 20 matching lines...) Expand all
453 return false; 453 return false;
454 454
455 // Offsets at the end are "out" for line breaks (they are on the next line). 455 // Offsets at the end are "out" for line breaks (they are on the next line).
456 if (isLineBreak()) 456 if (isLineBreak())
457 return false; 457 return false;
458 458
459 // Offsets at the end are "in" for normal boxes (but the caller has to check affinity). 459 // Offsets at the end are "in" for normal boxes (but the caller has to check affinity).
460 return true; 460 return true;
461 } 461 }
462 462
463 void InlineTextBox::characterWidths(Vector<FloatWillBeLayoutUnit>& widths) const 463 void InlineTextBox::characterWidths(Vector<float>& widths) const
464 { 464 {
465 FontCachePurgePreventer fontCachePurgePreventer; 465 FontCachePurgePreventer fontCachePurgePreventer;
466 466
467 const ComputedStyle& styleToUse = layoutObject().styleRef(isFirstLineStyle() ); 467 const ComputedStyle& styleToUse = layoutObject().styleRef(isFirstLineStyle() );
468 const Font& font = styleToUse.font(); 468 const Font& font = styleToUse.font();
469 469
470 TextRun textRun = constructTextRun(styleToUse, font); 470 TextRun textRun = constructTextRun(styleToUse, font);
471 471
472 SimpleShaper shaper(&font, textRun); 472 SimpleShaper shaper(&font, textRun);
473 FloatWillBeLayoutUnit lastWidth; 473 float lastWidth = 0;
474 widths.resize(m_len); 474 widths.resize(m_len);
475 for (unsigned i = 0; i < m_len; i++) { 475 for (unsigned i = 0; i < m_len; i++) {
476 shaper.advance(i + 1); 476 shaper.advance(i + 1);
477 widths[i] = shaper.runWidthSoFar() - lastWidth; 477 widths[i] = shaper.runWidthSoFar() - lastWidth;
478 lastWidth = shaper.runWidthSoFar(); 478 lastWidth = shaper.runWidthSoFar();
479 } 479 }
480 } 480 }
481 481
482 TextRun InlineTextBox::constructTextRun(const ComputedStyle& style, const Font& font, StringBuilder* charactersWithHyphen) const 482 TextRun InlineTextBox::constructTextRun(const ComputedStyle& style, const Font& font, StringBuilder* charactersWithHyphen) const
483 { 483 {
(...skipping 15 matching lines...) Expand all
499 const AtomicString& hyphenString = style.hyphenString(); 499 const AtomicString& hyphenString = style.hyphenString();
500 charactersWithHyphen->reserveCapacity(string.length() + hyphenString.len gth()); 500 charactersWithHyphen->reserveCapacity(string.length() + hyphenString.len gth());
501 charactersWithHyphen->append(string); 501 charactersWithHyphen->append(string);
502 charactersWithHyphen->append(hyphenString); 502 charactersWithHyphen->append(hyphenString);
503 string = charactersWithHyphen->toString().createView(); 503 string = charactersWithHyphen->toString().createView();
504 maximumLength = string.length(); 504 maximumLength = string.length();
505 } 505 }
506 506
507 ASSERT(maximumLength >= static_cast<int>(string.length())); 507 ASSERT(maximumLength >= static_cast<int>(string.length()));
508 508
509 TextRun run(string, textPos(), expansion(), expansionBehavior(), direction() , dirOverride() || style.rtlOrdering() == VisualOrder, !layoutObject().canUseSim pleFontCodePath()); 509 TextRun run(string, textPos().toFloat(), expansion(), expansionBehavior(), d irection(), dirOverride() || style.rtlOrdering() == VisualOrder, !layoutObject() .canUseSimpleFontCodePath());
510 run.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); 510 run.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
511 run.setCodePath(layoutObject().canUseSimpleFontCodePath() ? TextRun::ForceSi mple : TextRun::ForceComplex); 511 run.setCodePath(layoutObject().canUseSimpleFontCodePath() ? TextRun::ForceSi mple : TextRun::ForceComplex);
512 run.setTextJustify(style.textJustify()); 512 run.setTextJustify(style.textJustify());
513 513
514 // Propagate the maximum length of the characters buffer to the TextRun, eve n when we're only processing a substring. 514 // Propagate the maximum length of the characters buffer to the TextRun, eve n when we're only processing a substring.
515 run.setCharactersLength(maximumLength); 515 run.setCharactersLength(maximumLength);
516 ASSERT(run.charactersLength() >= run.length()); 516 ASSERT(run.charactersLength() >= run.length());
517 return run; 517 return run;
518 } 518 }
519 519
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), &obj); 551 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), &obj);
552 const int layoutObjectCharacterOffset = 75; 552 const int layoutObjectCharacterOffset = 75;
553 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) 553 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++)
554 fputc(' ', stderr); 554 fputc(' ', stderr);
555 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); 555 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata());
556 } 556 }
557 557
558 #endif 558 #endif
559 559
560 } // namespace blink 560 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/line/InlineTextBox.h ('k') | Source/core/layout/line/RootInlineBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698