| 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 | |
| 95 return style.Release(); | 92 return style.Release(); |
| 96 } | 93 } |
| 97 | 94 |
| 98 // --------------------------- | 95 // --------------------------- |
| 99 | 96 |
| 100 inline TextControlInnerEditorElement::TextControlInnerEditorElement( | 97 inline TextControlInnerEditorElement::TextControlInnerEditorElement( |
| 101 Document& document) | 98 Document& document) |
| 102 : HTMLDivElement(document) { | 99 : HTMLDivElement(document) { |
| 103 SetHasCustomStyleCallbacks(); | 100 SetHasCustomStyleCallbacks(); |
| 104 } | 101 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (!parent_layout_object || !parent_layout_object->IsTextControl()) | 139 if (!parent_layout_object || !parent_layout_object->IsTextControl()) |
| 143 return OriginalStyleForLayoutObject(); | 140 return OriginalStyleForLayoutObject(); |
| 144 LayoutTextControlItem text_control_layout_item = | 141 LayoutTextControlItem text_control_layout_item = |
| 145 LayoutTextControlItem(ToLayoutTextControl(parent_layout_object)); | 142 LayoutTextControlItem(ToLayoutTextControl(parent_layout_object)); |
| 146 RefPtr<ComputedStyle> inner_editor_style = | 143 RefPtr<ComputedStyle> inner_editor_style = |
| 147 text_control_layout_item.CreateInnerEditorStyle( | 144 text_control_layout_item.CreateInnerEditorStyle( |
| 148 text_control_layout_item.StyleRef()); | 145 text_control_layout_item.StyleRef()); |
| 149 // Using StyleAdjuster::adjustComputedStyle updates unwanted style. We'd like | 146 // Using StyleAdjuster::adjustComputedStyle updates unwanted style. We'd like |
| 150 // to apply only editing-related and alignment-related. | 147 // to apply only editing-related and alignment-related. |
| 151 StyleAdjuster::AdjustStyleForEditing(*inner_editor_style); | 148 StyleAdjuster::AdjustStyleForEditing(*inner_editor_style); |
| 152 if (const ComputedStyle* parent_style = ParentComputedStyle()) | |
| 153 StyleAdjuster::AdjustStyleForAlignment(*inner_editor_style, *parent_style); | |
| 154 return inner_editor_style.Release(); | 149 return inner_editor_style.Release(); |
| 155 } | 150 } |
| 156 | 151 |
| 157 // ---------------------------- | 152 // ---------------------------- |
| 158 | 153 |
| 159 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement( | 154 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement( |
| 160 Document& document) | 155 Document& document) |
| 161 : HTMLDivElement(document), capturing_(false) {} | 156 : HTMLDivElement(document), capturing_(false) {} |
| 162 | 157 |
| 163 SearchFieldCancelButtonElement* SearchFieldCancelButtonElement::Create( | 158 SearchFieldCancelButtonElement* SearchFieldCancelButtonElement::Create( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 197 |
| 203 bool SearchFieldCancelButtonElement::WillRespondToMouseClickEvents() { | 198 bool SearchFieldCancelButtonElement::WillRespondToMouseClickEvents() { |
| 204 const HTMLInputElement* input = toHTMLInputElement(OwnerShadowHost()); | 199 const HTMLInputElement* input = toHTMLInputElement(OwnerShadowHost()); |
| 205 if (input && !input->IsDisabledOrReadOnly()) | 200 if (input && !input->IsDisabledOrReadOnly()) |
| 206 return true; | 201 return true; |
| 207 | 202 |
| 208 return HTMLDivElement::WillRespondToMouseClickEvents(); | 203 return HTMLDivElement::WillRespondToMouseClickEvents(); |
| 209 } | 204 } |
| 210 | 205 |
| 211 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |