1 /* 2 * Copyright 2009, The Android Open Source Project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef CachedInput_H 27 #define CachedInput_H 28 29 #include "CachedDebug.h" 30 #include "HTMLInputElement.h" 31 #include "PlatformString.h" 32 33 namespace android { 34 35 class CachedInput { 36 public: 37 CachedInput() { 38 // Initiaized to 0 in its array, so nothing to do in the 39 // constructor 40 } 41 void* formPointer() const { return mForm; } 42 void init() { 43 bzero(this, sizeof(CachedInput)); 44 mName = WebCore::String(); 45 } 46 WebCore::HTMLInputElement::InputType inputType() const { return mInputType; } 47 bool isRtlText() const { return mIsRtlText; } 48 bool isTextField() const { return mIsTextField; } 49 int maxLength() const { return mMaxLength; }; 50 const WebCore::String& name() const { return mName; } 51 int paddingBottom() const { return mPaddingBottom; } 52 int paddingLeft() const { return mPaddingLeft; } 53 int paddingRight() const { return mPaddingRight; } 54 int paddingTop() const { return mPaddingTop; } 55 void setFormPointer(void* form) { mForm = form; } 56 void setInputType(WebCore::HTMLInputElement::InputType type) { mInputType = type; } 57 void setIsRtlText(bool isRtlText) { mIsRtlText = isRtlText; } 58 void setIsTextField(bool isTextField) { mIsTextField = isTextField; } 59 void setMaxLength(int maxLength) { mMaxLength = maxLength; } 60 void setName(const WebCore::String& name) { mName = name; } 61 void setPaddingBottom(int bottom) { mPaddingBottom = bottom; } 62 void setPaddingLeft(int left) { mPaddingLeft = left; } 63 void setPaddingRight(int right) { mPaddingRight = right; } 64 void setPaddingTop(int top) { mPaddingTop = top; } 65 void setTextSize(int textSize) { mTextSize = textSize; } 66 int textSize() const { return mTextSize; } 67 private: 68 void* mForm; 69 WebCore::HTMLInputElement::InputType mInputType; 70 int mMaxLength; 71 WebCore::String mName; 72 int mPaddingBottom; 73 int mPaddingLeft; 74 int mPaddingRight; 75 int mPaddingTop; 76 int mTextSize; 77 bool mIsRtlText : 1; 78 bool mIsTextField : 1; 79 #if DUMP_NAV_CACHE 80 public: 81 class Debug { 82 public: 83 CachedInput* base() const; 84 void print() const; 85 } mDebug; 86 #endif 87 }; 88 89 } 90 91 #endif 92