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

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: add helper function and descendant selector test 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 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) 1222 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
1223 { 1223 {
1224 ASSERT(parentStyle); 1224 ASSERT(parentStyle);
1225 if (!e) 1225 if (!e)
1226 return 0; 1226 return 0;
1227 1227
1228 StyleResolverState& state = m_state; 1228 StyleResolverState& state = m_state;
1229 1229
1230 state.initForStyleResolve(document(), e, parentStyle); 1230 state.initForStyleResolve(document(), e, parentStyle);
1231 1231
1232 if (m_state.parentStyle()) { 1232 if (pseudoStyleRequest.pseudoId != BACKDROP && m_state.parentStyle()) { // T he spec disallows inheritance for ::backdrop.
esprehn 2013/07/03 23:44:29 Lets add a method on PseudoStyleRequest which is a
falken 2013/07/04 08:20:12 Done. That looks a lot better.
1233 state.setStyle(RenderStyle::create()); 1233 state.setStyle(RenderStyle::create());
1234 state.style()->inheritFrom(m_state.parentStyle()); 1234 state.style()->inheritFrom(m_state.parentStyle());
1235 } else { 1235 } else {
1236 state.setStyle(defaultStyleForElement()); 1236 state.setStyle(defaultStyleForElement());
1237 state.setParentStyle(RenderStyle::clone(state.style())); 1237 state.setParentStyle(RenderStyle::clone(state.style()));
1238 } 1238 }
1239 1239
1240 // Since we don't use pseudo-elements in any of our quirk/print user agent r ules, don't waste time walking 1240 // Since we don't use pseudo-elements in any of our quirk/print user agent r ules, don't waste time walking
1241 // those rules. 1241 // those rules.
1242 1242
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 ASSERT_NOT_REACHED(); 1396 ASSERT_NOT_REACHED();
1397 return NONE; 1397 return NONE;
1398 } 1398 }
1399 ASSERT_NOT_REACHED(); 1399 ASSERT_NOT_REACHED();
1400 return BLOCK; 1400 return BLOCK;
1401 } 1401 }
1402 1402
1403 // CSS requires text-decoration to be reset at each DOM element for tables, 1403 // CSS requires text-decoration to be reset at each DOM element for tables,
1404 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating element s, 1404 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating element s,
1405 // and absolute or relatively positioned elements. 1405 // and absolute or relatively positioned elements.
1406 static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) 1406 static bool doesNotInheritTextDecoration(const RenderStyle* style, const Element * e)
1407 { 1407 {
1408 return style->display() == TABLE || style->display() == INLINE_TABLE || styl e->display() == RUN_IN 1408 return style->display() == TABLE || style->display() == INLINE_TABLE || styl e->display() == RUN_IN
1409 || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e) 1409 || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)
1410 || style->isFloating() || style->hasOutOfFlowPosition(); 1410 || style->isFloating() || style->hasOutOfFlowPosition();
1411 } 1411 }
1412 1412
1413 static bool isRenderedInTopLayer(const RenderStyle* style, const Element* e) {
1414 return (e && e->isInTopLayer()) || (style && style->styleType() == BACKDROP) ;
esprehn 2013/07/03 23:44:29 This looks bad, the PseudoElement for ::backdrop s
falken 2013/07/04 08:20:12 Even with the new patch, I have to keep this helpe
1415 }
1416
1413 static bool isDisplayFlexibleBox(EDisplay display) 1417 static bool isDisplayFlexibleBox(EDisplay display)
1414 { 1418 {
1415 return display == FLEX || display == INLINE_FLEX; 1419 return display == FLEX || display == INLINE_FLEX;
1416 } 1420 }
1417 1421
1418 static bool isDisplayGridBox(EDisplay display) 1422 static bool isDisplayGridBox(EDisplay display)
1419 { 1423 {
1420 return display == GRID || display == INLINE_GRID; 1424 return display == GRID || display == INLINE_GRID;
1421 } 1425 }
1422 1426
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 1475
1472 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead. 1476 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead.
1473 // Table headers with a text-align of -webkit-auto will change the text- align to center. 1477 // Table headers with a text-align of -webkit-auto will change the text- align to center.
1474 if (e && e->hasTagName(thTag) && style->textAlign() == TASTART) 1478 if (e && e->hasTagName(thTag) && style->textAlign() == TASTART)
1475 style->setTextAlign(CENTER); 1479 style->setTextAlign(CENTER);
1476 1480
1477 if (e && e->hasTagName(legendTag)) 1481 if (e && e->hasTagName(legendTag))
1478 style->setDisplay(BLOCK); 1482 style->setDisplay(BLOCK);
1479 1483
1480 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'. 1484 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'.
1481 if (e && e->isInTopLayer() && (style->position() == StaticPosition || st yle->position() == RelativePosition)) 1485 if (isRenderedInTopLayer(style, e) && (style->position() == StaticPositi on || style->position() == RelativePosition))
1482 style->setPosition(AbsolutePosition); 1486 style->setPosition(AbsolutePosition);
1483 1487
1484 // Absolute/fixed positioned elements, floating elements and the documen t element need block-like outside display. 1488 // Absolute/fixed positioned elements, floating elements and the documen t element need block-like outside display.
1485 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc ument()->documentElement() == e)) 1489 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc ument()->documentElement() == e))
1486 style->setDisplay(equivalentBlockDisplay(style->display(), style->is Floating(), !document()->inQuirksMode())); 1490 style->setDisplay(equivalentBlockDisplay(style->display(), style->is Floating(), !document()->inQuirksMode()));
1487 1491
1488 // FIXME: Don't support this mutation for pseudo styles like first-lette r or first-line, since it's not completely 1492 // FIXME: Don't support this mutation for pseudo styles like first-lette r or first-line, since it's not completely
1489 // clear how that should work. 1493 // clear how that should work.
1490 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl e->writingMode() != parentStyle->writingMode()) 1494 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl e->writingMode() != parentStyle->writingMode())
1491 style->setDisplay(INLINE_BLOCK); 1495 style->setDisplay(INLINE_BLOCK);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) 1531 if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e)
1528 || style->opacity() < 1.0f 1532 || style->opacity() < 1.0f
1529 || style->hasTransformRelatedProperty() 1533 || style->hasTransformRelatedProperty()
1530 || style->hasMask() 1534 || style->hasMask()
1531 || style->clipPath() 1535 || style->clipPath()
1532 || style->boxReflect() 1536 || style->boxReflect()
1533 || style->hasFilter() 1537 || style->hasFilter()
1534 || style->hasBlendMode() 1538 || style->hasBlendMode()
1535 || style->position() == StickyPosition 1539 || style->position() == StickyPosition
1536 || (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext()) 1540 || (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext())
1537 || (e && e->isInTopLayer()) 1541 || isRenderedInTopLayer(style, e)
1538 )) 1542 ))
1539 style->setZIndex(0); 1543 style->setZIndex(0);
1540 1544
1541 // Textarea considers overflow visible as auto. 1545 // Textarea considers overflow visible as auto.
1542 if (e && e->hasTagName(textareaTag)) { 1546 if (e && e->hasTagName(textareaTag)) {
1543 style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->over flowX()); 1547 style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->over flowX());
1544 style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->over flowY()); 1548 style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->over flowY());
1545 } 1549 }
1546 1550
1547 // For now, <marquee> requires an overflow clip to work properly. 1551 // For now, <marquee> requires an overflow clip to work properly.
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
3437 info.addMember(m_state, "state"); 3441 info.addMember(m_state, "state");
3438 3442
3439 // FIXME: move this to a place where it would be called only once? 3443 // FIXME: move this to a place where it would be called only once?
3440 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3444 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3441 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3445 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3442 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3446 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3443 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3447 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3444 } 3448 }
3445 3449
3446 } // namespace WebCore 3450 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698