Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(864)

Side by Side Diff: Source/WebCore/dom/MicroDataItemList.cpp

Issue 10695128: Merge 120979 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/dom/DynamicNodeList.cpp ('k') | Source/WebCore/dom/NameNodeList.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 2 * Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 27
28 #if ENABLE(MICRODATA) 28 #if ENABLE(MICRODATA)
29 #include "MicroDataItemList.h" 29 #include "MicroDataItemList.h"
30 30
31 #include "DOMSettableTokenList.h" 31 #include "DOMSettableTokenList.h"
32 #include "Document.h" 32 #include "Document.h"
33 #include "HTMLElement.h" 33 #include "HTMLElement.h"
34 #include "HTMLNames.h" 34 #include "HTMLNames.h"
35 #include "NodeRareData.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 using namespace HTMLNames; 39 using namespace HTMLNames;
39 40
40 MicroDataItemList::MicroDataItemList(PassRefPtr<Node> rootNode, const String& ty peNames) 41 MicroDataItemList::MicroDataItemList(PassRefPtr<Node> rootNode, const String& ty peNames)
41 : DynamicSubtreeNodeList(rootNode) 42 : DynamicSubtreeNodeList(rootNode)
42 , m_typeNames(typeNames, node()->document()->inQuirksMode()) 43 , m_typeNames(typeNames, node()->document()->inQuirksMode())
43 , m_originalTypeNames(typeNames) 44 , m_originalTypeNames(typeNames)
44 { 45 {
45 } 46 }
46 47
47 MicroDataItemList::~MicroDataItemList() 48 MicroDataItemList::~MicroDataItemList()
48 { 49 {
49 rootNode()->document()->removeCachedMicroDataItemList(this, m_originalTypeNa mes); 50 String localTypeNames = m_originalTypeNames.isNull() ? String("http://webkit .org/microdata/undefinedItemType") : m_originalTypeNames;
51 m_node->nodeLists()->removeCacheWithName(this, DynamicNodeList::MicroDataIte mListType, localTypeNames);
50 } 52 }
51 53
52 bool MicroDataItemList::nodeMatches(Element* testNode) const 54 bool MicroDataItemList::nodeMatches(Element* testNode) const
53 { 55 {
54 if (!testNode->isHTMLElement()) 56 if (!testNode->isHTMLElement())
55 return false; 57 return false;
56 58
57 HTMLElement* testElement = toHTMLElement(testNode); 59 HTMLElement* testElement = toHTMLElement(testNode);
58 if (!testElement->fastHasAttribute(itemscopeAttr) || testElement->fastHasAtt ribute(itempropAttr)) 60 if (!testElement->fastHasAttribute(itemscopeAttr) || testElement->fastHasAtt ribute(itempropAttr))
59 return false; 61 return false;
60 62
61 if (!m_typeNames.size()) 63 if (!m_typeNames.size())
62 return true; 64 return true;
63 65
64 return testElement->itemType()->tokens().containsAll(m_typeNames); 66 return testElement->itemType()->tokens().containsAll(m_typeNames);
65 } 67 }
66 68
67 } // namespace WebCore 69 } // namespace WebCore
68 70
69 #endif // ENABLE(MICRODATA) 71 #endif // ENABLE(MICRODATA)
OLDNEW
« no previous file with comments | « Source/WebCore/dom/DynamicNodeList.cpp ('k') | Source/WebCore/dom/NameNodeList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698