| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "platform/weborigin/SecurityOrigin.h" | 43 #include "platform/weborigin/SecurityOrigin.h" |
| 44 | 44 |
| 45 #include "wtf/TerminatedArrayBuilder.h" | 45 #include "wtf/TerminatedArrayBuilder.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 | 48 |
| 49 using namespace HTMLNames; | 49 using namespace HTMLNames; |
| 50 | 50 |
| 51 // ----------------------------------------------------------------- | 51 // ----------------------------------------------------------------- |
| 52 | 52 |
| 53 static bool containsUncommonAttributeSelector(const CSSSelector&); |
| 54 |
| 53 static inline bool selectorListContainsUncommonAttributeSelector(const CSSSelect
or* selector) | 55 static inline bool selectorListContainsUncommonAttributeSelector(const CSSSelect
or* selector) |
| 54 { | 56 { |
| 55 const CSSSelectorList* selectorList = selector->selectorList(); | 57 const CSSSelectorList* selectorList = selector->selectorList(); |
| 56 if (!selectorList) | 58 if (!selectorList) |
| 57 return false; | 59 return false; |
| 58 for (const CSSSelector* selector = selectorList->first(); selector; selector
= CSSSelectorList::next(*selector)) { | 60 for (const CSSSelector* selector = selectorList->first(); selector; selector
= CSSSelectorList::next(*selector)) { |
| 59 for (const CSSSelector* component = selector; component; component = com
ponent->tagHistory()) { | 61 if (containsUncommonAttributeSelector(*selector)) |
| 60 if (component->isAttributeSelector()) | 62 return true; |
| 61 return true; | |
| 62 } | |
| 63 } | 63 } |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| 66 | 66 |
| 67 static inline bool isCommonAttributeSelectorAttribute(const QualifiedName& attri
bute) | 67 static inline bool isCommonAttributeSelectorAttribute(const QualifiedName& attri
bute) |
| 68 { | 68 { |
| 69 // These are explicitly tested for equality in canShareStyleWithElement. | 69 // These are explicitly tested for equality in canShareStyleWithElement. |
| 70 return attribute == typeAttr || attribute == readonlyAttr; | 70 return attribute == typeAttr || attribute == readonlyAttr; |
| 71 } | 71 } |
| 72 | 72 |
| 73 static inline bool containsUncommonAttributeSelector(const CSSSelector& selector
) | 73 static bool containsUncommonAttributeSelector(const CSSSelector& selector) |
| 74 { | 74 { |
| 75 const CSSSelector* current = &selector; | 75 const CSSSelector* current = &selector; |
| 76 for (; current; current = current->tagHistory()) { | 76 for (; current; current = current->tagHistory()) { |
| 77 // Allow certain common attributes (used in the default style) in the se
lectors that match the current element. | 77 // Allow certain common attributes (used in the default style) in the se
lectors that match the current element. |
| 78 if (current->isAttributeSelector() && !isCommonAttributeSelectorAttribut
e(current->attribute())) | 78 if (current->isAttributeSelector() && !isCommonAttributeSelectorAttribut
e(current->attribute())) |
| 79 return true; | 79 return true; |
| 80 if (selectorListContainsUncommonAttributeSelector(current)) | 80 if (selectorListContainsUncommonAttributeSelector(current)) |
| 81 return true; | 81 return true; |
| 82 if (current->relation() != CSSSelector::SubSelector) { | 82 if (current->relation() != CSSSelector::SubSelector) { |
| 83 current = current->tagHistory(); | 83 current = current->tagHistory(); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 #ifndef NDEBUG | 395 #ifndef NDEBUG |
| 396 void RuleSet::show() | 396 void RuleSet::show() |
| 397 { | 397 { |
| 398 for (const auto& rule: m_allRules) | 398 for (const auto& rule: m_allRules) |
| 399 rule.selector().show(); | 399 rule.selector().show(); |
| 400 } | 400 } |
| 401 #endif | 401 #endif |
| 402 | 402 |
| 403 } // namespace blink | 403 } // namespace blink |
| OLD | NEW |