| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (clonedRoot.getNodeType() != Node.ELEMENT_NODE) { | 61 if (clonedRoot.getNodeType() != Node.ELEMENT_NODE) { |
| 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 DomUtil.stripStyleAttributes(clonedRoot); |
| 71 | 72 |
| 72 // Since there are tag elements that are being wrapped | 73 // Since there are tag elements that are being wrapped |
| 73 // by a pair of {@link WebTag}s, we only need to | 74 // by a pair of {@link WebTag}s, we only need to |
| 74 // get the innerHTML, otherwise these tags would be duplicated. | 75 // get the innerHTML, otherwise these tags would be duplicated. |
| 75 Element elementClonedRoot = Element.as(clonedRoot); | 76 Element elementClonedRoot = Element.as(clonedRoot); |
| 76 if (textOnly) { | 77 if (textOnly) { |
| 77 return elementClonedRoot.getInnerText(); | 78 return elementClonedRoot.getInnerText(); |
| 78 } else if (WebTag.canBeNested(elementClonedRoot.getTagName())) { | 79 } else if (WebTag.canBeNested(elementClonedRoot.getTagName())) { |
| 79 return elementClonedRoot.getInnerHTML(); | 80 return elementClonedRoot.getInnerHTML(); |
| 80 } | 81 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 133 } |
| 133 | 134 |
| 134 public void setGroupNumber(int group) { | 135 public void setGroupNumber(int group) { |
| 135 groupNumber = group; | 136 groupNumber = group; |
| 136 } | 137 } |
| 137 | 138 |
| 138 public int getGroupNumber() { | 139 public int getGroupNumber() { |
| 139 return groupNumber; | 140 return groupNumber; |
| 140 } | 141 } |
| 141 } | 142 } |
| OLD | NEW |