⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 89745 in webkit


Ignore:
Timestamp:
Jun 25, 2011, 11:41:39 AM (15 years ago)
Author:
rwlbuis@webkit.org
Message:

2011-06-25 Rob Buis <rbuis@rim.com>

Reviewed by Nikolas Zimmermann.

SVG1.1SE test linking-uri-01-b.svg fails
https://bugs.webkit.org/show_bug.cgi?id=63322

Allow navigating to internal <view> targets. When choosing Back ensure
the <svg> current view is initialized correctly.

Tests: svg/W3C-SVG-1.1-SE/linking-uri-01-b.svg

svg/custom/linking-uri-01-b.svg

  • page/FrameView.cpp: Delegate to setupInitialView. (WebCore::FrameView::scrollToAnchor):
  • svg/SVGAElement.cpp: Allow navigating to internal <view> targets. (WebCore::SVGAElement::defaultEventHandler):
  • svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::setupInitialView): Initialize current view depending on fragment identifier. (WebCore::SVGSVGElement::inheritViewAttributes):
  • svg/SVGSVGElement.h:

2011-06-25 Rob Buis <rbuis@rim.com>

Reviewed by Nikolas Zimmermann.

SVG1.1SE test linking-uri-01-b.svg fails
https://bugs.webkit.org/show_bug.cgi?id=63322

Add a test for navigating to an inner <view> anchor. The changed test results
are improvements.

  • platform/mac/svg/W3C-SVG-1.1-SE/linking-uri-01-b-expected.png: Added.
  • platform/mac/svg/W3C-SVG-1.1-SE/linking-uri-01-b-expected.txt: Added.
  • platform/mac/svg/custom/linking-a-03-b-all-expected.png:
  • platform/mac/svg/custom/linking-a-03-b-all-expected.txt:
  • platform/mac/svg/custom/linking-a-03-b-transform-expected.png:
  • platform/mac/svg/custom/linking-a-03-b-transform-expected.txt:
  • platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.png:
  • platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.txt:
  • platform/mac/svg/custom/linking-uri-01-b-expected.png: Added.
  • platform/mac/svg/custom/linking-uri-01-b-expected.txt: Added.
  • svg/W3C-SVG-1.1-SE/linking-uri-01-b.svg: Added.
  • svg/custom/linking-uri-01-b.svg: Added.
