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

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

Issue 2369113002: Revert "Apply first-line transform-text style" (Closed)
Patch Set: Created 4 years, 2 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 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 break; 1408 break;
1409 case UPPERCASE: 1409 case UPPERCASE:
1410 text = text.upper(style->locale()); 1410 text = text.upper(style->locale());
1411 break; 1411 break;
1412 case LOWERCASE: 1412 case LOWERCASE:
1413 text = text.lower(style->locale()); 1413 text = text.lower(style->locale());
1414 break; 1414 break;
1415 } 1415 }
1416 } 1416 }
1417 1417
1418 void LayoutText::applyTextTransformFromTo(int from, int len, const ComputedStyle * style)
1419 {
1420 if (!style)
1421 return;
1422 if (m_text.isEmpty())
1423 return;
1424
1425 String textToTransform = m_text.substring(from, len);
1426 if (textToTransform.isEmpty())
1427 return;
1428
1429 switch (style->textTransform()) {
1430 case TTNONE:
1431 break;
1432 case CAPITALIZE:
1433 makeCapitalized(&textToTransform, previousCharacter());
1434 m_text.replace(from, len, textToTransform);
1435 break;
1436 case UPPERCASE:
1437 m_text.replace(from, len, textToTransform.upper(style->locale()));
1438 break;
1439 case LOWERCASE:
1440 m_text.replace(from, len, textToTransform.lower(style->locale()));
1441 break;
1442 }
1443 }
1444
1445 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text) 1418 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text)
1446 { 1419 {
1447 ASSERT(text); 1420 ASSERT(text);
1448 m_text = std::move(text); 1421 m_text = std::move(text);
1449 1422
1450 if (style()) { 1423 if (style()) {
1451 applyTextTransform(style(), m_text, previousCharacter()); 1424 applyTextTransform(style(), m_text, previousCharacter());
1452 1425
1453 // We use the same characters here as for list markers. 1426 // We use the same characters here as for list markers.
1454 // See the listMarkerText function in LayoutListMarker.cpp. 1427 // See the listMarkerText function in LayoutListMarker.cpp.
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 LayoutRect rect = 1782 LayoutRect rect =
1810 LayoutRect(IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox. height())); 1783 LayoutRect(IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox. height()));
1811 LayoutBlock* block = containingBlock(); 1784 LayoutBlock* block = containingBlock();
1812 if (block && hasTextBoxes()) 1785 if (block && hasTextBoxes())
1813 block->adjustChildDebugRect(rect); 1786 block->adjustChildDebugRect(rect);
1814 1787
1815 return rect; 1788 return rect;
1816 } 1789 }
1817 1790
1818 } // namespace blink 1791 } // 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