Changeset 17991 in webkit


Ignore:
Timestamp:
Dec 3, 2006 4:02:26 AM (17 years ago)
Author:
rwlbuis
Message:

Reviewed by Oliver.

http://bugs.webkit.org/show_bug.cgi?id=11667
SVG: method .getTransformToElement(elt) in SVGLocatable not implemented

Implement getTransformToElement functionality. Introduce virtual
baseclass SVGLocatable to allow one implementation of the functionality.
Finally cleanup some code.

Location:
trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r17988 r17991  
     12006-12-03  Rob Buis  <buis@kde.org>
     2
     3        Reviewed by Oliver.
     4
     5        Testcase for:
     6        http://bugs.webkit.org/show_bug.cgi?id=11667
     7        SVG: method .getTransformToElement(elt) in SVGLocatable not implemented
     8
     9        * svg/custom/getTransformToElement-expected.checksum: Added.
     10        * svg/custom/getTransformToElement-expected.png: Added.
     11        * svg/custom/getTransformToElement-expected.txt: Added.
     12        * svg/custom/getTransformToElement.svg: Added.
     13
    1142006-12-03  Alexey Proskuryakov  <ap@webkit.org>
    215
  • trunk/WebCore/ChangeLog

    r17990 r17991  
     12006-12-03  Rob Buis  <buis@kde.org>
     2
     3        Reviewed by Oliver.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=11667
     6        SVG: method .getTransformToElement(elt) in SVGLocatable not implemented
     7
     8        Implement getTransformToElement functionality. Introduce virtual
     9        baseclass SVGLocatable to allow one implementation of the functionality.
     10        Finally cleanup some code.
     11
     12        * ksvg2/svg/SVGLocatable.cpp:
     13        (WebCore::SVGLocatable::getTransformToElement):
     14        * ksvg2/svg/SVGLocatable.h:
     15        * ksvg2/svg/SVGStyledLocatableElement.cpp:
     16        (WebCore::SVGStyledLocatableElement::SVGStyledLocatableElement):
     17        (WebCore::SVGStyledLocatableElement::nearestViewportElement):
     18        (WebCore::SVGStyledLocatableElement::farthestViewportElement):
     19        (WebCore::SVGStyledLocatableElement::getCTM):
     20        (WebCore::SVGStyledLocatableElement::getScreenCTM):
     21        * ksvg2/svg/SVGStyledLocatableElement.h:
     22        * ksvg2/svg/SVGStyledTransformableElement.cpp:
     23        (WebCore::SVGStyledTransformableElement::SVGStyledTransformableElement):
     24        (WebCore::SVGStyledTransformableElement::localMatrix):
     25        (WebCore::SVGStyledTransformableElement::getCTM):
     26        (WebCore::SVGStyledTransformableElement::getScreenCTM):
     27        (WebCore::SVGStyledTransformableElement::updateLocalTransform):
     28        (WebCore::SVGStyledTransformableElement::parseMappedAttribute):
     29        (WebCore::SVGStyledTransformableElement::nearestViewportElement):
     30        (WebCore::SVGStyledTransformableElement::farthestViewportElement):
     31        * ksvg2/svg/SVGStyledTransformableElement.h:
     32        * ksvg2/svg/SVGTextElement.h:
     33        * ksvg2/svg/SVGTransformable.h:
     34
    1352006-12-03  Nikolas Zimmermann  <zimmermann@kde.org>
    236
  • trunk/WebCore/ksvg2/svg/SVGLocatable.cpp

    r17062 r17991  
    124124}
    125125
     126SVGMatrix* SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec) const
     127{
     128    RefPtr<SVGMatrix> startctm(getCTM());
     129    SVGMatrix* ctm = SVGSVGElement::createSVGMatrix();
     130    ctm->multiply(startctm.get());
     131
     132    SVGElement* targetElement = svg_dynamic_cast(target);
     133    if (targetElement && targetElement->isStyledLocatable()) {
     134        RefPtr<SVGMatrix> targetCTM = static_cast<SVGStyledLocatableElement*>(targetElement)->getCTM();
     135        targetCTM.get()->inverse(ec);
     136        if (ec)
     137            return ctm;
     138        ctm->postMultiply(targetCTM.get());
     139    }
     140
     141    return ctm;
     142}
     143
    126144}
    127145
  • trunk/WebCore/ksvg2/svg/SVGLocatable.h

    r16330 r17991  
    4747        virtual SVGMatrix* getCTM() const = 0;
    4848        virtual SVGMatrix* getScreenCTM() const = 0;
    49         virtual SVGMatrix* getTransformToElement(SVGElement*, ExceptionCode&) const = 0;
     49        SVGMatrix* getTransformToElement(SVGElement*, ExceptionCode&) const;
    5050
    5151    protected:
  • trunk/WebCore/ksvg2/svg/SVGStyledLocatableElement.cpp

    r17265 r17991  
    11/*
    22    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
    3                   2004, 2005 Rob Buis <buis@kde.org>
     3                  2004, 2005, 2006 Rob Buis <buis@kde.org>
    44
    55    This file is part of the KDE project
     
    3232#include "SVGSVGElement.h"
    3333
    34 using namespace WebCore;
     34namespace WebCore {
    3535
    36 SVGStyledLocatableElement::SVGStyledLocatableElement(const QualifiedName& tagName, Document *doc)
    37 : SVGStyledElement(tagName, doc), SVGLocatable()
     36SVGStyledLocatableElement::SVGStyledLocatableElement(const QualifiedName& tagName, Document* doc)
     37    : SVGLocatable()
     38    , SVGStyledElement(tagName, doc)
    3839{
    3940}
     
    4344}
    4445
    45 SVGElement *SVGStyledLocatableElement::nearestViewportElement() const
     46SVGElement* SVGStyledLocatableElement::nearestViewportElement() const
    4647{
    4748    return SVGLocatable::nearestViewportElement(this);
    4849}
    4950
    50 SVGElement *SVGStyledLocatableElement::farthestViewportElement() const
     51SVGElement* SVGStyledLocatableElement::farthestViewportElement() const
    5152{
    5253    return SVGLocatable::farthestViewportElement(this);
     
    5859}
    5960
    60 SVGMatrix *SVGStyledLocatableElement::getCTM() const
     61SVGMatrix* SVGStyledLocatableElement::getCTM() const
    6162{
    6263    return SVGLocatable::getCTM(this);
    6364}
    6465
    65 SVGMatrix *SVGStyledLocatableElement::getScreenCTM() const
     66SVGMatrix* SVGStyledLocatableElement::getScreenCTM() const
    6667{
    6768    return SVGLocatable::getScreenCTM(this);
    6869}
    6970
    70 SVGMatrix *SVGStyledLocatableElement::getTransformToElement(SVGElement *, ExceptionCode&) const
    71 {
    72     // TODO!
    73     return 0;
    7471}
    7572
  • trunk/WebCore/ksvg2/svg/SVGStyledLocatableElement.h

    r16330 r17991  
    11/*
    22    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
    3                   2004, 2005 Rob Buis <buis@kde.org>
     3                  2004, 2005, 2006 Rob Buis <buis@kde.org>
    44
    55    This file is part of the KDE project
     
    3333    class SVGElement;
    3434
    35     class SVGStyledLocatableElement : public SVGStyledElement, public SVGLocatable {
     35    class SVGStyledLocatableElement : public SVGStyledElement, virtual public SVGLocatable {
    3636    public:
    3737        SVGStyledLocatableElement(const QualifiedName&, Document*);
     
    4747        virtual SVGMatrix* getCTM() const;
    4848        virtual SVGMatrix* getScreenCTM() const;
    49         virtual SVGMatrix* getTransformToElement(SVGElement*, ExceptionCode&) const;
    5049    };
    5150
  • trunk/WebCore/ksvg2/svg/SVGStyledTransformableElement.cpp

    r17879 r17991  
    11/*
    22    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
    3                   2004, 2005 Rob Buis <buis@kde.org>
     3                  2004, 2005, 2006 Rob Buis <buis@kde.org>
    44
    55    This file is part of the KDE project
     
    3636#include "SVGTransformList.h"
    3737
    38 using namespace WebCore;
     38namespace WebCore {
    3939
    40 SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document *doc)
     40SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document* doc)
    4141    : SVGStyledLocatableElement(tagName, doc)
    4242    , SVGTransformable()
     
    5151ANIMATED_PROPERTY_DEFINITIONS(SVGStyledTransformableElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr.localName(), m_transform.get())
    5252
    53 SVGMatrix *SVGStyledTransformableElement::localMatrix() const
     53SVGMatrix* SVGStyledTransformableElement::localMatrix() const
    5454{
    5555    return lazy_create<SVGMatrix>(m_localMatrix);
    5656}
    5757
    58 SVGMatrix *SVGStyledTransformableElement::getCTM() const
     58SVGMatrix* SVGStyledTransformableElement::getCTM() const
    5959{
    6060    return SVGTransformable::getCTM(this);
    6161}
    6262
    63 SVGMatrix *SVGStyledTransformableElement::getScreenCTM() const
     63SVGMatrix* SVGStyledTransformableElement::getScreenCTM() const
    6464{
    6565    return SVGTransformable::getScreenCTM(this);
    6666}
    6767
    68 void SVGStyledTransformableElement::updateLocalTransform(SVGTransformList *localTransforms)
     68void SVGStyledTransformableElement::updateLocalTransform(SVGTransformList* localTransforms)
    6969{
    7070    // Update cached local matrix
     
    7979}
    8080
    81 void SVGStyledTransformableElement::parseMappedAttribute(MappedAttribute *attr)
     81void SVGStyledTransformableElement::parseMappedAttribute(MappedAttribute* attr)
    8282{
    8383    if (attr->name() == SVGNames::transformAttr) {
    84         SVGTransformList *localTransforms = transformBaseValue();
     84        SVGTransformList* localTransforms = transformBaseValue();
    8585
    8686        ExceptionCode ec = 0;
     
    9393}
    9494
    95 SVGElement *SVGStyledTransformableElement::nearestViewportElement() const
     95SVGElement* SVGStyledTransformableElement::nearestViewportElement() const
    9696{
    9797    return SVGTransformable::nearestViewportElement(this);
    9898}
    9999
    100 SVGElement *SVGStyledTransformableElement::farthestViewportElement() const
     100SVGElement* SVGStyledTransformableElement::farthestViewportElement() const
    101101{
    102102    return SVGTransformable::farthestViewportElement(this);
     
    106106{
    107107    return SVGTransformable::getBBox(this);
    108 }
    109 
    110 SVGMatrix *SVGStyledTransformableElement::getTransformToElement(SVGElement*, ExceptionCode&) const
    111 {
    112     return 0;
    113108}
    114109
     
    121116}
    122117
     118}
    123119
    124120// vim:ts=4:noet
  • trunk/WebCore/ksvg2/svg/SVGStyledTransformableElement.h

    r16330 r17991  
    11/*
    22    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
    3                   2004, 2005 Rob Buis <buis@kde.org>
     3                  2004, 2005, 2006 Rob Buis <buis@kde.org>
    44
    55    This file is part of the KDE project
     
    4646
    4747        // 'SVGTransformable' functions
    48         virtual SVGMatrix *localMatrix() const;
     48        virtual SVGMatrix* localMatrix() const;
    4949
    5050        // Derived from: 'SVGLocatable'
    51         virtual SVGMatrix *getCTM() const;
    52         virtual SVGMatrix *getScreenCTM() const;
    53         virtual SVGElement *nearestViewportElement() const;
    54         virtual SVGElement *farthestViewportElement() const;
     51        virtual SVGMatrix* getCTM() const;
     52        virtual SVGMatrix* getScreenCTM() const;
     53        virtual SVGElement* nearestViewportElement() const;
     54        virtual SVGElement* farthestViewportElement() const;
    5555
    5656        virtual FloatRect getBBox() const;
    57         virtual SVGMatrix *getTransformToElement(SVGElement*, ExceptionCode&) const;
    5857
    59         virtual void parseMappedAttribute(MappedAttribute *attr);
     58        virtual void parseMappedAttribute(MappedAttribute* attr);
    6059
    61         void updateLocalTransform(SVGTransformList *localTransforms);
     60        void updateLocalTransform(SVGTransformList* localTransforms);
    6261       
    6362        virtual void attach();
  • trunk/WebCore/ksvg2/svg/SVGTextElement.h

    r17008 r17991  
    4646        virtual SVGMatrix* getCTM() const;
    4747        virtual SVGMatrix* getScreenCTM() const;
    48         virtual SVGMatrix* getTransformToElement(SVGElement*, ExceptionCode&) const { return 0; }
    4948
    5049        virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
  • trunk/WebCore/ksvg2/svg/SVGTransformable.h

    r17879 r17991  
    3333    class SVGTransformList;
    3434
    35     class SVGTransformable : public SVGLocatable {
     35    class SVGTransformable : virtual public SVGLocatable {
    3636    public:
    3737        SVGTransformable();
Note: See TracChangeset for help on using the changeset viewer.