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

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

Issue 16629006: Revert 151996 "Avoid N^2 walk placing renderers when building th..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Update to head 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
« no previous file with comments | « Source/core/css/SelectorChecker.h ('k') | Source/core/css/SiblingTraversalStrategies.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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 487 }
488 if (!parentElement->isFinishedParsingChildren()) 488 if (!parentElement->isFinishedParsingChildren())
489 return false; 489 return false;
490 return siblingTraversalStrategy.isFirstOfType(element, element-> tagQName()) && siblingTraversalStrategy.isLastOfType(element, element->tagQName( )); 490 return siblingTraversalStrategy.isFirstOfType(element, element-> tagQName()) && siblingTraversalStrategy.isLastOfType(element, element->tagQName( ));
491 } 491 }
492 break; 492 break;
493 case CSSSelector::PseudoNthChild: 493 case CSSSelector::PseudoNthChild:
494 if (!selector->parseNth()) 494 if (!selector->parseNth())
495 break; 495 break;
496 if (Element* parentElement = element->parentElement()) { 496 if (Element* parentElement = element->parentElement()) {
497 // FIXME: We should always have the index passed in to avoid nee ding countElementsBefore. 497 int count = 1 + siblingTraversalStrategy.countElementsBefore(ele ment);
498 int count = context.childIndex ? context.childIndex : 1 + siblin gTraversalStrategy.countElementsBefore(element);
499 if (m_mode == ResolvingStyle) { 498 if (m_mode == ResolvingStyle) {
500 RenderStyle* childStyle = context.elementStyle ? context.ele mentStyle : element->renderStyle(); 499 RenderStyle* childStyle = context.elementStyle ? context.ele mentStyle : element->renderStyle();
501 element->setChildIndex(count); 500 element->setChildIndex(count);
502 if (childStyle) 501 if (childStyle)
503 childStyle->setUnique(); 502 childStyle->setUnique();
504 parentElement->setChildrenAffectedByForwardPositionalRules() ; 503 parentElement->setChildrenAffectedByForwardPositionalRules() ;
505 } 504 }
506 505
507 if (selector->matchNth(count)) 506 if (selector->matchNth(count))
508 return true; 507 return true;
(...skipping 12 matching lines...) Expand all
521 } 520 }
522 break; 521 break;
523 case CSSSelector::PseudoNthLastChild: 522 case CSSSelector::PseudoNthLastChild:
524 if (!selector->parseNth()) 523 if (!selector->parseNth())
525 break; 524 break;
526 if (Element* parentElement = element->parentElement()) { 525 if (Element* parentElement = element->parentElement()) {
527 if (m_mode == ResolvingStyle) 526 if (m_mode == ResolvingStyle)
528 parentElement->setChildrenAffectedByBackwardPositionalRules( ); 527 parentElement->setChildrenAffectedByBackwardPositionalRules( );
529 if (!parentElement->isFinishedParsingChildren()) 528 if (!parentElement->isFinishedParsingChildren())
530 return false; 529 return false;
531 // FIXME: We should always have the index passed in to avoid nee ding countElementsAfter. 530 int count = 1 + siblingTraversalStrategy.countElementsAfter(elem ent);
532 int count = context.childIndex ? context.childIndex : 1 + siblin gTraversalStrategy.countElementsAfter(element);
533 if (selector->matchNth(count)) 531 if (selector->matchNth(count))
534 return true; 532 return true;
535 } 533 }
536 break; 534 break;
537 case CSSSelector::PseudoNthLastOfType: 535 case CSSSelector::PseudoNthLastOfType:
538 if (!selector->parseNth()) 536 if (!selector->parseNth())
539 break; 537 break;
540 if (Element* parentElement = element->parentElement()) { 538 if (Element* parentElement = element->parentElement()) {
541 if (m_mode == ResolvingStyle) 539 if (m_mode == ResolvingStyle)
542 parentElement->setChildrenAffectedByBackwardPositionalRules( ); 540 parentElement->setChildrenAffectedByBackwardPositionalRules( );
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 return element->focused() && isFrameFocused(element); 910 return element->focused() && isFrameFocused(element);
913 } 911 }
914 912
915 template 913 template
916 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const; 914 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const;
917 915
918 template 916 template
919 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; 917 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const;
920 918
921 } 919 }
OLDNEW
« no previous file with comments | « Source/core/css/SelectorChecker.h ('k') | Source/core/css/SiblingTraversalStrategies.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698