mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
generic: get rid of KJS and KHTML for good
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
74bd1e3004
commit
5a5a20c327
1395 changed files with 17 additions and 360031 deletions
|
@ -124,14 +124,6 @@ set_package_properties(DBusMenuQt PROPERTIES
|
|||
TYPE RECOMMENDED
|
||||
)
|
||||
|
||||
macro_optional_find_package(PCRE)
|
||||
set_package_properties(PCRE PROPERTIES
|
||||
DESCRIPTION "Perl-compatible regular expressions in KJS"
|
||||
URL "http://www.pcre.org"
|
||||
TYPE RECOMMENDED
|
||||
PURPOSE "Faster regular expression in KJS, increases web pages compatibility"
|
||||
)
|
||||
|
||||
macro_optional_find_package(FAM)
|
||||
set_package_properties(FAM PROPERTIES
|
||||
DESCRIPTION "File alteration notification support via a separate service"
|
||||
|
@ -233,13 +225,6 @@ set(KDE4_KPARTS_INCLUDES
|
|||
${KDE4_KIO_INCLUDES}
|
||||
)
|
||||
|
||||
# kjs depends on kio
|
||||
set(KDE4_KJS_INCLUDES
|
||||
${CMAKE_SOURCE_DIR}/kjs
|
||||
${CMAKE_SOURCE_DIR}/kjs/wtf
|
||||
${CMAKE_BINARY_DIR}/kjs
|
||||
)
|
||||
|
||||
################# configure checks and create the configured files #################
|
||||
|
||||
set(LIBRARY_TYPE SHARED)
|
||||
|
@ -282,14 +267,6 @@ add_subdirectory( kdesu )
|
|||
add_subdirectory( kdeui )
|
||||
if(QT_QTWEBKIT_FOUND)
|
||||
add_subdirectory( kdewebkit )
|
||||
# it is required for adblock
|
||||
install(
|
||||
FILES khtml/khtmlrc
|
||||
DESTINATION ${CONFIG_INSTALL_DIR}
|
||||
)
|
||||
else()
|
||||
add_subdirectory( kjs )
|
||||
add_subdirectory( khtml )
|
||||
endif()
|
||||
add_subdirectory( kdewidgets )
|
||||
add_subdirectory( kexiv2 )
|
||||
|
|
|
@ -20,7 +20,7 @@ set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
|
|||
|
||||
set( KDELIBSUFF ${LIB_SUFFIX} )
|
||||
|
||||
macro_bool_to_01(LIBINTL_FOUND ENABLE_NLS) # kdecore, khtml, kjs
|
||||
macro_bool_to_01(LIBINTL_FOUND ENABLE_NLS) # kdecore
|
||||
|
||||
# now check for dlfcn.h using the cmake supplied CHECK_INCLUDE_FILES() macro
|
||||
# If definitions like -D_GNU_SOURCE are needed for these checks they
|
||||
|
@ -55,7 +55,7 @@ check_include_files(unistd.h HAVE_UNISTD_H) # various
|
|||
check_include_files(stdint.h HAVE_STDINT_H) # various
|
||||
check_include_files(paths.h HAVE_PATHS_H) # kdecore, kio
|
||||
|
||||
check_include_files(errno.h HAVE_ERRNO_H) # kjs, errno.h is used in many places, but only guarded in kjs/
|
||||
check_include_files(errno.h HAVE_ERRNO_H) # various
|
||||
check_include_files(sys/time.h HAVE_SYS_TIME_H) # various
|
||||
check_include_files(langinfo.h HAVE_LANGINFO_H) # kdecore
|
||||
|
||||
|
|
|
@ -60,3 +60,9 @@ install(
|
|||
DESTINATION ${INCLUDE_INSTALL_DIR}
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
# it is required for adblock
|
||||
install(
|
||||
FILES khtmlrc
|
||||
DESTINATION ${CONFIG_INSTALL_DIR}
|
||||
)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
;; -*- emacs-lisp -*-
|
||||
;;
|
||||
;; This file is processed by the dirvars emacs package. Each variable
|
||||
;; setting below is performed when this dirvars file is loaded.
|
||||
;;
|
||||
indent-tabs-mode: nil
|
||||
tab-width: 8
|
||||
c-basic-offset: 4
|
||||
evaluate: (c-set-offset 'innamespace '0)
|
|
@ -1,6 +0,0 @@
|
|||
#regular chars are needed in khtml
|
||||
EXCLUDE doublequote_chars
|
||||
#SadEagle recommends excluding these checkers because khtml uses pimpl-patterned classes
|
||||
EXCLUDE dpointer,explicit
|
||||
|
||||
SKIP test_regression.*\|testkhtml.cpp\|testemca.cpp
|
|
@ -1,32 +0,0 @@
|
|||
In order to be able to use testregression, you have to build your Qt and kdelibs in a special manner.
|
||||
Here are the needed steps.
|
||||
|
||||
1. Set your QTDIR to point to the Qt source tree
|
||||
2. Configure Qt as:
|
||||
configure -prefix $PWD -no-reduce-exports -qt-gif -no-exceptions -debug -fast -qdbus -nomake examples -nomake demos
|
||||
The first 2 parameters are what's needed for testregression, the rest are standard. If you already have Qt configured,
|
||||
make sure to do "make confclean" first.
|
||||
3. Build & Install Qt
|
||||
4. Configure kdelibs:
|
||||
cmake /path/to/kdelibs-src/ -DCMAKE_INSTALL_PREFIX=$KDEDIR -DCMAKE_BUILD_TYPE=debug -DKHTML_BUILD_TESTREGRESSION=true
|
||||
Obviously, you may use whatever prefix and other flags you want, but you must pass
|
||||
-DKHTML_BUILD_TESTREGRESSION=true and must use a debug or debugfull build type.
|
||||
|
||||
Unfortunately, other KDE modules don't like visibility-less kdelibs and Qt much, so you may also want to apply this:
|
||||
--- cmake/modules/FindKDE4Internal.cmake (revision 738780)
|
||||
+++ cmake/modules/FindKDE4Internal.cmake (working copy)
|
||||
@@ -884,6 +884,8 @@
|
||||
exec_program(${CMAKE_C_COMPILER} ARGS -v OUTPUT_VARIABLE _gcc_alloc_info)
|
||||
string(REGEX MATCH "(--enable-libstdcxx-allocator=mt)" _GCC_COMPILED_WITH_BAD_ALLOCATOR "${_gcc_alloc_info}")
|
||||
endif (GCC_IS_NEWER_THAN_4_1)
|
||||
+
|
||||
+ set (__KDE_HAVE_GCC_VISIBILITY 0)
|
||||
|
||||
if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||
|
||||
|
||||
5. Build & Install kdelibs
|
||||
6. You can now use testregression from kdelibs build dirs bin/ directory. Pass it the path to the regression/ directory in khtmltests.
|
||||
Don't forget to make install after changing KHTML or KJS!
|
||||
|
|
@ -1,769 +0,0 @@
|
|||
project(khtml)
|
||||
|
||||
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=6000)
|
||||
add_definitions(-DENABLE_SVG)
|
||||
add_definitions(-DENABLE_SVG_FONTS)
|
||||
add_definitions(-DENABLE_VIDEO)
|
||||
add_definitions(-DWTF_PLATFORM_QT)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
|
||||
|
||||
configure_file(
|
||||
config-khtml.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config-khtml.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${KDE4_KDEUI_INCLUDES}
|
||||
${KDE4_KPARTS_INCLUDES}
|
||||
${CMAKE_BINARY_DIR}/kio/kssl
|
||||
${KDE4_KJS_INCLUDES}
|
||||
${CMAKE_SOURCE_DIR}/kimgio
|
||||
${CMAKE_SOURCE_DIR}/kio/kssl
|
||||
${CMAKE_SOURCE_DIR}/kutils/kmediaplayer
|
||||
${CMAKE_SOURCE_DIR}/interfaces
|
||||
${CMAKE_SOURCE_DIR}/interfaces/kregexpeditor
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/misc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dom
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xml
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/html
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ecma
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/imload
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/svg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/svg/graphics
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platform/graphics
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platform/text
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platform
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/css
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xpath
|
||||
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/misc
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/dom
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/xml
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/html
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/rendering
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ecma
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/imload
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/svg
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/svg/graphics
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/platform/graphics
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/platform/text
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/platform
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/compat
|
||||
${CMAKE_CURRENT_BINARY_DIR}/css
|
||||
)
|
||||
|
||||
set(khtmlgraphics_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/AffineTransform.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/FloatPoint.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/FloatRect.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/FloatSize.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/IntRect.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/Path.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/GraphicsTypes.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/PathTraversalState.cpp
|
||||
# ${CMAKE_SOURCE_DIR}/khtml/platform/graphics/Image.cpp
|
||||
# ${CMAKE_SOURCE_DIR}/khtml/platform/MIMETypeRegistry.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/AffineTransformQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/FloatPointQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/FloatRectQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/IntPointQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/IntRectQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/IntSizeQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/PathQt.cpp
|
||||
# ${CMAKE_SOURCE_DIR}/khtml/platform/qt/MIMETypeRegistryQt.cpp
|
||||
)
|
||||
|
||||
set(khtmlsvg_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGDocument.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGSVGElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStyledLocatableElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLocatable.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStyledElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStylable.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLength.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTransformable.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTransform.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAngle.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGDocumentExtensions.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGParserUtilities.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTransformDistance.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTransformList.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStringList.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStyledTransformableElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTests.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLangSpace.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGExternalResourcesRequired.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGRectElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPreserveAspectRatio.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGFitToViewBox.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGCircleElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStyleElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGEllipseElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPointList.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAnimatedPoints.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPolyElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPolygonElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPolylineElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAnimatedPathData.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegArc.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegClosePath.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegCurvetoCubic.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegCurvetoCubicSmooth.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegCurvetoQuadratic.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegCurvetoQuadraticSmooth.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegLineto.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegLinetoHorizontal.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegLinetoVertical.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegList.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegMoveto.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGURIReference.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStopElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGGradientElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLinearGradientElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGRadialGradientElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGDefsElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGClipPathElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGGElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGElementInstance.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGElementInstanceList.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGUseElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLineElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTextPathElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTextContentElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGNumberList.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTextPositioningElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLengthList.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTextElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGScriptElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTitleElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGDescElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGNames.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGZoomAndPan.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGViewSpec.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTSpanElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGGlyphElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAltGlyphElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGHKernElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGMissingGlyphElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGFontElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/SVGFontData.cpp
|
||||
#############################################################
|
||||
## GRAPHICS #################################################
|
||||
#############################################################
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGResource.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServerSolid.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerSolidQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGResourceClipper.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGResourceClipperQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServerGradient.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServerLinearGradient.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServerRadialGradient.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerGradientQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerLinearGradientQt.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerRadialGradientQt.cpp
|
||||
#############################################################
|
||||
## RENDERING PART BELOW ###################################
|
||||
#############################################################
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGRoot.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderPath.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGRenderStyleDefs.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGRenderStyle.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGGradientStop.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGContainer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGRenderSupport.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGHiddenContainer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGTransformableContainer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGInlineFlowBox.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGRootInlineBox.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGTextPath.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGInlineTextBox.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGCharacterLayoutInfo.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGInline.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGText.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGBlock.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGInlineText.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGTSpan.cpp
|
||||
)
|
||||
|
||||
set(khtmldom_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom_misc.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_block.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_inline.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/css_rule.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom_node.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_document.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_list.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/css_stylesheet.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom_string.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_element.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_misc.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/css_value.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom_text.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_object.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom_doc.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom_xml.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_head.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom_element.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_base.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_image.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_form.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom2_range.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/html_table.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom2_traversal.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom2_events.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom2_views.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/QualifiedName.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/dom/dom3_xpath.cpp
|
||||
)
|
||||
|
||||
set(khtmlmisc_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/loader.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/helper.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/stringit.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/paintbuffer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/imagefilter.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/borderarcstroker.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/idstring.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/htmlnames.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/AtomicString.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/misc/woff.cpp
|
||||
)
|
||||
|
||||
set(khtmlediting_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/editing/jsediting.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/editing/editing.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/editing/editor.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/editing/htmlediting_impl.cpp
|
||||
)
|
||||
|
||||
set(khtmlfind_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/ui/findbar/khtmlfind.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ui/findbar/khtmlfindbar.cpp
|
||||
)
|
||||
|
||||
set(passwordbar_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/ui/passwordbar/storepassbar.cpp
|
||||
)
|
||||
|
||||
set(khtmlhtml_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/htmlparser.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/htmltokenizer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/htmlprospectivetokenizer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/dtd.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_headimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_blockimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_elementimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_inlineimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_documentimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_baseimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_imageimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_listimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_miscimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_formimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_objectimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_tableimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/html_canvasimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/HTMLMediaElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/HTMLAudioElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/HTMLVideoElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/HTMLSourceElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/html/TimeRanges.cpp
|
||||
)
|
||||
|
||||
set(kjs_html_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_binding.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_dom.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_html.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_window.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_navigator.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_proxy.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_css.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_range.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_traversal.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_events.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_views.cpp
|
||||
# ${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_debugwin.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_mozilla.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSTimeRanges.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSTimeRanges.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSMediaError.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSMediaError.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/JSHTMLElement.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLMediaElement.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLMediaElement.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLAudioElement.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLAudioElement.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLVideoElement.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLVideoElement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/xmlhttprequest.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/xmlserializer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/domparser.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_context2d.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_audio.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_xpath.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_scriptable.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_data.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_arraybuffer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_arraybufferview.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_arraytyped.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_clientrect.cpp
|
||||
)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(kjs_html_STAT_SRCS
|
||||
${kjs_html_STAT_SRCS}
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/debugwindow.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/debugdocument.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/consoledock.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/breakpointsdock.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/callstackdock.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/localvariabledock.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/scriptsdock.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/value2string.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/errordlg.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/interpreter_ctx.cpp
|
||||
)
|
||||
|
||||
qt4_add_resources(kjs_html_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/debugger.qrc
|
||||
)
|
||||
add_definitions(-DKJS_DEBUGGER)
|
||||
endif()
|
||||
|
||||
set(khtmlrender_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/bidi.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_block.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_inline.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_style.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_object.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_container.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_box.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_flow.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_text.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_layer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_image.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_table.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/table_layout.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_replaced.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_form.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_list.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_canvas.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_frames.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_br.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_body.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/font.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_line.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_generated.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/enumerate.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/counter_tree.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_canvasimage.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_position.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/rendering/render_media.cpp
|
||||
)
|
||||
|
||||
set(khtmlcss_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_stylesheetimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_ruleimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_valueimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_svgvalueimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_base.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/cssparser.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/cssstyleselector.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/csshelper.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/parser.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_renderstyledeclarationimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_mediaquery.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_svgcssparser.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/SVGCSSStyleSelector.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/css/css_webfont.cpp
|
||||
)
|
||||
|
||||
set(khtmlxml_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/security_origin.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_docimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_nodeimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_nodelistimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_textimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_elementimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_stringimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom2_rangeimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom2_traversalimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/xml_tokenizer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_xmlimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom2_eventsimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom2_viewsimpl.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_restyler.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/ClassNames.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_position.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_positioniterator.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom_selection.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/wa_selectors.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xml/dom3_xpathimpl.cpp
|
||||
)
|
||||
|
||||
set(khtmlimload_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/imageplane.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/rawimageplane.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/scaledimageplane.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/pixmapplane.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/animprovider.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/imagepainter.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/updater.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/image.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/imagemanager.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/animtimer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/imload/canvasimage.cpp
|
||||
)
|
||||
|
||||
set(xpath_STAT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/expression.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/functions.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/parsedstatement.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/path.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/predicate.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/step.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/tokenizer.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/parser.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/util.cpp
|
||||
${CMAKE_SOURCE_DIR}/khtml/xpath/variablereference.cpp
|
||||
# ${CMAKE_SOURCE_DIR}/khtml/xpath/XPathNSResolverImpl.cpp
|
||||
)
|
||||
|
||||
########### libkhtml ###############
|
||||
|
||||
set(khtml_LIB_SRCS
|
||||
khtmlview.cpp
|
||||
khtmlviewbar.cpp
|
||||
khtmlviewbarwidget.cpp
|
||||
khtml_part.cpp
|
||||
khtml_childframe.cpp
|
||||
khtml_run.cpp
|
||||
khtml_global.cpp
|
||||
khtml_settings.cpp
|
||||
khtml_filter.cpp
|
||||
khtml_events.cpp
|
||||
khtml_ext.cpp
|
||||
khtml_printsettings.cpp
|
||||
khtml_iface.cc
|
||||
kjserrordlg.cpp
|
||||
${xpath_STAT_SRCS}
|
||||
${khtmlfind_STAT_SRCS}
|
||||
${passwordbar_STAT_SRCS}
|
||||
${khtmlxml_STAT_SRCS}
|
||||
${khtmlhtml_STAT_SRCS}
|
||||
${khtmlrender_STAT_SRCS}
|
||||
${khtmlcss_STAT_SRCS}
|
||||
${khtmlmisc_STAT_SRCS}
|
||||
${khtmlediting_STAT_SRCS}
|
||||
${kjs_html_STAT_SRCS}
|
||||
${khtmldom_STAT_SRCS}
|
||||
${khtmlimload_STAT_SRCS}
|
||||
# for WebCore compatibility
|
||||
${khtmlgraphics_STAT_SRCS}
|
||||
# for SVG
|
||||
${khtmlsvg_STAT_SRCS}
|
||||
# just so that it gets generated
|
||||
${CMAKE_CURRENT_BINARY_DIR}/org.kde.KHTMLPart.xml
|
||||
${CMAKE_SOURCE_DIR}/kdecore/localization/kentities.cpp
|
||||
)
|
||||
|
||||
|
||||
qt4_generate_dbus_interface(khtml_iface.h org.kde.KHTMLPart.xml)
|
||||
|
||||
set(kcookiejar_XML ${CMAKE_CURRENT_BINARY_DIR}/org.kde.KCookieServer.xml)
|
||||
qt4_generate_dbus_interface(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../kioslave/http/kcookiejar/kcookieserver.h
|
||||
org.kde.KCookieServer.xml
|
||||
)
|
||||
set_source_files_properties(${kcookiejar_XML} PROPERTIES
|
||||
INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/../kioslave/http/kcookiejar/kcookiejar_include.h"
|
||||
)
|
||||
qt4_add_dbus_interface(khtml_LIB_SRCS
|
||||
${kcookiejar_XML}
|
||||
kcookiejar_interface
|
||||
)
|
||||
|
||||
# going trough the extra trouble to not use shared KJS library for performance reasons
|
||||
add_library(khtml ${LIBRARY_TYPE} ${khtml_LIB_SRCS} $<TARGET_OBJECTS:kjs>)
|
||||
|
||||
target_link_libraries(khtml
|
||||
${KDE4_KDEUI_LIBRARY}
|
||||
${KDE4_KPARTS_LIBS}
|
||||
ktexteditor
|
||||
kio
|
||||
kdecore
|
||||
kmediaplayer
|
||||
${X11_LIBRARIES}
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTGUI_LIBRARY}
|
||||
# for KJS
|
||||
m
|
||||
)
|
||||
|
||||
# for KJS
|
||||
if(CMAKE_THREAD_LIBS_INIT)
|
||||
target_link_libraries(khtml ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
if(PCRE_FOUND)
|
||||
target_link_libraries(khtml ${PCRE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set_target_properties(khtml PROPERTIES
|
||||
VERSION ${KDE_NON_GENERIC_LIB_VERSION}
|
||||
SOVERSION ${KDE_NON_GENERIC_LIB_SOVERSION}
|
||||
)
|
||||
|
||||
set(CREATE_HASH_TABLE ${CMAKE_SOURCE_DIR}/kjs/create_hash_table )
|
||||
macro(CREATE_LUT _in_FILE _out_FILE)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
|
||||
COMMAND ${PERL_EXECUTABLE} ${CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
|
||||
)
|
||||
macro_add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE} )
|
||||
endmacro(CREATE_LUT)
|
||||
|
||||
create_lut(ecma/kjs_dom.cpp kjs_dom.lut.h)
|
||||
create_lut(ecma/kjs_html.cpp kjs_html.lut.h)
|
||||
create_lut(ecma/kjs_window.cpp kjs_window.lut.h)
|
||||
create_lut(ecma/kjs_css.cpp kjs_css.lut.h)
|
||||
create_lut(ecma/kjs_events.cpp kjs_events.lut.h)
|
||||
create_lut(ecma/kjs_navigator.cpp kjs_navigator.lut.h)
|
||||
create_lut(ecma/kjs_mozilla.cpp kjs_mozilla.lut.h)
|
||||
create_lut(ecma/kjs_range.cpp kjs_range.lut.h)
|
||||
create_lut(ecma/kjs_traversal.cpp kjs_traversal.lut.h)
|
||||
create_lut(ecma/kjs_views.cpp kjs_views.lut.h)
|
||||
create_lut(ecma/xmlhttprequest.cpp xmlhttprequest.lut.h)
|
||||
create_lut(ecma/xmlserializer.cpp xmlserializer.lut.h)
|
||||
create_lut(ecma/domparser.cpp domparser.lut.h)
|
||||
create_lut(ecma/kjs_context2d.cpp kjs_context2d.lut.h)
|
||||
create_lut(ecma/kjs_xpath.cpp kjs_xpath.lut.h)
|
||||
create_lut(ecma/kjs_arraybuffer.cpp kjs_arraybuffer.lut.h)
|
||||
create_lut(ecma/kjs_arraybufferview.cpp kjs_arraybufferview.lut.h)
|
||||
create_lut(ecma/kjs_clientrect.cpp kjs_clientrect.lut.h)
|
||||
|
||||
macro(create_js_binding _in_FILE)
|
||||
get_filename_component(_in_filename ${_in_FILE} NAME_WE)
|
||||
set(_out_h_FILE "${CMAKE_CURRENT_BINARY_DIR}/JS${_in_filename}.h")
|
||||
set(_out_cpp_FILE "${CMAKE_CURRENT_BINARY_DIR}/JS${_in_filename}.cpp")
|
||||
set(_scripts_dir ${CMAKE_SOURCE_DIR}/khtml/bindings/scripts)
|
||||
add_custom_command(OUTPUT ${_out_h_FILE} ${_out_cpp_FILE}
|
||||
COMMAND ${PERL_EXECUTABLE} -I${_scripts_dir}
|
||||
${_scripts_dir}/generate-bindings.pl
|
||||
--include=${CMAKE_SOURCE_DIR}/khtml/html
|
||||
--generator=JS
|
||||
--outputdir=${CMAKE_CURRENT_BINARY_DIR}
|
||||
--preprocessor=\"${QT_MOC_EXECUTABLE} -E\"
|
||||
--defines=ENABLE_VIDEO
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
|
||||
DEPENDS ${_scripts_dir}/CodeGeneratorJS.pm
|
||||
)
|
||||
macro_add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${_out_h_FILE} ${_out_cpp_FILE})
|
||||
endmacro(create_js_binding)
|
||||
|
||||
create_js_binding(html/TimeRanges.idl)
|
||||
create_js_binding(html/MediaError.idl)
|
||||
create_js_binding(html/HTMLMediaElement.idl)
|
||||
create_js_binding(html/HTMLAudioElement.idl)
|
||||
create_js_binding(html/HTMLVideoElement.idl)
|
||||
#create_js_binding(svg/SVGRectElement.idl)
|
||||
#create_js_binding(svg/SVGRect.idl)
|
||||
#create_js_binding(svg/SVGElement.idl)
|
||||
#create_js_binding(svg/SVGDocument.idl)
|
||||
#create_js_binding(svg/SVGAngle.idl)
|
||||
#create_js_binding(svg/SVGSVGElement.idl)
|
||||
#create_js_binding(svg/SVGLength.idl)
|
||||
#create_js_binding(svg/SVGNumber.idl)
|
||||
#create_js_binding(svg/SVGPoint.idl)
|
||||
#create_js_binding(svg/SVGMatrix.idl)
|
||||
#create_js_binding(svg/SVGTransform.idl)
|
||||
#create_js_binding(svg/SVGException.idl)
|
||||
#create_js_binding(svg/SVGPaint.idl)
|
||||
#create_js_binding(svg/SVGNumberList.idl)
|
||||
#create_js_binding(svg/SVGAnimatedLength.idl)
|
||||
#create_js_binding(svg/SVGRectElement.idl)
|
||||
#create_js_binding(svg/SVGTransformList.idl)
|
||||
#create_js_binding(svg/SVGAnimatedTransformList.idl)
|
||||
##create_js_binding(svg/SVGLocatable.idl)
|
||||
##create_js_binding(svg/SVGTransformable.idl)
|
||||
#create_js_binding(svg/SVGAnimatedString.idl)
|
||||
#create_js_binding(svg/SVGAnimatedBoolean.idl)
|
||||
#create_js_binding(svg/SVGStringList.idl)
|
||||
#create_js_binding(svg/SVGEllipseElement.idl)
|
||||
#create_js_binding(svg/SVGCircleElement.idl)
|
||||
#create_js_binding(svg/SVGLineElement.idl)
|
||||
#create_js_binding(svg/SVGScriptElement.idl)
|
||||
#create_js_binding(svg/SVGPathSeg.idl)
|
||||
#create_js_binding(svg/SVGPathElement.idl)
|
||||
#create_js_binding(svg/SVGAnimatedNumber.idl)
|
||||
#create_js_binding(svg/SVGPathSegArcAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegArcRel.idl)
|
||||
#create_js_binding(svg/SVGPathSegClosePath.idl)
|
||||
#create_js_binding(svg/SVGPathSegCurvetoCubicAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegCurvetoCubicRel.idl)
|
||||
#create_js_binding(svg/SVGPathSegCurvetoCubicSmoothAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegCurvetoCubicSmoothRel.idl)
|
||||
#create_js_binding(svg/SVGPathSegCurvetoQuadraticAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegCurvetoQuadraticRel.idl)
|
||||
#create_js_binding(svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegCurvetoQuadraticSmoothRel.idl)
|
||||
#create_js_binding(svg/SVGPathSegLinetoAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegLinetoHorizontalAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegLinetoHorizontalRel.idl)
|
||||
#create_js_binding(svg/SVGPathSegLinetoRel.idl)
|
||||
#create_js_binding(svg/SVGPathSegLinetoVerticalAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegLinetoVerticalRel.idl)
|
||||
#create_js_binding(svg/SVGPathSegList.idl)
|
||||
#create_js_binding(svg/SVGPathSegMovetoAbs.idl)
|
||||
#create_js_binding(svg/SVGPathSegMovetoRel.idl)
|
||||
|
||||
install(
|
||||
TARGETS khtml
|
||||
EXPORT kdelibsLibraryTargets
|
||||
${INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
)
|
||||
|
||||
########### khtmlpart ###############
|
||||
|
||||
kde4_add_plugin(khtmlpart khtml_factory.cpp)
|
||||
|
||||
target_link_libraries(khtmlpart ${KDE4_KDECORE_LIBS} khtml)
|
||||
|
||||
install(
|
||||
TARGETS khtmlpart
|
||||
DESTINATION ${PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
########### next target ###############
|
||||
|
||||
kde4_add_plugin(khtmladaptorpart khtmladaptorpart.cpp)
|
||||
|
||||
target_link_libraries(khtmladaptorpart ${KDE4_KPARTS_LIBS} khtml)
|
||||
|
||||
install(
|
||||
TARGETS khtmladaptorpart
|
||||
DESTINATION ${PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
########### next target ###############
|
||||
|
||||
add_executable(testkhtml testkhtml.cpp)
|
||||
|
||||
target_link_libraries(testkhtml ${KDE4_KDECORE_LIBS} khtml)
|
||||
|
||||
########### next target ###############
|
||||
|
||||
# Note that testregression can't be compiled by default, it needs private Qt headers.
|
||||
# See also BUILDING-TESTREGRESSION
|
||||
if(KHTML_BUILD_TESTREGRESSION)
|
||||
set(testregression_SRCS
|
||||
test_regression.cpp
|
||||
test_regression_fontoverload.cpp
|
||||
)
|
||||
|
||||
add_executable(testregression ${testregression_SRCS})
|
||||
|
||||
target_link_libraries(testregression ${KDE4_KDECORE_LIBS} ${X11_X11_LIB} khtml)
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(testregressiongui_SRCS
|
||||
test_regression_gui_window.cpp
|
||||
test_regression_gui_main.cpp
|
||||
)
|
||||
|
||||
qt4_add_resources(testregressiongui_SRCS test_regression_gui.qrc)
|
||||
|
||||
add_executable(testregressiongui ${testregressiongui_SRCS})
|
||||
|
||||
target_link_libraries(testregressiongui ${KDE4_KDECORE_LIBS} khtml)
|
||||
endif(KHTML_BUILD_TESTREGRESSION)
|
||||
|
||||
add_subdirectory( css )
|
||||
add_subdirectory( pics )
|
||||
add_subdirectory( kmultipart )
|
||||
if(ENABLE_TESTING)
|
||||
add_subdirectory( tests )
|
||||
endif()
|
||||
|
||||
########### install files ###############
|
||||
install(
|
||||
FILES
|
||||
khtml_export.h
|
||||
khtmlview.h
|
||||
khtml_part.h
|
||||
khtml_events.h
|
||||
khtml_settings.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
dom/dom_exception.h
|
||||
dom/html_base.h
|
||||
dom/html_inline.h
|
||||
dom/css_rule.h
|
||||
dom/dom_html.h
|
||||
dom/html_block.h
|
||||
dom/html_list.h
|
||||
dom/css_stylesheet.h
|
||||
dom/dom_misc.h
|
||||
dom/html_document.h
|
||||
dom/html_misc.h
|
||||
dom/css_value.h
|
||||
dom/dom_node.h
|
||||
dom/html_element.h
|
||||
dom/html_object.h
|
||||
dom/dom_core.h
|
||||
dom/dom_string.h
|
||||
dom/html_form.h
|
||||
dom/html_table.h
|
||||
dom/dom_doc.h
|
||||
dom/dom_text.h
|
||||
dom/html_head.h
|
||||
dom/dom_element.h
|
||||
dom/dom_xml.h
|
||||
dom/html_image.h
|
||||
dom/dom2_range.h
|
||||
dom/dom2_traversal.h
|
||||
dom/dom2_events.h
|
||||
dom/dom2_views.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/dom
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
khtml.desktop
|
||||
khtmladaptorpart.desktop
|
||||
DESTINATION ${SERVICES_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/org.kde.KHTMLPart.xml
|
||||
DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
khtml.rc
|
||||
khtml_browser.rc
|
||||
error.html
|
||||
DESTINATION ${DATA_INSTALL_DIR}/khtml
|
||||
)
|
||||
|
||||
install(
|
||||
FILES khtmlrc
|
||||
DESTINATION ${CONFIG_INSTALL_DIR}
|
||||
)
|
3860
khtml/ChangeLog
3860
khtml/ChangeLog
File diff suppressed because it is too large
Load diff
|
@ -1,46 +0,0 @@
|
|||
/** @mainpage KDE HTML Parser and Widget
|
||||
|
||||
If you want a fully-fledged HTML browser widget in your application,
|
||||
you can use KHTMLPart to do so.
|
||||
|
||||
@code
|
||||
KUrl url = "http://www.kde.org";
|
||||
KHTMLPart *w = new KHTMLPart();
|
||||
w->openUrl(url);
|
||||
w->view()->resize(500, 400);
|
||||
w->show();
|
||||
@endcode
|
||||
|
||||
For more information, see the documentation for KHTMLPart.
|
||||
|
||||
Note that using KHTMLPart may introduce security vulnerabilities
|
||||
and unnecessary bloat to your application. Qt's text widgets are
|
||||
rich-text capable, and will interpret a limited subset of HTML.
|
||||
|
||||
@authors
|
||||
Torben Weis \<weis@stud.uni-frankfurt.de\><br>
|
||||
Josip A. Gracin \<grac@fly.cc.fer.hr\><br>
|
||||
Martin Jones \<mjones@kde.org\><br>
|
||||
Waldo Bastian \<bastian@kde.org\><br>
|
||||
Lars Knoll \<knoll@kde.org\><br>
|
||||
Antti Koivisto \<koivisto@iki.fi\><br>
|
||||
Dirk Mueller \<mueller@kde.org\><br>
|
||||
Peter Kelly \<pmk@post.com\><br>
|
||||
George Staikos \<staikos@kde.org\><br>
|
||||
Allan Sandfeld Jensen \<kde@carewolf.com\><br>
|
||||
Germain Garand \<germain@ebooksfrance.org\><br>
|
||||
Maksim Orlovich \<maksim@kde.org\><br>
|
||||
KHTML has also heavily benefited from the work of Apple Computer, Inc.
|
||||
@maintainers
|
||||
Allan Sandfeld Jensen <br>
|
||||
Germain Garand<br>
|
||||
Maksim Orlovich
|
||||
|
||||
@licenses
|
||||
@lgpl
|
||||
|
||||
*/
|
||||
// DOXYGEN_REFERENCES = kdecore kdeui kio kparts kjs
|
||||
// DOXYGEN_EXCLUDE = test*.* html rendering xml misc ecma css imload pics test
|
||||
// DOXYGEN_SET_PROJECT_NAME = KHTML
|
||||
// vim:ts=4:sw=4:expandtab:filetype=doxygen
|
|
@ -1,66 +0,0 @@
|
|||
KDE HTML Widget
|
||||
===============
|
||||
|
||||
Developers
|
||||
----------
|
||||
|
||||
The first version was written by
|
||||
|
||||
Torben Weis <weis@stud.uni-frankfurt.de>
|
||||
|
||||
It was extended by
|
||||
|
||||
Josip A. Gracin <grac@fly.cc.fer.hr>,
|
||||
Martin Jones <mjones@kde.org>,
|
||||
Waldo Bastian <bastian@kde.org>
|
||||
Lars Knoll <knoll@kde.org>
|
||||
Antti Koivisto <koivisto@iki.fi>
|
||||
Dirk Mueller <mueller@kde.org>
|
||||
Peter Kelly <pmk@post.com>
|
||||
|
||||
It is currently primarily maintained and developed by
|
||||
Lars Knoll, Dirk Mueller and Antti Koivisto.
|
||||
|
||||
|
||||
Revision History
|
||||
----------------
|
||||
|
||||
This library is called libkhtml.
|
||||
This library used to be called libkhtmlw. With the release of KDE 1.1 a
|
||||
source incompatible version called libkhtml has been created.
|
||||
libkhtmlw will not be maintained any more, all application writers are
|
||||
urgently requested to make use of the new libkhtml library.
|
||||
|
||||
|
||||
Starting Point
|
||||
--------------
|
||||
|
||||
You can add the widget to your program by doing something like:
|
||||
|
||||
#include <khtml.h>
|
||||
|
||||
.
|
||||
.
|
||||
.
|
||||
|
||||
KHTMLWidget *view = new KHTMLWidget( parent, "Name" );
|
||||
view->show();
|
||||
|
||||
view->begin( "file:/tmp/test.html" );
|
||||
view->parse();
|
||||
view->write( "<HTML><TITLE>...." );
|
||||
view->write( "..." );
|
||||
.
|
||||
.
|
||||
.
|
||||
view->write( "</HTML>" );
|
||||
view->end();
|
||||
|
||||
|
||||
After doing this, control must be returned to the event loop as the HTML
|
||||
is parsed in the background using a Qt timer.
|
||||
|
||||
For more information see the full documentation in JavaDoc format included
|
||||
in the header files.
|
||||
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
|
||||
This is a short document with the progress of patches in the Safari codebase
|
||||
being merged into khtml.
|
||||
|
||||
its ordered by directory and by files. Add here the parts that cannot be
|
||||
immediately merged and need further negotiation.
|
||||
|
||||
Its recommended to add a //FIXME_SAFARI comment to places which need merging
|
||||
in the khtml sourcecode.
|
||||
|
||||
===========================================================================
|
||||
# css
|
||||
===========================================================================
|
||||
|
||||
- the font changes (except for the konq-body property) are still not merged.
|
||||
They are partly not easily portable and I don't understand some parts of them.
|
||||
a small part is merged but still unused (separate font sizes for fixed fonts)
|
||||
|
||||
- The Apple specific parts with their DPI settings.
|
||||
|
||||
- most of the html4.css changes are not in. I have already added the
|
||||
@konq-quirks part
|
||||
|
||||
===========================================================================
|
||||
# dom
|
||||
===========================================================================
|
||||
|
||||
- dom_doc.cpp / .h: preferred Stylesheet stuff. how does this correlate
|
||||
to the changes in css_stylesheet.h / cpp ? <- It's independent (lars).
|
||||
requires merging of the impl in xml/html first
|
||||
|
||||
- css_stylesheet.cpp / .h addition of preferredStyleSheet et all, but
|
||||
appears to be unused
|
||||
|
||||
- weird change in dom_doc.cpp: doctype()
|
||||
|
||||
- dom_string.h: removal of virtual destructor can't be merged, BIC.
|
||||
doesn't make sense anyway, as one might want to inherit from it.
|
||||
if it is a speed problem more stuff has to be handled with DOMStringImpl*
|
||||
|
||||
- html_document.cpp / .h setPolicyBaseURL for cookie handling. euhm?
|
||||
|
||||
===========================================================================
|
||||
# ecma
|
||||
===========================================================================
|
||||
|
||||
TODO:
|
||||
- ScriptInterpreter domObjectsPerDocument + getDOMDocumentNode
|
||||
|
||||
To investigate:
|
||||
- kjs_navigator (PluginBase refcount ; ProductSub)
|
||||
hmm, why is e.g. the ref/deref stuff in APPLE_CHANGES?
|
||||
- scope changes (kjs_events.cpp, DOMNode::pushEventHandlerScope)
|
||||
- Image object: DOM::Document doc -> QGuardedPtr<DOM::DocumentImpl> doc;
|
||||
(why? Or rather: should this also be done in all other domobject-wrappers?)
|
||||
- window.scroll == scrollto or scrollby ??
|
||||
- ScheduledAction: ObjectImp -> Object. Sounds good - why did we have an imp? refcount problem?
|
||||
|
||||
Needs other stuff before it can be applied:
|
||||
- Identifier change (needs kjs2) (includes lengthPropertyName change)
|
||||
|
||||
===========================================================================
|
||||
# html
|
||||
===========================================================================
|
||||
|
||||
- dtd.cpp: changes regarding ID_TEXT, ID_FORM, A and FONT left out
|
||||
|
||||
- html_formimpl.cpp/.h: many changes skipped. will need to integrate the
|
||||
"activate first submit" button part.
|
||||
|
||||
- html_headimpl.cpp: changes for FOUC in external style loading
|
||||
|
||||
- html_image/html_form: name / id lookup cache skipped. want to do that
|
||||
for all elements.
|
||||
|
||||
- html_miscimpl.cpp: case insensitive name / id matching
|
||||
|
||||
- html_parser: reapplying of dropped attributes. reported to be obsolete
|
||||
|
||||
===========================================================================
|
||||
# misc
|
||||
===========================================================================
|
||||
|
||||
- decoder.cpp/.h: changes in APPLE_CHANGES #ifdef that make decoder
|
||||
being a null wrapper just using unicode directly instead of working
|
||||
on charset specific 8bit data.
|
||||
|
||||
- htmltags.in: removal of <-konqblock>, not sure if that should ever
|
||||
be merged.
|
||||
|
||||
===========================================================================
|
||||
# rendering
|
||||
===========================================================================
|
||||
|
||||
done so far:
|
||||
|
||||
- RenderArena support. Usage of the arena is disabled for now. Needs
|
||||
testing before I'll enable it.
|
||||
|
||||
- renamed print methods to paint
|
||||
|
||||
- RenderLayer code is used. Needs to be updated to apples latest version.
|
||||
|
||||
- Handling of block within inlines via continuations is done.
|
||||
|
||||
changes that need to be merged:
|
||||
|
||||
- bidi.h/cpp: lot's of changes to white space handling and others.
|
||||
probably needs the merge of the tokenizer.
|
||||
|
||||
- font.cpp/h: some apple specific changes. Addition of a genericFamily enum,
|
||||
IMO to speed up style stuff. Should IMO be separated out into a font_mac.cpp
|
||||
and font_x11.cpp
|
||||
|
||||
- repaint has gotten a bool immediate
|
||||
|
||||
- render_applet.cpp: small #ifdef APPLE changes
|
||||
|
||||
- render_box.cpp:
|
||||
paintBackground has some fixes for background position in
|
||||
table cells and repeat handling. Need to examine in detail
|
||||
|
||||
calcWidth has some code for min and max width constraints
|
||||
calcHeight has a hack for "height: 100%". Not sure I understand it.
|
||||
|
||||
- render_container:
|
||||
some hack to avoid an infinite recursion on one of the evil tests.
|
||||
Since I fixed anonymous table insertion, I doubt it is still needed. Needs testing.
|
||||
|
||||
....
|
||||
|
||||
|
||||
===========================================================================
|
||||
# xml
|
||||
===========================================================================
|
||||
|
||||
- dom2_eventsimpl.cpp: computeLayerPos, requires mering of rendering/
|
||||
|
||||
- dom2_rangeimpl.cpp: createContextualFragment.. merging needed
|
||||
|
||||
- dom_docimpl.cpp:
|
||||
renderArena support.. merging needed.
|
||||
lowercase attribute names.. requires confirmation
|
||||
preferred style sheet / delay recalcing style selector till
|
||||
all external stylesheets are loaded.
|
||||
|
||||
- dom_nodeimpl.cpp: rendererNeedsClose. I don't fully understand this
|
||||
seems to be only required for the avoid-unstyled-elements-flicker
|
||||
restoreState -> QStringList change. will merge.
|
||||
setLayouted(false) calls in attach(). this should imho be handled
|
||||
in the rendering tree. needs feedback.
|
||||
|
||||
- dom_nodeimpl.cpp / .h: setMalformed() hack.
|
||||
isInline() fixes.
|
||||
previous/nextrenderer addition
|
||||
|
||||
- dom_stringimpl.cpp: toLengthArray alternative implementation not merged
|
||||
|
||||
- dom_textimpl.cpp: setNodeValue: whitespace nuking needs merged!!
|
||||
|
||||
- xml_tokenizer.cpp/.h: completely skipped. unfinished work.
|
60
khtml/TODO
60
khtml/TODO
|
@ -1,60 +0,0 @@
|
|||
Here's what's still missing (without order):
|
||||
|
||||
Rendering:
|
||||
* text-align: Justify missing
|
||||
* allow font elements in a block level context.
|
||||
|
||||
StyleSheets:
|
||||
* @ rules in sheets
|
||||
* lots of properties
|
||||
* delete the old cssproperties in a style attribute in case
|
||||
the style attribute changes.
|
||||
* border shorthand properties. Unspecified properties get their default
|
||||
values. border-width: medium; border-color: undefined (== text color)
|
||||
|
||||
DOM:
|
||||
* some functions in the Impl classes
|
||||
* fix the set/retrieve functions, which use boolean values
|
||||
-->> mostly done, still need to fix parseAttribute() calls
|
||||
* DOM level 2
|
||||
* DOM stylesheets, changes need to trigger the appropriate changes
|
||||
in the rendering tree
|
||||
* Implementation of NamedAttrMapImpl and Attributes in DOMElementImpl
|
||||
is ugly. MOve aatributes to the elementImpl and make the namedNodeMap
|
||||
point to an element. Think of creating AttrImpl's directly in
|
||||
khtmltoken.cpp
|
||||
|
||||
XML:
|
||||
* lots of stuff in the Impl classes
|
||||
* parsing
|
||||
* entities
|
||||
* style sheet processing instructions
|
||||
* proper mimetype detection
|
||||
|
||||
misc:
|
||||
* <font size=+3> works as size=+1
|
||||
|
||||
Java:
|
||||
* support for the object element
|
||||
--> mostly done
|
||||
* Java <--> HTMLWidget communication
|
||||
* turn kjava into a kpart
|
||||
|
||||
Attributes:
|
||||
* check for unimplemented attributes
|
||||
|
||||
Memory usage:
|
||||
* use bitfields for lots of things (especially in the
|
||||
DOM/CSS/rendering stuff)
|
||||
* try to make better use of shared objects, especially in the
|
||||
RenderStyle
|
||||
* check for leaks
|
||||
* there's a mem leak with the style objects of anonymous
|
||||
boxes (and ListMarkers).
|
||||
|
||||
Other:
|
||||
* there's a bug on correctly retrieving <textarea> text.
|
||||
see test/forms.html and compare it with the way all other
|
||||
browsers handle that code
|
||||
* paste should be enabled (and implemented) if there's pasteable clipboard
|
||||
content and a form element has the focus
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2006, 2007 Nikolas Zimmermann <zimmermann@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 "config.h"
|
||||
#include "wtf/Platform.h"
|
||||
|
||||
#if ENABLE(SVG)
|
||||
|
||||
#include "JSSVGMatrix.h"
|
||||
|
||||
#include "AffineTransform.h"
|
||||
#include "SVGException.h"
|
||||
|
||||
using namespace KJS;
|
||||
using namespace WebCore;
|
||||
|
||||
namespace khtml {
|
||||
|
||||
JSValue* JSSVGMatrix::multiply(ExecState* exec, const List& args)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
|
||||
AffineTransform secondMatrix = toSVGMatrix(args[0]);
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.multiply(secondMatrix)), m_context.get());
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::inverse(ExecState* exec, const List&)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.inverse()), m_context.get());
|
||||
|
||||
if (!imp.isInvertible())
|
||||
setDOMException(exec, SVGException::SVG_MATRIX_NOT_INVERTABLE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::translate(ExecState* exec, const List& args)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
|
||||
float x = args[0]->toFloat(exec);
|
||||
float y = args[1]->toFloat(exec);
|
||||
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.translate(x, y)), m_context.get());
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::scale(ExecState* exec, const List& args)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
|
||||
float scaleFactor = args[0]->toFloat(exec);
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.scale(scaleFactor)), m_context.get());
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::scaleNonUniform(ExecState* exec, const List& args)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
|
||||
float scaleFactorX = args[0]->toFloat(exec);
|
||||
float scaleFactorY = args[1]->toFloat(exec);
|
||||
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.scaleNonUniform(scaleFactorX, scaleFactorY)), m_context.get());
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::rotate(ExecState* exec, const List& args)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
|
||||
float angle = args[0]->toFloat(exec);
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.rotate(angle)), m_context.get());
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::rotateFromVector(ExecState* exec, const List& args)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
|
||||
float x = args[0]->toFloat(exec);
|
||||
float y = args[1]->toFloat(exec);
|
||||
|
||||
KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.rotateFromVector(x, y)), m_context.get());
|
||||
|
||||
if (x == 0.0 || y == 0.0)
|
||||
setDOMException(exec, SVGException::SVG_INVALID_VALUE_ERR);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::flipX(ExecState* exec, const List&)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.flipX()), m_context.get());
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::flipY(ExecState* exec, const List&)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.flipY()), m_context.get());
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::skewX(ExecState* exec, const List& args)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
|
||||
float angle = args[0]->toFloat(exec);
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.skewX(angle)), m_context.get());
|
||||
}
|
||||
|
||||
JSValue* JSSVGMatrix::skewY(ExecState* exec, const List& args)
|
||||
{
|
||||
AffineTransform imp(*impl());
|
||||
|
||||
float angle = args[0]->toFloat(exec);
|
||||
return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.skewY(angle)), m_context.get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // ENABLE(SVG)
|
||||
|
||||
// vim:ts=4:noet
|
|
@ -1,298 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
|
||||
* Copyright (C) 2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE 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 JSSVGPODTypeWrapper_h
|
||||
#define JSSVGPODTypeWrapper_h
|
||||
|
||||
#if ENABLE(SVG)
|
||||
|
||||
#include "Frame.h"
|
||||
#include <wtf/RefCounted.h>
|
||||
#include "SVGElement.h"
|
||||
|
||||
#include <wtf/Assertions.h>
|
||||
#include <wtf/HashMap.h>
|
||||
|
||||
namespace WebCore {
|
||||
template<typename PODType>
|
||||
class SVGPODListItem;
|
||||
}
|
||||
|
||||
using namespace WebCore;
|
||||
|
||||
namespace khtml {
|
||||
|
||||
template<typename PODType>
|
||||
class JSSVGPODTypeWrapper : public RefCounted<JSSVGPODTypeWrapper<PODType> > {
|
||||
public:
|
||||
JSSVGPODTypeWrapper() : RefCounted<JSSVGPODTypeWrapper<PODType> >(0) { }
|
||||
virtual ~JSSVGPODTypeWrapper() { }
|
||||
|
||||
// Getter wrapper
|
||||
virtual operator PODType() = 0;
|
||||
|
||||
// Setter wrapper
|
||||
virtual void commitChange(PODType, SVGElement*) = 0;
|
||||
};
|
||||
|
||||
template<typename PODType, typename PODTypeCreator>
|
||||
class JSSVGPODTypeWrapperCreatorReadWrite : public JSSVGPODTypeWrapper<PODType>
|
||||
{
|
||||
public:
|
||||
typedef PODType (PODTypeCreator::*GetterMethod)() const;
|
||||
typedef void (PODTypeCreator::*SetterMethod)(PODType);
|
||||
|
||||
JSSVGPODTypeWrapperCreatorReadWrite(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter)
|
||||
: m_creator(creator)
|
||||
, m_getter(getter)
|
||||
, m_setter(setter)
|
||||
{
|
||||
ASSERT(creator);
|
||||
ASSERT(getter);
|
||||
ASSERT(setter);
|
||||
}
|
||||
|
||||
virtual ~JSSVGPODTypeWrapperCreatorReadWrite() { }
|
||||
|
||||
// Getter wrapper
|
||||
virtual operator PODType() { return (m_creator.get()->*m_getter)(); }
|
||||
|
||||
// Setter wrapper
|
||||
virtual void commitChange(PODType type, SVGElement* context)
|
||||
{
|
||||
if (!m_setter)
|
||||
return;
|
||||
|
||||
(m_creator.get()->*m_setter)(type);
|
||||
|
||||
if (context)
|
||||
context->svgAttributeChanged(m_creator->associatedAttributeName());
|
||||
}
|
||||
|
||||
private:
|
||||
// Update callbacks
|
||||
RefPtr<PODTypeCreator> m_creator;
|
||||
GetterMethod m_getter;
|
||||
SetterMethod m_setter;
|
||||
};
|
||||
|
||||
template<typename PODType>
|
||||
class JSSVGPODTypeWrapperCreatorReadOnly : public JSSVGPODTypeWrapper<PODType>
|
||||
{
|
||||
public:
|
||||
JSSVGPODTypeWrapperCreatorReadOnly(PODType type)
|
||||
: m_podType(type)
|
||||
{ }
|
||||
|
||||
virtual ~JSSVGPODTypeWrapperCreatorReadOnly() { }
|
||||
|
||||
// Getter wrapper
|
||||
virtual operator PODType() { return m_podType; }
|
||||
|
||||
// Setter wrapper
|
||||
virtual void commitChange(PODType type, SVGElement*)
|
||||
{
|
||||
m_podType = type;
|
||||
}
|
||||
|
||||
private:
|
||||
PODType m_podType;
|
||||
};
|
||||
|
||||
template<typename PODType>
|
||||
class JSSVGPODTypeWrapperCreatorForList : public JSSVGPODTypeWrapper<PODType>
|
||||
{
|
||||
public:
|
||||
typedef PODType (SVGPODListItem<PODType>::*GetterMethod)() const;
|
||||
typedef void (SVGPODListItem<PODType>::*SetterMethod)(PODType);
|
||||
|
||||
JSSVGPODTypeWrapperCreatorForList(SVGPODListItem<PODType>* creator, const QualifiedName& attributeName)
|
||||
: m_creator(creator)
|
||||
, m_getter(&SVGPODListItem<PODType>::value)
|
||||
, m_setter(&SVGPODListItem<PODType>::setValue)
|
||||
, m_associatedAttributeName(attributeName)
|
||||
{
|
||||
ASSERT(m_creator);
|
||||
ASSERT(m_getter);
|
||||
ASSERT(m_setter);
|
||||
}
|
||||
|
||||
virtual ~JSSVGPODTypeWrapperCreatorForList() { }
|
||||
|
||||
// Getter wrapper
|
||||
virtual operator PODType() { return (m_creator.get()->*m_getter)(); }
|
||||
|
||||
// Setter wrapper
|
||||
virtual void commitChange(PODType type, SVGElement* context)
|
||||
{
|
||||
if (!m_setter)
|
||||
return;
|
||||
|
||||
(m_creator.get()->*m_setter)(type);
|
||||
|
||||
if (context)
|
||||
context->svgAttributeChanged(m_associatedAttributeName);
|
||||
}
|
||||
|
||||
private:
|
||||
// Update callbacks
|
||||
RefPtr<SVGPODListItem<PODType> > m_creator;
|
||||
GetterMethod m_getter;
|
||||
SetterMethod m_setter;
|
||||
const QualifiedName& m_associatedAttributeName;
|
||||
};
|
||||
|
||||
// Caching facilities
|
||||
template<typename PODType, typename PODTypeCreator>
|
||||
struct PODTypeReadWriteHashInfo {
|
||||
typedef PODType (PODTypeCreator::*GetterMethod)() const;
|
||||
typedef void (PODTypeCreator::*SetterMethod)(PODType);
|
||||
|
||||
// Empty value
|
||||
PODTypeReadWriteHashInfo()
|
||||
: creator(0)
|
||||
, getter(0)
|
||||
, setter(0)
|
||||
{
|
||||
}
|
||||
|
||||
// Deleted value
|
||||
PODTypeReadWriteHashInfo(WTF::HashTableDeletedValueType)
|
||||
: creator(reinterpret_cast<PODTypeCreator*>(-1))
|
||||
{
|
||||
}
|
||||
bool isHashTableDeletedValue() const
|
||||
{
|
||||
return creator == reinterpret_cast<PODTypeCreator*>(-1);
|
||||
}
|
||||
|
||||
PODTypeReadWriteHashInfo(PODTypeCreator* _creator, GetterMethod _getter, SetterMethod _setter)
|
||||
: creator(_creator)
|
||||
, getter(_getter)
|
||||
, setter(_setter)
|
||||
{
|
||||
ASSERT(creator);
|
||||
ASSERT(getter);
|
||||
}
|
||||
|
||||
bool operator==(const PODTypeReadWriteHashInfo& other) const
|
||||
{
|
||||
return creator == other.creator && getter == other.getter && setter == other.setter;
|
||||
}
|
||||
|
||||
PODTypeCreator* creator;
|
||||
GetterMethod getter;
|
||||
SetterMethod setter;
|
||||
};
|
||||
|
||||
template<typename PODType, typename PODTypeCreator>
|
||||
struct PODTypeReadWriteHashInfoHash {
|
||||
static unsigned hash(const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& info)
|
||||
{
|
||||
return StringImpl::computeHash(reinterpret_cast<const WebCore::UChar*>(&info), sizeof(PODTypeReadWriteHashInfo<PODType, PODTypeCreator>) / sizeof(WebCore::UChar));
|
||||
}
|
||||
|
||||
static bool equal(const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& a, const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& b)
|
||||
{
|
||||
return a == b;
|
||||
}
|
||||
|
||||
static const bool safeToCompareToEmptyOrDeleted = true;
|
||||
};
|
||||
|
||||
template<typename PODType, typename PODTypeCreator>
|
||||
struct PODTypeReadWriteHashInfoTraits : WTF::GenericHashTraits<PODTypeReadWriteHashInfo<PODType, PODTypeCreator> > {
|
||||
static const bool emptyValueIsZero = true;
|
||||
static const bool needsDestruction = false;
|
||||
|
||||
static const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& emptyValue()
|
||||
{
|
||||
static PODTypeReadWriteHashInfo<PODType, PODTypeCreator> key;
|
||||
return key;
|
||||
}
|
||||
|
||||
static void constructDeletedValue(PODTypeReadWriteHashInfo<PODType, PODTypeCreator>* slot)
|
||||
{
|
||||
new (slot) PODTypeReadWriteHashInfo<PODType, PODTypeCreator>(WTF::HashTableDeletedValue);
|
||||
}
|
||||
static bool isDeletedValue(const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& value)
|
||||
{
|
||||
return value.isHashTableDeletedValue();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename PODType, typename PODTypeCreator>
|
||||
class JSSVGPODTypeWrapperCache
|
||||
{
|
||||
public:
|
||||
typedef PODType (PODTypeCreator::*GetterMethod)() const;
|
||||
typedef void (PODTypeCreator::*SetterMethod)(PODType);
|
||||
|
||||
typedef HashMap<PODTypeReadWriteHashInfo<PODType, PODTypeCreator>, JSSVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>*, PODTypeReadWriteHashInfoHash<PODType, PODTypeCreator>, PODTypeReadWriteHashInfoTraits<PODType, PODTypeCreator> > ReadWriteHashMap;
|
||||
typedef typename ReadWriteHashMap::const_iterator ReadWriteHashMapIterator;
|
||||
|
||||
static ReadWriteHashMap& readWriteHashMap()
|
||||
{
|
||||
static ReadWriteHashMap _readWriteHashMap;
|
||||
return _readWriteHashMap;
|
||||
}
|
||||
|
||||
// Used for readwrite attributes only
|
||||
static JSSVGPODTypeWrapper<PODType>* lookupOrCreateWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter)
|
||||
{
|
||||
ReadWriteHashMap& map(readWriteHashMap());
|
||||
PODTypeReadWriteHashInfo<PODType, PODTypeCreator> info(creator, getter, setter);
|
||||
|
||||
if (map.contains(info))
|
||||
return map.get(info);
|
||||
|
||||
JSSVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>* wrapper = new JSSVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>(creator, getter, setter);
|
||||
map.set(info, wrapper);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
static void forgetWrapper(JSSVGPODTypeWrapper<PODType>* wrapper)
|
||||
{
|
||||
ReadWriteHashMap& map(readWriteHashMap());
|
||||
|
||||
ReadWriteHashMapIterator it = map.begin();
|
||||
ReadWriteHashMapIterator end = map.end();
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if (it->second != wrapper)
|
||||
continue;
|
||||
|
||||
// It's guaruanteed that there's just one object we need to take care of.
|
||||
map.remove(it->first);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif // ENABLE(SVG)
|
||||
#endif // JSSVGPODTypeWrapper_h
|
|
@ -1,117 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2006 Nikolas Zimmermann <zimmermann@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 "config.h"
|
||||
#include "wtf/Platform.h"
|
||||
|
||||
#if ENABLE(SVG)
|
||||
#include "JSSVGPathSeg.h"
|
||||
#include "JSSVGPathSegArcAbs.h"
|
||||
#include "JSSVGPathSegArcRel.h"
|
||||
#include "JSSVGPathSegClosePath.h"
|
||||
#include "JSSVGPathSegCurvetoCubicAbs.h"
|
||||
#include "JSSVGPathSegCurvetoCubicRel.h"
|
||||
#include "JSSVGPathSegCurvetoCubicSmoothAbs.h"
|
||||
#include "JSSVGPathSegCurvetoCubicSmoothRel.h"
|
||||
#include "JSSVGPathSegCurvetoQuadraticAbs.h"
|
||||
#include "JSSVGPathSegCurvetoQuadraticRel.h"
|
||||
#include "JSSVGPathSegCurvetoQuadraticSmoothAbs.h"
|
||||
#include "JSSVGPathSegCurvetoQuadraticSmoothRel.h"
|
||||
#include "JSSVGPathSegLinetoAbs.h"
|
||||
#include "JSSVGPathSegLinetoRel.h"
|
||||
#include "JSSVGPathSegLinetoHorizontalAbs.h"
|
||||
#include "JSSVGPathSegLinetoHorizontalRel.h"
|
||||
#include "JSSVGPathSegLinetoVerticalAbs.h"
|
||||
#include "JSSVGPathSegLinetoVerticalRel.h"
|
||||
#include "JSSVGPathSegMovetoAbs.h"
|
||||
#include "JSSVGPathSegMovetoRel.h"
|
||||
|
||||
#include "kjs_binding.h"
|
||||
|
||||
#include "SVGPathSeg.h"
|
||||
#include "SVGPathSegArc.h"
|
||||
#include "SVGPathSegClosePath.h"
|
||||
#include "SVGPathSegCurvetoCubic.h"
|
||||
#include "SVGPathSegCurvetoCubicSmooth.h"
|
||||
#include "SVGPathSegCurvetoQuadratic.h"
|
||||
#include "SVGPathSegCurvetoQuadraticSmooth.h"
|
||||
#include "SVGPathSegLineto.h"
|
||||
#include "SVGPathSegLinetoHorizontal.h"
|
||||
#include "SVGPathSegLinetoVertical.h"
|
||||
#include "SVGPathSegMoveto.h"
|
||||
|
||||
using namespace KJS;
|
||||
|
||||
namespace khtml {
|
||||
|
||||
JSValue* toJS(ExecState* exec, SVGPathSeg* obj, SVGElement* context)
|
||||
{
|
||||
if (!obj)
|
||||
return jsNull();
|
||||
|
||||
switch (obj->pathSegType()) {
|
||||
case SVGPathSeg::PATHSEG_CLOSEPATH:
|
||||
return cacheSVGDOMObject<SVGPathSegClosePath, JSSVGPathSegClosePath, JSSVGPathSegClosePathPrototype>(exec, static_cast<SVGPathSegClosePath*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_MOVETO_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegMovetoAbs, JSSVGPathSegMovetoAbs, JSSVGPathSegMovetoAbsPrototype>(exec, static_cast<SVGPathSegMovetoAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_MOVETO_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegMovetoRel, JSSVGPathSegMovetoRel, JSSVGPathSegMovetoRelPrototype>(exec, static_cast<SVGPathSegMovetoRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_LINETO_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegLinetoAbs, JSSVGPathSegLinetoAbs, JSSVGPathSegLinetoAbsPrototype>(exec, static_cast<SVGPathSegLinetoAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_LINETO_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegLinetoRel, JSSVGPathSegLinetoRel, JSSVGPathSegLinetoRelPrototype>(exec, static_cast<SVGPathSegLinetoRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegCurvetoCubicAbs, JSSVGPathSegCurvetoCubicAbs, JSSVGPathSegCurvetoCubicAbsPrototype>(exec, static_cast<SVGPathSegCurvetoCubicAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegCurvetoCubicRel, JSSVGPathSegCurvetoCubicRel, JSSVGPathSegCurvetoCubicRelPrototype>(exec, static_cast<SVGPathSegCurvetoCubicRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticAbs, JSSVGPathSegCurvetoQuadraticAbs, JSSVGPathSegCurvetoQuadraticAbsPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticRel, JSSVGPathSegCurvetoQuadraticRel, JSSVGPathSegCurvetoQuadraticRelPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_ARC_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegArcAbs, JSSVGPathSegArcAbs, JSSVGPathSegArcAbsPrototype>(exec, static_cast<SVGPathSegArcAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_ARC_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegArcRel, JSSVGPathSegArcRel, JSSVGPathSegArcRelPrototype>(exec, static_cast<SVGPathSegArcRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegLinetoHorizontalAbs, JSSVGPathSegLinetoHorizontalAbs, JSSVGPathSegLinetoHorizontalAbsPrototype>(exec, static_cast<SVGPathSegLinetoHorizontalAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegLinetoHorizontalRel, JSSVGPathSegLinetoHorizontalRel, JSSVGPathSegLinetoHorizontalRelPrototype>(exec, static_cast<SVGPathSegLinetoHorizontalRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegLinetoVerticalAbs, JSSVGPathSegLinetoVerticalAbs, JSSVGPathSegLinetoVerticalAbsPrototype>(exec, static_cast<SVGPathSegLinetoVerticalAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegLinetoVerticalRel, JSSVGPathSegLinetoVerticalRel, JSSVGPathSegLinetoVerticalRelPrototype>(exec, static_cast<SVGPathSegLinetoVerticalRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegCurvetoCubicSmoothAbs, JSSVGPathSegCurvetoCubicSmoothAbs, JSSVGPathSegCurvetoCubicSmoothAbsPrototype>(exec, static_cast<SVGPathSegCurvetoCubicSmoothAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegCurvetoCubicSmoothRel, JSSVGPathSegCurvetoCubicSmoothRel, JSSVGPathSegCurvetoCubicSmoothRelPrototype>(exec, static_cast<SVGPathSegCurvetoCubicSmoothRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
|
||||
return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticSmoothAbs, JSSVGPathSegCurvetoQuadraticSmoothAbs, JSSVGPathSegCurvetoQuadraticSmoothAbsPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticSmoothAbs*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
|
||||
return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticSmoothRel, JSSVGPathSegCurvetoQuadraticSmoothRel, JSSVGPathSegCurvetoQuadraticSmoothRelPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticSmoothRel*>(obj), context);
|
||||
case SVGPathSeg::PATHSEG_UNKNOWN:
|
||||
default:
|
||||
return cacheSVGDOMObject<SVGPathSeg, JSSVGPathSeg, JSSVGPathSegPrototype>(exec, obj, context);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // ENABLE(SVG)
|
||||
|
||||
// vim:ts=4:noet
|
|
@ -1,168 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@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 "config.h"
|
||||
#include "wtf/Platform.h"
|
||||
|
||||
#if ENABLE(SVG)
|
||||
#include "JSSVGPathSegList.h"
|
||||
|
||||
#include "Document.h"
|
||||
#include "Frame.h"
|
||||
#include "JSSVGPathSeg.h"
|
||||
#include "SVGDocumentExtensions.h"
|
||||
#include "SVGElement.h"
|
||||
#include "SVGPathSegList.h"
|
||||
|
||||
#include <wtf/Assertions.h>
|
||||
|
||||
using namespace KJS;
|
||||
using namespace DOM;
|
||||
|
||||
namespace khtml {
|
||||
|
||||
KJS::JSValue* JSSVGPathSegList::clear(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
|
||||
SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
|
||||
imp->clear(ec);
|
||||
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
KJS::JSValue* JSSVGPathSegList::initialize(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
SVGPathSeg* newItem = toSVGPathSeg(args[0]);
|
||||
|
||||
SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
|
||||
|
||||
SVGPathSeg* obj = WTF::getPtr(imp->initialize(newItem, ec));
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj, m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
return result;
|
||||
}
|
||||
|
||||
KJS::JSValue* JSSVGPathSegList::getItem(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
|
||||
bool indexOk;
|
||||
unsigned index = args[0]->toInt32(exec, indexOk);
|
||||
if (!indexOk) {
|
||||
setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
|
||||
SVGPathSeg* obj = WTF::getPtr(imp->getItem(index, ec));
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj, m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
return result;
|
||||
}
|
||||
|
||||
KJS::JSValue* JSSVGPathSegList::insertItemBefore(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
SVGPathSeg* newItem = toSVGPathSeg(args[0]);
|
||||
|
||||
bool indexOk;
|
||||
unsigned index = args[1]->toInt32(exec, indexOk);
|
||||
if (!indexOk) {
|
||||
setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->insertItemBefore(newItem, index, ec)), m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
return result;
|
||||
}
|
||||
|
||||
KJS::JSValue* JSSVGPathSegList::replaceItem(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
SVGPathSeg* newItem = toSVGPathSeg(args[0]);
|
||||
|
||||
bool indexOk;
|
||||
unsigned index = args[1]->toInt32(exec, indexOk);
|
||||
if (!indexOk) {
|
||||
setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->replaceItem(newItem, index, ec)), m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
return result;
|
||||
}
|
||||
|
||||
KJS::JSValue* JSSVGPathSegList::removeItem(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
|
||||
bool indexOk;
|
||||
unsigned index = args[0]->toInt32(exec, indexOk);
|
||||
if (!indexOk) {
|
||||
setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
|
||||
|
||||
RefPtr<SVGPathSeg> obj(imp->removeItem(index, ec));
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj.get(), m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
return result;
|
||||
}
|
||||
|
||||
KJS::JSValue* JSSVGPathSegList::appendItem(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
SVGPathSeg* newItem = toSVGPathSeg(args[0]);
|
||||
|
||||
SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->appendItem(newItem, ec)), m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // ENABLE(SVG)
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@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 "config.h"
|
||||
#include "wtf/Platform.h"
|
||||
|
||||
#if ENABLE(SVG)
|
||||
#include "JSSVGTransformList.h"
|
||||
|
||||
#include "Document.h"
|
||||
#include "Frame.h"
|
||||
#include "JSSVGTransform.h"
|
||||
#include "SVGDocumentExtensions.h"
|
||||
#include "SVGTransformList.h"
|
||||
#include "SVGStyledElement.h"
|
||||
|
||||
#include <wtf/Assertions.h>
|
||||
|
||||
using namespace KJS;
|
||||
using namespace WebCore;
|
||||
|
||||
namespace khtml {
|
||||
|
||||
JSValue* JSSVGTransformList::clear(ExecState* exec, const List&)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
|
||||
SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
|
||||
imp->clear(ec);
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
JSValue* JSSVGTransformList::initialize(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
SVGTransform newItem = toSVGTransform(args[0]);
|
||||
|
||||
SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
|
||||
SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
|
||||
|
||||
SVGPODListItem<SVGTransform>* listItem = listImp->initialize(SVGPODListItem<SVGTransform>::copy(newItem), ec).get();
|
||||
JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj, m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValue* JSSVGTransformList::getItem(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
|
||||
bool indexOk;
|
||||
unsigned index = args[0]->toInt32(exec, indexOk);
|
||||
if (!indexOk) {
|
||||
setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
|
||||
SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
|
||||
|
||||
SVGPODListItem<SVGTransform>* listItem = listImp->getItem(index, ec).get();
|
||||
JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj, m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValue* JSSVGTransformList::insertItemBefore(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
SVGTransform newItem = toSVGTransform(args[0]);
|
||||
|
||||
bool indexOk;
|
||||
unsigned index = args[1]->toInt32(exec, indexOk);
|
||||
if (!indexOk) {
|
||||
setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
|
||||
SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
|
||||
|
||||
SVGPODListItem<SVGTransform>* listItem = listImp->insertItemBefore(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get();
|
||||
JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj, m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValue* JSSVGTransformList::replaceItem(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
SVGTransform newItem = toSVGTransform(args[0]);
|
||||
|
||||
bool indexOk;
|
||||
unsigned index = args[1]->toInt32(exec, indexOk);
|
||||
if (!indexOk) {
|
||||
setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
|
||||
SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
|
||||
|
||||
SVGPODListItem<SVGTransform>* listItem = listImp->replaceItem(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get();
|
||||
JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj, m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValue* JSSVGTransformList::removeItem(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
|
||||
bool indexOk;
|
||||
unsigned index = args[0]->toInt32(exec, indexOk);
|
||||
if (!indexOk) {
|
||||
setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
|
||||
return jsUndefined();
|
||||
}
|
||||
|
||||
SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
|
||||
SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
|
||||
|
||||
RefPtr<SVGPODListItem<SVGTransform> > listItem(listImp->removeItem(index, ec));
|
||||
JSSVGPODTypeWrapper<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorReadOnly<SVGTransform>(*listItem.get());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj, m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValue* JSSVGTransformList::appendItem(ExecState* exec, const List& args)
|
||||
{
|
||||
ExceptionCode ec = 0;
|
||||
SVGTransform newItem = toSVGTransform(args[0]);
|
||||
|
||||
SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
|
||||
SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
|
||||
|
||||
SVGPODListItem<SVGTransform>* listItem = listImp->appendItem(SVGPODListItem<SVGTransform>::copy(newItem), ec).get();
|
||||
JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
|
||||
|
||||
KJS::JSValue* result = toJS(exec, obj, m_context.get());
|
||||
setDOMException(exec, ec);
|
||||
|
||||
m_context->svgAttributeChanged(imp->associatedAttributeName());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // ENABLE(SVG)
|
|
@ -1,382 +0,0 @@
|
|||
#
|
||||
# WebKit IDL parser
|
||||
#
|
||||
# Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
|
||||
# Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
|
||||
# Copyright (C) 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
|
||||
# aint 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.
|
||||
#
|
||||
|
||||
package CodeGenerator;
|
||||
|
||||
my $useDocument = "";
|
||||
my $useGenerator = "";
|
||||
my $useOutputDir = "";
|
||||
my $useDirectories = "";
|
||||
my $useLayerOnTop = 0;
|
||||
my $preprocessor;
|
||||
|
||||
my $codeGenerator = 0;
|
||||
|
||||
my $verbose = 0;
|
||||
|
||||
my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1,
|
||||
"unsigned int" => 1, "unsigned short" => 1,
|
||||
"unsigned long" => 1, "float" => 1,
|
||||
"double" => 1, "boolean" => 1, "void" => 1);
|
||||
|
||||
my %podTypeHash = ("RGBColor" => 1, "SVGLength" => 1, "SVGPoint" => 1, "SVGRect" => 1, "SVGNumber" => 1, "SVGMatrix" => 1, "SVGTransform" => 1);
|
||||
|
||||
my %stringTypeHash = ("DOMString" => 1, "AtomicString" => 1);
|
||||
|
||||
my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1, "SVGPaintType" => 1);
|
||||
|
||||
my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1,
|
||||
"SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" => 1,
|
||||
"SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1,
|
||||
"SVGAnimatedNumber" => 1, "SVGAnimatedNumberList" => 1,
|
||||
"SVGAnimatedPreserveAspectRatio" => 1,
|
||||
"SVGAnimatedRect" => 1, "SVGAnimatedString" => 1,
|
||||
"SVGAnimatedTransformList" => 1);
|
||||
|
||||
# Helpers for 'ScanDirectory'
|
||||
my $endCondition = 0;
|
||||
my $foundFilename = "";
|
||||
my @foundFilenames = ();
|
||||
my $ignoreParent = 1;
|
||||
my $defines = "";
|
||||
|
||||
# Default constructor
|
||||
sub new
|
||||
{
|
||||
my $object = shift;
|
||||
my $reference = { };
|
||||
|
||||
$useDirectories = shift;
|
||||
$useGenerator = shift;
|
||||
$useOutputDir = shift;
|
||||
$useLayerOnTop = shift;
|
||||
$preprocessor = shift;
|
||||
|
||||
bless($reference, $object);
|
||||
return $reference;
|
||||
}
|
||||
|
||||
sub StripModule($)
|
||||
{
|
||||
my $object = shift;
|
||||
my $name = shift;
|
||||
$name =~ s/[a-zA-Z0-9]*:://;
|
||||
return $name;
|
||||
}
|
||||
|
||||
sub ProcessDocument
|
||||
{
|
||||
my $object = shift;
|
||||
$useDocument = shift;
|
||||
$defines = shift;
|
||||
|
||||
my $ifaceName = "CodeGenerator" . $useGenerator;
|
||||
|
||||
# Dynamically load external code generation perl module
|
||||
require $ifaceName . ".pm";
|
||||
$codeGenerator = $ifaceName->new($object, $useOutputDir, $useLayerOnTop, $preprocessor);
|
||||
unless (defined($codeGenerator)) {
|
||||
my $classes = $useDocument->classes;
|
||||
foreach my $class (@$classes) {
|
||||
print "Skipping $useGenerator code generation for IDL interface \"" . $class->name . "\".\n" if $verbose;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
# Start the actual code generation!
|
||||
$codeGenerator->GenerateModule($useDocument, $defines);
|
||||
|
||||
my $classes = $useDocument->classes;
|
||||
foreach my $class (@$classes) {
|
||||
print "Generating $useGenerator bindings code for IDL interface \"" . $class->name . "\"...\n" if $verbose;
|
||||
$codeGenerator->GenerateInterface($class, $defines);
|
||||
}
|
||||
|
||||
$codeGenerator->finish();
|
||||
}
|
||||
|
||||
sub AddMethodsConstantsAndAttributesFromParentClasses
|
||||
{
|
||||
# For the passed interface, recursively parse all parent
|
||||
# IDLs in order to find out all inherited properties/methods.
|
||||
|
||||
my $object = shift;
|
||||
my $dataNode = shift;
|
||||
|
||||
my @parents = @{$dataNode->parents};
|
||||
my $parentsMax = @{$dataNode->parents};
|
||||
|
||||
my $constantsRef = $dataNode->constants;
|
||||
my $functionsRef = $dataNode->functions;
|
||||
my $attributesRef = $dataNode->attributes;
|
||||
|
||||
# Exception: For the DOM 'Node' is our topmost baseclass, not EventTargetNode.
|
||||
return if $parentsMax eq 1 and $parents[0] eq "EventTargetNode";
|
||||
|
||||
foreach (@{$dataNode->parents}) {
|
||||
if ($ignoreParent) {
|
||||
# Ignore first parent class, already handled by the generation itself.
|
||||
$ignoreParent = 0;
|
||||
next;
|
||||
}
|
||||
|
||||
my $interface = $object->StripModule($_);
|
||||
|
||||
# Step #1: Find the IDL file associated with 'interface'
|
||||
$endCondition = 0;
|
||||
$foundFilename = "";
|
||||
|
||||
foreach (@{$useDirectories}) {
|
||||
$object->ScanDirectory("$interface.idl", $_, $_, 0) if ($foundFilename eq "");
|
||||
}
|
||||
|
||||
if ($foundFilename ne "") {
|
||||
print " | |> Parsing parent IDL \"$foundFilename\" for interface \"$interface\"\n" if $verbose;
|
||||
|
||||
# Step #2: Parse the found IDL file (in quiet mode).
|
||||
my $parser = IDLParser->new(1);
|
||||
my $document = $parser->Parse($foundFilename, $defines, $preprocessor);
|
||||
|
||||
foreach my $class (@{$document->classes}) {
|
||||
# Step #3: Enter recursive parent search
|
||||
AddMethodsConstantsAndAttributesFromParentClasses($object, $class);
|
||||
|
||||
# Step #4: Collect constants & functions & attributes of this parent-class
|
||||
my $constantsMax = @{$class->constants};
|
||||
my $functionsMax = @{$class->functions};
|
||||
my $attributesMax = @{$class->attributes};
|
||||
|
||||
print " | |> -> Inheriting $constantsMax constants, $functionsMax functions, $attributesMax attributes...\n | |>\n" if $verbose;
|
||||
|
||||
# Step #5: Concatenate data
|
||||
push(@$constantsRef, $_) foreach (@{$class->constants});
|
||||
push(@$functionsRef, $_) foreach (@{$class->functions});
|
||||
push(@$attributesRef, $_) foreach (@{$class->attributes});
|
||||
}
|
||||
} else {
|
||||
die("Could NOT find specified parent interface \"$interface\"!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub GetMethodsAndAttributesFromParentClasses
|
||||
{
|
||||
# For the passed interface, recursively parse all parent
|
||||
# IDLs in order to find out all inherited properties/methods.
|
||||
|
||||
my $object = shift;
|
||||
my $dataNode = shift;
|
||||
|
||||
my @parents = @{$dataNode->parents};
|
||||
|
||||
return if @{$dataNode->parents} == 0;
|
||||
|
||||
my @parentList = ();
|
||||
|
||||
foreach (@{$dataNode->parents}) {
|
||||
my $interface = $object->StripModule($_);
|
||||
if ($interface eq "EventTargetNode") {
|
||||
$interface = "Node";
|
||||
}
|
||||
|
||||
# Step #1: Find the IDL file associated with 'interface'
|
||||
$endCondition = 0;
|
||||
$foundFilename = "";
|
||||
|
||||
foreach (@{$useDirectories}) {
|
||||
$object->ScanDirectory("${interface}.idl", $_, $_, 0) if $foundFilename eq "";
|
||||
}
|
||||
|
||||
die("Could NOT find specified parent interface \"$interface\"!\n") if $foundFilename eq "";
|
||||
|
||||
print " | |> Parsing parent IDL \"$foundFilename\" for interface \"$interface\"\n" if $verbose;
|
||||
|
||||
# Step #2: Parse the found IDL file (in quiet mode).
|
||||
my $parser = IDLParser->new(1);
|
||||
my $document = $parser->Parse($foundFilename, $defines);
|
||||
|
||||
foreach my $class (@{$document->classes}) {
|
||||
# Step #3: Enter recursive parent search
|
||||
push(@parentList, GetMethodsAndAttributesFromParentClasses($object, $class));
|
||||
|
||||
# Step #4: Collect constants & functions & attributes of this parent-class
|
||||
|
||||
# print " | |> -> Inheriting $functionsMax functions amd $attributesMax attributes...\n | |>\n" if $verbose;
|
||||
my $hash = {
|
||||
"name" => $class->name,
|
||||
"functions" => $class->functions,
|
||||
"attributes" => $class->attributes
|
||||
};
|
||||
|
||||
# Step #5: Concatenate data
|
||||
unshift(@parentList, $hash);
|
||||
}
|
||||
}
|
||||
|
||||
return @parentList;
|
||||
}
|
||||
|
||||
sub ParseInterface
|
||||
{
|
||||
my ($object, $interfaceName) = @_;
|
||||
|
||||
# Step #1: Find the IDL file associated with 'interface'
|
||||
$endCondition = 0;
|
||||
$foundFilename = "";
|
||||
|
||||
foreach (@{$useDirectories}) {
|
||||
$object->ScanDirectory("${interfaceName}.idl", $_, $_, 0) if $foundFilename eq "";
|
||||
}
|
||||
die "Could NOT find specified parent interface \"$interfaceName\"!\n" if $foundFilename eq "";
|
||||
|
||||
print " | |> Parsing parent IDL \"$foundFilename\" for interface \"$interfaceName\"\n" if $verbose;
|
||||
|
||||
# Step #2: Parse the found IDL file (in quiet mode).
|
||||
my $parser = IDLParser->new(1);
|
||||
my $document = $parser->Parse($foundFilename, $defines);
|
||||
|
||||
foreach my $interface (@{$document->classes}) {
|
||||
return $interface if $interface->name eq $interfaceName;
|
||||
}
|
||||
|
||||
die "Interface definition not found";
|
||||
}
|
||||
|
||||
# Helpers for all CodeGenerator***.pm modules
|
||||
sub IsPodType
|
||||
{
|
||||
my $object = shift;
|
||||
my $type = shift;
|
||||
|
||||
return 1 if $podTypeHash{$type};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub IsPrimitiveType
|
||||
{
|
||||
my $object = shift;
|
||||
my $type = shift;
|
||||
|
||||
return 1 if $primitiveTypeHash{$type};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub IsStringType
|
||||
{
|
||||
my $object = shift;
|
||||
my $type = shift;
|
||||
|
||||
return 1 if $stringTypeHash{$type};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub IsNonPointerType
|
||||
{
|
||||
my $object = shift;
|
||||
my $type = shift;
|
||||
|
||||
return 1 if $nonPointerTypeHash{$type} or $primitiveTypeHash{$type};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub IsSVGAnimatedType
|
||||
{
|
||||
my $object = shift;
|
||||
my $type = shift;
|
||||
|
||||
return 1 if $svgAnimatedTypeHash{$type};
|
||||
return 0;
|
||||
}
|
||||
|
||||
# Internal Helper
|
||||
sub ScanDirectory
|
||||
{
|
||||
my $object = shift;
|
||||
|
||||
my $interface = shift;
|
||||
my $directory = shift;
|
||||
my $useDirectory = shift;
|
||||
my $reportAllFiles = shift;
|
||||
|
||||
return if ($endCondition eq 1) and ($reportAllFiles eq 0);
|
||||
|
||||
my $sourceRoot = $ENV{SOURCE_ROOT};
|
||||
my $thisDir = $sourceRoot ? "$sourceRoot/$directory" : $directory;
|
||||
|
||||
if (!opendir(DIR, $thisDir)) {
|
||||
opendir(DIR, $directory) or die "[ERROR] Can't open directory $thisDir or $directory: \"$!\"\n";
|
||||
$thisDir = $directory;
|
||||
}
|
||||
|
||||
my @names = readdir(DIR) or die "[ERROR] Cant't read directory $thisDir \"$!\"\n";
|
||||
closedir(DIR);
|
||||
|
||||
foreach my $name (@names) {
|
||||
# Skip if we already found the right file or
|
||||
# if we encounter 'exotic' stuff (ie. '.', '..', '.svn')
|
||||
next if ($endCondition eq 1) or ($name =~ /^\./);
|
||||
|
||||
# Recurisvely enter directory
|
||||
if (-d "$thisDir/$name") {
|
||||
$object->ScanDirectory($interface, "$directory/$name", $useDirectory, $reportAllFiles);
|
||||
next;
|
||||
}
|
||||
|
||||
# Check wheter we found the desired file
|
||||
my $condition = ($name eq $interface);
|
||||
$condition = 1 if ($interface eq "allidls") and ($name =~ /\.idl$/);
|
||||
|
||||
if ($condition) {
|
||||
$foundFilename = "$thisDir/$name";
|
||||
|
||||
if ($reportAllFiles eq 0) {
|
||||
$endCondition = 1;
|
||||
} else {
|
||||
push(@foundFilenames, $foundFilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Uppercase the first letter while respecting WebKit style guidelines.
|
||||
# E.g., xmlEncoding becomes XMLEncoding, but xmlllang becomes Xmllang.
|
||||
sub WK_ucfirst
|
||||
{
|
||||
my ($object, $param) = @_;
|
||||
my $ret = ucfirst($param);
|
||||
$ret =~ s/Xml/XML/ if $ret =~ /^Xml[^a-z]/;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
# Lowercase the first letter while respecting WebKit style guidelines.
|
||||
# URL becomes url, but SetURL becomes setURL.
|
||||
sub WK_lcfirst
|
||||
{
|
||||
my ($object, $param) = @_;
|
||||
my $ret = lcfirst($param);
|
||||
$ret =~ s/uRL/url/ if $ret =~ /^uRL/;
|
||||
$ret =~ s/jS/js/ if $ret =~ /^jS/;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
1;
|
File diff suppressed because it is too large
Load diff
|
@ -1,416 +0,0 @@
|
|||
#
|
||||
# KDOM IDL parser
|
||||
#
|
||||
# Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
|
||||
#
|
||||
# This file is part of the KDE project
|
||||
#
|
||||
# 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
|
||||
# aint 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.
|
||||
#
|
||||
|
||||
package IDLParser;
|
||||
|
||||
use IPC::Open2;
|
||||
use IDLStructure;
|
||||
|
||||
use constant MODE_UNDEF => 0; # Default mode.
|
||||
|
||||
use constant MODE_MODULE => 10; # 'module' section
|
||||
use constant MODE_INTERFACE => 11; # 'interface' section
|
||||
use constant MODE_EXCEPTION => 12; # 'exception' section
|
||||
use constant MODE_ALIAS => 13; # 'alias' section
|
||||
|
||||
# Helper variables
|
||||
my @temporaryContent = "";
|
||||
|
||||
my $parseMode = MODE_UNDEF;
|
||||
my $preservedParseMode = MODE_UNDEF;
|
||||
|
||||
my $beQuiet; # Should not display anything on STDOUT?
|
||||
my $document = 0; # Will hold the resulting 'idlDocument'
|
||||
|
||||
# Default Constructor
|
||||
sub new
|
||||
{
|
||||
my $object = shift;
|
||||
my $reference = { };
|
||||
|
||||
$document = 0;
|
||||
$beQuiet = shift;
|
||||
|
||||
bless($reference, $object);
|
||||
return $reference;
|
||||
}
|
||||
|
||||
# Returns the parsed 'idlDocument'
|
||||
sub Parse
|
||||
{
|
||||
my $object = shift;
|
||||
my $fileName = shift;
|
||||
my $defines = shift;
|
||||
my $preprocessor = shift;
|
||||
|
||||
if (!$preprocessor) {
|
||||
$preprocessor = "/usr/bin/gcc -E -P -x c++";
|
||||
}
|
||||
|
||||
if (!$defines) {
|
||||
$defines = "";
|
||||
}
|
||||
|
||||
print " | *** Starting to parse $fileName...\n |\n" unless $beQuiet;
|
||||
|
||||
open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName);
|
||||
close PP_IN;
|
||||
my @documentContent = <PP_OUT>;
|
||||
close PP_OUT;
|
||||
|
||||
my $dataAvailable = 0;
|
||||
|
||||
# Simple IDL Parser (tm)
|
||||
foreach (@documentContent) {
|
||||
my $newParseMode = $object->DetermineParseMode($_);
|
||||
|
||||
if ($newParseMode ne MODE_UNDEF) {
|
||||
if ($dataAvailable eq 0) {
|
||||
$dataAvailable = 1; # Start node building...
|
||||
} else {
|
||||
$object->ProcessSection();
|
||||
}
|
||||
}
|
||||
|
||||
# Update detected data stream mode...
|
||||
if ($newParseMode ne MODE_UNDEF) {
|
||||
$parseMode = $newParseMode;
|
||||
}
|
||||
|
||||
push(@temporaryContent, $_);
|
||||
}
|
||||
|
||||
# Check if there is anything remaining to parse...
|
||||
if (($parseMode ne MODE_UNDEF) and ($#temporaryContent > 0)) {
|
||||
$object->ProcessSection();
|
||||
}
|
||||
|
||||
print " | *** Finished parsing!\n" unless $beQuiet;
|
||||
|
||||
$document->fileName($fileName);
|
||||
|
||||
return $document;
|
||||
}
|
||||
|
||||
sub ParseModule
|
||||
{
|
||||
my $object = shift;
|
||||
my $dataNode = shift;
|
||||
|
||||
print " |- Trying to parse module...\n" unless $beQuiet;
|
||||
|
||||
my $data = join("", @temporaryContent);
|
||||
$data =~ /$IDLStructure::moduleSelector/;
|
||||
|
||||
my $moduleName = (defined($1) ? $1 : die("Parsing error!\nSource:\n$data\n)"));
|
||||
$dataNode->module($moduleName);
|
||||
|
||||
print " |----> Module; NAME \"$moduleName\"\n |-\n |\n" unless $beQuiet;
|
||||
}
|
||||
|
||||
sub dumpExtendedAttributes
|
||||
{
|
||||
my $padStr = shift;
|
||||
my $attrs = shift;
|
||||
|
||||
if (!%{$attrs}) {
|
||||
return "";
|
||||
}
|
||||
|
||||
my @temp;
|
||||
while (($name, $value) = each(%{$attrs})) {
|
||||
push(@temp, "$name=$value");
|
||||
}
|
||||
|
||||
return $padStr . "[" . join(", ", @temp) . "]";
|
||||
}
|
||||
|
||||
sub parseExtendedAttributes
|
||||
{
|
||||
my $str = shift;
|
||||
$str =~ s/\[\s*(.*?)\s*\]/$1/g;
|
||||
|
||||
my %attrs = ();
|
||||
|
||||
foreach my $value (split(/\s*,\s*/, $str)) {
|
||||
($name,$value) = split(/\s*=\s*/, $value, 2);
|
||||
|
||||
# Attributes with no value are set to be true
|
||||
$value = 1 unless defined $value;
|
||||
$attrs{$name} = $value;
|
||||
}
|
||||
|
||||
return \%attrs;
|
||||
}
|
||||
|
||||
sub ParseInterface
|
||||
{
|
||||
my $object = shift;
|
||||
my $dataNode = shift;
|
||||
my $sectionName = shift;
|
||||
|
||||
my $data = join("", @temporaryContent);
|
||||
|
||||
# Look for end-of-interface mark
|
||||
$data =~ /};/g;
|
||||
$data = substr($data, index($data, $sectionName), pos($data) - length($data));
|
||||
|
||||
$data =~ s/[\n\r]/ /g;
|
||||
|
||||
# Beginning of the regexp parsing magic
|
||||
if ($sectionName eq "exception") {
|
||||
print " |- Trying to parse exception...\n" unless $beQuiet;
|
||||
|
||||
my $exceptionName = "";
|
||||
my $exceptionData = "";
|
||||
my $exceptionDataName = "";
|
||||
my $exceptionDataType = "";
|
||||
|
||||
# Match identifier of the exception, and enclosed data...
|
||||
$data =~ /$IDLStructure::exceptionSelector/;
|
||||
$exceptionName = (defined($1) ? $1 : die("Parsing error!\nSource:\n$data\n)"));
|
||||
$exceptionData = (defined($2) ? $2 : die("Parsing error!\nSource:\n$data\n)"));
|
||||
|
||||
('' =~ /^/); # Reset variables needed for regexp matching
|
||||
|
||||
# ... parse enclosed data (get. name & type)
|
||||
$exceptionData =~ /$IDLStructure::exceptionSubSelector/;
|
||||
$exceptionDataType = (defined($1) ? $1 : die("Parsing error!\nSource:\n$data\n)"));
|
||||
$exceptionDataName = (defined($2) ? $2 : die("Parsing error!\nSource:\n$data\n)"));
|
||||
|
||||
# Fill in domClass datastructure
|
||||
$dataNode->name($exceptionName);
|
||||
|
||||
my $newDataNode = new domAttribute();
|
||||
$newDataNode->type("readonly attribute");
|
||||
$newDataNode->signature(new domSignature());
|
||||
|
||||
$newDataNode->signature->name($exceptionDataName);
|
||||
$newDataNode->signature->type($exceptionDataType);
|
||||
|
||||
my $arrayRef = $dataNode->attributes;
|
||||
push(@$arrayRef, $newDataNode);
|
||||
|
||||
print " |----> Exception; NAME \"$exceptionName\" DATA TYPE \"$exceptionDataType\" DATA NAME \"$exceptionDataName\"\n |-\n |\n" unless $beQuiet;
|
||||
} elsif ($sectionName eq "interface") {
|
||||
print " |- Trying to parse interface...\n" unless $beQuiet;
|
||||
|
||||
my $interfaceName = "";
|
||||
my $interfaceData = "";
|
||||
|
||||
# Match identifier of the interface, and enclosed data...
|
||||
$data =~ /$IDLStructure::interfaceSelector/;
|
||||
|
||||
$interfaceExtendedAttributes = (defined($1) ? $1 : " "); chop($interfaceExtendedAttributes);
|
||||
$interfaceName = (defined($2) ? $2 : die("Parsing error!\nSource:\n$data\n)"));
|
||||
$interfaceBase = (defined($3) ? $3 : "");
|
||||
$interfaceData = (defined($4) ? $4 : die("Parsing error!\nSource:\n$data\n)"));
|
||||
|
||||
# Fill in known parts of the domClass datastructure now...
|
||||
$dataNode->name($interfaceName);
|
||||
$dataNode->extendedAttributes(parseExtendedAttributes($interfaceExtendedAttributes));
|
||||
|
||||
# Inheritance detection
|
||||
my @interfaceParents = split(/,/, $interfaceBase);
|
||||
foreach(@interfaceParents) {
|
||||
my $line = $_;
|
||||
$line =~ s/\s*//g;
|
||||
|
||||
my $arrayRef = $dataNode->parents;
|
||||
push(@$arrayRef, $line);
|
||||
}
|
||||
|
||||
$interfaceData =~ s/[\n\r]/ /g;
|
||||
my @interfaceMethods = split(/;/, $interfaceData);
|
||||
|
||||
foreach my $line (@interfaceMethods) {
|
||||
if ($line =~ /attribute/) {
|
||||
$line =~ /$IDLStructure::interfaceAttributeSelector/;
|
||||
|
||||
my $attributeType = (defined($1) ? $1 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
my $attributeExtendedAttributes = (defined($2) ? $2 : " "); chop($attributeExtendedAttributes);
|
||||
|
||||
my $attributeDataType = (defined($3) ? $3 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
my $attributeDataName = (defined($4) ? $4 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
|
||||
('' =~ /^/); # Reset variables needed for regexp matching
|
||||
|
||||
$line =~ /$IDLStructure::getterRaisesSelector/;
|
||||
my $getterException = (defined($1) ? $1 : "");
|
||||
|
||||
$line =~ /$IDLStructure::setterRaisesSelector/;
|
||||
my $setterException = (defined($1) ? $1 : "");
|
||||
|
||||
my $newDataNode = new domAttribute();
|
||||
$newDataNode->type($attributeType);
|
||||
$newDataNode->signature(new domSignature());
|
||||
|
||||
$newDataNode->signature->name($attributeDataName);
|
||||
$newDataNode->signature->type($attributeDataType);
|
||||
$newDataNode->signature->extendedAttributes(parseExtendedAttributes($attributeExtendedAttributes));
|
||||
|
||||
my $arrayRef = $dataNode->attributes;
|
||||
push(@$arrayRef, $newDataNode);
|
||||
|
||||
print " | |> Attribute; TYPE \"$attributeType\" DATA NAME \"$attributeDataName\" DATA TYPE \"$attributeDataType\" GET EXCEPTION? \"$getterException\" SET EXCEPTION? \"$setterException\"" .
|
||||
dumpExtendedAttributes("\n | ", $newDataNode->signature->extendedAttributes) . "\n" unless $beQuiet;
|
||||
|
||||
$getterException =~ s/\s+//g;
|
||||
$setterException =~ s/\s+//g;
|
||||
@{$newDataNode->getterExceptions} = split(/,/, $getterException);
|
||||
@{$newDataNode->setterExceptions} = split(/,/, $setterException);
|
||||
} elsif (($line !~ s/^\s*$//g) and ($line !~ /^\s*const/)) {
|
||||
$line =~ /$IDLStructure::interfaceMethodSelector/ or die "Parsing error!\nSource:\n$line\n)";
|
||||
|
||||
my $methodExtendedAttributes = (defined($1) ? $1 : " "); chop($methodExtendedAttributes);
|
||||
my $methodType = (defined($2) ? $2 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
my $methodName = (defined($3) ? $3 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
my $methodSignature = (defined($4) ? $4 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
|
||||
('' =~ /^/); # Reset variables needed for regexp matching
|
||||
|
||||
$line =~ /$IDLStructure::raisesSelector/;
|
||||
my $methodException = (defined($1) ? $1 : "");
|
||||
|
||||
my $newDataNode = new domFunction();
|
||||
|
||||
$newDataNode->signature(new domSignature());
|
||||
$newDataNode->signature->name($methodName);
|
||||
$newDataNode->signature->type($methodType);
|
||||
$newDataNode->signature->extendedAttributes(parseExtendedAttributes($methodExtendedAttributes));
|
||||
|
||||
print " | |- Method; TYPE \"$methodType\" NAME \"$methodName\" EXCEPTION? \"$methodException\"" .
|
||||
dumpExtendedAttributes("\n | ", $newDataNode->signature->extendedAttributes) . "\n" unless $beQuiet;
|
||||
|
||||
$methodException =~ s/\s+//g;
|
||||
@{$newDataNode->raisesExceptions} = split(/,/, $methodException);
|
||||
|
||||
my @params = split(/,/, $methodSignature);
|
||||
foreach(@params) {
|
||||
my $line = $_;
|
||||
|
||||
$line =~ /$IDLStructure::interfaceParameterSelector/;
|
||||
my $paramExtendedAttributes = (defined($1) ? $1 : " "); chop($paramExtendedAttributes);
|
||||
my $paramType = (defined($2) ? $2 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
my $paramName = (defined($3) ? $3 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
|
||||
my $paramDataNode = new domSignature();
|
||||
$paramDataNode->name($paramName);
|
||||
$paramDataNode->type($paramType);
|
||||
$paramDataNode->extendedAttributes(parseExtendedAttributes($paramExtendedAttributes));
|
||||
|
||||
my $arrayRef = $newDataNode->parameters;
|
||||
push(@$arrayRef, $paramDataNode);
|
||||
|
||||
print " | |> Param; TYPE \"$paramType\" NAME \"$paramName\"" .
|
||||
dumpExtendedAttributes("\n | ", $paramDataNode->extendedAttributes) . "\n" unless $beQuiet;
|
||||
}
|
||||
|
||||
my $arrayRef = $dataNode->functions;
|
||||
push(@$arrayRef, $newDataNode);
|
||||
} elsif ($line =~ /^\s*const/) {
|
||||
$line =~ /$IDLStructure::constantSelector/;
|
||||
my $constType = (defined($1) ? $1 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
my $constName = (defined($2) ? $2 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
my $constValue = (defined($3) ? $3 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
|
||||
my $newDataNode = new domConstant();
|
||||
$newDataNode->name($constName);
|
||||
$newDataNode->type($constType);
|
||||
$newDataNode->value($constValue);
|
||||
|
||||
my $arrayRef = $dataNode->constants;
|
||||
push(@$arrayRef, $newDataNode);
|
||||
|
||||
print " | |> Constant; TYPE \"$constType\" NAME \"$constName\" VALUE \"$constValue\"\n" unless $beQuiet;
|
||||
}
|
||||
}
|
||||
|
||||
print " |----> Interface; NAME \"$interfaceName\"" .
|
||||
dumpExtendedAttributes("\n | ", $dataNode->extendedAttributes) . "\n |-\n |\n" unless $beQuiet;
|
||||
}
|
||||
}
|
||||
|
||||
# Internal helper
|
||||
sub DetermineParseMode
|
||||
{
|
||||
my $object = shift;
|
||||
my $line = shift;
|
||||
|
||||
my $mode = MODE_UNDEF;
|
||||
if ($_ =~ /module/) {
|
||||
$mode = MODE_MODULE;
|
||||
} elsif ($_ =~ /interface/) {
|
||||
$mode = MODE_INTERFACE;
|
||||
} elsif ($_ =~ /exception/) {
|
||||
$mode = MODE_EXCEPTION;
|
||||
} elsif ($_ =~ /alias/) {
|
||||
$mode = MODE_ALIAS;
|
||||
}
|
||||
|
||||
return $mode;
|
||||
}
|
||||
|
||||
# Internal helper
|
||||
sub ProcessSection
|
||||
{
|
||||
my $object = shift;
|
||||
|
||||
if ($parseMode eq MODE_MODULE) {
|
||||
die ("Two modules in one file! Fatal error!\n") if ($document ne 0);
|
||||
$document = new idlDocument();
|
||||
$object->ParseModule($document);
|
||||
} elsif ($parseMode eq MODE_INTERFACE) {
|
||||
my $node = new domClass();
|
||||
$object->ParseInterface($node, "interface");
|
||||
|
||||
die ("No module specified! Fatal Error!\n") if ($document eq 0);
|
||||
my $arrayRef = $document->classes;
|
||||
push(@$arrayRef, $node);
|
||||
} elsif($parseMode eq MODE_EXCEPTION) {
|
||||
my $node = new domClass();
|
||||
$object->ParseInterface($node, "exception");
|
||||
|
||||
die ("No module specified! Fatal Error!\n") if ($document eq 0);
|
||||
my $arrayRef = $document->classes;
|
||||
push(@$arrayRef, $node);
|
||||
} elsif($parseMode eq MODE_ALIAS) {
|
||||
print " |- Trying to parse alias...\n" unless $beQuiet;
|
||||
|
||||
my $line = join("", @temporaryContent);
|
||||
$line =~ /$IDLStructure::aliasSelector/;
|
||||
|
||||
my $interfaceName = (defined($1) ? $1 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
my $wrapperName = (defined($2) ? $2 : die("Parsing error!\nSource:\n$line\n)"));
|
||||
|
||||
print " |----> Alias; INTERFACE \"$interfaceName\" WRAPPER \"$wrapperName\"\n |-\n |\n" unless $beQuiet;
|
||||
|
||||
# FIXME: Check if alias is already in aliases
|
||||
my $aliases = $document->aliases;
|
||||
$aliases->{$interfaceName} = $wrapperName;
|
||||
}
|
||||
|
||||
@temporaryContent = "";
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,107 +0,0 @@
|
|||
#
|
||||
# KDOM IDL parser
|
||||
#
|
||||
# Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
|
||||
#
|
||||
# This file is part of the KDE project
|
||||
#
|
||||
# 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
|
||||
# aint 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.
|
||||
#
|
||||
|
||||
package IDLStructure;
|
||||
|
||||
use Class::Struct;
|
||||
|
||||
# Used to represent a parsed IDL document
|
||||
struct( idlDocument => {
|
||||
module => '$', # Module identifier
|
||||
classes => '@', # All parsed interfaces
|
||||
fileName => '$' # file name
|
||||
});
|
||||
|
||||
# Used to represent 'interface' / 'exception' blocks
|
||||
struct( domClass => {
|
||||
name => '$', # Class identifier (without module)
|
||||
parents => '@', # List of strings
|
||||
constants => '@', # List of 'domConstant'
|
||||
functions => '@', # List of 'domFunction'
|
||||
attributes => '@', # List of 'domAttribute'
|
||||
extendedAttributes => '$', # Extended attributes
|
||||
});
|
||||
|
||||
# Used to represent domClass contents (name of method, signature)
|
||||
struct( domFunction => {
|
||||
signature => '$', # Return type/Object name/extended attributes
|
||||
parameters => '@', # List of 'domSignature'
|
||||
raisesExceptions => '@', # Possibly raised exceptions.
|
||||
});
|
||||
|
||||
# Used to represent domClass contents (name of attribute, signature)
|
||||
struct( domAttribute => {
|
||||
type => '$', # Attribute type (including namespace)
|
||||
signature => '$', # Attribute signature
|
||||
getterExceptions => '@', # Possibly raised exceptions.
|
||||
setterExceptions => '@', # Possibly raised exceptions.
|
||||
});
|
||||
|
||||
# Used to represent a map of 'variable name' <-> 'variable type'
|
||||
struct( domSignature => {
|
||||
name => '$', # Variable name
|
||||
type => '$', # Variable type
|
||||
extendedAttributes => '$' # Extended attributes
|
||||
});
|
||||
|
||||
# Used to represent string constants
|
||||
struct( domConstant => {
|
||||
name => '$', # DOM Constant identifier
|
||||
type => '$', # Type of data
|
||||
value => '$', # Constant value
|
||||
});
|
||||
|
||||
# Helpers
|
||||
$idlId = '[a-zA-Z0-9]'; # Generic identifier
|
||||
$idlIdNs = '[a-zA-Z0-9:]'; # Generic identifier including namespace
|
||||
$idlIdNsList = '[a-zA-Z0-9:,\ ]'; # List of Generic identifiers including namespace
|
||||
|
||||
$idlType = '[a-zA-Z0-9_]'; # Generic type/"value string" identifier
|
||||
$idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier
|
||||
|
||||
# Magic IDL parsing regular expressions
|
||||
my $supportedTypes = "((?:unsigned )?(?:int|short|long)|(?:$idlIdNs*))";
|
||||
|
||||
# Special IDL notations
|
||||
$extendedAttributeSyntax = '\[[^]]*\]'; # Used for extended attributes
|
||||
|
||||
# Regular expression based IDL 'syntactical tokenizer' used in the IDLParser
|
||||
$moduleSelector = 'module\s*(' . $idlId . '*)\s*{';
|
||||
$moduleNSSelector = 'module\s*(' . $idlId . '*)\s*\[ns\s*(' . $idlIdNs . '*)\s*(' . $idlIdNs . '*)\]\s*;';
|
||||
$constantSelector = 'const\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $idlType . '*)';
|
||||
$raisesSelector = 'raises\s*\((' . $idlIdNsList . '*)\s*\)';
|
||||
$getterRaisesSelector = '\bgetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)';
|
||||
$setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)';
|
||||
|
||||
$typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)';
|
||||
|
||||
$exceptionSelector = 'exception\s*(' . $idlIdNs . '*)\s*([a-zA-Z\s{;]*};)';
|
||||
$exceptionSubSelector = '{\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*;\s*}';
|
||||
|
||||
$interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]]*)';
|
||||
$interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)';
|
||||
$interfaceParameterSelector = 'in\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)';
|
||||
|
||||
$interfaceAttributeSelector = '\s*(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)';
|
||||
|
||||
1;
|
|
@ -1,67 +0,0 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2005 Apple Computer, Inc.
|
||||
# Copyright (C) 2006 Anders Carlsson <andersca@mac.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
|
||||
# aint 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.
|
||||
#
|
||||
|
||||
# This script is a temporary hack.
|
||||
# Files are generated in the source directory, when they really should go
|
||||
# to the DerivedSources directory.
|
||||
# This should also eventually be a build rule driven off of .idl files
|
||||
# however a build rule only solution is blocked by several radars:
|
||||
# <rdar://problems/4251781&4251785>
|
||||
|
||||
use strict;
|
||||
|
||||
use File::Path;
|
||||
use Getopt::Long;
|
||||
use Cwd;
|
||||
|
||||
use IDLParser;
|
||||
use CodeGenerator;
|
||||
|
||||
my @idlDirectories;
|
||||
my $outputDirectory;
|
||||
my $generator;
|
||||
my $defines;
|
||||
my $preprocessor;
|
||||
|
||||
GetOptions('include=s@' => \@idlDirectories,
|
||||
'outputdir=s' => \$outputDirectory,
|
||||
'generator=s' => \$generator,
|
||||
'defines=s' => \$defines,
|
||||
'preprocessor=s' => \$preprocessor);
|
||||
|
||||
my $idlFile = $ARGV[0];
|
||||
|
||||
die('Must specify input file.') unless defined($idlFile);
|
||||
die('Must specify IDL search path.') unless @idlDirectories;
|
||||
die('Must specify generator') unless defined($generator);
|
||||
die('Must specify input file.') unless defined($idlFile);
|
||||
die('Must specify output directory.') unless defined($outputDirectory);
|
||||
die('Must specify defines') unless defined($defines);
|
||||
|
||||
$defines =~ s/^\s+|\s+$//g; # trim whitespace
|
||||
|
||||
# Parse the given IDL file.
|
||||
my $parser = IDLParser->new(1);
|
||||
my $document = $parser->Parse($idlFile, $defines, $preprocessor);
|
||||
|
||||
# Generate desired output for given IDL file.
|
||||
my $codeGen = CodeGenerator->new(\@idlDirectories, $generator, $outputDirectory, 0, $preprocessor);
|
||||
$codeGen->ProcessDocument($document, $defines);
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef CSSHelper_h
|
||||
#define CSSHelper_h
|
||||
|
||||
#include "csshelper.h"
|
||||
|
||||
namespace WebCore
|
||||
{
|
||||
using namespace khtml;
|
||||
}
|
||||
|
||||
#endif // CSSHelper_h
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef Frame_h
|
||||
#define Frame_h
|
||||
|
||||
#include "khtmlview.h"
|
||||
|
||||
namespace WebCore
|
||||
{
|
||||
using namespace khtml;
|
||||
typedef KHTMLView Frame;
|
||||
} // namespace WebCore
|
||||
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef RenderBox_h
|
||||
#define RenderBox_h
|
||||
|
||||
#include "render_box.h"
|
||||
#include "IntRect.h"
|
||||
|
||||
namespace WebCore {
|
||||
using namespace khtml;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef RenderContainer_h
|
||||
#define RenderContainer_h
|
||||
|
||||
#include "render_container.h"
|
||||
#include "IntRect.h"
|
||||
#include "render_line.h"
|
||||
|
||||
namespace WebCore {
|
||||
using namespace khtml;
|
||||
}
|
||||
|
||||
#endif // RenderContainer_h
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef RenderBox_h
|
||||
#define RenderBox_h
|
||||
|
||||
#include "render_inline.h"
|
||||
|
||||
namespace WebCore {
|
||||
using namespace khtml;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,13 +0,0 @@
|
|||
#ifndef RenderObject_h
|
||||
#define RenderObject_h
|
||||
|
||||
#include "render_object.h"
|
||||
|
||||
// stuff for khtml rendering compatibility
|
||||
namespace WebCore
|
||||
{
|
||||
using khtml::RenderObject;
|
||||
using khtml::RenderStyle;
|
||||
} // namespace WebCore
|
||||
|
||||
#endif // RenderObject_h
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef RenderStyle_h
|
||||
#define RenderStyle_h
|
||||
|
||||
#include "render_style.h"
|
||||
|
||||
namespace WebCore
|
||||
{
|
||||
//using namespace khtml;
|
||||
using khtml::RenderStyle;
|
||||
} // namespace WebCore
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef RenderView_h
|
||||
#define RenderView_h
|
||||
|
||||
#include "rendering/render_canvas.h"
|
||||
|
||||
namespace WebCore
|
||||
{
|
||||
using namespace khtml;
|
||||
typedef RenderCanvas RenderView;
|
||||
} // namespace WebCore
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef CONFIG_KHTML_H
|
||||
#define CONFIG_KHTML_H
|
||||
|
||||
/* khtml svg support */
|
||||
#cmakedefine SVG_SUPPORT 1
|
||||
|
||||
#endif /* CONFIG_KHTML_H */
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
########### install files ###############
|
||||
|
||||
install(
|
||||
FILES
|
||||
html4.css
|
||||
quirks.css
|
||||
presentational.css
|
||||
DESTINATION ${DATA_INSTALL_DIR}/khtml/css
|
||||
)
|
|
@ -1,883 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2005 Apple Computer, Inc.
|
||||
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
|
||||
Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
|
||||
Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
|
||||
Copyright (C) 2009 Maksim Orlovich <maksim@kde.org>
|
||||
|
||||
Based on khtml css code by:
|
||||
Copyright (C) 1999-2003 Lars Knoll <knoll@kde.org>
|
||||
Copyright (C) 2003 Apple Computer, Inc.
|
||||
Copyright (C) 2004 Allan Sandfeld Jensen <kde@carewolf.com>
|
||||
Copyright (C) 2004 Germain Garand <germain@ebooksfrance.org>
|
||||
|
||||
This file is part of the KDE project
|
||||
|
||||
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 "cssstyleselector.h"
|
||||
#include "css_valueimpl.h"
|
||||
#include "css_svgvalueimpl.h"
|
||||
#include "cssvalues.h"
|
||||
|
||||
#include "SVGNames.h"
|
||||
#include "SVGRenderStyle.h"
|
||||
#include "SVGRenderStyleDefs.h"
|
||||
#include "SVGStyledElement.h"
|
||||
|
||||
#include <wtf/MathExtras.h>
|
||||
|
||||
#define HANDLE_INHERIT(prop, Prop) \
|
||||
if (isInherit) \
|
||||
{\
|
||||
svgstyle->set##Prop(parentStyle->svgStyle()->prop());\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define HANDLE_INHERIT_AND_INITIAL(prop, Prop) \
|
||||
HANDLE_INHERIT(prop, Prop) \
|
||||
else if (isInitial) \
|
||||
svgstyle->set##Prop(SVGRenderStyle::initial##Prop());
|
||||
|
||||
#define HANDLE_INHERIT_COND(propID, prop, Prop) \
|
||||
if (id == propID) \
|
||||
{\
|
||||
svgstyle->set##Prop(parentStyle->svgStyle()->prop());\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define HANDLE_INITIAL_COND(propID, Prop) \
|
||||
if (id == propID) \
|
||||
{\
|
||||
svgstyle->set##Prop(SVGRenderStyle::initial##Prop());\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define HANDLE_INITIAL_COND_WITH_VALUE(propID, Prop, Value) \
|
||||
if (id == propID) { \
|
||||
svgstyle->set##Prop(SVGRenderStyle::initial##Value()); \
|
||||
return; \
|
||||
}
|
||||
|
||||
namespace khtml {
|
||||
|
||||
using namespace DOM;
|
||||
using namespace WebCore;
|
||||
|
||||
static SVGPaintImpl* toPaint(CSSValueImpl* val)
|
||||
{
|
||||
if (val->cssValueType() != DOM::CSSValue::CSS_SVG_VALUE)
|
||||
return 0;
|
||||
SVGCSSValueImpl* svgVal = static_cast<SVGCSSValueImpl*>(val);
|
||||
if (svgVal->isSVGPaint())
|
||||
return static_cast<SVGPaintImpl*>(svgVal);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SVGColorImpl* toColor(CSSValueImpl* val)
|
||||
{
|
||||
if (val->cssValueType() != DOM::CSSValue::CSS_SVG_VALUE)
|
||||
return 0;
|
||||
SVGCSSValueImpl* svgVal = static_cast<SVGCSSValueImpl*>(val);
|
||||
if (svgVal->isSVGColor())
|
||||
return static_cast<SVGColorImpl*>(svgVal);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static float roundToNearestGlyphOrientationAngle(float angle)
|
||||
{
|
||||
angle = fabsf(fmodf(angle, 360.0f));
|
||||
|
||||
if (angle <= 45.0f || angle > 315.0f)
|
||||
return 0.0f;
|
||||
else if (angle > 45.0f && angle <= 135.0f)
|
||||
return 90.0f;
|
||||
else if (angle > 135.0f && angle <= 225.0f)
|
||||
return 180.0f;
|
||||
|
||||
return 270.0f;
|
||||
}
|
||||
|
||||
static int angleToGlyphOrientation(float angle)
|
||||
{
|
||||
angle = roundToNearestGlyphOrientationAngle(angle);
|
||||
|
||||
if (angle == 0.0f)
|
||||
return GO_0DEG;
|
||||
else if (angle == 90.0f)
|
||||
return GO_90DEG;
|
||||
else if (angle == 180.0f)
|
||||
return GO_180DEG;
|
||||
else if (angle == 270.0f)
|
||||
return GO_270DEG;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static EColorInterpolation colorInterpolationForValue(DOM::CSSPrimitiveValueImpl* primitiveValue)
|
||||
{
|
||||
if (!primitiveValue)
|
||||
return CI_AUTO;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_SRGB:
|
||||
return CI_SRGB;
|
||||
case CSS_VAL_LINEARRGB:
|
||||
return CI_LINEARRGB;
|
||||
case CSS_VAL_AUTO:
|
||||
default:
|
||||
return CI_AUTO;
|
||||
}
|
||||
}
|
||||
|
||||
void CSSStyleSelector::applySVGRule(int id, DOM::CSSValueImpl* value)
|
||||
{
|
||||
CSSPrimitiveValueImpl* primitiveValue = 0;
|
||||
if (value->isPrimitiveValue())
|
||||
primitiveValue = static_cast<CSSPrimitiveValueImpl*>(value);
|
||||
|
||||
SVGRenderStyle* svgstyle = style->accessSVGStyle();
|
||||
unsigned short valueType = value->cssValueType();
|
||||
|
||||
bool isInherit = parentNode && valueType == CSSPrimitiveValue::CSS_INHERIT;
|
||||
bool isInitial = valueType == CSSPrimitiveValue::CSS_INITIAL || (!parentNode && valueType == CSSPrimitiveValue::CSS_INHERIT);
|
||||
|
||||
// What follows is a list that maps the CSS properties into their
|
||||
// corresponding front-end RenderStyle values. Shorthands(e.g. border,
|
||||
// background) occur in this list as well and are only hit when mapping
|
||||
// "inherit" or "initial" into front-end values.
|
||||
switch (id) {
|
||||
// ident only properties
|
||||
case CSS_PROP_ALIGNMENT_BASELINE:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(alignmentBaseline, AlignmentBaseline)
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_AUTO:
|
||||
svgstyle->setAlignmentBaseline(AB_AUTO);
|
||||
break;
|
||||
case CSS_VAL_BASELINE:
|
||||
svgstyle->setAlignmentBaseline(AB_BASELINE);
|
||||
break;
|
||||
case CSS_VAL_BEFORE_EDGE:
|
||||
svgstyle->setAlignmentBaseline(AB_BEFORE_EDGE);
|
||||
break;
|
||||
case CSS_VAL_TEXT_BEFORE_EDGE:
|
||||
svgstyle->setAlignmentBaseline(AB_TEXT_BEFORE_EDGE);
|
||||
break;
|
||||
case CSS_VAL_MIDDLE:
|
||||
svgstyle->setAlignmentBaseline(AB_MIDDLE);
|
||||
break;
|
||||
case CSS_VAL_CENTRAL:
|
||||
svgstyle->setAlignmentBaseline(AB_CENTRAL);
|
||||
break;
|
||||
case CSS_VAL_AFTER_EDGE:
|
||||
svgstyle->setAlignmentBaseline(AB_AFTER_EDGE);
|
||||
break;
|
||||
case CSS_VAL_TEXT_AFTER_EDGE:
|
||||
svgstyle->setAlignmentBaseline(AB_TEXT_AFTER_EDGE);
|
||||
break;
|
||||
case CSS_VAL_IDEOGRAPHIC:
|
||||
svgstyle->setAlignmentBaseline(AB_IDEOGRAPHIC);
|
||||
break;
|
||||
case CSS_VAL_ALPHABETIC:
|
||||
svgstyle->setAlignmentBaseline(AB_ALPHABETIC);
|
||||
break;
|
||||
case CSS_VAL_HANGING:
|
||||
svgstyle->setAlignmentBaseline(AB_HANGING);
|
||||
break;
|
||||
case CSS_VAL_MATHEMATICAL:
|
||||
svgstyle->setAlignmentBaseline(AB_MATHEMATICAL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_BASELINE_SHIFT:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(baselineShift, BaselineShift);
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
if (primitiveValue->getIdent()) {
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_BASELINE:
|
||||
svgstyle->setBaselineShift(BS_BASELINE);
|
||||
break;
|
||||
case CSS_VAL_SUB:
|
||||
svgstyle->setBaselineShift(BS_SUB);
|
||||
break;
|
||||
case CSS_VAL_SUPER:
|
||||
svgstyle->setBaselineShift(BS_SUPER);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
svgstyle->setBaselineShift(BS_LENGTH);
|
||||
svgstyle->setBaselineShiftValue(primitiveValue);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_KERNING:
|
||||
{
|
||||
if (isInherit) {
|
||||
HANDLE_INHERIT_COND(CSS_PROP_KERNING, kerning, Kerning)
|
||||
return;
|
||||
}
|
||||
else if (isInitial) {
|
||||
HANDLE_INITIAL_COND_WITH_VALUE(CSS_PROP_KERNING, Kerning, Kerning)
|
||||
return;
|
||||
}
|
||||
svgstyle->setKerning(primitiveValue);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_POINTER_EVENTS:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(pointerEvents, PointerEvents)
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_NONE:
|
||||
svgstyle->setPointerEvents(PE_NONE);
|
||||
break;
|
||||
case CSS_VAL_STROKE:
|
||||
svgstyle->setPointerEvents(PE_STROKE);
|
||||
break;
|
||||
case CSS_VAL_FILL:
|
||||
svgstyle->setPointerEvents(PE_FILL);
|
||||
break;
|
||||
case CSS_VAL_PAINTED:
|
||||
svgstyle->setPointerEvents(PE_PAINTED);
|
||||
break;
|
||||
case CSS_VAL_VISIBLE:
|
||||
svgstyle->setPointerEvents(PE_VISIBLE);
|
||||
break;
|
||||
case CSS_VAL_VISIBLESTROKE:
|
||||
svgstyle->setPointerEvents(PE_VISIBLE_STROKE);
|
||||
break;
|
||||
case CSS_VAL_VISIBLEFILL:
|
||||
svgstyle->setPointerEvents(PE_VISIBLE_FILL);
|
||||
break;
|
||||
case CSS_VAL_VISIBLEPAINTED:
|
||||
svgstyle->setPointerEvents(PE_VISIBLE_PAINTED);
|
||||
break;
|
||||
case CSS_VAL_ALL:
|
||||
svgstyle->setPointerEvents(PE_ALL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_DOMINANT_BASELINE:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(dominantBaseline, DominantBaseline)
|
||||
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_AUTO:
|
||||
svgstyle->setDominantBaseline(DB_AUTO);
|
||||
break;
|
||||
case CSS_VAL_USE_SCRIPT:
|
||||
svgstyle->setDominantBaseline(DB_USE_SCRIPT);
|
||||
break;
|
||||
case CSS_VAL_NO_CHANGE:
|
||||
svgstyle->setDominantBaseline(DB_NO_CHANGE);
|
||||
break;
|
||||
case CSS_VAL_RESET_SIZE:
|
||||
svgstyle->setDominantBaseline(DB_RESET_SIZE);
|
||||
break;
|
||||
case CSS_VAL_IDEOGRAPHIC:
|
||||
svgstyle->setDominantBaseline(DB_IDEOGRAPHIC);
|
||||
break;
|
||||
case CSS_VAL_ALPHABETIC:
|
||||
svgstyle->setDominantBaseline(DB_ALPHABETIC);
|
||||
break;
|
||||
case CSS_VAL_HANGING:
|
||||
svgstyle->setDominantBaseline(DB_HANGING);
|
||||
break;
|
||||
case CSS_VAL_MATHEMATICAL:
|
||||
svgstyle->setDominantBaseline(DB_MATHEMATICAL);
|
||||
break;
|
||||
case CSS_VAL_CENTRAL:
|
||||
svgstyle->setDominantBaseline(DB_CENTRAL);
|
||||
break;
|
||||
case CSS_VAL_MIDDLE:
|
||||
svgstyle->setDominantBaseline(DB_MIDDLE);
|
||||
break;
|
||||
case CSS_VAL_TEXT_AFTER_EDGE:
|
||||
svgstyle->setDominantBaseline(DB_TEXT_AFTER_EDGE);
|
||||
break;
|
||||
case CSS_VAL_TEXT_BEFORE_EDGE:
|
||||
svgstyle->setDominantBaseline(DB_TEXT_BEFORE_EDGE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_COLOR_INTERPOLATION:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(colorInterpolation, ColorInterpolation);
|
||||
|
||||
svgstyle->setColorInterpolation(colorInterpolationForValue(primitiveValue));
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_COLOR_INTERPOLATION_FILTERS:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(colorInterpolationFilters, ColorInterpolationFilters)
|
||||
|
||||
svgstyle->setColorInterpolationFilters(colorInterpolationForValue(primitiveValue));
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_COLOR_RENDERING:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(colorRendering, ColorRendering)
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_AUTO:
|
||||
svgstyle->setColorRendering(CR_AUTO);
|
||||
break;
|
||||
case CSS_VAL_OPTIMIZESPEED:
|
||||
svgstyle->setColorRendering(CR_OPTIMIZESPEED);
|
||||
break;
|
||||
case CSS_VAL_OPTIMIZEQUALITY:
|
||||
svgstyle->setColorRendering(CR_OPTIMIZEQUALITY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_CLIP_RULE:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(clipRule, ClipRule)
|
||||
if (primitiveValue)
|
||||
svgstyle->setClipRule((primitiveValue->getIdent() == CSS_VAL_NONZERO) ? RULE_NONZERO : RULE_EVENODD);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_FILL_RULE:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(fillRule, FillRule)
|
||||
if (primitiveValue)
|
||||
svgstyle->setFillRule((primitiveValue->getIdent() == CSS_VAL_NONZERO) ? RULE_NONZERO : RULE_EVENODD);
|
||||
break;
|
||||
}
|
||||
|
||||
case CSS_PROP_STROKE_LINEJOIN:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(joinStyle, JoinStyle)
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_MITER:
|
||||
svgstyle->setJoinStyle(khtml::MiterJoin);
|
||||
break;
|
||||
case CSS_VAL_ROUND:
|
||||
svgstyle->setJoinStyle(khtml::RoundJoin);
|
||||
break;
|
||||
case CSS_VAL_BEVEL:
|
||||
svgstyle->setJoinStyle(khtml::BevelJoin);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_IMAGE_RENDERING:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(imageRendering, ImageRendering)
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_AUTO:
|
||||
svgstyle->setImageRendering(IR_AUTO);
|
||||
break;
|
||||
case CSS_VAL_OPTIMIZESPEED:
|
||||
svgstyle->setImageRendering(IR_OPTIMIZESPEED);
|
||||
break;
|
||||
case CSS_VAL_OPTIMIZEQUALITY:
|
||||
svgstyle->setImageRendering(IR_OPTIMIZEQUALITY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_SHAPE_RENDERING:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(shapeRendering, ShapeRendering)
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_AUTO:
|
||||
svgstyle->setShapeRendering(SR_AUTO);
|
||||
break;
|
||||
case CSS_VAL_OPTIMIZESPEED:
|
||||
svgstyle->setShapeRendering(SR_OPTIMIZESPEED);
|
||||
break;
|
||||
case CSS_VAL_CRISPEDGES:
|
||||
svgstyle->setShapeRendering(SR_CRISPEDGES);
|
||||
break;
|
||||
case CSS_VAL_GEOMETRICPRECISION:
|
||||
svgstyle->setShapeRendering(SR_GEOMETRICPRECISION);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_TEXT_RENDERING:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(textRendering, TextRendering)
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_AUTO:
|
||||
svgstyle->setTextRendering(TR_AUTO);
|
||||
break;
|
||||
case CSS_VAL_OPTIMIZESPEED:
|
||||
svgstyle->setTextRendering(TR_OPTIMIZESPEED);
|
||||
break;
|
||||
case CSS_VAL_OPTIMIZELEGIBILITY:
|
||||
svgstyle->setTextRendering(TR_OPTIMIZELEGIBILITY);
|
||||
break;
|
||||
case CSS_VAL_GEOMETRICPRECISION:
|
||||
svgstyle->setTextRendering(TR_GEOMETRICPRECISION);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// end of ident only properties
|
||||
case CSS_PROP_FILL:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(fillPaint, FillPaint)
|
||||
if (SVGPaintImpl* paint = toPaint(value))
|
||||
svgstyle->setFillPaint(paint);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_STROKE:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(strokePaint, StrokePaint)
|
||||
if (SVGPaintImpl* paint = toPaint(value))
|
||||
svgstyle->setStrokePaint(paint);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_STROKE_WIDTH:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(strokeWidth, StrokeWidth)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
svgstyle->setStrokeWidth(primitiveValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case CSS_PROP_STROKE_DASHARRAY:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray)
|
||||
if (!primitiveValue && value && value->isValueList()) {
|
||||
CSSValueListImpl* dashes = static_cast<CSSValueListImpl*>(value);
|
||||
svgstyle->setStrokeDashArray(dashes);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_STROKE_DASHOFFSET:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(strokeDashOffset, StrokeDashOffset)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
svgstyle->setStrokeDashOffset(primitiveValue);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_FILL_OPACITY:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(fillOpacity, FillOpacity)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
float f = 0.0f;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
|
||||
f = primitiveValue->floatValue() / 100.0f;
|
||||
else if (type == CSSPrimitiveValue::CSS_NUMBER)
|
||||
f = primitiveValue->floatValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setFillOpacity(f);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_STROKE_OPACITY:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(strokeOpacity, StrokeOpacity)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
float f = 0.0f;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
|
||||
f = primitiveValue->floatValue() / 100.0f;
|
||||
else if (type == CSSPrimitiveValue::CSS_NUMBER)
|
||||
f = primitiveValue->floatValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setStrokeOpacity(f);
|
||||
break;
|
||||
}
|
||||
|
||||
case CSS_PROP_STOP_OPACITY:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(stopOpacity, StopOpacity)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
float f = 0.0f;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
|
||||
f = primitiveValue->floatValue() / 100.0f;
|
||||
else if (type == CSSPrimitiveValue::CSS_NUMBER)
|
||||
f = primitiveValue->floatValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setStopOpacity(f);
|
||||
break;
|
||||
}
|
||||
|
||||
case CSS_PROP_MARKER_START:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(startMarker, StartMarker)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
String s;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_URI)
|
||||
s = primitiveValue->getStringValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setStartMarker(s);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_MARKER_MID:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(midMarker, MidMarker)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
String s;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_URI)
|
||||
s = primitiveValue->getStringValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setMidMarker(s);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_MARKER_END:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(endMarker, EndMarker)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
String s;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_URI)
|
||||
s = primitiveValue->getStringValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setEndMarker(s);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_STROKE_LINECAP:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(capStyle, CapStyle)
|
||||
if (!primitiveValue)
|
||||
break;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_BUTT:
|
||||
svgstyle->setCapStyle(ButtCap);
|
||||
break;
|
||||
case CSS_VAL_ROUND:
|
||||
svgstyle->setCapStyle(RoundCap);
|
||||
break;
|
||||
case CSS_VAL_SQUARE:
|
||||
svgstyle->setCapStyle(SquareCap);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_STROKE_MITERLIMIT:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(strokeMiterLimit, StrokeMiterLimit)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
float f = 0.0f;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_NUMBER)
|
||||
f = primitiveValue->floatValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setStrokeMiterLimit(f);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_FILTER:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(filter, Filter)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
String s;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_URI)
|
||||
s = primitiveValue->getStringValue();
|
||||
else
|
||||
return;
|
||||
svgstyle->setFilter(s);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_MASK:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(maskElement, MaskElement)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
String s;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_URI)
|
||||
s = primitiveValue->getStringValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setMaskElement(s);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_CLIP_PATH:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(clipPath, ClipPath)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
String s;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_URI)
|
||||
s = primitiveValue->getStringValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setClipPath(s);
|
||||
break;
|
||||
}
|
||||
|
||||
case CSS_PROP_TEXT_ANCHOR:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(textAnchor, TextAnchor)
|
||||
if (primitiveValue) {
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_START:
|
||||
svgstyle->setTextAnchor(TA_START);
|
||||
break;
|
||||
case CSS_VAL_MIDDLE:
|
||||
svgstyle->setTextAnchor(TA_MIDDLE);
|
||||
break;
|
||||
case CSS_VAL_END:
|
||||
svgstyle->setTextAnchor(TA_END);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CSS_PROP_WRITING_MODE:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(writingMode, WritingMode)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
switch (primitiveValue->getIdent()) {
|
||||
case CSS_VAL_LR_TB:
|
||||
svgstyle->setWritingMode(WM_LRTB);
|
||||
break;
|
||||
case CSS_VAL_LR:
|
||||
svgstyle->setWritingMode(WM_LR);
|
||||
break;
|
||||
case CSS_VAL_RL_TB:
|
||||
svgstyle->setWritingMode(WM_RLTB);
|
||||
break;
|
||||
case CSS_VAL_RL:
|
||||
svgstyle->setWritingMode(WM_RL);
|
||||
break;
|
||||
case CSS_VAL_TB_RL:
|
||||
svgstyle->setWritingMode(WM_TBRL);
|
||||
break;
|
||||
case CSS_VAL_TB:
|
||||
svgstyle->setWritingMode(WM_TB);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CSS_PROP_STOP_COLOR:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor);
|
||||
|
||||
SVGColorImpl* c = toColor(value);
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
QColor col;
|
||||
if (c->colorType() == SVGColorImpl::SVG_COLORTYPE_CURRENTCOLOR)
|
||||
col = style->color();
|
||||
else
|
||||
col = c->color();
|
||||
|
||||
svgstyle->setStopColor(col);
|
||||
break;
|
||||
}
|
||||
|
||||
case CSS_PROP_LIGHTING_COLOR:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor);
|
||||
|
||||
SVGColorImpl* c = toColor(value);
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
QColor col;
|
||||
if (c->colorType() == SVGColorImpl::SVG_COLORTYPE_CURRENTCOLOR)
|
||||
col = style->color();
|
||||
else
|
||||
col = c->color();
|
||||
|
||||
svgstyle->setLightingColor(col);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_FLOOD_OPACITY:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(floodOpacity, FloodOpacity)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
float f = 0.0f;
|
||||
int type = primitiveValue->primitiveType();
|
||||
if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
|
||||
f = primitiveValue->floatValue() / 100.0f;
|
||||
else if (type == CSSPrimitiveValue::CSS_NUMBER)
|
||||
f = primitiveValue->floatValue();
|
||||
else
|
||||
return;
|
||||
|
||||
svgstyle->setFloodOpacity(f);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_FLOOD_COLOR:
|
||||
{
|
||||
QColor col;
|
||||
if (isInitial)
|
||||
col = SVGRenderStyle::initialFloodColor();
|
||||
else {
|
||||
SVGColorImpl* c = toColor(value);
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
if (c->colorType() == SVGColorImpl::SVG_COLORTYPE_CURRENTCOLOR)
|
||||
col = style->color();
|
||||
else
|
||||
col = c->color();
|
||||
}
|
||||
|
||||
svgstyle->setFloodColor(col);
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_GLYPH_ORIENTATION_HORIZONTAL:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientationHorizontal)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_DEG) {
|
||||
int orientation = angleToGlyphOrientation(primitiveValue->floatValue());
|
||||
ASSERT(orientation != -1);
|
||||
|
||||
svgstyle->setGlyphOrientationHorizontal((EGlyphOrientation) orientation);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_GLYPH_ORIENTATION_VERTICAL:
|
||||
{
|
||||
HANDLE_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientationVertical)
|
||||
if (!primitiveValue)
|
||||
return;
|
||||
|
||||
if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_DEG) {
|
||||
int orientation = angleToGlyphOrientation(primitiveValue->floatValue());
|
||||
ASSERT(orientation != -1);
|
||||
|
||||
svgstyle->setGlyphOrientationVertical((EGlyphOrientation) orientation);
|
||||
} else if (primitiveValue->getIdent() == CSS_VAL_AUTO)
|
||||
svgstyle->setGlyphOrientationVertical(GO_AUTO);
|
||||
|
||||
break;
|
||||
}
|
||||
case CSS_PROP_ENABLE_BACKGROUND:
|
||||
// Silently ignoring this property for now
|
||||
// http://bugs.webkit.org/show_bug.cgi?id=6022
|
||||
break;
|
||||
default:
|
||||
// If you crash here, it's because you added a css property and are not handling it
|
||||
// in either this switch statement or the one in CSSStyleSelector::applyProperty
|
||||
kWarning() << "unimplemented property" << id << getPropertyName(id).string();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,430 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 1999 Waldo Bastian (bastian@kde.org)
|
||||
* Copyright 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch)
|
||||
* Copyright 2001-2003 Dirk Mueller (mueller@kde.org)
|
||||
* Copyright 2002 Apple Computer, Inc.
|
||||
* Copyright 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 CSS_DEBUG
|
||||
|
||||
#include "css_base.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#ifdef CSS_DEBUG
|
||||
#include "cssproperties.h"
|
||||
#endif
|
||||
|
||||
#include "css_stylesheetimpl.h"
|
||||
#include <xml/dom_docimpl.h>
|
||||
#include "css_valueimpl.h"
|
||||
using namespace DOM;
|
||||
|
||||
void StyleBaseImpl::checkLoaded() const
|
||||
{
|
||||
if(m_parent) m_parent->checkLoaded();
|
||||
}
|
||||
|
||||
void StyleBaseImpl::checkPending() const
|
||||
{
|
||||
if(m_parent) m_parent->checkPending();
|
||||
}
|
||||
|
||||
StyleSheetImpl* StyleBaseImpl::stylesheet()
|
||||
{
|
||||
StyleBaseImpl* b = this;
|
||||
while(b && !b->isStyleSheet())
|
||||
b = b->m_parent;
|
||||
return static_cast<StyleSheetImpl *>(b);
|
||||
}
|
||||
|
||||
KUrl StyleBaseImpl::baseURL()
|
||||
{
|
||||
// try to find the style sheet. If found look for its url.
|
||||
// If it has none, look for the parentsheet, or the parentNode and
|
||||
// try to find out about their url
|
||||
|
||||
StyleSheetImpl *sheet = stylesheet();
|
||||
|
||||
if(!sheet) return KUrl();
|
||||
|
||||
if(!sheet->href().isNull())
|
||||
return KUrl( sheet->href().string() );
|
||||
|
||||
// find parent
|
||||
if(sheet->parent()) return sheet->parent()->baseURL();
|
||||
|
||||
if(!sheet->ownerNode()) return KUrl();
|
||||
|
||||
return sheet->ownerNode()->document()->baseURL();
|
||||
}
|
||||
|
||||
void StyleBaseImpl::setParsedValue(int propId, const CSSValueImpl *parsedValue,
|
||||
bool important, QList<CSSProperty*> *propList)
|
||||
{
|
||||
QMutableListIterator<CSSProperty*> propIt(*propList);
|
||||
propIt.toBack(); // just remove the top one - not sure what should happen if we have multiple instances of the property
|
||||
CSSProperty* p;
|
||||
while (propIt.hasPrevious()) {
|
||||
p = propIt.previous();
|
||||
if (p->m_id == propId && p->m_important == important ) {
|
||||
delete propIt.value();
|
||||
propIt.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CSSProperty *prop = new CSSProperty();
|
||||
prop->m_id = propId;
|
||||
prop->setValue(const_cast<CSSValueImpl *>(parsedValue));
|
||||
prop->m_important = important;
|
||||
|
||||
propList->append(prop);
|
||||
#ifdef CSS_DEBUG
|
||||
kDebug( 6080 ) << "added property: " << getPropertyName(propId).string()
|
||||
// non implemented yet << ", value: " << parsedValue->cssText().string()
|
||||
<< " important: " << prop->m_important;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
StyleListImpl::~StyleListImpl()
|
||||
{
|
||||
StyleBaseImpl *n;
|
||||
|
||||
if(!m_lstChildren) return;
|
||||
|
||||
QListIterator<StyleBaseImpl*> it( *m_lstChildren );
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
n = it.next();
|
||||
n->setParent(0);
|
||||
if( !n->refCount() ) delete n;
|
||||
}
|
||||
delete m_lstChildren;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
void CSSSelector::print(void)
|
||||
{
|
||||
kDebug( 6080 ) << "[Selector: tag = " << QString::number(makeId(tagNamespace.id(), tagLocalName.id()),16) << ", attr = \"" << makeId(attrNamespace.id(), attrLocalName.id()) << "\", match = \"" << match
|
||||
<< "\" value = \"" << value.string().string().toLatin1().constData() << "\" relation = " << (int)relation
|
||||
<< "]" << endl;
|
||||
if ( tagHistory )
|
||||
tagHistory->print();
|
||||
kDebug( 6080 ) << " specificity = " << specificity();
|
||||
}
|
||||
|
||||
unsigned int CSSSelector::specificity() const
|
||||
{
|
||||
|
||||
int s = ((tagLocalName.id() == anyLocalName) ? 0 : 1);
|
||||
switch(match)
|
||||
{
|
||||
case Id:
|
||||
s += 0x10000;
|
||||
break;
|
||||
case Exact:
|
||||
case Set:
|
||||
case List:
|
||||
case Class:
|
||||
case Hyphen:
|
||||
case PseudoClass:
|
||||
case PseudoElement:
|
||||
case Contain:
|
||||
case Begin:
|
||||
case End:
|
||||
s += 0x100;
|
||||
case None:
|
||||
break;
|
||||
}
|
||||
if(tagHistory)
|
||||
s += tagHistory->specificity();
|
||||
// make sure it doesn't overflow
|
||||
return s & 0xffffff;
|
||||
}
|
||||
|
||||
void CSSSelector::extractPseudoType() const
|
||||
{
|
||||
if (match != PseudoClass && match != PseudoElement)
|
||||
return;
|
||||
_pseudoType = PseudoOther;
|
||||
bool element = false;
|
||||
bool compat = false;
|
||||
if (!value.isEmpty()) {
|
||||
value = value.string().lower();
|
||||
switch (value[0].unicode()) {
|
||||
case '-':
|
||||
if (value == "-khtml-replaced")
|
||||
_pseudoType = PseudoReplaced;
|
||||
else
|
||||
if (value == "-khtml-marker")
|
||||
_pseudoType = PseudoMarker;
|
||||
element = true;
|
||||
break;
|
||||
case 'a':
|
||||
if (value == "active")
|
||||
_pseudoType = PseudoActive;
|
||||
else if (value == "after") {
|
||||
_pseudoType = PseudoAfter;
|
||||
element = compat = true;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (value == "before") {
|
||||
_pseudoType = PseudoBefore;
|
||||
element = compat = true;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
if (value == "checked")
|
||||
_pseudoType = PseudoChecked;
|
||||
else if (value == "contains(")
|
||||
_pseudoType = PseudoContains;
|
||||
break;
|
||||
case 'd':
|
||||
if (value == "disabled")
|
||||
_pseudoType = PseudoDisabled;
|
||||
if (value == "default")
|
||||
_pseudoType = PseudoDefault;
|
||||
break;
|
||||
case 'e':
|
||||
if (value == "empty")
|
||||
_pseudoType = PseudoEmpty;
|
||||
else if (value == "enabled")
|
||||
_pseudoType = PseudoEnabled;
|
||||
break;
|
||||
case 'f':
|
||||
if (value == "first-child")
|
||||
_pseudoType = PseudoFirstChild;
|
||||
else if (value == "first-letter") {
|
||||
_pseudoType = PseudoFirstLetter;
|
||||
element = compat = true;
|
||||
}
|
||||
else if (value == "first-line") {
|
||||
_pseudoType = PseudoFirstLine;
|
||||
element = compat = true;
|
||||
}
|
||||
else if (value == "first-of-type")
|
||||
_pseudoType = PseudoFirstOfType;
|
||||
else if (value == "focus")
|
||||
_pseudoType = PseudoFocus;
|
||||
break;
|
||||
case 'h':
|
||||
if (value == "hover")
|
||||
_pseudoType = PseudoHover;
|
||||
break;
|
||||
case 'i':
|
||||
if (value == "indeterminate")
|
||||
_pseudoType = PseudoIndeterminate;
|
||||
break;
|
||||
case 'l':
|
||||
if (value == "link")
|
||||
_pseudoType = PseudoLink;
|
||||
else if (value == "lang(")
|
||||
_pseudoType = PseudoLang;
|
||||
else if (value == "last-child")
|
||||
_pseudoType = PseudoLastChild;
|
||||
else if (value == "last-of-type")
|
||||
_pseudoType = PseudoLastOfType;
|
||||
break;
|
||||
case 'n':
|
||||
if (value == "not(")
|
||||
_pseudoType = PseudoNot;
|
||||
else if (value == "nth-child(")
|
||||
_pseudoType = PseudoNthChild;
|
||||
else if (value == "nth-last-child(")
|
||||
_pseudoType = PseudoNthLastChild;
|
||||
else if (value == "nth-of-type(")
|
||||
_pseudoType = PseudoNthOfType;
|
||||
else if (value == "nth-last-of-type(")
|
||||
_pseudoType = PseudoNthLastOfType;
|
||||
break;
|
||||
case 'o':
|
||||
if (value == "only-child")
|
||||
_pseudoType = PseudoOnlyChild;
|
||||
else if (value == "only-of-type")
|
||||
_pseudoType = PseudoOnlyOfType;
|
||||
break;
|
||||
case 'r':
|
||||
if (value == "root")
|
||||
_pseudoType = PseudoRoot;
|
||||
else if (value == "read-only")
|
||||
_pseudoType = PseudoReadOnly;
|
||||
else if (value == "read-write")
|
||||
_pseudoType = PseudoReadWrite;
|
||||
break;
|
||||
case 's':
|
||||
if (value == "selection") {
|
||||
_pseudoType = PseudoSelection;
|
||||
element = true;
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (value == "target")
|
||||
_pseudoType = PseudoTarget;
|
||||
break;
|
||||
case 'v':
|
||||
if (value == "visited")
|
||||
_pseudoType = PseudoVisited;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match == PseudoClass && element)
|
||||
if (!compat) _pseudoType = PseudoOther;
|
||||
else match = PseudoElement;
|
||||
else
|
||||
if (match == PseudoElement && !element)
|
||||
_pseudoType = PseudoOther;
|
||||
}
|
||||
|
||||
|
||||
bool CSSSelector::operator == ( const CSSSelector &other ) const
|
||||
{
|
||||
const CSSSelector *sel1 = this;
|
||||
const CSSSelector *sel2 = &other;
|
||||
|
||||
while ( sel1 && sel2 ) {
|
||||
//assert(sel1->_pseudoType != PseudoNotParsed);
|
||||
//assert(sel2->_pseudoType != PseudoNotParsed);
|
||||
if ( sel1->tagLocalName.id() != sel2->tagLocalName.id() || sel1->attrLocalName.id() != sel2->attrLocalName.id() ||
|
||||
sel1->tagNamespace.id() != sel2->tagNamespace.id() || sel1->attrNamespace.id() != sel2->attrNamespace.id() ||
|
||||
sel1->relation != sel2->relation || sel1->match != sel2->match ||
|
||||
sel1->value != sel2->value ||
|
||||
sel1->pseudoType() != sel2->pseudoType() ||
|
||||
sel1->string_arg != sel2->string_arg)
|
||||
return false;
|
||||
sel1 = sel1->tagHistory;
|
||||
sel2 = sel2->tagHistory;
|
||||
}
|
||||
if ( sel1 || sel2 )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
DOMString CSSSelector::selectorText() const
|
||||
{
|
||||
// FIXME: Support namespaces when dumping the selector text. This requires preserving
|
||||
// the original namespace prefix used. Ugh. -dwh
|
||||
DOMString str;
|
||||
const CSSSelector* cs = this;
|
||||
quint16 tag = cs->tagLocalName.id();
|
||||
if (tag == anyLocalName && cs->match == CSSSelector::None)
|
||||
str = "*";
|
||||
else if (tag != anyLocalName)
|
||||
str = LocalName::fromId(tag).toString();
|
||||
|
||||
const CSSSelector* op = 0;
|
||||
while (true) {
|
||||
if ( makeId(cs->attrNamespace.id(), cs->attrLocalName.id()) == ATTR_ID && cs->match == CSSSelector::Id )
|
||||
{
|
||||
str += "#";
|
||||
str += cs->value;
|
||||
}
|
||||
else if ( cs->match == CSSSelector::Class )
|
||||
{
|
||||
str += ".";
|
||||
str += cs->value;
|
||||
}
|
||||
else if ( cs->match == CSSSelector::PseudoClass )
|
||||
{
|
||||
str += ":";
|
||||
str += cs->value;
|
||||
if (!cs->string_arg.isEmpty()) { // e.g :nth-child(...)
|
||||
str += cs->string_arg;
|
||||
str += ")";
|
||||
} else if (cs->simpleSelector && !op) { // :not(...)
|
||||
op = cs;
|
||||
cs = cs->simpleSelector;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if ( cs->match == CSSSelector::PseudoElement )
|
||||
{
|
||||
str += "::";
|
||||
str += cs->value;
|
||||
}
|
||||
// optional attribute
|
||||
else if ( cs->attrLocalName.id() ) {
|
||||
DOMString attrName = LocalName::fromId(cs->attrLocalName.id()).toString();
|
||||
str += "[";
|
||||
str += attrName;
|
||||
switch (cs->match) {
|
||||
case CSSSelector::Exact:
|
||||
str += "=";
|
||||
break;
|
||||
case CSSSelector::Set:
|
||||
break;
|
||||
case CSSSelector::List:
|
||||
str += "~=";
|
||||
break;
|
||||
case CSSSelector::Hyphen:
|
||||
str += "|=";
|
||||
break;
|
||||
case CSSSelector::Begin:
|
||||
str += "^=";
|
||||
break;
|
||||
case CSSSelector::End:
|
||||
str += "$=";
|
||||
break;
|
||||
case CSSSelector::Contain:
|
||||
str += "*=";
|
||||
break;
|
||||
default:
|
||||
kWarning(6080) << "Unhandled case in CSSStyleRuleImpl::selectorText : match=" << cs->match;
|
||||
}
|
||||
if (cs->match != CSSSelector::Set) {
|
||||
str += "\"";
|
||||
str += cs->value;
|
||||
str += "\"";
|
||||
}
|
||||
str += "]";
|
||||
}
|
||||
if (op && !cs->tagHistory) {
|
||||
cs=op;
|
||||
op=0;
|
||||
str += ")";
|
||||
}
|
||||
|
||||
if ((cs->relation != CSSSelector::SubSelector && !op) || !cs->tagHistory)
|
||||
break;
|
||||
cs = cs->tagHistory;
|
||||
}
|
||||
|
||||
if ( cs->tagHistory ) {
|
||||
DOMString tagHistoryText = cs->tagHistory->selectorText();
|
||||
if ( cs->relation == DirectAdjacent )
|
||||
str = tagHistoryText + DOMString(" + ") + str;
|
||||
else if ( cs->relation == IndirectAdjacent )
|
||||
str = tagHistoryText + DOMString(" ~ ") + str;
|
||||
else if ( cs->relation == Child )
|
||||
str = tagHistoryText + DOMString(" > ") + str;
|
||||
else // Descendant
|
||||
str = tagHistoryText + DOMString(" ") + str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
|
@ -1,287 +0,0 @@
|
|||
/*
|
||||
* This file is part of the CSS implementation for KDE.
|
||||
*
|
||||
* Copyright 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 1999 Waldo Bastian (bastian@kde.org)
|
||||
* Copyright 2002 Apple Computer, Inc.
|
||||
* Copyright 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.
|
||||
*
|
||||
*/
|
||||
#ifndef _CSS_BASE_H
|
||||
#define _CSS_BASE_H
|
||||
|
||||
#include "misc/AtomicString.h"
|
||||
#include "dom/dom_misc.h"
|
||||
#include "xml/dom_nodeimpl.h"
|
||||
#include "misc/shared.h"
|
||||
#include <kdemacros.h>
|
||||
#include <QtCore/qdatetime.h>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class StyleSheetImpl;
|
||||
class MediaList;
|
||||
|
||||
class CSSSelector;
|
||||
class CSSProperty;
|
||||
class CSSValueImpl;
|
||||
|
||||
// this class represents a selector for a StyleRule
|
||||
class CSSSelector
|
||||
{
|
||||
public:
|
||||
CSSSelector()
|
||||
: tagHistory(0), simpleSelector(0), relation( Descendant ),
|
||||
match( None ), pseudoId( 0 ), _pseudoType(PseudoNotParsed)
|
||||
{
|
||||
tagLocalName = LocalName::fromId(anyLocalName);
|
||||
tagNamespace = NamespaceName::fromId(anyNamespace);
|
||||
attrLocalName = LocalName::fromId(0);
|
||||
attrNamespace = NamespaceName::fromId(0);
|
||||
}
|
||||
|
||||
~CSSSelector() {
|
||||
delete tagHistory;
|
||||
delete simpleSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print debug output for this selector
|
||||
*/
|
||||
void print();
|
||||
|
||||
/**
|
||||
* Re-create selector text from selector's data
|
||||
*/
|
||||
DOMString selectorText() const;
|
||||
|
||||
// checks if the 2 selectors (including sub selectors) agree.
|
||||
bool operator == ( const CSSSelector &other ) const;
|
||||
|
||||
// tag == -1 means apply to all elements (Selector = *)
|
||||
|
||||
unsigned int specificity() const;
|
||||
|
||||
/* how the attribute value has to match.... Default is Exact */
|
||||
enum Match
|
||||
{
|
||||
None = 0,
|
||||
Id,
|
||||
Exact,
|
||||
Set,
|
||||
Class,
|
||||
List,
|
||||
Hyphen,
|
||||
PseudoClass,
|
||||
PseudoElement,
|
||||
Contain, // css3: E[foo*="bar"]
|
||||
Begin, // css3: E[foo^="bar"]
|
||||
End // css3: E[foo$="bar"]
|
||||
};
|
||||
|
||||
enum Relation
|
||||
{
|
||||
Descendant = 0,
|
||||
Child,
|
||||
DirectAdjacent,
|
||||
IndirectAdjacent,
|
||||
SubSelector
|
||||
};
|
||||
|
||||
enum PseudoType
|
||||
{
|
||||
PseudoNotParsed = 0,
|
||||
PseudoOther,
|
||||
PseudoEmpty,
|
||||
PseudoFirstChild,
|
||||
PseudoLastChild,
|
||||
PseudoNthChild,
|
||||
PseudoNthLastChild,
|
||||
PseudoOnlyChild,
|
||||
PseudoFirstOfType,
|
||||
PseudoLastOfType,
|
||||
PseudoNthOfType,
|
||||
PseudoNthLastOfType,
|
||||
PseudoOnlyOfType,
|
||||
PseudoLink,
|
||||
PseudoVisited,
|
||||
PseudoHover,
|
||||
PseudoFocus,
|
||||
PseudoActive,
|
||||
PseudoTarget,
|
||||
PseudoLang,
|
||||
PseudoNot,
|
||||
PseudoContains,
|
||||
PseudoRoot,
|
||||
PseudoEnabled,
|
||||
PseudoDisabled,
|
||||
PseudoDefault,
|
||||
PseudoReadOnly,
|
||||
PseudoReadWrite,
|
||||
PseudoChecked,
|
||||
PseudoIndeterminate,
|
||||
// pseudo-elements:
|
||||
// inherited:
|
||||
PseudoFirstLine,
|
||||
PseudoFirstLetter,
|
||||
PseudoSelection,
|
||||
// generated:
|
||||
PseudoBefore,
|
||||
PseudoAfter,
|
||||
PseudoMarker,
|
||||
PseudoReplaced
|
||||
};
|
||||
|
||||
PseudoType pseudoType() const {
|
||||
if (_pseudoType == PseudoNotParsed)
|
||||
extractPseudoType();
|
||||
return _pseudoType;
|
||||
}
|
||||
|
||||
mutable khtml::AtomicString value;
|
||||
CSSSelector *tagHistory;
|
||||
CSSSelector* simpleSelector; // Used by :not
|
||||
DOM::DOMString string_arg; // Used by :contains, :lang and :nth-*
|
||||
LocalName attrLocalName;
|
||||
NamespaceName attrNamespace;
|
||||
LocalName tagLocalName;
|
||||
NamespaceName tagNamespace;
|
||||
|
||||
Relation relation : 3;
|
||||
mutable Match match : 4;
|
||||
unsigned int pseudoId : 4;
|
||||
mutable PseudoType _pseudoType : 6;
|
||||
|
||||
private:
|
||||
void extractPseudoType() const;
|
||||
};
|
||||
|
||||
// a style class which has a parent (almost all have)
|
||||
class StyleBaseImpl : public khtml::TreeShared<StyleBaseImpl>
|
||||
{
|
||||
public:
|
||||
StyleBaseImpl() { m_parent = 0; hasInlinedDecl = false; strictParsing = true; multiLength = false; }
|
||||
StyleBaseImpl(StyleBaseImpl *p) {
|
||||
m_parent = p; hasInlinedDecl = false;
|
||||
strictParsing = (m_parent ? m_parent->useStrictParsing() : true);
|
||||
multiLength = false;
|
||||
}
|
||||
|
||||
virtual ~StyleBaseImpl() {}
|
||||
|
||||
// returns the url of the style sheet this object belongs to
|
||||
// not const
|
||||
KUrl baseURL();
|
||||
|
||||
virtual bool isStyleSheet() const { return false; }
|
||||
virtual bool isCSSStyleSheet() const { return false; }
|
||||
virtual bool isStyleSheetList() const { return false; }
|
||||
virtual bool isMediaList() const { return false; }
|
||||
virtual bool isRuleList() const { return false; }
|
||||
virtual bool isRule() const { return false; }
|
||||
virtual bool isStyleRule() const { return false; }
|
||||
virtual bool isCharsetRule() const { return false; }
|
||||
virtual bool isImportRule() const { return false; }
|
||||
virtual bool isMediaRule() const { return false; }
|
||||
virtual bool isFontFaceRule() const { return false; }
|
||||
virtual bool isPageRule() const { return false; }
|
||||
virtual bool isUnknownRule() const { return false; }
|
||||
virtual bool isStyleDeclaration() const { return false; }
|
||||
virtual bool isValue() const { return false; }
|
||||
virtual bool isPrimitiveValue() const { return false; }
|
||||
virtual bool isValueList() const { return false; }
|
||||
virtual bool isValueCustom() const { return false; }
|
||||
|
||||
void setParent(StyleBaseImpl *parent) { m_parent = parent; }
|
||||
|
||||
static void setParsedValue(int propId, const CSSValueImpl *parsedValue,
|
||||
bool important, QList<CSSProperty*> *propList);
|
||||
|
||||
virtual bool parseString(const DOMString &/*cssString*/, bool = false) { return false; }
|
||||
|
||||
// verifies if the resource chain is fully loaded,
|
||||
// and in the affirmative, notifies the owner document
|
||||
virtual void checkLoaded() const;
|
||||
// makes sure the resource chain is considered 'Pending' by the owner document
|
||||
virtual void checkPending() const;
|
||||
|
||||
void setStrictParsing( bool b ) { strictParsing = b; }
|
||||
bool useStrictParsing() const { return strictParsing; }
|
||||
|
||||
// not const
|
||||
StyleSheetImpl* stylesheet();
|
||||
|
||||
protected:
|
||||
bool hasInlinedDecl : 1;
|
||||
bool strictParsing : 1;
|
||||
bool multiLength : 1;
|
||||
};
|
||||
|
||||
// a style class which has a list of children (StyleSheets for example)
|
||||
class StyleListImpl : public StyleBaseImpl
|
||||
{
|
||||
public:
|
||||
StyleListImpl() : StyleBaseImpl() { m_lstChildren = 0; }
|
||||
StyleListImpl(StyleBaseImpl *parent) : StyleBaseImpl(parent) { m_lstChildren = 0; }
|
||||
virtual ~StyleListImpl();
|
||||
|
||||
unsigned long length() const { return m_lstChildren->count(); }
|
||||
StyleBaseImpl *item(unsigned long num) const { return num < length() ? m_lstChildren->at(num) : 0; }
|
||||
|
||||
void append(StyleBaseImpl *item) { m_lstChildren->append(item); }
|
||||
|
||||
protected:
|
||||
QList<StyleBaseImpl*> *m_lstChildren;
|
||||
};
|
||||
|
||||
KDE_NO_EXPORT int getPropertyID(const char *tagStr, int len);
|
||||
KDE_NO_EXPORT int getValueID(const char *tagStr, int len);
|
||||
|
||||
struct SelectorHash
|
||||
{
|
||||
static unsigned hash(CSSSelector* selector)
|
||||
{
|
||||
unsigned result = 0;
|
||||
while (selector) {
|
||||
result ^= (quintptr)selector->value.impl();
|
||||
result ^= (selector->attrLocalName.id() << 3);
|
||||
result ^= (selector->attrNamespace.id() << 7);
|
||||
result ^= (selector->tagLocalName.id() << 10);
|
||||
result ^= (selector->tagNamespace.id() << 13);
|
||||
result ^= (selector->relation << 17);
|
||||
result ^= (selector->match << 20);
|
||||
result ^= result << 5;
|
||||
selector = selector->tagHistory;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
static bool equal(CSSSelector* a, CSSSelector* b) { return a == b || *a == *b; }
|
||||
static const bool safeToCompareToEmptyOrDeleted = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace WTF
|
||||
{
|
||||
template<typename T> struct DefaultHash;
|
||||
template<> struct DefaultHash<DOM::CSSSelector*> {
|
||||
typedef DOM::SelectorHash Hash;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,366 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 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 "DOMException.h"
|
||||
#include "DOMString.h"
|
||||
|
||||
#include "CSS2AzimuthImpl.h"
|
||||
using namespace DOM;
|
||||
|
||||
CSS2AzimuthImpl::CSS2AzimuthImpl(DocumentImpl *doc) : CSSValueImpl(doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2AzimuthImpl::~CSS2AzimuthImpl()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2AzimuthImpl::azimuthType() const
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSS2AzimuthImpl::identifier() const
|
||||
{
|
||||
}
|
||||
|
||||
bool CSS2AzimuthImpl::behind() const
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2AzimuthImpl::setAngleValue( const unsigned short &unitType, const float &floatValue )
|
||||
{
|
||||
}
|
||||
|
||||
float CSS2AzimuthImpl::getAngleValue( const unsigned short &unitType )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2AzimuthImpl::setIdentifier( const DOMString &identifier, const bool &behind )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSS2BackgroundPositionImpl.h"
|
||||
CSS2BackgroundPositionImpl::CSS2BackgroundPositionImpl(DocumentImpl *doc) : CSSValueImpl(doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2BackgroundPositionImpl::~CSS2BackgroundPositionImpl()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2BackgroundPositionImpl::horizontalType() const
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2BackgroundPositionImpl::verticalType() const
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSS2BackgroundPositionImpl::horizontalIdentifier() const
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSS2BackgroundPositionImpl::verticalIdentifier() const
|
||||
{
|
||||
}
|
||||
|
||||
float CSS2BackgroundPositionImpl::getHorizontalPosition( const float &horizontalType )
|
||||
{
|
||||
}
|
||||
|
||||
float CSS2BackgroundPositionImpl::getVerticalPosition( const float &verticalType )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2BackgroundPositionImpl::setHorizontalPosition( const unsigned short &horizontalType, const float &value )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2BackgroundPositionImpl::setVerticalPosition( const unsigned short &verticalType, const float &value )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2BackgroundPositionImpl::setPositionIdentifier( const DOMString &horizontalIdentifier, const DOMString &verticalIdentifier )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSS2BorderSpacingImpl.h"
|
||||
CSS2BorderSpacingImpl::CSS2BorderSpacingImpl(DocumentImpl *doc) : CSSValueImpl(doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2BorderSpacingImpl::~CSS2BorderSpacingImpl()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2BorderSpacingImpl::horizontalType() const
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2BorderSpacingImpl::verticalType() const
|
||||
{
|
||||
}
|
||||
|
||||
float CSS2BorderSpacingImpl::getHorizontalSpacing( const float &horizontalType )
|
||||
{
|
||||
}
|
||||
|
||||
float CSS2BorderSpacingImpl::getVerticalSpacing( const float &verticalType )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2BorderSpacingImpl::setHorizontalSpacing( const unsigned short &horizontalType, const float &value )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2BorderSpacingImpl::setVerticalSpacing( const unsigned short &verticalType, const float &value )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2BorderSpacingImpl::setInherit()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSS2CounterIncrementImpl.h"
|
||||
CSS2CounterIncrementImpl::CSS2CounterIncrementImpl(DocumentImpl *doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2CounterIncrementImpl::~CSS2CounterIncrementImpl()
|
||||
{
|
||||
}
|
||||
|
||||
short CSS2CounterIncrementImpl::increment() const
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2CounterIncrementImpl::setIncrement( const short & )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSS2CounterResetImpl.h"
|
||||
CSS2CounterResetImpl::CSS2CounterResetImpl(DocumentImpl *doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2CounterResetImpl::~CSS2CounterResetImpl()
|
||||
{
|
||||
}
|
||||
|
||||
short CSS2CounterResetImpl::reset() const
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2CounterResetImpl::setReset( const short & )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSSValueList.h"
|
||||
#include "CSS2CursorImpl.h"
|
||||
CSS2CursorImpl::CSS2CursorImpl(DocumentImpl *doc) : CSSValueImpl(doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2CursorImpl::~CSS2CursorImpl()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2CursorImpl::cursorType() const
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2CursorImpl::setCursorType( const unsigned short & )
|
||||
{
|
||||
}
|
||||
|
||||
CSSValueList CSS2CursorImpl::uris() const
|
||||
{
|
||||
}
|
||||
|
||||
#include "CSS2FontFaceSrcImpl.h"
|
||||
CSS2FontFaceSrcImpl::CSS2FontFaceSrcImpl(DocumentImpl *doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2FontFaceSrcImpl::~CSS2FontFaceSrcImpl()
|
||||
{
|
||||
}
|
||||
|
||||
CSSValueList CSS2FontFaceSrcImpl::format() const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSS2FontFaceWidthsImpl.h"
|
||||
CSS2FontFaceWidthsImpl::CSS2FontFaceWidthsImpl(DocumentImpl *doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2FontFaceWidthsImpl::~CSS2FontFaceWidthsImpl()
|
||||
{
|
||||
}
|
||||
|
||||
CSSValueList CSS2FontFaceWidthsImpl::numbers() const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSS2PageSizeImpl.h"
|
||||
CSS2PageSizeImpl::CSS2PageSizeImpl(DocumentImpl *doc) : CSSValueImpl(doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2PageSizeImpl::~CSS2PageSizeImpl()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2PageSizeImpl::widthType() const
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2PageSizeImpl::heightType() const
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSS2PageSizeImpl::identifier() const
|
||||
{
|
||||
}
|
||||
|
||||
float CSS2PageSizeImpl::getWidth( const float &widthType )
|
||||
{
|
||||
}
|
||||
|
||||
float CSS2PageSizeImpl::getHeightSize( const float &heightType )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2PageSizeImpl::setWidthSize( const unsigned short &widthType, const float &value )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2PageSizeImpl::setHeightSize( const unsigned short &heightType, const float &value )
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2PageSizeImpl::setIdentifier( const DOMString &identifier )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSS2PlayDuringImpl.h"
|
||||
CSS2PlayDuringImpl::CSS2PlayDuringImpl(DocumentImpl *doc) : CSSValueImpl(doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2PlayDuringImpl::~CSS2PlayDuringImpl()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSS2PlayDuringImpl::playDuringType() const
|
||||
{
|
||||
}
|
||||
|
||||
bool CSS2PlayDuringImpl::mix() const
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2PlayDuringImpl::setMix( const bool & )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSS2PlayDuringImpl::repeat() const
|
||||
{
|
||||
}
|
||||
|
||||
void CSS2PlayDuringImpl::setRepeat( const bool & )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSS2PropertiesImpl.h"
|
||||
CSS2PropertiesImpl::CSS2PropertiesImpl(DocumentImpl *doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2PropertiesImpl::~CSS2PropertiesImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CSSValue.h"
|
||||
|
||||
#include "CSS2TextShadowImpl.h"
|
||||
CSS2TextShadowImpl::CSS2TextShadowImpl(DocumentImpl *doc)
|
||||
{
|
||||
}
|
||||
|
||||
CSS2TextShadowImpl::~CSS2TextShadowImpl()
|
||||
{
|
||||
}
|
||||
|
||||
CSSValue CSS2TextShadowImpl::color() const
|
||||
{
|
||||
}
|
||||
|
||||
CSSValue CSS2TextShadowImpl::horizontal() const
|
||||
{
|
||||
}
|
||||
|
||||
CSSValue CSS2TextShadowImpl::vertical() const
|
||||
{
|
||||
}
|
||||
|
||||
CSSValue CSS2TextShadowImpl::blur() const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,205 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 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 _CSS_css_extensionsimpl_h_
|
||||
#define _CSS_css_extensionsimpl_h_
|
||||
|
||||
#include "css_valueimpl.h"
|
||||
#include "dom_string.h"
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class CSS2AzimuthImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSS2AzimuthImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2AzimuthImpl();
|
||||
|
||||
unsigned short azimuthType() const;
|
||||
DOM::DOMString identifier() const;
|
||||
bool behind() const;
|
||||
void setAngleValue ( const unsigned short &unitType, const float &floatValue );
|
||||
float getAngleValue ( const unsigned short &unitType );
|
||||
void setIdentifier ( const DOM::DOMString &identifier, const bool &behind );
|
||||
};
|
||||
|
||||
|
||||
class DOM::DOMString;
|
||||
|
||||
class CSS2BackgroundPositionImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSS2BackgroundPositionImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2BackgroundPositionImpl();
|
||||
|
||||
unsigned short horizontalType() const;
|
||||
unsigned short verticalType() const;
|
||||
DOM::DOMString horizontalIdentifier() const;
|
||||
DOM::DOMString verticalIdentifier() const;
|
||||
float getHorizontalPosition ( const float &horizontalType );
|
||||
float getVerticalPosition ( const float &verticalType );
|
||||
void setHorizontalPosition ( const unsigned short &horizontalType, const float &value );
|
||||
void setVerticalPosition ( const unsigned short &verticalType, const float &value );
|
||||
void setPositionIdentifier ( const DOM::DOMString &horizontalIdentifier, const DOM::DOMString &verticalIdentifier );
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CSS2BorderSpacingImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSS2BorderSpacingImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2BorderSpacingImpl();
|
||||
|
||||
unsigned short horizontalType() const;
|
||||
unsigned short verticalType() const;
|
||||
float getHorizontalSpacing ( const float &horizontalType );
|
||||
float getVerticalSpacing ( const float &verticalType );
|
||||
void setHorizontalSpacing ( const unsigned short &horizontalType, const float &value );
|
||||
void setVerticalSpacing ( const unsigned short &verticalType, const float &value );
|
||||
void setInherit();
|
||||
};
|
||||
|
||||
|
||||
class CSS2CounterIncrementImpl
|
||||
{
|
||||
public:
|
||||
CSS2CounterIncrementImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2CounterIncrementImpl();
|
||||
|
||||
short increment() const;
|
||||
void setIncrement( const short & );
|
||||
};
|
||||
|
||||
|
||||
class CSS2CounterResetImpl
|
||||
{
|
||||
public:
|
||||
CSS2CounterResetImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2CounterResetImpl();
|
||||
|
||||
short reset() const;
|
||||
void setReset( const short & );
|
||||
};
|
||||
|
||||
|
||||
class CSS2CursorImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSS2CursorImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2CursorImpl();
|
||||
|
||||
unsigned short cursorType() const;
|
||||
void setCursorType( const unsigned short & );
|
||||
|
||||
CSSValueList uris() const;
|
||||
};
|
||||
|
||||
|
||||
class CSS2FontFaceSrcImpl
|
||||
{
|
||||
public:
|
||||
CSS2FontFaceSrcImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2FontFaceSrcImpl();
|
||||
|
||||
CSSValueList format() const;
|
||||
};
|
||||
|
||||
|
||||
class CSS2FontFaceWidthsImpl
|
||||
{
|
||||
public:
|
||||
CSS2FontFaceWidthsImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2FontFaceWidthsImpl();
|
||||
|
||||
CSSValueList numbers() const;
|
||||
};
|
||||
|
||||
|
||||
class CSS2PageSizeImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSS2PageSizeImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2PageSizeImpl();
|
||||
|
||||
unsigned short widthType() const;
|
||||
unsigned short heightType() const;
|
||||
DOM::DOMString identifier() const;
|
||||
float getWidth ( const float &widthType );
|
||||
float getHeightSize ( const float &heightType );
|
||||
void setWidthSize ( const unsigned short &widthType, const float &value );
|
||||
void setHeightSize ( const unsigned short &heightType, const float &value );
|
||||
void setIdentifier ( const DOM::DOMString &identifier );
|
||||
};
|
||||
|
||||
|
||||
class CSS2PlayDuringImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSS2PlayDuringImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2PlayDuringImpl();
|
||||
|
||||
unsigned short playDuringType() const;
|
||||
bool mix() const;
|
||||
|
||||
void setMix( const bool & );
|
||||
bool repeat() const;
|
||||
|
||||
void setRepeat( const bool & );
|
||||
};
|
||||
|
||||
|
||||
class CSS2PropertiesImpl
|
||||
{
|
||||
public:
|
||||
CSS2PropertiesImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2PropertiesImpl();
|
||||
};
|
||||
|
||||
|
||||
class CSS2TextShadowImpl
|
||||
{
|
||||
public:
|
||||
CSS2TextShadowImpl(DocumentImpl *doc);
|
||||
|
||||
~CSS2TextShadowImpl();
|
||||
|
||||
CSSValue color() const;
|
||||
CSSValue horizontal() const;
|
||||
CSSValue vertical() const;
|
||||
CSSValue blur() const;
|
||||
};
|
||||
|
||||
|
||||
}; // namespace
|
||||
|
||||
#endif
|
|
@ -1,783 +0,0 @@
|
|||
/*
|
||||
* CSS Media Query
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
|
||||
* (C) 2008 Germain Garand <germain@ebooksfrance.org>
|
||||
* 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 THE AUTHOR ``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.
|
||||
*/
|
||||
#include "css_mediaquery.h"
|
||||
#include "css_valueimpl.h"
|
||||
#include "css/css_stylesheetimpl.h"
|
||||
#include "css/cssparser.h"
|
||||
#include "cssstyleselector.h"
|
||||
#include "css/cssvalues.h"
|
||||
#include "khtml_part.h"
|
||||
#include "khtmlview.h"
|
||||
#include "rendering/render_style.h"
|
||||
#include "dom/dom_string.h"
|
||||
#include "xml/dom_stringimpl.h"
|
||||
#include <QHash>
|
||||
#include <limits.h>
|
||||
#include <QDesktopWidget>
|
||||
#include <QColormap>
|
||||
|
||||
using namespace DOM;
|
||||
using namespace khtml;
|
||||
|
||||
MediaQuery::MediaQuery(Restrictor r, const DOMString& mediaType, QList<MediaQueryExp*>* exprs)
|
||||
: m_restrictor(r)
|
||||
, m_mediaType(mediaType)
|
||||
, m_expressions(exprs)
|
||||
{
|
||||
if (!m_expressions)
|
||||
m_expressions = new QList<MediaQueryExp*>;
|
||||
}
|
||||
|
||||
MediaQuery::~MediaQuery()
|
||||
{
|
||||
if (m_expressions) {
|
||||
qDeleteAll(*m_expressions);
|
||||
delete m_expressions;
|
||||
}
|
||||
}
|
||||
|
||||
bool MediaQuery::operator==(const MediaQuery& other) const
|
||||
{
|
||||
if (m_restrictor != other.m_restrictor
|
||||
|| m_mediaType != other.m_mediaType
|
||||
|| m_expressions->size() != other.m_expressions->size())
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < m_expressions->size(); ++i) {
|
||||
MediaQueryExp* exp = m_expressions->at(i);
|
||||
MediaQueryExp* oexp = other.m_expressions->at(i);
|
||||
if (!(*exp == *oexp))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DOMString MediaQuery::cssText() const
|
||||
{
|
||||
DOMString text;
|
||||
switch (m_restrictor) {
|
||||
case MediaQuery::Only:
|
||||
text += "only ";
|
||||
break;
|
||||
case MediaQuery::Not:
|
||||
text += "not ";
|
||||
break;
|
||||
case MediaQuery::None:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
text += m_mediaType;
|
||||
for (int i = 0; i < m_expressions->size(); ++i) {
|
||||
MediaQueryExp* exp = m_expressions->at(i);
|
||||
text += " and (";
|
||||
text += exp->mediaFeature();
|
||||
if (exp->value()) {
|
||||
text += ": ";
|
||||
text += exp->value()->cssText();
|
||||
}
|
||||
text += ")";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
MediaQueryExp::MediaQueryExp(const DOMString& mediaFeature, ValueList* valueList)
|
||||
: m_mediaFeature(mediaFeature)
|
||||
, m_value(0)
|
||||
{
|
||||
m_viewportDependent = ( m_mediaFeature == "width" ||
|
||||
m_mediaFeature == "height" ||
|
||||
m_mediaFeature == "min-width" ||
|
||||
m_mediaFeature == "min-height" ||
|
||||
m_mediaFeature == "max-width" ||
|
||||
m_mediaFeature == "max-height" ||
|
||||
m_mediaFeature == "orientation" ||
|
||||
m_mediaFeature == "aspect-ratio" ||
|
||||
m_mediaFeature == "min-aspect-ratio" ||
|
||||
m_mediaFeature == "max-aspect-ratio" );
|
||||
if (valueList) {
|
||||
if (valueList->size() == 1) {
|
||||
Value* value = valueList->current();
|
||||
|
||||
if (value->id != 0)
|
||||
m_value = new CSSPrimitiveValueImpl(value->id);
|
||||
else if (value->unit == CSSPrimitiveValue::CSS_STRING)
|
||||
m_value = new CSSPrimitiveValueImpl(domString(value->string), (CSSPrimitiveValue::UnitTypes) value->unit);
|
||||
else if ((value->unit >= CSSPrimitiveValue::CSS_NUMBER &&
|
||||
value->unit <= CSSPrimitiveValue::CSS_KHZ) ||
|
||||
value->unit == CSSPrimitiveValue::CSS_DPI || value->unit == CSSPrimitiveValue::CSS_DPCM)
|
||||
m_value = new CSSPrimitiveValueImpl(value->fValue, (CSSPrimitiveValue::UnitTypes) value->unit);
|
||||
if (m_value)
|
||||
m_value->ref();
|
||||
valueList->next();
|
||||
} else if (valueList->size() > 1) {
|
||||
// create list of values
|
||||
// currently accepts only <integer>/<integer>
|
||||
|
||||
CSSValueListImpl* list = new CSSValueListImpl();
|
||||
Value* value = 0;
|
||||
bool isValid = true;
|
||||
|
||||
while ((value = valueList->current()) && isValid) {
|
||||
if (value->unit == Value::Operator && value->iValue == '/')
|
||||
list->append(new CSSPrimitiveValueImpl(DOMString("/"), CSSPrimitiveValue::CSS_STRING));
|
||||
else if (value->unit == CSSPrimitiveValue::CSS_NUMBER)
|
||||
list->append(new CSSPrimitiveValueImpl(value->fValue, CSSPrimitiveValue::CSS_NUMBER));
|
||||
else
|
||||
isValid = false;
|
||||
|
||||
value = valueList->next();
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
m_value = list;
|
||||
m_value->ref();
|
||||
} else
|
||||
delete list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MediaQueryExp::~MediaQueryExp()
|
||||
{
|
||||
if (m_value)
|
||||
m_value->deref();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// when adding features, update also m_viewportDependent test if applicable
|
||||
#define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \
|
||||
macro(color, "color") \
|
||||
macro(color_index, "color-index") \
|
||||
macro(grid, "grid") \
|
||||
macro(monochrome, "monochrome") \
|
||||
macro(height, "height") \
|
||||
macro(width, "width") \
|
||||
macro(device_aspect_ratio, "device-aspect-ratio") \
|
||||
macro(device_pixel_ratio, "-khtml-device-pixel-ratio") \
|
||||
macro(device_height, "device-height") \
|
||||
macro(device_width, "device-width") \
|
||||
macro(orientation, "orientation") \
|
||||
macro(aspect_ratio, "aspect-ratio") \
|
||||
macro(resolution, "resolution") \
|
||||
macro(scan, "scan") \
|
||||
macro(max_color, "max-color") \
|
||||
macro(max_color_index, "max-color-index") \
|
||||
macro(max_device_aspect_ratio, "max-device-aspect-ratio") \
|
||||
macro(max_device_pixel_ratio, "-khtml-max-device-pixel-ratio") \
|
||||
macro(max_device_height, "max-device-height") \
|
||||
macro(max_device_width, "max-device-width") \
|
||||
macro(max_aspect_ratio, "max-aspect-ratio") \
|
||||
macro(max_resolution, "max-resolution") \
|
||||
macro(max_height, "max-height") \
|
||||
macro(max_monochrome, "max-monochrome") \
|
||||
macro(max_width, "max-width") \
|
||||
macro(min_color, "min-color") \
|
||||
macro(min_color_index, "min-color-index") \
|
||||
macro(min_device_aspect_ratio, "min-device-aspect-ratio") \
|
||||
macro(min_device_pixel_ratio, "-khtml-min-device-pixel-ratio") \
|
||||
macro(min_device_height, "min-device-height") \
|
||||
macro(min_device_width, "min-device-width") \
|
||||
macro(min_resolution, "min-resolution") \
|
||||
macro(min_aspect_ratio, "min-aspect-ratio") \
|
||||
macro(min_height, "min-height") \
|
||||
macro(min_monochrome, "min-monochrome") \
|
||||
macro(min_width, "min-width") \
|
||||
// end of macro
|
||||
|
||||
enum MediaFeaturePrefix { MinPrefix, MaxPrefix, NoPrefix };
|
||||
|
||||
typedef bool (*EvalFunc)(CSSValueImpl*, RenderStyle*, KHTMLPart*, MediaFeaturePrefix);
|
||||
typedef QHash<DOMString, EvalFunc> FunctionMap;
|
||||
static FunctionMap* gFunctionMap = 0;
|
||||
|
||||
MediaQueryEvaluator::MediaQueryEvaluator(bool mediaFeatureResult)
|
||||
: m_part(0)
|
||||
, m_style(0)
|
||||
, m_expResult(mediaFeatureResult)
|
||||
{
|
||||
}
|
||||
|
||||
MediaQueryEvaluator:: MediaQueryEvaluator(const DOMString& acceptedMediaType, bool mediaFeatureResult)
|
||||
: m_mediaType(acceptedMediaType)
|
||||
, m_part(0)
|
||||
, m_style(0)
|
||||
, m_expResult(mediaFeatureResult)
|
||||
{
|
||||
}
|
||||
|
||||
MediaQueryEvaluator:: MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult)
|
||||
: m_mediaType(acceptedMediaType)
|
||||
, m_part(0)
|
||||
, m_style(0)
|
||||
, m_expResult(mediaFeatureResult)
|
||||
{
|
||||
}
|
||||
|
||||
MediaQueryEvaluator:: MediaQueryEvaluator(const DOMString& acceptedMediaType, KHTMLPart* part, RenderStyle* style)
|
||||
: m_mediaType(acceptedMediaType.lower())
|
||||
, m_part(part)
|
||||
, m_style(style)
|
||||
, m_expResult(false) // doesn't matter when we have m_part and m_style
|
||||
{
|
||||
}
|
||||
|
||||
MediaQueryEvaluator::~MediaQueryEvaluator()
|
||||
{
|
||||
}
|
||||
|
||||
bool MediaQueryEvaluator::mediaTypeMatch(const DOMString& mediaTypeToMatch) const
|
||||
{
|
||||
return mediaTypeToMatch.isEmpty()
|
||||
|| !strcasecmp("all", mediaTypeToMatch)
|
||||
|| !strcasecmp(m_mediaType, mediaTypeToMatch);
|
||||
}
|
||||
|
||||
bool MediaQueryEvaluator::mediaTypeMatchSpecific(const char* mediaTypeToMatch) const
|
||||
{
|
||||
// Like mediaTypeMatch, but without the special cases for "" and "all".
|
||||
assert(mediaTypeToMatch);
|
||||
assert(mediaTypeToMatch[0] != '\0');
|
||||
assert(strcasecmp(DOMString("all"), mediaTypeToMatch));
|
||||
return !strcasecmp(m_mediaType, mediaTypeToMatch);
|
||||
}
|
||||
|
||||
static bool applyRestrictor(MediaQuery::Restrictor r, bool value)
|
||||
{
|
||||
return r == MediaQuery::Not ? !value : value;
|
||||
}
|
||||
|
||||
bool MediaQueryEvaluator::eval(const MediaListImpl* mediaList, CSSStyleSelector* styleSelector) const
|
||||
{
|
||||
if (!mediaList)
|
||||
return true;
|
||||
|
||||
const QList<MediaQuery*>* queries = mediaList->mediaQueries();
|
||||
if (!queries->size())
|
||||
return true; // empty query list evaluates to true
|
||||
|
||||
// iterate over queries, stop if any of them eval to true (OR semantics)
|
||||
bool result = false;
|
||||
for (int i = 0; i < queries->size() && !result; ++i) {
|
||||
MediaQuery* query = queries->at(i);
|
||||
if (mediaTypeMatch(query->mediaType())) {
|
||||
const QList<MediaQueryExp*>* exps = query->expressions();
|
||||
// iterate through expressions, stop if any of them eval to false
|
||||
// (AND semantics)
|
||||
int j = 0;
|
||||
for (; j < exps->size(); ++j) {
|
||||
bool exprResult = eval(exps->at(j));
|
||||
if (styleSelector && exps->at(j)->isViewportDependent())
|
||||
styleSelector->addViewportDependentMediaQueryResult(exps->at(j), exprResult);
|
||||
if (!exprResult)
|
||||
break;
|
||||
}
|
||||
|
||||
// assume true if we are at the end of the list,
|
||||
// otherwise assume false
|
||||
result = applyRestrictor(query->restrictor(), exps->size() == j);
|
||||
} else
|
||||
result = applyRestrictor(query->restrictor(), false);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool parseAspectRatio(CSSValueImpl* value, int& h, int& v)
|
||||
{
|
||||
if (value->isValueList()){
|
||||
CSSValueListImpl* valueList = static_cast<CSSValueListImpl*>(value);
|
||||
if (valueList->length() == 3) {
|
||||
CSSValueImpl* i0 = valueList->item(0);
|
||||
CSSValueImpl* i1 = valueList->item(1);
|
||||
CSSValueImpl* i2 = valueList->item(2);
|
||||
if (i0->isPrimitiveValue() && static_cast<CSSPrimitiveValueImpl*>(i0)->primitiveType() == CSSPrimitiveValue::CSS_NUMBER
|
||||
&& i1->isPrimitiveValue() && static_cast<CSSPrimitiveValueImpl*>(i1)->primitiveType() == CSSPrimitiveValue::CSS_STRING
|
||||
&& i2->isPrimitiveValue() && static_cast<CSSPrimitiveValueImpl*>(i2)->primitiveType() == CSSPrimitiveValue::CSS_NUMBER) {
|
||||
DOMString str = static_cast<CSSPrimitiveValueImpl*>(i1)->getStringValue();
|
||||
if (!str.isNull() && str.length() == 1 && str[0] == '/') {
|
||||
h = (int)static_cast<CSSPrimitiveValueImpl*>(i0)->floatValue(CSSPrimitiveValue::CSS_NUMBER);
|
||||
v = (int)static_cast<CSSPrimitiveValueImpl*>(i2)->floatValue(CSSPrimitiveValue::CSS_NUMBER);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool compareValue(T a, T b, MediaFeaturePrefix op)
|
||||
{
|
||||
switch (op) {
|
||||
case MinPrefix:
|
||||
return a >= b;
|
||||
case MaxPrefix:
|
||||
return a <= b;
|
||||
case NoPrefix:
|
||||
return a == b;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool numberValue(CSSValueImpl* value, float& result)
|
||||
{
|
||||
if (value->isPrimitiveValue()
|
||||
&& static_cast<CSSPrimitiveValueImpl*>(value)->primitiveType() == CSSPrimitiveValue::CSS_NUMBER) {
|
||||
result = static_cast<CSSPrimitiveValueImpl*>(value)->floatValue(CSSPrimitiveValue::CSS_NUMBER);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool color_indexMediaFeatureEval(CSSValueImpl* value, RenderStyle*, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
unsigned int numColors = 0;
|
||||
if (printing) {
|
||||
numColors = pd->colorCount();
|
||||
} else {
|
||||
int sn = QApplication::desktop()->screenNumber( rootPart->view() );
|
||||
numColors = QApplication::desktop()->screen(sn)->colorCount();
|
||||
}
|
||||
if (numColors == INT_MAX)
|
||||
numColors = UINT_MAX;
|
||||
if (value)
|
||||
{
|
||||
float number = 0;
|
||||
return numberValue(value, number) && compareValue(numColors, static_cast<unsigned int>(number), op);
|
||||
}
|
||||
|
||||
return numColors;
|
||||
}
|
||||
|
||||
static bool colorMediaFeatureEval(CSSValueImpl* value, RenderStyle*, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
int bitsPerComponent = 0;
|
||||
if (printing) {
|
||||
if (pd->colorCount() > 2)
|
||||
bitsPerComponent = pd->depth()/3;
|
||||
// assume printer is either b&w or color.
|
||||
} else {
|
||||
int sn = QApplication::desktop()->screenNumber( rootPart->view() );
|
||||
if (QColormap::instance(sn).mode() != QColormap::Gray )
|
||||
bitsPerComponent = QApplication::desktop()->screen(sn)->depth()/3;
|
||||
}
|
||||
if (value && bitsPerComponent)
|
||||
{
|
||||
float number = 0;
|
||||
return numberValue(value, number) && compareValue(bitsPerComponent, static_cast<int>(number), op);
|
||||
}
|
||||
return bitsPerComponent;
|
||||
}
|
||||
|
||||
static bool monochromeMediaFeatureEval(CSSValueImpl* value, RenderStyle*, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
int depth = 0;
|
||||
if (printing) {
|
||||
if (pd->colorCount() < 2)
|
||||
depth = 1;
|
||||
// assume printer is either b&w or color.
|
||||
} else {
|
||||
int sn = QApplication::desktop()->screenNumber( rootPart->view() );
|
||||
if (QApplication::desktop()->screen(sn)->depth() == 1)
|
||||
depth = 1;
|
||||
else if (QColormap::instance(sn).mode() == QColormap::Gray)
|
||||
depth = QApplication::desktop()->screen(sn)->depth();
|
||||
}
|
||||
if (value)
|
||||
{
|
||||
float number = 0;
|
||||
return numberValue(value, number) && compareValue(depth, static_cast<int>(number), op);
|
||||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
static bool device_aspect_ratioMediaFeatureEval(CSSValueImpl* value, RenderStyle*, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
if (value) {
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
QRect sg;
|
||||
int h = 0, v = 0;
|
||||
if (printing) {
|
||||
sg = QRect(0, 0, pd->width(), pd->height());
|
||||
} else {
|
||||
sg = QApplication::desktop()->screen(QApplication::desktop()->screenNumber( rootPart->view() ))->rect();
|
||||
}
|
||||
if (parseAspectRatio(value, h, v))
|
||||
return v != 0 && compareValue(sg.width()*v, sg.height()*h, op);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ({,min-,max-}device-aspect-ratio)
|
||||
// assume if we have a device, its aspect ratio is non-zero
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool aspect_ratioMediaFeatureEval(CSSValueImpl* value, RenderStyle*, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
if (value) {
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
QSize vs;
|
||||
int h = 0, v = 0;
|
||||
if (printing) {
|
||||
vs= QSize(pd->width(), pd->height());
|
||||
} else {
|
||||
vs= QSize(part->view()->visibleWidth(), part->view()->visibleHeight());
|
||||
}
|
||||
if (parseAspectRatio(value, h, v))
|
||||
return v != 0 && compareValue(vs.width()*v, vs.height()*h, op);
|
||||
return false;
|
||||
}
|
||||
// ({,min-,max-}aspect-ratio)
|
||||
// assume if we have a viewport, its aspect ratio is non-zero
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool orientationMediaFeatureEval(CSSValueImpl* value, RenderStyle*, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
if (value) {
|
||||
CSSPrimitiveValueImpl* pv = static_cast<CSSPrimitiveValueImpl*>(value);
|
||||
if (!value->isPrimitiveValue() || pv->primitiveType() != CSSPrimitiveValue::CSS_IDENT ||
|
||||
(pv->getIdent() != CSS_VAL_PORTRAIT && pv->getIdent() != CSS_VAL_LANDSCAPE))
|
||||
return false;
|
||||
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
if (printing) {
|
||||
if (pd->width() > pd->height())
|
||||
return (pv->getIdent() == CSS_VAL_LANDSCAPE);
|
||||
} else {
|
||||
if (part->view()->visibleWidth() > part->view()->visibleHeight())
|
||||
return (pv->getIdent() == CSS_VAL_LANDSCAPE);
|
||||
}
|
||||
return (pv->getIdent() == CSS_VAL_PORTRAIT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool device_pixel_ratioMediaFeatureEval(CSSValueImpl *value, RenderStyle*, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
if (value)
|
||||
return value->isPrimitiveValue() && compareValue(part->zoomFactor()/100.0, static_cast<CSSPrimitiveValueImpl*>(value)->floatValue(), op);
|
||||
|
||||
return part->zoomFactor() != 0;
|
||||
}
|
||||
|
||||
static bool gridMediaFeatureEval(CSSValueImpl* value, RenderStyle*, KHTMLPart* /*part*/, MediaFeaturePrefix op)
|
||||
{
|
||||
// if output device is bitmap, grid: 0 == true
|
||||
// assume we have bitmap device
|
||||
float number;
|
||||
if (value && numberValue(value, number))
|
||||
return compareValue(static_cast<int>(number), 0, op);
|
||||
return false;
|
||||
}
|
||||
|
||||
// for printing media, we'll make the approximation that the device height == the paged box's height
|
||||
static bool device_heightMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
if (value) {
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
int height;
|
||||
if (printing)
|
||||
height = pd->height();
|
||||
else {
|
||||
height = QApplication::desktop()->screen(QApplication::desktop()->screenNumber( rootPart->view() ))->rect().height();
|
||||
doc = static_cast<DOM::DocumentImpl*>(part->document().handle());
|
||||
}
|
||||
int logicalDpiY = doc->logicalDpiY();
|
||||
return value->isPrimitiveValue() && compareValue(height, static_cast<CSSPrimitiveValueImpl*>(value)->computeLength(style, style, logicalDpiY), op);
|
||||
}
|
||||
// ({,min-,max-}device-height)
|
||||
// assume if we have a device, assume non-zero
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool device_widthMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
if (value) {
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
int width;
|
||||
if (printing)
|
||||
width = pd->width();
|
||||
else {
|
||||
width = QApplication::desktop()->screen(QApplication::desktop()->screenNumber( rootPart->view() ))->rect().width();
|
||||
doc = static_cast<DOM::DocumentImpl*>(part->document().handle());
|
||||
}
|
||||
int logicalDpiY = doc->logicalDpiY();
|
||||
return value->isPrimitiveValue() && compareValue(width, static_cast<CSSPrimitiveValueImpl*>(value)->computeLength(style, style, logicalDpiY), op);
|
||||
}
|
||||
// ({,min-,max-}device-width)
|
||||
// assume if we have a device, assume non-zero
|
||||
return true;
|
||||
}
|
||||
|
||||
// cf. http://www.w3.org/TR/css3-mediaqueries/#device-width
|
||||
// "For continuous media, this is the width of the viewport (as described by CSS2, section 9.1.1 [CSS2]).
|
||||
// For paged media, this is the width of the page box (as described by CSS2, section 13.2 [CSS2])"
|
||||
|
||||
static bool widthMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
int width;
|
||||
if (printing)
|
||||
width = pd->width();
|
||||
else {
|
||||
width = part->view()->visibleWidth();
|
||||
doc = static_cast<DOM::DocumentImpl*>(part->document().handle());
|
||||
}
|
||||
int logicalDpiY = doc->logicalDpiY();
|
||||
if (value)
|
||||
return value->isPrimitiveValue() && compareValue(width, static_cast<CSSPrimitiveValueImpl*>(value)->computeLength(style, style, logicalDpiY), op);
|
||||
|
||||
return width > 0;
|
||||
}
|
||||
|
||||
static bool heightMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
KHTMLPart* rootPart = part;
|
||||
while (rootPart->parentPart()) rootPart = rootPart->parentPart();
|
||||
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl*>(rootPart->document().handle());
|
||||
QPaintDevice *pd = doc->paintDevice();
|
||||
bool printing = pd ? (pd->devType() == QInternal::Printer) : false;
|
||||
int height;
|
||||
if (printing)
|
||||
height = pd->height();
|
||||
else {
|
||||
height = part->view()->visibleHeight();
|
||||
doc = static_cast<DOM::DocumentImpl*>(part->document().handle());
|
||||
}
|
||||
int logicalDpiY = doc->logicalDpiY();
|
||||
if (value)
|
||||
return value->isPrimitiveValue() && compareValue(height, static_cast<CSSPrimitiveValueImpl*>(value)->computeLength(style, style, logicalDpiY), op);
|
||||
|
||||
return height > 0;
|
||||
}
|
||||
|
||||
static bool resolutionMediaFeatureEval(CSSValueImpl* value, RenderStyle*, KHTMLPart* part, MediaFeaturePrefix op)
|
||||
{
|
||||
DOM::DocumentImpl *d = static_cast<DOM::DocumentImpl*>(part->document().handle());
|
||||
int logicalDpiY = d ? d->logicalDpiY() : 0;
|
||||
|
||||
if (value && logicalDpiY)
|
||||
return value->isPrimitiveValue() && compareValue(logicalDpiY, static_cast<CSSPrimitiveValueImpl*>(value)->getDPIResolution(), op);
|
||||
|
||||
return logicalDpiY != 0;
|
||||
}
|
||||
|
||||
static bool scanMediaFeatureEval(CSSValueImpl* /*value*/, RenderStyle*, KHTMLPart* /*part*/, MediaFeaturePrefix)
|
||||
{
|
||||
// no support for tv media type.
|
||||
return false;
|
||||
}
|
||||
|
||||
// rest of the functions are trampolines which set the prefix according to the media feature expression used
|
||||
|
||||
static bool min_color_indexMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return color_indexMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_color_indexMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return color_indexMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool min_colorMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return colorMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_colorMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return colorMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_monochromeMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return monochromeMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_monochromeMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return monochromeMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_device_aspect_ratioMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return device_aspect_ratioMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_device_aspect_ratioMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return device_aspect_ratioMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_aspect_ratioMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return aspect_ratioMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_aspect_ratioMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return aspect_ratioMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_device_pixel_ratioMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return device_pixel_ratioMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_device_pixel_ratioMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return device_pixel_ratioMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_heightMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return heightMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_heightMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return heightMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_widthMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return widthMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_widthMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return widthMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_device_heightMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return device_heightMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_device_heightMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return device_heightMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_device_widthMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return device_widthMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_device_widthMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return device_widthMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static bool min_resolutionMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return resolutionMediaFeatureEval(value, style, part, MinPrefix);
|
||||
}
|
||||
|
||||
static bool max_resolutionMediaFeatureEval(CSSValueImpl* value, RenderStyle* style, KHTMLPart* part, MediaFeaturePrefix /*op*/)
|
||||
{
|
||||
return resolutionMediaFeatureEval(value, style, part, MaxPrefix);
|
||||
}
|
||||
|
||||
static void createFunctionMap()
|
||||
{
|
||||
// Create the table.
|
||||
gFunctionMap = new FunctionMap;
|
||||
#define ADD_TO_FUNCTIONMAP(name, str) \
|
||||
gFunctionMap->insert(DOMString(str), name##MediaFeatureEval);
|
||||
CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(ADD_TO_FUNCTIONMAP);
|
||||
#undef ADD_TO_FUNCTIONMAP
|
||||
}
|
||||
|
||||
void MediaQueryEvaluator::cleanup() // static
|
||||
{
|
||||
delete gFunctionMap;
|
||||
gFunctionMap = 0;
|
||||
}
|
||||
|
||||
bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const
|
||||
{
|
||||
if (!m_part || !m_style)
|
||||
return m_expResult;
|
||||
|
||||
if (!gFunctionMap)
|
||||
createFunctionMap();
|
||||
|
||||
// call the media feature evaluation function. Assume no prefix
|
||||
// and let trampoline functions override the prefix if prefix is
|
||||
// used
|
||||
FunctionMap::ConstIterator func = gFunctionMap->constFind( expr->mediaFeature() );
|
||||
if (func != gFunctionMap->constEnd())
|
||||
return (*func.value())(expr->value(), m_style, m_part, NoPrefix);
|
||||
|
||||
return false;
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
* CSS Media Query
|
||||
*
|
||||
* Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
|
||||
*
|
||||
* 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 THE AUTHOR ``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 css_mediaquery_h
|
||||
#define css_mediaquery_h
|
||||
|
||||
#include "dom/dom_string.h"
|
||||
#include "css/css_valueimpl.h"
|
||||
|
||||
class KHTMLPart;
|
||||
|
||||
namespace DOM {
|
||||
class MediaListImpl;
|
||||
class ValueList;
|
||||
}
|
||||
|
||||
namespace khtml {
|
||||
|
||||
class MediaQueryExp;
|
||||
|
||||
class MediaQuery
|
||||
{
|
||||
public:
|
||||
enum Restrictor {
|
||||
Only, Not, None
|
||||
};
|
||||
|
||||
MediaQuery(Restrictor r, const DOM::DOMString& mediaType, QList<MediaQueryExp*>* exprs);
|
||||
~MediaQuery();
|
||||
|
||||
Restrictor restrictor() const { return m_restrictor; }
|
||||
const QList<MediaQueryExp*>* expressions() const { return m_expressions; }
|
||||
DOM::DOMString mediaType() const { return m_mediaType; }
|
||||
bool operator==(const MediaQuery& other) const;
|
||||
void append(MediaQueryExp* newExp) { m_expressions->append(newExp); }
|
||||
DOM::DOMString cssText() const;
|
||||
|
||||
private:
|
||||
Restrictor m_restrictor;
|
||||
DOM::DOMString m_mediaType;
|
||||
QList<MediaQueryExp*>* m_expressions;
|
||||
};
|
||||
|
||||
class CSSStyleSelector;
|
||||
class RenderStyle;
|
||||
class MediaQueryExp;
|
||||
|
||||
|
||||
/**
|
||||
* Class that evaluates css media queries as defined in
|
||||
* CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/)
|
||||
* Special constructors are needed, if simple media queries are to be
|
||||
* evaluated without knowledge of the medium features. This can happen
|
||||
* for example when parsing UA stylesheets, if evaluation is done
|
||||
* right after parsing.
|
||||
*
|
||||
* the boolean parameter is used to approximate results of evaluation, if
|
||||
* the device characteristics are not known. This can be used to prune the loading
|
||||
* of stylesheets to only those which are probable to match.
|
||||
*/
|
||||
class MediaQueryEvaluator
|
||||
{
|
||||
public:
|
||||
/** Creates evaluator which evaluates only simple media queries
|
||||
* Evaluator returns true for "all", and returns value of \mediaFeatureResult
|
||||
* for any media features
|
||||
*/
|
||||
MediaQueryEvaluator(bool mediaFeatureResult = false);
|
||||
|
||||
/** Creates evaluator which evaluates only simple media queries
|
||||
* Evaluator returns true for acceptedMediaType and returns value of \mediafeatureResult
|
||||
* for any media features
|
||||
*/
|
||||
MediaQueryEvaluator(const DOM::DOMString& acceptedMediaType, bool mediaFeatureResult = false);
|
||||
MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult = false);
|
||||
|
||||
/** Creates evaluator which evaluates full media queries
|
||||
*/
|
||||
MediaQueryEvaluator(const DOM::DOMString& acceptedMediaType, KHTMLPart*, RenderStyle*);
|
||||
|
||||
~MediaQueryEvaluator();
|
||||
|
||||
bool mediaTypeMatch(const DOM::DOMString& mediaTypeToMatch) const;
|
||||
bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const;
|
||||
|
||||
/** Evaluates a list of media queries */
|
||||
bool eval(const DOM::MediaListImpl*, CSSStyleSelector* = 0) const;
|
||||
|
||||
/** Evaluates media query subexpression, ie "and (media-feature: value)" part */
|
||||
bool eval(const MediaQueryExp*) const;
|
||||
|
||||
static void cleanup();
|
||||
|
||||
private:
|
||||
DOM::DOMString m_mediaType;
|
||||
KHTMLPart* m_part; // not owned
|
||||
RenderStyle* m_style; // not owned
|
||||
bool m_expResult;
|
||||
};
|
||||
|
||||
class MediaQueryExp
|
||||
{
|
||||
public:
|
||||
MediaQueryExp(const DOM::DOMString& mediaFeature, DOM::ValueList* values);
|
||||
~MediaQueryExp();
|
||||
|
||||
DOM::DOMString mediaFeature() const { return m_mediaFeature; }
|
||||
|
||||
DOM::CSSValueImpl* value() const { return m_value; }
|
||||
|
||||
bool operator==(const MediaQueryExp& other) const {
|
||||
return (other.m_mediaFeature == m_mediaFeature)
|
||||
&& ((!other.m_value && !m_value)
|
||||
|| (other.m_value && m_value && other.m_value->cssText() == m_value->cssText()));
|
||||
}
|
||||
|
||||
bool isViewportDependent() const { return m_viewportDependent; }
|
||||
|
||||
private:
|
||||
bool m_viewportDependent;
|
||||
DOM::DOMString m_mediaFeature;
|
||||
DOM::CSSValueImpl* m_value;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* css_renderstyleimpl.h
|
||||
*
|
||||
* Copyright 2004 Zack Rusin <zack@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef CSS_RENDERSTYLEIMPL_H
|
||||
#define CSS_RENDERSTYLEIMPL_H
|
||||
|
||||
#include "css/css_valueimpl.h"
|
||||
#include "dom/dom_string.h"
|
||||
#include "rendering/render_style.h"
|
||||
|
||||
|
||||
namespace DOM {
|
||||
class NodeImpl;
|
||||
}
|
||||
|
||||
namespace khtml {
|
||||
|
||||
|
||||
|
||||
// Used by DOM::Counter::listStyle()
|
||||
DOM::DOMString stringForListStyleType(khtml::EListStyleType type);
|
||||
|
||||
class RenderStyleDeclarationImpl : public DOM::CSSStyleDeclarationImpl
|
||||
{
|
||||
public:
|
||||
RenderStyleDeclarationImpl( DOM::NodeImpl *node );
|
||||
virtual ~RenderStyleDeclarationImpl();
|
||||
|
||||
DOM::DOMString cssText() const;
|
||||
void setCssText( DOM::DOMString str );
|
||||
|
||||
DOM::CSSValueImpl *getPropertyCSSValue( int propertyID ) const;
|
||||
DOM::DOMString getPropertyValue( int propertyID ) const;
|
||||
bool getPropertyPriority( int propertyID ) const;
|
||||
unsigned long length() const;
|
||||
|
||||
virtual void removeProperty(int propertyID, DOM::DOMString* old = 0);
|
||||
virtual bool removePropertiesInSet(const int* set, unsigned length);
|
||||
virtual bool isPropertyImplicit(int /*propertyID*/) const { return false; }
|
||||
bool setProperty ( int propertyId, const DOM::DOMString &value, bool important, int &ec );
|
||||
bool setProperty ( int propertyId, const DOM::DOMString &value, bool important = false );
|
||||
void setProperty ( int propertyId, int value, bool important = false );
|
||||
void setLengthProperty(int id, const DOM::DOMString &value, bool important, bool multiLength = false);
|
||||
|
||||
void setProperty ( const DOM::DOMString &propertyString);
|
||||
DOM::DOMString item ( unsigned long index ) const;
|
||||
|
||||
protected:
|
||||
DOM::CSSProperty property( int id ) const;
|
||||
|
||||
protected:
|
||||
SharedPtr<DOM::NodeImpl> m_node;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,516 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 2002-2003 Dirk Mueller (mueller@kde.org)
|
||||
* Copyright 2002-2008 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.
|
||||
*/
|
||||
|
||||
#include "css_ruleimpl.h"
|
||||
#include "css_stylesheetimpl.h"
|
||||
#include "css_valueimpl.h"
|
||||
#include "cssparser.h"
|
||||
|
||||
#include <dom/css_rule.h>
|
||||
#include <dom/css_stylesheet.h>
|
||||
#include <dom/dom_exception.h>
|
||||
#include <dom/dom_string.h>
|
||||
|
||||
#include <xml/dom_docimpl.h>
|
||||
|
||||
using namespace DOM;
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
CSSStyleSheetImpl *CSSRuleImpl::parentStyleSheet() const
|
||||
{
|
||||
return ( m_parent && m_parent->isCSSStyleSheet() ) ?
|
||||
static_cast<CSSStyleSheetImpl *>(m_parent) : 0;
|
||||
}
|
||||
|
||||
CSSRuleImpl *CSSRuleImpl::parentRule() const
|
||||
{
|
||||
return ( m_parent && m_parent->isRule() ) ?
|
||||
static_cast<CSSRuleImpl *>(m_parent) : 0;
|
||||
}
|
||||
|
||||
DOM::DOMString CSSRuleImpl::cssText() const
|
||||
{
|
||||
// ###
|
||||
return DOMString();
|
||||
}
|
||||
|
||||
void CSSRuleImpl::setCssText(DOM::DOMString /*str*/)
|
||||
{
|
||||
// ###
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
CSSFontFaceRuleImpl::CSSFontFaceRuleImpl(StyleBaseImpl *parent)
|
||||
: CSSRuleImpl(parent)
|
||||
{
|
||||
m_type = CSSRule::FONT_FACE_RULE;
|
||||
m_style = 0;
|
||||
}
|
||||
|
||||
CSSFontFaceRuleImpl::~CSSFontFaceRuleImpl()
|
||||
{
|
||||
if (m_style)
|
||||
m_style->deref();
|
||||
}
|
||||
|
||||
void CSSFontFaceRuleImpl::setDeclaration( CSSStyleDeclarationImpl* decl)
|
||||
{
|
||||
assert(!m_style);
|
||||
if (m_style = decl)
|
||||
m_style->ref();
|
||||
}
|
||||
|
||||
DOMString CSSFontFaceRuleImpl::cssText() const
|
||||
{
|
||||
DOMString result("@font-face");
|
||||
|
||||
result += " { ";
|
||||
result += m_style->cssText();
|
||||
result += "}";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
CSSImportRuleImpl::CSSImportRuleImpl( StyleBaseImpl *parent,
|
||||
const DOM::DOMString &href,
|
||||
MediaListImpl *media )
|
||||
: CSSRuleImpl(parent)
|
||||
{
|
||||
m_type = CSSRule::IMPORT_RULE;
|
||||
|
||||
m_lstMedia = media;
|
||||
if ( !m_lstMedia )
|
||||
m_lstMedia = new MediaListImpl( this, DOMString() );
|
||||
m_lstMedia->setParent( this );
|
||||
m_lstMedia->ref();
|
||||
|
||||
m_strHref = href;
|
||||
m_styleSheet = 0;
|
||||
|
||||
m_cachedSheet = 0;
|
||||
|
||||
init();
|
||||
}
|
||||
CSSImportRuleImpl::CSSImportRuleImpl( StyleBaseImpl *parent,
|
||||
const DOM::DOMString &href,
|
||||
const DOM::DOMString &media )
|
||||
: CSSRuleImpl(parent)
|
||||
{
|
||||
m_type = CSSRule::IMPORT_RULE;
|
||||
|
||||
m_lstMedia = new MediaListImpl( this, media );
|
||||
m_lstMedia->ref();
|
||||
|
||||
m_strHref = href;
|
||||
m_styleSheet = 0;
|
||||
|
||||
m_cachedSheet = 0;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
CSSImportRuleImpl::~CSSImportRuleImpl()
|
||||
{
|
||||
if( m_lstMedia ) {
|
||||
m_lstMedia->setParent( 0 );
|
||||
m_lstMedia->deref();
|
||||
}
|
||||
if(m_styleSheet) {
|
||||
m_styleSheet->setParent(0);
|
||||
m_styleSheet->deref();
|
||||
}
|
||||
|
||||
if(m_cachedSheet) m_cachedSheet->deref(this);
|
||||
}
|
||||
|
||||
void CSSImportRuleImpl::checkLoaded() const
|
||||
{
|
||||
if (isLoading())
|
||||
return;
|
||||
CSSRuleImpl::checkLoaded();
|
||||
}
|
||||
|
||||
void CSSImportRuleImpl::setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheetStr, const DOM::DOMString &charset, const DOM::DOMString &mimetype)
|
||||
{
|
||||
if ( m_styleSheet ) {
|
||||
m_styleSheet->setParent(0);
|
||||
m_styleSheet->deref();
|
||||
}
|
||||
m_styleSheet = new CSSStyleSheetImpl(this, url);
|
||||
m_styleSheet->setCharset(charset);
|
||||
m_styleSheet->ref();
|
||||
|
||||
CSSStyleSheetImpl *parent = parentStyleSheet();
|
||||
bool strict = parent ? parent->useStrictParsing() : true;
|
||||
DOMString sheet = sheetStr;
|
||||
if (strict && !khtml::isAcceptableCSSMimetype(mimetype))
|
||||
sheet = "";
|
||||
m_styleSheet->parseString( sheet, strict );
|
||||
m_loading = false;
|
||||
m_done = true;
|
||||
|
||||
checkLoaded();
|
||||
}
|
||||
|
||||
void CSSImportRuleImpl::error(int /*err*/, const QString &/*text*/)
|
||||
{
|
||||
if ( m_styleSheet ) {
|
||||
m_styleSheet->setParent(0);
|
||||
m_styleSheet->deref();
|
||||
}
|
||||
m_styleSheet = 0;
|
||||
|
||||
m_loading = false;
|
||||
m_done = true;
|
||||
|
||||
checkLoaded();
|
||||
}
|
||||
|
||||
bool CSSImportRuleImpl::isLoading() const
|
||||
{
|
||||
return ( m_loading || (m_styleSheet && m_styleSheet->isLoading()) );
|
||||
}
|
||||
|
||||
void CSSImportRuleImpl::init()
|
||||
{
|
||||
m_loading = 0;
|
||||
m_done = false;
|
||||
khtml::DocLoader *docLoader = 0;
|
||||
StyleBaseImpl *root = this;
|
||||
StyleBaseImpl *parent;
|
||||
while ( ( parent = root->parent()) )
|
||||
root = parent;
|
||||
if (root->isCSSStyleSheet())
|
||||
docLoader = static_cast<CSSStyleSheetImpl*>(root)->docLoader();
|
||||
|
||||
DOMString absHref = m_strHref;
|
||||
CSSStyleSheetImpl *parentSheet = parentStyleSheet();
|
||||
if (!parentSheet->href().isNull()) {
|
||||
// use parent styleheet's URL as the base URL
|
||||
absHref = KUrl(KUrl( parentSheet->href().string() ),m_strHref.string()).url();
|
||||
}
|
||||
/*
|
||||
else {
|
||||
// use documents's URL as the base URL
|
||||
DocumentImpl *doc = static_cast<CSSStyleSheetImpl*>(root)->doc();
|
||||
absHref = KUrl(doc->URL(),m_strHref.string()).url();
|
||||
}
|
||||
*/
|
||||
// Check for a cycle in our import chain. If we encounter a stylesheet
|
||||
// in our parent chain with the same URL, then just bail.
|
||||
for ( parent = static_cast<StyleBaseImpl*>( this )->parent();
|
||||
parent;
|
||||
parent = parent->parent() )
|
||||
if ( absHref == parent->baseURL().url() )
|
||||
return;
|
||||
|
||||
m_cachedSheet = docLoader->requestStyleSheet(absHref, parentStyleSheet()->charset().string());
|
||||
|
||||
if (m_cachedSheet)
|
||||
{
|
||||
// if the import rule is issued dynamically, the sheet may have already been
|
||||
// removed from the pending sheet count, so let the doc know
|
||||
// the sheet being imported is pending.
|
||||
checkPending();
|
||||
|
||||
m_loading = true;
|
||||
m_cachedSheet->ref(this);
|
||||
}
|
||||
}
|
||||
|
||||
DOMString CSSImportRuleImpl::cssText() const
|
||||
{
|
||||
DOMString result = "@import url(\"";
|
||||
result += m_strHref;
|
||||
result += "\")";
|
||||
|
||||
if (m_lstMedia) {
|
||||
result += " ";
|
||||
result += m_lstMedia->mediaText();
|
||||
}
|
||||
result += ";";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
CSSMediaRuleImpl::CSSMediaRuleImpl( StyleBaseImpl *parent, MediaListImpl *mediaList, CSSRuleListImpl *ruleList )
|
||||
: CSSRuleImpl( parent )
|
||||
{
|
||||
m_type = CSSRule::MEDIA_RULE;
|
||||
m_lstMedia = mediaList;
|
||||
if (m_lstMedia)
|
||||
m_lstMedia->ref();
|
||||
m_lstCSSRules = ruleList;
|
||||
m_lstCSSRules->ref();
|
||||
}
|
||||
|
||||
CSSMediaRuleImpl::CSSMediaRuleImpl(StyleBaseImpl *parent)
|
||||
: CSSRuleImpl( parent )
|
||||
{
|
||||
m_type = CSSRule::MEDIA_RULE;
|
||||
m_lstMedia = 0;
|
||||
m_lstCSSRules = new CSSRuleListImpl();
|
||||
m_lstCSSRules->ref();
|
||||
}
|
||||
|
||||
CSSMediaRuleImpl::CSSMediaRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &media )
|
||||
: CSSRuleImpl( parent )
|
||||
{
|
||||
m_type = CSSRule::MEDIA_RULE;
|
||||
m_lstMedia = new MediaListImpl( this, media );
|
||||
m_lstMedia->ref();
|
||||
m_lstCSSRules = new CSSRuleListImpl();
|
||||
m_lstCSSRules->ref();
|
||||
}
|
||||
|
||||
CSSMediaRuleImpl::~CSSMediaRuleImpl()
|
||||
{
|
||||
if( m_lstMedia ) {
|
||||
m_lstMedia->setParent( 0 );
|
||||
m_lstMedia->deref();
|
||||
}
|
||||
for ( unsigned int i = 0; i < m_lstCSSRules->length(); ++i )
|
||||
m_lstCSSRules->item( i )->setParent( 0 );
|
||||
m_lstCSSRules->deref();
|
||||
}
|
||||
|
||||
unsigned long CSSMediaRuleImpl::append( CSSRuleImpl *rule )
|
||||
{
|
||||
return rule ? m_lstCSSRules->insertRule( rule, m_lstCSSRules->length() ) : 0;
|
||||
}
|
||||
|
||||
unsigned long CSSMediaRuleImpl::insertRule( const DOMString &rule,
|
||||
unsigned long index )
|
||||
{
|
||||
CSSParser p( strictParsing );
|
||||
CSSRuleImpl *newRule = p.parseRule( parentStyleSheet(), rule );
|
||||
|
||||
return newRule ? m_lstCSSRules->insertRule( newRule, index ) : 0;
|
||||
}
|
||||
|
||||
DOM::DOMString CSSMediaRuleImpl::cssText() const
|
||||
{
|
||||
DOMString result("@media ");
|
||||
if (m_lstMedia) {
|
||||
result += m_lstMedia->mediaText();
|
||||
result += " ";
|
||||
}
|
||||
result += "{ \n";
|
||||
|
||||
if (m_lstCSSRules) {
|
||||
unsigned len = m_lstCSSRules->length();
|
||||
for (unsigned i = 0; i < len; i++) {
|
||||
result += " ";
|
||||
result += m_lstCSSRules->item(i)->cssText();
|
||||
result += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
result += "}";
|
||||
return result;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
CSSPageRuleImpl::CSSPageRuleImpl(StyleBaseImpl *parent)
|
||||
: CSSRuleImpl(parent)
|
||||
{
|
||||
m_type = CSSRule::PAGE_RULE;
|
||||
m_style = 0;
|
||||
}
|
||||
|
||||
CSSPageRuleImpl::~CSSPageRuleImpl()
|
||||
{
|
||||
if(m_style) m_style->deref();
|
||||
}
|
||||
|
||||
DOM::DOMString CSSPageRuleImpl::selectorText() const
|
||||
{
|
||||
// ###
|
||||
return DOMString();
|
||||
}
|
||||
|
||||
void CSSPageRuleImpl::setSelectorText(DOM::DOMString /*str*/)
|
||||
{
|
||||
// ###
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
CSSStyleRuleImpl::CSSStyleRuleImpl(StyleBaseImpl *parent)
|
||||
: CSSRuleImpl(parent)
|
||||
{
|
||||
m_type = CSSRule::STYLE_RULE;
|
||||
m_style = 0;
|
||||
m_selector = 0;
|
||||
}
|
||||
|
||||
CSSStyleRuleImpl::~CSSStyleRuleImpl()
|
||||
{
|
||||
if(m_style) {
|
||||
m_style->setParent( 0 );
|
||||
m_style->deref();
|
||||
}
|
||||
qDeleteAll(*m_selector);
|
||||
delete m_selector;
|
||||
}
|
||||
|
||||
DOMString CSSStyleRuleImpl::cssText() const
|
||||
{
|
||||
DOMString result(selectorText());
|
||||
|
||||
result += " { ";
|
||||
result += m_style->cssText();
|
||||
result += "}";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DOM::DOMString CSSStyleRuleImpl::selectorText() const
|
||||
{
|
||||
if (m_selector) {
|
||||
DOMString str;
|
||||
foreach (CSSSelector *s, *m_selector) {
|
||||
if (s != m_selector->at(0))
|
||||
str += ", ";
|
||||
str += s->selectorText();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
return DOMString();
|
||||
}
|
||||
|
||||
void CSSStyleRuleImpl::setSelectorText(DOM::DOMString /*str*/)
|
||||
{
|
||||
// ###
|
||||
}
|
||||
|
||||
bool CSSStyleRuleImpl::parseString( const DOMString &/*string*/, bool )
|
||||
{
|
||||
// ###
|
||||
return false;
|
||||
}
|
||||
|
||||
void CSSStyleRuleImpl::setDeclaration( CSSStyleDeclarationImpl *style)
|
||||
{
|
||||
if ( m_style != style ) {
|
||||
if(m_style) m_style->deref();
|
||||
m_style = style;
|
||||
if(m_style) m_style->ref();
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CSSNamespaceRuleImpl::CSSNamespaceRuleImpl(StyleBaseImpl *parent, const DOMString& prefix, const DOMString& ns)
|
||||
: CSSRuleImpl(parent)
|
||||
{
|
||||
m_type = CSSRule::NAMESPACE_RULE;
|
||||
m_prefix = prefix;
|
||||
m_namespace = ns;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CSSRuleListImpl::CSSRuleListImpl(StyleListImpl* const list, bool omitCharsetRules)
|
||||
{
|
||||
m_list = list;
|
||||
if (list && omitCharsetRules) {
|
||||
m_list = 0;
|
||||
unsigned len = list->length();
|
||||
for (unsigned i = 0; i < len; ++i) {
|
||||
StyleBaseImpl* rule = list->item(i);
|
||||
if (rule->isRule() && !rule->isCharsetRule())
|
||||
append(static_cast<CSSRuleImpl*>(rule));
|
||||
}
|
||||
} else if (m_list) {
|
||||
m_list->ref();
|
||||
}
|
||||
}
|
||||
|
||||
CSSRuleListImpl::~CSSRuleListImpl()
|
||||
{
|
||||
CSSRuleImpl* rule;
|
||||
while ( !m_lstCSSRules.isEmpty() && ( rule = m_lstCSSRules.takeFirst() ) )
|
||||
rule->deref();
|
||||
if (m_list)
|
||||
m_list->deref();
|
||||
}
|
||||
|
||||
unsigned long CSSRuleListImpl::length() const
|
||||
{
|
||||
return m_list ? m_list->length() : m_lstCSSRules.count();
|
||||
}
|
||||
|
||||
CSSRuleImpl* CSSRuleListImpl::item(unsigned long index)
|
||||
{
|
||||
if (m_list) {
|
||||
StyleBaseImpl* rule = m_list->item(index);
|
||||
assert(!rule || rule->isRule());
|
||||
return static_cast<CSSRuleImpl*>(rule);
|
||||
}
|
||||
return index < length() ? m_lstCSSRules.at(index) : 0;
|
||||
}
|
||||
|
||||
void CSSRuleListImpl::deleteRule ( unsigned long index )
|
||||
{
|
||||
assert(!m_list);
|
||||
if (index+1 > (unsigned) m_lstCSSRules.size()) {
|
||||
return;
|
||||
// ### Throw INDEX_SIZE_ERR exception here (TODO)
|
||||
}
|
||||
CSSRuleImpl *rule = m_lstCSSRules.takeAt( index );
|
||||
rule->deref();
|
||||
}
|
||||
|
||||
void CSSRuleListImpl::append(CSSRuleImpl* rule)
|
||||
{
|
||||
assert(!m_list);
|
||||
rule->ref();
|
||||
m_lstCSSRules.append( rule );
|
||||
}
|
||||
|
||||
unsigned long CSSRuleListImpl::insertRule( CSSRuleImpl *rule,
|
||||
unsigned long index )
|
||||
{
|
||||
assert(!m_list);
|
||||
if (index > (unsigned) m_lstCSSRules.size()) {
|
||||
return 0;
|
||||
// ### Throw INDEX_SIZE_ERR exception here (TODO)
|
||||
}
|
||||
|
||||
if( rule )
|
||||
{
|
||||
m_lstCSSRules.insert( index, rule );
|
||||
rule->ref();
|
||||
return index;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,260 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 2002-2003 Dirk Mueller (mueller@kde.org)
|
||||
* Copyright 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 _CSS_css_ruleimpl_h_
|
||||
#define _CSS_css_ruleimpl_h_
|
||||
|
||||
#include "dom/dom_string.h"
|
||||
#include "dom/css_rule.h"
|
||||
#include "css/css_base.h"
|
||||
#include "misc/loader_client.h"
|
||||
#include "misc/shared.h"
|
||||
|
||||
namespace khtml {
|
||||
class CachedCSSStyleSheet;
|
||||
}
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class CSSRule;
|
||||
class CSSStyleSheet;
|
||||
class CSSStyleSheetImpl;
|
||||
class CSSStyleDeclarationImpl;
|
||||
class CSSStyleListImpl;
|
||||
class MediaListImpl;
|
||||
|
||||
class CSSRuleImpl : public StyleBaseImpl
|
||||
{
|
||||
public:
|
||||
CSSRuleImpl(StyleBaseImpl *parent)
|
||||
: StyleBaseImpl(parent), m_type(CSSRule::UNKNOWN_RULE) {}
|
||||
|
||||
virtual bool isRule() const { return true; }
|
||||
unsigned short type() const { return m_type; }
|
||||
|
||||
CSSStyleSheetImpl *parentStyleSheet() const;
|
||||
CSSRuleImpl *parentRule() const;
|
||||
|
||||
virtual DOM::DOMString cssText() const;
|
||||
void setCssText(DOM::DOMString str);
|
||||
virtual void init() {}
|
||||
|
||||
protected:
|
||||
CSSRule::RuleType m_type;
|
||||
};
|
||||
|
||||
|
||||
class CSSCharsetRuleImpl : public CSSRuleImpl
|
||||
{
|
||||
public:
|
||||
CSSCharsetRuleImpl(StyleBaseImpl *parent)
|
||||
: CSSRuleImpl(parent) { m_type = CSSRule::CHARSET_RULE; }
|
||||
CSSCharsetRuleImpl(StyleBaseImpl *parent, const DOM::DOMString &encoding)
|
||||
: CSSRuleImpl(parent), m_encoding(encoding) { m_type = CSSRule::CHARSET_RULE; }
|
||||
|
||||
virtual bool isCharsetRule() const { return true; }
|
||||
|
||||
DOMString encoding() const { return m_encoding; }
|
||||
void setEncoding(DOMString _encoding) { m_encoding = _encoding; }
|
||||
virtual DOM::DOMString cssText() const { return DOMString("@charset \"") + m_encoding + DOMString("\";"); }
|
||||
protected:
|
||||
DOMString m_encoding;
|
||||
};
|
||||
|
||||
|
||||
class CSSFontFaceRuleImpl : public CSSRuleImpl
|
||||
{
|
||||
public:
|
||||
CSSFontFaceRuleImpl(StyleBaseImpl *parent);
|
||||
|
||||
virtual ~CSSFontFaceRuleImpl();
|
||||
|
||||
virtual bool isFontFaceRule() const { return true; }
|
||||
|
||||
CSSStyleDeclarationImpl *style() const { return m_style; }
|
||||
void setDeclaration( CSSStyleDeclarationImpl* decl);
|
||||
virtual DOMString cssText() const;
|
||||
protected:
|
||||
CSSStyleDeclarationImpl *m_style;
|
||||
};
|
||||
|
||||
|
||||
class CSSImportRuleImpl : public khtml::CachedObjectClient, public CSSRuleImpl
|
||||
{
|
||||
public:
|
||||
CSSImportRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &href,
|
||||
const DOM::DOMString &media );
|
||||
CSSImportRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &href,
|
||||
MediaListImpl *media );
|
||||
|
||||
virtual ~CSSImportRuleImpl();
|
||||
|
||||
DOM::DOMString href() const { return m_strHref; }
|
||||
MediaListImpl *media() const { return m_lstMedia; }
|
||||
CSSStyleSheetImpl *styleSheet() const { return m_styleSheet; }
|
||||
|
||||
virtual bool isImportRule() const { return true; }
|
||||
virtual DOM::DOMString cssText() const;
|
||||
virtual void checkLoaded() const;
|
||||
|
||||
|
||||
// from CachedObjectClient
|
||||
virtual void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet, const DOM::DOMString &charset, const DOM::DOMString& mimetype);
|
||||
virtual void error(int err, const QString &text);
|
||||
|
||||
bool isLoading() const;
|
||||
virtual void init();
|
||||
|
||||
protected:
|
||||
DOMString m_strHref;
|
||||
MediaListImpl *m_lstMedia;
|
||||
CSSStyleSheetImpl *m_styleSheet;
|
||||
khtml::CachedCSSStyleSheet *m_cachedSheet;
|
||||
bool m_loading;
|
||||
bool m_done;
|
||||
};
|
||||
|
||||
class MediaList;
|
||||
|
||||
class CSSRuleListImpl : public khtml::Shared<CSSRuleListImpl>
|
||||
{
|
||||
public:
|
||||
CSSRuleListImpl() : m_list(0) {}
|
||||
CSSRuleListImpl(StyleListImpl* const lst, bool omitCharsetRules = false);
|
||||
|
||||
~CSSRuleListImpl();
|
||||
|
||||
unsigned long length() const;
|
||||
CSSRuleImpl *item ( unsigned long index );
|
||||
|
||||
|
||||
// FIXME: Not part of the DOM. Only used by CSSMediaRuleImpl. We should be able to remove them if we changed media rules to work
|
||||
// as StyleLists instead.
|
||||
unsigned long insertRule ( CSSRuleImpl *rule, unsigned long index );
|
||||
void deleteRule ( unsigned long index );
|
||||
|
||||
void append( CSSRuleImpl *rule );
|
||||
protected:
|
||||
StyleListImpl* m_list;
|
||||
QList<CSSRuleImpl*> m_lstCSSRules;
|
||||
};
|
||||
|
||||
class CSSMediaRuleImpl : public CSSRuleImpl
|
||||
{
|
||||
public:
|
||||
CSSMediaRuleImpl( StyleBaseImpl *parent );
|
||||
CSSMediaRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &media );
|
||||
CSSMediaRuleImpl( StyleBaseImpl *parent, MediaListImpl *mediaList, CSSRuleListImpl *ruleList );
|
||||
|
||||
virtual ~CSSMediaRuleImpl();
|
||||
|
||||
MediaListImpl *media() const { return m_lstMedia; }
|
||||
CSSRuleListImpl *cssRules() { return m_lstCSSRules; }
|
||||
|
||||
unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index );
|
||||
void deleteRule ( unsigned long index ) { m_lstCSSRules->deleteRule( index ); }
|
||||
|
||||
virtual bool isMediaRule() const { return true; }
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
/* Not part of the DOM */
|
||||
unsigned long append( CSSRuleImpl *rule );
|
||||
protected:
|
||||
MediaListImpl *m_lstMedia;
|
||||
CSSRuleListImpl *m_lstCSSRules;
|
||||
};
|
||||
|
||||
|
||||
class CSSPageRuleImpl : public CSSRuleImpl
|
||||
{
|
||||
public:
|
||||
CSSPageRuleImpl(StyleBaseImpl *parent);
|
||||
|
||||
virtual ~CSSPageRuleImpl();
|
||||
|
||||
CSSStyleDeclarationImpl *style() const { return m_style; }
|
||||
|
||||
virtual bool isPageRule() const { return true; }
|
||||
|
||||
DOM::DOMString selectorText() const;
|
||||
void setSelectorText(DOM::DOMString str);
|
||||
|
||||
protected:
|
||||
CSSStyleDeclarationImpl *m_style;
|
||||
};
|
||||
|
||||
|
||||
class CSSStyleRuleImpl : public CSSRuleImpl
|
||||
{
|
||||
public:
|
||||
CSSStyleRuleImpl(StyleBaseImpl *parent);
|
||||
|
||||
virtual ~CSSStyleRuleImpl();
|
||||
|
||||
CSSStyleDeclarationImpl *style() const { return m_style; }
|
||||
|
||||
virtual bool isStyleRule() const { return true; }
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
DOM::DOMString selectorText() const;
|
||||
void setSelectorText(DOM::DOMString str);
|
||||
|
||||
virtual bool parseString( const DOMString &string, bool = false );
|
||||
|
||||
void setSelector( QList<CSSSelector*> *selector) { m_selector = selector; }
|
||||
void setDeclaration( CSSStyleDeclarationImpl *style);
|
||||
|
||||
QList<CSSSelector*> *selector() { return m_selector; }
|
||||
CSSStyleDeclarationImpl *declaration() { return m_style; }
|
||||
|
||||
protected:
|
||||
CSSStyleDeclarationImpl *m_style;
|
||||
QList<CSSSelector*> *m_selector;
|
||||
};
|
||||
|
||||
class CSSNamespaceRuleImpl : public CSSRuleImpl
|
||||
{
|
||||
public:
|
||||
CSSNamespaceRuleImpl(StyleBaseImpl *parent, const DOMString& prefix, const DOMString& ns);
|
||||
DOMString namespaceURI() const { return m_namespace; }
|
||||
DOMString prefix() const { return m_prefix; }
|
||||
|
||||
bool isDefault() const { return m_prefix.isEmpty(); }
|
||||
private:
|
||||
DOMString m_prefix;
|
||||
DOMString m_namespace;
|
||||
};
|
||||
|
||||
|
||||
class CSSUnknownRuleImpl : public CSSRuleImpl
|
||||
{
|
||||
public:
|
||||
CSSUnknownRuleImpl(StyleBaseImpl *parent) : CSSRuleImpl(parent) {}
|
||||
|
||||
virtual bool isUnknownRule() const { return true; }
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,671 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* (C) 2004 Apple Computer, Inc.
|
||||
* (C) 2008 Germain Garand <germain@ebooksfrance.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.
|
||||
*
|
||||
*/
|
||||
|
||||
//#define CSS_STYLESHEET_DEBUG
|
||||
|
||||
#include "css_stylesheetimpl.h"
|
||||
#include "css_ruleimpl.h"
|
||||
#include "css_valueimpl.h"
|
||||
#include "cssparser.h"
|
||||
#include "css_mediaquery.h"
|
||||
|
||||
#include <dom/dom_string.h>
|
||||
#include <dom/dom_exception.h>
|
||||
#include <dom/css_stylesheet.h>
|
||||
#include <dom/css_rule.h>
|
||||
#include <dom/dom_exception.h>
|
||||
|
||||
#include <xml/dom_nodeimpl.h>
|
||||
#include <html/html_documentimpl.h>
|
||||
#include <misc/loader.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
using namespace DOM;
|
||||
using namespace khtml;
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
StyleSheetImpl::StyleSheetImpl(StyleSheetImpl *parentSheet, DOMString href)
|
||||
: StyleListImpl(parentSheet)
|
||||
{
|
||||
m_disabled = false;
|
||||
m_media = 0;
|
||||
m_parentNode = 0;
|
||||
m_strHref = href;
|
||||
}
|
||||
|
||||
|
||||
StyleSheetImpl::StyleSheetImpl(DOM::NodeImpl *parentNode, DOMString href)
|
||||
: StyleListImpl()
|
||||
{
|
||||
m_parentNode = parentNode;
|
||||
m_disabled = false;
|
||||
m_media = 0;
|
||||
m_strHref = href;
|
||||
}
|
||||
|
||||
StyleSheetImpl::StyleSheetImpl(StyleBaseImpl *owner, DOMString href)
|
||||
: StyleListImpl(owner)
|
||||
{
|
||||
m_disabled = false;
|
||||
m_media = 0;
|
||||
m_parentNode = 0;
|
||||
m_strHref = href;
|
||||
}
|
||||
|
||||
StyleSheetImpl::~StyleSheetImpl()
|
||||
{
|
||||
if(m_media) {
|
||||
m_media->setParent( 0 );
|
||||
m_media->deref();
|
||||
}
|
||||
}
|
||||
|
||||
StyleSheetImpl *StyleSheetImpl::parentStyleSheet() const
|
||||
{
|
||||
if( !m_parent ) return 0;
|
||||
if( m_parent->isStyleSheet() ) return static_cast<StyleSheetImpl *>(m_parent);
|
||||
if( m_parent->isRule() ) return m_parent->stylesheet();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void StyleSheetImpl::setMedia( MediaListImpl *media )
|
||||
{
|
||||
if( media )
|
||||
media->ref();
|
||||
if( m_media ) {
|
||||
m_media->setParent( 0 );
|
||||
m_media->deref();
|
||||
}
|
||||
m_media = media;
|
||||
if (m_media)
|
||||
m_media->setParent( this );
|
||||
}
|
||||
|
||||
void StyleSheetImpl::setDisabled( bool disabled )
|
||||
{
|
||||
bool updateStyle = isCSSStyleSheet() && m_parentNode && disabled != m_disabled;
|
||||
m_disabled = disabled;
|
||||
if (updateStyle)
|
||||
m_parentNode->document()->updateStyleSelector();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
|
||||
CSSStyleSheetImpl::CSSStyleSheetImpl(CSSStyleSheetImpl *parentSheet, DOMString href)
|
||||
: StyleSheetImpl(parentSheet, href)
|
||||
{
|
||||
m_lstChildren = new QList<StyleBaseImpl*>;
|
||||
m_doc = parentSheet ? parentSheet->doc() : 0;
|
||||
m_implicit = false;
|
||||
m_namespaces = 0;
|
||||
m_defaultNamespace = NamespaceName::fromId(anyNamespace);
|
||||
m_loadedHint = false;
|
||||
}
|
||||
|
||||
CSSStyleSheetImpl::CSSStyleSheetImpl(DOM::NodeImpl *parentNode, DOMString href, bool _implicit)
|
||||
: StyleSheetImpl(parentNode, href)
|
||||
{
|
||||
m_lstChildren = new QList<StyleBaseImpl*>;
|
||||
m_doc = parentNode->document();
|
||||
m_implicit = _implicit;
|
||||
m_namespaces = 0;
|
||||
m_defaultNamespace = NamespaceName::fromId(anyNamespace);
|
||||
m_loadedHint = false;
|
||||
}
|
||||
|
||||
CSSStyleSheetImpl::CSSStyleSheetImpl(CSSRuleImpl *ownerRule, DOMString href)
|
||||
: StyleSheetImpl(ownerRule, href)
|
||||
{
|
||||
m_lstChildren = new QList<StyleBaseImpl*>;
|
||||
m_doc = static_cast<CSSStyleSheetImpl*>(ownerRule->stylesheet())->doc();
|
||||
m_implicit = false;
|
||||
m_namespaces = 0;
|
||||
m_defaultNamespace = NamespaceName::fromId(anyNamespace);
|
||||
m_loadedHint = false;
|
||||
}
|
||||
|
||||
CSSStyleSheetImpl::CSSStyleSheetImpl(DOM::NodeImpl *parentNode, CSSStyleSheetImpl *orig)
|
||||
: StyleSheetImpl(parentNode, orig->m_strHref)
|
||||
{
|
||||
m_lstChildren = new QList<StyleBaseImpl*>;
|
||||
StyleBaseImpl *rule;
|
||||
QListIterator<StyleBaseImpl*> it( *orig->m_lstChildren );
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
rule = it.next();
|
||||
m_lstChildren->append(rule);
|
||||
rule->setParent(this);
|
||||
}
|
||||
m_doc = parentNode->document();
|
||||
m_implicit = false;
|
||||
m_namespaces = 0;
|
||||
m_defaultNamespace = NamespaceName::fromId(anyNamespace);
|
||||
m_loadedHint = false;
|
||||
|
||||
recomputeNamespaceInfo(); // as we cloned kids
|
||||
}
|
||||
|
||||
CSSStyleSheetImpl::CSSStyleSheetImpl(CSSRuleImpl *ownerRule, CSSStyleSheetImpl *orig)
|
||||
: StyleSheetImpl(ownerRule, orig->m_strHref)
|
||||
{
|
||||
// m_lstChildren is deleted in StyleListImpl
|
||||
m_lstChildren = new QList<StyleBaseImpl*>;
|
||||
StyleBaseImpl *rule;
|
||||
QListIterator<StyleBaseImpl*> it( *orig->m_lstChildren );
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
rule = it.next();
|
||||
m_lstChildren->append(rule);
|
||||
rule->setParent(this);
|
||||
}
|
||||
m_doc = static_cast<CSSStyleSheetImpl*>(ownerRule->stylesheet())->doc();
|
||||
m_implicit = false;
|
||||
m_namespaces = 0;
|
||||
m_defaultNamespace = NamespaceName::fromId(anyNamespace);
|
||||
m_loadedHint = false;
|
||||
|
||||
recomputeNamespaceInfo(); // as we cloned kids
|
||||
}
|
||||
|
||||
CSSRuleImpl *CSSStyleSheetImpl::ownerRule() const
|
||||
{
|
||||
if( !m_parent ) return 0;
|
||||
if( m_parent->isRule() ) return static_cast<CSSRuleImpl *>(m_parent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long CSSStyleSheetImpl::insertRule( const DOMString &rule, unsigned long index, int &exceptioncode )
|
||||
{
|
||||
exceptioncode = 0;
|
||||
if (index > (unsigned) m_lstChildren->count()) {
|
||||
exceptioncode = DOMException::INDEX_SIZE_ERR;
|
||||
return 0;
|
||||
}
|
||||
CSSParser p( strictParsing );
|
||||
CSSRuleImpl *r = p.parseRule( this, rule );
|
||||
|
||||
if(!r) {
|
||||
exceptioncode = CSSException::SYNTAX_ERR + CSSException::_EXCEPTION_OFFSET;
|
||||
return 0;
|
||||
}
|
||||
// ###
|
||||
// HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified index e.g. if an
|
||||
//@import rule is inserted after a standard rule set or other at-rule.
|
||||
m_lstChildren->insert(index, r);
|
||||
if (m_doc)
|
||||
m_doc->updateStyleSelector(true /*shallow*/);
|
||||
|
||||
if (r->type() == DOM::CSSRule::NAMESPACE_RULE) {
|
||||
dirtyNamespaceInfo();
|
||||
if (static_cast<CSSNamespaceRuleImpl*>(r)->isDefault())
|
||||
recomputeNamespaceInfo(); // default may have changed
|
||||
// ### too late for some rules?
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
void CSSStyleSheetImpl::appendNamespaceRule(CSSNamespaceRuleImpl* ns)
|
||||
{
|
||||
append(ns);
|
||||
dirtyNamespaceInfo();
|
||||
if (ns->isDefault())
|
||||
recomputeNamespaceInfo();
|
||||
}
|
||||
|
||||
CSSRuleListImpl *CSSStyleSheetImpl::cssRules(bool omitCharsetRules)
|
||||
{
|
||||
return new CSSRuleListImpl(this, omitCharsetRules);
|
||||
}
|
||||
|
||||
void CSSStyleSheetImpl::deleteRule( unsigned long index, int &exceptioncode )
|
||||
{
|
||||
exceptioncode = 0;
|
||||
if (index+1 > (unsigned) m_lstChildren->count()) {
|
||||
exceptioncode = DOMException::INDEX_SIZE_ERR;
|
||||
return;
|
||||
}
|
||||
StyleBaseImpl *b = m_lstChildren->takeAt(index);
|
||||
|
||||
if (b->isRule() && static_cast<CSSRuleImpl*>(b)->type() == DOM::CSSRule::NAMESPACE_RULE) {
|
||||
dirtyNamespaceInfo();
|
||||
if (static_cast<CSSNamespaceRuleImpl*>(b)->isDefault())
|
||||
recomputeNamespaceInfo(); // default may have changed
|
||||
// ### too late for some rules?
|
||||
}
|
||||
|
||||
// TreeShared requires delete not deref when removed from tree
|
||||
b->setParent(0);
|
||||
if( !b->refCount() ) delete b;
|
||||
if (m_doc)
|
||||
m_doc->updateStyleSelector(true /*shallow*/);
|
||||
}
|
||||
|
||||
void CSSStyleSheetImpl::recomputeNamespaceInfo()
|
||||
{
|
||||
assert (!m_namespaces);
|
||||
|
||||
m_namespaces = new QList<CSSNamespaceRuleImpl*>;
|
||||
m_defaultNamespace = NamespaceName::fromId(anyNamespace);
|
||||
|
||||
// Compute list of all the @namespace nodes, as well as the default one.
|
||||
for (int i = 0; i < m_lstChildren->count(); ++i) {
|
||||
StyleBaseImpl* b = m_lstChildren->at(i);
|
||||
if (b->isRule() && static_cast<CSSRuleImpl*>(b)->type() == DOM::CSSRule::NAMESPACE_RULE) {
|
||||
CSSNamespaceRuleImpl* nr = static_cast<CSSNamespaceRuleImpl*>(b);
|
||||
DOM::DOMString prefix = nr->prefix();
|
||||
DOM::DOMString uri = nr->namespaceURI();
|
||||
|
||||
if (uri.isNull())
|
||||
continue;
|
||||
|
||||
if (nr->isDefault())
|
||||
m_defaultNamespace = NamespaceName::fromString(uri);
|
||||
|
||||
m_namespaces->append(nr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSSStyleSheetImpl::determineNamespace(NamespaceName& namespacename, const DOM::DOMString& prefix)
|
||||
{
|
||||
if (prefix.isEmpty())
|
||||
namespacename = NamespaceName::fromId(emptyNamespace); // No namespace. If an element/attribute has a namespace, we won't match it.
|
||||
else if (prefix == "*")
|
||||
namespacename = NamespaceName::fromId(anyNamespace); // We'll match any namespace.
|
||||
else {
|
||||
if (!m_namespaces)
|
||||
recomputeNamespaceInfo();
|
||||
|
||||
// To lookup the name, we go backwards, so the latest one wins
|
||||
for (int p = m_namespaces->count() - 1; p >= 0; --p) {
|
||||
CSSNamespaceRuleImpl* ns = m_namespaces->at(p);
|
||||
if (ns->prefix() == prefix) {
|
||||
namespacename = NamespaceName::fromString(ns->namespaceURI());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CSSStyleSheetImpl::parseString(const DOMString &string, bool strict)
|
||||
{
|
||||
#ifdef CSS_STYLESHEET_DEBUG
|
||||
kDebug( 6080 ) << "parsing sheet, len=" << string.length() << ", sheet is " << string.string();
|
||||
#endif
|
||||
|
||||
strictParsing = strict;
|
||||
CSSParser p( strict );
|
||||
p.parseSheet( this, string );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSSStyleSheetImpl::isLoading() const
|
||||
{
|
||||
StyleBaseImpl *rule;
|
||||
QListIterator<StyleBaseImpl*> it( *m_lstChildren );
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
rule = it.next();
|
||||
if(rule->isImportRule())
|
||||
{
|
||||
CSSImportRuleImpl *import = static_cast<CSSImportRuleImpl *>(rule);
|
||||
#ifdef CSS_STYLESHEET_DEBUG
|
||||
kDebug( 6080 ) << "found import";
|
||||
#endif
|
||||
if(import->isLoading())
|
||||
{
|
||||
#ifdef CSS_STYLESHEET_DEBUG
|
||||
kDebug( 6080 ) << "--> not loaded";
|
||||
#endif
|
||||
m_loadedHint = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_loadedHint = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CSSStyleSheetImpl::checkLoaded() const
|
||||
{
|
||||
if (isLoading())
|
||||
return;
|
||||
if (m_parent)
|
||||
m_parent->checkLoaded();
|
||||
if (m_parentNode)
|
||||
m_loadedHint = m_parentNode->checkRemovePendingSheet();
|
||||
else if (parentStyleSheet() && parentStyleSheet()->isCSSStyleSheet())
|
||||
m_loadedHint = static_cast<CSSStyleSheetImpl*>(parentStyleSheet())->loadedHint();
|
||||
else
|
||||
m_loadedHint = true;
|
||||
}
|
||||
|
||||
void CSSStyleSheetImpl::checkPending() const
|
||||
{
|
||||
if (!m_loadedHint)
|
||||
return;
|
||||
if (m_parent)
|
||||
m_parent->checkPending();
|
||||
else if (m_parentNode)
|
||||
m_parentNode->checkAddPendingSheet();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
StyleSheetListImpl::~StyleSheetListImpl()
|
||||
{
|
||||
foreach (StyleSheetImpl* sh, styleSheets)
|
||||
sh->deref();
|
||||
}
|
||||
|
||||
void StyleSheetListImpl::add( StyleSheetImpl* s )
|
||||
{
|
||||
if (managerDocument)
|
||||
managerDocument->ensureStyleSheetListUpToDate();
|
||||
|
||||
// ### in cases this is document.styleSheets, maybe
|
||||
// we should route to DocumentImpl::addStyleSheets?
|
||||
|
||||
if ( !styleSheets.contains( s ) ) {
|
||||
s->ref();
|
||||
styleSheets.append( s );
|
||||
}
|
||||
}
|
||||
|
||||
void StyleSheetListImpl::remove( StyleSheetImpl* s )
|
||||
{
|
||||
if (managerDocument)
|
||||
managerDocument->ensureStyleSheetListUpToDate();
|
||||
|
||||
if ( styleSheets.removeAll( s ) )
|
||||
s->deref();
|
||||
}
|
||||
|
||||
unsigned long StyleSheetListImpl::length() const
|
||||
{
|
||||
if (managerDocument)
|
||||
managerDocument->ensureStyleSheetListUpToDate();
|
||||
|
||||
// hack so implicit BODY stylesheets don't get counted here
|
||||
unsigned long l = 0;
|
||||
foreach (StyleSheetImpl* sh, styleSheets) {
|
||||
if (!sh->isCSSStyleSheet() || !static_cast<CSSStyleSheetImpl*>(sh)->implicit())
|
||||
++l;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
StyleSheetImpl *StyleSheetListImpl::item ( unsigned long index )
|
||||
{
|
||||
if (managerDocument)
|
||||
managerDocument->ensureStyleSheetListUpToDate();
|
||||
|
||||
unsigned long l = 0;
|
||||
foreach (StyleSheetImpl* sh, styleSheets) {
|
||||
if (!sh->isCSSStyleSheet() || !static_cast<CSSStyleSheetImpl*>(sh)->implicit()) {
|
||||
if (l == index)
|
||||
return sh;
|
||||
++l;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
/* MediaList is used to store 3 types of media related entities which mean the same:
|
||||
* Media Queries, Media Types and Media Descriptors.
|
||||
* Currently MediaList always tries to parse media queries and if parsing fails,
|
||||
* tries to fallback to Media Descriptors if m_fallback flag is set.
|
||||
* Slight problem with syntax error handling:
|
||||
* CSS 2.1 Spec (http://www.w3.org/TR/CSS21/media.html)
|
||||
* specifies that failing media type parsing is a syntax error
|
||||
* CSS 3 Media Queries Spec (http://www.w3.org/TR/css3-mediaqueries/)
|
||||
* specifies that failing media query is a syntax error
|
||||
* HTML 4.01 spec (http://www.w3.org/TR/REC-html40/present/styles.html#adef-media)
|
||||
* specifies that Media Descriptors should be parsed with forward-compatible syntax
|
||||
* DOM Level 2 Style Sheet spec (http://www.w3.org/TR/DOM-Level-2-Style/)
|
||||
* talks about MediaList.mediaText and refers
|
||||
* - to Media Descriptors of HTML 4.0 in context of StyleSheet
|
||||
* - to Media Types of CSS 2.0 in context of CSSMediaRule and CSSImportRule
|
||||
*
|
||||
* These facts create situation where same (illegal) media specification may result in
|
||||
* different parses depending on whether it is media attr of style element or part of
|
||||
* css @media rule.
|
||||
* <style media="screen and resolution > 40dpi"> ..</style> will be enabled on screen devices where as
|
||||
* @media screen and resolution > 40dpi {..} will not.
|
||||
* This gets more counter-intuitive in JavaScript:
|
||||
* document.styleSheets[0].media.mediaText = "screen and resolution > 40dpi" will be ok and
|
||||
* enabled, while
|
||||
* document.styleSheets[0].cssRules[0].media.mediaText = "screen and resolution > 40dpi" will
|
||||
* throw SYNTAX_ERR exception.
|
||||
*/
|
||||
|
||||
MediaListImpl::MediaListImpl( CSSStyleSheetImpl *parentSheet,
|
||||
const DOMString &media, bool fallbackToDescriptor)
|
||||
: StyleBaseImpl( parentSheet )
|
||||
, m_fallback(fallbackToDescriptor)
|
||||
{
|
||||
int ec = 0;
|
||||
setMediaText(media, ec);
|
||||
// FIXME: parsing can fail. The problem with failing constructor is that
|
||||
// we would need additional flag saying MediaList is not valid
|
||||
// Parse can fail only when fallbackToDescriptor == false, i.e when HTML4 media descriptor
|
||||
// forward-compatible syntax is not in use.
|
||||
// DOMImplementationCSS seems to mandate that media descriptors are used
|
||||
// for both html and svg, even though svg:style doesn't use media descriptors
|
||||
// Currently the only places where parsing can fail are
|
||||
// creating <svg:style>, creating css media / import rules from js
|
||||
if (ec)
|
||||
setMediaText("invalid", ec);
|
||||
}
|
||||
|
||||
MediaListImpl::MediaListImpl( CSSRuleImpl *parentRule, const DOMString &media, bool fallbackToDescriptor)
|
||||
: StyleBaseImpl(parentRule)
|
||||
, m_fallback(fallbackToDescriptor)
|
||||
{
|
||||
int ec = 0;
|
||||
setMediaText(media, ec);
|
||||
// FIXME: parsing can fail. The problem with failing constructor is that
|
||||
// we would need additional flag saying MediaList is not valid
|
||||
// Parse can fail only when fallbackToDescriptor == false, i.e when HTML4 media descriptor
|
||||
// forward-compatible syntax is not in use.
|
||||
// DOMImplementationCSS seems to mandate that media descriptors are used
|
||||
// for both html and svg, even though svg:style doesn't use media descriptors
|
||||
// Currently the only places where parsing can fail are
|
||||
// creating <svg:style>, creating css media / import rules from js
|
||||
if (ec)
|
||||
setMediaText("invalid", ec);
|
||||
}
|
||||
|
||||
MediaListImpl::~MediaListImpl()
|
||||
{
|
||||
qDeleteAll(m_queries);
|
||||
}
|
||||
|
||||
CSSStyleSheetImpl *MediaListImpl::parentStyleSheet() const
|
||||
{
|
||||
if( m_parent->isCSSStyleSheet() ) return static_cast<CSSStyleSheetImpl *>(m_parent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CSSRuleImpl *MediaListImpl::parentRule() const
|
||||
{
|
||||
if( m_parent->isRule() ) return static_cast<CSSRuleImpl *>(m_parent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DOMString parseMediaDescriptor(const DOMString& s)
|
||||
{
|
||||
int len = s.length();
|
||||
|
||||
// http://www.w3.org/TR/REC-html40/types.html#type-media-descriptors
|
||||
// "Each entry is truncated just before the first character that isn't a
|
||||
// US ASCII letter [a-zA-Z] (ISO 10646 hex 41-5a, 61-7a), digit [0-9] (hex 30-39),
|
||||
// or hyphen (hex 2d)."
|
||||
int i;
|
||||
unsigned short c;
|
||||
for (i = 0; i < len; ++i) {
|
||||
c = s[i].unicode();
|
||||
if (! ((c >= 'a' && c <= 'z')
|
||||
|| (c >= 'A' && c <= 'Z')
|
||||
|| (c >= '1' && c <= '9')
|
||||
|| (c == '-')))
|
||||
break;
|
||||
}
|
||||
return s.implementation()->substring(0, i);
|
||||
}
|
||||
|
||||
void MediaListImpl::deleteMedium(const DOMString& oldMedium, int& ec)
|
||||
{
|
||||
MediaListImpl tempMediaList;
|
||||
CSSParser p(true);
|
||||
|
||||
MediaQuery* oldQuery = 0;
|
||||
bool deleteOldQuery = false;
|
||||
|
||||
if (p.parseMediaQuery(&tempMediaList, oldMedium)) {
|
||||
if (tempMediaList.m_queries.size() > 0)
|
||||
oldQuery = tempMediaList.m_queries[0];
|
||||
} else if (m_fallback) {
|
||||
DOMString medium = parseMediaDescriptor(oldMedium);
|
||||
if (!medium.isNull()) {
|
||||
oldQuery = new MediaQuery(MediaQuery::None, medium, 0);
|
||||
deleteOldQuery = true;
|
||||
}
|
||||
}
|
||||
|
||||
// DOM Style Sheets spec doesn't allow SYNTAX_ERR to be thrown in deleteMedium
|
||||
ec = DOMException::NOT_FOUND_ERR;
|
||||
|
||||
if (oldQuery) {
|
||||
for(int i = 0; i < m_queries.size(); ++i) {
|
||||
MediaQuery* a = m_queries[i];
|
||||
if (*a == *oldQuery) {
|
||||
m_queries.removeAt(i);
|
||||
delete a;
|
||||
ec = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (deleteOldQuery)
|
||||
delete oldQuery;
|
||||
}
|
||||
}
|
||||
|
||||
DOM::DOMString MediaListImpl::mediaText() const
|
||||
{
|
||||
DOMString text;
|
||||
bool first = true;
|
||||
const QList<MediaQuery*>::ConstIterator itEnd = m_queries.end();
|
||||
|
||||
for ( QList<MediaQuery*>::ConstIterator it = m_queries.begin(); it != itEnd; ++it ) {
|
||||
if (!first)
|
||||
text += ", ";
|
||||
text += (*it)->cssText();
|
||||
first = false;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
void MediaListImpl::setMediaText(const DOM::DOMString &value, int& ec)
|
||||
{
|
||||
MediaListImpl tempMediaList;
|
||||
CSSParser p(true);
|
||||
|
||||
const QString val = value.string();
|
||||
const QStringList list = val.split( ',' );
|
||||
|
||||
const QStringList::ConstIterator itEnd = list.end();
|
||||
|
||||
for ( QStringList::ConstIterator it = list.begin(); it != itEnd; ++it )
|
||||
{
|
||||
const DOMString medium = (*it).trimmed();
|
||||
if( !medium.isEmpty() ) {
|
||||
if (!p.parseMediaQuery(&tempMediaList, medium)) {
|
||||
if (m_fallback) {
|
||||
DOMString mediaDescriptor = parseMediaDescriptor(medium);
|
||||
if (!mediaDescriptor.isNull())
|
||||
tempMediaList.m_queries.append(new MediaQuery(MediaQuery::None, mediaDescriptor, 0));
|
||||
} else {
|
||||
ec = CSSException::SYNTAX_ERR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (!m_fallback) {
|
||||
ec = CSSException::SYNTAX_ERR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// ",,,," falls straight through, but is not valid unless fallback
|
||||
if (!m_fallback && list.begin() == list.end()) {
|
||||
DOMString s = value.string().trimmed();
|
||||
if (!s.isEmpty()) {
|
||||
ec = CSSException::SYNTAX_ERR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ec = 0;
|
||||
qDeleteAll(m_queries);
|
||||
m_queries = tempMediaList.m_queries;
|
||||
tempMediaList.m_queries.clear();
|
||||
}
|
||||
|
||||
|
||||
DOMString MediaListImpl::item(unsigned long index) const
|
||||
{
|
||||
if (index < (unsigned)m_queries.size()) {
|
||||
MediaQuery* query = m_queries[index];
|
||||
return query->cssText();
|
||||
}
|
||||
|
||||
return DOMString();
|
||||
}
|
||||
|
||||
void MediaListImpl::appendMedium(const DOMString& newMedium, int& ec)
|
||||
{
|
||||
ec = DOMException::INVALID_CHARACTER_ERR;
|
||||
CSSParser p(true);
|
||||
if (p.parseMediaQuery(this, newMedium)) {
|
||||
ec = 0;
|
||||
} else if (m_fallback) {
|
||||
DOMString medium = parseMediaDescriptor(newMedium);
|
||||
if (!medium.isNull()) {
|
||||
m_queries.append(new MediaQuery(MediaQuery::None, medium, 0));
|
||||
ec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MediaListImpl::appendMediaQuery(MediaQuery* mediaQuery)
|
||||
{
|
||||
m_queries.append(mediaQuery);
|
||||
}
|
||||
|
||||
// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on; hl c++;
|
|
@ -1,201 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 2004 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 _CSS_css_stylesheetimpl_h_
|
||||
#define _CSS_css_stylesheetimpl_h_
|
||||
|
||||
#include "dom/dom_string.h"
|
||||
#include "css/css_base.h"
|
||||
#include "misc/loader_client.h"
|
||||
#include "xml/dom_docimpl.h"
|
||||
#include <QPointer>
|
||||
|
||||
namespace khtml {
|
||||
class CachedCSSStyleSheet;
|
||||
class DocLoader;
|
||||
class MediaQuery;
|
||||
}
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class StyleSheet;
|
||||
class CSSStyleSheet;
|
||||
class CSSParser;
|
||||
class MediaListImpl;
|
||||
class CSSRuleImpl;
|
||||
class CSSNamespaceRuleImpl;
|
||||
class CSSRuleListImpl;
|
||||
class NodeImpl;
|
||||
class DocumentImpl;
|
||||
|
||||
class StyleSheetImpl : public StyleListImpl
|
||||
{
|
||||
public:
|
||||
StyleSheetImpl(DOM::NodeImpl *ownerNode, DOM::DOMString href = DOMString());
|
||||
StyleSheetImpl(StyleSheetImpl *parentSheet, DOM::DOMString href = DOMString());
|
||||
StyleSheetImpl(StyleBaseImpl *owner, DOM::DOMString href = DOMString());
|
||||
StyleSheetImpl(khtml::CachedCSSStyleSheet *cached, DOM::DOMString href = DOMString());
|
||||
virtual ~StyleSheetImpl();
|
||||
|
||||
virtual bool isStyleSheet() const { return true; }
|
||||
|
||||
virtual DOM::DOMString type() const { return DOMString(); }
|
||||
|
||||
bool disabled() const { return m_disabled; }
|
||||
void setDisabled( bool disabled );
|
||||
DOM::NodeImpl *ownerNode() const { return m_parentNode; }
|
||||
StyleSheetImpl *parentStyleSheet() const;
|
||||
DOM::DOMString href() const { return m_strHref; }
|
||||
void setHref(const DOM::DOMString& href) { m_strHref = href; }
|
||||
DOM::DOMString title() const { return m_strTitle; }
|
||||
MediaListImpl *media() const { return m_media; }
|
||||
void setMedia( MediaListImpl *media );
|
||||
void setTitle( const DOM::DOMString& title ) { m_strTitle = title; }
|
||||
|
||||
protected:
|
||||
DOM::NodeImpl *m_parentNode;
|
||||
DOM::DOMString m_strHref;
|
||||
DOM::DOMString m_strTitle;
|
||||
MediaListImpl *m_media;
|
||||
bool m_disabled;
|
||||
};
|
||||
|
||||
class CSSStyleSheetImpl : public StyleSheetImpl
|
||||
{
|
||||
public:
|
||||
CSSStyleSheetImpl(DOM::NodeImpl *parentNode, DOM::DOMString href = DOMString(), bool _implicit = false);
|
||||
CSSStyleSheetImpl(CSSStyleSheetImpl *parentSheet, DOM::DOMString href = DOMString());
|
||||
CSSStyleSheetImpl(CSSRuleImpl *ownerRule, DOM::DOMString href = DOMString());
|
||||
// clone from a cached version of the sheet
|
||||
CSSStyleSheetImpl(DOM::NodeImpl *parentNode, CSSStyleSheetImpl *orig);
|
||||
CSSStyleSheetImpl(CSSRuleImpl *ownerRule, CSSStyleSheetImpl *orig);
|
||||
|
||||
~CSSStyleSheetImpl() { delete m_namespaces; }
|
||||
|
||||
virtual bool isCSSStyleSheet() const { return true; }
|
||||
|
||||
virtual DOM::DOMString type() const { return "text/css"; }
|
||||
|
||||
CSSRuleImpl *ownerRule() const;
|
||||
CSSRuleListImpl *cssRules(bool omitCharsetRule = false);
|
||||
unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index, int &exceptioncode );
|
||||
void deleteRule ( unsigned long index, int &exceptioncode );
|
||||
|
||||
void determineNamespace(NamespaceName& namespacename, const DOM::DOMString& prefix);
|
||||
quint32 defaultNamespace() { return m_defaultNamespace.id(); }
|
||||
void appendNamespaceRule(CSSNamespaceRuleImpl* ns);
|
||||
|
||||
void setCharset(const DOMString &charset) { m_charset = charset; }
|
||||
const DOMString& charset() const { return m_charset; }
|
||||
|
||||
virtual bool parseString( const DOMString &string, bool strict = true );
|
||||
|
||||
bool isLoading() const;
|
||||
|
||||
virtual void checkLoaded() const;
|
||||
virtual void checkPending() const;
|
||||
bool loadedHint() const { return m_loadedHint; }
|
||||
|
||||
// ### remove? (clients should use sheet->doc()->docLoader())
|
||||
khtml::DocLoader *docLoader() const
|
||||
{ return m_doc ? m_doc->docLoader() : 0; }
|
||||
|
||||
DocumentImpl *doc() const { return m_doc; }
|
||||
bool implicit() const { return m_implicit; }
|
||||
protected:
|
||||
void recomputeNamespaceInfo(); // updates m_defaultNamespace and m_namespaces
|
||||
// we update m_namespaces lazily, but
|
||||
// m_defaulNamespace eagerly.
|
||||
void dirtyNamespaceInfo() { delete m_namespaces; m_namespaces = 0; }
|
||||
|
||||
DocumentImpl *m_doc;
|
||||
bool m_implicit;
|
||||
mutable bool m_loadedHint;
|
||||
NamespaceName m_defaultNamespace;
|
||||
QList<CSSNamespaceRuleImpl*>* m_namespaces;
|
||||
DOMString m_charset;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class StyleSheetListImpl : public khtml::Shared<StyleSheetListImpl>
|
||||
{
|
||||
public:
|
||||
// the manager argument should be passed only when this is
|
||||
// document.styleSheets.
|
||||
StyleSheetListImpl(DocumentImpl* manager = 0): managerDocument(manager) {}
|
||||
~StyleSheetListImpl();
|
||||
|
||||
// the following two ignore implicit stylesheets
|
||||
unsigned long length() const;
|
||||
StyleSheetImpl *item ( unsigned long index );
|
||||
|
||||
void add(StyleSheetImpl* s);
|
||||
void remove(StyleSheetImpl* s);
|
||||
|
||||
QList<StyleSheetImpl*> styleSheets;
|
||||
|
||||
// we need the document pointer to make it update the stylesheet list
|
||||
// if needed for the global list. Luckily, we don't care about that if the
|
||||
// document dies, so we use QPointer to break the cycle
|
||||
QPointer<DocumentImpl> managerDocument;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class MediaListImpl : public StyleBaseImpl
|
||||
{
|
||||
public:
|
||||
MediaListImpl(bool fallbackToDescription = false)
|
||||
: StyleBaseImpl( 0 ), m_fallback(fallbackToDescription) {}
|
||||
MediaListImpl( CSSStyleSheetImpl *parentSheet, bool fallbackToDescription = false)
|
||||
: StyleBaseImpl(parentSheet), m_fallback(fallbackToDescription) {}
|
||||
MediaListImpl( CSSStyleSheetImpl *parentSheet,
|
||||
const DOM::DOMString &media, bool fallbackToDescription = false);
|
||||
MediaListImpl( CSSRuleImpl *parentRule, const DOM::DOMString &media, bool fallbackToDescription = false);
|
||||
~MediaListImpl();
|
||||
|
||||
virtual bool isMediaList() const { return true; }
|
||||
|
||||
CSSStyleSheetImpl *parentStyleSheet() const;
|
||||
CSSRuleImpl *parentRule() const;
|
||||
unsigned long length() const { return m_queries.size(); }
|
||||
DOM::DOMString item ( unsigned long index ) const;
|
||||
void deleteMedium ( const DOM::DOMString &oldMedium, int& ec);
|
||||
void appendMedium ( const DOM::DOMString &newMedium, int& ec);
|
||||
|
||||
DOM::DOMString mediaText() const;
|
||||
void setMediaText(const DOM::DOMString &value, int& ec);
|
||||
|
||||
void appendMediaQuery(khtml::MediaQuery* mediaQuery);
|
||||
const QList<khtml::MediaQuery*>* mediaQueries() const { return &m_queries; }
|
||||
|
||||
protected:
|
||||
QList<khtml::MediaQuery*> m_queries;
|
||||
bool m_fallback; // true if failed media query parsing should fallback to media description parsing
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
|
@ -1,352 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
|
||||
2004, 2005, 2007 Rob Buis <buis@kde.org>
|
||||
Copyright (C) 2005, 2006 Apple Computer, Inc.
|
||||
|
||||
This file is part of the KDE project
|
||||
|
||||
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 "cssparser.h"
|
||||
#include "cssproperties.h"
|
||||
#include "cssvalues.h"
|
||||
|
||||
#include "css/css_valueimpl.h"
|
||||
#include "css/css_svgvalueimpl.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace DOM
|
||||
{
|
||||
|
||||
bool CSSParser::parseSVGValue(int propId, bool important)
|
||||
{
|
||||
Value* value = valueList->current();
|
||||
if (!value)
|
||||
return false;
|
||||
|
||||
int id = value->id;
|
||||
|
||||
bool valid_primitive = false;
|
||||
CSSValueImpl *parsedValue = 0;
|
||||
|
||||
switch (propId) {
|
||||
/* The comment to the right defines all valid value of these
|
||||
* properties as defined in SVG 1.1, Appendix N. Property index */
|
||||
case CSS_PROP_ALIGNMENT_BASELINE:
|
||||
// auto | baseline | before-edge | text-before-edge | middle |
|
||||
// central | after-edge | text-after-edge | ideographic | alphabetic |
|
||||
// hanging | mathematical | inherit
|
||||
if (id == CSS_VAL_AUTO || id == CSS_VAL_BASELINE || id == CSS_VAL_MIDDLE ||
|
||||
(id >= CSS_VAL_BEFORE_EDGE && id <= CSS_VAL_MATHEMATICAL))
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_BASELINE_SHIFT:
|
||||
// baseline | super | sub | <percentage> | <length> | inherit
|
||||
if (id == CSS_VAL_BASELINE || id == CSS_VAL_SUB || id >= CSS_VAL_SUPER)
|
||||
valid_primitive = true;
|
||||
else
|
||||
valid_primitive = validUnit(value, FLength|FPercent, false);
|
||||
break;
|
||||
|
||||
case CSS_PROP_DOMINANT_BASELINE:
|
||||
// auto | use-script | no-change | reset-size | ideographic |
|
||||
// alphabetic | hanging | mathematical | central | middle |
|
||||
// text-after-edge | text-before-edge | inherit
|
||||
if (id == CSS_VAL_AUTO || id == CSS_VAL_MIDDLE ||
|
||||
(id >= CSS_VAL_USE_SCRIPT && id <= CSS_VAL_RESET_SIZE) ||
|
||||
(id >= CSS_VAL_CENTRAL && id <= CSS_VAL_MATHEMATICAL))
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_ENABLE_BACKGROUND:
|
||||
// accumulate | new [x] [y] [width] [height] | inherit
|
||||
if (id == CSS_VAL_ACCUMULATE) // ### TODO: new
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_MARKER_START:
|
||||
case CSS_PROP_MARKER_MID:
|
||||
case CSS_PROP_MARKER_END:
|
||||
case CSS_PROP_MASK:
|
||||
if (id == CSS_VAL_NONE)
|
||||
valid_primitive = true;
|
||||
else if (value->unit == CSSPrimitiveValue::CSS_URI) {
|
||||
parsedValue = new CSSPrimitiveValueImpl(domString(value->string), CSSPrimitiveValue::CSS_URI);
|
||||
if (parsedValue)
|
||||
valueList->next();
|
||||
}
|
||||
break;
|
||||
|
||||
case CSS_PROP_CLIP_RULE: // nonzero | evenodd | inherit
|
||||
case CSS_PROP_FILL_RULE:
|
||||
if (id == CSS_VAL_NONZERO || id == CSS_VAL_EVENODD)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_STROKE_MITERLIMIT: // <miterlimit> | inherit
|
||||
valid_primitive = validUnit(value, FNumber|FNonNeg, false);
|
||||
break;
|
||||
|
||||
case CSS_PROP_STROKE_LINEJOIN: // miter | round | bevel | inherit
|
||||
if (id == CSS_VAL_MITER || id == CSS_VAL_ROUND || id == CSS_VAL_BEVEL)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_STROKE_LINECAP: // butt | round | square | inherit
|
||||
if (id == CSS_VAL_BUTT || id == CSS_VAL_ROUND || id == CSS_VAL_SQUARE)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_STROKE_OPACITY: // <opacity-value> | inherit
|
||||
case CSS_PROP_FILL_OPACITY:
|
||||
case CSS_PROP_STOP_OPACITY:
|
||||
case CSS_PROP_FLOOD_OPACITY:
|
||||
valid_primitive = (!id && validUnit(value, FNumber|FPercent, false));
|
||||
break;
|
||||
|
||||
case CSS_PROP_SHAPE_RENDERING:
|
||||
// auto | optimizeSpeed | crispEdges | geometricPrecision | inherit
|
||||
if (id == CSS_VAL_AUTO || id == CSS_VAL_OPTIMIZESPEED ||
|
||||
id == CSS_VAL_CRISPEDGES || id == CSS_VAL_GEOMETRICPRECISION)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_TEXT_RENDERING: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit
|
||||
if (id == CSS_VAL_AUTO || id == CSS_VAL_OPTIMIZESPEED || id == CSS_VAL_OPTIMIZELEGIBILITY ||
|
||||
id == CSS_VAL_GEOMETRICPRECISION)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_IMAGE_RENDERING: // auto | optimizeSpeed |
|
||||
case CSS_PROP_COLOR_RENDERING: // optimizeQuality | inherit
|
||||
if (id == CSS_VAL_AUTO || id == CSS_VAL_OPTIMIZESPEED ||
|
||||
id == CSS_VAL_OPTIMIZEQUALITY)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_COLOR_PROFILE: // auto | sRGB | <name> | <uri> inherit
|
||||
if (id == CSS_VAL_AUTO || id == CSS_VAL_SRGB)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_COLOR_INTERPOLATION: // auto | sRGB | linearRGB | inherit
|
||||
case CSS_PROP_COLOR_INTERPOLATION_FILTERS:
|
||||
if (id == CSS_VAL_AUTO || id == CSS_VAL_SRGB || id == CSS_VAL_LINEARRGB)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_POINTER_EVENTS:
|
||||
// visiblePainted | visibleFill | visibleStroke | visible |
|
||||
// painted | fill | stroke | all | none | inherit
|
||||
if (id == CSS_VAL_VISIBLE || id == CSS_VAL_NONE ||
|
||||
(id >= CSS_VAL_VISIBLEPAINTED && id <= CSS_VAL_ALL))
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_TEXT_ANCHOR: // start | middle | end | inherit
|
||||
if (id == CSS_VAL_START || id == CSS_VAL_MIDDLE || id == CSS_VAL_END)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_GLYPH_ORIENTATION_VERTICAL: // auto | <angle> | inherit
|
||||
if (id == CSS_VAL_AUTO) {
|
||||
valid_primitive = true;
|
||||
break;
|
||||
}
|
||||
/* fallthrough intentional */
|
||||
case CSS_PROP_GLYPH_ORIENTATION_HORIZONTAL: // <angle> (restricted to _deg_ per SVG 1.1 spec) | inherit
|
||||
if (value->unit == CSSPrimitiveValue::CSS_DEG || value->unit == CSSPrimitiveValue::CSS_NUMBER) {
|
||||
parsedValue = new CSSPrimitiveValueImpl(value->fValue, CSSPrimitiveValue::CSS_DEG);
|
||||
|
||||
if (parsedValue)
|
||||
valueList->next();
|
||||
}
|
||||
break;
|
||||
|
||||
case CSS_PROP_FILL: // <paint> | inherit
|
||||
case CSS_PROP_STROKE: // <paint> | inherit
|
||||
{
|
||||
if (id == CSS_VAL_NONE)
|
||||
parsedValue = new SVGPaintImpl(SVGPaintImpl::SVG_PAINTTYPE_NONE);
|
||||
else if (id == CSS_VAL_CURRENTCOLOR)
|
||||
parsedValue = new SVGPaintImpl(SVGPaintImpl::SVG_PAINTTYPE_CURRENTCOLOR);
|
||||
else if (value->unit == CSSPrimitiveValue::CSS_URI) {
|
||||
CSSPrimitiveValueImpl* val;
|
||||
if (valueList->next() && (val = parseColorFromValue(valueList->current()/*, c, true*/))) {
|
||||
parsedValue = new SVGPaintImpl(domString(value->string), val->getRGBColorValue());
|
||||
delete val;
|
||||
} else
|
||||
parsedValue = new SVGPaintImpl(SVGPaintImpl::SVG_PAINTTYPE_URI, domString(value->string));
|
||||
} else
|
||||
parsedValue = parseSVGPaint();
|
||||
|
||||
if (parsedValue)
|
||||
valueList->next();
|
||||
}
|
||||
break;
|
||||
|
||||
/*case CSS_PROP_Color: // <color> | inherit
|
||||
if ((id >= CSS_VAL_Aqua && id <= CSS_VAL_Windowtext) ||
|
||||
(id >= CSS_VAL_Aliceblue && id <= CSS_VAL_Yellowgreen))
|
||||
parsedValue = new SVGColor(value->string);
|
||||
else
|
||||
parsedValue = parseSVGColor();
|
||||
|
||||
if (parsedValue)
|
||||
valueList->next();
|
||||
break;*/
|
||||
|
||||
case CSS_PROP_STOP_COLOR: // TODO : icccolor
|
||||
case CSS_PROP_FLOOD_COLOR:
|
||||
case CSS_PROP_LIGHTING_COLOR:
|
||||
if ((id >= CSS_VAL_AQUA && id <= CSS_VAL_WINDOWTEXT)/* ||
|
||||
(id >= CSS_VAL_Aliceblue && id <= CSS_VAL_Yellowgreen)*/)
|
||||
parsedValue = new SVGColorImpl(domString(value->string));
|
||||
else if (id == CSS_VAL_CURRENTCOLOR)
|
||||
parsedValue = new SVGColorImpl(SVGColorImpl::SVG_COLORTYPE_CURRENTCOLOR);
|
||||
else // TODO : svgcolor (iccColor)
|
||||
parsedValue = parseSVGColor();
|
||||
|
||||
if (parsedValue)
|
||||
valueList->next();
|
||||
|
||||
break;
|
||||
|
||||
case CSS_PROP_WRITING_MODE:
|
||||
// lr-tb | rl_tb | tb-rl | lr | rl | tb | inherit
|
||||
if (id >= CSS_VAL_LR_TB && id <= CSS_VAL_TB)
|
||||
valid_primitive = true;
|
||||
break;
|
||||
|
||||
case CSS_PROP_STROKE_WIDTH: // <length> | inherit
|
||||
case CSS_PROP_STROKE_DASHOFFSET:
|
||||
valid_primitive = validUnit(value, FLength | FPercent, false);
|
||||
break;
|
||||
|
||||
case CSS_PROP_STROKE_DASHARRAY: // none | <dasharray> | inherit
|
||||
if (id == CSS_VAL_NONE)
|
||||
valid_primitive = true;
|
||||
else
|
||||
parsedValue = parseSVGStrokeDasharray();
|
||||
|
||||
break;
|
||||
|
||||
case CSS_PROP_KERNING: // auto | normal | <length> | inherit
|
||||
if (id == CSS_VAL_AUTO || id == CSS_VAL_NORMAL)
|
||||
valid_primitive = true;
|
||||
else
|
||||
valid_primitive = validUnit(value, FLength, false);
|
||||
break;
|
||||
|
||||
case CSS_PROP_CLIP_PATH: // <uri> | none | inherit
|
||||
case CSS_PROP_FILTER:
|
||||
if (id == CSS_VAL_NONE)
|
||||
valid_primitive = true;
|
||||
else if (value->unit == CSSPrimitiveValue::CSS_URI) {
|
||||
parsedValue = new CSSPrimitiveValueImpl(domString(value->string), (CSSPrimitiveValue::UnitTypes) value->unit);
|
||||
if (parsedValue)
|
||||
valueList->next();
|
||||
}
|
||||
break;
|
||||
|
||||
/* shorthand properties */
|
||||
case CSS_PROP_MARKER:
|
||||
{
|
||||
const int properties[3] = { CSS_PROP_MARKER_START, CSS_PROP_MARKER_MID,
|
||||
CSS_PROP_MARKER_END };
|
||||
return parseShortHand(propId, properties, 3, important);
|
||||
|
||||
}
|
||||
default:
|
||||
// If you crash here, it's because you added a css property and are not handling it
|
||||
// in either this switch statement or the one in CSSParser::parseValue
|
||||
//ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId);
|
||||
//return false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (valid_primitive) {
|
||||
if (id != 0)
|
||||
parsedValue = new CSSPrimitiveValueImpl(id);
|
||||
else if (value->unit == CSSPrimitiveValue::CSS_STRING)
|
||||
parsedValue = new CSSPrimitiveValueImpl(domString(value->string), (CSSPrimitiveValue::UnitTypes)value->unit);
|
||||
else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
|
||||
parsedValue = new CSSPrimitiveValueImpl(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
|
||||
else if (value->unit >= Value::Q_EMS)
|
||||
parsedValue = new CSSQuirkPrimitiveValueImpl(value->fValue, CSSPrimitiveValue::CSS_EMS);
|
||||
valueList->next();
|
||||
}
|
||||
if (!parsedValue || (valueList->current() && !inShorthand())) {
|
||||
delete parsedValue;
|
||||
return false;
|
||||
}
|
||||
|
||||
addProperty(propId, parsedValue, important);
|
||||
return true;
|
||||
}
|
||||
|
||||
CSSValueImpl* CSSParser::parseSVGStrokeDasharray()
|
||||
{
|
||||
CSSValueListImpl* ret = new CSSValueListImpl(CSSValueListImpl::Comma);
|
||||
Value* value = valueList->current();
|
||||
bool valid_primitive = true;
|
||||
while (value) {
|
||||
valid_primitive = validUnit(value, FLength | FPercent |FNonNeg, false);
|
||||
if (!valid_primitive)
|
||||
break;
|
||||
if (value->id != 0)
|
||||
ret->append(new CSSPrimitiveValueImpl(value->id));
|
||||
else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
|
||||
ret->append(new CSSPrimitiveValueImpl(value->fValue, (CSSPrimitiveValue::UnitTypes) value->unit));
|
||||
value = valueList->next();
|
||||
if (value && value->unit == Value::Operator && value->iValue == ',')
|
||||
value = valueList->next();
|
||||
}
|
||||
if (!valid_primitive) {
|
||||
delete ret;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
CSSValueImpl* CSSParser::parseSVGPaint()
|
||||
{
|
||||
CSSPrimitiveValueImpl* val;
|
||||
|
||||
if (!(val = parseColorFromValue(valueList->current()/*, c, true*/)))
|
||||
return new SVGPaintImpl();
|
||||
|
||||
SVGPaintImpl* paint = new SVGPaintImpl(QColor(val->getRGBColorValue()));
|
||||
delete val;
|
||||
return paint;
|
||||
}
|
||||
|
||||
CSSValueImpl* CSSParser::parseSVGColor()
|
||||
{
|
||||
CSSPrimitiveValueImpl* val;
|
||||
if (!(val = parseColorFromValue(valueList->current()/*, c, true*/)))
|
||||
return 0;
|
||||
SVGColorImpl* color = new SVGColorImpl(QColor(val->getRGBColorValue()));
|
||||
delete val;
|
||||
return color;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,206 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
|
||||
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
|
||||
(C) 2009 Maksim Orlovich <maksim@kde.org>
|
||||
|
||||
This file is part of the KDE project
|
||||
|
||||
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 "css/css_svgvalueimpl.h"
|
||||
#include "svg/SVGException.h"
|
||||
|
||||
namespace DOM {
|
||||
|
||||
SVGColorImpl::SVGColorImpl()
|
||||
: m_colorType(SVG_COLORTYPE_UNKNOWN)
|
||||
{
|
||||
}
|
||||
|
||||
SVGColorImpl::SVGColorImpl(const DOMString& rgbColor)
|
||||
: m_colorType(SVG_COLORTYPE_RGBCOLOR)
|
||||
{
|
||||
setRGBColor(rgbColor);
|
||||
}
|
||||
|
||||
SVGColorImpl::SVGColorImpl(unsigned short colorType)
|
||||
: m_colorType(colorType)
|
||||
{}
|
||||
|
||||
SVGColorImpl::SVGColorImpl(const QColor& c)
|
||||
: m_color(c)
|
||||
, m_colorType(SVG_COLORTYPE_RGBCOLOR)
|
||||
{}
|
||||
|
||||
|
||||
SVGColorImpl::~SVGColorImpl()
|
||||
{}
|
||||
|
||||
unsigned short SVGColorImpl::colorType() const
|
||||
{
|
||||
return m_colorType;
|
||||
}
|
||||
|
||||
unsigned SVGColorImpl::rgbColor() const
|
||||
{
|
||||
return m_color.rgb();
|
||||
}
|
||||
|
||||
void SVGColorImpl::setRGBColor(const DOMString& rgbColor, int& ec)
|
||||
{
|
||||
QColor color = SVGColorImpl::colorFromRGBColorString(rgbColor);
|
||||
if (color.isValid())
|
||||
m_color = color;
|
||||
else
|
||||
ec = SVGException::SVG_INVALID_VALUE_ERR;
|
||||
}
|
||||
|
||||
QColor SVGColorImpl::colorFromRGBColorString(const DOMString& colorDOMString)
|
||||
{
|
||||
|
||||
// ### this used to disallow hsl, etc, but I think CSS3 color ought to win..
|
||||
// ### FIXME, same as canvas... where should the helper go.
|
||||
|
||||
/*DOMString s = colorDOMString.stripWhiteSpace();
|
||||
// hsl, hsla and rgba are not in the SVG spec.
|
||||
// FIXME: rework css parser so it is more svg aware
|
||||
if (s.startsWith("hsl") || s.startsWith("rgba"))
|
||||
return Color();
|
||||
RGBA32 color;
|
||||
if (CSSParser::parseColor(color, s))
|
||||
return color;
|
||||
return Color();*/
|
||||
return QColor(colorDOMString.string());
|
||||
}
|
||||
|
||||
void SVGColorImpl::setRGBColorICCColor(const DOMString& /* rgbColor */, const DOMString& /* iccColor */, int& /* ec */)
|
||||
{
|
||||
// ### TODO: implement me!
|
||||
}
|
||||
|
||||
void SVGColorImpl::setColor(unsigned short colorType, const DOMString& /* rgbColor */ , const DOMString& /* iccColor */, int& /*ec*/)
|
||||
{
|
||||
// ### TODO: implement me!
|
||||
m_colorType = colorType;
|
||||
}
|
||||
|
||||
DOMString SVGColorImpl::cssText() const
|
||||
{
|
||||
if (m_colorType == SVG_COLORTYPE_RGBCOLOR)
|
||||
return m_color.name();
|
||||
|
||||
// ### FIXME: other types?
|
||||
|
||||
return DOMString();
|
||||
}
|
||||
|
||||
const QColor& SVGColorImpl::color() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
SVGPaintImpl::SVGPaintImpl()
|
||||
: SVGColorImpl()
|
||||
, m_paintType(SVG_PAINTTYPE_UNKNOWN)
|
||||
{
|
||||
}
|
||||
|
||||
SVGPaintImpl::SVGPaintImpl(const DOMString& uri)
|
||||
: SVGColorImpl()
|
||||
, m_paintType(SVG_PAINTTYPE_URI_RGBCOLOR)
|
||||
{
|
||||
setUri(uri);
|
||||
}
|
||||
|
||||
SVGPaintImpl::SVGPaintImpl(SVGPaintType paintType)
|
||||
: SVGColorImpl()
|
||||
, m_paintType(paintType)
|
||||
{
|
||||
}
|
||||
|
||||
SVGPaintImpl::SVGPaintImpl(SVGPaintType paintType, const DOMString& uri, const DOMString& rgbPaint, const DOMString&)
|
||||
: SVGColorImpl(rgbPaint)
|
||||
, m_paintType(paintType)
|
||||
{
|
||||
setUri(uri);
|
||||
}
|
||||
|
||||
SVGPaintImpl::SVGPaintImpl(const QColor& c)
|
||||
: SVGColorImpl(c)
|
||||
, m_paintType(SVG_PAINTTYPE_RGBCOLOR)
|
||||
{
|
||||
}
|
||||
|
||||
SVGPaintImpl::SVGPaintImpl(const DOMString& uri, const QColor& c)
|
||||
: SVGColorImpl(c)
|
||||
, m_paintType(SVG_PAINTTYPE_URI_RGBCOLOR)
|
||||
{
|
||||
setUri(uri);
|
||||
}
|
||||
|
||||
SVGPaintImpl::~SVGPaintImpl()
|
||||
{
|
||||
}
|
||||
|
||||
SVGPaintImpl* SVGPaintImpl::defaultFill()
|
||||
{
|
||||
static SVGPaintImpl* _defaultFill = new SVGPaintImpl(Qt::black);
|
||||
return _defaultFill;
|
||||
}
|
||||
|
||||
SVGPaintImpl* SVGPaintImpl::defaultStroke()
|
||||
{
|
||||
static SVGPaintImpl* _defaultStroke = new SVGPaintImpl(SVG_PAINTTYPE_NONE);
|
||||
return _defaultStroke;
|
||||
}
|
||||
|
||||
DOMString SVGPaintImpl::uri() const
|
||||
{
|
||||
return m_uri;
|
||||
}
|
||||
|
||||
void SVGPaintImpl::setUri(const DOMString& uri)
|
||||
{
|
||||
m_uri = uri;
|
||||
}
|
||||
|
||||
void SVGPaintImpl::setPaint(SVGPaintType paintType, const DOMString& uri, const DOMString& rgbPaint, const DOMString&, int&)
|
||||
{
|
||||
m_paintType = paintType;
|
||||
|
||||
if (m_paintType == SVG_PAINTTYPE_URI)
|
||||
setUri(uri);
|
||||
else if (m_paintType == SVG_PAINTTYPE_RGBCOLOR)
|
||||
setRGBColor(rgbPaint);
|
||||
}
|
||||
|
||||
DOMString SVGPaintImpl::cssText() const
|
||||
{
|
||||
if (m_paintType == SVG_PAINTTYPE_NONE)
|
||||
return "none";
|
||||
else if (m_paintType == SVG_PAINTTYPE_CURRENTCOLOR)
|
||||
return "currentColor";
|
||||
else if (m_paintType == SVG_PAINTTYPE_URI)
|
||||
return m_uri; //return "url(" + m_uri + ")";
|
||||
|
||||
return SVGColorImpl::cssText();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
|
||||
2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
|
||||
Copyright (C) 2006 Samuel Weinig (sam.weinig@gmial.com)
|
||||
(C) 2009 Maksim Orlovich (maksim@kde.org)
|
||||
|
||||
This file is part of the KDE project
|
||||
|
||||
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 _CSS_svg_valueimpl_h_
|
||||
#define _CSS_svg_valueimpl_h_
|
||||
|
||||
#include <QColor>
|
||||
#include "css/css_valueimpl.h"
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class SVGCSSValueImpl : public CSSValueImpl {
|
||||
public:
|
||||
virtual bool isSVGColor() const { return false; }
|
||||
virtual bool isSVGPaint() const { return false; }
|
||||
|
||||
virtual unsigned short cssValueType() const { return DOM::CSSValue::CSS_SVG_VALUE; }
|
||||
};
|
||||
|
||||
class SVGColorImpl : public SVGCSSValueImpl {
|
||||
public:
|
||||
SVGColorImpl();
|
||||
SVGColorImpl(const DOMString& rgbColor);
|
||||
SVGColorImpl(const QColor& c);
|
||||
SVGColorImpl(unsigned short colorType);
|
||||
virtual ~SVGColorImpl();
|
||||
|
||||
enum SVGColorType {
|
||||
SVG_COLORTYPE_UNKNOWN = 0,
|
||||
SVG_COLORTYPE_RGBCOLOR = 1,
|
||||
SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2,
|
||||
SVG_COLORTYPE_CURRENTCOLOR = 3
|
||||
};
|
||||
|
||||
// 'SVGColor' functions
|
||||
unsigned short colorType() const;
|
||||
|
||||
unsigned rgbColor() const;
|
||||
|
||||
static QColor colorFromRGBColorString(const DOMString&);
|
||||
void setRGBColor(const DOMString& rgbColor) { int ignored = 0; setRGBColor(rgbColor, ignored); }
|
||||
void setRGBColor(const DOMString& rgbColor, int&);
|
||||
void setRGBColorICCColor(const DOMString& rgbColor, const DOMString& iccColor, int&);
|
||||
void setColor(unsigned short colorType, const DOMString& rgbColor, const DOMString& iccColor, int&);
|
||||
|
||||
virtual DOMString cssText() const;
|
||||
|
||||
// Helpers
|
||||
const QColor& color() const;
|
||||
|
||||
virtual bool isSVGColor() const { return true; }
|
||||
|
||||
virtual unsigned short cssValueType() const { return DOM::CSSValue::CSS_SVG_VALUE; }
|
||||
private:
|
||||
QColor m_color;
|
||||
unsigned short m_colorType;
|
||||
};
|
||||
|
||||
|
||||
class SVGPaintImpl : public SVGColorImpl {
|
||||
public:
|
||||
enum SVGPaintType {
|
||||
SVG_PAINTTYPE_UNKNOWN = 0,
|
||||
SVG_PAINTTYPE_RGBCOLOR = 1,
|
||||
SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2,
|
||||
SVG_PAINTTYPE_NONE = 101,
|
||||
SVG_PAINTTYPE_CURRENTCOLOR = 102,
|
||||
SVG_PAINTTYPE_URI_NONE = 103,
|
||||
SVG_PAINTTYPE_URI_CURRENTCOLOR = 104,
|
||||
SVG_PAINTTYPE_URI_RGBCOLOR = 105,
|
||||
SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106,
|
||||
SVG_PAINTTYPE_URI = 107
|
||||
};
|
||||
|
||||
SVGPaintImpl();
|
||||
SVGPaintImpl(const DOMString& uri);
|
||||
SVGPaintImpl(SVGPaintType);
|
||||
SVGPaintImpl(SVGPaintType, const DOMString& uri, const DOMString& rgbPaint = DOMString(), const DOMString& iccPaint = DOMString());
|
||||
SVGPaintImpl(const QColor& c);
|
||||
SVGPaintImpl(const DOMString& uri, const QColor& c);
|
||||
virtual ~SVGPaintImpl();
|
||||
|
||||
// 'SVGPaint' functions
|
||||
SVGPaintType paintType() const { return m_paintType; }
|
||||
DOMString uri() const;
|
||||
|
||||
void setUri(const DOMString&);
|
||||
void setPaint(SVGPaintType, const DOMString& uri, const DOMString& rgbPaint, const DOMString& iccPaint, int&);
|
||||
|
||||
virtual DOMString cssText() const;
|
||||
|
||||
static SVGPaintImpl* defaultFill();
|
||||
static SVGPaintImpl* defaultStroke();
|
||||
|
||||
virtual bool isSVGPaint() const { return true; }
|
||||
private:
|
||||
SVGPaintType m_paintType;
|
||||
DOMString m_uri;
|
||||
};
|
||||
|
||||
} // namespace DOM
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
File diff suppressed because it is too large
Load diff
|
@ -1,556 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* (C) 2004, 2005, 2006 Apple Computer, Inc.
|
||||
* (C) 2005 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.
|
||||
*
|
||||
*/
|
||||
#ifndef _CSS_css_valueimpl_h_
|
||||
#define _CSS_css_valueimpl_h_
|
||||
|
||||
#include "dom/css_value.h"
|
||||
#include "dom/dom_string.h"
|
||||
#include "css/css_base.h"
|
||||
#include "misc/loader_client.h"
|
||||
#include "misc/shared.h"
|
||||
|
||||
namespace khtml {
|
||||
class RenderStyle;
|
||||
class CachedImage;
|
||||
}
|
||||
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class CSSRuleImpl;
|
||||
class CSSValueImpl;
|
||||
class NodeImpl;
|
||||
class CounterImpl;
|
||||
class PairImpl;
|
||||
|
||||
|
||||
class CSSStyleDeclarationImpl : public StyleBaseImpl
|
||||
{
|
||||
public:
|
||||
CSSStyleDeclarationImpl(CSSRuleImpl *parentRule);
|
||||
CSSStyleDeclarationImpl(CSSRuleImpl *parentRule, QList<CSSProperty*> *lstValues);
|
||||
virtual ~CSSStyleDeclarationImpl();
|
||||
|
||||
CSSStyleDeclarationImpl& operator=( const CSSStyleDeclarationImpl&);
|
||||
|
||||
virtual unsigned long length() const;
|
||||
CSSRuleImpl *parentRule() const;
|
||||
virtual void removeProperty(int propertyID, DOM::DOMString* old = 0);
|
||||
virtual bool removePropertiesInSet(const int* set, unsigned length);
|
||||
virtual bool setProperty ( int propertyId, const DOM::DOMString &value, bool important, int &ec);
|
||||
virtual bool setProperty ( int propertyId, const DOM::DOMString &value, bool important = false);
|
||||
virtual void setProperty ( int propertyId, int value, bool important = false);
|
||||
virtual void clear();
|
||||
// this treats integers as pixels!
|
||||
// needed for conversion of html attributes
|
||||
virtual void setLengthProperty(int id, const DOM::DOMString &value, bool important, bool multiLength = false);
|
||||
|
||||
void setProperty(const DOMString &propertyName, const DOMString &value, const DOMString &priority);
|
||||
DOMString removeProperty(const DOMString &propertyName);
|
||||
|
||||
// add a whole, unparsed property
|
||||
virtual void setProperty ( const DOMString &propertyString);
|
||||
virtual DOM::DOMString item ( unsigned long index ) const;
|
||||
|
||||
DOM::DOMString cssText() const;
|
||||
void setCssText(const DOM::DOMString& str);
|
||||
|
||||
virtual bool isStyleDeclaration() const { return true; }
|
||||
virtual bool isPropertyImplicit(int propertyID) const;
|
||||
virtual bool parseString( const DOMString &string, bool = false );
|
||||
|
||||
CSSValueImpl *getPropertyCSSValue(const DOMString &propertyName) const;
|
||||
DOMString getPropertyValue(const DOMString &propertyName) const ;
|
||||
DOMString getPropertyPriority(const DOMString &propertyName) const;
|
||||
|
||||
virtual CSSValueImpl *getPropertyCSSValue( int propertyID ) const;
|
||||
virtual DOMString getPropertyValue( int propertyID ) const;
|
||||
virtual bool getPropertyPriority( int propertyID ) const;
|
||||
|
||||
QList<CSSProperty*> *values() const { return m_lstValues; }
|
||||
void setNode(NodeImpl *_node) { m_node = _node; }
|
||||
|
||||
virtual void setChanged();
|
||||
|
||||
protected:
|
||||
DOMString getShortHandValue( const int* properties, int number ) const;
|
||||
DOMString getCommonValue(const int* properties, int number) const;
|
||||
DOMString getLayeredShortHandValue(const int* properties, unsigned number) const;
|
||||
DOMString get4Values( const int* properties ) const;
|
||||
|
||||
QList<CSSProperty*> *m_lstValues;
|
||||
NodeImpl *m_node;
|
||||
|
||||
private:
|
||||
// currently not needed - make sure it is not used
|
||||
CSSStyleDeclarationImpl(const CSSStyleDeclarationImpl& o);
|
||||
};
|
||||
|
||||
class CSSInlineStyleDeclarationImpl : public CSSStyleDeclarationImpl
|
||||
{
|
||||
public:
|
||||
CSSInlineStyleDeclarationImpl(CSSRuleImpl *parentRule): CSSStyleDeclarationImpl(parentRule) {}
|
||||
virtual void setChanged();
|
||||
void updateFromAttribute(const DOMString &value);
|
||||
};
|
||||
|
||||
class CSSValueImpl : public StyleBaseImpl
|
||||
{
|
||||
public:
|
||||
CSSValueImpl() : StyleBaseImpl() {}
|
||||
|
||||
virtual unsigned short cssValueType() const = 0;
|
||||
|
||||
virtual DOM::DOMString cssText() const = 0;
|
||||
void setCssText(const DOM::DOMString&) { } // FIXME: Not implemented.
|
||||
|
||||
virtual bool isValue() const { return true; }
|
||||
virtual bool isFontValue() const { return false; }
|
||||
virtual bool isImplicitInitialValue() const { return false; }
|
||||
};
|
||||
|
||||
class CSSInheritedValueImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSSInheritedValueImpl() : CSSValueImpl() {}
|
||||
virtual ~CSSInheritedValueImpl() {}
|
||||
|
||||
virtual unsigned short cssValueType() const;
|
||||
virtual DOM::DOMString cssText() const;
|
||||
};
|
||||
|
||||
class CSSInitialValueImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSSInitialValueImpl(bool implicit)
|
||||
:m_implicit(implicit)
|
||||
{}
|
||||
virtual unsigned short cssValueType() const;
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
virtual bool isImplicitInitialValue() const { return m_implicit; }
|
||||
private:
|
||||
bool m_implicit; // whether this property has been created implicitly to fill undeclared properties
|
||||
// of a shorthand (e.g. 'border-top-width: medium' set from the 'border: solid red' declaration)
|
||||
};
|
||||
|
||||
class CSSValueListImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
enum Separator {
|
||||
Space,
|
||||
Comma
|
||||
};
|
||||
|
||||
CSSValueListImpl() : CSSValueImpl(), m_separator(Space) {}
|
||||
CSSValueListImpl(Separator sep) : CSSValueImpl(), m_separator(sep) {}
|
||||
|
||||
virtual ~CSSValueListImpl();
|
||||
|
||||
unsigned long length() const { return m_values.count(); }
|
||||
CSSValueImpl *item ( unsigned long index ) { return index < length() ? m_values.at(index) : 0; }
|
||||
|
||||
virtual bool isValueList() const { return true; }
|
||||
|
||||
virtual unsigned short cssValueType() const;
|
||||
|
||||
void append(CSSValueImpl *val);
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
protected:
|
||||
Separator m_separator: 1;
|
||||
QList<CSSValueImpl*> m_values;
|
||||
};
|
||||
|
||||
|
||||
class Counter;
|
||||
class RGBColor;
|
||||
class Rect;
|
||||
|
||||
class CSSPrimitiveValueImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
CSSPrimitiveValueImpl();
|
||||
CSSPrimitiveValueImpl(int ident);
|
||||
CSSPrimitiveValueImpl(double num, CSSPrimitiveValue::UnitTypes type);
|
||||
CSSPrimitiveValueImpl(const DOMString &str, CSSPrimitiveValue::UnitTypes type);
|
||||
CSSPrimitiveValueImpl(CounterImpl *c);
|
||||
CSSPrimitiveValueImpl( RectImpl *r);
|
||||
CSSPrimitiveValueImpl(QRgb color);
|
||||
CSSPrimitiveValueImpl(PairImpl *p);
|
||||
|
||||
virtual ~CSSPrimitiveValueImpl();
|
||||
|
||||
void cleanup();
|
||||
|
||||
unsigned short primitiveType() const { return m_type; }
|
||||
|
||||
/*
|
||||
* computes a length in pixels out of the given CSSValue. Need the RenderStyle to get
|
||||
* the fontinfo in case val is defined in em or ex.
|
||||
*
|
||||
* The metrics have to be a bit different for screen and printer output.
|
||||
* For screen output we assume 1 inch == 72 px, for printer we assume 300 dpi
|
||||
*
|
||||
* this is screen/printer dependent, so we probably need a config option for this,
|
||||
* and some tool to calibrate.
|
||||
*/
|
||||
int computeLength(khtml::RenderStyle *style, khtml::RenderStyle *rootStyle, int logicalDpiY);
|
||||
|
||||
double computeLengthFloat(khtml::RenderStyle *style, khtml::RenderStyle *rootStyle, int logicalDpiY);
|
||||
|
||||
/*
|
||||
* rounds a computer value into integer as appropriate. This takes
|
||||
* care of the various 4.9999999999 type cases
|
||||
*/
|
||||
static int snapValue( double result ) {
|
||||
// Conversions are imprecise, often resulting in values of, e.g., 44.99998. We
|
||||
// need to go ahead and round if we're really close to the next integer value.
|
||||
return (int)(result + (result < 0 ? -0.01 : +0.01));
|
||||
}
|
||||
|
||||
// Retrieves an explicit resolution from the CSSValue if it contains one.
|
||||
// This is specific to the CSS3 Media Queries module's resolution feature.
|
||||
int getDPIResolution() const;
|
||||
|
||||
// use with care!!!
|
||||
void setPrimitiveType(unsigned short type) { m_type = type; }
|
||||
void setFloatValue ( unsigned short unitType, double floatValue, int &exceptioncode );
|
||||
double floatValue ( unsigned short unitType = CSSPrimitiveValue::CSS_UNKNOWN) const { (void)unitType; return m_value.num; }
|
||||
|
||||
void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue, int &exceptioncode );
|
||||
DOM::DOMStringImpl *getStringValue () const {
|
||||
return ( ( m_type < CSSPrimitiveValue::CSS_STRING ||
|
||||
m_type > CSSPrimitiveValue::CSS_ATTR ||
|
||||
m_type == CSSPrimitiveValue::CSS_IDENT ) ? // fix IDENT
|
||||
0 : m_value.string );
|
||||
}
|
||||
CounterImpl *getCounterValue () const {
|
||||
return ( m_type != CSSPrimitiveValue::CSS_COUNTER ? 0 : m_value.counter );
|
||||
}
|
||||
|
||||
RectImpl *getRectValue () const {
|
||||
return ( m_type != CSSPrimitiveValue::CSS_RECT ? 0 : m_value.rect );
|
||||
}
|
||||
|
||||
QRgb getRGBColorValue () const {
|
||||
return ( m_type != CSSPrimitiveValue::CSS_RGBCOLOR ? 0 : m_value.rgbcolor );
|
||||
}
|
||||
|
||||
PairImpl* getPairValue() const {
|
||||
return (m_type != CSSPrimitiveValue::CSS_PAIR ? 0 : m_value.pair);
|
||||
}
|
||||
|
||||
virtual bool isPrimitiveValue() const { return true; }
|
||||
virtual unsigned short cssValueType() const;
|
||||
|
||||
int getIdent();
|
||||
|
||||
virtual bool parseString( const DOMString &string, bool = false);
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
virtual bool isQuirkValue() const { return false; }
|
||||
|
||||
protected:
|
||||
int m_type;
|
||||
union {
|
||||
int ident;
|
||||
double num;
|
||||
DOM::DOMStringImpl *string;
|
||||
CounterImpl *counter;
|
||||
RectImpl *rect;
|
||||
QRgb rgbcolor;
|
||||
PairImpl* pair;
|
||||
} m_value;
|
||||
};
|
||||
|
||||
// This value is used to handle quirky margins in reflow roots (body, td, and th) like WinIE.
|
||||
// The basic idea is that a stylesheet can use the value __qem (for quirky em) instead of em
|
||||
// in a stylesheet. When the quirky value is used, if you're in quirks mode, the margin will
|
||||
// collapse away inside a table cell.
|
||||
class CSSQuirkPrimitiveValueImpl : public CSSPrimitiveValueImpl
|
||||
{
|
||||
public:
|
||||
CSSQuirkPrimitiveValueImpl(double num, CSSPrimitiveValue::UnitTypes type)
|
||||
:CSSPrimitiveValueImpl(num, type) {}
|
||||
|
||||
virtual ~CSSQuirkPrimitiveValueImpl() {}
|
||||
|
||||
virtual bool isQuirkValue() const { return true; }
|
||||
};
|
||||
|
||||
class CounterImpl : public khtml::Shared<CounterImpl> {
|
||||
public:
|
||||
CounterImpl() : m_listStyle(0) { }
|
||||
DOMString identifier() const { return m_identifier; }
|
||||
unsigned int listStyle() const { return m_listStyle; }
|
||||
DOMString separator() const { return m_separator; }
|
||||
|
||||
DOMString m_identifier;
|
||||
unsigned int m_listStyle;
|
||||
DOMString m_separator;
|
||||
};
|
||||
|
||||
class RectImpl : public khtml::Shared<RectImpl> {
|
||||
public:
|
||||
RectImpl();
|
||||
~RectImpl();
|
||||
|
||||
CSSPrimitiveValueImpl *top() const { return m_top; }
|
||||
CSSPrimitiveValueImpl *right() const { return m_right; }
|
||||
CSSPrimitiveValueImpl *bottom() const { return m_bottom; }
|
||||
CSSPrimitiveValueImpl *left() const { return m_left; }
|
||||
|
||||
void setTop( CSSPrimitiveValueImpl *top );
|
||||
void setRight( CSSPrimitiveValueImpl *right );
|
||||
void setBottom( CSSPrimitiveValueImpl *bottom );
|
||||
void setLeft( CSSPrimitiveValueImpl *left );
|
||||
protected:
|
||||
CSSPrimitiveValueImpl *m_top;
|
||||
CSSPrimitiveValueImpl *m_right;
|
||||
CSSPrimitiveValueImpl *m_bottom;
|
||||
CSSPrimitiveValueImpl *m_left;
|
||||
};
|
||||
|
||||
// A primitive value representing a pair. This is useful for properties like border-radius, background-size/position,
|
||||
// and border-spacing (all of which are space-separated sets of two values). At the moment we are only using it for
|
||||
// border-radius and background-size, but (FIXME) border-spacing and background-position could be converted over to use
|
||||
// it (eliminating some extra -webkit- internal properties).
|
||||
class PairImpl : public khtml::Shared<PairImpl> {
|
||||
public:
|
||||
PairImpl() : m_first(0), m_second(0) { }
|
||||
PairImpl(CSSPrimitiveValueImpl* first, CSSPrimitiveValueImpl* second)
|
||||
: m_first(first), m_second(second) { if (first) first->ref(); if (second) second->ref(); }
|
||||
virtual ~PairImpl();
|
||||
|
||||
CSSPrimitiveValueImpl* first() const { return m_first; }
|
||||
CSSPrimitiveValueImpl* second() const { return m_second; }
|
||||
|
||||
void setFirst(CSSPrimitiveValueImpl* first);
|
||||
void setSecond(CSSPrimitiveValueImpl* second);
|
||||
|
||||
protected:
|
||||
CSSPrimitiveValueImpl* m_first;
|
||||
CSSPrimitiveValueImpl* m_second;
|
||||
};
|
||||
|
||||
|
||||
class CSSImageValueImpl : public CSSPrimitiveValueImpl, public khtml::CachedObjectClient
|
||||
{
|
||||
public:
|
||||
CSSImageValueImpl(const DOMString &url, StyleBaseImpl *style);
|
||||
CSSImageValueImpl();
|
||||
virtual ~CSSImageValueImpl();
|
||||
|
||||
khtml::CachedImage *requestCssImage(DocumentImpl*);
|
||||
protected:
|
||||
khtml::CachedImage *m_image;
|
||||
QString m_fullImageUrl;
|
||||
};
|
||||
|
||||
class FontFamilyValueImpl : public CSSPrimitiveValueImpl
|
||||
{
|
||||
public:
|
||||
FontFamilyValueImpl( const QString &string);
|
||||
const QString &fontName() const { return parsedFontName; }
|
||||
int genericFamilyType() const { return _genericFamilyType; }
|
||||
protected:
|
||||
QString parsedFontName;
|
||||
private:
|
||||
int _genericFamilyType;
|
||||
};
|
||||
|
||||
class FontValueImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
FontValueImpl();
|
||||
virtual ~FontValueImpl();
|
||||
|
||||
virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
|
||||
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
virtual bool isFontValue() const { return true; }
|
||||
|
||||
CSSPrimitiveValueImpl *style;
|
||||
CSSPrimitiveValueImpl *variant;
|
||||
CSSPrimitiveValueImpl *weight;
|
||||
CSSPrimitiveValueImpl *size;
|
||||
CSSPrimitiveValueImpl *lineHeight;
|
||||
CSSValueListImpl *family;
|
||||
};
|
||||
|
||||
// Used for quotes
|
||||
class QuotesValueImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
QuotesValueImpl();
|
||||
// virtual ~QuotesValueImpl();
|
||||
|
||||
virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
void addLevel(const QString& open, const QString& close);
|
||||
QString openQuote(int level) const;
|
||||
QString closeQuote(int level) const;
|
||||
|
||||
unsigned int levels;
|
||||
QStringList data;
|
||||
};
|
||||
|
||||
// Used for text-shadow and box-shadow
|
||||
class ShadowValueImpl : public CSSValueImpl
|
||||
{
|
||||
public:
|
||||
ShadowValueImpl(CSSPrimitiveValueImpl* _x, CSSPrimitiveValueImpl* _y,
|
||||
CSSPrimitiveValueImpl* _blur, CSSPrimitiveValueImpl* _color);
|
||||
virtual ~ShadowValueImpl();
|
||||
|
||||
virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
|
||||
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
CSSPrimitiveValueImpl* x;
|
||||
CSSPrimitiveValueImpl* y;
|
||||
CSSPrimitiveValueImpl* blur;
|
||||
CSSPrimitiveValueImpl* color;
|
||||
};
|
||||
|
||||
// Used for counter-reset and counter-increment
|
||||
class CounterActImpl : public CSSValueImpl {
|
||||
public:
|
||||
CounterActImpl(const DOMString &c, short v) : m_counter(c), m_value(v) { }
|
||||
virtual ~CounterActImpl() {}
|
||||
|
||||
virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
|
||||
virtual DOM::DOMString cssText() const;
|
||||
|
||||
const DOMString& counter() const { return m_counter; }
|
||||
short value() const { return m_value; }
|
||||
void setValue( const short v ) { m_value = v; }
|
||||
|
||||
DOM::DOMString m_counter;
|
||||
short m_value;
|
||||
};
|
||||
|
||||
|
||||
class CSSFontFaceSrcValueImpl : public CSSValueImpl {
|
||||
public:
|
||||
CSSFontFaceSrcValueImpl(const DOMString& resource, bool local)
|
||||
: m_resource(resource)
|
||||
, m_isLocal(local)
|
||||
#if 0
|
||||
//ENABLE(SVG_FONTS)
|
||||
, m_svgFontFaceElement(0)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
virtual ~CSSFontFaceSrcValueImpl() { }
|
||||
|
||||
virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
|
||||
|
||||
const DOMString& resource() const { return m_resource; }
|
||||
const DOMString& format() const { return m_format; }
|
||||
bool isLocal() const { return m_isLocal; }
|
||||
|
||||
void setFormat(const DOMString& format) { m_format = format; }
|
||||
|
||||
bool isSupportedFormat() const;
|
||||
|
||||
#if 0
|
||||
//ENABLE(SVG_FONTS)
|
||||
bool isSVGFontFaceSrc() const;
|
||||
|
||||
SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
|
||||
void setSVGFontFaceElement(SVGFontFaceElement* element) { m_svgFontFaceElement = element; }
|
||||
#endif
|
||||
|
||||
virtual DOMString cssText() const;
|
||||
|
||||
private:
|
||||
|
||||
DOMString m_resource;
|
||||
DOMString m_format;
|
||||
bool m_isLocal;
|
||||
|
||||
#if 0
|
||||
//ENABLE(SVG_FONTS)
|
||||
SVGFontFaceElement* m_svgFontFaceElement;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
// another helper class
|
||||
class CSSProperty
|
||||
{
|
||||
public:
|
||||
CSSProperty()
|
||||
{
|
||||
m_id = -1;
|
||||
m_important = false;
|
||||
m_value = 0;
|
||||
}
|
||||
CSSProperty(const CSSProperty& o)
|
||||
{
|
||||
m_id = o.m_id;
|
||||
m_important = o.m_important;
|
||||
m_value = o.m_value;
|
||||
if (m_value) m_value->ref();
|
||||
}
|
||||
~CSSProperty() {
|
||||
if(m_value) m_value->deref();
|
||||
}
|
||||
|
||||
void setValue(CSSValueImpl *val) {
|
||||
if ( val != m_value ) {
|
||||
if(m_value) m_value->deref();
|
||||
m_value = val;
|
||||
if(m_value) m_value->ref();
|
||||
}
|
||||
}
|
||||
|
||||
int id() const { return m_id; }
|
||||
|
||||
bool isImportant() const { return m_important; }
|
||||
bool isImplicit() const { return m_implicit; }
|
||||
|
||||
CSSValueImpl *value() const { return m_value; }
|
||||
|
||||
DOM::DOMString cssText() const;
|
||||
|
||||
// make sure the following fits in 4 bytes.
|
||||
signed int m_id : 28;
|
||||
bool m_important : 1;
|
||||
bool m_implicit : 1; // whether this property has been set implicitly as part of a shorthand
|
||||
// (e.g. 'margin-left: 10px' set from the 'margin: 10px' declaration)
|
||||
protected:
|
||||
CSSValueImpl *m_value;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,850 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
|
||||
* Copyright (C) 2009 Germain Garand <germain@ebooksfrance.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "css_webfont.h"
|
||||
#include "css/css_ruleimpl.h"
|
||||
#include "css/cssproperties.h"
|
||||
#include "css/cssvalues.h"
|
||||
#include "xml/dom_docimpl.h"
|
||||
#include "rendering/font.h"
|
||||
#include "rendering/render_object.h"
|
||||
#include "rendering/render_canvas.h"
|
||||
#include <kdebug.h>
|
||||
#include <QFontDatabase>
|
||||
#include <QFont>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
CSSFontFaceSource::CSSFontFaceSource(const DOMString& str, bool distant)
|
||||
: m_string(str)
|
||||
, m_font(0)
|
||||
, m_face(0)
|
||||
, m_refed(false)
|
||||
, m_distant(distant)
|
||||
#if 0
|
||||
//ENABLE(SVG_FONTS)
|
||||
, m_svgFontFaceElement(0)
|
||||
#endif
|
||||
{
|
||||
m_id = -1;
|
||||
}
|
||||
|
||||
CSSFontFaceSource::~CSSFontFaceSource()
|
||||
{
|
||||
if (m_font) {
|
||||
if (m_refed)
|
||||
m_font->deref( this );
|
||||
if (m_id != -1) {
|
||||
WTF::Vector<DOMString> names = m_face->familyNames();
|
||||
unsigned size = names.size();
|
||||
for (unsigned i = 0; i < size; i++) {
|
||||
QFont::removeSubstitution( names[i].string() );
|
||||
khtml::Font::invalidateCachedFontFamily( names[i].string() );
|
||||
}
|
||||
QFontDatabase::removeApplicationFont( m_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CSSFontFaceSource::isLoaded() const
|
||||
{
|
||||
if (m_distant)
|
||||
return m_font? m_font->isLoaded() : false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSSFontFaceSource::isValid() const
|
||||
{
|
||||
if (m_font) {
|
||||
return !m_font->hadError();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSSFontFaceSource::notifyFinished(khtml::CachedObject *finishedObj)
|
||||
{
|
||||
// Nothing to do if font already added from other src or failed to load
|
||||
if (m_face->installed() || finishedObj->hadError()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WTF::Vector<DOMString> names = m_face->familyNames();
|
||||
const unsigned size = names.size();
|
||||
|
||||
m_id = QFontDatabase::addApplicationFontFromData( m_font->font() );
|
||||
|
||||
if (m_id == -1) {
|
||||
kDebug(6080) << "WARNING: downloaded web font" << (size?names[0].string():QString()) << "was rejected by the font subsystem.";
|
||||
return;
|
||||
}
|
||||
|
||||
m_face->setInstalled();
|
||||
|
||||
QString nativeName = QFontDatabase::applicationFontFamilies( m_id )[0];
|
||||
for (unsigned i = 0; i < size; i++) {
|
||||
if (names[i].string() != nativeName) {
|
||||
QFont::insertSubstitution( names[i].string(), nativeName );
|
||||
}
|
||||
khtml::Font::invalidateCachedFontFamily( names[i].string() );
|
||||
}
|
||||
|
||||
if (m_face && m_refed) {
|
||||
m_face->fontLoaded(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CSSFontFaceSource::refLoader()
|
||||
{
|
||||
if (!m_distant)
|
||||
return;
|
||||
if (!m_font) {
|
||||
assert(m_face);
|
||||
m_font = m_face->fontSelector()->docLoader()->requestFont(m_string);
|
||||
}
|
||||
if (m_font) {
|
||||
m_font->ref( this );
|
||||
m_refed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
SimpleFontData* CSSFontFaceSource::getFontData(const FontDef& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector)
|
||||
{
|
||||
// If the font hasn't loaded or an error occurred, then we've got nothing.
|
||||
if (!isValid())
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
if (!m_font && !m_svgFontFaceElement) {
|
||||
#else
|
||||
if (!m_font) {
|
||||
#endif
|
||||
FontPlatformData* data = fontCache()->getCachedFontPlatformData(fontDescription, m_string);
|
||||
SimpleFontData* fontData = fontCache()->getCachedFontData(data);
|
||||
|
||||
// We're local. Just return a SimpleFontData from the normal cache.
|
||||
return fontData;
|
||||
}
|
||||
|
||||
// See if we have a mapping in our FontData cache.
|
||||
unsigned hashKey = fontDescription.computedPixelSize() << 2 | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
|
||||
if (SimpleFontData* cachedData = m_fontDataTable.get(hashKey))
|
||||
return cachedData;
|
||||
|
||||
OwnPtr<SimpleFontData> fontData;
|
||||
|
||||
// If we are still loading, then we let the system pick a font.
|
||||
if (isLoaded()) {
|
||||
if (m_font) {
|
||||
#if 0
|
||||
//ENABLE(SVG_FONTS)
|
||||
if (m_font->isSVGFont()) {
|
||||
// For SVG fonts parse the external SVG document, and extract the <font> element.
|
||||
if (!m_font->ensureSVGFontData())
|
||||
return 0;
|
||||
|
||||
if (!m_externalSVGFontElement)
|
||||
m_externalSVGFontElement = m_font->getSVGFontById(SVGURIReference::getTarget(m_string));
|
||||
|
||||
if (!m_externalSVGFontElement)
|
||||
return 0;
|
||||
|
||||
SVGFontFaceElement* fontFaceElement = 0;
|
||||
|
||||
// Select first <font-face> child
|
||||
for (Node* fontChild = m_externalSVGFontElement->firstChild(); fontChild; fontChild = fontChild->nextSibling()) {
|
||||
if (fontChild->hasTagName(SVGNames::font_faceTag)) {
|
||||
fontFaceElement = static_cast<SVGFontFaceElement*>(fontChild);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fontFaceElement) {
|
||||
if (!m_svgFontFaceElement) {
|
||||
// We're created using a CSS @font-face rule, that means we're not associated with a SVGFontFaceElement.
|
||||
// Use the imported <font-face> tag as referencing font-face element for these cases.
|
||||
m_svgFontFaceElement = fontFaceElement;
|
||||
}
|
||||
|
||||
SVGFontData* svgFontData = new SVGFontData(fontFaceElement);
|
||||
fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.renderingMode()), true, false, svgFontData));
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// Create new FontPlatformData from our CGFontRef, point size and ATSFontRef.
|
||||
if (!m_font->ensureCustomFontData())
|
||||
return 0;
|
||||
|
||||
fontData.set(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.renderingMode()), true, false));
|
||||
}
|
||||
} else {
|
||||
#if 0
|
||||
//ENABLE(SVG_FONTS)
|
||||
// In-Document SVG Fonts
|
||||
if (m_svgFontFaceElement) {
|
||||
SVGFontData* svgFontData = new SVGFontData(m_svgFontFaceElement);
|
||||
fontData.set(new SimpleFontData(FontPlatformData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic), true, false, svgFontData));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
// Kick off the load now.
|
||||
if (DocLoader* docLoader = fontSelector->docLoader())
|
||||
m_font->beginLoadIfNeeded(docLoader);
|
||||
// FIXME: m_string is a URL so it makes no sense to pass it as a family name.
|
||||
FontPlatformData* tempData = fontCache()->getCachedFontPlatformData(fontDescription, m_string);
|
||||
if (!tempData)
|
||||
tempData = fontCache()->getLastResortFallbackFont(fontDescription);
|
||||
fontData.set(new SimpleFontData(*tempData, true, true));
|
||||
}
|
||||
|
||||
m_fontDataTable.set(hashKey, fontData.get());
|
||||
return fontData.release();
|
||||
}
|
||||
#endif
|
||||
|
||||
CSSFontFace::~CSSFontFace()
|
||||
{
|
||||
deleteAllValues(m_sources);
|
||||
}
|
||||
|
||||
bool CSSFontFace::isLoaded() const
|
||||
{
|
||||
unsigned size = m_sources.size();
|
||||
for (unsigned i = 0; i < size; i++) {
|
||||
if (!m_sources[i]->isLoaded())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSSFontFace::isValid() const
|
||||
{
|
||||
unsigned size = m_sources.size();
|
||||
if (!size)
|
||||
return false;
|
||||
for (unsigned i = 0; i < size; i++) {
|
||||
if (m_sources[i]->isValid())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CSSFontFace::setInstalled()
|
||||
{
|
||||
m_installed = true;
|
||||
}
|
||||
|
||||
bool CSSFontFace::installed() const
|
||||
{
|
||||
return m_installed;
|
||||
}
|
||||
|
||||
void CSSFontFace::refLoaders()
|
||||
{
|
||||
if (m_refed)
|
||||
return;
|
||||
unsigned size = m_sources.size();
|
||||
if (!size)
|
||||
return;
|
||||
for (unsigned i = 0; i < size; i++) {
|
||||
m_sources[i]->refLoader();
|
||||
}
|
||||
m_refed = true;
|
||||
}
|
||||
|
||||
void CSSFontFace::addedToSegmentedFontFace(CSSSegmentedFontFace* segmentedFontFace)
|
||||
{
|
||||
(void) segmentedFontFace;
|
||||
// m_segmentedFontFaces.add(segmentedFontFace);
|
||||
}
|
||||
|
||||
void CSSFontFace::removedFromSegmentedFontFace(CSSSegmentedFontFace* segmentedFontFace)
|
||||
{
|
||||
(void) segmentedFontFace;
|
||||
// m_segmentedFontFaces.remove(segmentedFontFace);
|
||||
}
|
||||
|
||||
void CSSFontFace::addSource(CSSFontFaceSource* source)
|
||||
{
|
||||
m_sources.append(source);
|
||||
source->setFontFace(this);
|
||||
}
|
||||
|
||||
void CSSFontFace::fontLoaded(CSSFontFaceSource*)
|
||||
{
|
||||
/*
|
||||
// FIXME: Can we assert that m_segmentedFontFaces is not empty? That may
|
||||
// require stopping in-progress font loading when the last
|
||||
// CSSSegmentedFontFace is removed.
|
||||
if (m_segmentedFontFaces.isEmpty())
|
||||
return;
|
||||
|
||||
HashSet<CSSSegmentedFontFace*>::iterator end = m_segmentedFontFaces.end();
|
||||
for (HashSet<CSSSegmentedFontFace*>::iterator it = m_segmentedFontFaces.begin(); it != end; ++it)
|
||||
(*it)->fontLoaded(this);
|
||||
|
||||
// Use one of the CSSSegmentedFontFaces' font selector. They all have
|
||||
// the same font selector, so it's wasteful to store it in the CSSFontFace.
|
||||
CSSFontSelector* fontSelector = (*m_segmentedFontFaces.begin())->fontSelector();
|
||||
*/
|
||||
m_fontSelector->fontLoaded();
|
||||
}
|
||||
|
||||
#if 0
|
||||
SimpleFontData* CSSFontFace::getFontData(const FontDef& fontDescription, bool syntheticBold, bool syntheticItalic)
|
||||
{
|
||||
if (!isValid())
|
||||
return 0;
|
||||
|
||||
ASSERT(!m_segmentedFontFaces.isEmpty());
|
||||
CSSFontSelector* fontSelector = (*m_segmentedFontFaces.begin())->fontSelector();
|
||||
|
||||
SimpleFontData* result = 0;
|
||||
unsigned size = m_sources.size();
|
||||
for (unsigned i = 0; i < size && !result; i++)
|
||||
result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, fontSelector);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
CSSFontSelector::CSSFontSelector(DocumentImpl* document)
|
||||
: m_document(document)
|
||||
{
|
||||
assert(m_document);
|
||||
// fontCache()->addClient(this);
|
||||
}
|
||||
|
||||
CSSFontSelector::~CSSFontSelector()
|
||||
{
|
||||
// fontCache()->removeClient(this);
|
||||
// deleteAllValues(m_fontFaces);
|
||||
// deleteAllValues(m_locallyInstalledFontFaces);
|
||||
// deleteAllValues(m_fonts);
|
||||
QHash<DOMString, CSSFontFace*>::const_iterator cur = m_locallyInstalledFontFaces.constBegin();
|
||||
QHash<DOMString, CSSFontFace*>::const_iterator end = m_locallyInstalledFontFaces.constEnd();
|
||||
for (;cur != end; cur++)
|
||||
cur.value()->deref();
|
||||
}
|
||||
|
||||
bool CSSFontSelector::isEmpty() const
|
||||
{
|
||||
return false;
|
||||
//return m_fonts.isEmpty();
|
||||
}
|
||||
|
||||
khtml::DocLoader* CSSFontSelector::docLoader() const
|
||||
{
|
||||
return m_document ? m_document->docLoader() : 0;
|
||||
}
|
||||
|
||||
void CSSFontSelector::addFontFaceRule(const CSSFontFaceRuleImpl* fontFaceRule)
|
||||
{
|
||||
// Obtain the font-family property and the src property. Both must be defined.
|
||||
const CSSStyleDeclarationImpl* style = fontFaceRule->style();
|
||||
CSSValueImpl* fontFamily = style->getPropertyCSSValue( CSS_PROP_FONT_FAMILY );
|
||||
CSSValueImpl* src = style->getPropertyCSSValue( CSS_PROP_SRC );
|
||||
CSSValueImpl* unicodeRange = style->getPropertyCSSValue(CSS_PROP_UNICODE_RANGE);
|
||||
|
||||
if (!fontFamily || !src || !fontFamily->isValueList() || !src->isValueList() || (unicodeRange && !unicodeRange->isValueList()))
|
||||
return;
|
||||
|
||||
CSSValueListImpl* familyList = static_cast<CSSValueListImpl*>(fontFamily);
|
||||
if (!familyList->length())
|
||||
return;
|
||||
|
||||
CSSValueListImpl* srcList = static_cast<CSSValueListImpl*>(src);
|
||||
if (!srcList->length())
|
||||
return;
|
||||
|
||||
// CSSValueListImpl* rangeList = static_cast<CSSValueListImpl*>(unicodeRange);
|
||||
|
||||
unsigned traitsMask = 0;
|
||||
/*
|
||||
if (CSSValueImpl* fontStyle = style->getPropertyCSSValue(CSS_PROP_FONT_STYLE)) {
|
||||
|
||||
if (fontStyle->isPrimitiveValue()) {
|
||||
CSSValueListImpl* list = new CSSValueListImpl(CSSValueListImpl::Comma);
|
||||
list->append(fontStyle);
|
||||
fontStyle = list;
|
||||
} else if (!fontStyle->isValueList())
|
||||
return;
|
||||
|
||||
CSSValueListImpl* styleList = static_cast<CSSValueListImpl*>(fontStyle);
|
||||
unsigned numStyles = styleList->length();
|
||||
if (!numStyles)
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < numStyles; ++i) {
|
||||
switch (static_cast<CSSPrimitiveValueImpl*>(styleList[i])->getIdent()) {
|
||||
case CSS_ALL:
|
||||
traitsMask |= FontStyleMask;
|
||||
break;
|
||||
case CSS_NORMAL:
|
||||
traitsMask |= FontStyleNormalMask;
|
||||
break;
|
||||
case CSS_ITALIC:
|
||||
case CSS_OBLIQUE:
|
||||
traitsMask |= FontStyleItalicMask;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
traitsMask |= FontStyleMask;
|
||||
|
||||
if (CSSValueImpl* fontWeight = style->getPropertyCSSValue(CSS_PROP_FONT_WEIGHT)) {
|
||||
if (fontWeight->isPrimitiveValue()) {
|
||||
CSSValueListImpl* list = new CSSValueListImpl(CSSValueListImpl::Comma);
|
||||
list->append(fontWeight);
|
||||
fontWeight = list;
|
||||
} else if (!fontWeight->isValueList())
|
||||
return;
|
||||
|
||||
CSSValueListImpl* weightList = static_cast<CSSValueListImpl*>(fontWeight);
|
||||
unsigned numWeights = weightList->length();
|
||||
if (!numWeights)
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < numWeights; ++i) {
|
||||
switch (static_cast<CSSPrimitiveValueImpl*>(weightList[i])->getIdent()) {
|
||||
case CSS_VAL_ALL:
|
||||
traitsMask |= FontWeightMask;
|
||||
break;
|
||||
case CSS_VAL_BOLDER:
|
||||
case CSS_VAL_BOLD:
|
||||
case CSS_VAL_700:
|
||||
traitsMask |= FontWeight700Mask;
|
||||
break;
|
||||
case CSS_VAL_NORMAL:
|
||||
case CSS_VAL_400:
|
||||
traitsMask |= FontWeight400Mask;
|
||||
break;
|
||||
case CSS_VAL_900:
|
||||
traitsMask |= FontWeight900Mask;
|
||||
break;
|
||||
case CSS_VAL_800:
|
||||
traitsMask |= FontWeight800Mask;
|
||||
break;
|
||||
case CSS_VAL_600:
|
||||
traitsMask |= FontWeight600Mask;
|
||||
break;
|
||||
case CSS_VAL_500:
|
||||
traitsMask |= FontWeight500Mask;
|
||||
break;
|
||||
case CSS_VAL_300:
|
||||
traitsMask |= FontWeight300Mask;
|
||||
break;
|
||||
case CSS_VAL_LIGHTER:
|
||||
case CSS_VAL_200:
|
||||
traitsMask |= FontWeight200Mask;
|
||||
break;
|
||||
case CSS_VAL_100:
|
||||
traitsMask |= FontWeight100Mask;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
traitsMask |= FontWeightMask;
|
||||
|
||||
if (CSSValueImpl* fontVariant = style->getPropertyCSSValue(CSS_PROP_FONT_VARIANT)) {
|
||||
if (fontVariant->isPrimitiveValue()) {
|
||||
CSSValueListImpl* list = new CSSValueListImpl(CSSValueListImpl::Comma);
|
||||
list->append(fontVariant);
|
||||
fontVariant = list;
|
||||
} else if (!fontVariant->isValueList())
|
||||
return;
|
||||
|
||||
CSSValueListImpl* variantList = static_cast<CSSValueListImpl*>(fontVariant);
|
||||
unsigned numVariants = variantList->length();
|
||||
if (!numVariants)
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < numVariants; ++i) {
|
||||
switch (static_cast<CSSPrimitiveValueImpl*>(variantList[i])->getIdent()) {
|
||||
case CSS_VAL_ALL:
|
||||
traitsMask |= FontVariantMask;
|
||||
break;
|
||||
case CSS_VAL_NORMAL:
|
||||
traitsMask |= FontVariantNormalMask;
|
||||
break;
|
||||
case CSS_VAL_SMALL_CAPS:
|
||||
traitsMask |= FontVariantSmallCapsMask;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
traitsMask |= FontVariantNormalMask;
|
||||
*/
|
||||
|
||||
// Each item in the src property's list is a single CSSFontFaceSource. Put them all into a CSSFontFace.
|
||||
CSSFontFace* fontFace = 0;
|
||||
|
||||
const int srcLength = srcList->length();
|
||||
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
bool foundSVGFont = false;
|
||||
#endif
|
||||
for (int i = 0; i < srcLength; i++) {
|
||||
// An item in the list either specifies a string (local font name) or a URL (remote font to download).
|
||||
CSSFontFaceSrcValueImpl* item = static_cast<CSSFontFaceSrcValueImpl*>(srcList->item(i));
|
||||
CSSFontFaceSource* source = 0;
|
||||
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
foundSVGFont = item->isSVGFontFaceSrc() || item->svgFontFaceElement();
|
||||
#endif
|
||||
|
||||
if (!item->isLocal()) {
|
||||
if (item->isSupportedFormat() && m_document) {
|
||||
source = new CSSFontFaceSource(item->resource(), true /*distant*/);
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
if (foundSVGFont)
|
||||
cachedFont->setSVGFont(true);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
source = new CSSFontFaceSource(item->resource());
|
||||
}
|
||||
|
||||
if (!fontFace)
|
||||
fontFace = new CSSFontFace( static_cast<FontTraitsMask>(traitsMask), this );
|
||||
|
||||
if (source) {
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
source->setSVGFontFaceElement(item->svgFontFaceElement());
|
||||
#endif
|
||||
fontFace->addSource(source);
|
||||
}
|
||||
}
|
||||
|
||||
assert(fontFace);
|
||||
|
||||
if (fontFace && !fontFace->isValid()) {
|
||||
delete fontFace;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (rangeList) {
|
||||
unsigned numRanges = rangeList->length();
|
||||
for (unsigned i = 0; i < numRanges; i++) {
|
||||
CSSUnicodeRangeValueImpl* range = static_cast<CSSUnicodeRangeValueImpl*>(rangeList->item(i));
|
||||
fontFace->addRange(range->from(), range->to());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Hash under every single family name.
|
||||
int familyLength = familyList->length();
|
||||
for (int i = 0; i < familyLength; i++) {
|
||||
CSSPrimitiveValueImpl* item = static_cast<CSSPrimitiveValueImpl*>(familyList->item(i));
|
||||
DOMString familyName;
|
||||
if (item->primitiveType() == CSSPrimitiveValue::CSS_STRING) {
|
||||
familyName = DOMString(static_cast<FontFamilyValueImpl*>(item)->fontName());
|
||||
} else if (item->primitiveType() == CSSPrimitiveValue::CSS_IDENT) {
|
||||
// We need to use the raw text for all the generic family types, since @font-face is a way of actually
|
||||
// defining what font to use for those types.
|
||||
switch (item->getIdent()) {
|
||||
case CSS_VAL_SERIF:
|
||||
familyName = "-khtml-serif";
|
||||
break;
|
||||
case CSS_VAL_SANS_SERIF:
|
||||
familyName = "-khtml-sans-serif";
|
||||
break;
|
||||
case CSS_VAL_CURSIVE:
|
||||
familyName = "-khtml-cursive";
|
||||
break;
|
||||
case CSS_VAL_FANTASY:
|
||||
familyName = "-khtml-fantasy";
|
||||
break;
|
||||
case CSS_VAL_MONOSPACE:
|
||||
familyName = "-khtml-monospace";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (familyName.isEmpty())
|
||||
continue;
|
||||
|
||||
fontFace->addFamilyName( familyName );
|
||||
m_locallyInstalledFontFaces.insertMulti( familyName.lower(), fontFace );
|
||||
fontFace->ref();
|
||||
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
// SVG allows several <font> elements with the same font-family, differing only
|
||||
// in ie. font-variant. Be sure to pick up the right one - in getFontData below.
|
||||
if (foundSVGFont && (traitsMask & FontVariantSmallCapsMask))
|
||||
familyName += "-webkit-svg-small-caps";
|
||||
#endif
|
||||
|
||||
/*
|
||||
Vector<RefPtr<CSSFontFace> >* familyFontFaces = m_fontFaces.get(familyName);
|
||||
if (!familyFontFaces) {
|
||||
familyFontFaces = new Vector<RefPtr<CSSFontFace> >;
|
||||
m_fontFaces.set(familyName, familyFontFaces);
|
||||
|
||||
ASSERT(!m_locallyInstalledFontFaces.contains(familyName));
|
||||
Vector<RefPtr<CSSFontFace> >* familyLocallyInstalledFaces;
|
||||
|
||||
Vector<unsigned> locallyInstalledFontsTraitsMasks;
|
||||
fontCache()->getTraitsInFamily(familyName, locallyInstalledFontsTraitsMasks);
|
||||
unsigned numLocallyInstalledFaces = locallyInstalledFontsTraitsMasks.size();
|
||||
if (numLocallyInstalledFaces) {
|
||||
familyLocallyInstalledFaces = new Vector<RefPtr<CSSFontFace> >;
|
||||
m_locallyInstalledFontFaces.set(familyName, familyLocallyInstalledFaces);
|
||||
|
||||
for (unsigned i = 0; i < numLocallyInstalledFaces; ++i) {
|
||||
RefPtr<CSSFontFace> locallyInstalledFontFace = CSSFontFace::create(static_cast<FontTraitsMask>(locallyInstalledFontsTraitsMasks[i]));
|
||||
locallyInstalledFontFace->addSource(new CSSFontFaceSource(familyName));
|
||||
ASSERT(locallyInstalledFontFace->isValid());
|
||||
familyLocallyInstalledFaces->append(locallyInstalledFontFace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
familyFontFaces->append(fontFace);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void CSSFontSelector::requestFamilyName( const DOMString& familyName )
|
||||
{
|
||||
QHash<DOMString, CSSFontFace*>::const_iterator it = m_locallyInstalledFontFaces.constBegin();
|
||||
QHash<DOMString, CSSFontFace*>::const_iterator end = m_locallyInstalledFontFaces.constEnd();
|
||||
if (it == end) {
|
||||
return;
|
||||
}
|
||||
const DOMString familyNameLower = familyName.lower();
|
||||
do {
|
||||
if (it.key() == familyNameLower) {
|
||||
it.value()->refLoaders();
|
||||
}
|
||||
++it;
|
||||
} while (it != end);
|
||||
}
|
||||
|
||||
void CSSFontSelector::fontLoaded()
|
||||
{
|
||||
if (!m_document || !m_document->renderer())
|
||||
return;
|
||||
static_cast<khtml::RenderCanvas*>(m_document->renderer())->updateInvalidatedFonts();
|
||||
khtml::Font::markAllCachedFontsAsValid();
|
||||
}
|
||||
|
||||
void CSSFontSelector::fontCacheInvalidated()
|
||||
{
|
||||
if (!m_document || !m_document->renderer())
|
||||
return;
|
||||
m_document->recalcStyle(DocumentImpl::Force);
|
||||
// m_document->renderer()->setNeedsLayoutAndMinMaxRecalc();
|
||||
}
|
||||
|
||||
/*
|
||||
static FontData* fontDataForGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName)
|
||||
{
|
||||
if (!document || !document->frame())
|
||||
return 0;
|
||||
|
||||
const Settings* settings = document->frame()->settings();
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
AtomicString genericFamily;
|
||||
if (familyName == "-webkit-serif")
|
||||
genericFamily = settings->serifFontFamily();
|
||||
else if (familyName == "-webkit-sans-serif")
|
||||
genericFamily = settings->sansSerifFontFamily();
|
||||
else if (familyName == "-webkit-cursive")
|
||||
genericFamily = settings->cursiveFontFamily();
|
||||
else if (familyName == "-webkit-fantasy")
|
||||
genericFamily = settings->fantasyFontFamily();
|
||||
else if (familyName == "-webkit-monospace")
|
||||
genericFamily = settings->fixedFontFamily();
|
||||
else if (familyName == "-webkit-standard")
|
||||
genericFamily = settings->standardFontFamily();
|
||||
|
||||
if (!genericFamily.isEmpty())
|
||||
return fontCache()->getCachedFontData(fontCache()->getCachedFontPlatformData(fontDescription, genericFamily));
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
static FontTraitsMask desiredTraitsMaskForComparison;
|
||||
|
||||
static inline bool compareFontFaces(CSSFontFace* first, CSSFontFace* second)
|
||||
{
|
||||
FontTraitsMask firstTraitsMask = first->traitsMask();
|
||||
FontTraitsMask secondTraitsMask = second->traitsMask();
|
||||
|
||||
bool firstHasDesiredVariant = firstTraitsMask & desiredTraitsMaskForComparison & FontVariantMask;
|
||||
bool secondHasDesiredVariant = secondTraitsMask & desiredTraitsMaskForComparison & FontVariantMask;
|
||||
|
||||
if (firstHasDesiredVariant != secondHasDesiredVariant)
|
||||
return firstHasDesiredVariant;
|
||||
|
||||
bool firstHasDesiredStyle = firstTraitsMask & desiredTraitsMaskForComparison & FontStyleMask;
|
||||
bool secondHasDesiredStyle = secondTraitsMask & desiredTraitsMaskForComparison & FontStyleMask;
|
||||
|
||||
if (firstHasDesiredStyle != secondHasDesiredStyle)
|
||||
return firstHasDesiredStyle;
|
||||
|
||||
if (secondTraitsMask & desiredTraitsMaskForComparison & FontWeightMask)
|
||||
return false;
|
||||
if (firstTraitsMask & desiredTraitsMaskForComparison & FontWeightMask)
|
||||
return true;
|
||||
|
||||
// http://www.w3.org/TR/2002/WD-css3-webfonts-20020802/#q46 says: "If there are fewer then 9 weights in the family, the default algorithm
|
||||
// for filling the "holes" is as follows. If '500' is unassigned, it will be assigned the same font as '400'. If any of the values '600',
|
||||
// '700', '800', or '900' remains unassigned, they are assigned to the same face as the next darker assigned keyword, if any, or the next
|
||||
// lighter one otherwise. If any of '300', '200', or '100' remains unassigned, it is assigned to the next lighter assigned keyword, if any,
|
||||
// or the next darker otherwise."
|
||||
// For '400', we made up our own rule (which then '500' follows).
|
||||
|
||||
static const unsigned fallbackRuleSets = 9;
|
||||
static const unsigned rulesPerSet = 8;
|
||||
static const FontTraitsMask weightFallbackRuleSets[fallbackRuleSets][rulesPerSet] = {
|
||||
{ FontWeight200Mask, FontWeight300Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
|
||||
{ FontWeight100Mask, FontWeight300Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
|
||||
{ FontWeight200Mask, FontWeight100Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
|
||||
{ FontWeight500Mask, FontWeight300Mask, FontWeight600Mask, FontWeight200Mask, FontWeight700Mask, FontWeight100Mask, FontWeight800Mask, FontWeight900Mask },
|
||||
{ FontWeight400Mask, FontWeight300Mask, FontWeight600Mask, FontWeight200Mask, FontWeight700Mask, FontWeight100Mask, FontWeight800Mask, FontWeight900Mask },
|
||||
{ FontWeight700Mask, FontWeight800Mask, FontWeight900Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
|
||||
{ FontWeight800Mask, FontWeight900Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
|
||||
{ FontWeight900Mask, FontWeight700Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
|
||||
{ FontWeight800Mask, FontWeight700Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask }
|
||||
};
|
||||
|
||||
unsigned ruleSetIndex = 0;
|
||||
unsigned w = FontWeight100Bit;
|
||||
while (!(desiredTraitsMaskForComparison & (1 << w))) {
|
||||
w++;
|
||||
ruleSetIndex++;
|
||||
}
|
||||
|
||||
assert(ruleSetIndex < fallbackRuleSets);
|
||||
const FontTraitsMask* weightFallbackRule = weightFallbackRuleSets[ruleSetIndex];
|
||||
for (unsigned i = 0; i < rulesPerSet; ++i) {
|
||||
if (secondTraitsMask & weightFallbackRule[i])
|
||||
return false;
|
||||
if (firstTraitsMask & weightFallbackRule[i])
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
FontData* CSSFontSelector::getFontData(const FontDescription& fontDescription, const AtomicString& familyName)
|
||||
{
|
||||
if (m_fontFaces.isEmpty()) {
|
||||
if (familyName.startsWith("-khtml-"))
|
||||
return fontDataForGenericFamily(m_document, fontDescription, familyName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
String family = familyName.string();
|
||||
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
if (fontDescription.smallCaps())
|
||||
family += "-khtml-svg-small-caps";
|
||||
#endif
|
||||
|
||||
Vector<RefPtr<CSSFontFace> >* familyFontFaces = m_fontFaces.get(family);
|
||||
// If no face was found, then return 0 and let the OS come up with its best match for the name.
|
||||
if (!familyFontFaces || familyFontFaces->isEmpty()) {
|
||||
// If we were handed a generic family, but there was no match, go ahead and return the correct font based off our
|
||||
// settings.
|
||||
return fontDataForGenericFamily(m_document, fontDescription, familyName);
|
||||
}
|
||||
|
||||
HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >* segmentedFontFaceCache = m_fonts.get(family);
|
||||
if (!segmentedFontFaceCache) {
|
||||
segmentedFontFaceCache = new HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >;
|
||||
m_fonts.set(family, segmentedFontFaceCache);
|
||||
}
|
||||
|
||||
FontTraitsMask traitsMask = fontDescription.traitsMask();
|
||||
|
||||
RefPtr<CSSSegmentedFontFace> face = segmentedFontFaceCache->get(traitsMask);
|
||||
|
||||
if (!face) {
|
||||
face = CSSSegmentedFontFace::create(this);
|
||||
segmentedFontFaceCache->set(traitsMask, face);
|
||||
// Collect all matching faces and sort them in order of preference.
|
||||
Vector<CSSFontFace*, 32> candidateFontFaces;
|
||||
for (int i = familyFontFaces->size() - 1; i >= 0; --i) {
|
||||
CSSFontFace* candidate = familyFontFaces->at(i).get();
|
||||
unsigned candidateTraitsMask = candidate->traitsMask();
|
||||
if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
|
||||
continue;
|
||||
if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
|
||||
continue;
|
||||
candidateFontFaces.append(candidate);
|
||||
}
|
||||
|
||||
if (Vector<RefPtr<CSSFontFace> >* familyLocallyInstalledFontFaces = m_locallyInstalledFontFaces.get(family)) {
|
||||
unsigned numLocallyInstalledFontFaces = familyLocallyInstalledFontFaces->size();
|
||||
for (unsigned i = 0; i < numLocallyInstalledFontFaces; ++i) {
|
||||
CSSFontFace* candidate = familyLocallyInstalledFontFaces->at(i).get();
|
||||
unsigned candidateTraitsMask = candidate->traitsMask();
|
||||
if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
|
||||
continue;
|
||||
if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
|
||||
continue;
|
||||
candidateFontFaces.append(candidate);
|
||||
}
|
||||
}
|
||||
|
||||
desiredTraitsMaskForComparison = traitsMask;
|
||||
std::stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), compareFontFaces);
|
||||
unsigned numCandidates = candidateFontFaces.size();
|
||||
for (unsigned i = 0; i < numCandidates; ++i)
|
||||
face->appendFontFace(candidateFontFaces[i]);
|
||||
}
|
||||
|
||||
// We have a face. Ask it for a font data. If it cannot produce one, it will fail, and the OS will take over.
|
||||
return face->getFontData(fontDescription);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -1,245 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
|
||||
* Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
|
||||
* Copyright (C) 2009 Germain Garand <germain@ebooksfrance.org>
|
||||
*
|
||||
* 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 css_webfont_h
|
||||
#define css_webfont_h
|
||||
|
||||
#include "dom/dom_string.h"
|
||||
#include "misc/shared.h"
|
||||
#include "misc/loader.h"
|
||||
#include "css/css_valueimpl.h"
|
||||
|
||||
#include <wtf/HashMap.h>
|
||||
#include <wtf/RefPtr.h>
|
||||
#include <wtf/HashSet.h>
|
||||
#include <wtf/PassRefPtr.h>
|
||||
#include <wtf/RefCounted.h>
|
||||
#include <wtf/Vector.h>
|
||||
|
||||
#include <QHash>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class CSSFontFace;
|
||||
class CSSFontFaceRuleImpl;
|
||||
class CSSFontSelector;
|
||||
class CSSSegmentedFontFace;
|
||||
class DocumentImpl;
|
||||
class DocLoader;
|
||||
class FontDef;
|
||||
|
||||
enum {
|
||||
FontStyleNormalBit = 0,
|
||||
FontStyleItalicBit,
|
||||
FontVariantNormalBit,
|
||||
FontVariantSmallCapsBit,
|
||||
FontWeight100Bit,
|
||||
FontWeight200Bit,
|
||||
FontWeight300Bit,
|
||||
FontWeight400Bit,
|
||||
FontWeight500Bit,
|
||||
FontWeight600Bit,
|
||||
FontWeight700Bit,
|
||||
FontWeight800Bit,
|
||||
FontWeight900Bit,
|
||||
FontTraitsMaskWidth
|
||||
};
|
||||
|
||||
enum FontTraitsMask {
|
||||
FontStyleNormalMask = 1 << FontStyleNormalBit,
|
||||
FontStyleItalicMask = 1 << FontStyleItalicBit,
|
||||
FontStyleMask = FontStyleNormalMask | FontStyleItalicMask,
|
||||
|
||||
FontVariantNormalMask = 1 << FontVariantNormalBit,
|
||||
FontVariantSmallCapsMask = 1 << FontVariantSmallCapsBit,
|
||||
FontVariantMask = FontVariantNormalMask | FontVariantSmallCapsMask,
|
||||
|
||||
FontWeight100Mask = 1 << FontWeight100Bit,
|
||||
FontWeight200Mask = 1 << FontWeight200Bit,
|
||||
FontWeight300Mask = 1 << FontWeight300Bit,
|
||||
FontWeight400Mask = 1 << FontWeight400Bit,
|
||||
FontWeight500Mask = 1 << FontWeight500Bit,
|
||||
FontWeight600Mask = 1 << FontWeight600Bit,
|
||||
FontWeight700Mask = 1 << FontWeight700Bit,
|
||||
FontWeight800Mask = 1 << FontWeight800Bit,
|
||||
FontWeight900Mask = 1 << FontWeight900Bit,
|
||||
FontWeightMask = FontWeight100Mask | FontWeight200Mask | FontWeight300Mask | FontWeight400Mask | FontWeight500Mask | FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask
|
||||
};
|
||||
|
||||
class CSSSegmentedFontFace : public khtml::Shared<CSSSegmentedFontFace>{
|
||||
public:
|
||||
CSSSegmentedFontFace(CSSFontSelector*);
|
||||
~CSSSegmentedFontFace();
|
||||
|
||||
bool isLoaded() const;
|
||||
bool isValid() const;
|
||||
CSSFontSelector* fontSelector() const { return m_fontSelector; }
|
||||
|
||||
void fontLoaded(CSSFontFace*);
|
||||
|
||||
void appendFontFace(CSSFontFace);
|
||||
|
||||
// FontData* getFontData(const FontDescription&);
|
||||
|
||||
private:
|
||||
|
||||
// void pruneTable();
|
||||
|
||||
CSSFontSelector* m_fontSelector;
|
||||
// HashMap<unsigned, SegmentedFontData*> m_fontDataTable;
|
||||
// WTF::Vector<WTF::RefPtr<CSSFontFace>, 1> m_fontFaces;
|
||||
};
|
||||
|
||||
class CSSFontFaceSource : public khtml::CachedObjectClient {
|
||||
public:
|
||||
CSSFontFaceSource(const DOMString&, bool distant = false);
|
||||
virtual ~CSSFontFaceSource();
|
||||
|
||||
bool isLoaded() const;
|
||||
bool isValid() const;
|
||||
|
||||
DOMString string() const { return m_string; }
|
||||
|
||||
void setFontFace(CSSFontFace* face) { m_face = face; }
|
||||
|
||||
virtual void notifyFinished(khtml::CachedObject * finishedObj);
|
||||
void refLoader();
|
||||
|
||||
// SimpleFontData* getFontData(const FontDef&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*);
|
||||
// void pruneTable();
|
||||
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
|
||||
void setSVGFontFaceElement(SVGFontFaceElement* element) { m_svgFontFaceElement = element; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
DOMString m_string; // URI for remote, built-in font name for local.
|
||||
khtml::CachedFont* m_font; // For remote fonts, a pointer to our cached resource.
|
||||
CSSFontFace* m_face; // Our owning font face.
|
||||
int m_id; // Qt identifier for the Application font.
|
||||
bool m_refed;
|
||||
bool m_distant;
|
||||
// HashMap<unsigned, SimpleFontData*> m_fontDataTable; // The hash key is composed of size synthetic styles.
|
||||
|
||||
#if 0
|
||||
// ENABLE(SVG_FONTS)
|
||||
SVGFontFaceElement* m_svgFontFaceElement;
|
||||
RefPtr<SVGFontElement> m_externalSVGFontElement;
|
||||
#endif
|
||||
};
|
||||
|
||||
class CSSFontFace : public khtml::Shared<CSSFontFace> {
|
||||
public:
|
||||
CSSFontFace(FontTraitsMask traitsMask, CSSFontSelector* fs)
|
||||
: m_traitsMask(traitsMask), m_fontSelector(fs), m_refed(false), m_installed(false)
|
||||
{
|
||||
}
|
||||
~CSSFontFace();
|
||||
|
||||
FontTraitsMask traitsMask() const { return m_traitsMask; }
|
||||
|
||||
/*
|
||||
struct UnicodeRange;
|
||||
|
||||
void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); }
|
||||
const Vector<UnicodeRange>& ranges() const { return m_ranges; }
|
||||
*/
|
||||
void addedToSegmentedFontFace(CSSSegmentedFontFace*);
|
||||
void removedFromSegmentedFontFace(CSSSegmentedFontFace*);
|
||||
|
||||
bool isLoaded() const;
|
||||
bool isValid() const;
|
||||
|
||||
void setInstalled();
|
||||
bool installed() const;
|
||||
|
||||
void addSource(CSSFontFaceSource*);
|
||||
|
||||
void fontLoaded(CSSFontFaceSource*);
|
||||
void addFamilyName(const DOMString& name) { m_names.append( name ); }
|
||||
WTF::Vector<DOMString> familyNames() const { return m_names; }
|
||||
CSSFontSelector* fontSelector() const { return m_fontSelector; }
|
||||
void refLoaders(); // start loading all sources
|
||||
|
||||
// SimpleFontData* getFontData(const FontDef&, bool syntheticBold, bool syntheticItalic);
|
||||
|
||||
/*
|
||||
struct UnicodeRange {
|
||||
UnicodeRange(UChar32 from, UChar32 to)
|
||||
: m_from(from)
|
||||
, m_to(to)
|
||||
{
|
||||
}
|
||||
|
||||
UChar32 from() const { return m_from; }
|
||||
UChar32 to() const { return m_to; }
|
||||
|
||||
private:
|
||||
UChar32 m_from;
|
||||
UChar32 m_to;
|
||||
};
|
||||
*/
|
||||
|
||||
private:
|
||||
FontTraitsMask m_traitsMask;
|
||||
// Vector<UnicodeRange> m_ranges;
|
||||
// HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces;
|
||||
WTF::Vector<DOMString> m_names;
|
||||
WTF::Vector<CSSFontFaceSource*> m_sources;
|
||||
CSSFontSelector* m_fontSelector;
|
||||
bool m_refed;
|
||||
bool m_installed; // Successfully added into application font db
|
||||
};
|
||||
|
||||
class CSSFontSelector : public khtml::Shared<CSSFontSelector> {
|
||||
public:
|
||||
CSSFontSelector(DocumentImpl*);
|
||||
virtual ~CSSFontSelector();
|
||||
|
||||
// virtual FontData* getFontData(const FontDef& fontDescription, const DOMString& familyName);
|
||||
void requestFamilyName( const DOMString& familyName );
|
||||
void clearDocument() { m_document = 0; }
|
||||
void addFontFaceRule(const CSSFontFaceRuleImpl*);
|
||||
void fontLoaded();
|
||||
virtual void fontCacheInvalidated();
|
||||
bool isEmpty() const;
|
||||
khtml::DocLoader* docLoader() const;
|
||||
|
||||
private:
|
||||
|
||||
DocumentImpl* m_document;
|
||||
// HashMap<DOMString, Vector<RefPtr<CSSFontFace> >*, CaseFoldingHash> m_fontFaces;
|
||||
// WTF::HashMap<DOMString, WTF::Vector<WTF::RefPtr<CSSFontFace> >*, CaseFoldingHash> m_locallyInstalledFontFaces;
|
||||
QHash<DOMString, CSSFontFace*> m_locallyInstalledFontFaces;
|
||||
// HashMap<DOMString, HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >*, CaseFoldingHash> m_fonts;
|
||||
};
|
||||
|
||||
} // namespace DOM
|
||||
|
||||
#endif // css_webfont_h
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* This file is part of the CSS implementation for KDE.
|
||||
*
|
||||
* Copyright 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 "csshelper.h"
|
||||
|
||||
#include "misc/helper.h"
|
||||
#include "xml/dom_stringimpl.h"
|
||||
|
||||
using namespace DOM;
|
||||
using namespace khtml;
|
||||
|
||||
|
||||
DOMString khtml::parseURL(const DOMString &url)
|
||||
{
|
||||
DOMStringImpl* i = url.implementation();
|
||||
if(!i) return DOMString();
|
||||
|
||||
int o = 0;
|
||||
int l = i->l;
|
||||
while(o < l && (i->s[o] <= ' ')) { o++; l--; }
|
||||
while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
|
||||
|
||||
if(l >= 5 &&
|
||||
(i->s[o].toLower() == 'u') &&
|
||||
(i->s[o+1].toLower() == 'r') &&
|
||||
(i->s[o+2].toLower() == 'l') &&
|
||||
i->s[o+3].toLatin1() == '(' &&
|
||||
i->s[o+l-1].toLatin1() == ')') {
|
||||
o += 4;
|
||||
l -= 5;
|
||||
}
|
||||
|
||||
while(o < l && (i->s[o] <= ' ')) { o++; l--; }
|
||||
while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
|
||||
|
||||
if(l >= 2 && i->s[o] == i->s[o+l-1] &&
|
||||
(i->s[o].toLatin1() == '\'' || i->s[o].toLatin1() == '\"')) {
|
||||
o++;
|
||||
l -= 2;
|
||||
}
|
||||
|
||||
while(o < l && (i->s[o] <= ' ')) { o++; l--; }
|
||||
while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
|
||||
|
||||
DOMStringImpl* j = new DOMStringImpl(i->s+o,l);
|
||||
|
||||
int nl = 0;
|
||||
for(int k = o; k < o+l; k++)
|
||||
if(i->s[k].unicode() > '\r')
|
||||
j->s[nl++] = i->s[k];
|
||||
|
||||
j->l = nl;
|
||||
|
||||
return j;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* This file is part of the CSS implementation for KDE.
|
||||
*
|
||||
* Copyright 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 css_helper_h
|
||||
#define css_helper_h
|
||||
|
||||
#include "dom/dom_string.h"
|
||||
|
||||
|
||||
namespace khtml
|
||||
{
|
||||
|
||||
/*
|
||||
* mostly just removes the url("...") brace
|
||||
*/
|
||||
DOM::DOMString parseURL(const DOM::DOMString &url);
|
||||
|
||||
const float cssPixelsPerInch = 96.0f;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,270 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 2003 Lars Knoll (knoll@kde.org)
|
||||
* Copyright (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.
|
||||
*/
|
||||
#ifndef _CSS_cssparser_h_
|
||||
#define _CSS_cssparser_h_
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QColor>
|
||||
#include <QtCore/QVector>
|
||||
#include <dom/dom_string.h>
|
||||
#include <misc/htmlnames.h>
|
||||
#include <wtf/Vector.h>
|
||||
#include <xml/dom_docimpl.h>
|
||||
|
||||
namespace khtml {
|
||||
class MediaQuery;
|
||||
}
|
||||
|
||||
namespace DOM {
|
||||
class StyleListImpl;
|
||||
class CSSStyleSheetImpl;
|
||||
class CSSRuleImpl;
|
||||
class CSSStyleRuleImpl;
|
||||
class DocumentImpl;
|
||||
class CSSValueImpl;
|
||||
class CSSValueListImpl;
|
||||
class CSSPrimitiveValueImpl;
|
||||
class CSSStyleDeclarationImpl;
|
||||
class CSSFontFaceRuleImpl;
|
||||
class CSSProperty;
|
||||
class MediaListImpl;
|
||||
class CSSSelector;
|
||||
|
||||
|
||||
struct ParseString {
|
||||
unsigned short *string;
|
||||
int length;
|
||||
};
|
||||
|
||||
struct Value;
|
||||
class ValueList;
|
||||
|
||||
struct Function {
|
||||
ParseString name;
|
||||
ValueList *args;
|
||||
};
|
||||
|
||||
struct Value {
|
||||
int id;
|
||||
bool isInt;
|
||||
union {
|
||||
double fValue;
|
||||
int iValue;
|
||||
ParseString string;
|
||||
struct Function *function;
|
||||
};
|
||||
enum {
|
||||
Operator = 0x100000,
|
||||
Function = 0x100001,
|
||||
Q_EMS = 0x100002
|
||||
};
|
||||
|
||||
int unit;
|
||||
};
|
||||
|
||||
static inline QString qString( const ParseString &ps ) {
|
||||
return QString( (QChar *)ps.string, ps.length );
|
||||
}
|
||||
static inline DOMString domString( const ParseString &ps ) {
|
||||
return DOMString( (QChar *)ps.string, ps.length );
|
||||
}
|
||||
|
||||
class ValueList {
|
||||
public:
|
||||
ValueList() : m_current(0) { }
|
||||
~ValueList();
|
||||
void addValue(const Value& v) { m_values.append(v); }
|
||||
int size() const { return m_values.size(); }
|
||||
Value* current() { return m_current < m_values.size() ? &m_values[m_current] : 0; }
|
||||
Value* next() { ++m_current; return current(); }
|
||||
private:
|
||||
QVector<Value> m_values;
|
||||
int m_current;
|
||||
};
|
||||
|
||||
class CSSParser
|
||||
{
|
||||
public:
|
||||
CSSParser( bool strictParsing = true );
|
||||
~CSSParser();
|
||||
|
||||
void parseSheet( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string );
|
||||
DOM::CSSRuleImpl *parseRule( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string );
|
||||
bool parseValue( DOM::CSSStyleDeclarationImpl *decls, int id, const DOM::DOMString &string,
|
||||
bool _important );
|
||||
bool parseDeclaration( DOM::CSSStyleDeclarationImpl *decls, const DOM::DOMString &string );
|
||||
bool parseMediaQuery(DOM::MediaListImpl* queries, const DOM::DOMString& string);
|
||||
QList<DOM::CSSSelector*> parseSelectorList(DOM::DocumentImpl* doc, const DOM::DOMString& string);
|
||||
// Returns an empty list on parse error.
|
||||
|
||||
static CSSParser *current() { return currentParser; }
|
||||
|
||||
unsigned int getLocalNameId(const DOMString& str) {
|
||||
LocalName localname;
|
||||
DOM::DocumentImpl *doc = document();
|
||||
if (doc && doc->isHTMLDocument())
|
||||
localname = LocalName::fromString(str, khtml::IDS_NormalizeLower);
|
||||
else
|
||||
localname = LocalName::fromString(str);
|
||||
boundLocalNames.append(localname);
|
||||
return localname.id();
|
||||
}
|
||||
|
||||
DOM::DocumentImpl *document() const;
|
||||
|
||||
unsigned int defaultNamespace();
|
||||
|
||||
void addProperty( int propId, CSSValueImpl *value, bool important );
|
||||
void rollbackParsedProperties(int toNumParsedProperties);
|
||||
bool hasProperties() const { return numParsedProperties > 0; }
|
||||
CSSStyleDeclarationImpl *createStyleDeclaration( CSSStyleRuleImpl *rule );
|
||||
CSSStyleDeclarationImpl *createFontFaceStyleDeclaration( CSSFontFaceRuleImpl *rule );
|
||||
void clearProperties();
|
||||
|
||||
bool parseValue( int propId, bool important );
|
||||
bool parseSVGValue( int propId, bool important );
|
||||
bool parseShortHand(int propId, const int *properties, const int numProperties, bool important);
|
||||
bool parse4Values( int propId, const int *properties, bool important );
|
||||
bool parseContent( int propId, bool important );
|
||||
|
||||
CSSValueImpl* parseBackgroundColor();
|
||||
CSSValueImpl* parseBackgroundImage(bool& didParse);
|
||||
|
||||
enum BackgroundPosKind {
|
||||
BgPos_X,
|
||||
BgPos_Y,
|
||||
BgPos_NonKW,
|
||||
BgPos_Center
|
||||
};
|
||||
|
||||
CSSValueImpl* parseBackgroundPositionXY(BackgroundPosKind& kindOut);
|
||||
void parseBackgroundPosition(CSSValueImpl*& value1, CSSValueImpl*& value2);
|
||||
CSSValueImpl* parseBackgroundSize();
|
||||
|
||||
bool parseBackgroundProperty(int propId, int& propId1, int& propId2, CSSValueImpl*& retValue1, CSSValueImpl*& retValue2);
|
||||
bool parseBackgroundShorthand(bool important);
|
||||
|
||||
void addBackgroundValue(CSSValueImpl*& lval, CSSValueImpl* rval);
|
||||
|
||||
bool parseShape( int propId, bool important );
|
||||
bool parseFontShorthand(bool important);
|
||||
bool parseFontFaceSrc();
|
||||
bool parseCounter(int propId, bool increment, bool important);
|
||||
bool parseListStyleShorthand(bool important);
|
||||
|
||||
// returns parsed font-weight's css value id if valid, otherwise 0 (CSS_VAL_INVALID)
|
||||
int parseFontWeight(Value *val, bool strict);
|
||||
|
||||
bool parseColorParameters(Value*, int* colorValues, bool parseAlpha);
|
||||
bool parseHSLParameters(Value*, double* colorValues, bool parseAlpha);
|
||||
|
||||
// returns the found property
|
||||
// 0 if nothing found (or ok == false)
|
||||
// @param forward if true, it parses the next in the list
|
||||
CSSValueListImpl *parseFontFamily();
|
||||
CSSPrimitiveValueImpl *parseColor();
|
||||
CSSPrimitiveValueImpl *parseColorFromValue(Value* val);
|
||||
CSSValueImpl* parseCounterContent(ValueList *args, bool counters);
|
||||
|
||||
// CSS3 Parsing Routines (for properties specific to CSS3)
|
||||
bool parseShadow(int propId, bool important);
|
||||
|
||||
// SVG parsing:
|
||||
CSSValueImpl* parseSVGStrokeDasharray();
|
||||
CSSValueImpl* parseSVGPaint();
|
||||
CSSValueImpl* parseSVGColor();
|
||||
private:
|
||||
// defines units allowed for a certain property, used in parseUnit
|
||||
enum Units {
|
||||
FUnknown = 0x0000,
|
||||
FInteger = 0x0001,
|
||||
FNumber = 0x0002, // Real Numbers
|
||||
FPercent = 0x0004,
|
||||
FLength = 0x0008,
|
||||
FAngle = 0x0010,
|
||||
FTime = 0x0020,
|
||||
FFrequency = 0x0040,
|
||||
FRelative = 0x0100,
|
||||
FNonNeg = 0x0200
|
||||
};
|
||||
|
||||
bool parseBorderImage(int propId, bool important);
|
||||
bool parseBorderRadius(bool important);
|
||||
|
||||
static bool validUnit( Value *value, int unitflags, bool strict );
|
||||
|
||||
|
||||
public:
|
||||
bool strict;
|
||||
bool important;
|
||||
unsigned int id;
|
||||
DOM::StyleListImpl* styleElement;
|
||||
mutable DOM::DocumentImpl* styleDocument; // cached document for styleElement,
|
||||
// or manually set one for special parses
|
||||
|
||||
// Outputs for specialized parses.
|
||||
DOM::CSSRuleImpl *rule;
|
||||
khtml::MediaQuery* mediaQuery;
|
||||
QList<DOM::CSSSelector*> selectors;
|
||||
|
||||
ValueList *valueList;
|
||||
CSSProperty **parsedProperties;
|
||||
int numParsedProperties;
|
||||
int maxParsedProperties;
|
||||
|
||||
int m_inParseShorthand;
|
||||
int m_currentShorthand;
|
||||
bool m_implicitShorthand;
|
||||
|
||||
|
||||
static CSSParser *currentParser;
|
||||
|
||||
// tokenizer methods and data
|
||||
public:
|
||||
int lex( void *yylval );
|
||||
int token() { return yyTok; }
|
||||
unsigned short *text( int *length);
|
||||
int lex();
|
||||
private:
|
||||
int yyparse();
|
||||
void runParser();
|
||||
void setupParser(const char *prefix, const DOMString &string, const char *suffix);
|
||||
|
||||
bool inShorthand() const { return m_inParseShorthand; }
|
||||
|
||||
unsigned short *data;
|
||||
unsigned short *yytext;
|
||||
unsigned short *yy_c_buf_p;
|
||||
unsigned short yy_hold_char;
|
||||
int yy_last_accepting_state;
|
||||
unsigned short *yy_last_accepting_cpos;
|
||||
int block_nesting;
|
||||
int yyleng;
|
||||
int yyTok;
|
||||
int yy_start;
|
||||
WTF::Vector<LocalName> boundLocalNames;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
// kate: tab-width 8;
|
||||
|
|
@ -1,898 +0,0 @@
|
|||
/* ANSI-C code produced by gperf version 3.0.4 */
|
||||
/* Command-line: gperf -a -L ANSI-C -E -C -c -o -t -k '*' -NfindProp -Hhash_prop -Wwordlist_prop -D -s 2 cssproperties.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 <bug-gnu-gperf@gnu.org>."
|
||||
#endif
|
||||
|
||||
#line 1 "cssproperties.gperf"
|
||||
|
||||
/* This file is automatically generated from cssproperties.in by makeprop, do not edit */
|
||||
/* Copyright 1999 W. Bastian */
|
||||
#include "cssproperties.h"
|
||||
#line 6 "cssproperties.gperf"
|
||||
struct css_prop {
|
||||
const char *name;
|
||||
int id;
|
||||
};
|
||||
|
||||
static const struct css_prop * findProp (register const char *str, register unsigned int len);
|
||||
/* maximum key range = 902, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static unsigned int
|
||||
hash_prop (register const char *str, register unsigned int len)
|
||||
{
|
||||
static const unsigned short asso_values[] =
|
||||
{
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 0, 907, 907, 907, 907,
|
||||
907, 0, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 5, 0, 0,
|
||||
0, 0, 230, 0, 25, 20, 0, 120, 0, 70,
|
||||
20, 0, 0, 5, 0, 10, 5, 145, 30, 370,
|
||||
5, 220, 25, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907, 907, 907, 907, 907,
|
||||
907, 907, 907, 907, 907, 907
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
switch (hval)
|
||||
{
|
||||
default:
|
||||
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 css_prop *
|
||||
findProp (register const char *str, register unsigned int len)
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 187,
|
||||
MIN_WORD_LENGTH = 3,
|
||||
MAX_WORD_LENGTH = 33,
|
||||
MIN_HASH_VALUE = 5,
|
||||
MAX_HASH_VALUE = 906
|
||||
};
|
||||
|
||||
static const struct css_prop wordlist_prop[] =
|
||||
{
|
||||
#line 57 "cssproperties.gperf"
|
||||
{"color", CSS_PROP_COLOR},
|
||||
#line 134 "cssproperties.gperf"
|
||||
{"border", CSS_PROP_BORDER},
|
||||
#line 122 "cssproperties.gperf"
|
||||
{"top", CSS_PROP_TOP},
|
||||
#line 55 "cssproperties.gperf"
|
||||
{"clear", CSS_PROP_CLEAR},
|
||||
#line 135 "cssproperties.gperf"
|
||||
{"border-color", CSS_PROP_BORDER_COLOR},
|
||||
#line 114 "cssproperties.gperf"
|
||||
{"src", CSS_PROP_SRC},
|
||||
#line 137 "cssproperties.gperf"
|
||||
{"border-top", CSS_PROP_BORDER_TOP},
|
||||
#line 41 "cssproperties.gperf"
|
||||
{"border-top-color", CSS_PROP_BORDER_TOP_COLOR},
|
||||
#line 56 "cssproperties.gperf"
|
||||
{"clip", CSS_PROP_CLIP},
|
||||
#line 188 "cssproperties.gperf"
|
||||
{"stop-color", CSS_PROP_STOP_COLOR},
|
||||
#line 37 "cssproperties.gperf"
|
||||
{"border-collapse", CSS_PROP_BORDER_COLLAPSE},
|
||||
#line 148 "cssproperties.gperf"
|
||||
{"scrollbar-base-color", CSS_PROP_SCROLLBAR_BASE_COLOR},
|
||||
#line 147 "cssproperties.gperf"
|
||||
{"padding", CSS_PROP_PADDING},
|
||||
#line 112 "cssproperties.gperf"
|
||||
{"right", CSS_PROP_RIGHT},
|
||||
#line 58 "cssproperties.gperf"
|
||||
{"content", CSS_PROP_CONTENT},
|
||||
#line 113 "cssproperties.gperf"
|
||||
{"size", CSS_PROP_SIZE},
|
||||
#line 102 "cssproperties.gperf"
|
||||
{"padding-top", CSS_PROP_PADDING_TOP},
|
||||
#line 138 "cssproperties.gperf"
|
||||
{"border-right", CSS_PROP_BORDER_RIGHT},
|
||||
#line 160 "cssproperties.gperf"
|
||||
{"clip-path", CSS_PROP_CLIP_PATH},
|
||||
#line 93 "cssproperties.gperf"
|
||||
{"orphans", CSS_PROP_ORPHANS},
|
||||
#line 42 "cssproperties.gperf"
|
||||
{"border-right-color", CSS_PROP_BORDER_RIGHT_COLOR},
|
||||
#line 38 "cssproperties.gperf"
|
||||
{"border-spacing", CSS_PROP_BORDER_SPACING},
|
||||
#line 116 "cssproperties.gperf"
|
||||
{"text-align", CSS_PROP_TEXT_ALIGN},
|
||||
#line 62 "cssproperties.gperf"
|
||||
{"direction", CSS_PROP_DIRECTION},
|
||||
#line 165 "cssproperties.gperf"
|
||||
{"color-rendering", CSS_PROP_COLOR_RENDERING},
|
||||
#line 198 "cssproperties.gperf"
|
||||
{"text-anchor", CSS_PROP_TEXT_ANCHOR},
|
||||
#line 132 "cssproperties.gperf"
|
||||
{"z-index", CSS_PROP_Z_INDEX},
|
||||
#line 73 "cssproperties.gperf"
|
||||
{"letter-spacing", CSS_PROP_LETTER_SPACING},
|
||||
#line 117 "cssproperties.gperf"
|
||||
{"text-decoration", CSS_PROP_TEXT_DECORATION},
|
||||
#line 71 "cssproperties.gperf"
|
||||
{"height", CSS_PROP_HEIGHT},
|
||||
#line 110 "cssproperties.gperf"
|
||||
{"position", CSS_PROP_POSITION},
|
||||
#line 53 "cssproperties.gperf"
|
||||
{"bottom", CSS_PROP_BOTTOM},
|
||||
#line 152 "cssproperties.gperf"
|
||||
{"scrollbar-3dlight-color", CSS_PROP_SCROLLBAR_3DLIGHT_COLOR},
|
||||
#line 199 "cssproperties.gperf"
|
||||
{"text-rendering", CSS_PROP_TEXT_RENDERING},
|
||||
#line 118 "cssproperties.gperf"
|
||||
{"text-indent", CSS_PROP_TEXT_INDENT},
|
||||
#line 54 "cssproperties.gperf"
|
||||
{"caption-side", CSS_PROP_CAPTION_SIDE},
|
||||
#line 139 "cssproperties.gperf"
|
||||
{"border-bottom", CSS_PROP_BORDER_BOTTOM},
|
||||
#line 43 "cssproperties.gperf"
|
||||
{"border-bottom-color", CSS_PROP_BORDER_BOTTOM_COLOR},
|
||||
#line 180 "cssproperties.gperf"
|
||||
{"lighting-color", CSS_PROP_LIGHTING_COLOR},
|
||||
#line 103 "cssproperties.gperf"
|
||||
{"padding-right", CSS_PROP_PADDING_RIGHT},
|
||||
#line 142 "cssproperties.gperf"
|
||||
{"box-sizing", CSS_PROP_BOX_SIZING},
|
||||
#line 162 "cssproperties.gperf"
|
||||
{"color-interpolation", CSS_PROP_COLOR_INTERPOLATION},
|
||||
#line 187 "cssproperties.gperf"
|
||||
{"shape-rendering", CSS_PROP_SHAPE_RENDERING},
|
||||
#line 125 "cssproperties.gperf"
|
||||
{"vertical-align", CSS_PROP_VERTICAL_ALIGN},
|
||||
#line 145 "cssproperties.gperf"
|
||||
{"margin", CSS_PROP_MARGIN},
|
||||
#line 186 "cssproperties.gperf"
|
||||
{"pointer-events", CSS_PROP_POINTER_EVENTS},
|
||||
#line 74 "cssproperties.gperf"
|
||||
{"line-height", CSS_PROP_LINE_HEIGHT},
|
||||
#line 78 "cssproperties.gperf"
|
||||
{"margin-top", CSS_PROP_MARGIN_TOP},
|
||||
#line 104 "cssproperties.gperf"
|
||||
{"padding-bottom", CSS_PROP_PADDING_BOTTOM},
|
||||
#line 190 "cssproperties.gperf"
|
||||
{"stroke", CSS_PROP_STROKE},
|
||||
#line 151 "cssproperties.gperf"
|
||||
{"scrollbar-highlight-color", CSS_PROP_SCROLLBAR_HIGHLIGHT_COLOR},
|
||||
#line 61 "cssproperties.gperf"
|
||||
{"cursor", CSS_PROP_CURSOR},
|
||||
#line 89 "cssproperties.gperf"
|
||||
{"max-height", CSS_PROP_MAX_HEIGHT},
|
||||
#line 154 "cssproperties.gperf"
|
||||
{"scrollbar-track-color", CSS_PROP_SCROLLBAR_TRACK_COLOR},
|
||||
#line 178 "cssproperties.gperf"
|
||||
{"image-rendering", CSS_PROP_IMAGE_RENDERING},
|
||||
#line 111 "cssproperties.gperf"
|
||||
{"quotes", CSS_PROP_QUOTES},
|
||||
#line 161 "cssproperties.gperf"
|
||||
{"clip-rule", CSS_PROP_CLIP_RULE},
|
||||
#line 79 "cssproperties.gperf"
|
||||
{"margin-right", CSS_PROP_MARGIN_RIGHT},
|
||||
#line 179 "cssproperties.gperf"
|
||||
{"kerning", CSS_PROP_KERNING},
|
||||
#line 36 "cssproperties.gperf"
|
||||
{"border-radius", CSS_PROP_BORDER_RADIUS},
|
||||
#line 193 "cssproperties.gperf"
|
||||
{"stroke-linecap", CSS_PROP_STROKE_LINECAP},
|
||||
#line 91 "cssproperties.gperf"
|
||||
{"min-height", CSS_PROP_MIN_HEIGHT},
|
||||
#line 146 "cssproperties.gperf"
|
||||
{"outline", CSS_PROP_OUTLINE},
|
||||
#line 60 "cssproperties.gperf"
|
||||
{"counter-reset", CSS_PROP_COUNTER_RESET},
|
||||
#line 181 "cssproperties.gperf"
|
||||
{"marker", CSS_PROP_MARKER},
|
||||
#line 95 "cssproperties.gperf"
|
||||
{"outline-color", CSS_PROP_OUTLINE_COLOR},
|
||||
#line 80 "cssproperties.gperf"
|
||||
{"margin-bottom", CSS_PROP_MARGIN_BOTTOM},
|
||||
#line 185 "cssproperties.gperf"
|
||||
{"mask", CSS_PROP_MASK},
|
||||
#line 166 "cssproperties.gperf"
|
||||
{"dominant-baseline", CSS_PROP_DOMINANT_BASELINE},
|
||||
#line 158 "cssproperties.gperf"
|
||||
{"alignment-baseline", CSS_PROP_ALIGNMENT_BASELINE},
|
||||
#line 109 "cssproperties.gperf"
|
||||
{"page-break-inside", CSS_PROP_PAGE_BREAK_INSIDE},
|
||||
#line 124 "cssproperties.gperf"
|
||||
{"unicode-range", CSS_PROP_UNICODE_RANGE},
|
||||
#line 182 "cssproperties.gperf"
|
||||
{"marker-end", CSS_PROP_MARKER_END},
|
||||
#line 194 "cssproperties.gperf"
|
||||
{"stroke-linejoin", CSS_PROP_STROKE_LINEJOIN},
|
||||
#line 184 "cssproperties.gperf"
|
||||
{"marker-start", CSS_PROP_MARKER_START},
|
||||
#line 123 "cssproperties.gperf"
|
||||
{"unicode-bidi", CSS_PROP_UNICODE_BIDI},
|
||||
#line 72 "cssproperties.gperf"
|
||||
{"left", CSS_PROP_LEFT},
|
||||
#line 172 "cssproperties.gperf"
|
||||
{"flood-color", CSS_PROP_FLOOD_COLOR},
|
||||
#line 65 "cssproperties.gperf"
|
||||
{"float", CSS_PROP_FLOAT},
|
||||
#line 140 "cssproperties.gperf"
|
||||
{"border-left", CSS_PROP_BORDER_LEFT},
|
||||
#line 136 "cssproperties.gperf"
|
||||
{"border-style", CSS_PROP_BORDER_STYLE},
|
||||
#line 44 "cssproperties.gperf"
|
||||
{"border-left-color", CSS_PROP_BORDER_LEFT_COLOR},
|
||||
#line 168 "cssproperties.gperf"
|
||||
{"fill", CSS_PROP_FILL},
|
||||
#line 45 "cssproperties.gperf"
|
||||
{"border-top-style", CSS_PROP_BORDER_TOP_STYLE},
|
||||
#line 94 "cssproperties.gperf"
|
||||
{"opacity", CSS_PROP_OPACITY},
|
||||
#line 32 "cssproperties.gperf"
|
||||
{"border-top-right-radius", CSS_PROP_BORDER_TOP_RIGHT_RADIUS},
|
||||
#line 143 "cssproperties.gperf"
|
||||
{"font", CSS_PROP_FONT},
|
||||
#line 171 "cssproperties.gperf"
|
||||
{"filter", CSS_PROP_FILTER},
|
||||
#line 63 "cssproperties.gperf"
|
||||
{"display", CSS_PROP_DISPLAY},
|
||||
#line 164 "cssproperties.gperf"
|
||||
{"color-profile", CSS_PROP_COLOR_PROFILE},
|
||||
#line 149 "cssproperties.gperf"
|
||||
{"scrollbar-face-color", CSS_PROP_SCROLLBAR_FACE_COLOR},
|
||||
#line 189 "cssproperties.gperf"
|
||||
{"stop-opacity", CSS_PROP_STOP_OPACITY},
|
||||
#line 144 "cssproperties.gperf"
|
||||
{"list-style", CSS_PROP_LIST_STYLE},
|
||||
#line 105 "cssproperties.gperf"
|
||||
{"padding-left", CSS_PROP_PADDING_LEFT},
|
||||
#line 183 "cssproperties.gperf"
|
||||
{"marker-mid", CSS_PROP_MARKER_MID},
|
||||
#line 133 "cssproperties.gperf"
|
||||
{"background", CSS_PROP_BACKGROUND},
|
||||
#line 46 "cssproperties.gperf"
|
||||
{"border-right-style", CSS_PROP_BORDER_RIGHT_STYLE},
|
||||
#line 14 "cssproperties.gperf"
|
||||
{"background-color", CSS_PROP_BACKGROUND_COLOR},
|
||||
#line 106 "cssproperties.gperf"
|
||||
{"-khtml-padding-start", CSS_PROP__KHTML_PADDING_START},
|
||||
#line 175 "cssproperties.gperf"
|
||||
{"font-stretch", CSS_PROP_FONT_STRETCH},
|
||||
#line 64 "cssproperties.gperf"
|
||||
{"empty-cells", CSS_PROP_EMPTY_CELLS},
|
||||
#line 16 "cssproperties.gperf"
|
||||
{"background-repeat", CSS_PROP_BACKGROUND_REPEAT},
|
||||
#line 67 "cssproperties.gperf"
|
||||
{"font-size", CSS_PROP_FONT_SIZE},
|
||||
#line 59 "cssproperties.gperf"
|
||||
{"counter-increment", CSS_PROP_COUNTER_INCREMENT},
|
||||
#line 29 "cssproperties.gperf"
|
||||
{"background-clip", CSS_PROP_BACKGROUND_CLIP},
|
||||
#line 167 "cssproperties.gperf"
|
||||
{"enable-background", CSS_PROP_ENABLE_BACKGROUND},
|
||||
#line 47 "cssproperties.gperf"
|
||||
{"border-bottom-style", CSS_PROP_BORDER_BOTTOM_STYLE},
|
||||
#line 33 "cssproperties.gperf"
|
||||
{"border-bottom-right-radius", CSS_PROP_BORDER_BOTTOM_RIGHT_RADIUS},
|
||||
#line 69 "cssproperties.gperf"
|
||||
{"font-variant", CSS_PROP_FONT_VARIANT},
|
||||
#line 126 "cssproperties.gperf"
|
||||
{"visibility", CSS_PROP_VISIBILITY},
|
||||
#line 159 "cssproperties.gperf"
|
||||
{"baseline-shift", CSS_PROP_BASELINE_SHIFT},
|
||||
#line 31 "cssproperties.gperf"
|
||||
{"background-size", CSS_PROP_BACKGROUND_SIZE},
|
||||
#line 81 "cssproperties.gperf"
|
||||
{"margin-left", CSS_PROP_MARGIN_LEFT},
|
||||
#line 195 "cssproperties.gperf"
|
||||
{"stroke-miterlimit", CSS_PROP_STROKE_MITERLIMIT},
|
||||
#line 76 "cssproperties.gperf"
|
||||
{"list-style-position", CSS_PROP_LIST_STYLE_POSITION},
|
||||
#line 40 "cssproperties.gperf"
|
||||
{"-khtml-border-vertical-spacing", CSS_PROP__KHTML_BORDER_VERTICAL_SPACING},
|
||||
#line 30 "cssproperties.gperf"
|
||||
{"background-origin", CSS_PROP_BACKGROUND_ORIGIN},
|
||||
#line 121 "cssproperties.gperf"
|
||||
{"text-transform", CSS_PROP_TEXT_TRANSFORM},
|
||||
#line 108 "cssproperties.gperf"
|
||||
{"page-break-before", CSS_PROP_PAGE_BREAK_BEFORE},
|
||||
#line 82 "cssproperties.gperf"
|
||||
{"-khtml-margin-start", CSS_PROP__KHTML_MARGIN_START},
|
||||
#line 75 "cssproperties.gperf"
|
||||
{"list-style-image", CSS_PROP_LIST_STYLE_IMAGE},
|
||||
#line 18 "cssproperties.gperf"
|
||||
{"background-position", CSS_PROP_BACKGROUND_POSITION},
|
||||
#line 107 "cssproperties.gperf"
|
||||
{"page-break-after", CSS_PROP_PAGE_BREAK_AFTER},
|
||||
#line 163 "cssproperties.gperf"
|
||||
{"color-interpolation-filters", CSS_PROP_COLOR_INTERPOLATION_FILTERS},
|
||||
#line 19 "cssproperties.gperf"
|
||||
{"background-position-x", CSS_PROP_BACKGROUND_POSITION_X},
|
||||
#line 115 "cssproperties.gperf"
|
||||
{"table-layout", CSS_PROP_TABLE_LAYOUT},
|
||||
#line 196 "cssproperties.gperf"
|
||||
{"stroke-opacity", CSS_PROP_STROKE_OPACITY},
|
||||
#line 15 "cssproperties.gperf"
|
||||
{"background-image", CSS_PROP_BACKGROUND_IMAGE},
|
||||
#line 170 "cssproperties.gperf"
|
||||
{"fill-rule", CSS_PROP_FILL_RULE},
|
||||
#line 39 "cssproperties.gperf"
|
||||
{"-khtml-border-horizontal-spacing", CSS_PROP__KHTML_BORDER_HORIZONTAL_SPACING},
|
||||
#line 155 "cssproperties.gperf"
|
||||
{"scrollbar-arrow-color", CSS_PROP_SCROLLBAR_ARROW_COLOR},
|
||||
#line 28 "cssproperties.gperf"
|
||||
{"-khtml-border-radius", CSS_PROP__KHTML_BORDER_RADIUS},
|
||||
#line 191 "cssproperties.gperf"
|
||||
{"stroke-dasharray", CSS_PROP_STROKE_DASHARRAY},
|
||||
#line 129 "cssproperties.gperf"
|
||||
{"width", CSS_PROP_WIDTH},
|
||||
#line 177 "cssproperties.gperf"
|
||||
{"glyph-orientation-vertical", CSS_PROP_GLYPH_ORIENTATION_VERTICAL},
|
||||
#line 141 "cssproperties.gperf"
|
||||
{"border-width", CSS_PROP_BORDER_WIDTH},
|
||||
#line 120 "cssproperties.gperf"
|
||||
{"text-shadow", CSS_PROP_TEXT_SHADOW},
|
||||
#line 131 "cssproperties.gperf"
|
||||
{"word-spacing", CSS_PROP_WORD_SPACING},
|
||||
#line 97 "cssproperties.gperf"
|
||||
{"outline-style", CSS_PROP_OUTLINE_STYLE},
|
||||
#line 49 "cssproperties.gperf"
|
||||
{"border-top-width", CSS_PROP_BORDER_TOP_WIDTH},
|
||||
#line 35 "cssproperties.gperf"
|
||||
{"border-top-left-radius", CSS_PROP_BORDER_TOP_LEFT_RADIUS},
|
||||
#line 127 "cssproperties.gperf"
|
||||
{"white-space", CSS_PROP_WHITE_SPACE},
|
||||
#line 150 "cssproperties.gperf"
|
||||
{"scrollbar-shadow-color", CSS_PROP_SCROLLBAR_SHADOW_COLOR},
|
||||
#line 17 "cssproperties.gperf"
|
||||
{"background-attachment", CSS_PROP_BACKGROUND_ATTACHMENT},
|
||||
#line 83 "cssproperties.gperf"
|
||||
{"-khtml-marquee", CSS_PROP__KHTML_MARQUEE},
|
||||
#line 176 "cssproperties.gperf"
|
||||
{"glyph-orientation-horizontal", CSS_PROP_GLYPH_ORIENTATION_HORIZONTAL},
|
||||
#line 87 "cssproperties.gperf"
|
||||
{"-khtml-marquee-speed", CSS_PROP__KHTML_MARQUEE_SPEED},
|
||||
#line 24 "cssproperties.gperf"
|
||||
{"-khtml-border-top-right-radius", CSS_PROP__KHTML_BORDER_TOP_RIGHT_RADIUS},
|
||||
#line 48 "cssproperties.gperf"
|
||||
{"border-left-style", CSS_PROP_BORDER_LEFT_STYLE},
|
||||
#line 50 "cssproperties.gperf"
|
||||
{"border-right-width", CSS_PROP_BORDER_RIGHT_WIDTH},
|
||||
#line 174 "cssproperties.gperf"
|
||||
{"font-size-adjust", CSS_PROP_FONT_SIZE_ADJUST},
|
||||
#line 173 "cssproperties.gperf"
|
||||
{"flood-opacity", CSS_PROP_FLOOD_OPACITY},
|
||||
#line 68 "cssproperties.gperf"
|
||||
{"font-style", CSS_PROP_FONT_STYLE},
|
||||
#line 90 "cssproperties.gperf"
|
||||
{"max-width", CSS_PROP_MAX_WIDTH},
|
||||
#line 77 "cssproperties.gperf"
|
||||
{"list-style-type", CSS_PROP_LIST_STYLE_TYPE},
|
||||
#line 169 "cssproperties.gperf"
|
||||
{"fill-opacity", CSS_PROP_FILL_OPACITY},
|
||||
#line 200 "cssproperties.gperf"
|
||||
{"writing-mode", CSS_PROP_WRITING_MODE},
|
||||
#line 51 "cssproperties.gperf"
|
||||
{"border-bottom-width", CSS_PROP_BORDER_BOTTOM_WIDTH},
|
||||
#line 34 "cssproperties.gperf"
|
||||
{"border-bottom-left-radius", CSS_PROP_BORDER_BOTTOM_LEFT_RADIUS},
|
||||
#line 84 "cssproperties.gperf"
|
||||
{"-khtml-marquee-direction", CSS_PROP__KHTML_MARQUEE_DIRECTION},
|
||||
#line 92 "cssproperties.gperf"
|
||||
{"min-width", CSS_PROP_MIN_WIDTH},
|
||||
#line 86 "cssproperties.gperf"
|
||||
{"-khtml-marquee-repetition", CSS_PROP__KHTML_MARQUEE_REPETITION},
|
||||
#line 21 "cssproperties.gperf"
|
||||
{"-khtml-background-clip", CSS_PROP__KHTML_BACKGROUND_CLIP},
|
||||
#line 25 "cssproperties.gperf"
|
||||
{"-khtml-border-bottom-right-radius", CSS_PROP__KHTML_BORDER_BOTTOM_RIGHT_RADIUS},
|
||||
#line 197 "cssproperties.gperf"
|
||||
{"stroke-width", CSS_PROP_STROKE_WIDTH},
|
||||
#line 153 "cssproperties.gperf"
|
||||
{"scrollbar-darkshadow-color", CSS_PROP_SCROLLBAR_DARKSHADOW_COLOR},
|
||||
#line 157 "cssproperties.gperf"
|
||||
{"-khtml-user-input", CSS_PROP__KHTML_USER_INPUT},
|
||||
#line 23 "cssproperties.gperf"
|
||||
{"-khtml-background-size", CSS_PROP__KHTML_BACKGROUND_SIZE},
|
||||
#line 22 "cssproperties.gperf"
|
||||
{"-khtml-background-origin", CSS_PROP__KHTML_BACKGROUND_ORIGIN},
|
||||
#line 85 "cssproperties.gperf"
|
||||
{"-khtml-marquee-increment", CSS_PROP__KHTML_MARQUEE_INCREMENT},
|
||||
#line 20 "cssproperties.gperf"
|
||||
{"background-position-y", CSS_PROP_BACKGROUND_POSITION_Y},
|
||||
#line 98 "cssproperties.gperf"
|
||||
{"outline-width", CSS_PROP_OUTLINE_WIDTH},
|
||||
#line 99 "cssproperties.gperf"
|
||||
{"overflow", CSS_PROP_OVERFLOW},
|
||||
#line 100 "cssproperties.gperf"
|
||||
{"overflow-x", CSS_PROP_OVERFLOW_X},
|
||||
#line 119 "cssproperties.gperf"
|
||||
{"text-overflow", CSS_PROP_TEXT_OVERFLOW},
|
||||
#line 192 "cssproperties.gperf"
|
||||
{"stroke-dashoffset", CSS_PROP_STROKE_DASHOFFSET},
|
||||
#line 27 "cssproperties.gperf"
|
||||
{"-khtml-border-top-left-radius", CSS_PROP__KHTML_BORDER_TOP_LEFT_RADIUS},
|
||||
#line 52 "cssproperties.gperf"
|
||||
{"border-left-width", CSS_PROP_BORDER_LEFT_WIDTH},
|
||||
#line 96 "cssproperties.gperf"
|
||||
{"outline-offset", CSS_PROP_OUTLINE_OFFSET},
|
||||
#line 70 "cssproperties.gperf"
|
||||
{"font-weight", CSS_PROP_FONT_WEIGHT},
|
||||
#line 88 "cssproperties.gperf"
|
||||
{"-khtml-marquee-style", CSS_PROP__KHTML_MARQUEE_STYLE},
|
||||
#line 26 "cssproperties.gperf"
|
||||
{"-khtml-border-bottom-left-radius", CSS_PROP__KHTML_BORDER_BOTTOM_LEFT_RADIUS},
|
||||
#line 130 "cssproperties.gperf"
|
||||
{"word-wrap", CSS_PROP_WORD_WRAP},
|
||||
#line 128 "cssproperties.gperf"
|
||||
{"widows", CSS_PROP_WIDOWS},
|
||||
#line 66 "cssproperties.gperf"
|
||||
{"font-family", CSS_PROP_FONT_FAMILY},
|
||||
#line 101 "cssproperties.gperf"
|
||||
{"overflow-y", CSS_PROP_OVERFLOW_Y},
|
||||
#line 156 "cssproperties.gperf"
|
||||
{"-khtml-flow-mode", CSS_PROP__KHTML_FLOW_MODE}
|
||||
};
|
||||
|
||||
static const short lookup[] =
|
||||
{
|
||||
-1, -1, -1, -1, -1, 0, 1, -1, 2, -1,
|
||||
3, -1, 4, 5, -1, 6, -1, -1, -1, -1,
|
||||
-1, 7, -1, -1, 8, 9, -1, -1, -1, -1,
|
||||
10, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
11, -1, 12, -1, -1, 13, -1, 14, -1, 15,
|
||||
-1, 16, 17, -1, 18, -1, -1, 19, 20, 21,
|
||||
22, -1, -1, -1, 23, 24, 25, 26, -1, 27,
|
||||
28, 29, -1, 30, -1, -1, 31, -1, 32, 33,
|
||||
-1, 34, 35, 36, -1, -1, -1, -1, -1, 37,
|
||||
-1, -1, -1, -1, 38, -1, -1, -1, 39, -1,
|
||||
40, -1, -1, -1, 41, 42, -1, -1, -1, 43,
|
||||
-1, 44, -1, -1, 45, -1, 46, -1, -1, -1,
|
||||
47, -1, -1, -1, -1, -1, -1, -1, -1, 48,
|
||||
-1, 49, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
50, 51, -1, -1, -1, 52, 53, -1, -1, -1,
|
||||
54, 55, -1, -1, 56, -1, -1, 57, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 58, -1, -1,
|
||||
-1, -1, -1, 59, 60, 61, -1, 62, 63, -1,
|
||||
-1, 64, -1, 65, -1, -1, -1, -1, 66, 67,
|
||||
-1, -1, 68, 69, -1, -1, -1, 70, -1, -1,
|
||||
-1, -1, -1, 71, -1, 72, -1, -1, -1, -1,
|
||||
73, -1, 74, -1, -1, -1, -1, 75, -1, 76,
|
||||
-1, 77, -1, -1, -1, 78, 79, 80, -1, -1,
|
||||
-1, -1, 81, -1, 82, -1, 83, 84, 85, 86,
|
||||
-1, 87, 88, 89, -1, -1, -1, -1, -1, -1,
|
||||
90, -1, -1, -1, -1, -1, -1, 91, -1, -1,
|
||||
92, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 93, -1, -1, 94, -1, -1, -1, -1,
|
||||
95, -1, -1, 96, -1, -1, 97, -1, -1, -1,
|
||||
98, -1, 99, -1, -1, -1, 100, 101, -1, 102,
|
||||
-1, -1, 103, -1, -1, 104, -1, -1, -1, -1,
|
||||
-1, -1, 105, -1, 106, -1, 107, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 108, -1, -1, 109, -1, -1, -1, 110,
|
||||
111, 112, 113, -1, 114, 115, -1, 116, -1, 117,
|
||||
-1, -1, -1, -1, -1, -1, -1, 118, -1, 119,
|
||||
-1, 120, -1, -1, 121, -1, 122, 123, -1, -1,
|
||||
-1, 124, -1, -1, -1, -1, -1, 125, -1, 126,
|
||||
-1, 127, -1, -1, 128, -1, -1, 129, -1, -1,
|
||||
-1, 130, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
131, 132, -1, -1, -1, 133, 134, -1, -1, -1,
|
||||
-1, -1, 135, -1, -1, -1, 136, 137, 138, -1,
|
||||
-1, 139, 140, -1, -1, -1, 141, 142, -1, -1,
|
||||
-1, 143, -1, -1, -1, -1, -1, -1, -1, 144,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 145, -1,
|
||||
-1, -1, -1, -1, -1, 146, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 147, -1, 148, 149, -1,
|
||||
-1, 150, -1, 151, -1, -1, -1, -1, -1, -1,
|
||||
152, -1, -1, -1, -1, -1, -1, -1, -1, 153,
|
||||
154, -1, 155, -1, -1, -1, -1, 156, -1, 157,
|
||||
158, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, 159, -1, -1, -1, -1, 160,
|
||||
161, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 162, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, 163, -1, -1, -1, 164, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 165, -1, -1, -1,
|
||||
-1, -1, 166, -1, -1, -1, -1, 167, -1, -1,
|
||||
-1, -1, -1, -1, 168, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, 169, -1, 170, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, 171, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 172, -1,
|
||||
-1, -1, -1, -1, -1, 173, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 174, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 175, -1, 176,
|
||||
-1, -1, 177, -1, -1, -1, -1, -1, -1, 178,
|
||||
-1, -1, -1, -1, -1, -1, 179, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
180, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 181, -1, -1,
|
||||
-1, -1, -1, -1, 182, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 183, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 184, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
185, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 186
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash_prop (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register int index = lookup[key];
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
register const char *s = wordlist_prop[index].name;
|
||||
|
||||
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
|
||||
return &wordlist_prop[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#line 201 "cssproperties.gperf"
|
||||
|
||||
static const char * const propertyList[] = {
|
||||
"",
|
||||
"background-color",
|
||||
"background-image",
|
||||
"background-repeat",
|
||||
"background-attachment",
|
||||
"background-position",
|
||||
"background-position-x",
|
||||
"background-position-y",
|
||||
"-khtml-background-clip",
|
||||
"-khtml-background-origin",
|
||||
"-khtml-background-size",
|
||||
"-khtml-border-top-right-radius",
|
||||
"-khtml-border-bottom-right-radius",
|
||||
"-khtml-border-bottom-left-radius",
|
||||
"-khtml-border-top-left-radius",
|
||||
"-khtml-border-radius",
|
||||
"background-clip",
|
||||
"background-origin",
|
||||
"background-size",
|
||||
"border-top-right-radius",
|
||||
"border-bottom-right-radius",
|
||||
"border-bottom-left-radius",
|
||||
"border-top-left-radius",
|
||||
"border-radius",
|
||||
"border-collapse",
|
||||
"border-spacing",
|
||||
"-khtml-border-horizontal-spacing",
|
||||
"-khtml-border-vertical-spacing",
|
||||
"border-top-color",
|
||||
"border-right-color",
|
||||
"border-bottom-color",
|
||||
"border-left-color",
|
||||
"border-top-style",
|
||||
"border-right-style",
|
||||
"border-bottom-style",
|
||||
"border-left-style",
|
||||
"border-top-width",
|
||||
"border-right-width",
|
||||
"border-bottom-width",
|
||||
"border-left-width",
|
||||
"bottom",
|
||||
"caption-side",
|
||||
"clear",
|
||||
"clip",
|
||||
"color",
|
||||
"content",
|
||||
"counter-increment",
|
||||
"counter-reset",
|
||||
"cursor",
|
||||
"direction",
|
||||
"display",
|
||||
"empty-cells",
|
||||
"float",
|
||||
"font-family",
|
||||
"font-size",
|
||||
"font-style",
|
||||
"font-variant",
|
||||
"font-weight",
|
||||
"height",
|
||||
"left",
|
||||
"letter-spacing",
|
||||
"line-height",
|
||||
"list-style-image",
|
||||
"list-style-position",
|
||||
"list-style-type",
|
||||
"margin-top",
|
||||
"margin-right",
|
||||
"margin-bottom",
|
||||
"margin-left",
|
||||
"-khtml-margin-start",
|
||||
"-khtml-marquee",
|
||||
"-khtml-marquee-direction",
|
||||
"-khtml-marquee-increment",
|
||||
"-khtml-marquee-repetition",
|
||||
"-khtml-marquee-speed",
|
||||
"-khtml-marquee-style",
|
||||
"max-height",
|
||||
"max-width",
|
||||
"min-height",
|
||||
"min-width",
|
||||
"orphans",
|
||||
"opacity",
|
||||
"outline-color",
|
||||
"outline-offset",
|
||||
"outline-style",
|
||||
"outline-width",
|
||||
"overflow",
|
||||
"overflow-x",
|
||||
"overflow-y",
|
||||
"padding-top",
|
||||
"padding-right",
|
||||
"padding-bottom",
|
||||
"padding-left",
|
||||
"-khtml-padding-start",
|
||||
"page-break-after",
|
||||
"page-break-before",
|
||||
"page-break-inside",
|
||||
"position",
|
||||
"quotes",
|
||||
"right",
|
||||
"size",
|
||||
"src",
|
||||
"table-layout",
|
||||
"text-align",
|
||||
"text-decoration",
|
||||
"text-indent",
|
||||
"text-overflow",
|
||||
"text-shadow",
|
||||
"text-transform",
|
||||
"top",
|
||||
"unicode-bidi",
|
||||
"unicode-range",
|
||||
"vertical-align",
|
||||
"visibility",
|
||||
"white-space",
|
||||
"widows",
|
||||
"width",
|
||||
"word-wrap",
|
||||
"word-spacing",
|
||||
"z-index",
|
||||
"background",
|
||||
"border",
|
||||
"border-color",
|
||||
"border-style",
|
||||
"border-top",
|
||||
"border-right",
|
||||
"border-bottom",
|
||||
"border-left",
|
||||
"border-width",
|
||||
"box-sizing",
|
||||
"font",
|
||||
"list-style",
|
||||
"margin",
|
||||
"outline",
|
||||
"padding",
|
||||
"scrollbar-base-color",
|
||||
"scrollbar-face-color",
|
||||
"scrollbar-shadow-color",
|
||||
"scrollbar-highlight-color",
|
||||
"scrollbar-3dlight-color",
|
||||
"scrollbar-darkshadow-color",
|
||||
"scrollbar-track-color",
|
||||
"scrollbar-arrow-color",
|
||||
"-khtml-flow-mode",
|
||||
"-khtml-user-input",
|
||||
"alignment-baseline",
|
||||
"baseline-shift",
|
||||
"clip-path",
|
||||
"clip-rule",
|
||||
"color-interpolation",
|
||||
"color-interpolation-filters",
|
||||
"color-profile",
|
||||
"color-rendering",
|
||||
"dominant-baseline",
|
||||
"enable-background",
|
||||
"fill",
|
||||
"fill-opacity",
|
||||
"fill-rule",
|
||||
"filter",
|
||||
"flood-color",
|
||||
"flood-opacity",
|
||||
"font-size-adjust",
|
||||
"font-stretch",
|
||||
"glyph-orientation-horizontal",
|
||||
"glyph-orientation-vertical",
|
||||
"image-rendering",
|
||||
"kerning",
|
||||
"lighting-color",
|
||||
"marker",
|
||||
"marker-end",
|
||||
"marker-mid",
|
||||
"marker-start",
|
||||
"mask",
|
||||
"pointer-events",
|
||||
"shape-rendering",
|
||||
"stop-color",
|
||||
"stop-opacity",
|
||||
"stroke",
|
||||
"stroke-dasharray",
|
||||
"stroke-dashoffset",
|
||||
"stroke-linecap",
|
||||
"stroke-linejoin",
|
||||
"stroke-miterlimit",
|
||||
"stroke-opacity",
|
||||
"stroke-width",
|
||||
"text-anchor",
|
||||
"text-rendering",
|
||||
"writing-mode",
|
||||
0
|
||||
};
|
||||
DOMString getPropertyName(unsigned short id)
|
||||
{
|
||||
if(id >= CSS_PROP_TOTAL || id == 0)
|
||||
return DOMString();
|
||||
else
|
||||
return DOMString(propertyList[id]);
|
||||
}
|
||||
|
|
@ -1,202 +0,0 @@
|
|||
/* This file is automatically generated from cssproperties.in by makeprop, do not edit */
|
||||
/* Copyright 1998 W. Bastian */
|
||||
|
||||
#ifndef CSSPROPERTIES_H
|
||||
#define CSSPROPERTIES_H
|
||||
|
||||
DOM::DOMString getPropertyName(unsigned short id) KDE_NO_EXPORT;
|
||||
|
||||
#define CSS_PROP_INVALID 0
|
||||
#define CSS_PROP_MIN 1
|
||||
#define CSS_PROP_BACKGROUND_COLOR 1
|
||||
#define CSS_PROP_BACKGROUND_IMAGE 2
|
||||
#define CSS_PROP_BACKGROUND_REPEAT 3
|
||||
#define CSS_PROP_BACKGROUND_ATTACHMENT 4
|
||||
#define CSS_PROP_BACKGROUND_POSITION 5
|
||||
#define CSS_PROP_BACKGROUND_POSITION_X 6
|
||||
#define CSS_PROP_BACKGROUND_POSITION_Y 7
|
||||
#define CSS_PROP__KHTML_BACKGROUND_CLIP 8
|
||||
#define CSS_PROP__KHTML_BACKGROUND_ORIGIN 9
|
||||
#define CSS_PROP__KHTML_BACKGROUND_SIZE 10
|
||||
#define CSS_PROP__KHTML_BORDER_TOP_RIGHT_RADIUS 11
|
||||
#define CSS_PROP__KHTML_BORDER_BOTTOM_RIGHT_RADIUS 12
|
||||
#define CSS_PROP__KHTML_BORDER_BOTTOM_LEFT_RADIUS 13
|
||||
#define CSS_PROP__KHTML_BORDER_TOP_LEFT_RADIUS 14
|
||||
#define CSS_PROP__KHTML_BORDER_RADIUS 15
|
||||
#define CSS_PROP_BACKGROUND_CLIP 16
|
||||
#define CSS_PROP_BACKGROUND_ORIGIN 17
|
||||
#define CSS_PROP_BACKGROUND_SIZE 18
|
||||
#define CSS_PROP_BORDER_TOP_RIGHT_RADIUS 19
|
||||
#define CSS_PROP_BORDER_BOTTOM_RIGHT_RADIUS 20
|
||||
#define CSS_PROP_BORDER_BOTTOM_LEFT_RADIUS 21
|
||||
#define CSS_PROP_BORDER_TOP_LEFT_RADIUS 22
|
||||
#define CSS_PROP_BORDER_RADIUS 23
|
||||
#define CSS_PROP_BORDER_COLLAPSE 24
|
||||
#define CSS_PROP_BORDER_SPACING 25
|
||||
#define CSS_PROP__KHTML_BORDER_HORIZONTAL_SPACING 26
|
||||
#define CSS_PROP__KHTML_BORDER_VERTICAL_SPACING 27
|
||||
#define CSS_PROP_BORDER_TOP_COLOR 28
|
||||
#define CSS_PROP_BORDER_RIGHT_COLOR 29
|
||||
#define CSS_PROP_BORDER_BOTTOM_COLOR 30
|
||||
#define CSS_PROP_BORDER_LEFT_COLOR 31
|
||||
#define CSS_PROP_BORDER_TOP_STYLE 32
|
||||
#define CSS_PROP_BORDER_RIGHT_STYLE 33
|
||||
#define CSS_PROP_BORDER_BOTTOM_STYLE 34
|
||||
#define CSS_PROP_BORDER_LEFT_STYLE 35
|
||||
#define CSS_PROP_BORDER_TOP_WIDTH 36
|
||||
#define CSS_PROP_BORDER_RIGHT_WIDTH 37
|
||||
#define CSS_PROP_BORDER_BOTTOM_WIDTH 38
|
||||
#define CSS_PROP_BORDER_LEFT_WIDTH 39
|
||||
#define CSS_PROP_BOTTOM 40
|
||||
#define CSS_PROP_CAPTION_SIDE 41
|
||||
#define CSS_PROP_CLEAR 42
|
||||
#define CSS_PROP_CLIP 43
|
||||
#define CSS_PROP_COLOR 44
|
||||
#define CSS_PROP_CONTENT 45
|
||||
#define CSS_PROP_COUNTER_INCREMENT 46
|
||||
#define CSS_PROP_COUNTER_RESET 47
|
||||
#define CSS_PROP_CURSOR 48
|
||||
#define CSS_PROP_DIRECTION 49
|
||||
#define CSS_PROP_DISPLAY 50
|
||||
#define CSS_PROP_EMPTY_CELLS 51
|
||||
#define CSS_PROP_FLOAT 52
|
||||
#define CSS_PROP_FONT_FAMILY 53
|
||||
#define CSS_PROP_FONT_SIZE 54
|
||||
#define CSS_PROP_FONT_STYLE 55
|
||||
#define CSS_PROP_FONT_VARIANT 56
|
||||
#define CSS_PROP_FONT_WEIGHT 57
|
||||
#define CSS_PROP_HEIGHT 58
|
||||
#define CSS_PROP_LEFT 59
|
||||
#define CSS_PROP_LETTER_SPACING 60
|
||||
#define CSS_PROP_LINE_HEIGHT 61
|
||||
#define CSS_PROP_LIST_STYLE_IMAGE 62
|
||||
#define CSS_PROP_LIST_STYLE_POSITION 63
|
||||
#define CSS_PROP_LIST_STYLE_TYPE 64
|
||||
#define CSS_PROP_MARGIN_TOP 65
|
||||
#define CSS_PROP_MARGIN_RIGHT 66
|
||||
#define CSS_PROP_MARGIN_BOTTOM 67
|
||||
#define CSS_PROP_MARGIN_LEFT 68
|
||||
#define CSS_PROP__KHTML_MARGIN_START 69
|
||||
#define CSS_PROP__KHTML_MARQUEE 70
|
||||
#define CSS_PROP__KHTML_MARQUEE_DIRECTION 71
|
||||
#define CSS_PROP__KHTML_MARQUEE_INCREMENT 72
|
||||
#define CSS_PROP__KHTML_MARQUEE_REPETITION 73
|
||||
#define CSS_PROP__KHTML_MARQUEE_SPEED 74
|
||||
#define CSS_PROP__KHTML_MARQUEE_STYLE 75
|
||||
#define CSS_PROP_MAX_HEIGHT 76
|
||||
#define CSS_PROP_MAX_WIDTH 77
|
||||
#define CSS_PROP_MIN_HEIGHT 78
|
||||
#define CSS_PROP_MIN_WIDTH 79
|
||||
#define CSS_PROP_ORPHANS 80
|
||||
#define CSS_PROP_OPACITY 81
|
||||
#define CSS_PROP_OUTLINE_COLOR 82
|
||||
#define CSS_PROP_OUTLINE_OFFSET 83
|
||||
#define CSS_PROP_OUTLINE_STYLE 84
|
||||
#define CSS_PROP_OUTLINE_WIDTH 85
|
||||
#define CSS_PROP_OVERFLOW 86
|
||||
#define CSS_PROP_OVERFLOW_X 87
|
||||
#define CSS_PROP_OVERFLOW_Y 88
|
||||
#define CSS_PROP_PADDING_TOP 89
|
||||
#define CSS_PROP_PADDING_RIGHT 90
|
||||
#define CSS_PROP_PADDING_BOTTOM 91
|
||||
#define CSS_PROP_PADDING_LEFT 92
|
||||
#define CSS_PROP__KHTML_PADDING_START 93
|
||||
#define CSS_PROP_PAGE_BREAK_AFTER 94
|
||||
#define CSS_PROP_PAGE_BREAK_BEFORE 95
|
||||
#define CSS_PROP_PAGE_BREAK_INSIDE 96
|
||||
#define CSS_PROP_POSITION 97
|
||||
#define CSS_PROP_QUOTES 98
|
||||
#define CSS_PROP_RIGHT 99
|
||||
#define CSS_PROP_SIZE 100
|
||||
#define CSS_PROP_SRC 101
|
||||
#define CSS_PROP_TABLE_LAYOUT 102
|
||||
#define CSS_PROP_TEXT_ALIGN 103
|
||||
#define CSS_PROP_TEXT_DECORATION 104
|
||||
#define CSS_PROP_TEXT_INDENT 105
|
||||
#define CSS_PROP_TEXT_OVERFLOW 106
|
||||
#define CSS_PROP_TEXT_SHADOW 107
|
||||
#define CSS_PROP_TEXT_TRANSFORM 108
|
||||
#define CSS_PROP_TOP 109
|
||||
#define CSS_PROP_UNICODE_BIDI 110
|
||||
#define CSS_PROP_UNICODE_RANGE 111
|
||||
#define CSS_PROP_VERTICAL_ALIGN 112
|
||||
#define CSS_PROP_VISIBILITY 113
|
||||
#define CSS_PROP_WHITE_SPACE 114
|
||||
#define CSS_PROP_WIDOWS 115
|
||||
#define CSS_PROP_WIDTH 116
|
||||
#define CSS_PROP_WORD_WRAP 117
|
||||
#define CSS_PROP_WORD_SPACING 118
|
||||
#define CSS_PROP_Z_INDEX 119
|
||||
#define CSS_PROP_BACKGROUND 120
|
||||
#define CSS_PROP_BORDER 121
|
||||
#define CSS_PROP_BORDER_COLOR 122
|
||||
#define CSS_PROP_BORDER_STYLE 123
|
||||
#define CSS_PROP_BORDER_TOP 124
|
||||
#define CSS_PROP_BORDER_RIGHT 125
|
||||
#define CSS_PROP_BORDER_BOTTOM 126
|
||||
#define CSS_PROP_BORDER_LEFT 127
|
||||
#define CSS_PROP_BORDER_WIDTH 128
|
||||
#define CSS_PROP_BOX_SIZING 129
|
||||
#define CSS_PROP_FONT 130
|
||||
#define CSS_PROP_LIST_STYLE 131
|
||||
#define CSS_PROP_MARGIN 132
|
||||
#define CSS_PROP_OUTLINE 133
|
||||
#define CSS_PROP_PADDING 134
|
||||
#define CSS_PROP_SCROLLBAR_BASE_COLOR 135
|
||||
#define CSS_PROP_SCROLLBAR_FACE_COLOR 136
|
||||
#define CSS_PROP_SCROLLBAR_SHADOW_COLOR 137
|
||||
#define CSS_PROP_SCROLLBAR_HIGHLIGHT_COLOR 138
|
||||
#define CSS_PROP_SCROLLBAR_3DLIGHT_COLOR 139
|
||||
#define CSS_PROP_SCROLLBAR_DARKSHADOW_COLOR 140
|
||||
#define CSS_PROP_SCROLLBAR_TRACK_COLOR 141
|
||||
#define CSS_PROP_SCROLLBAR_ARROW_COLOR 142
|
||||
#define CSS_PROP__KHTML_FLOW_MODE 143
|
||||
#define CSS_PROP__KHTML_USER_INPUT 144
|
||||
#define CSS_PROP_ALIGNMENT_BASELINE 145
|
||||
#define CSS_PROP_BASELINE_SHIFT 146
|
||||
#define CSS_PROP_CLIP_PATH 147
|
||||
#define CSS_PROP_CLIP_RULE 148
|
||||
#define CSS_PROP_COLOR_INTERPOLATION 149
|
||||
#define CSS_PROP_COLOR_INTERPOLATION_FILTERS 150
|
||||
#define CSS_PROP_COLOR_PROFILE 151
|
||||
#define CSS_PROP_COLOR_RENDERING 152
|
||||
#define CSS_PROP_DOMINANT_BASELINE 153
|
||||
#define CSS_PROP_ENABLE_BACKGROUND 154
|
||||
#define CSS_PROP_FILL 155
|
||||
#define CSS_PROP_FILL_OPACITY 156
|
||||
#define CSS_PROP_FILL_RULE 157
|
||||
#define CSS_PROP_FILTER 158
|
||||
#define CSS_PROP_FLOOD_COLOR 159
|
||||
#define CSS_PROP_FLOOD_OPACITY 160
|
||||
#define CSS_PROP_FONT_SIZE_ADJUST 161
|
||||
#define CSS_PROP_FONT_STRETCH 162
|
||||
#define CSS_PROP_GLYPH_ORIENTATION_HORIZONTAL 163
|
||||
#define CSS_PROP_GLYPH_ORIENTATION_VERTICAL 164
|
||||
#define CSS_PROP_IMAGE_RENDERING 165
|
||||
#define CSS_PROP_KERNING 166
|
||||
#define CSS_PROP_LIGHTING_COLOR 167
|
||||
#define CSS_PROP_MARKER 168
|
||||
#define CSS_PROP_MARKER_END 169
|
||||
#define CSS_PROP_MARKER_MID 170
|
||||
#define CSS_PROP_MARKER_START 171
|
||||
#define CSS_PROP_MASK 172
|
||||
#define CSS_PROP_POINTER_EVENTS 173
|
||||
#define CSS_PROP_SHAPE_RENDERING 174
|
||||
#define CSS_PROP_STOP_COLOR 175
|
||||
#define CSS_PROP_STOP_OPACITY 176
|
||||
#define CSS_PROP_STROKE 177
|
||||
#define CSS_PROP_STROKE_DASHARRAY 178
|
||||
#define CSS_PROP_STROKE_DASHOFFSET 179
|
||||
#define CSS_PROP_STROKE_LINECAP 180
|
||||
#define CSS_PROP_STROKE_LINEJOIN 181
|
||||
#define CSS_PROP_STROKE_MITERLIMIT 182
|
||||
#define CSS_PROP_STROKE_OPACITY 183
|
||||
#define CSS_PROP_STROKE_WIDTH 184
|
||||
#define CSS_PROP_TEXT_ANCHOR 185
|
||||
#define CSS_PROP_TEXT_RENDERING 186
|
||||
#define CSS_PROP_WRITING_MODE 187
|
||||
|
||||
#define CSS_PROP_TOTAL 188
|
||||
const size_t maxCSSPropertyNameLength = 33;
|
||||
#endif
|
||||
|
|
@ -1,227 +0,0 @@
|
|||
#
|
||||
# all valid CSS2 properties.
|
||||
#
|
||||
# aural properties are commented out, as we don't support them anyway.
|
||||
#
|
||||
# some properties are used in khtml, but are not part of CSS. They are used to get
|
||||
# HTML4 compatibility in the rendering engine.
|
||||
#
|
||||
# Mircosoft extensions are documented here:
|
||||
# http://msdn.microsoft.com/workshop/author/css/reference/attributes.asp
|
||||
#
|
||||
# CSS_PROP_BACKGROUND_COLOR:
|
||||
#
|
||||
background-color
|
||||
background-image
|
||||
background-repeat
|
||||
background-attachment
|
||||
background-position
|
||||
# IE Extensions
|
||||
background-position-x
|
||||
background-position-y
|
||||
# CSS3 Extensions
|
||||
-khtml-background-clip
|
||||
-khtml-background-origin
|
||||
-khtml-background-size
|
||||
-khtml-border-top-right-radius
|
||||
-khtml-border-bottom-right-radius
|
||||
-khtml-border-bottom-left-radius
|
||||
-khtml-border-top-left-radius
|
||||
-khtml-border-radius
|
||||
background-clip
|
||||
background-origin
|
||||
background-size
|
||||
border-top-right-radius
|
||||
border-bottom-right-radius
|
||||
border-bottom-left-radius
|
||||
border-top-left-radius
|
||||
border-radius
|
||||
|
||||
border-collapse
|
||||
border-spacing
|
||||
-khtml-border-horizontal-spacing
|
||||
-khtml-border-vertical-spacing
|
||||
border-top-color
|
||||
border-right-color
|
||||
border-bottom-color
|
||||
border-left-color
|
||||
border-top-style
|
||||
border-right-style
|
||||
border-bottom-style
|
||||
border-left-style
|
||||
border-top-width
|
||||
border-right-width
|
||||
border-bottom-width
|
||||
border-left-width
|
||||
bottom
|
||||
caption-side
|
||||
clear
|
||||
clip
|
||||
color
|
||||
content
|
||||
counter-increment
|
||||
counter-reset
|
||||
cursor
|
||||
direction
|
||||
display
|
||||
empty-cells
|
||||
float
|
||||
font-family
|
||||
font-size
|
||||
font-style
|
||||
font-variant
|
||||
font-weight
|
||||
height
|
||||
left
|
||||
letter-spacing
|
||||
line-height
|
||||
list-style-image
|
||||
list-style-position
|
||||
list-style-type
|
||||
margin-top
|
||||
margin-right
|
||||
margin-bottom
|
||||
margin-left
|
||||
-khtml-margin-start
|
||||
-khtml-marquee
|
||||
-khtml-marquee-direction
|
||||
-khtml-marquee-increment
|
||||
-khtml-marquee-repetition
|
||||
-khtml-marquee-speed
|
||||
-khtml-marquee-style
|
||||
max-height
|
||||
max-width
|
||||
min-height
|
||||
min-width
|
||||
orphans
|
||||
opacity
|
||||
outline-color
|
||||
outline-offset
|
||||
outline-style
|
||||
outline-width
|
||||
overflow
|
||||
overflow-x
|
||||
overflow-y
|
||||
padding-top
|
||||
padding-right
|
||||
padding-bottom
|
||||
padding-left
|
||||
-khtml-padding-start
|
||||
#page
|
||||
page-break-after
|
||||
page-break-before
|
||||
page-break-inside
|
||||
position
|
||||
quotes
|
||||
right
|
||||
size
|
||||
src
|
||||
table-layout
|
||||
text-align
|
||||
text-decoration
|
||||
text-indent
|
||||
text-overflow
|
||||
text-shadow
|
||||
text-transform
|
||||
top
|
||||
unicode-bidi
|
||||
unicode-range
|
||||
vertical-align
|
||||
visibility
|
||||
white-space
|
||||
widows
|
||||
width
|
||||
word-wrap
|
||||
word-spacing
|
||||
z-index
|
||||
background
|
||||
border
|
||||
border-color
|
||||
border-style
|
||||
border-top
|
||||
border-right
|
||||
border-bottom
|
||||
border-left
|
||||
border-width
|
||||
box-sizing
|
||||
font
|
||||
list-style
|
||||
margin
|
||||
outline
|
||||
padding
|
||||
# some more IE extensions
|
||||
scrollbar-base-color
|
||||
scrollbar-face-color
|
||||
scrollbar-shadow-color
|
||||
scrollbar-highlight-color
|
||||
scrollbar-3dlight-color
|
||||
scrollbar-darkshadow-color
|
||||
scrollbar-track-color
|
||||
scrollbar-arrow-color
|
||||
# khtml internals
|
||||
-khtml-flow-mode
|
||||
-khtml-user-input
|
||||
#
|
||||
# SVG (1.1)
|
||||
#
|
||||
alignment-baseline
|
||||
baseline-shift
|
||||
# clip
|
||||
clip-path
|
||||
clip-rule
|
||||
# color
|
||||
color-interpolation
|
||||
color-interpolation-filters
|
||||
color-profile
|
||||
color-rendering
|
||||
# cursor
|
||||
# direction
|
||||
# display
|
||||
dominant-baseline
|
||||
enable-background
|
||||
fill
|
||||
fill-opacity
|
||||
fill-rule
|
||||
filter
|
||||
flood-color
|
||||
flood-opacity
|
||||
# font
|
||||
# font-family
|
||||
# font-size
|
||||
font-size-adjust
|
||||
font-stretch
|
||||
# font-style
|
||||
# font-variant
|
||||
# font-weight
|
||||
glyph-orientation-horizontal
|
||||
glyph-orientation-vertical
|
||||
image-rendering
|
||||
kerning
|
||||
# letter-spacing
|
||||
lighting-color
|
||||
marker
|
||||
marker-end
|
||||
marker-mid
|
||||
marker-start
|
||||
mask
|
||||
# opacity
|
||||
# overflow
|
||||
pointer-events
|
||||
shape-rendering
|
||||
stop-color
|
||||
stop-opacity
|
||||
stroke
|
||||
stroke-dasharray
|
||||
stroke-dashoffset
|
||||
stroke-linecap
|
||||
stroke-linejoin
|
||||
stroke-miterlimit
|
||||
stroke-opacity
|
||||
stroke-width
|
||||
text-anchor
|
||||
# text-decoration
|
||||
text-rendering
|
||||
# unicode-bidi
|
||||
# visibility
|
||||
# word-spacing
|
||||
writing-mode
|
File diff suppressed because it is too large
Load diff
|
@ -1,376 +0,0 @@
|
|||
/*
|
||||
* This file is part of the CSS implementation for KDE.
|
||||
*
|
||||
* Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* Copyright (C) 2003, 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.
|
||||
*
|
||||
*/
|
||||
#ifndef _CSS_cssstyleselector_h_
|
||||
#define _CSS_cssstyleselector_h_
|
||||
|
||||
#include "rendering/render_style.h"
|
||||
#include "dom/dom_string.h"
|
||||
#include "css/css_mediaquery.h"
|
||||
#include <QtCore/QVarLengthArray>
|
||||
#include <QtCore/QList>
|
||||
#include <wtf/HashMap.h>
|
||||
#include <wtf/Vector.h>
|
||||
#include <wtf/HashSet.h>
|
||||
|
||||
class KHTMLSettings;
|
||||
class KHTMLView;
|
||||
class KHTMLPart;
|
||||
class KUrl;
|
||||
|
||||
namespace DOM {
|
||||
class DocumentImpl;
|
||||
class NodeImpl;
|
||||
class ElementImpl;
|
||||
class StyleSheetImpl;
|
||||
class CSSStyleRuleImpl;
|
||||
class CSSStyleSheetImpl;
|
||||
class CSSSelector;
|
||||
class CSSStyleDeclarationImpl;
|
||||
class CSSProperty;
|
||||
class StyleSheetListImpl;
|
||||
class CSSValueImpl;
|
||||
class CSSFontSelector;
|
||||
}
|
||||
|
||||
namespace khtml
|
||||
{
|
||||
class CSSStyleSelectorList;
|
||||
class CSSOrderedRule;
|
||||
class CSSOrderedPropertyList;
|
||||
class RenderStyle;
|
||||
class MediaQueryEvaluator;
|
||||
|
||||
/*
|
||||
* to remember the source where a rule came from. Differentiates between
|
||||
* important and not important rules. This is ordered in the order they have to be applied
|
||||
* to the RenderStyle.
|
||||
*/
|
||||
enum Source {
|
||||
Default = 0,
|
||||
User = 1,
|
||||
NonCSSHint = 2,
|
||||
Author = 3,
|
||||
Inline = 4,
|
||||
AuthorImportant = 5,
|
||||
InlineImportant = 6,
|
||||
UserImportant =7
|
||||
};
|
||||
|
||||
/*
|
||||
* List of properties that get applied to the Element. We need to collect them first
|
||||
* and then apply them one by one, because we have to change the apply order.
|
||||
* Some properties depend on other one already being applied (for example all properties specifying
|
||||
* some length need to have already the correct font size. Same applies to color
|
||||
*
|
||||
* While sorting them, we have to take care not to mix up the original order.
|
||||
*/
|
||||
class CSSOrderedProperty
|
||||
{
|
||||
public:
|
||||
CSSOrderedProperty(DOM::CSSProperty *_prop, uint _selector,
|
||||
bool first, Source source, unsigned int specificity,
|
||||
unsigned int _position )
|
||||
: prop ( _prop ), pseudoId( RenderStyle::NOPSEUDO ), selector( _selector ),
|
||||
position( _position )
|
||||
{
|
||||
priority = (!first << 30) | (source << 24) | specificity;
|
||||
}
|
||||
CSSOrderedProperty(): prop( 0 ), pseudoId( RenderStyle::NOPSEUDO ), selector(0),
|
||||
position( 0 )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool operator < ( const CSSOrderedProperty &other ) const {
|
||||
if (priority < other.priority) return true;
|
||||
if (priority > other.priority) return false;
|
||||
if (position < other.position) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
DOM::CSSProperty *prop;
|
||||
RenderStyle::PseudoId pseudoId;
|
||||
unsigned int selector;
|
||||
unsigned int position;
|
||||
|
||||
quint32 priority;
|
||||
};
|
||||
|
||||
class MediaQueryResult
|
||||
{
|
||||
public:
|
||||
MediaQueryResult(const MediaQueryExp& expr, bool result)
|
||||
: m_expression(expr)
|
||||
, m_result(result)
|
||||
{}
|
||||
|
||||
MediaQueryExp m_expression;
|
||||
bool m_result;
|
||||
};
|
||||
|
||||
/**
|
||||
* this class selects a RenderStyle for a given Element based on the
|
||||
* collection of stylesheets it contains. This is just a virtual base class
|
||||
* for specific implementations of the Selector. At the moment only CSSStyleSelector
|
||||
* exists, but someone may wish to implement XSL...
|
||||
*/
|
||||
class StyleSelector
|
||||
{
|
||||
public:
|
||||
StyleSelector() {}
|
||||
|
||||
/* as nobody has implemented a second style selector up to now comment out
|
||||
the virtual methods until then, so the class has no vptr.
|
||||
*/
|
||||
// virtual ~StyleSelector() {}
|
||||
// virtual RenderStyle *styleForElement(DOM::ElementImpl *e) = 0;
|
||||
|
||||
enum State {
|
||||
None = 0x00,
|
||||
Hover = 0x01,
|
||||
Focus = 0x02,
|
||||
Active = 0x04
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* the StyleSelector implementation for CSS.
|
||||
*/
|
||||
class CSSStyleSelector : public StyleSelector
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* creates a new StyleSelector for a Document.
|
||||
* goes through all StyleSheets defined in the document and
|
||||
* creates a list of rules it needs to apply to objects
|
||||
*
|
||||
* Also takes into account special cases for HTML documents,
|
||||
* including the defaultStyle (which is html only)
|
||||
*/
|
||||
CSSStyleSelector( DOM::DocumentImpl* doc, QString userStyleSheet, DOM::StyleSheetListImpl *styleSheets, const KUrl &url,
|
||||
bool _strictParsing );
|
||||
/**
|
||||
* same as above but for a single stylesheet.
|
||||
*/
|
||||
CSSStyleSelector( DOM::CSSStyleSheetImpl *sheet );
|
||||
|
||||
~CSSStyleSelector();
|
||||
|
||||
void addSheet( DOM::CSSStyleSheetImpl *sheet );
|
||||
KHTML_EXPORT static void clear();
|
||||
static void reparseConfiguration();
|
||||
|
||||
static void loadDefaultStyle(const KHTMLSettings *s, DOM::DocumentImpl *doc);
|
||||
|
||||
// fallbackParentStyle will be inheritted from if the parent doesn't have style info
|
||||
RenderStyle *styleForElement(DOM::ElementImpl *e, RenderStyle* fallbackParentStyle = 0);
|
||||
|
||||
bool isMatchedByAnySelector(DOM::ElementImpl* e, const QList<DOM::CSSSelector*>& sels);
|
||||
|
||||
QVector<int> fontSizes() const { return m_fontSizes; }
|
||||
QVector<int> fixedFontSizes() const { return m_fixedFontSizes; }
|
||||
|
||||
bool strictParsing;
|
||||
struct Encodedurl {
|
||||
QString host; //also contains protocol
|
||||
QString path;
|
||||
QString file;
|
||||
} encodedurl;
|
||||
|
||||
// called from KHTMLView::print()
|
||||
void computeFontSizes(int logicalDpiY, int zoomFactor);
|
||||
void computeFontSizesFor(int logicalDpiY, int zoomFactor, QVector<int>& fontSizes, bool isFixed);
|
||||
|
||||
static void precomputeAttributeDependencies(DOM::DocumentImpl* doc, DOM::CSSSelector* sel);
|
||||
void addViewportDependentMediaQueryResult(const MediaQueryExp*, bool result);
|
||||
bool affectedByViewportChange() const;
|
||||
DOM::CSSFontSelector* fontSelector() const { return m_fontSelector; }
|
||||
protected:
|
||||
/* checks if the complete selector (which can be build up from a few CSSSelector's
|
||||
with given relationships matches the given Element */
|
||||
void checkSelector(int selector, DOM::ElementImpl *e);
|
||||
/* checks if the selector matches the given Element */
|
||||
bool checkSimpleSelector(DOM::CSSSelector *selector, DOM::ElementImpl *e, bool isAncestor, bool isSubSelector = false);
|
||||
|
||||
enum SelectorMatch {SelectorMatches = 0, SelectorFailsLocal, SelectorFails};
|
||||
SelectorMatch checkSelector(DOM::CSSSelector *sel, DOM::ElementImpl *e, bool isAncestor, bool isSubSelector = false);
|
||||
|
||||
// computes various summaries of the documents' properties, which are used in
|
||||
// the various checkSelector methods for optimizations
|
||||
void prepareToMatchElement(DOM::ElementImpl* e, bool withDeps);
|
||||
|
||||
void addDependency(int dependencyType, DOM::ElementImpl* dependency);
|
||||
void setupDefaultRootStyle(DOM::DocumentImpl *d=0);
|
||||
// locates potentially similar style
|
||||
RenderStyle* locateSimilarStyle();
|
||||
|
||||
/* builds up the selectors and properties lists from the CSSStyleSelectorList's */
|
||||
void buildLists();
|
||||
void clearLists();
|
||||
|
||||
void adjustRenderStyle(RenderStyle* style, DOM::ElementImpl *e);
|
||||
|
||||
void addInlineDeclarations(DOM::ElementImpl* e);
|
||||
|
||||
static DOM::CSSStyleSheetImpl *s_defaultSheet;
|
||||
static DOM::CSSStyleSheetImpl *s_defaultNonCSSHintsSheet;
|
||||
static DOM::CSSStyleSheetImpl *s_quirksSheet;
|
||||
static CSSStyleSelectorList *s_defaultStyle;
|
||||
static CSSStyleSelectorList *s_defaultQuirksStyle;
|
||||
static CSSStyleSelectorList *s_defaultPrintStyle;
|
||||
static CSSStyleSelectorList *s_defaultNonCSSHintsStyle;
|
||||
static RenderStyle* styleNotYetAvailable;
|
||||
|
||||
CSSStyleSelectorList *defaultStyle;
|
||||
CSSStyleSelectorList *defaultQuirksStyle;
|
||||
CSSStyleSelectorList *defaultNonCSSHintsStyle;
|
||||
CSSStyleSelectorList *defaultPrintStyle;
|
||||
|
||||
CSSStyleSelectorList *authorStyle;
|
||||
CSSStyleSelectorList *implicitStyle;
|
||||
CSSStyleSelectorList *userStyle;
|
||||
DOM::CSSStyleSheetImpl *userSheet;
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
void init(const KHTMLSettings* settings, DOM::DocumentImpl* doc);
|
||||
|
||||
void mapBackgroundAttachment(BackgroundLayer* layer, DOM::CSSValueImpl* value);
|
||||
void mapBackgroundClip(BackgroundLayer* layer, DOM::CSSValueImpl* value);
|
||||
void mapBackgroundOrigin(BackgroundLayer* layer, DOM::CSSValueImpl* value);
|
||||
void mapBackgroundImage(BackgroundLayer* layer, DOM::CSSValueImpl* value);
|
||||
void mapBackgroundRepeat(BackgroundLayer* layer, DOM::CSSValueImpl* value);
|
||||
void mapBackgroundSize(BackgroundLayer* layer, DOM::CSSValueImpl* value);
|
||||
void mapBackgroundXPosition(BackgroundLayer* layer, DOM::CSSValueImpl* value);
|
||||
void mapBackgroundYPosition(BackgroundLayer* layer, DOM::CSSValueImpl* value);
|
||||
|
||||
public: // we need to make the enum public for SelectorCache
|
||||
enum SelectorState {
|
||||
Unknown = 0,
|
||||
Applies,
|
||||
AppliesPseudo,
|
||||
Invalid
|
||||
};
|
||||
|
||||
enum SelectorMedia {
|
||||
MediaAural = 1,
|
||||
MediaBraille,
|
||||
MediaEmboss,
|
||||
MediaHandheld,
|
||||
MediaPrint,
|
||||
MediaProjection,
|
||||
MediaScreen,
|
||||
MediaTTY,
|
||||
MediaTV
|
||||
};
|
||||
protected:
|
||||
|
||||
struct SelectorCache {
|
||||
SelectorState state;
|
||||
unsigned firstPropertyIndex;
|
||||
};
|
||||
|
||||
unsigned int selectors_size;
|
||||
DOM::CSSSelector **selectors;
|
||||
SelectorCache *selectorCache;
|
||||
unsigned *nextPropertyIndexes;
|
||||
unsigned int properties_size;
|
||||
unsigned *nextSimilarSelector;
|
||||
CSSOrderedProperty *propertiesBuffer;
|
||||
QVarLengthArray<CSSOrderedProperty> inlineProps;
|
||||
MediaQueryEvaluator* m_medium;
|
||||
WTF::Vector<CSSOrderedProperty*> propsToApply;
|
||||
WTF::Vector<CSSOrderedProperty*> pseudoProps;
|
||||
|
||||
// hashes for faster styleForElement
|
||||
WTF::HashMap<quintptr, int> classSelector, idSelector;
|
||||
WTF::HashMap<unsigned, int> tagSelector;
|
||||
int otherSelector;
|
||||
|
||||
WTF::HashSet<unsigned> tagCache;
|
||||
WTF::HashSet<quintptr> classCache, idCache;
|
||||
|
||||
RenderStyle::PseudoId dynamicPseudo;
|
||||
|
||||
RenderStyle *style;
|
||||
RenderStyle *parentStyle;
|
||||
RenderStyle *m_rootStyle; // needed to compute 'rem' lengths
|
||||
DOM::ElementImpl *element;
|
||||
DOM::NodeImpl *parentNode;
|
||||
KHTMLView *view;
|
||||
KHTMLPart *part;
|
||||
const KHTMLSettings *settings;
|
||||
bool rememberDependencies;
|
||||
int logicalDpiY;
|
||||
RenderStyle* m_rootDefaultStyle;
|
||||
QVector<int> m_fontSizes;
|
||||
QVector<int> m_fixedFontSizes;
|
||||
int m_minFontSize;
|
||||
|
||||
bool fontDirty;
|
||||
DOM::CSSFontSelector* m_fontSelector;
|
||||
QList<MediaQueryResult*> m_viewportDependentMediaQueryResults;
|
||||
|
||||
void applyRule(int id, DOM::CSSValueImpl *value);
|
||||
void applySVGRule(int id, DOM::CSSValueImpl *value);
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the list we will collect all properties we need to apply in.
|
||||
* It will get sorted once before applying.
|
||||
*/
|
||||
class CSSOrderedPropertyList : public QVector<CSSOrderedProperty>
|
||||
{
|
||||
public:
|
||||
void append(DOM::CSSStyleDeclarationImpl *decl, uint selector, uint specificity,
|
||||
Source regular, Source important);
|
||||
};
|
||||
|
||||
class CSSOrderedRule
|
||||
{
|
||||
public:
|
||||
CSSOrderedRule(DOM::CSSStyleRuleImpl *r, DOM::CSSSelector *s, int _index);
|
||||
~CSSOrderedRule();
|
||||
|
||||
DOM::CSSSelector *selector;
|
||||
DOM::CSSStyleRuleImpl *rule;
|
||||
int index;
|
||||
};
|
||||
|
||||
class CSSStyleSelectorList : public QList<CSSOrderedRule*>
|
||||
{
|
||||
public:
|
||||
CSSStyleSelectorList();
|
||||
virtual ~CSSStyleSelectorList();
|
||||
|
||||
void append( DOM::CSSStyleSheetImpl *sheet,
|
||||
MediaQueryEvaluator *medium, CSSStyleSelector* styleSelector );
|
||||
|
||||
void collect(WTF::HashMap<DOM::CSSSelector*, int>* selectorsCache, QList<DOM::CSSSelector*> *selectorList,
|
||||
CSSOrderedPropertyList *propList, Source regular, Source important);
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,350 +0,0 @@
|
|||
/* This file is automatically generated from cssvalues.in by makevalues, do not edit */
|
||||
/* Copyright 1998 W. Bastian */
|
||||
|
||||
#ifndef CSSVALUES_H
|
||||
#define CSSVALUES_H
|
||||
|
||||
DOM::DOMString getValueName(unsigned short id) KDE_NO_EXPORT;
|
||||
|
||||
#define CSS_VAL_INVALID 0
|
||||
#define CSS_VAL_MIN 1
|
||||
#define CSS_VAL_INHERIT 1
|
||||
#define CSS_VAL_INITIAL 2
|
||||
#define CSS_VAL__KHTML_NATIVE 3
|
||||
#define CSS_VAL_NONE 4
|
||||
#define CSS_VAL_HIDDEN 5
|
||||
#define CSS_VAL_INSET 6
|
||||
#define CSS_VAL_GROOVE 7
|
||||
#define CSS_VAL_RIDGE 8
|
||||
#define CSS_VAL_OUTSET 9
|
||||
#define CSS_VAL_DOTTED 10
|
||||
#define CSS_VAL_DASHED 11
|
||||
#define CSS_VAL_SOLID 12
|
||||
#define CSS_VAL_DOUBLE 13
|
||||
#define CSS_VAL_CAPTION 14
|
||||
#define CSS_VAL_ICON 15
|
||||
#define CSS_VAL_MENU 16
|
||||
#define CSS_VAL_MESSAGE_BOX 17
|
||||
#define CSS_VAL_SMALL_CAPTION 18
|
||||
#define CSS_VAL_STATUS_BAR 19
|
||||
#define CSS_VAL_ITALIC 20
|
||||
#define CSS_VAL_OBLIQUE 21
|
||||
#define CSS_VAL_SMALL_CAPS 22
|
||||
#define CSS_VAL_NORMAL 23
|
||||
#define CSS_VAL_BOLD 24
|
||||
#define CSS_VAL_BOLDER 25
|
||||
#define CSS_VAL_LIGHTER 26
|
||||
#define CSS_VAL_100 27
|
||||
#define CSS_VAL_200 28
|
||||
#define CSS_VAL_300 29
|
||||
#define CSS_VAL_400 30
|
||||
#define CSS_VAL_500 31
|
||||
#define CSS_VAL_600 32
|
||||
#define CSS_VAL_700 33
|
||||
#define CSS_VAL_800 34
|
||||
#define CSS_VAL_900 35
|
||||
#define CSS_VAL_XX_SMALL 36
|
||||
#define CSS_VAL_X_SMALL 37
|
||||
#define CSS_VAL_SMALL 38
|
||||
#define CSS_VAL_MEDIUM 39
|
||||
#define CSS_VAL_LARGE 40
|
||||
#define CSS_VAL_X_LARGE 41
|
||||
#define CSS_VAL_XX_LARGE 42
|
||||
#define CSS_VAL__KHTML_XXX_LARGE 43
|
||||
#define CSS_VAL_SMALLER 44
|
||||
#define CSS_VAL_LARGER 45
|
||||
#define CSS_VAL_WIDER 46
|
||||
#define CSS_VAL_NARROWER 47
|
||||
#define CSS_VAL_ULTRA_CONDENSED 48
|
||||
#define CSS_VAL_EXTRA_CONDENSED 49
|
||||
#define CSS_VAL_CONDENSED 50
|
||||
#define CSS_VAL_SEMI_CONDENSED 51
|
||||
#define CSS_VAL_SEMI_EXPANDED 52
|
||||
#define CSS_VAL_EXPANDED 53
|
||||
#define CSS_VAL_EXTRA_EXPANDED 54
|
||||
#define CSS_VAL_ULTRA_EXPANDED 55
|
||||
#define CSS_VAL_SERIF 56
|
||||
#define CSS_VAL_SANS_SERIF 57
|
||||
#define CSS_VAL_CURSIVE 58
|
||||
#define CSS_VAL_FANTASY 59
|
||||
#define CSS_VAL_MONOSPACE 60
|
||||
#define CSS_VAL_SCROLL 61
|
||||
#define CSS_VAL_FIXED 62
|
||||
#define CSS_VAL_LOCAL 63
|
||||
#define CSS_VAL_TRANSPARENT 64
|
||||
#define CSS_VAL_AQUA 65
|
||||
#define CSS_VAL_BLACK 66
|
||||
#define CSS_VAL_BLUE 67
|
||||
#define CSS_VAL_CRIMSON 68
|
||||
#define CSS_VAL_FUCHSIA 69
|
||||
#define CSS_VAL_GRAY 70
|
||||
#define CSS_VAL_GREEN 71
|
||||
#define CSS_VAL_INDIGO 72
|
||||
#define CSS_VAL_LIME 73
|
||||
#define CSS_VAL_MAROON 74
|
||||
#define CSS_VAL_NAVY 75
|
||||
#define CSS_VAL_OLIVE 76
|
||||
#define CSS_VAL_ORANGE 77
|
||||
#define CSS_VAL_PURPLE 78
|
||||
#define CSS_VAL_RED 79
|
||||
#define CSS_VAL_SILVER 80
|
||||
#define CSS_VAL_TEAL 81
|
||||
#define CSS_VAL_WHITE 82
|
||||
#define CSS_VAL_YELLOW 83
|
||||
#define CSS_VAL_ACTIVEBORDER 84
|
||||
#define CSS_VAL_ACTIVECAPTION 85
|
||||
#define CSS_VAL_APPWORKSPACE 86
|
||||
#define CSS_VAL_BACKGROUND 87
|
||||
#define CSS_VAL_BUTTONFACE 88
|
||||
#define CSS_VAL_BUTTONHIGHLIGHT 89
|
||||
#define CSS_VAL_BUTTONSHADOW 90
|
||||
#define CSS_VAL_BUTTONTEXT 91
|
||||
#define CSS_VAL_CAPTIONTEXT 92
|
||||
#define CSS_VAL_GRAYTEXT 93
|
||||
#define CSS_VAL_HIGHLIGHT 94
|
||||
#define CSS_VAL_HIGHLIGHTTEXT 95
|
||||
#define CSS_VAL_INACTIVEBORDER 96
|
||||
#define CSS_VAL_INACTIVECAPTION 97
|
||||
#define CSS_VAL_INACTIVECAPTIONTEXT 98
|
||||
#define CSS_VAL_INFOBACKGROUND 99
|
||||
#define CSS_VAL_INFOTEXT 100
|
||||
#define CSS_VAL_MENUTEXT 101
|
||||
#define CSS_VAL_SCROLLBAR 102
|
||||
#define CSS_VAL_THREEDDARKSHADOW 103
|
||||
#define CSS_VAL_THREEDFACE 104
|
||||
#define CSS_VAL_THREEDHIGHLIGHT 105
|
||||
#define CSS_VAL_THREEDLIGHTSHADOW 106
|
||||
#define CSS_VAL_THREEDSHADOW 107
|
||||
#define CSS_VAL_WINDOW 108
|
||||
#define CSS_VAL_WINDOWFRAME 109
|
||||
#define CSS_VAL_WINDOWTEXT 110
|
||||
#define CSS_VAL_CURRENTCOLOR 111
|
||||
#define CSS_VAL_GREY 112
|
||||
#define CSS_VAL__KHTML_TEXT 113
|
||||
#define CSS_VAL_REPEAT 114
|
||||
#define CSS_VAL_REPEAT_X 115
|
||||
#define CSS_VAL_REPEAT_Y 116
|
||||
#define CSS_VAL_NO_REPEAT 117
|
||||
#define CSS_VAL_BASELINE 118
|
||||
#define CSS_VAL_MIDDLE 119
|
||||
#define CSS_VAL_SUB 120
|
||||
#define CSS_VAL_SUPER 121
|
||||
#define CSS_VAL_TEXT_TOP 122
|
||||
#define CSS_VAL_TEXT_BOTTOM 123
|
||||
#define CSS_VAL_TOP 124
|
||||
#define CSS_VAL_BOTTOM 125
|
||||
#define CSS_VAL__KHTML_BASELINE_MIDDLE 126
|
||||
#define CSS_VAL__KHTML_AUTO 127
|
||||
#define CSS_VAL_LEFT 128
|
||||
#define CSS_VAL_RIGHT 129
|
||||
#define CSS_VAL_CENTER 130
|
||||
#define CSS_VAL_JUSTIFY 131
|
||||
#define CSS_VAL__KHTML_LEFT 132
|
||||
#define CSS_VAL__KHTML_RIGHT 133
|
||||
#define CSS_VAL__KHTML_CENTER 134
|
||||
#define CSS_VAL_OUTSIDE 135
|
||||
#define CSS_VAL_INSIDE 136
|
||||
#define CSS_VAL_DISC 137
|
||||
#define CSS_VAL_CIRCLE 138
|
||||
#define CSS_VAL_SQUARE 139
|
||||
#define CSS_VAL_BOX 140
|
||||
#define CSS_VAL__KHTML_DIAMOND 141
|
||||
#define CSS_VAL_DECIMAL 142
|
||||
#define CSS_VAL_DECIMAL_LEADING_ZERO 143
|
||||
#define CSS_VAL__KHTML_ARABIC_INDIC 144
|
||||
#define CSS_VAL__KHTML_LAO 145
|
||||
#define CSS_VAL__KHTML_PERSIAN 146
|
||||
#define CSS_VAL__KHTML_URDU 147
|
||||
#define CSS_VAL__KHTML_THAI 148
|
||||
#define CSS_VAL__KHTML_TIBETAN 149
|
||||
#define CSS_VAL_LOWER_ROMAN 150
|
||||
#define CSS_VAL_UPPER_ROMAN 151
|
||||
#define CSS_VAL_HEBREW 152
|
||||
#define CSS_VAL_ARMENIAN 153
|
||||
#define CSS_VAL_GEORGIAN 154
|
||||
#define CSS_VAL_CJK_IDEOGRAPHIC 155
|
||||
#define CSS_VAL__KHTML_JAPANESE_FORMAL 156
|
||||
#define CSS_VAL__KHTML_JAPANESE_INFORMAL 157
|
||||
#define CSS_VAL__KHTML_SIMP_CHINESE_FORMAL 158
|
||||
#define CSS_VAL__KHTML_SIMP_CHINESE_INFORMAL 159
|
||||
#define CSS_VAL__KHTML_TRAD_CHINESE_FORMAL 160
|
||||
#define CSS_VAL__KHTML_TRAD_CHINESE_INFORMAL 161
|
||||
#define CSS_VAL_LOWER_GREEK 162
|
||||
#define CSS_VAL__KHTML_UPPER_GREEK 163
|
||||
#define CSS_VAL_LOWER_ALPHA 164
|
||||
#define CSS_VAL_LOWER_LATIN 165
|
||||
#define CSS_VAL_UPPER_ALPHA 166
|
||||
#define CSS_VAL_UPPER_LATIN 167
|
||||
#define CSS_VAL_HIRAGANA 168
|
||||
#define CSS_VAL_KATAKANA 169
|
||||
#define CSS_VAL_HIRAGANA_IROHA 170
|
||||
#define CSS_VAL_KATAKANA_IROHA 171
|
||||
#define CSS_VAL__KHTML_OPEN_QUOTE 172
|
||||
#define CSS_VAL__KHTML_CLOSE_QUOTE 173
|
||||
#define CSS_VAL_INLINE 174
|
||||
#define CSS_VAL_BLOCK 175
|
||||
#define CSS_VAL_LIST_ITEM 176
|
||||
#define CSS_VAL_RUN_IN 177
|
||||
#define CSS_VAL_COMPACT 178
|
||||
#define CSS_VAL_INLINE_BLOCK 179
|
||||
#define CSS_VAL_TABLE 180
|
||||
#define CSS_VAL_INLINE_TABLE 181
|
||||
#define CSS_VAL_TABLE_ROW_GROUP 182
|
||||
#define CSS_VAL_TABLE_HEADER_GROUP 183
|
||||
#define CSS_VAL_TABLE_FOOTER_GROUP 184
|
||||
#define CSS_VAL_TABLE_ROW 185
|
||||
#define CSS_VAL_TABLE_COLUMN_GROUP 186
|
||||
#define CSS_VAL_TABLE_COLUMN 187
|
||||
#define CSS_VAL_TABLE_CELL 188
|
||||
#define CSS_VAL_TABLE_CAPTION 189
|
||||
#define CSS_VAL_AUTO 190
|
||||
#define CSS_VAL_DEFAULT 191
|
||||
#define CSS_VAL_CONTEXT_MENU 192
|
||||
#define CSS_VAL_HELP 193
|
||||
#define CSS_VAL_POINTER 194
|
||||
#define CSS_VAL_PROGRESS 195
|
||||
#define CSS_VAL_WAIT 196
|
||||
#define CSS_VAL_CELL 197
|
||||
#define CSS_VAL_CROSSHAIR 198
|
||||
#define CSS_VAL_TEXT 199
|
||||
#define CSS_VAL_VERTICAL_TEXT 200
|
||||
#define CSS_VAL_ALIAS 201
|
||||
#define CSS_VAL_COPY 202
|
||||
#define CSS_VAL_MOVE 203
|
||||
#define CSS_VAL_NO_DROP 204
|
||||
#define CSS_VAL_NOT_ALLOWED 205
|
||||
#define CSS_VAL_E_RESIZE 206
|
||||
#define CSS_VAL_N_RESIZE 207
|
||||
#define CSS_VAL_NE_RESIZE 208
|
||||
#define CSS_VAL_NW_RESIZE 209
|
||||
#define CSS_VAL_S_RESIZE 210
|
||||
#define CSS_VAL_SE_RESIZE 211
|
||||
#define CSS_VAL_SW_RESIZE 212
|
||||
#define CSS_VAL_W_RESIZE 213
|
||||
#define CSS_VAL_EW_RESIZE 214
|
||||
#define CSS_VAL_NS_RESIZE 215
|
||||
#define CSS_VAL_NESW_RESIZE 216
|
||||
#define CSS_VAL_NWSE_RESIZE 217
|
||||
#define CSS_VAL_COL_RESIZE 218
|
||||
#define CSS_VAL_ROW_RESIZE 219
|
||||
#define CSS_VAL_ALL_SCROLL 220
|
||||
#define CSS_VAL_LTR 221
|
||||
#define CSS_VAL_RTL 222
|
||||
#define CSS_VAL_CAPITALIZE 223
|
||||
#define CSS_VAL_UPPERCASE 224
|
||||
#define CSS_VAL_LOWERCASE 225
|
||||
#define CSS_VAL_VISIBLE 226
|
||||
#define CSS_VAL_COLLAPSE 227
|
||||
#define CSS_VAL_CLOSE_QUOTE 228
|
||||
#define CSS_VAL_NO_CLOSE_QUOTE 229
|
||||
#define CSS_VAL_NO_OPEN_QUOTE 230
|
||||
#define CSS_VAL_OPEN_QUOTE 231
|
||||
#define CSS_VAL_NOWRAP 232
|
||||
#define CSS_VAL_PRE 233
|
||||
#define CSS_VAL_PRE_WRAP 234
|
||||
#define CSS_VAL_PRE_LINE 235
|
||||
#define CSS_VAL__KHTML_NOWRAP 236
|
||||
#define CSS_VAL_BREAK_WORD 237
|
||||
#define CSS_VAL_ABOVE 238
|
||||
#define CSS_VAL_ABSOLUTE 239
|
||||
#define CSS_VAL_ALWAYS 240
|
||||
#define CSS_VAL_AVOID 241
|
||||
#define CSS_VAL_BELOW 242
|
||||
#define CSS_VAL_BIDI_OVERRIDE 243
|
||||
#define CSS_VAL_BLINK 244
|
||||
#define CSS_VAL_BOTH 245
|
||||
#define CSS_VAL_CROP 246
|
||||
#define CSS_VAL_CROSS 247
|
||||
#define CSS_VAL_EMBED 248
|
||||
#define CSS_VAL_HAND 249
|
||||
#define CSS_VAL_HIDE 250
|
||||
#define CSS_VAL_HIGHER 251
|
||||
#define CSS_VAL_INVERT 252
|
||||
#define CSS_VAL_LANDSCAPE 253
|
||||
#define CSS_VAL_LEVEL 254
|
||||
#define CSS_VAL_LINE_THROUGH 255
|
||||
#define CSS_VAL_LOUD 256
|
||||
#define CSS_VAL_LOWER 257
|
||||
#define CSS_VAL_MARQUEE 258
|
||||
#define CSS_VAL_MIX 259
|
||||
#define CSS_VAL_OVERLINE 260
|
||||
#define CSS_VAL_PORTRAIT 261
|
||||
#define CSS_VAL_RELATIVE 262
|
||||
#define CSS_VAL_SEPARATE 263
|
||||
#define CSS_VAL_SHOW 264
|
||||
#define CSS_VAL_STATIC 265
|
||||
#define CSS_VAL_THICK 266
|
||||
#define CSS_VAL_THIN 267
|
||||
#define CSS_VAL_UNDERLINE 268
|
||||
#define CSS_VAL__KHTML_NORMAL 269
|
||||
#define CSS_VAL__KHTML_AROUND_FLOATS 270
|
||||
#define CSS_VAL_BORDER_BOX 271
|
||||
#define CSS_VAL_CONTENT_BOX 272
|
||||
#define CSS_VAL_ENABLED 273
|
||||
#define CSS_VAL_DISABLED 274
|
||||
#define CSS_VAL_FORWARDS 275
|
||||
#define CSS_VAL_BACKWARDS 276
|
||||
#define CSS_VAL_AHEAD 277
|
||||
#define CSS_VAL_REVERSE 278
|
||||
#define CSS_VAL_UP 279
|
||||
#define CSS_VAL_DOWN 280
|
||||
#define CSS_VAL_SLOW 281
|
||||
#define CSS_VAL_FAST 282
|
||||
#define CSS_VAL_INFINITE 283
|
||||
#define CSS_VAL_SLIDE 284
|
||||
#define CSS_VAL_ALTERNATE 285
|
||||
#define CSS_VAL_UNFURL 286
|
||||
#define CSS_VAL_CLIP 287
|
||||
#define CSS_VAL_ELLIPSIS 288
|
||||
#define CSS_VAL_PADDING_BOX 289
|
||||
#define CSS_VAL_BORDER 290
|
||||
#define CSS_VAL_CONTENT 291
|
||||
#define CSS_VAL_PADDING 292
|
||||
#define CSS_VAL_CONTAIN 293
|
||||
#define CSS_VAL_COVER 294
|
||||
#define CSS_VAL_EVENODD 295
|
||||
#define CSS_VAL_NONZERO 296
|
||||
#define CSS_VAL_BEFORE_EDGE 297
|
||||
#define CSS_VAL_TEXT_BEFORE_EDGE 298
|
||||
#define CSS_VAL_CENTRAL 299
|
||||
#define CSS_VAL_AFTER_EDGE 300
|
||||
#define CSS_VAL_TEXT_AFTER_EDGE 301
|
||||
#define CSS_VAL_IDEOGRAPHIC 302
|
||||
#define CSS_VAL_ALPHABETIC 303
|
||||
#define CSS_VAL_HANGING 304
|
||||
#define CSS_VAL_MATHEMATICAL 305
|
||||
#define CSS_VAL_USE_SCRIPT 306
|
||||
#define CSS_VAL_NO_CHANGE 307
|
||||
#define CSS_VAL_RESET_SIZE 308
|
||||
#define CSS_VAL_MITER 309
|
||||
#define CSS_VAL_ROUND 310
|
||||
#define CSS_VAL_BEVEL 311
|
||||
#define CSS_VAL_BUTT 312
|
||||
#define CSS_VAL_ACCUMULATE 313
|
||||
#define CSS_VAL_OPTIMIZESPEED 314
|
||||
#define CSS_VAL_CRISPEDGES 315
|
||||
#define CSS_VAL_GEOMETRICPRECISION 316
|
||||
#define CSS_VAL_START 317
|
||||
#define CSS_VAL_END 318
|
||||
#define CSS_VAL_OPTIMIZELEGIBILITY 319
|
||||
#define CSS_VAL_OPTIMIZEQUALITY 320
|
||||
#define CSS_VAL_SRGB 321
|
||||
#define CSS_VAL_LINEARRGB 322
|
||||
#define CSS_VAL_VISIBLEPAINTED 323
|
||||
#define CSS_VAL_VISIBLEFILL 324
|
||||
#define CSS_VAL_VISIBLESTROKE 325
|
||||
#define CSS_VAL_PAINTED 326
|
||||
#define CSS_VAL_FILL 327
|
||||
#define CSS_VAL_STROKE 328
|
||||
#define CSS_VAL_ALL 329
|
||||
#define CSS_VAL_LR_TB 330
|
||||
#define CSS_VAL_RL_TB 331
|
||||
#define CSS_VAL_TB_RL 332
|
||||
#define CSS_VAL_TB_LR 333
|
||||
#define CSS_VAL_LR 334
|
||||
#define CSS_VAL_RL 335
|
||||
#define CSS_VAL_TB 336
|
||||
|
||||
#define CSS_VAL_TOTAL 337
|
||||
#endif
|
||||
|
|
@ -1,592 +0,0 @@
|
|||
# These are all values accepted for CSS2.
|
||||
#
|
||||
# WARNING:
|
||||
# --------
|
||||
#
|
||||
# The Values are sorted according to the properties they belong to,
|
||||
# and have to be in the same order as the enums in render_style.h.
|
||||
#
|
||||
# If not, the optimizations in the cssparser and style selector will fail,
|
||||
# and produce incorrect results.
|
||||
#
|
||||
inherit
|
||||
initial
|
||||
#
|
||||
# CSS_PROP_OUTLINE_STYLE
|
||||
# CSS_PROP_BORDER_TOP_STYLE
|
||||
# CSS_PROP_BORDER_BOTTOM_STYLE
|
||||
# CSS_PROP_BORDER_LEFT_STYLE
|
||||
-khtml-native
|
||||
none
|
||||
hidden
|
||||
inset
|
||||
groove
|
||||
ridge
|
||||
outset
|
||||
dotted
|
||||
dashed
|
||||
solid
|
||||
double
|
||||
#
|
||||
# CSS_PROP_FONT:
|
||||
#
|
||||
caption
|
||||
icon
|
||||
menu
|
||||
message-box
|
||||
small-caption
|
||||
status-bar
|
||||
#
|
||||
# CSS_PROP_FONT_STYLE:
|
||||
#
|
||||
#normal
|
||||
italic
|
||||
oblique
|
||||
#
|
||||
# CSS_PROP_FONT_VARIANT:
|
||||
#
|
||||
#normal
|
||||
small-caps
|
||||
#
|
||||
# CSS_PROP_FONT_WEIGHT:
|
||||
#
|
||||
normal
|
||||
bold
|
||||
bolder
|
||||
lighter
|
||||
100
|
||||
200
|
||||
300
|
||||
400
|
||||
500
|
||||
600
|
||||
700
|
||||
800
|
||||
900
|
||||
#
|
||||
# CSS_PROP_FONT_SIZE:
|
||||
#
|
||||
xx-small
|
||||
x-small
|
||||
small
|
||||
medium
|
||||
large
|
||||
x-large
|
||||
xx-large
|
||||
-khtml-xxx-large
|
||||
smaller
|
||||
larger
|
||||
#
|
||||
# CSS_PROP_FONT_STRETCH:
|
||||
#
|
||||
#normal
|
||||
wider
|
||||
narrower
|
||||
ultra-condensed
|
||||
extra-condensed
|
||||
condensed
|
||||
semi-condensed
|
||||
semi-expanded
|
||||
expanded
|
||||
extra-expanded
|
||||
ultra-expanded
|
||||
#
|
||||
# CSS_PROP_GENERIC_FONT_FAMILY:
|
||||
#
|
||||
serif
|
||||
sans-serif
|
||||
cursive
|
||||
fantasy
|
||||
monospace
|
||||
#
|
||||
# CSS_PROP_BACKGROUND_ATTACHMENT:
|
||||
#
|
||||
scroll
|
||||
fixed
|
||||
local
|
||||
#
|
||||
# CSS_PROP_BACKGROUND_COLOR:
|
||||
#
|
||||
transparent
|
||||
#
|
||||
#
|
||||
# CSS_PROP_*_COLOR
|
||||
#
|
||||
aqua
|
||||
black
|
||||
blue
|
||||
crimson
|
||||
fuchsia
|
||||
gray
|
||||
green
|
||||
indigo
|
||||
lime
|
||||
maroon
|
||||
navy
|
||||
olive
|
||||
orange
|
||||
purple
|
||||
red
|
||||
silver
|
||||
teal
|
||||
white
|
||||
yellow
|
||||
activeborder
|
||||
activecaption
|
||||
appworkspace
|
||||
background
|
||||
buttonface
|
||||
buttonhighlight
|
||||
buttonshadow
|
||||
buttontext
|
||||
captiontext
|
||||
graytext
|
||||
highlight
|
||||
highlighttext
|
||||
inactiveborder
|
||||
inactivecaption
|
||||
inactivecaptiontext
|
||||
infobackground
|
||||
infotext
|
||||
menutext
|
||||
scrollbar
|
||||
threeddarkshadow
|
||||
threedface
|
||||
threedhighlight
|
||||
threedlightshadow
|
||||
threedshadow
|
||||
window
|
||||
windowframe
|
||||
windowtext
|
||||
currentcolor
|
||||
#
|
||||
# colors in non strict mode
|
||||
grey
|
||||
-khtml-text
|
||||
#
|
||||
# CSS_PROP_BACKGROUND_REPEAT:
|
||||
#
|
||||
repeat
|
||||
repeat-x
|
||||
repeat-y
|
||||
no-repeat
|
||||
#
|
||||
# CSS_PROP_VERTICAL_ALIGN:
|
||||
#
|
||||
baseline
|
||||
middle
|
||||
sub
|
||||
super
|
||||
text-top
|
||||
text-bottom
|
||||
top
|
||||
bottom
|
||||
# HTML alignment MIDDLE has no corresponding CSS alignment
|
||||
-khtml-baseline-middle
|
||||
#
|
||||
# CSS_PROP_TEXT_ALIGN:
|
||||
#
|
||||
-khtml-auto
|
||||
left
|
||||
right
|
||||
center
|
||||
justify
|
||||
-khtml-left
|
||||
-khtml-right
|
||||
-khtml-center
|
||||
#
|
||||
# CSS_PROP_LIST_STYLE_POSITION:
|
||||
#
|
||||
outside
|
||||
inside
|
||||
#
|
||||
# CSS_PROP_LIST_STYLE_TYPE:
|
||||
#
|
||||
disc
|
||||
circle
|
||||
square
|
||||
box
|
||||
-khtml-diamond
|
||||
decimal
|
||||
decimal-leading-zero
|
||||
-khtml-arabic-indic
|
||||
-khtml-lao
|
||||
-khtml-persian
|
||||
-khtml-urdu
|
||||
-khtml-thai
|
||||
-khtml-tibetan
|
||||
lower-roman
|
||||
upper-roman
|
||||
hebrew
|
||||
armenian
|
||||
georgian
|
||||
cjk-ideographic
|
||||
-khtml-japanese-formal
|
||||
-khtml-japanese-informal
|
||||
-khtml-simp-chinese-formal
|
||||
-khtml-simp-chinese-informal
|
||||
-khtml-trad-chinese-formal
|
||||
-khtml-trad-chinese-informal
|
||||
lower-greek
|
||||
-khtml-upper-greek
|
||||
lower-alpha
|
||||
lower-latin
|
||||
upper-alpha
|
||||
upper-latin
|
||||
hiragana
|
||||
katakana
|
||||
hiragana-iroha
|
||||
katakana-iroha
|
||||
-khtml-open-quote
|
||||
-khtml-close-quote
|
||||
#none
|
||||
#
|
||||
# CSS_PROP_DISPLAY:
|
||||
#
|
||||
inline
|
||||
block
|
||||
list-item
|
||||
run-in
|
||||
compact
|
||||
inline-block
|
||||
table
|
||||
inline-table
|
||||
table-row-group
|
||||
table-header-group
|
||||
table-footer-group
|
||||
table-row
|
||||
table-column-group
|
||||
table-column
|
||||
table-cell
|
||||
table-caption
|
||||
#none
|
||||
#
|
||||
# CSS_PROP_CURSOR:
|
||||
#
|
||||
auto
|
||||
default
|
||||
context-menu
|
||||
help
|
||||
pointer
|
||||
progress
|
||||
wait
|
||||
cell
|
||||
crosshair
|
||||
text
|
||||
vertical-text
|
||||
alias
|
||||
copy
|
||||
move
|
||||
no-drop
|
||||
not-allowed
|
||||
e-resize
|
||||
n-resize
|
||||
ne-resize
|
||||
nw-resize
|
||||
s-resize
|
||||
se-resize
|
||||
sw-resize
|
||||
w-resize
|
||||
ew-resize
|
||||
ns-resize
|
||||
nesw-resize
|
||||
nwse-resize
|
||||
col-resize
|
||||
row-resize
|
||||
all-scroll
|
||||
#
|
||||
# CSS_PROP_DIRECTION:
|
||||
#
|
||||
ltr
|
||||
rtl
|
||||
#
|
||||
# CSS_PROP_TEXT_TRANSFORM:
|
||||
#
|
||||
capitalize
|
||||
uppercase
|
||||
lowercase
|
||||
#none
|
||||
#
|
||||
# CSS_PROP_VISIBILITY:
|
||||
#
|
||||
visible
|
||||
#hidden
|
||||
collapse
|
||||
#
|
||||
# CSS_PROP_CONTENT:
|
||||
#
|
||||
close-quote
|
||||
no-close-quote
|
||||
no-open-quote
|
||||
open-quote
|
||||
#
|
||||
# CSS_PROP_WHITE_SPACE:
|
||||
#
|
||||
#normal
|
||||
nowrap
|
||||
pre
|
||||
pre-wrap
|
||||
pre-line
|
||||
-khtml-nowrap
|
||||
#
|
||||
# CSS_PROP_WORD_WRAP
|
||||
#
|
||||
#normal
|
||||
break-word
|
||||
#
|
||||
# Unordered rest
|
||||
#
|
||||
above
|
||||
absolute
|
||||
always
|
||||
avoid
|
||||
below
|
||||
bidi-override
|
||||
blink
|
||||
both
|
||||
crop
|
||||
cross
|
||||
embed
|
||||
hand
|
||||
hide
|
||||
higher
|
||||
invert
|
||||
landscape
|
||||
level
|
||||
line-through
|
||||
loud
|
||||
lower
|
||||
marquee
|
||||
mix
|
||||
overline
|
||||
portrait
|
||||
relative
|
||||
separate
|
||||
show
|
||||
static
|
||||
thick
|
||||
thin
|
||||
underline
|
||||
#
|
||||
# CSS_PROP__KHTML_FLOW_MODE
|
||||
-khtml-normal
|
||||
-khtml-around-floats
|
||||
|
||||
# CSS3 Values
|
||||
# CSS_PROP__KHTML_BOX_SIZING
|
||||
border-box
|
||||
content-box
|
||||
|
||||
# CSS_PROP__KHTML_USER_INPUT
|
||||
enabled
|
||||
disabled
|
||||
#none
|
||||
|
||||
# CSS_PROP_MARQUEE_DIRECTION
|
||||
forwards
|
||||
backwards
|
||||
ahead
|
||||
reverse
|
||||
# left
|
||||
# right
|
||||
up
|
||||
down
|
||||
# auto
|
||||
|
||||
# CSS_PROP_MARQUEE_SPEED
|
||||
slow
|
||||
# normal
|
||||
fast
|
||||
|
||||
# CSS_PROP_MARQUEE_REPETITION
|
||||
infinite
|
||||
|
||||
# CSS_PROP_MARQUEE_STYLE
|
||||
# none
|
||||
slide
|
||||
# scroll
|
||||
alternate
|
||||
unfurl
|
||||
|
||||
#
|
||||
# CSS_PROP_TEXT_OVERFLOW
|
||||
#
|
||||
clip
|
||||
ellipsis
|
||||
|
||||
#
|
||||
# CSS_PROP_BACKGROUND_CLIP/ORIGIN
|
||||
#
|
||||
# border-box
|
||||
# content-box
|
||||
padding-box
|
||||
|
||||
# for early implementation, of BACKGROUND_CLIP/ORIGIN
|
||||
# using khtml prefix
|
||||
border
|
||||
content
|
||||
padding
|
||||
|
||||
#
|
||||
# CSS_PROP_BACKGROUND_SIZE
|
||||
#
|
||||
contain
|
||||
cover
|
||||
|
||||
#
|
||||
# Not supported:
|
||||
#
|
||||
# CSS_PROP_BORDER_IMAGE
|
||||
#
|
||||
# stretch
|
||||
# repeat
|
||||
# round
|
||||
#
|
||||
# CSS_PROP_AZIMUTH:
|
||||
#
|
||||
#A left-side
|
||||
#A far-left
|
||||
#A #left
|
||||
#A center-left
|
||||
#A #center
|
||||
#A center-right
|
||||
#A right
|
||||
#A far-right
|
||||
#A right-side
|
||||
#A behind
|
||||
#A leftwards
|
||||
#A rightwards
|
||||
#
|
||||
# CSS_PROP_SPEECH_RATE:
|
||||
#
|
||||
#A x-slow
|
||||
#A slow
|
||||
#A #medium
|
||||
#A x-fast
|
||||
#A fast
|
||||
#A faster
|
||||
#A slower
|
||||
#
|
||||
# CSS_PROP_VOLUME:
|
||||
#
|
||||
#A silent
|
||||
#A x-soft
|
||||
#A soft
|
||||
#A #medium
|
||||
#A high
|
||||
#A x-high
|
||||
#A x-loud
|
||||
#
|
||||
# CSS_PROP_PITCH:
|
||||
#
|
||||
#A x-low
|
||||
#A low
|
||||
#A #medium
|
||||
#A #high
|
||||
#A #x-high
|
||||
#
|
||||
# CSS_PROP_SPEAK:
|
||||
#
|
||||
#A #normal
|
||||
#A #none
|
||||
#A spell-out
|
||||
#
|
||||
# CSS_PROP_SPEAK_HEADER:
|
||||
#
|
||||
#A #once
|
||||
#A always
|
||||
#
|
||||
# CSS_PROP_SPEAK_NUMERAL:
|
||||
#
|
||||
#A digits
|
||||
#A continuous
|
||||
#
|
||||
# CSS_PROP_SPEAK_PUNCTUATION:
|
||||
#
|
||||
#A code
|
||||
#A #none
|
||||
|
||||
#
|
||||
# SVG
|
||||
#
|
||||
evenodd
|
||||
nonzero
|
||||
|
||||
# CSS_PROP_ALIGNMENT_BASELINE:
|
||||
#
|
||||
# auto
|
||||
# baseline
|
||||
before-edge
|
||||
text-before-edge
|
||||
# middle
|
||||
central
|
||||
after-edge
|
||||
text-after-edge
|
||||
ideographic
|
||||
alphabetic
|
||||
hanging
|
||||
mathematical
|
||||
|
||||
# CSS_PROP_DOMINANT_BASELINE
|
||||
#
|
||||
#
|
||||
use-script
|
||||
no-change
|
||||
reset-size
|
||||
|
||||
# CSS_PROP_STROKE_LINEJOIN
|
||||
miter
|
||||
round
|
||||
bevel
|
||||
|
||||
# CSS_PROP_STROKE_LINECAP
|
||||
butt
|
||||
# round
|
||||
# square
|
||||
|
||||
# CSS_PROP_ENABLE_BACKGROUND
|
||||
accumulate
|
||||
|
||||
# CSS_PROP_SHAPE_RENDERING:
|
||||
optimizeSpeed
|
||||
crispEdges
|
||||
geometricPrecision
|
||||
|
||||
# CSS_PROP_TEXT_ANCHOR:
|
||||
start
|
||||
# middle
|
||||
end
|
||||
|
||||
# CSS_PROP_TEXT_RENDERING:
|
||||
optimizeLegibility
|
||||
|
||||
# CSS_PROP_IMAGE_RENDERING:
|
||||
optimizeQuality
|
||||
|
||||
# CSS_PROP_COLOR_PROFILE:
|
||||
sRGB
|
||||
|
||||
# CSS_PROP_COLOR_INTERPOLATION:
|
||||
linearRGB
|
||||
|
||||
# CSS_PROP_POINTER_EVENTS:
|
||||
visiblePainted
|
||||
visibleFill
|
||||
visibleStroke
|
||||
# visible
|
||||
painted
|
||||
fill
|
||||
stroke
|
||||
all
|
||||
# none
|
||||
# inherit
|
||||
|
||||
# CSS_PROP_WRITING_MODE:
|
||||
lr-tb
|
||||
rl-tb
|
||||
tb-rl
|
||||
tb-lr
|
||||
lr
|
||||
rl
|
||||
tb
|
||||
|
|
@ -1,603 +0,0 @@
|
|||
/*
|
||||
* The default style sheet used by khtml to render HTML pages
|
||||
* Copyright 2000-2003 Lars Knoll (knoll@kde.org)
|
||||
*
|
||||
* Konqueror/khtml relies on the existence of this style sheet for
|
||||
* rendering. Do not remove or modify this file unless you know
|
||||
* what you are doing.
|
||||
*
|
||||
* KHTML_STYLE_VERSION: 1
|
||||
*/
|
||||
|
||||
@namespace "http://www.w3.org/1999/xhtml";
|
||||
|
||||
html {
|
||||
display: block;
|
||||
color: -khtml-text;
|
||||
}
|
||||
|
||||
/*
|
||||
* head and it's children all have display=none
|
||||
*/
|
||||
|
||||
head {
|
||||
display: none;
|
||||
}
|
||||
|
||||
meta {
|
||||
display: none;
|
||||
}
|
||||
|
||||
title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
link {
|
||||
display: none;
|
||||
}
|
||||
|
||||
style {
|
||||
display: none;
|
||||
}
|
||||
|
||||
script {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*
|
||||
* generic block level elements
|
||||
*/
|
||||
|
||||
@media print {
|
||||
body {
|
||||
display: block;
|
||||
margin: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen {
|
||||
body {
|
||||
display: block;
|
||||
margin: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
display: block;
|
||||
margin: 1.0__qem 0px;
|
||||
}
|
||||
|
||||
div {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* to force a block level context for some cases (broken HTML) */
|
||||
|
||||
layer {
|
||||
display: block;
|
||||
}
|
||||
|
||||
address {
|
||||
display: block;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
display: block;
|
||||
margin: 1__qem 40px 1em 40px;
|
||||
}
|
||||
|
||||
/* default behaviour:
|
||||
:lang(en) > q { quotes: '"' '"' "'" "'" }
|
||||
*/
|
||||
|
||||
:lang(ar) > q, :lang(fa) > q { quotes: "\00AB" "\00BB"; }
|
||||
:lang(ca) > q, :lang(es) > q { quotes: "\00AB" "\00BB" "\0022" "\0022"; }
|
||||
:lang(el) > q, :lang(pt) > q, :lang(tr) > q, :lang(vi) > q { quotes: "\00AB" "\00BB" "\2039" "\203A"; }
|
||||
:lang(hy) > q { quotes: "\00AB" "\00BB" "\201C" "\201D"; }
|
||||
:lang(ru) > q, :lang(uk) > q { quotes: "\00AB" "\00BB" "\201E" "\201C"; }
|
||||
:lang(eo) > q { quotes: "\201C" "\201D"; }
|
||||
:lang(id) > q, :lang(it) > q, :lang(zh-cn) > q, :lang(ko) > q, :lang(nb) > q, :lang(no) > q { quotes: "\201C" "\201D" "\2018" "\2019"; }
|
||||
:lang(bg) > q { quotes: "\201E" "\201C"; }
|
||||
:lang(cs) > q, :lang(de) > q, :lang(lt) > q, :lang(sk) > q, :lang(sl) > q { quotes: "\201E" "\201C" "\201A" "\2018"; }
|
||||
:lang(da) > q { quotes: "\201E" "\201C" "\2019" "\2019"; }
|
||||
:lang(pl) > q, :lang(ro) > q { quotes: "\201E" "\201D" "\00AB" "\00BB"; }
|
||||
:lang(hu) > q { quotes: "\201E" "\201D" "\00BB" "\00AB"; }
|
||||
:lang(fi) > q, :lang(nl) > q, :lang(sv) > q { quotes: "\201D" "\201D" "\2019" "\2019"; }
|
||||
:lang(fr) > q { quotes: "\00AB\00A0" "\00A0\00BB" "\2039\00A0" "\00A0\203A"; }
|
||||
:lang(hr) > q { quotes: "\00BB" "\00AB" "\203A" "\2039"; }
|
||||
:lang(ja) > q, :lang(zh-hk) > q, :lang(zh-tw) > q { quotes: "\300C" "\300D" "\300E" "\300F"; }
|
||||
|
||||
q {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
q:before {
|
||||
content: open-quote;
|
||||
}
|
||||
|
||||
q:after {
|
||||
content: close-quote;
|
||||
}
|
||||
|
||||
center {
|
||||
display: block;
|
||||
/* special centering to be able to emulate the html4/netscape behavior */
|
||||
text-align: -khtml-center;
|
||||
}
|
||||
|
||||
hr {
|
||||
display: block;
|
||||
margin: 12px auto;
|
||||
border-style: inset;
|
||||
border-width: 1px;
|
||||
-khtml-flow-mode: -khtml-around-floats
|
||||
}
|
||||
|
||||
map {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/*
|
||||
* heading elements
|
||||
*/
|
||||
|
||||
h1 {
|
||||
display: block;
|
||||
margin: 0.67__qem 0 0.67em 0;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2 {
|
||||
display: block;
|
||||
margin: 0.83__qem 0 0.83em 0;
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h3 {
|
||||
display: block;
|
||||
margin: 1__qem 0 1em 0;
|
||||
font-size: 1.17em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h4 {
|
||||
display: block;
|
||||
margin: 1.33__qem 0 1.33em 0;
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h5 {
|
||||
display: block;
|
||||
margin: 1.67__qem 0 1.67em 0;
|
||||
font-size: 0.83em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h6 {
|
||||
display: block;
|
||||
margin: 2.33__qem 0 2.33em 0;
|
||||
font-size: 0.67em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*
|
||||
* tables
|
||||
*/
|
||||
|
||||
table {
|
||||
display: table;
|
||||
border-collapse: separate;
|
||||
border-spacing: 2px;
|
||||
-khtml-flow-mode: -khtml-around-floats;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
thead {
|
||||
display: table-header-group;
|
||||
border-color: inherit;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
tbody {
|
||||
display: table-row-group;
|
||||
border-color: inherit;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
tfoot {
|
||||
display: table-footer-group;
|
||||
border-color: inherit;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
col {
|
||||
display: table-column;
|
||||
}
|
||||
|
||||
colgroup {
|
||||
display: table-column-group;
|
||||
}
|
||||
|
||||
tr {
|
||||
display: table-row;
|
||||
vertical-align: inherit;
|
||||
border-color: inherit;
|
||||
}
|
||||
|
||||
td, th {
|
||||
display: table-cell;
|
||||
vertical-align: inherit;
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
caption {
|
||||
display: table-caption;
|
||||
text-align: -khtml-center;
|
||||
}
|
||||
|
||||
/*
|
||||
* lists
|
||||
*/
|
||||
|
||||
ul, menu, dir {
|
||||
display: block;
|
||||
list-style-type: disc;
|
||||
margin: 1__qem 0 1em 0;
|
||||
-khtml-padding-start: 40px
|
||||
}
|
||||
|
||||
ol {
|
||||
display: block;
|
||||
list-style-type: decimal;
|
||||
margin: 1__qem 0 1em 0;
|
||||
-khtml-padding-start: 40px
|
||||
}
|
||||
|
||||
li {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
ul ul ul, ul ol ul, ul menu ul, ul dir ul,
|
||||
ol ul ul, ol ol ul, ol menu ul, ol dir ul,
|
||||
menu ul ul, menu ol ul, menu menu ul, menu dir ul,
|
||||
dir ul ul, dir ol ul, dir menu ul, dir dir ul,
|
||||
ul ul menu, ul ol menu, ul menu menu, ul dir menu,
|
||||
ol ul menu, ol ol menu, ol menu menu, ol dir menu,
|
||||
menu ul menu, menu ol menu, menu menu menu, menu dir menu,
|
||||
dir ul menu, dir ol menu, dir menu menu, dir dir menu,
|
||||
ul ul dir, ul ol dir, ul menu dir, ul dir dir,
|
||||
ol ul dir, ol ol dir, ol menu dir, ol dir dir,
|
||||
menu ul dir, menu ol dir, menu menu dir, menu dir dir,
|
||||
dir ul dir, dir ol dir, dir menu dir, dir dir dir
|
||||
{
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
ul ul, ul menu, ul dir,
|
||||
ol ul, ol menu, ol dir,
|
||||
menu ul, menu menu, menu dir,
|
||||
dir ul, dir menu, dir dir
|
||||
{
|
||||
list-style-type: circle;
|
||||
}
|
||||
|
||||
dd {
|
||||
display: block;
|
||||
}
|
||||
|
||||
dl > dd {
|
||||
-khtml-margin-start: 40px;
|
||||
}
|
||||
|
||||
dl {
|
||||
display: block;
|
||||
margin: 1__qem 0 1em 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
display: block;
|
||||
}
|
||||
|
||||
ol ul, ol menu, ol dir, ol ol,
|
||||
ul ul, ul menu, ul dir, ul ol,
|
||||
menu ul, menu menu, menu dir, menu ol,
|
||||
dir ul, dir menu, dir dir, dir ol
|
||||
{
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
}
|
||||
|
||||
li > p {
|
||||
margin-top: auto;
|
||||
/* margin-bottom: auto;*/
|
||||
}
|
||||
|
||||
li > div {
|
||||
margin-top: auto;
|
||||
/* margin-bottom: auto;*/
|
||||
}
|
||||
|
||||
/*
|
||||
* form elements
|
||||
*/
|
||||
|
||||
form {
|
||||
display: block;
|
||||
margin: 0__qem 0 1em 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
display: block;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
border: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
display: block;
|
||||
padding: 0.75em 0.625em;
|
||||
margin: 1.0em 0;
|
||||
border: 2px groove threedface;
|
||||
-khtml-flow-mode: -khtml-around-floats
|
||||
}
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
border: 2px outset buttonface;
|
||||
background-color: buttonface;
|
||||
font-size: small;
|
||||
color: buttontext;
|
||||
padding: 2px 2px 2px 2px;
|
||||
cursor: default;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
button:enabled:active {
|
||||
border-style: inset;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
text-align: -khtml-auto;
|
||||
}
|
||||
|
||||
input, textarea, select, button {
|
||||
font-weight: normal;
|
||||
margin: 0__qem;
|
||||
}
|
||||
input:focus, textarea:focus, select:focus, button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
input { color: windowtext;
|
||||
font-family: sans-serif;
|
||||
font-size: small;
|
||||
border: 2px -khtml-native;
|
||||
background-color: window;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
input[type="hidden"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
input[type="radio"], input[type="checkbox"] {
|
||||
margin: 0 0.5ex;
|
||||
background-color: window;
|
||||
color: windowtext;
|
||||
box-sizing: border-box;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
input[type="text"], input[type="password"] {
|
||||
background-color: window;
|
||||
color: windowtext;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
input[type="submit"], input[type="reset"], input[type="button"] {
|
||||
background-color: buttonface;
|
||||
color: buttontext;
|
||||
box-sizing: border-box;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
input[type="file"] {
|
||||
background-color: window;
|
||||
color: windowtext;
|
||||
box-sizing: border-box;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
input[type="image"] {
|
||||
background-color: transparent;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
isindex { color: windowtext; font-size: small; border: 2px -khtml-native; }
|
||||
|
||||
|
||||
option,
|
||||
optgroup,
|
||||
area,
|
||||
param {
|
||||
display: none;
|
||||
}
|
||||
|
||||
select {
|
||||
font-family: sans-serif;
|
||||
font-size: small;
|
||||
color: buttontext;
|
||||
background-color: window;
|
||||
box-sizing: border-box;
|
||||
border: 2px -khtml-native;
|
||||
}
|
||||
|
||||
select[multiple],
|
||||
select[size] {
|
||||
color: windowtext;
|
||||
}
|
||||
|
||||
select[size="0"]:not([multiple]),
|
||||
select[size="1"]:not([multiple]) {
|
||||
color: buttontext;
|
||||
}
|
||||
|
||||
textarea {
|
||||
color: windowtext;
|
||||
background-color: window;
|
||||
font-family: monospace;
|
||||
border: 2px -khtml-native;
|
||||
cursor: text;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
/*
|
||||
* inline elements
|
||||
*/
|
||||
|
||||
u,
|
||||
ins {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
strong,
|
||||
b {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
i,
|
||||
cite,
|
||||
em,
|
||||
var,
|
||||
address {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
tt,
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
pre,
|
||||
listing,
|
||||
xmp,
|
||||
plaintext {
|
||||
display: block;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
margin: 1__qem 0;
|
||||
}
|
||||
|
||||
big {
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
s,
|
||||
strike,
|
||||
del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
sub {
|
||||
vertical-align: sub;
|
||||
font-size: smaller;
|
||||
}
|
||||
sup {
|
||||
vertical-align: super;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
abbr, acronym {
|
||||
font-variant: small-caps;
|
||||
letter-spacing: 0.1em
|
||||
}
|
||||
|
||||
*|:focus { outline: 1px dotted invert }
|
||||
a:link:active { color: red; outline: 1px dotted invert; }
|
||||
a:visited:active { color: red; outline: 1px dotted invert; }
|
||||
|
||||
/* with the current design it is too expensive to set this default via css
|
||||
:before,:after { white-space: pre-line }
|
||||
*/
|
||||
|
||||
/* ### use this to replace renderbr
|
||||
br:before { content: "\n" }
|
||||
*/
|
||||
|
||||
|
||||
/* bidirectionality settings (do not change) */
|
||||
|
||||
bdo[dir="ltr"] {
|
||||
direction: ltr;
|
||||
unicode-bidi: bidi-override;
|
||||
}
|
||||
|
||||
bdo[dir="rtl"] {
|
||||
direction: rtl;
|
||||
unicode-bidi: bidi-override;
|
||||
}
|
||||
|
||||
*[dir="ltr"] { direction: ltr; unicode-bidi: embed }
|
||||
*[dir="rtl"] { direction: rtl; unicode-bidi: embed }
|
||||
|
||||
/* elements that are block-level in html4 */
|
||||
/* ### don't support unicode-bidi at the moment
|
||||
address, blockquote, body, dd, div, dl, dt, fieldset,
|
||||
form, frame, frameset, h1, h2, h3, h4, h5, h6, iframe,
|
||||
noscript, noframes, object, ol, p, ul, applet, center,
|
||||
dir, hr, menu, pre, listing, li, table, tr, thead, tbody, tfoot,
|
||||
col, colgroup, td, th, caption
|
||||
{ unicode-bidi: embed }
|
||||
*/
|
||||
|
||||
/* end bidi settings */
|
||||
|
||||
/*
|
||||
* other elements
|
||||
*/
|
||||
|
||||
noframes {
|
||||
display: none;
|
||||
}
|
||||
|
||||
frameset {
|
||||
display: block;
|
||||
}
|
||||
|
||||
frame {
|
||||
display: block;
|
||||
}
|
||||
|
||||
iframe:focus, object:focus, frame:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
nobr {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
marquee {
|
||||
display: inline-block;
|
||||
overflow: marquee;
|
||||
}
|
||||
|
||||
/* noscript is handled internally, as it depends on the html settings */
|
||||
|
||||
@media print {
|
||||
h1, h2, h3,
|
||||
h4, h5, h6 { page-break-after: avoid }
|
||||
ul, ol, dl { page-break-before: avoid }
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
YACC=bison
|
||||
|
||||
$YACC -v -d -p cssyy parser.y && mv parser.tab.c parser.cpp;
|
||||
if test -f parser.tab.h; then
|
||||
if cmp -s parser.tab.h parser.h; then rm -f parser.tab.h;
|
||||
else mv parser.tab.h parser.h; fi
|
||||
else :; fi
|
|
@ -1,79 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This file is part of the KDE libraries
|
||||
#
|
||||
# Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
|
||||
# (c) 2006 Nikolas Zimmermann <zimmermann@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 HTML Widget -- Script to generate cssproperties.c and cssproperties.h
|
||||
#
|
||||
num=1
|
||||
NS=""
|
||||
|
||||
if [ -n "$1" ] # Eventually specified namespace prefix (ie. SVG)
|
||||
then
|
||||
num=10001 # Bigger than all properties from HTML CSS
|
||||
NS=$1
|
||||
fi
|
||||
|
||||
prefix=`echo $NS | awk '{ do { print tolower($0) } while (getline) }'`
|
||||
|
||||
grep "^[^\#]" "$prefix"cssproperties.in > "$prefix"cssproperties.strip
|
||||
|
||||
echo -e '%{\n/* This file is automatically generated from '$prefix'cssproperties.in by makeprop, do not edit */\n/* Copyright 1999 W. Bastian */\n#include "'$prefix'cssproperties.h"\n%}\nstruct css_prop'$prefix' {\n const char *name;\n int id;\n};\n\nstatic const struct css_prop'$prefix' * findProp'$NS' (register const char *str, register unsigned int len);\n\n%%' > "$prefix"cssproperties.gperf
|
||||
cat "$prefix"cssproperties.strip | awk '{ do { prop = $0; gsub("-", "_"); print prop ", '$NS'CSS_PROP_" toupper($0) } while (getline) }' >> "$prefix"cssproperties.gperf
|
||||
echo '%%' >> "$prefix"cssproperties.gperf
|
||||
echo -e '/* This file is automatically generated from '$prefix'cssproperties.in by makeprop, do not edit */\n/* Copyright 1998 W. Bastian */\n\n#ifndef '$NS'CSSPROPERTIES_H\n#define '$NS'CSSPROPERTIES_H\n\nDOM::DOMString get'$NS'PropertyName(unsigned short id) KDE_NO_EXPORT;\n' > "$prefix"cssproperties.h
|
||||
cat "$prefix"cssproperties.strip | awk '{ \
|
||||
i='$num'; \
|
||||
print "#define '$NS'CSS_PROP_INVALID 0"; \
|
||||
print "#define '$NS'CSS_PROP_MIN '$num'"; \
|
||||
do { gsub("-", "_"); print "#define '$NS'CSS_PROP_" toupper($0) " " i; i = i + 1 } while (getline); \
|
||||
print ""; \
|
||||
print "#define '$NS'CSS_PROP_TOTAL " (i + 1 - '$num') \
|
||||
}' >> "$prefix"cssproperties.h
|
||||
perl -e 'my $max = 0; while (<>) { chomp; $max = length if $max < length; } print "const size_t max'$NS'CSSPropertyNameLength = $max;\n"' < "$prefix"cssproperties.strip >> "$prefix"cssproperties.h
|
||||
|
||||
gperf -a -L 'ANSI-C' -E -C -c -o -t -k '*' -NfindProp"$NS" -Hhash_prop"$prefix" -Wwordlist_prop"$prefix" -D -s 2 "$prefix"cssproperties.gperf > "$prefix"cssproperties.c || exit 1
|
||||
echo -e '#endif\n' >> "$prefix"cssproperties.h
|
||||
|
||||
cat "$prefix"cssproperties.strip | awk '{ \
|
||||
i=1; \
|
||||
print "static const char * const propertyList'$NS'[] = {"; \
|
||||
print "\"\","; \
|
||||
do { print "\"" $0 "\", "; i = i + 1 } while (getline); \
|
||||
print " 0"; \
|
||||
print "};"; \
|
||||
print "DOMString get'$NS'PropertyName(unsigned short id)"; \
|
||||
print "{"; \
|
||||
print " if(id >= '$NS'CSS_PROP_TOTAL || id == 0)"; \
|
||||
print " return DOMString();";\
|
||||
print " else";\
|
||||
print " return DOMString(propertyList'$NS'[id - "('$num' - 1)"]);"; \
|
||||
print "}"; \
|
||||
print ""; \
|
||||
}' >> "$prefix"cssproperties.c
|
||||
|
||||
perl -pi -e "s/id\ -\ 0/id/" "$prefix"cssproperties.c
|
||||
perl -pi -e "s/TOTAL_KEYWORDS/${NS}TOTAL_KEYWORDS/g" "$prefix"cssproperties.c
|
||||
perl -pi -e "s/MIN_WORD_LENGTH/${NS}MIN_WORD_LENGTH/g" "$prefix"cssproperties.c
|
||||
perl -pi -e "s/MAX_WORD_LENGTH/${NS}MAX_WORD_LENGTH/g" "$prefix"cssproperties.c
|
||||
perl -pi -e "s/MIN_HASH_VALUE/${NS}MIN_HASH_VALUE/g" "$prefix"cssproperties.c
|
||||
perl -pi -e "s/MAX_HASH_VALUE/${NS}MAX_HASH_VALUE/g" "$prefix"cssproperties.c
|
|
@ -1,111 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
open(IN, "flex -t tokenizer.flex|") or die "no flex?\n";
|
||||
open(OUT, ">tokenizer.cpp") or die $!;
|
||||
|
||||
print OUT <<STOP;
|
||||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 2003 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.
|
||||
*/
|
||||
|
||||
/* This file is mostly data generated by flex. Unfortunately flex
|
||||
can't handle 16bit strings directly, so we just copy the part of
|
||||
the code we need and modify it to our needs.
|
||||
|
||||
Most of the defines below are to make sure we can easily use the
|
||||
flex generated code, using as little editing as possible.
|
||||
|
||||
The flex syntax to generate the lexer are more or less directly
|
||||
copied from the CSS2.1 specs, with some fixes for comments and
|
||||
the important symbol.
|
||||
|
||||
To regenerate, run flex on tokenizer.flex. After this, copy the
|
||||
data tables and the YY_DECL method over to this file. Remove the
|
||||
init code from YY_DECL and change the YY_END_OF_BUFFER to only call
|
||||
yyterminate().
|
||||
|
||||
*/
|
||||
|
||||
// --------- begin generated code -------------------
|
||||
|
||||
STOP
|
||||
print OUT<<STOP;
|
||||
|
||||
#include "parser.h"
|
||||
|
||||
#define INITIAL 0
|
||||
#define mediaquery 1
|
||||
#define at_rule 2
|
||||
#define block 3
|
||||
|
||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
typedef int8_t flex_int8_t;
|
||||
typedef uint8_t flex_uint8_t;
|
||||
typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
#endif /* ! C99 */
|
||||
STOP
|
||||
|
||||
while (<IN>) {
|
||||
/YY_NUM_RULES/../yy_last_accepting/
|
||||
and !/yy_last_accepting/ and print OUT;
|
||||
/^YY_DECL/ and print OUT and last;
|
||||
}
|
||||
|
||||
while (<IN>) {
|
||||
s/char/unsigned short/;
|
||||
print OUT;
|
||||
last if /yy_act/;
|
||||
}
|
||||
|
||||
while (<IN>) {
|
||||
last if /while \( 1 \)/;
|
||||
}
|
||||
|
||||
print OUT;
|
||||
while (<IN>) {
|
||||
next if /^yy_match:/;
|
||||
next if /^do_action:/;
|
||||
last if /YY_END_OF_BUFFER/;
|
||||
print OUT;
|
||||
print OUT "case YY_END_OF_BUFFER:\n" if /^case YY_STATE_EOF\(INITIAL\):/;
|
||||
}
|
||||
|
||||
while (<IN>) {
|
||||
last if /default:/;
|
||||
}
|
||||
|
||||
print OUT;
|
||||
while (<IN>) {
|
||||
print OUT;
|
||||
last if /end of yylex/;
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This file is part of the KDE libraries
|
||||
#
|
||||
# Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
|
||||
# (c) 2006 Nikolas Zimmermann <zimmermann@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 HTML Widget -- Script to generate cssvalues.c and cssvalues.h
|
||||
#
|
||||
num=1
|
||||
NS=""
|
||||
|
||||
if [ -n "$1" ] # Eventually specified namespace prefix (ie. SVG)
|
||||
then
|
||||
num=10001 # Bigger than all values from HTML CSS
|
||||
NS=$1
|
||||
fi
|
||||
|
||||
prefix=`echo $NS | awk '{ do { print tolower($0) } while (getline) }'`
|
||||
|
||||
grep "^[^\#]" "$prefix"cssvalues.in > "$prefix"cssvalues.strip
|
||||
|
||||
echo -e '%{\n/* This file is automatically generated from '$prefix'cssvalues.in by makevalues, do not edit */\n/* Copyright 1999 W. Bastian */\n#include "'$prefix'cssvalues.h"\n%}\nstruct css_value'$prefix' {\n const char *name;\n int id;\n};\n\nstatic const css_value'$prefix' * findValue'$NS' (register const char *str, register unsigned int len);\n\n%%' > "$prefix"cssvalues.gperf
|
||||
cat "$prefix"cssvalues.strip | awk '{ do { prop = $0; gsub("-", "_"); print prop ", '$NS'CSS_VAL_" toupper($0) } while (getline) }' >> "$prefix"cssvalues.gperf
|
||||
echo '%%' >> "$prefix"cssvalues.gperf
|
||||
echo -e '/* This file is automatically generated from '$prefix'cssvalues.in by makevalues, do not edit */\n/* Copyright 1998 W. Bastian */\n\n#ifndef '$NS'CSSVALUES_H\n#define '$NS'CSSVALUES_H\n\nDOM::DOMString get'$NS'ValueName(unsigned short id) KDE_NO_EXPORT;\n' > "$prefix"cssvalues.h
|
||||
cat "$prefix"cssvalues.strip | awk '{ \
|
||||
i='$num'; \
|
||||
print "#define '$NS'CSS_VAL_INVALID 0"; \
|
||||
print "#define '$NS'CSS_VAL_MIN '$num'"; \
|
||||
do { gsub("-", "_"); print "#define '$NS'CSS_VAL_" toupper($0) " " i; i = i + 1 } while (getline); \
|
||||
print ""; \
|
||||
print "#define '$NS'CSS_VAL_TOTAL " (i + 1 - '$num') \
|
||||
}' >> "$prefix"cssvalues.h
|
||||
gperf -L 'ANSI-C' -E -c -C -n -o -t -k '*' -NfindValue"$NS" -Hhash_val"$prefix" -Wwordlist_value"$prefix" -D "$prefix"cssvalues.gperf > "$prefix"cssvalues.c || exit 1
|
||||
echo -e '#endif\n' >> "$prefix"cssvalues.h
|
||||
cat "$prefix"cssvalues.strip | awk '{ \
|
||||
i=1; \
|
||||
print "static const char * const valueList'$NS'[] = {"; \
|
||||
print "\"\","; \
|
||||
do { print "\"" $0 "\", "; i = i + 1 } while (getline); \
|
||||
print " 0"; \
|
||||
print "};"; \
|
||||
print "DOMString get'$NS'ValueName(unsigned short id)"; \
|
||||
print "{"; \
|
||||
print " if(id >= '$NS'CSS_VAL_TOTAL || id == 0)"; \
|
||||
print " return DOMString();";\
|
||||
print " else";\
|
||||
print " return DOMString(valueList'$NS'[id - "('$num' - 1)"]);"; \
|
||||
print "}"; \
|
||||
print ""; \
|
||||
}' >> "$prefix"cssvalues.c
|
||||
|
||||
perl -pi -e "s/id\ -\ 0/id/" "$prefix"cssvalues.c
|
||||
perl -pi -e "s/TOTAL_KEYWORDS/${NS}TOTAL_KEYWORDS/g" "$prefix"cssvalues.c
|
||||
perl -pi -e "s/MIN_WORD_LENGTH/${NS}MIN_WORD_LENGTH/g" "$prefix"cssvalues.c
|
||||
perl -pi -e "s/MAX_WORD_LENGTH/${NS}MAX_WORD_LENGTH/g" "$prefix"cssvalues.c
|
||||
perl -pi -e "s/MIN_HASH_VALUE/${NS}MIN_HASH_VALUE/g" "$prefix"cssvalues.c
|
||||
perl -pi -e "s/MAX_HASH_VALUE/${NS}MAX_HASH_VALUE/g" "$prefix"cssvalues.c
|
3587
khtml/css/parser.cpp
3587
khtml/css/parser.cpp
File diff suppressed because it is too large
Load diff
|
@ -1,150 +0,0 @@
|
|||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_CSSYY_PARSER_TAB_H_INCLUDED
|
||||
# define YY_CSSYY_PARSER_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int cssyydebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
REDUCE = 258,
|
||||
S = 259,
|
||||
SGML_CD = 260,
|
||||
INCLUDES = 261,
|
||||
DASHMATCH = 262,
|
||||
BEGINSWITH = 263,
|
||||
ENDSWITH = 264,
|
||||
CONTAINS = 265,
|
||||
STRING = 266,
|
||||
IDENT = 267,
|
||||
NTH = 268,
|
||||
HASH = 269,
|
||||
HEXCOLOR = 270,
|
||||
IMPORT_SYM = 271,
|
||||
PAGE_SYM = 272,
|
||||
MEDIA_SYM = 273,
|
||||
FONT_FACE_SYM = 274,
|
||||
CHARSET_SYM = 275,
|
||||
NAMESPACE_SYM = 276,
|
||||
KHTML_RULE_SYM = 277,
|
||||
KHTML_DECLS_SYM = 278,
|
||||
KHTML_VALUE_SYM = 279,
|
||||
KHTML_MEDIAQUERY_SYM = 280,
|
||||
KHTML_SELECTORS_SYM = 281,
|
||||
IMPORTANT_SYM = 282,
|
||||
MEDIA_ONLY = 283,
|
||||
MEDIA_NOT = 284,
|
||||
MEDIA_AND = 285,
|
||||
QEMS = 286,
|
||||
EMS = 287,
|
||||
EXS = 288,
|
||||
CHS = 289,
|
||||
REMS = 290,
|
||||
PXS = 291,
|
||||
CMS = 292,
|
||||
MMS = 293,
|
||||
INS = 294,
|
||||
PTS = 295,
|
||||
PCS = 296,
|
||||
DEGS = 297,
|
||||
RADS = 298,
|
||||
GRADS = 299,
|
||||
MSECS = 300,
|
||||
SECS = 301,
|
||||
HERZ = 302,
|
||||
KHERZ = 303,
|
||||
DPI = 304,
|
||||
DPCM = 305,
|
||||
DIMEN = 306,
|
||||
PERCENTAGE = 307,
|
||||
FLOAT = 308,
|
||||
INTEGER = 309,
|
||||
URI = 310,
|
||||
FUNCTION = 311,
|
||||
NOTFUNCTION = 312,
|
||||
UNICODERANGE = 313
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
||||
union YYSTYPE
|
||||
{
|
||||
|
||||
|
||||
CSSRuleImpl *rule;
|
||||
CSSSelector *selector;
|
||||
QList<CSSSelector*> *selectorList;
|
||||
bool ok;
|
||||
MediaListImpl *mediaList;
|
||||
CSSMediaRuleImpl *mediaRule;
|
||||
CSSRuleListImpl *ruleList;
|
||||
ParseString string;
|
||||
double val;
|
||||
int prop_id;
|
||||
unsigned int attribute;
|
||||
unsigned int element;
|
||||
CSSSelector::Relation relation;
|
||||
CSSSelector::Match match;
|
||||
bool b;
|
||||
char tok;
|
||||
Value value;
|
||||
ValueList *valueList;
|
||||
|
||||
khtml::MediaQuery* mediaQuery;
|
||||
khtml::MediaQueryExp* mediaQueryExp;
|
||||
QList<khtml::MediaQueryExp*>* mediaQueryExpList;
|
||||
khtml::MediaQuery::Restrictor mediaQueryRestrictor;
|
||||
|
||||
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int cssyyparse (DOM::CSSParser *parser);
|
||||
|
||||
#endif /* !YY_CSSYY_PARSER_TAB_H_INCLUDED */
|
1326
khtml/css/parser.y
1326
khtml/css/parser.y
File diff suppressed because it is too large
Load diff
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* The default presentational attributes' styles used by khtml to render HTML pages
|
||||
* (cf. CSS 2.1 - 6.4.4)
|
||||
* Copyright 2007 Germain Garand (germain@ebooksfrance.org)
|
||||
*
|
||||
* Konqueror/khtml relies on the existence of this style sheet for
|
||||
* rendering. Do not remove or modify this file unless you know
|
||||
* what you are doing.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
pre[wrap], listing[wrap] {
|
||||
white-space: pre-wrap
|
||||
}
|
||||
|
||||
table[rules="groups"] > tbody,
|
||||
table[rules="groups"] > thead,
|
||||
table[rules="groups"] > tfoot {
|
||||
border-top-width: thin;
|
||||
border-bottom-width: thin;
|
||||
border-top-style: solid;
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
|
||||
table[rules="groups"] > colgroup {
|
||||
border-left-width: thin;
|
||||
border-right-width: thin;
|
||||
border-left-style: solid;
|
||||
border-right-style: solid;
|
||||
}
|
||||
|
||||
table[border] > tbody > tr > td,
|
||||
table[border] > tbody > tr > th,
|
||||
table[border] > thead > tr > td,
|
||||
table[border] > thead > tr > th,
|
||||
table[border] > tfoot > tr > td,
|
||||
table[border] > tfoot > tr > th,
|
||||
table[border] > tr > td,
|
||||
table[border] > tr > th {
|
||||
border-style: inset;
|
||||
border-width: thin;
|
||||
}
|
||||
|
||||
table[bordercolor] > tbody > tr > td,
|
||||
table[bordercolor] > tbody > tr > th,
|
||||
table[bordercolor] > thead > tr > td,
|
||||
table[bordercolor] > thead > tr > th,
|
||||
table[bordercolor] > tfoot > tr > td,
|
||||
table[bordercolor] > tfoot > tr > th,
|
||||
table[bordercolor] > tr > td,
|
||||
table[bordercolor] > tr > th {
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
table[border="0"] > tbody > tr > td,
|
||||
table[border="0"] > tbody > tr > th,
|
||||
table[border="0"] > thead > tr > td,
|
||||
table[border="0"] > thead > tr > th,
|
||||
table[border="0"] > tfoot > tr > td,
|
||||
table[border="0"] > tfoot > tr > th,
|
||||
table[border="0"] > tr > td,
|
||||
table[border="0"] > tr > th {
|
||||
/* Do not attempt to avoid this declaration by appending a :not() to the table[border] selectors
|
||||
* That would increase its specificity, breaking proper cascade.
|
||||
*/
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
table[rules] > tbody > tr > td,
|
||||
table[rules] > tbody > tr > th,
|
||||
table[rules] > thead > tr > td,
|
||||
table[rules] > thead > tr > th,
|
||||
table[rules] > tfoot > tr > td,
|
||||
table[rules] > tfoot > tr > th,
|
||||
table[rules] > tr > td,
|
||||
table[rules] > tr > th {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
table[rules="all"] > tbody > tr > td,
|
||||
table[rules="all"] > tbody > tr > th,
|
||||
table[rules="all"] > thead > tr > td,
|
||||
table[rules="all"] > thead > tr > th,
|
||||
table[rules="all"] > tfoot > tr > td,
|
||||
table[rules="all"] > tfoot > tr > th,
|
||||
table[rules="all"] > tr > td,
|
||||
table[rules="all"] > tr > th {
|
||||
border-width: thin;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
table[rules="cols"] > tbody > tr > td,
|
||||
table[rules="cols"] > tbody > tr > th,
|
||||
table[rules="cols"] > thead > tr > td,
|
||||
table[rules="cols"] > thead > tr > th,
|
||||
table[rules="cols"] > tfoot > tr > td,
|
||||
table[rules="cols"] > tfoot > tr > th,
|
||||
table[rules="cols"] > tr > td,
|
||||
table[rules="cols"] > tr > th {
|
||||
border-left-width: thin;
|
||||
border-right-width: thin;
|
||||
border-left-style: solid;
|
||||
border-right-style: solid;
|
||||
}
|
||||
|
||||
table[rules="rows"] > tbody > tr > td,
|
||||
table[rules="rows"] > tbody > tr > th,
|
||||
table[rules="rows"] > thead > tr > td,
|
||||
table[rules="rows"] > thead > tr > th,
|
||||
table[rules="rows"] > tfoot > tr > td,
|
||||
table[rules="rows"] > tfoot > tr > th,
|
||||
table[rules="rows"] > tr > td,
|
||||
table[rules="rows"] > tr > th {
|
||||
border-top-width: thin;
|
||||
border-bottom-width: thin;
|
||||
border-top-style: solid;
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
|
||||
table[rules]:not([rules="none"]){
|
||||
/* FIXME: enabling border-collapse when 'rules' attribute is defined matches
|
||||
* current Mozilla/Opera but is not standard.
|
||||
*/
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table[align="center"] {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table[align="left"] {
|
||||
float: -khtml-left;
|
||||
}
|
||||
|
||||
table[align="right"] {
|
||||
float: -khtml-right;
|
||||
}
|
||||
|
||||
dl[compact] > dt {
|
||||
display: compact;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* This style sheet is used by khtml to render HTML pages in quirks mode
|
||||
* (C) 2000-2003 Lars Knoll (knoll@kde.org)
|
||||
*
|
||||
* Konqueror/khtml relies on the existence of this style sheet for
|
||||
* rendering. Do not remove or modify this file unless you know
|
||||
* what you are doing.
|
||||
*/
|
||||
|
||||
/* Give floated images margins of 3px */
|
||||
img[align="left"] {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
img[align="right"] {
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
input[type="text"], input[type="password"], textarea {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Tables reset both line-height and white-space in quirks mode.
|
||||
Compatible with WinIE. For some reason they don't reset font-family */
|
||||
table {
|
||||
white-space: normal;
|
||||
line-height: normal;
|
||||
color: -khtml-text;
|
||||
font-size: medium;
|
||||
font-variant: normal;
|
||||
empty-cells: hide;
|
||||
text-align: -khtml-auto;
|
||||
font-weight: initial;
|
||||
}
|
||||
|
||||
LAYER {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
DIV > LAYER {
|
||||
position: static;
|
||||
}
|
||||
|
||||
ILAYER > LAYER {
|
||||
position: relative;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,110 +0,0 @@
|
|||
%option case-insensitive
|
||||
%option noyywrap
|
||||
%option 8bit
|
||||
%option stack
|
||||
%s mediaquery at_rule block
|
||||
|
||||
h [0-9a-fA-F]
|
||||
nonascii [\200-\377]
|
||||
unicode \\{h}{1,6}[ \t\r\n\f]?
|
||||
escape {unicode}|\\[ -~\200-\377]
|
||||
nmstart [_a-zA-Z]|{nonascii}|{escape}
|
||||
nmchar [_a-zA-Z0-9-]|{nonascii}|{escape}
|
||||
string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
|
||||
string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
|
||||
hexcolor {h}{3}|{h}{6}
|
||||
|
||||
ident -?{nmstart}{nmchar}*
|
||||
name {nmchar}+
|
||||
num [0-9]+|[0-9]*"."[0-9]+
|
||||
intnum [0-9]+
|
||||
string {string1}|{string2}
|
||||
url ([!#$%&*-~]|{nonascii}|{escape})*
|
||||
w [ \t\r\n\f]*
|
||||
nl \n|\r\n|\r|\f
|
||||
range \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h})))))
|
||||
nth ([\+-]?[0-9]*n[ \t\r\n\f]*[\+-][ \t\r\n\f]*[0-9]+)|([\+-]?[0-9]*n)
|
||||
|
||||
%%
|
||||
|
||||
\/\*[^*]*\*+([^/*][^*]*\*+)*\/ /* ignore comments */
|
||||
|
||||
[ \t\r\n\f]+ {yyTok = S; return yyTok;}
|
||||
|
||||
"<!--" {yyTok = SGML_CD; return yyTok;}
|
||||
"-->" {yyTok = SGML_CD; return yyTok;}
|
||||
"~=" {yyTok = INCLUDES; return yyTok;}
|
||||
"|=" {yyTok = DASHMATCH; return yyTok;}
|
||||
"^=" {yyTok = BEGINSWITH; return yyTok;}
|
||||
"$=" {yyTok = ENDSWITH; return yyTok;}
|
||||
"*=" {yyTok = CONTAINS; return yyTok;}
|
||||
<mediaquery>"not" {yyTok = MEDIA_NOT; return yyTok;}
|
||||
<mediaquery>"only" {yyTok = MEDIA_ONLY; return yyTok;}
|
||||
<mediaquery>"and" {yyTok = MEDIA_AND; return yyTok;}
|
||||
|
||||
{string} {yyTok = STRING; return yyTok;}
|
||||
{ident} {yyTok = IDENT; return yyTok;}
|
||||
{nth} {yyTok = NTH; return yyTok;}
|
||||
|
||||
|
||||
<block>"#"{hexcolor} {yyTok = HEXCOLOR; return yyTok;}
|
||||
"#"{ident} {yyTok = HASH; return yyTok;}
|
||||
/* @rule tokens surrounding css declaration blocks with { } braces must start a BEGIN(at_rule) context */
|
||||
"@import" {BEGIN(mediaquery); yyTok = IMPORT_SYM; return yyTok;}
|
||||
"@page" {BEGIN(at_rule); yyTok = PAGE_SYM; return yyTok;}
|
||||
"@media" {BEGIN(mediaquery); yyTok = MEDIA_SYM; return yyTok;}
|
||||
"@font-face" {BEGIN(at_rule); yyTok = FONT_FACE_SYM; return yyTok;}
|
||||
"@charset" {BEGIN(at_rule); yyTok = CHARSET_SYM; return yyTok;}
|
||||
"@namespace" {BEGIN(at_rule); yyTok = NAMESPACE_SYM; return yyTok; }
|
||||
"@-khtml-rule" {BEGIN(at_rule); yyTok = KHTML_RULE_SYM; return yyTok; }
|
||||
"@-khtml-decls" {yyTok = KHTML_DECLS_SYM; return yyTok; }
|
||||
"@-khtml-value" {yyTok = KHTML_VALUE_SYM; return yyTok; }
|
||||
"@-khtml-selectors" {yyTok = KHTML_SELECTORS_SYM; return yyTok; }
|
||||
"@-khtml-mediaquery" {BEGIN(mediaquery); yyTok = KHTML_MEDIAQUERY_SYM; return yyTok; }
|
||||
|
||||
"!"{w}"important" {yyTok = IMPORTANT_SYM; return yyTok;}
|
||||
|
||||
{num}em {yyTok = EMS; return yyTok;}
|
||||
{num}__qem {yyTok = QEMS; return yyTok;} /* quirky ems */
|
||||
{num}ex {yyTok = EXS; return yyTok;}
|
||||
{num}ch {yyTok = CHS; return yyTok;}
|
||||
{num}rem {yyTok = REMS; return yyTok;}
|
||||
{num}px {yyTok = PXS; return yyTok;}
|
||||
{num}cm {yyTok = CMS; return yyTok;}
|
||||
{num}mm {yyTok = MMS; return yyTok;}
|
||||
{num}in {yyTok = INS; return yyTok;}
|
||||
{num}pt {yyTok = PTS; return yyTok;}
|
||||
{num}pc {yyTok = PCS; return yyTok;}
|
||||
{num}deg {yyTok = DEGS; return yyTok;}
|
||||
{num}rad {yyTok = RADS; return yyTok;}
|
||||
{num}grad {yyTok = GRADS; return yyTok;}
|
||||
{num}ms {yyTok = MSECS; return yyTok;}
|
||||
{num}s {yyTok = SECS; return yyTok;}
|
||||
{num}Hz {yyTok = HERZ; return yyTok;}
|
||||
<mediaquery>{num}dpi {yyTok = DPI; return yyTok;}
|
||||
<mediaquery>{num}dpcm {yyTok = DPCM; return yyTok;}
|
||||
{num}kHz {yyTok = KHERZ; return yyTok;}
|
||||
{num}{ident} {yyTok = DIMEN; return yyTok;}
|
||||
{num}% {yyTok = PERCENTAGE; return yyTok;}
|
||||
{intnum} {yyTok = INTEGER; return yyTok;}
|
||||
{num} {yyTok = FLOAT; return yyTok;}
|
||||
|
||||
|
||||
"not(" {yyTok = NOTFUNCTION; return yyTok;}
|
||||
"url("{w}{string}{w}")" {yyTok = URI; return yyTok;}
|
||||
"url("{w}{url}{w}")" {yyTok = URI; return yyTok;}
|
||||
{ident}"(" {yyTok = FUNCTION; return yyTok;}
|
||||
|
||||
U\+{range} {yyTok = UNICODERANGE; return yyTok;}
|
||||
U\+{h}{1,6}-{h}{1,6} {yyTok = UNICODERANGE; return yyTok;}
|
||||
|
||||
<INITIAL>"{" {BEGIN(block); yyTok = *yytext; return yyTok;}
|
||||
<at_rule>"{" |
|
||||
<at_rule>";" |
|
||||
<block>"}" |
|
||||
<mediaquery>"{" |
|
||||
<mediaquery>";" {BEGIN(INITIAL); yyTok = *yytext; return yyTok; }
|
||||
. {yyTok = *yytext; return yyTok;}
|
||||
|
||||
%%
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 1997 Martin Jones (mjones@kde.org)
|
||||
(C) 1998 Waldo Bastian (bastian@kde.org)
|
||||
(C) 1998, 1999 Torben Weis (weis@kde.org)
|
||||
(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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This library provides a full-featured HTML parser and widget. It is
|
||||
* used for rendering in all KDE applications which allow HTML viewing,
|
||||
* including the Konqueror browser/file manager, KMail, and the KDE Help
|
||||
* system.
|
||||
*
|
||||
* This library provides support for HTML4/XHTML, embedded Java applets,
|
||||
* cascading style sheets (CSS2), and JavaScript.
|
||||
*
|
||||
* If you want to add to your application a widget that only needs simple text
|
||||
* browsing, you can also use the KTextBrowser widget in kdeui.
|
||||
*
|
||||
* KHTMLPart :
|
||||
* The main part/widget for using khtml.
|
||||
*
|
||||
* DOM :
|
||||
* The dom implementation used in khtml.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* The Document Object Model (DOM) is divided into two parts, the
|
||||
* COREDOM core
|
||||
* DOM, specifying some core functionality, and the HTMLDOM HTML DOM,
|
||||
* which deals with the extensions needed for HTML.
|
||||
*
|
||||
*
|
||||
*/
|
||||
namespace DOM
|
||||
{
|
||||
};
|
|
@ -1,346 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Internal design of khtml</title>
|
||||
<style>
|
||||
dt { font-weight: bold; }
|
||||
</style>
|
||||
<body bgcolor=white>
|
||||
<h1>Internal design of khtml</h1>
|
||||
|
||||
<p>
|
||||
This document tries to give a short overview about the internal design of the khtml
|
||||
library. I've written this, because the lib has gotten quite big, and it is hard at first to find your
|
||||
way in the source code. This doesn't mean that you'll understand khtml after reading this
|
||||
document, but it'll hopefully make it easier for you to read the source code.
|
||||
</p>
|
||||
<p>
|
||||
The library is build up out of several different parts. Basically, when you use the lib, you
|
||||
create an instance of a KHTMLPart, and feed data to it. That's more or less all you need to
|
||||
know if you want to use khtml for another application. If you want to start hacking khtml,
|
||||
here's a sketch of the objects that will get constructed, when eg. running testkhtml with
|
||||
a url argument.
|
||||
</p>
|
||||
<p>
|
||||
In the following I'll assume that you're familiar with all the buzzwords used in current web
|
||||
techology. In case you aren't here's a more or less complete list of references:
|
||||
</p>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Document Object model (DOM):</b><br>
|
||||
<a href="http://www.w3.org/DOM/">DOM Level1 and 2</a><br>
|
||||
We support DOM Level2 except for the events model at the moment.
|
||||
</p>
|
||||
<p>
|
||||
<b>HTML:</b><br>
|
||||
<a href="http://www.w3.org/TR/html4/">HTML4 specs</a><br>
|
||||
<a href="http://www.w3.org/TR/xhtml1/">xhtml specs</a><br>
|
||||
We support almost all of HTML4 and xhtml.
|
||||
</p>
|
||||
<p>
|
||||
<b>Cascading style sheets (CSS):</b><br>
|
||||
<a href="http://www.w3.org/TR/REC-CSS2/">CSS2 specs</a><br>
|
||||
We support almost all of CSS1, and most parts of CSS2.
|
||||
</p>
|
||||
<p>
|
||||
<b>Javascript:</b><br>
|
||||
<a href="http://msdn.microsoft.com/workshop/author/dhtml/reference/objects.asp">Microsoft javascript bindings</a><br>
|
||||
<a href="http://docs.sun.com/source/816-6408-10/index.html">Netscape javascript reference</a><br>
|
||||
Netscapes javascript bindings are outdated. We shouldn't follow them. Let's focus on getting the bindings
|
||||
compatible to IE.
|
||||
<a href="http://mozilla.org/docs/dom/domref/">Mozilla JS/DOM reference</a>
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
<a href="khtml_part.h">KHTMLPart</a> creates one instance of a
|
||||
<a href="khtmlview.h">KHTMLView</a> (derived from QScrollView),
|
||||
the widget showing the whole thing. At the same time a DOM tree
|
||||
is built up from the HTML or XML found in the specified file.
|
||||
<p>
|
||||
Let me describe this with an example.
|
||||
<p>
|
||||
khtml makes use of the document object model (DOM) for storing the document
|
||||
in a tree like structure. Imagine some html like
|
||||
<pre>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
h1: { color: red; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<H1>
|
||||
some red text
|
||||
</h1>
|
||||
more text
|
||||
<p>
|
||||
a paragraph with an
|
||||
<img src="foo.png">
|
||||
embedded image.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</pre>
|
||||
In the following I'll show how this input will be processed step by step to generate the visible output
|
||||
you will finally see on your screen. I'm describing the things as if they happen one after the other,
|
||||
to make the principle more clear. In reality, to get visible output on the screen as soon as possible,
|
||||
all these things (from tokenization to the build up and layouting of the rendering tree) happen
|
||||
more or less in parallel.
|
||||
|
||||
<h2>Tokenizer and parser</h2>
|
||||
<p>
|
||||
The first thing that happens when you start parsing a new document is that a
|
||||
DocumentImpl* (for XML documents) or an HTMLDocumentImpl* object will get
|
||||
created by the Part (in khtml_part.cpp::begin()). A Tokenizer*
|
||||
object is created as soon as DocumentImpl::open() is called by the part, also
|
||||
in begin() (can be either an XMLTokenizer or an HTMLTokenizer).
|
||||
<p>
|
||||
The XMLTokenizer uses the QXML classes in Qt to parse the document, and it's SAX interface
|
||||
to parse the stuff into khtmls DOM.
|
||||
<p>
|
||||
For HTML, the tokenizer is located in khtmltokenizer.cpp. The tokenizer uses the contents
|
||||
of a HTML-file as input and breaks this contents up in a linked list of
|
||||
tokens. The tokenizer recognizes HTML-entities and HTML-tags. Text between
|
||||
begin- and end-tags is handled distinctly for several tags. The distinctions
|
||||
are in the way how spaces, linefeeds, HTML-entities and other tags are
|
||||
handled.
|
||||
<p>
|
||||
The tokenizer is completely state-driven on a character by character basis.
|
||||
All text passed over to the tokenizer is directly tokenized. A complete
|
||||
HTML-file can be passed to the tokenizer as a whole, character by character
|
||||
(not very efficient) or in blocks of any (variable) size.
|
||||
<p>
|
||||
The HTMLTokenizer creates an HTMLParser which
|
||||
interprets the stream of tokens provided by the tokenizer
|
||||
and constructs the tree of Nodes representing the document according
|
||||
to the Document Object Model.
|
||||
<p>
|
||||
|
||||
<h2>The DOM in khtml</h2>
|
||||
<p>
|
||||
Parsing the document given above gives the following DOM tree:
|
||||
|
||||
<pre>
|
||||
HTMLDocumentElement
|
||||
|--> HTMLHeadElement
|
||||
| \--> HTMLStyleElement
|
||||
| \--> CSSStyleSheet
|
||||
\--> HTMLBodyElement
|
||||
|--> HTMLHeadingElement
|
||||
| \--> Text
|
||||
|--> Text
|
||||
\--> HTMLParagraphElement
|
||||
|--> Text
|
||||
|--> HTMLImageElement
|
||||
\--> Text
|
||||
</pre>
|
||||
<p>
|
||||
Actually, the classes mentioned above are the interfaces for accessing the
|
||||
DOM. The actual data is stored in *Impl classes, providing the implementation
|
||||
for all of the above mentioned elements. So internally we have a tree
|
||||
looking like:
|
||||
<pre>
|
||||
HTMLDocumentElementImpl*
|
||||
|--> HTMLHeadElementImpl*
|
||||
| \--> HTMLStyleElementImpl*
|
||||
| \--> CSSStyleSheetImpl*
|
||||
\--> HTMLBodyElementImpl*
|
||||
|--> HTMLHeadingElementImpl*
|
||||
| \--> TextImpl*
|
||||
|--> TextImpl*
|
||||
\--> HTMLParagraphElementImpl*
|
||||
|--> TextImpl*
|
||||
|--> HTMLImageElementImpl*
|
||||
\--> TextImpl*
|
||||
</pre>
|
||||
<p>
|
||||
We use a refcounting scheme to assure that all the objects get deleted, in
|
||||
case the root element gets deleted (as long as there's no interface class
|
||||
holding a pointer to the Implementation).
|
||||
<p>
|
||||
The interface classes (the ones without the Impl) are defined in the <code>dom/</code>
|
||||
subdirectory, and are not used by khtml itself at all. The only place they are used are in the
|
||||
javascript bindings, which uses them to access the DOM tree. The big advantage of having this
|
||||
separation between interface classes and imlementation classes, is that we can have several
|
||||
interface objects pointing to the same implementation. This implements the requirement of
|
||||
explicit sharing of the DOM specs.
|
||||
<p>
|
||||
Another advantage is, that (as the implementation classes are not exported) it gives us a lot
|
||||
more freedom to make changes in the implementation without breaking binary compatibility.
|
||||
<p>
|
||||
You will find almost a one to one correspondence between the interface classes and the implementation
|
||||
classes. In the implementation classes we have added a few more intermediate classes, that can
|
||||
not be seen from the outside for various reasons (make implementation of shared features easier
|
||||
or to reduce memory consumption).
|
||||
<p>
|
||||
In C++, you can access the whole DOM tree from outside KHTML by using the interface classes.
|
||||
For a description see the <a href="http://developer.kde.org/documentation/library/kdeqt/kde3arch/khtml/index.html">introduction to khtml</a> on <a href="http://developer.kde.org/">developer.kde.org</a>.
|
||||
|
||||
One thing that has been omitted in the discussion above is the style sheet defined inside the
|
||||
<code><style></code> element (as an example of a style sheet) and the image element
|
||||
(as an example of an external resource that needs to be loaded). This will be done in the following
|
||||
two sections.
|
||||
|
||||
<h2>CSS</h2> The contents of the <code><style></code> element (in this
|
||||
case the <code>h1 { color: red; }</code> rule) will get passed to the
|
||||
<a href="html/html_headimpl.h">HTMLStyleElementImpl object</a>. This object creates an
|
||||
<a href="css/cssstylesheetimpl.h">CSSStyleSheetImpl object</a> and passes the
|
||||
data to it. The <a href="css/cssparser.h">CSS parser</a> will take
|
||||
the data, and parse it into a DOM structure for CSS (similar to the one for
|
||||
HTML, see also the DOM level 2 specs). This will be later on used to define the
|
||||
look of the HTML elements in the DOM tree.
|
||||
<p>
|
||||
Actually "later on" is relative, as we will see later, that this happens partly in parallel to
|
||||
the build up of the DOM tree.
|
||||
|
||||
<h2>Loading external objects</h2>
|
||||
<p>
|
||||
Some HTML elements (as <code><img>, <link>, <object>, etc.</code>) contain
|
||||
references to external objects, that have to be loaded. This is done by the
|
||||
Loader and related classes (misc/loader.*). Objects that might need to load external objects
|
||||
inherit from <a href="misc/loader_client.h">CachedObjectClient</a>, and can ask
|
||||
the <a href="misc/loader.h">loader</a> (that also acts as a memory cache) to
|
||||
download the object they need for them from the web.
|
||||
<p>
|
||||
Once the <a href="misc/loader.h">loader</a> has the requested object ready, it will notify the
|
||||
<a href="misc/loader_client.h">CachedObjectClient</a> of this, and the client can
|
||||
then process the received data.
|
||||
|
||||
<h2>Making it visible</h2>
|
||||
|
||||
Now once we have the DOM tree, and the associated style sheets and external objects, how
|
||||
do we get the stuff actually displayed on the screen?
|
||||
<p>
|
||||
For this we have a rendering engine, that is completely based on CSS. The first
|
||||
thing that is done is to collect all style sheets that apply to the document
|
||||
and create a nice list of style rules that need to be applied to the
|
||||
elements. This is done in the <a href="css/cssstyleselector.h">CSSStyleSelector</a> class.
|
||||
It takes the <a href="css/html4.css">default HTML style sheet</a> (defined in css/html4.css),
|
||||
an optional user defined style sheet, and all style sheets from the document,
|
||||
and combines them to a nice list of parsed style rules (optimised for fast
|
||||
lookup). The exact rules of how these style sheets should get applied to HTML
|
||||
or XML documents can be found in the CSS2 specs.
|
||||
<p>
|
||||
Once we have this list, we can get a <a
|
||||
href="rendering/render_style.h">RenderStyle object</a>
|
||||
for every DOM element from the <a
|
||||
href="css/cssstyleselector.h">CSSStyleSelector</a> by calling
|
||||
"styleForElement(DOM::ElementImpl *)".
|
||||
The style object describes in a compact form all the
|
||||
<a href="css/css_properties.in">CSS properties</a>
|
||||
that should get applied to the Node.
|
||||
<p>
|
||||
After that, a rendering tree gets built up. Using the style object, the
|
||||
<a href="xml/dom_nodeimpl.h">DOM Node</a> creates an appropriate render object
|
||||
(all these are defined in the rendering subdirectory) and adds it to the
|
||||
rendering tree. This will give another tree like structure, that resembles in
|
||||
it's general structure the DOM tree, but might have some significant
|
||||
differences too. First of all, so called
|
||||
<a href="http://www.w3.org/TR/REC-CSS2/visuren.html#anonymous-block-level">anonymous boxes</a> - (see
|
||||
<a href="http://www.w3.org/TR/REC-CSS2/">CSS specs</a>) that
|
||||
have no DOM counterpart might get inserted into the rendering tree to satisfy
|
||||
DOM requirements. Second, the display property of the style affects which type
|
||||
of rendering object is chosen to represent the current DOM object.
|
||||
|
||||
<p>
|
||||
In the above example we would get the following rendering tree:
|
||||
<pre>
|
||||
RenderRoot*
|
||||
\--> RenderBody*
|
||||
|--> RenderFlow* (<H1>)
|
||||
| \--> RenderText* ("some red text")
|
||||
|--> RenderFlow* (anonymous box)
|
||||
| \--> RenderText* ("more text")
|
||||
\--> RenderFlow* (<P>)
|
||||
|--> RenderText* ("a paragraph with an")
|
||||
|--> RenderImage*
|
||||
\--> RenderText* ("embedded image.")
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
A call to of <a href="rendering/render_root.cpp">layout()</a> on the
|
||||
<a href="rendering/render_root.h">RenderRoot </a> (the root of the rendering tree)
|
||||
object causes the rendering tree to layout itself into the available space
|
||||
(width) given by the KHTMLView. After that, the drawContents() method of
|
||||
KHTMLView can call RenderRoot->print() with appropriate parameters to actually
|
||||
paint the document. This is not 100% correct, when parsing incrementally, but
|
||||
is exactly what happens when you resize the document.
|
||||
|
||||
|
||||
As you can see, the conversion to the rendering tree removed the head part of
|
||||
the HTML code, and inserted an anonymous render object around the string "more
|
||||
text". For an explanation why this is done, see the CSS specs.
|
||||
<p>
|
||||
|
||||
<h2>Directory structure</h2>
|
||||
|
||||
A short explanation of the subdirectories in khtml.
|
||||
<dl>
|
||||
<dt><a href="css/">css:</a>
|
||||
<dd>Contains all the stuff relevant to the CSS part of DOM Level2 (implementation classes only),
|
||||
the <a href="css/cssparser.h">CSS parser</a>, and the stuff to create
|
||||
RenderStyle object out of Nodes and the CSS style sheets.
|
||||
<dt><a href="dom/">dom: </a>
|
||||
<dd>Contains the external DOM API (the DOM interface classes) for all of the DOM
|
||||
<dt><a href="ecma/">ecma:</a>
|
||||
<dd>The javascript bindings to the DOM and khtml.
|
||||
<dt><a href="html/">html:</a>
|
||||
<dd>The html subpart of the DOM (implementation only), the HTML tokenizer and parser and a class
|
||||
that defines the DTD to use for HTML (used mainly in the parser).
|
||||
<dt><a href="java/">java:</a>
|
||||
<dd>Java related stuff.
|
||||
<dt><a href="misc/">misc:</a>
|
||||
<dd>Some misc stuff needed in khtml. Contains the image loader, some misc definitions and the
|
||||
decoder class that converts the incoming stream to unicode.
|
||||
<dt><a href="rendering">rendering:</a>
|
||||
<dd>Everything thats related to bringing a DOM tree with CSS declarations to the screen. Contains
|
||||
the definition of the objects used in the rendering tree, the layouting code, and the RenderStyle objects.
|
||||
<dt><a href="xml/">xml:</a>
|
||||
<dd>The XML part of the DOM implementation, the xml tokenizer.
|
||||
</dl>
|
||||
|
||||
<h2>Exception handling</h2>
|
||||
To save on library size, C++-exceptions are only enabled in the dom/ subdirectory,
|
||||
since exceptions are mandated by the DOM API. In the rest of KHTML's code,
|
||||
we pass an error flag (usually called "exceptionCode"), and the class that
|
||||
is part of dom/* checks for this flag and throws the exception.
|
||||
|
||||
<h2>Final words...</h2>
|
||||
<p>
|
||||
All the above is to give you a quick introduction into the way khtml brings an HTML/XML file to the screen.
|
||||
It is by no way complete or even 100% correct. I left out many problems, I will perhaps add either on request
|
||||
or when I find some time to do so. Let me name some of the missing things:
|
||||
<ul>
|
||||
<li>The decoder to convert the incoming stream to Unicode
|
||||
<li>interaction with konqueror/applications
|
||||
<li>javascript
|
||||
<li>dynamic reflow and how to use the DOM to manipulate khtmls visual output
|
||||
<li>mouse/event handling
|
||||
<li>real interactions when parsing incrementally
|
||||
<li>java
|
||||
</ul>
|
||||
|
||||
Still I hope that this short introduction will make it easier for you to get a first hold of khtml and the way it works.
|
||||
<p>
|
||||
Now before I finish let me add a small <b>warning</b> and <b>advice</b> to all of you who plan hacking khtml themselves:
|
||||
<p>
|
||||
khtml is by now a quite big library and it takes some time to understand how it works. Don't let yourself get frustrated
|
||||
if you don't immediately understand how it works. On the other hand, it is by now one of the libraries that
|
||||
get used a lot, that probably has the biggest number of remaining bugs (even though it's sometimes hard to
|
||||
know if some behavior is really a bug).
|
||||
<blockquote>
|
||||
Some parts of it's code are however <b>extremely touchy</b> (especially the layouting algorithms),
|
||||
and making changes there (that might fix a bug on one web page) might introduce severe bugs.
|
||||
All the people developing khtml have already spend huge amounts of time searching for such bugs,
|
||||
that only showed up on some web pages, and thus were found only a week after the change that
|
||||
introduced the bug was made. This can be very frustrating for us, and we'd appreciate if people
|
||||
that are not completely familiar with khtml post changes touching these critical regions to kfm-devel
|
||||
for review before applying them.
|
||||
</blockquote>
|
||||
|
||||
<div style="margin-top: 2em; font-size: large;">
|
||||
And now have fun hacking khtml.
|
||||
<div style="margin-left: 10em; margin-bottom: 1em;">Lars</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,71 +0,0 @@
|
|||
This document gives an example of how a given rendering of inline elements,
|
||||
with its associated HTML code, will map to 2 different trees:
|
||||
|
||||
-a tree of render objects, mirroring the corresponding DOM tree.
|
||||
-a tree of lineboxes reflecting how inline-level render objects are laid out in distinct lines inside
|
||||
block-level elements. (cf. http://www.w3.org/TR/CSS2/visuren.html#inline-formatting and http://www.w3.org/TR/CSS2/visudet.html#line-height)
|
||||
|
||||
Rendering:
|
||||
=========
|
||||
_________________
|
||||
|Lorem ipsum dolor|
|
||||
|sit amet. |
|
||||
|_________________|
|
||||
|
||||
=> 1 block level element
|
||||
=> 2 lines (because of wrapping).
|
||||
|
||||
HTML:
|
||||
====
|
||||
|
||||
<div>Lorem <span>ipsum <i>dolor sit</i> amet.</span></div>
|
||||
|
||||
Render tree:
|
||||
===========
|
||||
[RenderBlock1
|
||||
[RenderText1 "Lorem "]
|
||||
[RenderInline1
|
||||
[RenderText2 "ipsum "]
|
||||
[RenderInline2
|
||||
[RenderText3 "dolor sit"]
|
||||
]
|
||||
[RenderText4 " amet."]
|
||||
]
|
||||
]
|
||||
|
||||
Linebox tree:
|
||||
============
|
||||
|
||||
[RootInlineBox1
|
||||
[InlineTextBox1 "Lorem"]
|
||||
[InlineFlowBox1
|
||||
[InlineTextBox2 "ipsum"]
|
||||
[InlineFlowBox3
|
||||
[InlineTextBox3 "dolor"]
|
||||
]
|
||||
]
|
||||
]
|
||||
[RootInlineBox2
|
||||
[InlineFlowBox2
|
||||
[InlineFlowBox4
|
||||
[InlineTextBox4 "sit"]
|
||||
]
|
||||
[InlineTextBox5 " amet."]
|
||||
]
|
||||
]
|
||||
|
||||
Linkage of LineBox tree:
|
||||
========================
|
||||
(just for first line:)
|
||||
|
||||
RootBox1->nextOnLine() == InlineTextBox1 ->nextOnLine() == InlineFlowBox1 -> nextOnLine() == InlineTextBox2 ->
|
||||
nextOnLine() == InlineFlowBox2-> nextOnLine() == InlineTextBox2 ->nextOnLine() == InlineFlowBox2 ->
|
||||
nextOnLine() == InlineTextBox3
|
||||
|
||||
Correspondence Render tree / Linebox tree:
|
||||
==========================================
|
||||
(just for some objects:)
|
||||
|
||||
( RenderBlock1 -> firstLineBox() == RootBox1 ) ->nextLineBox() == (RootBox2 == RenderBlock1 -> lastLineBox() )
|
||||
( RenderInline1 ->firstLineBox() == InlineFlowBox1 ) -> nextLineBox() == (InlineFlowBox2 == RenderInline1 -> lastLineBox() )
|
||||
( RenderText3 -> firstTextBox() == InlineTextBox3 ) -> nextTextBox() == (InlineTextBox4 == RenderText3 -> lastLineBox() )
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 2008 Harri Porten (porten@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.
|
||||
*
|
||||
* This file includes excerpts from the Document Object Model (DOM)
|
||||
* Level 1 Specification (Recommendation)
|
||||
* http://www.w3.org/TR/REC-DOM-Level-1/
|
||||
* Copyright © World Wide Web Consortium , (Massachusetts Institute of
|
||||
* Technology , Institut National de Recherche en Informatique et en
|
||||
* Automatique , Keio University ). All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ExceptionCode_h
|
||||
#define ExceptionCode_h
|
||||
|
||||
#include <dom/dom_exception.h>
|
||||
|
||||
namespace khtml
|
||||
{
|
||||
typedef unsigned short ExceptionCode;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Apple Computer, Inc.
|
||||
* Copyright (C) 2008 Vyacheslav Tokarev (tsjoker@gmail.com)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "QualifiedName.h"
|
||||
#include "xml/dom_nodeimpl.h"
|
||||
|
||||
namespace DOM {
|
||||
|
||||
QualifiedName::QualifiedName(const DOMString& prefix, const DOMString& localName, const DOMString& namespaceURI)
|
||||
{
|
||||
m_prefix = PrefixName::fromString(prefix);
|
||||
m_localName = LocalName::fromString(localName);
|
||||
m_namespace = NamespaceName::fromString(namespaceURI);
|
||||
}
|
||||
|
||||
QualifiedName::QualifiedName(const QualifiedName& name)
|
||||
{
|
||||
m_prefix = name.prefixId();
|
||||
m_namespace = name.namespaceNameId();
|
||||
m_localName = name.localNameId();
|
||||
}
|
||||
|
||||
QualifiedName::QualifiedName(int prefix, int localName, int namespaceName)
|
||||
{
|
||||
m_prefix = PrefixName::fromId(prefix);
|
||||
m_localName = LocalName::fromId(localName);
|
||||
m_namespace = NamespaceName::fromId(namespaceName);
|
||||
}
|
||||
|
||||
QualifiedName::QualifiedName(quint32 id, PrefixName prefix) {
|
||||
m_prefix = prefix;
|
||||
m_localName = LocalName::fromId(localNamePart(id));
|
||||
m_namespace = NamespaceName::fromId(namespacePart(id));
|
||||
}
|
||||
|
||||
const QualifiedName& QualifiedName::operator=(const QualifiedName& name)
|
||||
{
|
||||
m_prefix = name.prefixId();
|
||||
m_namespace = name.namespaceNameId();
|
||||
m_localName = name.localNameId();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool QualifiedName::operator==(const QualifiedName& other) const
|
||||
{
|
||||
/*kDebug() << m_prefix.id() << other.prefixId().id() << ((m_prefix == other.prefixId())) << endl;
|
||||
kDebug() << (m_prefix == other.prefixId()) << (m_localName == other.localNameId()) << (m_namespace == other.namespaceNameId()) << endl;*/
|
||||
return (m_prefix == other.prefixId() && m_localName == other.localNameId() && m_namespace == other.namespaceNameId());
|
||||
}
|
||||
|
||||
bool QualifiedName::hasPrefix() const
|
||||
{
|
||||
return m_prefix.id() != 0/*emptyPrefix*/;
|
||||
}
|
||||
|
||||
bool QualifiedName::matches(const QualifiedName& other) const
|
||||
{
|
||||
//FIXME: IMPLEMENT
|
||||
return *this == other || (m_localName == other.localNameId() && (m_prefix == other.prefixId() || m_namespace == other.namespaceNameId()));
|
||||
}
|
||||
|
||||
void QualifiedName::setPrefix(const PrefixName& prefix) {
|
||||
m_prefix = prefix;
|
||||
}
|
||||
|
||||
void QualifiedName::setPrefix(const DOMString& prefix) {
|
||||
m_prefix = PrefixName::fromString(prefix);
|
||||
}
|
||||
|
||||
unsigned QualifiedName::id() const
|
||||
{
|
||||
return (m_namespace.id() << 16) ^ (m_localName.id());
|
||||
}
|
||||
|
||||
DOMString QualifiedName::tagName() const
|
||||
{
|
||||
DOMString prefix = m_prefix.toString();
|
||||
DOMString localName = m_localName.toString();
|
||||
if (prefix.isEmpty())
|
||||
return localName;
|
||||
return prefix + DOMString(":") + localName;
|
||||
}
|
||||
|
||||
DOMString QualifiedName::prefix() const
|
||||
{
|
||||
return m_prefix.toString();
|
||||
}
|
||||
|
||||
DOMString QualifiedName::localName() const
|
||||
{
|
||||
return m_localName.toString();
|
||||
}
|
||||
|
||||
DOMString QualifiedName::namespaceURI() const
|
||||
{
|
||||
return m_namespace.toString();
|
||||
}
|
||||
|
||||
DOMString QualifiedName::toString() const
|
||||
{
|
||||
return prefix() + DOMString(":") + localName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright (C) 2005 Apple Computer, Inc.
|
||||
* Copyright (C) 2008 Vyacheslav Tokarev (tsjoker@gmail.com)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#ifndef _DOM_QUALIFIEDNAME_h_
|
||||
#define _DOM_QUALIFIEDNAME_h_
|
||||
|
||||
#include "misc/idstring.h"
|
||||
#include "misc/htmlnames.h"
|
||||
|
||||
namespace DOM {
|
||||
|
||||
/*class DOMString;
|
||||
class PrefixName;
|
||||
class LocalName;
|
||||
class NamespaceName;*/
|
||||
|
||||
class QualifiedName {
|
||||
public:
|
||||
QualifiedName() {}
|
||||
QualifiedName(PrefixName prefix, LocalName localName, NamespaceName namespaceURI) : m_namespace(namespaceURI), m_prefix(prefix), m_localName(localName) {}
|
||||
QualifiedName(const DOMString& prefix, const DOMString& localName, const DOMString& namespaceURI);
|
||||
QualifiedName(int prefix, int localName, int namespaceName);
|
||||
//QualifiedName(DOMString namespaceURI, DOMString prefix, DOMString localName);
|
||||
QualifiedName(quint32 id, PrefixName prefix);
|
||||
~QualifiedName() {}
|
||||
|
||||
QualifiedName(const QualifiedName& name);
|
||||
const QualifiedName& operator=(const QualifiedName& name);
|
||||
|
||||
bool operator==(const QualifiedName& other) const;
|
||||
//inline bool operator!=(const QualifiedName& other) const { return (m_prefix != other.prefixId() || m_localName != other.localNameId() || m_namespace != other.namespaceNameId()); }
|
||||
|
||||
bool matches(const QualifiedName& other) const;
|
||||
|
||||
inline bool hasPrefix() const;
|
||||
void setPrefix(const PrefixName& prefix);
|
||||
void setPrefix(const DOMString& prefix);
|
||||
|
||||
inline PrefixName prefixId() const { return m_prefix; }
|
||||
inline LocalName localNameId() const { return m_localName; }
|
||||
inline NamespaceName namespaceNameId() const { return m_namespace; }
|
||||
unsigned id() const;
|
||||
|
||||
DOMString tagName() const;
|
||||
|
||||
DOMString prefix() const;
|
||||
DOMString localName() const;
|
||||
DOMString namespaceURI() const;
|
||||
|
||||
DOMString toString() const;
|
||||
|
||||
private:
|
||||
NamespaceName m_namespace;
|
||||
PrefixName m_prefix;
|
||||
LocalName m_localName;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,596 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 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 "css/css_ruleimpl.h"
|
||||
|
||||
using namespace DOM;
|
||||
|
||||
CSSRule::CSSRule()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
CSSRule::CSSRule(const CSSRule &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
CSSRule::CSSRule(CSSRuleImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
CSSRule &CSSRule::operator = (const CSSRule &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSRule::~CSSRule()
|
||||
{
|
||||
if(impl) impl->deref();
|
||||
}
|
||||
|
||||
unsigned short CSSRule::type() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSRuleImpl *)impl)->type();
|
||||
}
|
||||
|
||||
DOMString CSSRule::cssText() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return impl->cssText();
|
||||
}
|
||||
|
||||
void CSSRule::setCssText( const DOMString &value )
|
||||
{
|
||||
if(!impl) return;
|
||||
impl->setCssText(value);
|
||||
}
|
||||
|
||||
CSSStyleSheet CSSRule::parentStyleSheet() const
|
||||
{
|
||||
if(!impl) return CSSStyleSheet();
|
||||
return ((CSSRuleImpl *)impl)->parentStyleSheet();
|
||||
}
|
||||
|
||||
CSSRule CSSRule::parentRule() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSRuleImpl *)impl)->parentRule();
|
||||
}
|
||||
|
||||
CSSRuleImpl *CSSRule::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool CSSRule::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
void CSSRule::assignOther( const CSSRule &other, RuleType thisType )
|
||||
{
|
||||
if (other.type() != thisType ) {
|
||||
if ( impl ) impl->deref();
|
||||
impl = 0;
|
||||
} else
|
||||
CSSRule::operator = ( other );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
||||
CSSCharsetRule::CSSCharsetRule()
|
||||
: CSSRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSCharsetRule::CSSCharsetRule(const CSSCharsetRule &other) : CSSRule(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSCharsetRule::CSSCharsetRule(const CSSRule &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSCharsetRule::CSSCharsetRule(CSSCharsetRuleImpl *impl) : CSSRule(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSCharsetRule &CSSCharsetRule::operator = (const CSSCharsetRule &other)
|
||||
{
|
||||
CSSRule::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSCharsetRule &CSSCharsetRule::operator = (const CSSRule &other)
|
||||
{
|
||||
assignOther( other, CSSRule::CHARSET_RULE);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSCharsetRule::~CSSCharsetRule()
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSSCharsetRule::encoding() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((CSSCharsetRuleImpl*)impl)->encoding();
|
||||
}
|
||||
|
||||
void CSSCharsetRule::setEncoding( const DOMString &value )
|
||||
{
|
||||
((CSSCharsetRuleImpl*)impl)->setEncoding(value);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
||||
CSSFontFaceRule::CSSFontFaceRule() : CSSRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSFontFaceRule::CSSFontFaceRule(const CSSFontFaceRule &other) : CSSRule(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSFontFaceRule::CSSFontFaceRule(const CSSRule &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSFontFaceRule::CSSFontFaceRule(CSSFontFaceRuleImpl *impl) : CSSRule(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSFontFaceRule &CSSFontFaceRule::operator = (const CSSFontFaceRule &other)
|
||||
{
|
||||
CSSRule::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSFontFaceRule &CSSFontFaceRule::operator = (const CSSRule &other)
|
||||
{
|
||||
assignOther( other, CSSRule::FONT_FACE_RULE );
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSFontFaceRule::~CSSFontFaceRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSStyleDeclaration CSSFontFaceRule::style() const
|
||||
{
|
||||
if(!impl) return CSSStyleDeclaration();
|
||||
return ((CSSFontFaceRuleImpl *)impl)->style();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
||||
CSSImportRule::CSSImportRule() : CSSRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSImportRule::CSSImportRule(const CSSImportRule &other) : CSSRule(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSImportRule::CSSImportRule(const CSSRule &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSImportRule::CSSImportRule(CSSImportRuleImpl *impl) : CSSRule(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSImportRule &CSSImportRule::operator = (const CSSImportRule &other)
|
||||
{
|
||||
CSSRule::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSImportRule &CSSImportRule::operator = (const CSSRule &other)
|
||||
{
|
||||
assignOther( other, CSSRule::IMPORT_RULE );
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSImportRule::~CSSImportRule()
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSSImportRule::href() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((CSSImportRuleImpl *)impl)->href();
|
||||
}
|
||||
|
||||
MediaList CSSImportRule::media() const
|
||||
{
|
||||
if(!impl) return MediaList();
|
||||
return ((CSSImportRuleImpl *)impl)->media();
|
||||
}
|
||||
|
||||
CSSStyleSheet CSSImportRule::styleSheet() const
|
||||
{
|
||||
if(!impl) return CSSStyleSheet();
|
||||
return ((CSSImportRuleImpl *)impl)->styleSheet();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
||||
CSSMediaRule::CSSMediaRule() : CSSRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSMediaRule::CSSMediaRule(const CSSMediaRule &other) : CSSRule(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSMediaRule::CSSMediaRule(const CSSRule &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSMediaRule::CSSMediaRule(CSSMediaRuleImpl *impl) : CSSRule(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSMediaRule &CSSMediaRule::operator = (const CSSMediaRule &other)
|
||||
{
|
||||
CSSRule::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSMediaRule &CSSMediaRule::operator = (const CSSRule &other)
|
||||
{
|
||||
assignOther( other, CSSRule::MEDIA_RULE );
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSMediaRule::~CSSMediaRule()
|
||||
{
|
||||
}
|
||||
|
||||
MediaList CSSMediaRule::media() const
|
||||
{
|
||||
if(!impl) return MediaList();
|
||||
return ((CSSMediaRuleImpl *)impl)->media();
|
||||
}
|
||||
|
||||
CSSRuleList CSSMediaRule::cssRules() const
|
||||
{
|
||||
if(!impl) return CSSRuleList();
|
||||
return ((CSSMediaRuleImpl *)impl)->cssRules();
|
||||
}
|
||||
|
||||
unsigned long CSSMediaRule::insertRule( const DOMString &rule, unsigned long index )
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSMediaRuleImpl *)impl)->insertRule( rule, index );
|
||||
}
|
||||
|
||||
void CSSMediaRule::deleteRule( unsigned long index )
|
||||
{
|
||||
if(impl)
|
||||
((CSSMediaRuleImpl *)impl)->deleteRule( index );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
||||
CSSPageRule::CSSPageRule() : CSSRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSPageRule::CSSPageRule(const CSSPageRule &other) : CSSRule(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSPageRule::CSSPageRule(const CSSRule &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSPageRule::CSSPageRule(CSSPageRuleImpl *impl) : CSSRule(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSPageRule &CSSPageRule::operator = (const CSSPageRule &other)
|
||||
{
|
||||
CSSRule::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSPageRule &CSSPageRule::operator = (const CSSRule &other)
|
||||
{
|
||||
assignOther( other, CSSRule::PAGE_RULE );
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSPageRule::~CSSPageRule()
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSSPageRule::selectorText() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((CSSPageRuleImpl*)impl)->selectorText();
|
||||
}
|
||||
|
||||
void CSSPageRule::setSelectorText( const DOMString &value )
|
||||
{
|
||||
((CSSPageRuleImpl*)impl)->setSelectorText(value);
|
||||
}
|
||||
|
||||
CSSStyleDeclaration CSSPageRule::style() const
|
||||
{
|
||||
if(!impl) return CSSStyleDeclaration();
|
||||
return ((CSSPageRuleImpl *)impl)->style();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
CSSStyleRule::CSSStyleRule() : CSSRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSStyleRule::CSSStyleRule(const CSSStyleRule &other)
|
||||
: CSSRule(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSStyleRule::CSSStyleRule(const CSSRule &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
|
||||
CSSStyleRule::CSSStyleRule(CSSStyleRuleImpl *impl)
|
||||
: CSSRule(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSStyleRule &CSSStyleRule::operator = (const CSSStyleRule &other)
|
||||
{
|
||||
CSSRule::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSStyleRule &CSSStyleRule::operator = (const CSSRule &other)
|
||||
{
|
||||
assignOther( other, CSSRule::STYLE_RULE );
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSStyleRule::~CSSStyleRule()
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSSStyleRule::selectorText() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((CSSStyleRuleImpl*)impl)->selectorText();
|
||||
}
|
||||
|
||||
void CSSStyleRule::setSelectorText( const DOMString &value )
|
||||
{
|
||||
((CSSStyleRuleImpl*)impl)->setSelectorText(value);
|
||||
}
|
||||
|
||||
CSSStyleDeclaration CSSStyleRule::style() const
|
||||
{
|
||||
if(!impl) return CSSStyleDeclaration();
|
||||
return ((CSSStyleRuleImpl *)impl)->style();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
||||
CSSNamespaceRule::CSSNamespaceRule() : CSSRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSNamespaceRule::CSSNamespaceRule(const CSSNamespaceRule &other)
|
||||
: CSSRule(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSNamespaceRule::CSSNamespaceRule(const CSSRule &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSNamespaceRule::CSSNamespaceRule(CSSNamespaceRuleImpl *impl)
|
||||
: CSSRule(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSNamespaceRule &CSSNamespaceRule::operator = (const CSSNamespaceRule &other)
|
||||
{
|
||||
CSSRule::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSNamespaceRule &CSSNamespaceRule::operator = (const CSSRule &other)
|
||||
{
|
||||
assignOther( other, CSSRule::NAMESPACE_RULE );
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSNamespaceRule::~CSSNamespaceRule()
|
||||
{
|
||||
}
|
||||
|
||||
DOMString CSSNamespaceRule::namespaceURI() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return static_cast<CSSNamespaceRuleImpl*>(impl)->namespaceURI();
|
||||
}
|
||||
|
||||
DOMString CSSNamespaceRule::prefix() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return static_cast<CSSNamespaceRuleImpl*>(impl)->prefix();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
||||
CSSUnknownRule::CSSUnknownRule() : CSSRule()
|
||||
{
|
||||
}
|
||||
|
||||
CSSUnknownRule::CSSUnknownRule(const CSSUnknownRule &other)
|
||||
: CSSRule(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSUnknownRule::CSSUnknownRule(const CSSRule &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSUnknownRule::CSSUnknownRule(CSSUnknownRuleImpl *impl)
|
||||
: CSSRule(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSUnknownRule &CSSUnknownRule::operator = (const CSSUnknownRule &other)
|
||||
{
|
||||
CSSRule::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSUnknownRule &CSSUnknownRule::operator = (const CSSRule &other)
|
||||
{
|
||||
assignOther( other, CSSRule::UNKNOWN_RULE );
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSUnknownRule::~CSSUnknownRule()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
CSSRuleList::CSSRuleList()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
CSSRuleList::CSSRuleList(const CSSRuleList &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
CSSRuleList::CSSRuleList(CSSRuleListImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
CSSRuleList::CSSRuleList(StyleListImpl *lst)
|
||||
{
|
||||
impl = new CSSRuleListImpl;
|
||||
impl->ref();
|
||||
if (lst)
|
||||
{
|
||||
for( unsigned long i = 0; i < lst->length() ; ++i )
|
||||
{
|
||||
StyleBaseImpl* style = lst->item( i );
|
||||
if ( style->isRule() )
|
||||
impl->insertRule( static_cast<CSSRuleImpl *>(style), impl->length() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CSSRuleList &CSSRuleList::operator = (const CSSRuleList &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSRuleList::~CSSRuleList()
|
||||
{
|
||||
if(impl) impl->deref();
|
||||
}
|
||||
|
||||
unsigned long CSSRuleList::length() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSRuleListImpl *)impl)->length();
|
||||
return 0;
|
||||
}
|
||||
|
||||
CSSRule CSSRuleList::item( unsigned long index )
|
||||
{
|
||||
if(!impl) return CSSRule();
|
||||
return ((CSSRuleListImpl *)impl)->item( index );
|
||||
}
|
||||
|
||||
CSSRuleListImpl *CSSRuleList::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool CSSRuleList::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,562 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 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.
|
||||
*
|
||||
* This file includes excerpts from the Document Object Model (DOM)
|
||||
* Level 2 Specification (Candidate Recommendation)
|
||||
* http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
|
||||
* Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef _CSS_css_rule_h_
|
||||
#define _CSS_css_rule_h_
|
||||
|
||||
#include <dom/dom_string.h>
|
||||
#include <dom/css_stylesheet.h>
|
||||
#include <dom/css_value.h>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class CSSRuleImpl;
|
||||
|
||||
/**
|
||||
* The \c CSSRule interface is the abstract base interface
|
||||
* for any type of CSS <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#q5"> statement
|
||||
* </a> . This includes both <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#q8"> rule sets
|
||||
* </a> and <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#at-rules">
|
||||
* at-rules </a> . An implementation is expected to preserve all rules
|
||||
* specified in a CSS style sheet, even if it is not recognized.
|
||||
* Unrecognized rules are represented using the \c CSSUnknownRule
|
||||
* interface.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSRule
|
||||
{
|
||||
public:
|
||||
CSSRule();
|
||||
CSSRule(const CSSRule &other);
|
||||
CSSRule(CSSRuleImpl *impl);
|
||||
public:
|
||||
|
||||
CSSRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSRule();
|
||||
/**
|
||||
* An integer indicating which type of rule this is.
|
||||
*
|
||||
*/
|
||||
enum RuleType {
|
||||
UNKNOWN_RULE = 0,
|
||||
STYLE_RULE = 1,
|
||||
CHARSET_RULE = 2,
|
||||
IMPORT_RULE = 3,
|
||||
MEDIA_RULE = 4,
|
||||
FONT_FACE_RULE = 5,
|
||||
PAGE_RULE = 6,
|
||||
NAMESPACE_RULE = 10, ///< CSSOM, @since 4.6.0
|
||||
QUIRKS_RULE = 100 // KHTML CSS Extension
|
||||
};
|
||||
|
||||
/**
|
||||
* The type of the rule, as defined above. The expectation is that
|
||||
* binding-specific casting methods can be used to cast down from
|
||||
* an instance of the \c CSSRule interface to the
|
||||
* specific derived interface implied by the \c type .
|
||||
*
|
||||
*/
|
||||
unsigned short type() const;
|
||||
|
||||
/**
|
||||
* The parsable textual representation of the rule. This reflects
|
||||
* the current state of the rule and not its initial value.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString cssText() const;
|
||||
|
||||
/**
|
||||
* see cssText
|
||||
* @exception DOMException
|
||||
*
|
||||
* HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted
|
||||
* at this point in the style sheet.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
|
||||
* readonly.
|
||||
*
|
||||
* @exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified CSS string value has a
|
||||
* syntax error and is unparsable.
|
||||
*
|
||||
* INVALID_MODIFICATION_ERR: Raised if the specified CSS string value
|
||||
* represents a different type of rule than the current one.
|
||||
*/
|
||||
void setCssText( const DOM::DOMString & );
|
||||
|
||||
/**
|
||||
* The style sheet that contains this rule.
|
||||
*
|
||||
*/
|
||||
CSSStyleSheet parentStyleSheet() const;
|
||||
|
||||
/**
|
||||
* If this rule is contained inside another rule (e.g. a style
|
||||
* rule inside an \@media block), this is the containing rule. If
|
||||
* this rule is not nested inside any other rules, this returns
|
||||
* \c null .
|
||||
*
|
||||
*/
|
||||
CSSRule parentRule() const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
CSSRuleImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
CSSRuleImpl *impl;
|
||||
|
||||
void assignOther( const CSSRule &other, RuleType thisType );
|
||||
};
|
||||
|
||||
class CSSCharsetRuleImpl;
|
||||
|
||||
/**
|
||||
* The \c CSSCharsetRule interface a <a href=""> \@charset
|
||||
* rule </a> in a CSS style sheet. A \c \@charset rule can
|
||||
* be used to define the encoding of the style sheet.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSCharsetRule : public CSSRule
|
||||
{
|
||||
public:
|
||||
CSSCharsetRule();
|
||||
CSSCharsetRule(const CSSCharsetRule &other);
|
||||
CSSCharsetRule(const CSSRule &other);
|
||||
CSSCharsetRule(CSSCharsetRuleImpl *impl);
|
||||
public:
|
||||
|
||||
CSSCharsetRule & operator = (const CSSCharsetRule &other);
|
||||
CSSCharsetRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSCharsetRule();
|
||||
|
||||
/**
|
||||
* The encoding information used in this \c \@charset
|
||||
* rule.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString encoding() const;
|
||||
|
||||
/**
|
||||
* see encoding
|
||||
* @exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified encoding value has a syntax
|
||||
* error and is unparsable.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this encoding rule is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void setEncoding( const DOM::DOMString & );
|
||||
};
|
||||
|
||||
|
||||
class CSSFontFaceRuleImpl;
|
||||
/**
|
||||
* The \c CSSFontFaceRule interface represents a <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/fonts.html#font-descriptions">
|
||||
* \c \@font-face rule </a> in a CSS style sheet. The \c \@font-face
|
||||
* rule is used to hold a set of font descriptions.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSFontFaceRule : public CSSRule
|
||||
{
|
||||
public:
|
||||
CSSFontFaceRule();
|
||||
CSSFontFaceRule(const CSSFontFaceRule &other);
|
||||
CSSFontFaceRule(const CSSRule &other);
|
||||
CSSFontFaceRule(CSSFontFaceRuleImpl *impl);
|
||||
public:
|
||||
|
||||
CSSFontFaceRule & operator = (const CSSFontFaceRule &other);
|
||||
CSSFontFaceRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSFontFaceRule();
|
||||
|
||||
/**
|
||||
* The <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#q8">
|
||||
* declaration-block </a> of this rule.
|
||||
*
|
||||
*/
|
||||
CSSStyleDeclaration style() const;
|
||||
};
|
||||
|
||||
class CSSImportRuleImpl;
|
||||
/**
|
||||
* The \c CSSImportRule interface represents a <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/cascade.html#at-import">
|
||||
* \c \@import rule </a> within a CSS style sheet. The \c \@import
|
||||
* rule is used to import style rules from other style sheets.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSImportRule : public CSSRule
|
||||
{
|
||||
public:
|
||||
CSSImportRule();
|
||||
CSSImportRule(const CSSImportRule &other);
|
||||
CSSImportRule(const CSSRule &other);
|
||||
CSSImportRule(CSSImportRuleImpl *impl);
|
||||
public:
|
||||
|
||||
CSSImportRule & operator = (const CSSImportRule &other);
|
||||
CSSImportRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSImportRule();
|
||||
|
||||
/**
|
||||
* The location of the style sheet to be imported. The attribute
|
||||
* will not contain the \c "url(...)" specifier around
|
||||
* the URI.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString href() const;
|
||||
|
||||
/**
|
||||
* A list of media types for which this style sheet may be used.
|
||||
*
|
||||
*/
|
||||
MediaList media() const;
|
||||
|
||||
/**
|
||||
* The style sheet referred to by this rule, if it has been
|
||||
* loaded. The value of this attribute is null if the style sheet
|
||||
* has not yet been loaded or if it will not be loaded (e.g. if
|
||||
* the style sheet is for a media type not supported by the user
|
||||
* agent).
|
||||
*
|
||||
*/
|
||||
CSSStyleSheet styleSheet() const;
|
||||
};
|
||||
|
||||
class CSSMediaRuleImpl;
|
||||
/**
|
||||
* The \c CSSMediaRule interface represents a <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/media.html#at-media-rule">
|
||||
* \@media rule </a> in a CSS style sheet. A \c \@media rule
|
||||
* can be used to delimit style rules for specific media types.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSMediaRule : public CSSRule
|
||||
{
|
||||
public:
|
||||
CSSMediaRule();
|
||||
CSSMediaRule(const CSSMediaRule &other);
|
||||
CSSMediaRule(const CSSRule &other);
|
||||
CSSMediaRule(CSSMediaRuleImpl *impl);
|
||||
public:
|
||||
|
||||
CSSMediaRule & operator = (const CSSMediaRule &other);
|
||||
CSSMediaRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSMediaRule();
|
||||
|
||||
/**
|
||||
* A list of <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/media.html#media-types">
|
||||
* media types </a> for this rule.
|
||||
*
|
||||
*/
|
||||
MediaList media() const;
|
||||
|
||||
/**
|
||||
* A list of all CSS rules contained within the media block.
|
||||
*
|
||||
*/
|
||||
CSSRuleList cssRules() const;
|
||||
|
||||
/**
|
||||
* Used to insert a new rule into the media block.
|
||||
*
|
||||
* @param rule The parsable text representing the rule. For rule
|
||||
* sets this contains both the selector and the style declaration.
|
||||
* For at-rules, this specifies both the at-identifier and the
|
||||
* rule content.
|
||||
*
|
||||
* @param index The index within the media block's rule collection
|
||||
* of the rule before which to insert the specified rule. If the
|
||||
* specified index is equal to the length of the media blocks's
|
||||
* rule collection, the rule will be added to the end of the media
|
||||
* block.
|
||||
*
|
||||
* @return The index within the media block's rule collection of
|
||||
* the newly inserted rule.
|
||||
*
|
||||
* \exception DOMException
|
||||
* HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at
|
||||
* the specified index. e.g. if an \c \@import rule is
|
||||
* inserted after a standard rule set or other at-rule.
|
||||
*
|
||||
* INDEX_SIZE_ERR: Raised if the specified index is not a valid
|
||||
* insertion point.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
|
||||
* readonly.
|
||||
*
|
||||
* \exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified rule has a syntax error
|
||||
* and is unparsable.
|
||||
*
|
||||
*/
|
||||
unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index );
|
||||
|
||||
/**
|
||||
* Used to delete a rule from the media block.
|
||||
*
|
||||
* @param index The index within the media block's rule collection
|
||||
* of the rule to remove.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* \exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if the specified index does not
|
||||
* correspond to a rule in the media rule list.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void deleteRule ( unsigned long index );
|
||||
};
|
||||
|
||||
|
||||
class CSSPageRuleImpl;
|
||||
/**
|
||||
* The \c CSSPageRule interface represents a <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/page.html#page-box"> page rule
|
||||
* </a> within a CSS style sheet. The \c @page rule is
|
||||
* used to specify the dimensions, orientation, margins, etc. of a
|
||||
* page box for paged media.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSPageRule : public CSSRule
|
||||
{
|
||||
public:
|
||||
CSSPageRule();
|
||||
CSSPageRule(const CSSPageRule &other);
|
||||
CSSPageRule(const CSSRule &other);
|
||||
CSSPageRule(CSSPageRuleImpl *impl);
|
||||
public:
|
||||
|
||||
CSSPageRule & operator = (const CSSPageRule &other);
|
||||
CSSPageRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSPageRule();
|
||||
|
||||
/**
|
||||
* The parsable textual representation of the page selector for
|
||||
* the rule.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString selectorText() const;
|
||||
|
||||
/**
|
||||
* see selectorText
|
||||
* @exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified CSS string value has a
|
||||
* syntax error and is unparsable.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void setSelectorText( const DOM::DOMString & );
|
||||
|
||||
/**
|
||||
* The <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#q8">
|
||||
* declaration-block </a> of this rule.
|
||||
*
|
||||
*/
|
||||
CSSStyleDeclaration style() const;
|
||||
};
|
||||
|
||||
class CSSStyleRuleImpl;
|
||||
/**
|
||||
* The \c CSSStyleRule interface represents a single <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#q8"> rule set </a>
|
||||
* in a CSS style sheet.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSStyleRule : public CSSRule
|
||||
{
|
||||
public:
|
||||
CSSStyleRule();
|
||||
CSSStyleRule(const CSSStyleRule &other);
|
||||
CSSStyleRule(const CSSRule &other);
|
||||
CSSStyleRule(CSSStyleRuleImpl *impl);
|
||||
public:
|
||||
|
||||
CSSStyleRule & operator = (const CSSStyleRule &other);
|
||||
CSSStyleRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSStyleRule();
|
||||
|
||||
/**
|
||||
* The textual representation of the <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/selector.html"> selector
|
||||
* </a> for the rule set. The implementation may have stripped out
|
||||
* insignificant whitespace while parsing the selector.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString selectorText() const;
|
||||
|
||||
/**
|
||||
* see selectorText
|
||||
* @exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified CSS string value has a
|
||||
* syntax error and is unparsable.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void setSelectorText( const DOM::DOMString & );
|
||||
|
||||
/**
|
||||
* The <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#q8">
|
||||
* declaration-block </a> of this rule set.
|
||||
*
|
||||
*/
|
||||
CSSStyleDeclaration style() const;
|
||||
};
|
||||
|
||||
class CSSNamespaceRuleImpl;
|
||||
/**
|
||||
* The \c CSSNamespaceRule interface represents an @namespace rule
|
||||
* @since 4.6.0
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSNamespaceRule : public CSSRule
|
||||
{
|
||||
public:
|
||||
CSSNamespaceRule();
|
||||
CSSNamespaceRule(const CSSNamespaceRule &other);
|
||||
CSSNamespaceRule(const CSSRule &other);
|
||||
CSSNamespaceRule(CSSNamespaceRuleImpl *impl);
|
||||
|
||||
DOMString namespaceURI() const;
|
||||
DOMString prefix() const;
|
||||
public:
|
||||
|
||||
CSSNamespaceRule & operator = (const CSSNamespaceRule &other);
|
||||
CSSNamespaceRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSNamespaceRule();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class CSSUnknownRuleImpl;
|
||||
/**
|
||||
* The \c CSSUnkownRule interface represents an at-rule
|
||||
* not supported by this user agent.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSUnknownRule : public CSSRule
|
||||
{
|
||||
public:
|
||||
CSSUnknownRule();
|
||||
CSSUnknownRule(const CSSUnknownRule &other);
|
||||
CSSUnknownRule(const CSSRule &other);
|
||||
CSSUnknownRule(CSSUnknownRuleImpl *impl);
|
||||
public:
|
||||
|
||||
CSSUnknownRule & operator = (const CSSUnknownRule &other);
|
||||
CSSUnknownRule & operator = (const CSSRule &other);
|
||||
|
||||
~CSSUnknownRule();
|
||||
};
|
||||
|
||||
|
||||
class CSSRuleListImpl;
|
||||
class StyleListImpl;
|
||||
/**
|
||||
* The \c CSSRuleList interface provides the abstraction
|
||||
* of an ordered collection of CSS rules.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSRuleList
|
||||
{
|
||||
public:
|
||||
CSSRuleList();
|
||||
CSSRuleList(const CSSRuleList &other);
|
||||
CSSRuleList(CSSRuleListImpl *i);
|
||||
CSSRuleList(StyleListImpl *i);
|
||||
public:
|
||||
|
||||
CSSRuleList & operator = (const CSSRuleList &other);
|
||||
|
||||
~CSSRuleList();
|
||||
|
||||
/**
|
||||
* The number of \c CSSRule s in the list. The range
|
||||
* of valid child rule indices is \c 0 to
|
||||
* \c length-1 inclusive.
|
||||
*
|
||||
*/
|
||||
unsigned long length() const;
|
||||
|
||||
/**
|
||||
* Used to retrieve a CSS rule by ordinal index. The order in this
|
||||
* collection represents the order of the rules in the CSS style
|
||||
* sheet.
|
||||
*
|
||||
* @param index Index into the collection
|
||||
*
|
||||
* @return The style rule at the \c index position in
|
||||
* the \c CSSRuleList , or \c null if that
|
||||
* is not a valid index.
|
||||
*
|
||||
*/
|
||||
CSSRule item ( unsigned long index );
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
CSSRuleListImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
// we just need a pointer to an implementation here.
|
||||
CSSRuleListImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,499 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999-2003 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 2001-2003 Dirk Mueller (mueller@kde.org)
|
||||
* Copyright 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.
|
||||
*
|
||||
*/
|
||||
#include "dom/dom_exception.h"
|
||||
#include "dom/css_rule.h"
|
||||
#include "dom/dom_doc.h"
|
||||
|
||||
#include "xml/dom_docimpl.h"
|
||||
|
||||
#include "html/html_headimpl.h"
|
||||
|
||||
#include "css/css_stylesheetimpl.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace DOM;
|
||||
|
||||
StyleSheet::StyleSheet()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
StyleSheet::StyleSheet(const StyleSheet &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
StyleSheet::StyleSheet(StyleSheetImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
StyleSheet &StyleSheet::operator = (const StyleSheet &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
StyleSheet::~StyleSheet()
|
||||
{
|
||||
if(impl) impl->deref();
|
||||
}
|
||||
|
||||
DOMString StyleSheet::type() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((StyleSheetImpl *)impl)->type();
|
||||
}
|
||||
|
||||
bool StyleSheet::disabled() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((StyleSheetImpl *)impl)->disabled();
|
||||
}
|
||||
|
||||
void StyleSheet::setDisabled( bool _disabled )
|
||||
{
|
||||
if(impl)
|
||||
((StyleSheetImpl *)impl)->setDisabled( _disabled );
|
||||
}
|
||||
|
||||
DOM::Node StyleSheet::ownerNode() const
|
||||
{
|
||||
if(!impl) return Node();
|
||||
return ((StyleSheetImpl *)impl)->ownerNode();
|
||||
}
|
||||
|
||||
StyleSheet StyleSheet::parentStyleSheet() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((StyleSheetImpl *)impl)->parentStyleSheet();
|
||||
}
|
||||
|
||||
DOMString StyleSheet::href() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((StyleSheetImpl *)impl)->href();
|
||||
}
|
||||
|
||||
DOMString StyleSheet::title() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((StyleSheetImpl *)impl)->title();
|
||||
}
|
||||
|
||||
MediaList StyleSheet::media() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((StyleSheetImpl *)impl)->media();
|
||||
}
|
||||
|
||||
bool StyleSheet::isCSSStyleSheet() const
|
||||
{
|
||||
if(!impl) return false;
|
||||
return ((StyleSheetImpl *)impl)->isCSSStyleSheet();
|
||||
}
|
||||
|
||||
KUrl StyleSheet::baseUrl() {
|
||||
if(!impl) return KUrl();
|
||||
return ((StyleSheetImpl *)impl)->baseURL();
|
||||
}
|
||||
|
||||
DOMString CSSException::codeAsString() const
|
||||
{
|
||||
return codeAsString(code);
|
||||
}
|
||||
|
||||
bool CSSException::isCSSExceptionCode(int exceptioncode)
|
||||
{
|
||||
return exceptioncode >= _EXCEPTION_OFFSET && exceptioncode < _EXCEPTION_MAX;
|
||||
}
|
||||
|
||||
DOMString CSSException::codeAsString(int code)
|
||||
{
|
||||
switch ( code ) {
|
||||
case SYNTAX_ERR:
|
||||
return DOMString( "SYNTAX_ERR" );
|
||||
case INVALID_MODIFICATION_ERR:
|
||||
return DOMString( "INVALID_MODIFICATION_ERR" );
|
||||
default:
|
||||
return DOMString( "(unknown exception code)" );
|
||||
}
|
||||
}
|
||||
|
||||
CSSStyleSheet::CSSStyleSheet() : StyleSheet()
|
||||
{
|
||||
}
|
||||
|
||||
CSSStyleSheet::CSSStyleSheet(const CSSStyleSheet &other) : StyleSheet(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSStyleSheet::CSSStyleSheet(const StyleSheet &other)
|
||||
{
|
||||
if (!other.isCSSStyleSheet())
|
||||
impl = 0;
|
||||
else
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSStyleSheet::CSSStyleSheet(CSSStyleSheetImpl *impl) : StyleSheet(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSStyleSheet &CSSStyleSheet::operator = (const CSSStyleSheet &other)
|
||||
{
|
||||
StyleSheet::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSStyleSheet &CSSStyleSheet::operator = (const StyleSheet &other)
|
||||
{
|
||||
if(!other.handle()->isCSSStyleSheet())
|
||||
{
|
||||
if(impl) impl->deref();
|
||||
impl = 0;
|
||||
} else {
|
||||
StyleSheet::operator = (other);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSStyleSheet::~CSSStyleSheet()
|
||||
{
|
||||
}
|
||||
|
||||
CSSRule CSSStyleSheet::ownerRule() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSStyleSheetImpl *)impl)->ownerRule();
|
||||
}
|
||||
|
||||
CSSRuleList CSSStyleSheet::cssRules() const
|
||||
{
|
||||
if(!impl) return (CSSRuleListImpl*)0;
|
||||
return ((CSSStyleSheetImpl *)impl)->cssRules();
|
||||
}
|
||||
|
||||
unsigned long CSSStyleSheet::insertRule( const DOMString &rule, unsigned long index )
|
||||
{
|
||||
int exceptioncode = 0;
|
||||
if(!impl) return 0;
|
||||
unsigned long retval = ((CSSStyleSheetImpl *)impl)->insertRule( rule, index, exceptioncode );
|
||||
if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
|
||||
throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
|
||||
if ( exceptioncode )
|
||||
throw DOMException( exceptioncode );
|
||||
return retval;
|
||||
}
|
||||
|
||||
void CSSStyleSheet::deleteRule( unsigned long index )
|
||||
{
|
||||
int exceptioncode = 0;
|
||||
if(impl)
|
||||
((CSSStyleSheetImpl *)impl)->deleteRule( index, exceptioncode );
|
||||
if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
|
||||
throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
|
||||
if ( exceptioncode )
|
||||
throw DOMException( exceptioncode );
|
||||
}
|
||||
|
||||
DOM::DOMString CSSStyleSheet::charset() const {
|
||||
if(!impl) return DOMString();
|
||||
return static_cast<CSSStyleSheetImpl *>(impl)->charset();
|
||||
}
|
||||
|
||||
|
||||
StyleSheetList::StyleSheetList()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
StyleSheetList::StyleSheetList(const StyleSheetList &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
StyleSheetList::StyleSheetList(StyleSheetListImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
StyleSheetList &StyleSheetList::operator = (const StyleSheetList &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
StyleSheetList::~StyleSheetList()
|
||||
{
|
||||
if(impl) impl->deref();
|
||||
}
|
||||
|
||||
unsigned long StyleSheetList::length() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((StyleSheetListImpl *)impl)->length();
|
||||
}
|
||||
|
||||
StyleSheet StyleSheetList::item( unsigned long index )
|
||||
{
|
||||
if(!impl) return StyleSheet();
|
||||
return ((StyleSheetListImpl *)impl)->item( index );
|
||||
}
|
||||
|
||||
StyleSheetListImpl *StyleSheetList::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool StyleSheetList::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
MediaList::MediaList()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
MediaList::MediaList(const MediaList &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
MediaList::MediaList(MediaListImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
MediaList &MediaList::operator = (const MediaList &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
MediaList::~MediaList()
|
||||
{
|
||||
if(impl) impl->deref();
|
||||
}
|
||||
|
||||
DOM::DOMString MediaList::mediaText() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return static_cast<MediaListImpl *>(impl)->mediaText();
|
||||
}
|
||||
|
||||
void MediaList::setMediaText(const DOM::DOMString &value )
|
||||
{
|
||||
if(!impl)
|
||||
return;
|
||||
int exceptioncode = 0;
|
||||
static_cast<MediaListImpl *>(impl)->setMediaText( value, exceptioncode );
|
||||
if ( exceptioncode )
|
||||
throw DOMException( exceptioncode );
|
||||
}
|
||||
|
||||
unsigned long MediaList::length() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((MediaListImpl *)impl)->length();
|
||||
}
|
||||
|
||||
DOM::DOMString MediaList::item(unsigned long index) const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((MediaListImpl *)impl)->item( index );
|
||||
}
|
||||
|
||||
void MediaList::deleteMedium(const DOM::DOMString &oldMedium)
|
||||
{
|
||||
if(!impl)
|
||||
return;
|
||||
int exceptioncode = 0;
|
||||
((MediaListImpl *)impl)->deleteMedium( oldMedium, exceptioncode );
|
||||
if ( exceptioncode )
|
||||
throw DOMException( exceptioncode );
|
||||
}
|
||||
|
||||
void MediaList::appendMedium(const DOM::DOMString &newMedium)
|
||||
{
|
||||
if(!impl)
|
||||
return;
|
||||
int exceptioncode = 0;
|
||||
((MediaListImpl *)impl)->appendMedium( newMedium, exceptioncode );
|
||||
if ( exceptioncode )
|
||||
throw DOMException( exceptioncode );
|
||||
}
|
||||
|
||||
MediaListImpl *MediaList::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool MediaList::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
LinkStyle::LinkStyle()
|
||||
{
|
||||
node = 0;
|
||||
}
|
||||
|
||||
LinkStyle::LinkStyle(const LinkStyle &other)
|
||||
{
|
||||
node = other.node;
|
||||
if(node) node->ref();
|
||||
}
|
||||
|
||||
LinkStyle & LinkStyle::operator = (const LinkStyle &other)
|
||||
{
|
||||
if ( node != other.node ) {
|
||||
if(node) node->deref();
|
||||
node = other.node;
|
||||
if(node) node->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
LinkStyle & LinkStyle::operator = (const Node &other)
|
||||
{
|
||||
if(node) node->deref();
|
||||
node = 0;
|
||||
// ### add processing instructions
|
||||
NodeImpl *n = other.handle();
|
||||
|
||||
// ### check link is really linking a style sheet
|
||||
if( n && n->isElementNode() &&
|
||||
(n->id() == ID_STYLE || n->id() == ID_LINK) ) {
|
||||
node = n;
|
||||
if(node) node->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
LinkStyle::~LinkStyle()
|
||||
{
|
||||
if(node) node->deref();
|
||||
}
|
||||
|
||||
StyleSheet LinkStyle::sheet()
|
||||
{
|
||||
int id = node ? node->id() : 0;
|
||||
// ### add PI
|
||||
return
|
||||
( id == ID_STYLE) ?
|
||||
static_cast<HTMLStyleElementImpl *>(node)->sheet()
|
||||
: ( (id == ID_LINK) ?
|
||||
static_cast<HTMLLinkElementImpl *>(node)->sheet()
|
||||
: StyleSheet() );
|
||||
}
|
||||
|
||||
bool LinkStyle::isNull() const
|
||||
{
|
||||
return (node == 0);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
DocumentStyle::DocumentStyle()
|
||||
{
|
||||
doc = 0;
|
||||
}
|
||||
|
||||
DocumentStyle::DocumentStyle(const DocumentStyle &other)
|
||||
{
|
||||
doc = other.doc;
|
||||
if(doc) doc->ref();
|
||||
}
|
||||
|
||||
DocumentStyle & DocumentStyle::operator = (const DocumentStyle &other)
|
||||
{
|
||||
if ( doc != other.doc ) {
|
||||
if(doc) doc->deref();
|
||||
doc = other.doc;
|
||||
if(doc) doc->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
DocumentStyle & DocumentStyle::operator = (const Document &other)
|
||||
{
|
||||
DocumentImpl *odoc = static_cast<DocumentImpl *>(other.handle());
|
||||
if ( doc != odoc ) {
|
||||
if(doc) doc->deref();
|
||||
doc = odoc;
|
||||
if(doc) doc->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
DocumentStyle::~DocumentStyle()
|
||||
{
|
||||
if(doc) doc->deref();
|
||||
}
|
||||
|
||||
StyleSheetList DocumentStyle::styleSheets() const
|
||||
{
|
||||
return doc->styleSheets();
|
||||
}
|
||||
|
||||
DOMString DocumentStyle::preferredStylesheetSet() const
|
||||
{
|
||||
return doc->preferredStylesheetSet();
|
||||
}
|
||||
|
||||
void DocumentStyle::setSelectedStylesheetSet(const DOMString& aStr)
|
||||
{
|
||||
return doc->setSelectedStylesheetSet(aStr);
|
||||
}
|
||||
|
||||
DOMString DocumentStyle::selectedStylesheetSet() const
|
||||
{
|
||||
return doc->selectedStylesheetSet();
|
||||
}
|
|
@ -1,509 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 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.
|
||||
*
|
||||
* This file includes excerpts from the Document Object Model (DOM)
|
||||
* Level 2 Specification (Candidate Recommendation)
|
||||
* http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
|
||||
* Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef _CSS_css_stylesheet_h_
|
||||
#define _CSS_css_stylesheet_h_
|
||||
|
||||
#include <khtml_export.h>
|
||||
|
||||
#include <dom/dom_string.h>
|
||||
#include <dom/dom_node.h>
|
||||
#include <dom/dom_misc.h>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class StyleSheetImpl;
|
||||
class MediaList;
|
||||
class NodeImpl;
|
||||
class DocumentImpl;
|
||||
|
||||
/**
|
||||
* The \c StyleSheet interface is the abstract base
|
||||
* interface for any type of style sheet. It represents a single style
|
||||
* sheet associated with a structured document. In HTML, the
|
||||
* StyleSheet interface represents either an external style sheet,
|
||||
* included via the HTML <a
|
||||
* href="http://www.w3.org/TR/REC-html40/struct/links.html#h-12.3">
|
||||
* LINK </a> element, or an inline <a
|
||||
* href="http://www.w3.org/TR/REC-html40/present/styles.html#h-14.2.3">
|
||||
* STYLE </a> element. In XML, this interface represents an external
|
||||
* style sheet, included via a <a
|
||||
* href="http://www.w3.org/TR/xml-stylesheet"> style sheet processing
|
||||
* instruction </a> .
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT StyleSheet
|
||||
{
|
||||
public:
|
||||
StyleSheet();
|
||||
StyleSheet(const StyleSheet &other);
|
||||
StyleSheet(StyleSheetImpl *impl);
|
||||
public:
|
||||
|
||||
StyleSheet & operator = (const StyleSheet &other);
|
||||
|
||||
~StyleSheet();
|
||||
|
||||
/**
|
||||
* This specifies the style sheet language for this style sheet.
|
||||
* The style sheet language is specified as a content type (e.g.
|
||||
* "text/css"). The content type is often specified in the
|
||||
* \c ownerNode . A list of registered content types can be
|
||||
* found at <a
|
||||
* href="ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/">
|
||||
* ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/ </a> .
|
||||
* Also see the <a
|
||||
* href="http://www.w3.org/TR/REC-html40/struct/links.html#adef-type-A">
|
||||
* type attribute definition </a> for the \c LINK
|
||||
* element in HTML 4.0, and the type pseudo-attribute for the XML
|
||||
* <a href="http://www.w3.org/TR/xml-stylesheet"> style sheet
|
||||
* processing instruction </a> .
|
||||
*
|
||||
*/
|
||||
DOM::DOMString type() const;
|
||||
|
||||
/**
|
||||
* \c false if the style sheet is applied to the
|
||||
* document. \c true if it is not. Modifying this
|
||||
* attribute may cause a reresolution of style for the document.
|
||||
*
|
||||
*/
|
||||
bool disabled() const;
|
||||
|
||||
/**
|
||||
* see disabled
|
||||
*/
|
||||
void setDisabled( bool );
|
||||
|
||||
/**
|
||||
* The node that associates this style sheet with the document.
|
||||
* For HTML, this may be the corresponding \c LINK or
|
||||
* \c STYLE element. For XML, it may be the linking
|
||||
* processing instruction. For style sheets that are included by
|
||||
* other style sheets, this attribute has a value of null.
|
||||
*
|
||||
*/
|
||||
DOM::Node ownerNode() const;
|
||||
|
||||
/**
|
||||
* For style sheet languages that support the concept of style
|
||||
* sheet inclusion, this attribute represents the including style
|
||||
* sheet, if one exists. If the style sheet is a top-level style
|
||||
* sheet, or the style sheet language does not support inclusion,
|
||||
* the value of the attribute is null.
|
||||
*
|
||||
*/
|
||||
StyleSheet parentStyleSheet() const;
|
||||
|
||||
/**
|
||||
* If the style sheet is a linked style sheet, the value of its
|
||||
* attribute is its location. For inline style sheets, the value
|
||||
* of this attribute is null. See the <a
|
||||
* href="http://www.w3.org/TR/REC-html40/struct/links.html#adef-href">
|
||||
* href attribute definition </a> for the \c LINK
|
||||
* element in HTML 4.0, and the href pseudo-attribute for the XML
|
||||
* <a href="http://www.w3.org/TR/xml-stylesheet"> style sheet
|
||||
* processing instruction </a> .
|
||||
*
|
||||
*/
|
||||
DOM::DOMString href() const;
|
||||
|
||||
/**
|
||||
* The advisory title. The title is often specified in the
|
||||
* \c ownerNode . See the <a
|
||||
* href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-title">
|
||||
* title attribute definition </a> for the \c LINK
|
||||
* element in HTML 4.0, and the title pseudo-attribute for the XML
|
||||
* <a href="http://www.w3.org/TR/xml-stylesheet"> style sheet
|
||||
* processing instruction </a> .
|
||||
*
|
||||
*/
|
||||
DOM::DOMString title() const;
|
||||
|
||||
/**
|
||||
* The intended destination media for style information. The media
|
||||
* is often specified in the \c ownerNode . See the <a
|
||||
* href="http://www.w3.org/TR/REC-html40/present/styles.html#adef-media">
|
||||
* media attribute definition </a> for the \c LINK
|
||||
* element in HTML 4.0, and the media pseudo-attribute for the XML
|
||||
* <a href="http://www.w3.org/TR/WD-xml-stylesheet"> style sheet
|
||||
* processing instruction </a> .
|
||||
*
|
||||
*/
|
||||
MediaList media() const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
KUrl baseUrl();
|
||||
bool isCSSStyleSheet() const;
|
||||
StyleSheetImpl *handle() const { return impl; }
|
||||
bool isNull() const { return !impl; }
|
||||
protected:
|
||||
StyleSheetImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This exception is raised when a specific CSS operation is impossible
|
||||
* to perform.
|
||||
*/
|
||||
class KHTML_EXPORT CSSException
|
||||
{
|
||||
public:
|
||||
CSSException(unsigned short _code) { code = _code; }
|
||||
CSSException(const CSSException &other) { code = other.code; }
|
||||
|
||||
CSSException & operator = (const CSSException &other)
|
||||
{ code = other.code; return *this; }
|
||||
|
||||
virtual ~CSSException() {}
|
||||
/**
|
||||
* An integer indicating the type of error generated.
|
||||
*
|
||||
*/
|
||||
unsigned short code;
|
||||
|
||||
enum ExceptionCode
|
||||
{
|
||||
SYNTAX_ERR = 0,
|
||||
INVALID_MODIFICATION_ERR = 1,
|
||||
_EXCEPTION_OFFSET = 1000,
|
||||
_EXCEPTION_MAX = 1999
|
||||
};
|
||||
|
||||
/// Returns the name of this error
|
||||
DOMString codeAsString() const;
|
||||
|
||||
/// Returns the name of given error code
|
||||
static DOMString codeAsString(int cssCode);
|
||||
|
||||
/** @internal - checks to see whether internal code is a CSS one */
|
||||
static bool isCSSExceptionCode(int exceptioncode);
|
||||
};
|
||||
|
||||
class CSSStyleSheetImpl;
|
||||
class CSSRule;
|
||||
class CSSRuleList;
|
||||
|
||||
/**
|
||||
* The \c CSSStyleSheet interface is a concrete interface
|
||||
* used to represent a CSS style sheet i.e. a style sheet whose
|
||||
* content type is "text/css".
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSStyleSheet : public StyleSheet
|
||||
{
|
||||
public:
|
||||
CSSStyleSheet();
|
||||
CSSStyleSheet(const CSSStyleSheet &other);
|
||||
CSSStyleSheet(const StyleSheet &other);
|
||||
CSSStyleSheet(CSSStyleSheetImpl *impl);
|
||||
public:
|
||||
|
||||
CSSStyleSheet & operator = (const CSSStyleSheet &other);
|
||||
CSSStyleSheet & operator = (const StyleSheet &other);
|
||||
|
||||
~CSSStyleSheet();
|
||||
|
||||
/**
|
||||
* If this style sheet comes from an \c \@import rule,
|
||||
* the \c ownerRule attribute will contain the
|
||||
* \c CSSImportRule . In that case, the \c ownerNode
|
||||
* attribute in the \c StyleSheet interface
|
||||
* will be \c null . If the style sheet comes from an
|
||||
* element or a processing instruction, the \c ownerRule
|
||||
* attribute will be \c null and the
|
||||
* \c ownerNode attribute will contain the \c Node .
|
||||
*
|
||||
*/
|
||||
CSSRule ownerRule() const;
|
||||
|
||||
/**
|
||||
* The list of all CSS rules contained within the style sheet.
|
||||
* This includes both <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#q8"> rule sets
|
||||
* </a> and <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#at-rules">
|
||||
* at-rules </a> .
|
||||
*
|
||||
*/
|
||||
CSSRuleList cssRules() const;
|
||||
|
||||
/**
|
||||
* Used to insert a new rule into the style sheet. The new rule
|
||||
* now becomes part of the cascade.
|
||||
*
|
||||
* @param rule The parsable text representing the rule. For rule
|
||||
* sets this contains both the selector and the style declaration.
|
||||
* For at-rules, this specifies both the at-identifier and the
|
||||
* rule content.
|
||||
*
|
||||
* @param index The index within the style sheet's rule list of
|
||||
* the rule before which to insert the specified rule. If the
|
||||
* specified index is equal to the length of the style sheet's
|
||||
* rule collection, the rule will be added to the end of the style
|
||||
* sheet.
|
||||
*
|
||||
* @return The index within the style sheet's rule collection of
|
||||
* the newly inserted rule.
|
||||
*
|
||||
* @exception DOMException
|
||||
* HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at
|
||||
* the specified index e.g. if an \c \@import rule is
|
||||
* inserted after a standard rule set or other at-rule.
|
||||
*
|
||||
* INDEX_SIZE_ERR: Raised if the specified index is not a valid
|
||||
* insertion point.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
|
||||
* readonly.
|
||||
*
|
||||
* @exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified rule has a syntax error
|
||||
* and is unparsable.
|
||||
*
|
||||
*/
|
||||
unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index );
|
||||
|
||||
/**
|
||||
* Used to delete a rule from the style sheet.
|
||||
*
|
||||
* @param index The index within the style sheet's rule list of
|
||||
* the rule to remove.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if the specified index does not
|
||||
* correspond to a rule in the style sheet's rule list.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void deleteRule ( unsigned long index );
|
||||
|
||||
/** @internal */
|
||||
DOM::DOMString charset() const;
|
||||
};
|
||||
|
||||
|
||||
class StyleSheetListImpl;
|
||||
class StyleSheet;
|
||||
|
||||
/**
|
||||
* The \c StyleSheetList interface provides the
|
||||
* abstraction of an ordered collection of style sheets.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT StyleSheetList
|
||||
{
|
||||
public:
|
||||
StyleSheetList();
|
||||
StyleSheetList(const StyleSheetList &other);
|
||||
StyleSheetList(StyleSheetListImpl *impl);
|
||||
public:
|
||||
|
||||
StyleSheetList & operator = (const StyleSheetList &other);
|
||||
|
||||
~StyleSheetList();
|
||||
|
||||
/**
|
||||
* The number of \c StyleSheet in the list. The range
|
||||
* of valid child stylesheet indices is \c 0 to
|
||||
* \c length-1 inclusive.
|
||||
*
|
||||
*/
|
||||
unsigned long length() const;
|
||||
|
||||
/**
|
||||
* Used to retrieve a style sheet by ordinal index.
|
||||
*
|
||||
* @param index Index into the collection
|
||||
*
|
||||
* @return The style sheet at the \c index position in
|
||||
* the \c StyleSheetList , or \c null if
|
||||
* that is not a valid index.
|
||||
*
|
||||
*/
|
||||
StyleSheet item ( unsigned long index );
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
StyleSheetListImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
StyleSheetListImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
class MediaListImpl;
|
||||
class CSSRule;
|
||||
class CSSStyleSheet;
|
||||
|
||||
/**
|
||||
* The \c MediaList interface provides the abstraction of
|
||||
* an ordered collection of media, without defining or constraining
|
||||
* how this collection is implemented. All media are lowercase
|
||||
* strings.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT MediaList
|
||||
{
|
||||
public:
|
||||
MediaList();
|
||||
MediaList(const MediaList &other);
|
||||
MediaList(MediaListImpl *impl);
|
||||
public:
|
||||
|
||||
MediaList & operator = (const MediaList &other);
|
||||
|
||||
~MediaList();
|
||||
|
||||
/**
|
||||
* The parsable textual representation of the media list. This is a
|
||||
* comma-separated list of media.
|
||||
*
|
||||
* @exception DOMException
|
||||
* SYNTAX_ERR: Raised if the specified string value has a syntax error and
|
||||
* is unparsable.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is readonly.
|
||||
*/
|
||||
DOM::DOMString mediaText() const;
|
||||
|
||||
/**
|
||||
* see mediaText
|
||||
*/
|
||||
void setMediaText(const DOM::DOMString &value);
|
||||
|
||||
/**
|
||||
* The number of media in the list. The range of valid media is 0 to length-1 inclusive.
|
||||
*/
|
||||
unsigned long length() const;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the indexth in the list. If index is greater than or equal to
|
||||
* the number of media in the list, this returns null.
|
||||
*
|
||||
* @param index Index into the collection.
|
||||
*
|
||||
* @return The medium at the indexth position in the MediaList, or null if
|
||||
* that is not a valid index.
|
||||
*/
|
||||
DOM::DOMString item(unsigned long index) const;
|
||||
|
||||
/**
|
||||
* Deletes the medium indicated by oldMedium from the list.
|
||||
*
|
||||
* @param oldMedium The medium to delete in the media list.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
|
||||
*
|
||||
* NOT_FOUND_ERR: Raised if oldMedium is not in the list.
|
||||
*/
|
||||
void deleteMedium(const DOM::DOMString &oldMedium);
|
||||
|
||||
/**
|
||||
* Adds the medium newMedium to the end of the list. If the newMedium is
|
||||
* already used, it is first removed.
|
||||
*
|
||||
* @param newMedium The new medium to add.
|
||||
*
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: If the medium contains characters that are
|
||||
* invalid in the underlying style language.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
|
||||
*/
|
||||
void appendMedium(const DOM::DOMString &newMedium);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
MediaListImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
MediaListImpl *impl;
|
||||
};
|
||||
|
||||
class LinkStyleImpl;
|
||||
|
||||
class KHTML_EXPORT LinkStyle
|
||||
{
|
||||
public:
|
||||
LinkStyle();
|
||||
LinkStyle(const LinkStyle &other);
|
||||
|
||||
LinkStyle & operator = (const LinkStyle &other);
|
||||
LinkStyle & operator = (const Node &other);
|
||||
|
||||
~LinkStyle();
|
||||
|
||||
StyleSheet sheet();
|
||||
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
DOM::NodeImpl *node;
|
||||
LinkStyleImpl *impl;
|
||||
};
|
||||
|
||||
class DocumentStyleImpl;
|
||||
|
||||
class KHTML_EXPORT DocumentStyle
|
||||
{
|
||||
public:
|
||||
DocumentStyle();
|
||||
DocumentStyle(const DocumentStyle &other);
|
||||
|
||||
DocumentStyle & operator = (const DocumentStyle &other);
|
||||
DocumentStyle & operator = (const Document &other);
|
||||
|
||||
~DocumentStyle();
|
||||
|
||||
StyleSheetList styleSheets() const ;
|
||||
|
||||
DOMString preferredStylesheetSet() const;
|
||||
DOMString selectedStylesheetSet() const;
|
||||
void setSelectedStylesheetSet( const DOMString& aString );
|
||||
|
||||
bool isNull() const { return !impl; }
|
||||
|
||||
protected:
|
||||
DOM::DocumentImpl *doc;
|
||||
DocumentStyleImpl *impl;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,561 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 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 "dom/css_rule.h"
|
||||
#include "dom/dom_exception.h"
|
||||
|
||||
#include "css/css_renderstyledeclarationimpl.h"
|
||||
#include "css/css_valueimpl.h"
|
||||
|
||||
namespace DOM {
|
||||
|
||||
CSSStyleDeclaration::CSSStyleDeclaration()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
CSSStyleDeclaration::CSSStyleDeclaration(const CSSStyleDeclaration &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
CSSStyleDeclaration::CSSStyleDeclaration(CSSStyleDeclarationImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
CSSStyleDeclaration &CSSStyleDeclaration::operator = (const CSSStyleDeclaration &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSStyleDeclaration::~CSSStyleDeclaration()
|
||||
{
|
||||
if(impl) impl->deref();
|
||||
}
|
||||
|
||||
DOMString CSSStyleDeclaration::cssText() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return static_cast<CSSStyleDeclarationImpl *>(impl)->cssText();
|
||||
}
|
||||
|
||||
void CSSStyleDeclaration::setCssText( const DOMString &value )
|
||||
{
|
||||
if(!impl) return;
|
||||
impl->setCssText(value);
|
||||
}
|
||||
|
||||
DOMString CSSStyleDeclaration::getPropertyValue( const DOMString &propertyName ) const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return static_cast<CSSStyleDeclarationImpl *>(impl)->getPropertyValue(propertyName);
|
||||
}
|
||||
|
||||
CSSValue CSSStyleDeclaration::getPropertyCSSValue( const DOMString &propertyName ) const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return static_cast<CSSStyleDeclarationImpl *>(impl)->getPropertyCSSValue(propertyName);
|
||||
}
|
||||
|
||||
DOMString CSSStyleDeclaration::removeProperty( const DOMString &propertyName )
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return static_cast<CSSStyleDeclarationImpl *>(impl)->removeProperty(propertyName);
|
||||
}
|
||||
|
||||
DOMString CSSStyleDeclaration::getPropertyPriority( const DOMString &propertyName ) const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return impl->getPropertyPriority(propertyName);
|
||||
}
|
||||
|
||||
void CSSStyleDeclaration::setProperty( const DOMString &propName, const DOMString &value, const DOMString &priority )
|
||||
{
|
||||
if(!impl) return;
|
||||
if (value.isEmpty()) {
|
||||
static_cast<CSSStyleDeclarationImpl *>(impl)->removeProperty(propName);
|
||||
return;
|
||||
}
|
||||
static_cast<CSSStyleDeclarationImpl *>(impl)->setProperty( propName, value, priority );
|
||||
}
|
||||
|
||||
unsigned long CSSStyleDeclaration::length() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return static_cast<CSSStyleDeclarationImpl *>(impl)->length();
|
||||
}
|
||||
|
||||
DOMString CSSStyleDeclaration::item( unsigned long index )
|
||||
{
|
||||
return const_cast<const CSSStyleDeclaration*>( this )->item( index );
|
||||
}
|
||||
|
||||
DOMString CSSStyleDeclaration::item( unsigned long index ) const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return static_cast<CSSStyleDeclarationImpl *>(impl)->item( index );
|
||||
}
|
||||
CSSRule CSSStyleDeclaration::parentRule() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return static_cast<CSSStyleDeclarationImpl *>(impl)->parentRule();
|
||||
}
|
||||
|
||||
CSSStyleDeclarationImpl *CSSStyleDeclaration::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool CSSStyleDeclaration::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
CSSValue::CSSValue()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
CSSValue::CSSValue(const CSSValue &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
CSSValue::CSSValue(CSSValueImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
|
||||
CSSValue &CSSValue::operator = (const CSSValue &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSValue::~CSSValue()
|
||||
{
|
||||
if(impl) impl->deref();
|
||||
}
|
||||
|
||||
DOMString CSSValue::cssText() const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((CSSValueImpl *)impl)->cssText();
|
||||
}
|
||||
|
||||
void CSSValue::setCssText(const DOMString &value)
|
||||
{
|
||||
if(!impl) return;
|
||||
((CSSValueImpl *)impl)->setCssText(value);
|
||||
}
|
||||
|
||||
unsigned short CSSValue::cssValueType() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSValueImpl *)impl)->cssValueType();
|
||||
}
|
||||
|
||||
bool CSSValue::isCSSValueList() const
|
||||
{
|
||||
if(!impl) return false;
|
||||
return ((CSSValueImpl *)impl)->isValueList();
|
||||
}
|
||||
|
||||
bool CSSValue::isCSSPrimitiveValue() const
|
||||
{
|
||||
if(!impl) return false;
|
||||
return ((CSSValueImpl *)impl)->isPrimitiveValue();
|
||||
}
|
||||
|
||||
CSSValueImpl *CSSValue::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool CSSValue::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
CSSValueList::CSSValueList() : CSSValue()
|
||||
{
|
||||
}
|
||||
|
||||
CSSValueList::CSSValueList(const CSSValueList &other) : CSSValue(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSValueList::CSSValueList(const CSSValue &other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSValueList::CSSValueList(CSSValueListImpl *impl) : CSSValue(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSValueList &CSSValueList::operator = (const CSSValueList &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if (impl) impl->deref();
|
||||
impl = other.handle();
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSValueList &CSSValueList::operator = (const CSSValue &other)
|
||||
{
|
||||
CSSValueImpl *ohandle = other.handle() ;
|
||||
if ( impl != ohandle ) {
|
||||
if (impl) impl->deref();
|
||||
if (!other.isNull() && !other.isCSSValueList()) {
|
||||
impl = 0;
|
||||
} else {
|
||||
impl = ohandle;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSValueList::~CSSValueList()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned long CSSValueList::length() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSValueListImpl *)impl)->length();
|
||||
}
|
||||
|
||||
CSSValue CSSValueList::item( unsigned long index )
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSValueListImpl *)impl)->item( index );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
CSSPrimitiveValue::CSSPrimitiveValue() : CSSValue()
|
||||
{
|
||||
}
|
||||
|
||||
CSSPrimitiveValue::CSSPrimitiveValue(const CSSPrimitiveValue &other) : CSSValue(other)
|
||||
{
|
||||
}
|
||||
|
||||
CSSPrimitiveValue::CSSPrimitiveValue(const CSSValue &other) : CSSValue(other)
|
||||
{
|
||||
impl = 0;
|
||||
operator=(other);
|
||||
}
|
||||
|
||||
CSSPrimitiveValue::CSSPrimitiveValue(CSSPrimitiveValueImpl *impl) : CSSValue(impl)
|
||||
{
|
||||
}
|
||||
|
||||
CSSPrimitiveValue &CSSPrimitiveValue::operator = (const CSSPrimitiveValue &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if (impl) impl->deref();
|
||||
impl = other.handle();
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSPrimitiveValue &CSSPrimitiveValue::operator = (const CSSValue &other)
|
||||
{
|
||||
CSSValueImpl *ohandle = other.handle();
|
||||
if ( impl != ohandle ) {
|
||||
if (impl) impl->deref();
|
||||
if (!other.isNull() && !other.isCSSPrimitiveValue()) {
|
||||
impl = 0;
|
||||
} else {
|
||||
impl = ohandle;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSSPrimitiveValue::~CSSPrimitiveValue()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned short CSSPrimitiveValue::primitiveType() const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
return ((CSSPrimitiveValueImpl *)impl)->primitiveType();
|
||||
}
|
||||
|
||||
void CSSPrimitiveValue::setFloatValue( unsigned short unitType, float floatValue )
|
||||
{
|
||||
if(!impl) return;
|
||||
int exceptioncode = 0;
|
||||
((CSSPrimitiveValueImpl *)impl)->setFloatValue( unitType, floatValue, exceptioncode );
|
||||
if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
|
||||
throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
|
||||
if ( exceptioncode )
|
||||
throw DOMException( exceptioncode );
|
||||
}
|
||||
|
||||
float CSSPrimitiveValue::getFloatValue( unsigned short unitType ) const
|
||||
{
|
||||
if(!impl) return 0;
|
||||
// ### add unit conversion
|
||||
if(primitiveType() != unitType)
|
||||
throw CSSException(CSSException::SYNTAX_ERR);
|
||||
return ((CSSPrimitiveValueImpl *)impl)->floatValue( unitType );
|
||||
}
|
||||
|
||||
void CSSPrimitiveValue::setStringValue( unsigned short stringType, const DOMString &stringValue )
|
||||
{
|
||||
int exceptioncode = 0;
|
||||
if(impl)
|
||||
((CSSPrimitiveValueImpl *)impl)->setStringValue( stringType, stringValue, exceptioncode );
|
||||
if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
|
||||
throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
|
||||
if ( exceptioncode )
|
||||
throw DOMException( exceptioncode );
|
||||
|
||||
}
|
||||
|
||||
DOMString CSSPrimitiveValue::getStringValue( ) const
|
||||
{
|
||||
if(!impl) return DOMString();
|
||||
return ((CSSPrimitiveValueImpl *)impl)->getStringValue( );
|
||||
}
|
||||
|
||||
Counter CSSPrimitiveValue::getCounterValue( ) const
|
||||
{
|
||||
if(!impl) return Counter();
|
||||
return ((CSSPrimitiveValueImpl *)impl)->getCounterValue( );
|
||||
}
|
||||
|
||||
Rect CSSPrimitiveValue::getRectValue( ) const
|
||||
{
|
||||
if(!impl) return Rect();
|
||||
return ((CSSPrimitiveValueImpl *)impl)->getRectValue( );
|
||||
}
|
||||
|
||||
RGBColor CSSPrimitiveValue::getRGBColorValue( ) const
|
||||
{
|
||||
// ###
|
||||
return RGBColor();
|
||||
//if(!impl) return RGBColor();
|
||||
//return ((CSSPrimitiveValueImpl *)impl)->getRGBColorValue( );
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
Counter::Counter()
|
||||
{
|
||||
}
|
||||
|
||||
Counter::Counter(const Counter &/*other*/)
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
Counter &Counter::operator = (const Counter &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if (impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Counter::Counter(CounterImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
Counter::~Counter()
|
||||
{
|
||||
if (impl) impl->deref();
|
||||
}
|
||||
|
||||
DOMString Counter::identifier() const
|
||||
{
|
||||
if (!impl) return DOMString();
|
||||
return impl->identifier();
|
||||
}
|
||||
|
||||
DOMString Counter::listStyle() const
|
||||
{
|
||||
if (!impl) return DOMString();
|
||||
return khtml::stringForListStyleType((khtml::EListStyleType)impl->listStyle());
|
||||
}
|
||||
|
||||
DOMString Counter::separator() const
|
||||
{
|
||||
if (!impl) return DOMString();
|
||||
return impl->separator();
|
||||
}
|
||||
|
||||
CounterImpl *Counter::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool Counter::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
RGBColor::RGBColor()
|
||||
{
|
||||
}
|
||||
|
||||
RGBColor::RGBColor(const RGBColor &other)
|
||||
{
|
||||
m_color = other.m_color;
|
||||
}
|
||||
|
||||
RGBColor::RGBColor(QRgb color)
|
||||
{
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
RGBColor &RGBColor::operator = (const RGBColor &other)
|
||||
{
|
||||
m_color = other.m_color;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RGBColor::~RGBColor()
|
||||
{
|
||||
}
|
||||
|
||||
CSSPrimitiveValue RGBColor::red() const
|
||||
{
|
||||
return new CSSPrimitiveValueImpl(float(qAlpha(m_color) ? qRed(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
|
||||
}
|
||||
|
||||
CSSPrimitiveValue RGBColor::green() const
|
||||
{
|
||||
return new CSSPrimitiveValueImpl(float(qAlpha(m_color) ? qGreen(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
|
||||
}
|
||||
|
||||
CSSPrimitiveValue RGBColor::blue() const
|
||||
{
|
||||
return new CSSPrimitiveValueImpl(float(qAlpha(m_color) ? qBlue(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
Rect::Rect()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
Rect::Rect(const Rect &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
Rect::Rect(RectImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
Rect &Rect::operator = (const Rect &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if (impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rect::~Rect()
|
||||
{
|
||||
if (impl) impl->deref();
|
||||
}
|
||||
|
||||
CSSPrimitiveValue Rect::top() const
|
||||
{
|
||||
if (!impl) return 0;
|
||||
return impl->top();
|
||||
}
|
||||
|
||||
CSSPrimitiveValue Rect::right() const
|
||||
{
|
||||
if (!impl) return 0;
|
||||
return impl->right();
|
||||
}
|
||||
|
||||
CSSPrimitiveValue Rect::bottom() const
|
||||
{
|
||||
if (!impl) return 0;
|
||||
return impl->bottom();
|
||||
}
|
||||
|
||||
CSSPrimitiveValue Rect::left() const
|
||||
{
|
||||
if (!impl) return 0;
|
||||
return impl->left();
|
||||
}
|
||||
|
||||
RectImpl *Rect::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool Rect::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
@ -1,743 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 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.
|
||||
*
|
||||
* This file includes excerpts from the Document Object Model (DOM)
|
||||
* Level 2 Specification (Style)
|
||||
* http://www.w3.org/TR/DOM-Level-2-Style/
|
||||
* Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef _CSS_css_value_h_
|
||||
#define _CSS_css_value_h_
|
||||
|
||||
#include <dom/dom_string.h>
|
||||
|
||||
#include <QtGui/QColor>
|
||||
|
||||
#include <kdemacros.h>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class CSSStyleDeclarationImpl;
|
||||
class CSSRule;
|
||||
class CSSValue;
|
||||
|
||||
/**
|
||||
* The \c CSSStyleDeclaration interface represents a
|
||||
* single <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#block">
|
||||
* CSS declaration block </a> . This interface may be used to
|
||||
* determine the style properties currently set in a block or to set
|
||||
* style properties explicitly within the block.
|
||||
*
|
||||
* While an implementation may not recognize all CSS properties
|
||||
* within a CSS declaration block, it is expected to provide access to
|
||||
* all specified properties through the \c CSSStyleDeclaration
|
||||
* interface. Furthermore, implementations that support a
|
||||
* specific level of CSS should correctly handle <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/about.html#shorthand"> CSS
|
||||
* shorthand </a> properties for that level. For a further discussion
|
||||
* of shorthand properties, see the \c CSS2Properties
|
||||
* interface.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSStyleDeclaration
|
||||
{
|
||||
public:
|
||||
CSSStyleDeclaration();
|
||||
CSSStyleDeclaration(const CSSStyleDeclaration &other);
|
||||
CSSStyleDeclaration(CSSStyleDeclarationImpl *impl);
|
||||
public:
|
||||
|
||||
CSSStyleDeclaration & operator = (const CSSStyleDeclaration &other);
|
||||
|
||||
~CSSStyleDeclaration();
|
||||
|
||||
/**
|
||||
* The parsable textual representation of the declaration block
|
||||
* (including the surrounding curly braces). Setting this
|
||||
* attribute will result in the parsing of the new value and
|
||||
* resetting of the properties in the declaration block.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString cssText() const;
|
||||
|
||||
/**
|
||||
* see cssText
|
||||
* @exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified CSS string value has a
|
||||
* syntax error and is unparsable.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void setCssText( const DOM::DOMString & );
|
||||
|
||||
/**
|
||||
* The number of properties that have been explicitly set in this
|
||||
* declaration block.
|
||||
*
|
||||
*/
|
||||
unsigned long length() const;
|
||||
|
||||
/**
|
||||
* The CSS rule that contains this declaration block.
|
||||
*
|
||||
*/
|
||||
CSSRule parentRule() const;
|
||||
|
||||
/**
|
||||
* Used to retrieve the value of a CSS property if it has been
|
||||
* explicitly set within this declaration block.
|
||||
*
|
||||
* @param propertyName The name of the CSS property. See the <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/propidx.html"> CSS property
|
||||
* index </a> .
|
||||
*
|
||||
* @return Returns the value of the property if it has been
|
||||
* explicitly set for this declaration block. Returns the empty
|
||||
* string if the property has not been set.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName ) const;
|
||||
|
||||
/**
|
||||
* Used to retrieve the object representation of the value of a
|
||||
* CSS property if it has been explicitly set within this
|
||||
* declaration block. This method returns null if the property is
|
||||
* a <a href="http://www.w3.org/TR/REC-CSS2/about.html#shorthand">
|
||||
* shorthand </a> property. Shorthand property values can only be
|
||||
* accessed and modified as strings, using the
|
||||
* \c getPropertyValue and \c setProperty
|
||||
* methods.
|
||||
*
|
||||
* @param propertyName The name of the CSS property. See the <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/propidx.html"> CSS property
|
||||
* index </a> .
|
||||
*
|
||||
* @return Returns the value of the property if it has been
|
||||
* explicitly set for this declaration block. Returns the
|
||||
* \c null if the property has not been set.
|
||||
*
|
||||
*/
|
||||
CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName ) const;
|
||||
|
||||
/**
|
||||
* Used to remove a CSS property if it has been explicitly set
|
||||
* within this declaration block.
|
||||
*
|
||||
* @param propertyName The name of the CSS property. See the <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/propidx.html"> CSS property
|
||||
* index </a> .
|
||||
*
|
||||
* @return Returns the value of the property if it has been
|
||||
* explicitly set for this declaration block. Returns the empty
|
||||
* string if the property has not been set or the property name
|
||||
* does not correspond to a valid CSS2 property.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
|
||||
|
||||
/**
|
||||
* Used to retrieve the priority of a CSS property (e.g. the
|
||||
* \c "important" qualifier) if the property has been
|
||||
* explicitly set in this declaration block.
|
||||
*
|
||||
* @param propertyName The name of the CSS property. See the <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/propidx.html"> CSS property
|
||||
* index </a> .
|
||||
*
|
||||
* @return A string representing the priority (e.g.
|
||||
* \c "important" ) if one exists. The empty string if none
|
||||
* exists.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName ) const;
|
||||
|
||||
/**
|
||||
* Used to set a property value and priority within this
|
||||
* declaration block.
|
||||
*
|
||||
* @param propertyName The name of the CSS property. See the <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/propidx.html"> CSS property
|
||||
* index </a> .
|
||||
*
|
||||
* @param value The new value of the property.
|
||||
*
|
||||
* @param priority The new priority of the property (e.g.
|
||||
* \c "important" ).
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified value has a syntax error
|
||||
* and is unparsable.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
|
||||
|
||||
/**
|
||||
* Used to retrieve the properties that have been explicitly set
|
||||
* in this declaration block. The order of the properties
|
||||
* retrieved using this method does not have to be the order in
|
||||
* which they were set. This method can be used to iterate over
|
||||
* all properties in this declaration block.
|
||||
*
|
||||
* @param index Index of the property name to retrieve.
|
||||
*
|
||||
* @return The name of the property at this ordinal position. The
|
||||
* empty string if no property exists at this position.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString item ( unsigned long index ) const;
|
||||
DOM::DOMString item ( unsigned long index ); // ### KDE5: remove
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
CSSStyleDeclarationImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
CSSStyleDeclarationImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
class CSSValueImpl;
|
||||
|
||||
/**
|
||||
* The \c CSSValue interface represents a simple or a
|
||||
* complexe value.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSValue
|
||||
{
|
||||
public:
|
||||
CSSValue();
|
||||
CSSValue(const CSSValue &other);
|
||||
CSSValue(CSSValueImpl *impl);
|
||||
public:
|
||||
|
||||
CSSValue & operator = (const CSSValue &other);
|
||||
|
||||
~CSSValue();
|
||||
/**
|
||||
* An integer indicating which type of unit applies to the value.
|
||||
*
|
||||
* All CSS2 constants are not supposed to be required by the
|
||||
* implementation since all CSS2 interfaces are optionals.
|
||||
*
|
||||
*/
|
||||
enum UnitTypes {
|
||||
CSS_INHERIT = 0,
|
||||
CSS_PRIMITIVE_VALUE = 1,
|
||||
CSS_VALUE_LIST = 2,
|
||||
CSS_CUSTOM = 3,
|
||||
CSS_INITIAL = 4,
|
||||
|
||||
CSS_SVG_VALUE = 1001 ///< Not part of DOM
|
||||
};
|
||||
|
||||
/**
|
||||
* A string representation of the current value.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString cssText() const;
|
||||
|
||||
/**
|
||||
* see cssText
|
||||
* @exception CSSException
|
||||
* SYNTAX_ERR: Raised if the specified CSS string value has a
|
||||
* syntax error and is unparsable.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void setCssText( const DOM::DOMString & );
|
||||
|
||||
/**
|
||||
* A code defining the type of the value as defined above.
|
||||
*
|
||||
*/
|
||||
unsigned short cssValueType() const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
bool isCSSValueList() const;
|
||||
bool isCSSPrimitiveValue() const;
|
||||
CSSValueImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
CSSValueImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
class CSSValueListImpl;
|
||||
class CSSValue;
|
||||
|
||||
/**
|
||||
* The \c CSSValueList interface provides the absraction
|
||||
* of an ordered collection of CSS values.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSValueList : public CSSValue
|
||||
{
|
||||
public:
|
||||
CSSValueList();
|
||||
CSSValueList(const CSSValueList &other);
|
||||
CSSValueList(const CSSValue &other);
|
||||
CSSValueList(CSSValueListImpl *impl);
|
||||
public:
|
||||
|
||||
CSSValueList & operator = (const CSSValueList &other);
|
||||
CSSValueList & operator = (const CSSValue &other);
|
||||
|
||||
~CSSValueList();
|
||||
|
||||
/**
|
||||
* The number of \c CSSValue s in the list. The range
|
||||
* of valid values indices is \c 0 to \c length-1
|
||||
* inclusive.
|
||||
*
|
||||
*/
|
||||
unsigned long length() const;
|
||||
|
||||
/**
|
||||
* Used to retrieve a CSS rule by ordinal index. The order in this
|
||||
* collection represents the order of the values in the CSS style
|
||||
* property.
|
||||
*
|
||||
* @param index Index into the collection.
|
||||
*
|
||||
* @return The style rule at the \c index position in
|
||||
* the \c CSSValueList , or \c null if
|
||||
* that is not valid index.
|
||||
*
|
||||
*/
|
||||
CSSValue item ( unsigned long index );
|
||||
|
||||
protected:
|
||||
CSSValueListImpl *vimpl;
|
||||
};
|
||||
|
||||
|
||||
class CSSPrimitiveValueImpl;
|
||||
class Counter;
|
||||
class RGBColor;
|
||||
class Rect;
|
||||
|
||||
/**
|
||||
* The \c CSSPrimitiveValue interface represents a single
|
||||
* <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#values"> CSS
|
||||
* value </a> . This interface may be used to determine the value of a
|
||||
* specific style property currently set in a block or to set a
|
||||
* specific style properties explicitly within the block. An instance
|
||||
* of this interface can be obtained from the
|
||||
* \c getPropertyCSSValue method of the
|
||||
* \c CSSStyleDeclaration interface.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT CSSPrimitiveValue : public CSSValue
|
||||
{
|
||||
public:
|
||||
CSSPrimitiveValue();
|
||||
CSSPrimitiveValue(const CSSPrimitiveValue &other);
|
||||
CSSPrimitiveValue(const CSSValue &other);
|
||||
CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
|
||||
public:
|
||||
|
||||
CSSPrimitiveValue & operator = (const CSSPrimitiveValue &other);
|
||||
CSSPrimitiveValue & operator = (const CSSValue &other);
|
||||
|
||||
~CSSPrimitiveValue();
|
||||
/**
|
||||
* An integer indicating which type of unit applies to the value.
|
||||
*
|
||||
*/
|
||||
enum UnitTypes {
|
||||
CSS_UNKNOWN = 0,
|
||||
CSS_NUMBER = 1,
|
||||
CSS_PERCENTAGE = 2,
|
||||
CSS_EMS = 3,
|
||||
CSS_EXS = 4,
|
||||
CSS_CHS = 5,
|
||||
CSS_REMS = 6,
|
||||
CSS_PX = 7,
|
||||
CSS_CM = 8,
|
||||
CSS_MM = 9,
|
||||
CSS_IN = 10,
|
||||
CSS_PT = 11,
|
||||
CSS_PC = 12,
|
||||
CSS_DEG = 13,
|
||||
CSS_RAD = 14,
|
||||
CSS_GRAD = 15,
|
||||
CSS_MS = 16,
|
||||
CSS_S = 17,
|
||||
CSS_HZ = 18,
|
||||
CSS_KHZ = 19,
|
||||
CSS_DIMENSION = 20,
|
||||
CSS_STRING = 21,
|
||||
CSS_URI = 22,
|
||||
CSS_IDENT = 23,
|
||||
CSS_ATTR = 24,
|
||||
CSS_COUNTER = 25,
|
||||
CSS_RECT = 26,
|
||||
CSS_RGBCOLOR = 27,
|
||||
CSS_DPI = 28,
|
||||
CSS_DPCM = 29,
|
||||
CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs
|
||||
CSS_HTML_RELATIVE = 255
|
||||
};
|
||||
|
||||
/**
|
||||
* The type of the value as defined by the constants specified
|
||||
* above.
|
||||
*
|
||||
*/
|
||||
unsigned short primitiveType() const;
|
||||
|
||||
/**
|
||||
* A method to set the float value with a specified unit. If the
|
||||
* property attached with this value can not accept the specified
|
||||
* unit or the float value, the value will be unchanged and a
|
||||
* \c DOMException will be raised.
|
||||
*
|
||||
* @param unitType A unit code as defined above. The unit code can
|
||||
* only be a float unit type (e.g. \c NUMBER ,
|
||||
* \c PERCENTAGE , \c CSS_EMS , \c CSS_EXS
|
||||
* , \c CSS_PX , \c CSS_PX ,
|
||||
* \c CSS_CM , \c CSS_MM , \c CSS_IN
|
||||
* , \c CSS_PT , \c CSS_PC ,
|
||||
* \c CSS_DEG , \c CSS_RAD ,
|
||||
* \c CSS_GRAD , \c CSS_MS , \c CSS_S
|
||||
* , \c CSS_HZ , \c CSS_KHZ ,
|
||||
* \c CSS_DIMENSION ).
|
||||
*
|
||||
* @param floatValue The new float value.
|
||||
*
|
||||
* @return
|
||||
* @exception DOMException
|
||||
* INVALID_ACCESS_ERR: Raises if the attached property doesn't
|
||||
* support the float value or the unit type.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void setFloatValue ( unsigned short unitType, float floatValue );
|
||||
|
||||
/**
|
||||
* This method is used to get a float value in a specified unit.
|
||||
* If this CSS value doesn't contain a float value or can't be
|
||||
* converted into the specified unit, a \c DOMException
|
||||
* is raised.
|
||||
*
|
||||
* @param unitType A unit code to get the float value. The unit
|
||||
* code can only be a float unit type (e.g. \c CSS_NUMBER
|
||||
* , \c CSS_PERCENTAGE , \c CSS_EMS
|
||||
* , \c CSS_EXS , \c CSS_PX ,
|
||||
* \c CSS_PX , \c CSS_CM , \c CSS_MM
|
||||
* , \c CSS_IN , \c CSS_PT ,
|
||||
* \c CSS_PC , \c CSS_DEG , \c CSS_RAD
|
||||
* , \c CSS_GRAD , \c CSS_MS ,
|
||||
* \c CSS_S , \c CSS_HZ , \c CSS_KHZ
|
||||
* , \c CSS_DIMENSION ).
|
||||
*
|
||||
* @return The float value in the specified unit.
|
||||
*
|
||||
* @exception DOMException
|
||||
* INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a
|
||||
* float value or if the float value can't be converted into the
|
||||
* specified unit.
|
||||
*
|
||||
*/
|
||||
float getFloatValue ( unsigned short unitType ) const;
|
||||
|
||||
/**
|
||||
* A method to set the string value with a specified unit. If the
|
||||
* property attached to this value can't accept the specified unit
|
||||
* or the string value, the value will be unchanged and a
|
||||
* \c DOMException will be raised.
|
||||
*
|
||||
* @param stringType A string code as defined above. The string
|
||||
* code can only be a string unit type (e.g. \c CSS_URI
|
||||
* , \c CSS_IDENT , \c CSS_INHERIT
|
||||
* and \c CSS_ATTR ).
|
||||
*
|
||||
* @param stringValue The new string value. If the
|
||||
* \c stringType is equal to \c CSS_INHERIT , the
|
||||
* \c stringValue should be \c inherit .
|
||||
*
|
||||
* @return
|
||||
* @exception DOMException
|
||||
* INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a
|
||||
* string value or if the string value can't be converted into the
|
||||
* specified unit.
|
||||
*
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
|
||||
* readonly.
|
||||
*
|
||||
*/
|
||||
void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
|
||||
|
||||
/**
|
||||
* This method is used to get the string value in a specified
|
||||
* unit. If the CSS value doesn't contain a string value, a
|
||||
* \c DOMException is raised.
|
||||
*
|
||||
* @return The string value in the current unit. The current
|
||||
* \c valueType can only be a string unit type (e.g.
|
||||
* \c CSS_URI , \c CSS_IDENT and
|
||||
* \c CSS_ATTR ).
|
||||
*
|
||||
* @exception DOMException
|
||||
* INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a
|
||||
* string value.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString getStringValue ( ) const;
|
||||
|
||||
/**
|
||||
* This method is used to get the Counter value. If this CSS value
|
||||
* doesn't contain a counter value, a \c DOMException
|
||||
* is raised. Modification to the corresponding style property can
|
||||
* be achieved using the \c Counter interface.
|
||||
*
|
||||
* @return The Counter value.
|
||||
*
|
||||
* @exception DOMException
|
||||
* INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a
|
||||
* Counter value.
|
||||
*
|
||||
*/
|
||||
Counter getCounterValue ( ) const;
|
||||
|
||||
/**
|
||||
* This method is used to get the Rect value. If this CSS value
|
||||
* doesn't contain a rect value, a \c DOMException is
|
||||
* raised. Modification to the corresponding style property can be
|
||||
* achieved using the \c Rect interface.
|
||||
*
|
||||
* @return The Rect value.
|
||||
*
|
||||
* @exception DOMException
|
||||
* INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a
|
||||
* Rect value.
|
||||
*
|
||||
*/
|
||||
Rect getRectValue ( ) const;
|
||||
|
||||
/**
|
||||
* This method is used to get the RGB color. If this CSS value
|
||||
* doesn't contain a RGB color value, a \c DOMException
|
||||
* is raised. Modification to the corresponding style
|
||||
* property can be achieved using the \c RGBColor
|
||||
* interface.
|
||||
*
|
||||
* @return the RGB color value.
|
||||
*
|
||||
* @exception DOMException
|
||||
* INVALID_ACCESS_ERR: Raises if the attached property can't
|
||||
* return a RGB color value.
|
||||
*
|
||||
*/
|
||||
RGBColor getRGBColorValue ( ) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The \c RGBColor interface is used to represent any <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-color">
|
||||
* RGB color </a> value. This interface reflects the values in the
|
||||
* underlying style property. Hence, modifications made through this
|
||||
* interface modify the style property.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT RGBColor
|
||||
{
|
||||
public:
|
||||
RGBColor();
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
RGBColor(const QColor& c) { m_color = c.rgb(); }
|
||||
RGBColor(QRgb color);
|
||||
|
||||
RGBColor(const RGBColor &other);
|
||||
RGBColor & operator = (const RGBColor &other);
|
||||
|
||||
~RGBColor();
|
||||
|
||||
/**
|
||||
* This attribute is used for the red value of the RGB color.
|
||||
*
|
||||
*/
|
||||
CSSPrimitiveValue red() const;
|
||||
|
||||
/**
|
||||
* This attribute is used for the green value of the RGB color.
|
||||
*
|
||||
*/
|
||||
CSSPrimitiveValue green() const;
|
||||
|
||||
/**
|
||||
* This attribute is used for the blue value of the RGB color.
|
||||
*
|
||||
*/
|
||||
CSSPrimitiveValue blue() const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
QRgb color() const { return m_color; }
|
||||
protected:
|
||||
QRgb m_color;
|
||||
};
|
||||
|
||||
class RectImpl;
|
||||
|
||||
/**
|
||||
* The \c Rect interface is used to represent any <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/visufx.html#value-def-shape">
|
||||
* rect </a> value. This interface reflects the values in the
|
||||
* underlying style property. Hence, modifications made through this
|
||||
* interface modify the style property.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT Rect
|
||||
{
|
||||
friend class CSSPrimitiveValue;
|
||||
public:
|
||||
Rect();
|
||||
Rect(const Rect &other);
|
||||
|
||||
Rect & operator = (const Rect &other);
|
||||
|
||||
~Rect();
|
||||
|
||||
/**
|
||||
* This attribute is used for the top of the rect.
|
||||
*
|
||||
*/
|
||||
CSSPrimitiveValue top() const;
|
||||
|
||||
/**
|
||||
* This attribute is used for the right of the rect.
|
||||
*
|
||||
*/
|
||||
CSSPrimitiveValue right() const;
|
||||
|
||||
/**
|
||||
* This attribute is used for the bottom of the rect.
|
||||
*
|
||||
*/
|
||||
CSSPrimitiveValue bottom() const;
|
||||
|
||||
/**
|
||||
* This attribute is used for the left of the rect.
|
||||
*
|
||||
*/
|
||||
CSSPrimitiveValue left() const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
RectImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
RectImpl *impl;
|
||||
Rect(RectImpl *i);
|
||||
};
|
||||
|
||||
class CounterImpl;
|
||||
|
||||
/**
|
||||
* The \c Counter interface is used to represent any <a
|
||||
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-counter">
|
||||
* counter or counters function </a> value. This interface reflects
|
||||
* the values in the underlying style property. Hence, modifications
|
||||
* made through this interface modify the style property.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT Counter
|
||||
{
|
||||
friend class CSSPrimitiveValue;
|
||||
public:
|
||||
Counter();
|
||||
Counter(const Counter &other);
|
||||
public:
|
||||
|
||||
Counter & operator = (const Counter &other);
|
||||
|
||||
~Counter();
|
||||
|
||||
/**
|
||||
* This attribute is used for the identifier of the counter.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString identifier() const;
|
||||
|
||||
/**
|
||||
* This attribute is used for the style of the list.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString listStyle() const;
|
||||
|
||||
/**
|
||||
* This attribute is used for the separator of nested counters.
|
||||
*
|
||||
*/
|
||||
DOM::DOMString separator() const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
CounterImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
CounterImpl *impl;
|
||||
Counter(CounterImpl *i);
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
#endif
|
|
@ -1,717 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 2001 Peter Kelly (pmk@post.com)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dom/dom2_views.h"
|
||||
#include "dom/dom_exception.h"
|
||||
#include "xml/dom2_eventsimpl.h"
|
||||
#include "xml/dom_nodeimpl.h"
|
||||
|
||||
using namespace DOM;
|
||||
|
||||
EventListener::EventListener()
|
||||
{
|
||||
}
|
||||
|
||||
EventListener::~EventListener()
|
||||
{
|
||||
}
|
||||
|
||||
void EventListener::handleEvent(Event &/*evt*/)
|
||||
{
|
||||
}
|
||||
|
||||
DOMString EventListener::eventListenerType()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Event::Event()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
|
||||
Event::Event(const Event &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
Event::Event(EventImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
Event::~Event()
|
||||
{
|
||||
if (impl) impl->deref();
|
||||
}
|
||||
|
||||
Event &Event::operator = (const Event &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
DOMString Event::type() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->type();
|
||||
}
|
||||
|
||||
Node Event::target() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
if (impl->target()->eventTargetType() == EventTargetImpl::DOM_NODE)
|
||||
return static_cast<DOM::NodeImpl*>(impl->target());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node Event::currentTarget() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
if (impl->currentTarget()->eventTargetType() == EventTargetImpl::DOM_NODE)
|
||||
return static_cast<DOM::NodeImpl*>(impl->currentTarget());
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned short Event::eventPhase() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->eventPhase();
|
||||
}
|
||||
|
||||
bool Event::bubbles() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->bubbles();
|
||||
}
|
||||
|
||||
bool Event::cancelable() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->cancelable();
|
||||
}
|
||||
|
||||
DOMTimeStamp Event::timeStamp() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->timeStamp();
|
||||
}
|
||||
|
||||
void Event::stopPropagation()
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
impl->stopPropagation(true);
|
||||
}
|
||||
|
||||
void Event::preventDefault()
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
impl->preventDefault(true);
|
||||
}
|
||||
|
||||
void Event::initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg)
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
impl->initEvent(eventTypeArg,canBubbleArg,cancelableArg);
|
||||
}
|
||||
|
||||
EventImpl *Event::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool Event::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#ifndef SAVE_SPACE
|
||||
|
||||
EventException::EventException(unsigned short _code)
|
||||
{
|
||||
code = _code;
|
||||
}
|
||||
|
||||
EventException::EventException(const EventException &other)
|
||||
{
|
||||
code = other.code;
|
||||
}
|
||||
|
||||
EventException & EventException::operator = (const EventException &other)
|
||||
{
|
||||
code = other.code;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
DOMString EventException::codeAsString() const
|
||||
{
|
||||
return codeAsString(code);
|
||||
}
|
||||
|
||||
bool EventException::isEventExceptionCode(int exceptioncode)
|
||||
{
|
||||
return exceptioncode >= _EXCEPTION_OFFSET && exceptioncode < _EXCEPTION_MAX;
|
||||
}
|
||||
|
||||
DOMString EventException::codeAsString(int code)
|
||||
{
|
||||
switch ( code ) {
|
||||
case UNSPECIFIED_EVENT_TYPE_ERR:
|
||||
return DOMString( "UNSPECIFIED_EVENT_TYPE_ERR" );
|
||||
default:
|
||||
return DOMString( "(unknown exception code)" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
UIEvent::UIEvent() : Event()
|
||||
{
|
||||
}
|
||||
|
||||
UIEvent::UIEvent(const UIEvent &other) : Event(other)
|
||||
{
|
||||
}
|
||||
|
||||
UIEvent::UIEvent(const Event &other) : Event()
|
||||
{
|
||||
(*this)=other;
|
||||
}
|
||||
|
||||
UIEvent::UIEvent(UIEventImpl *impl) : Event(impl)
|
||||
{
|
||||
}
|
||||
|
||||
UIEvent &UIEvent::operator = (const UIEvent &other)
|
||||
{
|
||||
Event::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
UIEvent &UIEvent::operator = (const Event &other)
|
||||
{
|
||||
Event e;
|
||||
e = other;
|
||||
if (!e.isNull() && !e.handle()->isUIEvent()) {
|
||||
if ( impl ) impl->deref();
|
||||
impl = 0;
|
||||
} else
|
||||
Event::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
UIEvent::~UIEvent()
|
||||
{
|
||||
}
|
||||
|
||||
AbstractView UIEvent::view() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<UIEventImpl*>(impl)->view();
|
||||
}
|
||||
|
||||
long UIEvent::detail() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<UIEventImpl*>(impl)->detail();
|
||||
}
|
||||
|
||||
int UIEvent::keyCode() const
|
||||
{
|
||||
if ( !impl ) throw DOMException( DOMException::INVALID_STATE_ERR );
|
||||
|
||||
return static_cast<UIEventImpl*>(impl)->keyCode();
|
||||
}
|
||||
|
||||
int UIEvent::charCode() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<UIEventImpl*>(impl)->charCode();
|
||||
}
|
||||
|
||||
int UIEvent::pageX() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<UIEventImpl*>(impl)->pageX();
|
||||
}
|
||||
|
||||
int UIEvent::pageY() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<UIEventImpl*>(impl)->pageY();
|
||||
}
|
||||
|
||||
int UIEvent::layerX() const
|
||||
{
|
||||
if( !impl )
|
||||
throw DOMException( DOMException::INVALID_STATE_ERR );
|
||||
|
||||
return static_cast<UIEventImpl*>(impl)->layerX();
|
||||
}
|
||||
|
||||
int UIEvent::layerY() const
|
||||
{
|
||||
if( !impl )
|
||||
throw DOMException( DOMException::INVALID_STATE_ERR );
|
||||
|
||||
return static_cast<UIEventImpl*>(impl)->layerY();
|
||||
}
|
||||
|
||||
int UIEvent::which() const
|
||||
{
|
||||
if( !impl ) throw DOMException( DOMException::INVALID_STATE_ERR );
|
||||
return static_cast<UIEventImpl*>(impl)->which();
|
||||
}
|
||||
|
||||
void UIEvent::initUIEvent(const DOMString &typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const AbstractView &viewArg,
|
||||
long detailArg)
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
static_cast<UIEventImpl*>(impl)->initUIEvent(typeArg,canBubbleArg,cancelableArg,
|
||||
viewArg.handle(),detailArg);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
MouseEvent::MouseEvent() : UIEvent()
|
||||
{
|
||||
}
|
||||
|
||||
MouseEvent::MouseEvent(const MouseEvent &other) : UIEvent(other)
|
||||
{
|
||||
}
|
||||
|
||||
MouseEvent::MouseEvent(const Event &other) : UIEvent()
|
||||
{
|
||||
(*this)=other;
|
||||
}
|
||||
|
||||
MouseEvent::MouseEvent(MouseEventImpl *impl) : UIEvent(impl)
|
||||
{
|
||||
}
|
||||
|
||||
MouseEvent &MouseEvent::operator = (const MouseEvent &other)
|
||||
{
|
||||
UIEvent::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
MouseEvent &MouseEvent::operator = (const Event &other)
|
||||
{
|
||||
Event e;
|
||||
e = other;
|
||||
if (!e.isNull() && !e.handle()->isMouseEvent()) {
|
||||
if ( impl ) impl->deref();
|
||||
impl = 0;
|
||||
} else
|
||||
UIEvent::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
MouseEvent::~MouseEvent()
|
||||
{
|
||||
}
|
||||
|
||||
long MouseEvent::screenX() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->screenX();
|
||||
}
|
||||
|
||||
long MouseEvent::screenY() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->screenY();
|
||||
}
|
||||
|
||||
long MouseEvent::clientX() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->clientX();
|
||||
}
|
||||
|
||||
long MouseEvent::clientY() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->clientY();
|
||||
}
|
||||
|
||||
bool MouseEvent::ctrlKey() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->ctrlKey();
|
||||
}
|
||||
|
||||
bool MouseEvent::shiftKey() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->shiftKey();
|
||||
}
|
||||
|
||||
bool MouseEvent::altKey() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->altKey();
|
||||
}
|
||||
|
||||
bool MouseEvent::metaKey() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->metaKey();
|
||||
}
|
||||
|
||||
unsigned short MouseEvent::button() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->button();
|
||||
}
|
||||
|
||||
Node MouseEvent::relatedTarget() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MouseEventImpl*>(impl)->relatedTarget();
|
||||
}
|
||||
|
||||
void MouseEvent::initMouseEvent(const DOMString &typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const AbstractView &viewArg,
|
||||
long detailArg,
|
||||
long screenXArg,
|
||||
long screenYArg,
|
||||
long clientXArg,
|
||||
long clientYArg,
|
||||
bool ctrlKeyArg,
|
||||
bool altKeyArg,
|
||||
bool shiftKeyArg,
|
||||
bool metaKeyArg,
|
||||
unsigned short buttonArg,
|
||||
const Node &relatedTargetArg)
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
static_cast<MouseEventImpl*>(impl)->initMouseEvent(typeArg,canBubbleArg,
|
||||
cancelableArg,viewArg.handle(),detailArg,screenXArg,screenYArg,clientXArg,
|
||||
clientYArg,ctrlKeyArg,altKeyArg,shiftKeyArg,metaKeyArg,buttonArg,
|
||||
relatedTargetArg);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
TextEvent::TextEvent() : UIEvent()
|
||||
{
|
||||
}
|
||||
|
||||
TextEvent::TextEvent(const TextEvent &other) : UIEvent(other)
|
||||
{
|
||||
}
|
||||
|
||||
TextEvent::TextEvent(const Event &other) : UIEvent()
|
||||
{
|
||||
(*this)=other;
|
||||
}
|
||||
|
||||
TextEvent &TextEvent::operator = (const TextEvent &other)
|
||||
{
|
||||
UIEvent::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
TextEvent &TextEvent::operator = (const Event &other)
|
||||
{
|
||||
Event e;
|
||||
e = other;
|
||||
if (!e.isNull() && !e.handle()->isTextInputEvent()) {
|
||||
if ( impl ) impl->deref();
|
||||
impl = 0;
|
||||
} else
|
||||
UIEvent::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
TextEvent::~TextEvent()
|
||||
{
|
||||
}
|
||||
|
||||
void TextEvent::initTextEvent(const DOMString &typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const AbstractView &viewArg,
|
||||
const DOMString &dataArg)
|
||||
{
|
||||
static_cast<TextEventImpl*>(impl)->initTextEvent(
|
||||
typeArg, canBubbleArg, cancelableArg, viewArg.handle(), dataArg);
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
KeyboardEvent::KeyboardEvent() : UIEvent()
|
||||
{
|
||||
}
|
||||
|
||||
KeyboardEvent::KeyboardEvent(const KeyboardEvent &other) : UIEvent(other)
|
||||
{
|
||||
}
|
||||
|
||||
KeyboardEvent::KeyboardEvent(const Event &other) : UIEvent()
|
||||
{
|
||||
(*this)=other;
|
||||
}
|
||||
|
||||
KeyboardEvent &KeyboardEvent::operator = (const KeyboardEvent &other)
|
||||
{
|
||||
UIEvent::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyboardEvent &KeyboardEvent::operator = (const Event &other)
|
||||
{
|
||||
Event e;
|
||||
e = other;
|
||||
if (!e.isNull() && !e.handle()->isKeyboardEvent()) {
|
||||
if ( impl ) impl->deref();
|
||||
impl = 0;
|
||||
} else
|
||||
UIEvent::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyboardEvent::~KeyboardEvent()
|
||||
{
|
||||
}
|
||||
|
||||
DOMString KeyboardEvent::keyIdentifier() const
|
||||
{
|
||||
return static_cast<const KeyboardEventImpl*>(impl)->keyIdentifier();
|
||||
}
|
||||
|
||||
unsigned long KeyboardEvent::keyLocation() const
|
||||
{
|
||||
return static_cast<const KeyboardEventImpl*>(impl)->keyLocation();
|
||||
}
|
||||
|
||||
bool KeyboardEvent::ctrlKey() const
|
||||
{
|
||||
return static_cast<const KeyboardEventImpl*>(impl)->ctrlKey();
|
||||
}
|
||||
|
||||
bool KeyboardEvent::shiftKey() const
|
||||
{
|
||||
return static_cast<const KeyboardEventImpl*>(impl)->shiftKey();
|
||||
}
|
||||
|
||||
bool KeyboardEvent::altKey() const
|
||||
{
|
||||
return static_cast<const KeyboardEventImpl*>(impl)->altKey();
|
||||
}
|
||||
|
||||
bool KeyboardEvent::metaKey() const
|
||||
{
|
||||
return static_cast<const KeyboardEventImpl*>(impl)->metaKey();
|
||||
}
|
||||
|
||||
bool KeyboardEvent::getModifierState(DOMString keyIdentifierArg) const
|
||||
{
|
||||
return static_cast<const KeyboardEventImpl*>(impl)->getModifierState(keyIdentifierArg);
|
||||
}
|
||||
|
||||
void KeyboardEvent::initKeyboardEvent(DOMString typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
AbstractView viewArg,
|
||||
DOMString keyIdentifierArg,
|
||||
unsigned long keyLocationArg,
|
||||
DOMString modifiersList)
|
||||
{
|
||||
static_cast<KeyboardEventImpl*>(impl)->initKeyboardEvent(typeArg,
|
||||
canBubbleArg, cancelableArg, viewArg.handle(), keyIdentifierArg, keyLocationArg, modifiersList);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
MutationEvent::MutationEvent() : Event()
|
||||
{
|
||||
}
|
||||
|
||||
MutationEvent::MutationEvent(const MutationEvent &other) : Event(other)
|
||||
{
|
||||
}
|
||||
|
||||
MutationEvent::MutationEvent(const Event &other) : Event()
|
||||
{
|
||||
(*this)=other;
|
||||
}
|
||||
|
||||
MutationEvent::MutationEvent(MutationEventImpl *impl) : Event(impl)
|
||||
{
|
||||
}
|
||||
|
||||
MutationEvent &MutationEvent::operator = (const MutationEvent &other)
|
||||
{
|
||||
Event::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutationEvent &MutationEvent::operator = (const Event &other)
|
||||
{
|
||||
Event e;
|
||||
e = other;
|
||||
if (!e.isNull() && !e.handle()->isMutationEvent()) {
|
||||
if ( impl ) impl->deref();
|
||||
impl = 0;
|
||||
} else
|
||||
Event::operator = (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutationEvent::~MutationEvent()
|
||||
{
|
||||
}
|
||||
|
||||
Node MutationEvent::relatedNode() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MutationEventImpl*>(impl)->relatedNode();
|
||||
}
|
||||
|
||||
DOMString MutationEvent::prevValue() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MutationEventImpl*>(impl)->prevValue();
|
||||
}
|
||||
|
||||
DOMString MutationEvent::newValue() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MutationEventImpl*>(impl)->newValue();
|
||||
}
|
||||
|
||||
DOMString MutationEvent::attrName() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MutationEventImpl*>(impl)->attrName();
|
||||
}
|
||||
|
||||
unsigned short MutationEvent::attrChange() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return static_cast<MutationEventImpl*>(impl)->attrChange();
|
||||
}
|
||||
|
||||
void MutationEvent::initMutationEvent(const DOMString &typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const Node &relatedNodeArg,
|
||||
const DOMString &prevValueArg,
|
||||
const DOMString &newValueArg,
|
||||
const DOMString &attrNameArg,
|
||||
unsigned short attrChangeArg)
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
static_cast<MutationEventImpl*>(impl)->initMutationEvent(typeArg,
|
||||
canBubbleArg,cancelableArg,relatedNodeArg,prevValueArg,
|
||||
newValueArg,attrNameArg,attrChangeArg);
|
||||
}
|
||||
|
||||
|
|
@ -1,886 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 2001 Peter Kelly (pmk@post.com)
|
||||
* Copyright 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.
|
||||
*
|
||||
* This file includes excerpts from the Document Object Model (DOM)
|
||||
* Level 3 Events Specification (Working Group Note 07 November 2003)
|
||||
* http://www.w3.org/TR/DOM-Level-3-Events/
|
||||
* Copyright © 2003 World Wide Web Consortium , (Massachusetts Institute of
|
||||
* Technology, European Research Consortium for Informatics and Mathematics,
|
||||
* Keio University ). All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _DOM_Events_h_
|
||||
#define _DOM_Events_h_
|
||||
|
||||
#include <dom/dom_node.h>
|
||||
#include <dom/dom_misc.h>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class Event;
|
||||
class EventException;
|
||||
class UIEvent;
|
||||
class MouseEvent;
|
||||
class TextEvent;
|
||||
class MutationEvent;
|
||||
class AbstractView;
|
||||
|
||||
class EventListenerImpl;
|
||||
class EventImpl;
|
||||
class UIEventImpl;
|
||||
class MouseEventImpl;
|
||||
class MutationEventImpl;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 2
|
||||
*
|
||||
* The EventListener interface is the primary method for handling events.
|
||||
* Users implement the EventListener interface and register their listener on
|
||||
* an EventTarget using the AddEventListener method. The users should also
|
||||
* remove their EventListener from its EventTarget after they have completed
|
||||
* using the listener.
|
||||
*
|
||||
* When a Node is copied using the cloneNode method the EventListeners attached
|
||||
* to the source Node are not attached to the copied Node. If the user wishes
|
||||
* the same EventListeners to be added to the newly created copy the user must
|
||||
* add them manually.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT EventListener : public DomShared {
|
||||
public:
|
||||
EventListener();
|
||||
virtual ~EventListener();
|
||||
|
||||
/**
|
||||
* This method is called whenever an event occurs of the type for which the
|
||||
* EventListener interface was registered. Parameters
|
||||
*
|
||||
* @param evt The Event contains contextual information about the event. It
|
||||
* also contains the stopPropagation and preventDefault methods which are
|
||||
* used in determining the event's flow and default action.
|
||||
*
|
||||
*/
|
||||
virtual void handleEvent(Event &evt);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*
|
||||
* Returns a name specifying the type of listener. Useful for checking
|
||||
* if an event is of a particular sublass.
|
||||
*
|
||||
*/
|
||||
virtual DOMString eventListenerType();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @internal
|
||||
* Reserved. Do not use in your subclasses.
|
||||
*/
|
||||
EventListenerImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 2
|
||||
*
|
||||
* The Event interface is used to provide contextual information about an event
|
||||
* to the handler processing the event. An object which implements the Event
|
||||
* interface is generally passed as the first parameter to an event handler.
|
||||
* More specific context information is passed to event handlers by deriving
|
||||
* additional interfaces from Event which contain information directly relating
|
||||
* to the type of event they accompany. These derived interfaces are also
|
||||
* implemented by the object passed to the event listener.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT Event {
|
||||
friend class Document;
|
||||
friend class NodeImpl;
|
||||
friend class DocumentImpl;
|
||||
public:
|
||||
Event();
|
||||
Event(const Event &other);
|
||||
virtual ~Event();
|
||||
|
||||
Event & operator = (const Event &other);
|
||||
|
||||
/**
|
||||
* An integer indicating which phase of event flow is being processed.
|
||||
*
|
||||
* AT_TARGET: The event is currently being evaluated at the target
|
||||
* EventTarget.
|
||||
*
|
||||
* BUBBLING_PHASE: The current event phase is the bubbling phase.
|
||||
*
|
||||
* CAPTURING_PHASE: The current event phase is the capturing phase.
|
||||
*
|
||||
*/
|
||||
enum PhaseType {
|
||||
CAPTURING_PHASE = 1,
|
||||
AT_TARGET = 2,
|
||||
BUBBLING_PHASE = 3
|
||||
};
|
||||
|
||||
/**
|
||||
* The name of the event (case-insensitive). The name must be an XML name.
|
||||
*
|
||||
*/
|
||||
DOMString type() const;
|
||||
|
||||
/**
|
||||
* Used to indicate the EventTarget to which the event was originally
|
||||
* dispatched.
|
||||
*
|
||||
*/
|
||||
Node target() const;
|
||||
|
||||
/**
|
||||
* Used to indicate the EventTarget whose EventListeners are currently
|
||||
* being processed. This is particularly useful during capturing and
|
||||
* bubbling.
|
||||
*
|
||||
*/
|
||||
Node currentTarget() const;
|
||||
|
||||
/**
|
||||
* Used to indicate which phase of event flow is currently being evaluated.
|
||||
*
|
||||
*/
|
||||
unsigned short eventPhase() const;
|
||||
|
||||
/**
|
||||
* Used to indicate whether or not an event is a bubbling event. If the
|
||||
* event can bubble the value is true, else the value is false.
|
||||
*
|
||||
*/
|
||||
bool bubbles() const;
|
||||
|
||||
/**
|
||||
* Used to indicate whether or not an event can have its default action
|
||||
* prevented. If the default action can be prevented the value is true,
|
||||
* else the value is false.
|
||||
*
|
||||
*/
|
||||
bool cancelable() const;
|
||||
|
||||
/**
|
||||
* Used to specify the time (in milliseconds relative to the epoch) at
|
||||
* which the event was created. Due to the fact that some systems may not
|
||||
* provide this information the value of timeStamp may be not available for
|
||||
* all events. When not available, a value of 0 will be returned. Examples
|
||||
* of epoch time are the time of the system start or 0:0:0 UTC 1st January 1970.
|
||||
*
|
||||
*/
|
||||
DOMTimeStamp timeStamp() const;
|
||||
|
||||
/**
|
||||
* The stopPropagation method is used prevent further propagation of an
|
||||
* event during event flow. If this method is called by any EventListener
|
||||
* the event will cease propagating through the tree. The event will
|
||||
* complete dispatch to all listeners on the current EventTarget before
|
||||
* event flow stops. This method may be used during any stage of event flow.
|
||||
*
|
||||
*/
|
||||
void stopPropagation();
|
||||
|
||||
/**
|
||||
* If an event is cancelable, the preventDefault method is used to signify
|
||||
* that the event is to be canceled, meaning any default action normally
|
||||
* taken by the implementation as a result of the event will not occur. If,
|
||||
* during any stage of event flow, the preventDefault method is called the
|
||||
* event is canceled. Any default action associated with the event will not
|
||||
* occur. Calling this method for a non-cancelable event has no effect.
|
||||
* Once preventDefault has been called it will remain in effect throughout
|
||||
* the remainder of the event's propagation. This method may be used during
|
||||
* any stage of event flow.
|
||||
*
|
||||
*/
|
||||
void preventDefault();
|
||||
|
||||
/**
|
||||
* The initEvent method is used to initialize the value of an Event created
|
||||
* through the DocumentEvent interface. This method may only be called
|
||||
* before the Event has been dispatched via the dispatchEvent method,
|
||||
* though it may be called multiple times during that phase if necessary.
|
||||
* If called multiple times the final invocation takes precedence. If
|
||||
* called from a subclass of Event interface only the values specified in
|
||||
* the initEvent method are modified, all other attributes are left
|
||||
* unchanged.
|
||||
*
|
||||
* @param eventTypeArg Specifies the event type. This type may be any event
|
||||
* type currently defined in this specification or a new event type.. The
|
||||
* string must be an XML name.
|
||||
*
|
||||
* Any new event type must not begin with any upper, lower, or mixed case
|
||||
* version of the string "DOM". This prefix is reserved for future DOM
|
||||
* event sets. It is also strongly recommended that third parties adding
|
||||
* their own events use their own prefix to avoid confusion and lessen the
|
||||
* probability of conflicts with other new events.
|
||||
*
|
||||
* @param canBubbleArg Specifies whether or not the event can bubble.
|
||||
*
|
||||
* @param cancelableArg Specifies whether or not the event's default action can be prevented.
|
||||
*
|
||||
*/
|
||||
void initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
EventImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
Event(EventImpl *i);
|
||||
protected:
|
||||
EventImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 2:
|
||||
*
|
||||
* Event operations may throw an EventException as specified in their method
|
||||
* descriptions.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT EventException
|
||||
{
|
||||
public:
|
||||
EventException(unsigned short _code);
|
||||
EventException(const EventException &other);
|
||||
EventException & operator = (const EventException &other);
|
||||
virtual ~EventException() {}
|
||||
|
||||
/**
|
||||
* An integer indicating the type of error generated.
|
||||
*
|
||||
* UNSPECIFIED_EVENT_TYPE_ERR: If the Event's type was not specified by
|
||||
* initializing the event before the method was called. Specification of
|
||||
* the Event's type as null or an empty string will also trigger this
|
||||
* exception.
|
||||
*
|
||||
*/
|
||||
enum EventExceptionCode {
|
||||
UNSPECIFIED_EVENT_TYPE_ERR = 0,
|
||||
_EXCEPTION_OFFSET = 3000,
|
||||
_EXCEPTION_MAX = 3999
|
||||
};
|
||||
|
||||
unsigned short code;
|
||||
|
||||
/// Returns the name of this error
|
||||
DOMString codeAsString() const;
|
||||
|
||||
/// Returns the name of given error code
|
||||
static DOMString codeAsString(int cssCode);
|
||||
|
||||
/** @internal - checks to see whether internal code is an event one */
|
||||
static bool isEventExceptionCode(int exceptioncode);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 2
|
||||
*
|
||||
* The UIEvent interface provides specific contextual information associated
|
||||
* with User Interface events.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT UIEvent : public Event {
|
||||
public:
|
||||
UIEvent();
|
||||
UIEvent(const UIEvent &other);
|
||||
UIEvent(const Event &other);
|
||||
UIEvent & operator = (const UIEvent &other);
|
||||
UIEvent & operator = (const Event &other);
|
||||
virtual ~UIEvent();
|
||||
|
||||
/**
|
||||
* The view attribute identifies the AbstractView from which the event was
|
||||
* generated.
|
||||
*
|
||||
*/
|
||||
AbstractView view() const;
|
||||
|
||||
/**
|
||||
* Specifies some detail information about the Event, depending on the type
|
||||
* of event.
|
||||
*
|
||||
*/
|
||||
long detail() const;
|
||||
|
||||
/**
|
||||
* Non-standard extension to support IE-style keyCode event property.
|
||||
*
|
||||
*/
|
||||
int keyCode() const;
|
||||
|
||||
/**
|
||||
* Non-standard extension to support IE-style charCode event property.
|
||||
*
|
||||
*/
|
||||
int charCode() const;
|
||||
|
||||
/**
|
||||
* Non-standard extensions to support Netscape-style pageX and pageY event properties.
|
||||
*
|
||||
*/
|
||||
int pageX() const;
|
||||
int pageY() const;
|
||||
|
||||
/**
|
||||
* Non-standard extensions to support Netscape-style layerX and layerY event properties.
|
||||
*
|
||||
*/
|
||||
int layerX() const;
|
||||
int layerY() const;
|
||||
|
||||
/**
|
||||
* Non-standard extension to support Netscape-style "which" event property.
|
||||
*
|
||||
*/
|
||||
int which() const;
|
||||
|
||||
/**
|
||||
* The initUIEvent method is used to initialize the value of a UIEvent
|
||||
* created through the DocumentEvent interface. This method may only be
|
||||
* called before the UIEvent has been dispatched via the dispatchEvent
|
||||
* method, though it may be called multiple times during that phase if
|
||||
* necessary. If called multiple times, the final invocation takes
|
||||
* precedence.
|
||||
*
|
||||
* @param typeArg Specifies the event type.
|
||||
*
|
||||
* @param canBubbleArg Specifies whether or not the event can bubble.
|
||||
*
|
||||
* @param cancelableArg Specifies whether or not the event's default action
|
||||
* can be prevented.
|
||||
*
|
||||
* @param viewArg Specifies the Event's AbstractView.
|
||||
*
|
||||
* @param detailArg Specifies the Event's detail.
|
||||
*
|
||||
*/
|
||||
void initUIEvent(const DOMString &typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const AbstractView &viewArg,
|
||||
long detailArg);
|
||||
protected:
|
||||
UIEvent(UIEventImpl *impl);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 2
|
||||
*
|
||||
* The MouseEvent interface provides specific contextual information associated
|
||||
* with Mouse events.
|
||||
*
|
||||
* The detail attribute inherited from UIEvent indicates the number of times a
|
||||
* mouse button has been pressed and released over the same screen location
|
||||
* during a user action. The attribute value is 1 when the user begins this
|
||||
* action and increments by 1 for each full sequence of pressing and releasing.
|
||||
* If the user moves the mouse between the mousedown and mouseup the value will
|
||||
* be set to 0, indicating that no click is occurring.
|
||||
*
|
||||
* In the case of nested elements mouse events are always targeted at the most
|
||||
* deeply nested element. Ancestors of the targeted element may use bubbling to
|
||||
* obtain notification of mouse events which occur within its descendent elements.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT MouseEvent : public UIEvent {
|
||||
public:
|
||||
MouseEvent();
|
||||
MouseEvent(const MouseEvent &other);
|
||||
MouseEvent(const Event &other);
|
||||
MouseEvent & operator = (const MouseEvent &other);
|
||||
MouseEvent & operator = (const Event &other);
|
||||
virtual ~MouseEvent();
|
||||
|
||||
/**
|
||||
* The horizontal coordinate at which the event occurred relative to the
|
||||
* origin of the screen coordinate system.
|
||||
*
|
||||
*/
|
||||
long screenX() const;
|
||||
|
||||
/**
|
||||
* The vertical coordinate at which the event occurred relative to the
|
||||
* origin of the screen coordinate system.
|
||||
*
|
||||
*/
|
||||
long screenY() const;
|
||||
|
||||
/**
|
||||
* The horizontal coordinate at which the event occurred relative to the
|
||||
* DOM implementation's client area.
|
||||
*
|
||||
*/
|
||||
long clientX() const;
|
||||
|
||||
/**
|
||||
* The vertical coordinate at which the event occurred relative to the DOM
|
||||
* implementation's client area.
|
||||
*
|
||||
*/
|
||||
long clientY() const;
|
||||
|
||||
/**
|
||||
* Used to indicate whether the 'ctrl' key was depressed during the firing
|
||||
* of the event.
|
||||
*/
|
||||
bool ctrlKey() const;
|
||||
|
||||
/**
|
||||
* Used to indicate whether the 'shift' key was depressed during the firing
|
||||
* of the event.
|
||||
*
|
||||
*/
|
||||
bool shiftKey() const;
|
||||
|
||||
/**
|
||||
* Used to indicate whether the 'alt' key was depressed during the firing
|
||||
* of the event. On some platforms this key may map to an alternative key
|
||||
* name.
|
||||
*
|
||||
*/
|
||||
bool altKey() const;
|
||||
|
||||
/**
|
||||
* Used to indicate whether the 'meta' key was depressed during the firing
|
||||
* of the event. On some platforms this key may map to an alternative key
|
||||
* name.
|
||||
*
|
||||
*/
|
||||
bool metaKey() const;
|
||||
|
||||
/**
|
||||
* During mouse events caused by the depression or release of a mouse
|
||||
* button, button is used to indicate which mouse button changed state. The
|
||||
* values for button range from zero to indicate the left button of the
|
||||
* mouse, one to indicate the middle button if present, and two to indicate
|
||||
* the right button. For mice configured for left handed use in which the
|
||||
* button actions are reversed the values are instead read from right to
|
||||
* left.
|
||||
*
|
||||
*/
|
||||
unsigned short button() const;
|
||||
|
||||
/**
|
||||
* Used to identify a secondary EventTarget related to a UI event.
|
||||
* Currently this attribute is used with the mouseover event to indicate
|
||||
* the EventTarget which the pointing device exited and with the mouseout
|
||||
* event to indicate the EventTarget which the pointing device entered.
|
||||
*
|
||||
*/
|
||||
Node relatedTarget() const;
|
||||
|
||||
/**
|
||||
* The initMouseEvent method is used to initialize the value of a
|
||||
* MouseEvent created through the DocumentEvent interface. This method may
|
||||
* only be called before the MouseEvent has been dispatched via the
|
||||
* dispatchEvent method, though it may be called multiple times during that
|
||||
* phase if necessary. If called multiple times, the final invocation takes
|
||||
* precedence. Parameters
|
||||
*
|
||||
* @param typeArg Specifies the event type.
|
||||
*
|
||||
* @param canBubbleArg Specifies whether or not the event can bubble.
|
||||
*
|
||||
* @param cancelableArg Specifies whether or not the event's default action can be prevented.
|
||||
*
|
||||
* @param viewArg Specifies the Event's AbstractView.
|
||||
*
|
||||
* @param detailArg Specifies the Event's mouse click count.
|
||||
*
|
||||
* @param screenXArg Specifies the Event's screen x coordinate
|
||||
*
|
||||
* @param screenYArg Specifies the Event's screen y coordinate
|
||||
*
|
||||
* @param clientXArg Specifies the Event's client x coordinate
|
||||
*
|
||||
* @param clientYArg Specifies the Event's client y coordinate
|
||||
*
|
||||
* @param ctrlKeyArg Specifies whether or not control key was depressed during the Event.
|
||||
*
|
||||
* @param altKeyArg Specifies whether or not alt key was depressed during the Event.
|
||||
*
|
||||
* @param shiftKeyArg Specifies whether or not shift key was depressed during the Event.
|
||||
*
|
||||
* @param metaKeyArg Specifies whether or not meta key was depressed during the Event.
|
||||
*
|
||||
* @param buttonArg Specifies the Event's mouse button.
|
||||
*
|
||||
* @param relatedTargetArg Specifies the Event's related EventTarget.
|
||||
*
|
||||
*/
|
||||
void initMouseEvent(const DOMString &typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const AbstractView &viewArg,
|
||||
long detailArg,
|
||||
long screenXArg,
|
||||
long screenYArg,
|
||||
long clientXArg,
|
||||
long clientYArg,
|
||||
bool ctrlKeyArg,
|
||||
bool altKeyArg,
|
||||
bool shiftKeyArg,
|
||||
bool metaKeyArg,
|
||||
unsigned short buttonArg,
|
||||
const Node &relatedTargetArg);
|
||||
protected:
|
||||
MouseEvent(MouseEventImpl *impl);
|
||||
};
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 3
|
||||
*
|
||||
* DOM::TextEvent is used to indicate actual text entry
|
||||
* during text input. It corresponds to the HTML keypress events
|
||||
*/
|
||||
class KHTML_EXPORT TextEvent : public UIEvent {
|
||||
public:
|
||||
TextEvent();
|
||||
TextEvent(const TextEvent &other);
|
||||
TextEvent(const Event &other);
|
||||
TextEvent & operator = (const TextEvent &other);
|
||||
TextEvent & operator = (const Event &other);
|
||||
virtual ~TextEvent();
|
||||
|
||||
/**
|
||||
* initTextEvent
|
||||
* The initTextEvent method is used to initialize the value of a TextEvent
|
||||
* object and has the same behavior as UIEvent.initUIEvent().
|
||||
* The value of UIEvent.detail remains undefined.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* Specifies the event type.
|
||||
* canBubbleArg of type boolean
|
||||
* Specifies whether or not the event can bubble.
|
||||
* cancelableArg of type boolean
|
||||
* Specifies whether or not the event's default action can be prevent.
|
||||
* viewArg of type views::AbstractView
|
||||
* Specifies the TextEvent's AbstractView.
|
||||
* dataArg of type DOMString
|
||||
* Specifies TextEvent.data.
|
||||
*/
|
||||
void initTextEvent(const DOMString &typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const AbstractView &viewArg,
|
||||
const DOMString &dataArg);
|
||||
|
||||
/**
|
||||
* data of type DOMString, readonly
|
||||
*
|
||||
* data holds the value of the characters generated by the character device. This may be a single Unicode character or a non-empty sequence of Unicode characters [Unicode]. Characters should be normalized as defined by the Unicode normalization form NFC, defined in [UTR #15].
|
||||
* Note: while the DOM spec specifies that the string never be empty,
|
||||
* KHTML can not guarantee that
|
||||
*/
|
||||
DOMString data() const;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 3
|
||||
*
|
||||
* DOM::KeyboardEvent
|
||||
* The KeyboardEvent interface provides specific contextual information
|
||||
* associated with keyboard devices. Each keyboard event references a
|
||||
* key using an identifier. Keyboard events are commonly directed at
|
||||
* the element that has the focus.
|
||||
*
|
||||
* The KeyboardEvent interface provides convenient attributes for some
|
||||
* common modifiers keys: KeyboardEvent.ctrlKey, KeyboardEvent.shiftKey,
|
||||
* KeyboardEvent.altKey, KeyboardEvent.metaKey. These attributes are
|
||||
* equivalent to use the method KeyboardEvent.getModifierState(keyIdentifierArg)
|
||||
* with "Control", "Shift", "Alt", or "Meta" respectively.
|
||||
*
|
||||
* To create an instance of the KeyboardEvent interface, use the
|
||||
* DocumentEvent.createEvent("KeyboardEvent") method call.
|
||||
*/
|
||||
class KHTML_EXPORT KeyboardEvent : public UIEvent {
|
||||
public:
|
||||
KeyboardEvent();
|
||||
KeyboardEvent(const KeyboardEvent &other);
|
||||
KeyboardEvent(const Event &other);
|
||||
KeyboardEvent & operator = (const KeyboardEvent &other);
|
||||
KeyboardEvent & operator = (const Event &other);
|
||||
virtual ~KeyboardEvent();
|
||||
|
||||
enum KeyLocation {
|
||||
/**
|
||||
The key activation is not distinguished as the left
|
||||
or right version of the key, and did not originate
|
||||
from the numeric keypad (or did not originate with a
|
||||
virtual key corresponding to the numeric keypad).
|
||||
Example: the 'Q' key on a PC 101 Key US keyboard.
|
||||
*/
|
||||
DOM_KEY_LOCATION_STANDARD = 0x00,
|
||||
|
||||
/**
|
||||
The key activated is in the left key location
|
||||
(there is more than one possible location for this key).
|
||||
Example: the left Shift key on a PC 101 Key US keyboard.
|
||||
|
||||
Note: KHTML currently always considers modifier keys to be on the left
|
||||
*/
|
||||
DOM_KEY_LOCATION_LEFT = 0x01,
|
||||
|
||||
/**
|
||||
The key activated is in the right key location
|
||||
(there is more than one possible location for this key).
|
||||
Example: the right Shift key on a PC 101 Key US keyboard.
|
||||
|
||||
Note: KHTML currently always considers modifier keys to be on the left
|
||||
*/
|
||||
DOM_KEY_LOCATION_RIGHT = 0x02,
|
||||
|
||||
/**
|
||||
The key activation originated on the numeric keypad or
|
||||
with a virtual key corresponding to the numeric keypad.
|
||||
Example: the '1' key on a PC 101 Key US keyboard located on the numeric pad.
|
||||
*/
|
||||
DOM_KEY_LOCATION_NUMPAD = 0x03
|
||||
};
|
||||
|
||||
/**
|
||||
* keyIdentifier of type DOMString, readonly
|
||||
*
|
||||
* keyIdentifier holds the identifier of the key. The key identifiers
|
||||
* are defined in Appendix A.2 "Key identifiers set"
|
||||
* (http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set)
|
||||
*/
|
||||
DOMString keyIdentifier() const;
|
||||
|
||||
/**
|
||||
* keyLocation of type unsigned long, readonly
|
||||
*
|
||||
* The keyLocation attribute contains an indication of the location
|
||||
* of they key on the device.
|
||||
* See the KeyLocation enum for possible values
|
||||
*/
|
||||
unsigned long keyLocation() const;
|
||||
|
||||
/**
|
||||
* ctrlKey of type boolean, readonly
|
||||
*
|
||||
* true if the control (Ctrl) key modifier is activated.
|
||||
*/
|
||||
bool ctrlKey() const;
|
||||
|
||||
/**
|
||||
* shiftKey of type boolean, readonly
|
||||
*
|
||||
* true if the shift (Shift) key modifier is activated.
|
||||
*/
|
||||
bool shiftKey() const;
|
||||
|
||||
/**
|
||||
* altKey of type boolean, readonly
|
||||
*
|
||||
* true if the alt (Alt) key modifier is activated.
|
||||
*/
|
||||
bool altKey() const;
|
||||
|
||||
/**
|
||||
* metaKey of type boolean, readonly
|
||||
*
|
||||
* true if the meta (Meta) key modifier is activated.
|
||||
*/
|
||||
bool metaKey() const;
|
||||
|
||||
/**
|
||||
* getModifierState
|
||||
*
|
||||
*
|
||||
* This methods queries the state of a modifier using a key identifier
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* keyIdentifierArg of type DOMString
|
||||
* A modifier key identifier. Supported modifier keys are "Alt", "Control", "Meta", "Shift".
|
||||
*
|
||||
* Return Value
|
||||
* boolean true if it is modifier key and the modifier is activated, false otherwise.
|
||||
*/
|
||||
bool getModifierState(DOMString keyIdentifierArg) const;
|
||||
|
||||
|
||||
/**
|
||||
* initKeyboardEvent
|
||||
*
|
||||
* The initKeyboardEvent method is used to initialize the value of a
|
||||
* KeyboardEvent object and has the same behavior as UIEvent.initUIEvent().
|
||||
* The value of UIEvent.detail remains undefined.
|
||||
*
|
||||
* Parameters:
|
||||
* typeArg of type DOMString
|
||||
* Specifies the event type.
|
||||
* canBubbleArg of type boolean
|
||||
* Specifies whether or not the event can bubble.
|
||||
* cancelableArg of type boolean
|
||||
* Specifies whether or not the event's default action can be prevent.
|
||||
* viewArg of type views::AbstractView
|
||||
* Specifies the TextEvent's AbstractView.
|
||||
* keyIdentifierArg of type DOMString
|
||||
* Specifies KeyboardEvent.keyIdentifier.
|
||||
* keyLocationArg of type unsigned long
|
||||
* Specifies KeyboardEvent.keyLocation.
|
||||
* modifiersList of type DOMString
|
||||
* A white space separated list of modifier key identifiers to be activated on this object.
|
||||
*/
|
||||
void initKeyboardEvent(DOMString typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
AbstractView viewArg,
|
||||
DOMString keyIdentifierArg,
|
||||
unsigned long keyLocationArg,
|
||||
DOMString modifiersList);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 2
|
||||
*
|
||||
* The MutationEvent interface provides specific contextual information
|
||||
* associated with Mutation events.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT MutationEvent : public Event {
|
||||
public:
|
||||
MutationEvent();
|
||||
MutationEvent(const MutationEvent &other);
|
||||
MutationEvent(const Event &other);
|
||||
MutationEvent & operator = (const MutationEvent &other);
|
||||
MutationEvent & operator = (const Event &other);
|
||||
virtual ~MutationEvent();
|
||||
|
||||
/**
|
||||
* An integer indicating in which way the Attr was changed.
|
||||
*
|
||||
* ADDITION: The Attr was just added.
|
||||
*
|
||||
* MODIFICATION: The Attr was modified in place.
|
||||
*
|
||||
* REMOVAL: The Attr was just removed.
|
||||
*
|
||||
*/
|
||||
enum attrChangeType {
|
||||
MODIFICATION = 1,
|
||||
ADDITION = 2,
|
||||
REMOVAL = 3
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* relatedNode is used to identify a secondary node related to a mutation
|
||||
* event. For example, if a mutation event is dispatched to a node
|
||||
* indicating that its parent has changed, the relatedNode is the changed
|
||||
* parent. If an event is instead dispatched to a subtree indicating a node
|
||||
* was changed within it, the relatedNode is the changed node. In the case
|
||||
* of the DOMAttrModified event it indicates the Attr node which was
|
||||
* modified, added, or removed.
|
||||
*
|
||||
*/
|
||||
Node relatedNode() const;
|
||||
|
||||
/**
|
||||
* prevValue indicates the previous value of the Attr node in
|
||||
* DOMAttrModified events, and of the CharacterData node in
|
||||
* DOMCharDataModified events.
|
||||
*
|
||||
*/
|
||||
DOMString prevValue() const;
|
||||
|
||||
/**
|
||||
* newValue indicates the new value of the Attr node in DOMAttrModified
|
||||
* events, and of the CharacterData node in DOMCharDataModified events.
|
||||
*
|
||||
*/
|
||||
DOMString newValue() const;
|
||||
|
||||
/**
|
||||
* attrName indicates the name of the changed Attr node in a
|
||||
* DOMAttrModified event.
|
||||
*
|
||||
*/
|
||||
DOMString attrName() const;
|
||||
|
||||
/**
|
||||
* attrChange indicates the type of change which triggered the
|
||||
* DOMAttrModified event. The values can be MODIFICATION, ADDITION, or
|
||||
* REMOVAL.
|
||||
*
|
||||
*/
|
||||
unsigned short attrChange() const;
|
||||
|
||||
/**
|
||||
* The initMutationEvent method is used to initialize the value of a
|
||||
* MutationEvent created through the DocumentEvent interface. This method
|
||||
* may only be called before the MutationEvent has been dispatched via the
|
||||
* dispatchEvent method, though it may be called multiple times during that
|
||||
* phase if necessary. If called multiple times, the final invocation takes
|
||||
* precedence.
|
||||
*
|
||||
* @param typeArg Specifies the event type.
|
||||
*
|
||||
* @param canBubbleArg Specifies whether or not the event can bubble.
|
||||
*
|
||||
* @param cancelableArg Specifies whether or not the event's default action can be prevented.
|
||||
*
|
||||
* @param relatedNodeArg Specifies the Event's related Node.
|
||||
*
|
||||
* @param prevValueArg Specifies the Event's prevValue attribute. This value may be null.
|
||||
*
|
||||
* @param newValueArg Specifies the Event's newValue attribute. This value may be null.
|
||||
*
|
||||
* @param attrNameArg Specifies the Event's attrName attribute. This value may be null.
|
||||
*
|
||||
* @param attrChangeArg Specifies the Event's attrChange attribute
|
||||
*
|
||||
*/
|
||||
void initMutationEvent(const DOMString &typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const Node &relatedNodeArg,
|
||||
const DOMString &prevValueArg,
|
||||
const DOMString &newValueArg,
|
||||
const DOMString &attrNameArg,
|
||||
unsigned short attrChangeArg);
|
||||
protected:
|
||||
MutationEvent(MutationEventImpl *impl);
|
||||
};
|
||||
|
||||
|
||||
|
||||
} //namespace
|
||||
#endif
|
|
@ -1,428 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 2000 Gunnstein Lye (gunnstein@netcom.no)
|
||||
* Copyright 2000 Frederik Holljen (frederik.holljen@hig.no)
|
||||
* Copyright 2001 Peter Kelly (pmk@post.com)
|
||||
* Copyright 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.
|
||||
*
|
||||
*/
|
||||
#include "dom/dom_exception.h"
|
||||
#include "xml/dom_docimpl.h"
|
||||
#include "xml/dom2_rangeimpl.h"
|
||||
|
||||
using namespace DOM;
|
||||
|
||||
DOMString RangeException::codeAsString() const
|
||||
{
|
||||
return codeAsString(code);
|
||||
}
|
||||
|
||||
bool RangeException::isRangeExceptionCode(int exceptioncode)
|
||||
{
|
||||
return exceptioncode >= _EXCEPTION_OFFSET && exceptioncode < _EXCEPTION_MAX;
|
||||
}
|
||||
|
||||
DOMString RangeException::codeAsString(int code)
|
||||
{
|
||||
switch ( code ) {
|
||||
case BAD_BOUNDARYPOINTS_ERR:
|
||||
return DOMString( "BAD_BOUNDARYPOINTS_ERR" );
|
||||
case INVALID_NODE_TYPE_ERR:
|
||||
return DOMString( "INVALID_NODE_TYPE_ERR" );
|
||||
default:
|
||||
return DOMString( "(unknown exception code)" );
|
||||
}
|
||||
}
|
||||
|
||||
Range::Range()
|
||||
{
|
||||
// a range can't exist by itself - it must be associated with a document
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
Range::Range(const Document rootContainer)
|
||||
{
|
||||
if(rootContainer.handle())
|
||||
{
|
||||
impl = new RangeImpl(rootContainer.handle()->docPtr());
|
||||
impl->ref();
|
||||
}
|
||||
else
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
Range::Range(const Range &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
Range::Range(const Node startContainer, const long startOffset, const Node endContainer, const long endOffset)
|
||||
{
|
||||
if (startContainer.isNull() || endContainer.isNull()) {
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR);
|
||||
}
|
||||
|
||||
if (!startContainer.handle()->document() ||
|
||||
startContainer.handle()->document() != endContainer.handle()->document()) {
|
||||
throw DOMException(DOMException::WRONG_DOCUMENT_ERR);
|
||||
}
|
||||
|
||||
impl = new RangeImpl(startContainer.handle()->docPtr(),startContainer.handle(),startOffset,endContainer.handle(),endOffset);
|
||||
impl->ref();
|
||||
}
|
||||
|
||||
Range::Range(RangeImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
Range &Range::operator = (const Range &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if (impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Range::~Range()
|
||||
{
|
||||
if (impl) impl->deref();
|
||||
}
|
||||
|
||||
Node Range::startContainer() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
NodeImpl *r = impl->startContainer(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
long Range::startOffset() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
long r = impl->startOffset(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
Node Range::endContainer() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
NodeImpl *r = impl->endContainer(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
long Range::endOffset() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
long r = impl->endOffset(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
bool Range::collapsed() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
bool r = impl->collapsed(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
Node Range::commonAncestorContainer()
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
NodeImpl *r = impl->commonAncestorContainer(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
void Range::setStart( const Node &refNode, long offset )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->setStart(refNode.handle(),offset,exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::setEnd( const Node &refNode, long offset )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->setEnd(refNode.handle(),offset,exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::setStartBefore( const Node &refNode )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->setStartBefore(refNode.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::setStartAfter( const Node &refNode )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->setStartAfter(refNode.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::setEndBefore( const Node &refNode )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->setEndBefore(refNode.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::setEndAfter( const Node &refNode )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->setEndAfter(refNode.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::collapse( bool toStart )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->collapse(toStart,exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::selectNode( const Node &refNode )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->selectNode(refNode.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::selectNodeContents( const Node &refNode )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->selectNodeContents(refNode.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
short Range::compareBoundaryPoints( CompareHow how, const Range &sourceRange )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
short r = impl->compareBoundaryPoints(how,sourceRange.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
bool Range::boundaryPointsValid( )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->boundaryPointsValid();
|
||||
}
|
||||
|
||||
void Range::deleteContents( )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->deleteContents(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
DocumentFragment Range::extractContents( )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
DocumentFragmentImpl *r = impl->extractContents(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
DocumentFragment Range::cloneContents( )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
DocumentFragmentImpl *r = impl->cloneContents(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
void Range::insertNode( const Node &newNode )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->insertNode(newNode.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
void Range::surroundContents( const Node &newParent )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->surroundContents(newParent.handle(),exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
Range Range::cloneRange( )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
RangeImpl *r = impl->cloneRange(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
DOMString Range::toString( )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
DOMString r = impl->toString(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
DOMString Range::toHTML( )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
int exceptioncode = 0;
|
||||
DOMString r = impl->toHTML(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
DocumentFragment Range::createContextualFragment( const DOMString &html )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
DocumentFragment r = impl->createContextualFragment(html, exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
void Range::detach( )
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->detach(exceptioncode);
|
||||
throwException(exceptioncode);
|
||||
}
|
||||
|
||||
bool Range::isDetached() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->isDetached();
|
||||
}
|
||||
|
||||
RangeImpl *Range::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool Range::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
void Range::throwException(int exceptioncode) const
|
||||
{
|
||||
if (!exceptioncode)
|
||||
return;
|
||||
|
||||
// ### also check for CSS & other exceptions?
|
||||
if (exceptioncode >= RangeException::_EXCEPTION_OFFSET && exceptioncode <= RangeException::_EXCEPTION_MAX)
|
||||
throw RangeException(static_cast<RangeException::RangeExceptionCode>(exceptioncode-RangeException::_EXCEPTION_OFFSET));
|
||||
else
|
||||
throw DOMException(exceptioncode);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,483 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 2000 Gunnstein Lye (gunnstein@netcom.no)
|
||||
* Copyright 2000 Frederik Holljen (frederik.holljen@hig.no)
|
||||
* Copyright 2001 Peter Kelly (pmk@post.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.
|
||||
*
|
||||
* This file includes excerpts from the Document Object Model (DOM)
|
||||
* Level 2 Specification (Candidate Recommendation)
|
||||
* http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
|
||||
* Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef _dom2_range_h_
|
||||
#define _dom2_range_h_
|
||||
|
||||
#include <dom/dom_doc.h>
|
||||
#include <dom/dom_misc.h>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
class DocumentFragment;
|
||||
class Node;
|
||||
class DOMString;
|
||||
class DocumentImpl;
|
||||
class RangeImpl;
|
||||
|
||||
class DOMException;
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
class KHTML_EXPORT RangeException {
|
||||
public:
|
||||
RangeException(unsigned short _code) { code = _code; }
|
||||
RangeException(const RangeException &other) { code = other.code; }
|
||||
|
||||
RangeException & operator = (const RangeException &other)
|
||||
{ code = other.code; return *this; }
|
||||
|
||||
virtual ~RangeException() {}
|
||||
/**
|
||||
* An integer indicating the type of error generated.
|
||||
*
|
||||
*/
|
||||
enum RangeExceptionCode {
|
||||
BAD_BOUNDARYPOINTS_ERR = 1,
|
||||
INVALID_NODE_TYPE_ERR = 2,
|
||||
_EXCEPTION_OFFSET = 2000,
|
||||
_EXCEPTION_MAX = 2999
|
||||
};
|
||||
unsigned short code;
|
||||
|
||||
/// Returns the name of this error
|
||||
DOMString codeAsString() const;
|
||||
|
||||
/// Returns the name of given DOM error code
|
||||
static DOMString codeAsString(int rangeCode);
|
||||
|
||||
/** @internal - checks to see whether internal code is a Range one */
|
||||
static bool isRangeExceptionCode(int exceptioncode);
|
||||
};
|
||||
|
||||
|
||||
class KHTML_EXPORT Range
|
||||
{
|
||||
friend class DocumentImpl;
|
||||
friend class Document;
|
||||
friend class RangeImpl;
|
||||
public:
|
||||
Range();
|
||||
Range(const Document rootContainer);
|
||||
Range(const Range &other);
|
||||
Range(const Node startContainer, const long startOffset, const Node endContainer, const long endOffset);
|
||||
|
||||
Range & operator = (const Range &other);
|
||||
|
||||
~Range();
|
||||
|
||||
/**
|
||||
* Node within which the range begins
|
||||
*
|
||||
*/
|
||||
Node startContainer() const;
|
||||
|
||||
/**
|
||||
* Offset within the starting node of the range.
|
||||
*
|
||||
*/
|
||||
long startOffset() const;
|
||||
|
||||
/**
|
||||
* Node within which the range ends
|
||||
*
|
||||
*/
|
||||
Node endContainer() const;
|
||||
|
||||
/**
|
||||
* Offset within the ending node of the range.
|
||||
*
|
||||
*/
|
||||
long endOffset() const;
|
||||
|
||||
/**
|
||||
* true if the range is collapsed
|
||||
*
|
||||
*/
|
||||
bool collapsed() const;
|
||||
|
||||
/**
|
||||
* Gets the common ancestor container of the range's two end-points.
|
||||
* Also sets it.
|
||||
*
|
||||
*/
|
||||
// ### BIC make const in the next release
|
||||
Node commonAncestorContainer();
|
||||
|
||||
/**
|
||||
* Sets the attributes describing the start of the range.
|
||||
*
|
||||
* @param refNode The \c refNode value. This parameter
|
||||
* must be different from \c null .
|
||||
*
|
||||
* @param offset The \c startOffset value.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception RangeException
|
||||
* NULL_NODE_ERR: Raised if \c refNode is \c null .
|
||||
*
|
||||
* INVALID_NODE_TYPE_ERR: Raised if \c refNode or an
|
||||
* ancestor of \c refNode is an Attr, Entity,
|
||||
* Notation, or DocumentType node.
|
||||
*
|
||||
* If an offset is out-of-bounds, should it just be fixed up or
|
||||
* should an exception be raised.
|
||||
*
|
||||
*/
|
||||
void setStart ( const Node &refNode, long offset );
|
||||
|
||||
/**
|
||||
* Sets the attributes describing the end of a range.
|
||||
*
|
||||
* @param refNode The \c refNode value. This parameter
|
||||
* must be different from \c null .
|
||||
*
|
||||
* @param offset The \c endOffset value.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception RangeException
|
||||
* NULL_NODE_ERR: Raised if \c refNode is \c null .
|
||||
*
|
||||
* INVALID_NODE_TYPE_ERR: Raised if \c refNode or an
|
||||
* ancestor of \c refNode is an Attr, Entity,
|
||||
* Notation, or DocumentType node.
|
||||
*
|
||||
*/
|
||||
void setEnd ( const Node &refNode, long offset );
|
||||
|
||||
/**
|
||||
* Sets the start position to be before a node
|
||||
*
|
||||
* @param refNode Range starts before \c refNode
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception RangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if an ancestor of \c refNode
|
||||
* is an Attr, Entity, Notation, or DocumentType node or
|
||||
* if \c refNode is a Document, DocumentFragment,
|
||||
* Attr, Entity, or Notation node.
|
||||
*
|
||||
*/
|
||||
void setStartBefore ( const Node &refNode );
|
||||
|
||||
/**
|
||||
* Sets the start position to be after a node
|
||||
*
|
||||
* @param refNode Range starts after \c refNode
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception RangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if an ancestor of \c refNode
|
||||
* is an Attr, Entity, Notation, or DocumentType node or
|
||||
* if \c refNode is a Document, DocumentFragment,
|
||||
* Attr, Entity, or Notation node.
|
||||
*
|
||||
*/
|
||||
void setStartAfter ( const Node &refNode );
|
||||
|
||||
/**
|
||||
* Sets the end position to be before a node.
|
||||
*
|
||||
* @param refNode Range ends before \c refNode
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception RangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if an ancestor of \c refNode
|
||||
* is an Attr, Entity, Notation, or DocumentType node or
|
||||
* if \c refNode is a Document, DocumentFragment,
|
||||
* Attr, Entity, or Notation node.
|
||||
*
|
||||
*/
|
||||
void setEndBefore ( const Node &refNode );
|
||||
|
||||
/**
|
||||
* Sets the end of a range to be after a node
|
||||
*
|
||||
* @param refNode Range ends after \c refNode .
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception RangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if an ancestor of \c refNode
|
||||
* is an Attr, Entity, Notation or DocumentType node or if
|
||||
* \c refNode is a Document, DocumentFragment, Attr,
|
||||
* Entity, or Notation node.
|
||||
*
|
||||
*/
|
||||
void setEndAfter ( const Node &refNode );
|
||||
|
||||
/**
|
||||
* Collapse a range onto one of its end-points
|
||||
*
|
||||
* @param toStart If true, collapses the Range onto its start; if
|
||||
* false, collapses it onto its end.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
void collapse ( bool toStart );
|
||||
|
||||
/**
|
||||
* Select a node and its contents
|
||||
*
|
||||
* @param refNode The node to select.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception RangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if an ancestor of \c refNode
|
||||
* is an Attr, Entity, Notation or DocumentType node or if
|
||||
* \c refNode is a Document, DocumentFragment, Attr,
|
||||
* Entity, or Notation node.
|
||||
*
|
||||
*/
|
||||
void selectNode ( const Node &refNode );
|
||||
|
||||
/**
|
||||
* Select the contents within a node
|
||||
*
|
||||
* @param refNode Node to select from
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception RangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if \c refNode or an
|
||||
* ancestor of \c refNode is an Attr, Entity, Notation
|
||||
* or DocumentType node.
|
||||
*
|
||||
*/
|
||||
void selectNodeContents ( const Node &refNode );
|
||||
|
||||
enum CompareHow {
|
||||
START_TO_START = 0,
|
||||
START_TO_END = 1,
|
||||
END_TO_END = 2,
|
||||
END_TO_START = 3
|
||||
};
|
||||
|
||||
/**
|
||||
* Compare the end-points of two ranges in a document.
|
||||
*
|
||||
* @param how
|
||||
*
|
||||
* @param sourceRange
|
||||
*
|
||||
* @return -1, 0 or 1 depending on whether the corresponding
|
||||
* end-point of the Range is before, equal to, or after the
|
||||
* corresponding end-point of \c sourceRange .
|
||||
*
|
||||
* @exception DOMException
|
||||
* WRONG_DOCUMENT_ERR: Raised if the two Ranges are not in the
|
||||
* same document or document fragment.
|
||||
*
|
||||
*/
|
||||
short compareBoundaryPoints ( CompareHow how, const Range &sourceRange );
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*
|
||||
* Compare the boundary-points of a range.
|
||||
*
|
||||
* Return true if the startContainer is before the endContainer,
|
||||
* or if they are equal.
|
||||
* Return false if the startContainer is after the endContainer.
|
||||
*
|
||||
*/
|
||||
bool boundaryPointsValid ( );
|
||||
|
||||
/**
|
||||
* Removes the contents of a range from the containing document or
|
||||
* document fragment without returning a reference to the removed
|
||||
* content.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the
|
||||
* content of the range is read-only or any of the nodes that
|
||||
* contain any of the content of the range are read-only.
|
||||
*
|
||||
*/
|
||||
void deleteContents ( );
|
||||
|
||||
/**
|
||||
* Moves the contents of a range from the containing document or
|
||||
* document fragment to a new DocumentFragment.
|
||||
*
|
||||
* @return A DocumentFragment containing the extracted contents.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the
|
||||
* content of the range is read-only or any of the nodes which
|
||||
* contain any of the content of the range are read-only.
|
||||
*
|
||||
* HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be
|
||||
* extracted into the new DocumentFragment.
|
||||
*
|
||||
*/
|
||||
DocumentFragment extractContents ( );
|
||||
|
||||
/**
|
||||
* Duplicates the contents of a range
|
||||
*
|
||||
* @return A DocumentFragment containing contents equivalent to
|
||||
* those of this range.
|
||||
*
|
||||
* @exception DOMException
|
||||
* HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be
|
||||
* extracted into the new DocumentFragment.
|
||||
*
|
||||
*/
|
||||
DocumentFragment cloneContents ( );
|
||||
|
||||
/**
|
||||
* Inserts a node into the document or document fragment at the
|
||||
* start of the range.
|
||||
*
|
||||
* @param newNode The node to insert at the start of the range
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of
|
||||
* the start of the range is read-only.
|
||||
*
|
||||
* WRONG_DOCUMENT_ERR: Raised if \c newNode and the
|
||||
* container of the start of the Range were not created from the
|
||||
* same document.
|
||||
*
|
||||
* HIERARCHY_REQUEST_ERR: Raised if the container of the start of
|
||||
* the Range is of a type that does not allow children of the type
|
||||
* of \c newNode or if \c newNode is an
|
||||
* ancestor of the container .
|
||||
*
|
||||
* @exception RangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if \c node is an
|
||||
* Attr, Entity, Notation, DocumentFragment, or Document node.
|
||||
*
|
||||
*/
|
||||
void insertNode ( const Node &newNode );
|
||||
|
||||
/**
|
||||
* Reparents the contents of the range to the given node and
|
||||
* inserts the node at the position of the start of the range.
|
||||
*
|
||||
* @param newParent The node to surround the contents with.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of
|
||||
* either end-point of the range is read-only.
|
||||
*
|
||||
* WRONG_DOCUMENT_ERR: Raised if \c newParent and the
|
||||
* container of the start of the Range were not created from the
|
||||
* same document.
|
||||
*
|
||||
* HIERARCHY_REQUEST_ERR: Raised if the container of the start of
|
||||
* the Range is of a type that does not allow children of the type
|
||||
* of \c newParent or if \c newParent is
|
||||
* an ancestor of the container or if \c node would
|
||||
* end up with a child node of a type not allowed by the type of
|
||||
* \c node .
|
||||
*
|
||||
* @exception RangeException
|
||||
* BAD_ENDPOINTS_ERR: Raised if the range partially selects a
|
||||
* non-text node.
|
||||
*
|
||||
* INVALID_NODE_TYPE_ERR: Raised if \c node is an
|
||||
* Attr, Entity, DocumentType, Notation, Document, or
|
||||
* DocumentFragment node.
|
||||
*
|
||||
*/
|
||||
void surroundContents ( const Node &newParent );
|
||||
|
||||
/**
|
||||
* Produces a new range whose end-points are equal to the
|
||||
* end-points of the range.
|
||||
*
|
||||
* @return The duplicated range.
|
||||
*
|
||||
*/
|
||||
Range cloneRange ( );
|
||||
|
||||
/**
|
||||
* Returns the contents of a range as a string.
|
||||
*
|
||||
* @return The contents of the range.
|
||||
*
|
||||
*/
|
||||
DOMString toString ( );
|
||||
|
||||
/**
|
||||
* @internal Not part of DOM
|
||||
*/
|
||||
DOMString toHTML ( );
|
||||
|
||||
/* Mozilla extension - only works for HTML documents. */
|
||||
DocumentFragment createContextualFragment (const DOMString &html);
|
||||
|
||||
/**
|
||||
* Called to indicate that the range is no longer in use and that
|
||||
* the implementation may relinquish any resources associated with
|
||||
* this range. Subsequent calls to any methods or attribute getters
|
||||
* on this range will result in a DOMException being thrown with an
|
||||
* error code of INVALID_STATE_ERR.
|
||||
*
|
||||
*/
|
||||
void detach ( );
|
||||
|
||||
/**
|
||||
* not part of the DOM
|
||||
* true if the range is detached
|
||||
*
|
||||
*/
|
||||
bool isDetached() const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
RangeImpl *handle() const;
|
||||
bool isNull() const;
|
||||
Range(RangeImpl *i);
|
||||
protected:
|
||||
RangeImpl *impl;
|
||||
private:
|
||||
void throwException(int exceptioncode) const;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,360 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 2000 Frederik Holljen (frederik.holljen@hig.no)
|
||||
* 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 "dom/dom_exception.h"
|
||||
#include "dom/dom_string.h"
|
||||
#include "xml/dom_nodeimpl.h"
|
||||
#include "xml/dom2_traversalimpl.h"
|
||||
|
||||
using namespace DOM;
|
||||
|
||||
|
||||
NodeIterator::NodeIterator()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
NodeIterator::NodeIterator(const NodeIterator &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
NodeIterator::NodeIterator(NodeIteratorImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
NodeIterator &NodeIterator::operator = (const NodeIterator &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if (impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
NodeIterator::~NodeIterator()
|
||||
{
|
||||
if (impl) impl->deref();
|
||||
}
|
||||
|
||||
Node NodeIterator::root()
|
||||
{
|
||||
if (impl) return impl->root();
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long NodeIterator::whatToShow()
|
||||
{
|
||||
if (impl) return impl->whatToShow();
|
||||
return 0;
|
||||
}
|
||||
|
||||
NodeFilter NodeIterator::filter()
|
||||
{
|
||||
if (impl) return impl->filter();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool NodeIterator::expandEntityReferences()
|
||||
{
|
||||
if (impl) return impl->expandEntityReferences();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node NodeIterator::nextNode( )
|
||||
{
|
||||
void* dummy;
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
SharedPtr<NodeImpl> r = impl->nextNode(exceptioncode, dummy);
|
||||
if (exceptioncode)
|
||||
throw DOMException(exceptioncode);
|
||||
return r.get();
|
||||
}
|
||||
|
||||
Node NodeIterator::previousNode( )
|
||||
{
|
||||
void* dummy; // ### rely on C++ exception propagation --- might not be safe
|
||||
// we could probably proxy the DOM exceptions at the very least
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
SharedPtr<NodeImpl> r = impl->previousNode(exceptioncode, dummy);
|
||||
if (exceptioncode)
|
||||
throw DOMException(exceptioncode);
|
||||
return r.get();
|
||||
}
|
||||
|
||||
void NodeIterator::detach()
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
int exceptioncode = 0;
|
||||
impl->detach(exceptioncode);
|
||||
if (exceptioncode)
|
||||
throw DOMException(exceptioncode);
|
||||
}
|
||||
|
||||
NodeIteratorImpl *NodeIterator::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool NodeIterator::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
||||
NodeFilter::NodeFilter()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
NodeFilter::NodeFilter(const NodeFilter &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
NodeFilter::NodeFilter(NodeFilterImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
NodeFilter &NodeFilter::operator = (const NodeFilter &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if (impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
NodeFilter::~NodeFilter()
|
||||
{
|
||||
if (impl) impl->deref();
|
||||
}
|
||||
|
||||
short NodeFilter::acceptNode(const Node &n)
|
||||
{
|
||||
void* dummy;
|
||||
if (impl) return impl->acceptNode(n, dummy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NodeFilter::setCustomNodeFilter(CustomNodeFilter *custom)
|
||||
{
|
||||
if (impl) impl->setCustomNodeFilter(custom);
|
||||
}
|
||||
|
||||
CustomNodeFilter *NodeFilter::customNodeFilter()
|
||||
{
|
||||
if (impl) return impl->customNodeFilter();
|
||||
return 0;
|
||||
}
|
||||
|
||||
NodeFilterImpl *NodeFilter::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool NodeFilter::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
NodeFilter NodeFilter::createCustom(CustomNodeFilter *custom)
|
||||
{
|
||||
NodeFilterImpl *i = new NodeFilterImpl();
|
||||
i->setCustomNodeFilter(custom);
|
||||
return i;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
CustomNodeFilter::CustomNodeFilter()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
CustomNodeFilter::~CustomNodeFilter()
|
||||
{
|
||||
}
|
||||
|
||||
short CustomNodeFilter::acceptNode (const Node &/*n*/)
|
||||
{
|
||||
return NodeFilter::FILTER_ACCEPT;
|
||||
}
|
||||
|
||||
bool CustomNodeFilter::isNull()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DOMString CustomNodeFilter::customNodeFilterType()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
TreeWalker::TreeWalker()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
TreeWalker::TreeWalker(const TreeWalker &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
TreeWalker::TreeWalker(TreeWalkerImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
TreeWalker & TreeWalker::operator = (const TreeWalker &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if (impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
TreeWalker::~TreeWalker()
|
||||
{
|
||||
if (impl) impl->deref();
|
||||
}
|
||||
|
||||
Node TreeWalker::root()
|
||||
{
|
||||
if (impl) return impl->getRoot();
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long TreeWalker::whatToShow()
|
||||
{
|
||||
if (impl) return impl->getWhatToShow();
|
||||
return 0;
|
||||
}
|
||||
|
||||
NodeFilter TreeWalker::filter()
|
||||
{
|
||||
if (impl) return impl->getFilter();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TreeWalker::expandEntityReferences()
|
||||
{
|
||||
if (impl) return impl->getExpandEntityReferences();
|
||||
return false;
|
||||
}
|
||||
|
||||
Node TreeWalker::currentNode()
|
||||
{
|
||||
if (impl) return impl->getCurrentNode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TreeWalker::setCurrentNode(const Node& _currentNode)
|
||||
{
|
||||
int exceptionCode = 0;
|
||||
if (impl) impl->setCurrentNode(_currentNode.handle(), exceptionCode);
|
||||
if (exceptionCode)
|
||||
throw DOMException(exceptionCode);
|
||||
}
|
||||
|
||||
Node TreeWalker::parentNode()
|
||||
{
|
||||
void *dummy;
|
||||
if (impl) return impl->parentNode(dummy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node TreeWalker::firstChild()
|
||||
{
|
||||
void *dummy;
|
||||
if (impl) return impl->firstChild(dummy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node TreeWalker::lastChild()
|
||||
{
|
||||
void *dummy;
|
||||
if (impl) return impl->lastChild(dummy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node TreeWalker::previousSibling()
|
||||
{
|
||||
void *dummy;
|
||||
if (impl) return impl->previousSibling(dummy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node TreeWalker::nextSibling()
|
||||
{
|
||||
void *dummy;
|
||||
if (impl) return impl->nextSibling(dummy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node TreeWalker::previousNode()
|
||||
{
|
||||
void *dummy;
|
||||
if (impl) return impl->previousNode(dummy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node TreeWalker::nextNode()
|
||||
{
|
||||
void *dummy;
|
||||
if (impl) return impl->nextNode(dummy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
TreeWalkerImpl *TreeWalker::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool TreeWalker::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
|
@ -1,533 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 1999 Lars Knoll (knoll@kde.org)
|
||||
* Copyright 2000 Frederik Holljen (frederik.holljen@hig.no)
|
||||
* 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.
|
||||
*
|
||||
* This file includes excerpts from the Document Object Model (DOM)
|
||||
* Level 2 Specification (Candidate Recommendation)
|
||||
* http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
|
||||
* Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef _dom2_traversal_h_
|
||||
#define _dom2_traversal_h_
|
||||
|
||||
#include <khtml_export.h>
|
||||
#include <dom/dom_node.h>
|
||||
#include <dom/dom_misc.h>
|
||||
|
||||
namespace DOM {
|
||||
class Node;
|
||||
class NodeFilter;
|
||||
class NodeIteratorImpl;
|
||||
class NodeFilterImpl;
|
||||
class TreeWalkerImpl;
|
||||
class CustomNodeFilter;
|
||||
class CustomNodeFilterImpl;
|
||||
|
||||
/**
|
||||
* NodeIterators are used to step through a set of nodes, e.g. the set
|
||||
* of nodes in a NodeList, the document subtree governed by a
|
||||
* particular node, the results of a query, or any other set of nodes.
|
||||
* The set of nodes to be iterated is determined by the implementation
|
||||
* of the NodeIterator. DOM Level 2 specifies a single NodeIterator
|
||||
* implementation for document-order traversal of a document subtree.
|
||||
* Instances of these iterators are created by calling
|
||||
* DocumentTraversal.createNodeIterator().
|
||||
*
|
||||
* Any Iterator that returns nodes may implement the
|
||||
* \c NodeIterator interface. Users and vendor libraries may also
|
||||
* choose to create Iterators that implement the \c NodeIterator
|
||||
* interface.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT NodeIterator
|
||||
{
|
||||
friend class NodeIteratorImpl;
|
||||
friend class Document;
|
||||
public:
|
||||
NodeIterator();
|
||||
NodeIterator(const NodeIterator &other);
|
||||
|
||||
NodeIterator & operator = (const NodeIterator &other);
|
||||
|
||||
~NodeIterator();
|
||||
|
||||
/**
|
||||
* The root node of the NodeIterator, as specified when it was created.
|
||||
*/
|
||||
Node root();
|
||||
|
||||
/**
|
||||
* This attribute determines which node types are presented via the
|
||||
* iterator. The available set of constants is defined in the NodeFilter
|
||||
* interface. Nodes not accepted by whatToShow will be skipped, but their
|
||||
* children may still be considered. Note that this skip takes precedence
|
||||
* over the filter, if any.
|
||||
*/
|
||||
unsigned long whatToShow();
|
||||
|
||||
/**
|
||||
* The NodeFilter used to screen nodes.
|
||||
*/
|
||||
NodeFilter filter();
|
||||
|
||||
/**
|
||||
* The value of this flag determines whether the children of entity
|
||||
* reference nodes are visible to the iterator. If false, they and
|
||||
* their descendents will be rejected. Note that this rejection takes
|
||||
* precedence over whatToShow and the filter. Also note that this is
|
||||
* currently the only situation where NodeIterators may reject a complete
|
||||
* subtree rather than skipping individual nodes.
|
||||
*
|
||||
* To produce a view of the document that has entity references expanded
|
||||
* and does not expose the entity reference node itself, use the whatToShow
|
||||
* flags to hide the entity reference node and set expandEntityReferences to
|
||||
* true when creating the iterator. To produce a view of the document that
|
||||
* has entity reference nodes but no entity expansion, use the whatToShow
|
||||
* flags to show the entity reference node and set expandEntityReferences to
|
||||
* false.
|
||||
*/
|
||||
bool expandEntityReferences();
|
||||
|
||||
/**
|
||||
* Returns the next node in the set and advances the position of
|
||||
* the Iterator in the set. After a NodeIterator is created, the
|
||||
* first call to nextNode() returns the first node in the set.
|
||||
*
|
||||
* @return The next \c Node in the set being iterated
|
||||
* over, or \c null if there are no more members in
|
||||
* that set.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node nextNode();
|
||||
|
||||
/**
|
||||
* Returns the previous node in the set and moves the position of
|
||||
* the Iterator backwards in the set.
|
||||
*
|
||||
* @return The previous \c Node in the set being
|
||||
* iterated over, or \c null if there are no more
|
||||
* members in that set.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node previousNode();
|
||||
|
||||
/**
|
||||
* Detaches the NodeIterator from the set which it iterated over,
|
||||
* releasing any computational resources and placing the iterator in the
|
||||
* INVALID state. After detach has been invoked, calls to nextNode or
|
||||
* previousNode will raise the exception INVALID_STATE_ERR.
|
||||
*/
|
||||
void detach();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
NodeIteratorImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
NodeIteratorImpl *impl;
|
||||
NodeIterator(NodeIteratorImpl *i);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Filters are objects that know how to "filter out" nodes. If an
|
||||
* Iterator or \c TreeWalker is given a filter, before it
|
||||
* returns the next node, it applies the filter. If the filter says to
|
||||
* accept the node, the Iterator returns it; otherwise, the Iterator
|
||||
* looks for the next node and pretends that the node that was
|
||||
* rejected was not there.
|
||||
*
|
||||
* The DOM does not provide any filters. Filter is just an interface
|
||||
* that users can implement to provide their own filters.
|
||||
*
|
||||
* Filters do not need to know how to iterate, nor do they need to
|
||||
* know anything about the data structure that is being iterated. This
|
||||
* makes it very easy to write filters, since the only thing they have
|
||||
* to know how to do is evaluate a single node. One filter may be used
|
||||
* with a number of different kinds of Iterators, encouraging code
|
||||
* reuse.
|
||||
*
|
||||
* To create your own custom NodeFilter, define a subclass of
|
||||
* CustomNodeFilter which overrides the acceptNode() method and assign
|
||||
* an instance of it to the NodeFilter. For more details see the
|
||||
* CustomNodeFilter class
|
||||
*/
|
||||
class KHTML_EXPORT NodeFilter
|
||||
{
|
||||
friend class NodeIterator;
|
||||
friend class NodeIteratorImpl;
|
||||
friend class TreeWalker;
|
||||
friend class TreeWalkerImpl;
|
||||
friend class NodeFilterImpl;
|
||||
public:
|
||||
NodeFilter();
|
||||
NodeFilter(const NodeFilter &other);
|
||||
NodeFilter(NodeFilterImpl *i);
|
||||
|
||||
virtual NodeFilter & operator = (const NodeFilter &other);
|
||||
|
||||
virtual ~NodeFilter();
|
||||
/**
|
||||
* The following constants are returned by the acceptNode()
|
||||
* method:
|
||||
*
|
||||
*/
|
||||
enum AcceptCode {
|
||||
FILTER_ACCEPT = 1,
|
||||
FILTER_REJECT = 2,
|
||||
FILTER_SKIP = 3
|
||||
};
|
||||
|
||||
/**
|
||||
* These are the available values for the whatToShow parameter.
|
||||
* They are the same as the set of possible types for Node, and
|
||||
* their values are derived by using a bit position corresponding
|
||||
* to the value of NodeType for the equivalent node type.
|
||||
*
|
||||
*/
|
||||
enum ShowCode {
|
||||
SHOW_ALL = 0xFFFFFFFF,
|
||||
SHOW_ELEMENT = 0x00000001,
|
||||
SHOW_ATTRIBUTE = 0x00000002,
|
||||
SHOW_TEXT = 0x00000004,
|
||||
SHOW_CDATA_SECTION = 0x00000008,
|
||||
SHOW_ENTITY_REFERENCE = 0x00000010,
|
||||
SHOW_ENTITY = 0x00000020,
|
||||
SHOW_PROCESSING_INSTRUCTION = 0x00000040,
|
||||
SHOW_COMMENT = 0x00000080,
|
||||
SHOW_DOCUMENT = 0x00000100,
|
||||
SHOW_DOCUMENT_TYPE = 0x00000200,
|
||||
SHOW_DOCUMENT_FRAGMENT = 0x00000400,
|
||||
SHOW_NOTATION = 0x00000800
|
||||
};
|
||||
|
||||
/**
|
||||
* Test whether a specified node is visible in the logical view of
|
||||
* a TreeWalker or NodeIterator. This function will be called by
|
||||
* the implementation of TreeWalker and NodeIterator; it is not
|
||||
* intended to be called directly from user code.
|
||||
*
|
||||
* @param n The node to check to see if it passes the filter or
|
||||
* not.
|
||||
*
|
||||
* @return a constant to determine whether the node is accepted,
|
||||
* rejected, or skipped, as defined <a
|
||||
* href="#Traversal-NodeFilter-acceptNode-constants"> above </a> .
|
||||
*
|
||||
*/
|
||||
virtual short acceptNode (const Node &n);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
virtual NodeFilterImpl *handle() const;
|
||||
virtual bool isNull() const;
|
||||
|
||||
void setCustomNodeFilter(CustomNodeFilter *custom);
|
||||
CustomNodeFilter *customNodeFilter();
|
||||
static NodeFilter createCustom(CustomNodeFilter *custom);
|
||||
|
||||
protected:
|
||||
NodeFilterImpl *impl;
|
||||
};
|
||||
|
||||
/**
|
||||
* CustomNodeFilter can be used to define your own NodeFilter for use
|
||||
* with NodeIterators and TreeWalkers. You can create a custom filter
|
||||
* by doing the following:
|
||||
*
|
||||
* class MyCustomNodeFilter {
|
||||
* .....
|
||||
* virtual short acceptNode (const Node &n);
|
||||
* .....
|
||||
* }
|
||||
*
|
||||
* Then in your program:
|
||||
*
|
||||
* short MyCustomNodeFilter::acceptNode (const Node &n)
|
||||
* {
|
||||
* if (condition)
|
||||
* return NodeFilter::FILTER_ACCEPT;
|
||||
* else
|
||||
* ....
|
||||
* }
|
||||
*
|
||||
*
|
||||
* MyCustomFilter *filter = new MyCustomFilter();
|
||||
* NodeFilter nf = NodeFilter::createCustom(filter);
|
||||
* NodeIterator ni = document.createNodeIterator(document,NodeFilter.SHOW_ALL,nf,false);
|
||||
*
|
||||
* The default implementation of acceptNode() returns NodeFilter::FILTER_ACCEPT
|
||||
* for all nodes.
|
||||
*
|
||||
*/
|
||||
|
||||
class KHTML_EXPORT CustomNodeFilter : public DomShared {
|
||||
public:
|
||||
CustomNodeFilter();
|
||||
virtual ~CustomNodeFilter();
|
||||
virtual short acceptNode (const Node &n);
|
||||
virtual bool isNull();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*
|
||||
* Returns a name specifying the type of custom node filter. Useful for checking
|
||||
* if an custom node filter is of a particular sublass.
|
||||
*
|
||||
*/
|
||||
virtual DOMString customNodeFilterType();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @internal
|
||||
* Reserved. Do not use in your subclasses.
|
||||
*/
|
||||
CustomNodeFilterImpl *impl;
|
||||
};
|
||||
|
||||
/**
|
||||
* \c TreeWalker objects are used to navigate a document
|
||||
* tree or subtree using the view of the document defined by its
|
||||
* \c whatToShow flags and any filters that are defined
|
||||
* for the \c TreeWalker . Any function which performs
|
||||
* navigation using a \c TreeWalker will automatically
|
||||
* support any view defined by a \c TreeWalker .
|
||||
*
|
||||
* Omitting nodes from the logical view of a subtree can result in a
|
||||
* structure that is substantially different from the same subtree in
|
||||
* the complete, unfiltered document. Nodes that are siblings in the
|
||||
* TreeWalker view may be children of different, widely separated
|
||||
* nodes in the original view. For instance, consider a Filter that
|
||||
* skips all nodes except for Text nodes and the root node of a
|
||||
* document. In the logical view that results, all text nodes will be
|
||||
* siblings and appear as direct children of the root node, no matter
|
||||
* how deeply nested the structure of the original document.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT TreeWalker
|
||||
{
|
||||
friend class Document;
|
||||
friend class TreeWalkerImpl;
|
||||
public:
|
||||
TreeWalker();
|
||||
TreeWalker(const TreeWalker &other);
|
||||
|
||||
TreeWalker & operator = (const TreeWalker &other);
|
||||
|
||||
~TreeWalker();
|
||||
|
||||
|
||||
/**
|
||||
* The root node of the TreeWalker, as specified when it was created.
|
||||
*/
|
||||
Node root();
|
||||
|
||||
/**
|
||||
* This attribute determines which node types are presented via the
|
||||
* TreeWalker. The available set of constants is defined in the NodeFilter
|
||||
* interface. Nodes not accepted by whatToShow will be skipped, but their
|
||||
* children may still be considered. Note that this skip takes precedence
|
||||
* over the filter, if any.
|
||||
*/
|
||||
unsigned long whatToShow();
|
||||
|
||||
/**
|
||||
* The filter used to screen nodes.
|
||||
*/
|
||||
NodeFilter filter();
|
||||
|
||||
/**
|
||||
* The value of this flag determines whether the children of entity
|
||||
* reference nodes are visible to the TreeWalker. If false, they and their
|
||||
* descendents will be rejected. Note that this rejection takes precedence
|
||||
* over whatToShow and the filter, if any.
|
||||
*
|
||||
* To produce a view of the document that has entity references expanded
|
||||
* and does not expose the entity reference node itself, use the whatToShow
|
||||
* flags to hide the entity reference node and set expandEntityReferences
|
||||
* to true when creating the TreeWalker. To produce a view of the document
|
||||
* that has entity reference nodes but no entity expansion, use the
|
||||
* whatToShow flags to show the entity reference node and set
|
||||
* expandEntityReferences to false.
|
||||
*/
|
||||
bool expandEntityReferences();
|
||||
|
||||
/**
|
||||
* The node at which the TreeWalker is currently positioned.
|
||||
* Alterations to the DOM tree may cause the current node to no longer be
|
||||
* accepted by the TreeWalker's associated filter. currentNode may also be
|
||||
* explicitly set to any node, whether or not it is within the subtree
|
||||
* specified by the root node or would be accepted by the filter and
|
||||
* whatToShow flags. Further traversal occurs relative to currentNode even
|
||||
* if it is not part of the current view, by applying the filters in the
|
||||
* requested direction; if no traversal is possible, currentNode is not changed.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NOT_SUPPORTED_ERR: Raised if an attempt is made to set currentNode to null.
|
||||
*/
|
||||
Node currentNode();
|
||||
|
||||
/**
|
||||
* see currentNode
|
||||
*/
|
||||
void setCurrentNode(const Node &_currentNode);
|
||||
|
||||
/**
|
||||
* Moves to and returns the parent node of the current node. If
|
||||
* there is no parent node, or if the current node is the root
|
||||
* node from which this TreeWalker was created, retains the
|
||||
* current position and returns null.
|
||||
*
|
||||
* @return The new parent node, or null if the current node has no
|
||||
* parent in the TreeWalker's logical view.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node parentNode();
|
||||
|
||||
/**
|
||||
* Moves the \c TreeWalker to the first child of the
|
||||
* current node, and returns the new node. If the current node has
|
||||
* no children, returns \c null , and retains the
|
||||
* current node.
|
||||
*
|
||||
* @return The new node, or \c null if the current
|
||||
* node has no children.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node firstChild();
|
||||
|
||||
/**
|
||||
* Moves the \c TreeWalker to the last child of the
|
||||
* current node, and returns the new node. If the current node has
|
||||
* no children, returns \c null , and retains the
|
||||
* current node.
|
||||
*
|
||||
* @return The new node, or \c null if the current
|
||||
* node has no children.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node lastChild();
|
||||
|
||||
/**
|
||||
* Moves the \c TreeWalker to the previous sibling of
|
||||
* the current node, and returns the new node. If the current node
|
||||
* has no previous sibling, returns \c null , and
|
||||
* retains the current node.
|
||||
*
|
||||
* @return The new node, or \c null if the current
|
||||
* node has no previous sibling.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node previousSibling();
|
||||
|
||||
/**
|
||||
* Moves the \c TreeWalker to the next sibling of the
|
||||
* current node, and returns the new node. If the current node has
|
||||
* no next sibling, returns \c null , and retains the
|
||||
* current node.
|
||||
*
|
||||
* @return The new node, or \c null if the current
|
||||
* node has no next sibling.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node nextSibling();
|
||||
|
||||
/**
|
||||
* Moves the \c TreeWalker to the previous node in
|
||||
* document order relative to the current node, and returns the
|
||||
* new node. If the current node has no previous node, returns
|
||||
* \c null , and retains the current node.
|
||||
*
|
||||
* @return The new node, or \c null if the current
|
||||
* node has no previous node.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node previousNode();
|
||||
|
||||
/**
|
||||
* Moves the \c TreeWalker to the next node in
|
||||
* document order relative to the current node, and returns the
|
||||
* new node. If the current node has no next node, returns
|
||||
* \c null , and retains the current node.
|
||||
*
|
||||
* @return The new node, or \c null if the current
|
||||
* node has no next node.
|
||||
*
|
||||
* @exception Exceptions from user code
|
||||
* Any exceptions raised by a user-written Filter will propagate
|
||||
* through.
|
||||
*
|
||||
*/
|
||||
Node nextNode();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
TreeWalkerImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
TreeWalker(TreeWalkerImpl *i);
|
||||
TreeWalkerImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,95 +0,0 @@
|
|||
/**
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 2001 Peter Kelly (pmk@post.com)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dom/dom2_views.h"
|
||||
#include "dom/dom_exception.h"
|
||||
#include "dom/dom_doc.h"
|
||||
#include "xml/dom_elementimpl.h"
|
||||
#include "xml/dom2_viewsimpl.h"
|
||||
|
||||
using namespace DOM;
|
||||
|
||||
|
||||
AbstractView::AbstractView()
|
||||
{
|
||||
impl = 0;
|
||||
}
|
||||
|
||||
|
||||
AbstractView::AbstractView(const AbstractView &other)
|
||||
{
|
||||
impl = other.impl;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
|
||||
AbstractView::AbstractView(AbstractViewImpl *i)
|
||||
{
|
||||
impl = i;
|
||||
if (impl) impl->ref();
|
||||
}
|
||||
|
||||
AbstractView::~AbstractView()
|
||||
{
|
||||
if (impl)
|
||||
impl->deref();
|
||||
}
|
||||
|
||||
AbstractView &AbstractView::operator = (const AbstractView &other)
|
||||
{
|
||||
if ( impl != other.impl ) {
|
||||
if(impl) impl->deref();
|
||||
impl = other.impl;
|
||||
if(impl) impl->ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Document AbstractView::document() const
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->document();
|
||||
}
|
||||
|
||||
CSSStyleDeclaration AbstractView::getComputedStyle(const Element &elt, const DOMString &pseudoElt)
|
||||
{
|
||||
if (!impl)
|
||||
throw DOMException(DOMException::INVALID_STATE_ERR);
|
||||
|
||||
return impl->getComputedStyle(static_cast<ElementImpl*>(elt.handle()),pseudoElt.implementation());
|
||||
}
|
||||
|
||||
|
||||
AbstractViewImpl *AbstractView::handle() const
|
||||
{
|
||||
return impl;
|
||||
}
|
||||
|
||||
bool AbstractView::isNull() const
|
||||
{
|
||||
return (impl == 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* This file is part of the DOM implementation for KDE.
|
||||
*
|
||||
* Copyright 2001 Peter Kelly (pmk@post.com)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _DOM_Views_h_
|
||||
#define _DOM_Views_h_
|
||||
|
||||
#include <khtml_export.h>
|
||||
namespace DOM {
|
||||
|
||||
class Document;
|
||||
class AbstractViewImpl;
|
||||
class CSSStyleDeclaration;
|
||||
class Element;
|
||||
class DOMString;
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 2
|
||||
*
|
||||
* A base interface that all views shall derive from.
|
||||
*
|
||||
*/
|
||||
class KHTML_EXPORT AbstractView {
|
||||
friend class Event;
|
||||
friend class UIEvent;
|
||||
friend class MouseEvent;
|
||||
friend class MutationEvent;
|
||||
friend class Document;
|
||||
public:
|
||||
AbstractView();
|
||||
AbstractView(const AbstractView &other);
|
||||
virtual ~AbstractView();
|
||||
|
||||
AbstractView & operator = (const AbstractView &other);
|
||||
|
||||
/**
|
||||
* The source DocumentView of which this is an AbstractView.
|
||||
*/
|
||||
Document document() const;
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 2
|
||||
* This method is from the ViewCSS interface
|
||||
*
|
||||
* This method is used to get the computed style as it is defined in
|
||||
* [CSS2].
|
||||
*
|
||||
* @param elt The element whose style is to be computed. This parameter
|
||||
* cannot be null.
|
||||
*
|
||||
* @param pseudoElt The pseudo-element or null if none.
|
||||
*
|
||||
* @return The computed style. The CSSStyleDeclaration is read-only and
|
||||
* contains only absolute values.
|
||||
*/
|
||||
CSSStyleDeclaration getComputedStyle(const Element &elt, const DOMString &pseudoElt);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* not part of the DOM
|
||||
*/
|
||||
AbstractViewImpl *handle() const;
|
||||
bool isNull() const;
|
||||
|
||||
protected:
|
||||
AbstractView(AbstractViewImpl *i);
|
||||
AbstractViewImpl *impl;
|
||||
};
|
||||
|
||||
|
||||
} //namespace
|
||||
#endif
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* XPathExceptionImpl.cpp - Copyright 2005 Frerich Raabe <raabe@kde.org>
|
||||
*
|
||||
* 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 THE AUTHOR ``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 THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "dom3_xpath.h"
|
||||
|
||||
using namespace DOM;
|
||||
|
||||
DOMString XPathException::codeAsString(int code) {
|
||||
switch ( code ) {
|
||||
case INVALID_EXPRESSION_ERR:
|
||||
return DOMString( "INVALID_EXPRESSION_ERR" );
|
||||
case TYPE_ERR:
|
||||
return DOMString( "TYPE_ERR" );
|
||||
}
|
||||
return DOMString( "(unknown exception code)" );
|
||||
}
|
||||
|
||||
DOMString XPathException::codeAsString() const
|
||||
{
|
||||
return codeAsString(code);
|
||||
}
|
||||
|
||||
int XPathException::toCode( int xpathCode )
|
||||
{
|
||||
return xpathCode + _EXCEPTION_OFFSET;
|
||||
}
|
||||
|
||||
bool XPathException::isXPathExceptionCode(int exceptioncode)
|
||||
{
|
||||
return exceptioncode >= _EXCEPTION_OFFSET && exceptioncode < _EXCEPTION_MAX;
|
||||
}
|
||||
|
||||
// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
* dom3_xpath.h - Copyright 2005 Frerich Raabe <raabe@kde.org>
|
||||
* Copyright 2010 Maksim Orlovich <maksim@kde.org>
|
||||
* Copyright 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.
|
||||
*
|
||||
* Based on kdomxpath.h, which was licensed as follows:
|
||||
* 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 THE AUTHOR ``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 THE AUTHOR 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 DOM3_XPATH_H
|
||||
#define DOM3_XPATH_H
|
||||
|
||||
#include <dom_string.h>
|
||||
|
||||
namespace DOM {
|
||||
|
||||
enum XPathExceptionCode {
|
||||
INVALID_EXPRESSION_ERR = 51,
|
||||
TYPE_ERR = 52
|
||||
};
|
||||
|
||||
namespace XPath {
|
||||
enum XPathResultType {
|
||||
ANY_TYPE = 0,
|
||||
NUMBER_TYPE = 1,
|
||||
STRING_TYPE = 2,
|
||||
BOOLEAN_TYPE = 3,
|
||||
UNORDERED_NODE_ITERATOR_TYPE = 4,
|
||||
ORDERED_NODE_ITERATOR_TYPE = 5,
|
||||
UNORDERED_NODE_SNAPSHOT_TYPE = 6,
|
||||
ORDERED_NODE_SNAPSHOT_TYPE = 7,
|
||||
ANY_UNORDERED_NODE_TYPE = 8,
|
||||
FIRST_ORDERED_NODE_TYPE = 9
|
||||
};
|
||||
}
|
||||
|
||||
class KHTML_EXPORT XPathException
|
||||
{
|
||||
public:
|
||||
XPathException(unsigned short _code) { code = _code; }
|
||||
XPathException(const XPathException &other) { code = other.code; }
|
||||
|
||||
XPathException & operator = (const XPathException &other)
|
||||
{ code = other.code; return *this; }
|
||||
|
||||
virtual ~XPathException() {}
|
||||
|
||||
/**
|
||||
* An integer indicating the type of error generated, as given by DOM L3 XPath
|
||||
*
|
||||
*/
|
||||
unsigned short code;
|
||||
|
||||
enum XPathExceptionCode
|
||||
{
|
||||
INVALID_EXPRESSION_ERR = 51,
|
||||
TYPE_ERR = 52,
|
||||
|
||||
_EXCEPTION_OFFSET = 4000,
|
||||
_EXCEPTION_MAX = 4999
|
||||
};
|
||||
|
||||
DOMString codeAsString() const;
|
||||
static DOMString codeAsString(int xpathCode);
|
||||
|
||||
/** @internal - converts XPath exception code to internal code */
|
||||
static int toCode(int xpathCode);
|
||||
|
||||
/** @internal - checks to see whether internal code is an XPath one */
|
||||
static bool isXPathExceptionCode(int exceptioncode);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // DOM3_XPATH_H
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue