TEST_F(HTMLTextFormControlElementTest, WordAndSentenceBoundary) { HTMLElement* innerText = textControl().innerEditorElement(); { SCOPED_TRACE("String is value."); innerText->removeChildren(); innerText->setNodeValue("Hel\nlo, text form.\n"); testBoundary(document(), textControl()); } { SCOPED_TRACE("A Text node and a BR element"); innerText->removeChildren(); innerText->setNodeValue(""); innerText->appendChild(Text::create(document(), "Hello, text form.")); innerText->appendChild(HTMLBRElement::create(document())); testBoundary(document(), textControl()); } { SCOPED_TRACE("Text nodes."); innerText->removeChildren(); innerText->setNodeValue(""); innerText->appendChild(Text::create(document(), "Hel\nlo, te")); innerText->appendChild(Text::create(document(), "xt form.")); testBoundary(document(), textControl()); } }
void HTMLTextFormControlElement::addPlaceholderBreakElementIfNecessary() { HTMLElement* innerEditor = innerEditorElement(); if (innerEditor->layoutObject() && !innerEditor->layoutObject()->style()->preserveNewline()) return; Node* lastChild = innerEditor->lastChild(); if (!lastChild || !lastChild->isTextNode()) return; if (toText(lastChild)->data().endsWith('\n') || toText(lastChild)->data().endsWith('\r')) innerEditor->appendChild(createPlaceholderBreakElement()); }
//=================================================================== // ReportItemFrame //=================================================================== ReportItem::PrintResult ReportItemFrame::printHtml(HTMLElement & out) { qfLogFuncFrame(); PrintResult res = PrintOk; if(out.isNull()) return res; qfDebug() << "\tparent html element:" << out.tagName(); //qfDebug() << "\tlayout:" << (isGridLayout()? "grid": (layout() == qf::qmlwidgets::graphics::LayoutHorizontal)? "horizontal": (layout() == qf::qmlwidgets::graphics::LayoutVertical)? "vertical" : "nevim"); //qfDebug() << "\tmetaPaintLayoutLength:" << metaPaintLayoutLength << "metaPaintOrthogonalLayoutLength:" << metaPaintOrthogonalLayoutLength; //--updateChildren(); if(children().count() > 0) { if(children().count() == 1) { /// jedno dite vyres tak, ze se vubec nevytiskne rodicovsky frame ReportItem *it = itemAt(0); res = it->printHtml(out); } else { QDomElement el_div = out.ownerDocument().createElement("div");; if(layout() == LayoutHorizontal) { el_div.setAttribute("layout", "horizontal"); } for(int i=0; i<children().count(); i++) { ReportItem *it = itemAt(i); PrintResult ch_res; //int cnt = 0; do { //if(cnt) qfInfo() << "\t opakovacka:" << cnt; ch_res = it->printHtml(el_div); //if(cnt) qfInfo() << "\t again2:" << (ch_res .flags & FlagPrintAgain); //cnt++; } while(ch_res.flags & FlagPrintAgain); res = ch_res; } out.appendChild(el_div); } /*-- QDomElement el = out.lastChild().toElement(); if(!el.isNull()) { ReportItemTable *tbl_it = dynamic_cast<ReportItemTable*>(this); if(tbl_it) { el.setAttribute("__table", "__fakeBandTable"); } else { static QStringList sl = QStringList() << "__fakeBandDetail" << "__fakeBandHeaderRow" << "__fakeBandFooterRow"; foreach(QString s, sl) { if(element.attribute(s).toInt() > 0) el.setAttribute("__table", s); } } } --*/ } return res; }
void RangeInputType::createShadowSubtree() { DCHECK(element().shadow()); Document& document = element().document(); HTMLDivElement* track = HTMLDivElement::create(document); track->setShadowPseudoId(AtomicString("-webkit-slider-runnable-track")); track->setAttribute(idAttr, ShadowElementNames::sliderTrack()); track->appendChild(SliderThumbElement::create(document)); HTMLElement* container = SliderContainerElement::create(document); container->appendChild(track); element().userAgentShadowRoot()->appendChild(container); container->setAttribute(styleAttr, "-webkit-appearance:inherit"); }
static void swapInNodePreservingAttributesAndChildren(HTMLElement& newNode, HTMLElement& nodeToReplace) { ASSERT(nodeToReplace.inDocument()); RefPtr<ContainerNode> parentNode = nodeToReplace.parentNode(); // FIXME: Fix this to send the proper MutationRecords when MutationObservers are present. newNode.cloneDataFromElement(nodeToReplace); NodeVector children; getChildNodes(nodeToReplace, children); for (auto& child : children) newNode.appendChild(WTF::move(child), ASSERT_NO_EXCEPTION); parentNode->insertBefore(newNode, &nodeToReplace, ASSERT_NO_EXCEPTION); parentNode->removeChild(nodeToReplace, ASSERT_NO_EXCEPTION); }
//=================================================================== // ReportItemPara //=================================================================== ReportItem::PrintResult ReportItemPara::printHtml(HTMLElement & out) { qfLogFuncFrame();// << element.tagName() << "id:" << element.attribute("id"); PrintResult res = PrintOk; if(out.isNull()) return res; QDomElement el_div = out.ownerDocument().createElement("div"); QDomElement el_p = out.ownerDocument().createElement("p"); QString text = paraText(); QRegExp rx = ReportItemMetaPaint::checkReportSubstitutionRegExp; if(rx.exactMatch(text)) { bool check_on = rx.capturedTexts().value(1) == "1"; text = (check_on)? "X": QString(); } setElementText(el_p, text); out.appendChild(el_div); el_div.appendChild(el_p); return res; }