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

Side by Side Diff: Source/core/css/SelectorChecker.cpp

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed web/mac/WebSubstringUtil.mm Created 5 years, 10 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 if (!textNode->data().isEmpty()) { 606 if (!textNode->data().isEmpty()) {
607 result = false; 607 result = false;
608 break; 608 break;
609 } 609 }
610 } 610 }
611 } 611 }
612 if (m_mode == ResolvingStyle) { 612 if (m_mode == ResolvingStyle) {
613 element.setStyleAffectedByEmpty(); 613 element.setStyleAffectedByEmpty();
614 if (context.elementStyle) 614 if (context.elementStyle)
615 context.elementStyle->setEmptyState(result); 615 context.elementStyle->setEmptyState(result);
616 else if (element.layoutStyle() && (element.document().styleEngin e()->usesSiblingRules() || element.layoutStyle()->unique())) 616 else if (element.mutableLayoutStyle() && (element.document().sty leEngine()->usesSiblingRules() || element.mutableLayoutStyle()->unique()))
617 element.layoutStyle()->setEmptyState(result); 617 element.mutableLayoutStyle()->setEmptyState(result);
618 } 618 }
619 return result; 619 return result;
620 } 620 }
621 case CSSSelector::PseudoFirstChild: 621 case CSSSelector::PseudoFirstChild:
622 // first-child matches the first child that is an element 622 // first-child matches the first child that is an element
623 if (ContainerNode* parent = element.parentElementOrDocumentFragment()) { 623 if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
624 bool result = siblingTraversalStrategy.isFirstChild(element); 624 bool result = siblingTraversalStrategy.isFirstChild(element);
625 if (m_mode == ResolvingStyle) { 625 if (m_mode == ResolvingStyle) {
626 parent->setChildrenAffectedByFirstChildRules(); 626 parent->setChildrenAffectedByFirstChildRules();
627 element.setAffectedByFirstChildRules(); 627 element.setAffectedByFirstChildRules();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 return false; 683 return false;
684 return siblingTraversalStrategy.isFirstOfType(element, element.tagQN ame()) && siblingTraversalStrategy.isLastOfType(element, element.tagQName()); 684 return siblingTraversalStrategy.isFirstOfType(element, element.tagQN ame()) && siblingTraversalStrategy.isLastOfType(element, element.tagQName());
685 } 685 }
686 break; 686 break;
687 case CSSSelector::PseudoNthChild: 687 case CSSSelector::PseudoNthChild:
688 if (!selector.parseNth()) 688 if (!selector.parseNth())
689 break; 689 break;
690 if (ContainerNode* parent = element.parentElementOrDocumentFragment()) { 690 if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
691 int count = 1 + siblingTraversalStrategy.countElementsBefore(element ); 691 int count = 1 + siblingTraversalStrategy.countElementsBefore(element );
692 if (m_mode == ResolvingStyle) { 692 if (m_mode == ResolvingStyle) {
693 LayoutStyle* childStyle = context.elementStyle ? context.element Style : element.layoutStyle(); 693 LayoutStyle* childStyle = context.elementStyle ? context.element Style : element.mutableLayoutStyle();
dstockwell 2015/02/19 00:41:50 Why this change? setUnique() is const now (given m
Julien - ping for review 2015/02/19 21:04:13 Good catch, updated.
694 if (childStyle) 694 if (childStyle)
695 childStyle->setUnique(); 695 childStyle->setUnique();
696 parent->setChildrenAffectedByForwardPositionalRules(); 696 parent->setChildrenAffectedByForwardPositionalRules();
697 } 697 }
698 698
699 if (selector.matchNth(count)) 699 if (selector.matchNth(count))
700 return true; 700 return true;
701 } 701 }
702 break; 702 break;
703 case CSSSelector::PseudoNthOfType: 703 case CSSSelector::PseudoNthOfType:
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMen uList(); 1174 return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMen uList();
1175 } 1175 }
1176 1176
1177 template 1177 template
1178 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst DOMSiblingTraversalStrategy&, MatchResult*) const; 1178 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst DOMSiblingTraversalStrategy&, MatchResult*) const;
1179 1179
1180 template 1180 template
1181 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; 1181 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const;
1182 1182
1183 } 1183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698