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

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

Issue 2331793002: Apply first-line transform-text style (Closed)
Patch Set: bug 129669 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 if (m_text.isEmpty())
1422 return;
1423
1424 String textToTransform = m_text.substring(from, len);
1425 if (textToTransform.isEmpty())
1426 return;
1427
1428 switch (style->textTransform()) {
1429 case TTNONE:
1430 break;
1431 case CAPITALIZE:
1432 makeCapitalized(&textToTransform, previousCharacter());
1433 m_text.replace(from, len, textToTransform);
1434 break;
1435 case UPPERCASE:
1436 m_text.replace(from, len, textToTransform.upper(style->locale()));
1437 break;
1438 case LOWERCASE:
1439 m_text.replace(from, len, textToTransform.lower(style->locale()));
1440 break;
1441 }
1442 }
1443
1417 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text) 1444 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text)
1418 { 1445 {
1419 ASSERT(text); 1446 ASSERT(text);
1420 m_text = std::move(text); 1447 m_text = std::move(text);
1421 1448
1422 if (style()) { 1449 if (style()) {
1423 applyTextTransform(style(), m_text, previousCharacter()); 1450 applyTextTransform(style(), m_text, previousCharacter());
1424 1451
1425 // We use the same characters here as for list markers. 1452 // We use the same characters here as for list markers.
1426 // See the listMarkerText function in LayoutListMarker.cpp. 1453 // 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()) { 1794 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1768 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1795 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1769 if (box->truncation() != cNoTruncation) { 1796 if (box->truncation() != cNoTruncation) {
1770 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1797 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1771 paintInvalidator.invalidateDisplayItemClient(*ellipsisBox, inval idationReason); 1798 paintInvalidator.invalidateDisplayItemClient(*ellipsisBox, inval idationReason);
1772 } 1799 }
1773 } 1800 }
1774 } 1801 }
1775 1802
1776 } // namespace blink 1803 } // 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