| OLD | NEW |
| 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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P
seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) | 1257 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P
seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) |
| 1258 { | 1258 { |
| 1259 ASSERT(parentStyle); | 1259 ASSERT(parentStyle); |
| 1260 if (!e) | 1260 if (!e) |
| 1261 return 0; | 1261 return 0; |
| 1262 | 1262 |
| 1263 StyleResolverState& state = m_state; | 1263 StyleResolverState& state = m_state; |
| 1264 | 1264 |
| 1265 state.initForStyleResolve(document(), e, parentStyle); | 1265 state.initForStyleResolve(document(), e, parentStyle); |
| 1266 | 1266 |
| 1267 if (m_state.parentStyle()) { | 1267 if (pseudoStyleRequest.allowsInheritance(m_state.parentStyle())) { |
| 1268 state.setStyle(RenderStyle::create()); | 1268 state.setStyle(RenderStyle::create()); |
| 1269 state.style()->inheritFrom(m_state.parentStyle()); | 1269 state.style()->inheritFrom(m_state.parentStyle()); |
| 1270 } else { | 1270 } else { |
| 1271 state.setStyle(defaultStyleForElement()); | 1271 state.setStyle(defaultStyleForElement()); |
| 1272 state.setParentStyle(RenderStyle::clone(state.style())); | 1272 state.setParentStyle(RenderStyle::clone(state.style())); |
| 1273 } | 1273 } |
| 1274 | 1274 |
| 1275 // Since we don't use pseudo-elements in any of our quirk/print user agent r
ules, don't waste time walking | 1275 // Since we don't use pseudo-elements in any of our quirk/print user agent r
ules, don't waste time walking |
| 1276 // those rules. | 1276 // those rules. |
| 1277 | 1277 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 ASSERT_NOT_REACHED(); | 1431 ASSERT_NOT_REACHED(); |
| 1432 return NONE; | 1432 return NONE; |
| 1433 } | 1433 } |
| 1434 ASSERT_NOT_REACHED(); | 1434 ASSERT_NOT_REACHED(); |
| 1435 return BLOCK; | 1435 return BLOCK; |
| 1436 } | 1436 } |
| 1437 | 1437 |
| 1438 // CSS requires text-decoration to be reset at each DOM element for tables, | 1438 // CSS requires text-decoration to be reset at each DOM element for tables, |
| 1439 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating element
s, | 1439 // inline blocks, inline tables, run-ins, shadow DOM crossings, floating element
s, |
| 1440 // and absolute or relatively positioned elements. | 1440 // and absolute or relatively positioned elements. |
| 1441 static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) | 1441 static bool doesNotInheritTextDecoration(const RenderStyle* style, const Element
* e) |
| 1442 { | 1442 { |
| 1443 return style->display() == TABLE || style->display() == INLINE_TABLE || styl
e->display() == RUN_IN | 1443 return style->display() == TABLE || style->display() == INLINE_TABLE || styl
e->display() == RUN_IN |
| 1444 || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX ||
isAtShadowBoundary(e) | 1444 || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX ||
isAtShadowBoundary(e) |
| 1445 || style->isFloating() || style->hasOutOfFlowPosition(); | 1445 || style->isFloating() || style->hasOutOfFlowPosition(); |
| 1446 } | 1446 } |
| 1447 | 1447 |
| 1448 // FIXME: This helper is only needed because pseudoStyleForElement passes a null |
| 1449 // element to adjustRenderStyle, so we can't just use element->isInTopLayer(). |
| 1450 static bool isInTopLayer(const Element* element, const RenderStyle* style) |
| 1451 { |
| 1452 return (element && element->isInTopLayer()) || (style && style->styleType()
== BACKDROP); |
| 1453 } |
| 1454 |
| 1448 static bool isDisplayFlexibleBox(EDisplay display) | 1455 static bool isDisplayFlexibleBox(EDisplay display) |
| 1449 { | 1456 { |
| 1450 return display == FLEX || display == INLINE_FLEX; | 1457 return display == FLEX || display == INLINE_FLEX; |
| 1451 } | 1458 } |
| 1452 | 1459 |
| 1453 static bool isDisplayGridBox(EDisplay display) | 1460 static bool isDisplayGridBox(EDisplay display) |
| 1454 { | 1461 { |
| 1455 return display == GRID || display == INLINE_GRID; | 1462 return display == GRID || display == INLINE_GRID; |
| 1456 } | 1463 } |
| 1457 | 1464 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 | 1513 |
| 1507 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it
in html.css instead. | 1514 // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it
in html.css instead. |
| 1508 // Table headers with a text-align of -webkit-auto will change the text-
align to center. | 1515 // Table headers with a text-align of -webkit-auto will change the text-
align to center. |
| 1509 if (e && e->hasTagName(thTag) && style->textAlign() == TASTART) | 1516 if (e && e->hasTagName(thTag) && style->textAlign() == TASTART) |
| 1510 style->setTextAlign(CENTER); | 1517 style->setTextAlign(CENTER); |
| 1511 | 1518 |
| 1512 if (e && e->hasTagName(legendTag)) | 1519 if (e && e->hasTagName(legendTag)) |
| 1513 style->setDisplay(BLOCK); | 1520 style->setDisplay(BLOCK); |
| 1514 | 1521 |
| 1515 // Per the spec, position 'static' and 'relative' in the top layer compu
te to 'absolute'. | 1522 // Per the spec, position 'static' and 'relative' in the top layer compu
te to 'absolute'. |
| 1516 if (e && e->isInTopLayer() && (style->position() == StaticPosition || st
yle->position() == RelativePosition)) | 1523 if (isInTopLayer(e, style) && (style->position() == StaticPosition || st
yle->position() == RelativePosition)) |
| 1517 style->setPosition(AbsolutePosition); | 1524 style->setPosition(AbsolutePosition); |
| 1518 | 1525 |
| 1519 // Absolute/fixed positioned elements, floating elements and the documen
t element need block-like outside display. | 1526 // Absolute/fixed positioned elements, floating elements and the documen
t element need block-like outside display. |
| 1520 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc
ument()->documentElement() == e)) | 1527 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc
ument()->documentElement() == e)) |
| 1521 style->setDisplay(equivalentBlockDisplay(style->display(), style->is
Floating(), !document()->inQuirksMode())); | 1528 style->setDisplay(equivalentBlockDisplay(style->display(), style->is
Floating(), !document()->inQuirksMode())); |
| 1522 | 1529 |
| 1523 // FIXME: Don't support this mutation for pseudo styles like first-lette
r or first-line, since it's not completely | 1530 // FIXME: Don't support this mutation for pseudo styles like first-lette
r or first-line, since it's not completely |
| 1524 // clear how that should work. | 1531 // clear how that should work. |
| 1525 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl
e->writingMode() != parentStyle->writingMode()) | 1532 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl
e->writingMode() != parentStyle->writingMode()) |
| 1526 style->setDisplay(INLINE_BLOCK); | 1533 style->setDisplay(INLINE_BLOCK); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) | 1569 if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) |
| 1563 || style->opacity() < 1.0f | 1570 || style->opacity() < 1.0f |
| 1564 || style->hasTransformRelatedProperty() | 1571 || style->hasTransformRelatedProperty() |
| 1565 || style->hasMask() | 1572 || style->hasMask() |
| 1566 || style->clipPath() | 1573 || style->clipPath() |
| 1567 || style->boxReflect() | 1574 || style->boxReflect() |
| 1568 || style->hasFilter() | 1575 || style->hasFilter() |
| 1569 || style->hasBlendMode() | 1576 || style->hasBlendMode() |
| 1570 || style->position() == StickyPosition | 1577 || style->position() == StickyPosition |
| 1571 || (style->position() == FixedPosition && e && e->document()->page() &&
e->document()->page()->settings()->fixedPositionCreatesStackingContext()) | 1578 || (style->position() == FixedPosition && e && e->document()->page() &&
e->document()->page()->settings()->fixedPositionCreatesStackingContext()) |
| 1572 || (e && e->isInTopLayer()) | 1579 || isInTopLayer(e, style) |
| 1573 )) | 1580 )) |
| 1574 style->setZIndex(0); | 1581 style->setZIndex(0); |
| 1575 | 1582 |
| 1576 // Textarea considers overflow visible as auto. | 1583 // Textarea considers overflow visible as auto. |
| 1577 if (e && e->hasTagName(textareaTag)) { | 1584 if (e && e->hasTagName(textareaTag)) { |
| 1578 style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->over
flowX()); | 1585 style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->over
flowX()); |
| 1579 style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->over
flowY()); | 1586 style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->over
flowY()); |
| 1580 } | 1587 } |
| 1581 | 1588 |
| 1582 // For now, <marquee> requires an overflow clip to work properly. | 1589 // For now, <marquee> requires an overflow clip to work properly. |
| (...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3472 info.addMember(m_state, "state"); | 3479 info.addMember(m_state, "state"); |
| 3473 | 3480 |
| 3474 // FIXME: move this to a place where it would be called only once? | 3481 // FIXME: move this to a place where it would be called only once? |
| 3475 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); | 3482 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); |
| 3476 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); | 3483 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); |
| 3477 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle"
); | 3484 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle"
); |
| 3478 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); | 3485 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); |
| 3479 } | 3486 } |
| 3480 | 3487 |
| 3481 } // namespace WebCore | 3488 } // namespace WebCore |
| OLD | NEW |