OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "DocumentStatisticsCollector.h" | 5 #include "DocumentStatisticsCollector.h" |
6 | 6 |
7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
8 #include "core/InputTypeNames.h" | 8 #include "core/InputTypeNames.h" |
9 #include "core/dom/ElementTraversal.h" | 9 #include "core/dom/ElementTraversal.h" |
10 #include "core/dom/NodeComputedStyle.h" | 10 #include "core/dom/NodeComputedStyle.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 } | 58 } |
59 return length; | 59 return length; |
60 } | 60 } |
61 | 61 |
62 bool isVisible(const Element& element) { | 62 bool isVisible(const Element& element) { |
63 const ComputedStyle* style = element.computedStyle(); | 63 const ComputedStyle* style = element.computedStyle(); |
64 if (!style) | 64 if (!style) |
65 return false; | 65 return false; |
66 return (style->display() != EDisplay::None && | 66 return (style->display() != EDisplay::None && |
67 style->visibility() != EVisibility::Hidden && style->opacity() != 0); | 67 style->visibility() != EVisibility::kHidden && style->opacity() != 0); |
68 } | 68 } |
69 | 69 |
70 bool matchAttributes(const Element& element, const Vector<String>& words) { | 70 bool matchAttributes(const Element& element, const Vector<String>& words) { |
71 const String& classes = element.getClassAttribute(); | 71 const String& classes = element.getClassAttribute(); |
72 const String& id = element.getIdAttribute(); | 72 const String& id = element.getIdAttribute(); |
73 for (const String& word : words) { | 73 for (const String& word : words) { |
74 if (classes.findIgnoringCase(word) != WTF::kNotFound || | 74 if (classes.findIgnoringCase(word) != WTF::kNotFound || |
75 id.findIgnoringCase(word) != WTF::kNotFound) { | 75 id.findIgnoringCase(word) != WTF::kNotFound) { |
76 return true; | 76 return true; |
77 } | 77 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 double elapsedTime = monotonicallyIncreasingTime() - startTime; | 220 double elapsedTime = monotonicallyIncreasingTime() - startTime; |
221 | 221 |
222 DEFINE_STATIC_LOCAL(CustomCountHistogram, distillabilityHistogram, | 222 DEFINE_STATIC_LOCAL(CustomCountHistogram, distillabilityHistogram, |
223 ("WebCore.DistillabilityUs", 1, 1000000, 50)); | 223 ("WebCore.DistillabilityUs", 1, 1000000, 50)); |
224 distillabilityHistogram.count(static_cast<int>(1e6 * elapsedTime)); | 224 distillabilityHistogram.count(static_cast<int>(1e6 * elapsedTime)); |
225 | 225 |
226 return features; | 226 return features; |
227 } | 227 } |
228 | 228 |
229 } // namespace blink | 229 } // namespace blink |
OLD | NEW |