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

Side by Side Diff: third_party/WebKit/Source/core/css/StyleSheetList.cpp

Issue 2392343005: Reflow comments in core/css (Closed)
Patch Set: Revert clang-format Created 4 years, 2 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 | « third_party/WebKit/Source/core/css/StyleSheetContents.cpp ('k') | no next file » | 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 30 matching lines...) Expand all
41 unsigned StyleSheetList::length() { 41 unsigned StyleSheetList::length() {
42 return styleSheets().size(); 42 return styleSheets().size();
43 } 43 }
44 44
45 StyleSheet* StyleSheetList::item(unsigned index) { 45 StyleSheet* StyleSheetList::item(unsigned index) {
46 const HeapVector<Member<StyleSheet>>& sheets = styleSheets(); 46 const HeapVector<Member<StyleSheet>>& sheets = styleSheets();
47 return index < sheets.size() ? sheets[index].get() : nullptr; 47 return index < sheets.size() ? sheets[index].get() : nullptr;
48 } 48 }
49 49
50 HTMLStyleElement* StyleSheetList::getNamedItem(const AtomicString& name) const { 50 HTMLStyleElement* StyleSheetList::getNamedItem(const AtomicString& name) const {
51 // IE also supports retrieving a stylesheet by name, using the name/id of the <style> tag 51 // IE also supports retrieving a stylesheet by name, using the name/id of the
52 // (this is consistent with all the other collections) 52 // <style> tag (this is consistent with all the other collections) ### Bad
53 // ### Bad implementation because returns a single element (are IDs always uni que?) 53 // implementation because returns a single element (are IDs always unique?)
54 // and doesn't look for name attribute. 54 // and doesn't look for name attribute. But unicity of stylesheet ids is good
55 // But unicity of stylesheet ids is good practice anyway ;) 55 // practice anyway ;)
56 // FIXME: We should figure out if we should change this or fix the spec. 56 // FIXME: We should figure out if we should change this or fix the spec.
57 Element* element = m_treeScope->getElementById(name); 57 Element* element = m_treeScope->getElementById(name);
58 return isHTMLStyleElement(element) ? toHTMLStyleElement(element) : nullptr; 58 return isHTMLStyleElement(element) ? toHTMLStyleElement(element) : nullptr;
59 } 59 }
60 60
61 CSSStyleSheet* StyleSheetList::anonymousNamedGetter(const AtomicString& name) { 61 CSSStyleSheet* StyleSheetList::anonymousNamedGetter(const AtomicString& name) {
62 if (document()) 62 if (document())
63 UseCounter::count(*document(), 63 UseCounter::count(*document(),
64 UseCounter::StyleSheetListAnonymousNamedGetter); 64 UseCounter::StyleSheetListAnonymousNamedGetter);
65 HTMLStyleElement* item = getNamedItem(name); 65 HTMLStyleElement* item = getNamedItem(name);
66 if (!item) 66 if (!item)
67 return nullptr; 67 return nullptr;
68 return item->sheet(); 68 return item->sheet();
69 } 69 }
70 70
71 DEFINE_TRACE(StyleSheetList) { 71 DEFINE_TRACE(StyleSheetList) {
72 visitor->trace(m_treeScope); 72 visitor->trace(m_treeScope);
73 } 73 }
74 74
75 } // namespace blink 75 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698