void TextFieldInputType::createShadowSubtree()
{
    ASSERT(element().shadow());
    ShadowRoot* shadowRoot = element().userAgentShadowRoot();
    ASSERT(!shadowRoot->hasChildren());

    Document& document = element().document();
    bool shouldHaveSpinButton = this->shouldHaveSpinButton();
    bool shouldHaveDataListIndicator = element().hasValidDataListOptions();
    bool createsContainer = shouldHaveSpinButton || shouldHaveDataListIndicator || needsContainer();

    RefPtrWillBeRawPtr<TextControlInnerEditorElement> innerEditor = TextControlInnerEditorElement::create(document);
    if (!createsContainer) {
        shadowRoot->appendChild(innerEditor.release());
        return;
    }

    RefPtrWillBeRawPtr<TextControlInnerContainer> container = TextControlInnerContainer::create(document);
    container->setShadowPseudoId(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
    shadowRoot->appendChild(container);

    RefPtrWillBeRawPtr<EditingViewPortElement> editingViewPort = EditingViewPortElement::create(document);
    editingViewPort->appendChild(innerEditor.release());
    container->appendChild(editingViewPort.release());

    if (shouldHaveDataListIndicator)
        container->appendChild(DataListIndicatorElement::create(document));
    // FIXME: Because of a special handling for a spin button in
    // LayoutTextControlSingleLine, we need to put it to the last position. It's
    // inconsistent with multiple-fields date/time types.
    if (shouldHaveSpinButton)
        container->appendChild(SpinButtonElement::create(document, *this));

    // See listAttributeTargetChanged too.
}
Ejemplo n.º 2
0
void HTMLSummaryElement::didAddClosedShadowRoot(ShadowRoot& root)
{
    RefPtrWillBeRawPtr<DetailsMarkerControl> markerControl = DetailsMarkerControl::create(document());
    markerControl->setIdAttribute(ShadowElementNames::detailsMarker());
    root.appendChild(markerControl);
    root.appendChild(HTMLContentElement::create(document()));
}
Ejemplo n.º 3
0
void HTMLOptGroupElement::didAddUserAgentShadowRoot(ShadowRoot& root) {
  DEFINE_STATIC_LOCAL(AtomicString, labelPadding, ("0 2px 1px 2px"));
  DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em"));
  HTMLDivElement* label = HTMLDivElement::create(document());
  label->setAttribute(roleAttr, AtomicString("group"));
  label->setAttribute(aria_labelAttr, AtomicString());
  label->setInlineStyleProperty(CSSPropertyPadding, labelPadding);
  label->setInlineStyleProperty(CSSPropertyMinHeight, labelMinHeight);
  label->setIdAttribute(ShadowElementNames::optGroupLabel());
  root.appendChild(label);

  HTMLContentElement* content = HTMLContentElement::create(document());
  content->setAttribute(selectAttr, "option,hr");
  root.appendChild(content);
}
Ejemplo n.º 4
0
TEST(TreeScopeTest, CommonAncestorOfTreesAtDifferentDepths) {
  //  document
  //    / \    : Common ancestor is document.
  //   Y   B
  //  /
  // A

  Document* document = Document::create();
  Element* html = document->createElement("html", StringOrDictionary());
  document->appendChild(html);
  Element* head = document->createElement("head", StringOrDictionary());
  html->appendChild(head);
  Element* body = document->createElement("body", StringOrDictionary());
  html->appendChild(body);

  ShadowRoot* shadowRootY =
      head->createShadowRootInternal(ShadowRootType::V0, ASSERT_NO_EXCEPTION);
  ShadowRoot* shadowRootB =
      body->createShadowRootInternal(ShadowRootType::V0, ASSERT_NO_EXCEPTION);

  Element* divInY = document->createElement("div", StringOrDictionary());
  shadowRootY->appendChild(divInY);
  ShadowRoot* shadowRootA =
      divInY->createShadowRootInternal(ShadowRootType::V0, ASSERT_NO_EXCEPTION);

  EXPECT_EQ(document, shadowRootA->commonAncestorTreeScope(*shadowRootB));
  EXPECT_EQ(document, shadowRootB->commonAncestorTreeScope(*shadowRootA));
}
void TextFieldInputType::createShadowSubtree()
{
    ASSERT(element().shadowRoot());

    ASSERT(!m_innerText);
    ASSERT(!m_innerBlock);
    ASSERT(!m_innerSpinButton);

    Document& document = element().document();
    bool shouldHaveSpinButton = this->shouldHaveSpinButton();
    bool createsContainer = shouldHaveSpinButton || needsContainer();

    m_innerText = TextControlInnerTextElement::create(document);
    if (!createsContainer) {
        element().userAgentShadowRoot()->appendChild(m_innerText, IGNORE_EXCEPTION);
        return;
    }

    ShadowRoot* shadowRoot = element().userAgentShadowRoot();
    m_container = TextControlInnerContainer::create(document);
    m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
    shadowRoot->appendChild(m_container, IGNORE_EXCEPTION);

    m_innerBlock = TextControlInnerElement::create(document);
    m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
    m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);

    if (shouldHaveSpinButton) {
        m_innerSpinButton = SpinButtonElement::create(document, *this);
        m_container->appendChild(m_innerSpinButton, IGNORE_EXCEPTION);
    }
}
TEST_F(CustomElementUpgradeSorterTest, sorter_shadow) {
  // A*
  // + {ShadowRoot}
  // | + B
  // |   + C*
  // + D*
  Element* a = createElementWithId("a-a", "a");
  Element* b = createElementWithId("a-a", "b");
  Element* c = createElementWithId("a-a", "c");
  Element* d = createElementWithId("a-a", "d");

  document()->documentElement()->appendChild(a);
  ShadowRoot* s = attachShadowTo(a);
  a->appendChild(d);

  s->appendChild(b);
  b->appendChild(c);

  CustomElementUpgradeSorter sort;
  sort.add(a);
  sort.add(c);
  sort.add(d);

  HeapVector<Member<Element>> elements;
  sort.sorted(&elements, document());
  EXPECT_EQ(3u, elements.size());
  EXPECT_EQ(a, elements[0].get());
  EXPECT_EQ(c, elements[1].get());
  EXPECT_EQ(d, elements[2].get());
}
Ejemplo n.º 7
0
void HTMLMarqueeElement::didAddUserAgentShadowRoot(ShadowRoot& shadowRoot) {
    Element* style = HTMLStyleElement::create(document(), false);
    style->setTextContent(
        ":host { display: inline-block; overflow: hidden;"
        "text-align: initial; white-space: nowrap; }"
        ":host([direction=\"up\"]), :host([direction=\"down\"]) { overflow: "
        "initial; overflow-y: hidden; white-space: initial; }"
        ":host > div { will-change: transform; }");
    shadowRoot.appendChild(style);

    Element* mover = HTMLDivElement::create(document());
    shadowRoot.appendChild(mover);

    mover->appendChild(HTMLContentElement::create(document()));
    m_mover = mover;
}
Ejemplo n.º 8
0
void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
{
    ASSERT(!m_targetElementInstance);
    ASSERT(!m_needsShadowTreeRecreation);

    // <use> creates a "user agent" shadow root. Do not build the shadow/instance tree for <use>
    // elements living in a user agent shadow tree because they will get expanded in a second
    // pass -- see expandUseElementsInShadowTree().
    if (inUseShadowTree())
        return;

    // Do not allow self-referencing.
    // 'target' may be null, if it's a non SVG namespaced element.
    if (!target || target == this || isDisallowedElement(target))
        return;

    // Set up root SVG element in shadow tree.
    RefPtrWillBeRawPtr<Element> newChild = target->cloneElementWithoutChildren();
    m_targetElementInstance = toSVGElement(newChild.get());
    ShadowRoot* shadowTreeRootElement = userAgentShadowRoot();
    shadowTreeRootElement->appendChild(newChild.release());

    // Clone the target subtree into the shadow tree, not handling <use> and <symbol> yet.

    // SVG specification does not say a word about <use> & cycles. My view on this is: just ignore it!
    // Non-appearing <use> content is easier to debug, then half-appearing content.
    if (!buildShadowTree(target, m_targetElementInstance.get(), false)) {
        clearShadowTree();
        return;
    }

    if (instanceTreeIsLoading(m_targetElementInstance.get()))
        return;

    // Assure shadow tree building was successfull
    ASSERT(m_targetElementInstance);
    ASSERT(m_targetElementInstance->correspondingUseElement() == this);
    ASSERT(m_targetElementInstance->correspondingElement() == target);

    // Expand all <use> elements in the shadow tree.
    // Expand means: replace the actual <use> element by what it references.
    if (!expandUseElementsInShadowTree(m_targetElementInstance.get())) {
        clearShadowTree();
        return;
    }

    // Expand all <symbol> elements in the shadow tree.
    // Expand means: replace the actual <symbol> element by the <svg> element.
    expandSymbolElementsInShadowTree(toSVGElement(shadowTreeRootElement->firstChild()));

    m_targetElementInstance = toSVGElement(shadowTreeRootElement->firstChild());
    transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get(), *m_targetElementInstance->correspondingElement());

    ASSERT(m_targetElementInstance->parentNode() == shadowTreeRootElement);

    // Update relative length information.
    updateRelativeLengthsInformation();
}
Ejemplo n.º 9
0
void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot& root)
{
    DEFINE_STATIC_LOCAL(const AtomicString, summarySelector, ("summary:first-of-type", AtomicString::ConstructFromLiteral));

    RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(document());
    defaultSummary->appendChild(Text::create(document(), locale().queryString(blink::WebLocalizedString::DetailsLabel)));

    RefPtr<HTMLContentElement> summary = HTMLContentElement::create(document());
    summary->setIdAttribute(ShadowElementNames::detailsSummary());
    summary->setAttribute(selectAttr, summarySelector);
    summary->appendChild(defaultSummary);
    root.appendChild(summary.release());

    RefPtr<HTMLDivElement> content = HTMLDivElement::create(document());
    content->setIdAttribute(ShadowElementNames::detailsContent());
    content->appendChild(HTMLContentElement::create(document()));
    content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
    root.appendChild(content.release());
}
Ejemplo n.º 10
0
void SVGTRefElement::updateReferencedText()
{
    String textContent;
    if (Element* target = SVGURIReference::targetElementFromIRIString(href(), document()))
        textContent = target->textContent();

    ASSERT(shadow());
    ShadowRoot* root = shadow()->oldestShadowRoot();
    if (!root->firstChild())
        root->appendChild(SVGShadowText::create(document(), textContent), ASSERT_NO_EXCEPTION);
    else
        root->firstChild()->setTextContent(textContent, ASSERT_NO_EXCEPTION);
}
Ejemplo n.º 11
0
void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot& root)
{
    ASSERT(!m_value);

    RefPtrWillBeRawPtr<MeterInnerElement> inner = MeterInnerElement::create(document());
    root.appendChild(inner);

    RefPtrWillBeRawPtr<MeterBarElement> bar = MeterBarElement::create(document());
    m_value = MeterValueElement::create(document());
    m_value->setWidthPercentage(0);
    m_value->updatePseudo();
    bar->appendChild(m_value);

    inner->appendChild(bar);
}
Ejemplo n.º 12
0
void SVGTRefElement::updateReferencedText(Element* target)
{
    String textContent;
    if (target)
        textContent = target->textContent();

    ASSERT(shadowRoot());
    ShadowRoot* root = shadowRoot();
    if (!root->firstChild())
        root->appendChild(Text::create(document(), textContent), ASSERT_NO_EXCEPTION);
    else {
        ASSERT(root->firstChild()->isTextNode());
        root->firstChild()->setTextContent(textContent, ASSERT_NO_EXCEPTION);
    }
}
Ejemplo n.º 13
0
void InputType::destroyShadowSubtree()
{
    ShadowRoot* root = element()->userAgentShadowRoot();
    if (!root)
        return;

    root->removeAllChildren();

    // It's ok to clear contents of all other ShadowRoots because they must have
    // been created by TextFieldDecorationElement, and we don't allow adding
    // AuthorShadowRoot to HTMLInputElement.
    while ((root = root->youngerShadowRoot())) {
        root->removeAllChildren();
        root->appendChild(HTMLShadowElement::create(shadowTag, element()->document()));
    }
}
Ejemplo n.º 14
0
void TextFieldInputType::createShadowSubtree()
{
    ASSERT(element()->hasShadowRoot());

    ASSERT(!m_innerText);
    ASSERT(!m_innerBlock);
    ASSERT(!m_innerSpinButton);

    Document* document = element()->document();
    ChromeClient* chromeClient = document->page() ? document->page()->chrome()->client() : 0;
    bool shouldAddDecorations = chromeClient && chromeClient->willAddTextFieldDecorationsTo(element());
    bool shouldHaveSpinButton = this->shouldHaveSpinButton();
    bool createsContainer = shouldHaveSpinButton || needsContainer() || shouldAddDecorations;

    ExceptionCode ec = 0;
    m_innerText = TextControlInnerTextElement::create(document);
    if (!createsContainer) {
        element()->shadowTree()->oldestShadowRoot()->appendChild(m_innerText, ec);
        return;
    }

    ShadowRoot* shadowRoot = element()->shadowTree()->oldestShadowRoot();
    m_container = HTMLDivElement::create(document);
    m_container->setShadowPseudoId("-webkit-textfield-decoration-container");
    shadowRoot->appendChild(m_container, ec);

    m_innerBlock = TextControlInnerElement::create(document);
    m_innerBlock->appendChild(m_innerText, ec);
    m_container->appendChild(m_innerBlock, ec);

#if ENABLE(INPUT_SPEECH)
    ASSERT(!m_speechButton);
    if (element()->isSpeechEnabled()) {
        m_speechButton = InputFieldSpeechButtonElement::create(document);
        m_container->appendChild(m_speechButton, ec);
    }
#endif

    if (shouldHaveSpinButton) {
        m_innerSpinButton = SpinButtonElement::create(document);
        m_container->appendChild(m_innerSpinButton, ec);
    }

    if (shouldAddDecorations)
        chromeClient->addTextFieldDecorationsTo(element());
}
Ejemplo n.º 15
0
void TextFieldInputType::createShadowSubtree()
{
    ASSERT(element().shadowRoot());

    ASSERT(!m_innerText);
    ASSERT(!m_innerBlock);
    ASSERT(!m_innerSpinButton);

    Document& document = element().document();
    bool shouldHaveSpinButton = this->shouldHaveSpinButton();
    bool shouldHaveCapsLockIndicator = this->shouldHaveCapsLockIndicator();
    bool createsContainer = shouldHaveSpinButton || shouldHaveCapsLockIndicator || needsContainer();

    m_innerText = TextControlInnerTextElement::create(document);
    if (!createsContainer) {
        element().userAgentShadowRoot()->appendChild(m_innerText, IGNORE_EXCEPTION);
        updatePlaceholderText();
        return;
    }

    ShadowRoot* shadowRoot = element().userAgentShadowRoot();
    m_container = TextControlInnerContainer::create(document);
    m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
    shadowRoot->appendChild(m_container, IGNORE_EXCEPTION);

    m_innerBlock = TextControlInnerElement::create(document);
    m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
    m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);

    updatePlaceholderText();

    if (shouldHaveSpinButton) {
        m_innerSpinButton = SpinButtonElement::create(document, *this);
        m_container->appendChild(m_innerSpinButton, IGNORE_EXCEPTION);
    }

    if (shouldHaveCapsLockIndicator) {
        m_capsLockIndicator = HTMLDivElement::create(document);
        m_capsLockIndicator->setPseudo(AtomicString("-webkit-caps-lock-indicator", AtomicString::ConstructFromLiteral));

        bool shouldDrawCapsLockIndicator = this->shouldDrawCapsLockIndicator();
        m_capsLockIndicator->setInlineStyleProperty(CSSPropertyDisplay, shouldDrawCapsLockIndicator ? CSSValueBlock : CSSValueNone, true);

        m_container->appendChild(m_capsLockIndicator, IGNORE_EXCEPTION);
    }
}
Ejemplo n.º 16
0
void TextFieldInputType::createShadowSubtree()
{
    ASSERT(element()->shadow());

    ASSERT(!m_innerText);
    ASSERT(!m_innerBlock);
    ASSERT(!m_innerSpinButton);

    Document* document = element()->document();
    ChromeClient* chromeClient = document->page() ? document->page()->chrome()->client() : 0;
    bool shouldAddDecorations = chromeClient && chromeClient->willAddTextFieldDecorationsTo(element());
    bool shouldHaveSpinButton = this->shouldHaveSpinButton();
    bool createsContainer = shouldHaveSpinButton || needsContainer() || shouldAddDecorations;

    m_innerText = TextControlInnerTextElement::create(document);
    if (!createsContainer) {
        element()->userAgentShadowRoot()->appendChild(m_innerText, IGNORE_EXCEPTION);
        return;
    }

    ShadowRoot* shadowRoot = element()->userAgentShadowRoot();
    m_container = TextControlInnerContainer::create(document);
    m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
    shadowRoot->appendChild(m_container, IGNORE_EXCEPTION);

    m_innerBlock = TextControlInnerElement::create(document);
    m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
    m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);

