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

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

Issue 2305833002: Apply first-line transform-text style (Closed)
Patch Set: Created 4 years, 3 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
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 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 break; 1397 break;
1398 case UPPERCASE: 1398 case UPPERCASE:
1399 text = text.upper(style->locale()); 1399 text = text.upper(style->locale());
1400 break; 1400 break;
1401 case LOWERCASE: 1401 case LOWERCASE:
1402 text = text.lower(style->locale()); 1402 text = text.lower(style->locale());
1403 break; 1403 break;
1404 } 1404 }
1405 } 1405 }
1406 1406
1407 void LayoutText::applyTextTransformFromTo(int from, int len, const ComputedStyle * style)
1408 {
1409 if (!style)
1410 return;
1411
1412 String textToCapitalize;
1413 switch (style->textTransform()) {
1414 case TTNONE:
rhogan 2016/09/05 18:00:33 I decided to not try and adapt the previous functi
eae 2016/09/05 20:53:34 I agree. Thanks for the clarification.
1415 break;
1416 case CAPITALIZE:
1417 textToCapitalize = m_text.substring(from, len);
1418 makeCapitalized(&textToCapitalize, previousCharacter());
1419 m_text = m_text.replace(from, len, textToCapitalize);
1420 break;
1421 case UPPERCASE:
1422 m_text = m_text.replace(from, len, m_text.substring(from, len).upper(sty le->locale()));
1423 break;
1424 case LOWERCASE:
1425 m_text = m_text.replace(from, len, m_text.substring(from, len).lower(sty le->locale()));
1426 break;
1427 }
1428 }
1429
1407 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text) 1430 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text)
1408 { 1431 {
1409 ASSERT(text); 1432 ASSERT(text);
1410 m_text = text; 1433 m_text = text;
1411 1434
1412 if (style()) { 1435 if (style()) {
1413 applyTextTransform(style(), m_text, previousCharacter()); 1436 applyTextTransform(style(), m_text, previousCharacter());
1414 1437
1415 // We use the same characters here as for list markers. 1438 // We use the same characters here as for list markers.
1416 // See the listMarkerText function in LayoutListMarker.cpp. 1439 // See the listMarkerText function in LayoutListMarker.cpp.
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1780 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1758 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1781 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1759 if (box->truncation() != cNoTruncation) { 1782 if (box->truncation() != cNoTruncation) {
1760 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1783 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1761 paintInvalidator.invalidateDisplayItemClient(*ellipsisBox, inval idationReason); 1784 paintInvalidator.invalidateDisplayItemClient(*ellipsisBox, inval idationReason);
1762 } 1785 }
1763 } 1786 }
1764 } 1787 }
1765 1788
1766 } // namespace blink 1789 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698