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

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

Issue 2660423004: Rename EOverflow values with k prefix. (Closed)
Patch Set: Rebase Created 3 years, 10 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 * 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // This is necessary to fix a crash where a site tries to position these 224 // This is necessary to fix a crash where a site tries to position these
225 // objects. They also never honor display. 225 // objects. They also never honor display.
226 style.setPosition(StaticPosition); 226 style.setPosition(StaticPosition);
227 style.setDisplay(EDisplay::Block); 227 style.setDisplay(EDisplay::Block);
228 return; 228 return;
229 } 229 }
230 230
231 if (isHTMLFrameElementBase(element)) { 231 if (isHTMLFrameElementBase(element)) {
232 // Frames cannot overflow (they are always the size we ask them to be). 232 // Frames cannot overflow (they are always the size we ask them to be).
233 // Some compositing code paths may try to draw scrollbars anyhow. 233 // Some compositing code paths may try to draw scrollbars anyhow.
234 style.setOverflowX(EOverflow::Visible); 234 style.setOverflowX(EOverflow::kVisible);
235 style.setOverflowY(EOverflow::Visible); 235 style.setOverflowY(EOverflow::kVisible);
236 return; 236 return;
237 } 237 }
238 238
239 if (isHTMLRTElement(element)) { 239 if (isHTMLRTElement(element)) {
240 // Ruby text does not support float or position. This might change with 240 // Ruby text does not support float or position. This might change with
241 // evolution of the specification. 241 // evolution of the specification.
242 style.setPosition(StaticPosition); 242 style.setPosition(StaticPosition);
243 style.setFloating(EFloat::kNone); 243 style.setFloating(EFloat::kNone);
244 return; 244 return;
245 } 245 }
246 246
247 if (isHTMLLegendElement(element)) { 247 if (isHTMLLegendElement(element)) {
248 style.setDisplay(EDisplay::Block); 248 style.setDisplay(EDisplay::Block);
249 return; 249 return;
250 } 250 }
251 251
252 if (isHTMLMarqueeElement(element)) { 252 if (isHTMLMarqueeElement(element)) {
253 // For now, <marquee> requires an overflow clip to work properly. 253 // For now, <marquee> requires an overflow clip to work properly.
254 style.setOverflowX(EOverflow::Hidden); 254 style.setOverflowX(EOverflow::kHidden);
255 style.setOverflowY(EOverflow::Hidden); 255 style.setOverflowY(EOverflow::kHidden);
256 return; 256 return;
257 } 257 }
258 258
259 if (isHTMLTextAreaElement(element)) { 259 if (isHTMLTextAreaElement(element)) {
260 // Textarea considers overflow visible as auto. 260 // Textarea considers overflow visible as auto.
261 style.setOverflowX(style.overflowX() == EOverflow::Visible 261 style.setOverflowX(style.overflowX() == EOverflow::kVisible
262 ? EOverflow::Auto 262 ? EOverflow::kAuto
263 : style.overflowX()); 263 : style.overflowX());
264 style.setOverflowY(style.overflowY() == EOverflow::Visible 264 style.setOverflowY(style.overflowY() == EOverflow::kVisible
265 ? EOverflow::Auto 265 ? EOverflow::kAuto
266 : style.overflowY()); 266 : style.overflowY());
267 return; 267 return;
268 } 268 }
269 269
270 if (isHTMLPlugInElement(element)) { 270 if (isHTMLPlugInElement(element)) {
271 style.setRequiresAcceleratedCompositingForExternalReasons( 271 style.setRequiresAcceleratedCompositingForExternalReasons(
272 toHTMLPlugInElement(element).shouldAccelerate()); 272 toHTMLPlugInElement(element).shouldAccelerate());
273 return; 273 return;
274 } 274 }
275 } 275 }
276 276
277 static void adjustOverflow(ComputedStyle& style) { 277 static void adjustOverflow(ComputedStyle& style) {
278 DCHECK(style.overflowX() != EOverflow::Visible || 278 DCHECK(style.overflowX() != EOverflow::kVisible ||
279 style.overflowY() != EOverflow::Visible); 279 style.overflowY() != EOverflow::kVisible);
280 280
281 if (style.display() == EDisplay::Table || 281 if (style.display() == EDisplay::Table ||
282 style.display() == EDisplay::InlineTable) { 282 style.display() == EDisplay::InlineTable) {
283 // Tables only support overflow:hidden and overflow:visible and ignore 283 // Tables only support overflow:hidden and overflow:visible and ignore
284 // anything else, see http://dev.w3.org/csswg/css2/visufx.html#overflow. As 284 // anything else, see http://dev.w3.org/csswg/css2/visufx.html#overflow. As
285 // a table is not a block container box the rules for resolving conflicting 285 // a table is not a block container box the rules for resolving conflicting
286 // x and y values in CSS Overflow Module Level 3 do not apply. Arguably 286 // x and y values in CSS Overflow Module Level 3 do not apply. Arguably
287 // overflow-x and overflow-y aren't allowed on tables but all UAs allow it. 287 // overflow-x and overflow-y aren't allowed on tables but all UAs allow it.
288 if (style.overflowX() != EOverflow::Hidden) 288 if (style.overflowX() != EOverflow::kHidden)
289 style.setOverflowX(EOverflow::Visible); 289 style.setOverflowX(EOverflow::kVisible);
290 if (style.overflowY() != EOverflow::Hidden) 290 if (style.overflowY() != EOverflow::kHidden)
291 style.setOverflowY(EOverflow::Visible); 291 style.setOverflowY(EOverflow::kVisible);
292 // If we are left with conflicting overflow values for the x and y axes on a 292 // If we are left with conflicting overflow values for the x and y axes on a
293 // table then resolve both to OverflowVisible. This is interoperable 293 // table then resolve both to OverflowVisible. This is interoperable
294 // behaviour but is not specced anywhere. 294 // behaviour but is not specced anywhere.
295 if (style.overflowX() == EOverflow::Visible) 295 if (style.overflowX() == EOverflow::kVisible)
296 style.setOverflowY(EOverflow::Visible); 296 style.setOverflowY(EOverflow::kVisible);
297 else if (style.overflowY() == EOverflow::Visible) 297 else if (style.overflowY() == EOverflow::kVisible)
298 style.setOverflowX(EOverflow::Visible); 298 style.setOverflowX(EOverflow::kVisible);
299 } else if (style.overflowX() == EOverflow::Visible && 299 } else if (style.overflowX() == EOverflow::kVisible &&
300 style.overflowY() != EOverflow::Visible) { 300 style.overflowY() != EOverflow::kVisible) {
301 // If either overflow value is not visible, change to auto. 301 // If either overflow value is not visible, change to auto.
302 // FIXME: Once we implement pagination controls, overflow-x should default 302 // FIXME: Once we implement pagination controls, overflow-x should default
303 // to hidden if overflow-y is set to -webkit-paged-x or -webkit-page-y. For 303 // to hidden if overflow-y is set to -webkit-paged-x or -webkit-page-y. For
304 // now, we'll let it default to auto so we can at least scroll through the 304 // now, we'll let it default to auto so we can at least scroll through the
305 // pages. 305 // pages.
306 style.setOverflowX(EOverflow::Auto); 306 style.setOverflowX(EOverflow::kAuto);
307 } else if (style.overflowY() == EOverflow::Visible && 307 } else if (style.overflowY() == EOverflow::kVisible &&
308 style.overflowX() != EOverflow::Visible) { 308 style.overflowX() != EOverflow::kVisible) {
309 style.setOverflowY(EOverflow::Auto); 309 style.setOverflowY(EOverflow::kAuto);
310 } 310 }
311 311
312 // Menulists should have visible overflow 312 // Menulists should have visible overflow
313 if (style.appearance() == MenulistPart) { 313 if (style.appearance() == MenulistPart) {
314 style.setOverflowX(EOverflow::Visible); 314 style.setOverflowX(EOverflow::kVisible);
315 style.setOverflowY(EOverflow::Visible); 315 style.setOverflowY(EOverflow::kVisible);
316 } 316 }
317 } 317 }
318 318
319 static void adjustStyleForDisplay(ComputedStyle& style, 319 static void adjustStyleForDisplay(ComputedStyle& style,
320 const ComputedStyle& parentStyle, 320 const ComputedStyle& parentStyle,
321 Document* document) { 321 Document* document) {
322 if (style.display() == EDisplay::Block && !style.isFloating()) 322 if (style.display() == EDisplay::Block && !style.isFloating())
323 return; 323 return;
324 324
325 // FIXME: Don't support this mutation for pseudo styles like first-letter or 325 // FIXME: Don't support this mutation for pseudo styles like first-letter or
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 if (style.position() == StaticPosition && 426 if (style.position() == StaticPosition &&
427 !parentStyleForcesZIndexToCreateStackingContext(parentStyle)) { 427 !parentStyleForcesZIndexToCreateStackingContext(parentStyle)) {
428 style.setIsStackingContext(false); 428 style.setIsStackingContext(false);
429 // TODO(alancutter): Avoid altering z-index here. 429 // TODO(alancutter): Avoid altering z-index here.
430 if (!style.hasAutoZIndex()) 430 if (!style.hasAutoZIndex())
431 style.setZIndex(0); 431 style.setZIndex(0);
432 } else if (!style.hasAutoZIndex()) { 432 } else if (!style.hasAutoZIndex()) {
433 style.setIsStackingContext(true); 433 style.setIsStackingContext(true);
434 } 434 }
435 435
436 if (style.overflowX() != EOverflow::Visible || 436 if (style.overflowX() != EOverflow::kVisible ||
437 style.overflowY() != EOverflow::Visible) 437 style.overflowY() != EOverflow::kVisible)
438 adjustOverflow(style); 438 adjustOverflow(style);
439 439
440 if (doesNotInheritTextDecoration(style, element)) 440 if (doesNotInheritTextDecoration(style, element))
441 style.clearAppliedTextDecorations(); 441 style.clearAppliedTextDecorations();
442 else 442 else
443 style.restoreParentTextDecorations(parentStyle); 443 style.restoreParentTextDecorations(parentStyle);
444 style.applyTextDecorations( 444 style.applyTextDecorations(
445 parentStyle.visitedDependentColor(CSSPropertyTextDecorationColor), 445 parentStyle.visitedDependentColor(CSSPropertyTextDecorationColor),
446 overridesTextDecorationColors(element)); 446 overridesTextDecorationColors(element));
447 447
(...skipping 28 matching lines...) Expand all
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

Powered by Google App Engine
This is Rietveld 408576698