eFlag Tree::appendVertex(Sit S, Vertex *v) { sabassert(stackTop && isDaddy(stackTop)); sabassert(!isText(v) || !pendingTextNode); if (!isText(v)) flushPendingText(); E( cast(Daddy*,stackTop) -> newChild(S, v) ); //sets parent too if (isDaddy(v)) stackTop = v; v -> stamp = vcount++; // set the subtree information for vertex v -> setSubtreeInfo(subtrees.getCurrent()); return OK; };
void HTMLConstructionSite::insertTextNode(const String& string, WhitespaceMode whitespaceMode) { HTMLConstructionSiteTask dummyTask(HTMLConstructionSiteTask::Insert); dummyTask.parent = currentNode(); // FIXME: This probably doesn't need to be done both here and in insert(Task). if (isHTMLTemplateElement(*dummyTask.parent)) dummyTask.parent = toHTMLTemplateElement(dummyTask.parent.get())->content(); // Unclear when parent != case occurs. Somehow we insert text into two separate // nodes while processing the same Token. When it happens we have to flush the // pending text into the task queue before making more. if (!m_pendingText.isEmpty() && (m_pendingText.parent != dummyTask.parent)) flushPendingText(); m_pendingText.append(dummyTask.parent, string, whitespaceMode); }
eFlag Tree::parseFinished(Sit S) { flushPendingText(); return OK; }
void HTMLConstructionSite::queueTask(const HTMLConstructionSiteTask& task) { flushPendingText(); ASSERT(m_pendingText.isEmpty()); m_taskQueue.append(task); }