#if ENABLE(INPUT_SPEECH)
    ASSERT(!m_speechButton);
    if (element()->isSpeechEnabled()) {
        m_speechButton = InputFieldSpeechButtonElement::create(document);
        m_container->appendChild(m_speechButton, IGNORE_EXCEPTION);
    }
#endif

    if (shouldHaveSpinButton) {
        m_innerSpinButton = SpinButtonElement::create(document, *this);
        m_container->appendChild(m_innerSpinButton, IGNORE_EXCEPTION);
    }

    if (shouldAddDecorations)
        chromeClient->addTextFieldDecorationsTo(element());
}
Ejemplo n.º 17
0
void HTMLKeygenElement::didAddUserAgentShadowRoot(ShadowRoot& root)
{
    DEFINE_STATIC_LOCAL(AtomicString, keygenSelectPseudoId, ("-webkit-keygen-select", AtomicString::ConstructFromLiteral));

    Vector<String> keys;
    getSupportedKeySizes(locale(), keys);

    // Create a select element with one option element for each key size.
    RefPtr<HTMLSelectElement> select = HTMLSelectElement::create(document());
    select->setPseudo(keygenSelectPseudoId);
    for (size_t i = 0; i < keys.size(); ++i) {
        RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document());
        option->appendChild(Text::create(document(), keys[i]));
        select->appendChild(option);
    }

    root.appendChild(select);
}
void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot& root)
{
    ASSERT(!m_value);

    RefPtr<ProgressInnerElement> inner = ProgressInnerElement::create(document());
    inner->setShadowPseudoId(AtomicString("-webkit-progress-inner-element", AtomicString::ConstructFromLiteral));
    root.appendChild(inner);

    RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document());
    bar->setShadowPseudoId(AtomicString("-webkit-progress-bar", AtomicString::ConstructFromLiteral));
    RefPtr<ProgressValueElement> value = ProgressValueElement::create(document());
    m_value = value.get();
    m_value->setShadowPseudoId(AtomicString("-webkit-progress-value", AtomicString::ConstructFromLiteral));
    m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100);
    bar->appendChild(m_value);

    inner->appendChild(bar);
}
void TextFieldDecorationElement::decorate(HTMLInputElement* input, bool visible)
{
    ASSERT(input);
    ShadowRoot* existingRoot;
    ShadowRoot* decorationRoot;
    getDecorationRootAndDecoratedRoot(input, decorationRoot, existingRoot);
    ASSERT(decorationRoot);
    ASSERT(existingRoot);
    RefPtr<HTMLDivElement> box = HTMLDivElement::create(input->document());
    decorationRoot->appendChild(box);
    box->setInlineStyleProperty(CSSPropertyDisplay, CSSValueWebkitBox);
    box->setInlineStyleProperty(CSSPropertyWebkitBoxAlign, CSSValueCenter);
    ASSERT(existingRoot->childNodeCount() == 1);
    toHTMLElement(existingRoot->firstChild())->setInlineStyleProperty(CSSPropertyWebkitBoxFlex, 1.0, CSSPrimitiveValue::CSS_NUMBER);
    box->appendChild(HTMLShadowElement::create(HTMLNames::shadowTag, input->document()));

    setInlineStyleProperty(CSSPropertyDisplay, visible ? CSSValueBlock : CSSValueNone);
    box->appendChild(this);
}
Ejemplo n.º 20
0
void TextFieldInputType::createShadowSubtree()
{
    ASSERT(element()->hasShadowRoot());

    ASSERT(!m_innerText);
    ASSERT(!m_innerBlock);
    ASSERT(!m_innerSpinButton);

    Document* document = element()->document();
    RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme();
    bool shouldHaveSpinButton = theme->shouldHaveSpinButton(element());
    bool createsContainer = shouldHaveSpinButton || needsContainer();

    ExceptionCode ec = 0;
    m_innerText = TextControlInnerTextElement::create(document);
    if (!createsContainer) {
        element()->shadowTree()->oldestShadowRoot()->appendChild(m_innerText, ec);
        return;
    }

    ShadowRoot* shadowRoot = element()->shadowTree()->oldestShadowRoot();
    m_container = HTMLDivElement::create(document);
    m_container->setShadowPseudoId("-webkit-textfield-decoration-container");
    shadowRoot->appendChild(m_container, ec);

    m_innerBlock = TextControlInnerElement::create(document);
    m_innerBlock->appendChild(m_innerText, ec);
    m_container->appendChild(m_innerBlock, ec);

#if ENABLE(INPUT_SPEECH)
    ASSERT(!m_speechButton);
    if (element()->isSpeechEnabled()) {
        m_speechButton = InputFieldSpeechButtonElement::create(document);
        m_container->appendChild(m_speechButton, ec);
    }
#endif

    if (shouldHaveSpinButton) {
        m_innerSpinButton = SpinButtonElement::create(document);
        m_container->appendChild(m_innerSpinButton, ec);
    }
}
Ejemplo n.º 21
0
void ValidationMessage::buildBubbleTree(Timer<ValidationMessage>*)
{
    ASSERT(!validationMessageClient());
    ShadowRoot* shadowRoot = m_element->ensureUserAgentShadowRoot();

    Document* doc = m_element->document();
    m_bubble = HTMLDivElement::create(doc);
    m_bubble->setPseudo(AtomicString("-webkit-validation-bubble", AtomicString::ConstructFromLiteral));
    // Need to force position:absolute because RenderMenuList doesn't assume it
    // contains non-absolute or non-fixed renderers as children.
    m_bubble->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
    shadowRoot->appendChild(m_bubble.get(), ASSERT_NO_EXCEPTION);
    m_element->document()->updateLayout();
    adjustBubblePosition(m_element->boundingBox(), m_bubble.get());

    RefPtr<HTMLDivElement> clipper = HTMLDivElement::create(doc);
    clipper->setPseudo(AtomicString("-webkit-validation-bubble-arrow-clipper", AtomicString::ConstructFromLiteral));
    RefPtr<HTMLDivElement> bubbleArrow = HTMLDivElement::create(doc);
    bubbleArrow->setPseudo(AtomicString("-webkit-validation-bubble-arrow", AtomicString::ConstructFromLiteral));
    clipper->appendChild(bubbleArrow.release(), ASSERT_NO_EXCEPTION);
    m_bubble->appendChild(clipper.release(), ASSERT_NO_EXCEPTION);

    RefPtr<HTMLElement> message = HTMLDivElement::create(doc);
    message->setPseudo(AtomicString("-webkit-validation-bubble-message", AtomicString::ConstructFromLiteral));
    RefPtr<HTMLElement> icon = HTMLDivElement::create(doc);
    icon->setPseudo(AtomicString("-webkit-validation-bubble-icon", AtomicString::ConstructFromLiteral));
    message->appendChild(icon.release(), ASSERT_NO_EXCEPTION);
    RefPtr<HTMLElement> textBlock = HTMLDivElement::create(doc);
    textBlock->setPseudo(AtomicString("-webkit-validation-bubble-text-block", AtomicString::ConstructFromLiteral));
    m_messageHeading = HTMLDivElement::create(doc);
    m_messageHeading->setPseudo(AtomicString("-webkit-validation-bubble-heading", AtomicString::ConstructFromLiteral));
    textBlock->appendChild(m_messageHeading, ASSERT_NO_EXCEPTION);
    m_messageBody = HTMLDivElement::create(doc);
    m_messageBody->setPseudo(AtomicString("-webkit-validation-bubble-body", AtomicString::ConstructFromLiteral));
    textBlock->appendChild(m_messageBody, ASSERT_NO_EXCEPTION);
    message->appendChild(textBlock.release(), ASSERT_NO_EXCEPTION);
    m_bubble->appendChild(message.release(), ASSERT_NO_EXCEPTION);

    setMessageDOMAndStartTimer();

    // FIXME: Use transition to show the bubble.
}
Ejemplo n.º 22
0
void HTMLKeygenElement::didAddUserAgentShadowRoot(ShadowRoot& root) {
  DEFINE_STATIC_LOCAL(AtomicString, keygenSelectPseudoId,
                      ("-webkit-keygen-select"));

  Vector<String> keys;
  keys.reserveCapacity(2);
  keys.append(
      locale().queryString(WebLocalizedString::KeygenMenuHighGradeKeySize));
  keys.append(
      locale().queryString(WebLocalizedString::KeygenMenuMediumGradeKeySize));

  // Create a select element with one option element for each key size.
  HTMLSelectElement* select = HTMLSelectElement::create(document());
  select->setShadowPseudoId(keygenSelectPseudoId);
  for (const String& key : keys) {
    HTMLOptionElement* option = HTMLOptionElement::create(document());
    option->appendChild(Text::create(document(), key));
    select->appendChild(option);
  }

  root.appendChild(select);
}
Ejemplo n.º 23
0
void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot& root) {
  root.appendChild(TextControlInnerEditorElement::create(document()));
}
Ejemplo n.º 24
0
void HTMLSummaryElement::didAddUserAgentShadowRoot(ShadowRoot& root)
{
    root.appendChild(DetailsMarkerControl::create(document()));
    root.appendChild(HTMLContentElement::create(document()));
}