Chromium Code Reviews| 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.LogUtil; | 9 import org.chromium.distiller.LogUtil; |
| 10 import org.chromium.distiller.TableClassifier; | 10 import org.chromium.distiller.TableClassifier; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 boolean visible = DomUtil.isVisible(e); | 80 boolean visible = DomUtil.isVisible(e); |
| 81 logVisibilityInfo(e, visible); | 81 logVisibilityInfo(e, visible); |
| 82 if (!visible) { | 82 if (!visible) { |
| 83 hiddenElements.add(e); | 83 hiddenElements.add(e); |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Node-type specific extractors check for elements they are interested in here. Everything | 87 // Node-type specific extractors check for elements they are interested in here. Everything |
| 88 // else will be filtered through the switch below. | 88 // else will be filtered through the switch below. |
| 89 | 89 |
| 90 // Check for embedded elements that might be extracted. | 90 try { |
| 91 if (embedTagNames.contains(e.getTagName())) { | 91 // Check for embedded elements that might be extracted. |
| 92 // If the tag is marked as interesting, check the extractors. | 92 if (embedTagNames.contains(e.getTagName())) { |
| 93 for (EmbedExtractor extractor : extractors) { | 93 // If the tag is marked as interesting, check the extractors. |
| 94 WebElement embed = extractor.extract(e); | 94 for (EmbedExtractor extractor : extractors) { |
| 95 if (embed != null) { | 95 WebElement embed = extractor.extract(e); |
| 96 builder.embed(embed); | 96 if (embed != null) { |
| 97 return false; | 97 builder.embed(embed); |
| 98 return false; | |
| 99 } | |
| 98 } | 100 } |
| 99 } | 101 } |
| 102 } catch (Exception exception) { | |
| 103 LogUtil.logToConsole("Exception happened in EmbedExtractors: " + exc eption.getMessage()); | |
|
mdjones
2016/08/29 20:52:51
100+ chars?
| |
| 100 } | 104 } |
| 101 | 105 |
| 102 // Skip IFRAMEs not recognized by EmbedExtractors. | 106 // Skip IFRAMEs not recognized by EmbedExtractors. |
| 103 if (e.getTagName().equals("IFRAME")) { | 107 if (e.getTagName().equals("IFRAME")) { |
| 104 return false; | 108 return false; |
| 105 } | 109 } |
| 106 | 110 |
| 107 // Create a placeholder for the elements we want to preserve. | 111 // Create a placeholder for the elements we want to preserve. |
| 108 if (WebTag.canBeNested(e.getTagName())) { | 112 if (WebTag.canBeNested(e.getTagName())) { |
| 109 builder.tag(new WebTag(e.getTagName(), WebTag.TagType.START)); | 113 builder.tag(new WebTag(e.getTagName(), WebTag.TagType.START)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 Element parent = e.getParentElement(); | 180 Element parent = e.getParentElement(); |
| 177 LogUtil.logToConsole("TABLE: " + type + | 181 LogUtil.logToConsole("TABLE: " + type + |
| 178 ", id=" + e.getId() + | 182 ", id=" + e.getId() + |
| 179 ", class=" + e.getClassName() + | 183 ", class=" + e.getClassName() + |
| 180 ", parent=[" + parent.getTagName() + | 184 ", parent=[" + parent.getTagName() + |
| 181 ", id=" + parent.getId() + | 185 ", id=" + parent.getId() + |
| 182 ", class=" + parent.getClassName() + | 186 ", class=" + parent.getClassName() + |
| 183 "]"); | 187 "]"); |
| 184 } | 188 } |
| 185 } | 189 } |
| OLD | NEW |