Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: Source/core/css/resolver/ScopedStyleResolver.cpp

Issue 29633003: Avoid style sharing with mis-matched descendant selectors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2012 Google Inc. All rights reserved. 4 * Copyright (C) 2012 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 389 }
390 390
391 void ScopedStyleResolver::matchAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules, bool applyAuthorStyles) 391 void ScopedStyleResolver::matchAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules, bool applyAuthorStyles)
392 { 392 {
393 collector.clearMatchedRules(); 393 collector.clearMatchedRules();
394 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult(). matchedProperties.size() - 1; 394 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult(). matchedProperties.size() - 1;
395 collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, ignoreCascadeScope); 395 collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, ignoreCascadeScope);
396 collector.sortAndTransferMatchedRules(); 396 collector.sortAndTransferMatchedRules();
397 } 397 }
398 398
399 bool ScopedStyleResolver::matchesAnyAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules, bool applyAuthorStyles)
400 {
401 collector.clearMatchedRules();
402 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult(). matchedProperties.size() - 1;
403 collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, ignoreCascadeScope);
404 return collector.matchedResult().matchedRules.size();
405 }
406
399 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle ctor, bool includeEmptyRules, bool applyAuthorStyles, CascadeScope cascadeScope, CascadeOrder cascadeOrder) 407 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle ctor, bool includeEmptyRules, bool applyAuthorStyles, CascadeScope cascadeScope, CascadeOrder cascadeOrder)
400 { 408 {
401 if (!m_authorStyle) 409 if (!m_authorStyle)
402 return; 410 return;
403 411
404 const ContainerNode* scopingNode = &m_scopingNode; 412 const ContainerNode* scopingNode = &m_scopingNode;
405 unsigned behaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary; 413 unsigned behaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary;
406 414
407 if (!applyAuthorStyles) 415 if (!applyAuthorStyles)
408 behaviorAtBoundary |= SelectorChecker::ScopeContainsLastMatchedElement; 416 behaviorAtBoundary |= SelectorChecker::ScopeContainsLastMatchedElement;
(...skipping 18 matching lines...) Expand all
427 435
428 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const 436 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const
429 { 437 {
430 // Only consider the global author RuleSet for @viewport rules. 438 // Only consider the global author RuleSet for @viewport rules.
431 ASSERT(m_scopingNode.isDocumentNode()); 439 ASSERT(m_scopingNode.isDocumentNode());
432 if (m_authorStyle) 440 if (m_authorStyle)
433 resolver->viewportStyleResolver()->collectViewportRules(m_authorStyle.ge t(), ViewportStyleResolver::AuthorOrigin); 441 resolver->viewportStyleResolver()->collectViewportRules(m_authorStyle.ge t(), ViewportStyleResolver::AuthorOrigin);
434 } 442 }
435 443
436 } // namespace WebCore 444 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698