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

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

Issue 18147020: Remove broken sibling selector optimization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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
« no previous file with comments | « Source/core/css/SelectorChecker.h ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 if (!parentElement->isFinishedParsingChildren()) 491 if (!parentElement->isFinishedParsingChildren())
492 return false; 492 return false;
493 return siblingTraversalStrategy.isFirstOfType(element, element-> tagQName()) && siblingTraversalStrategy.isLastOfType(element, element->tagQName( )); 493 return siblingTraversalStrategy.isFirstOfType(element, element-> tagQName()) && siblingTraversalStrategy.isLastOfType(element, element->tagQName( ));
494 } 494 }
495 break; 495 break;
496 case CSSSelector::PseudoNthChild: 496 case CSSSelector::PseudoNthChild:
497 if (!selector->parseNth()) 497 if (!selector->parseNth())
498 break; 498 break;
499 if (Element* parentElement = element->parentElement()) { 499 if (Element* parentElement = element->parentElement()) {
500 // FIXME: We should always have the index passed in to avoid nee ding countElementsBefore. 500 // FIXME: We should always have the index passed in to avoid nee ding countElementsBefore.
501 int count = context.childIndex ? context.childIndex : 1 + siblin gTraversalStrategy.countElementsBefore(element); 501 int count = 1 + siblingTraversalStrategy.countElementsBefore(ele ment);
502 if (m_mode == ResolvingStyle) { 502 if (m_mode == ResolvingStyle) {
503 RenderStyle* childStyle = context.elementStyle ? context.ele mentStyle : element->renderStyle(); 503 RenderStyle* childStyle = context.elementStyle ? context.ele mentStyle : element->renderStyle();
504 element->setChildIndex(count); 504 element->setChildIndex(count);
505 if (childStyle) 505 if (childStyle)
506 childStyle->setUnique(); 506 childStyle->setUnique();
507 parentElement->setChildrenAffectedByForwardPositionalRules() ; 507 parentElement->setChildrenAffectedByForwardPositionalRules() ;
508 } 508 }
509 509
510 if (selector->matchNth(count)) 510 if (selector->matchNth(count))
511 return true; 511 return true;
(...skipping 13 matching lines...) Expand all
525 break; 525 break;
526 case CSSSelector::PseudoNthLastChild: 526 case CSSSelector::PseudoNthLastChild:
527 if (!selector->parseNth()) 527 if (!selector->parseNth())
528 break; 528 break;
529 if (Element* parentElement = element->parentElement()) { 529 if (Element* parentElement = element->parentElement()) {
530 if (m_mode == ResolvingStyle) 530 if (m_mode == ResolvingStyle)
531 parentElement->setChildrenAffectedByBackwardPositionalRules( ); 531 parentElement->setChildrenAffectedByBackwardPositionalRules( );
532 if (!parentElement->isFinishedParsingChildren()) 532 if (!parentElement->isFinishedParsingChildren())
533 return false; 533 return false;
534 // FIXME: We should always have the index passed in to avoid nee ding countElementsAfter. 534 // FIXME: We should always have the index passed in to avoid nee ding countElementsAfter.
535 int count = context.childIndex ? context.childIndex : 1 + siblin gTraversalStrategy.countElementsAfter(element); 535 int count = 1 + siblingTraversalStrategy.countElementsAfter(elem ent);
536 if (selector->matchNth(count)) 536 if (selector->matchNth(count))
537 return true; 537 return true;
538 } 538 }
539 break; 539 break;
540 case CSSSelector::PseudoNthLastOfType: 540 case CSSSelector::PseudoNthLastOfType:
541 if (!selector->parseNth()) 541 if (!selector->parseNth())
542 break; 542 break;
543 if (Element* parentElement = element->parentElement()) { 543 if (Element* parentElement = element->parentElement()) {
544 if (m_mode == ResolvingStyle) 544 if (m_mode == ResolvingStyle)
545 parentElement->setChildrenAffectedByBackwardPositionalRules( ); 545 parentElement->setChildrenAffectedByBackwardPositionalRules( );
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 return element->focused() && isFrameFocused(element); 914 return element->focused() && isFrameFocused(element);
915 } 915 }
916 916
917 template 917 template
918 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const; 918 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const;
919 919
920 template 920 template
921 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; 921 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const;
922 922
923 } 923 }
OLDNEW
« no previous file with comments | « Source/core/css/SelectorChecker.h ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698