Chromium Code Reviews| 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 package org.chromium.distiller.webdocument; | 5 package org.chromium.distiller.webdocument; |
| 6 | 6 |
| 7 import com.google.gwt.dom.client.Element; | 7 import com.google.gwt.dom.client.Element; |
| 8 import org.chromium.distiller.DomUtil; | 8 import org.chromium.distiller.DomUtil; |
| 9 import org.chromium.distiller.TreeCloneBuilder; | 9 import org.chromium.distiller.TreeCloneBuilder; |
| 10 import org.chromium.distiller.labels.DefaultLabels; | 10 import org.chromium.distiller.labels.DefaultLabels; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 Node parentClone = getTextNodes().get(0).getParentElement().cloneNod e(false); | 62 Node parentClone = getTextNodes().get(0).getParentElement().cloneNod e(false); |
| 63 parentClone.appendChild(clonedRoot); | 63 parentClone.appendChild(clonedRoot); |
| 64 clonedRoot = parentClone; | 64 clonedRoot = parentClone; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Make sure links are absolute and IDs are gone. | 67 // Make sure links are absolute and IDs are gone. |
| 68 DomUtil.makeAllLinksAbsolute(clonedRoot); | 68 DomUtil.makeAllLinksAbsolute(clonedRoot); |
| 69 DomUtil.stripIds(clonedRoot); | 69 DomUtil.stripIds(clonedRoot); |
| 70 DomUtil.stripFontColorAttributes(clonedRoot); | 70 DomUtil.stripFontColorAttributes(clonedRoot); |
| 71 | 71 |
| 72 Element elementClonedRoot = Element.as(clonedRoot); | |
| 72 if (textOnly) { | 73 if (textOnly) { |
| 73 return Element.as(clonedRoot).getInnerText(); | 74 return elementClonedRoot.getInnerText(); |
| 75 } else if (elementClonedRoot.getTagName().equals("LI")) { | |
| 76 return elementClonedRoot.getInnerHTML(); | |
|
wychen
2015/08/01 01:00:20
I see why this is needed in this implementation, b
dalmirdasilva
2015/08/01 16:27:04
Is here the case where we can ask someone else whe
| |
| 74 } | 77 } |
| 75 return Element.as(clonedRoot).getString(); | 78 return elementClonedRoot.getString(); |
| 76 } | 79 } |
| 77 | 80 |
| 78 public List<Node> getTextNodes() { | 81 public List<Node> getTextNodes() { |
| 79 return allTextNodes.subList(start, end); | 82 return allTextNodes.subList(start, end); |
| 80 } | 83 } |
| 81 | 84 |
| 82 public void addLabel(String s) { | 85 public void addLabel(String s) { |
| 83 labels.add(s); | 86 labels.add(s); |
| 84 } | 87 } |
| 85 | 88 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 } | 129 } |
| 127 | 130 |
| 128 public void setGroupNumber(int group) { | 131 public void setGroupNumber(int group) { |
| 129 groupNumber = group; | 132 groupNumber = group; |
| 130 } | 133 } |
| 131 | 134 |
| 132 public int getGroupNumber() { | 135 public int getGroupNumber() { |
| 133 return groupNumber; | 136 return groupNumber; |
| 134 } | 137 } |
| 135 } | 138 } |
| OLD | NEW |