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

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

Issue 2443693003: Add parsing support for display: contents, and minimum behavior similar to display: none (Closed)
Patch Set: Add parsing support for display: contents, and minimum behavior similar to display: none Created 4 years, 1 month 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 case EDisplay::TableRowGroup: 78 case EDisplay::TableRowGroup:
79 case EDisplay::TableHeaderGroup: 79 case EDisplay::TableHeaderGroup:
80 case EDisplay::TableFooterGroup: 80 case EDisplay::TableFooterGroup:
81 case EDisplay::TableRow: 81 case EDisplay::TableRow:
82 case EDisplay::TableColumnGroup: 82 case EDisplay::TableColumnGroup:
83 case EDisplay::TableColumn: 83 case EDisplay::TableColumn:
84 case EDisplay::TableCell: 84 case EDisplay::TableCell:
85 case EDisplay::TableCaption: 85 case EDisplay::TableCaption:
86 return EDisplay::Block; 86 return EDisplay::Block;
87 case EDisplay::None: 87 case EDisplay::None:
88 case EDisplay::Contents:
88 ASSERT_NOT_REACHED(); 89 ASSERT_NOT_REACHED();
89 return EDisplay::None; 90 return display;
90 } 91 }
91 ASSERT_NOT_REACHED(); 92 ASSERT_NOT_REACHED();
92 return EDisplay::Block; 93 return EDisplay::Block;
93 } 94 }
94 95
95 static bool isOutermostSVGElement(const Element* element) { 96 static bool isOutermostSVGElement(const Element* element) {
96 return element && element->isSVGElement() && 97 return element && element->isSVGElement() &&
97 toSVGElement(*element).isOutermostSVGSVGElement(); 98 toSVGElement(*element).isOutermostSVGSVGElement();
98 } 99 }
99 100
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVertical); 363 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVertical);
363 if (style.marginBefore().isPercentOrCalc() || 364 if (style.marginBefore().isPercentOrCalc() ||
364 style.marginAfter().isPercentOrCalc()) 365 style.marginAfter().isPercentOrCalc())
365 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVertical); 366 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVertical);
366 } 367 }
367 } 368 }
368 369
369 void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, 370 void StyleAdjuster::adjustComputedStyle(ComputedStyle& style,
370 const ComputedStyle& parentStyle, 371 const ComputedStyle& parentStyle,
371 Element* element) { 372 Element* element) {
372 if (style.display() != EDisplay::None) { 373 if (style.display() != EDisplay::None &&
374 style.display() != EDisplay::Contents) {
373 if (element && element->isHTMLElement()) 375 if (element && element->isHTMLElement())
374 adjustStyleForHTMLElement(style, toHTMLElement(*element)); 376 adjustStyleForHTMLElement(style, toHTMLElement(*element));
375 377
376 // Per the spec, position 'static' and 'relative' in the top layer compute 378 // Per the spec, position 'static' and 'relative' in the top layer compute
377 // to 'absolute'. 379 // to 'absolute'.
378 if (isInTopLayer(element, style) && (style.position() == StaticPosition || 380 if (isInTopLayer(element, style) && (style.position() == StaticPosition ||
379 style.position() == RelativePosition)) 381 style.position() == RelativePosition))
380 style.setPosition(AbsolutePosition); 382 style.setPosition(AbsolutePosition);
381 383
382 // Absolute/fixed positioned elements, floating elements and the document 384 // Absolute/fixed positioned elements, floating elements and the document
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 style.setDisplay(EDisplay::Block); 457 style.setDisplay(EDisplay::Block);
456 458
457 // Columns don't apply to svg text elements. 459 // Columns don't apply to svg text elements.
458 if (isSVGTextElement(*element)) 460 if (isSVGTextElement(*element))
459 style.clearMultiCol(); 461 style.clearMultiCol();
460 } 462 }
461 adjustStyleForAlignment(style, parentStyle); 463 adjustStyleForAlignment(style, parentStyle);
462 } 464 }
463 465
464 } // namespace blink 466 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698