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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp

Issue 2508743002: Changed EWhiteSpace to an enum class and renamed its members to keywords (Closed)
Patch Set: Small mac fix 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 static bool parentStyleForcesZIndexToCreateStackingContext( 132 static bool parentStyleForcesZIndexToCreateStackingContext(
133 const ComputedStyle& parentStyle) { 133 const ComputedStyle& parentStyle) {
134 return parentStyle.isDisplayFlexibleOrGridBox(); 134 return parentStyle.isDisplayFlexibleOrGridBox();
135 } 135 }
136 136
137 void StyleAdjuster::adjustStyleForEditing(ComputedStyle& style) { 137 void StyleAdjuster::adjustStyleForEditing(ComputedStyle& style) {
138 if (style.userModify() != READ_WRITE_PLAINTEXT_ONLY) 138 if (style.userModify() != READ_WRITE_PLAINTEXT_ONLY)
139 return; 139 return;
140 // Collapsing whitespace is harmful in plain-text editing. 140 // Collapsing whitespace is harmful in plain-text editing.
141 if (style.whiteSpace() == NORMAL) 141 if (style.whiteSpace() == EWhiteSpace::Normal)
142 style.setWhiteSpace(PRE_WRAP); 142 style.setWhiteSpace(EWhiteSpace::PreWrap);
143 else if (style.whiteSpace() == NOWRAP) 143 else if (style.whiteSpace() == EWhiteSpace::Nowrap)
144 style.setWhiteSpace(PRE); 144 style.setWhiteSpace(EWhiteSpace::Pre);
145 else if (style.whiteSpace() == PRE_LINE) 145 else if (style.whiteSpace() == EWhiteSpace::PreLine)
146 style.setWhiteSpace(PRE_WRAP); 146 style.setWhiteSpace(EWhiteSpace::PreWrap);
147 } 147 }
148 148
149 static void adjustStyleForFirstLetter(ComputedStyle& style) { 149 static void adjustStyleForFirstLetter(ComputedStyle& style) {
150 if (style.styleType() != PseudoIdFirstLetter) 150 if (style.styleType() != PseudoIdFirstLetter)
151 return; 151 return;
152 152
153 // Force inline display (except for floating first-letters). 153 // Force inline display (except for floating first-letters).
154 style.setDisplay(style.isFloating() ? EDisplay::Block : EDisplay::Inline); 154 style.setDisplay(style.isFloating() ? EDisplay::Block : EDisplay::Inline);
155 155
156 // CSS2 says first-letter can't be positioned. 156 // CSS2 says first-letter can't be positioned.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 190
191 static void adjustStyleForHTMLElement(ComputedStyle& style, 191 static void adjustStyleForHTMLElement(ComputedStyle& style,
192 HTMLElement& element) { 192 HTMLElement& element) {
193 // <div> and <span> are the most common elements on the web, we skip all the 193 // <div> and <span> are the most common elements on the web, we skip all the
194 // work for them. 194 // work for them.
195 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) 195 if (isHTMLDivElement(element) || isHTMLSpanElement(element))
196 return; 196 return;
197 197
198 if (isHTMLTableCellElement(element)) { 198 if (isHTMLTableCellElement(element)) {
199 if (style.whiteSpace() == KHTML_NOWRAP) { 199 if (style.whiteSpace() == EWhiteSpace::KhtmlNowrap) {
200 // Figure out if we are really nowrapping or if we should just 200 // Figure out if we are really nowrapping or if we should just
201 // use normal instead. If the width of the cell is fixed, then 201 // use normal instead. If the width of the cell is fixed, then
202 // we don't actually use NOWRAP. 202 // we don't actually use NOWRAP.
203 if (style.width().isFixed()) 203 if (style.width().isFixed())
204 style.setWhiteSpace(NORMAL); 204 style.setWhiteSpace(EWhiteSpace::Normal);
205 else 205 else
206 style.setWhiteSpace(NOWRAP); 206 style.setWhiteSpace(EWhiteSpace::Nowrap);
207 } 207 }
208 return; 208 return;
209 } 209 }
210 210
211 if (isHTMLTableElement(element)) { 211 if (isHTMLTableElement(element)) {
212 // Tables never support the -webkit-* values for text-align and will reset 212 // Tables never support the -webkit-* values for text-align and will reset
213 // back to the default. 213 // back to the default.
214 if (style.textAlign() == ETextAlign::WebkitLeft || 214 if (style.textAlign() == ETextAlign::WebkitLeft ||
215 style.textAlign() == ETextAlign::WebkitCenter || 215 style.textAlign() == ETextAlign::WebkitCenter ||
216 style.textAlign() == ETextAlign::WebkitRight) 216 style.textAlign() == ETextAlign::WebkitRight)
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 style.setDisplay(EDisplay::Block); 476 style.setDisplay(EDisplay::Block);
477 477
478 // Columns don't apply to svg text elements. 478 // Columns don't apply to svg text elements.
479 if (isSVGTextElement(*element)) 479 if (isSVGTextElement(*element))
480 style.clearMultiCol(); 480 style.clearMultiCol();
481 } 481 }
482 adjustStyleForAlignment(style, parentStyle); 482 adjustStyleForAlignment(style, parentStyle);
483 } 483 }
484 484
485 } // namespace blink 485 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h ('k') | third_party/WebKit/Source/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698