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

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

Issue 16194002: Make ScopedStyleResolver use apply-author-styles of a given element's treescope. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 * (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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 446 }
447 447
448 void StyleResolver::matchScopedAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules) 448 void StyleResolver::matchScopedAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules)
449 { 449 {
450 // fast path 450 // fast path
451 if (m_styleTree.hasOnlyScopeResolverForDocument()) { 451 if (m_styleTree.hasOnlyScopeResolverForDocument()) {
452 m_styleTree.scopedStyleResolverForDocument()->matchAuthorRules(collector , includeEmptyRules, true); 452 m_styleTree.scopedStyleResolverForDocument()->matchAuthorRules(collector , includeEmptyRules, true);
453 return; 453 return;
454 } 454 }
455 455
456 Vector<std::pair<ScopedStyleResolver*, bool>, 8> stack; 456 Vector<ScopedStyleResolver*, 8> stack;
457 m_styleTree.resolveScopeStyles(m_state.element(), stack); 457 m_styleTree.resolveScopeStyles(m_state.element(), stack);
458 if (stack.isEmpty()) 458 if (stack.isEmpty())
459 return; 459 return;
460 460
461 for (int i = stack.size() - 1; i >= 0; --i) { 461 bool applyAuthorStyles = m_state.element()->treeScope()->applyAuthorStyles() ;
462 ScopedStyleResolver* scopeResolver = stack.at(i).first; 462 for (int i = stack.size() - 1; i >= 0; --i)
463 bool applyAuthorStyles = stack.at(i).second; 463 stack.at(i)->matchAuthorRules(collector, includeEmptyRules, applyAuthorS tyles);
464 scopeResolver->matchAuthorRules(collector, includeEmptyRules, applyAutho rStyles); 464
465 } 465 matchHostRules(stack.first(), collector, includeEmptyRules);
466 matchHostRules(stack.first().first, collector, includeEmptyRules);
467 } 466 }
468 467
469 void StyleResolver::matchAuthorRules(ElementRuleCollector& collector, bool inclu deEmptyRules) 468 void StyleResolver::matchAuthorRules(ElementRuleCollector& collector, bool inclu deEmptyRules)
470 { 469 {
471 matchScopedAuthorRules(collector, includeEmptyRules); 470 matchScopedAuthorRules(collector, includeEmptyRules);
472 matchShadowDistributedRules(collector, includeEmptyRules); 471 matchShadowDistributedRules(collector, includeEmptyRules);
473 } 472 }
474 473
475 void StyleResolver::matchUserRules(ElementRuleCollector& collector, bool include EmptyRules) 474 void StyleResolver::matchUserRules(ElementRuleCollector& collector, bool include EmptyRules)
476 { 475 {
(...skipping 3383 matching lines...) Expand 10 before | Expand all | Expand 10 after
3860 info.addMember(m_state, "state"); 3859 info.addMember(m_state, "state");
3861 3860
3862 // FIXME: move this to a place where it would be called only once? 3861 // FIXME: move this to a place where it would be called only once?
3863 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3862 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3864 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3863 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3865 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3864 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3866 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3865 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3867 } 3866 }
3868 3867
3869 } // namespace WebCore 3868 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698