[webkit-changes] cvs commit: WebCore/kwq KWQPainter.h KWQPainter.mm
Eric
eseidel at opensource.apple.com
Thu Sep 22 20:28:30 PDT 2005
eseidel 05/09/22 20:28:30
Modified: . ChangeLog
WebCore.xcodeproj project.pbxproj
khtml khtml_part.cpp
khtml/xml dom_docimpl.cpp dom_docimpl.h
kwq KWQPainter.h KWQPainter.mm
Added: WebCore+SVG dom_kdomdocumentwrapper.cpp
dom_kdomdocumentwrapper.h
dom_kdomnodetreewrapper.cpp
dom_kdomnodetreewrapper.h render_kcanvaswrapper.cpp
render_kcanvaswrapper.h xml_kdomtokenizer.cpp
xml_kdomtokenizer.h
Log:
Bug #: 5003
Submitted by: eseidel
Reviewed by: hyatt
Added KDOM and KCanvas wrapper objects for the WebCore DOM
and WebCore render tree. This allows using SVG in any
WebKit app, including Safari.
Also added extensions to QPainter to return a
KRenderingDeviceContext object to be passed into KCanvas.
http://bugzilla.opendarwin.org/show_bug.cgi?id=5003
* WebCore+SVG/dom_kdomdocumentwrapper.cpp: Added.
(KDOMDocumentWrapperImpl::renderingDevice):
(KDOMDocumentWrapperImpl::KDOMDocumentWrapperImpl):
(KDOMDocumentWrapperImpl::~KDOMDocumentWrapperImpl):
(DOM::KDOMDocumentWrapperImpl::createTokenizer):
(KDOMDocumentWrapperImpl::svgView):
* WebCore+SVG/dom_kdomdocumentwrapper.h: Added.
* WebCore+SVG/dom_kdomnodetreewrapper.cpp: Added.
(DOM::KDOMNodeTreeWrapperImpl::KDOMNodeTreeWrapperImpl):
(KDOMNodeTreeWrapperImpl::~KDOMNodeTreeWrapperImpl):
(KDOMNodeTreeWrapperImpl::attach):
(KDOMNodeTreeWrapperImpl::createRenderer):
* WebCore+SVG/dom_kdomnodetreewrapper.h: Added.
* WebCore+SVG/render_kcanvaswrapper.cpp: Added.
(RenderKCanvasWrapper::RenderKCanvasWrapper):
(RenderKCanvasWrapper::~RenderKCanvasWrapper):
(RenderKCanvasWrapper::layout):
(RenderKCanvasWrapper::paint):
(RenderKCanvasWrapper::intrinsicWidth):
(RenderKCanvasWrapper::intrinsicHeight):
* WebCore+SVG/render_kcanvaswrapper.h: Added.
(khtml::RenderKCanvasWrapper::renderName):
(khtml::RenderKCanvasWrapper::setCanvas):
* WebCore+SVG/xml_kdomtokenizer.cpp: Added.
(KDOMTokenizer::KDOMTokenizer):
(KDOMTokenizer::~KDOMTokenizer):
(KDOMTokenizer::documentWrapper):
(KDOMTokenizer::write):
(KDOMTokenizer::setOnHold):
(KDOMTokenizer::finish):
(KDOMTokenizer::isWaitingForScripts):
(khtml::newKDOMTokenizer):
* WebCore+SVG/xml_kdomtokenizer.h: Added.
* WebCore.xcodeproj/project.pbxproj:
* khtml/khtml_part.cpp:
(KHTMLPart::begin):
* khtml/xml/dom_docimpl.cpp:
(DOMImplementationImpl::createKDOMDocument):
* khtml/xml/dom_docimpl.h:
* kwq/KWQPainter.h:
* kwq/KWQPainter.mm:
(QPainterPrivate::QPainterPrivate):
(QPainterPrivate::~QPainterPrivate):
(QPainter::renderingDeviceContext):
Revision Changes Path
1.147 +56 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -r1.146 -r1.147
--- ChangeLog 22 Sep 2005 19:19:54 -0000 1.146
+++ ChangeLog 23 Sep 2005 03:28:25 -0000 1.147
@@ -1,3 +1,59 @@
+2005-09-22 Eric Seidel <eseidel at apple.com>
+
+ Reviewed by hyatt.
+
+ Added KDOM and KCanvas wrapper objects for the WebCore DOM
+ and WebCore render tree. This allows using SVG in any
+ WebKit app, including Safari.
+ Also added extensions to QPainter to return a
+ KRenderingDeviceContext object to be passed into KCanvas.
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=5003
+
+ * WebCore+SVG/dom_kdomdocumentwrapper.cpp: Added.
+ (KDOMDocumentWrapperImpl::renderingDevice):
+ (KDOMDocumentWrapperImpl::KDOMDocumentWrapperImpl):
+ (KDOMDocumentWrapperImpl::~KDOMDocumentWrapperImpl):
+ (DOM::KDOMDocumentWrapperImpl::createTokenizer):
+ (KDOMDocumentWrapperImpl::svgView):
+ * WebCore+SVG/dom_kdomdocumentwrapper.h: Added.
+ * WebCore+SVG/dom_kdomnodetreewrapper.cpp: Added.
+ (DOM::KDOMNodeTreeWrapperImpl::KDOMNodeTreeWrapperImpl):
+ (KDOMNodeTreeWrapperImpl::~KDOMNodeTreeWrapperImpl):
+ (KDOMNodeTreeWrapperImpl::attach):
+ (KDOMNodeTreeWrapperImpl::createRenderer):
+ * WebCore+SVG/dom_kdomnodetreewrapper.h: Added.
+ * WebCore+SVG/render_kcanvaswrapper.cpp: Added.
+ (RenderKCanvasWrapper::RenderKCanvasWrapper):
+ (RenderKCanvasWrapper::~RenderKCanvasWrapper):
+ (RenderKCanvasWrapper::layout):
+ (RenderKCanvasWrapper::paint):
+ (RenderKCanvasWrapper::intrinsicWidth):
+ (RenderKCanvasWrapper::intrinsicHeight):
+ * WebCore+SVG/render_kcanvaswrapper.h: Added.
+ (khtml::RenderKCanvasWrapper::renderName):
+ (khtml::RenderKCanvasWrapper::setCanvas):
+ * WebCore+SVG/xml_kdomtokenizer.cpp: Added.
+ (KDOMTokenizer::KDOMTokenizer):
+ (KDOMTokenizer::~KDOMTokenizer):
+ (KDOMTokenizer::documentWrapper):
+ (KDOMTokenizer::write):
+ (KDOMTokenizer::setOnHold):
+ (KDOMTokenizer::finish):
+ (KDOMTokenizer::isWaitingForScripts):
+ (khtml::newKDOMTokenizer):
+ * WebCore+SVG/xml_kdomtokenizer.h: Added.
+ * WebCore.xcodeproj/project.pbxproj:
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::begin):
+ * khtml/xml/dom_docimpl.cpp:
+ (DOMImplementationImpl::createKDOMDocument):
+ * khtml/xml/dom_docimpl.h:
+ * kwq/KWQPainter.h:
+ * kwq/KWQPainter.mm:
+ (QPainterPrivate::QPainterPrivate):
+ (QPainterPrivate::~QPainterPrivate):
+ (QPainter::renderingDeviceContext):
+
2005-09-22 Darin Adler <darin at apple.com>
Reviewed by Geoff.
1.1 SVGSupport/WebCore+SVG/dom_kdomdocumentwrapper.cpp
Index: dom_kdomdocumentwrapper.cpp
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "dom_kdomdocumentwrapper.h"
#include "xml_kdomtokenizer.h"
#include "KWQKSVGView.h"
#include "KWQKSVGPart.h"
#include "kcanvas/KCanvas.h"
#include "kcanvas/device/quartz/KRenderingDeviceQuartz.h"
using namespace khtml;
using namespace DOM;
KRenderingDeviceQuartz *KDOMDocumentWrapperImpl::renderingDevice()
{
static KRenderingDeviceQuartz *__quartzRenderingDevice = nil;
if (!__quartzRenderingDevice)
__quartzRenderingDevice = new KRenderingDeviceQuartz();
return __quartzRenderingDevice;
}
KDOMDocumentWrapperImpl::KDOMDocumentWrapperImpl(DOMImplementationImpl *i, KHTMLView *v) : DocumentImpl(i,v)
{
m_svgPart = new KSVG::KSVGPart();
m_canvas = new KCanvas(KDOMDocumentWrapperImpl::renderingDevice());
svgView()->canvasView()->init(m_canvas, NULL);
m_canvas->addView(svgView()->canvasView());
}
KDOMDocumentWrapperImpl::~KDOMDocumentWrapperImpl()
{
delete m_svgPart;
delete m_canvas;
}
Tokenizer *DOM::KDOMDocumentWrapperImpl::createTokenizer()
{
return newKDOMTokenizer(docPtr(), m_view);
}
KSVG::KSVGView *KDOMDocumentWrapperImpl::svgView()
{
return m_svgPart ? static_cast<KSVG::KSVGView *>(m_svgPart->view()) : NULL;
}
1.1 SVGSupport/WebCore+SVG/dom_kdomdocumentwrapper.h
Index: dom_kdomdocumentwrapper.h
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _DOM_KDOMDocumentWrapperImpl_h
#define _DOM_KDOMDocumentWrapperImpl_h
#include "khtml/xml/dom_docimpl.h"
class KCanvas;
class KRenderingDeviceQuartz;
namespace KSVG {
class KSVGPart;
class KSVGView;
}
namespace DOM {
class KDOMDocumentWrapperImpl : public DocumentImpl
{
public:
KDOMDocumentWrapperImpl(DOMImplementationImpl *i, KHTMLView *v);
virtual ~KDOMDocumentWrapperImpl();
virtual khtml::Tokenizer *createTokenizer();
KSVG::KSVGView *svgView();
private:
static KRenderingDeviceQuartz *renderingDevice();
KSVG::KSVGPart *m_svgPart;
KCanvas *m_canvas;
};
}; // namespace
#endif
1.1 SVGSupport/WebCore+SVG/dom_kdomnodetreewrapper.cpp
Index: dom_kdomnodetreewrapper.cpp
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "dom_kdomnodetreewrapper.h"
#include "dom_elementimpl.h"
#include "render_object.h"
#include "render_kcanvaswrapper.h"
#include "kdom/core/DocumentImpl.h"
#include "ksvg2/svg/SVGDocumentImpl.h"
using namespace khtml;
using namespace DOM;
using namespace KSVG;
DOM::KDOMNodeTreeWrapperImpl::KDOMNodeTreeWrapperImpl(DOM::DocumentPtr *doc, KDOM::DocumentImpl *wrapped) :
DOM::ElementImpl(QualifiedName("svg", "svg", "http://www.w3.org/2000/svg"), doc), m_wrappedDoc(wrapped)
{
if (m_wrappedDoc)
m_wrappedDoc->ref();
}
KDOMNodeTreeWrapperImpl::~KDOMNodeTreeWrapperImpl()
{
if (m_wrappedDoc)
m_wrappedDoc->deref();
}
void KDOMNodeTreeWrapperImpl::attach()
{
ElementImpl::attach();
if (renderer()) {
RenderKCanvasWrapper *canvasWrapper = static_cast<RenderKCanvasWrapper*>(renderer());
SVGDocumentImpl *svgDoc = static_cast<KSVG::SVGDocumentImpl *>(m_wrappedDoc);
canvasWrapper->setCanvas(svgDoc->canvas());
}
}
RenderObject *KDOMNodeTreeWrapperImpl::createRenderer(RenderArena *arena, RenderStyle *style)
{
return new (arena) RenderKCanvasWrapper(this);
}
1.1 SVGSupport/WebCore+SVG/dom_kdomnodetreewrapper.h
Index: dom_kdomnodetreewrapper.h
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _DOM_KDOMNodeTreeWrapperImpl_h
#define _DOM_KDOMNodeTreeWrapperImpl_h
#include "dom_elementimpl.h"
class RenderArena;
namespace khtml {
class RenderObject;
class RenderStyle;
}
namespace KDOM {
class DocumentImpl;
};
namespace DOM {
class KDOMNodeTreeWrapperImpl : public ElementImpl
{
public:
KDOMNodeTreeWrapperImpl(DocumentPtr *doc, KDOM::DocumentImpl *wrapped);
virtual ~KDOMNodeTreeWrapperImpl();
virtual khtml::RenderObject *createRenderer(RenderArena *arena, khtml::RenderStyle *style);
virtual void attach();
private:
KDOM::DocumentImpl *m_wrappedDoc;
};
}; // namespace
#endif
1.1 SVGSupport/WebCore+SVG/render_kcanvaswrapper.cpp
Index: render_kcanvaswrapper.cpp
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "render_kcanvaswrapper.h"
#include "kcanvas/KCanvas.h"
#include "kcanvas/KCanvasContainer.h"
#include "kcanvas/device/KRenderingDevice.h"
using namespace khtml;
RenderKCanvasWrapper::RenderKCanvasWrapper(DOM::KDOMNodeTreeWrapperImpl *node) : RenderReplaced(node), m_canvas(0)
{
}
RenderKCanvasWrapper::~RenderKCanvasWrapper()
{
}
void RenderKCanvasWrapper::layout()
{
QSize canvasSize = m_canvas->canvasSize();
// this should go somewhere in ksvg2
if ((canvasSize == QSize(-1,-1)) && m_canvas->rootContainer()) {
QRect canvasBounds = m_canvas->rootContainer()->bbox();
canvasSize = QSize(abs(canvasBounds.x()) + canvasBounds.width(), abs(canvasBounds.y()) + canvasBounds.height());
m_canvas->setCanvasSize(canvasSize);
}
setWidth(canvasSize.width());
setHeight(canvasSize.height());
setNeedsLayout(false);
}
void RenderKCanvasWrapper::paint(PaintInfo &paintInfo, int parentX, int parentY)
{
if (paintInfo.p->paintingDisabled())
return;
if (paintInfo.phase == PaintActionBlockBackground) {
paintRootBoxDecorations(paintInfo, parentX, parentY);
return;
}
if (!RenderReplaced::shouldPaint(paintInfo, parentX, parentY) || (paintInfo.phase != PaintActionForeground))
return;
if (!m_canvas || !m_canvas->rootContainer() || !m_canvas->renderingDevice())
return;
KRenderingDevice *renderingDevice = m_canvas->renderingDevice();
renderingDevice->pushContext(paintInfo.p->renderingDeviceContext());
paintInfo.p->save();
QRect dirtyRect = paintInfo.r; //QRect([drawView mapViewRectToCanvas:dirtyViewRect]);
m_canvas->rootContainer()->draw(dirtyRect);
// restore drawing state
paintInfo.p->restore();
renderingDevice->popContext();
}
int RenderKCanvasWrapper::intrinsicWidth() const
{
return 150;
}
int RenderKCanvasWrapper::intrinsicHeight() const
{
return 150;
}
1.1 SVGSupport/WebCore+SVG/render_kcanvaswrapper.h
Index: render_kcanvaswrapper.h
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RENDER_KCANVASWRAPPER_H
#define RENDER_KCANVASWRAPPER_H
#include "khtml/misc/loader.h"
#include "khtml/rendering/render_replaced.h"
#include "dom_kdomnodetreewrapper.h"
class KCanvas;
namespace khtml {
class RenderKCanvasWrapper : public RenderReplaced
{
public:
RenderKCanvasWrapper(DOM::KDOMNodeTreeWrapperImpl *node);
virtual ~RenderKCanvasWrapper();
virtual const char *renderName() const { return "RenderKCanvasWrapper"; }
virtual void layout();
virtual void paint(PaintInfo &i, int _tx, int _ty);
void setCanvas(KCanvas *canvas) { m_canvas = canvas; }
int RenderKCanvasWrapper::intrinsicWidth() const;
int RenderKCanvasWrapper::intrinsicHeight() const;
private:
KCanvas *m_canvas;
};
}; // namespace
#endif
1.1 SVGSupport/WebCore+SVG/xml_kdomtokenizer.cpp
Index: xml_kdomtokenizer.cpp
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <qstring.h>
#include "loader_client.h"
#include "khtmlview.h"
#include "dom_kdomdocumentwrapper.h"
#include "dom_kdomnodetreewrapper.h"
#include "dom_nodeimpl.h"
#include "xml_tokenizer.h"
#include "xml_kdomtokenizer.h"
#include "kdom/core/DOMConfigurationImpl.h"
#include "kdom/backends/libxml/LibXMLParser.h"
#include "kdom/core/DocumentImpl.h"
#include "ksvg2/svg/SVGDocumentImpl.h"
#include "ksvg2/misc/KSVGDocumentBuilder.h"
namespace DOM {
class KDOMDocumentWrapperImpl;
};
namespace khtml {
class TokenizerString;
class KDOMTokenizer : public Tokenizer, public CachedObjectClient
{
public:
KDOMTokenizer(DOM::DocumentPtr *, KHTMLView * = 0);
~KDOMTokenizer();
// from Tokenizer
virtual void write(const TokenizerString &str, bool);
virtual void finish();
virtual void setOnHold(bool onHold);
virtual bool isWaitingForScripts() const;
private:
DOM::KDOMDocumentWrapperImpl *documentWrapper();
DOM::DocumentPtr *m_doc;
KHTMLView *m_view;
QString m_xmlCode;
};
}; // namespace
using namespace khtml;
using namespace KSVG;
using namespace DOM;
// --------------------------------
KDOMTokenizer::KDOMTokenizer(DOM::DocumentPtr *_doc, KHTMLView *_view)
: m_doc(_doc), m_view(_view)
{
if (m_doc)
m_doc->ref();
//FIXME: KDOMTokenizer should use this in a fashion similiar to how
//HTMLTokenizer uses loadStopped, in the future.
loadStopped = false;
}
KDOMTokenizer::~KDOMTokenizer()
{
if (m_doc)
m_doc->deref();
}
KDOMDocumentWrapperImpl *KDOMTokenizer::documentWrapper()
{
return m_doc ? static_cast<KDOMDocumentWrapperImpl *>(m_doc->document()) : NULL;
}
void KDOMTokenizer::write(const TokenizerString &s, bool /*appendData*/ )
{
m_xmlCode += s.toString();
}
void KDOMTokenizer::setOnHold(bool onHold)
{
// Will we need to implement this when we do incremental XML parsing?
}
void KDOMTokenizer::finish()
{
KSVG::DocumentBuilder *builder = new KSVG::DocumentBuilder(documentWrapper()->svgView());
KDOM::LibXMLParser *parser = new KDOM::LibXMLParser(KURL());
parser->setDocumentBuilder(builder);
parser->domConfig()->setParameter(KDOM::ENTITIES.handle(), false);
parser->domConfig()->setParameter(KDOM::ELEMENT_CONTENT_WHITESPACE.handle(), false);
// Feed the parser the whole document (hack)
parser->doOneShotParse(m_xmlCode.utf8(), m_xmlCode.length());
SVGDocumentImpl *svgDoc = static_cast<SVGDocumentImpl *>(parser->document());
NodeImpl *wrappedDoc = new KDOMNodeTreeWrapperImpl(m_doc, svgDoc);
delete parser; // builder is owned (deleted) by parser
if (documentWrapper()->addChild(wrappedDoc)) {
KCanvasView *primaryView = documentWrapper()->svgView()->canvasView();
svgDoc->setCanvasView(primaryView);
if (m_view && !wrappedDoc->attached())
wrappedDoc->attach();
}
else
delete wrappedDoc;
emit finishedParsing();
}
bool KDOMTokenizer::isWaitingForScripts() const
{
return false;
}
namespace khtml {
Tokenizer *newKDOMTokenizer(DOM::DocumentPtr *d, KHTMLView *v)
{
return new KDOMTokenizer(d, v);
}
};
1.1 SVGSupport/WebCore+SVG/xml_kdomtokenizer.h
Index: xml_kdomtokenizer.h
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _XML_KDOMTokenizer_h_
#define _XML_KDOMTokenizer_h_
class KHTMLView;
namespace DOM {
class DocumentPtr;
}
namespace khtml {
class Tokenizer;
Tokenizer *newKDOMTokenizer(DOM::DocumentPtr *, KHTMLView * = 0);
}; // namespace
#endif
1.26 +47 -15 WebCore/WebCore.xcodeproj/project.pbxproj
Index: project.pbxproj
===================================================================
RCS file: /cvs/root/WebCore/WebCore.xcodeproj/project.pbxproj,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- project.pbxproj 21 Sep 2005 00:24:12 -0000 1.25
+++ project.pbxproj 23 Sep 2005 03:28:27 -0000 1.26
@@ -1542,6 +1542,7 @@
A85D7A300879EBA9006A9172 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */; };
A85D7A8E0879EC64006A9172 /* KWQWMatrix.mm in Sources */ = {isa = PBXBuildFile; fileRef = A85D7A8C0879EC64006A9172 /* KWQWMatrix.mm */; };
A85D7A8F0879EC64006A9172 /* KWQWMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = A85D7A8D0879EC64006A9172 /* KWQWMatrix.h */; };
+ A863312F08E3AB25009CFEF4 /* CDFInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A863312E08E3AB24009CFEF4 /* CDFInterface.cpp */; };
A8700A4808DD734300CC5A86 /* CDFInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F9FE089701F500BA5114 /* CDFInterface.cpp */; };
A898F147088121E90075EFB2 /* htmlfactory.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEF3433087B563E00BBF833 /* htmlfactory.h */; };
A898F148088121ED0075EFB2 /* htmlfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEF3432087B563E00BBF833 /* htmlfactory.cpp */; };
@@ -2289,7 +2290,14 @@
A8C0FFFF089701FC00BA5114 /* QuartzSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB77089701F800BA5114 /* QuartzSupport.mm */; };
A8DC63E908E0DD0A004507F7 /* EcmaInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8DC63E808E0DD0A004507F7 /* EcmaInterface.cpp */; };
A8DC63EC08E0DD2A004507F7 /* EcmaInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8DC63EB08E0DD2A004507F7 /* EcmaInterface.cpp */; };
- A8EA429508E0BA41004BC396 /* CDFInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA429408E0BA41004BC396 /* CDFInterface.cpp */; };
+ A8EA434508E14EAC004BC396 /* xml_kdomtokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA433D08E14EAB004BC396 /* xml_kdomtokenizer.h */; };
+ A8EA434608E14EAC004BC396 /* xml_kdomtokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA433E08E14EAC004BC396 /* xml_kdomtokenizer.cpp */; };
+ A8EA434708E14EAC004BC396 /* render_kcanvaswrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA433F08E14EAC004BC396 /* render_kcanvaswrapper.h */; };
+ A8EA434808E14EAC004BC396 /* render_kcanvaswrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA434008E14EAC004BC396 /* render_kcanvaswrapper.cpp */; };
+ A8EA434908E14EAC004BC396 /* dom_kdomnodetreewrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA434108E14EAC004BC396 /* dom_kdomnodetreewrapper.h */; };
+ A8EA434A08E14EAC004BC396 /* dom_kdomnodetreewrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA434208E14EAC004BC396 /* dom_kdomnodetreewrapper.cpp */; };
+ A8EA434B08E14EAC004BC396 /* dom_kdomdocumentwrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA434308E14EAC004BC396 /* dom_kdomdocumentwrapper.h */; };
+ A8EA434C08E14EAC004BC396 /* dom_kdomdocumentwrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA434408E14EAC004BC396 /* dom_kdomdocumentwrapper.cpp */; };
A8FD8B86087CB44C00DC3707 /* KWQWMatrix.mm in Sources */ = {isa = PBXBuildFile; fileRef = A85D7A8C0879EC64006A9172 /* KWQWMatrix.mm */; };
A8FD8B87087CB45700DC3707 /* KWQWMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = A85D7A8D0879EC64006A9172 /* KWQWMatrix.h */; };
BC179892088D975F006068A5 /* render_theme_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC17988F088D975F006068A5 /* render_theme_mac.mm */; };
@@ -3020,7 +3028,7 @@
A81D5A7F08ADF70400136AC1 /* tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tokenizer.h; sourceTree = "<group>"; };
A81D5A8108ADF70400136AC1 /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
A81D5A8208ADF70400136AC1 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
- A8212D0708794A2300677359 /* WebCore+SVG.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "WebCore+SVG.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
+ A8212D0708794A2300677359 /* WebCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A82FC27308C9292E00EFEE23 /* DOMImplementationLSImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMImplementationLSImpl.h; sourceTree = "<group>"; };
A82FC27408C9292E00EFEE23 /* DOMImplementationLSImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMImplementationLSImpl.cpp; sourceTree = "<group>"; };
A82FC2F008C9AAE400EFEE23 /* LinkStyleImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkStyleImpl.h; sourceTree = "<group>"; };
@@ -3033,6 +3041,7 @@
A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
A85D7A8C0879EC64006A9172 /* KWQWMatrix.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQWMatrix.mm; sourceTree = "<group>"; };
A85D7A8D0879EC64006A9172 /* KWQWMatrix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KWQWMatrix.h; sourceTree = "<group>"; };
+ A863312E08E3AB24009CFEF4 /* CDFInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDFInterface.cpp; sourceTree = "<group>"; };
A8BC0BE608D19F1900379918 /* AttrWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AttrWrapper.cpp; sourceTree = "<group>"; };
A8BC0BE708D19F1900379918 /* AttrWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttrWrapper.h; sourceTree = "<group>"; };
A8BC0BE808D19F1900379918 /* CDATASectionWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDATASectionWrapper.cpp; sourceTree = "<group>"; };
@@ -3822,7 +3831,14 @@
A8C0FB8E089701F800BA5114 /* KCanvasView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCanvasView.h; sourceTree = "<group>"; };
A8DC63E808E0DD0A004507F7 /* EcmaInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EcmaInterface.cpp; path = "../../../../build/WebCore.build/Development/WebCore+SVG.build/DerivedSources/kdom/ecma/EcmaInterface.cpp"; sourceTree = "<group>"; };
A8DC63EB08E0DD2A004507F7 /* EcmaInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EcmaInterface.cpp; path = "../../../../build/WebCore.build/Development/WebCore+SVG.build/DerivedSources/ksvg2/ecma/EcmaInterface.cpp"; sourceTree = "<group>"; };
- A8EA429408E0BA41004BC396 /* CDFInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDFInterface.cpp; sourceTree = "<group>"; };
+ A8EA433D08E14EAB004BC396 /* xml_kdomtokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xml_kdomtokenizer.h; sourceTree = "<group>"; };
+ A8EA433E08E14EAC004BC396 /* xml_kdomtokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xml_kdomtokenizer.cpp; sourceTree = "<group>"; };
+ A8EA433F08E14EAC004BC396 /* render_kcanvaswrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = render_kcanvaswrapper.h; sourceTree = "<group>"; };
+ A8EA434008E14EAC004BC396 /* render_kcanvaswrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = render_kcanvaswrapper.cpp; sourceTree = "<group>"; };
+ A8EA434108E14EAC004BC396 /* dom_kdomnodetreewrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dom_kdomnodetreewrapper.h; sourceTree = "<group>"; };
+ A8EA434208E14EAC004BC396 /* dom_kdomnodetreewrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dom_kdomnodetreewrapper.cpp; sourceTree = "<group>"; };
+ A8EA434308E14EAC004BC396 /* dom_kdomdocumentwrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dom_kdomdocumentwrapper.h; sourceTree = "<group>"; };
+ A8EA434408E14EAC004BC396 /* dom_kdomdocumentwrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dom_kdomdocumentwrapper.cpp; sourceTree = "<group>"; };
BC06F24906D18A7E004A6FA3 /* xsl_stylesheetimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = xsl_stylesheetimpl.cpp; path = xsl/xsl_stylesheetimpl.cpp; sourceTree = "<group>"; };
BC06F24A06D18A7E004A6FA3 /* xsl_stylesheetimpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = xsl_stylesheetimpl.h; path = xsl/xsl_stylesheetimpl.h; sourceTree = "<group>"; };
BC06F24B06D18A7E004A6FA3 /* xslt_processorimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = xslt_processorimpl.cpp; path = xsl/xslt_processorimpl.cpp; sourceTree = "<group>"; };
@@ -4331,7 +4347,7 @@
isa = PBXGroup;
children = (
93F19B1A08245E5A001E9ABC /* WebCore.framework */,
- A8212D0708794A2300677359 /* WebCore+SVG.framework */,
+ A8212D0708794A2300677359 /* WebCore.framework */,
);
name = Products;
sourceTree = SOURCE_ROOT;
@@ -5300,6 +5316,14 @@
A8C0F6E6089701F100BA5114 /* DrawViewPrivate.h */,
A8C0F6E7089701F100BA5114 /* NSSVGImageRep.h */,
A8C0F6E8089701F100BA5114 /* NSSVGImageRep.m */,
+ A8EA433D08E14EAB004BC396 /* xml_kdomtokenizer.h */,
+ A8EA433E08E14EAC004BC396 /* xml_kdomtokenizer.cpp */,
+ A8EA433F08E14EAC004BC396 /* render_kcanvaswrapper.h */,
+ A8EA434008E14EAC004BC396 /* render_kcanvaswrapper.cpp */,
+ A8EA434108E14EAC004BC396 /* dom_kdomnodetreewrapper.h */,
+ A8EA434208E14EAC004BC396 /* dom_kdomnodetreewrapper.cpp */,
+ A8EA434308E14EAC004BC396 /* dom_kdomdocumentwrapper.h */,
+ A8EA434408E14EAC004BC396 /* dom_kdomdocumentwrapper.cpp */,
);
name = "WebCore+SVG";
path = "../SVGSupport/WebCore+SVG";
@@ -5393,8 +5417,8 @@
A8C0F7FC089701F300BA5114 /* svg */ = {
isa = PBXGroup;
children = (
- A8EA429408E0BA41004BC396 /* CDFInterface.cpp */,
A8C0F7FE089701F300BA5114 /* CDFInterface.h */,
+ A863312E08E3AB24009CFEF4 /* CDFInterface.cpp */,
A8C0F7FF089701F300BA5114 /* SVGAElementImpl.cpp */,
A8C0F800089701F300BA5114 /* SVGAElementImpl.h */,
A8C0F801089701F300BA5114 /* SVGAngleImpl.cpp */,
@@ -8142,6 +8166,10 @@
A8122F6B08D564B500844FA3 /* SVGViewElementWrapper.h in Headers */,
A8122F6D08D564B500844FA3 /* SVGZoomAndPanWrapper.h in Headers */,
A8122F6F08D564B500844FA3 /* SVGZoomEventWrapper.h in Headers */,
+ A8EA434508E14EAC004BC396 /* xml_kdomtokenizer.h in Headers */,
+ A8EA434708E14EAC004BC396 /* render_kcanvaswrapper.h in Headers */,
+ A8EA434908E14EAC004BC396 /* dom_kdomnodetreewrapper.h in Headers */,
+ A8EA434B08E14EAC004BC396 /* dom_kdomdocumentwrapper.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -8351,7 +8379,7 @@
name = "WebCore+SVG";
productInstallPath = /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks;
productName = WebKit;
- productReference = A8212D0708794A2300677359 /* WebCore+SVG.framework */;
+ productReference = A8212D0708794A2300677359 /* WebCore.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
@@ -9262,12 +9290,12 @@
);
name = "KDOM EcmaScript.cpp/h";
outputPaths = (
- $DERIVED_FILE_DIR/kdom/ecma/EcmaInterface.cpp,
+ kdom/ecma/EcmaInterface.cpp,
$DERIVED_FILE_DIR/kdom/ecma/EcmaInterface.h,
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "ECMA_OUTPUT_DIR=\"${DERIVED_FILE_DIR}/kdom/ecma\"\nmkdir -p \"${ECMA_OUTPUT_DIR}\"\n\n/usr/bin/perl -Ikdom/bindings kdom/bindings/kdomidl.pl \\\n\t--generator ecmaInterface \\\n\t--outputdir \"${ECMA_OUTPUT_DIR}\" \\\n\t--includedir kdom/bindings/idl \\\n\t--input kdom/bindings/idl/core/Node.idl \\\n\t--documentation empty ;\n\nln -s \"$ECMA_OUTPUT_DIR/EcmaInterface.cpp\" kdom/ecma/EcmaInterface.cpp";
+ shellScript = "ECMA_OUTPUT_DIR=\"${DERIVED_FILE_DIR}/kdom/ecma\"\nmkdir -p \"${ECMA_OUTPUT_DIR}\"\n\n/usr/bin/perl -Ikdom/bindings kdom/bindings/kdomidl.pl \\\n\t--generator ecmaInterface \\\n\t--outputdir \"${ECMA_OUTPUT_DIR}\" \\\n\t--includedir kdom/bindings/idl \\\n\t--input kdom/bindings/idl/core/Node.idl \\\n\t--documentation empty ;\n\n# Hack until <rdar://problem/4251784> \"DerivedSources (build intermediates) relative filepaths should be possible\" is fixed.\nln -sf \"$ECMA_OUTPUT_DIR/EcmaInterface.cpp\" kdom/ecma/EcmaInterface.cpp";
};
A8BC0B0108D1954500379918 /* KSVG EcmaScript.cpp/h */ = {
isa = PBXShellScriptBuildPhase;
@@ -9279,12 +9307,12 @@
);
name = "KSVG EcmaScript.cpp/h";
outputPaths = (
- $DERIVED_FILE_DIR/ksvg2/ecma/EcmaInterface.cpp,
+ ksvg2/ecma/EcmaInterface.cpp,
$DERIVED_FILE_DIR/ksvg2/ecma/EcmaInterface.h,
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "ECMA_OUTPUT_DIR=\"${DERIVED_FILE_DIR}/ksvg2/ecma\"\nmkdir -p \"${ECMA_OUTPUT_DIR}\"\n\n/usr/bin/perl -Ikdom/bindings kdom/bindings/kdomidl.pl \\\n\t--generator ecmaInterface \\\n\t--outputdir \"${ECMA_OUTPUT_DIR}\" \\\n\t--includedir kdom/bindings/idl \\\n\t--includedir ksvg2/bindings/idl \\\n\t--input ksvg2/bindings/idl/svg/SVGElement.idl \\\n\t--documentation empty \\\n\t--ontop ;\n\nln -s \"$ECMA_OUTPUT_DIR/EcmaInterface.cpp\" ksvg2/ecma/EcmaInterface.cpp";
+ shellScript = "ECMA_OUTPUT_DIR=\"${DERIVED_FILE_DIR}/ksvg2/ecma\"\nmkdir -p \"${ECMA_OUTPUT_DIR}\"\n\n/usr/bin/perl -Ikdom/bindings kdom/bindings/kdomidl.pl \\\n\t--generator ecmaInterface \\\n\t--outputdir \"${ECMA_OUTPUT_DIR}\" \\\n\t--includedir kdom/bindings/idl \\\n\t--includedir ksvg2/bindings/idl \\\n\t--input ksvg2/bindings/idl/svg/SVGElement.idl \\\n\t--documentation empty \\\n\t--ontop ;\n\n# Hack until <rdar://problem/4251784> \"DerivedSources (build intermediates) relative filepaths should be possible\" is fixed.\nln -sf \"$ECMA_OUTPUT_DIR/EcmaInterface.cpp\" ksvg2/ecma/EcmaInterface.cpp";
};
/* End PBXShellScriptBuildPhase section */
@@ -10338,9 +10366,13 @@
A8122F6C08D564B500844FA3 /* SVGZoomAndPanWrapper.cpp in Sources */,
A8122F6E08D564B500844FA3 /* SVGZoomEventWrapper.cpp in Sources */,
A8700A4808DD734300CC5A86 /* CDFInterface.cpp in Sources */,
- A8EA429508E0BA41004BC396 /* CDFInterface.cpp in Sources */,
A8DC63E908E0DD0A004507F7 /* EcmaInterface.cpp in Sources */,
A8DC63EC08E0DD2A004507F7 /* EcmaInterface.cpp in Sources */,
+ A8EA434608E14EAC004BC396 /* xml_kdomtokenizer.cpp in Sources */,
+ A8EA434808E14EAC004BC396 /* render_kcanvaswrapper.cpp in Sources */,
+ A8EA434A08E14EAC004BC396 /* dom_kdomnodetreewrapper.cpp in Sources */,
+ A8EA434C08E14EAC004BC396 /* dom_kdomdocumentwrapper.cpp in Sources */,
+ A863312F08E3AB25009CFEF4 /* CDFInterface.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -10626,7 +10658,7 @@
"-Wl,-exported_symbols_list,$(DERIVED_FILES_DIR)/WebCore+SVG.exp",
);
PREBINDING = NO;
- PRODUCT_NAME = "WebCore+SVG";
+ PRODUCT_NAME = WebCore;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wall",
@@ -10687,7 +10719,7 @@
"-Wl,-exported_symbols_list,$(DERIVED_FILES_DIR)/WebCore+SVG.exp",
);
PREBINDING = NO;
- PRODUCT_NAME = "WebCore+SVG";
+ PRODUCT_NAME = WebCore;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wall",
@@ -10748,7 +10780,7 @@
"-Wl,-exported_symbols_list,$(DERIVED_FILES_DIR)/WebCore+SVG.exp",
);
PREBINDING = NO;
- PRODUCT_NAME = "WebCore+SVG";
+ PRODUCT_NAME = WebCore;
SECTORDER_FLAGS = "";
STYLE_LDFLAGS = "";
WARNING_CFLAGS = (
@@ -10808,7 +10840,7 @@
"-lxml2-WebCore",
"-Wl,-exported_symbols_list,$(DERIVED_FILES_DIR)/WebCore+SVG.exp",
);
- PRODUCT_NAME = "WebCore+SVG";
+ PRODUCT_NAME = WebCore;
SECTORDER_FLAGS = (
"-sectorder",
__TEXT,
1.341 +4 -0 WebCore/khtml/khtml_part.cpp
Index: khtml_part.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtml_part.cpp,v
retrieving revision 1.340
retrieving revision 1.341
diff -u -r1.340 -r1.341
--- khtml_part.cpp 16 Sep 2005 22:42:00 -0000 1.340
+++ khtml_part.cpp 23 Sep 2005 03:28:28 -0000 1.341
@@ -1610,6 +1610,10 @@
if (args.serviceType == "text/xml" || args.serviceType == "application/xml" || args.serviceType == "application/xhtml+xml" ||
args.serviceType == "text/xsl" || args.serviceType == "application/rss+xml" || args.serviceType == "application/atom+xml")
d->m_doc = DOMImplementationImpl::instance()->createDocument( d->m_view );
+#if SVG_SUPPORT
+ else if (args.serviceType == "image/svg+xml")
+ d->m_doc = DOMImplementationImpl::instance()->createKDOMDocument(d->m_view);
+#endif
else
d->m_doc = DOMImplementationImpl::instance()->createHTMLDocument( d->m_view );
1.256 +11 -0 WebCore/khtml/xml/dom_docimpl.cpp
Index: dom_docimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
retrieving revision 1.255
retrieving revision 1.256
diff -u -r1.255 -r1.256
--- dom_docimpl.cpp 16 Sep 2005 22:42:19 -0000 1.255
+++ dom_docimpl.cpp 23 Sep 2005 03:28:28 -0000 1.256
@@ -92,6 +92,10 @@
#include "KWQLogging.h"
#endif
+#if SVG_SUPPORT
+#include "dom_kdomdocumentwrapper.h"
+#endif
+
using namespace DOM;
using namespace DOM::EventNames;
using namespace HTMLNames;
@@ -256,6 +260,13 @@
return new HTMLDocumentImpl(this, v);
}
+#if SVG_SUPPORT
+DocumentImpl *DOMImplementationImpl::createKDOMDocument( KHTMLView *v )
+{
+ return new KDOMDocumentWrapperImpl(this, v);
+}
+#endif
+
DOMImplementationImpl *DOMImplementationImpl::instance()
{
if (!m_instance) {
1.127 +3 -0 WebCore/khtml/xml/dom_docimpl.h
Index: dom_docimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.h,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -r1.126 -r1.127
--- dom_docimpl.h 16 Sep 2005 22:42:19 -0000 1.126
+++ dom_docimpl.h 23 Sep 2005 03:28:28 -0000 1.127
@@ -151,6 +151,9 @@
// Other methods (not part of DOM)
DocumentImpl *createDocument( KHTMLView *v = 0 );
HTMLDocumentImpl *createHTMLDocument( KHTMLView *v = 0 );
+#if SVG_SUPPORT
+ DocumentImpl *createKDOMDocument( KHTMLView *v = 0 );
+#endif
// Returns the static instance of this class - only one instance of this class should
// ever be present, and is used as a factory method for creating DocumentImpl objects
1.82 +8 -0 WebCore/kwq/KWQPainter.h
Index: KWQPainter.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQPainter.h,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- KWQPainter.h 16 Sep 2005 23:09:59 -0000 1.81
+++ KWQPainter.h 23 Sep 2005 03:28:29 -0000 1.82
@@ -42,6 +42,10 @@
class QPainterPrivate;
class QString;
+#if SVG_SUPPORT
+class KRenderingDeviceContext;
+#endif
+
class QPainter : public Qt {
public:
typedef enum { RTL, LTR } TextDirection;
@@ -136,6 +140,10 @@
CGContextRef currentContext();
+#if SVG_SUPPORT
+ KRenderingDeviceContext *renderingDeviceContext();
+#endif
+
static int compositeOperatorFromString (const QString &aString);
static int getCompositeOperation(CGContextRef context);
static void setCompositeOperation (CGContextRef context, const QString &operation);
1.140 +38 -3 WebCore/kwq/KWQPainter.mm
Index: KWQPainter.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQPainter.mm,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- KWQPainter.mm 16 Sep 2005 23:09:59 -0000 1.139
+++ KWQPainter.mm 23 Sep 2005 03:28:29 -0000 1.140
@@ -41,6 +41,10 @@
#import "WebCoreTextRenderer.h"
#import "WebCoreTextRendererFactory.h"
+#if SVG_SUPPORT
+#import "kcanvas/device/quartz/KRenderingDeviceQuartz.h"
+#endif
+
// NSColor, NSBezierPath, NSGraphicsContext and WebCoreTextRenderer
// calls in this file are all exception-safe, so we don't block
// exceptions for those.
@@ -55,9 +59,8 @@
};
struct QPainterPrivate {
- QPainterPrivate() : textRenderer(0), focusRingPath(0), focusRingWidth(0), focusRingOffset(0),
- hasFocusRingColor(false) { }
- ~QPainterPrivate() { KWQRelease(textRenderer); KWQRelease(focusRingPath); }
+ QPainterPrivate();
+ ~QPainterPrivate();
QPState state;
QPtrStack<QPState> stack;
id <WebCoreTextRenderer> textRenderer;
@@ -67,8 +70,29 @@
int focusRingOffset;
bool hasFocusRingColor;
QColor focusRingColor;
+#if SVG_SUPPORT
+ KRenderingDeviceContextQuartz *renderingDeviceContext;
+#endif
};
+QPainterPrivate::QPainterPrivate() : textRenderer(0), focusRingPath(0), focusRingWidth(0), focusRingOffset(0),
+ hasFocusRingColor(false)
+#if SVG_SUPPORT
+ , renderingDeviceContext(0)
+#endif
+{
+
+}
+
+QPainterPrivate::~QPainterPrivate()
+{
+ KWQRelease(textRenderer);
+ KWQRelease(focusRingPath);
+#if SVG_SUPPORT
+ delete renderingDeviceContext;
+#endif
+}
+
static inline void _fillRectXX(float x, float y, float w, float h, const QColor& col);
QPainter::QPainter() : data(new QPainterPrivate), _isForPrinting(false), _usesInactiveTextBackgroundColor(false), _updatingControlTints(false)
{
@@ -856,6 +880,17 @@
return (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
}
+#if SVG_SUPPORT
+KRenderingDeviceContext *QPainter::renderingDeviceContext()
+{
+ if (!data->renderingDeviceContext) {
+ data->renderingDeviceContext = new KRenderingDeviceContextQuartz();
+ }
+ data->renderingDeviceContext->setCGContext(currentContext());
+ return data->renderingDeviceContext;
+}
+#endif
+
void QPainter::beginTransparencyLayer(float opacity)
{
if (data->state.paintingDisabled)
More information about the webkit-changes
mailing list