Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 static bool isSkippableComponentForInvalidation(const CSSSelector& selector) | 46 static bool isSkippableComponentForInvalidation(const CSSSelector& selector) |
| 47 { | 47 { |
| 48 if (selector.matchesPseudoElement() || selector.pseudoType() == CSSSelector: :PseudoHost) | 48 if (selector.matchesPseudoElement() || selector.pseudoType() == CSSSelector: :PseudoHost) |
| 49 return false; | 49 return false; |
| 50 return true; | 50 return true; |
| 51 } | 51 } |
| 52 | 52 |
| 53 // This method is somewhat conservative in what it acceptss. | 53 // This method is somewhat conservative in what it acceptss. |
| 54 static bool supportsClassDescendantInvalidation(const CSSSelector& selector) | 54 static bool supportsClassDescendantInvalidation(const CSSSelector& selector) |
| 55 { | 55 { |
| 56 bool foundDescendantRelation = false; | 56 bool foundDescendantRelation = false; |
|
chrishtr
2014/02/19 17:50:44
remove these variables
rune
2014/02/19 18:47:40
See other comment.
| |
| 57 bool foundAncestorIdent = false; | |
| 58 bool foundIdent = false; | 57 bool foundIdent = false; |
| 59 for (const CSSSelector* component = &selector; component; component = compon ent->tagHistory()) { | 58 for (const CSSSelector* component = &selector; component; component = compon ent->tagHistory()) { |
| 60 | 59 |
| 61 // FIXME: We should allow pseudo elements, but we need to change how the y hook | 60 // FIXME: We should allow pseudo elements, but we need to change how the y hook |
| 62 // into recalcStyle by moving them to recalcOwnStyle instead of recalcCh ildStyle. | 61 // into recalcStyle by moving them to recalcOwnStyle instead of recalcCh ildStyle. |
| 63 | 62 |
| 64 // FIXME: next up: Tag and Id. | 63 // FIXME: next up: Tag and Id. |
| 65 if (component->m_match == CSSSelector::Class) { | 64 if (component->m_match == CSSSelector::Class) { |
| 66 if (!foundDescendantRelation) | 65 if (!foundDescendantRelation) |
| 67 foundIdent = true; | 66 foundIdent = true; |
|
chrishtr
2014/02/19 17:50:44
return true, remove if (!foundDescendantRelation)
rune
2014/02/19 18:47:40
We still need to continue to look for adjacent com
chrishtr
2014/02/19 18:54:01
Oh right, good point.
| |
| 68 else | |
| 69 foundAncestorIdent = true; | |
| 70 } else if (!isSkippableComponentForInvalidation(*component)) { | 67 } else if (!isSkippableComponentForInvalidation(*component)) { |
| 71 return false; | 68 return false; |
| 72 } | 69 } |
| 73 // FIXME: We can probably support ChildTree and DescendantTree. | 70 // FIXME: We can probably support ChildTree and DescendantTree. |
| 74 switch (component->relation()) { | 71 switch (component->relation()) { |
| 75 case CSSSelector::Descendant: | 72 case CSSSelector::Descendant: |
| 76 case CSSSelector::Child: | 73 case CSSSelector::Child: |
| 77 foundDescendantRelation = true; | 74 foundDescendantRelation = true; |
|
chrishtr
2014/02/19 17:50:44
return true;
| |
| 78 // Fall through! | 75 // Fall through! |
| 79 case CSSSelector::SubSelector: | 76 case CSSSelector::SubSelector: |
| 80 continue; | 77 continue; |
| 81 default: | 78 default: |
| 82 return false; | 79 return false; |
| 83 } | 80 } |
| 84 } | 81 } |
| 85 return foundDescendantRelation && foundAncestorIdent && foundIdent; | 82 return foundIdent; |
|
chrishtr
2014/02/19 17:50:44
remove this line
rune
2014/02/19 18:47:40
See other comment.
| |
| 86 } | 83 } |
| 87 | 84 |
| 88 void extractClassIdOrTag(const CSSSelector& selector, Vector<AtomicString>& clas ses, AtomicString& id, AtomicString& tagName) | 85 void extractClassIdOrTag(const CSSSelector& selector, Vector<AtomicString>& clas ses, AtomicString& id, AtomicString& tagName) |
| 89 { | 86 { |
| 90 if (selector.m_match == CSSSelector::Tag) | 87 if (selector.m_match == CSSSelector::Tag) |
| 91 tagName = selector.tagQName().localName(); | 88 tagName = selector.tagQName().localName(); |
| 92 else if (selector.m_match == CSSSelector::Id) | 89 else if (selector.m_match == CSSSelector::Id) |
| 93 id = selector.value(); | 90 id = selector.value(); |
| 94 else if (selector.m_match == CSSSelector::Class) | 91 else if (selector.m_match == CSSSelector::Class) |
| 95 classes.append(selector.value()); | 92 classes.append(selector.value()); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 element->setNeedsStyleRecalc(LocalStyleChange); | 421 element->setNeedsStyleRecalc(LocalStyleChange); |
| 425 | 422 |
| 426 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); | 423 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
| 427 element->clearChildNeedsStyleInvalidation(); | 424 element->clearChildNeedsStyleInvalidation(); |
| 428 element->clearNeedsStyleInvalidation(); | 425 element->clearNeedsStyleInvalidation(); |
| 429 | 426 |
| 430 return thisElementNeedsStyleRecalc; | 427 return thisElementNeedsStyleRecalc; |
| 431 } | 428 } |
| 432 | 429 |
| 433 } // namespace WebCore | 430 } // namespace WebCore |
| OLD | NEW |