Пример #1
0
 /**
  * Obtains the computed style with the given name. The 'computed style' is
  * the one in effect; taking inheritance and default styles into account.
  *
  * @param string $name The name of the style to compute.
  *
  * @return string|null The style value if specified anywhere, else null.
  */
 public function getComputedStyle($name)
 {
     $style = null;
     if (isset($this->styles[$name])) {
         $style = $this->styles[$name];
     }
     if (($style === null || $style === 'inherit') && isset($this->parent)) {
         return $this->parent->getComputedStyle($name);
     }
     // 'inherit' is not what we want. Either get the real style, or
     // nothing at all.
     return $style !== 'inherit' ? $style : null;
 }
Пример #2
0
 /**
  * Iterates over all children, parses them into library class instances,
  * and adds them to the given node container.
  *
  * @param SVGNodeContainer  $node The node to add the children to.
  * @param \SimpleXMLElement $xml  The XML node containing the children.
  *
  * @return void
  */
 private function addChildren(SVGNodeContainer $node, \SimpleXMLElement $xml)
 {
     foreach ($xml->children() as $child) {
         $childNode = $this->parseNode($child);
         if (!$childNode) {
             continue;
         }
         $node->addChild($childNode);
     }
 }
Пример #3
0
 public function getSerializableAttributes()
 {
     $attrs = parent::getSerializableAttributes();
     if ($this->root) {
         $attrs['xmlns'] = 'http://www.w3.org/2000/svg';
         foreach ($this->namespaces as $namespace => $uri) {
             if (substr($namespace, 0, 6) !== 'xmlns:') {
                 $namespace = 'xmlns:' . $namespace;
             }
             $attrs[$namespace] = $uri;
         }
     }
     if (isset($attrs['width']) && $attrs['width'] === '100%') {
         unset($attrs['width']);
     }
     if (isset($attrs['height']) && $attrs['height'] === '100%') {
         unset($attrs['height']);
     }
     return $attrs;
 }
Пример #4
0
 public function __construct()
 {
     parent::__construct();
 }