summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/wml
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-15 09:57:36 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-15 09:57:36 (GMT)
commit336dfcef05cb63df0a6d550b59a4badc7a0f01c1 (patch)
treea218ec97413e0c8ebc9600ac5db9b2adea485b32 /src/3rdparty/webkit/WebCore/wml
parente44d64510e019e5d3b379b704cfb824e0d7ccc9d (diff)
downloadQt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.zip
Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.tar.gz
Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.tar.bz2
Merge of master
Diffstat (limited to 'src/3rdparty/webkit/WebCore/wml')
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAElement.cpp19
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAccessElement.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLAttributeNames.in2
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLBRElement.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp25
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLCardElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLDoElement.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLDocument.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLDocument.h2
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLElement.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLElement.h3
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.cpp27
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.h16
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLFieldSetElement.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.cpp80
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.h53
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLGoElement.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLImageElement.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLImageLoader.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLInputElement.cpp507
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLInputElement.h110
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.cpp7
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.h2
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLMetaElement.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLNoopElement.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOnEventElement.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.cpp175
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.h69
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOptionElement.cpp163
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLOptionElement.h69
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPElement.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp224
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h94
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTableElement.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTagNames.in11
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.cpp7
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.h5
-rw-r--r--src/3rdparty/webkit/WebCore/wml/WMLTimerElement.cpp1
40 files changed, 1651 insertions, 77 deletions
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLAElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLAElement.cpp
index b3a8ecc..5fbeac6 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLAElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLAElement.cpp
@@ -37,8 +37,9 @@
#include "FrameLoader.h"
#include "HTMLNames.h"
#include "KeyboardEvent.h"
+#include "MappedAttribute.h"
#include "MouseEvent.h"
-#include "RenderFlow.h"
+#include "RenderBox.h"
#include "WMLNames.h"
namespace WebCore {
@@ -56,7 +57,7 @@ void WMLAElement::parseMappedAttribute(MappedAttribute* attr)
bool wasLink = isLink();
setIsLink(!attr->isNull());
if (wasLink != isLink())
- setChanged();
+ setNeedsStyleRecalc();
if (isLink() && document()->isDNSPrefetchEnabled()) {
String value = attr->value();
if (protocolIs(value, "http") || protocolIs(value, "https") || value.startsWith("//"))
@@ -101,12 +102,14 @@ bool WMLAElement::isKeyboardFocusable(KeyboardEvent* event) const
if (!document()->frame()->eventHandler()->tabsToLinks(event))
return false;
+ if (!renderer() || !renderer()->isBoxModelObject())
+ return false;
+
// Before calling absoluteRects, check for the common case where the renderer
- // or one of the continuations is non-empty, since this is a faster check and
- // almost always returns true.
- for (RenderObject* r = renderer(); r; r = r->continuation())
- if (r->width() > 0 && r->height() > 0)
- return true;
+ // is non-empty, since this is a faster check and almost always returns true.
+ RenderBoxModelObject* box = toRenderBoxModelObject(renderer());
+ if (!box->borderBoundingBox().isEmpty())
+ return true;
Vector<IntRect> rects;
FloatPoint absPos = renderer()->localToAbsolute();
@@ -148,7 +151,7 @@ void WMLAElement::defaultEventHandler(Event* event)
if (!event->defaultPrevented() && document()->frame()) {
KURL url = document()->completeURL(parseURL(getAttribute(HTMLNames::hrefAttr)));
- document()->frame()->loader()->urlSelected(url, target(), event, false, true);
+ document()->frame()->loader()->urlSelected(url, target(), event, false, false, true);
}
event->setDefaultHandled();
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLAccessElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLAccessElement.cpp
index 7668c74..db0ab67 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLAccessElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLAccessElement.cpp
@@ -23,6 +23,7 @@
#if ENABLE(WML)
#include "WMLAccessElement.h"
+#include "MappedAttribute.h"
#include "WMLDocument.h"
#include "WMLNames.h"
#include "WMLVariables.h"
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLAttributeNames.in b/src/3rdparty/webkit/WebCore/wml/WMLAttributeNames.in
index 9c0e8c5..e2711fb 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLAttributeNames.in
+++ b/src/3rdparty/webkit/WebCore/wml/WMLAttributeNames.in
@@ -1,7 +1,7 @@
namespace="WML"
namespaceURI="http://www.wapforum.org/DTD/wml_1.1.xml"
guardFactoryWith="ENABLE(WML)"
-attrsNullNamespace="1"
+attrsNullNamespace
cache_control
columns
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLBRElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLBRElement.cpp
index 7bd6360..035619f 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLBRElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLBRElement.cpp
@@ -30,6 +30,7 @@
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "RenderBR.h"
namespace WebCore {
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp
index a2555a4..c8e92af 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -26,10 +26,12 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "NodeList.h"
#include "RenderStyle.h"
#include "WMLDocument.h"
#include "WMLDoElement.h"
+#include "WMLInputElement.h"
#include "WMLIntrinsicEventHandler.h"
#include "WMLNames.h"
#include "WMLTemplateElement.h"
@@ -41,13 +43,14 @@ namespace WebCore {
using namespace WMLNames;
WMLCardElement::WMLCardElement(const QualifiedName& tagName, Document* doc)
- : WMLEventHandlingElement(tagName, doc)
+ : WMLElement(tagName, doc)
, m_isNewContext(false)
, m_isOrdered(false)
, m_isVisible(false)
, m_eventTimer(0)
, m_template(0)
{
+ ASSERT(hasTagName(cardTag));
}
WMLCardElement::~WMLCardElement()
@@ -162,16 +165,18 @@ void WMLCardElement::handleIntrinsicEventIfNeeded()
if (m_eventTimer)
m_eventTimer->start();
- // FIXME: Initialize input/select elements in this card
- /*
- Node* node = this;
- while (node = node->traverseNextNode()) {
+ // FIXME: Initialize select elements in this card
+ for (Node* node = traverseNextNode(); node != 0; node = node->traverseNextNode()) {
+ if (!node->isElementNode())
+ continue;
+
if (node->hasTagName(inputTag))
- static_cast<WMLInputElement*>(node)->init();
+ static_cast<WMLInputElement*>(node)->initialize();
+ /*
else if (node->hasTagName(selectTag))
static_cast<WMLSelectElement*>(node)->selectInitialOptions();
+ */
}
- */
}
void WMLCardElement::handleDeckLevelTaskOverridesIfNeeded()
@@ -216,7 +221,7 @@ void WMLCardElement::parseMappedAttribute(MappedAttribute* attr)
else if (attr->name() == orderedAttr)
m_isOrdered = (attr->value() == "true");
else {
- WMLEventHandlingElement::parseMappedAttribute(attr);
+ WMLElement::parseMappedAttribute(attr);
return;
}
@@ -232,7 +237,7 @@ void WMLCardElement::parseMappedAttribute(MappedAttribute* attr)
void WMLCardElement::insertedIntoDocument()
{
- WMLEventHandlingElement::insertedIntoDocument();
+ WMLElement::insertedIntoDocument();
// The first card inserted into a document, is visible by default.
if (!m_isVisible) {
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLCardElement.h b/src/3rdparty/webkit/WebCore/wml/WMLCardElement.h
index 5bc763a..972961e 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLCardElement.h
+++ b/src/3rdparty/webkit/WebCore/wml/WMLCardElement.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -31,7 +31,7 @@ namespace WebCore {
class WMLTemplateElement;
class WMLTimerElement;
-class WMLCardElement : public WMLEventHandlingElement {
+class WMLCardElement : public WMLElement, public WMLEventHandlingElement {
public:
WMLCardElement(const QualifiedName&, Document*);
virtual ~WMLCardElement();
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLDoElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLDoElement.cpp
index 8739e5c..916bc6e 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLDoElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLDoElement.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -27,6 +27,7 @@
#include "EventNames.h"
#include "HTMLNames.h"
#include "KeyboardEvent.h"
+#include "MappedAttribute.h"
#include "Page.h"
#include "RenderButton.h"
#include "WMLCardElement.h"
@@ -119,11 +120,8 @@ void WMLDoElement::insertedIntoDocument()
if (!parent || !parent->isWMLElement())
return;
- WMLElement* parentElement = static_cast<WMLElement*>(parent);
- if (!parentElement->isWMLEventHandlingElement())
- return;
-
- static_cast<WMLEventHandlingElement*>(parentElement)->registerDoElement(this);
+ if (WMLEventHandlingElement* eventHandlingElement = toWMLEventHandlingElement(static_cast<WMLElement*>(parent)))
+ eventHandlingElement->registerDoElement(this, document());
}
RenderObject* WMLDoElement::createRenderer(RenderArena* arena, RenderStyle* style)
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLDocument.cpp b/src/3rdparty/webkit/WebCore/wml/WMLDocument.cpp
index 36c436f..7f73848 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLDocument.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLDocument.cpp
@@ -61,6 +61,12 @@ void WMLDocument::finishedParsing()
// Remember that we'e successfully entered the deck
wmlPageState->setNeedCheckDeckAccess(false);
+ initialize();
+ Document::finishedParsing();
+}
+
+void WMLDocument::initialize()
+{
// Notify the existance of templates to all cards of the current deck
WMLTemplateElement::registerTemplatesInDocument(this);
@@ -77,8 +83,6 @@ void WMLDocument::finishedParsing()
// Handle card-level intrinsic event
card->handleIntrinsicEventIfNeeded();
-
- Document::finishedParsing();
}
WMLPageState* wmlPageStateForDocument(Document* doc)
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLDocument.h b/src/3rdparty/webkit/WebCore/wml/WMLDocument.h
index d7eb8b2..9189085 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLDocument.h
+++ b/src/3rdparty/webkit/WebCore/wml/WMLDocument.h
@@ -40,6 +40,8 @@ public:
virtual bool isWMLDocument() const { return true; }
virtual void finishedParsing();
+ void initialize();
+
private:
WMLDocument(Frame*);
};
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLElement.cpp
index c88c5d3..e818f9d 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLElement.cpp
@@ -25,6 +25,7 @@
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "RenderObject.h"
#include "WMLErrorHandling.h"
#include "WMLNames.h"
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLElement.h b/src/3rdparty/webkit/WebCore/wml/WMLElement.h
index e5421da..61bd98f 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLElement.h
+++ b/src/3rdparty/webkit/WebCore/wml/WMLElement.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -32,7 +32,6 @@ public:
WMLElement(const QualifiedName& tagName, Document*);
virtual bool isWMLElement() const { return true; }
- virtual bool isWMLEventHandlingElement() const { return false; }
virtual bool isWMLTaskElement() const { return false; }
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.cpp
index 69b2f8e..2848985 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -23,17 +23,19 @@
#if ENABLE(WML)
#include "WMLEventHandlingElement.h"
+#include "WMLCardElement.h"
#include "WMLDoElement.h"
#include "WMLIntrinsicEventHandler.h"
+#include "WMLOptionElement.h"
#include "WMLTaskElement.h"
+#include "WMLTemplateElement.h"
#include "WMLNames.h"
namespace WebCore {
using namespace WMLNames;
-WMLEventHandlingElement::WMLEventHandlingElement(const QualifiedName& tagName, Document* doc)
- : WMLElement(tagName, doc)
+WMLEventHandlingElement::WMLEventHandlingElement()
{
}
@@ -47,14 +49,14 @@ void WMLEventHandlingElement::createEventHandlerIfNeeded()
m_eventHandler.set(new WMLIntrinsicEventHandler);
}
-void WMLEventHandlingElement::registerDoElement(WMLDoElement* doElement)
+void WMLEventHandlingElement::registerDoElement(WMLDoElement* doElement, Document* document)
{
Vector<WMLDoElement*>::iterator it = m_doElements.begin();
Vector<WMLDoElement*>::iterator end = m_doElements.end();
for (; it != end; ++it) {
if ((*it)->name() == doElement->name()) {
- reportWMLError(document(), WMLErrorDuplicatedDoElement);
+ reportWMLError(document, WMLErrorDuplicatedDoElement);
return;
}
}
@@ -63,6 +65,21 @@ void WMLEventHandlingElement::registerDoElement(WMLDoElement* doElement)
doElement->setActive(true);
}
+WMLEventHandlingElement* toWMLEventHandlingElement(WMLElement* element)
+{
+ if (!element->isWMLElement())
+ return 0;
+
+ if (element->hasTagName(cardTag))
+ return static_cast<WMLCardElement*>(element);
+ else if (element->hasTagName(optionTag))
+ return static_cast<WMLOptionElement*>(element);
+ else if (element->hasTagName(templateTag))
+ return static_cast<WMLTemplateElement*>(element);
+
+ return 0;
+}
+
}
#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.h b/src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.h
index cb66e53..92ae289 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.h
+++ b/src/3rdparty/webkit/WebCore/wml/WMLEventHandlingElement.h
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,7 +22,6 @@
#define WMLEventHandlingElement_h
#if ENABLE(WML)
-#include "WMLElement.h"
#include "WMLIntrinsicEventHandler.h"
#include <wtf/OwnPtr.h>
@@ -30,26 +29,27 @@
namespace WebCore {
+class WMLElement;
class WMLDoElement;
-class WMLEventHandlingElement : public WMLElement {
+class WMLEventHandlingElement {
public:
- WMLEventHandlingElement(const QualifiedName& tagName, Document*);
- virtual ~WMLEventHandlingElement();
-
- virtual bool isWMLEventHandlingElement() const { return true; }
+ WMLEventHandlingElement();
+ ~WMLEventHandlingElement();
WMLIntrinsicEventHandler* eventHandler() const { return m_eventHandler.get(); }
void createEventHandlerIfNeeded();
Vector<WMLDoElement*>& doElements() { return m_doElements; }
- void registerDoElement(WMLDoElement*);
+ void registerDoElement(WMLDoElement*, Document*);
private:
OwnPtr<WMLIntrinsicEventHandler> m_eventHandler;
Vector<WMLDoElement*> m_doElements;
};
+WMLEventHandlingElement* toWMLEventHandlingElement(WMLElement*);
+
}
#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLFieldSetElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLFieldSetElement.cpp
index d32f9b1..8146375 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLFieldSetElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLFieldSetElement.cpp
@@ -24,6 +24,7 @@
#include "WMLFieldSetElement.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "RenderFieldset.h"
#include "Text.h"
#include "WMLElementFactory.h"
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.cpp
new file mode 100644
index 0000000..f849ac8
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.cpp
@@ -0,0 +1,80 @@
+/**
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#if ENABLE(WML)
+#include "WMLFormControlElement.h"
+
+#include "RenderBox.h"
+#include "RenderObject.h"
+#include "RenderStyle.h"
+
+namespace WebCore {
+
+WMLFormControlElement::WMLFormControlElement(const QualifiedName& tagName, Document* document)
+ : WMLElement(tagName, document)
+ , m_valueMatchesRenderer(false)
+{
+}
+
+WMLFormControlElement::~WMLFormControlElement()
+{
+}
+
+bool WMLFormControlElement::isFocusable() const
+{
+ if (!renderer() || !renderer()->isBox())
+ return false;
+
+ if (toRenderBox(renderer())->size().isEmpty())
+ return false;
+
+ if (RenderStyle* style = renderer()->style()) {
+ if (style->visibility() != VISIBLE)
+ return false;
+ }
+
+ return true;
+}
+
+void WMLFormControlElement::attach()
+{
+ ASSERT(!attached());
+ WMLElement::attach();
+
+ // The call to updateFromElement() needs to go after the call through
+ // to the base class's attach() because that can sometimes do a close
+ // on the renderer.
+ if (renderer())
+ renderer()->updateFromElement();
+}
+
+void WMLFormControlElement::recalcStyle(StyleChange change)
+{
+ WMLElement::recalcStyle(change);
+
+ if (renderer())
+ renderer()->updateFromElement();
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.h b/src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.h
new file mode 100644
index 0000000..dde86ed
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLFormControlElement.h
@@ -0,0 +1,53 @@
+/**
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WMLFormControlElement_h
+#define WMLFormControlElement_h
+
+#if ENABLE(WML)
+#include "WMLElement.h"
+
+namespace WebCore {
+
+class WMLFormControlElement : public WMLElement {
+public:
+ WMLFormControlElement(const QualifiedName&, Document*);
+ virtual ~WMLFormControlElement();
+
+ virtual bool isFormControlElement() const { return true; }
+ virtual bool isReadOnlyFormControl() const { return false; }
+ virtual bool isTextFormControl() const { return false; }
+
+ virtual bool formControlValueMatchesRenderer() const { return m_valueMatchesRenderer; }
+ virtual void setFormControlValueMatchesRenderer(bool b = true) { m_valueMatchesRenderer = b; }
+
+ virtual bool isFocusable() const;
+
+ virtual void attach();
+ virtual void recalcStyle(StyleChange);
+
+private:
+ bool m_valueMatchesRenderer;
+};
+
+}
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLGoElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLGoElement.cpp
index 5ecf495..7293e66 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLGoElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLGoElement.cpp
@@ -28,6 +28,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "ResourceRequest.h"
#include "TextEncoding.h"
#include "WMLCardElement.h"
@@ -64,7 +65,7 @@ void WMLGoElement::parseMappedAttribute(MappedAttribute* attr)
WMLTaskElement::parseMappedAttribute(attr);
}
-void WMLGoElement::executeTask(Event* event)
+void WMLGoElement::executeTask(Event*)
{
Document* doc = document();
WMLPageState* pageState = wmlPageStateForDocument(doc);
@@ -131,7 +132,7 @@ void WMLGoElement::executeTask(Event* event)
request.setCachePolicy(ReloadIgnoringCacheData);
}
- loader->load(request);
+ loader->load(request, false);
}
void WMLGoElement::preparePOSTRequest(ResourceRequest& request, bool inSameDeck, const String& cacheControl)
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLImageElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLImageElement.cpp
index 05ed9a0..d47868a 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLImageElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLImageElement.cpp
@@ -27,6 +27,7 @@
#include "CSSValueKeywords.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "RenderImage.h"
#include "WMLNames.h"
#include "WMLVariables.h"
@@ -70,7 +71,7 @@ void WMLImageElement::parseMappedAttribute(MappedAttribute* attr)
if (attrName == HTMLNames::altAttr) {
if (renderer() && renderer()->isImage())
- static_cast<RenderImage*>(renderer())->updateAltText();
+ toRenderImage(renderer())->updateAltText();
} else if (attrName == HTMLNames::srcAttr || attrName == localsrcAttr)
m_imageLoader.updateFromElementIgnoringPreviousError();
else if (attrName == HTMLNames::widthAttr)
@@ -94,7 +95,7 @@ void WMLImageElement::attach()
WMLElement::attach();
if (renderer() && renderer()->isImage()) {
- RenderImage* imageObj = static_cast<RenderImage*>(renderer());
+ RenderImage* imageObj = toRenderImage(renderer());
if (imageObj->hasImage())
return;
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLImageLoader.cpp b/src/3rdparty/webkit/WebCore/wml/WMLImageLoader.cpp
index a1a020d..c77b511 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLImageLoader.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLImageLoader.cpp
@@ -45,10 +45,6 @@ WMLImageLoader::~WMLImageLoader()
void WMLImageLoader::dispatchLoadEvent()
{
// WML doesn't fire any events.
- if (haveFiredLoadEvent())
- return;
-
- setHaveFiredLoadEvent(true);
}
String WMLImageLoader::sourceURI(const AtomicString& attr) const
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLInputElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLInputElement.cpp
new file mode 100644
index 0000000..cb824d1
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLInputElement.cpp
@@ -0,0 +1,507 @@
+/**
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#if ENABLE(WML)
+#include "WMLInputElement.h"
+
+#include "EventNames.h"
+#include "FormDataList.h"
+#include "Frame.h"
+#include "HTMLNames.h"
+#include "KeyboardEvent.h"
+#include "MappedAttribute.h"
+#include "RenderTextControlSingleLine.h"
+#include "TextEvent.h"
+#include "WMLDocument.h"
+#include "WMLNames.h"
+#include "WMLPageState.h"
+
+namespace WebCore {
+
+WMLInputElement::WMLInputElement(const QualifiedName& tagName, Document* doc)
+ : WMLFormControlElement(tagName, doc)
+ , m_isPasswordField(false)
+ , m_isEmptyOk(false)
+ , m_numOfCharsAllowedByMask(0)
+{
+}
+
+WMLInputElement::~WMLInputElement()
+{
+ if (m_isPasswordField)
+ document()->unregisterForDocumentActivationCallbacks(this);
+}
+
+static const AtomicString& formatCodes()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, codes, ("AaNnXxMm"));
+ return codes;
+}
+
+bool WMLInputElement::isKeyboardFocusable(KeyboardEvent*) const
+{
+ return WMLFormControlElement::isFocusable();
+}
+
+bool WMLInputElement::isMouseFocusable() const
+{
+ return WMLFormControlElement::isFocusable();
+}
+
+void WMLInputElement::dispatchFocusEvent()
+{
+ InputElement::dispatchFocusEvent(m_data, this, this);
+ WMLElement::dispatchFocusEvent();
+}
+
+void WMLInputElement::dispatchBlurEvent()
+{
+ // Firstly check if it is allowed to leave this input field
+ String val = value();
+ if ((!m_isEmptyOk && val.isEmpty()) || !isConformedToInputMask(val)) {
+ updateFocusAppearance(true);
+ return;
+ }
+
+ // update the name variable of WML input elmenet
+ String nameVariable = formControlName();
+ if (!nameVariable.isEmpty())
+ wmlPageStateForDocument(document())->storeVariable(nameVariable, val);
+
+ InputElement::dispatchBlurEvent(m_data, this, this);
+ WMLElement::dispatchBlurEvent();
+}
+
+void WMLInputElement::updateFocusAppearance(bool restorePreviousSelection)
+{
+ InputElement::updateFocusAppearance(m_data, this, this, restorePreviousSelection);
+}
+
+void WMLInputElement::aboutToUnload()
+{
+ InputElement::aboutToUnload(this, this);
+}
+
+int WMLInputElement::size() const
+{
+ return m_data.size();
+}
+
+const AtomicString& WMLInputElement::formControlType() const
+{
+ // needs to be lowercase according to DOM spec
+ if (m_isPasswordField) {
+ DEFINE_STATIC_LOCAL(const AtomicString, password, ("password"));
+ return password;
+ }
+
+ DEFINE_STATIC_LOCAL(const AtomicString, text, ("text"));
+ return text;
+}
+
+const AtomicString& WMLInputElement::formControlName() const
+{
+ return m_data.name();
+}
+
+String WMLInputElement::value() const
+{
+ String value = m_data.value();
+ if (value.isNull())
+ value = constrainValue(getAttribute(HTMLNames::valueAttr));
+
+ return value;
+}
+
+void WMLInputElement::setValue(const String& value)
+{
+ InputElement::updatePlaceholderVisibility(m_data, this, this);
+ setFormControlValueMatchesRenderer(false);
+ m_data.setValue(constrainValue(value));
+ if (inDocument())
+ document()->updateStyleIfNeeded();
+ if (renderer())
+ renderer()->updateFromElement();
+ setNeedsStyleRecalc();
+
+ unsigned max = m_data.value().length();
+ if (document()->focusedNode() == this)
+ InputElement::updateSelectionRange(this, this, max, max);
+ else
+ cacheSelection(max, max);
+
+ InputElement::notifyFormStateChanged(this);
+}
+
+void WMLInputElement::setValueFromRenderer(const String& value)
+{
+ InputElement::setValueFromRenderer(m_data, this, this, value);
+}
+
+bool WMLInputElement::saveFormControlState(String& result) const
+{
+ if (m_isPasswordField)
+ return false;
+
+ result = value();
+ return true;
+}
+
+void WMLInputElement::restoreFormControlState(const String& state)
+{
+ ASSERT(!m_isPasswordField); // should never save/restore password fields
+ setValue(state);
+}
+
+void WMLInputElement::select()
+{
+ if (RenderTextControl* r = toRenderTextControl(renderer()))
+ r->select();
+}
+
+void WMLInputElement::accessKeyAction(bool)
+{
+ // should never restore previous selection here
+ focus(false);
+}
+
+void WMLInputElement::parseMappedAttribute(MappedAttribute* attr)
+{
+ if (attr->name() == HTMLNames::nameAttr)
+ m_data.setName(parseValueForbiddingVariableReferences(attr->value()));
+ else if (attr->name() == HTMLNames::typeAttr) {
+ String type = parseValueForbiddingVariableReferences(attr->value());
+ m_isPasswordField = (type == "password");
+ } else if (attr->name() == HTMLNames::valueAttr) {
+ // We only need to setChanged if the form is looking at the default value right now.
+ if (m_data.value().isNull())
+ setNeedsStyleRecalc();
+ setFormControlValueMatchesRenderer(false);
+ } else if (attr->name() == HTMLNames::maxlengthAttr)
+ InputElement::parseMaxLengthAttribute(m_data, this, this, attr);
+ else if (attr->name() == HTMLNames::sizeAttr)
+ InputElement::parseSizeAttribute(m_data, this, attr);
+ else if (attr->name() == WMLNames::formatAttr)
+ m_formatMask = validateInputMask(parseValueForbiddingVariableReferences(attr->value()));
+ else if (attr->name() == WMLNames::emptyokAttr)
+ m_isEmptyOk = (attr->value() == "true");
+ else
+ WMLElement::parseMappedAttribute(attr);
+
+ // FIXME: Handle 'accesskey' attribute
+ // FIXME: Handle 'tabindex' attribute
+ // FIXME: Handle 'title' attribute
+}
+
+void WMLInputElement::copyNonAttributeProperties(const Element* source)
+{
+ const WMLInputElement* sourceElement = static_cast<const WMLInputElement*>(source);
+ m_data.setValue(sourceElement->m_data.value());
+ WMLElement::copyNonAttributeProperties(source);
+}
+
+RenderObject* WMLInputElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+ return new (arena) RenderTextControlSingleLine(this);
+}
+
+void WMLInputElement::detach()
+{
+ WMLElement::detach();
+ setFormControlValueMatchesRenderer(false);
+}
+
+bool WMLInputElement::appendFormData(FormDataList& encoding, bool)
+{
+ if (formControlName().isEmpty())
+ return false;
+
+ encoding.appendData(formControlName(), value());
+ return true;
+}
+
+void WMLInputElement::reset()
+{
+ setValue(String());
+}
+
+void WMLInputElement::defaultEventHandler(Event* evt)
+{
+ bool clickDefaultFormButton = false;
+
+ if (evt->type() == eventNames().textInputEvent && evt->isTextEvent()) {
+ TextEvent* textEvent = static_cast<TextEvent*>(evt);
+ if (textEvent->data() == "\n")
+ clickDefaultFormButton = true;
+ else if (renderer() && !isConformedToInputMask(textEvent->data()[0], toRenderTextControl(renderer())->text().length() + 1))
+ // If the inputed char doesn't conform to the input mask, stop handling
+ return;
+ }
+
+ if (evt->type() == eventNames().keydownEvent && evt->isKeyboardEvent() && focused() && document()->frame()
+ && document()->frame()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt))) {
+ evt->setDefaultHandled();
+ return;
+ }
+
+ // Let the key handling done in EventTargetNode take precedence over the event handling here for editable text fields
+ if (!clickDefaultFormButton) {
+ WMLElement::defaultEventHandler(evt);
+ if (evt->defaultHandled())
+ return;
+ }
+
+ // Use key press event here since sending simulated mouse events
+ // on key down blocks the proper sending of the key press event.
+ if (evt->type() == eventNames().keypressEvent && evt->isKeyboardEvent()) {
+ // Simulate mouse click on the default form button for enter for these types of elements.
+ if (static_cast<KeyboardEvent*>(evt)->charCode() == '\r')
+ clickDefaultFormButton = true;
+ }
+
+ if (clickDefaultFormButton) {
+ // Fire onChange for text fields.
+ RenderObject* r = renderer();
+ if (r && toRenderTextControl(r)->isEdited()) {
+ dispatchEvent(eventNames().changeEvent, true, false);
+
+ // Refetch the renderer since arbitrary JS code run during onchange can do anything, including destroying it.
+ r = renderer();
+ if (r)
+ toRenderTextControl(r)->setEdited(false);
+ }
+
+ evt->setDefaultHandled();
+ return;
+ }
+
+ if (evt->isBeforeTextInsertedEvent())
+ InputElement::handleBeforeTextInsertedEvent(m_data, this, document(), evt);
+
+ if (renderer() && (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent() || evt->type() == eventNames().blurEvent || evt->type() == eventNames().focusEvent))
+ static_cast<RenderTextControlSingleLine*>(renderer())->forwardEvent(evt);
+}
+
+void WMLInputElement::cacheSelection(int start, int end)
+{
+ m_data.setCachedSelectionStart(start);
+ m_data.setCachedSelectionEnd(end);
+}
+
+String WMLInputElement::constrainValue(const String& proposedValue) const
+{
+ return InputElement::constrainValue(this, proposedValue, m_data.maxLength());
+}
+
+void WMLInputElement::documentDidBecomeActive()
+{
+ ASSERT(m_isPasswordField);
+ reset();
+}
+
+bool WMLInputElement::placeholderShouldBeVisible() const
+{
+ return m_data.placeholderShouldBeVisible();
+}
+
+void WMLInputElement::willMoveToNewOwnerDocument()
+{
+ // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
+ if (m_isPasswordField)
+ document()->unregisterForDocumentActivationCallbacks(this);
+
+ WMLElement::willMoveToNewOwnerDocument();
+}
+
+void WMLInputElement::didMoveToNewOwnerDocument()
+{
+ if (m_isPasswordField)
+ document()->registerForDocumentActivationCallbacks(this);
+
+ WMLElement::didMoveToNewOwnerDocument();
+}
+
+void WMLInputElement::initialize()
+{
+ String nameVariable = formControlName();
+ String variableValue;
+ WMLPageState* pageSate = wmlPageStateForDocument(document());
+ ASSERT(pageSate);
+ if (!nameVariable.isEmpty())
+ variableValue = pageSate->getVariable(nameVariable);
+
+ if (variableValue.isEmpty() || !isConformedToInputMask(variableValue)) {
+ String val = value();
+ if (isConformedToInputMask(val))
+ variableValue = val;
+ else
+ variableValue = "";
+
+ pageSate->storeVariable(nameVariable, variableValue);
+ }
+ setValue(variableValue);
+
+ if (!hasAttribute(WMLNames::emptyokAttr)) {
+ if (m_formatMask.isEmpty() ||
+ // check if the format codes is just "*f"
+ (m_formatMask.length() == 2 && m_formatMask[0] == '*' && formatCodes().find(m_formatMask[1]) != -1))
+ m_isEmptyOk = true;
+ }
+}
+
+String WMLInputElement::validateInputMask(const String& inputMask)
+{
+ bool isValid = true;
+ bool hasWildcard = false;
+ unsigned escapeCharCount = 0;
+ unsigned maskLength = inputMask.length();
+ UChar formatCode;
+
+ for (unsigned i = 0; i < maskLength; ++i) {
+ formatCode = inputMask[i];
+ if (formatCodes().find(formatCode) == -1) {
+ if (formatCode == '*' || (WTF::isASCIIDigit(formatCode) && formatCode != '0')) {
+ // validate codes which ends with '*f' or 'nf'
+ formatCode = inputMask[++i];
+ if ((i + 1 != maskLength) || formatCodes().find(formatCode) == -1) {
+ isValid = false;
+ break;
+ }
+ hasWildcard = true;
+ } else if (formatCode == '\\') {
+ //skip over the next mask character
+ ++i;
+ ++escapeCharCount;
+ } else {
+ isValid = false;
+ break;
+ }
+ }
+ }
+
+ if (!isValid)
+ return String();
+
+ // calculate the number of characters allowed to be entered by input mask
+ m_numOfCharsAllowedByMask = maskLength;
+
+ if (escapeCharCount)
+ m_numOfCharsAllowedByMask -= escapeCharCount;
+
+ if (hasWildcard) {
+ formatCode = inputMask[maskLength - 2];
+ if (formatCode == '*')
+ m_numOfCharsAllowedByMask = m_data.maxLength();
+ else {
+ unsigned leftLen = String(&formatCode).toInt();
+ m_numOfCharsAllowedByMask = leftLen + m_numOfCharsAllowedByMask - 2;
+ }
+ }
+
+ return inputMask;
+}
+
+bool WMLInputElement::isConformedToInputMask(const String& inputChars)
+{
+ for (unsigned i = 0; i < inputChars.length(); ++i)
+ if (!isConformedToInputMask(inputChars[i], i + 1, false))
+ return false;
+
+ return true;
+}
+
+bool WMLInputElement::isConformedToInputMask(UChar inChar, unsigned inputCharCount, bool isUserInput)
+{
+ if (m_formatMask.isEmpty())
+ return true;
+
+ if (inputCharCount > m_numOfCharsAllowedByMask)
+ return false;
+
+ unsigned maskIndex = 0;
+ if (isUserInput) {
+ unsigned cursorPosition = 0;
+ if (renderer())
+ cursorPosition = toRenderTextControl(renderer())->selectionStart();
+ else
+ cursorPosition = m_data.cachedSelectionStart();
+
+ maskIndex = cursorPositionToMaskIndex(cursorPosition);
+ } else
+ maskIndex = cursorPositionToMaskIndex(inputCharCount - 1);
+
+ bool ok = true;
+ UChar mask = m_formatMask[maskIndex];
+ // match the inputed character with input mask
+ switch (mask) {
+ case 'A':
+ ok = !WTF::isASCIIDigit(inChar) && !WTF::isASCIILower(inChar) && WTF::isASCIIPrintable(inChar);
+ break;
+ case 'a':
+ ok = !WTF::isASCIIDigit(inChar) && !WTF::isASCIIUpper(inChar) && WTF::isASCIIPrintable(inChar);
+ break;
+ case 'N':
+ ok = WTF::isASCIIDigit(inChar);
+ break;
+ case 'n':
+ ok = !WTF::isASCIIAlpha(inChar) && WTF::isASCIIPrintable(inChar);
+ break;
+ case 'X':
+ ok = !WTF::isASCIILower(inChar) && WTF::isASCIIPrintable(inChar);
+ break;
+ case 'x':
+ ok = !WTF::isASCIIUpper(inChar) && WTF::isASCIIPrintable(inChar);
+ break;
+ case 'M':
+ ok = WTF::isASCIIPrintable(inChar);
+ break;
+ case 'm':
+ ok = WTF::isASCIIPrintable(inChar);
+ break;
+ default:
+ ok = (mask == inChar);
+ break;
+ }
+
+ return ok;
+}
+
+unsigned WMLInputElement::cursorPositionToMaskIndex(unsigned cursorPosition)
+{
+ UChar mask;
+ int index = -1;
+ do {
+ mask = m_formatMask[++index];
+ if (mask == '\\')
+ ++index;
+ else if (mask == '*' || (WTF::isASCIIDigit(mask) && mask != '0')) {
+ index = m_formatMask.length() - 1;
+ break;
+ }
+ } while (cursorPosition--);
+
+ return index;
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLInputElement.h b/src/3rdparty/webkit/WebCore/wml/WMLInputElement.h
new file mode 100644
index 0000000..7529968
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLInputElement.h
@@ -0,0 +1,110 @@
+/**
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WMLInputElement_h
+#define WMLInputElement_h
+
+#if ENABLE(WML)
+#include "WMLFormControlElement.h"
+#include "InputElement.h"
+
+namespace WebCore {
+
+class FormDataList;
+
+class WMLInputElement : public WMLFormControlElement, public InputElement {
+public:
+ WMLInputElement(const QualifiedName& tagName, Document*);
+ virtual ~WMLInputElement();
+
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isMouseFocusable() const;
+ virtual void dispatchFocusEvent();
+ virtual void dispatchBlurEvent();
+ virtual void updateFocusAppearance(bool restorePreviousSelection);
+ virtual void aboutToUnload();
+
+ virtual bool shouldUseInputMethod() const { return !m_isPasswordField; }
+ virtual bool isChecked() const { return false; }
+ virtual bool isAutofilled() const { return false; }
+ virtual bool isIndeterminate() const { return false; }
+ virtual bool isTextFormControl() const { return true; }
+ virtual bool isRadioButton() const { return false; }
+ virtual bool isTextField() const { return true; }
+ virtual bool isSearchField() const { return false; }
+ virtual bool isInputTypeHidden() const { return false; }
+ virtual bool isPasswordField() const { return m_isPasswordField; }
+ virtual bool searchEventsShouldBeDispatched() const { return false; }
+
+ virtual int size() const;
+ virtual const AtomicString& formControlType() const;
+ virtual const AtomicString& formControlName() const;
+ virtual String value() const;
+ virtual void setValue(const String&);
+ virtual String placeholder() const { return String(); }
+ virtual void setPlaceholder(const String&) { }
+ virtual void setValueFromRenderer(const String&);
+
+ virtual bool saveFormControlState(String& value) const;
+ virtual void restoreFormControlState(const String&);
+
+ virtual void select();
+ virtual void accessKeyAction(bool sendToAnyElement);
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void copyNonAttributeProperties(const Element* source);
+
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void detach();
+ virtual bool appendFormData(FormDataList&, bool);
+ virtual void reset();
+
+ virtual void defaultEventHandler(Event*);
+ virtual void cacheSelection(int start, int end);
+
+ virtual String constrainValue(const String& proposedValue) const;
+
+ virtual void documentDidBecomeActive();
+ virtual bool placeholderShouldBeVisible() const;
+
+ virtual void willMoveToNewOwnerDocument();
+ virtual void didMoveToNewOwnerDocument();
+
+ bool isConformedToInputMask(const String&);
+ bool isConformedToInputMask(UChar, unsigned, bool isUserInput = true);
+
+private:
+ friend class WMLCardElement;
+ void initialize();
+
+ String validateInputMask(const String&);
+ unsigned cursorPositionToMaskIndex(unsigned);
+
+ InputElementData m_data;
+ bool m_isPasswordField;
+ bool m_isEmptyOk;
+ String m_formatMask;
+ unsigned m_numOfCharsAllowedByMask;
+};
+
+}
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.cpp
index 7decd77..1464e71 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.cpp
@@ -23,8 +23,6 @@
#if ENABLE(WML)
#include "WMLInsertedLegendElement.h"
-#include "RenderLegend.h"
-
namespace WebCore {
WMLInsertedLegendElement::WMLInsertedLegendElement(const QualifiedName& tagName, Document* doc)
@@ -36,11 +34,6 @@ WMLInsertedLegendElement::~WMLInsertedLegendElement()
{
}
-RenderObject* WMLInsertedLegendElement::createRenderer(RenderArena* arena, RenderStyle*)
-{
- return new (arena) RenderLegend(this);
-}
-
}
#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.h b/src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.h
index d758487..73392ad 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.h
+++ b/src/3rdparty/webkit/WebCore/wml/WMLInsertedLegendElement.h
@@ -30,8 +30,6 @@ class WMLInsertedLegendElement : public WMLElement {
public:
WMLInsertedLegendElement(const QualifiedName& tagName, Document*);
virtual ~WMLInsertedLegendElement();
-
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
};
}
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLMetaElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLMetaElement.cpp
index 71bbf51..81109ae 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLMetaElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLMetaElement.cpp
@@ -25,6 +25,7 @@
#include "Document.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
namespace WebCore {
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLNoopElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLNoopElement.cpp
index 0460d9f..1ba1c18 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLNoopElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLNoopElement.cpp
@@ -53,7 +53,7 @@ void WMLNoopElement::insertedIntoDocument()
if (parent->hasTagName(doTag)) {
WMLDoElement* doElement = static_cast<WMLDoElement*>(parent);
doElement->setNoop(true);
- doElement->setChanged();
+ doElement->setNeedsStyleRecalc();
} else if (parent->hasTagName(anchorTag))
reportWMLError(document(), WMLErrorForbiddenTaskInAnchorElement);
}
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLOnEventElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLOnEventElement.cpp
index 2e9e519..a8d35a0 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLOnEventElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLOnEventElement.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -24,6 +24,7 @@
#include "WMLOnEventElement.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "WMLErrorHandling.h"
#include "WMLEventHandlingElement.h"
#include "WMLIntrinsicEventHandler.h"
@@ -71,11 +72,10 @@ void WMLOnEventElement::registerTask(WMLTaskElement* task)
if (!parent || !parent->isWMLElement())
return;
- WMLElement* parentElement = static_cast<WMLElement*>(parent);
- if (!parentElement->isWMLEventHandlingElement())
+ WMLEventHandlingElement* eventHandlingElement = toWMLEventHandlingElement(static_cast<WMLElement*>(parent));
+ if (!eventHandlingElement)
return;
- WMLEventHandlingElement* eventHandlingElement = static_cast<WMLEventHandlingElement*>(parentElement);
eventHandlingElement->createEventHandlerIfNeeded();
RefPtr<WMLIntrinsicEvent> event = WMLIntrinsicEvent::createWithTask(task);
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.cpp
new file mode 100644
index 0000000..d70731c
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.cpp
@@ -0,0 +1,175 @@
+/**
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#if ENABLE(WML)
+#include "WMLOptGroupElement.h"
+
+#include "Document.h"
+#include "MappedAttribute.h"
+#include "HTMLNames.h"
+#include "NodeRenderStyle.h"
+#include "RenderStyle.h"
+#include "WMLNames.h"
+#include "WMLSelectElement.h"
+
+namespace WebCore {
+
+using namespace WMLNames;
+
+WMLOptGroupElement::WMLOptGroupElement(const QualifiedName& tagName, Document* doc)
+ : WMLFormControlElement(tagName, doc)
+{
+}
+
+WMLOptGroupElement::~WMLOptGroupElement()
+{
+}
+
+const AtomicString& WMLOptGroupElement::formControlType() const
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, optgroup, ("optgroup"));
+ return optgroup;
+}
+
+bool WMLOptGroupElement::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, bool shouldLazyAttach)
+{
+ bool result = WMLFormControlElement::insertBefore(newChild, refChild, ec, shouldLazyAttach);
+ if (result)
+ recalcSelectOptions();
+ return result;
+}
+
+bool WMLOptGroupElement::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, bool shouldLazyAttach)
+{
+ bool result = WMLFormControlElement::replaceChild(newChild, oldChild, ec, shouldLazyAttach);
+ if (result)
+ recalcSelectOptions();
+ return result;
+}
+
+bool WMLOptGroupElement::removeChild(Node* oldChild, ExceptionCode& ec)
+{
+ bool result = WMLFormControlElement::removeChild(oldChild, ec);
+ if (result)
+ recalcSelectOptions();
+ return result;
+}
+
+bool WMLOptGroupElement::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bool shouldLazyAttach)
+{
+ bool result = WMLFormControlElement::appendChild(newChild, ec, shouldLazyAttach);
+ if (result)
+ recalcSelectOptions();
+ return result;
+}
+
+bool WMLOptGroupElement::removeChildren()
+{
+ bool result = WMLFormControlElement::removeChildren();
+ if (result)
+ recalcSelectOptions();
+ return result;
+}
+
+static inline WMLSelectElement* ownerSelectElement(Element* element)
+{
+ Node* select = element->parentNode();
+ while (select && !select->hasTagName(selectTag))
+ select = select->parentNode();
+
+ if (!select)
+ return 0;
+
+ return static_cast<WMLSelectElement*>(select);
+}
+
+void WMLOptGroupElement::accessKeyAction(bool)
+{
+ WMLSelectElement* select = ownerSelectElement(this);
+ if (!select || select->focused())
+ return;
+
+ // send to the parent to bring focus to the list box
+ select->accessKeyAction(false);
+}
+
+void WMLOptGroupElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+ recalcSelectOptions();
+ WMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+}
+
+void WMLOptGroupElement::parseMappedAttribute(MappedAttribute* attr)
+{
+ if (attr->name() == HTMLNames::titleAttr) {
+ m_title = parseValueSubstitutingVariableReferences(attr->value());
+ return;
+ }
+
+ WMLFormControlElement::parseMappedAttribute(attr);
+ recalcSelectOptions();
+}
+
+void WMLOptGroupElement::attach()
+{
+ if (parentNode()->renderStyle())
+ setRenderStyle(styleForRenderer());
+ WMLFormControlElement::attach();
+}
+
+void WMLOptGroupElement::detach()
+{
+ m_style.clear();
+ WMLFormControlElement::detach();
+}
+
+void WMLOptGroupElement::setRenderStyle(PassRefPtr<RenderStyle> style)
+{
+ m_style = style;
+}
+
+RenderStyle* WMLOptGroupElement::nonRendererRenderStyle() const
+{
+ return m_style.get();
+}
+
+String WMLOptGroupElement::groupLabelText() const
+{
+ String itemText = document()->displayStringModifiedByEncoding(m_title);
+
+ // In WinIE, leading and trailing whitespace is ignored in options and optgroups. We match this behavior.
+ itemText = itemText.stripWhiteSpace();
+ // We want to collapse our whitespace too. This will match other browsers.
+ itemText = itemText.simplifyWhiteSpace();
+
+ return itemText;
+}
+
+void WMLOptGroupElement::recalcSelectOptions()
+{
+ if (WMLSelectElement* select = ownerSelectElement(this))
+ select->setRecalcListItems();
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.h b/src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.h
new file mode 100644
index 0000000..1ba5ac1
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLOptGroupElement.h
@@ -0,0 +1,69 @@
+/**
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WMLOptGroupElement_h
+#define WMLOptGroupElement_h
+
+#if ENABLE(WML)
+#include "WMLFormControlElement.h"
+#include "OptionGroupElement.h"
+
+namespace WebCore {
+
+class WMLOptGroupElement : public WMLFormControlElement, public OptionGroupElement {
+public:
+ WMLOptGroupElement(const QualifiedName& tagName, Document*);
+ virtual ~WMLOptGroupElement();
+
+ String title() const { return m_title; }
+
+ virtual const AtomicString& formControlType() const;
+
+ virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+
+ virtual bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool removeChild(Node* child, ExceptionCode&);
+ virtual bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, bool shouldLazyAttach = false);
+ virtual bool removeChildren();
+
+ virtual void accessKeyAction(bool sendToAnyElement);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void attach();
+ virtual void detach();
+ virtual void setRenderStyle(PassRefPtr<RenderStyle>);
+
+ virtual String groupLabelText() const;
+
+private:
+ virtual RenderStyle* nonRendererRenderStyle() const;
+ void recalcSelectOptions();
+
+private:
+ String m_title;
+ RefPtr<RenderStyle> m_style;
+};
+
+}
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLOptionElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLOptionElement.cpp
new file mode 100644
index 0000000..1087134
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLOptionElement.cpp
@@ -0,0 +1,163 @@
+/**
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#if ENABLE(WML)
+#include "WMLOptionElement.h"
+
+#include "HTMLNames.h"
+#include "MappedAttribute.h"
+#include "NodeRenderStyle.h"
+#include "RenderStyle.h"
+#include "WMLNames.h"
+#include "WMLSelectElement.h"
+
+namespace WebCore {
+
+using namespace WMLNames;
+
+WMLOptionElement::WMLOptionElement(const QualifiedName& tagName, Document* doc)
+ : WMLFormControlElement(tagName, doc)
+{
+}
+
+WMLOptionElement::~WMLOptionElement()
+{
+}
+
+const AtomicString& WMLOptionElement::formControlType() const
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, option, ("option"));
+ return option;
+}
+
+static inline WMLSelectElement* ownerSelectElement(Element* element)
+{
+ Node* select = element->parentNode();
+ while (select && !select->hasTagName(selectTag))
+ select = select->parentNode();
+
+ if (!select)
+ return 0;
+
+ return static_cast<WMLSelectElement*>(select);
+}
+
+void WMLOptionElement::accessKeyAction(bool)
+{
+ if (WMLSelectElement* select = ownerSelectElement(this))
+ select->accessKeySetSelectedIndex(OptionElement::optionIndex(select, this));
+}
+
+void WMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+ if (WMLSelectElement* select = ownerSelectElement(this))
+ select->childrenChanged(changedByParser);
+
+ WMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+}
+
+void WMLOptionElement::parseMappedAttribute(MappedAttribute* attr)
+{
+ if (attr->name() == HTMLNames::valueAttr)
+ m_data.setValue(parseValueSubstitutingVariableReferences(attr->value()));
+ else if (attr->name() == HTMLNames::titleAttr)
+ m_data.setLabel(parseValueSubstitutingVariableReferences(attr->value()));
+ else if (attr->name() == onpickAttr) {
+ // Register intrinsic event in card
+ RefPtr<WMLIntrinsicEvent> event = WMLIntrinsicEvent::create(document(), attr->value());
+
+ createEventHandlerIfNeeded();
+ eventHandler()->registerIntrinsicEvent(WMLIntrinsicEventOnPick, event);
+ } else
+ WMLFormControlElement::parseMappedAttribute(attr);
+}
+
+void WMLOptionElement::attach()
+{
+ if (parentNode()->renderStyle())
+ setRenderStyle(styleForRenderer());
+ WMLFormControlElement::attach();
+}
+
+void WMLOptionElement::detach()
+{
+ m_style.clear();
+ WMLFormControlElement::detach();
+}
+
+void WMLOptionElement::setRenderStyle(PassRefPtr<RenderStyle> style)
+{
+ m_style = style;
+}
+
+void WMLOptionElement::insertedIntoDocument()
+{
+ WMLSelectElement* select;
+ if (selected() && (select = ownerSelectElement(this)))
+ select->scrollToSelection();
+
+ WMLFormControlElement::insertedIntoDocument();
+}
+
+bool WMLOptionElement::selected() const
+{
+ return m_data.selected();
+}
+
+void WMLOptionElement::setSelectedState(bool selected)
+{
+ OptionElement::setSelectedState(m_data, this, selected);
+}
+
+String WMLOptionElement::value() const
+{
+ return OptionElement::collectOptionValue(m_data, this);
+}
+
+String WMLOptionElement::text() const
+{
+ return OptionElement::collectOptionText(m_data, this);
+}
+
+String WMLOptionElement::textIndentedToRespectGroupLabel() const
+{
+ return OptionElement::collectOptionTextRespectingGroupLabel(m_data, this);
+}
+
+RenderStyle* WMLOptionElement::nonRendererRenderStyle() const
+{
+ return m_style.get();
+}
+
+void WMLOptionElement::handleIntrinsicEventIfNeeded()
+{
+ WMLIntrinsicEventHandler* eventHandler = this->eventHandler();
+ if (!eventHandler)
+ return;
+
+ if (eventHandler->hasIntrinsicEvent(WMLIntrinsicEventOnPick))
+ eventHandler->triggerIntrinsicEvent(WMLIntrinsicEventOnPick);
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLOptionElement.h b/src/3rdparty/webkit/WebCore/wml/WMLOptionElement.h
new file mode 100644
index 0000000..c34f319
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLOptionElement.h
@@ -0,0 +1,69 @@
+/**
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WMLOptionElement_h
+#define WMLOptionElement_h
+
+#if ENABLE(WML)
+#include "OptionElement.h"
+#include "WMLFormControlElement.h"
+#include "WMLEventHandlingElement.h"
+
+namespace WebCore {
+
+class WMLOptionElement : public WMLFormControlElement, public WMLEventHandlingElement, public OptionElement {
+public:
+ WMLOptionElement(const QualifiedName& tagName, Document*);
+ virtual ~WMLOptionElement();
+
+ virtual const AtomicString& formControlType() const;
+
+ virtual bool rendererIsNeeded(RenderStyle*) { return false; }
+
+ virtual void accessKeyAction(bool sendToAnyElement);
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual void attach();
+ virtual void detach();
+ virtual void setRenderStyle(PassRefPtr<RenderStyle>);
+
+ virtual void insertedIntoDocument();
+
+ virtual bool selected() const;
+ virtual void setSelectedState(bool);
+
+ virtual String text() const;
+ virtual String textIndentedToRespectGroupLabel() const;
+ virtual String value() const;
+
+private:
+ virtual RenderStyle* nonRendererRenderStyle() const;
+ void handleIntrinsicEventIfNeeded();
+
+private:
+ OptionElementData m_data;
+ RefPtr<RenderStyle> m_style;
+};
+
+}
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLPElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLPElement.cpp
index 3655b2e..0cec653 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLPElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLPElement.cpp
@@ -30,6 +30,7 @@
#include "CSSValueKeywords.h"
#include "Document.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "NodeList.h"
#include "WMLNames.h"
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp
index 0cc7d42..69f61f5 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLPostfieldElement.cpp
@@ -26,6 +26,7 @@
#include "CString.h"
#include "TextEncoding.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "WMLDocument.h"
#include "WMLGoElement.h"
#include "WMLNames.h"
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp
new file mode 100644
index 0000000..5b5aed1
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.cpp
@@ -0,0 +1,224 @@
+/**
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#if ENABLE(WML)
+#include "WMLSelectElement.h"
+
+#include "HTMLNames.h"
+#include "MappedAttribute.h"
+#include "RenderListBox.h"
+#include "RenderMenuList.h"
+
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+WMLSelectElement::WMLSelectElement(const QualifiedName& tagName, Document* document)
+ : WMLFormControlElement(tagName, document)
+{
+}
+
+WMLSelectElement::~WMLSelectElement()
+{
+}
+
+const AtomicString& WMLSelectElement::formControlType() const
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple"));
+ DEFINE_STATIC_LOCAL(const AtomicString, selectOne, ("select-one"));
+ return m_data.multiple() ? selectMultiple : selectOne;
+}
+
+bool WMLSelectElement::isKeyboardFocusable(KeyboardEvent* event) const
+{
+ if (renderer())
+ return isFocusable();
+
+ return WMLFormControlElement::isKeyboardFocusable(event);
+}
+
+bool WMLSelectElement::isMouseFocusable() const
+{
+ if (renderer())
+ return isFocusable();
+
+ return WMLFormControlElement::isMouseFocusable();
+}
+
+void WMLSelectElement::selectAll()
+{
+ SelectElement::selectAll(m_data, this);
+}
+
+void WMLSelectElement::recalcStyle(StyleChange change)
+{
+ SelectElement::recalcStyle(m_data, this);
+ WMLFormControlElement::recalcStyle(change);
+}
+
+void WMLSelectElement::dispatchFocusEvent()
+{
+ SelectElement::dispatchFocusEvent(m_data, this);
+ WMLFormControlElement::dispatchFocusEvent();
+}
+
+void WMLSelectElement::dispatchBlurEvent()
+{
+ SelectElement::dispatchBlurEvent(m_data, this);
+ WMLFormControlElement::dispatchBlurEvent();
+}
+
+int WMLSelectElement::selectedIndex() const
+{
+ return SelectElement::selectedIndex(m_data, this);
+}
+
+void WMLSelectElement::setSelectedIndex(int index, bool deselect, bool fireOnChange)
+{
+ SelectElement::setSelectedIndex(m_data, this, index, deselect, fireOnChange);
+}
+
+bool WMLSelectElement::saveFormControlState(String& value) const
+{
+ return SelectElement::saveFormControlState(m_data, this, value);
+}
+
+void WMLSelectElement::restoreFormControlState(const String& state)
+{
+ SelectElement::restoreFormControlState(m_data, this, state);
+}
+
+void WMLSelectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+ SelectElement::setRecalcListItems(m_data, this);
+ WMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+}
+
+void WMLSelectElement::parseMappedAttribute(MappedAttribute* attr)
+{
+ if (attr->name() == HTMLNames::multipleAttr)
+ SelectElement::parseMultipleAttribute(m_data, this, attr);
+ else
+ WMLFormControlElement::parseMappedAttribute(attr);
+}
+
+RenderObject* WMLSelectElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+ if (m_data.usesMenuList())
+ return new (arena) RenderMenuList(this);
+ return new (arena) RenderListBox(this);
+}
+
+bool WMLSelectElement::appendFormData(FormDataList& list, bool)
+{
+ return SelectElement::appendFormData(m_data, this, list);
+}
+
+int WMLSelectElement::optionToListIndex(int optionIndex) const
+{
+ return SelectElement::optionToListIndex(m_data, this, optionIndex);
+}
+
+int WMLSelectElement::listToOptionIndex(int listIndex) const
+{
+ return SelectElement::listToOptionIndex(m_data, this, listIndex);
+}
+
+void WMLSelectElement::reset()
+{
+ SelectElement::reset(m_data, this);
+}
+
+void WMLSelectElement::defaultEventHandler(Event* event)
+{
+ SelectElement::defaultEventHandler(m_data, this, event);
+}
+
+void WMLSelectElement::accessKeyAction(bool sendToAnyElement)
+{
+ focus();
+ dispatchSimulatedClick(0, sendToAnyElement);
+}
+
+void WMLSelectElement::setActiveSelectionAnchorIndex(int index)
+{
+ SelectElement::setActiveSelectionAnchorIndex(m_data, this, index);
+}
+
+void WMLSelectElement::setActiveSelectionEndIndex(int index)
+{
+ SelectElement::setActiveSelectionEndIndex(m_data, index);
+}
+
+void WMLSelectElement::updateListBoxSelection(bool deselectOtherOptions)
+{
+ SelectElement::updateListBoxSelection(m_data, this, deselectOtherOptions);
+}
+
+void WMLSelectElement::listBoxOnChange()
+{
+ SelectElement::listBoxOnChange(m_data, this);
+}
+
+void WMLSelectElement::menuListOnChange()
+{
+ SelectElement::menuListOnChange(m_data, this);
+}
+
+int WMLSelectElement::activeSelectionStartListIndex() const
+{
+ if (m_data.activeSelectionAnchorIndex() >= 0)
+ return m_data.activeSelectionAnchorIndex();
+ return optionToListIndex(selectedIndex());
+}
+
+int WMLSelectElement::activeSelectionEndListIndex() const
+{
+ if (m_data.activeSelectionEndIndex() >= 0)
+ return m_data.activeSelectionEndIndex();
+ return SelectElement::lastSelectedListIndex(m_data, this);
+}
+
+void WMLSelectElement::accessKeySetSelectedIndex(int index)
+{
+ SelectElement::accessKeySetSelectedIndex(m_data, this, index);
+}
+
+void WMLSelectElement::setRecalcListItems()
+{
+ SelectElement::setRecalcListItems(m_data, this);
+}
+
+void WMLSelectElement::scrollToSelection()
+{
+ SelectElement::scrollToSelection(m_data, this);
+}
+
+void WMLSelectElement::insertedIntoTree(bool deep)
+{
+ SelectElement::insertedIntoTree(m_data, this);
+ WMLFormControlElement::insertedIntoTree(deep);
+}
+
+}
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h b/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h
new file mode 100644
index 0000000..8d3e0f9
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h
@@ -0,0 +1,94 @@
+/**
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WMLSelectElement_h
+#define WMLSelectElement_h
+
+#if ENABLE(WML)
+#include "WMLFormControlElement.h"
+#include "SelectElement.h"
+
+namespace WebCore {
+
+class WMLSelectElement : public WMLFormControlElement, public SelectElement {
+public:
+ WMLSelectElement(const QualifiedName&, Document*);
+ virtual ~WMLSelectElement();
+
+ virtual const AtomicString& formControlType() const;
+
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isMouseFocusable() const;
+ virtual bool canSelectAll() const { return !m_data.usesMenuList(); }
+ virtual void selectAll();
+
+ virtual void recalcStyle(StyleChange);
+
+ virtual void dispatchFocusEvent();
+ virtual void dispatchBlurEvent();
+
+ virtual bool canStartSelection() const { return false; }
+
+ virtual int selectedIndex() const;
+ virtual void setSelectedIndex(int index, bool deselect = true, bool fireOnChange = false);
+
+ virtual int size() const { return m_data.size(); }
+ virtual bool multiple() const { return m_data.multiple(); }
+
+ virtual bool saveFormControlState(String& value) const;
+ virtual void restoreFormControlState(const String&);
+
+ virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual bool appendFormData(FormDataList&, bool);
+ virtual int optionToListIndex(int optionIndex) const;
+ virtual int listToOptionIndex(int listIndex) const;
+
+ virtual const Vector<Element*>& listItems() const { return m_data.listItems(this); }
+ virtual void reset();
+
+ virtual void defaultEventHandler(Event*);
+ virtual void accessKeyAction(bool sendToAnyElement);
+ virtual void setActiveSelectionAnchorIndex(int index);
+ virtual void setActiveSelectionEndIndex(int index);
+ virtual void updateListBoxSelection(bool deselectOtherOptions);
+ virtual void listBoxOnChange();
+ virtual void menuListOnChange();
+
+ virtual int activeSelectionStartListIndex() const;
+ virtual int activeSelectionEndListIndex() const;
+
+ void accessKeySetSelectedIndex(int);
+ void setRecalcListItems();
+ void scrollToSelection();
+
+private:
+ virtual void insertedIntoTree(bool);
+
+ SelectElementData m_data;
+};
+
+}
+
+#endif
+#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp
index 9bce944..da9a1f4 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLSetvarElement.cpp
@@ -24,6 +24,7 @@
#include "WMLSetvarElement.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "WMLErrorHandling.h"
#include "WMLTaskElement.h"
#include "WMLVariables.h"
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLTableElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLTableElement.cpp
index f241f46..92c7580 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLTableElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLTableElement.cpp
@@ -28,6 +28,7 @@
#include "CSSValueKeywords.h"
#include "Document.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "NodeList.h"
#include "RenderObject.h"
#include "Text.h"
@@ -66,7 +67,7 @@ void WMLTableElement::parseMappedAttribute(MappedAttribute* attr)
// Spec: This required attribute specifies the number of columns for the table.
// The user agent must create a table with exactly the number of columns specified
- // by the attribute value. It is an error to specify a value of zero (“0”).
+ // by the attribute value. It is an error to specify a value of zero ("0")
if (!m_columns || !isNumber)
reportWMLError(document(), WMLErrorInvalidColumnsNumberInTable);
} else if (attr->name() == HTMLNames::alignAttr)
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLTagNames.in b/src/3rdparty/webkit/WebCore/wml/WMLTagNames.in
index 293c603..fd7c762 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLTagNames.in
+++ b/src/3rdparty/webkit/WebCore/wml/WMLTagNames.in
@@ -12,23 +12,24 @@ fieldset interfaceName=WMLFieldSetElement
go
head interfaceName=WMLElement
img interfaceName=WMLImageElement
+input
+#if 0
# Note: 'insertedLegend' is not an official WML element - internal purpose only!
+#endif
insertedLegend interfaceName=WMLInsertedLegendElement
meta
noop
onevent interfaceName=WMLOnEventElement
+optgroup interfaceName=WMLOptGroupElement
+option
p
postfield
prev
refresh
+select
setvar
table
td interfaceName=WMLElement
template
timer
tr interfaceName=WMLElement
-
-#if 0
-# These elements have a corresponding HTML*Element class, that we want to share code with.
-# input, optgroup, option, select
-#endif
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.cpp
index d0bfa61..2575c9a 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -23,6 +23,7 @@
#if ENABLE(WML)
#include "WMLTemplateElement.h"
+#include "MappedAttribute.h"
#include "NodeList.h"
#include "WMLCardElement.h"
#include "WMLDocument.h"
@@ -34,7 +35,7 @@ namespace WebCore {
using namespace WMLNames;
WMLTemplateElement::WMLTemplateElement(const QualifiedName& tagName, Document* doc)
- : WMLEventHandlingElement(tagName, doc)
+ : WMLElement(tagName, doc)
{
}
@@ -53,7 +54,7 @@ void WMLTemplateElement::parseMappedAttribute(MappedAttribute* attr)
else if (attr->name() == ontimerAttr)
eventType = WMLIntrinsicEventOnTimer;
else {
- WMLEventHandlingElement::parseMappedAttribute(attr);
+ WMLElement::parseMappedAttribute(attr);
return;
}
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.h b/src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.h
index 1ba720e..3fc0eda 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.h
+++ b/src/3rdparty/webkit/WebCore/wml/WMLTemplateElement.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,11 +22,12 @@
#define WMLTemplateElement_h
#if ENABLE(WML)
+#include "WMLElement.h"
#include "WMLEventHandlingElement.h"
namespace WebCore {
-class WMLTemplateElement : public WMLEventHandlingElement {
+class WMLTemplateElement : public WMLElement, public WMLEventHandlingElement {
public:
WMLTemplateElement(const QualifiedName&, Document*);
virtual ~WMLTemplateElement();
diff --git a/src/3rdparty/webkit/WebCore/wml/WMLTimerElement.cpp b/src/3rdparty/webkit/WebCore/wml/WMLTimerElement.cpp
index 7cd2e50..00c7036 100644
--- a/src/3rdparty/webkit/WebCore/wml/WMLTimerElement.cpp
+++ b/src/3rdparty/webkit/WebCore/wml/WMLTimerElement.cpp
@@ -24,6 +24,7 @@
#include "WMLTimerElement.h"
#include "HTMLNames.h"
+#include "MappedAttribute.h"
#include "WMLCardElement.h"
#include "WMLDocument.h"
#include "WMLNames.h"