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

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

Issue 2868783005: Make ETextSecurity an enum class. (Closed)
Patch Set: Rebase Created 3 years, 7 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // We do have to schedule layouts, though, since a style change can force us 201 // We do have to schedule layouts, though, since a style change can force us
202 // to need to relayout. 202 // to need to relayout.
203 if (diff.NeedsFullLayout()) { 203 if (diff.NeedsFullLayout()) {
204 SetNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::kStyleChange); 204 SetNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::kStyleChange);
205 known_to_have_no_overflow_and_no_fallback_fonts_ = false; 205 known_to_have_no_overflow_and_no_fallback_fonts_ = false;
206 } 206 }
207 207
208 const ComputedStyle& new_style = StyleRef(); 208 const ComputedStyle& new_style = StyleRef();
209 ETextTransform old_transform = 209 ETextTransform old_transform =
210 old_style ? old_style->TextTransform() : ETextTransform::kNone; 210 old_style ? old_style->TextTransform() : ETextTransform::kNone;
211 ETextSecurity old_security = old_style ? old_style->TextSecurity() : TSNONE; 211 ETextSecurity old_security =
212 old_style ? old_style->TextSecurity() : ETextSecurity::kNone;
212 if (old_transform != new_style.TextTransform() || 213 if (old_transform != new_style.TextTransform() ||
213 old_security != new_style.TextSecurity()) 214 old_security != new_style.TextSecurity())
214 TransformText(); 215 TransformText();
215 216
216 // This is an optimization that kicks off font load before layout. 217 // This is an optimization that kicks off font load before layout.
217 if (!GetText().ContainsOnlyWhitespace()) 218 if (!GetText().ContainsOnlyWhitespace())
218 new_style.GetFont().WillUseFontData(GetText()); 219 new_style.GetFont().WillUseFontData(GetText());
219 220
220 TextAutosizer* text_autosizer = GetDocument().GetTextAutosizer(); 221 TextAutosizer* text_autosizer = GetDocument().GetTextAutosizer();
221 if (!old_style && text_autosizer) 222 if (!old_style && text_autosizer)
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 void LayoutText::SetTextInternal(PassRefPtr<StringImpl> text) { 1679 void LayoutText::SetTextInternal(PassRefPtr<StringImpl> text) {
1679 DCHECK(text); 1680 DCHECK(text);
1680 text_ = std::move(text); 1681 text_ = std::move(text);
1681 1682
1682 if (Style()) { 1683 if (Style()) {
1683 ApplyTextTransform(Style(), text_, PreviousCharacter()); 1684 ApplyTextTransform(Style(), text_, PreviousCharacter());
1684 1685
1685 // We use the same characters here as for list markers. 1686 // We use the same characters here as for list markers.
1686 // See the listMarkerText function in LayoutListMarker.cpp. 1687 // See the listMarkerText function in LayoutListMarker.cpp.
1687 switch (Style()->TextSecurity()) { 1688 switch (Style()->TextSecurity()) {
1688 case TSNONE: 1689 case ETextSecurity::kNone:
1689 break; 1690 break;
1690 case TSCIRCLE: 1691 case ETextSecurity::kCircle:
1691 SecureText(kWhiteBulletCharacter); 1692 SecureText(kWhiteBulletCharacter);
1692 break; 1693 break;
1693 case TSDISC: 1694 case ETextSecurity::kDisc:
1694 SecureText(kBulletCharacter); 1695 SecureText(kBulletCharacter);
1695 break; 1696 break;
1696 case TSSQUARE: 1697 case ETextSecurity::kSquare:
1697 SecureText(kBlackSquareCharacter); 1698 SecureText(kBlackSquareCharacter);
1698 } 1699 }
1699 } 1700 }
1700 1701
1701 DCHECK(text_); 1702 DCHECK(text_);
1702 DCHECK(!IsBR() || (TextLength() == 1 && text_[0] == kNewlineCharacter)); 1703 DCHECK(!IsBR() || (TextLength() == 1 && text_[0] == kNewlineCharacter));
1703 } 1704 }
1704 1705
1705 void LayoutText::SecureText(UChar mask) { 1706 void LayoutText::SecureText(UChar mask) {
1706 if (!text_.length()) 1707 if (!text_.length())
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 LayoutRect rect = LayoutRect( 2085 LayoutRect rect = LayoutRect(
2085 IntRect(FirstRunX(), FirstRunY(), lines_box.Width(), lines_box.Height())); 2086 IntRect(FirstRunX(), FirstRunY(), lines_box.Width(), lines_box.Height()));
2086 LayoutBlock* block = ContainingBlock(); 2087 LayoutBlock* block = ContainingBlock();
2087 if (block && HasTextBoxes()) 2088 if (block && HasTextBoxes())
2088 block->AdjustChildDebugRect(rect); 2089 block->AdjustChildDebugRect(rect);
2089 2090
2090 return rect; 2091 return rect;
2091 } 2092 }
2092 2093
2093 } // namespace blink 2094 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698