| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 bool isGoodForScoring(const WebDistillabilityFeatures& features, | 82 bool isGoodForScoring(const WebDistillabilityFeatures& features, |
| 83 const Element& element) { | 83 const Element& element) { |
| 84 DEFINE_STATIC_LOCAL(Vector<String>, unlikelyCandidates, ()); | 84 DEFINE_STATIC_LOCAL(Vector<String>, unlikelyCandidates, ()); |
| 85 if (unlikelyCandidates.isEmpty()) { | 85 if (unlikelyCandidates.isEmpty()) { |
| 86 auto words = { | 86 auto words = { |
| 87 "banner", "combx", "comment", "community", "disqus", "extra", | 87 "banner", "combx", "comment", "community", "disqus", "extra", |
| 88 "foot", "header", "menu", "related", "remark", "rss", | 88 "foot", "header", "menu", "related", "remark", "rss", |
| 89 "share", "shoutbox", "sidebar", "skyscraper", "sponsor", "ad-break", | 89 "share", "shoutbox", "sidebar", "skyscraper", "sponsor", "ad-break", |
| 90 "agegate", "pagination", "pager", "popup"}; | 90 "agegate", "pagination", "pager", "popup"}; |
| 91 for (auto word : words) { | 91 for (auto word : words) { |
| 92 unlikelyCandidates.append(word); | 92 unlikelyCandidates.push_back(word); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 DEFINE_STATIC_LOCAL(Vector<String>, highlyLikelyCandidates, ()); | 95 DEFINE_STATIC_LOCAL(Vector<String>, highlyLikelyCandidates, ()); |
| 96 if (highlyLikelyCandidates.isEmpty()) { | 96 if (highlyLikelyCandidates.isEmpty()) { |
| 97 auto words = {"and", "article", "body", "column", "main", "shadow"}; | 97 auto words = {"and", "article", "body", "column", "main", "shadow"}; |
| 98 for (auto word : words) { | 98 for (auto word : words) { |
| 99 highlyLikelyCandidates.append(word); | 99 highlyLikelyCandidates.push_back(word); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 if (!isVisible(element)) | 103 if (!isVisible(element)) |
| 104 return false; | 104 return false; |
| 105 if (features.mozScore >= kMozScoreSaturation && | 105 if (features.mozScore >= kMozScoreSaturation && |
| 106 features.mozScoreAllSqrt >= kMozScoreAllSqrtSaturation && | 106 features.mozScoreAllSqrt >= kMozScoreAllSqrtSaturation && |
| 107 features.mozScoreAllLinear >= kMozScoreAllLinearSaturation) | 107 features.mozScoreAllLinear >= kMozScoreAllLinearSaturation) |
| 108 return false; | 108 return false; |
| 109 if (matchAttributes(element, unlikelyCandidates) && | 109 if (matchAttributes(element, unlikelyCandidates) && |
| (...skipping 110 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 |