Chromium Code Reviews| 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 else | 709 else |
| 710 style = RenderStyle::create(); | 710 style = RenderStyle::create(); |
| 711 StyleResolverState state(element.document(), &element); | 711 StyleResolverState state(element.document(), &element); |
| 712 state.setStyle(style); | 712 state.setStyle(style); |
| 713 return createAnimatableValueSnapshot(state, property, value); | 713 return createAnimatableValueSnapshot(state, property, value); |
| 714 } | 714 } |
| 715 | 715 |
| 716 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(StyleResolverState& state, CSSPropertyID property, CSSValue& value) | 716 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(StyleResolverState& state, CSSPropertyID property, CSSValue& value) |
| 717 { | 717 { |
| 718 StyleBuilder::applyProperty(property, state, &value); | 718 StyleBuilder::applyProperty(property, state, &value); |
| 719 state.fontBuilder().createFont(state.document().styleEngine()->fontSelector( ), state.style(), state.parentStyle()); | |
|
dglazkov
2014/11/20 19:22:14
Let's ask animation folks? :)
Mike, who would be
| |
| 719 return CSSAnimatableValueFactory::create(property, *state.style()); | 720 return CSSAnimatableValueFactory::create(property, *state.style()); |
| 720 } | 721 } |
| 721 | 722 |
| 722 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId) | 723 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId) |
| 723 { | 724 { |
| 724 if (pseudoId == FIRST_LETTER) | 725 if (pseudoId == FIRST_LETTER) |
| 725 return FirstLetterPseudoElement::create(parent); | 726 return FirstLetterPseudoElement::create(parent); |
| 726 return PseudoElement::create(parent, pseudoId); | 727 return PseudoElement::create(parent, pseudoId); |
| 727 } | 728 } |
| 728 | 729 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 915 if (ScopedStyleResolver* scopedResolver = document().scopedStyleResolver()) | 916 if (ScopedStyleResolver* scopedResolver = document().scopedStyleResolver()) |
| 916 scopedResolver->collectViewportRulesTo(this); | 917 scopedResolver->collectViewportRulesTo(this); |
| 917 | 918 |
| 918 viewportStyleResolver()->resolve(); | 919 viewportStyleResolver()->resolve(); |
| 919 } | 920 } |
| 920 | 921 |
| 921 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() | 922 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() |
| 922 { | 923 { |
| 923 RefPtr<RenderStyle> style = RenderStyle::create(); | 924 RefPtr<RenderStyle> style = RenderStyle::create(); |
| 924 FontBuilder fontBuilder(document()); | 925 FontBuilder fontBuilder(document()); |
| 925 fontBuilder.setStyle(style.get()); | |
| 926 fontBuilder.setInitial(style->effectiveZoom()); | 926 fontBuilder.setInitial(style->effectiveZoom()); |
| 927 style->font().update(document().styleEngine()->fontSelector()); | 927 fontBuilder.createFont(document().styleEngine()->fontSelector(), style.get() , nullptr); |
| 928 return style.release(); | 928 return style.release(); |
| 929 } | 929 } |
| 930 | 930 |
| 931 PassRefPtr<RenderStyle> StyleResolver::styleForText(Text* textNode) | 931 PassRefPtr<RenderStyle> StyleResolver::styleForText(Text* textNode) |
| 932 { | 932 { |
| 933 ASSERT(textNode); | 933 ASSERT(textNode); |
| 934 | 934 |
| 935 Node* parentNode = NodeRenderingTraversal::parent(textNode); | 935 Node* parentNode = NodeRenderingTraversal::parent(textNode); |
| 936 if (!parentNode || !parentNode->renderStyle()) | 936 if (!parentNode || !parentNode->renderStyle()) |
| 937 return defaultStyleForElement(); | 937 return defaultStyleForElement(); |
| 938 return parentNode->renderStyle(); | 938 return parentNode->renderStyle(); |
| 939 } | 939 } |
| 940 | 940 |
| 941 void StyleResolver::updateFont(StyleResolverState& state) | 941 void StyleResolver::updateFont(StyleResolverState& state) |
| 942 { | 942 { |
| 943 state.fontBuilder().createFont(document().styleEngine()->fontSelector(), sta te.parentStyle(), state.style()); | 943 state.fontBuilder().createFont(document().styleEngine()->fontSelector(), sta te.style(), state.parentStyle()); |
| 944 state.setConversionFontSizes(CSSToLengthConversionData::FontSizes(state.styl e(), state.rootElementStyle())); | 944 state.setConversionFontSizes(CSSToLengthConversionData::FontSizes(state.styl e(), state.rootElementStyle())); |
| 945 state.setConversionZoom(state.style()->effectiveZoom()); | 945 state.setConversionZoom(state.style()->effectiveZoom()); |
| 946 } | 946 } |
| 947 | 947 |
| 948 PassRefPtrWillBeRawPtr<StyleRuleList> StyleResolver::styleRulesForElement(Elemen t* element, unsigned rulesToInclude) | 948 PassRefPtrWillBeRawPtr<StyleRuleList> StyleResolver::styleRulesForElement(Elemen t* element, unsigned rulesToInclude) |
| 949 { | 949 { |
| 950 ASSERT(element); | 950 ASSERT(element); |
| 951 StyleResolverState state(document(), element); | 951 StyleResolverState state(document(), element); |
| 952 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta te.style()); | 952 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta te.style()); |
| 953 collector.setMode(SelectorChecker::CollectingStyleRules); | 953 collector.setMode(SelectorChecker::CollectingStyleRules); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1435 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHi t); | 1435 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHi t); |
| 1436 | 1436 |
| 1437 EInsideLink linkStatus = state.style()->insideLink(); | 1437 EInsideLink linkStatus = state.style()->insideLink(); |
| 1438 // If the cache item parent style has identical inherited properties to the current parent style then the | 1438 // If the cache item parent style has identical inherited properties to the current parent style then the |
| 1439 // resulting style will be identical too. We copy the inherited prop erties over from the cache and are done. | 1439 // resulting style will be identical too. We copy the inherited prop erties over from the cache and are done. |
| 1440 state.style()->inheritFrom(cachedMatchedProperties->renderStyle.get( )); | 1440 state.style()->inheritFrom(cachedMatchedProperties->renderStyle.get( )); |
| 1441 | 1441 |
| 1442 // Unfortunately the link status is treated like an inherited proper ty. We need to explicitly restore it. | 1442 // Unfortunately the link status is treated like an inherited proper ty. We need to explicitly restore it. |
| 1443 state.style()->setInsideLink(linkStatus); | 1443 state.style()->setInsideLink(linkStatus); |
| 1444 | 1444 |
| 1445 state.fontBuilder().setFontDescription(state.style()->fontDescriptio n()); | |
| 1446 | |
| 1445 updateFont(state); | 1447 updateFont(state); |
| 1446 | 1448 |
| 1447 return; | 1449 return; |
| 1448 } | 1450 } |
| 1449 applyInheritedOnly = true; | 1451 applyInheritedOnly = true; |
| 1450 } | 1452 } |
| 1451 | 1453 |
| 1452 // Now we have all of the matched rules in the appropriate order. Walk the r ules and apply | 1454 // Now we have all of the matched rules in the appropriate order. Walk the r ules and apply |
| 1453 // high-priority properties first, i.e., those properties that other propert ies depend on. | 1455 // high-priority properties first, i.e., those properties that other propert ies depend on. |
| 1454 // The order is (1) high-priority not important, (2) high-priority important , (3) normal not important | 1456 // The order is (1) high-priority not important, (2) high-priority important , (3) normal not important |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1604 visitor->trace(m_uncommonAttributeRuleSet); | 1606 visitor->trace(m_uncommonAttributeRuleSet); |
| 1605 visitor->trace(m_watchedSelectorsRules); | 1607 visitor->trace(m_watchedSelectorsRules); |
| 1606 visitor->trace(m_treeBoundaryCrossingRules); | 1608 visitor->trace(m_treeBoundaryCrossingRules); |
| 1607 visitor->trace(m_styleSharingLists); | 1609 visitor->trace(m_styleSharingLists); |
| 1608 visitor->trace(m_pendingStyleSheets); | 1610 visitor->trace(m_pendingStyleSheets); |
| 1609 visitor->trace(m_document); | 1611 visitor->trace(m_document); |
| 1610 #endif | 1612 #endif |
| 1611 } | 1613 } |
| 1612 | 1614 |
| 1613 } // namespace blink | 1615 } // namespace blink |
| OLD | NEW |