| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/dom/shadow/ShadowRoot.h" | 37 #include "core/dom/shadow/ShadowRoot.h" |
| 38 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
| 39 #include "core/rendering/RenderButton.h" | 39 #include "core/rendering/RenderButton.h" |
| 40 #include "core/rendering/RenderTextFragment.h" | 40 #include "core/rendering/RenderTextFragment.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 45 | 45 |
| 46 class NonSelectableText : public Text { | 46 class NonSelectableText : public Text { |
| 47 inline NonSelectableText(Document* document, const String& data) | 47 inline NonSelectableText(Document& document, const String& data) |
| 48 : Text(document, data, CreateText) | 48 : Text(document, data, CreateText) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual RenderText* createTextRenderer(RenderStyle*) OVERRIDE | 52 virtual RenderText* createTextRenderer(RenderStyle*) OVERRIDE |
| 53 { | 53 { |
| 54 return new RenderTextFragment(this, dataImpl()); | 54 return new RenderTextFragment(this, dataImpl()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 public: | 57 public: |
| 58 static inline PassRefPtr<NonSelectableText> create(Document* document, const
String& data) | 58 static inline PassRefPtr<NonSelectableText> create(Document& document, const
String& data) |
| 59 { | 59 { |
| 60 return adoptRef(new NonSelectableText(document, data)); | 60 return adoptRef(new NonSelectableText(document, data)); |
| 61 } | 61 } |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // ---------------------------- | 64 // ---------------------------- |
| 65 | 65 |
| 66 void BaseButtonInputType::createShadowSubtree() | 66 void BaseButtonInputType::createShadowSubtree() |
| 67 { | 67 { |
| 68 ASSERT(element()->userAgentShadowRoot()); | 68 ASSERT(element()->userAgentShadowRoot()); |
| 69 RefPtr<Text> text = NonSelectableText::create(&element()->document(), elemen
t()->valueWithDefault()); | 69 RefPtr<Text> text = NonSelectableText::create(element()->document(), element
()->valueWithDefault()); |
| 70 element()->userAgentShadowRoot()->appendChild(text); | 70 element()->userAgentShadowRoot()->appendChild(text); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void BaseButtonInputType::valueAttributeChanged() | 73 void BaseButtonInputType::valueAttributeChanged() |
| 74 { | 74 { |
| 75 toText(element()->userAgentShadowRoot()->firstChild())->setData(element()->v
alueWithDefault()); | 75 toText(element()->userAgentShadowRoot()->firstChild())->setData(element()->v
alueWithDefault()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool BaseButtonInputType::shouldSaveAndRestoreFormControlState() const | 78 bool BaseButtonInputType::shouldSaveAndRestoreFormControlState() const |
| 79 { | 79 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 95 { | 95 { |
| 96 return false; | 96 return false; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void BaseButtonInputType::setValue(const String& sanitizedValue, bool, TextField
EventBehavior) | 99 void BaseButtonInputType::setValue(const String& sanitizedValue, bool, TextField
EventBehavior) |
| 100 { | 100 { |
| 101 element()->setAttribute(valueAttr, sanitizedValue); | 101 element()->setAttribute(valueAttr, sanitizedValue); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace WebCore | 104 } // namespace WebCore |
| OLD | NEW |