OLD | NEW |
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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 490 } |
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 int count = 1 + siblingTraversalStrategy.countElementsBefore(ele
ment); | 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 if (m_mode == ResolvingStyle) { | 502 if (m_mode == ResolvingStyle) { |
502 RenderStyle* childStyle = context.elementStyle ? context.ele
mentStyle : element->renderStyle(); | 503 RenderStyle* childStyle = context.elementStyle ? context.ele
mentStyle : element->renderStyle(); |
503 element->setChildIndex(count); | 504 element->setChildIndex(count); |
504 if (childStyle) | 505 if (childStyle) |
505 childStyle->setUnique(); | 506 childStyle->setUnique(); |
506 parentElement->setChildrenAffectedByForwardPositionalRules()
; | 507 parentElement->setChildrenAffectedByForwardPositionalRules()
; |
507 } | 508 } |
508 | 509 |
509 if (selector->matchNth(count)) | 510 if (selector->matchNth(count)) |
510 return true; | 511 return true; |
(...skipping 12 matching lines...) Expand all Loading... |
523 } | 524 } |
524 break; | 525 break; |
525 case CSSSelector::PseudoNthLastChild: | 526 case CSSSelector::PseudoNthLastChild: |
526 if (!selector->parseNth()) | 527 if (!selector->parseNth()) |
527 break; | 528 break; |
528 if (Element* parentElement = element->parentElement()) { | 529 if (Element* parentElement = element->parentElement()) { |
529 if (m_mode == ResolvingStyle) | 530 if (m_mode == ResolvingStyle) |
530 parentElement->setChildrenAffectedByBackwardPositionalRules(
); | 531 parentElement->setChildrenAffectedByBackwardPositionalRules(
); |
531 if (!parentElement->isFinishedParsingChildren()) | 532 if (!parentElement->isFinishedParsingChildren()) |
532 return false; | 533 return false; |
533 int count = 1 + siblingTraversalStrategy.countElementsAfter(elem
ent); | 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); |
534 if (selector->matchNth(count)) | 536 if (selector->matchNth(count)) |
535 return true; | 537 return true; |
536 } | 538 } |
537 break; | 539 break; |
538 case CSSSelector::PseudoNthLastOfType: | 540 case CSSSelector::PseudoNthLastOfType: |
539 if (!selector->parseNth()) | 541 if (!selector->parseNth()) |
540 break; | 542 break; |
541 if (Element* parentElement = element->parentElement()) { | 543 if (Element* parentElement = element->parentElement()) { |
542 if (m_mode == ResolvingStyle) | 544 if (m_mode == ResolvingStyle) |
543 parentElement->setChildrenAffectedByBackwardPositionalRules(
); | 545 parentElement->setChildrenAffectedByBackwardPositionalRules(
); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 return element->focused() && isFrameFocused(element); | 914 return element->focused() && isFrameFocused(element); |
913 } | 915 } |
914 | 916 |
915 template | 917 template |
916 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps
eudoId&, const DOMSiblingTraversalStrategy&) const; | 918 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps
eudoId&, const DOMSiblingTraversalStrategy&) const; |
917 | 919 |
918 template | 920 template |
919 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps
eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; | 921 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps
eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; |
920 | 922 |
921 } | 923 } |
OLD | NEW |