OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void TextFieldDecorationElement::decorate(HTMLInputElement* input, bool visible) | 104 void TextFieldDecorationElement::decorate(HTMLInputElement* input, bool visible) |
105 { | 105 { |
106 ASSERT(input); | 106 ASSERT(input); |
107 ShadowRoot* existingRoot; | 107 ShadowRoot* existingRoot; |
108 ShadowRoot* decorationRoot; | 108 ShadowRoot* decorationRoot; |
109 getDecorationRootAndDecoratedRoot(input, decorationRoot, existingRoot); | 109 getDecorationRootAndDecoratedRoot(input, decorationRoot, existingRoot); |
110 ASSERT(decorationRoot); | 110 ASSERT(decorationRoot); |
111 ASSERT(existingRoot); | 111 ASSERT(existingRoot); |
112 RefPtr<HTMLDivElement> box = HTMLDivElement::create(input->document()); | 112 RefPtr<HTMLDivElement> box = HTMLDivElement::create(input->document()); |
113 decorationRoot->appendChild(box); | 113 decorationRoot->appendChild(box); |
114 box->setInlineStyleProperty(CSSPropertyDisplay, CSSValueWebkitFlex); | 114 box->setInlineStyleProperty(CSSPropertyDisplay, CSSValueFlex); |
115 box->setInlineStyleProperty(CSSPropertyWebkitAlignItems, CSSValueCenter); | 115 box->setInlineStyleProperty(CSSPropertyAlignItems, CSSValueCenter); |
116 ASSERT(existingRoot->childNodeCount() == 1); | 116 ASSERT(existingRoot->childNodeCount() == 1); |
117 toHTMLElement(existingRoot->firstChild())->setInlineStyleProperty(CSSPropert
yWebkitFlexGrow, 1.0, CSSPrimitiveValue::CSS_NUMBER); | 117 toHTMLElement(existingRoot->firstChild())->setInlineStyleProperty(CSSPropert
yFlexGrow, 1.0, CSSPrimitiveValue::CSS_NUMBER); |
118 box->appendChild(HTMLShadowElement::create(HTMLNames::shadowTag, input->docu
ment())); | 118 box->appendChild(HTMLShadowElement::create(HTMLNames::shadowTag, input->docu
ment())); |
119 setInlineStyleProperty(CSSPropertyDisplay, visible ? CSSValueBlock : CSSValu
eNone); | 119 setInlineStyleProperty(CSSPropertyDisplay, visible ? CSSValueBlock : CSSValu
eNone); |
120 box->appendChild(this); | 120 box->appendChild(this); |
121 } | 121 } |
122 | 122 |
123 inline HTMLInputElement* TextFieldDecorationElement::hostInput() | 123 inline HTMLInputElement* TextFieldDecorationElement::hostInput() |
124 { | 124 { |
125 // TextFieldDecorationElement is created only by C++ code, and it is always | 125 // TextFieldDecorationElement is created only by C++ code, and it is always |
126 // in <input> shadow. | 126 // in <input> shadow. |
127 return toHTMLInputElement(shadowHost()); | 127 return toHTMLInputElement(shadowHost()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 bool TextFieldDecorationElement::willRespondToMouseClickEvents() | 227 bool TextFieldDecorationElement::willRespondToMouseClickEvents() |
228 { | 228 { |
229 const HTMLInputElement* input = hostInput(); | 229 const HTMLInputElement* input = hostInput(); |
230 if (!input->isDisabledOrReadOnly()) | 230 if (!input->isDisabledOrReadOnly()) |
231 return true; | 231 return true; |
232 | 232 |
233 return HTMLDivElement::willRespondToMouseClickEvents(); | 233 return HTMLDivElement::willRespondToMouseClickEvents(); |
234 } | 234 } |
235 | 235 |
236 } // namespace WebCore | 236 } // namespace WebCore |
OLD | NEW |