diff options
author | David Boddie <dboddie@trolltech.com> | 2009-07-14 10:59:38 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-07-14 10:59:38 (GMT) |
commit | 2d01fb17dbf7590dd60987b08433252eb95f55e0 (patch) | |
tree | 6beeb6c07bd64755c5f0ef0208e7002028709757 /src/3rdparty/webkit/WebCore/html | |
parent | b19a64a407a9c69b0df7fd1b12f2f1377a6bc9c0 (diff) | |
parent | af2b01c4571b468a57cb4e5e72dab481f6d88eb1 (diff) | |
download | Qt-2d01fb17dbf7590dd60987b08433252eb95f55e0.zip Qt-2d01fb17dbf7590dd60987b08433252eb95f55e0.tar.gz Qt-2d01fb17dbf7590dd60987b08433252eb95f55e0.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/3rdparty/webkit/WebCore/html')
81 files changed, 752 insertions, 165 deletions
diff --git a/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp index 37f4799..7a255d8 100644 --- a/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp +++ b/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp @@ -58,10 +58,10 @@ #include "TextMetrics.h" #include "HTMLVideoElement.h" #include <stdio.h> - #include <wtf/ByteArray.h> #include <wtf/MathExtras.h> #include <wtf/OwnPtr.h> +#include <wtf/UnusedParam.h> using namespace std; @@ -546,6 +546,8 @@ void CanvasRenderingContext2D::lineTo(float x, float y) return; if (!state().m_invertibleCTM) return; + if (m_path.isEmpty()) + m_path.moveTo(FloatPoint(x, y)); m_path.addLineTo(FloatPoint(x, y)); } @@ -555,6 +557,8 @@ void CanvasRenderingContext2D::quadraticCurveTo(float cpx, float cpy, float x, f return; if (!state().m_invertibleCTM) return; + if (m_path.isEmpty()) + m_path.moveTo(FloatPoint(cpx, cpy)); m_path.addQuadCurveTo(FloatPoint(cpx, cpy), FloatPoint(x, y)); } @@ -564,6 +568,8 @@ void CanvasRenderingContext2D::bezierCurveTo(float cp1x, float cp1y, float cp2x, return; if (!state().m_invertibleCTM) return; + if (m_path.isEmpty()) + m_path.moveTo(FloatPoint(cp1x, cp1y)); m_path.addBezierCurveTo(FloatPoint(cp1x, cp1y), FloatPoint(cp2x, cp2y), FloatPoint(x, y)); } @@ -1103,7 +1109,7 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec c->translate(destRect.x(), destRect.y()); c->scale(FloatSize(destRect.width()/sourceRect.width(), destRect.height()/sourceRect.height())); c->translate(-sourceRect.x(), -sourceRect.y()); - video->paint(c, IntRect(IntPoint(), size(video))); + video->paintCurrentFrameInContext(c, IntRect(IntPoint(), size(video))); c->restore(); } #endif @@ -1158,6 +1164,8 @@ void CanvasRenderingContext2D::prepareGradientForDashboard(CanvasGradient* gradi if (Settings* settings = m_canvas->document()->settings()) if (settings->usesDashboardBackwardCompatibilityMode()) gradient->setDashboardCompatibilityMode(); +#else + UNUSED_PARAM(gradient); #endif } diff --git a/src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp b/src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp index 743ed4f..946cac7 100644 --- a/src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp +++ b/src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp @@ -174,7 +174,7 @@ void CanvasStyle::applyFillColor(GraphicsContext* context) switch (m_type) { case ColorString: { Color c = Color(m_color); - if (c.isValid()){ + if (c.isValid()) { context->setFillColor(c.rgb()); break; } @@ -185,7 +185,7 @@ void CanvasStyle::applyFillColor(GraphicsContext* context) } case ColorStringWithAlpha: { Color c = Color(m_color); - if (c.isValid()){ + if (c.isValid()) { context->setFillColor(colorWithOverrideAlpha(c.rgb(), m_alpha)); break; } diff --git a/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp b/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp new file mode 100644 index 0000000..aa44d8c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(DATAGRID) + +#include "DOMDataGridDataSource.h" + +namespace WebCore { + +DOMDataGridDataSource::DOMDataGridDataSource() +{ +} + +DOMDataGridDataSource::~DOMDataGridDataSource() +{ +} + +} // namespace WebCore + +#endif // ENABLE(DATAGRID) diff --git a/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h b/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h new file mode 100644 index 0000000..2ce2ab8 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DOMDataGridDataSource_h +#define DOMDataGridDataSource_h + +#if ENABLE(DATAGRID) + +#include "DataGridDataSource.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class HTMLDataGridElement; + +class DOMDataGridDataSource : public DataGridDataSource { +public: + static PassRefPtr<DOMDataGridDataSource> create() + { + return adoptRef(new DOMDataGridDataSource); + } + + virtual ~DOMDataGridDataSource(); + + virtual bool isDOMDataGridDataSource() const { return true; } + +private: + DOMDataGridDataSource(); +}; + +inline DOMDataGridDataSource* asDOMDataGridDataSource(DataGridDataSource* dataSource) +{ + ASSERT(dataSource->isDOMDataGridDataSource()); + return static_cast<DOMDataGridDataSource*>(dataSource); +} + +inline const DOMDataGridDataSource* asDOMDataGridDataSource(const DataGridDataSource* dataSource) +{ + ASSERT(dataSource->isDOMDataGridDataSource()); + return static_cast<const DOMDataGridDataSource*>(dataSource); +} + +} // namespace WebCore + +#endif // ENABLE(DATAGRID) +#endif // DOMDataGridDataSource_h diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp b/src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp index 136c08e..7810c86 100644 --- a/src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp +++ b/src/3rdparty/webkit/WebCore/html/DataGridColumn.cpp @@ -24,6 +24,9 @@ */ #include "config.h" + +#if ENABLE(DATAGRID) + #include "DataGridColumn.h" #include "DataGridColumnList.h" @@ -39,4 +42,12 @@ void DataGridColumn::setPrimary(bool primary) } } +void DataGridColumn::columnChanged() +{ + if (m_columns) + m_columns->setDataGridNeedsLayout(); +} + } // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumn.h b/src/3rdparty/webkit/WebCore/html/DataGridColumn.h index 8e63cd6..3d480a9 100644 --- a/src/3rdparty/webkit/WebCore/html/DataGridColumn.h +++ b/src/3rdparty/webkit/WebCore/html/DataGridColumn.h @@ -26,7 +26,10 @@ #ifndef DataGridColumn_h #define DataGridColumn_h +#if ENABLE(DATAGRID) + #include "AtomicString.h" +#include "RenderStyle.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -36,34 +39,49 @@ class DataGridColumnList; class DataGridColumn : public RefCounted<DataGridColumn> { public: - static PassRefPtr<DataGridColumn> create(DataGridColumnList* columns, const String& columnID, const String& label, const String& type, bool primary, unsigned short sortable) + static PassRefPtr<DataGridColumn> create(const String& columnID, const String& label, const String& type, bool primary, unsigned short sortable) { - return new DataGridColumn(columns, columnID, label, type, primary, sortable); + return adoptRef(new DataGridColumn(columnID, label, type, primary, sortable)); } const AtomicString& id() const { return m_id; } - void setId(const AtomicString& id) { m_id = id; } + void setId(const AtomicString& id) { m_id = id; columnChanged(); } const AtomicString& label() const { return m_label; } - void setLabel(const AtomicString& label) { m_label = label; } + void setLabel(const AtomicString& label) { m_label = label; columnChanged(); } const AtomicString& type() const { return m_type; } - void setType(const AtomicString& type) { m_type = type; } + void setType(const AtomicString& type) { m_type = type; columnChanged(); } unsigned short sortable() const { return m_sortable; } - void setSortable(unsigned short sortable) { m_sortable = sortable; } + void setSortable(unsigned short sortable) { m_sortable = sortable; columnChanged(); } unsigned short sortDirection() const { return m_sortDirection; } - void setSortDirection(unsigned short sortDirection) { m_sortDirection = sortDirection; } + void setSortDirection(unsigned short sortDirection) { m_sortDirection = sortDirection; columnChanged(); } bool primary() const { return m_primary; } void setPrimary(bool); - void detachFromColumnList() { m_columns = 0; } + void setColumnList(DataGridColumnList* list) + { + m_columns = list; + m_columnStyle = 0; + m_headerStyle = 0; + m_rect = IntRect(); + } + + RenderStyle* columnStyle() const { return m_columnStyle.get(); } + void setColumnStyle(PassRefPtr<RenderStyle> style) { m_columnStyle = style; } + + RenderStyle* headerStyle() const { return m_headerStyle.get(); } + void setHeaderStyle(PassRefPtr<RenderStyle> style) { m_headerStyle = style; } + + const IntRect& rect() const { return m_rect; } + void setRect(const IntRect& rect) { m_rect = rect; } private: - DataGridColumn(DataGridColumnList* columns, const String& columnID, const String& label, const String& type, bool primary, unsigned short sortable) - : m_columns(columns) + DataGridColumn(const String& columnID, const String& label, const String& type, bool primary, unsigned short sortable) + : m_columns(0) , m_id(columnID) , m_label(label) , m_type(type) @@ -73,6 +91,8 @@ private: { } + void columnChanged(); + DataGridColumnList* m_columns; // Not refcounted. The columns list will null out our reference when it goes away. AtomicString m_id; @@ -83,8 +103,15 @@ private: unsigned short m_sortable; unsigned short m_sortDirection; + + RefPtr<RenderStyle> m_columnStyle; // The style used to render the column background behind the row cells. + RefPtr<RenderStyle> m_headerStyle; // The style used to render the column header above the row cells. + + IntRect m_rect; }; } // namespace WebCore +#endif + #endif // DataGridColumn_h diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumn.idl b/src/3rdparty/webkit/WebCore/html/DataGridColumn.idl index 04418a1..f566325 100644 --- a/src/3rdparty/webkit/WebCore/html/DataGridColumn.idl +++ b/src/3rdparty/webkit/WebCore/html/DataGridColumn.idl @@ -26,7 +26,8 @@ module html { interface [ - GenerateConstructor + GenerateConstructor, + Conditional=DATAGRID ] DataGridColumn { attribute DOMString id; // The identifier for the column. attribute DOMString label; // The text to display in the column. diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp index 48f7d60..9613402 100644 --- a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp +++ b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.cpp @@ -24,13 +24,22 @@ */ #include "config.h" -#include "DataGridColumnList.h" + +#if ENABLE(DATAGRID) #include "AtomicString.h" +#include "DataGridColumnList.h" +#include "HTMLDataGridElement.h" #include "PlatformString.h" +#include "RenderObject.h" namespace WebCore { +DataGridColumnList::DataGridColumnList(HTMLDataGridElement* dataGrid) + : m_dataGrid(dataGrid) +{ +} + DataGridColumnList::~DataGridColumnList() { clear(); @@ -46,13 +55,26 @@ DataGridColumn* DataGridColumnList::itemWithName(const AtomicString& name) const return 0; } +void DataGridColumnList::setDataGridNeedsLayout() +{ + // Mark the datagrid as needing layout. + if (dataGrid() && dataGrid()->renderer()) + dataGrid()->renderer()->setNeedsLayout(true); +} + DataGridColumn* DataGridColumnList::add(const String& id, const String& label, const String& type, bool primary, unsigned short sortable) { - RefPtr<DataGridColumn> column = DataGridColumn::create(this, id, label, type, primary, sortable); - if (primary) + return add(DataGridColumn::create(id, label, type, primary, sortable).get()); +} + +DataGridColumn* DataGridColumnList::add(DataGridColumn* column) +{ + if (column->primary()) m_primaryColumn = column; m_columns.append(column); - return column.get(); + column->setColumnList(this); + setDataGridNeedsLayout(); + return column; } void DataGridColumnList::remove(DataGridColumn* col) @@ -65,6 +87,8 @@ void DataGridColumnList::remove(DataGridColumn* col) m_primaryColumn = 0; if (col == m_sortColumn) m_sortColumn = 0; + col->setColumnList(0); + setDataGridNeedsLayout(); } void DataGridColumnList::move(DataGridColumn* col, unsigned long index) @@ -73,16 +97,18 @@ void DataGridColumnList::move(DataGridColumn* col, unsigned long index) if (colIndex == notFound) return; m_columns.insert(index, col); + setDataGridNeedsLayout(); } void DataGridColumnList::clear() { unsigned length = m_columns.size(); for (unsigned i = 0; i < length; ++i) - m_columns[i]->detachFromColumnList(); + m_columns[i]->setColumnList(0); m_columns.clear(); m_primaryColumn = 0; m_sortColumn = 0; + setDataGridNeedsLayout(); } void DataGridColumnList::primaryColumnChanged(DataGridColumn* col) @@ -92,7 +118,9 @@ void DataGridColumnList::primaryColumnChanged(DataGridColumn* col) else if (m_primaryColumn = col) m_primaryColumn = 0; - // FIXME: Invalidate the tree. + setDataGridNeedsLayout(); } } // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.h b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.h index d0caebe..ed72863 100644 --- a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.h +++ b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.h @@ -1,6 +1,8 @@ #ifndef DataGridColumnList_h #define DataGridColumnList_h +#if ENABLE(DATAGRID) + #include "DataGridColumn.h" #include <wtf/PassRefPtr.h> @@ -10,13 +12,14 @@ namespace WebCore { class AtomicString; +class HTMLDataGridElement; class DataGridColumnList : public RefCounted<DataGridColumnList> { friend class DataGridColumn; public: - static PassRefPtr<DataGridColumnList> create() + static PassRefPtr<DataGridColumnList> create(HTMLDataGridElement* grid) { - return new DataGridColumnList(); + return adoptRef(new DataGridColumnList(grid)); } ~DataGridColumnList(); @@ -31,12 +34,22 @@ public: DataGridColumn* sortColumn() const { return m_sortColumn.get(); } DataGridColumn* add(const String& id, const String& label, const String& type, bool primary, unsigned short sortable); + DataGridColumn* add(DataGridColumn*); void remove(DataGridColumn*); void move(DataGridColumn*, unsigned long index); void clear(); + HTMLDataGridElement* dataGrid() const { return m_dataGrid; } + void clearDataGrid() { m_dataGrid = 0; } + + void setDataGridNeedsLayout(); + private: - void primaryColumnChanged(DataGridColumn* col); + DataGridColumnList(HTMLDataGridElement*); + + void primaryColumnChanged(DataGridColumn*); + + HTMLDataGridElement* m_dataGrid; // Weak reference. Will be nulled out when our tree goes away. Vector<RefPtr<DataGridColumn> > m_columns; RefPtr<DataGridColumn> m_primaryColumn; @@ -45,4 +58,6 @@ private: } // namespace WebCore +#endif + #endif // DataGridColumnList_h diff --git a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl index cab4339..1a59f43 100644 --- a/src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl +++ b/src/3rdparty/webkit/WebCore/html/DataGridColumnList.idl @@ -28,7 +28,8 @@ module html { interface [ GenerateConstructor, HasIndexGetter, - HasNameGetter + HasNameGetter, + Conditional=DATAGRID ] DataGridColumnList { DataGridColumn item(in [IsIndex] unsigned long index); readonly attribute unsigned long length; diff --git a/src/3rdparty/webkit/WebCore/html/DataGridDataSource.h b/src/3rdparty/webkit/WebCore/html/DataGridDataSource.h index 0c9a24d..2ab1f5b 100644 --- a/src/3rdparty/webkit/WebCore/html/DataGridDataSource.h +++ b/src/3rdparty/webkit/WebCore/html/DataGridDataSource.h @@ -26,6 +26,8 @@ #ifndef DataGridDataSource_h #define DataGridDataSource_h +#if ENABLE(DATAGRID) + #include <wtf/RefCounted.h> namespace WebCore { @@ -36,11 +38,12 @@ class DataGridDataSource : public RefCounted<DataGridDataSource> { public: virtual ~DataGridDataSource() { } + virtual bool isDOMDataGridDataSource() const { return false; } virtual bool isJSDataGridDataSource() const { return false; } - - virtual void initialize(HTMLDataGridElement*) = 0; }; } // namespace WebCore +#endif + #endif // DataGridDataSource_h diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp index 354f9f0..09362cd 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLAnchorElement.cpp @@ -249,7 +249,7 @@ void HTMLAnchorElement::setActive(bool down, bool pause) if (Settings* settings = document()->settings()) editableLinkBehavior = settings->editableLinkBehavior(); - switch(editableLinkBehavior) { + switch (editableLinkBehavior) { default: case EditableLinkDefaultBehavior: case EditableLinkAlwaysLive: @@ -497,7 +497,7 @@ bool HTMLAnchorElement::isLiveLink() const if (Settings* settings = document()->settings()) editableLinkBehavior = settings->editableLinkBehavior(); - switch(editableLinkBehavior) { + switch (editableLinkBehavior) { default: case EditableLinkDefaultBehavior: case EditableLinkAlwaysLive: diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h b/src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h index 26d8126..e271965 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLAppletElement.h @@ -30,8 +30,7 @@ namespace WebCore { class HTMLFormElement; class HTMLImageLoader; -class HTMLAppletElement : public HTMLPlugInElement -{ +class HTMLAppletElement : public HTMLPlugInElement { public: HTMLAppletElement(const QualifiedName&, Document*); ~HTMLAppletElement(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in b/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in index a29d6d2..0fc45d7 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in +++ b/src/3rdparty/webkit/WebCore/html/HTMLAttributeNames.in @@ -17,6 +17,7 @@ aria-checked aria-describedby aria-disabled aria-hidden +aria-label aria-labeledby aria-labelledby aria-level diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h b/src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h index de390cf..1dbe44f 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLAudioElement.h @@ -32,8 +32,7 @@ namespace WebCore { -class HTMLAudioElement : public HTMLMediaElement -{ +class HTMLAudioElement : public HTMLMediaElement { public: HTMLAudioElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBRElement.h b/src/3rdparty/webkit/WebCore/html/HTMLBRElement.h index 982a646..5600463 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLBRElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLBRElement.h @@ -28,8 +28,7 @@ namespace WebCore { class String; -class HTMLBRElement : public HTMLElement -{ +class HTMLBRElement : public HTMLElement { public: HTMLBRElement(const QualifiedName&, Document*); ~HTMLBRElement(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp index a278908..84e359c 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.cpp @@ -30,6 +30,7 @@ #include "HTMLNames.h" #include "KURL.h" #include "MappedAttribute.h" +#include "XSSAuditor.h" namespace WebCore { @@ -48,6 +49,7 @@ HTMLBaseElement::~HTMLBaseElement() void HTMLBaseElement::parseMappedAttribute(MappedAttribute* attr) { if (attr->name() == hrefAttr) { + m_hrefAttrValue = attr->value(); m_href = parseURL(attr->value()); process(); } else if (attr->name() == targetAttr) { @@ -78,7 +80,7 @@ void HTMLBaseElement::process() if (!inDocument()) return; - if (!m_href.isEmpty()) + if (!m_href.isEmpty() && (!document()->frame() || document()->frame()->script()->xssAuditor()->canSetBaseElementURL(m_hrefAttrValue))) document()->setBaseElementURL(KURL(document()->url(), m_href)); if (!m_target.isEmpty()) diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h b/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h index f068851..bb980e9 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h @@ -26,8 +26,7 @@ namespace WebCore { -class HTMLBaseElement : public HTMLElement -{ +class HTMLBaseElement : public HTMLElement { public: HTMLBaseElement(const QualifiedName&, Document*); ~HTMLBaseElement(); @@ -48,6 +47,7 @@ public: void setTarget(const String&); protected: + String m_hrefAttrValue; String m_href; String m_target; }; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h b/src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h index 0c9a9fd..c15a36e 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLBaseFontElement.h @@ -26,8 +26,7 @@ namespace WebCore { -class HTMLBaseFontElement : public HTMLElement -{ +class HTMLBaseFontElement : public HTMLElement { public: HTMLBaseFontElement(const QualifiedName&, Document* doc); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl index 028e92b..30ad6f2 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLButtonElement.idl @@ -26,6 +26,9 @@ module html { ImplementationUUID=1be13b5f-40df-4550-b70e-8c805e546cad ] HTMLButtonElement : HTMLElement { readonly attribute HTMLFormElement form; +#if !defined(LANGUAGE_COM) || !LANGUAGE_COM + readonly attribute ValidityState validity; +#endif attribute [ConvertNullToNullString] DOMString accessKey; attribute boolean disabled; attribute boolean autofocus; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDListElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDListElement.h index 8925e6b..49c944b 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDListElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLDListElement.h @@ -26,8 +26,7 @@ namespace WebCore { -class HTMLDListElement : public HTMLElement -{ +class HTMLDListElement : public HTMLElement { public: HTMLDListElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp index d06ad82..bad8929 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.cpp @@ -24,6 +24,9 @@ */ #include "config.h" + +#if ENABLE(DATAGRID) + #include "HTMLDataGridCellElement.h" #include "HTMLNames.h" @@ -89,3 +92,5 @@ void HTMLDataGridCellElement::setProgress(float progress) } } // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h index 9de6e40..270835c 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.h @@ -26,6 +26,8 @@ #ifndef HTMLDataGridCellElement_h #define HTMLDataGridCellElement_h +#if ENABLE(DATAGRID) + #include "HTMLElement.h" namespace WebCore { @@ -55,4 +57,6 @@ public: } // namespace WebCore +#endif + #endif // HTMLDataGridCellElement_h diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl index 4d15f6f..c7c51bc 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridCellElement.idl @@ -26,7 +26,8 @@ module html { interface [ - GenerateConstructor + GenerateConstructor, + Conditional=DATAGRID ] HTMLDataGridCellElement : HTMLElement { attribute DOMString label; // The text to display in the column, assuming the type supports text. diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp index b209447..8398545 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.cpp @@ -24,9 +24,14 @@ */ #include "config.h" -#include "HTMLDataGridColElement.h" +#if ENABLE(DATAGRID) + +#include "DataGridColumn.h" +#include "HTMLDataGridElement.h" +#include "HTMLDataGridColElement.h" #include "HTMLNames.h" +#include "MappedAttribute.h" #include "Text.h" namespace WebCore { @@ -35,9 +40,48 @@ using namespace HTMLNames; HTMLDataGridColElement::HTMLDataGridColElement(const QualifiedName& name, Document* doc) : HTMLElement(name, doc) + , m_dataGrid(0) +{ +} + +HTMLDataGridElement* HTMLDataGridColElement::findDataGridAncestor() const +{ + if (parent() && parent()->hasTagName(datagridTag)) + return static_cast<HTMLDataGridElement*>(parent()); + return 0; +} + +void HTMLDataGridColElement::ensureColumn() { + if (m_column) + return; + m_column = DataGridColumn::create(getAttribute(idAttr), label(), type(), primary(), sortable()); } +void HTMLDataGridColElement::insertedIntoTree(bool deep) +{ + HTMLElement::insertedIntoTree(deep); + if (dataGrid()) // We're connected to a datagrid already. + return; + m_dataGrid = findDataGridAncestor(); + if (dataGrid() && dataGrid()->dataSource()->isDOMDataGridDataSource()) { + ensureColumn(); + m_dataGrid->columns()->add(column()); // FIXME: Deal with ordering issues (complicated, since columns can be made outside the DOM). + } +} + +void HTMLDataGridColElement::removedFromTree(bool deep) +{ + HTMLElement::removedFromTree(deep); + if (dataGrid() && dataGrid()->dataSource()->isDOMDataGridDataSource()) { + HTMLDataGridElement* grid = findDataGridAncestor(); + if (!grid && column()) { + dataGrid()->columns()->remove(column()); + m_dataGrid = 0; + } + } +} + String HTMLDataGridColElement::label() const { return getAttribute(labelAttr); @@ -60,12 +104,14 @@ void HTMLDataGridColElement::setType(const String& type) unsigned short HTMLDataGridColElement::sortable() const { - return hasAttribute(sortableAttr); + if (!hasAttribute(sortableAttr)) + return 2; + return getAttribute(sortableAttr).toInt(0); } void HTMLDataGridColElement::setSortable(unsigned short sortable) { - setAttribute(sortableAttr, sortable ? "" : 0); + setAttribute(sortableAttr, String::number(sortable)); } unsigned short HTMLDataGridColElement::sortDirection() const @@ -99,4 +145,27 @@ void HTMLDataGridColElement::setPrimary(bool primary) setAttribute(primaryAttr, primary ? "" : 0); } +void HTMLDataGridColElement::parseMappedAttribute(MappedAttribute* attr) +{ + HTMLElement::parseMappedAttribute(attr); + + if (!column()) + return; + + if (attr->name() == labelAttr) + column()->setLabel(label()); + else if (attr->name() == typeAttr) + column()->setType(type()); + else if (attr->name() == primaryAttr) + column()->setPrimary(primary()); + else if (attr->name() == sortableAttr) + column()->setSortable(sortable()); + else if (attr->name() == sortdirectionAttr) + column()->setSortDirection(sortDirection()); + else if (attr->name() == idAttr) + column()->setId(getAttribute(idAttr)); +} + } // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h index 87133cc..d91ec51 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.h @@ -26,17 +26,25 @@ #ifndef HTMLDataGridColElement_h #define HTMLDataGridColElement_h +#if ENABLE(DATAGRID) + +#include "DataGridColumn.h" #include "HTMLElement.h" namespace WebCore { +class HTMLDataGridElement; + class HTMLDataGridColElement : public HTMLElement { public: HTMLDataGridColElement(const QualifiedName&, Document*); virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; } virtual int tagPriority() const { return 0; } - + virtual void insertedIntoTree(bool /*deep*/); + virtual void removedFromTree(bool /*deep*/); + virtual void parseMappedAttribute(MappedAttribute*); + String label() const; void setLabel(const String&); @@ -51,8 +59,21 @@ public: bool primary() const; void setPrimary(bool); + + DataGridColumn* column() const { return m_column.get(); } + void setColumn(PassRefPtr<DataGridColumn> col) { m_column = col; } + +private: + HTMLDataGridElement* dataGrid() const { return m_dataGrid; } + HTMLDataGridElement* findDataGridAncestor() const; + void ensureColumn(); + + RefPtr<DataGridColumn> m_column; + HTMLDataGridElement* m_dataGrid; // Not refcounted. We will null out our reference if we get removed from the grid. }; } // namespace WebCore +#endif + #endif // HTMLDataGridColElement_h diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl index c72751c..5861039 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridColElement.idl @@ -26,7 +26,8 @@ module html { interface [ - GenerateConstructor + GenerateConstructor, + Conditional=DATAGRID ] HTMLDataGridColElement : HTMLElement { attribute DOMString label; // The text to display in the column. attribute DOMString type; // The type of data displayed in this column. diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp index 2d9f852..bb1f4a6 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.cpp @@ -24,8 +24,12 @@ */ #include "config.h" + +#if ENABLE(DATAGRID) + #include "HTMLDataGridElement.h" +#include "DOMDataGridDataSource.h" #include "HTMLNames.h" #include "RenderDataGrid.h" #include "Text.h" @@ -36,13 +40,14 @@ using namespace HTMLNames; HTMLDataGridElement::HTMLDataGridElement(const QualifiedName& tagName, Document* document) : HTMLElement(tagName, document) - , m_initializationTimer(this, &HTMLDataGridElement::initializationTimerFired) + , m_columns(DataGridColumnList::create(this)) { - m_columns = DataGridColumnList::create(); + setDataSource(DOMDataGridDataSource::create()); } HTMLDataGridElement::~HTMLDataGridElement() { + m_columns->clearDataGrid(); } bool HTMLDataGridElement::checkDTD(const Node* newChild) @@ -87,18 +92,27 @@ void HTMLDataGridElement::setMultiple(bool multiple) setAttribute(multipleAttr, multiple ? "" : 0); } -void HTMLDataGridElement::setDataSource(PassRefPtr<DataGridDataSource> dataSource) +void HTMLDataGridElement::setDataSource(PassRefPtr<DataGridDataSource> ds) { - if (m_initializationTimer.isActive()) - m_initializationTimer.stop(); - + if (m_dataSource == ds) + return; + + RefPtr<DataGridDataSource> dataSource = ds; + if (!dataSource) + dataSource = DOMDataGridDataSource::create(); m_dataSource = dataSource; - m_initializationTimer.startOneShot(0); + + // Always clear our columns when a data source changes. + // The register callback will rebuild the columns. + m_columns->clear(); } -void HTMLDataGridElement::initializationTimerFired(Timer<HTMLDataGridElement>*) +DataGridDataSource* HTMLDataGridElement::dataSource() const { - m_dataSource->initialize(this); + ASSERT(m_dataSource); + return m_dataSource.get(); } } // namespace WebCore + +#endif // ENABLE(DATAGRID) diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h index 646c97e..94672c1 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.h @@ -26,6 +26,8 @@ #ifndef HTMLDataGridElement_h #define HTMLDataGridElement_h +#if ENABLE(DATAGRID) + #include "DataGridColumnList.h" #include "DataGridDataSource.h" #include "HTMLElement.h" @@ -53,19 +55,17 @@ public: void setMultiple(bool); void setDataSource(PassRefPtr<DataGridDataSource>); - DataGridDataSource* dataSource() const { return m_dataSource.get(); } + DataGridDataSource* dataSource() const; DataGridColumnList* columns() const { return m_columns.get(); } private: - void initializationTimerFired(Timer<HTMLDataGridElement>*); - - Timer<HTMLDataGridElement> m_initializationTimer; RefPtr<DataGridDataSource> m_dataSource; - RefPtr<DataGridColumnList> m_columns; }; } // namespace WebCore +#endif + #endif // HTMLDataGridElement_h diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl index b4b0897..c9e6d9d 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridElement.idl @@ -26,7 +26,8 @@ module html { interface [ - GenerateConstructor + GenerateConstructor, + Conditional=DATAGRID ] HTMLDataGridElement : HTMLElement { attribute [Custom] DataGridDataSource dataSource; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp index e671806..c958cbd 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.cpp @@ -24,6 +24,9 @@ */ #include "config.h" + +#if ENABLE(DATAGRID) + #include "HTMLDataGridRowElement.h" #include "HTMLNames.h" @@ -76,3 +79,5 @@ void HTMLDataGridRowElement::setExpanded(bool expanded) } } // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h index d911db2..eac33e6 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.h @@ -26,6 +26,8 @@ #ifndef HTMLDataGridRowElement_h #define HTMLDataGridRowElement_h +#if ENABLE(DATAGRID) + #include "HTMLElement.h" namespace WebCore { @@ -49,4 +51,6 @@ public: } // namespace WebCore +#endif + #endif // HTMLDataGridRowElement_h diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl index 4aeb4d5..f6954af 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLDataGridRowElement.idl @@ -26,7 +26,8 @@ module html { interface [ - GenerateConstructor + GenerateConstructor, + Conditional=DATAGRID ] HTMLDataGridRowElement : HTMLElement { attribute boolean selected; // Whether or not the row is currently selected. attribute boolean focused; // Whether or not the row is the current object in the tree for keyboard navigation (or as the principal item of a multiple selection). diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h b/src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h index 6be4c22..eead141 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLDirectoryElement.h @@ -26,8 +26,7 @@ namespace WebCore { -class HTMLDirectoryElement : public HTMLElement -{ +class HTMLDirectoryElement : public HTMLElement { public: HTMLDirectoryElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLElement.cpp index 5655df8..8acc6bd 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLElement.cpp @@ -79,7 +79,7 @@ HTMLTagStatus HTMLElement::endTagRequirement() const { if (hasLocalName(wbrTag)) return TagStatusForbidden; - if (hasLocalName(dtTag) || hasLocalName(ddTag)) + if (hasLocalName(dtTag) || hasLocalName(ddTag) || hasLocalName(rpTag) || hasLocalName(rtTag)) return TagStatusOptional; // Same values as <span>. This way custom tag name elements will behave like inline spans. @@ -90,9 +90,9 @@ int HTMLElement::tagPriority() const { if (hasLocalName(wbrTag)) return 0; - if (hasLocalName(addressTag) || hasLocalName(ddTag) || hasLocalName(dtTag) || hasLocalName(noscriptTag)) + if (hasLocalName(addressTag) || hasLocalName(ddTag) || hasLocalName(dtTag) || hasLocalName(noscriptTag) || hasLocalName(rpTag) || hasLocalName(rtTag)) return 3; - if (hasLocalName(centerTag) || hasLocalName(nobrTag)) + if (hasLocalName(centerTag) || hasLocalName(nobrTag) || hasLocalName(rubyTag)) return 5; if (hasLocalName(noembedTag) || hasLocalName(noframesTag)) return 10; @@ -875,6 +875,9 @@ static HashSet<AtomicStringImpl*>* inlineTagList() tagList.add(audioTag.localName().impl()); tagList.add(videoTag.localName().impl()); #endif + tagList.add(rpTag.localName().impl()); + tagList.add(rtTag.localName().impl()); + tagList.add(rubyTag.localName().impl()); } return &tagList; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp index eb8d4ed..eb83173 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.cpp @@ -34,7 +34,7 @@ namespace WebCore { using namespace HTMLNames; HTMLFieldSetElement::HTMLFieldSetElement(const QualifiedName& tagName, Document *doc, HTMLFormElement *f) - : HTMLFormControlElement(tagName, doc, f) + : HTMLFormControlElement(tagName, doc, f) { ASSERT(hasTagName(fieldsetTag)); } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl index c48f8d6..371f3fd 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLFieldSetElement.idl @@ -25,6 +25,9 @@ module html { ImplementationUUID=93573758-96db-415d-9bdc-ee7238604094 ] HTMLFieldSetElement : HTMLElement { readonly attribute HTMLFormElement form; +#if !defined(LANGUAGE_COM) || !LANGUAGE_COM + readonly attribute ValidityState validity; +#endif readonly attribute boolean willValidate; }; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp index b985e75..87938ac 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "HTMLFormControlElement.h" +#include "ChromeClient.h" #include "Document.h" #include "EventHandler.h" #include "EventNames.h" @@ -35,8 +36,10 @@ #include "HTMLParser.h" #include "HTMLTokenizer.h" #include "MappedAttribute.h" +#include "Page.h" #include "RenderBox.h" #include "RenderTheme.h" +#include "ValidityState.h" namespace WebCore { @@ -61,6 +64,14 @@ HTMLFormControlElement::~HTMLFormControlElement() m_form->removeFormElement(this); } +ValidityState* HTMLFormControlElement::validity() +{ + if (!m_validityState) + m_validityState = ValidityState::create(this); + + return m_validityState.get(); +} + void HTMLFormControlElement::parseMappedAttribute(MappedAttribute *attr) { if (attr->name() == nameAttr) { @@ -242,6 +253,22 @@ bool HTMLFormControlElement::willValidate() const return form() && name().length() && !disabled() && !isReadOnlyFormControl(); } +void HTMLFormControlElement::dispatchFocusEvent() +{ + if (document()->frame() && document()->frame()->page()) + document()->frame()->page()->chrome()->client()->formDidFocus(this); + + HTMLElement::dispatchFocusEvent(); +} + +void HTMLFormControlElement::dispatchBlurEvent() +{ + if (document()->frame() && document()->frame()->page()) + document()->frame()->page()->chrome()->client()->formDidBlur(this); + + HTMLElement::dispatchBlurEvent(); +} + bool HTMLFormControlElement::supportsFocus() const { return isFocusable() || (!disabled() && !document()->haveStylesheetsLoaded()); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h index 0a7bbd1..a03eb1a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormControlElement.h @@ -30,6 +30,7 @@ namespace WebCore { class FormDataList; class HTMLFormElement; +class ValidityState; class HTMLFormControlElement : public HTMLElement { public: @@ -40,6 +41,7 @@ public: virtual int tagPriority() const { return 1; } HTMLFormElement* form() const { return m_form; } + virtual ValidityState* validity(); virtual bool isTextFormControl() const { return false; } virtual bool isEnabledFormControl() const { return !disabled(); } @@ -100,6 +102,9 @@ public: void formDestroyed() { m_form = 0; } + virtual void dispatchFocusEvent(); + virtual void dispatchBlurEvent(); + protected: void removeFromForm(); @@ -107,6 +112,7 @@ private: virtual HTMLFormElement* virtualForm() const; HTMLFormElement* m_form; + RefPtr<ValidityState> m_validityState; bool m_disabled; bool m_readOnly; bool m_valueMatchesRenderer; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp index 64cac37..f2012e1 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.cpp @@ -328,7 +328,7 @@ static void transferMailtoPostFormDataToURL(RefPtr<FormData>& data, KURL& url, c url.setQuery(query); } -void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockHistory, bool lockBackForwardList) +void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockHistory) { FrameView* view = document()->view(); Frame* frame = document()->frame(); @@ -389,14 +389,14 @@ void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockH m_url = url.string(); } - frame->loader()->submitForm("POST", m_url, data.release(), m_target, m_formDataBuilder.encodingType(), String(), lockHistory, lockBackForwardList, event, formState.release()); + frame->loader()->submitForm("POST", m_url, data.release(), m_target, m_formDataBuilder.encodingType(), String(), lockHistory, event, formState.release()); } else { Vector<char> boundary = m_formDataBuilder.generateUniqueBoundaryString(); - frame->loader()->submitForm("POST", m_url, createFormData(boundary.data()), m_target, m_formDataBuilder.encodingType(), boundary.data(), lockHistory, lockBackForwardList, event, formState.release()); + frame->loader()->submitForm("POST", m_url, createFormData(boundary.data()), m_target, m_formDataBuilder.encodingType(), boundary.data(), lockHistory, event, formState.release()); } } else { m_formDataBuilder.setIsMultiPartForm(false); - frame->loader()->submitForm("GET", m_url, createFormData(CString()), m_target, String(), String(), lockHistory, lockBackForwardList, event, formState.release()); + frame->loader()->submitForm("GET", m_url, createFormData(CString()), m_target, String(), String(), lockHistory, event, formState.release()); } if (needButtonActivation && firstSuccessfulSubmitButton) @@ -415,7 +415,7 @@ void HTMLFormElement::reset() // ### DOM2 labels this event as not cancelable, however // common browsers( sick! ) allow it be cancelled. - if ( !dispatchEvent(eventNames().resetEvent,true, true) ) { + if ( !dispatchEvent(eventNames().resetEvent, true, true) ) { m_inreset = false; return; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h index d08e16c..6b7812a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLFormElement.h @@ -78,7 +78,7 @@ public: void removeImgElement(HTMLImageElement*); bool prepareSubmit(Event*); - void submit(Event* = 0, bool activateSubmitButton = false, bool lockHistory = false, bool lockBackForwardList = false); + void submit(Event* = 0, bool activateSubmitButton = false, bool lockHistory = false); void reset(); // Used to indicate a malformed state to keep from applying the bottom margin of the form. diff --git a/src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp index d6cc58e..6858f56 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp @@ -71,7 +71,7 @@ void HTMLHRElement::parseMappedAttribute(MappedAttribute *attr) } else if (attr->name() == widthAttr) { bool ok; int v = attr->value().toInt(&ok); - if(ok && !v) + if (ok && !v) addCSSLength(attr, CSSPropertyWidth, "1"); else addCSSLength(attr, CSSPropertyWidth, attr->value()); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h b/src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h index 2f01ef2..21d8a2f 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h @@ -30,8 +30,7 @@ namespace WebCore { -class HTMLHeadElement : public HTMLElement -{ +class HTMLHeadElement : public HTMLElement { public: HTMLHeadElement(const QualifiedName&, Document*); ~HTMLHeadElement(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h b/src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h index 91a0045..86603b5 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h @@ -30,8 +30,7 @@ namespace WebCore { -class HTMLHtmlElement : public HTMLElement -{ +class HTMLHtmlElement : public HTMLElement { public: HTMLHtmlElement(const QualifiedName&, Document*); ~HTMLHtmlElement(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h b/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h index 25cbb55..ae2ce38 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLImageElement.h @@ -67,7 +67,7 @@ public: CachedImage* cachedImage() const { return m_imageLoader.image(); } void setCachedImage(CachedImage* i) { m_imageLoader.setImage(i); }; - void setLoadManually (bool loadManually) { m_imageLoader.setLoadManually(loadManually); } + void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); } String name() const; void setName(const String&); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp index ae7e768..8b2aa0e 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp @@ -1590,9 +1590,9 @@ void HTMLInputElement::onSearch() VisibleSelection HTMLInputElement::selection() const { - if (!renderer() || !isTextField() || m_data.cachedSelectionStart() == -1 || m_data.cachedSelectionEnd() == -1) + if (!renderer() || !isTextField() || m_data.cachedSelectionStart() == -1 || m_data.cachedSelectionEnd() == -1) return VisibleSelection(); - return toRenderTextControl(renderer())->selection(m_data.cachedSelectionStart(), m_data.cachedSelectionEnd()); + return toRenderTextControl(renderer())->selection(m_data.cachedSelectionStart(), m_data.cachedSelectionEnd()); } void HTMLInputElement::documentDidBecomeActive() diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl index 5536733..7cd91b0 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.idl @@ -28,6 +28,9 @@ module html { attribute [ConvertNullToNullString] DOMString defaultValue; attribute boolean defaultChecked; readonly attribute HTMLFormElement form; +#if !defined(LANGUAGE_COM) || !LANGUAGE_COM + readonly attribute ValidityState validity; +#endif attribute [ConvertNullToNullString] DOMString accept; attribute [ConvertNullToNullString] DOMString accessKey; attribute [ConvertNullToNullString] DOMString align; @@ -69,7 +72,7 @@ module html { readonly attribute URL absoluteImageURL; #endif -#if !defined(LANGUAGE_COM) +#if !defined(LANGUAGE_COM) || !LANGUAGE_COM readonly attribute FileList files; #endif }; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h b/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h index 82042cf..a1462b8 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLIsIndexElement.h @@ -27,8 +27,7 @@ namespace WebCore { -class HTMLIsIndexElement : public HTMLInputElement -{ +class HTMLIsIndexElement : public HTMLInputElement { public: HTMLIsIndexElement(const QualifiedName&, Document *doc, HTMLFormElement *f = 0); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp index cb8f36c..986544a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLLinkElement.cpp @@ -181,9 +181,11 @@ void HTMLLinkElement::process() if (m_isDNSPrefetch && m_url.isValid() && !m_url.isEmpty()) prefetchDNS(m_url.host()); + bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings() && document()->page()->settings()->treatsAnyTextCSSLinkAsStylesheet(); + // Stylesheet // This was buggy and would incorrectly match <link rel="alternate">, which has a different specified meaning. -dwh - if (m_disabledState != 2 && m_isStyleSheet && document()->frame() && m_url.isValid()) { + if (m_disabledState != 2 && (m_isStyleSheet || acceptIfTypeContainsTextCSS && type.contains("text/css")) && document()->frame() && m_url.isValid()) { // also, don't load style sheets for standalone documents // Add ourselves as a pending sheet, but only if we aren't an alternate // stylesheet. Alternate stylesheets don't hold up render tree construction. diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp index d62eaab..0cb6501 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLMarqueeElement.cpp @@ -34,7 +34,7 @@ namespace WebCore { using namespace HTMLNames; - // WinIE uses 60ms as the minimum delay by default. +// WinIE uses 60ms as the minimum delay by default. const int defaultMinimumDelay = 60; HTMLMarqueeElement::HTMLMarqueeElement(const QualifiedName& tagName, Document* doc) diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp index 3d48b82..716a592 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp @@ -391,7 +391,7 @@ String HTMLMediaElement::canPlayType(const String& mimeType) const switch (support) { case MediaPlayer::IsNotSupported: - canPlay = "no"; + canPlay = ""; break; case MediaPlayer::MayBeSupported: canPlay = "maybe"; @@ -690,7 +690,6 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state) } if (state == MediaPlayer::Idle) { - ASSERT(static_cast<ReadyState>(m_player->readyState()) < HAVE_ENOUGH_DATA); if (m_networkState > NETWORK_IDLE) { stopPeriodicTimers(); scheduleProgressEvent(eventNames().suspendEvent); @@ -752,7 +751,6 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) if (m_seeking && m_readyState < HAVE_CURRENT_DATA) { // 4.8.10.10, step 9 scheduleEvent(eventNames().seekingEvent); - m_seeking = false; } if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) { @@ -839,6 +837,18 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) } } +void HTMLMediaElement::rewind(float timeDelta) +{ + ExceptionCode e; + setCurrentTime(max(currentTime() - timeDelta, minTimeSeekable()), e); +} + +void HTMLMediaElement::returnToRealtime() +{ + ExceptionCode e; + setCurrentTime(maxTimeSeekable(), e); +} + void HTMLMediaElement::seek(float time, ExceptionCode& ec) { // 4.8.10.10. Seeking @@ -891,6 +901,11 @@ HTMLMediaElement::ReadyState HTMLMediaElement::readyState() const return m_readyState; } +MediaPlayer::MovieLoadType HTMLMediaElement::movieLoadType() const +{ + return m_player ? m_player->movieLoadType() : MediaPlayer::Unknown; +} + bool HTMLMediaElement::seeking() const { return m_seeking; @@ -1408,9 +1423,9 @@ PassRefPtr<TimeRanges> HTMLMediaElement::played() const PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const { // FIXME real ranges support - if (!m_player || !m_player->maxTimeSeekable()) + if (!maxTimeSeekable()) return TimeRanges::create(); - return TimeRanges::create(0, m_player->maxTimeSeekable()); + return TimeRanges::create(minTimeSeekable(), maxTimeSeekable()); } bool HTMLMediaElement::potentiallyPlaying() const @@ -1444,6 +1459,16 @@ bool HTMLMediaElement::pausedForUserInteraction() const return false; } +float HTMLMediaElement::minTimeSeekable() const +{ + return 0; +} + +float HTMLMediaElement::maxTimeSeekable() const +{ + return m_player ? m_player->maxTimeSeekable() : 0; +} + void HTMLMediaElement::updateVolume() { if (!m_player) @@ -1603,7 +1628,7 @@ bool HTMLMediaElement::processingUserGesture() const FrameLoader* loader = frame ? frame->loader() : 0; // return 'true' for safety if we don't know the answer - return loader ? loader->userGestureHint() : true; + return loader ? loader->isProcessingUserGesture() : true; } #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h index 8d238d5..486574b 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h @@ -66,6 +66,9 @@ public: virtual bool isVideo() const { return false; } virtual bool hasVideo() const { return false; } + void rewind(float timeDelta); + void returnToRealtime(); + virtual bool supportsFullscreen() const { return false; } void scheduleLoad(); @@ -75,6 +78,8 @@ public: // Pauses playback without changing any states or generating events void setPausedInternal(bool); + MediaPlayer::MovieLoadType movieLoadType() const; + bool inActiveDocument() const { return m_inActiveDocument; } // DOM API @@ -221,10 +226,12 @@ private: bool stoppedDueToErrors() const; bool pausedForUserInteraction() const; + float minTimeSeekable() const; + float maxTimeSeekable() const; + // Restrictions to change default behaviors. This is a effectively a compile time choice at the moment // because there are no accessor methods. - enum BehaviorRestrictions - { + enum BehaviorRestrictions { NoRestrictions = 0, RequireUserGestureForLoadRestriction = 1 << 0, RequireUserGestureForRateChangeRestriction = 1 << 1, diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h index 0f4488d..68b5b8f 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h @@ -26,8 +26,7 @@ namespace WebCore { -class HTMLMenuElement : public HTMLElement -{ +class HTMLMenuElement : public HTMLElement { public: HTMLMenuElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h index f535293..d86df2e 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h @@ -28,8 +28,7 @@ namespace WebCore { -class HTMLMetaElement : public HTMLElement -{ +class HTMLMetaElement : public HTMLElement { public: HTMLMetaElement(const QualifiedName&, Document*); ~HTMLMetaElement(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLModElement.h b/src/3rdparty/webkit/WebCore/html/HTMLModElement.h index 399053c..83697f9 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLModElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLModElement.h @@ -30,8 +30,7 @@ namespace WebCore { class String; -class HTMLModElement : public HTMLElement -{ +class HTMLModElement : public HTMLElement { public: HTMLModElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLOListElement.h b/src/3rdparty/webkit/WebCore/html/HTMLOListElement.h index e459269..b7a13ee 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLOListElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLOListElement.h @@ -26,8 +26,7 @@ namespace WebCore { -class HTMLOListElement : public HTMLElement -{ +class HTMLOListElement : public HTMLElement { public: HTMLOListElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp index 1d446f7..8cb95d0 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLOptionElement.cpp @@ -152,10 +152,10 @@ void HTMLOptionElement::setSelectedState(bool selected) void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { - HTMLSelectElement* select = ownerSelectElement(); - if (select) - select->childrenChanged(changedByParser); - HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); + HTMLSelectElement* select = ownerSelectElement(); + if (select) + select->childrenChanged(changedByParser); + HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParamElement.h b/src/3rdparty/webkit/WebCore/html/HTMLParamElement.h index 4da2ed3..1867ccf 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLParamElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLParamElement.h @@ -27,8 +27,7 @@ namespace WebCore { -class HTMLParamElement : public HTMLElement -{ +class HTMLParamElement : public HTMLElement { friend class HTMLAppletElement; public: HTMLParamElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp index ea6bbe2..722f4e2 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLParser.cpp @@ -793,6 +793,20 @@ bool HTMLParser::dtCreateErrorCheck(Token* t, RefPtr<Node>& result) return true; } +bool HTMLParser::rpCreateErrorCheck(Token*, RefPtr<Node>&) +{ + popBlock(rpTag); + popBlock(rtTag); + return true; +} + +bool HTMLParser::rtCreateErrorCheck(Token*, RefPtr<Node>&) +{ + popBlock(rpTag); + popBlock(rtTag); + return true; +} + bool HTMLParser::nestedCreateErrorCheck(Token* t, RefPtr<Node>&) { popBlock(t->tagName); @@ -917,6 +931,8 @@ PassRefPtr<Node> HTMLParser::getNode(Token* t) gFunctionMap.set(pTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck); gFunctionMap.set(plaintextTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck); gFunctionMap.set(preTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck); + gFunctionMap.set(rpTag.localName().impl(), &HTMLParser::rpCreateErrorCheck); + gFunctionMap.set(rtTag.localName().impl(), &HTMLParser::rtCreateErrorCheck); gFunctionMap.set(sTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck); gFunctionMap.set(selectTag.localName().impl(), &HTMLParser::selectCreateErrorCheck); gFunctionMap.set(smallTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck); @@ -1656,7 +1672,7 @@ void HTMLParser::reportErrorToConsole(HTMLParserErrorCode errorCode, const Atomi message.replace("%tag1", tag1); message.replace("%tag2", tag2); - frame->domWindow()->console()->addMessage(HTMLMessageSource, + frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, isWarning(errorCode) ? WarningMessageLevel : ErrorMessageLevel, message, lineNumber, m_document->url().string()); } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLParser.h b/src/3rdparty/webkit/WebCore/html/HTMLParser.h index 19f553e..bd12049 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLParser.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLParser.h @@ -102,6 +102,8 @@ private: bool noscriptCreateErrorCheck(Token*, RefPtr<Node>&); bool pCloserCreateErrorCheck(Token*, RefPtr<Node>&); bool pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&); + bool rpCreateErrorCheck(Token*, RefPtr<Node>&); + bool rtCreateErrorCheck(Token*, RefPtr<Node>&); bool selectCreateErrorCheck(Token*, RefPtr<Node>&); bool tableCellCreateErrorCheck(Token*, RefPtr<Node>&); bool tableSectionCreateErrorCheck(Token*, RefPtr<Node>&); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h b/src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h index 623c28f..addbfb4 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLQuoteElement.h @@ -28,8 +28,7 @@ namespace WebCore { class String; -class HTMLQuoteElement : public HTMLElement -{ +class HTMLQuoteElement : public HTMLElement { public: HTMLQuoteElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp index c47bb70..2409f31 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.cpp @@ -106,13 +106,7 @@ int HTMLSelectElement::activeSelectionEndListIndex() const unsigned HTMLSelectElement::length() const { - unsigned len = 0; - const Vector<Element*>& items = listItems(); - for (unsigned i = 0; i < items.size(); ++i) { - if (items[i]->hasLocalName(optionTag)) - ++len; - } - return len; + return SelectElement::optionCount(m_data, this); } void HTMLSelectElement::add(HTMLElement *element, HTMLElement *before, ExceptionCode& ec) diff --git a/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl index fb08bb1..26f2653 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLSelectElement.idl @@ -41,6 +41,9 @@ module html { #endif readonly attribute HTMLFormElement form; +#if !defined(LANGUAGE_COM) || !LANGUAGE_COM + readonly attribute ValidityState validity; +#endif readonly attribute boolean willValidate; // Modified in DOM Level 2: diff --git a/src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h b/src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h index fe3adb0..03b4c66 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLStyleElement.h @@ -28,8 +28,7 @@ namespace WebCore { -class HTMLStyleElement : public HTMLElement, public StyleElement -{ +class HTMLStyleElement : public HTMLElement, public StyleElement { public: HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h index 38bc434..3c2aaa1 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLTableCaptionElement.h @@ -30,8 +30,7 @@ namespace WebCore { -class HTMLTableCaptionElement : public HTMLTablePartElement -{ +class HTMLTableCaptionElement : public HTMLTablePartElement { public: HTMLTableCaptionElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h index 7e26e94..fc74cae 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLTableCellElement.h @@ -32,8 +32,7 @@ namespace WebCore { -class HTMLTableCellElement : public HTMLTablePartElement -{ +class HTMLTableCellElement : public HTMLTablePartElement { public: HTMLTableCellElement(const QualifiedName&, Document*); ~HTMLTableCellElement(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h index 0bed401..83a26aa 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLTableColElement.h @@ -34,8 +34,7 @@ namespace WebCore { class HTMLTableElement; -class HTMLTableColElement : public HTMLTablePartElement -{ +class HTMLTableColElement : public HTMLTablePartElement { public: HTMLTableColElement(const QualifiedName& tagName, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp index e91a96a..15fa97e 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTableSectionElement.cpp @@ -99,7 +99,7 @@ PassRefPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionC return r.release(); } -void HTMLTableSectionElement::deleteRow( int index, ExceptionCode& ec) +void HTMLTableSectionElement::deleteRow(int index, ExceptionCode& ec) { RefPtr<HTMLCollection> children = rows(); int numRows = children ? (int)children->length() : 0; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTagNames.in b/src/3rdparty/webkit/WebCore/html/HTMLTagNames.in index e6bbfc9..c066e3c 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTagNames.in +++ b/src/3rdparty/webkit/WebCore/html/HTMLTagNames.in @@ -25,10 +25,10 @@ cite interfaceName=HTMLElement code interfaceName=HTMLElement col interfaceName=HTMLTableColElement colgroup interfaceName=HTMLTableColElement -datagrid interfaceName=HTMLDataGridElement -dcell interfaceName=HTMLDataGridCellElement -dcol interfaceName=HTMLDataGridColElement -drow interfaceName=HTMLDataGridRowElement +datagrid interfaceName=HTMLDataGridElement,conditional=DATAGRID +dcell interfaceName=HTMLDataGridCellElement,conditional=DATAGRID +dcol interfaceName=HTMLDataGridColElement,conditional=DATAGRID +drow interfaceName=HTMLDataGridRowElement,conditional=DATAGRID dd interfaceName=HTMLElement del interfaceName=HTMLModElement dfn interfaceName=HTMLElement @@ -89,6 +89,9 @@ param plaintext interfaceName=HTMLElement pre q interfaceName=HTMLQuoteElement +rp interfaceName=HTMLElement +rt interfaceName=HTMLElement +ruby interfaceName=HTMLElement s interfaceName=HTMLElement samp interfaceName=HTMLElement script constructorNeedsCreatedByParser diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl index c4f144b..f6ac05a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLTextAreaElement.idl @@ -27,6 +27,9 @@ module html { ] HTMLTextAreaElement : HTMLElement { attribute [ConvertNullToNullString] DOMString defaultValue; readonly attribute HTMLFormElement form; +#if !defined(LANGUAGE_COM) || !LANGUAGE_COM + readonly attribute ValidityState validity; +#endif attribute [ConvertNullToNullString] DOMString accessKey; attribute long cols; attribute boolean disabled; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h b/src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h index 2cbb667..5335d8d 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLTitleElement.h @@ -28,8 +28,7 @@ namespace WebCore { -class HTMLTitleElement : public HTMLElement -{ +class HTMLTitleElement : public HTMLElement { public: HTMLTitleElement(const QualifiedName&, Document*); ~HTMLTitleElement(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp index 6966351..5788eb6 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp @@ -321,7 +321,7 @@ HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State { ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState()); ASSERT(!state.hasTagState()); - ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1 ); + ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1); if (state.inScript() && !m_currentScriptTagStartLineNumber) m_currentScriptTagStartLineNumber = m_lineNumber; @@ -730,9 +730,9 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de EntityUnicodeValue = 0; } - while(!src.isEmpty()) { + while (!src.isEmpty()) { UChar cc = *src; - switch(state.entityState()) { + switch (state.entityState()) { case NoEntity: ASSERT(state.entityState() != NoEntity); return state; @@ -781,7 +781,7 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de case Decimal: { int ll = min(src.length(), 9-cBufferPos); - while(ll--) { + while (ll--) { cc = *src; if (!(cc >= '0' && cc <= '9')) { @@ -800,7 +800,7 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de case EntityName: { int ll = min(src.length(), 9-cBufferPos); - while(ll--) { + while (ll--) { cc = *src; if (!((cc >= 'a' && cc <= 'z') || (cc >= '0' && cc <= '9') || (cc >= 'A' && cc <= 'Z'))) { @@ -814,7 +814,7 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de if (cBufferPos == 9) state.setEntityState(SearchSemicolon); if (state.entityState() == SearchSemicolon) { - if(cBufferPos > 1) { + if (cBufferPos > 1) { // Since the maximum length of entity name is 9, // so a single char array which is allocated on // the stack, its length is 10, should be OK. @@ -837,11 +837,11 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de else e = 0; - if(e) + if (e) EntityUnicodeValue = e->code; // be IE compatible - if(parsingTag && EntityUnicodeValue > 255 && *src != ';') + if (parsingTag && EntityUnicodeValue > 255 && *src != ';') EntityUnicodeValue = 0; } } @@ -1122,7 +1122,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) while (!src.isEmpty()) { checkBuffer(); - switch(state.tagState()) { + switch (state.tagState()) { case NoTag: { m_cBufferPos = cBufferPos; @@ -1237,7 +1237,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) break; } case SearchAttribute: - while(!src.isEmpty()) { + while (!src.isEmpty()) { UChar curchar = *src; // In this mode just ignore any quotes we encounter and treat them like spaces. if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"') { @@ -1256,6 +1256,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) break; case AttributeName: { + m_rawAttributeBeforeValue.clear(); int ll = min(src.length(), CBUFLEN - cBufferPos); while (ll--) { UChar curchar = *src; @@ -1278,6 +1279,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) else m_cBuffer[cBufferPos++] = curchar; + m_rawAttributeBeforeValue.append(curchar); src.advance(m_lineNumber); } if (cBufferPos == CBUFLEN) { @@ -1309,6 +1311,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) state.setTagState(SearchValue); if (inViewSourceMode()) m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); src.advancePastNonNewline(); } else { m_currentToken.addAttribute(m_attrName, emptyAtom, inViewSourceMode()); @@ -1318,11 +1321,12 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) } break; } - if (inViewSourceMode()) - m_currentToken.addViewSourceChar(curchar); - + lastIsSlash = curchar == '/'; + if (inViewSourceMode()) + m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); src.advance(m_lineNumber); } break; @@ -1335,6 +1339,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) state.setTagState(QuotedValue); if (inViewSourceMode()) m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); src.advancePastNonNewline(); } else state.setTagState(Value); @@ -1343,6 +1348,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) } if (inViewSourceMode()) m_currentToken.addViewSourceChar(curchar); + m_rawAttributeBeforeValue.append(curchar); src.advance(m_lineNumber); } break; @@ -1391,6 +1397,13 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) m_currentToken.addViewSourceChar('x'); } else if (inViewSourceMode()) m_currentToken.addViewSourceChar('v'); + + if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_parser->skipMode() && m_attrName == srcAttr) { + String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); + if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(context, attributeValue)) + attributeValue = blankURL().string(); + } + m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); m_dest = m_buffer; state.setTagState(SearchAttribute); @@ -1407,7 +1420,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) } break; case Value: - while(!src.isEmpty()) { + while (!src.isEmpty()) { checkBuffer(); UChar curchar = *src; if (curchar <= '>' && !src.escaped()) { @@ -1421,6 +1434,13 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) // '/' does not delimit in IE! if (isASCIISpace(curchar) || curchar == '>') { AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); + + if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_parser->skipMode() && m_attrName == srcAttr) { + String context(m_rawAttributeBeforeValue.data(), m_rawAttributeBeforeValue.size()); + if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(context, attributeValue)) + attributeValue = blankURL().string(); + } + m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode()); if (inViewSourceMode()) m_currentToken.addViewSourceChar('v'); @@ -1473,11 +1493,8 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) m_scriptTagCharsetAttrValue = String(); if (m_currentToken.attrs && !m_fragment) { if (m_doc->frame() && m_doc->frame()->script()->isEnabled()) { - if ((a = m_currentToken.attrs->getAttributeItem(srcAttr))) { + if ((a = m_currentToken.attrs->getAttributeItem(srcAttr))) m_scriptTagSrcAttrValue = m_doc->completeURL(parseURL(a->value())).string(); - if (m_XSSAuditor && !m_XSSAuditor->canLoadExternalScriptFromSrc(a->value())) - m_scriptTagSrcAttrValue = String(); - } } } } @@ -1684,7 +1701,7 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData) else if (state.startTag()) { state.setStartTag(false); - switch(cc) { + switch (cc) { case '/': break; case '!': { @@ -1712,7 +1729,7 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData) } // else fall through default: { - if( ((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) { + if ( ((cc >= 'a') && (cc <= 'z')) || ((cc >= 'A') && (cc <= 'Z'))) { // Start of a Start-Tag } else { // Invalid tag diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h index 6612af8..d731b2d 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h @@ -213,6 +213,10 @@ private: Token m_currentToken; + // This buffer holds the raw characters we've seen between the beginning of + // the attribute name and the first character of the attribute value. + Vector<UChar, 32> m_rawAttributeBeforeValue; + // Tokenizer flags ////////////////// // are we in quotes within a html tag diff --git a/src/3rdparty/webkit/WebCore/html/HTMLUListElement.h b/src/3rdparty/webkit/WebCore/html/HTMLUListElement.h index 3a565a4..1eda5f3 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLUListElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLUListElement.h @@ -26,8 +26,7 @@ namespace WebCore { -class HTMLUListElement : public HTMLElement -{ +class HTMLUListElement : public HTMLElement { public: HTMLUListElement(const QualifiedName&, Document*); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp index a6210a2..ecd74e7 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.cpp @@ -186,7 +186,7 @@ void HTMLVideoElement::updatePosterImage() #endif } -void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& r) +void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& destRect) { // FIXME: We should also be able to paint the poster image. @@ -195,7 +195,19 @@ void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& r) return; player->setVisible(true); // Make player visible or it won't draw. - player->paint(context, r); + player->paint(context, destRect); +} + +void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect) +{ + // FIXME: We should also be able to paint the poster image. + + MediaPlayer* player = HTMLMediaElement::player(); + if (!player) + return; + + player->setVisible(true); // Make player visible or it won't draw. + player->paintCurrentFrameInContext(context, destRect); } } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h b/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h index 830e72e..dc9714a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLVideoElement.h @@ -35,8 +35,7 @@ namespace WebCore { class HTMLImageLoader; -class HTMLVideoElement : public HTMLMediaElement -{ +class HTMLVideoElement : public HTMLMediaElement { public: HTMLVideoElement(const QualifiedName&, Document*); @@ -67,8 +66,9 @@ public: void updatePosterImage(); - // Used by canvas to gain raw pixel access void paint(GraphicsContext*, const IntRect&); + // Used by canvas to gain raw pixel access + void paintCurrentFrameInContext(GraphicsContext*, const IntRect&); private: OwnPtr<HTMLImageLoader> m_imageLoader; diff --git a/src/3rdparty/webkit/WebCore/html/ImageData.idl b/src/3rdparty/webkit/WebCore/html/ImageData.idl index 7f37b52..8025de1 100644 --- a/src/3rdparty/webkit/WebCore/html/ImageData.idl +++ b/src/3rdparty/webkit/WebCore/html/ImageData.idl @@ -29,8 +29,8 @@ module html { interface [ + CustomToJS, GenerateConstructor, - GenerateToJS ] ImageData { readonly attribute long width; readonly attribute long height; diff --git a/src/3rdparty/webkit/WebCore/html/TimeRanges.h b/src/3rdparty/webkit/WebCore/html/TimeRanges.h index 37820dc..6be8c4e 100644 --- a/src/3rdparty/webkit/WebCore/html/TimeRanges.h +++ b/src/3rdparty/webkit/WebCore/html/TimeRanges.h @@ -64,7 +64,8 @@ private: // We consider all the Ranges to be semi-bounded as follow: [start, end[ struct Range { Range() { } - Range(float start, float end) { + Range(float start, float end) + { m_start = start; m_end = end; } diff --git a/src/3rdparty/webkit/WebCore/html/ValidityState.cpp b/src/3rdparty/webkit/WebCore/html/ValidityState.cpp new file mode 100644 index 0000000..8ff629c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/ValidityState.cpp @@ -0,0 +1,43 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.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" +#include "ValidityState.h" +#include "HTMLFormControlElement.h" + +namespace WebCore { + +ValidityState::ValidityState(HTMLFormControlElement* parent) + : m_control(parent) +{ + ASSERT(parent); +} + +bool ValidityState::valid() +{ + bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow() || + tooLong() || patternMismatch() || valueMissing() || customError(); + + return !someError; +} + +} // namespace diff --git a/src/3rdparty/webkit/WebCore/html/ValidityState.h b/src/3rdparty/webkit/WebCore/html/ValidityState.h new file mode 100644 index 0000000..a011f7a --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/ValidityState.h @@ -0,0 +1,59 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.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 ValidityState_h +#define ValidityState_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + + class HTMLFormControlElement; + + class ValidityState : public RefCounted<ValidityState> { + public: + static PassRefPtr<ValidityState> create(HTMLFormControlElement* owner) + { + return adoptRef(new ValidityState(owner)); + } + + HTMLFormControlElement* control() const { return m_control; } + + bool valueMissing() { return false; } + bool typeMismatch() { return false; } + bool patternMismatch() { return false; } + bool tooLong() { return false; } + bool rangeUnderflow() { return false; } + bool rangeOverflow() { return false; } + bool stepMismatch() { return false; } + bool customError() { return false; } + bool valid(); + + private: + ValidityState(HTMLFormControlElement*); + HTMLFormControlElement* m_control; + }; + +} // namespace WebCore + +#endif // ValidityState_h diff --git a/src/3rdparty/webkit/WebCore/html/ValidityState.idl b/src/3rdparty/webkit/WebCore/html/ValidityState.idl new file mode 100644 index 0000000..b926852 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/ValidityState.idl @@ -0,0 +1,36 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.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. + * + */ + +module html { + + interface ValidityState { + readonly attribute boolean valueMissing; + readonly attribute boolean typeMismatch; + readonly attribute boolean patternMismatch; + readonly attribute boolean tooLong; + readonly attribute boolean rangeUnderflow; + readonly attribute boolean rangeOverflow; + readonly attribute boolean stepMismatch; + readonly attribute boolean customError; + readonly attribute boolean valid; + }; +} |