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

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

Issue 2529243002: Skip leading space in ltr text in rtl flow when placing ellipsis (Closed)
Patch Set: bug 667128 Created 4 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
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. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * 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.
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 372 }
373 373
374 // Set the truncation index on the text run. 374 // Set the truncation index on the text run.
375 setTruncation(offset); 375 setTruncation(offset);
376 376
377 // If we got here that means that we were only partially truncated and we 377 // If we got here that means that we were only partially truncated and we
378 // need to return the pixel offset at which to place the ellipsis. Where the 378 // need to return the pixel offset at which to place the ellipsis. Where the
379 // text and its flow have opposite directions then our offset into the text 379 // text and its flow have opposite directions then our offset into the text
380 // is at the start of the part that will be visible. 380 // is at the start of the part that will be visible.
381 LayoutUnit widthOfVisibleText(getLineLayoutItem().width( 381 LayoutUnit widthOfVisibleText(getLineLayoutItem().width(
382 ltr == flowIsLTR ? m_start : offset, 382 ltr == flowIsLTR ? m_start : m_start + offset,
383 ltr == flowIsLTR ? offset : m_len - offset, textPos(), 383 ltr == flowIsLTR ? offset : m_len - offset, textPos(),
384 flowIsLTR ? LTR : RTL, isFirstLineStyle())); 384 flowIsLTR ? LTR : RTL, isFirstLineStyle()));
385 385
386 // The ellipsis needs to be placed just after the last visible character. 386 // The ellipsis needs to be placed just after the last visible character.
387 // Where "after" is defined by the flow directionality, not the inline 387 // Where "after" is defined by the flow directionality, not the inline
388 // box directionality. 388 // box directionality.
389 // e.g. In the case of an LTR inline box truncated in an RTL flow then we 389 // e.g. In the case of an LTR inline box truncated in an RTL flow then we
390 // can have a situation such as |Hello| -> |...He| 390 // can have a situation such as |Hello| -> |...He|
391 truncatedWidth += widthOfVisibleText + ellipsisWidth; 391 truncatedWidth += widthOfVisibleText + ellipsisWidth;
392 if (flowIsLTR) 392 if (flowIsLTR)
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 const int layoutObjectCharacterOffset = 75; 682 const int layoutObjectCharacterOffset = 75;
683 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) 683 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++)
684 fputc(' ', stderr); 684 fputc(' ', stderr);
685 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), 685 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(),
686 value.utf8().data()); 686 value.utf8().data());
687 } 687 }
688 688
689 #endif 689 #endif
690 690
691 } // namespace blink 691 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-mixed-text-in-ltr-flow-underline-expected.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698