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

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

Issue 2516263002: Changed ETextTransform to an enum class and renamed its members (Closed)
Patch Set: Created 4 years 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // There is no need to ever schedule paint invalidations from a style change 193 // There is no need to ever schedule paint invalidations from a style change
194 // of a text run, since we already did this for the parent of the text run. 194 // of a text run, since we already did this for the parent of the text run.
195 // We do have to schedule layouts, though, since a style change can force us 195 // We do have to schedule layouts, though, since a style change can force us
196 // to need to relayout. 196 // to need to relayout.
197 if (diff.needsFullLayout()) { 197 if (diff.needsFullLayout()) {
198 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange); 198 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange);
199 m_knownToHaveNoOverflowAndNoFallbackFonts = false; 199 m_knownToHaveNoOverflowAndNoFallbackFonts = false;
200 } 200 }
201 201
202 const ComputedStyle& newStyle = styleRef(); 202 const ComputedStyle& newStyle = styleRef();
203 ETextTransform oldTransform = oldStyle ? oldStyle->textTransform() : TTNONE; 203 ETextTransform oldTransform =
204 oldStyle ? oldStyle->textTransform() : ETextTransform::None;
204 ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE; 205 ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE;
205 if (oldTransform != newStyle.textTransform() || 206 if (oldTransform != newStyle.textTransform() ||
206 oldSecurity != newStyle.textSecurity()) 207 oldSecurity != newStyle.textSecurity())
207 transformText(); 208 transformText();
208 209
209 // This is an optimization that kicks off font load before layout. 210 // This is an optimization that kicks off font load before layout.
210 if (!text().containsOnlyWhitespace()) 211 if (!text().containsOnlyWhitespace())
211 newStyle.font().willUseFontData(text()); 212 newStyle.font().willUseFontData(text());
212 } 213 }
213 214
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 // Text nodes aren't event targets, so don't descend any further. 1576 // Text nodes aren't event targets, so don't descend any further.
1576 } 1577 }
1577 1578
1578 void applyTextTransform(const ComputedStyle* style, 1579 void applyTextTransform(const ComputedStyle* style,
1579 String& text, 1580 String& text,
1580 UChar previousCharacter) { 1581 UChar previousCharacter) {
1581 if (!style) 1582 if (!style)
1582 return; 1583 return;
1583 1584
1584 switch (style->textTransform()) { 1585 switch (style->textTransform()) {
1585 case TTNONE: 1586 case ETextTransform::None:
1586 break; 1587 break;
1587 case CAPITALIZE: 1588 case ETextTransform::Capitalize:
1588 makeCapitalized(&text, previousCharacter); 1589 makeCapitalized(&text, previousCharacter);
1589 break; 1590 break;
1590 case UPPERCASE: 1591 case ETextTransform::Uppercase:
1591 text = text.upper(style->locale()); 1592 text = text.upper(style->locale());
1592 break; 1593 break;
1593 case LOWERCASE: 1594 case ETextTransform::Lowercase:
1594 text = text.lower(style->locale()); 1595 text = text.lower(style->locale());
1595 break; 1596 break;
1596 } 1597 }
1597 } 1598 }
1598 1599
1599 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text) { 1600 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text) {
1600 ASSERT(text); 1601 ASSERT(text);
1601 m_text = std::move(text); 1602 m_text = std::move(text);
1602 1603
1603 if (style()) { 1604 if (style()) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 LayoutRect rect = LayoutRect( 1974 LayoutRect rect = LayoutRect(
1974 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); 1975 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height()));
1975 LayoutBlock* block = containingBlock(); 1976 LayoutBlock* block = containingBlock();
1976 if (block && hasTextBoxes()) 1977 if (block && hasTextBoxes())
1977 block->adjustChildDebugRect(rect); 1978 block->adjustChildDebugRect(rect);
1978 1979
1979 return rect; 1980 return rect;
1980 } 1981 }
1981 1982
1982 } // namespace blink 1983 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698