diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index a9a1afde..1ac74152 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -6,10 +6,14 @@ CHANGELOG * [#47] support for max-height and max-width attributes * [#79] enhancements for page-size attribute support -* 1.2.10 (???) +* 1.2.11 (???) * (nothing) +* 1.2.10 (2016-08-15) + + * [#114] Fix failures on nodes initialization in big documents + * 1.2.9 (2016-03-06) * [#95] relaxed ZF components versions diff --git a/lib/PHPPdf/Core/Node/Manager.php b/lib/PHPPdf/Core/Node/Manager.php index 61e377dc..11d43d00 100644 --- a/lib/PHPPdf/Core/Node/Manager.php +++ b/lib/PHPPdf/Core/Node/Manager.php @@ -27,8 +27,6 @@ class Manager implements DocumentParserListener private $managedNodes = array(); private $behavioursTasks; - - private $preFormatInvoked = array(); public function __construct() { @@ -187,13 +185,12 @@ private function invokePreFormatIfItHasntInvokedYet(Document $document, Node $no { if(!$this->preFormatHasBeenInvoked($node)) { - $this->preFormatInvoked[spl_object_hash($node)] = true; $node->preFormat($document); } } private function preFormatHasBeenInvoked(Node $node) { - return isset($this->preFormatInvoked[spl_object_hash($node)]); + return $node->hasPreFormatBeenInvoked(); } } \ No newline at end of file diff --git a/lib/PHPPdf/Core/Node/Node.php b/lib/PHPPdf/Core/Node/Node.php index 05df2f3f..f6bf2a67 100644 --- a/lib/PHPPdf/Core/Node/Node.php +++ b/lib/PHPPdf/Core/Node/Node.php @@ -84,6 +84,8 @@ abstract class Node implements Drawable, NodeAware, \ArrayAccess, \Serializable private $closestAncestorWithPosition = null; private $positionTranslation = null; + private $preFormatInvoked = false; + public function __construct(array $attributes = array(), UnitConverter $converter = null) { static::initializeTypeIfNecessary(); @@ -1327,6 +1329,7 @@ public function copy() $copy->ancestorWithFontSize = null; $copy->ancestorWithRotation = null; $copy->closestAncestorWithPosition = null; + $copy->preFormatInvoked = false; return $copy; } @@ -1606,8 +1609,9 @@ public function format(Document $document) public function preFormat(Document $document) { $this->beforeFormat($document); - + $this->doFormat('pre', $document); + $this->preFormatInvoked = true; } public function doFormat($type, Document $document) @@ -1889,4 +1893,9 @@ public function getShape() { return self::SHAPE_RECTANGLE; } + + public function hasPreFormatBeenInvoked() + { + return $this->preFormatInvoked; + } } \ No newline at end of file