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 WMLFormControlElement::~WMLFormControlElement() 39 { 40 } 41 42 bool WMLFormControlElement::supportsFocus() const 43 { 44 return true; 45 } 46 47 bool WMLFormControlElement::isFocusable() const 48 { 49 if (!renderer() || !renderer()->isBox()) 50 return false; 51 52 if (toRenderBox(renderer())->size().isEmpty()) 53 return false; 54 55 return WMLElement::isFocusable(); 56 } 57 58 59 void WMLFormControlElement::attach() 60 { 61 ASSERT(!attached()); 62 WMLElement::attach(); 63 64 // The call to updateFromElement() needs to go after the call through 65 // to the base class's attach() because that can sometimes do a close 66 // on the renderer. 67 if (renderer()) 68 renderer()->updateFromElement(); 69 } 70 71 void WMLFormControlElement::recalcStyle(StyleChange change) 72 { 73 WMLElement::recalcStyle(change); 74 75 if (renderer()) 76 renderer()->updateFromElement(); 77 } 78 79 } 80 81 #endif 82