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

Side by Side Diff: Source/core/rendering/InlineTextBox.cpp

Issue 813133002: iter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « Source/core/rendering/InlineIterator.h ('k') | no next file » | 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 return logicalLeft() + widthOfVisibleText; 293 return logicalLeft() + widthOfVisibleText;
294 else 294 else
295 return logicalRight() - widthOfVisibleText - ellipsisWidth; 295 return logicalRight() - widthOfVisibleText - ellipsisWidth;
296 } 296 }
297 truncatedWidth += logicalWidth(); 297 truncatedWidth += logicalWidth();
298 return -1; 298 return -1;
299 } 299 }
300 300
301 bool InlineTextBox::isLineBreak() const 301 bool InlineTextBox::isLineBreak() const
302 { 302 {
303 return renderer().isBR() || (renderer().style()->preserveNewline() && len() == 1 && (*renderer().text().impl())[start()] == '\n'); 303 return renderer().isBR() || (renderer().style()->preserveNewline()
304 && len() == 1 && start() < len()
305 && (*renderer().text().impl())[start()] == '\n');
304 } 306 }
305 307
306 bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 308 bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
307 { 309 {
308 if (isLineBreak()) 310 if (isLineBreak())
309 return false; 311 return false;
310 312
311 FloatPointWillBeLayoutPoint boxOrigin = locationIncludingFlipping(); 313 FloatPointWillBeLayoutPoint boxOrigin = locationIncludingFlipping();
312 boxOrigin.moveBy(accumulatedOffset); 314 boxOrigin.moveBy(accumulatedOffset);
313 FloatRectWillBeLayoutRect rect(boxOrigin, size()); 315 FloatRectWillBeLayoutRect rect(boxOrigin, size());
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); 543 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj);
542 const int rendererCharacterOffset = 75; 544 const int rendererCharacterOffset = 75;
543 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) 545 for (; printedCharacters < rendererCharacterOffset; printedCharacters++)
544 fputc(' ', stderr); 546 fputc(' ', stderr);
545 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); 547 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata());
546 } 548 }
547 549
548 #endif 550 #endif
549 551
550 } // namespace blink 552 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineIterator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698