OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 style->setFlexGrow(1); | 87 style->setFlexGrow(1); |
88 style->setMinWidth(Length(0, Fixed)); | 88 style->setMinWidth(Length(0, Fixed)); |
89 style->setDisplay(BLOCK); | 89 style->setDisplay(BLOCK); |
90 style->setDirection(LTR); | 90 style->setDirection(LTR); |
91 | 91 |
92 // We don't want the shadow dom to be editable, so we set this block to | 92 // We don't want the shadow dom to be editable, so we set this block to |
93 // read-only in case the input itself is editable. | 93 // read-only in case the input itself is editable. |
94 style->setUserModify(READ_ONLY); | 94 style->setUserModify(READ_ONLY); |
95 style->setUnique(); | 95 style->setUnique(); |
96 | 96 |
| 97 if (const ComputedStyle* parentStyle = parentComputedStyle()) |
| 98 StyleAdjuster::adjustStyleForAlignment(*style, *parentStyle); |
| 99 |
97 return style.release(); | 100 return style.release(); |
98 } | 101 } |
99 | 102 |
100 // --------------------------- | 103 // --------------------------- |
101 | 104 |
102 inline TextControlInnerEditorElement::TextControlInnerEditorElement(Document& do
cument) | 105 inline TextControlInnerEditorElement::TextControlInnerEditorElement(Document& do
cument) |
103 : HTMLDivElement(document) | 106 : HTMLDivElement(document) |
104 { | 107 { |
105 setHasCustomStyleCallbacks(); | 108 setHasCustomStyleCallbacks(); |
106 } | 109 } |
(...skipping 30 matching lines...) Expand all Loading... |
137 } | 140 } |
138 | 141 |
139 PassRefPtr<ComputedStyle> TextControlInnerEditorElement::customStyleForLayoutObj
ect() | 142 PassRefPtr<ComputedStyle> TextControlInnerEditorElement::customStyleForLayoutObj
ect() |
140 { | 143 { |
141 LayoutObject* parentLayoutObject = shadowHost()->layoutObject(); | 144 LayoutObject* parentLayoutObject = shadowHost()->layoutObject(); |
142 if (!parentLayoutObject || !parentLayoutObject->isTextControl()) | 145 if (!parentLayoutObject || !parentLayoutObject->isTextControl()) |
143 return originalStyleForLayoutObject(); | 146 return originalStyleForLayoutObject(); |
144 LayoutTextControlItem textControlLayoutItem = LayoutTextControlItem(toLayout
TextControl(parentLayoutObject)); | 147 LayoutTextControlItem textControlLayoutItem = LayoutTextControlItem(toLayout
TextControl(parentLayoutObject)); |
145 RefPtr<ComputedStyle> innerEditorStyle = textControlLayoutItem.createInnerEd
itorStyle(textControlLayoutItem.styleRef()); | 148 RefPtr<ComputedStyle> innerEditorStyle = textControlLayoutItem.createInnerEd
itorStyle(textControlLayoutItem.styleRef()); |
146 // Using StyleAdjuster::adjustComputedStyle updates unwanted style. We'd lik
e | 149 // Using StyleAdjuster::adjustComputedStyle updates unwanted style. We'd lik
e |
147 // to apply only editing-related. | 150 // to apply only editing-related and alignment-related. |
148 StyleAdjuster::adjustStyleForEditing(*innerEditorStyle); | 151 StyleAdjuster::adjustStyleForEditing(*innerEditorStyle); |
| 152 if (const ComputedStyle* parentStyle = parentComputedStyle()) |
| 153 StyleAdjuster::adjustStyleForAlignment(*innerEditorStyle, *parentStyle); |
149 return innerEditorStyle.release(); | 154 return innerEditorStyle.release(); |
150 } | 155 } |
151 | 156 |
152 // ---------------------------- | 157 // ---------------------------- |
153 | 158 |
154 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document&
document) | 159 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document&
document) |
155 : HTMLDivElement(document) | 160 : HTMLDivElement(document) |
156 , m_capturing(false) | 161 , m_capturing(false) |
157 { | 162 { |
158 } | 163 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() | 205 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() |
201 { | 206 { |
202 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); | 207 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); |
203 if (input && !input->isDisabledOrReadOnly()) | 208 if (input && !input->isDisabledOrReadOnly()) |
204 return true; | 209 return true; |
205 | 210 |
206 return HTMLDivElement::willRespondToMouseClickEvents(); | 211 return HTMLDivElement::willRespondToMouseClickEvents(); |
207 } | 212 } |
208 | 213 |
209 } // namespace blink | 214 } // namespace blink |
OLD | NEW |