| 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 28 matching lines...) Expand all Loading... |
| 39 #include "core/dom/Text.h" | 39 #include "core/dom/Text.h" |
| 40 #include "core/dom/shadow/InsertionPoint.h" | 40 #include "core/dom/shadow/InsertionPoint.h" |
| 41 #include "core/dom/shadow/ShadowRoot.h" | 41 #include "core/dom/shadow/ShadowRoot.h" |
| 42 #include "core/editing/FrameSelection.h" | 42 #include "core/editing/FrameSelection.h" |
| 43 #include "core/html/HTMLDocument.h" | 43 #include "core/html/HTMLDocument.h" |
| 44 #include "core/html/HTMLFrameElementBase.h" | 44 #include "core/html/HTMLFrameElementBase.h" |
| 45 #include "core/html/HTMLInputElement.h" | 45 #include "core/html/HTMLInputElement.h" |
| 46 #include "core/html/HTMLOptionElement.h" | 46 #include "core/html/HTMLOptionElement.h" |
| 47 #include "core/html/HTMLProgressElement.h" | 47 #include "core/html/HTMLProgressElement.h" |
| 48 #include "core/html/HTMLStyleElement.h" | 48 #include "core/html/HTMLStyleElement.h" |
| 49 #include "core/html/parser/HTMLParserIdioms.h" |
| 49 #include "core/inspector/InspectorInstrumentation.h" | 50 #include "core/inspector/InspectorInstrumentation.h" |
| 50 #include "core/page/FocusController.h" | 51 #include "core/page/FocusController.h" |
| 51 #include "core/page/Frame.h" | 52 #include "core/page/Frame.h" |
| 52 #include "core/page/Page.h" | 53 #include "core/page/Page.h" |
| 53 #include "core/platform/ScrollableArea.h" | 54 #include "core/platform/ScrollableArea.h" |
| 54 #include "core/platform/ScrollbarTheme.h" | 55 #include "core/platform/ScrollbarTheme.h" |
| 55 #include "core/rendering/RenderObject.h" | 56 #include "core/rendering/RenderObject.h" |
| 56 #include "core/rendering/RenderScrollbar.h" | 57 #include "core/rendering/RenderScrollbar.h" |
| 57 #include "core/rendering/style/RenderStyle.h" | 58 #include "core/rendering/style/RenderStyle.h" |
| 58 | 59 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 230 } |
| 230 } | 231 } |
| 231 return SelectorFailsCompletely; | 232 return SelectorFailsCompletely; |
| 232 } | 233 } |
| 233 } | 234 } |
| 234 | 235 |
| 235 ASSERT_NOT_REACHED(); | 236 ASSERT_NOT_REACHED(); |
| 236 return SelectorFailsCompletely; | 237 return SelectorFailsCompletely; |
| 237 } | 238 } |
| 238 | 239 |
| 240 static inline bool containsHTMLSpace(const AtomicString& string) |
| 241 { |
| 242 for (unsigned i = 0; i < string.length(); i++) |
| 243 if (isHTMLSpace(string[i])) |
| 244 return true; |
| 245 return false; |
| 246 } |
| 247 |
| 239 static bool attributeValueMatches(const Attribute* attributeItem, CSSSelector::M
atch match, const AtomicString& selectorValue, bool caseSensitive) | 248 static bool attributeValueMatches(const Attribute* attributeItem, CSSSelector::M
atch match, const AtomicString& selectorValue, bool caseSensitive) |
| 240 { | 249 { |
| 241 const AtomicString& value = attributeItem->value(); | 250 const AtomicString& value = attributeItem->value(); |
| 242 if (value.isNull()) | 251 if (value.isNull()) |
| 243 return false; | 252 return false; |
| 244 | 253 |
| 245 switch (match) { | 254 switch (match) { |
| 246 case CSSSelector::Exact: | 255 case CSSSelector::Exact: |
| 247 if (caseSensitive ? selectorValue != value : !equalIgnoringCase(selector
Value, value)) | 256 if (caseSensitive ? selectorValue != value : !equalIgnoringCase(selector
Value, value)) |
| 248 return false; | 257 return false; |
| 249 break; | 258 break; |
| 250 case CSSSelector::List: | 259 case CSSSelector::List: |
| 251 { | 260 { |
| 252 // Ignore empty selectors or selectors containing spaces | 261 // Ignore empty selectors or selectors containing HTML spaces |
| 253 if (selectorValue.contains(' ') || selectorValue.isEmpty()) | 262 if (containsHTMLSpace(selectorValue) || selectorValue.isEmpty()) |
| 254 return false; | 263 return false; |
| 255 | 264 |
| 256 unsigned startSearchAt = 0; | 265 unsigned startSearchAt = 0; |
| 257 while (true) { | 266 while (true) { |
| 258 size_t foundPos = value.find(selectorValue, startSearchAt, caseS
ensitive); | 267 size_t foundPos = value.find(selectorValue, startSearchAt, caseS
ensitive); |
| 259 if (foundPos == notFound) | 268 if (foundPos == notFound) |
| 260 return false; | 269 return false; |
| 261 if (!foundPos || value[foundPos - 1] == ' ') { | 270 if (!foundPos || isHTMLSpace(value[foundPos - 1])) { |
| 262 unsigned endStr = foundPos + selectorValue.length(); | 271 unsigned endStr = foundPos + selectorValue.length(); |
| 263 if (endStr == value.length() || value[endStr] == ' ') | 272 if (endStr == value.length() || isHTMLSpace(value[endStr])) |
| 264 break; // We found a match. | 273 break; // We found a match. |
| 265 } | 274 } |
| 266 | 275 |
| 267 // No match. Keep looking. | 276 // No match. Keep looking. |
| 268 startSearchAt = foundPos + 1; | 277 startSearchAt = foundPos + 1; |
| 269 } | 278 } |
| 270 break; | 279 break; |
| 271 } | 280 } |
| 272 case CSSSelector::Contain: | 281 case CSSSelector::Contain: |
| 273 if (!value.contains(selectorValue, caseSensitive) || selectorValue.isEmp
ty()) | 282 if (!value.contains(selectorValue, caseSensitive) || selectorValue.isEmp
ty()) |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 return element->focused() && isFrameFocused(element); | 904 return element->focused() && isFrameFocused(element); |
| 896 } | 905 } |
| 897 | 906 |
| 898 template | 907 template |
| 899 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps
eudoId&, const DOMSiblingTraversalStrategy&) const; | 908 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps
eudoId&, const DOMSiblingTraversalStrategy&) const; |
| 900 | 909 |
| 901 template | 910 template |
| 902 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps
eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; | 911 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps
eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; |
| 903 | 912 |
| 904 } | 913 } |
| OLD | NEW |