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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 style->SetFlexGrow(1); | 82 style->SetFlexGrow(1); |
83 style->SetMinWidth(Length(0, kFixed)); | 83 style->SetMinWidth(Length(0, kFixed)); |
84 style->SetDisplay(EDisplay::kBlock); | 84 style->SetDisplay(EDisplay::kBlock); |
85 style->SetDirection(TextDirection::kLtr); | 85 style->SetDirection(TextDirection::kLtr); |
86 | 86 |
87 // We don't want the shadow dom to be editable, so we set this block to | 87 // We don't want the shadow dom to be editable, so we set this block to |
88 // read-only in case the input itself is editable. | 88 // read-only in case the input itself is editable. |
89 style->SetUserModify(EUserModify::kReadOnly); | 89 style->SetUserModify(EUserModify::kReadOnly); |
90 style->SetUnique(); | 90 style->SetUnique(); |
91 | 91 |
| 92 if (const ComputedStyle* parent_style = ParentComputedStyle()) |
| 93 StyleAdjuster::AdjustStyleForAlignment(*style, *parent_style); |
| 94 |
92 return style.Release(); | 95 return style.Release(); |
93 } | 96 } |
94 | 97 |
95 // --------------------------- | 98 // --------------------------- |
96 | 99 |
97 inline TextControlInnerEditorElement::TextControlInnerEditorElement( | 100 inline TextControlInnerEditorElement::TextControlInnerEditorElement( |
98 Document& document) | 101 Document& document) |
99 : HTMLDivElement(document) { | 102 : HTMLDivElement(document) { |
100 SetHasCustomStyleCallbacks(); | 103 SetHasCustomStyleCallbacks(); |
101 } | 104 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if (!parent_layout_object || !parent_layout_object->IsTextControl()) | 142 if (!parent_layout_object || !parent_layout_object->IsTextControl()) |
140 return OriginalStyleForLayoutObject(); | 143 return OriginalStyleForLayoutObject(); |
141 LayoutTextControlItem text_control_layout_item = | 144 LayoutTextControlItem text_control_layout_item = |
142 LayoutTextControlItem(ToLayoutTextControl(parent_layout_object)); | 145 LayoutTextControlItem(ToLayoutTextControl(parent_layout_object)); |
143 RefPtr<ComputedStyle> inner_editor_style = | 146 RefPtr<ComputedStyle> inner_editor_style = |
144 text_control_layout_item.CreateInnerEditorStyle( | 147 text_control_layout_item.CreateInnerEditorStyle( |
145 text_control_layout_item.StyleRef()); | 148 text_control_layout_item.StyleRef()); |
146 // Using StyleAdjuster::adjustComputedStyle updates unwanted style. We'd like | 149 // Using StyleAdjuster::adjustComputedStyle updates unwanted style. We'd like |
147 // to apply only editing-related and alignment-related. | 150 // to apply only editing-related and alignment-related. |
148 StyleAdjuster::AdjustStyleForEditing(*inner_editor_style); | 151 StyleAdjuster::AdjustStyleForEditing(*inner_editor_style); |
| 152 if (const ComputedStyle* parent_style = ParentComputedStyle()) |
| 153 StyleAdjuster::AdjustStyleForAlignment(*inner_editor_style, *parent_style); |
149 return inner_editor_style.Release(); | 154 return inner_editor_style.Release(); |
150 } | 155 } |
151 | 156 |
152 // ---------------------------- | 157 // ---------------------------- |
153 | 158 |
154 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement( | 159 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement( |
155 Document& document) | 160 Document& document) |
156 : HTMLDivElement(document), capturing_(false) {} | 161 : HTMLDivElement(document), capturing_(false) {} |
157 | 162 |
158 SearchFieldCancelButtonElement* SearchFieldCancelButtonElement::Create( | 163 SearchFieldCancelButtonElement* SearchFieldCancelButtonElement::Create( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 202 |
198 bool SearchFieldCancelButtonElement::WillRespondToMouseClickEvents() { | 203 bool SearchFieldCancelButtonElement::WillRespondToMouseClickEvents() { |
199 const HTMLInputElement* input = toHTMLInputElement(OwnerShadowHost()); | 204 const HTMLInputElement* input = toHTMLInputElement(OwnerShadowHost()); |
200 if (input && !input->IsDisabledOrReadOnly()) | 205 if (input && !input->IsDisabledOrReadOnly()) |
201 return true; | 206 return true; |
202 | 207 |
203 return HTMLDivElement::WillRespondToMouseClickEvents(); | 208 return HTMLDivElement::WillRespondToMouseClickEvents(); |
204 } | 209 } |
205 | 210 |
206 } // namespace blink | 211 } // namespace blink |
OLD | NEW |