Skip to content
forked from psliwa/PHPPdf

Commit

Permalink
Merge branch '1.2.x'
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGELOG.markdown
	lib/PHPPdf/Version.php
  • Loading branch information
psliwa committed Aug 14, 2016
2 parents bf6d0b2 + 84390da commit 2e38a65
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions lib/PHPPdf/Core/Node/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class Manager implements DocumentParserListener

private $managedNodes = array();
private $behavioursTasks;

private $preFormatInvoked = array();

public function __construct()
{
Expand Down Expand Up @@ -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();
}
}
11 changes: 10 additions & 1 deletion lib/PHPPdf/Core/Node/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -1327,6 +1329,7 @@ public function copy()
$copy->ancestorWithFontSize = null;
$copy->ancestorWithRotation = null;
$copy->closestAncestorWithPosition = null;
$copy->preFormatInvoked = false;

return $copy;
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1889,4 +1893,9 @@ public function getShape()
{
return self::SHAPE_RECTANGLE;
}

public function hasPreFormatBeenInvoked()
{
return $this->preFormatInvoked;
}
}

0 comments on commit 2e38a65

Please sign in to comment.