Changeset 20122 in webkit


Ignore:
Timestamp:
Mar 12, 2007 1:17:49 PM (17 years ago)
Author:
rwlbuis
Message:

Reviewed by Nikolas Zimmermann.

http://bugs.webkit.org/show_bug.cgi?id=12500
SVG fails to correctly handle all link style selectors
http://bugs.webkit.org/show_bug.cgi?id=12567
<text> elements ignore <a> children

Allow <a> inside svg text and handle xlink:show.

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r20110 r20122  
     12007-03-09  Rob Buis  <buis@kde.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=12500
     6        SVG fails to correctly handle all link style selectors
     7        http://bugs.webkit.org/show_bug.cgi?id=12567
     8        <text> elements ignore <a> children
     9
     10        Updated results because of allowing <a> inside <text>.
     11
     12        * svg/W3C-SVG-1.1/interact-cursor-01-f-expected.checksum:
     13        * svg/W3C-SVG-1.1/interact-cursor-01-f-expected.png:
     14        * svg/W3C-SVG-1.1/interact-cursor-01-f-expected.txt:
     15        * svg/W3C-SVG-1.1/struct-frag-05-t-expected.checksum:
     16        * svg/W3C-SVG-1.1/struct-frag-05-t-expected.png:
     17        * svg/W3C-SVG-1.1/struct-frag-05-t-expected.txt:
     18        * svg/W3C-SVG-1.1/styling-css-06-b-expected.checksum:
     19        * svg/W3C-SVG-1.1/styling-css-06-b-expected.png:
     20        * svg/W3C-SVG-1.1/styling-css-06-b-expected.txt:
     21
    1222007-03-11  Oliver Hunt  <oliver@apple.com>
    223
  • trunk/LayoutTests/svg/W3C-SVG-1.1/interact-cursor-01-f-expected.checksum

    r18436 r20122  
    1 977a31d10cfd3511994f4545baed5d98
     1a74f021740df82f71546d3e7b4f0ca37
  • trunk/LayoutTests/svg/W3C-SVG-1.1/interact-cursor-01-f-expected.txt

    r19798 r20122  
    11layer at (0,0) size 480x360
    22  RenderView at (0,0) size 480x360
    3     RenderSVGContainer {svg} at (0.50,0.50) size 479x359
    4       RenderSVGContainer {g} at (115.29,1) size 294.71x334
     3    RenderSVGContainer {svg} at (0.50,0.50) size 525.50x359
     4      RenderSVGContainer {g} at (97,1) size 429x334
    55        RenderSVGHiddenContainer {defs} at (0,0) size 0x0
    66        RenderSVGText {text} at (240,25) size 480x31
    7           RenderSVGInlineText {#text} at (-63,-24) size 126x31
    8             text run at (-63,-24) width 126: "Text Cursor"
     7          RenderSVGInlineText {#text} at (-143,-24) size 143x31
     8            text run at (-143,-24) width 133: "Text Cursor "
     9          RenderSVGInline {a} at (0,0) size 153x31
     10            RenderSVGInlineText {#text} at (133,0) size 153x0
     11              text run at (133,0) width 153: "Pointer Cursor"
    912          RenderSVGInlineText {#text} at (0,0) size 0x0
    1013        RenderPath {rect} at (118.50,38.50) size 243x239 [stroke={[type=SOLID] [color=#666666] [stroke width=3.00]}] [data="M120.00,40.00L360.00,40.00L360.00,276.00L120.00,276.00"]
  • trunk/LayoutTests/svg/W3C-SVG-1.1/struct-frag-05-t-expected.checksum

    r18436 r20122  
    1 33ee91d98da4044601a1e1a0d08b251a
     1bce5347ed8dce07767d07bb25183e25f
  • trunk/LayoutTests/svg/W3C-SVG-1.1/struct-frag-05-t-expected.txt

    r18436 r20122  
    22  RenderView at (0,0) size 480x360
    33    RenderSVGContainer {svg} at (0.50,0.50) size 479x359
    4       RenderSVGContainer {g} at (0,0) size 0x0
    5         RenderSVGText {text} at (240,100) size 480x0
     4      RenderSVGContainer {g} at (240,64) size 89x46
     5        RenderSVGText {text} at (240,100) size 480x46
     6          RenderSVGInline {toto:a} at (0,0) size 89x46
     7            RenderSVGInlineText {#text} at (0,0) size 89x0
     8              text run at (0,0) width 89: "Valid"
     9          RenderSVGInlineText {#text} at (0,0) size 0x0
    610        RenderSVGText {text} at (240,250) size 480x0
    711      RenderSVGText {text} at (10,340) size 480x46
  • trunk/LayoutTests/svg/W3C-SVG-1.1/styling-css-06-b-expected.checksum

    r18436 r20122  
    1 d014231d5c813e6a1ca0ba1f3e8b55b8
     1b9bcfaa8847a02cffac85f7f4ab01b72
  • trunk/LayoutTests/svg/W3C-SVG-1.1/styling-css-06-b-expected.txt

    r18436 r20122  
    22  RenderView at (0,0) size 480x360
    33    RenderSVGContainer {svg} at (0.50,0.50) size 479x359
    4       RenderSVGContainer {g} at (150,142) size 260x106
    5         RenderSVGContainer {g} at (150,142) size 260x106
    6           RenderSVGText {text} at (50,100) size 480x0
    7           RenderSVGText {text} at (250,100) size 480x0
    8           RenderSVGText {text} at (50,170) size 480x0
     4      RenderSVGContainer {g} at (50,72) size 360x176
     5        RenderSVGContainer {g} at (50,72) size 360x176
     6          RenderSVGText {text} at (50,100) size 480x36
     7            RenderSVGInline {a} at (0,0) size 86x36
     8              RenderSVGInlineText {#text} at (0,0) size 86x0
     9                text run at (0,0) width 86: "Visited"
     10          RenderSVGText {text} at (250,100) size 480x36
     11            RenderSVGInline {a} at (0,0) size 116x36
     12              RenderSVGInlineText {#text} at (0,0) size 116x0
     13                text run at (0,0) width 116: "Unvisited"
     14          RenderSVGText {text} at (50,170) size 480x36
     15            RenderSVGInline {a} at (0,0) size 119x36
     16              RenderSVGInlineText {#text} at (0,0) size 119x0
     17                text run at (0,0) width 119: "Hover me"
    918          RenderSVGText {text} at (250,170) size 480x36
    1019            RenderSVGInlineText {#text} at (0,-28) size 160x36
  • trunk/WebCore/ChangeLog

    r20120 r20122  
     12007-03-09  Rob Buis  <buis@kde.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=12500
     6        SVG fails to correctly handle all link style selectors
     7        http://bugs.webkit.org/show_bug.cgi?id=12567
     8        <text> elements ignore <a> children
     9
     10        Allow <a> inside svg text and handle xlink:show.
     11
     12        * ksvg2/svg/SVGAElement.cpp:
     13        (WebCore::SVGAElement::createRenderer):
     14        (WebCore::SVGAElement::defaultEventHandler):
     15        (WebCore::SVGAElement::childShouldCreateRenderer):
     16        * ksvg2/svg/SVGAElement.h:
     17        * ksvg2/svg/SVGElement.h:
     18        (WebCore::SVGElement::isTextContent):
     19        * ksvg2/svg/SVGTextContentElement.h:
     20        (WebCore::SVGTextContentElement::isTextContent):
     21        * ksvg2/svg/SVGTextElement.cpp:
     22        (WebCore::SVGTextElement::childShouldCreateRenderer):
     23        * rendering/SVGInlineFlowBox.cpp:
     24        (WebCore::translateBox):
     25        (WebCore::placePositionedBoxesHorizontally):
     26        (WebCore::placeBoxesVerticallyWithAbsBaseline):
     27
    1282007-03-12  Adele Peterson  <adele@apple.com>
    229
  • trunk/WebCore/ksvg2/svg/SVGAElement.cpp

    r19855 r20122  
    11/*
    22    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
    3                   2004, 2005 Rob Buis <buis@kde.org>
     3                  2004, 2005, 2007 Rob Buis <buis@kde.org>
    44
    55    This file is part of the KDE project
     
    3333#include "FrameLoader.h"
    3434#include "MouseEvent.h"
     35#include "PlatformMouseEvent.h"
     36#include "RenderSVGInline.h"
    3537#include "RenderSVGContainer.h"
    3638#include "ResourceRequest.h"
     
    8587RenderObject* SVGAElement::createRenderer(RenderArena* arena, RenderStyle* style)
    8688{
     89    if (static_cast<SVGElement*>(parent())->isTextContent())
     90        return new (arena) RenderSVGInline(this);
     91
    8792    return new (arena) RenderSVGContainer(this);
    8893}
     
    9499        MouseEvent* e = static_cast<MouseEvent*>(evt);
    95100
    96         if (e && e->button() == 2) {
     101        if (e && e->button() == RightButton) {
    97102            SVGStyledTransformableElement::defaultEventHandler(evt);
    98103            return;
    99104        }
    100105
     106        String target = getAttribute(SVGNames::targetAttr);
     107        String xlinktarget = getAttribute(XLinkNames::showAttr);
     108        if (e && e->button() == MiddleButton)
     109            target = "_blank";
     110        else if (xlinktarget == "new" || target == "_blank")
     111            target = "_blank";
     112        else // default is replace/_self
     113            target = "_self";
     114
    101115        String url = parseURL(href());
    102 
    103         String target = getAttribute(SVGNames::targetAttr);
    104         if (e && e->button() == 1)
    105             target = "_blank";
    106 
    107116        if (!evt->defaultPrevented())
    108117            if (document() && document()->frame())
     
    115124}
    116125
     126bool SVGAElement::childShouldCreateRenderer(Node* child) const
     127{
     128    if (static_cast<SVGElement*>(parent())->isTextContent())
     129        return child->isTextNode();
     130
     131    return SVGElement::childShouldCreateRenderer(child);
     132}
     133
     134
    117135} // namespace WebCore
    118136
  • trunk/WebCore/ksvg2/svg/SVGAElement.h

    r19908 r20122  
    5454        virtual void defaultEventHandler(Event *evt);
    5555
     56        virtual bool childShouldCreateRenderer(Node*) const;
     57
    5658    protected:
    5759        virtual const SVGElement* contextElement() const { return this; }
  • trunk/WebCore/ksvg2/svg/SVGElement.h

    r19855 r20122  
    204204        virtual bool isFilterEffect() const { return false; }
    205205        virtual bool isGradientStop() const { return false; }
     206        virtual bool isTextContent() const { return false; }
    206207
    207208        virtual bool isShadowNode() const { return m_shadowParent; }
  • trunk/WebCore/ksvg2/svg/SVGTextContentElement.h

    r19855 r20122  
    4949       
    5050        virtual bool isValid() const { return SVGTests::isValid(); }
     51        virtual bool isTextContent() const { return true; }
    5152
    5253        // 'SVGTextContentElement' functions
  • trunk/WebCore/ksvg2/svg/SVGTextElement.cpp

    r19855 r20122  
    122122bool SVGTextElement::childShouldCreateRenderer(Node* child) const
    123123{
    124     if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag) ||
    125         child->hasTagName(SVGNames::trefTag))
     124    if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag)
     125        || child->hasTagName(SVGNames::aTag)
     126        || child->hasTagName(SVGNames::trefTag))
    126127        return true;
    127128    return false;
  • trunk/WebCore/rendering/SVGInlineFlowBox.cpp

    r19855 r20122  
    3232#include "RootInlineBox.h"
    3333#include "SVGLengthList.h"
     34#include "SVGNames.h"
    3435#include "SVGPaintServer.h"
    3536#include "SVGResourceClipper.h"
     
    4445namespace WebCore {
    4546
     47using namespace SVGNames;
     48
    4649void SVGInlineFlowBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
    4750{
     
    147150        box->setXPos(box->xPos() + x);
    148151        box->setYPos(box->yPos() + y);
    149     } else {
     152    } else if (!box->object()->element()->hasTagName(aTag)) {
    150153        InlineFlowBox* flow = static_cast<InlineFlowBox*>(box);
    151154        SVGTextPositioningElement* text = static_cast<SVGTextPositioningElement*>(box->object()->element());
     
    188191            mx = max(mx, x);
    189192            amx = max(amx, x);
    190         } else {
    191             ASSERT(curr->object()->isInlineFlow());
     193        } else if (curr->object()->isInlineFlow()) {
    192194            InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr);
    193             SVGTextPositioningElement* text = static_cast<SVGTextPositioningElement*>(flow->object()->element());
    194             x += (int)(text->dx()->getFirst().value());
    195             if (text->x()->numberOfItems() > 0)
    196                 x = (int)(text->x()->getFirst().value() - xPos);
    197             if (text->x()->numberOfItems() > 0 || text->y()->numberOfItems() > 0 ||
    198                 text->dx()->numberOfItems() > 0 || text->dy()->numberOfItems() > 0) {
    199                 seenPositionedElement = true;
    200                 needsWordSpacing = false;
    201                 int ignoreX, ignoreY;
    202                 x = placePositionedBoxesHorizontally(flow, x, mn, mx, ignoreX, ignoreY, needsWordSpacing, xPos, true);
    203             } else if (seenPositionedElement) {
    204                 int ignoreX, ignoreY;
    205                 x = placePositionedBoxesHorizontally(flow, x, mn, mx, ignoreX, ignoreY, needsWordSpacing, xPos, false);
    206             } else
     195            if (flow->object()->element()->hasTagName(aTag)) {
    207196                x = placePositionedBoxesHorizontally(flow, x, mn, mx, amn, amx, needsWordSpacing, xPos, false);
     197            } else {
     198                SVGTextPositioningElement* text = static_cast<SVGTextPositioningElement*>(flow->object()->element());
     199                x += (int)(text->dx()->getFirst().value());
     200                if (text->x()->numberOfItems() > 0)
     201                    x = (int)(text->x()->getFirst().value() - xPos);
     202                if (text->x()->numberOfItems() > 0 || text->y()->numberOfItems() > 0 ||
     203                    text->dx()->numberOfItems() > 0 || text->dy()->numberOfItems() > 0) {
     204                    seenPositionedElement = true;
     205                    needsWordSpacing = false;
     206                    int ignoreX, ignoreY;
     207                    x = placePositionedBoxesHorizontally(flow, x, mn, mx, ignoreX, ignoreY, needsWordSpacing, xPos, true);
     208                } else if (seenPositionedElement) {
     209                    int ignoreX, ignoreY;
     210                    x = placePositionedBoxesHorizontally(flow, x, mn, mx, ignoreX, ignoreY, needsWordSpacing, xPos, false);
     211                } else
     212                    x = placePositionedBoxesHorizontally(flow, x, mn, mx, amn, amx, needsWordSpacing, xPos, false);
     213            }
    208214        }
    209215    }
     
    258264{
    259265    for (InlineBox* curr = flow->firstChild(); curr; curr = curr->nextOnLine()) {
    260         if (curr->isInlineFlowBox()) {
     266        if (curr->isInlineFlowBox() && !curr->object()->element()->hasTagName(aTag)) {
    261267            SVGTextPositioningElement* text = static_cast<SVGTextPositioningElement*>(curr->object()->element());
    262268            baseline += (int)(text->dy()->getFirst().value());
Note: See TracChangeset for help on using the changeset viewer.