From dfe289850f068f19ba4a83ab4e7e22a7e09c13c9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:21 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- tdehtml/html/AlwaysInline.h | 49 + tdehtml/html/CMakeLists.txt | 44 + tdehtml/html/Makefile.am | 54 + tdehtml/html/Platform.h | 218 +++ tdehtml/html/RefPtr.h | 202 +++ tdehtml/html/doctypes.cpp | 1174 ++++++++++++++ tdehtml/html/doctypes.gperf | 91 ++ tdehtml/html/dtd.cpp | 918 +++++++++++ tdehtml/html/dtd.dtd | 1072 +++++++++++++ tdehtml/html/dtd.h | 41 + tdehtml/html/html_baseimpl.cpp | 708 +++++++++ tdehtml/html/html_baseimpl.h | 207 +++ tdehtml/html/html_blockimpl.cpp | 371 +++++ tdehtml/html/html_blockimpl.h | 108 ++ tdehtml/html/html_documentimpl.cpp | 537 +++++++ tdehtml/html/html_documentimpl.h | 95 ++ tdehtml/html/html_elementimpl.cpp | 685 +++++++++ tdehtml/html/html_elementimpl.h | 89 ++ tdehtml/html/html_formimpl.cpp | 2980 ++++++++++++++++++++++++++++++++++++ tdehtml/html/html_formimpl.h | 606 ++++++++ tdehtml/html/html_headimpl.cpp | 649 ++++++++ tdehtml/html/html_headimpl.h | 233 +++ tdehtml/html/html_imageimpl.cpp | 560 +++++++ tdehtml/html/html_imageimpl.h | 150 ++ tdehtml/html/html_inlineimpl.cpp | 298 ++++ tdehtml/html/html_inlineimpl.h | 75 + tdehtml/html/html_listimpl.cpp | 169 ++ tdehtml/html/html_listimpl.h | 112 ++ tdehtml/html/html_miscimpl.cpp | 443 ++++++ tdehtml/html/html_miscimpl.h | 150 ++ tdehtml/html/html_objectimpl.cpp | 465 ++++++ tdehtml/html/html_objectimpl.h | 145 ++ tdehtml/html/html_tableimpl.cpp | 994 ++++++++++++ tdehtml/html/html_tableimpl.h | 329 ++++ tdehtml/html/htmlparser.cpp | 1731 +++++++++++++++++++++ tdehtml/html/htmlparser.h | 192 +++ tdehtml/html/htmltokenizer.cpp | 1798 ++++++++++++++++++++++ tdehtml/html/htmltokenizer.h | 358 +++++ 38 files changed, 19100 insertions(+) create mode 100644 tdehtml/html/AlwaysInline.h create mode 100644 tdehtml/html/CMakeLists.txt create mode 100644 tdehtml/html/Makefile.am create mode 100644 tdehtml/html/Platform.h create mode 100644 tdehtml/html/RefPtr.h create mode 100644 tdehtml/html/doctypes.cpp create mode 100644 tdehtml/html/doctypes.gperf create mode 100644 tdehtml/html/dtd.cpp create mode 100644 tdehtml/html/dtd.dtd create mode 100644 tdehtml/html/dtd.h create mode 100644 tdehtml/html/html_baseimpl.cpp create mode 100644 tdehtml/html/html_baseimpl.h create mode 100644 tdehtml/html/html_blockimpl.cpp create mode 100644 tdehtml/html/html_blockimpl.h create mode 100644 tdehtml/html/html_documentimpl.cpp create mode 100644 tdehtml/html/html_documentimpl.h create mode 100644 tdehtml/html/html_elementimpl.cpp create mode 100644 tdehtml/html/html_elementimpl.h create mode 100644 tdehtml/html/html_formimpl.cpp create mode 100644 tdehtml/html/html_formimpl.h create mode 100644 tdehtml/html/html_headimpl.cpp create mode 100644 tdehtml/html/html_headimpl.h create mode 100644 tdehtml/html/html_imageimpl.cpp create mode 100644 tdehtml/html/html_imageimpl.h create mode 100644 tdehtml/html/html_inlineimpl.cpp create mode 100644 tdehtml/html/html_inlineimpl.h create mode 100644 tdehtml/html/html_listimpl.cpp create mode 100644 tdehtml/html/html_listimpl.h create mode 100644 tdehtml/html/html_miscimpl.cpp create mode 100644 tdehtml/html/html_miscimpl.h create mode 100644 tdehtml/html/html_objectimpl.cpp create mode 100644 tdehtml/html/html_objectimpl.h create mode 100644 tdehtml/html/html_tableimpl.cpp create mode 100644 tdehtml/html/html_tableimpl.h create mode 100644 tdehtml/html/htmlparser.cpp create mode 100644 tdehtml/html/htmlparser.h create mode 100644 tdehtml/html/htmltokenizer.cpp create mode 100644 tdehtml/html/htmltokenizer.h (limited to 'tdehtml/html') diff --git a/tdehtml/html/AlwaysInline.h b/tdehtml/html/AlwaysInline.h new file mode 100644 index 000000000..71fe82928 --- /dev/null +++ b/tdehtml/html/AlwaysInline.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2005, 2007 Apple Inc. All rights reserved. + * + * 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 "html/Platform.h" + + +#ifndef ALWAYS_INLINE +#if COMPILER(GCC) && defined(NDEBUG) && __GNUC__ > 3 +#define ALWAYS_INLINE inline __attribute__ ((__always_inline__)) +#elif COMPILER(MSVC) && defined(NDEBUG) +#define ALWAYS_INLINE __forceinline +#else +#define ALWAYS_INLINE inline +#endif +#endif + +#ifndef ALWAYS_INLINE_INTO +#if COMPILER(GCC) && defined(NDEBUG) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || __GNUC__ > 4) +#define ALWAYS_INLINE_INTO __attribute__ ((__flatten__)) +#else +#define ALWAYS_INLINE_INTO +#endif +#endif + + +#ifndef NEVER_INLINE +#if COMPILER(GCC) && __GNUC__ > 3 +#define NEVER_INLINE __attribute__ ((__noinline__)) +#else +#define NEVER_INLINE +#endif +#endif diff --git a/tdehtml/html/CMakeLists.txt b/tdehtml/html/CMakeLists.txt new file mode 100644 index 000000000..a7a3bf466 --- /dev/null +++ b/tdehtml/html/CMakeLists.txt @@ -0,0 +1,44 @@ +################################################# +# +# (C) 2010 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${TQT_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/tdecore + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/tdehtml + ${CMAKE_SOURCE_DIR}/dcop + ${CMAKE_SOURCE_DIR}/tdecore + ${CMAKE_SOURCE_DIR}/tdeui + ${CMAKE_SOURCE_DIR}/kio + ${CMAKE_SOURCE_DIR}/kio/kio + ${CMAKE_SOURCE_DIR}/kio/kfile + ${CMAKE_SOURCE_DIR}/kio/kssl + ${CMAKE_SOURCE_DIR}/tdeutils + ${CMAKE_SOURCE_DIR}/tdewallet/client +) + +##### tdehtmlhtml-static ########################### + +set( target tdehtmlhtml ) + +set( ${target}_SRCS + htmlparser.cpp htmltokenizer.cpp dtd.cpp html_headimpl.cpp + html_blockimpl.cpp html_elementimpl.cpp html_inlineimpl.cpp + html_documentimpl.cpp html_baseimpl.cpp html_imageimpl.cpp + html_listimpl.cpp html_miscimpl.cpp html_formimpl.cpp + html_objectimpl.cpp html_tableimpl.cpp +) + +tde_add_library( ${target} STATIC_PIC AUTOMOC + SOURCES ${${target}_SRCS} +) diff --git a/tdehtml/html/Makefile.am b/tdehtml/html/Makefile.am new file mode 100644 index 000000000..0a3286243 --- /dev/null +++ b/tdehtml/html/Makefile.am @@ -0,0 +1,54 @@ +# This file is part of the KDE libraries +# Copyright (C) 1997 Martin Jones (mjones@kde.org) +# (C) 1997 Torben Weis (weis@kde.org) + +# 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. + +KDE_CXXFLAGS = $(WOVERLOADED_VIRTUAL) + +noinst_LTLIBRARIES = libtdehtmlhtml.la +libtdehtmlhtml_la_SOURCES = \ + htmlparser.cpp htmltokenizer.cpp \ + dtd.cpp html_headimpl.cpp html_blockimpl.cpp \ + html_elementimpl.cpp html_inlineimpl.cpp html_documentimpl.cpp \ + html_baseimpl.cpp html_imageimpl.cpp html_listimpl.cpp \ + html_miscimpl.cpp html_formimpl.cpp html_objectimpl.cpp \ + html_tableimpl.cpp + +libtdehtmlhtml_la_METASOURCES = AUTO + + +noinst_HEADERS = \ + dtd.h html_headimpl.h html_tableimpl.h \ + html_baseimpl.h html_imageimpl.h htmlparser.h \ + html_blockimpl.h html_inlineimpl.h \ + html_documentimpl.h html_listimpl.h htmltokenizer.h \ + html_elementimpl.h html_miscimpl.h \ + html_formimpl.h html_objectimpl.h + +INCLUDES = -I$(top_srcdir)/kimgio -I$(top_srcdir)/dcop \ + -I$(top_srcdir)/kio/kssl \ + -I$(top_srcdir)/kjs -I$(top_srcdir)/tdehtml -I$(top_srcdir) \ + -I$(top_srcdir)/tdewallet/client -I$(top_srcdir)/tdeutils \ + $(all_includes) + +# Use "make doctypes" to regenerate doctypes.cpp from doctypes.gperf +doctypes: $(srcdir)/doctypes.gperf $(srcdir)/Makefile.am + gperf -CEot -L "ANSI-C" -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $(srcdir)/doctypes.gperf > $(srcdir)/doctypes.cpp + +#html_documentimpl.lo: doctypes.cpp +.PHONY: doctypes + diff --git a/tdehtml/html/Platform.h b/tdehtml/html/Platform.h new file mode 100644 index 000000000..3cdd7177b --- /dev/null +++ b/tdehtml/html/Platform.h @@ -0,0 +1,218 @@ +/* -*- mode: c++; c-basic-offset: 4 -*- */ +/* + * Copyright (C) 2006 Apple Computer, 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 COMPUTER, 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 COMPUTER, 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 WTF_Platform_h +#define WTF_Platform_h + +/* Force KDE build here in our tree... */ +#ifndef BUILDING_KDE__ +#define BUILDING_KDE__ 1 +#endif + +/* PLATFORM handles OS, operating environment, graphics API, and CPU */ +#define PLATFORM(WTF_FEATURE) (defined( WTF_PLATFORM_##WTF_FEATURE ) && WTF_PLATFORM_##WTF_FEATURE) +#define COMPILER(WTF_FEATURE) (defined( WTF_COMPILER_##WTF_FEATURE ) && WTF_COMPILER_##WTF_FEATURE) +#define HAVE(WTF_FEATURE) (defined( HAVE_##WTF_FEATURE ) && HAVE_##WTF_FEATURE) +#define USE(WTF_FEATURE) (defined( WTF_USE_##WTF_FEATURE ) && WTF_USE_##WTF_FEATURE) +#define ENABLE(WTF_FEATURE) (defined( ENABLE_##WTF_FEATURE ) && ENABLE_##WTF_FEATURE) + +/* Operating systems - low-level dependencies */ + +/* PLATFORM(DARWIN) */ +/* Operating system level dependencies for Mac OS X / Darwin that should */ +/* be used regardless of operating environment */ +#ifdef __APPLE__ +#define WTF_PLATFORM_DARWIN 1 +#endif + +/* PLATFORM(WIN_OS) */ +/* Operating system level dependencies for Windows that should be used */ +/* regardless of operating environment */ +#if defined(WIN32) || defined(_WIN32) +#define WTF_PLATFORM_WIN_OS 1 +#endif + +/* PLATFORM(UNIX) */ +/* Operating system level dependencies for Unix-like systems that */ +/* should be used regardless of operating environment */ +/* (includes PLATFORM(DARWIN)) */ +#if defined(__APPLE__) \ + || defined(unix) \ + || defined(__unix) \ + || defined(__unix__) \ + || defined (__NetBSD__) \ + || defined(_AIX) +#define WTF_PLATFORM_UNIX 1 +#endif + +/* PLATFORM(SOLARIS_OS) */ +/* Operating system level dependencies for Sun (Open)Solaris 10. */ +/* Studio 12 on Solaris defines __SunOS; gcc defines __sun__; */ +/* Both compilers define __sun and sun. */ +#if defined(__sun) || defined(sun) +#define WTF_PLATFORM_SOLARIS_OS 1 +#endif + +/* Operating environments */ + +/* I made the BUILDING_KDE__ macro up for the KDE build system to define */ + +/* PLATFORM(KDE) */ +/* PLATFORM(MAC) */ +/* PLATFORM(WIN) */ +#if BUILDING_KDE__ +#define WTF_PLATFORM_KDE 1 +#elif PLATFORM(DARWIN) +#define WTF_PLATFORM_MAC 1 +#elif PLATFORM(WIN_OS) +#define WTF_PLATFORM_WIN 1 +#endif +#if defined(BUILDING_GDK__) +#define WTF_PLATFORM_GDK 1 +#endif + + +/* CPU */ + +/* PLATFORM(PPC) */ +#if defined(__ppc__) \ + || defined(__PPC__) \ + || defined(__powerpc__) \ + || defined(__powerpc) \ + || defined(__POWERPC__) \ + || defined(_M_PPC) \ + || defined(__PPC) +#define WTF_PLATFORM_PPC 1 +#define WTF_PLATFORM_BIG_ENDIAN 1 +#endif + +/* PLATFORM(PPC64) */ +#if defined(__ppc64__) \ + || defined(__PPC64__) +#define WTF_PLATFORM_PPC64 1 +#define WTF_PLATFORM_BIG_ENDIAN 1 +#endif + +#if defined(arm) +#define WTF_PLATFORM_ARM 1 +#if defined(__ARMEB__) +#define WTF_PLATFORM_BIG_ENDIAN 1 +#elif !defined(__ARM_EABI__) && !defined(__ARMEB__) +#define WTF_PLATFORM_MIDDLE_ENDIAN 1 +#endif +#if !defined(__ARM_EABI__) +#define WTF_PLATFORM_FORCE_PACK 1 +#endif +#endif + +/* PLATFORM(X86) */ +#if defined(__i386__) \ + || defined(i386) \ + || defined(_M_IX86) \ + || defined(_X86_) \ + || defined(__THW_INTEL) +#define WTF_PLATFORM_X86 1 +#endif + +/* PLATFORM(X86_64) */ +#if defined(__x86_64__) \ + || defined(__ia64__) +#define WTF_PLATFORM_X86_64 1 +#endif + +/* PLATFORM(SPARC) */ +#if defined(sparc) +#define WTF_PLATFORM_SPARC 1 +#endif + +/* Compiler */ + +/* COMPILER(CWP) */ +#if defined(__MWERKS__) +#define WTF_COMPILER_CWP 1 +#endif + +/* COMPILER(MSVC) */ +#if defined(_MSC_VER) +#define WTF_COMPILER_MSVC 1 +#endif + +/* COMPILER(GCC) */ +#if defined(__GNUC__) +#define WTF_COMPILER_GCC 1 +#endif + +/* COMPILER(SUNPRO) */ +#if defined(__SUNPRO_CC) +#define WTF_COMPILER_SUNPRO 1 +#endif + +/* COMPILER(BORLAND) */ +/* not really fully supported - is this relevant any more? */ +#if defined(__BORLANDC__) +#define WTF_COMPILER_BORLAND 1 +#endif + +/* COMPILER(CYGWIN) */ +/* not really fully supported - is this relevant any more? */ +#if defined(__CYGWIN__) +#define WTF_COMPILER_CYGWIN 1 +#endif + +/* multiple threads only supported on Mac for now */ +#if PLATFORM(MAC) +#ifndef WTF_USE_MULTIPLE_THREADS +#define WTF_USE_MULTIPLE_THREADS 1 +#endif +#ifndef WTF_USE_BINDINGS +#define WTF_USE_BINDINGS 1 +#endif +#endif + +/* for Unicode, KDE uses Qt, everything else uses ICU */ +#if PLATFORM(KDE) || PLATFORM(QT) +#define WTF_USE_QT4_UNICODE 1 +#elif PLATFORM(SYMBIAN) +#define WTF_USE_SYMBIAN_UNICODE 1 +#else +#define WTF_USE_ICU_UNICODE 1 +#endif + +#if PLATFORM(MAC) +#define WTF_PLATFORM_CF 1 +#endif + +#if PLATFORM(WIN) +#define WTF_USE_WININET 1 +#endif + +#if PLATFORM(GDK) +#define WTF_USE_CURL 1 +#endif + +/* ENABLE macro defaults */ + +#endif /* WTF_Platform_h */ diff --git a/tdehtml/html/RefPtr.h b/tdehtml/html/RefPtr.h new file mode 100644 index 000000000..8754bbf94 --- /dev/null +++ b/tdehtml/html/RefPtr.h @@ -0,0 +1,202 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * + * 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 WTF_RefPtr_h +#define WTF_RefPtr_h + +#include +#include "AlwaysInline.h" + +namespace WTF { + + enum PlacementNewAdoptType { PlacementNewAdopt }; + + template class PassRefPtr; + + enum HashTableDeletedValueType { HashTableDeletedValue }; + + template class RefPtr { + public: + RefPtr() : m_ptr(0) { } + RefPtr(T* ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); } + RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { if (T* ptr = m_ptr) ptr->ref(); } + // see comment in PassRefPtr.h for why this takes const reference + template RefPtr(const PassRefPtr&); + + // Special constructor for cases where we overwrite an object in place. + RefPtr(PlacementNewAdoptType) { } + + // Hash table deleted values, which are only constructed and never copied or destroyed. + RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { } + bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } + + ~RefPtr() { if (T* ptr = m_ptr) ptr->deref(); } + + template RefPtr(const RefPtr& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); } + + T* get() const { return m_ptr; } + + void clear() { if (T* ptr = m_ptr) ptr->deref(); m_ptr = 0; } + PassRefPtr release() { PassRefPtr tmp = adoptRef(m_ptr); m_ptr = 0; return tmp; } + + T& operator*() const { return *m_ptr; } + ALWAYS_INLINE T* operator->() const { return m_ptr; } + + bool operator!() const { return !m_ptr; } + + // This conversion operator allows implicit conversion to bool but not to other integer types. + typedef T* RefPtr::*UnspecifiedBoolType; + operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : 0; } + + RefPtr& operator=(const RefPtr&); + RefPtr& operator=(T*); + RefPtr& operator=(const PassRefPtr&); + template RefPtr& operator=(const RefPtr&); + template RefPtr& operator=(const PassRefPtr&); + + void swap(RefPtr&); + + private: + static T* hashTableDeletedValue() { return reinterpret_cast(-1); } + + T* m_ptr; + }; + + template template inline RefPtr::RefPtr(const PassRefPtr& o) + : m_ptr(o.releaseRef()) + { + } + + template inline RefPtr& RefPtr::operator=(const RefPtr& o) + { + T* optr = o.get(); + if (optr) + optr->ref(); + T* ptr = m_ptr; + m_ptr = optr; + if (ptr) + ptr->deref(); + return *this; + } + + template template inline RefPtr& RefPtr::operator=(const RefPtr& o) + { + T* optr = o.get(); + if (optr) + optr->ref(); + T* ptr = m_ptr; + m_ptr = optr; + if (ptr) + ptr->deref(); + return *this; + } + + template inline RefPtr& RefPtr::operator=(T* optr) + { + if (optr) + optr->ref(); + T* ptr = m_ptr; + m_ptr = optr; + if (ptr) + ptr->deref(); + return *this; + } + + template inline RefPtr& RefPtr::operator=(const PassRefPtr& o) + { + T* ptr = m_ptr; + m_ptr = o.releaseRef(); + if (ptr) + ptr->deref(); + return *this; + } + + template template inline RefPtr& RefPtr::operator=(const PassRefPtr& o) + { + T* ptr = m_ptr; + m_ptr = o.releaseRef(); + if (ptr) + ptr->deref(); + return *this; + } + + template inline void RefPtr::swap(RefPtr& o) + { + std::swap(m_ptr, o.m_ptr); + } + + template inline void swap(RefPtr& a, RefPtr& b) + { + a.swap(b); + } + + template inline bool operator==(const RefPtr& a, const RefPtr& b) + { + return a.get() == b.get(); + } + + template inline bool operator==(const RefPtr& a, U* b) + { + return a.get() == b; + } + + template inline bool operator==(T* a, const RefPtr& b) + { + return a == b.get(); + } + + template inline bool operator!=(const RefPtr& a, const RefPtr& b) + { + return a.get() != b.get(); + } + + template inline bool operator!=(const RefPtr& a, U* b) + { + return a.get() != b; + } + + template inline bool operator!=(T* a, const RefPtr& b) + { + return a != b.get(); + } + + template inline RefPtr static_pointer_cast(const RefPtr& p) + { + return RefPtr(static_cast(p.get())); + } + + template inline RefPtr const_pointer_cast(const RefPtr& p) + { + return RefPtr(const_cast(p.get())); + } + + template inline T* getPtr(const RefPtr& p) + { + return p.get(); + } + +} // namespace WTF + +using WTF::RefPtr; +using WTF::static_pointer_cast; +using WTF::const_pointer_cast; + +#endif // WTF_RefPtr_h diff --git a/tdehtml/html/doctypes.cpp b/tdehtml/html/doctypes.cpp new file mode 100644 index 000000000..332ad18fd --- /dev/null +++ b/tdehtml/html/doctypes.cpp @@ -0,0 +1,1174 @@ +/* ANSI-C code produced by gperf version 3.0.1 */ +/* Command-line: gperf -CEot -L ANSI-C -k '*' -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards /opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#endif + +#line 1 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" +struct PubIDInfo { + enum eMode { + eQuirks, /* always quirks mode, unless there's an internal subset */ + eQuirks3, /* ditto, but but pre-HTML4 (no tbody) */ + eAlmostStandards, + eFullStandards + }; + + const char* name; + eMode mode_if_no_sysid; + eMode mode_if_sysid; +}; +/* maximum key range = 727, duplicates = 0 */ + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static unsigned int +hash (register const char *str, register unsigned int len) +{ + static const unsigned short asso_values[] = + { + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 0, 731, 731, 731, 731, 731, 731, 0, + 731, 731, 731, 0, 731, 0, 15, 0, 10, 25, + 5, 0, 5, 15, 5, 5, 731, 5, 0, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 10, 5, 0, + 40, 0, 20, 10, 0, 0, 0, 731, 0, 0, + 10, 45, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 0, 5, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, + 731, 731, 731, 731, 731, 731 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[79]]; + /*FALLTHROUGH*/ + case 79: + hval += asso_values[(unsigned char)str[78]]; + /*FALLTHROUGH*/ + case 78: + hval += asso_values[(unsigned char)str[77]]; + /*FALLTHROUGH*/ + case 77: + hval += asso_values[(unsigned char)str[76]]; + /*FALLTHROUGH*/ + case 76: + hval += asso_values[(unsigned char)str[75]]; + /*FALLTHROUGH*/ + case 75: + hval += asso_values[(unsigned char)str[74]]; + /*FALLTHROUGH*/ + case 74: + hval += asso_values[(unsigned char)str[73]]; + /*FALLTHROUGH*/ + case 73: + hval += asso_values[(unsigned char)str[72]]; + /*FALLTHROUGH*/ + case 72: + hval += asso_values[(unsigned char)str[71]]; + /*FALLTHROUGH*/ + case 71: + hval += asso_values[(unsigned char)str[70]]; + /*FALLTHROUGH*/ + case 70: + hval += asso_values[(unsigned char)str[69]]; + /*FALLTHROUGH*/ + case 69: + hval += asso_values[(unsigned char)str[68]]; + /*FALLTHROUGH*/ + case 68: + hval += asso_values[(unsigned char)str[67]]; + /*FALLTHROUGH*/ + case 67: + hval += asso_values[(unsigned char)str[66]]; + /*FALLTHROUGH*/ + case 66: + hval += asso_values[(unsigned char)str[65]]; + /*FALLTHROUGH*/ + case 65: + hval += asso_values[(unsigned char)str[64]]; + /*FALLTHROUGH*/ + case 64: + hval += asso_values[(unsigned char)str[63]]; + /*FALLTHROUGH*/ + case 63: + hval += asso_values[(unsigned char)str[62]]; + /*FALLTHROUGH*/ + case 62: + hval += asso_values[(unsigned char)str[61]]; + /*FALLTHROUGH*/ + case 61: + hval += asso_values[(unsigned char)str[60]]; + /*FALLTHROUGH*/ + case 60: + hval += asso_values[(unsigned char)str[59]]; + /*FALLTHROUGH*/ + case 59: + hval += asso_values[(unsigned char)str[58]]; + /*FALLTHROUGH*/ + case 58: + hval += asso_values[(unsigned char)str[57]]; + /*FALLTHROUGH*/ + case 57: + hval += asso_values[(unsigned char)str[56]]; + /*FALLTHROUGH*/ + case 56: + hval += asso_values[(unsigned char)str[55]]; + /*FALLTHROUGH*/ + case 55: + hval += asso_values[(unsigned char)str[54]]; + /*FALLTHROUGH*/ + case 54: + hval += asso_values[(unsigned char)str[53]]; + /*FALLTHROUGH*/ + case 53: + hval += asso_values[(unsigned char)str[52]]; + /*FALLTHROUGH*/ + case 52: + hval += asso_values[(unsigned char)str[51]]; + /*FALLTHROUGH*/ + case 51: + hval += asso_values[(unsigned char)str[50]]; + /*FALLTHROUGH*/ + case 50: + hval += asso_values[(unsigned char)str[49]]; + /*FALLTHROUGH*/ + case 49: + hval += asso_values[(unsigned char)str[48]]; + /*FALLTHROUGH*/ + case 48: + hval += asso_values[(unsigned char)str[47]]; + /*FALLTHROUGH*/ + case 47: + hval += asso_values[(unsigned char)str[46]]; + /*FALLTHROUGH*/ + case 46: + hval += asso_values[(unsigned char)str[45]]; + /*FALLTHROUGH*/ + case 45: + hval += asso_values[(unsigned char)str[44]]; + /*FALLTHROUGH*/ + case 44: + hval += asso_values[(unsigned char)str[43]]; + /*FALLTHROUGH*/ + case 43: + hval += asso_values[(unsigned char)str[42]]; + /*FALLTHROUGH*/ + case 42: + hval += asso_values[(unsigned char)str[41]]; + /*FALLTHROUGH*/ + case 41: + hval += asso_values[(unsigned char)str[40]]; + /*FALLTHROUGH*/ + case 40: + hval += asso_values[(unsigned char)str[39]]; + /*FALLTHROUGH*/ + case 39: + hval += asso_values[(unsigned char)str[38]]; + /*FALLTHROUGH*/ + case 38: + hval += asso_values[(unsigned char)str[37]]; + /*FALLTHROUGH*/ + case 37: + hval += asso_values[(unsigned char)str[36]]; + /*FALLTHROUGH*/ + case 36: + hval += asso_values[(unsigned char)str[35]]; + /*FALLTHROUGH*/ + case 35: + hval += asso_values[(unsigned char)str[34]]; + /*FALLTHROUGH*/ + case 34: + hval += asso_values[(unsigned char)str[33]]; + /*FALLTHROUGH*/ + case 33: + hval += asso_values[(unsigned char)str[32]]; + /*FALLTHROUGH*/ + case 32: + hval += asso_values[(unsigned char)str[31]]; + /*FALLTHROUGH*/ + case 31: + hval += asso_values[(unsigned char)str[30]]; + /*FALLTHROUGH*/ + case 30: + hval += asso_values[(unsigned char)str[29]]; + /*FALLTHROUGH*/ + case 29: + hval += asso_values[(unsigned char)str[28]]; + /*FALLTHROUGH*/ + case 28: + hval += asso_values[(unsigned char)str[27]]; + /*FALLTHROUGH*/ + case 27: + hval += asso_values[(unsigned char)str[26]]; + /*FALLTHROUGH*/ + case 26: + hval += asso_values[(unsigned char)str[25]]; + /*FALLTHROUGH*/ + case 25: + hval += asso_values[(unsigned char)str[24]]; + /*FALLTHROUGH*/ + case 24: + hval += asso_values[(unsigned char)str[23]]; + /*FALLTHROUGH*/ + case 23: + hval += asso_values[(unsigned char)str[22]]; + /*FALLTHROUGH*/ + case 22: + hval += asso_values[(unsigned char)str[21]]; + /*FALLTHROUGH*/ + case 21: + hval += asso_values[(unsigned char)str[20]]; + /*FALLTHROUGH*/ + case 20: + hval += asso_values[(unsigned char)str[19]]; + /*FALLTHROUGH*/ + case 19: + hval += asso_values[(unsigned char)str[18]]; + /*FALLTHROUGH*/ + case 18: + hval += asso_values[(unsigned char)str[17]]; + /*FALLTHROUGH*/ + case 17: + hval += asso_values[(unsigned char)str[16]]; + /*FALLTHROUGH*/ + case 16: + hval += asso_values[(unsigned char)str[15]]; + /*FALLTHROUGH*/ + case 15: + hval += asso_values[(unsigned char)str[14]]; + /*FALLTHROUGH*/ + case 14: + hval += asso_values[(unsigned char)str[13]]; + /*FALLTHROUGH*/ + case 13: + hval += asso_values[(unsigned char)str[12]]; + /*FALLTHROUGH*/ + case 12: + hval += asso_values[(unsigned char)str[11]]; + /*FALLTHROUGH*/ + case 11: + hval += asso_values[(unsigned char)str[10]]; + /*FALLTHROUGH*/ + case 10: + hval += asso_values[(unsigned char)str[9]]; + /*FALLTHROUGH*/ + case 9: + hval += asso_values[(unsigned char)str[8]]; + /*FALLTHROUGH*/ + case 8: + hval += asso_values[(unsigned char)str[7]]; + /*FALLTHROUGH*/ + case 7: + hval += asso_values[(unsigned char)str[6]]; + /*FALLTHROUGH*/ + case 6: + hval += asso_values[(unsigned char)str[5]]; + /*FALLTHROUGH*/ + case 5: + hval += asso_values[(unsigned char)str[4]]; + /*FALLTHROUGH*/ + case 4: + hval += asso_values[(unsigned char)str[3]]; + /*FALLTHROUGH*/ + case 3: + hval += asso_values[(unsigned char)str[2]]; + /*FALLTHROUGH*/ + case 2: + hval += asso_values[(unsigned char)str[1]]; + /*FALLTHROUGH*/ + case 1: + hval += asso_values[(unsigned char)str[0]]; + break; + } + return hval; +} + +#ifdef __GNUC__ +__inline +#endif +const struct PubIDInfo * +findDoctypeEntry (register const char *str, register unsigned int len) +{ + enum + { + TOTAL_KEYWORDS = 78, + MIN_WORD_LENGTH = 4, + MAX_WORD_LENGTH = 80, + MIN_HASH_VALUE = 4, + MAX_HASH_VALUE = 730 + }; + + static const struct PubIDInfo wordlist[] = + { + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 91 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"html", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 81 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd w3 html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 48 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 28 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 3//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 73 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 3.2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 45 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 35 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html level 3//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 33 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html level 2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 43 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict level 3//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 29 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html level 0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 41 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict level 2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 27 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 3.2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 37 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict level 0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 69 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w30//dtd w3 html 2.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 24 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 3.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 50 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html//en//3.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 25 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 3.0//en//", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 31 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html level 1//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 22 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 2.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 49 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 47 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict//en//3.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 36 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html level 3//en//3.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 39 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict level 1//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 21 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 2.0 strict//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 46 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 44 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict level 3//en//3.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 18 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 2.0 level 2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 34 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html level 2//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 72 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 3.2 final//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 23 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 2.1e//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 75 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 4.0 frameset//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks}, +#line 30 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html level 0//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 20 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 2.0 strict level 2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 42 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict level 2//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 85 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3o//dtd w3 html 3.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 89 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//webtechs//dtd mozilla html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 86 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3o//dtd w3 html 3.0//en//", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 84 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd xhtml 1.1//en", PubIDInfo::eAlmostStandards, PubIDInfo::eAlmostStandards}, +#line 38 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict level 0//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 70 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 3 1995-03-24//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 87 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3o//dtd w3 html strict 3.0//en//", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 17 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 2.0 level 1//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 32 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html level 1//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 26 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 3.2 final//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 19 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html 2.0 strict level 1//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 40 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//ietf//dtd html strict level 1//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 77 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 4.01 frameset//en", PubIDInfo::eQuirks, PubIDInfo::eAlmostStandards}, +#line 71 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 3.2 draft//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 74 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 3.2s draft//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 82 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd xhtml 1.0 frameset//en", PubIDInfo::eAlmostStandards, PubIDInfo::eAlmostStandards}, +#line 80 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html experimental 970421//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 51 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//metrius//dtd metrius presentational//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 88 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//webtechs//dtd mozilla html 2.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 90 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-/w3c/dtd html 4.0 transitional/en", PubIDInfo::eQuirks, PubIDInfo::eQuirks}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 76 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 4.0 transitional//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 79 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html experimental 19960712//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 58 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//netscape comm. corp.//dtd html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 78 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd html 4.01 transitional//en", PubIDInfo::eQuirks, PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 83 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//w3c//dtd xhtml 1.0 transitional//en", PubIDInfo::eAlmostStandards, PubIDInfo::eAlmostStandards}, +#line 59 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//netscape comm. corp.//dtd strict html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 65 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//spyglass//dtd html 2.0 extended//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 16 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//as//dtd html 3.0 aswedit + extensions//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 66 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//sq//dtd html 2.0 hotmetal + extensions//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 67 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//sun microsystems corp.//dtd hotjava html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 68 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//sun microsystems corp.//dtd hotjava strict html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 60 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//o'reilly and associates//dtd html 2.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 56 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//microsoft//dtd internet explorer 3.0 html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 53 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//microsoft//dtd internet explorer 2.0 html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 55 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//microsoft//dtd internet explorer 3.0 html strict//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 14 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"+//silmaril//dtd html pro v0r11 19970101//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, +#line 52 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//microsoft//dtd internet explorer 2.0 html strict//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 57 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//microsoft//dtd internet explorer 3.0 tables//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 54 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//microsoft//dtd internet explorer 2.0 tables//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 15 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//advasoft ltd//dtd html 3.0 aswedit + extensions//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 61 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//o'reilly and associates//dtd html extended 1.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 62 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//o'reilly and associates//dtd html extended relaxed 1.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 64 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, + {"",PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards}, +#line 63 "/opt/src/kde/tdelibs/tdehtml/html/doctypes.gperf" + {"-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + { + register const char *s = wordlist[key].name; + + if (*str == *s && !strcmp (str + 1, s + 1)) + return &wordlist[key]; + } + } + return 0; +} diff --git a/tdehtml/html/doctypes.gperf b/tdehtml/html/doctypes.gperf new file mode 100644 index 000000000..97b10e258 --- /dev/null +++ b/tdehtml/html/doctypes.gperf @@ -0,0 +1,91 @@ +struct PubIDInfo { + enum eMode { + eQuirks, /* always quirks mode, unless there's an internal subset */ + eQuirks3, /* ditto, but but pre-HTML4 (no tbody) */ + eAlmostStandards, + eFullStandards + }; + + const char* name; + eMode mode_if_no_sysid; + eMode mode_if_sysid; +} +%% +"+//silmaril//dtd html pro v0r11 19970101//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//advasoft ltd//dtd html 3.0 aswedit + extensions//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//as//dtd html 3.0 aswedit + extensions//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 2.0 level 1//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 2.0 level 2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 2.0 strict level 1//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 2.0 strict level 2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 2.0 strict//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 2.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 2.1e//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 3.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 3.0//en//", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 3.2 final//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 3.2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html 3//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html level 0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html level 0//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html level 1//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html level 1//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html level 2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html level 2//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html level 3//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html level 3//en//3.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict level 0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict level 0//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict level 1//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict level 1//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict level 2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict level 2//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict level 3//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict level 3//en//3.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html strict//en//3.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html//en//2.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//ietf//dtd html//en//3.0", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//metrius//dtd metrius presentational//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks +"-//microsoft//dtd internet explorer 2.0 html strict//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//microsoft//dtd internet explorer 2.0 html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//microsoft//dtd internet explorer 2.0 tables//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//microsoft//dtd internet explorer 3.0 html strict//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//microsoft//dtd internet explorer 3.0 html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//microsoft//dtd internet explorer 3.0 tables//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//netscape comm. corp.//dtd html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//netscape comm. corp.//dtd strict html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//o'reilly and associates//dtd html 2.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//o'reilly and associates//dtd html extended 1.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//o'reilly and associates//dtd html extended relaxed 1.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks +"-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks +"-//spyglass//dtd html 2.0 extended//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//sq//dtd html 2.0 hotmetal + extensions//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//sun microsystems corp.//dtd hotjava html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//sun microsystems corp.//dtd hotjava strict html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w30//dtd w3 html 2.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd html 3 1995-03-24//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd html 3.2 draft//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd html 3.2 final//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd html 3.2//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd html 3.2s draft//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd html 4.0 frameset//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks +"-//w3c//dtd html 4.0 transitional//en", PubIDInfo::eQuirks, PubIDInfo::eQuirks +"-//w3c//dtd html 4.01 frameset//en", PubIDInfo::eQuirks, PubIDInfo::eAlmostStandards +"-//w3c//dtd html 4.01 transitional//en", PubIDInfo::eQuirks, PubIDInfo::eAlmostStandards +"-//w3c//dtd html experimental 19960712//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd html experimental 970421//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd w3 html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3c//dtd xhtml 1.0 frameset//en", PubIDInfo::eAlmostStandards, PubIDInfo::eAlmostStandards +"-//w3c//dtd xhtml 1.0 transitional//en", PubIDInfo::eAlmostStandards, PubIDInfo::eAlmostStandards +"-//w3c//dtd xhtml 1.1//en", PubIDInfo::eAlmostStandards, PubIDInfo::eAlmostStandards +"-//w3o//dtd w3 html 3.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3o//dtd w3 html 3.0//en//", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//w3o//dtd w3 html strict 3.0//en//", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//webtechs//dtd mozilla html 2.0//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-//webtechs//dtd mozilla html//en", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 +"-/w3c/dtd html 4.0 transitional/en", PubIDInfo::eQuirks, PubIDInfo::eQuirks +"html", PubIDInfo::eQuirks3, PubIDInfo::eQuirks3 \ No newline at end of file diff --git a/tdehtml/html/dtd.cpp b/tdehtml/html/dtd.cpp new file mode 100644 index 000000000..accc8b855 --- /dev/null +++ b/tdehtml/html/dtd.cpp @@ -0,0 +1,918 @@ +/** + * This file is part of the DOM implementation for KDE. + * + * (C) 1999 Lars Knoll (knoll@kde.org) + * + * 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 "html/dtd.h" +#include "misc/htmlhashes.h" + +using namespace DOM; + +#include +#include + +// priority of tags. Closing tags of higher priority close tags of lower +// priority. +// Update this list, whenever you change htmltags.* +// +// 0 elements with forbidden close tag and text. They don't get pushed +// to the stack. +// 1 inline elements +// 2 form elements +// 3 regular block level elements +// 4 lists (OL UL DIR MENU) +// 5 TD TH SELECT +// 6 TR +// 7 tbody thead tfoot caption object +// 8 table +// 9 body frameset +// 10 html + +const unsigned short KDE_NO_EXPORT DOM::tagPriority[] = { + 0, // 0 + 1, // ID_A == 1 + 1, // ID_ABBR + 1, // ID_ACRONYM + 3, // ID_ADDRESS + 1, // ID_APPLET + 0, // ID_AREA + 1, // ID_B + 0, // ID_BASE + 0, // ID_BASEFONT + 1, // ID_BDO + 1, // ID_BIG + 5, // ID_BLOCKQUOTE + 10, // ID_BODY + 0, // ID_BR + 1, // ID_BUTTON + 5, // ID_CAPTION + 5, // ID_CENTER + 1, // ID_CITE + 1, // ID_CODE + 0, // ID_COL + 1, // ID_COLGROUP + 3, // ID_DD + 1, // ID_DEL + 1, // ID_DFN + 5, // ID_DIR + 5, // ID_DIV + 5, // ID_DL + 3, // ID_DT + 1, // ID_EM + 0, // ID_EMBED + 3, // ID_FIELDSET + 1, // ID_FONT + 3, // ID_FORM + 0, // ID_FRAME + 10,// ID_FRAMESET + 5, // ID_H1 + 5, // ID_H2 + 5, // ID_H3 + 5, // ID_H4 + 5, // ID_H5 + 5, // ID_H6 + 10,// ID_HEAD + 0, // ID_HR + 11,// ID_HTML + 1, // ID_I + 1, // ID_IFRAME + 1, // ID_ILAYER + 0, // ID_IMG + 0, // ID_INPUT + 1, // ID_INS + 0, // ID_ISINDEX + 1, // ID_KBD + 0, // ID_KEYGEN + 1, // ID_LABEL + 1, // ID_LAYER + 1, // ID_LEGEND + 3, // ID_LI + 0, // ID_LINK + 1, // ID_MAP + 3, // ID_MARQUEE + 5, // ID_MENU + 0, // ID_META + 5, // ID_NOBR + 10,// ID_NOEMBED + 10,// ID_NOFRAMES + 3, // ID_NOSCRIPT + 1, // ID_NOLAYER + 5, // ID_OBJECT + 5, // ID_OL + 1, // ID_OPTGROUP + 2, // ID_OPTION + 3, // ID_P + 0, // ID_PARAM + 5, // ID_PLAINTEXT + 5, // ID_PRE + 1, // ID_Q + 1, // ID_S + 1, // ID_SAMP + 1, // ID_SCRIPT + 6, // ID_SELECT + 1, // ID_SMALL + 1, // ID_SPAN + 1, // ID_STRIKE + 1, // ID_STRONG + 1, // ID_STYLE + 1, // ID_SUB + 1, // ID_SUP + 9,// ID_TABLE + 8, // ID_TBODY + 6, // ID_TD + 1, // ID_TEXTAREA + 8, // ID_TFOOT + 6, // ID_TH + 8, // ID_THEAD + 1, // ID_TITLE + 7, // ID_TR + 1, // ID_TT + 1, // ID_U + 5, // ID_UL + 1, // ID_VAR + 1, // ID_WBR + 5, // ID_XMP + 0, // ID_TEXT +}; + +const tagStatus DOM::endTag[] = { + REQUIRED, // 0 + REQUIRED, // ID_A == 1 + REQUIRED, // ID_ABBR + REQUIRED, // ID_ACRONYM + REQUIRED, // ID_ADDRESS + REQUIRED, // ID_APPLET + FORBIDDEN, // ID_AREA + REQUIRED, // ID_B + FORBIDDEN, // ID_BASE + FORBIDDEN, // ID_BASEFONT + REQUIRED, // ID_BDO + REQUIRED, // ID_BIG + REQUIRED, // ID_BLOCKQUOTE + REQUIRED, // ID_BODY + FORBIDDEN, // ID_BR + REQUIRED, // ID_BUTTON + REQUIRED, // ID_CAPTION + REQUIRED, // ID_CENTER + REQUIRED, // ID_CITE + REQUIRED, // ID_CODE + FORBIDDEN, // ID_COL + OPTIONAL, // ID_COLGROUP + OPTIONAL, // ID_DD + REQUIRED, // ID_DEL + REQUIRED, // ID_DFN + REQUIRED, // ID_DIR + REQUIRED, // ID_DIV + REQUIRED, // ID_DL + OPTIONAL, // ID_DT + REQUIRED, // ID_EM + REQUIRED, // ID_EMBED + REQUIRED, // ID_FIELDSET + REQUIRED, // ID_FONT + REQUIRED, // ID_FORM + FORBIDDEN, // ID_FRAME + REQUIRED, // ID_FRAMESET + REQUIRED, // ID_H1 + REQUIRED, // ID_H2 + REQUIRED, // ID_H3 + REQUIRED, // ID_H4 + REQUIRED, // ID_H5 + REQUIRED, // ID_H6 + OPTIONAL, // ID_HEAD + FORBIDDEN, // ID_HR + REQUIRED, // ID_HTML + REQUIRED, // ID_I + REQUIRED, // ID_IFRAME + REQUIRED, // ID_ILAYER + FORBIDDEN, // ID_IMG + FORBIDDEN, // ID_INPUT + REQUIRED, // ID_INS + FORBIDDEN, // ID_ISINDEX + REQUIRED, // ID_KBD + REQUIRED, // ID_KEYGEN + REQUIRED, // ID_LABEL + REQUIRED, // ID_LAYER + REQUIRED, // ID_LEGEND + OPTIONAL, // ID_LI + FORBIDDEN, // ID_LINK + REQUIRED, // ID_MAP + REQUIRED, // ID_MARQUEE + REQUIRED, // ID_MENU + FORBIDDEN, // ID_META + REQUIRED, // ID_NOBR + REQUIRED, // ID_NOEMBED + REQUIRED, // ID_NOFRAMES + REQUIRED, // ID_NOSCRIPT + REQUIRED, // ID_NOLAYER + REQUIRED, // ID_OBJECT + REQUIRED, // ID_OL + REQUIRED, // ID_OPTGROUP + OPTIONAL, // ID_OPTION + OPTIONAL, // ID_P + FORBIDDEN, // ID_PARAM + REQUIRED, // ID_PLAINTEXT + REQUIRED, // ID_PRE + REQUIRED, // ID_Q + REQUIRED, // ID_S + REQUIRED, // ID_SAMP + REQUIRED, // ID_SCRIPT + REQUIRED, // ID_SELECT + REQUIRED, // ID_SMALL + REQUIRED, // ID_SPAN + REQUIRED, // ID_STRIKE + REQUIRED, // ID_STRONG + REQUIRED, // ID_STYLE + REQUIRED, // ID_SUB + REQUIRED, // ID_SUP + REQUIRED, // ID_TABLE + OPTIONAL, // ID_TBODY + OPTIONAL, // ID_TD + REQUIRED, // ID_TEXTAREA + OPTIONAL, // ID_TFOOT + OPTIONAL, // ID_TH + OPTIONAL, // ID_THEAD + REQUIRED, // ID_TITLE + OPTIONAL, // ID_TR + REQUIRED, // ID_TT + REQUIRED, // ID_U + REQUIRED, // ID_UL + REQUIRED, // ID_VAR + OPTIONAL, // ID_WBR + REQUIRED, // ID_XMP + REQUIRED // ID_TEXT +}; + + +static const ushort tag_list_0[] = { + ID_TEXT, + ID_TT, + ID_I, + ID_B, + ID_U, + ID_S, + ID_STRIKE, + ID_BIG, + ID_SMALL, + ID_EM, + ID_STRONG, + ID_DFN, + ID_CODE, + ID_SAMP, + ID_KBD, + ID_VAR, + ID_CITE, + ID_ABBR, + ID_ACRONYM, + ID_A, + ID_IMG, + ID_APPLET, + ID_OBJECT, + ID_EMBED, + ID_FONT, + ID_BASEFONT, + ID_BR, + ID_SCRIPT, + ID_MAP, + ID_Q, + ID_SUB, + ID_SUP, + ID_SPAN, + ID_BDO, + ID_IFRAME, + ID_INPUT, + ID_SELECT, + ID_TEXTAREA, + ID_LABEL, + ID_BUTTON, + ID_INS, + ID_DEL, + ID_COMMENT, + ID_NOBR, + ID_WBR, + 0 +}; + +static const ushort tag_list_1[] = { + ID_TEXT, + ID_P, + ID_H1, + ID_H2, + ID_H3, + ID_H4, + ID_H5, + ID_H6, + ID_UL, + ID_OL, + ID_DIR, + ID_MENU, + ID_PRE, + ID_PLAINTEXT, + ID_DL, + ID_DIV, + ID_ILAYER, + ID_LAYER, + ID_CENTER, + ID_NOSCRIPT, + ID_NOFRAMES, + ID_BLOCKQUOTE, + ID_FORM, + ID_ISINDEX, + ID_HR, + ID_TABLE, + ID_FIELDSET, + ID_ADDRESS, + ID_TT, + ID_I, + ID_B, + ID_U, + ID_S, + ID_STRIKE, + ID_BIG, + ID_SMALL, + ID_EM, + ID_STRONG, + ID_DFN, + ID_CODE, + ID_SAMP, + ID_KBD, + ID_VAR, + ID_CITE, + ID_ABBR, + ID_ACRONYM, + ID_A, + ID_IMG, + ID_APPLET, + ID_OBJECT, + ID_EMBED, + ID_FONT, + ID_BASEFONT, + ID_BR, + ID_SCRIPT, + ID_MAP, + ID_Q, + ID_SUB, + ID_SUP, + ID_SPAN, + ID_BDO, + ID_IFRAME, + ID_INPUT, + ID_KEYGEN, + ID_SELECT, + ID_TEXTAREA, + ID_LABEL, + ID_BUTTON, + ID_COMMENT, + ID_LI, + ID_DD, + ID_XMP, + ID_INS, + ID_DEL, + ID_NOBR, + ID_WBR, + ID_MARQUEE, + 0 +}; + +static const ushort tag_list_2[] = { + ID_COMMENT, + 0 +}; + +static const ushort tag_list_3[] = { + ID_TEXT, + ID_P, + ID_H1, + ID_H2, + ID_H3, + ID_H4, + ID_H5, + ID_H6, + ID_UL, + ID_OL, + ID_DIR, + ID_MENU, + ID_PRE, + ID_PLAINTEXT, + ID_DL, + ID_DIV, + ID_ILAYER, + ID_LAYER, + ID_CENTER, + ID_NOSCRIPT, + ID_NOFRAMES, + ID_BLOCKQUOTE, + ID_FORM, + ID_ISINDEX, + ID_HR, + ID_TABLE, + ID_FIELDSET, + ID_ADDRESS, + ID_COMMENT, + ID_LI, + ID_DD, + ID_XMP, + ID_MARQUEE, + 0 +}; + +static const ushort tag_list_4[] = { + ID_TEXT, + ID_PARAM, + ID_P, + ID_H1, + ID_H2, + ID_H3, + ID_H4, + ID_H5, + ID_H6, + ID_UL, + ID_OL, + ID_DIR, + ID_MENU, + ID_PRE, + ID_PLAINTEXT, + ID_DL, + ID_DIV, + ID_ILAYER, + ID_LAYER, + ID_CENTER, + ID_NOSCRIPT, + ID_NOFRAMES, + ID_BLOCKQUOTE, + ID_FORM, + ID_ISINDEX, + ID_HR, + ID_TABLE, + ID_FIELDSET, + ID_ADDRESS, + ID_TEXT, + ID_TT, + ID_I, + ID_B, + ID_U, + ID_S, + ID_STRIKE, + ID_BIG, + ID_SMALL, + ID_EM, + ID_STRONG, + ID_DFN, + ID_CODE, + ID_SAMP, + ID_KBD, + ID_VAR, + ID_CITE, + ID_ABBR, + ID_ACRONYM, + ID_A, + ID_IMG, + ID_APPLET, + ID_OBJECT, + ID_EMBED, + ID_FONT, + ID_BASEFONT, + ID_BR, + ID_SCRIPT, + ID_MAP, + ID_Q, + ID_SUB, + ID_SUP, + ID_SPAN, + ID_BDO, + ID_IFRAME, + ID_INPUT, + ID_SELECT, + ID_TEXTAREA, + ID_LABEL, + ID_BUTTON, + ID_COMMENT, + ID_LI, + ID_DD, + ID_XMP, + ID_MARQUEE, + 0 +}; + +static const ushort tag_list_6[] = { + ID_DT, + ID_DD, + ID_COMMENT, + 0 +}; + +static const ushort tag_list_7[] = { + ID_TEXT, + ID_OPTGROUP, + ID_OPTION, + ID_COMMENT, + ID_SCRIPT, + 0 +}; + +static const ushort tag_list_10[] = { + ID_FRAMESET, + ID_FRAME, + ID_NOFRAMES, + ID_COMMENT, + 0 +}; + +static const ushort tag_list_11[] = { + ID_SCRIPT, + ID_STYLE, + ID_META, + ID_LINK, + ID_TITLE, + ID_ISINDEX, + ID_BASE, + ID_COMMENT, + 0 +}; + +static bool check_array(ushort child, const ushort *tagList) +{ + int i = 0; + while(tagList[i] != 0) + { + if(tagList[i] == child) return true; + i++; + } + return false; +} + + +bool DOM::checkChild(ushort tagID, ushort childID, bool strict) +{ + //kdDebug( 6030 ) << "checkChild: " << tagID << "/" << childID << endl; + + // ### allow comments inside ANY node that can contain children + + if (tagID >= 1000 || childID >= 1000) + return true; // one or both of the elements in an XML element; just allow for now + + switch(tagID) + { + case ID_TT: + case ID_I: + case ID_B: + case ID_U: + case ID_S: + case ID_STRIKE: + case ID_BIG: + case ID_SMALL: + case ID_EM: + case ID_STRONG: + case ID_DFN: + case ID_CODE: + case ID_SAMP: + case ID_KBD: + case ID_VAR: + case ID_CITE: + case ID_ABBR: + case ID_ACRONYM: + case ID_SUB: + case ID_SUP: + case ID_BDO: + case ID_FONT: + case ID_LEGEND: + case ID_Q: + case ID_A: + case ID_NOBR: + case ID_WBR: + // _1 * + return check_array(childID, tag_list_1) || check_array(childID, tag_list_6); + case ID_P: + // P: ( _0 | TABLE | NOSCRIPT) * + return check_array(childID, tag_list_0) || (!strict && (childID == ID_TABLE || childID == ID_NOSCRIPT)); + case ID_H1: + case ID_H2: + case ID_H3: + case ID_H4: + case ID_H5: + case ID_H6: + // _0 * + return check_array(childID, tag_list_0) || + (!strict && check_array(childID, tag_list_3) && (childID < ID_H1 || childID > ID_H6)); + case ID_BASEFONT: + case ID_BR: + case ID_AREA: + case ID_LINK: + case ID_IMG: + case ID_PARAM: + case ID_HR: + case ID_INPUT: + case ID_COL: + case ID_FRAME: + case ID_ISINDEX: + case ID_BASE: + case ID_META: + case ID_COMMENT: + // BASEFONT: EMPTY + return false; + case ID_BODY: + // BODY: _1 * + _2 + return check_array(childID, tag_list_1) || check_array(childID, tag_list_2); + case ID_ADDRESS: + // ADDRESS: ( _0 | P ) * + return check_array(childID, tag_list_0) || childID == ID_P; + case ID_DT: + if ( childID == ID_DL ) return false; + case ID_LI: + case ID_DIV: + case ID_SPAN: + case ID_ILAYER: + case ID_LAYER: + case ID_CENTER: + case ID_BLOCKQUOTE: + case ID_INS: + case ID_DEL: + case ID_DD: + case ID_TH: + case ID_TD: + case ID_IFRAME: + case ID_NOFRAMES: + case ID_NOSCRIPT: + case ID_CAPTION: + case ID_MARQUEE: + // DIV: _1 * + return check_array(childID, tag_list_1); + case ID_MAP: + // We accept SCRIPT in client-side image maps as an extension to the DTD. + // MAP: ( _3 + | AREA + | SCRIPT + ) + return check_array(childID, tag_list_3) || + childID == ID_AREA || + childID == ID_SCRIPT; + case ID_OBJECT: + case ID_EMBED: + case ID_APPLET: + // OBJECT: _4 * + return check_array(childID, tag_list_4); + case ID_PRE: + case ID_XMP: + case ID_PLAINTEXT: + // PRE: _0 * - _5 + return check_array(childID, tag_list_1); + case ID_DL: + // DL: _6 + + return check_array(childID, tag_list_6) || check_array(childID, tag_list_1); + case ID_OL: + case ID_UL: + // OL: LI + + return check_array(childID, tag_list_1); + case ID_DIR: + case ID_MENU: + // (DIR|MENU): LI + - _3 + if(childID == ID_LI) return true; + return false; + case ID_FORM: + // FORM: _1 * - FORM + return check_array(childID, tag_list_1); + case ID_LABEL: + // LABEL: _1 * - LABEL + return check_array(childID, tag_list_1); + // KEYGEN does not really allow any children + // from outside, just need this to be able + // to add the keylengths ourself + // Yes, consider it a hack (Dirk) + case ID_KEYGEN: + case ID_SELECT: + // SELECT: _7 + + return check_array(childID, tag_list_7); + case ID_OPTGROUP: + // OPTGROUP: OPTION + + if(childID == ID_OPTION) return true; + return false; + case ID_OPTION: + case ID_TEXTAREA: + case ID_TITLE: + case ID_STYLE: + case ID_SCRIPT: + // OPTION: TEXT + if(childID == ID_TEXT) return true; + return false; + case ID_FIELDSET: + // FIELDSET: ( TEXT , LEGEND , _1 * ) + if(childID == ID_TEXT) return true; + if(childID == ID_LEGEND) return true; + return check_array(childID, tag_list_1); + case ID_BUTTON: + // BUTTON: _1 * - _8 + return check_array(childID, tag_list_1); + case ID_TABLE: + // TABLE: ( CAPTION ? , ( COL * | COLGROUP * ) , THEAD ? , TFOOT ? , TBODY + ) + switch(childID) + { + case ID_CAPTION: + case ID_COL: + case ID_COLGROUP: + case ID_THEAD: + case ID_TFOOT: + case ID_TBODY: + case ID_FORM: + case ID_SCRIPT: + return true; + default: + return false; + } + case ID_THEAD: + case ID_TFOOT: + case ID_TBODY: + // THEAD: TR + + if(childID == ID_TR || childID == ID_SCRIPT) return true; + return false; + case ID_COLGROUP: + // COLGROUP: COL * + if(childID == ID_COL) return true; + return false; + case ID_TR: + // TR: (TD, TH) + return (childID == ID_TH || childID == ID_TD || childID == ID_SCRIPT); + case ID_FRAMESET: + // FRAMESET: _10 + return check_array(childID, tag_list_10); + case ID_HEAD: + // HEAD: _11 + return check_array(childID, tag_list_11); + case ID_HTML: + // HTML: ( HEAD , COMMENT, ( BODY | ( FRAMESET & NOFRAMES ? ) ) ) + switch(childID) + { + case ID_HEAD: + case ID_COMMENT: + case ID_BODY: + case ID_FRAMESET: + case ID_NOFRAMES: + case ID_SCRIPT: + return true; + default: + return false; + } + default: + kdDebug( 6030 ) << "unhandled tag in dtd.cpp:checkChild(): tagID=" << tagID << "!" << endl; + return false; + } +} + +void DOM::addForbidden(int tagId, ushort *forbiddenTags) +{ + switch(tagId) + { + case ID_A: + // we allow nested anchors. The innermost one wil be taken... + //forbiddenTags[ID_A]++; + break; + case ID_NOBR: + forbiddenTags[ID_PRE]++; + // fall through + case ID_PRE: + case ID_PLAINTEXT: + case ID_XMP: + //forbiddenTags[ID_IMG]++; + forbiddenTags[ID_OBJECT]++; + forbiddenTags[ID_EMBED]++; + forbiddenTags[ID_APPLET]++; + // why forbid them. We can deal with them in PRE + //forbiddenTags[ID_BIG]++; + //forbiddenTags[ID_SMALL]++; + //forbiddenTags[ID_SUB]++; + //forbiddenTags[ID_SUP]++; + forbiddenTags[ID_BASEFONT]++; + break; + case ID_DIR: + case ID_MENU: + forbiddenTags[ID_P]++; + forbiddenTags[ID_H1]++; + forbiddenTags[ID_H2]++; + forbiddenTags[ID_H3]++; + forbiddenTags[ID_H4]++; + forbiddenTags[ID_H5]++; + forbiddenTags[ID_H6]++; + forbiddenTags[ID_UL]++; + forbiddenTags[ID_OL]++; + forbiddenTags[ID_DIR]++; + forbiddenTags[ID_MENU]++; + forbiddenTags[ID_PRE]++; + forbiddenTags[ID_PLAINTEXT]++; + forbiddenTags[ID_XMP]++; + forbiddenTags[ID_DL]++; + forbiddenTags[ID_DIV]++; + forbiddenTags[ID_CENTER]++; + forbiddenTags[ID_NOSCRIPT]++; + forbiddenTags[ID_NOFRAMES]++; + forbiddenTags[ID_BLOCKQUOTE]++; + forbiddenTags[ID_FORM]++; + forbiddenTags[ID_ISINDEX]++; + forbiddenTags[ID_HR]++; + forbiddenTags[ID_TABLE]++; + forbiddenTags[ID_FIELDSET]++; + forbiddenTags[ID_ADDRESS]++; + break; + case ID_LABEL: + forbiddenTags[ID_LABEL]++; + break; + case ID_BUTTON: + forbiddenTags[ID_A]++; + forbiddenTags[ID_INPUT]++; + forbiddenTags[ID_SELECT]++; + forbiddenTags[ID_TEXTAREA]++; + forbiddenTags[ID_LABEL]++; + forbiddenTags[ID_BUTTON]++; + forbiddenTags[ID_FORM]++; + forbiddenTags[ID_ISINDEX]++; + forbiddenTags[ID_FIELDSET]++; + forbiddenTags[ID_IFRAME]++; + break; + default: + break; + } +} + +void DOM::removeForbidden(int tagId, ushort *forbiddenTags) +{ + switch(tagId) + { + case ID_A: + //forbiddenTags[ID_A]--; + break; + case ID_NOBR: + forbiddenTags[ID_PRE]--; + // fall through + case ID_PRE: + case ID_XMP: + case ID_PLAINTEXT: + //forbiddenTags[ID_IMG]--; + forbiddenTags[ID_OBJECT]--; + forbiddenTags[ID_EMBED]--; + forbiddenTags[ID_APPLET]--; + //forbiddenTags[ID_BIG]--; + //forbiddenTags[ID_SMALL]--; + //forbiddenTags[ID_SUB]--; + //forbiddenTags[ID_SUP]--; + forbiddenTags[ID_BASEFONT]--; + break; + case ID_DIR: + case ID_MENU: + forbiddenTags[ID_P]--; + forbiddenTags[ID_H1]--; + forbiddenTags[ID_H2]--; + forbiddenTags[ID_H3]--; + forbiddenTags[ID_H4]--; + forbiddenTags[ID_H5]--; + forbiddenTags[ID_H6]--; + forbiddenTags[ID_UL]--; + forbiddenTags[ID_OL]--; + forbiddenTags[ID_DIR]--; + forbiddenTags[ID_MENU]--; + forbiddenTags[ID_PRE]--; + forbiddenTags[ID_PLAINTEXT]--; + forbiddenTags[ID_XMP]--; + forbiddenTags[ID_DL]--; + forbiddenTags[ID_DIV]--; + forbiddenTags[ID_CENTER]--; + forbiddenTags[ID_NOSCRIPT]--; + forbiddenTags[ID_NOFRAMES]--; + forbiddenTags[ID_BLOCKQUOTE]--; + forbiddenTags[ID_FORM]--; + forbiddenTags[ID_ISINDEX]--; + forbiddenTags[ID_HR]--; + forbiddenTags[ID_TABLE]--; + forbiddenTags[ID_FIELDSET]--; + forbiddenTags[ID_ADDRESS]--; + break; + case ID_LABEL: + forbiddenTags[ID_LABEL]--; + break; + case ID_BUTTON: + forbiddenTags[ID_A]--; + forbiddenTags[ID_INPUT]--; + forbiddenTags[ID_SELECT]--; + forbiddenTags[ID_TEXTAREA]--; + forbiddenTags[ID_LABEL]--; + forbiddenTags[ID_BUTTON]--; + forbiddenTags[ID_FORM]--; + forbiddenTags[ID_ISINDEX]--; + forbiddenTags[ID_FIELDSET]--; + forbiddenTags[ID_IFRAME]--; + break; + default: + break; + } +} + diff --git a/tdehtml/html/dtd.dtd b/tdehtml/html/dtd.dtd new file mode 100644 index 000000000..d6a5ac8f0 --- /dev/null +++ b/tdehtml/html/dtd.dtd @@ -0,0 +1,1072 @@ + + + + + ... + + + ... + + + + The URI used as a system identifier with the public identifier allows + the user agent to download the DTD and entity sets as needed. + + The FPI for the Strict HTML 4.0 DTD is: + + "-//W3C//DTD HTML 4.0//EN" + + and its URI is: + + http://www.w3.org/TR/REC-html40/strict.dtd + + Authors should use the Strict DTD unless they need the + presentation control for user agents that don't (adequately) + support style sheets. + + If you are writing a document that includes frames, use + the following FPI: + + "-//W3C//DTD HTML 4.0 Frameset//EN" + + with the URI: + + http://www.w3.org/TR/REC-html40/frameset.dtd + + The following URIs are supported in relation to HTML 4.0 + + "http://www.w3.org/TR/REC-html40/strict.dtd" (Strict DTD) + "http://www.w3.org/TR/REC-html40/loose.dtd" (Loose DTD) + "http://www.w3.org/TR/REC-html40/frameset.dtd" (Frameset DTD) + "http://www.w3.org/TR/REC-html40/HTMLlat1.ent" (Latin-1 entities) + "http://www.w3.org/TR/REC-html40/HTMLsymbol.ent" (Symbol entities) + "http://www.w3.org/TR/REC-html40/HTMLspecial.ent" (Special entities) + + These URIs point to the latest version of each file. To reference + this specific revision use the following URIs: + + "http://www.w3.org/TR/1998/REC-html40-19980424/strict.dtd" + "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd" + "http://www.w3.org/TR/1998/REC-html40-19980424/frameset.dtd" + "http://www.w3.org/TR/1998/REC-html40-19980424/HTMLlat1.ent" + "http://www.w3.org/TR/1998/REC-html40-19980424/HTMLsymbol.ent" + "http://www.w3.org/TR/1998/REC-html40-19980424/HTMLspecial.ent" + +--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tdehtml/html/dtd.h b/tdehtml/html/dtd.h new file mode 100644 index 000000000..4192ce51c --- /dev/null +++ b/tdehtml/html/dtd.h @@ -0,0 +1,41 @@ +/* + * This file is part of the DOM implementation for KDE. + * + * (C) 1999 Lars Knoll (knoll@kde.org) + * + * 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 _DOM_dtd_h_ +#define _DOM_dtd_h_ + +#include "dom/dom_string.h" + +namespace DOM +{ + +void addForbidden(int tagId, ushort *forbiddenTags); +void removeForbidden(int tagId, ushort *forbiddenTags); + +enum tagStatus { OPTIONAL, REQUIRED, FORBIDDEN }; + +bool checkChild(ushort tagID, ushort childID, bool strict = false); + +extern const unsigned short tagPriority[]; +extern const tagStatus endTag[]; + +} //namespace DOM +#endif diff --git a/tdehtml/html/html_baseimpl.cpp b/tdehtml/html/html_baseimpl.cpp new file mode 100644 index 000000000..7ac3d93c9 --- /dev/null +++ b/tdehtml/html/html_baseimpl.cpp @@ -0,0 +1,708 @@ +/** + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2000 Simon Hausmann (hausmann@kde.org) + * (C) 2001-2003 Dirk Mueller (mueller@kde.org) + * + * 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 "html/html_baseimpl.h" +#include "html/html_documentimpl.h" + +#include "tdehtmlview.h" +#include "tdehtml_part.h" + +#include "rendering/render_frames.h" +#include "rendering/render_body.h" +#include "css/cssstyleselector.h" +#include "css/css_stylesheetimpl.h" +#include "css/cssproperties.h" +#include "css/cssvalues.h" +#include "css/csshelper.h" +#include "misc/loader.h" +#include "misc/htmlhashes.h" +#include "dom/dom_string.h" +#include "dom/dom_doc.h" +#include "xml/dom2_eventsimpl.h" + +#include +#include + +using namespace DOM; +using namespace tdehtml; + +HTMLBodyElementImpl::HTMLBodyElementImpl(DocumentImpl *doc) + : HTMLElementImpl(doc), + m_bgSet( false ), m_fgSet( false ) +{ + m_styleSheet = 0; +} + +HTMLBodyElementImpl::~HTMLBodyElementImpl() +{ + if(m_styleSheet) m_styleSheet->deref(); +} + +NodeImpl::Id HTMLBodyElementImpl::id() const +{ + return ID_BODY; +} + +void HTMLBodyElementImpl::parseAttribute(AttributeImpl *attr) +{ + switch(attr->id()) + { + + case ATTR_BACKGROUND: + { + TQString url = tdehtml::parseURL( attr->value() ).string(); + if (!url.isEmpty()) { + url = getDocument()->completeURL( url ); + addCSSProperty(CSS_PROP_BACKGROUND_IMAGE, "url('"+url+"')" ); + m_bgSet = true; + } + else { + removeCSSProperty(CSS_PROP_BACKGROUND_IMAGE); + m_bgSet = false; + } + break; + } + case ATTR_MARGINWIDTH: { + KHTMLView* w = getDocument()->view(); + if (w) + w->setMarginWidth( -1 ); // unset this, so it doesn't override the setting here + addCSSLength(CSS_PROP_MARGIN_RIGHT, attr->value() ); + } + /* nobreak; */ + case ATTR_LEFTMARGIN: + addCSSLength(CSS_PROP_MARGIN_LEFT, attr->value() ); + break; + case ATTR_MARGINHEIGHT: { + KHTMLView* w = getDocument()->view(); + if (w) + w->setMarginHeight( -1 ); // unset this, so it doesn't override the setting here + addCSSLength(CSS_PROP_MARGIN_BOTTOM, attr->value()); + } + /* nobreak */ + case ATTR_TOPMARGIN: + addCSSLength(CSS_PROP_MARGIN_TOP, attr->value()); + break; + case ATTR_BGCOLOR: + addHTMLColor(CSS_PROP_BACKGROUND_COLOR, attr->value()); + m_bgSet = !attr->value().isNull(); + break; + case ATTR_TEXT: + addHTMLColor(CSS_PROP_COLOR, attr->value()); + m_fgSet = !attr->value().isNull(); + break; + case ATTR_BGPROPERTIES: + if ( strcasecmp( attr->value(), "fixed" ) == 0) + addCSSProperty(CSS_PROP_BACKGROUND_ATTACHMENT, CSS_VAL_FIXED); + break; + case ATTR_VLINK: + case ATTR_ALINK: + case ATTR_LINK: + { + if(!m_styleSheet) { + m_styleSheet = new CSSStyleSheetImpl(this,DOMString(),true); + m_styleSheet->ref(); + } + TQString aStr; + if ( attr->id() == ATTR_LINK ) + aStr = "a:link"; + else if ( attr->id() == ATTR_VLINK ) + aStr = "a:visited"; + else if ( attr->id() == ATTR_ALINK ) + aStr = "a:active"; + aStr += " { color: " + attr->value().string() + "; }"; + m_styleSheet->parseString(aStr, !getDocument()->inCompatMode()); + m_styleSheet->setNonCSSHints(); + if (attached()) + getDocument()->updateStyleSelector(); + break; + } + case ATTR_ONLOAD: + getDocument()->setHTMLWindowEventListener(EventImpl::LOAD_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onload", NULL)); + break; + case ATTR_ONUNLOAD: + getDocument()->setHTMLWindowEventListener(EventImpl::UNLOAD_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onunload", NULL)); + break; + case ATTR_ONBLUR: + getDocument()->setHTMLWindowEventListener(EventImpl::BLUR_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onblur", NULL)); + break; + case ATTR_ONFOCUS: + getDocument()->setHTMLWindowEventListener(EventImpl::FOCUS_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onfocus", NULL)); + break; + case ATTR_ONRESIZE: + getDocument()->setHTMLWindowEventListener(EventImpl::RESIZE_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onresize", NULL)); + break; + case ATTR_ONKEYUP: + getDocument()->setHTMLWindowEventListener(EventImpl::KEYUP_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onkeyup", NULL)); + break; + case ATTR_ONKEYDOWN: + getDocument()->setHTMLWindowEventListener(EventImpl::KEYDOWN_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onkeydown", NULL)); + break; + case ATTR_ONKEYPRESS: + getDocument()->setHTMLWindowEventListener(EventImpl::KEYPRESS_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onkeypress", NULL)); + break; + case ATTR_ONSCROLL: + getDocument()->setHTMLWindowEventListener(EventImpl::SCROLL_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onscroll", NULL)); + break; + case ATTR_NOSAVE: + break; + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +void HTMLBodyElementImpl::insertedIntoDocument() +{ + HTMLElementImpl::insertedIntoDocument(); + + KHTMLView* w = getDocument()->view(); + if(w && w->marginWidth() != -1) { + TQString s; + s.sprintf( "%d", w->marginWidth() ); + addCSSLength(CSS_PROP_MARGIN_LEFT, s); + addCSSLength(CSS_PROP_MARGIN_RIGHT, s); + } + if(w && w->marginHeight() != -1) { + TQString s; + s.sprintf( "%d", w->marginHeight() ); + addCSSLength(CSS_PROP_MARGIN_TOP, s); + addCSSLength(CSS_PROP_MARGIN_BOTTOM, s); + } + + if ( m_bgSet && !m_fgSet ) + addCSSProperty(CSS_PROP_COLOR, CSS_VAL_BLACK); + + if (m_styleSheet) + getDocument()->updateStyleSelector(); +} + +void HTMLBodyElementImpl::removedFromDocument() +{ + HTMLElementImpl::removedFromDocument(); + + if (m_styleSheet) + getDocument()->updateStyleSelector(); +} + +void HTMLBodyElementImpl::attach() +{ + assert(!m_render); + assert(parentNode()); + + RenderStyle* style = getDocument()->styleSelector()->styleForElement(this); + style->ref(); + if (parentNode()->renderer() && style->display() != NONE) { + if (style->display() == BLOCK) + // only use the quirky class for block display + m_render = new (getDocument()->renderArena()) RenderBody(this); + else + m_render = RenderObject::createObject(this, style); + m_render->setStyle(style); + parentNode()->renderer()->addChild(m_render, nextRenderer()); + } + style->deref(); + + NodeBaseImpl::attach(); +} + +// ------------------------------------------------------------------------- + +HTMLFrameElementImpl::HTMLFrameElementImpl(DocumentImpl *doc) + : HTMLElementImpl(doc) +{ + frameBorder = true; + frameBorderSet = false; + marginWidth = -1; + marginHeight = -1; + scrolling = TQScrollView::Auto; + noresize = false; + url = "about:blank"; +} + +HTMLFrameElementImpl::~HTMLFrameElementImpl() +{ +} + +NodeImpl::Id HTMLFrameElementImpl::id() const +{ + return ID_FRAME; +} + +void HTMLFrameElementImpl::parseAttribute(AttributeImpl *attr) +{ + switch(attr->id()) + { + case ATTR_SRC: + setLocation(tdehtml::parseURL(attr->val())); + break; + case ATTR_FRAMEBORDER: + { + frameBorder = attr->value().toInt(); + frameBorderSet = ( attr->val() != 0 ); + // FIXME: when attached, has no effect + } + break; + case ATTR_MARGINWIDTH: + marginWidth = attr->val()->toInt(); + // FIXME: when attached, has no effect + break; + case ATTR_MARGINHEIGHT: + marginHeight = attr->val()->toInt(); + // FIXME: when attached, has no effect + break; + case ATTR_NORESIZE: + noresize = true; + // FIXME: when attached, has no effect + break; + case ATTR_SCROLLING: + if( strcasecmp( attr->value(), "auto" ) == 0 ) + scrolling = TQScrollView::Auto; + else if( strcasecmp( attr->value(), "yes" ) == 0 ) + scrolling = TQScrollView::AlwaysOn; + else if( strcasecmp( attr->value(), "no" ) == 0 ) + scrolling = TQScrollView::AlwaysOff; + // when attached, has no effect + break; + case ATTR_ONLOAD: + setHTMLEventListener(EventImpl::LOAD_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onload", this)); + break; + case ATTR_ONUNLOAD: + setHTMLEventListener(EventImpl::UNLOAD_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onunload", this)); + break; + case ATTR_ID: + case ATTR_NAME: + // FIXME: if already attached, doesn't change the frame name + // FIXME: frame name conflicts, no unique frame name anymore + name = attr->value(); + //fallthrough intentional, let the base handle it + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +void HTMLFrameElementImpl::attach() +{ + assert(!attached()); + assert(parentNode()); + + name = getAttribute(ATTR_NAME); + if (name.isNull()) + name = getAttribute(ATTR_ID); + + // inherit default settings from parent frameset + HTMLElementImpl* node = static_cast(parentNode()); + while(node) + { + if(node->id() == ID_FRAMESET) + { + HTMLFrameSetElementImpl* frameset = static_cast(node); + if(!frameBorderSet) frameBorder = frameset->frameBorder(); + if(!noresize) noresize = frameset->noResize(); + break; + } + node = static_cast(node->parentNode()); + } + + if (parentNode()->renderer() && getDocument()->isURLAllowed(url.string())) { + RenderStyle* _style = getDocument()->styleSelector()->styleForElement(this); + _style->ref(); + if ( _style->display() != NONE ) { + m_render = new (getDocument()->renderArena()) RenderFrame(this); + m_render->setStyle(_style); + parentNode()->renderer()->addChild(m_render, nextRenderer()); + } + _style->deref(); + } + + NodeBaseImpl::attach(); + + if (!m_render) + return; + + KHTMLView* w = getDocument()->view(); + if (w) { + // we need a unique name for every frame in the frameset. Hope that's unique enough. + if(name.isEmpty() || w->part()->frameExists( name.string() ) ) + name = DOMString(w->part()->requestFrameName()); + + // load the frame contents + w->part()->requestFrame( static_cast(m_render), url.string(), name.string() ); + } +} + +void HTMLFrameElementImpl::setLocation( const DOMString& str ) +{ + + url = str; + + if( !attached() ) + return; + + if( !m_render ) { + detach(); + attach(); + return; + } + + if( !getDocument()->isURLAllowed(url.string()) ) + return; + + // load the frame contents + KHTMLView *w = getDocument()->view(); + if (w) { + KHTMLPart *part = w->part()->findFrame( name.string() ); + if ( part ) { + part->openURL( KURL( getDocument()->completeURL( url.string() ) ) ); + } else { + w->part()->requestFrame( static_cast( m_render ), url.string(), name.string() ); + } + } +} + +bool HTMLFrameElementImpl::isFocusable() const +{ + return m_render!=0; +} + +void HTMLFrameElementImpl::setFocus(bool received) +{ + HTMLElementImpl::setFocus(received); + tdehtml::RenderFrame *renderFrame = static_cast(m_render); + if (!renderFrame || !renderFrame->widget()) + return; + if (received) + renderFrame->widget()->setFocus(); + else + renderFrame->widget()->clearFocus(); +} + +DocumentImpl* HTMLFrameElementImpl::contentDocument() const +{ + if ( !m_render ) return 0; + + RenderPart* render = static_cast( m_render ); + + if(render->widget() && ::tqqt_cast( render->widget()) ) + return static_cast( render->widget() )->part()->xmlDocImpl(); + + return 0; +} + +KHTMLPart* HTMLFrameElementImpl::contentPart() const +{ + if ( !m_render ) return 0; + + RenderPart* render = static_cast( m_render ); + + if(render->widget() && ::tqqt_cast( render->widget()) ) + return static_cast( render->widget() )->part(); + + return 0; +} + +// ------------------------------------------------------------------------- + +HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentImpl *doc) + : HTMLElementImpl(doc) +{ + // default value for rows and cols... + m_totalRows = 1; + m_totalCols = 1; + + m_rows = m_cols = 0; + + frameborder = true; + frameBorderSet = false; + m_border = 4; + noresize = false; + + m_resizing = false; + + m_onLoad = m_onUnLoad = 0; +} + +HTMLFrameSetElementImpl::~HTMLFrameSetElementImpl() +{ + //### this is likely not quite right since we may be effectively "overriding" some old value, + //which needs to be recomputed, but this is better than crashing... + if (getDocument()) { + if (m_onLoad && getDocument()->getHTMLEventListener(EventImpl::LOAD_EVENT) == m_onLoad) + getDocument()->setHTMLEventListener(EventImpl::LOAD_EVENT, 0); + + if (m_onUnLoad && getDocument()->getHTMLEventListener(EventImpl::UNLOAD_EVENT) == m_onUnLoad) + getDocument()->setHTMLEventListener(EventImpl::UNLOAD_EVENT, 0); + } + + delete [] m_rows; + delete [] m_cols; +} + +NodeImpl::Id HTMLFrameSetElementImpl::id() const +{ + return ID_FRAMESET; +} + +void HTMLFrameSetElementImpl::parseAttribute(AttributeImpl *attr) +{ + switch(attr->id()) + { + case ATTR_ROWS: + if (!attr->val()) break; + delete [] m_rows; + m_rows = attr->val()->toLengthArray(m_totalRows); + setChanged(); + break; + case ATTR_COLS: + if (!attr->val()) break; + delete [] m_cols; + m_cols = attr->val()->toLengthArray(m_totalCols); + setChanged(); + break; + case ATTR_FRAMEBORDER: + // false or "no" or "0".. + if ( attr->value().toInt() == 0 ) { + frameborder = false; + m_border = 0; + } + frameBorderSet = true; + break; + case ATTR_NORESIZE: + noresize = true; + break; + case ATTR_BORDER: + m_border = attr->val()->toInt(); + if(!m_border) + frameborder = false; + break; + case ATTR_ONLOAD: + m_onLoad = getDocument()->createHTMLEventListener(attr->value().string(), "onload", this); + getDocument()->setHTMLEventListener(EventImpl::LOAD_EVENT, m_onLoad); + break; + case ATTR_ONUNLOAD: + m_onUnLoad = getDocument()->createHTMLEventListener(attr->value().string(), "onunload", this); + getDocument()->setHTMLEventListener(EventImpl::UNLOAD_EVENT, m_onUnLoad); + break; + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +void HTMLFrameSetElementImpl::attach() +{ + assert(!attached() ); + assert(parentNode()); + + // inherit default settings from parent frameset + HTMLElementImpl* node = static_cast(parentNode()); + while(node) + { + if(node->id() == ID_FRAMESET) + { + HTMLFrameSetElementImpl* frameset = static_cast(node); + if(!frameBorderSet) frameborder = frameset->frameBorder(); + if(!noresize) noresize = frameset->noResize(); + break; + } + node = static_cast(node->parentNode()); + } + + // ignore display: none + if ( parentNode()->renderer() ) { + m_render = new (getDocument()->renderArena()) RenderFrameSet(this); + m_render->setStyle(getDocument()->styleSelector()->styleForElement(this)); + parentNode()->renderer()->addChild(m_render, nextRenderer()); + } + + NodeBaseImpl::attach(); +} + +void HTMLFrameSetElementImpl::defaultEventHandler(EventImpl *evt) +{ + if (evt->isMouseEvent() && !noresize && m_render) + static_cast(m_render)->userResize(static_cast(evt)); + + evt->setDefaultHandled(); + HTMLElementImpl::defaultEventHandler(evt); +} + +void HTMLFrameSetElementImpl::detach() +{ + if(attached()) + // ### send the event when we actually get removed from the doc instead of here + getDocument()->dispatchHTMLEvent(EventImpl::UNLOAD_EVENT,false,false); + + HTMLElementImpl::detach(); +} + +void HTMLFrameSetElementImpl::recalcStyle( StyleChange ch ) +{ + if (changed() && m_render) { + m_render->setNeedsLayout(true); +// m_render->layout(); + setChanged(false); + } + HTMLElementImpl::recalcStyle( ch ); +} + + +// ------------------------------------------------------------------------- + +NodeImpl::Id HTMLHeadElementImpl::id() const +{ + return ID_HEAD; +} + +// ------------------------------------------------------------------------- + +NodeImpl::Id HTMLHtmlElementImpl::id() const +{ + return ID_HTML; +} + + +// ------------------------------------------------------------------------- + +HTMLIFrameElementImpl::HTMLIFrameElementImpl(DocumentImpl *doc) : HTMLFrameElementImpl(doc) +{ + frameBorder = false; + marginWidth = 0; + marginHeight = 0; + needWidgetUpdate = false; + m_frame = true; +} + +HTMLIFrameElementImpl::~HTMLIFrameElementImpl() +{ +} + +NodeImpl::Id HTMLIFrameElementImpl::id() const +{ + return ID_IFRAME; +} + +void HTMLIFrameElementImpl::parseAttribute(AttributeImpl *attr ) +{ + switch ( attr->id() ) + { + case ATTR_WIDTH: + if (!attr->value().isEmpty()) + addCSSLength(CSS_PROP_WIDTH, attr->value()); + else + removeCSSProperty(CSS_PROP_WIDTH); + break; + case ATTR_HEIGHT: + if (!attr->value().isEmpty()) + addCSSLength(CSS_PROP_HEIGHT, attr->value()); + else + removeCSSProperty(CSS_PROP_HEIGHT); + break; + case ATTR_ALIGN: + addHTMLAlignment( attr->value() ); + break; + case ATTR_SRC: + needWidgetUpdate = true; // ### do this for scrolling, margins etc? + HTMLFrameElementImpl::parseAttribute( attr ); + break; + case ATTR_FRAMEBORDER: + { + m_frame = (!attr->val() || attr->value().toInt() > 0); + if (attached()) updateFrame(); + } + default: + HTMLFrameElementImpl::parseAttribute( attr ); + } +} + +void HTMLIFrameElementImpl::updateFrame() +{ + if (m_frame) { + addCSSProperty(CSS_PROP_BORDER_TOP_STYLE, CSS_VAL_OUTSET); + addCSSProperty(CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_OUTSET); + addCSSProperty(CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_OUTSET); + addCSSProperty(CSS_PROP_BORDER_RIGHT_STYLE, CSS_VAL_OUTSET); + addCSSLength(CSS_PROP_BORDER_WIDTH, "2"); + } else { + addCSSProperty(CSS_PROP_BORDER_TOP_STYLE, CSS_VAL_NONE); + addCSSProperty(CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_NONE); + addCSSProperty(CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_NONE); + addCSSProperty(CSS_PROP_BORDER_RIGHT_STYLE, CSS_VAL_NONE); + removeCSSProperty(CSS_PROP_BORDER_WIDTH); + } + +} + +void HTMLIFrameElementImpl::attach() +{ + assert(!attached()); + assert(!m_render); + assert(parentNode()); + + updateFrame(); + name = getAttribute(ATTR_NAME); + if (name.isNull()) + name = getAttribute(ATTR_ID); + + RenderStyle* style = getDocument()->styleSelector()->styleForElement(this); + style->ref(); + if (getDocument()->isURLAllowed(url.string()) && + parentNode()->renderer() && style->display() != NONE) { + m_render = new (getDocument()->renderArena()) RenderPartObject(this); + m_render->setStyle(style); + parentNode()->renderer()->addChild(m_render, nextRenderer()); + } + style->deref(); + + NodeBaseImpl::attach(); + + if (m_render) { + // we need a unique name for every frame in the frameset. Hope that's unique enough. + KHTMLView* w = getDocument()->view(); + if(w && (name.isEmpty() || w->part()->frameExists( name.string() ))) + name = DOMString(w->part()->requestFrameName()); + + needWidgetUpdate = false; + static_cast(m_render)->updateWidget(); + } +} + +void HTMLIFrameElementImpl::recalcStyle( StyleChange ch ) +{ + if (needWidgetUpdate) { + needWidgetUpdate = false; + if(m_render) static_cast(m_render)->updateWidget(); + } + HTMLElementImpl::recalcStyle( ch ); +} + diff --git a/tdehtml/html/html_baseimpl.h b/tdehtml/html/html_baseimpl.h new file mode 100644 index 000000000..0aff3e8e1 --- /dev/null +++ b/tdehtml/html/html_baseimpl.h @@ -0,0 +1,207 @@ +/* + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) + * (C) 2000-2003 Dirk Mueller (mueller@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2000 Simon Hausmann + * Copyright (C) 2002 Apple Computer, Inc. + * + * 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 HTML_BASEIMPL_H +#define HTML_BASEIMPL_H + +#include "html/dtd.h" +#include "html/html_elementimpl.h" +#include "misc/tdehtmllayout.h" + +#include + +class KHTMLView; +class KHTMLPart; + +namespace tdehtml { + class RenderFrameSet; + class RenderFrame; + class RenderPartObject; +} + +namespace DOM { + +class DOMString; +class CSSStyleSheetImpl; +class HTMLFrameElement; + +// ------------------------------------------------------------------------- + +class HTMLBodyElementImpl : public HTMLElementImpl +{ +public: + HTMLBodyElementImpl(DocumentImpl *doc); + ~HTMLBodyElementImpl(); + + virtual Id id() const; + + virtual void parseAttribute(AttributeImpl *); + virtual void attach(); + + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + + CSSStyleSheetImpl *sheet() const { return m_styleSheet; } + +protected: + CSSStyleSheetImpl *m_styleSheet; + bool m_bgSet; + bool m_fgSet; +}; + +// ------------------------------------------------------------------------- + +class HTMLFrameElementImpl : public HTMLElementImpl +{ + friend class tdehtml::RenderFrame; + friend class tdehtml::RenderPartObject; + +public: + HTMLFrameElementImpl(DocumentImpl *doc); + + ~HTMLFrameElementImpl(); + + virtual Id id() const; + + virtual void parseAttribute(AttributeImpl *); + virtual void attach(); + + bool noResize() { return noresize; } + void setLocation( const DOMString& str ); + + virtual bool isFocusable() const; + virtual void setFocus(bool); + + DocumentImpl* contentDocument() const; + KHTMLPart* contentPart() const; + + DOMString url; + DOMString name; + + int marginWidth; + int marginHeight; + TQScrollView::ScrollBarMode scrolling; + + bool frameBorder : 1; + bool frameBorderSet : 1; + bool noresize : 1; +}; + +// ------------------------------------------------------------------------- + +class HTMLFrameSetElementImpl : public HTMLElementImpl +{ + friend class tdehtml::RenderFrameSet; +public: + HTMLFrameSetElementImpl(DocumentImpl *doc); + + ~HTMLFrameSetElementImpl(); + + virtual Id id() const; + + virtual void parseAttribute(AttributeImpl *); + virtual void attach(); + + virtual void defaultEventHandler(EventImpl *evt); + + bool frameBorder() { return frameborder; } + bool noResize() { return noresize; } + + int totalRows() const { return m_totalRows; } + int totalCols() const { return m_totalCols; } + int border() const { return m_border; } + virtual void detach(); + + virtual void recalcStyle( StyleChange ch ); + +protected: + tdehtml::Length* m_rows; + tdehtml::Length* m_cols; + + int m_totalRows; + int m_totalCols; + int m_border; + + bool frameborder : 1; + bool frameBorderSet : 1; + bool noresize : 1; + bool m_resizing : 1; // is the user resizing currently + + EventListener* m_onLoad; + EventListener* m_onUnLoad; +}; + +// ------------------------------------------------------------------------- + +class HTMLHeadElementImpl : public HTMLElementImpl +{ +public: + HTMLHeadElementImpl(DocumentImpl *doc) + : HTMLElementImpl(doc) {} + + virtual Id id() const; +}; + +// ------------------------------------------------------------------------- + +class HTMLHtmlElementImpl : public HTMLElementImpl +{ +public: + HTMLHtmlElementImpl(DocumentImpl *doc) + : HTMLElementImpl(doc) {} + + virtual Id id() const; +}; + + +// ------------------------------------------------------------------------- + +class HTMLIFrameElementImpl : public HTMLFrameElementImpl +{ +public: + HTMLIFrameElementImpl(DocumentImpl *doc); + + ~HTMLIFrameElementImpl(); + + virtual Id id() const; + + virtual void parseAttribute(AttributeImpl *attr); + virtual void attach(); + virtual void recalcStyle( StyleChange ch ); + +protected: + + void updateFrame(); + + bool needWidgetUpdate; + bool m_frame; +}; + + +} //namespace + +#endif + diff --git a/tdehtml/html/html_blockimpl.cpp b/tdehtml/html/html_blockimpl.cpp new file mode 100644 index 000000000..3e4585c41 --- /dev/null +++ b/tdehtml/html/html_blockimpl.cpp @@ -0,0 +1,371 @@ +/** + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2003 Apple Computer, Inc. + * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.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. + * + */ +// ------------------------------------------------------------------------- +//#define DEBUG +#include "html_blockimpl.h" +#include "html_documentimpl.h" +#include "css/cssstyleselector.h" + +#include "css/cssproperties.h" +#include "css/cssvalues.h" +#include "misc/htmlhashes.h" + +#include + +using namespace tdehtml; +using namespace DOM; + +void HTMLDivElementImpl::parseAttribute(AttributeImpl *attr) +{ + switch(attr->id()) + { + case ATTR_ALIGN: + { + DOMString v = attr->value().lower(); + if ( strcmp( v, "middle" ) == 0 || strcmp( v, "center" ) == 0 ) + addCSSProperty(CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_CENTER); + else if (strcmp(v, "left") == 0) + addCSSProperty(CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_LEFT); + else if (strcmp(v, "right") == 0) + addCSSProperty(CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_RIGHT); + else + addCSSProperty(CSS_PROP_TEXT_ALIGN, v); + break; + } + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +// ------------------------------------------------------------------------- + +NodeImpl::Id HTMLHRElementImpl::id() const +{ + return ID_HR; +} + +void HTMLHRElementImpl::parseAttribute(AttributeImpl *attr) +{ + switch( attr->id() ) + { + case ATTR_ALIGN: { + if (strcasecmp(attr->value(), "left") == 0) { + addCSSProperty(CSS_PROP_MARGIN_LEFT, "0"); + addCSSProperty(CSS_PROP_MARGIN_RIGHT, CSS_VAL_AUTO); + } + else if (strcasecmp(attr->value(), "right") == 0) { + addCSSProperty(CSS_PROP_MARGIN_LEFT, CSS_VAL_AUTO); + addCSSProperty(CSS_PROP_MARGIN_RIGHT, "0"); + } + else { + addCSSProperty(CSS_PROP_MARGIN_LEFT, CSS_VAL_AUTO); + addCSSProperty(CSS_PROP_MARGIN_RIGHT, CSS_VAL_AUTO); + } + break; + } + case ATTR_WIDTH: + { + if(!attr->val()) break; + // cheap hack to cause linebreaks + // tdehtmltests/html/strange_hr.html + bool ok; + int v = attr->val()->toInt(&ok); + if(ok && !v) + addCSSLength(CSS_PROP_WIDTH, "1"); + else + addCSSLength(CSS_PROP_WIDTH, attr->value()); + } + break; + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +// ### make sure we undo what we did during detach +void HTMLHRElementImpl::attach() +{ + if (attributes(true /* readonly */)) { + // there are some attributes, lets check + DOMString color = getAttribute(ATTR_COLOR); + DOMStringImpl* si = getAttribute(ATTR_SIZE).implementation(); + int _s = si ? si->toInt() : -1; + DOMString n("1"); + if (!color.isNull()) { + addCSSProperty(CSS_PROP_BORDER_TOP_STYLE, CSS_VAL_SOLID); + addCSSProperty(CSS_PROP_BORDER_RIGHT_STYLE, CSS_VAL_SOLID); + addCSSProperty(CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_SOLID); + addCSSProperty(CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_SOLID); + addCSSProperty(CSS_PROP_BORDER_TOP_WIDTH, DOMString("0")); + addCSSLength(CSS_PROP_BORDER_BOTTOM_WIDTH, DOMString(si)); + addHTMLColor(CSS_PROP_BORDER_COLOR, color); + } + else { + if (_s > 1 && getAttribute(ATTR_NOSHADE).isNull()) { + addCSSProperty(CSS_PROP_BORDER_BOTTOM_WIDTH, n); + addCSSProperty(CSS_PROP_BORDER_TOP_WIDTH, n); + addCSSProperty(CSS_PROP_BORDER_LEFT_WIDTH, n); + addCSSProperty(CSS_PROP_BORDER_RIGHT_WIDTH, n); + addCSSLength(CSS_PROP_HEIGHT, DOMString(TQString::number(_s-2))); + } + else if (_s >= 0) { + addCSSProperty(CSS_PROP_BORDER_TOP_WIDTH, DOMString(TQString::number(_s))); + addCSSProperty(CSS_PROP_BORDER_BOTTOM_WIDTH, DOMString("0")); + } + } + if (_s == 0) + addCSSProperty(CSS_PROP_MARGIN_BOTTOM, n); + } + + HTMLElementImpl::attach(); +} + +// ------------------------------------------------------------------------- + +long HTMLPreElementImpl::width() const +{ + // ### + return 0; +} + +void HTMLPreElementImpl::setWidth( long /*w*/ ) +{ + // ### +} + +// ------------------------------------------------------------------------- + + // WinIE uses 60ms as the minimum delay by default. +const int defaultMinimumDelay = 60; + +HTMLMarqueeElementImpl::HTMLMarqueeElementImpl(DocumentImpl *doc) +: HTMLElementImpl(doc), + m_minimumDelay(defaultMinimumDelay) +{ +} + +NodeImpl::Id HTMLMarqueeElementImpl::id() const +{ + return ID_MARQUEE; +} + +void HTMLMarqueeElementImpl::parseAttribute(AttributeImpl *attr) +{ + switch(attr->id()) + { + case ATTR_WIDTH: + if (!attr->value().isEmpty()) + addCSSLength(CSS_PROP_WIDTH, attr->value()); + else + removeCSSProperty(CSS_PROP_WIDTH); + break; + case ATTR_HEIGHT: + if (!attr->value().isEmpty()) + addCSSLength(CSS_PROP_HEIGHT, attr->value()); + else + removeCSSProperty(CSS_PROP_HEIGHT); + break; + case ATTR_BGCOLOR: + if (!attr->value().isEmpty()) + addHTMLColor(CSS_PROP_BACKGROUND_COLOR, attr->value()); + else + removeCSSProperty(CSS_PROP_BACKGROUND_COLOR); + break; + case ATTR_VSPACE: + if (!attr->value().isEmpty()) { + addCSSLength(CSS_PROP_MARGIN_TOP, attr->value()); + addCSSLength(CSS_PROP_MARGIN_BOTTOM, attr->value()); + } + else { + removeCSSProperty(CSS_PROP_MARGIN_TOP); + removeCSSProperty(CSS_PROP_MARGIN_BOTTOM); + } + break; + case ATTR_HSPACE: + if (!attr->value().isEmpty()) { + addCSSLength(CSS_PROP_MARGIN_LEFT, attr->value()); + addCSSLength(CSS_PROP_MARGIN_RIGHT, attr->value()); + } + else { + removeCSSProperty(CSS_PROP_MARGIN_LEFT); + removeCSSProperty(CSS_PROP_MARGIN_RIGHT); + } + break; + case ATTR_SCROLLAMOUNT: + if (!attr->value().isEmpty()) + addCSSLength(CSS_PROP__KHTML_MARQUEE_INCREMENT, attr->value()); + else + removeCSSProperty(CSS_PROP__KHTML_MARQUEE_INCREMENT); + break; + case ATTR_SCROLLDELAY: + if (!attr->value().isEmpty()) + addCSSLength(CSS_PROP__KHTML_MARQUEE_SPEED, attr->value(), true); + else + removeCSSProperty(CSS_PROP__KHTML_MARQUEE_SPEED); + break; + case ATTR_LOOP: + if (!attr->value().isEmpty()) { + if (attr->value() == "-1" || strcasecmp(attr->value(), "infinite") == 0) + addCSSProperty(CSS_PROP__KHTML_MARQUEE_REPETITION, CSS_VAL_INFINITE); + else + addCSSLength(CSS_PROP__KHTML_MARQUEE_REPETITION, attr->value().lower(), true); + } + else + removeCSSProperty(CSS_PROP__KHTML_MARQUEE_REPETITION); + break; + case ATTR_BEHAVIOR: + if (!attr->value().isEmpty()) + addCSSProperty(CSS_PROP__KHTML_MARQUEE_STYLE, attr->value().lower()); + else + removeCSSProperty(CSS_PROP__KHTML_MARQUEE_STYLE); + break; + case ATTR_DIRECTION: + if (!attr->value().isEmpty()) + addCSSProperty(CSS_PROP__KHTML_MARQUEE_DIRECTION, attr->value().lower()); + else + removeCSSProperty(CSS_PROP__KHTML_MARQUEE_DIRECTION); + break; + case ATTR_TRUESPEED: + m_minimumDelay = attr->val() ? 0 : defaultMinimumDelay; + break; + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +// ------------------------------------------------------------------------ + +HTMLLayerElementImpl::HTMLLayerElementImpl(DocumentImpl *doc, ushort _tagid) + : HTMLDivElementImpl( doc, _tagid ) +{ + transparent = fixed = false; +} + +void HTMLLayerElementImpl::parseAttribute(AttributeImpl *attr) +{ + // Layers are evil + // They are mainly implemented here to correctly parse the hidden attribute + switch(attr->id()) { + case ATTR_LEFT: + addCSSProperty(CSS_PROP_LEFT, attr->value()); + break; + case ATTR_TOP: + addCSSProperty(CSS_PROP_TOP, attr->value()); + break; + case ATTR_PAGEX: + if (!transparent && !fixed) { + addCSSProperty(CSS_PROP_POSITION, CSS_VAL_FIXED); + fixed = true; + } + addCSSProperty(CSS_PROP_LEFT, attr->value()); + break; + case ATTR_PAGEY: + if (!transparent && !fixed) { + addCSSProperty(CSS_PROP_POSITION, CSS_VAL_FIXED); + fixed = true; + } + addCSSProperty(CSS_PROP_TOP, attr->value()); + break; + case ATTR_WIDTH: + if (!attr->value().isEmpty()) + addCSSLength(CSS_PROP_WIDTH, attr->value()); + else + removeCSSProperty(CSS_PROP_WIDTH); + break; + case ATTR_HEIGHT: + if (!attr->value().isEmpty()) + addCSSLength(CSS_PROP_HEIGHT, attr->value()); + else + removeCSSProperty(CSS_PROP_HEIGHT); + break; + case ATTR_BGCOLOR: + if (!attr->value().isEmpty()) + addHTMLColor(CSS_PROP_BACKGROUND_COLOR, attr->value()); + else + removeCSSProperty(CSS_PROP_BACKGROUND_COLOR); + break; + case ATTR_Z_INDEX: + if (!attr->value().isEmpty()) + addCSSProperty(CSS_PROP_Z_INDEX, attr->value()); + else + removeCSSProperty(CSS_PROP_Z_INDEX); + break; + case ATTR_VISIBILITY: + if (attr->value().lower() == "show") + addCSSProperty(CSS_PROP_VISIBILITY, CSS_VAL_VISIBLE); + else if (attr->value().lower() == "hide") + addCSSProperty(CSS_PROP_VISIBILITY, CSS_VAL_HIDDEN); + else if (attr->value().lower() == "inherit") + addCSSProperty(CSS_PROP_VISIBILITY, CSS_VAL_INHERIT); + break; + case ATTR_NAME: + if (id() == ID_LAYER && inDocument() && m_name != attr->value()) { + getDocument()->underDocNamedCache().remove(m_name.string(), this); + getDocument()->underDocNamedCache().add (attr->value().string(), this); + } + //fallthrough + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +void HTMLLayerElementImpl::removedFromDocument() +{ + if (id() == ID_LAYER) + getDocument()->underDocNamedCache().remove(m_name.string(), this); + HTMLDivElementImpl::removedFromDocument(); +} + +void HTMLLayerElementImpl::insertedIntoDocument() +{ + if (id() == ID_LAYER) + getDocument()->underDocNamedCache().add(m_name.string(), this); + HTMLDivElementImpl::insertedIntoDocument(); +} + +void HTMLLayerElementImpl::removeId(const TQString& id) +{ + getDocument()->underDocNamedCache().remove(id, this); + HTMLDivElementImpl::removeId(id); +} + +void HTMLLayerElementImpl::addId (const TQString& id) +{ + getDocument()->underDocNamedCache().add(id, this); + HTMLDivElementImpl::addId(id); +} + + + +NodeImpl *HTMLLayerElementImpl::addChild(NodeImpl *child) +{ + NodeImpl *retval = HTMLDivElementImpl::addChild(child); + // When someone adds standard layers, we make sure not to interfere + if (retval && retval->id() == ID_DIV) { + if (!transparent) + addCSSProperty(CSS_PROP_POSITION, CSS_VAL_STATIC); + transparent = true; + } + return retval; +} diff --git a/tdehtml/html/html_blockimpl.h b/tdehtml/html/html_blockimpl.h new file mode 100644 index 000000000..f560583db --- /dev/null +++ b/tdehtml/html/html_blockimpl.h @@ -0,0 +1,108 @@ +/* + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2003 Apple Computer, Inc. + * + * 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 HTML_BLOCKIMPL_H +#define HTML_BLOCKIMPL_H + +#include "html_elementimpl.h" +#include "dtd.h" + +namespace DOM { + +// ------------------------------------------------------------------------- + +class HTMLDivElementImpl : public HTMLGenericElementImpl +{ +public: + HTMLDivElementImpl(DocumentImpl *doc, ushort _tagid) + : HTMLGenericElementImpl(doc, _tagid) {} + + virtual void parseAttribute(AttributeImpl *token); +}; + +// ------------------------------------------------------------------------- + +class HTMLHRElementImpl : public HTMLElementImpl +{ +public: + HTMLHRElementImpl(DocumentImpl *doc) + : HTMLElementImpl(doc) {} + + virtual NodeImpl::Id id() const; + virtual void parseAttribute(AttributeImpl *); + virtual void attach(); +}; + +// ------------------------------------------------------------------------- + +class HTMLPreElementImpl : public HTMLGenericElementImpl +{ +public: + HTMLPreElementImpl(DocumentImpl *doc, ushort _tagid) + : HTMLGenericElementImpl(doc, _tagid) {} + + long width() const; + void setWidth( long w ); +}; + +// ------------------------------------------------------------------------- + +class HTMLMarqueeElementImpl : public HTMLElementImpl +{ +public: + HTMLMarqueeElementImpl(DocumentImpl *doc); + + virtual NodeImpl::Id id() const; + virtual void parseAttribute(AttributeImpl *token); + + int minimumDelay() const { return m_minimumDelay; } + +private: + int m_minimumDelay; +}; + +// ------------------------------------------------------------------------- + +class HTMLLayerElementImpl : public HTMLDivElementImpl +{ +public: + HTMLLayerElementImpl( DocumentImpl *doc, ushort _tagid ); + + virtual void parseAttribute(AttributeImpl *); + virtual NodeImpl *addChild(NodeImpl *child); + + virtual void removedFromDocument(); + virtual void insertedIntoDocument(); + virtual void addId(const TQString& id); + virtual void removeId(const TQString& id); +private: + DOMString m_name; + bool fixed; + bool transparent; +}; + +} //namespace +#endif + diff --git a/tdehtml/html/html_documentimpl.cpp b/tdehtml/html/html_documentimpl.cpp new file mode 100644 index 000000000..3aa70c196 --- /dev/null +++ b/tdehtml/html/html_documentimpl.cpp @@ -0,0 +1,537 @@ +/** + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * + * 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 "html/html_documentimpl.h" +#include "html/html_imageimpl.h" +#include "html/html_headimpl.h" +#include "html/html_baseimpl.h" +#include "html/htmltokenizer.h" +#include "html/html_miscimpl.h" +#include "html/html_formimpl.h" + +#include "tdehtmlview.h" +#include "tdehtml_part.h" +#include "tdehtmlpart_p.h" +#include "tdehtml_settings.h" +#include "misc/htmlattrs.h" +#include "misc/htmlhashes.h" + +#include "xml/xml_tokenizer.h" +#include "xml/dom2_eventsimpl.h" + +#include "tdehtml_factory.h" +#include "rendering/render_object.h" +#include "dom/dom_exception.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "css/cssproperties.h" +#include "css/cssstyleselector.h" +#include "css/css_stylesheetimpl.h" +#include +#include + +// Turn off inlining to avoid warning with newer gcc. +#undef __inline +#define __inline +#include "doctypes.cpp" +#undef __inline + +template class TQPtrStack; + +using namespace DOM; +using namespace tdehtml; + + +HTMLDocumentImpl::HTMLDocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v) + : DocumentImpl(_implementation, v) +{ +// kdDebug( 6090 ) << "HTMLDocumentImpl constructor this = " << this << endl; + htmlElement = 0; + + m_doAutoFill = false; + +/* dynamic history stuff to be fixed later (pfeiffer) + connect( KHTMLFactory::vLinks(), TQT_SIGNAL( removed( const TQString& )), + TQT_SLOT( slotHistoryChanged() )); +*/ + connect( KHTMLFactory::vLinks(), TQT_SIGNAL( inserted( const TQString& ) ), + TQT_SLOT( slotHistoryChanged() )); + connect( KHTMLFactory::vLinks(), TQT_SIGNAL( cleared()), + TQT_SLOT( slotHistoryChanged() )); +} + +HTMLDocumentImpl::~HTMLDocumentImpl() +{ +} + +DOMString HTMLDocumentImpl::referrer() const +{ + if ( view() ) + return view()->part()->pageReferrer(); + return DOMString(); +} + +DOMString HTMLDocumentImpl::lastModified() const +{ + if ( view() ) + return view()->part()->lastModified(); + return DOMString(); +} + +DOMString HTMLDocumentImpl::cookie() const +{ + long windowId = 0; + KHTMLView *v = view (); + + if ( v && v->topLevelWidget() ) + windowId = v->topLevelWidget()->winId(); + + TQCString replyType; + TQByteArray params, reply; + TQDataStream stream(params, IO_WriteOnly); + stream << URL().url() << windowId; + if (!kapp->dcopClient()->call("kcookiejar", "kcookiejar", + "findDOMCookies(TQString,long int)", params, + replyType, reply)) + { + kdWarning(6010) << "Can't communicate with cookiejar!" << endl; + return DOMString(); + } + + TQDataStream stream2(reply, IO_ReadOnly); + if(replyType != "TQString") { + kdError(6010) << "DCOP function findDOMCookies(...) returns " + << replyType << ", expected TQString" << endl; + return DOMString(); + } + + TQString result; + stream2 >> result; + return DOMString(result); +} + +void HTMLDocumentImpl::setCookie( const DOMString & value ) +{ + long windowId = 0; + KHTMLView *v = view (); + + if ( v && v->topLevelWidget() ) + windowId = v->topLevelWidget()->winId(); + + TQByteArray params; + TQDataStream stream(params, IO_WriteOnly); + TQCString fake_header("Set-Cookie: "); + fake_header.append(value.string().latin1()); + fake_header.append("\n"); + stream << URL().url() << fake_header << windowId; + if (!kapp->dcopClient()->send("kcookiejar", "kcookiejar", + "addCookies(TQString,TQCString,long int)", params)) + { + // Maybe it wasn't running (e.g. we're opening local html files) + TDEApplication::startServiceByDesktopName( "kcookiejar"); + if (!kapp->dcopClient()->send("kcookiejar", "kcookiejar", + "addCookies(TQString,TQCString,long int)", params)) + kdWarning(6010) << "Can't communicate with cookiejar!" << endl; + } +} + + + +HTMLElementImpl *HTMLDocumentImpl::body() +{ + NodeImpl *de = documentElement(); + if (!de) + return 0; + + // try to prefer a FRAMESET element over BODY + NodeImpl* body = 0; + for (NodeImpl* i = de->firstChild(); i; i = i->nextSibling()) { + if (i->id() == ID_FRAMESET) + return static_cast(i); + + if (i->id() == ID_BODY) + body = i; + } + return static_cast(body); +} + +void HTMLDocumentImpl::setBody(HTMLElementImpl *_body, int& exceptioncode) +{ + HTMLElementImpl *b = body(); + if ( !_body ) { + exceptioncode = DOMException::HIERARCHY_REQUEST_ERR; + return; + } + if ( !b ) + documentElement()->appendChild( _body, exceptioncode ); + else + documentElement()->replaceChild( _body, b, exceptioncode ); +} + +Tokenizer *HTMLDocumentImpl::createTokenizer() +{ + return new HTMLTokenizer(docPtr(),m_view); +} + +// -------------------------------------------------------------------------- +// not part of the DOM +// -------------------------------------------------------------------------- + +bool HTMLDocumentImpl::childAllowed( NodeImpl *newChild ) +{ + // ### support comments. etc as a child + return (newChild->id() == ID_HTML || newChild->id() == ID_COMMENT); +} + +ElementImpl *HTMLDocumentImpl::createElement( const DOMString &name, int* pExceptioncode ) +{ + ElementImpl *e = createHTMLElement(name); + if ( e ) { + e->setHTMLCompat( htmlMode() != XHtml ); + return e; + } + return DocumentImpl::createElement(name, pExceptioncode); +} + +void HTMLDocumentImpl::slotHistoryChanged() +{ + if ( true || !m_render ) + return; + + recalcStyle( Force ); + m_render->repaint(); +} + +HTMLMapElementImpl* HTMLDocumentImpl::getMap(const DOMString& _url) +{ + TQString url = _url.string(); + TQString s; + int pos = url.find('#'); + //kdDebug(0) << "map pos of #:" << pos << endl; + s = TQString(_url.unicode() + pos + 1, _url.length() - pos - 1); + + TQMapConstIterator it = mapMap.find(s); + + if (it != mapMap.end()) + return *it; + else + return 0; +} + +void HTMLDocumentImpl::close() +{ + bool doload = !parsing() && m_tokenizer; + + DocumentImpl::close(); + + if (doload) { + + if (title().isEmpty()) // ensure setTitle is called at least once + setTitle( DOMString() ); + + // auto fill: walk the tree and try to fill in login credentials + if (view() && m_doAutoFill) { + for (NodeImpl* n = this; n; n = n->traverseNextNode()) + if (n->id() == ID_FORM) + static_cast(n)->doAutoFill(); + m_doAutoFill = false; + } + + // According to dom the load event must not bubble + // but other browsers execute in a frameset document + // the first(IE)/last(Moz/Konq) registered onload on a and the + // first(IE)/last(Moz/Konq) registered onload on a . + + //kdDebug() << "dispatching LOAD_EVENT on document " << getDocument() << " " << (view()?view()->part()->name():0) << endl; + + //Make sure to flush any pending image events now, as we want them out before the document's load event + dispatchImageLoadEventsNow(); + getDocument()->dispatchWindowEvent(EventImpl::LOAD_EVENT, false, false); + + // don't update rendering if we're going to redirect anyway + if ( view() && ( view()->part()->d->m_redirectURL.isNull() || + view()->part()->d->m_delayRedirect > 1 ) ) + updateRendering(); + } +} + + +const int PARSEMODE_HAVE_DOCTYPE = (1<<0); +const int PARSEMODE_HAVE_PUBLIC_ID = (1<<1); +const int PARSEMODE_HAVE_SYSTEM_ID = (1<<2); +const int PARSEMODE_HAVE_INTERNAL = (1<<3); + +static int parseDocTypePart(const TQString& buffer, int index) +{ + while (true) { + TQChar ch = buffer[index]; + if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') + ++index; + else if (ch == '-') { + int tmpIndex=index; + if (buffer[index+1] == '-' && + ((tmpIndex=buffer.find("--", index+2)) != -1)) + index = tmpIndex+2; + else + return index; + } + else + return index; + } +} + +static bool containsString(const char* str, const TQString& buffer, int offset) +{ + TQString startString(str); + if (offset + startString.length() > buffer.length()) + return false; + + TQString bufferString = buffer.mid(offset, startString.length()).lower(); + TQString lowerStart = startString.lower(); + + return bufferString.startsWith(lowerStart); +} + +static bool parseDocTypeDeclaration(const TQString& buffer, + int* resultFlags, + TQString& publicID, + TQString& systemID) +{ + bool haveDocType = false; + *resultFlags = 0; + + // Skip through any comments and processing instructions. + int index = 0; + do { + index = buffer.find('<', index); + if (index == -1) break; + TQChar nextChar = buffer[index+1]; + if (nextChar == '!') { + if (containsString("doctype", buffer, index+2)) { + haveDocType = true; + index += 9; // Skip "', index); + } + else if (nextChar == '?') + index = buffer.find('>', index); + else + break; + } while (index != -1); + + if (!haveDocType) + return true; + *resultFlags |= PARSEMODE_HAVE_DOCTYPE; + + index = parseDocTypePart(buffer, index); + if (!containsString("html", buffer, index)) + return false; + + index = parseDocTypePart(buffer, index+4); + bool hasPublic = containsString("public", buffer, index); + if (hasPublic) { + index = parseDocTypePart(buffer, index+6); + + // We've read ') { + // Public identifier present, but no system identifier. + // Do nothing. Note that this is the most common + // case. + } + else if (next == '\"' || next == '\'') { + // We have a system identifier. + *resultFlags |= PARSEMODE_HAVE_SYSTEM_ID; + int systemIDStart = index+1; + int systemIDEnd = buffer.find(next, systemIDStart); + if (systemIDEnd == -1) + return false; + systemID = buffer.mid(systemIDStart, systemIDEnd - systemIDStart); + } + else if (next == '[') { + // We found an internal subset. + *resultFlags |= PARSEMODE_HAVE_INTERNAL; + } + else + return false; // Something's wrong. + + // We need to trim whitespace off the public identifier. + publicID = buffer.mid(publicIDStart, publicIDEnd - publicIDStart); + publicID = publicID.simplifyWhiteSpace(); + *resultFlags |= PARSEMODE_HAVE_PUBLIC_ID; + } else { + if (containsString("system", buffer, index)) { + // Doctype has a system ID but no public ID + *resultFlags |= PARSEMODE_HAVE_SYSTEM_ID; + index = parseDocTypePart(buffer, index+6); + TQChar next = buffer[index]; + if (next != '\"' && next != '\'') + return false; + int systemIDStart = index+1; + int systemIDEnd = buffer.find(next, systemIDStart); + if (systemIDEnd == -1) + return false; + systemID = buffer.mid(systemIDStart, systemIDEnd - systemIDStart); + index = parseDocTypePart(buffer, systemIDEnd+1); + } + + TQChar nextChar = buffer[index]; + if (nextChar == '[') + *resultFlags |= PARSEMODE_HAVE_INTERNAL; + else if (nextChar != '>') + return false; + } + + return true; +} + +void HTMLDocumentImpl::determineParseMode( const TQString &str ) +{ + //kdDebug() << "DocumentImpl::determineParseMode str=" << str<< endl; + int oldPMode = pMode; + + // This code more or less mimics Mozilla's implementation (specifically the + // doctype parsing implemented by David Baron in Mozilla's nsParser.cpp). + // + // There are three possible parse modes: + // COMPAT - quirks mode emulates WinIE + // and NS4. CSS parsing is also relaxed in this mode, e.g., unit types can + // be omitted from numbers. + // ALMOST STRICT - This mode is identical to strict mode + // except for its treatment of line-height in the inline box model. For + // now (until the inline box model is re-written), this mode is identical + // to STANDARDS mode. + // STRICT - no quirks apply. Web pages will obey the specifications to + // the letter. + + TQString systemID, publicID; + int resultFlags = 0; + if (parseDocTypeDeclaration(str, &resultFlags, publicID, systemID)) { + if (resultFlags & PARSEMODE_HAVE_DOCTYPE) { + m_doctype->setName("HTML"); + m_doctype->setPublicId(publicID); + m_doctype->setSystemId(systemID); + } + if (!(resultFlags & PARSEMODE_HAVE_DOCTYPE)) { + // No doctype found at all. Default to quirks mode and Html4. + pMode = Compat; + hMode = Html4; + } + else if ((resultFlags & PARSEMODE_HAVE_INTERNAL) || + !(resultFlags & PARSEMODE_HAVE_PUBLIC_ID)) { + // Internal subsets always denote full standards, as does + // a doctype without a public ID. + pMode = Strict; + hMode = Html4; + } + else { + // We have to check a list of public IDs to see what we + // should do. + TQString lowerPubID = publicID.lower(); + const char* pubIDStr = lowerPubID.latin1(); + + // Look up the entry in our gperf-generated table. + const PubIDInfo* doctypeEntry = findDoctypeEntry(pubIDStr, publicID.length()); + if (!doctypeEntry) { + // The DOCTYPE is not in the list. Assume strict mode. + // ### Doesn't make any sense, but it's what Mozilla does. + pMode = Strict; + hMode = Html4; + return; + } + + switch ((resultFlags & PARSEMODE_HAVE_SYSTEM_ID) ? + doctypeEntry->mode_if_sysid : + doctypeEntry->mode_if_no_sysid) + { + case PubIDInfo::eQuirks3: + pMode = Compat; + hMode = Html3; + break; + case PubIDInfo::eQuirks: + pMode = Compat; + hMode = Html4; + break; + case PubIDInfo::eAlmostStandards: + pMode = Transitional; + hMode = Html4; + break; + default: + assert(false); + } + } + } + else { + // Malformed doctype implies quirks mode. + pMode = Compat; + hMode = Html3; + } + + // This needs to be done last, see tests/parser/compatmode_xhtml_mixed.html + if ( hMode == Html4 && !m_htmlRequested ) { + // this part is still debatable and possibly UA dependent + hMode = XHtml; + pMode = Transitional; + } + + m_styleSelector->strictParsing = !inCompatMode(); + + // kdDebug() << "DocumentImpl::determineParseMode: publicId =" << publicID << " systemId = " << systemID << endl; + // kdDebug() << "DocumentImpl::determineParseMode: htmlMode = " << hMode<< endl; + if( pMode == Strict ) + kdDebug(6030) << " using strict parseMode" << endl; + else if (pMode == Compat ) + kdDebug(6030) << " using compatibility parseMode" << endl; + else + kdDebug(6030) << " using transitional parseMode" << endl; + + // not sure this is needed + if ( pMode != oldPMode && styleSelector() ) + recalcStyleSelector(); + +} + + +#include "html_documentimpl.moc" diff --git a/tdehtml/html/html_documentimpl.h b/tdehtml/html/html_documentimpl.h new file mode 100644 index 000000000..0aea47b8b --- /dev/null +++ b/tdehtml/html/html_documentimpl.h @@ -0,0 +1,95 @@ +/* + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * + * 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 HTML_DOCUMENTIMPL_H +#define HTML_DOCUMENTIMPL_H + +#include "xml/dom_docimpl.h" +#include "html/html_miscimpl.h" + +#include + +class KHTMLView; +class TQString; + +namespace DOM { + + class Element; + class HTMLElement; + class HTMLElementImpl; + class DOMString; + class CSSStyleSheetImpl; + class HTMLMapElementImpl; + +class HTMLDocumentImpl : public DOM::DocumentImpl +{ + Q_OBJECT +public: + HTMLDocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v = 0); + ~HTMLDocumentImpl(); + + virtual bool isHTMLDocument() const { return true; } + + DOMString referrer() const; + DOMString lastModified() const; + DOMString cookie() const; + void setCookie( const DOMString &); + + HTMLElementImpl *body(); + void setBody(HTMLElementImpl *_body, int& exceptioncode); + + virtual tdehtml::Tokenizer *createTokenizer(); + + virtual bool childAllowed( NodeImpl *newChild ); + + virtual ElementImpl *createElement ( const DOMString &tagName, int* pExceptioncode ); + + HTMLMapElementImpl* getMap(const DOMString& url_); + + virtual void determineParseMode( const TQString &str ); + virtual void close(); + + void setAutoFill() { m_doAutoFill = true; } + + // If true, HTML was requested by mimetype (e.g. HTTP Content-Type). Otherwise XHTML was requested. + // This is independent of the actual doctype, of course. (#86446) + void setHTMLRequested( bool html ) { m_htmlRequested = html; } + +protected: + HTMLElementImpl *htmlElement; + friend class HTMLMapElementImpl; + friend class HTMLImageElementImpl; + TQMap mapMap; + bool m_doAutoFill; + bool m_htmlRequested; + +protected slots: + /** + * Repaints, so that all links get the proper color + */ + void slotHistoryChanged(); +}; + +} //namespace + +#endif diff --git a/tdehtml/html/html_elementimpl.cpp b/tdehtml/html/html_elementimpl.cpp new file mode 100644 index 000000000..c18f19ea0 --- /dev/null +++ b/tdehtml/html/html_elementimpl.cpp @@ -0,0 +1,685 @@ +// -*- c-basic-offset: 4; -*- +/** + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2003 Dirk Mueller (mueller@kde.org) + * Copyright (C) 2002 Apple Computer, Inc. + * + * 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. + * + */ +// ------------------------------------------------------------------------- +//#define DEBUG +//#define DEBUG_LAYOUT +//#define PAR_DEBUG +//#define EVENT_DEBUG +//#define UNSUPPORTED_ATTR + +#include "html/dtd.h" +#include "html/html_elementimpl.h" +#include "html/html_documentimpl.h" +#include "html/htmltokenizer.h" + +#include "misc/htmlhashes.h" + +#include "tdehtmlview.h" +#include "tdehtml_part.h" + +#include "rendering/render_object.h" +#include "rendering/render_replaced.h" +#include "css/css_valueimpl.h" +#include "css/css_stylesheetimpl.h" +#include "css/cssproperties.h" +#include "css/cssvalues.h" +#include "xml/dom_textimpl.h" +#include "xml/dom2_eventsimpl.h" + +#include +#include +#include "html_elementimpl.h" + +using namespace DOM; +using namespace tdehtml; + +HTMLElementImpl::HTMLElementImpl(DocumentImpl *doc) + : ElementImpl( doc ) +{ + m_htmlCompat = doc && doc->htmlMode() != DocumentImpl::XHtml; +} + +HTMLElementImpl::~HTMLElementImpl() +{ +} + +bool HTMLElementImpl::isInline() const +{ + if (renderer()) + return ElementImpl::isInline(); + + switch(id()) { + case ID_A: + case ID_FONT: + case ID_TT: + case ID_U: + case ID_B: + case ID_I: + case ID_S: + case ID_STRIKE: + case ID_BIG: + case ID_SMALL: + + // %phrase + case ID_EM: + case ID_STRONG: + case ID_DFN: + case ID_CODE: + case ID_SAMP: + case ID_KBD: + case ID_VAR: + case ID_CITE: + case ID_ABBR: + case ID_ACRONYM: + + // %special + case ID_SUB: + case ID_SUP: + case ID_SPAN: + case ID_NOBR: + case ID_WBR: + return true; + + default: + return ElementImpl::isInline(); + } +} + +DOMString HTMLElementImpl::namespaceURI() const +{ + return (!m_htmlCompat) ? + DOMString(XHTML_NAMESPACE) : DOMString(); +} + + +DOMString HTMLElementImpl::localName() const +{ + // We only have a localName if we were created by createElementNS(), in which + // case we are an XHTML element. This also means we have a lowercase name. + if (!m_htmlCompat) // XHTML == not HTMLCompat + { + NodeImpl::Id _id = id(); + DOMString tn; + if ( _id >= ID_LAST_TAG ) + tn = getDocument()->getName(ElementId, _id); + else // HTML tag + tn = getTagName( _id ); + return tn; // lowercase already + } + // createElement() always returns elements with a null localName. + else + return DOMString(); +} + +DOMString HTMLElementImpl::tagName() const +{ + DOMString tn; + NodeImpl::Id _id = id(); + if ( _id >= ID_LAST_TAG ) + tn = getDocument()->getName(ElementId, _id); + else // HTML tag + tn = getTagName( _id ); + + if ( m_htmlCompat ) + tn = tn.upper(); + + if (m_prefix) + return DOMString(m_prefix) + ":" + tn; + + return tn; +} + +void HTMLElementImpl::parseAttribute(AttributeImpl *attr) +{ + DOMString indexstring; + switch( attr->id() ) + { + case ATTR_ALIGN: + if (attr->val()) { + if ( strcasecmp(attr->value(), "middle" ) == 0 ) + addCSSProperty( CSS_PROP_TEXT_ALIGN, CSS_VAL_CENTER ); + else + addCSSProperty(CSS_PROP_TEXT_ALIGN, attr->value().lower()); + } + else + removeCSSProperty(CSS_PROP_TEXT_ALIGN); + break; +// the core attributes... + case ATTR_ID: + // unique id + setHasID(); + getDocument()->incDOMTreeVersion(); + break; + case ATTR_CLASS: + if (attr->val()) { + DOMString v = attr->value(); + const TQChar* s = v.unicode(); + int l = v.length(); + while( l && !s->isSpace() ) + l--,s++; + setHasClassList(l); + setHasClass(true); + } else { + setHasClassList(false); + setHasClass(false); + } + break; + case ATTR_NAME: + getDocument()->incDOMTreeVersion(); + break; + case ATTR_STYLE: + if (m_styleDecls) + m_styleDecls->removeCSSHints(); + else + createDecl(); + m_styleDecls->setProperty(attr->value()); + setChanged(); + break; + case ATTR_TABINDEX: + indexstring=getAttribute(ATTR_TABINDEX); + if (indexstring.length()) + setTabIndex(indexstring.toInt()); + break; +// i18n attributes + case ATTR_LANG: + break; + case ATTR_DIR: + addCSSProperty(CSS_PROP_DIRECTION, attr->value().lower()); + addCSSProperty(CSS_PROP_UNICODE_BIDI, CSS_VAL_EMBED); + break; +// standard events + case ATTR_ONCLICK: + setHTMLEventListener(EventImpl::KHTML_ECMA_CLICK_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onclick", this)); + break; + case ATTR_ONDBLCLICK: + setHTMLEventListener(EventImpl::KHTML_ECMA_DBLCLICK_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "ondblclick", this)); + break; + case ATTR_ONMOUSEDOWN: + setHTMLEventListener(EventImpl::MOUSEDOWN_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onmousedown", this)); + break; + case ATTR_ONMOUSEMOVE: + setHTMLEventListener(EventImpl::MOUSEMOVE_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onmousemove", this)); + break; + case ATTR_ONMOUSEOUT: + setHTMLEventListener(EventImpl::MOUSEOUT_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onmouseout", this)); + break; + case ATTR_ONMOUSEOVER: + setHTMLEventListener(EventImpl::MOUSEOVER_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onmouseover", this)); + break; + case ATTR_ONMOUSEUP: + setHTMLEventListener(EventImpl::MOUSEUP_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onmouseup", this)); + break; + case ATTR_ONKEYDOWN: + setHTMLEventListener(EventImpl::KEYDOWN_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onkeydown", this)); + break; + case ATTR_ONKEYPRESS: + setHTMLEventListener(EventImpl::KEYPRESS_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onkeypress", this)); + break; + case ATTR_ONKEYUP: + setHTMLEventListener(EventImpl::KEYUP_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onkeyup", this)); + break; + case ATTR_ONFOCUS: + setHTMLEventListener(EventImpl::FOCUS_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onfocus", this)); + break; + case ATTR_ONBLUR: + setHTMLEventListener(EventImpl::BLUR_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onblur", this)); + break; + case ATTR_ONSCROLL: + setHTMLEventListener(EventImpl::SCROLL_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onscroll", this)); + break; +// other misc attributes + default: +#ifdef UNSUPPORTED_ATTR + kdDebug(6030) << "UATTR: <" << this->nodeName().string() << "> [" + << attr->name().string() << "]=[" << attr->value().string() << "]" << endl; +#endif + break; + } +} + +void HTMLElementImpl::recalcStyle( StyleChange ch ) +{ + ElementImpl::recalcStyle( ch ); + + if (m_render /*&& changed*/) + m_render->updateFromElement(); +} + +void HTMLElementImpl::addCSSProperty(int id, const DOMString &value) +{ + if(!m_styleDecls) createDecl(); + m_styleDecls->setProperty(id, value, false, true); + setChanged(); +} + +void HTMLElementImpl::addCSSProperty(int id, int value) +{ + if(!m_styleDecls) createDecl(); + m_styleDecls->setProperty(id, value, false, true); + setChanged(); +} + +void HTMLElementImpl::addCSSLength(int id, const DOMString &value, bool numOnly, bool multiLength) +{ + if(!m_styleDecls) createDecl(); + + // strip attribute garbage to avoid CSS parsing errors + // ### create specialized hook that avoids parsing every + // value twice! + if ( value.implementation() ) { + // match \s*[+-]?\d*(\.\d*)?[%\*]? + unsigned i = 0, j = 0; + TQChar* s = value.implementation()->s; + unsigned l = value.implementation()->l; + + while (i < l && s[i].isSpace()) + ++i; + if (i < l && (s[i] == '+' || s[i] == '-')) + ++i; + while (i < l && s[i].isDigit()) + ++i,++j; + + // no digits! + if (j == 0) return; + + int v = kClamp( TQConstString(s, i).string().toInt(), -8192, 8191 ) ; + const char* suffix = "px"; + if (!numOnly || multiLength) { + // look if we find a % or * + while (i < l) { + if (multiLength && s[i] == '*') { + suffix = ""; + break; + } + if (s[i] == '%') { + suffix = "%"; + break; + } + ++i; + } + } + if (numOnly) suffix = ""; + + TQString ns = TQString::number(v) + suffix; + m_styleDecls->setLengthProperty( id, DOMString( ns ), false, true, multiLength ); + setChanged(); + return; + } + + m_styleDecls->setLengthProperty(id, value, false, true, multiLength); + setChanged(); +} + +static inline bool isHexDigit( const TQChar &c ) { + return ( c >= TQChar('0') && c <= TQChar('9') ) || + ( c >= TQChar('a') && c <= TQChar('f') ) || + ( c >= TQChar('A') && c <= TQChar('F') ); +} + +static inline int toHex( const TQChar &c ) { + return ( (c >= TQChar('0') && c <= TQChar('9')) + ? (c.unicode() - '0') + : ( ( c >= TQChar('a') && c <= TQChar('f') ) + ? (c.unicode() - 'a' + 10) + : ( ( c >= TQChar('A') && c <= TQChar('F') ) + ? (c.unicode() - 'A' + 10) + : -1 ) ) ); +} + +/* color parsing that tries to match as close as possible IE 6. */ +void HTMLElementImpl::addHTMLColor( int id, const DOMString &c ) +{ + if(!m_styleDecls) createDecl(); + + // this is the only case no color gets applied in IE. + if ( !c.length() ) { + removeCSSProperty(id); + return; + } + + if ( m_styleDecls->setProperty(id, c, false, true) ) + return; + + TQString color = c.string(); + // not something that fits the specs. + + // we're emulating IEs color parser here. It maps transparent to black, otherwise it tries to build a rgb value + // out of everyhting you put in. The algorithm is experimentally determined, but seems to work for all test cases I have. + + // the length of the color value is rounded up to the next + // multiple of 3. each part of the rgb triple then gets one third + // of the length. + // + // Each triplet is parsed byte by byte, mapping + // each number to a hex value (0-9a-fA-F to their values + // everything else to 0). + // + // The highest non zero digit in all triplets is remembered, and + // used as a normalization point to normalize to values between 0 + // and 255. + + if ( color.lower() != "transparent" ) { + if ( color[0] == '#' ) + color.remove( 0, 1 ); + int basicLength = (color.length() + 2) / 3; + if ( basicLength > 1 ) { + // IE ignores colors with three digits or less +// tqDebug("trying to fix up color '%s'. basicLength=%d, length=%d", +// color.latin1(), basicLength, color.length() ); + int colors[3] = { 0, 0, 0 }; + int component = 0; + int pos = 0; + int maxDigit = basicLength-1; + while ( component < 3 ) { + // search forward for digits in the string + int numDigits = 0; + while ( pos < (int)color.length() && numDigits < basicLength ) { + int hex = toHex( color[pos] ); + colors[component] = (colors[component] << 4); + if ( hex > 0 ) { + colors[component] += hex; + maxDigit = kMin( maxDigit, numDigits ); + } + numDigits++; + pos++; + } + while ( numDigits++ < basicLength ) + colors[component] <<= 4; + component++; + } + maxDigit = basicLength - maxDigit; +// tqDebug("color is %x %x %x, maxDigit=%d", colors[0], colors[1], colors[2], maxDigit ); + + // normalize to 00-ff. The highest filled digit counts, minimum is 2 digits + maxDigit -= 2; + colors[0] >>= 4*maxDigit; + colors[1] >>= 4*maxDigit; + colors[2] >>= 4*maxDigit; +// tqDebug("normalized color is %x %x %x", colors[0], colors[1], colors[2] ); + // assert( colors[0] < 0x100 && colors[1] < 0x100 && colors[2] < 0x100 ); + + color.sprintf("#%02x%02x%02x", colors[0], colors[1], colors[2] ); +// tqDebug( "trying to add fixed color string '%s'", color.latin1() ); + if ( m_styleDecls->setProperty(id, DOMString(color), false, true) ) + return; + } + } + m_styleDecls->setProperty(id, CSS_VAL_BLACK, false, true); +} + +void HTMLElementImpl::removeCSSProperty(int id) +{ + if(!m_styleDecls) + return; + m_styleDecls->setParent(getDocument()->elementSheet()); + m_styleDecls->removeProperty(id, true /*nonCSSHint */); + setChanged(); +} + +DOMString HTMLElementImpl::innerHTML() const +{ + TQString result; //Use TQString to accumulate since DOMString is poor for appends + for (NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling()) { + DOMString kid = child->toString(); + result += TQConstString(kid.unicode(), kid.length()).string(); + } + return result; +} + +DOMString HTMLElementImpl::innerText() const +{ + TQString text = ""; + if(!firstChild()) + return text; + + const NodeImpl *n = this; + // find the next text/image after the anchor, to get a position + while(n) { + if(n->firstChild()) + n = n->firstChild(); + else if(n->nextSibling()) + n = n->nextSibling(); + else { + NodeImpl *next = 0; + while(!next) { + n = n->parentNode(); + if(!n || n == (NodeImpl *)this ) goto end; + next = n->nextSibling(); + } + n = next; + } + if(n->isTextNode() ) { + DOMStringImpl* data = static_cast(n)->string(); + text += TQConstString(data->s, data->l).string(); + } + } + end: + return text; +} + +DocumentFragment HTMLElementImpl::createContextualFragment( const DOMString &html ) +{ + // the following is in accordance with the definition as used by IE + if( endTag[id()] == FORBIDDEN ) + return DocumentFragment(); + // IE disallows innerHTML on inline elements. + // I don't see why we should have this restriction, as our + // dhtml engine can cope with it. Lars + //if ( isInline() ) return false; + switch( id() ) { + case ID_COL: + case ID_COLGROUP: + case ID_FRAMESET: + case ID_HEAD: + case ID_TABLE: + case ID_TBODY: + case ID_TFOOT: + case ID_THEAD: + case ID_TITLE: + return DocumentFragment(); + default: + break; + } + if ( !getDocument()->isHTMLDocument() ) + return DocumentFragment(); + + DocumentFragmentImpl* fragment = new DocumentFragmentImpl( docPtr() ); + DocumentFragment f( fragment ); + { + HTMLTokenizer tok( docPtr(), fragment ); + tok.begin(); + tok.write( html.string(), true ); + tok.end(); + } + + // Exceptions are ignored because none ought to happen here. + int ignoredExceptionCode; + + // we need to pop and elements and remove to + // accomadate folks passing complete HTML documents to make the + // child of an element. + for ( NodeImpl* node = fragment->firstChild(); node; ) { + if (node->id() == ID_HTML || node->id() == ID_BODY) { + NodeImpl* firstChild = node->firstChild(); + NodeImpl* child = firstChild; + while ( child ) { + NodeImpl *nextChild = child->nextSibling(); + fragment->insertBefore(child, node, ignoredExceptionCode); + child = nextChild; + } + if ( !firstChild ) { + NodeImpl *nextNode = node->nextSibling(); + fragment->removeChild(node, ignoredExceptionCode); + node = nextNode; + } else { + fragment->removeChild(node, ignoredExceptionCode); + node = firstChild; + } + } else if (node->id() == ID_HEAD) { + NodeImpl *nextNode = node->nextSibling(); + fragment->removeChild(node, ignoredExceptionCode); + node = nextNode; + } else { + node = node->nextSibling(); + } + } + + return f; +} + +void HTMLElementImpl::setInnerHTML( const DOMString &html, int &exceptioncode ) +{ + // Works line innerText in Gecko + // ### test if needed for ID_SCRIPT as well. + if ( id() == ID_STYLE ) { + setInnerText(html, exceptioncode); + return; + } + + DocumentFragment fragment = createContextualFragment( html ); + if ( fragment.isNull() ) { + exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR; + return; + } + + // Make sure adding the new child is ok, before removing all children (#96187) + checkAddChild( fragment.handle(), exceptioncode ); + if ( exceptioncode ) + return; + + removeChildren(); + appendChild( fragment.handle(), exceptioncode ); +} + +void HTMLElementImpl::setInnerText( const DOMString &text, int& exceptioncode ) +{ + // following the IE specs. + if( endTag[id()] == FORBIDDEN ) { + exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR; + return; + } + // IE disallows innerHTML on inline elements. I don't see why we should have this restriction, as our + // dhtml engine can cope with it. Lars + //if ( isInline() ) return false; + switch( id() ) { + case ID_COL: + case ID_COLGROUP: + case ID_FRAMESET: + case ID_HEAD: + case ID_HTML: + case ID_TABLE: + case ID_TBODY: + case ID_TFOOT: + case ID_THEAD: + case ID_TR: + exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR; + return; + default: + break; + } + + removeChildren(); + + TextImpl *t = new TextImpl( docPtr(), text.implementation() ); + appendChild( t, exceptioncode ); +} + +void HTMLElementImpl::addHTMLAlignment( DOMString alignment ) +{ + //tqDebug("alignment is %s", alignment.string().latin1() ); + // vertical alignment with respect to the current baseline of the text + // right or left means floating images + int propfloat = -1; + int propvalign = -1; + if ( strcasecmp( alignment, "absmiddle" ) == 0 ) { + propvalign = CSS_VAL_MIDDLE; + } else if ( strcasecmp( alignment, "absbottom" ) == 0 ) { + propvalign = CSS_VAL_BOTTOM; + } else if ( strcasecmp( alignment, "left" ) == 0 ) { + propfloat = CSS_VAL_LEFT; + propvalign = CSS_VAL_TOP; + } else if ( strcasecmp( alignment, "right" ) == 0 ) { + propfloat = CSS_VAL_RIGHT; + propvalign = CSS_VAL_TOP; + } else if ( strcasecmp( alignment, "top" ) == 0 ) { + propvalign = CSS_VAL_TOP; + } else if ( strcasecmp( alignment, "middle" ) == 0 ) { + propvalign = CSS_VAL__KHTML_BASELINE_MIDDLE; + } else if ( strcasecmp( alignment, "center" ) == 0 ) { + propvalign = CSS_VAL_MIDDLE; + } else if ( strcasecmp( alignment, "bottom" ) == 0 ) { + propvalign = CSS_VAL_BASELINE; + } else if ( strcasecmp ( alignment, "texttop") == 0 ) { + propvalign = CSS_VAL_TEXT_TOP; + } + + if ( propfloat != -1 ) + addCSSProperty( CSS_PROP_FLOAT, propfloat ); + if ( propvalign != -1 ) + addCSSProperty( CSS_PROP_VERTICAL_ALIGN, propvalign ); +} + +DOMString HTMLElementImpl::toString() const +{ + if (!hasChildNodes()) { + DOMString result = openTagStartToString(); + result += ">"; + + if (endTag[id()] == REQUIRED) { + result += ""; + } + + return result; + } + + return ElementImpl::toString(); +} + +// ------------------------------------------------------------------------- +HTMLGenericElementImpl::HTMLGenericElementImpl(DocumentImpl *doc, ushort i) + : HTMLElementImpl(doc) +{ + _id = i; +} + +HTMLGenericElementImpl::~HTMLGenericElementImpl() +{ +} diff --git a/tdehtml/html/html_elementimpl.h b/tdehtml/html/html_elementimpl.h new file mode 100644 index 000000000..f71ae9b23 --- /dev/null +++ b/tdehtml/html/html_elementimpl.h @@ -0,0 +1,89 @@ +/* + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * + * 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 HTML_ELEMENTIMPL_H +#define HTML_ELEMENTIMPL_H + +#include "xml/dom_elementimpl.h" + +namespace DOM { + +class DOMString; +class CSSStyleDeclarationImpl; +class HTMLFormElementImpl; +class DocumentFragment; + +class HTMLElementImpl : public ElementImpl +{ +public: + HTMLElementImpl(DocumentImpl *doc); + + virtual ~HTMLElementImpl(); + + virtual bool isHTMLElement() const { return true; } + + virtual bool isInline() const; + + virtual Id id() const = 0; + virtual DOMString tagName() const; + virtual DOMString localName() const; + virtual DOMString namespaceURI() const; + + virtual void parseAttribute(AttributeImpl *token); + + void addCSSLength(int id, const DOMString &value, bool numOnly = false, bool multiLength = false); + void addCSSProperty(int id, const DOMString &value); + void addCSSProperty(int id, int value); + void addHTMLColor( int id, const DOMString &c ); + void removeCSSProperty(int id); + + virtual void recalcStyle( StyleChange ); + + DOMString innerHTML() const; + DOMString innerText() const; + DocumentFragment createContextualFragment( const DOMString &html ); + void setInnerHTML( const DOMString &html, int& exceptioncode ); + void setInnerText( const DOMString &text, int& exceptioncode ); + + virtual DOMString toString() const; + +protected: + // for IMG, OBJECT and APPLET + void addHTMLAlignment( DOMString alignment ); +}; + +class HTMLGenericElementImpl : public HTMLElementImpl +{ +public: + HTMLGenericElementImpl(DocumentImpl *doc, ushort i); + + virtual ~HTMLGenericElementImpl(); + + virtual Id id() const { return _id; }; + +protected: + ushort _id; +}; + +} //namespace + +#endif diff --git a/tdehtml/html/html_formimpl.cpp b/tdehtml/html/html_formimpl.cpp new file mode 100644 index 000000000..f8c566511 --- /dev/null +++ b/tdehtml/html/html_formimpl.cpp @@ -0,0 +1,2980 @@ +/* + * This file is part of the DOM implementation for KDE. + * + * Copyright (C) 1999 Lars Knoll (knoll@kde.org) + * (C) 1999 Antti Koivisto (koivisto@kde.org) + * (C) 2001 Dirk Mueller (mueller@kde.org) + * (C) 2004, 2005, 2006 Apple Computer, Inc. + * + * 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. + * + */ + +#undef FORMS_DEBUG +//#define FORMS_DEBUG + +#include "html/html_formimpl.h" + +#include "tdehtmlview.h" +#include "tdehtml_part.h" +#include "html/html_documentimpl.h" +#include "tdehtml_settings.h" +#include "misc/htmlhashes.h" + +#include "css/cssstyleselector.h" +#include "css/cssproperties.h" +#include "css/cssvalues.h" +#include "css/csshelper.h" +#include "xml/dom_textimpl.h" +#include "xml/dom_docimpl.h" +#include "xml/dom2_eventsimpl.h" +#include "xml/dom_restyler.h" +#include "tdehtml_ext.h" + +#include "rendering/render_form.h" + +#include +#include +#include +#include +#include +#include +#include +#ifndef KHTML_NO_WALLET +#include +#endif +#include +#include +#include +#include +#include + +// for keygen +#include +#include + +#include + + +using namespace DOM; +using namespace tdehtml; + +HTMLFormElementImpl::HTMLFormElementImpl(DocumentImpl *doc, bool implicit) + : HTMLElementImpl(doc) +{ + m_implicit = implicit; + m_post = false; + m_multipart = false; + m_autocomplete = true; + m_insubmit = false; + m_doingsubmit = false; + m_inreset = false; + m_enctype = "application/x-www-form-urlencoded"; + m_boundary = "----------" + TDEApplication::randomString( 42 + 13 ); + m_acceptcharset = "UNKNOWN"; + m_malformed = false; +} + +HTMLFormElementImpl::~HTMLFormElementImpl() +{ + if (getDocument() && getDocument()->view() && getDocument()->view()->part()) { + getDocument()->view()->part()->dequeueWallet(this); + } + TQPtrListIterator it(formElements); + for (; it.current(); ++it) + it.current()->m_form = 0; + TQPtrListIterator it2(imgElements); + for (; it2.current(); ++it2) + it2.current()->m_form = 0; +} + +NodeImpl::Id HTMLFormElementImpl::id() const +{ + return ID_FORM; +} + +long HTMLFormElementImpl::length() const +{ + int len = 0; + TQPtrListIterator it(formElements); + for (; it.current(); ++it) + if (it.current()->isEnumeratable()) + ++len; + + return len; +} + +static TQCString encodeCString(const TQCString& e) +{ + // http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1 + // safe characters like NS handles them for compatibility + static const char *safe = "-._*"; + TQCString encoded(( e.length()+e.contains( '\n' ) )*3 + +e.contains('\r') * 3 + 1); + int enclen = 0; + bool crmissing = false; + unsigned char oldc; + unsigned char c ='\0'; + + //TQCString orig(e.data(), e.size()); + + unsigned len = e.length(); + for(unsigned pos = 0; pos < len; pos++) { + oldc = c; + c = e[pos]; + + if (crmissing && c != '\n') { + encoded[enclen++] = '%'; + encoded[enclen++] = '0'; + encoded[enclen++] = 'D'; + crmissing = false; + } + + if ( (( c >= 'A') && ( c <= 'Z')) || + (( c >= 'a') && ( c <= 'z')) || + (( c >= '0') && ( c <= '9')) || + (strchr(safe, c)) + ) + encoded[enclen++] = c; + else if ( c == ' ' ) + encoded[enclen++] = '+'; + else if ( c == '\n' ) + { + encoded[enclen++] = '%'; + encoded[enclen++] = '0'; + encoded[enclen++] = 'D'; + encoded[enclen++] = '%'; + encoded[enclen++] = '0'; + encoded[enclen++] = 'A'; + crmissing = false; + } + else if (c == '\r' && oldc != '\n') { + crmissing = true; + } + else if ( c != '\r' ) + { + encoded[enclen++] = '%'; + unsigned int h = c / 16; + h += (h > 9) ? ('A' - 10) : '0'; + encoded[enclen++] = h; + + unsigned int l = c % 16; + l += (l > 9) ? ('A' - 10) : '0'; + encoded[enclen++] = l; + } + } + encoded[enclen++] = '\0'; + encoded.truncate(enclen); + + return encoded; +} + +// ### This function only encodes to numeric ampersand escapes, +// ### we could use standard ampersand values as well. +inline static TQString escapeUnencodeable(const TQTextCodec* codec, const TQString& s) { + TQString enc_string; + const int len = s.length(); + for(int i=0; i canEncode(c)) + enc_string.append(c); + else { + TQString ampersandEscape; + ampersandEscape.sprintf("&#%u;", c.unicode()); + enc_string.append(ampersandEscape); + } + } + return enc_string; +} + +inline static TQCString fixUpfromUnicode(const TQTextCodec* codec, const TQString& s) +{ + TQCString str = codec->fromUnicode(escapeUnencodeable(codec,s)); + str.truncate(str.length()); + return str; +} + +TQByteArray HTMLFormElementImpl::formData(bool& ok) +{ +#ifdef FORMS_DEBUG + kdDebug( 6030 ) << "form: formData()" << endl; +#endif + + TQByteArray form_data(0); + TQCString enc_string = ""; // used for non-multipart data + + // find out the QTextcodec to use + const TQString str = m_acceptcharset.string(); + const TQChar space(' '); + const unsigned int strLength = str.length(); + for(unsigned int i=0; i < strLength; ++i) if(str[i].latin1() == ',') str[i] = space; + const TQStringList charsets = TQStringList::split(' ', str); + TQTextCodec* codec = 0; + KHTMLView *view = getDocument()->view(); + { + TQStringList::ConstIterator it = charsets.begin(); + const TQStringList::ConstIterator itEnd = charsets.end(); + + for ( ; it != itEnd; ++it ) + { + TQString enc = (*it); + if(enc.contains("UNKNOWN")) + { + // use standard document encoding + enc = "ISO 8859-1"; + if(view && view->part()) + enc = view->part()->encoding(); + } + if((codec = TDEGlobal::charsets()->codecForName(enc.latin1()))) + break; + } + } + if(!codec) + codec = TQTextCodec::codecForLocale(); + + // we need to map visual hebrew to logical hebrew, as the web + // server alsways expects responses in logical ordering + if ( codec->mibEnum() == 11 ) + codec = TQTextCodec::codecForMib( 85 ); + + m_encCharset = codec->name(); + const unsigned int m_encCharsetLength = m_encCharset.length(); + for(unsigned int i=0; i < m_encCharsetLength; ++i) + m_encCharset[i] = m_encCharset[i].latin1() == ' ' ? TQChar('-') : m_encCharset[i].lower(); + + TQStringList fileUploads, fileNotUploads; + + for (TQPtrListIterator it(formElements); it.current(); ++it) { + HTMLGenericFormElementImpl* const current = it.current(); + tdehtml::encodingList lst; + + if (!current->disabled() && current->encoding(codec, lst, m_multipart)) + { + //kdDebug(6030) << "adding name '" << current->name().string() << "'" << endl; + tdehtml::encodingList::ConstIterator it = lst.begin(); + const tdehtml::encodingList::ConstIterator itEnd = lst.end(); + for( it = lst.begin(); it != itEnd; ++it ) + { + if (!m_multipart) + { + // handle ISINDEX / special + // but only if its the first entry + if ( enc_string.isEmpty() && *it == "isindex" ) { + ++it; + enc_string += encodeCString( *it ); + } + else { + if(!enc_string.isEmpty()) + enc_string += '&'; + + enc_string += encodeCString(*it); + enc_string += "="; + ++it; + enc_string += encodeCString(*it); + } + } + else + { + TQCString hstr("--"); + hstr += m_boundary.latin1(); + hstr += "\r\n"; + hstr += "Content-Disposition: form-data; name=\""; + hstr += (*it).data(); + hstr += "\""; + + // if the current type is FILE, then we also need to + // include the filename + if (current->id() == ID_INPUT && + static_cast(current)->inputType() == HTMLInputElementImpl::FILE && + current->renderer()) + { + KURL path; + TQString val = static_cast(current)->value().string().stripWhiteSpace(); + if (!val.isEmpty() && + TQDir::isRelativePath(val) && + TQFile::exists(TDEGlobalSettings::documentPath() + val)) { + path.setPath(TDEGlobalSettings::documentPath() + val); + } else { + path = KURL::fromPathOrURL(val); + } + + hstr += fixUpfromUnicode(codec, "; filename=\"" + path.fileName() + "\""); + if (path.isValid()) { + fileUploads << path.prettyURL(0, KURL::StripFileProtocol); + const KMimeType::Ptr ptr = KMimeType::findByURL(path); + if (!ptr->name().isEmpty()) { + hstr += "\r\nContent-Type: "; + hstr += ptr->name().ascii(); + } + } else if (!val.isEmpty()) { + fileNotUploads << path.prettyURL(0, KURL::StripFileProtocol); + } + } + + hstr += "\r\n\r\n"; + ++it; + + // append body + const unsigned int old_size = form_data.size(); + form_data.resize( old_size + hstr.length() + (*it).size() + 1); + memcpy(form_data.data() + old_size, hstr.data(), hstr.length()); + memcpy(form_data.data() + old_size + hstr.length(), *it, (*it).size()); + form_data[form_data.size()-2] = '\r'; + form_data[form_data.size()-1] = '\n'; + + // reset unsubmittedFormChange flag + if (current->id() == ID_INPUT && + static_cast(current)->inputType() == HTMLInputElementImpl::TEXT) + static_cast(current)->setUnsubmittedFormChange(false); + + if (current->id() == ID_TEXTAREA) + static_cast(current)->setUnsubmittedFormChange(false); + + } + } + } + } + + if (fileNotUploads.count()) { + const int result = KMessageBox::warningContinueCancelList( 0, + i18n("The following files will not be uploaded" + " because they could not be found.\n" + "Do you want to continue?"), + fileNotUploads, + i18n("Submit Confirmation"),KGuiItem(i18n("&Submit Anyway"))); + + + if (result == KMessageBox::Cancel) { + ok = false; + return TQByteArray(); + } + } + + if (fileUploads.count()) { + const int result = KMessageBox::warningContinueCancelList( 0, + i18n("You're about to transfer the following files from " + "your local computer to the Internet.\n" + "Do you really want to continue?"), + fileUploads, + i18n("Send Confirmation"),KGuiItem(i18n("&Send Files"))); + + + if (result == KMessageBox::Cancel) { + ok = false; + return TQByteArray(); + } + } + + if (m_multipart) + enc_string = ("--" + m_boundary + "--\r\n").ascii(); + + const int old_size = form_data.size(); + form_data.resize( form_data.size() + enc_string.length() ); + memcpy(form_data.data() + old_size, enc_string.data(), enc_string.length() ); + + ok = true; + return form_data; +} + +void HTMLFormElementImpl::setEnctype( const DOMString& type ) +{ + if(type.string().find("multipart", 0, false) != -1 || type.string().find("form-data", 0, false) != -1) + { + m_enctype = "multipart/form-data"; + m_multipart = true; + m_post = true; + } else if (type.string().find("text", 0, false) != -1 || type.string().find("plain", 0, false) != -1) + { + m_enctype = "text/plain"; + m_multipart = false; + } + else + { + m_enctype = "application/x-www-form-urlencoded"; + m_multipart = false; + } + m_encCharset = TQString::null; +} + +static TQString calculateAutoFillKey(const HTMLFormElementImpl& e) +{ + KURL k(e.getDocument()->URL()); + k.setRef(TQString::null); + k.setQuery(TQString::null); + // ensure that we have the user / password inside the url + // otherwise we might have a potential security problem + // by saving passwords under wrong lookup key. + const TQString name = e.getAttribute(ATTR_NAME).string().stripWhiteSpace(); + const TQRegExp re("[;,!]"); + const TQStringList url = TQStringList::split(re, k.url()); + return url[0] + '#' + name; +} + +void HTMLFormElementImpl::doAutoFill() +{ +#ifndef KHTML_NO_WALLET + const TQString key = calculateAutoFillKey(*this); + + if (KWallet::Wallet::keyDoesNotExist(KWallet::Wallet::NetworkWallet(), + KWallet::Wallet::FormDataFolder(), + key)) + return; + + // assert(view()) + getDocument()->view()->part()->openWallet(this); +#endif // KHTML_NO_WALLET +} + + +void HTMLFormElementImpl::walletOpened(KWallet::Wallet *w) { +#ifndef KHTML_NO_WALLET + assert(w); + const TQString key = calculateAutoFillKey(*this); + if (!w->hasFolder(KWallet::Wallet::FormDataFolder())) { + return; // failed + } + w->setFolder(KWallet::Wallet::FormDataFolder()); + TQMap map; + if (w->readMap(key, map)) + return; // failed, abort + + for (TQPtrListIterator it(formElements); it.current(); ++it) { + if (it.current()->id() == ID_INPUT) { + HTMLInputElementImpl* const current = static_cast(it.current()); + if ((current->inputType() == HTMLInputElementImpl::PASSWORD || + current->inputType() == HTMLInputElementImpl::TEXT) && + !current->readOnly() && + map.contains(current->name().string())) { + getDocument()->setFocusNode(current); + current->setValue(map[current->name().string()]); + } + } + } +#endif // KHTML_NO_WALLET +} + +void HTMLFormElementImpl::submitFromKeyboard() +{ + // Activate the first nondisabled submit button + // if there is none, do a submit anyway if not more + // than one or + unsigned int inputtext = 0; + for (TQPtrListIterator it(formElements); it.current(); ++it) { + if (it.current()->id() == ID_BUTTON) { + HTMLButtonElementImpl* const current = static_cast(it.current()); + if (current->buttonType() == HTMLButtonElementImpl::SUBMIT && !current->disabled()) { + current->click(); + return; + } + } else if (it.current()->id() == ID_INPUT) { + HTMLInputElementImpl* const current = static_cast(it.current()); + switch(current->inputType()) { + case HTMLInputElementImpl::SUBMIT: + case HTMLInputElementImpl::IMAGE: + if(!current->disabled()) { + current->click(); + return; + } + break; + case HTMLInputElementImpl::TEXT: + case HTMLInputElementImpl::PASSWORD: + ++inputtext; + default: + break; + } + } + } + + if (inputtext <= 1) + prepareSubmit(); +} + + +void HTMLFormElementImpl::gatherWalletData() +{ +#ifndef KHTML_NO_WALLET + KHTMLView* const view = getDocument()->view(); + // check if we have any password input's + m_walletMap.clear(); + m_havePassword = false; + m_haveTextarea = false; + const KURL formUrl(getDocument()->URL()); + if (view && !view->nonPasswordStorableSite(formUrl.host())) { + for (TQPtrListIterator it(formElements); it.current(); ++it) { + if (it.current()->id() == ID_INPUT) { + HTMLInputElementImpl* const c = static_cast (it.current()); + if ((c->inputType() == HTMLInputElementImpl::TEXT || + c->inputType() == HTMLInputElementImpl::PASSWORD) && + !c->readOnly()) { + m_walletMap.insert(c->name().string(), c->value().string()); + if (c->inputType() == HTMLInputElementImpl::PASSWORD && + !c->value().isEmpty()) + m_havePassword = true; + } + } + else if (it.current()->id() == ID_TEXTAREA) + m_haveTextarea = true; + } + } +#endif // KHTML_NO_WALLET +} + + +bool HTMLFormElementImpl::prepareSubmit() +{ + KHTMLView* const view = getDocument()->view(); + if(m_insubmit || !view || !view->part() || view->part()->onlyLocalReferences()) + return m_insubmit; + + gatherWalletData(); + + m_insubmit = true; + m_doingsubmit = false; + + if ( dispatchHTMLEvent(EventImpl::SUBMIT_EVENT,true,true) && !m_doingsubmit ) + m_doingsubmit = true; + + m_insubmit = false; + + if ( m_doingsubmit ) + submit(); + + return m_doingsubmit; +} + +void HTMLFormElementImpl::submit( ) +{ + if ( m_insubmit ) { + m_doingsubmit = true; + return; + } + + m_insubmit = true; + +#ifdef FORMS_DEBUG + kdDebug( 6030 ) << "submitting!" << endl; +#endif + + bool ok; + KHTMLView* const view = getDocument()->view(); + const TQByteArray form_data = formData(ok); + const KURL formUrl(getDocument()->URL()); + + if (ok && view) { + if (m_walletMap.isEmpty()) { + gatherWalletData(); + } +#ifndef KHTML_NO_WALLET + if (m_havePassword && !m_haveTextarea && KWallet::Wallet::isEnabled()) { + const TQString key = calculateAutoFillKey(*this); + const bool doesnotexist = KWallet::Wallet::keyDoesNotExist(KWallet::Wallet::NetworkWallet(), KWallet::Wallet::FormDataFolder(), key); + KWallet::Wallet* const w = view->part()->wallet(); + bool login_changed = false; + + if (!doesnotexist && w) { + // check if the login information changed from what + // we had so far. + if (w->hasFolder(KWallet::Wallet::FormDataFolder())) { + w->setFolder(KWallet::Wallet::FormDataFolder()); + TQMap map; + if (!w->readMap(key, map)) { + TQMapConstIterator it = map.begin(); + const TQMapConstIterator itEnd = map.end(); + for ( ; it != itEnd; ++it ) + if ( map[it.key()] != m_walletMap[it.key()] ) { + login_changed = true; + break; + } + } else { + login_changed = true; + } + } + } + + if ( doesnotexist || !w || login_changed ) { + // TODO use KMessageBox::questionYesNoCancel() again, if you can pass a KGuiItem for Cancel + KDialogBase* const dialog = new KDialogBase(i18n("Save Login Information"), + KDialogBase::Yes | KDialogBase::No | KDialogBase::Cancel, + KDialogBase::Yes, KDialogBase::Cancel, + 0, "questionYesNoCancel", true, true, + i18n("Store"), KGuiItem(i18n("Ne&ver for This Site")), i18n("Do Not Store")); + + bool checkboxResult = false; + const int savePassword = KMessageBox::createKMessageBox(dialog, TQMessageBox::Information, + i18n("Store passwords on this page?"), + TQStringList(), TQString::null, &checkboxResult, KMessageBox::Notify); + + if ( savePassword == KDialogBase::Yes ) { + // ensure that we have the user / password inside the url + // otherwise we might have a potential security problem + // by saving passwords under wrong lookup key. + + if (view->part()) { + view->part()->saveToWallet(key, m_walletMap); + } + } else if ( savePassword == KDialogBase::No ) { + view->addNonPasswordStorableSite(formUrl.host()); + } + } + } +#endif // KHTML_NO_WALLET + + const DOMString url(tdehtml::parseURL(getAttribute(ATTR_ACTION))); + if(m_post) { + view->part()->submitForm( "post", url.string(), form_data, + m_target.string(), + enctype().string(), + m_boundary ); + } + else { + view->part()->submitForm( "get", url.string(), form_data, + m_target.string() ); + } + } + + m_walletMap.clear(); // done with it + m_havePassword = m_haveTextarea= false; + m_doingsubmit = m_insubmit = false; +} + +void HTMLFormElementImpl::reset( ) +{ + KHTMLView* const view = getDocument()->view(); + if(m_inreset || !view || !view->part()) return; + + m_inreset = true; + +#ifdef FORMS_DEBUG + kdDebug( 6030 ) << "reset pressed!" << endl; +#endif + + // ### DOM2 labels this event as not cancelable, however + // common browsers( sick! ) allow it be cancelled. + if ( !dispatchHTMLEvent(EventImpl::RESET_EVENT,true, true) ) { + m_inreset = false; + return; + } + + for (TQPtrListIterator it(formElements); it.current(); ++it) + it.current()->reset(); + + m_inreset = false; +} + +void HTMLFormElementImpl::parseAttribute(AttributeImpl *attr) +{ + switch(attr->id()) + { + case ATTR_ACTION: + break; + case ATTR_TARGET: + m_target = attr->value(); + break; + case ATTR_METHOD: + m_post = ( strcasecmp( attr->value(), "post" ) == 0 ); + break; + case ATTR_ENCTYPE: + setEnctype( attr->value() ); + break; + case ATTR_ACCEPT_CHARSET: + // space separated list of charsets the server + // accepts - see rfc2045 + m_acceptcharset = attr->value(); + break; + case ATTR_ACCEPT: + // ignore this one for the moment... + break; + case ATTR_AUTOCOMPLETE: + m_autocomplete = strcasecmp( attr->value(), "off" ); + break; + case ATTR_ONSUBMIT: + setHTMLEventListener(EventImpl::SUBMIT_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onsubmit", this)); + break; + case ATTR_ONRESET: + setHTMLEventListener(EventImpl::RESET_EVENT, + getDocument()->createHTMLEventListener(attr->value().string(), "onreset", this)); + break; + case ATTR_NAME: + if (inDocument() && m_name != attr->value()) { + getDocument()->underDocNamedCache().remove(m_name.string(), this); + getDocument()->underDocNamedCache().add (attr->value().string(), this); + } + m_name = attr->value(); + //Fallthrough intentional + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +void HTMLFormElementImpl::removedFromDocument() +{ + getDocument()->underDocNamedCache().remove(m_name.string(), this); + HTMLElementImpl::removedFromDocument(); +} + +void HTMLFormElementImpl::insertedIntoDocument() +{ + getDocument()->underDocNamedCache().add(m_name.string(), this); + HTMLElementImpl::insertedIntoDocument(); +} + +void HTMLFormElementImpl::removeId(const TQString& id) +{ + getDocument()->underDocNamedCache().remove(id, this); + HTMLElementImpl::removeId(id); +} + +void HTMLFormElementImpl::addId (const TQString& id) +{ + getDocument()->underDocNamedCache().add(id, this); + HTMLElementImpl::addId(id); +} + + +void HTMLFormElementImpl::radioClicked( HTMLGenericFormElementImpl *caller ) +{ + for (TQPtrListIterator it(formElements); it.current(); ++it) { + HTMLGenericFormElementImpl* const current = it.current(); + if (current->id() == ID_INPUT && + static_cast(current)->inputType() == HTMLInputElementImpl::RADIO && + current != caller && current->form() == caller->form() && current->name() == caller->name()) + static_cast(current)->setChecked(false); + } +} + +void HTMLFormElementImpl::registerFormElement(HTMLGenericFormElementImpl *e) +{ + formElements.append(e); +} + +void HTMLFormElementImpl::removeFormElement(HTMLGenericFormElementImpl *e) +{ + formElements.remove(e); +} + +void HTMLFormElementImpl::registerImgElement(HTMLImageElementImpl *e) +{ + imgElements.append(e); +} + +void HTMLFormElementImpl::removeImgElement(HTMLImageElementImpl *e) +{ + imgElements.remove(e); +} + +// ------------------------------------------------------------------------- + +HTMLGenericFormElementImpl::HTMLGenericFormElementImpl(DocumentImpl *doc, HTMLFormElementImpl *f) + : HTMLElementImpl(doc) +{ + m_disabled = m_readOnly = false; + m_name = 0; + + if (f) + m_form = f; + else + m_form = getForm(); + if (m_form) + m_form->registerFormElement(this); +} + +void HTMLGenericFormElementImpl::insertedIntoDocument() +{ + HTMLElementImpl::insertedIntoDocument(); + + if (!m_form) { + HTMLFormElementImpl* const newform = getForm(); + if (newform) { + m_form = newform; + m_form->registerFormElement(this); + } + } +} + +void HTMLGenericFormElementImpl::removedFromDocument() +{ + HTMLElementImpl::removedFromDocument(); + + if (m_form) + m_form->removeFormElement(this); + + m_form = 0; +} + +HTMLGenericFormElementImpl::~HTMLGenericFormElementImpl() +{ + if (m_form) + m_form->removeFormElement(this); + if (m_name) m_name->deref(); +} + +void HTMLGenericFormElementImpl::parseAttribute(AttributeImpl *attr) +{ + switch(attr->id()) + { + case ATTR_DISABLED: + setDisabled( attr->val() != 0 ); + break; + case ATTR_READONLY: + { + const bool m_oldreadOnly = m_readOnly; + m_readOnly = attr->val() != 0; + if (m_oldreadOnly != m_readOnly) setChanged(); + break; + } + default: + HTMLElementImpl::parseAttribute(attr); + } +} + +void HTMLGenericFormElementImpl::attach() +{ + assert(!attached()); + + if (m_render) { + assert(m_render->style()); + parentNode()->renderer()->addChild(m_render, nextRenderer()); + } + + // FIXME: This handles the case of a new form element being created by + // JavaScript and inserted inside a form. What it does not handle is + // a form element being moved from inside a form to outside, or from one + // inside one form to another. The reason this other case is hard to fix + // is that during parsing, we may have been passed a form that we are not + // inside, DOM-tree-wise. If so, it's hard for us to know when we should + // be removed from that form's element list. + if (!m_form) { + m_form = getForm(); + if (m_form) + m_form->registerFormElement(this); + } + + NodeBaseImpl::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 (m_render) + m_render->updateFromElement(); + +} + +HTMLFormElementImpl *HTMLGenericFormElementImpl::getForm() const +{ + NodeImpl *p = parentNode(); + while(p) + { + if( p->id() == ID_FORM ) + return static_cast(p); + if( p->parentNode() && p->parentNode()->id() == ID_TABLE && p->previousSibling() ) + { + p = p->previousSibling(); + continue; + } + p = p->parentNode(); + } +#ifdef FORMS_DEBUG + kdDebug( 6030 ) << "couldn't find form!" << endl; + kdDebug( 6030 ) << kdBacktrace() << endl; +#endif + return 0; +} + +DOMString HTMLGenericFormElementImpl::name() const +{ + if (m_name) return m_name; + +// ### +// DOMString n = getDocument()->htmlMode() != DocumentImpl::XHtml ? +// getAttribute(ATTR_NAME) : getAttribute(ATTR_ID); + const DOMString n = getAttribute(ATTR_NAME); + if (n.isNull()) + return new DOMStringImpl(""); + + return n; +} + +void HTMLGenericFormElementImpl::setName(const DOMString& name) +{ + if (m_name) m_name->deref(); + m_name = name.implementation(); + setAttribute( ATTR_NAME, name ); + if (m_name) m_name->ref(); +} + +void HTMLGenericFormElementImpl::onSelect() +{ + // ### make this work with new form events architecture + dispatchHTMLEvent(EventImpl::SELECT_EVENT,true,false); +} + +void HTMLGenericFormElementImpl::onChange() +{ + // ### make this work with new form events architecture + dispatchHTMLEvent(EventImpl::CHANGE_EVENT,true,false); +} + +void HTMLGenericFormElementImpl::setDisabled( bool _disabled ) +{ + if ( m_disabled != _disabled ) { + m_disabled = _disabled; + // Trigger dynamic restyles + getDocument()->dynamicDomRestyler().restyleDepedent(this, OtherStateDependency); + // We need to update rendering under all circumstances + if (!changed() && m_render) { + m_render->updateFromElement(); + } + } +} + +bool HTMLGenericFormElementImpl::isFocusable() const +{ + if (disabled()) + return false; + + //Non-widget INPUT TYPE="image" and