| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 { | 124 { |
| 125 FrameView* view = document.view(); | 125 FrameView* view = document.view(); |
| 126 if (view) { | 126 if (view) { |
| 127 m_medium = adoptPtr(new MediaQueryEvaluator(&view->frame())); | 127 m_medium = adoptPtr(new MediaQueryEvaluator(&view->frame())); |
| 128 m_printMediaType = equalIgnoringCase(view->mediaType(), MediaTypeNames::
print); | 128 m_printMediaType = equalIgnoringCase(view->mediaType(), MediaTypeNames::
print); |
| 129 } else { | 129 } else { |
| 130 m_medium = adoptPtr(new MediaQueryEvaluator("all")); | 130 m_medium = adoptPtr(new MediaQueryEvaluator("all")); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void StyleResolver::appendCSSStyleSheet(CSSStyleSheet* cssSheet) | |
| 135 { | |
| 136 ASSERT(cssSheet); | |
| 137 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m
_viewportDependentMediaQueryResults)) | |
| 138 return; | |
| 139 | |
| 140 Node* ownerNode = cssSheet->ownerNode(); | |
| 141 if (!ownerNode) | |
| 142 return; | |
| 143 | |
| 144 TreeScope& treeScope = ownerNode->treeScope(); | |
| 145 treeScope.scopedStyleResolver().addRulesFromSheet(cssSheet); | |
| 146 | |
| 147 // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets fo
r the moment. | |
| 148 if (ownerNode->isDocumentNode()) { | |
| 149 CSSFontSelector* fontSelector = document().styleEngine()->fontSelector()
; | |
| 150 RuleSet& ruleSet = cssSheet->contents()->ruleSet(); | |
| 151 const Vector<RawPtr<StyleRuleFontFace> > fontFaceRules = ruleSet.fontFac
eRules(); | |
| 152 for (unsigned i = 0; i < fontFaceRules.size(); ++i) { | |
| 153 if (RefPtr<FontFace> fontFace = FontFace::create(&document(), fontFa
ceRules[i])) | |
| 154 fontSelector->fontFaceCache()->add(fontSelector, fontFaceRules[i
], fontFace); | |
| 155 } | |
| 156 if (fontFaceRules.size()) | |
| 157 invalidateMatchedPropertiesCache(); | |
| 158 } | |
| 159 } | |
| 160 | |
| 161 void StyleResolver::addToStyleSharingList(Element& element) | 134 void StyleResolver::addToStyleSharingList(Element& element) |
| 162 { | 135 { |
| 163 // Never add elements to the style sharing list if we're not in a recalcStyl
e, | 136 // Never add elements to the style sharing list if we're not in a recalcStyl
e, |
| 164 // otherwise we could leave stale pointers in there. | 137 // otherwise we could leave stale pointers in there. |
| 165 if (!document().inStyleRecalc()) | 138 if (!document().inStyleRecalc()) |
| 166 return; | 139 return; |
| 167 ASSERT(element.supportsStyleSharing()); | 140 ASSERT(element.supportsStyleSharing()); |
| 168 INCREMENT_STYLE_STATS_COUNTER(*this, sharedStyleCandidates); | 141 INCREMENT_STYLE_STATS_COUNTER(*this, sharedStyleCandidates); |
| 169 StyleSharingList& list = styleSharingList(); | 142 StyleSharingList& list = styleSharingList(); |
| 170 if (list.size() >= styleSharingListSize) | 143 if (list.size() >= styleSharingListSize) |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 updateFont(state); | 696 updateFont(state); |
| 724 break; | 697 break; |
| 725 default: | 698 default: |
| 726 break; | 699 break; |
| 727 } | 700 } |
| 728 StyleBuilder::applyProperty(properties[i].property, state, propertie
s[i].value); | 701 StyleBuilder::applyProperty(properties[i].property, state, propertie
s[i].value); |
| 729 } | 702 } |
| 730 } | 703 } |
| 731 } | 704 } |
| 732 | 705 |
| 706 void StyleResolver::resetMediaQueryAffectedByViewportChange() |
| 707 { |
| 708 m_viewportDependentMediaQueryResults.clear(); |
| 709 } |
| 710 |
| 711 void StyleResolver::addMediaQueryAffectedByViewportChange(const MediaQueryResult
List& list) |
| 712 { |
| 713 m_viewportDependentMediaQueryResults.appendVector(list); |
| 714 } |
| 715 |
| 733 bool StyleResolver::mediaQueryAffectedByViewportChange() const | 716 bool StyleResolver::mediaQueryAffectedByViewportChange() const |
| 734 { | 717 { |
| 735 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { | 718 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { |
| 736 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) | 719 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) |
| 737 return true; | 720 return true; |
| 738 } | 721 } |
| 739 return false; | 722 return false; |
| 740 } | 723 } |
| 741 | 724 |
| 742 } // namespace blink | 725 } // namespace blink |
| OLD | NEW |