| 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 } | 562 } |
| 563 | 563 |
| 564 StyleResolverState state(document(), elementContext, defaultParent); | 564 StyleResolverState state(document(), elementContext, defaultParent); |
| 565 | 565 |
| 566 ElementAnimations* elementAnimations = element->elementAnimations(); | 566 ElementAnimations* elementAnimations = element->elementAnimations(); |
| 567 const LayoutStyle* baseLayoutStyle = elementAnimations ? elementAnimations->
baseLayoutStyle() : nullptr; | 567 const LayoutStyle* baseLayoutStyle = elementAnimations ? elementAnimations->
baseLayoutStyle() : nullptr; |
| 568 | 568 |
| 569 if (baseLayoutStyle) { | 569 if (baseLayoutStyle) { |
| 570 state.setStyle(LayoutStyle::clone(*baseLayoutStyle)); | 570 state.setStyle(LayoutStyle::clone(*baseLayoutStyle)); |
| 571 if (!state.parentStyle()) | 571 if (!state.parentStyle()) |
| 572 state.setParentStyle(defaultStyleForElement()); | 572 state.setParentStyle(initialStyleForElement()); |
| 573 } else { | 573 } else { |
| 574 if (state.parentStyle()) { | 574 if (state.parentStyle()) { |
| 575 RefPtr<LayoutStyle> style = LayoutStyle::create(); | 575 RefPtr<LayoutStyle> style = LayoutStyle::create(); |
| 576 style->inheritFrom(*state.parentStyle(), isAtShadowBoundary(element)
? LayoutStyle::AtShadowBoundary : LayoutStyle::NotAtShadowBoundary); | 576 style->inheritFrom(*state.parentStyle(), isAtShadowBoundary(element)
? LayoutStyle::AtShadowBoundary : LayoutStyle::NotAtShadowBoundary); |
| 577 state.setStyle(style.release()); | 577 state.setStyle(style.release()); |
| 578 } else { | 578 } else { |
| 579 state.setStyle(defaultStyleForElement()); | 579 state.setStyle(initialStyleForElement()); |
| 580 state.setParentStyle(LayoutStyle::clone(*state.style())); | 580 state.setParentStyle(LayoutStyle::clone(*state.style())); |
| 581 } | 581 } |
| 582 } | 582 } |
| 583 | 583 |
| 584 // contenteditable attribute (implemented by -webkit-user-modify) should | 584 // contenteditable attribute (implemented by -webkit-user-modify) should |
| 585 // be propagated from shadow host to distributed node. | 585 // be propagated from shadow host to distributed node. |
| 586 if (state.distributedToInsertionPoint()) { | 586 if (state.distributedToInsertionPoint()) { |
| 587 if (Element* parent = element->parentElement()) { | 587 if (Element* parent = element->parentElement()) { |
| 588 if (LayoutStyle* styleOfShadowHost = parent->layoutStyle()) | 588 if (LayoutStyle* styleOfShadowHost = parent->layoutStyle()) |
| 589 state.style()->setUserModify(styleOfShadowHost->userModify()); | 589 state.style()->setUserModify(styleOfShadowHost->userModify()); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 ElementAnimations* elementAnimations = pseudoElement ? pseudoElement->elemen
tAnimations() : nullptr; | 775 ElementAnimations* elementAnimations = pseudoElement ? pseudoElement->elemen
tAnimations() : nullptr; |
| 776 const LayoutStyle* baseLayoutStyle = elementAnimations ? elementAnimations->
baseLayoutStyle() : nullptr; | 776 const LayoutStyle* baseLayoutStyle = elementAnimations ? elementAnimations->
baseLayoutStyle() : nullptr; |
| 777 | 777 |
| 778 if (baseLayoutStyle) { | 778 if (baseLayoutStyle) { |
| 779 state.setStyle(LayoutStyle::clone(*baseLayoutStyle)); | 779 state.setStyle(LayoutStyle::clone(*baseLayoutStyle)); |
| 780 } else if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) { | 780 } else if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) { |
| 781 RefPtr<LayoutStyle> style = LayoutStyle::create(); | 781 RefPtr<LayoutStyle> style = LayoutStyle::create(); |
| 782 style->inheritFrom(*state.parentStyle()); | 782 style->inheritFrom(*state.parentStyle()); |
| 783 state.setStyle(style.release()); | 783 state.setStyle(style.release()); |
| 784 } else { | 784 } else { |
| 785 state.setStyle(defaultStyleForElement()); | 785 state.setStyle(initialStyleForElement()); |
| 786 state.setParentStyle(LayoutStyle::clone(*state.style())); | 786 state.setParentStyle(LayoutStyle::clone(*state.style())); |
| 787 } | 787 } |
| 788 | 788 |
| 789 state.style()->setStyleType(pseudoStyleRequest.pseudoId); | 789 state.style()->setStyleType(pseudoStyleRequest.pseudoId); |
| 790 | 790 |
| 791 // Since we don't use pseudo-elements in any of our quirk/print | 791 // Since we don't use pseudo-elements in any of our quirk/print |
| 792 // user agent rules, don't waste time walking those rules. | 792 // user agent rules, don't waste time walking those rules. |
| 793 | 793 |
| 794 if (!baseLayoutStyle) { | 794 if (!baseLayoutStyle) { |
| 795 // Check UA, user and author rules. | 795 // Check UA, user and author rules. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 applyMatchedProperties<LowPropertyPriority>(state, result, false, 0, result.
matchedProperties.size() - 1, inheritedOnly); | 879 applyMatchedProperties<LowPropertyPriority>(state, result, false, 0, result.
matchedProperties.size() - 1, inheritedOnly); |
| 880 | 880 |
| 881 loadPendingResources(state); | 881 loadPendingResources(state); |
| 882 | 882 |
| 883 didAccess(); | 883 didAccess(); |
| 884 | 884 |
| 885 // Now return the style. | 885 // Now return the style. |
| 886 return state.takeStyle(); | 886 return state.takeStyle(); |
| 887 } | 887 } |
| 888 | 888 |
| 889 PassRefPtr<LayoutStyle> StyleResolver::defaultStyleForElement() | 889 PassRefPtr<LayoutStyle> StyleResolver::initialStyleForElement() |
| 890 { | 890 { |
| 891 RefPtr<LayoutStyle> style = LayoutStyle::create(); | 891 RefPtr<LayoutStyle> style = LayoutStyle::create(); |
| 892 FontBuilder fontBuilder(document()); | 892 FontBuilder fontBuilder(document()); |
| 893 fontBuilder.setInitial(style->effectiveZoom()); | 893 fontBuilder.setInitial(style->effectiveZoom()); |
| 894 fontBuilder.createFont(document().styleEngine().fontSelector(), *style); | 894 fontBuilder.createFont(document().styleEngine().fontSelector(), *style); |
| 895 return style.release(); | 895 return style.release(); |
| 896 } | 896 } |
| 897 | 897 |
| 898 PassRefPtr<LayoutStyle> StyleResolver::styleForText(Text* textNode) | 898 PassRefPtr<LayoutStyle> StyleResolver::styleForText(Text* textNode) |
| 899 { | 899 { |
| 900 ASSERT(textNode); | 900 ASSERT(textNode); |
| 901 | 901 |
| 902 Node* parentNode = NodeRenderingTraversal::parent(*textNode); | 902 Node* parentNode = NodeRenderingTraversal::parent(*textNode); |
| 903 if (!parentNode || !parentNode->layoutStyle()) | 903 if (!parentNode || !parentNode->layoutStyle()) |
| 904 return defaultStyleForElement(); | 904 return initialStyleForElement(); |
| 905 return parentNode->layoutStyle(); | 905 return parentNode->layoutStyle(); |
| 906 } | 906 } |
| 907 | 907 |
| 908 void StyleResolver::updateFont(StyleResolverState& state) | 908 void StyleResolver::updateFont(StyleResolverState& state) |
| 909 { | 909 { |
| 910 state.fontBuilder().createFont(document().styleEngine().fontSelector(), stat
e.mutableStyleRef()); | 910 state.fontBuilder().createFont(document().styleEngine().fontSelector(), stat
e.mutableStyleRef()); |
| 911 state.setConversionFontSizes(CSSToLengthConversionData::FontSizes(state.styl
e(), state.rootElementStyle())); | 911 state.setConversionFontSizes(CSSToLengthConversionData::FontSizes(state.styl
e(), state.rootElementStyle())); |
| 912 state.setConversionZoom(state.style()->effectiveZoom()); | 912 state.setConversionZoom(state.style()->effectiveZoom()); |
| 913 } | 913 } |
| 914 | 914 |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 visitor->trace(m_uncommonAttributeRuleSet); | 1499 visitor->trace(m_uncommonAttributeRuleSet); |
| 1500 visitor->trace(m_watchedSelectorsRules); | 1500 visitor->trace(m_watchedSelectorsRules); |
| 1501 visitor->trace(m_treeBoundaryCrossingRules); | 1501 visitor->trace(m_treeBoundaryCrossingRules); |
| 1502 visitor->trace(m_styleSharingLists); | 1502 visitor->trace(m_styleSharingLists); |
| 1503 visitor->trace(m_pendingStyleSheets); | 1503 visitor->trace(m_pendingStyleSheets); |
| 1504 visitor->trace(m_document); | 1504 visitor->trace(m_document); |
| 1505 #endif | 1505 #endif |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 } // namespace blink | 1508 } // namespace blink |
| OLD | NEW |