mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Bug 1355779 - Skip interned nsHtml5ElementName lookup for Custom Elements (ones with hyphen).
Tag UXP Issue #1344
This commit is contained in:
parent
a3b5d98af7
commit
c7ff832ca7
2 changed files with 39 additions and 8 deletions
|
|
@ -223,6 +223,8 @@ public final class ElementName
|
||||||
public static final ElementName ISINDEX = new ElementName("isindex", "isindex", TreeBuilder.OTHER);
|
public static final ElementName ISINDEX = new ElementName("isindex", "isindex", TreeBuilder.OTHER);
|
||||||
// ]NOCPP]
|
// ]NOCPP]
|
||||||
|
|
||||||
|
public static final ElementName ANNOTATION_XML = new ElementName("annotation-xml", "annotation-xml", TreeBuilder.ANNOTATION_XML | SCOPING_AS_MATHML);
|
||||||
|
|
||||||
// START CODE ONLY USED FOR GENERATING CODE uncomment and run to regenerate
|
// START CODE ONLY USED FOR GENERATING CODE uncomment and run to regenerate
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
|
@ -261,6 +263,9 @@ public final class ElementName
|
||||||
// for (int i = 0; i < name.length(); i++) {
|
// for (int i = 0; i < name.length(); i++) {
|
||||||
// char c = name.charAt(i);
|
// char c = name.charAt(i);
|
||||||
// if (c == '-') {
|
// if (c == '-') {
|
||||||
|
// // if (!"annotation-xml".equals(name)) {
|
||||||
|
// // throw new RuntimeException("Non-annotation-xml element name with hyphen: " + name);
|
||||||
|
// // }
|
||||||
// buf[i] = '_';
|
// buf[i] = '_';
|
||||||
// } else if (c >= '0' && c <= '9') {
|
// } else if (c >= '0' && c <= '9') {
|
||||||
// buf[i] = c;
|
// buf[i] = c;
|
||||||
|
|
@ -702,7 +707,6 @@ public final class ElementName
|
||||||
public static final ElementName TBREAK = new ElementName("tbreak", "tbreak", TreeBuilder.OTHER);
|
public static final ElementName TBREAK = new ElementName("tbreak", "tbreak", TreeBuilder.OTHER);
|
||||||
public static final ElementName TRACK = new ElementName("track", "track", TreeBuilder.PARAM_OR_SOURCE_OR_TRACK | SPECIAL);
|
public static final ElementName TRACK = new ElementName("track", "track", TreeBuilder.PARAM_OR_SOURCE_OR_TRACK | SPECIAL);
|
||||||
public static final ElementName DL = new ElementName("dl", "dl", TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
|
public static final ElementName DL = new ElementName("dl", "dl", TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
|
||||||
public static final ElementName ANNOTATION_XML = new ElementName("annotation-xml", "annotation-xml", TreeBuilder.ANNOTATION_XML | SCOPING_AS_MATHML);
|
|
||||||
public static final ElementName CSYMBOL = new ElementName("csymbol", "csymbol", TreeBuilder.OTHER);
|
public static final ElementName CSYMBOL = new ElementName("csymbol", "csymbol", TreeBuilder.OTHER);
|
||||||
public static final ElementName CURL = new ElementName("curl", "curl", TreeBuilder.OTHER);
|
public static final ElementName CURL = new ElementName("curl", "curl", TreeBuilder.OTHER);
|
||||||
public static final ElementName FACTORIAL = new ElementName("factorial", "factorial", TreeBuilder.OTHER);
|
public static final ElementName FACTORIAL = new ElementName("factorial", "factorial", TreeBuilder.OTHER);
|
||||||
|
|
@ -1076,7 +1080,6 @@ public final class ElementName
|
||||||
FONT_FACE_URI,
|
FONT_FACE_URI,
|
||||||
PI,
|
PI,
|
||||||
MASK,
|
MASK,
|
||||||
ANNOTATION_XML,
|
|
||||||
FORALL,
|
FORALL,
|
||||||
LABEL,
|
LABEL,
|
||||||
SYMBOL,
|
SYMBOL,
|
||||||
|
|
|
||||||
|
|
@ -416,6 +416,12 @@ public class Tokenizer implements Locator {
|
||||||
*/
|
*/
|
||||||
protected boolean endTag;
|
protected boolean endTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <code>true</code> iff the current element/attribute name contains
|
||||||
|
* a hyphen.
|
||||||
|
*/
|
||||||
|
private boolean containsHyphen;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current tag token name. One of
|
* The current tag token name. One of
|
||||||
* 1) null,
|
* 1) null,
|
||||||
|
|
@ -529,6 +535,7 @@ public class Tokenizer implements Locator {
|
||||||
this.charRefBuf = new char[32];
|
this.charRefBuf = new char[32];
|
||||||
this.bmpChar = new char[1];
|
this.bmpChar = new char[1];
|
||||||
this.astralChar = new char[2];
|
this.astralChar = new char[2];
|
||||||
|
this.containsHyphen = false;
|
||||||
this.tagName = null;
|
this.tagName = null;
|
||||||
this.nonInternedTagName = new ElementName();
|
this.nonInternedTagName = new ElementName();
|
||||||
this.attributeName = null;
|
this.attributeName = null;
|
||||||
|
|
@ -560,6 +567,7 @@ public class Tokenizer implements Locator {
|
||||||
this.charRefBuf = new char[32];
|
this.charRefBuf = new char[32];
|
||||||
this.bmpChar = new char[1];
|
this.bmpChar = new char[1];
|
||||||
this.astralChar = new char[2];
|
this.astralChar = new char[2];
|
||||||
|
this.containsHyphen = false;
|
||||||
this.tagName = null;
|
this.tagName = null;
|
||||||
this.nonInternedTagName = new ElementName();
|
this.nonInternedTagName = new ElementName();
|
||||||
this.attributeName = null;
|
this.attributeName = null;
|
||||||
|
|
@ -1125,6 +1133,17 @@ public class Tokenizer implements Locator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void strBufToElementNameString() {
|
private void strBufToElementNameString() {
|
||||||
|
if (containsHyphen) {
|
||||||
|
// We've got a custom element or annotation-xml.
|
||||||
|
@Local String annotationName = ElementName.ANNOTATION_XML.getName();
|
||||||
|
if (Portability.localEqualsBuffer(annotationName, strBuf, 0, strBufLen)) {
|
||||||
|
tagName = ElementName.ANNOTATION_XML;
|
||||||
|
} else {
|
||||||
|
nonInternedTagName.setNameForNonInterned(Portability.newLocalNameFromBuffer(strBuf, 0, strBufLen,
|
||||||
|
interner));
|
||||||
|
tagName = nonInternedTagName;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
tagName = ElementName.elementNameByBuffer(strBuf, 0, strBufLen,
|
tagName = ElementName.elementNameByBuffer(strBuf, 0, strBufLen,
|
||||||
interner);
|
interner);
|
||||||
if (tagName == null) {
|
if (tagName == null) {
|
||||||
|
|
@ -1132,6 +1151,8 @@ public class Tokenizer implements Locator {
|
||||||
interner));
|
interner));
|
||||||
tagName = nonInternedTagName;
|
tagName = nonInternedTagName;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
containsHyphen = false;
|
||||||
clearStrBufAfterUse();
|
clearStrBufAfterUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1585,6 +1606,7 @@ public class Tokenizer implements Locator {
|
||||||
*/
|
*/
|
||||||
clearStrBufBeforeUse();
|
clearStrBufBeforeUse();
|
||||||
appendStrBuf((char) (c + 0x20));
|
appendStrBuf((char) (c + 0x20));
|
||||||
|
containsHyphen = false;
|
||||||
/* then switch to the tag name state. */
|
/* then switch to the tag name state. */
|
||||||
state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
|
state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
|
||||||
/*
|
/*
|
||||||
|
|
@ -1605,6 +1627,7 @@ public class Tokenizer implements Locator {
|
||||||
*/
|
*/
|
||||||
clearStrBufBeforeUse();
|
clearStrBufBeforeUse();
|
||||||
appendStrBuf(c);
|
appendStrBuf(c);
|
||||||
|
containsHyphen = false;
|
||||||
/* then switch to the tag name state. */
|
/* then switch to the tag name state. */
|
||||||
state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
|
state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
|
||||||
/*
|
/*
|
||||||
|
|
@ -1748,6 +1771,8 @@ public class Tokenizer implements Locator {
|
||||||
* tag name.
|
* tag name.
|
||||||
*/
|
*/
|
||||||
c += 0x20;
|
c += 0x20;
|
||||||
|
} else if (c == '-') {
|
||||||
|
containsHyphen = true;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Anything else Append the current input
|
* Anything else Append the current input
|
||||||
|
|
@ -1755,6 +1780,7 @@ public class Tokenizer implements Locator {
|
||||||
* name.
|
* name.
|
||||||
*/
|
*/
|
||||||
appendStrBuf(c);
|
appendStrBuf(c);
|
||||||
|
containsHyphen = false;
|
||||||
/*
|
/*
|
||||||
* Stay in the tag name state.
|
* Stay in the tag name state.
|
||||||
*/
|
*/
|
||||||
|
|
@ -6752,6 +6778,7 @@ public class Tokenizer implements Locator {
|
||||||
endTag = false;
|
endTag = false;
|
||||||
shouldSuspend = false;
|
shouldSuspend = false;
|
||||||
initDoctypeFields();
|
initDoctypeFields();
|
||||||
|
containsHyphen = false;
|
||||||
tagName = null;
|
tagName = null;
|
||||||
attributeName = null;
|
attributeName = null;
|
||||||
if (newAttributesEachTime) {
|
if (newAttributesEachTime) {
|
||||||
|
|
@ -6813,6 +6840,7 @@ public class Tokenizer implements Locator {
|
||||||
publicIdentifier = Portability.newStringFromString(other.publicIdentifier);
|
publicIdentifier = Portability.newStringFromString(other.publicIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
containsHyphen = other.containsHyphen;
|
||||||
if (other.tagName == null) {
|
if (other.tagName == null) {
|
||||||
tagName = null;
|
tagName = null;
|
||||||
} else if (other.tagName.isInterned()) {
|
} else if (other.tagName.isInterned()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue