Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Unified Diff: test/com/dom_distiller/client/SimpleContentHandler.java

Issue 296113004: Start using computed style instead of default tag actions. (Closed) Base URL: https://code.google.com/p/dom-distiller/@master
Patch Set: Fixed nit. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/com/dom_distiller/client/DomToSaxVisitorTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/com/dom_distiller/client/SimpleContentHandler.java
diff --git a/test/com/dom_distiller/client/SimpleContentHandler.java b/test/com/dom_distiller/client/SimpleContentHandler.java
index c533d6e3739c0dea2e524e7c792863b92784bfdf..8bb36ba5aaa23af584b7d2ce201e5c62086fbef3 100644
--- a/test/com/dom_distiller/client/SimpleContentHandler.java
+++ b/test/com/dom_distiller/client/SimpleContentHandler.java
@@ -6,6 +6,9 @@ package com.dom_distiller.client;
import com.dom_distiller.client.sax.Attributes;
import com.dom_distiller.client.sax.ContentHandler;
+import com.google.gwt.core.client.JsArray;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Node;
/**
* This is a simple SAX content handler that converts sax events to an xml document. It only handles
@@ -13,6 +16,8 @@ import com.dom_distiller.client.sax.ContentHandler;
*/
class SimpleContentHandler implements ContentHandler {
+ private StringBuilder documentStringBuilder;
+
SimpleContentHandler() {
documentStringBuilder = new StringBuilder();
}
@@ -31,28 +36,28 @@ class SimpleContentHandler implements ContentHandler {
public void startDocument() {}
@Override
- public void startElement(String uri, String localName, String qName, Attributes atts) {
- documentStringBuilder.append("<" + localName);
- for (int i = 0; i < atts.getLength(); i++) {
+ public void startElement(Element element, Attributes atts) {
+ documentStringBuilder.append("<");
+ documentStringBuilder.append(element.getTagName());
+ JsArray<Node> attributes = DomUtil.getAttributes(element);
+ for (int i = 0; i < attributes.length(); i++) {
+ Node node = attributes.get(i);
documentStringBuilder.append(" ");
- documentStringBuilder.append(atts.getLocalName(i));
+ documentStringBuilder.append(node.getNodeName());
documentStringBuilder.append("=\"");
- documentStringBuilder.append(atts.getValue(i));
+ documentStringBuilder.append(node.getNodeValue());
documentStringBuilder.append("\"");
-
}
documentStringBuilder.append(">");
}
@Override
- public void endElement(String uri, String localName, String qName) {
- documentStringBuilder.append("</" + localName + ">");
+ public void endElement(Element element) {
+ documentStringBuilder.append("</" + element.getTagName() + ">");
}
@Override
public void characters(char[] ch, int start, int length) {
documentStringBuilder.append(ch, start, length);
}
-
- private StringBuilder documentStringBuilder;
}
« no previous file with comments | « test/com/dom_distiller/client/DomToSaxVisitorTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698