1 /* 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved. 4 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * * Redistributions in binary form must reproduce the above 13 * copyright notice, this list of conditions and the following disclaimer 14 * in the documentation and/or other materials provided with the 15 * distribution. 16 * * Neither the name of Google Inc. nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_IMAGE_INPUT_TYPE_H_ 34 #define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_IMAGE_INPUT_TYPE_H_ 35 36 #include "third_party/blink/renderer/core/html/forms/base_button_input_type.h" 37 #include "third_party/blink/renderer/platform/geometry/int_point.h" 38 39 namespace blink { 40 41 class ImageInputType final : public BaseButtonInputType { 42 public: 43 explicit ImageInputType(HTMLInputElement&); 44 void CustomStyleForLayoutObject(ComputedStyle& style) override; 45 46 private: 47 void CountUsage() override; 48 const AtomicString& FormControlType() const override; 49 bool IsFormDataAppendable() const override; 50 void AppendToFormData(FormData&) const override; 51 String ResultForDialogSubmit() const override; 52 bool SupportsValidation() const override; 53 bool TypeShouldForceLegacyLayout() const override; 54 LayoutObject* CreateLayoutObject(const ComputedStyle&, 55 LegacyLayout) const override; 56 void HandleDOMActivateEvent(Event&) override; 57 void AltAttributeChanged() override; 58 void SrcAttributeChanged() override; 59 void ValueAttributeChanged() override; 60 void StartResourceLoading() override; 61 void OnAttachWithLayoutObject() override; 62 bool ShouldRespectAlignAttribute() override; 63 bool CanBeSuccessfulSubmitButton() override; 64 bool IsEnumeratable() override; 65 bool ShouldRespectHeightAndWidthAttributes() override; 66 unsigned Height() const override; 67 unsigned Width() const override; 68 bool HasLegalLinkAttribute(const QualifiedName&) const override; 69 const QualifiedName& SubResourceAttributeName() const override; 70 void EnsureFallbackContent() override; 71 void EnsurePrimaryContent() override; 72 void CreateShadowSubtree() override; 73 74 void ReattachFallbackContent(); 75 void SetUseFallbackContent(); HasFallbackContent()76 bool HasFallbackContent() const override { return use_fallback_content_; } 77 78 // Valid only during HTMLFormElement::prepareForSubmission(). 79 IntPoint click_location_; 80 81 bool use_fallback_content_; 82 }; 83 84 } // namespace blink 85 86 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_IMAGE_INPUT_TYPE_H_ 87