1 /** 2 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 * 19 */ 20 21 #include "config.h" 22 23 #if ENABLE(WML) 24 #include "WMLFormControlElement.h" 25 26 #include "RenderBox.h" 27 #include "RenderObject.h" 28 #include "RenderStyle.h" 29 30 namespace WebCore { 31 32 WMLFormControlElement::WMLFormControlElement(const QualifiedName& tagName, Document* document) 33 : WMLElement(tagName, document) 34 , m_valueMatchesRenderer(false) 35 { 36 } 37 38 PassRefPtr<WMLFormControlElement> WMLFormControlElement::create(const QualifiedName& tagName, Document* document) 39 { 40 return adoptRef(new WMLFormControlElement(tagName, document)); 41 } 42 43 WMLFormControlElement::~WMLFormControlElement() 44 { 45 } 46 47 bool WMLFormControlElement::supportsFocus() const 48 { 49 return true; 50 } 51 52 bool WMLFormControlElement::isFocusable() const 53 { 54 if (!renderer() || !renderer()->isBox()) 55 return false; 56 57 if (toRenderBox(renderer())->size().isEmpty()) 58 return false; 59 60 return WMLElement::isFocusable(); 61 } 62 63 64 void WMLFormControlElement::attach() 65 { 66 ASSERT(!attached()); 67 WMLElement::attach(); 68 69 // The call to updateFromElement() needs to go after the call through 70 // to the base class's attach() because that can sometimes do a close 71 // on the renderer. 72 if (renderer()) 73 renderer()->updateFromElement(); 74 } 75 76 void WMLFormControlElement::recalcStyle(StyleChange change) 77 { 78 WMLElement::recalcStyle(change); 79 80 if (renderer()) 81 renderer()->updateFromElement(); 82 } 83 84 } 85 86 #endif 87