| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple 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 are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "core/html/forms/BaseButtonInputType.h" | 32 #include "core/html/forms/BaseButtonInputType.h" |
| 33 | 33 |
| 34 #include "core/HTMLNames.h" | 34 #include "core/HTMLNames.h" |
| 35 #include "core/dom/Text.h" | 35 #include "core/dom/Text.h" |
| 36 #include "core/dom/shadow/ShadowRoot.h" | 36 #include "core/dom/shadow/ShadowRoot.h" |
| 37 #include "core/html/HTMLFormElement.h" |
| 37 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
| 38 #include "core/html/parser/HTMLParserIdioms.h" | 39 #include "core/html/parser/HTMLParserIdioms.h" |
| 39 #include "core/layout/LayoutButton.h" | 40 #include "core/layout/LayoutButton.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 44 | 45 |
| 45 void BaseButtonInputType::createShadowSubtree() | 46 void BaseButtonInputType::createShadowSubtree() |
| 46 { | 47 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 75 bool BaseButtonInputType::storesValueSeparateFromAttribute() | 76 bool BaseButtonInputType::storesValueSeparateFromAttribute() |
| 76 { | 77 { |
| 77 return false; | 78 return false; |
| 78 } | 79 } |
| 79 | 80 |
| 80 void BaseButtonInputType::setValue(const String& sanitizedValue, bool, TextField
EventBehavior) | 81 void BaseButtonInputType::setValue(const String& sanitizedValue, bool, TextField
EventBehavior) |
| 81 { | 82 { |
| 82 element().setAttribute(valueAttr, AtomicString(sanitizedValue)); | 83 element().setAttribute(valueAttr, AtomicString(sanitizedValue)); |
| 83 } | 84 } |
| 84 | 85 |
| 86 bool BaseButtonInputType::matchesDefaultPseudoClass() |
| 87 { |
| 88 // HTMLFormElement::findDefaultButton() traverses the tree. So we check |
| 89 // canBeSuccessfulSubmitButton() first for early return. |
| 90 return canBeSuccessfulSubmitButton() && element().form() && element().form()
->findDefaultButton() == &element(); |
| 91 } |
| 92 |
| 85 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |