void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements()
{
    WillBeHeapVector<RefPtrWillBeMember<SVGSVGElement>> timeContainers;
    copyToVector(m_timeContainers, timeContainers);
    for (const auto& container : timeContainers) {
        SVGSVGElement* outerSVG = container.get();
        if (!outerSVG->isOutermostSVGSVGElement())
            continue;

        // don't dispatch the load event document is not wellformed (for XML/standalone svg)
        if (outerSVG->document().wellFormed() || !outerSVG->document().isSVGDocument())
            outerSVG->sendSVGLoadEventIfPossible();
    }
}
Esempio n. 2
0
void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements()
{
    Vector<RefPtr<SVGSVGElement> > timeContainers;
    timeContainers.appendRange(m_timeContainers.begin(), m_timeContainers.end());

    Vector<RefPtr<SVGSVGElement> >::iterator end = timeContainers.end();
    for (Vector<RefPtr<SVGSVGElement> >::iterator it = timeContainers.begin(); it != end; ++it) {
        SVGSVGElement* outerSVG = (*it).get();
        if (!outerSVG->isOutermostSVGSVGElement())
            continue;

        // don't dispatch the load event document is not wellformed (for XML/standalone svg)
        if (outerSVG->document().wellFormed() || !outerSVG->document().isSVGDocument())
            outerSVG->sendSVGLoadEventIfPossible();
    }
}
Esempio n. 3
0
void SVGSVGElement::setupInitialView(const String& fragmentIdentifier,
                                     Element* anchorNode) {
  if (fragmentIdentifier.startsWith("svgView(")) {
    SVGViewSpec* viewSpec = SVGViewSpec::createForElement(*this);
    if (viewSpec->parseViewSpec(fragmentIdentifier)) {
      UseCounter::count(document(), UseCounter::SVGSVGElementFragmentSVGView);
      setViewSpec(viewSpec);
      return;
    }
  }

  setViewSpec(nullptr);

  if (!isSVGViewElement(anchorNode))
    return;

  SVGViewElement& viewElement = toSVGViewElement(*anchorNode);

  // Spec: If the SVG fragment identifier addresses a 'view' element
  // within an SVG document (e.g., MyDrawing.svg#MyView) then the
  // closest ancestor 'svg' element is displayed in the
  // viewport. Any view specification attributes included on the
  // given 'view' element override the corresponding view
  // specification attributes on the closest ancestor 'svg' element.
  // TODO(ed): The spec text above is a bit unclear.
  // Should the transform from outermost svg to nested svg be applied to
  // "display" the inner svg in the viewport, then let the view element
  // override the inner svg's view specification attributes. Should it
  // fill/override the outer viewport?
  SVGSVGElement* svg = viewElement.ownerSVGElement();
  if (!svg)
    return;
  SVGViewSpec* viewSpec = SVGViewSpec::createForElement(*svg);
  viewSpec->inheritViewAttributesFromElement(viewElement);
  UseCounter::count(svg->document(),
                    UseCounter::SVGSVGElementFragmentSVGViewElement);
  svg->setViewSpec(viewSpec);
}