patches for style decoding

This commit is contained in:
Connor Tumbleson 2017-05-23 09:27:27 -04:00
parent 390ecae6c5
commit d979247794
No known key found for this signature in database
GPG Key ID: C3CC0A201EC7DA75

View File

@ -138,8 +138,8 @@ public class StringBlock {
}
StringBuilder html = new StringBuilder(raw.length() + 32);
int[] opened = new int[style.length / 3];
boolean[] unclosed = new boolean[style.length / 3];
int offset = 0, depth = 0;
boolean closeTagOnEnd = false;
while (true) {
int i = -1, j;
for (j = 0; j != style.length; j += 3) {
@ -156,7 +156,7 @@ public class StringBlock {
int end = style[last + 2];
if (end >= start) {
if (style[last + 1] == -1 && end != -1) {
closeTagOnEnd = true;
unclosed[j] = true;
}
break;
}
@ -169,8 +169,8 @@ public class StringBlock {
depth = j + 1;
if (offset < start) {
html.append(ResXmlEncoders.escapeXmlChars(raw.substring(offset, start)));
if (closeTagOnEnd) {
if (j > 0) {
if (j >= 0 && unclosed.length >= j && unclosed[j]) {
if (unclosed.length > (j + 1) && unclosed[j + 1] || unclosed.length == 1) {
outputStyleTag(getString(style[opened[j]]), html, true);
}
}