OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.distiller.webdocument; | 5 package org.chromium.distiller.webdocument; |
6 | 6 |
7 import org.chromium.distiller.DomUtil; | 7 import org.chromium.distiller.DomUtil; |
8 import org.chromium.distiller.DomWalker; | 8 import org.chromium.distiller.DomWalker; |
9 import org.chromium.distiller.JavaScript; | 9 import org.chromium.distiller.JavaScript; |
10 import org.chromium.distiller.LogUtil; | 10 import org.chromium.distiller.LogUtil; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return false; | 89 return false; |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 private boolean visitElement(Element e) { | 93 private boolean visitElement(Element e) { |
94 // Skip invisible or uninteresting elements. | 94 // Skip invisible or uninteresting elements. |
95 boolean visible = DomUtil.isVisible(e); | 95 boolean visible = DomUtil.isVisible(e); |
96 boolean keepAnyway = false; | 96 boolean keepAnyway = false; |
97 boolean hasHiddenClassName = false; | 97 boolean hasHiddenClassName = false; |
98 if (!visible) { | 98 if (!visible) { |
| 99 // Process more hidden elements in a marked article in mobile-friend
ly pages |
| 100 // because some sites hide the lower part of the article. |
99 if (isMobileFriendly && hasArticleElement) { | 101 if (isMobileFriendly && hasArticleElement) { |
100 if (!isHiddenClass) { | 102 if (!isHiddenClass) { |
101 hasHiddenClassName = DomUtil.hasClassName(e, "hidden"); | 103 hasHiddenClassName = DomUtil.hasClassName(e, "hidden"); |
102 } | 104 } |
103 if (isHiddenClass || hasHiddenClassName) { | 105 if (isHiddenClass || hasHiddenClassName) { |
104 // Process more hidden elements in a marked article in mobil
e-friendly pages | |
105 // because some sites hide the lower part of the article. | |
106 // See crbug.com/599121 | 106 // See crbug.com/599121 |
107 keepAnyway = true; | 107 keepAnyway = true; |
108 } | 108 } |
109 } | 109 } |
| 110 if (isMobileFriendly) { |
| 111 if (e.getAttribute("class").contains("continue")) { |
| 112 // See crbug.com/687071 |
| 113 keepAnyway = true; |
| 114 } |
| 115 } |
110 } | 116 } |
111 logVisibilityInfo(e, visible || keepAnyway); | 117 logVisibilityInfo(e, visible || keepAnyway); |
112 if (!visible && !keepAnyway) { | 118 if (!visible && !keepAnyway) { |
113 hiddenElements.add(e); | 119 hiddenElements.add(e); |
114 return false; | 120 return false; |
115 } | 121 } |
116 | 122 |
117 // Node-type specific extractors check for elements they are interested
in here. Everything | 123 // Node-type specific extractors check for elements they are interested
in here. Everything |
118 // else will be filtered through the switch below. | 124 // else will be filtered through the switch below. |
119 | 125 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 Element parent = e.getParentElement(); | 217 Element parent = e.getParentElement(); |
212 LogUtil.logToConsole("TABLE: " + type + | 218 LogUtil.logToConsole("TABLE: " + type + |
213 ", id=" + e.getId() + | 219 ", id=" + e.getId() + |
214 ", class=" + e.getAttribute("class") + | 220 ", class=" + e.getAttribute("class") + |
215 ", parent=[" + parent.getTagName() + | 221 ", parent=[" + parent.getTagName() + |
216 ", id=" + parent.getId() + | 222 ", id=" + parent.getId() + |
217 ", class=" + parent.getAttribute("class") + | 223 ", class=" + parent.getAttribute("class") + |
218 "]"); | 224 "]"); |
219 } | 225 } |
220 } | 226 } |
OLD | NEW |