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 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights 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 30 matching lines...) Expand all Loading... |
41 #include "core/dom/NodeRenderStyle.h" | 41 #include "core/dom/NodeRenderStyle.h" |
42 #include "core/dom/shadow/ElementShadow.h" | 42 #include "core/dom/shadow/ElementShadow.h" |
43 #include "core/dom/shadow/ShadowRoot.h" | 43 #include "core/dom/shadow/ShadowRoot.h" |
44 #include "core/rendering/RenderObject.h" | 44 #include "core/rendering/RenderObject.h" |
45 #include "wtf/BitVector.h" | 45 #include "wtf/BitVector.h" |
46 | 46 |
47 namespace WebCore { | 47 namespace WebCore { |
48 | 48 |
49 static bool isSkippableComponentForInvalidation(const CSSSelector& selector) | 49 static bool isSkippableComponentForInvalidation(const CSSSelector& selector) |
50 { | 50 { |
51 if (selector.matchesPseudoElement() || selector.pseudoType() == CSSSelector:
:PseudoHost) | 51 if (selector.m_match == CSSSelector::Tag |
| 52 || selector.m_match == CSSSelector::Id |
| 53 || selector.isAttributeSelector()) |
| 54 return true; |
| 55 if (selector.m_match != CSSSelector::PseudoClass) |
52 return false; | 56 return false; |
53 return true; | 57 switch (selector.pseudoType()) { |
| 58 case CSSSelector::PseudoEmpty: |
| 59 case CSSSelector::PseudoFirstChild: |
| 60 case CSSSelector::PseudoFirstOfType: |
| 61 case CSSSelector::PseudoLastChild: |
| 62 case CSSSelector::PseudoLastOfType: |
| 63 case CSSSelector::PseudoOnlyChild: |
| 64 case CSSSelector::PseudoOnlyOfType: |
| 65 case CSSSelector::PseudoNthChild: |
| 66 case CSSSelector::PseudoNthOfType: |
| 67 case CSSSelector::PseudoNthLastChild: |
| 68 case CSSSelector::PseudoNthLastOfType: |
| 69 case CSSSelector::PseudoLink: |
| 70 case CSSSelector::PseudoVisited: |
| 71 case CSSSelector::PseudoAnyLink: |
| 72 case CSSSelector::PseudoHover: |
| 73 case CSSSelector::PseudoDrag: |
| 74 case CSSSelector::PseudoFocus: |
| 75 case CSSSelector::PseudoActive: |
| 76 case CSSSelector::PseudoChecked: |
| 77 case CSSSelector::PseudoEnabled: |
| 78 case CSSSelector::PseudoDefault: |
| 79 case CSSSelector::PseudoDisabled: |
| 80 case CSSSelector::PseudoOptional: |
| 81 case CSSSelector::PseudoRequired: |
| 82 case CSSSelector::PseudoReadOnly: |
| 83 case CSSSelector::PseudoReadWrite: |
| 84 case CSSSelector::PseudoValid: |
| 85 case CSSSelector::PseudoInvalid: |
| 86 case CSSSelector::PseudoIndeterminate: |
| 87 case CSSSelector::PseudoTarget: |
| 88 case CSSSelector::PseudoLang: |
| 89 case CSSSelector::PseudoRoot: |
| 90 case CSSSelector::PseudoScope: |
| 91 case CSSSelector::PseudoInRange: |
| 92 case CSSSelector::PseudoOutOfRange: |
| 93 case CSSSelector::PseudoUnresolved: |
| 94 return true; |
| 95 default: |
| 96 return false; |
| 97 } |
| 98 ASSERT_NOT_REACHED(); |
| 99 return false; |
54 } | 100 } |
55 | 101 |
56 // This method is somewhat conservative in what it acceptss. | 102 // This method is somewhat conservative in what it accepts. |
57 static bool supportsClassDescendantInvalidation(const CSSSelector& selector) | 103 static bool supportsClassDescendantInvalidation(const CSSSelector& selector) |
58 { | 104 { |
59 bool foundDescendantRelation = false; | 105 bool foundDescendantRelation = false; |
60 bool foundIdent = false; | 106 bool foundIdent = false; |
61 for (const CSSSelector* component = &selector; component; component = compon
ent->tagHistory()) { | 107 for (const CSSSelector* component = &selector; component; component = compon
ent->tagHistory()) { |
62 | 108 |
63 // FIXME: We should allow pseudo elements, but we need to change how the
y hook | 109 // FIXME: We should allow pseudo elements, but we need to change how the
y hook |
64 // into recalcStyle by moving them to recalcOwnStyle instead of recalcCh
ildStyle. | 110 // into recalcStyle by moving them to recalcOwnStyle instead of recalcCh
ildStyle. |
65 | 111 |
66 // FIXME: next up: Tag and Id. | 112 // FIXME: next up: Tag and Id. |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } | 464 } |
419 | 465 |
420 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); | 466 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
421 element->clearChildNeedsStyleInvalidation(); | 467 element->clearChildNeedsStyleInvalidation(); |
422 element->clearNeedsStyleInvalidation(); | 468 element->clearNeedsStyleInvalidation(); |
423 | 469 |
424 return thisElementNeedsStyleRecalc; | 470 return thisElementNeedsStyleRecalc; |
425 } | 471 } |
426 | 472 |
427 } // namespace WebCore | 473 } // namespace WebCore |
OLD | NEW |