Location:
trunk
Files:
6 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r89743 r89745  
     12011-06-25  Rob Buis  <rbuis@rim.com>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG1.1SE test linking-uri-01-b.svg fails
     6        https://bugs.webkit.org/show_bug.cgi?id=63322
     7
     8        Add a test for navigating to an inner <view> anchor. The changed test results
     9        are improvements.
     10
     11        * platform/mac/svg/W3C-SVG-1.1-SE/linking-uri-01-b-expected.png: Added.
     12        * platform/mac/svg/W3C-SVG-1.1-SE/linking-uri-01-b-expected.txt: Added.
     13        * platform/mac/svg/custom/linking-a-03-b-all-expected.png:
     14        * platform/mac/svg/custom/linking-a-03-b-all-expected.txt:
     15        * platform/mac/svg/custom/linking-a-03-b-transform-expected.png:
     16        * platform/mac/svg/custom/linking-a-03-b-transform-expected.txt:
     17        * platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.png:
     18        * platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.txt:
     19        * platform/mac/svg/custom/linking-uri-01-b-expected.png: Added.
     20        * platform/mac/svg/custom/linking-uri-01-b-expected.txt: Added.
     21        * svg/W3C-SVG-1.1-SE/linking-uri-01-b.svg: Added.
     22        * svg/custom/linking-uri-01-b.svg: Added.
     23
    1242011-06-25  Dimitri Glazkov  <dglazkov@chromium.org>
    225
  • trunk/LayoutTests/platform/mac/svg/custom/linking-a-03-b-all-expected.txt

    r77485 r89745  
    1111        RenderSVGInlineText {#text} at (0,0) size 40x15
    1212          chunk 1 text run 1 at (203.00,99.00) startOffset 0 endOffset 8 width 40.00: "circle-1"
    13       RenderSVGPath {circle} at (0,104) size 135x256 [stroke={[type=SOLID] [color=#00FF00] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FFFF00]}] [cx=100.00] [cy=260.00] [r=20.00]
     13      RenderSVGPath {circle} at (5,84) size 239x239 [stroke={[type=SOLID] [color=#00FF00] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FFFF00]}] [cx=100.00] [cy=260.00] [r=20.00]
    1414      RenderSVGText {text} at (80,283) size 40x15 contains 1 chunk(s)
    1515        RenderSVGInlineText {#text} at (0,0) size 40x15
    1616          chunk 1 text run 1 at (80.00,295.00) startOffset 0 endOffset 8 width 40.00: "circle-2"
    17       RenderSVGPath {rect} at (0,32) size 219x328 [stroke={[type=SOLID] [color=#000000]}] [x=64.00] [y=227.00] [width=72.00] [height=72.00]
     17      RenderSVGPath {rect} at (0,18) size 324x342 [stroke={[type=SOLID] [color=#000000]}] [x=64.00] [y=227.00] [width=72.00] [height=72.00]
    1818      RenderSVGPath {circle} at (0,0) size 0x0 [stroke={[type=SOLID] [color=#0000FF] [stroke width=10.00]}] [cx=340.00] [cy=260.00] [r=50.00]
    1919      RenderSVGText {text} at (320,320) size 40x15 contains 1 chunk(s)
  • trunk/LayoutTests/platform/mac/svg/custom/linking-a-03-b-transform-expected.txt

    r77485 r89745  
    22  RenderView at (0,0) size 800x600
    33layer at (0,0) size 480x360
    4   RenderSVGRoot {svg} at (0,0) size 473x360
    5     RenderSVGContainer {g} at (3,19) size 385x341
     4  RenderSVGRoot {svg} at (0,0) size 479x360
     5    RenderSVGContainer {g} at (33,14) size 360x346
    66      RenderSVGText {text} at (100,9) size 184x14 contains 1 chunk(s)
    77        RenderSVGInlineText {#text} at (0,0) size 184x14
    88          chunk 1 text run 1 at (100.00,20.00) startOffset 0 endOffset 41 width 184.00: "Some circles with ids, for linking tests."
    9       RenderSVGPath {circle} at (150,134) size 85x84 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FF0000]}] [cx=220.00] [cy=140.00] [r=35.00]
     9      RenderSVGPath {circle} at (167,119) size 79x79 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FF0000]}] [cx=220.00] [cy=140.00] [r=35.00]
    1010      RenderSVGText {text} at (203,87) size 40x15 contains 1 chunk(s)
    1111        RenderSVGInlineText {#text} at (0,0) size 40x15
    1212          chunk 1 text run 1 at (203.00,99.00) startOffset 0 endOffset 8 width 40.00: "circle-1"
    13       RenderSVGPath {circle} at (27,247) size 52x52 [stroke={[type=SOLID] [color=#00FF00] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FFFF00]}] [cx=100.00] [cy=260.00] [r=20.00]
     13      RenderSVGPath {circle} at (53,243) size 48x49 [stroke={[type=SOLID] [color=#00FF00] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FFFF00]}] [cx=100.00] [cy=260.00] [r=20.00]
    1414      RenderSVGText {text} at (80,283) size 40x15 contains 1 chunk(s)
    1515        RenderSVGInlineText {#text} at (0,0) size 40x15
    1616          chunk 1 text run 1 at (80.00,295.00) startOffset 0 endOffset 8 width 40.00: "circle-2"
    17       RenderSVGPath {rect} at (9,233) size 87x87 [stroke={[type=SOLID] [color=#000000]}] [x=64.00] [y=227.00] [width=72.00] [height=72.00]
    18       RenderSVGPath {circle} at (225,251) size 129x109 [stroke={[type=SOLID] [color=#0000FF] [stroke width=10.00]}] [cx=340.00] [cy=260.00] [r=50.00]
     17      RenderSVGPath {rect} at (36,230) size 81x81 [stroke={[type=SOLID] [color=#000000]}] [x=64.00] [y=227.00] [width=72.00] [height=72.00]
     18      RenderSVGPath {circle} at (256,229) size 120x120 [stroke={[type=SOLID] [color=#0000FF] [stroke width=10.00]}] [cx=340.00] [cy=260.00] [r=50.00]
    1919      RenderSVGText {text} at (320,320) size 40x15 contains 1 chunk(s)
    2020        RenderSVGInlineText {#text} at (0,0) size 40x15
    2121          chunk 1 text run 1 at (320.00,332.00) startOffset 0 endOffset 8 width 40.00: "circle-3"
    22     RenderSVGContainer {g} at (0,0) size 473x360
    23       RenderSVGPath {rect} at (0,0) size 473x360 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
     22    RenderSVGContainer {g} at (0,0) size 479x360
     23      RenderSVGPath {rect} at (0,0) size 479x360 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
  • trunk/LayoutTests/platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.txt

    r77485 r89745  
    1111        RenderSVGInlineText {#text} at (0,0) size 40x15
    1212          chunk 1 text run 1 at (203.00,99.00) startOffset 0 endOffset 8 width 40.00: "circle-1"
    13       RenderSVGPath {circle} at (0,104) size 135x256 [stroke={[type=SOLID] [color=#00FF00] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FFFF00]}] [cx=100.00] [cy=260.00] [r=20.00]
     13      RenderSVGPath {circle} at (5,84) size 239x239 [stroke={[type=SOLID] [color=#00FF00] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FFFF00]}] [cx=100.00] [cy=260.00] [r=20.00]
    1414      RenderSVGText {text} at (80,283) size 40x15 contains 1 chunk(s)
    1515        RenderSVGInlineText {#text} at (0,0) size 40x15
    1616          chunk 1 text run 1 at (80.00,295.00) startOffset 0 endOffset 8 width 40.00: "circle-2"
    17       RenderSVGPath {rect} at (0,32) size 219x328 [stroke={[type=SOLID] [color=#000000]}] [x=64.00] [y=227.00] [width=72.00] [height=72.00]
     17      RenderSVGPath {rect} at (0,18) size 324x342 [stroke={[type=SOLID] [color=#000000]}] [x=64.00] [y=227.00] [width=72.00] [height=72.00]
    1818      RenderSVGPath {circle} at (0,0) size 0x0 [stroke={[type=SOLID] [color=#0000FF] [stroke width=10.00]}] [cx=340.00] [cy=260.00] [r=50.00]
    1919      RenderSVGText {text} at (320,320) size 40x15 contains 1 chunk(s)
  • trunk/Source/WebCore/ChangeLog

    r89742 r89745  
     12011-06-25  Rob Buis  <rbuis@rim.com>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG1.1SE test linking-uri-01-b.svg fails
     6        https://bugs.webkit.org/show_bug.cgi?id=63322
     7
     8        Allow navigating to internal <view> targets. When choosing Back ensure
     9        the <svg> current view is initialized correctly.
     10
     11        Tests: svg/W3C-SVG-1.1-SE/linking-uri-01-b.svg
     12               svg/custom/linking-uri-01-b.svg
     13
     14        * page/FrameView.cpp: Delegate to setupInitialView.
     15        (WebCore::FrameView::scrollToAnchor):
     16        * svg/SVGAElement.cpp: Allow navigating to internal <view> targets.
     17        (WebCore::SVGAElement::defaultEventHandler):
     18        * svg/SVGSVGElement.cpp:
     19        (WebCore::SVGSVGElement::setupInitialView): Initialize current view depending on fragment identifier.
     20        (WebCore::SVGSVGElement::inheritViewAttributes):
     21        * svg/SVGSVGElement.h:
     22
    1232011-06-24  Dimitri Glazkov  <dglazkov@chromium.org>
    224
  • trunk/Source/WebCore/page/FrameView.cpp

    r89316 r89745  
    7272#if ENABLE(SVG)
    7373#include "SVGDocument.h"
    74 #include "SVGLocatable.h"
    75 #include "SVGNames.h"
    76 #include "SVGPreserveAspectRatio.h"
    7774#include "SVGSVGElement.h"
    78 #include "SVGViewElement.h"
    79 #include "SVGViewSpec.h"
    8075#endif
    8176
     
    14631458    Element* anchorNode = m_frame->document()->findAnchor(name);
    14641459
     1460    // Setting to null will clear the current target.
     1461    m_frame->document()->setCSSTarget(anchorNode);
     1462
    14651463#if ENABLE(SVG)
    14661464    if (m_frame->document()->isSVGDocument()) {
    1467         if (name.startsWith("xpointer(")) {
    1468             // We need to parse the xpointer reference here
    1469         } else if (name.startsWith("svgView(")) {
    1470             RefPtr<SVGSVGElement> svg = static_cast<SVGDocument*>(m_frame->document())->rootElement();
    1471             if (!svg->currentView()->parseViewSpec(name))
    1472                 return false;
    1473             svg->setUseCurrentView(true);
    1474         } else {
    1475             if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) {
    1476                 RefPtr<SVGViewElement> viewElement = anchorNode->hasTagName(SVGNames::viewTag) ? static_cast<SVGViewElement*>(anchorNode) : 0;
    1477                 if (viewElement.get()) {
    1478                     SVGElement* element = SVGLocatable::nearestViewportElement(viewElement.get());
    1479                     if (element->hasTagName(SVGNames::svgTag)) {
    1480                         RefPtr<SVGSVGElement> svg = static_cast<SVGSVGElement*>(element);
    1481                         svg->inheritViewAttributes(viewElement.get());
    1482                     }
    1483                 }
    1484             }
    1485         }
    1486         // FIXME: need to decide which <svg> to focus on, and zoom to that one
    1487         // FIXME: need to actually "highlight" the viewTarget(s)
    1488     }
    1489 #endif
    1490 
    1491     m_frame->document()->setCSSTarget(anchorNode); // Setting to null will clear the current target.
     1465        if (SVGSVGElement* svg = static_cast<SVGDocument*>(m_frame->document())->rootElement()) {
     1466            svg->setupInitialView(name, anchorNode);
     1467            if (!anchorNode)
     1468                return true;
     1469        }
     1470    }
     1471#endif
    14921472 
    14931473    // Implement the rule that "" and "top" both mean top of page as in other browsers.
  • trunk/Source/WebCore/svg/SVGAElement.cpp

    r88989 r89745  
    213213                    static_cast<SVGSMILElement*>(targetElement)->beginByLinkActivation();
    214214                    event->setDefaultHandled();
     215                    return;
    215216                }
    216                 return;
     217                // Only allow navigation to internal <view> anchors.
     218                if (!targetElement->hasTagName(SVGNames::viewTag))
     219                    return;
    217220            }
    218221#endif
  • trunk/Source/WebCore/svg/SVGSVGElement.cpp

    r88989 r89745  
    626626}
    627627
     628void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* anchorNode)
     629{
     630    bool hadUseCurrentView = m_useCurrentView;
     631    setUseCurrentView(false);
     632    if (fragmentIdentifier.startsWith("xpointer(")) {
     633        // FIXME: XPointer references are ignored (https://bugs.webkit.org/show_bug.cgi?id=17491)
     634        return;
     635    }
     636    if (fragmentIdentifier.startsWith("svgView(")) {
     637        if (!currentView()->parseViewSpec(fragmentIdentifier))
     638            return;
     639        setUseCurrentView(true);
     640        return;
     641    }
     642    if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) {
     643        SVGViewElement* viewElement = anchorNode->hasTagName(SVGNames::viewTag) ? static_cast<SVGViewElement*>(anchorNode) : 0;
     644        if (viewElement) {
     645            SVGElement* element = SVGLocatable::nearestViewportElement(viewElement);
     646            if (element->hasTagName(SVGNames::svgTag)) {
     647                SVGSVGElement* svg = static_cast<SVGSVGElement*>(element);
     648                svg->inheritViewAttributes(viewElement);
     649                setUseCurrentView(true);
     650            }
     651        }
     652        return;
     653    }
     654    if (hadUseCurrentView) {
     655        currentView()->setTransform(emptyString());
     656        if (RenderObject* object = renderer())
     657            RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
     658    }
     659    // FIXME: We need to decide which <svg> to focus on, and zoom to it.
     660    // FIXME: We need to actually "highlight" the viewTarget(s).
     661}
     662
    628663void SVGSVGElement::inheritViewAttributes(SVGViewElement* viewElement)
    629664{
    630     setUseCurrentView(true);
    631665    if (viewElement->hasAttribute(SVGNames::viewBoxAttr))
    632666        currentView()->setViewBoxBaseValue(viewElement->viewBox());
  • trunk/Source/WebCore/svg/SVGSVGElement.h

    r88555 r89745  
    121121    AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
    122122
    123     void inheritViewAttributes(SVGViewElement*);
     123    void setupInitialView(const String& fragmentIdentifier, Element* anchorNode);
    124124
    125125    bool isOutermostSVG() const;
     
    151151
    152152    virtual bool selfHasRelativeLengths() const;
     153
     154    void inheritViewAttributes(SVGViewElement*);
    153155
    154156    // Animated property declarations
Note: See TracChangeset for help on using the changeset viewer.