本文整理汇总了C++中ContainerNode::appendChild方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerNode::appendChild方法的具体用法?C++ ContainerNode::appendChild怎么用?C++ ContainerNode::appendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerNode
的用法示例。
在下文中一共展示了ContainerNode::appendChild方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createShadowSubtree
void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree()
{
ASSERT(element()->shadow());
Document* document = element()->document();
ContainerNode* container = element()->userAgentShadowRoot();
RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(document, *this));
m_dateTimeEditElement = dateTimeEditElement.get();
container->appendChild(m_dateTimeEditElement);
updateInnerTextValue();
RefPtr<SpinButtonElement> spinButton = SpinButtonElement::create(document, *this);
m_spinButtonElement = spinButton.get();
container->appendChild(spinButton);
bool shouldAddPickerIndicator = false;
#if ENABLE(DATALIST_ELEMENT)
if (InputType::themeSupportsDataListUI(this))
shouldAddPickerIndicator = true;
#endif
RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme();
if (theme->supportsCalendarPicker(formControlType())) {
shouldAddPickerIndicator = true;
m_pickerIndicatorIsAlwaysVisible = true;
}
if (shouldAddPickerIndicator) {
RefPtr<PickerIndicatorElement> pickerElement = PickerIndicatorElement::create(document, *this);
m_pickerIndicatorElement = pickerElement.get();
container->appendChild(m_pickerIndicatorElement);
m_pickerIndicatorIsVisible = true;
updatePickerIndicatorVisibility();
}
}
示例2: loadIntoContainer
void PluginPlaceholderImpl::loadIntoContainer(ContainerNode& container)
{
m_placeholderElement->remove(ASSERT_NO_EXCEPTION);
update();
container.removeChildren();
container.appendChild(m_placeholderElement);
}
示例3: cloneTarget
void SVGUseElement::cloneTarget(ContainerNode& container, SVGElement& target) const
{
Ref<SVGElement> targetClone = static_pointer_cast<SVGElement>(target.cloneElementWithChildren(document())).releaseNonNull();
associateClonesWithOriginals(targetClone.get(), target);
removeDisallowedElementsFromSubtree(targetClone.get());
transferSizeAttributesToTargetClone(targetClone.get());
container.appendChild(WTF::move(targetClone));
}
示例4: fillContainerFromString
static void fillContainerFromString(ContainerNode& paragraph, const String& string)
{
Document& document = paragraph.document();
if (string.isEmpty()) {
paragraph.appendChild(createBlockPlaceholderElement(document), ASSERT_NO_EXCEPTION);
return;
}
ASSERT(string.find('\n') == notFound);
Vector<String> tabList;
string.split('\t', true, tabList);
String tabText = emptyString();
bool first = true;
size_t numEntries = tabList.size();
for (size_t i = 0; i < numEntries; ++i) {
const String& s = tabList[i];
// append the non-tab textual part
if (!s.isEmpty()) {
if (!tabText.isEmpty()) {
paragraph.appendChild(createTabSpanElement(document, tabText), ASSERT_NO_EXCEPTION);
tabText = emptyString();
}
Ref<Node> textNode = document.createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries));
paragraph.appendChild(WTF::move(textNode), ASSERT_NO_EXCEPTION);
}
// there is a tab after every entry, except the last entry
// (if the last character is a tab, the list gets an extra empty entry)
if (i + 1 != numEntries)
tabText.append('\t');
else if (!tabText.isEmpty())
paragraph.appendChild(createTabSpanElement(document, tabText), ASSERT_NO_EXCEPTION);
first = false;
}
}
示例5: createShadowSubtree
void MultipleFieldsTemporalInputTypeView::createShadowSubtree() {
DCHECK(element().shadow());
// Element must not have a layoutObject here, because if it did
// DateTimeEditElement::customStyleForLayoutObject() is called in
// appendChild() before the field wrapper element is created.
// FIXME: This code should not depend on such craziness.
DCHECK(!element().layoutObject());
Document& document = element().document();
ContainerNode* container = element().userAgentShadowRoot();
container->appendChild(DateTimeEditElement::create(document, *this));
element().updateView();
container->appendChild(ClearButtonElement::create(document, *this));
container->appendChild(SpinButtonElement::create(document, *this));
if (LayoutTheme::theme().supportsCalendarPicker(
m_inputType->formControlType()))
m_pickerIndicatorIsAlwaysVisible = true;
container->appendChild(PickerIndicatorElement::create(document, *this));
m_pickerIndicatorIsVisible = true;
updatePickerIndicatorVisibility();
}
示例6: createShadowSubtree
void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree()
{
ASSERT(element().shadow());
// Element must not have a renderer here, because if it did
// DateTimeEditElement::customStyleForRenderer() is called in appendChild()
// before the field wrapper element is created.
// FIXME: This code should not depend on such craziness.
ASSERT(!element().renderer());
Document& document = element().document();
ContainerNode* container = element().userAgentShadowRoot();
container->appendChild(DateTimeEditElement::create(document, *this));
element().updateView();
container->appendChild(ClearButtonElement::create(document, *this));
container->appendChild(SpinButtonElement::create(document, *this));
if (RenderTheme::theme().supportsCalendarPicker(formControlType()))
m_pickerIndicatorIsAlwaysVisible = true;
container->appendChild(PickerIndicatorElement::create(document, *this));
m_pickerIndicatorIsVisible = true;
updatePickerIndicatorVisibility();
}
示例7: viaInspectorStyleSheet
InspectorStyleSheet* InspectorCSSAgent::viaInspectorStyleSheet(Document* document, bool createIfAbsent)
{
if (!document) {
ASSERT(!createIfAbsent);
return 0;
}
RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_documentToInspectorStyleSheet.get(document);
if (inspectorStyleSheet || !createIfAbsent)
return inspectorStyleSheet.get();
ExceptionCode ec = 0;
RefPtr<Element> styleElement = document->createElement("style", ec);
if (!ec)
styleElement->setAttribute("type", "text/css", ec);
if (!ec) {
ContainerNode* targetNode;
// HEAD is absent in ImageDocuments, for example.
if (document->head())
targetNode = document->head();
else if (document->body())
targetNode = document->body();
else
return 0;
targetNode->appendChild(styleElement, ec);
}
if (ec)
return 0;
StyleSheetList* styleSheets = document->styleSheets();
StyleSheet* styleSheet = styleSheets->item(styleSheets->length() - 1);
if (!styleSheet->isCSSStyleSheet())
return 0;
CSSStyleSheet* cssStyleSheet = static_cast<CSSStyleSheet*>(styleSheet);
String id = String::number(m_lastStyleSheetId++);
inspectorStyleSheet = InspectorStyleSheet::create(id, cssStyleSheet, "inspector", m_domAgent->documentURLString(document));
m_idToInspectorStyleSheet.set(id, inspectorStyleSheet);
m_cssStyleSheetToInspectorStyleSheet.set(cssStyleSheet, inspectorStyleSheet);
m_documentToInspectorStyleSheet.set(document, inspectorStyleSheet);
return inspectorStyleSheet.get();
}