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 13 matching lines...) Expand all Loading... | |
| 24 * along with this library; see the file COPYING.LIB. If not, write to | 24 * along with this library; see the file COPYING.LIB. If not, write to |
| 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 26 * Boston, MA 02110-1301, USA. | 26 * Boston, MA 02110-1301, USA. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "core/css/resolver/StyleResolver.h" | 30 #include "core/css/resolver/StyleResolver.h" |
| 31 | 31 |
| 32 #include "core/CSSPropertyNames.h" | 32 #include "core/CSSPropertyNames.h" |
| 33 #include "core/HTMLNames.h" | 33 #include "core/HTMLNames.h" |
| 34 #include "core/MediaTypeNames.h" | |
| 34 #include "core/StylePropertyShorthand.h" | 35 #include "core/StylePropertyShorthand.h" |
| 35 #include "core/animation/ActiveAnimations.h" | 36 #include "core/animation/ActiveAnimations.h" |
| 36 #include "core/animation/Animation.h" | 37 #include "core/animation/Animation.h" |
| 37 #include "core/animation/AnimationTimeline.h" | 38 #include "core/animation/AnimationTimeline.h" |
| 38 #include "core/animation/StyleInterpolation.h" | 39 #include "core/animation/StyleInterpolation.h" |
| 39 #include "core/animation/animatable/AnimatableValue.h" | 40 #include "core/animation/animatable/AnimatableValue.h" |
| 40 #include "core/animation/css/CSSAnimatableValueFactory.h" | 41 #include "core/animation/css/CSSAnimatableValueFactory.h" |
| 41 #include "core/animation/css/CSSAnimations.h" | 42 #include "core/animation/css/CSSAnimations.h" |
| 42 #include "core/css/CSSCalculationValue.h" | 43 #include "core/css/CSSCalculationValue.h" |
| 43 #include "core/css/CSSDefaultStyleSheets.h" | 44 #include "core/css/CSSDefaultStyleSheets.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 collector.clearMatchedRules(); | 461 collector.clearMatchedRules(); |
| 461 collector.matchedResult().ranges.lastUserRule = collector.matchedResult().ma tchedProperties.size() - 1; | 462 collector.matchedResult().ranges.lastUserRule = collector.matchedResult().ma tchedProperties.size() - 1; |
| 462 | 463 |
| 463 MatchRequest matchRequest(m_watchedSelectorsRules.get()); | 464 MatchRequest matchRequest(m_watchedSelectorsRules.get()); |
| 464 RuleRange ruleRange = collector.matchedResult().ranges.userRuleRange(); | 465 RuleRange ruleRange = collector.matchedResult().ranges.userRuleRange(); |
| 465 collector.collectMatchingRules(matchRequest, ruleRange); | 466 collector.collectMatchingRules(matchRequest, ruleRange); |
| 466 | 467 |
| 467 collector.sortAndTransferMatchedRules(); | 468 collector.sortAndTransferMatchedRules(); |
| 468 } | 469 } |
| 469 | 470 |
| 471 static bool printMediaType(FrameView* view) | |
| 472 { | |
| 473 if (!view) | |
| 474 return false; | |
| 475 return equalIgnoringCase(view->mediaType(), MediaTypeNames::print); | |
| 476 } | |
| 477 | |
| 470 void StyleResolver::matchUARules(ElementRuleCollector& collector) | 478 void StyleResolver::matchUARules(ElementRuleCollector& collector) |
| 471 { | 479 { |
| 472 collector.setMatchingUARules(true); | 480 collector.setMatchingUARules(true); |
| 473 | 481 |
| 474 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance( ); | 482 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance( ); |
| 475 RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print") | 483 RuleSet* userAgentStyleSheet = printMediaType(document().view()) |
|
esprehn
2014/07/25 23:42:04
Why would this be slow? mediaTypeMatchSpecific jus
| |
| 476 ? defaultStyleSheets.defaultPrintStyle() : defaultStyleSheets.defaultSty le(); | 484 ? defaultStyleSheets.defaultPrintStyle() : defaultStyleSheets.defaultSty le(); |
| 477 matchUARules(collector, userAgentStyleSheet); | 485 matchUARules(collector, userAgentStyleSheet); |
| 478 | 486 |
| 479 // In quirks mode, we match rules from the quirks user agent sheet. | 487 // In quirks mode, we match rules from the quirks user agent sheet. |
| 480 if (document().inQuirksMode()) | 488 if (document().inQuirksMode()) |
| 481 matchUARules(collector, defaultStyleSheets.defaultQuirksStyle()); | 489 matchUARules(collector, defaultStyleSheets.defaultQuirksStyle()); |
| 482 | 490 |
| 483 // If document uses view source styles (in view source mode or in xml viewer mode), then we match rules from the view source style sheet. | 491 // If document uses view source styles (in view source mode or in xml viewer mode), then we match rules from the view source style sheet. |
| 484 if (document().isViewSource()) | 492 if (document().isViewSource()) |
| 485 matchUARules(collector, defaultStyleSheets.defaultViewSourceStyle()); | 493 matchUARules(collector, defaultStyleSheets.defaultViewSourceStyle()); |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1565 visitor->trace(m_features); | 1573 visitor->trace(m_features); |
| 1566 visitor->trace(m_siblingRuleSet); | 1574 visitor->trace(m_siblingRuleSet); |
| 1567 visitor->trace(m_uncommonAttributeRuleSet); | 1575 visitor->trace(m_uncommonAttributeRuleSet); |
| 1568 visitor->trace(m_watchedSelectorsRules); | 1576 visitor->trace(m_watchedSelectorsRules); |
| 1569 visitor->trace(m_treeBoundaryCrossingRules); | 1577 visitor->trace(m_treeBoundaryCrossingRules); |
| 1570 visitor->trace(m_pendingStyleSheets); | 1578 visitor->trace(m_pendingStyleSheets); |
| 1571 #endif | 1579 #endif |
| 1572 } | 1580 } |
| 1573 | 1581 |
| 1574 } // namespace blink | 1582 } // namespace blink |
| OLD | NEW |