| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "core/InputTypeNames.h" | 27 #include "core/InputTypeNames.h" |
| 28 #include "core/dom/shadow/ShadowRoot.h" | 28 #include "core/dom/shadow/ShadowRoot.h" |
| 29 #include "core/events/MouseEvent.h" | 29 #include "core/events/MouseEvent.h" |
| 30 #include "core/fetch/ImageResource.h" | 30 #include "core/fetch/ImageResource.h" |
| 31 #include "core/html/FormDataList.h" | 31 #include "core/html/FormDataList.h" |
| 32 #include "core/html/HTMLFormElement.h" | 32 #include "core/html/HTMLFormElement.h" |
| 33 #include "core/html/HTMLImageFallbackHelper.h" | 33 #include "core/html/HTMLImageFallbackHelper.h" |
| 34 #include "core/html/HTMLImageLoader.h" | 34 #include "core/html/HTMLImageLoader.h" |
| 35 #include "core/html/HTMLInputElement.h" | 35 #include "core/html/HTMLInputElement.h" |
| 36 #include "core/html/parser/HTMLParserIdioms.h" | 36 #include "core/html/parser/HTMLParserIdioms.h" |
| 37 #include "core/layout/LayoutImage.h" |
| 37 #include "core/rendering/RenderBlockFlow.h" | 38 #include "core/rendering/RenderBlockFlow.h" |
| 38 #include "core/rendering/RenderImage.h" | |
| 39 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
| 40 #include "wtf/text/StringBuilder.h" | 40 #include "wtf/text/StringBuilder.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 45 | 45 |
| 46 inline ImageInputType::ImageInputType(HTMLInputElement& element) | 46 inline ImageInputType::ImageInputType(HTMLInputElement& element) |
| 47 : BaseButtonInputType(element) | 47 : BaseButtonInputType(element) |
| 48 , m_useFallbackContent(false) | 48 , m_useFallbackContent(false) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 m_clickLocation = extractClickLocation(event); | 118 m_clickLocation = extractClickLocation(event); |
| 119 element->form()->prepareForSubmission(event); // Event handlers can run. | 119 element->form()->prepareForSubmission(event); // Event handlers can run. |
| 120 element->setActivatedSubmit(false); | 120 element->setActivatedSubmit(false); |
| 121 event->setDefaultHandled(); | 121 event->setDefaultHandled(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 LayoutObject* ImageInputType::createRenderer(const LayoutStyle& style) const | 124 LayoutObject* ImageInputType::createRenderer(const LayoutStyle& style) const |
| 125 { | 125 { |
| 126 if (m_useFallbackContent) | 126 if (m_useFallbackContent) |
| 127 return new RenderBlockFlow(&element()); | 127 return new RenderBlockFlow(&element()); |
| 128 RenderImage* image = new RenderImage(&element()); | 128 LayoutImage* image = new LayoutImage(&element()); |
| 129 image->setImageResource(RenderImageResource::create()); | 129 image->setImageResource(LayoutImageResource::create()); |
| 130 return image; | 130 return image; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void ImageInputType::altAttributeChanged() | 133 void ImageInputType::altAttributeChanged() |
| 134 { | 134 { |
| 135 if (element().userAgentShadowRoot()) { | 135 if (element().userAgentShadowRoot()) { |
| 136 Element* text = element().userAgentShadowRoot()->getElementById("alttext
"); | 136 Element* text = element().userAgentShadowRoot()->getElementById("alttext
"); |
| 137 String value = element().altText(); | 137 String value = element().altText(); |
| 138 if (text && text->textContent() != value) | 138 if (text && text->textContent() != value) |
| 139 text->setTextContent(element().altText()); | 139 text->setTextContent(element().altText()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ImageInputType::startResourceLoading() | 157 void ImageInputType::startResourceLoading() |
| 158 { | 158 { |
| 159 BaseButtonInputType::startResourceLoading(); | 159 BaseButtonInputType::startResourceLoading(); |
| 160 | 160 |
| 161 HTMLImageLoader& imageLoader = element().ensureImageLoader(); | 161 HTMLImageLoader& imageLoader = element().ensureImageLoader(); |
| 162 imageLoader.updateFromElement(); | 162 imageLoader.updateFromElement(); |
| 163 | 163 |
| 164 LayoutObject* renderer = element().renderer(); | 164 LayoutObject* renderer = element().renderer(); |
| 165 if (!renderer || !renderer->isRenderImage()) | 165 if (!renderer || !renderer->isLayoutImage()) |
| 166 return; | 166 return; |
| 167 | 167 |
| 168 RenderImageResource* imageResource = toRenderImage(renderer)->imageResource(
); | 168 LayoutImageResource* imageResource = toLayoutImage(renderer)->imageResource(
); |
| 169 imageResource->setImageResource(imageLoader.image()); | 169 imageResource->setImageResource(imageLoader.image()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool ImageInputType::shouldRespectAlignAttribute() | 172 bool ImageInputType::shouldRespectAlignAttribute() |
| 173 { | 173 { |
| 174 return true; | 174 return true; |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool ImageInputType::canBeSuccessfulSubmitButton() | 177 bool ImageInputType::canBeSuccessfulSubmitButton() |
| 178 { | 178 { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 PassRefPtr<LayoutStyle> ImageInputType::customStyleForRenderer(PassRefPtr<Layout
Style> newStyle) | 298 PassRefPtr<LayoutStyle> ImageInputType::customStyleForRenderer(PassRefPtr<Layout
Style> newStyle) |
| 299 { | 299 { |
| 300 if (!m_useFallbackContent) | 300 if (!m_useFallbackContent) |
| 301 return newStyle; | 301 return newStyle; |
| 302 | 302 |
| 303 return HTMLImageFallbackHelper::customStyleForAltText(element(), newStyle); | 303 return HTMLImageFallbackHelper::customStyleForAltText(element(), newStyle); |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // namespace blink | 306 } // namespace blink |
| OLD | NEW |