@SuppressWarnings("unchecked") private StackNode<T> getUnusedStackNode() { // Search for an unused stack node. while (stackNodesIdx < numStackNodes) { if (stackNodes[stackNodesIdx].isUnused()) { return stackNodes[stackNodesIdx++]; } stackNodesIdx++; } if (stackNodesIdx < stackNodes.length) { // No unused stack nodes, but there is still space in the storage array. stackNodes[stackNodesIdx] = new StackNode<T>(stackNodesIdx); numStackNodes++; return stackNodes[stackNodesIdx++]; } // Could not find an unused stack node and storage array is full. StackNode<T>[] newStack = new StackNode[stackNodes.length + 64]; System.arraycopy(stackNodes, 0, newStack, 0, stackNodes.length); stackNodes = newStack; // Create a new stack node and return it. stackNodes[stackNodesIdx] = new StackNode<T>(stackNodesIdx); numStackNodes++; return stackNodes[stackNodesIdx++]; }
@SuppressWarnings("unchecked") private StackNode<T> getUnusedStackNode() { // Search for an unused stack node. while (stackNodesIdx < numStackNodes) { if (stackNodes[stackNodesIdx].isUnused()) { return stackNodes[stackNodesIdx++]; } stackNodesIdx++; } if (stackNodesIdx < stackNodes.length) { // No unused stack nodes, but there is still space in the storage array. stackNodes[stackNodesIdx] = new StackNode<T>(stackNodesIdx); numStackNodes++; return stackNodes[stackNodesIdx++]; } // Could not find an unused stack node and storage array is full. StackNode<T>[] newStack = new StackNode[stackNodes.length + 64]; System.arraycopy(stackNodes, 0, newStack, 0, stackNodes.length); stackNodes = newStack; // Create a new stack node and return it. stackNodes[stackNodesIdx] = new StackNode<T>(stackNodesIdx); numStackNodes++; return stackNodes[stackNodesIdx++]; }
private void pushHeadPointerOntoStack() throws SAXException { assert headPointer != null; assert !fragment; assert mode == AFTER_HEAD; fatal(); silentPush(new StackNode<T>(ElementName.HEAD, headPointer // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] )); }
private void appendHtmlElementToDocumentAndPush(HtmlAttributes attributes) throws SAXException { // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); // ]NOCPP] T elt = createHtmlElementSetAsRoot(attributes); StackNode<T> node = new StackNode<T>(ElementName.HTML, elt // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); }
private void appendToCurrentNodeAndPushElement(ElementName elementName, HtmlAttributes attributes) throws SAXException { // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); // ]NOCPP] // This method can't be called for custom elements T elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes); appendElement(elt, stack[currentPtr].node); StackNode<T> node = new StackNode<T>(elementName, elt // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); }
StackNode<T> node = listOfActiveFormattingElements[i]; if (node != null) { StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns, node.name, node.node, node.popName, node.attributes.cloneAttributes(null) int listIndex = findInListOfActiveFormattingElements(node); if (listIndex == -1) { StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns, node.name, node.node, node.popName, null
private void appendToCurrentNodeAndPushHeadElement(HtmlAttributes attributes) throws SAXException { // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); // ]NOCPP] T elt = createElement("http://www.w3.org/1999/xhtml", "head", attributes); appendElement(elt, stack[currentPtr].node); headPointer = elt; StackNode<T> node = new StackNode<T>(ElementName.HEAD, elt // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); }
StackNode<T> node = listOfActiveFormattingElements[i]; if (node != null) { StackNode<T> newNode = new StackNode<T>(-1); newNode.setValues(node.getFlags(), node.ns, node.name, node.node, node.popName, int listIndex = findInListOfActiveFormattingElements(node); if (listIndex == -1) { StackNode<T> newNode = new StackNode<T>(-1); newNode.setValues(node.getFlags(), node.ns, node.name, node.node, node.popName,
StackNode<T> node = listOfActiveFormattingElements[i]; if (node != null) { StackNode<T> newNode = new StackNode<T>(-1); newNode.setValues(node.getFlags(), node.ns, node.name, node.node, node.popName, int listIndex = findInListOfActiveFormattingElements(node); if (listIndex == -1) { StackNode<T> newNode = new StackNode<T>(-1); newNode.setValues(node.getFlags(), node.ns, node.name, node.node, node.popName,
private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes, T form) throws SAXException { // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); // ]NOCPP] // Can't be called for custom elements T elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes, fragment ? null : form); StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); insertIntoFosterParent(elt); } else { appendElement(elt, current.node); } StackNode<T> node = new StackNode<T>(elementName, elt // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); }
private void appendToCurrentNodeAndPushFormElementMayFoster( HtmlAttributes attributes) throws SAXException { // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); // ]NOCPP] T elt = createElement("http://www.w3.org/1999/xhtml", "form", attributes); formPointer = elt; StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); insertIntoFosterParent(elt); } else { appendElement(elt, current.node); } StackNode<T> node = new StackNode<T>(ElementName.FORM, elt // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); }
private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes) throws SAXException { @Local String popName = elementName.name; // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); if (elementName.isCustom()) { popName = checkPopName(popName); } // ]NOCPP] T elt = createElement("http://www.w3.org/1999/xhtml", popName, attributes); StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); insertIntoFosterParent(elt); } else { appendElement(elt, current.node); } StackNode<T> node = new StackNode<T>(elementName, elt, popName // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); }
elt = createHtmlElementSetAsRoot(tokenizer.emptyAttributes()); StackNode<T> node = new StackNode<T>(ElementName.HTML, elt
private void appendToCurrentNodeAndPushElementMayFosterSVG( ElementName elementName, HtmlAttributes attributes) throws SAXException { @Local String popName = elementName.camelCaseName; // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/2000/svg"); if (elementName.isCustom()) { popName = checkPopName(popName); } // ]NOCPP] T elt = createElement("http://www.w3.org/2000/svg", popName, attributes); StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); insertIntoFosterParent(elt); } else { appendElement(elt, current.node); } StackNode<T> node = new StackNode<T>(elementName, popName, elt // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); }
private void appendToCurrentNodeAndPushFormattingElementMayFoster( ElementName elementName, HtmlAttributes attributes) throws SAXException { // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); // ]NOCPP] // This method can't be called for custom elements T elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes); StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); insertIntoFosterParent(elt); } else { appendElement(elt, current.node); } StackNode<T> node = new StackNode<T>(elementName, elt, attributes.cloneAttributes(null) // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); append(node); node.retain(); // append doesn't retain itself }
markAsHtmlIntegrationPoint = true; StackNode<T> node = new StackNode<T>(elementName, elt, popName, markAsHtmlIntegrationPoint
T clone = createElement("http://www.w3.org/1999/xhtml", entry.name, entry.attributes.cloneAttributes(null)); StackNode<T> entryClone = new StackNode<T>(entry.getFlags(), entry.ns, entry.name, clone, entry.popName, entry.attributes
StackNode<T> node = listCopy[i]; if (node != null) { StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns, Portability.newLocalFromLocal(node.name, interner), node.node, Portability.newLocalFromLocal(node.popName, interner), int listIndex = findInArray(node, listCopy); if (listIndex == -1) { StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns, Portability.newLocalFromLocal(node.name, interner), node.node, Portability.newLocalFromLocal(node.popName, interner),
T clone = createElement("http://www.w3.org/1999/xhtml", node.name, node.attributes.cloneAttributes(null)); StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns, node.name, clone, node.popName, node.attributes formattingElt.name, formattingElt.attributes.cloneAttributes(null)); StackNode<T> formattingClone = new StackNode<T>( formattingElt.getFlags(), formattingElt.ns, formattingElt.name, clone, formattingElt.popName,