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. | 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 : 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 ? TextDirection::Ltr : TextDirection::Rtl, | 384 flowIsLTR ? TextDirection::kLtr : TextDirection::kRtl, |
385 isFirstLineStyle())); | 385 isFirstLineStyle())); |
386 | 386 |
387 // The ellipsis needs to be placed just after the last visible character. | 387 // The ellipsis needs to be placed just after the last visible character. |
388 // Where "after" is defined by the flow directionality, not the inline | 388 // Where "after" is defined by the flow directionality, not the inline |
389 // box directionality. | 389 // box directionality. |
390 // e.g. In the case of an LTR inline box truncated in an RTL flow then we | 390 // e.g. In the case of an LTR inline box truncated in an RTL flow then we |
391 // can have a situation such as |Hello| -> |...He| | 391 // can have a situation such as |Hello| -> |...He| |
392 truncatedWidth += widthOfVisibleText + ellipsisWidth; | 392 truncatedWidth += widthOfVisibleText + ellipsisWidth; |
393 if (flowIsLTR) | 393 if (flowIsLTR) |
394 return logicalLeft() + widthOfVisibleText; | 394 return logicalLeft() + widthOfVisibleText; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 const int layoutObjectCharacterOffset = 75; | 688 const int layoutObjectCharacterOffset = 75; |
689 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) | 689 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) |
690 fputc(' ', stderr); | 690 fputc(' ', stderr); |
691 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), | 691 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), |
692 value.utf8().data()); | 692 value.utf8().data()); |
693 } | 693 } |
694 | 694 |
695 #endif | 695 #endif |
696 | 696 |
697 } // namespace blink | 697 } // namespace blink |
OLD | NEW |