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

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

Issue 2331793002: 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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 break; 1407 break;
1408 case UPPERCASE: 1408 case UPPERCASE:
1409 text = text.upper(style->locale()); 1409 text = text.upper(style->locale());
1410 break; 1410 break;
1411 case LOWERCASE: 1411 case LOWERCASE:
1412 text = text.lower(style->locale()); 1412 text = text.lower(style->locale());
1413 break; 1413 break;
1414 } 1414 }
1415 } 1415 }
1416 1416
1417 void LayoutText::applyTextTransformFromTo(int from, int len, const ComputedStyle * style)
1418 {
1419 if (!style)
1420 return;
1421
1422 String textToCapitalize;
1423 switch (style->textTransform()) {
1424 case TTNONE:
1425 break;
1426 case CAPITALIZE:
1427 textToCapitalize = m_text.substring(from, len);
1428 makeCapitalized(&textToCapitalize, previousCharacter());
1429 m_text.replace(from, len, textToCapitalize);
rhogan 2016/09/12 18:58:25 A couple of things may have been the source of the
1430 break;
1431 case UPPERCASE:
1432 m_text.replace(from, len, m_text.substring(from, len).upper(style->local e()));
1433 break;
1434 case LOWERCASE:
1435 m_text.replace(from, len, m_text.substring(from, len).lower(style->local e()));
1436 break;
1437 }
1438 }
1439
1417 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text) 1440 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text)
1418 { 1441 {
1419 ASSERT(text); 1442 ASSERT(text);
1420 m_text = std::move(text); 1443 m_text = std::move(text);
1421 1444
1422 if (style()) { 1445 if (style()) {
1423 applyTextTransform(style(), m_text, previousCharacter()); 1446 applyTextTransform(style(), m_text, previousCharacter());
1424 1447
1425 // We use the same characters here as for list markers. 1448 // We use the same characters here as for list markers.
1426 // See the listMarkerText function in LayoutListMarker.cpp. 1449 // See the listMarkerText function in LayoutListMarker.cpp.
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1790 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1768 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1791 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1769 if (box->truncation() != cNoTruncation) { 1792 if (box->truncation() != cNoTruncation) {
1770 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1793 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1771 paintInvalidator.invalidateDisplayItemClient(*ellipsisBox, inval idationReason); 1794 paintInvalidator.invalidateDisplayItemClient(*ellipsisBox, inval idationReason);
1772 } 1795 }
1773 } 1796 }
1774 } 1797 }
1775 1798
1776 } // namespace blink 1799 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutText.h ('k') | third_party/WebKit/Source/core/layout/api/LineLayoutText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698