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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 16529003: Simplify 'position' adjustment of top layer elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/HTMLDialogElement/top-layer-position-static-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 } 1536 }
1537 1537
1538 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead. 1538 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead.
1539 // Table headers with a text-align of -webkit-auto will change the text- align to center. 1539 // Table headers with a text-align of -webkit-auto will change the text- align to center.
1540 if (e && e->hasTagName(thTag) && style->textAlign() == TASTART) 1540 if (e && e->hasTagName(thTag) && style->textAlign() == TASTART)
1541 style->setTextAlign(CENTER); 1541 style->setTextAlign(CENTER);
1542 1542
1543 if (e && e->hasTagName(legendTag)) 1543 if (e && e->hasTagName(legendTag))
1544 style->setDisplay(BLOCK); 1544 style->setDisplay(BLOCK);
1545 1545
1546 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'.
1547 if (e && e->isInTopLayer() && (style->position() == StaticPosition || st yle->position() == RelativePosition))
1548 style->setPosition(AbsolutePosition);
1549
1546 // Absolute/fixed positioned elements, floating elements and the documen t element need block-like outside display. 1550 // Absolute/fixed positioned elements, floating elements and the documen t element need block-like outside display.
1547 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc ument()->documentElement() == e)) 1551 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc ument()->documentElement() == e))
1548 style->setDisplay(equivalentBlockDisplay(style->display(), style->is Floating(), !document()->inQuirksMode())); 1552 style->setDisplay(equivalentBlockDisplay(style->display(), style->is Floating(), !document()->inQuirksMode()));
1549 1553
1550 // FIXME: Don't support this mutation for pseudo styles like first-lette r or first-line, since it's not completely 1554 // FIXME: Don't support this mutation for pseudo styles like first-lette r or first-line, since it's not completely
1551 // clear how that should work. 1555 // clear how that should work.
1552 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl e->writingMode() != parentStyle->writingMode()) 1556 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl e->writingMode() != parentStyle->writingMode())
1553 style->setDisplay(INLINE_BLOCK); 1557 style->setDisplay(INLINE_BLOCK);
1554 1558
1555 // After performing the display mutation, check table rows. We do not ho nor position:relative or position:sticky on 1559 // After performing the display mutation, check table rows. We do not ho nor position:relative or position:sticky on
(...skipping 14 matching lines...) Expand all
1570 // FIXME: Since we don't support block-flow on flexible boxes yet, disal low setting 1574 // FIXME: Since we don't support block-flow on flexible boxes yet, disal low setting
1571 // of block-flow to anything other than TopToBottomWritingMode. 1575 // of block-flow to anything other than TopToBottomWritingMode.
1572 // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support. 1576 // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support.
1573 if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX)) 1577 if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX))
1574 style->setWritingMode(TopToBottomWritingMode); 1578 style->setWritingMode(TopToBottomWritingMode);
1575 1579
1576 if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(par entStyle->display())) { 1580 if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(par entStyle->display())) {
1577 style->setFloating(NoFloat); 1581 style->setFloating(NoFloat);
1578 style->setDisplay(equivalentBlockDisplay(style->display(), style->is Floating(), !document()->inQuirksMode())); 1582 style->setDisplay(equivalentBlockDisplay(style->display(), style->is Floating(), !document()->inQuirksMode()));
1579 } 1583 }
1580
1581 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'.
1582 if (e && e->isInTopLayer() && (style->position() == StaticPosition || st yle->position() == RelativePosition)) {
1583 style->setPosition(AbsolutePosition);
1584 style->setDisplay(BLOCK);
1585 }
1586 } 1584 }
1587 1585
1588 // Make sure our z-index value is only applied if the object is positioned. 1586 // Make sure our z-index value is only applied if the object is positioned.
1589 if (style->position() == StaticPosition && !isDisplayFlexibleBox(parentStyle ->display())) 1587 if (style->position() == StaticPosition && !isDisplayFlexibleBox(parentStyle ->display()))
1590 style->setHasAutoZIndex(); 1588 style->setHasAutoZIndex();
1591 1589
1592 // Auto z-index becomes 0 for the root element and transparent objects. This prevents 1590 // Auto z-index becomes 0 for the root element and transparent objects. This prevents
1593 // cases where objects that should be blended as a single unit end up with a non-transparent 1591 // cases where objects that should be blended as a single unit end up with a non-transparent
1594 // object wedged in between them. Auto z-index also becomes 0 for objects th at specify transforms/masks/reflections. 1592 // object wedged in between them. Auto z-index also becomes 0 for objects th at specify transforms/masks/reflections.
1595 if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) 1593 if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e)
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3741 info.addMember(m_state, "state"); 3739 info.addMember(m_state, "state");
3742 3740
3743 // FIXME: move this to a place where it would be called only once? 3741 // FIXME: move this to a place where it would be called only once?
3744 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3742 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3745 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3743 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3746 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3744 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3747 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3745 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3748 } 3746 }
3749 3747
3750 } // namespace WebCore 3748 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/HTMLDialogElement/top-layer-position-static-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698