Skip to content

Commit 2e38a65

Browse files
committed
Merge branch '1.2.x'
Conflicts: CHANGELOG.markdown lib/PHPPdf/Version.php
2 parents bf6d0b2 + 84390da commit 2e38a65

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

CHANGELOG.markdown

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ CHANGELOG
66
* [#47] support for max-height and max-width attributes
77
* [#79] enhancements for page-size attribute support
88

9-
* 1.2.10 (???)
9+
* 1.2.11 (???)
1010

1111
* (nothing)
1212

13+
* 1.2.10 (2016-08-15)
14+
15+
* [#114] Fix failures on nodes initialization in big documents
16+
1317
* 1.2.9 (2016-03-06)
1418

1519
* [#95] relaxed ZF components versions

lib/PHPPdf/Core/Node/Manager.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class Manager implements DocumentParserListener
2727

2828
private $managedNodes = array();
2929
private $behavioursTasks;
30-
31-
private $preFormatInvoked = array();
3230

3331
public function __construct()
3432
{
@@ -187,13 +185,12 @@ private function invokePreFormatIfItHasntInvokedYet(Document $document, Node $no
187185
{
188186
if(!$this->preFormatHasBeenInvoked($node))
189187
{
190-
$this->preFormatInvoked[spl_object_hash($node)] = true;
191188
$node->preFormat($document);
192189
}
193190
}
194191

195192
private function preFormatHasBeenInvoked(Node $node)
196193
{
197-
return isset($this->preFormatInvoked[spl_object_hash($node)]);
194+
return $node->hasPreFormatBeenInvoked();
198195
}
199196
}

lib/PHPPdf/Core/Node/Node.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ abstract class Node implements Drawable, NodeAware, \ArrayAccess, \Serializable
8484
private $closestAncestorWithPosition = null;
8585
private $positionTranslation = null;
8686

87+
private $preFormatInvoked = false;
88+
8789
public function __construct(array $attributes = array(), UnitConverter $converter = null)
8890
{
8991
static::initializeTypeIfNecessary();
@@ -1327,6 +1329,7 @@ public function copy()
13271329
$copy->ancestorWithFontSize = null;
13281330
$copy->ancestorWithRotation = null;
13291331
$copy->closestAncestorWithPosition = null;
1332+
$copy->preFormatInvoked = false;
13301333

13311334
return $copy;
13321335
}
@@ -1606,8 +1609,9 @@ public function format(Document $document)
16061609
public function preFormat(Document $document)
16071610
{
16081611
$this->beforeFormat($document);
1609-
1612+
16101613
$this->doFormat('pre', $document);
1614+
$this->preFormatInvoked = true;
16111615
}
16121616

16131617
public function doFormat($type, Document $document)
@@ -1889,4 +1893,9 @@ public function getShape()
18891893
{
18901894
return self::SHAPE_RECTANGLE;
18911895
}
1896+
1897+
public function hasPreFormatBeenInvoked()
1898+
{
1899+
return $this->preFormatInvoked;
1900+
}
18921901
}

0 commit comments

Comments
 (0)