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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/html/HtmlKeywords.java

Issue 11673007: Improve our html editor; add syntax highlighting for script tags; hyperlink detection and navigatio… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 12 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
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/html/HtmlKeywords.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/html/HtmlKeywords.java (revision 16584)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/html/HtmlKeywords.java (working copy)
@@ -22,30 +22,35 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* A comprehensive list of html keywords and attributes. This class reads its content from the
* html.txt file.
*/
public class HtmlKeywords {
-
private static List<String> globalAttributes;
private static List<String> eventAttributes;
private static List<String> keywords;
private static Map<String, List<String>> attributeMap;
+ private static Set<String> SELF_CLOSING = new HashSet<String>(Arrays.asList(new String[] {
+ "area", "base", "basefont", "br", "col", "frame", "hr", "img", "input", "link", "meta",
+ "param", "!", "h1", "h2", "h3", "h4", "h5", "h6"}));
+
static {
init();
}
- public static List<String> getAttributes(String keyword) {
- if (attributeMap.containsKey(keyword)) {
+ public static List<String> getAttributes(String entityName) {
+ if (attributeMap.containsKey(entityName)) {
List<String> atts = new ArrayList<String>();
- atts.addAll(attributeMap.get(keyword));
+ atts.addAll(attributeMap.get(entityName));
atts.addAll(globalAttributes);
return atts;
@@ -62,6 +67,10 @@
return keywords;
}
+ public static boolean isSelfClosing(String entityName) {
+ return SELF_CLOSING.contains(entityName);
+ }
+
public static boolean isValidEventAttribute(String name) {
name = processEventAttribute(name);

Powered by Google App Engine
This is Rietveld 408576698