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

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

Issue 17654008: Implement the ::backdrop pseudo-element for modal <dialog>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments Created 7 years, 5 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
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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) 1266 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
1267 { 1267 {
1268 ASSERT(parentStyle); 1268 ASSERT(parentStyle);
1269 if (!e) 1269 if (!e)
1270 return 0; 1270 return 0;
1271 1271
1272 StyleResolverState& state = m_state; 1272 StyleResolverState& state = m_state;
1273 1273
1274 state.initForStyleResolve(document(), e, parentStyle); 1274 state.initForStyleResolve(document(), e, parentStyle);
1275 1275
1276 if (m_state.parentStyle()) { 1276 if (pseudoStyleRequest.allowsInheritance(m_state.parentStyle())) {
1277 state.setStyle(RenderStyle::create()); 1277 state.setStyle(RenderStyle::create());
1278 state.style()->inheritFrom(m_state.parentStyle()); 1278 state.style()->inheritFrom(m_state.parentStyle());
1279 } else { 1279 } else {
1280 state.setStyle(defaultStyleForElement()); 1280 state.setStyle(defaultStyleForElement());
1281 state.setParentStyle(RenderStyle::clone(state.style())); 1281 state.setParentStyle(RenderStyle::clone(state.style()));
1282 } 1282 }
1283 1283
1284 // Since we don't use pseudo-elements in any of our quirk/print user agent r ules, don't waste time walking 1284 // Since we don't use pseudo-elements in any of our quirk/print user agent r ules, don't waste time walking
1285 // those rules. 1285 // those rules.
1286 1286
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 ASSERT_NOT_REACHED(); 1440 ASSERT_NOT_REACHED();
1441 return NONE; 1441 return NONE;
1442 } 1442 }
1443 ASSERT_NOT_REACHED(); 1443 ASSERT_NOT_REACHED();
1444 return BLOCK; 1444 return BLOCK;
1445 } 1445 }
1446 1446
1447 // CSS requires text-decoration to be reset at each DOM element for tables, 1447 // CSS requires text-decoration to be reset at each DOM element for tables,
1448 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating element s, 1448 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating element s,
1449 // and absolute or relatively positioned elements. 1449 // and absolute or relatively positioned elements.
1450 static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) 1450 static bool doesNotInheritTextDecoration(const RenderStyle* style, const Element * e)
1451 { 1451 {
1452 return style->display() == TABLE || style->display() == INLINE_TABLE || styl e->display() == RUN_IN 1452 return style->display() == TABLE || style->display() == INLINE_TABLE || styl e->display() == RUN_IN
1453 || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e) 1453 || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)
1454 || style->isFloating() || style->hasOutOfFlowPosition(); 1454 || style->isFloating() || style->hasOutOfFlowPosition();
1455 } 1455 }
1456 1456
1457 // FIXME: This helper is only needed because pseudoStyleForElement passes a null
1458 // element to adjustRenderStyle, so we can't just use element->isInTopLayer().
1459 static bool isInTopLayer(const Element* element, const RenderStyle* style)
1460 {
1461 return (element && element->isInTopLayer()) || (style && style->styleType() == BACKDROP);
1462 }
1463
1457 static bool isDisplayFlexibleBox(EDisplay display) 1464 static bool isDisplayFlexibleBox(EDisplay display)
1458 { 1465 {
1459 return display == FLEX || display == INLINE_FLEX; 1466 return display == FLEX || display == INLINE_FLEX;
1460 } 1467 }
1461 1468
1462 static bool isDisplayGridBox(EDisplay display) 1469 static bool isDisplayGridBox(EDisplay display)
1463 { 1470 {
1464 return display == GRID || display == INLINE_GRID; 1471 return display == GRID || display == INLINE_GRID;
1465 } 1472 }
1466 1473
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 1522
1516 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead. 1523 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead.
1517 // Table headers with a text-align of -webkit-auto will change the text- align to center. 1524 // Table headers with a text-align of -webkit-auto will change the text- align to center.
1518 if (e && e->hasTagName(thTag) && style->textAlign() == TASTART) 1525 if (e && e->hasTagName(thTag) && style->textAlign() == TASTART)
1519 style->setTextAlign(CENTER); 1526 style->setTextAlign(CENTER);
1520 1527
1521 if (e && e->hasTagName(legendTag)) 1528 if (e && e->hasTagName(legendTag))
1522 style->setDisplay(BLOCK); 1529 style->setDisplay(BLOCK);
1523 1530
1524 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'. 1531 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'.
1525 if (e && e->isInTopLayer() && (style->position() == StaticPosition || st yle->position() == RelativePosition)) 1532 if (isInTopLayer(e, style) && (style->position() == StaticPosition || st yle->position() == RelativePosition))
1526 style->setPosition(AbsolutePosition); 1533 style->setPosition(AbsolutePosition);
1527 1534
1528 // Absolute/fixed positioned elements, floating elements and the documen t element need block-like outside display. 1535 // Absolute/fixed positioned elements, floating elements and the documen t element need block-like outside display.
1529 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc ument()->documentElement() == e)) 1536 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc ument()->documentElement() == e))
1530 style->setDisplay(equivalentBlockDisplay(style->display(), style->is Floating(), !document()->inQuirksMode())); 1537 style->setDisplay(equivalentBlockDisplay(style->display(), style->is Floating(), !document()->inQuirksMode()));
1531 1538
1532 // FIXME: Don't support this mutation for pseudo styles like first-lette r or first-line, since it's not completely 1539 // FIXME: Don't support this mutation for pseudo styles like first-lette r or first-line, since it's not completely
1533 // clear how that should work. 1540 // clear how that should work.
1534 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl e->writingMode() != parentStyle->writingMode()) 1541 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl e->writingMode() != parentStyle->writingMode())
1535 style->setDisplay(INLINE_BLOCK); 1542 style->setDisplay(INLINE_BLOCK);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) 1578 if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e)
1572 || style->opacity() < 1.0f 1579 || style->opacity() < 1.0f
1573 || style->hasTransformRelatedProperty() 1580 || style->hasTransformRelatedProperty()
1574 || style->hasMask() 1581 || style->hasMask()
1575 || style->clipPath() 1582 || style->clipPath()
1576 || style->boxReflect() 1583 || style->boxReflect()
1577 || style->hasFilter() 1584 || style->hasFilter()
1578 || style->hasBlendMode() 1585 || style->hasBlendMode()
1579 || style->position() == StickyPosition 1586 || style->position() == StickyPosition
1580 || (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext()) 1587 || (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext())
1581 || (e && e->isInTopLayer()) 1588 || isInTopLayer(e, style)
1582 )) 1589 ))
1583 style->setZIndex(0); 1590 style->setZIndex(0);
1584 1591
1585 // Textarea considers overflow visible as auto. 1592 // Textarea considers overflow visible as auto.
1586 if (e && e->hasTagName(textareaTag)) { 1593 if (e && e->hasTagName(textareaTag)) {
1587 style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->over flowX()); 1594 style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->over flowX());
1588 style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->over flowY()); 1595 style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->over flowY());
1589 } 1596 }
1590 1597
1591 // For now, <marquee> requires an overflow clip to work properly. 1598 // For now, <marquee> requires an overflow clip to work properly.
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 info.addMember(m_state, "state"); 3488 info.addMember(m_state, "state");
3482 3489
3483 // FIXME: move this to a place where it would be called only once? 3490 // FIXME: move this to a place where it would be called only once?
3484 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3491 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3485 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3492 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3486 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3493 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3487 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3494 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3488 } 3495 }
3489 3496
3490 } // namespace WebCore 3497 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698