Changeset 112503 in webkit


Ignore:
Timestamp:
Mar 28, 2012 11:00:23 PM (12 years ago)
Author:
tkent@chromium.org
Message:

Add TextFieldDecorationElement::decorate()
https://bugs.webkit.org/show_bug.cgi?id=82572

Reviewed by Hajime Morita.

This change will be needed for Bug 82143.
No new tests because of no behavior changes yet. This code change
doesn't affect non-Chromium ports for now.

  • dom/ShadowRoot.cpp:

(WebCore::ShadowRoot::create):
Remove unnecessary assertion. We should allow multiple UA shadow roots.

  • html/shadow/TextFieldDecorationElement.cpp:

(WebCore::TextFieldDecorationElement::decorate):
Added.
This function adds another ShadowRoot, and it contains one flexible box container.
The container contains existin ShadowRoot content and the decoration element.

  • html/shadow/TextFieldDecorationElement.h:

(TextFieldDecorationElement): Add the declaration of decorate().

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r112502 r112503  
     12012-03-28  Kent Tamura  <tkent@chromium.org>
     2
     3        Add TextFieldDecorationElement::decorate()
     4        https://bugs.webkit.org/show_bug.cgi?id=82572
     5
     6        Reviewed by Hajime Morita.
     7
     8        This change will be needed for Bug 82143.
     9        No new tests because of no behavior changes yet. This code change
     10        doesn't affect non-Chromium ports for now.
     11
     12        * dom/ShadowRoot.cpp:
     13        (WebCore::ShadowRoot::create):
     14        Remove unnecessary assertion. We should allow multiple UA shadow roots.
     15        * html/shadow/TextFieldDecorationElement.cpp:
     16        (WebCore::TextFieldDecorationElement::decorate):
     17        Added.
     18        This function adds another ShadowRoot, and it contains one flexible box container.
     19        The container contains existin ShadowRoot content and the decoration element.
     20        * html/shadow/TextFieldDecorationElement.h:
     21        (TextFieldDecorationElement): Add the declaration of decorate().
     22
    1232012-03-28  Vineet Chaudhary  <rgf748@motorola.com>
    224
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r111155 r112503  
    114114    }
    115115
    116     ASSERT(purpose != CreatingUserAgentShadowRoot || !element->hasShadowRoot());
    117116    RefPtr<ShadowRoot> shadowRoot = adoptRef(new ShadowRoot(element->document()));
    118117
  • trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp

    r112109 r112503  
    3232#include "TextFieldDecorationElement.h"
    3333
     34#include "CSSPropertyNames.h"
     35#include "CSSValueKeywords.h"
    3436#include "Event.h"
    3537#include "HTMLInputElement.h"
     38#include "HTMLShadowElement.h"
    3639#include "NodeRenderStyle.h"
    3740#include "RenderImage.h"
     41#include "ShadowRoot.h"
     42#include "ShadowTree.h"
    3843
    3944namespace WebCore {
     
    6065{
    6166    return adoptRef(new TextFieldDecorationElement(document, decorator));
     67}
     68
     69void TextFieldDecorationElement::decorate(HTMLInputElement* input)
     70{
     71    ASSERT(input);
     72    ShadowRoot* existingRoot = input->shadowTree()->youngestShadowRoot();
     73    RefPtr<ShadowRoot> newRoot = ShadowRoot::create(input, ShadowRoot::CreatingUserAgentShadowRoot, ASSERT_NO_EXCEPTION);
     74    RefPtr<HTMLDivElement> box = HTMLDivElement::create(input->document());
     75    newRoot->appendChild(box);
     76    box->setInlineStyleProperty(CSSPropertyDisplay, CSSValueWebkitBox);
     77    box->setInlineStyleProperty(CSSPropertyWebkitBoxAlign, CSSValueCenter);
     78    ASSERT(existingRoot);
     79    ASSERT(existingRoot->childNodeCount() == 1);
     80    toHTMLElement(existingRoot->firstChild())->setInlineStyleProperty(CSSPropertyWebkitBoxFlex, 1.0, CSSPrimitiveValue::CSS_NUMBER);
     81    box->appendChild(HTMLShadowElement::create(HTMLNames::shadowTag, input->document()));
     82
     83    setInlineStyleProperty(CSSPropertyWebkitBoxFlex, 0.0, CSSPrimitiveValue::CSS_NUMBER);
     84    box->appendChild(this);
    6285}
    6386
  • trunk/Source/WebCore/html/shadow/TextFieldDecorationElement.h

    r112109 r112503  
    6464    static PassRefPtr<TextFieldDecorationElement> create(Document*, TextFieldDecorator*);
    6565    TextFieldDecorator* textFieldDecorator() { return m_textFieldDecorator; }
     66    void decorate(HTMLInputElement*);
    6667
    6768private:
Note: See TracChangeset for help on using the changeset viewer.