Skip to content

Commit 91c44a7

Browse files
jakejackson1claude
andcommitted
Draw a static form field in its CSS colour, background and border (#432) (#442)
* Draw a static form field in its CSS colour, background and border (#432) A field drawn into the page, with active forms off, always had a near-white fill, black text and a 0.2mm border in the colour already set. The form tags now record the field's background and border, read from the BORDER-TOP shorthand the cascade folds the border into, whether or not forms are active, and Form draws text inputs, text areas, selects, buttons, checkboxes and radio buttons with them, keeping the defaults for what the CSS leaves unset. The disabled and read-only greys still win, and a border of style none or no width is not drawn. An active field's /MK /BC now also follows a border colour given in the border shorthand, which only the border-color longhand reached before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share BorderMerger's border defaults with the form tags, and set a static field's colours in one place Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Say what the static field style helpers do more plainly Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Refresh the form snapshots for a field's CSS colours and border form-fields-static draws its styled field in dark red on pale yellow inside a blue border, and form-fields-active and form-fields-pdfa take that blue as the widget's border colour. The page-break-avoid fixtures draw their fields' grey CSS border. Rasterised against the base branch, nothing else changes; against this branch before its rebase onto #441, only the maxlength field differs, which #441 draws whole in a smaller font. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 16dc47b commit 91c44a7

12 files changed

Lines changed: 337 additions & 68 deletions

‎src/Css/BorderMerger.php‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66

77
class BorderMerger
88
{
9+
10+
/**
11+
* The parts a side's shorthand is built with when longhands give only some of them
12+
*/
13+
const DEFAULTS = [
14+
'WIDTH' => '0px',
15+
'STYLE' => 'none',
16+
'COLOR' => '#000000',
17+
];
18+
919
/**
1020
* @var array<int> Border dominance levels for cell borders (top/right/bottom/left)
1121
*/
@@ -44,12 +54,6 @@ public function mergeBorderProperties($newProperties, &$cssProperties)
4454
protected function mergeSideBorder($side, $properties, &$cssProperties)
4555
{
4656
// Merges $a['BORDER-TOP-STYLE'] to $cssProperties['BORDER-TOP'] etc.
47-
$defaults = [
48-
'WIDTH' => '0px',
49-
'STYLE' => 'none',
50-
'COLOR' => '#000000'
51-
];
52-
5357
$borderKey = 'BORDER-' . $side;
5458
$currentBorder = isset($cssProperties[$borderKey]) ? trim($cssProperties[$borderKey]) : '';
5559

@@ -74,7 +78,7 @@ protected function mergeSideBorder($side, $properties, &$cssProperties)
7478
} else {
7579
// Build new border from scratch with defaults
7680
if (!isset($borderParts)) {
77-
$borderParts = $defaults;
81+
$borderParts = self::DEFAULTS;
7882
}
7983

8084
$borderParts[$el] = $value;

‎src/Form.php‎

Lines changed: 101 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -238,22 +238,14 @@ function print_ob_text($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir)
238238
$this->mpdf->biDirectional = true;
239239
}
240240

241-
$this->mpdf->SetLineWidth(0.2 / $k);
241+
$border = $this->setStaticBorder($objattr, $k);
242242

243-
if (!empty($objattr['disabled'])) {
244-
$this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
245-
$this->mpdf->SetTColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
246-
} elseif (!empty($objattr['readonly'])) {
247-
$this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
248-
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
249-
} else {
250-
$this->mpdf->SetFColor($this->colorConverter->convert(250, $this->mpdf->PDFAXwarnings));
251-
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
252-
}
243+
$this->setStaticColors($objattr, !empty($objattr['disabled']) || !empty($objattr['readonly']));
253244

254-
$this->fittedCell($w, $h, $texto, 1, $rtlalign, 1, $this->form_element_spacing['input']['inner']['h'] / $k);
245+
$this->fittedCell($w, $h, $texto, $border ? 1 : 0, $rtlalign, 1, $this->form_element_spacing['input']['inner']['h'] / $k);
255246
$this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
256247
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
248+
$this->resetStaticBorder($objattr);
257249
}
258250
}
259251

@@ -332,20 +324,11 @@ function print_ob_textarea($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir)
332324
$this->mpdf->x += $this->form_element_spacing['textarea']['outer']['h'] / $k;
333325
$this->mpdf->y += $this->form_element_spacing['textarea']['outer']['v'] / $k;
334326

335-
$this->mpdf->SetLineWidth(0.2 / $k);
327+
$border = $this->setStaticBorder($objattr, $k);
336328

337-
if (!empty($objattr['disabled'])) {
338-
$this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
339-
$this->mpdf->SetTColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
340-
} elseif (!empty($objattr['readonly'])) {
341-
$this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
342-
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
343-
} else {
344-
$this->mpdf->SetFColor($this->colorConverter->convert(250, $this->mpdf->PDFAXwarnings));
345-
$this->mpdf->SetTColor(isset($objattr['color']) ? $objattr['color'] : $this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
346-
}
329+
$this->setStaticColors($objattr, !empty($objattr['disabled']) || !empty($objattr['readonly']));
347330

348-
$this->mpdf->Rect($this->mpdf->x, $this->mpdf->y, $w, $h, 'DF');
331+
$this->mpdf->Rect($this->mpdf->x, $this->mpdf->y, $w, $h, $border ? 'DF' : 'F');
349332
$ClipPath = sprintf('q %.3F %.3F %.3F %.3F re W n ', $this->mpdf->x * Mpdf::SCALE, ($this->mpdf->h - $this->mpdf->y) * Mpdf::SCALE, $w * Mpdf::SCALE, -$h * Mpdf::SCALE);
350333
$this->writer->write($ClipPath);
351334

@@ -360,6 +343,7 @@ function print_ob_textarea($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir)
360343
$this->writer->write('Q');
361344
$this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
362345
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
346+
$this->resetStaticBorder($objattr);
363347
}
364348
}
365349

@@ -430,14 +414,8 @@ function print_ob_select($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir)
430414
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
431415

432416
} else {
433-
$this->mpdf->SetLineWidth(0.2 / $k);
434-
if (!empty($objattr['disabled'])) {
435-
$this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
436-
$this->mpdf->SetTColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
437-
} else {
438-
$this->mpdf->SetFColor($this->colorConverter->convert(250, $this->mpdf->PDFAXwarnings));
439-
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
440-
}
417+
$border = $this->setStaticBorder($objattr, $k) ? 1 : 0;
418+
$this->setStaticColors($objattr, !empty($objattr['disabled']));
441419
$w -= $this->form_element_spacing['select']['outer']['h'] * 2 / $k;
442420
$h -= $this->form_element_spacing['select']['outer']['v'] * 2 / $k;
443421
$this->mpdf->x += $this->form_element_spacing['select']['outer']['h'] / $k;
@@ -456,7 +434,7 @@ function print_ob_select($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir)
456434
$this->mpdf->biDirectional = true;
457435
} // *RTL*
458436

459-
$this->fittedCell($w - ($this->mpdf->FontSize * 1.4), $h, $texto, 1, $rtlalign, 1, $this->form_element_spacing['select']['inner']['h'] / $k, $objattr['OTLdata']);
437+
$this->fittedCell($w - ($this->mpdf->FontSize * 1.4), $h, $texto, $border, $rtlalign, 1, $this->form_element_spacing['select']['inner']['h'] / $k, $objattr['OTLdata']);
460438
$this->mpdf->SetFColor($this->colorConverter->convert(190, $this->mpdf->PDFAXwarnings));
461439
$save_font = $this->mpdf->FontFamily;
462440
$save_currentfont = $this->mpdf->currentfontfamily;
@@ -470,15 +448,16 @@ function print_ob_select($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir)
470448
} else {
471449
$down = '=';
472450
}
473-
$this->mpdf->Cell($this->mpdf->FontSize * 1.4, $h, $down, 1, 0, 'C', 1);
451+
$this->mpdf->Cell($this->mpdf->FontSize * 1.4, $h, $down, $border, 0, 'C', 1);
474452
} else {
475453
$this->mpdf->SetFont('czapfdingbats');
476-
$this->mpdf->Cell($this->mpdf->FontSize * 1.4, $h, chr(116), 1, 0, 'C', 1);
454+
$this->mpdf->Cell($this->mpdf->FontSize * 1.4, $h, chr(116), $border, 0, 'C', 1);
477455
}
478456
$this->mpdf->SetFont($save_font);
479457
$this->mpdf->currentfontfamily = $save_currentfont;
480458
$this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
481459
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
460+
$this->resetStaticBorder($objattr);
482461
}
483462
}
484463

@@ -612,15 +591,18 @@ function print_ob_button($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir)
612591

613592
} else {
614593

615-
$this->mpdf->SetLineWidth(0.2 / $k);
616-
$this->mpdf->SetFColor($this->colorConverter->convert(190, $this->mpdf->PDFAXwarnings));
594+
$border = $this->setStaticBorder($objattr, $k);
595+
$this->mpdf->SetFColor($this->fieldColor($objattr, 'background-col', 190));
596+
if (isset($objattr['color'])) {
597+
$this->mpdf->SetTColor($objattr['color']);
598+
}
617599

618600
$w -= $this->form_element_spacing['button']['outer']['h'] * 2 / $k;
619601
$h -= $this->form_element_spacing['button']['outer']['v'] * 2 / $k;
620602

621603
$this->mpdf->x += $this->form_element_spacing['button']['outer']['h'] / $k;
622604
$this->mpdf->y += $this->form_element_spacing['button']['outer']['v'] / $k;
623-
$this->mpdf->RoundedRect($this->mpdf->x, $this->mpdf->y, $w, $h, 0.5 / $k, 'DF');
605+
$this->mpdf->RoundedRect($this->mpdf->x, $this->mpdf->y, $w, $h, 0.5 / $k, $border ? 'DF' : 'F');
624606

625607
$w -= $this->form_element_spacing['button']['inner']['h'] * 2 / $k;
626608
$h -= $this->form_element_spacing['button']['inner']['v'] * 2 / $k;
@@ -635,6 +617,10 @@ function print_ob_button($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir)
635617

636618
$this->fittedCell($w, $h, $texto, '', 'C', 0, 0);
637619
$this->mpdf->SetFColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
620+
if (isset($objattr['color'])) {
621+
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
622+
}
623+
$this->resetStaticBorder($objattr);
638624
}
639625
}
640626

@@ -659,15 +645,15 @@ function print_ob_checkbox($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir, $
659645
$ty = $y + (($h - $ih) / 2);
660646
$rx = $lx + $iw;
661647
$by = $ty + $ih;
662-
$this->mpdf->SetLineWidth(0.2 / $k);
648+
$border = $this->setStaticBorder($objattr, $k);
663649
if (!empty($objattr['disabled'])) {
664650
$this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
665651
$this->mpdf->SetDColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
666652
} else {
667-
$this->mpdf->SetFColor($this->colorConverter->convert(250, $this->mpdf->PDFAXwarnings));
668-
$this->mpdf->SetDColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
653+
$this->mpdf->SetFColor($this->fieldColor($objattr, 'background-col', 250));
654+
$this->mpdf->SetDColor($this->fieldColor($objattr, 'border-col', 0));
669655
}
670-
$this->mpdf->Rect($lx, $ty, $iw, $ih, 'DF');
656+
$this->mpdf->Rect($lx, $ty, $iw, $ih, $border ? 'DF' : 'F');
671657
if (!empty($objattr['checked'])) {
672658
//Round join and cap
673659
$this->mpdf->SetLineCap(1);
@@ -696,30 +682,96 @@ function print_ob_radio($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir, $x,
696682
}
697683
$this->SetRadio($w, $h, (isset($objattr['fieldname']) ? $objattr['fieldname'] : ''), $objattr['value'], (isset($objattr['title']) ? $objattr['title'] : ''), $checked, $flags, (isset($objattr['disabled']) ? $objattr['disabled'] : false));
698684
} else {
699-
$this->mpdf->SetLineWidth(0.2 / $k);
685+
$border = $this->setStaticBorder($objattr, $k);
700686
$radius = $this->mpdf->FontSize * 0.35;
701687
$cx = $x + ($w / 2);
702688
$cy = $y + ($h / 2);
703689
$color = $this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings);
704690
if (isset($objattr['color']) && $objattr['color']) {
705691
$color = $objattr['color'];
706692
}
693+
// The ring takes the text colour unless the border has its own
694+
$ring = isset($objattr['border-col']) ? $objattr['border-col'] : $color;
707695
if (!empty($objattr['disabled'])) {
708-
$this->mpdf->SetFColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
709-
$this->mpdf->SetDColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
710-
} else {
711-
$this->mpdf->SetFColor($color);
712-
$this->mpdf->SetDColor($color);
696+
$color = $ring = $this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings);
697+
}
698+
$background = isset($objattr['background-col']);
699+
$this->mpdf->SetFColor($background ? $objattr['background-col'] : $color);
700+
$this->mpdf->SetDColor($ring);
701+
if ($border || $background) {
702+
$this->mpdf->Circle($cx, $cy, $radius, ($border ? 'D' : '') . ($background ? 'F' : ''));
713703
}
714-
$this->mpdf->Circle($cx, $cy, $radius, 'D');
715704
if (!empty($objattr['checked'])) {
705+
$this->mpdf->SetFColor($color);
706+
$this->mpdf->SetDColor($color);
716707
$this->mpdf->Circle($cx, $cy, $radius * 0.4, 'DF');
717708
}
718709
$this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
719710
$this->mpdf->SetDColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
720711
}
721712
}
722713

714+
/**
715+
* A colour the field's CSS sets, or else a default
716+
*
717+
* @param mixed[] $objattr
718+
* @param string $key 'color', 'background-col' or 'border-col'
719+
* @param int $grey the default, from 0 for black to 255 for white
720+
*
721+
* @return string
722+
*/
723+
private function fieldColor(array $objattr, $key, $grey)
724+
{
725+
return isset($objattr[$key]) ? $objattr[$key] : $this->colorConverter->convert($grey, $this->mpdf->PDFAXwarnings);
726+
}
727+
728+
/**
729+
* Fills a text field, text area or select drawn into the page and colours its text as its CSS says, or else black
730+
* on near-white. Grey fill for a field that cannot be edited, and grey text for a disabled one, win over the CSS.
731+
*
732+
* @param mixed[] $objattr
733+
* @param bool $greyed whether it cannot be edited
734+
*/
735+
private function setStaticColors(array $objattr, $greyed)
736+
{
737+
$this->mpdf->SetFColor($greyed ? $this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings) : $this->fieldColor($objattr, 'background-col', 250));
738+
$this->mpdf->SetTColor(!empty($objattr['disabled']) ? $this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings) : $this->fieldColor($objattr, 'color', 0));
739+
}
740+
741+
/**
742+
* Sets the line a field drawn into the page is outlined with: its CSS border width and colour, or else 0.2mm in
743+
* the colour already set. A field without a border keeps the 0.2mm line for a checkbox's cross.
744+
*
745+
* @param mixed[] $objattr
746+
* @param float $k how much a table shrinks the field
747+
*
748+
* @return bool whether the field has a border
749+
*/
750+
private function setStaticBorder(array $objattr, $k)
751+
{
752+
$width = isset($objattr['border-width']) ? $objattr['border-width'] : 0.2;
753+
$border = $width > 0 && !(isset($objattr['border-style']) && in_array($objattr['border-style'], ['none', 'hidden'], true));
754+
755+
$this->mpdf->SetLineWidth(($border ? $width : 0.2) / $k);
756+
if (isset($objattr['border-col'])) {
757+
$this->mpdf->SetDColor($objattr['border-col']);
758+
}
759+
760+
return $border;
761+
}
762+
763+
/**
764+
* Strokes in black again after a field drawn in its CSS border colour
765+
*
766+
* @param mixed[] $objattr
767+
*/
768+
private function resetStaticBorder(array $objattr)
769+
{
770+
if (isset($objattr['border-col'])) {
771+
$this->mpdf->SetDColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
772+
}
773+
}
774+
723775
private function getCountItems($form)
724776
{
725777
$total = 1;

‎src/Tag/Input.php‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,8 @@ public function open($attr, &$ahtml, &$ihtml)
8585
} elseif (isset($properties['TEXT-ALIGN'])) {
8686
$objattr['text_align'] = $this->getAlign($properties['TEXT-ALIGN']);
8787
}
88-
if (isset($properties['BORDER-TOP-COLOR'])) {
89-
$objattr['border-col'] = $this->colorConverter->convert($properties['BORDER-TOP-COLOR'], $this->mpdf->PDFAXwarnings);
90-
}
91-
if (isset($properties['BACKGROUND-COLOR'])) {
92-
$objattr['background-col'] = $this->colorConverter->convert($properties['BACKGROUND-COLOR'], $this->mpdf->PDFAXwarnings);
93-
}
9488
}
89+
$objattr = array_merge($objattr, $this->formFieldStyle($properties));
9590

9691
$type = '';
9792
$texto = '';

‎src/Tag/Select.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function open($attr, &$ahtml, &$ihtml)
2626
if (isset($properties['COLOR'])) {
2727
$this->mpdf->selectoption['COLOR'] = $this->colorConverter->convert($properties['COLOR'], $this->mpdf->PDFAXwarnings);
2828
}
29+
$this->mpdf->selectoption['STYLE'] = $this->formFieldStyle($properties);
2930
$this->mpdf->specialcontent = 'type=select';
3031
if (isset($attr['DISABLED'])) {
3132
$this->mpdf->selectoption['DISABLED'] = $attr['DISABLED'];
@@ -123,6 +124,7 @@ public function close(&$ahtml, &$ihtml)
123124
if (isset($this->mpdf->selectoption['SIZE'])) {
124125
$objattr['size'] = $this->mpdf->selectoption['SIZE'];
125126
}
127+
$objattr = array_merge($objattr, $this->mpdf->selectoption['STYLE']);
126128
$rows = 1;
127129
if (isset($objattr['size']) && $objattr['size'] > 1) {
128130
$rows = $objattr['size'];

‎src/Tag/Tag.php‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Mpdf\Cache;
88
use Mpdf\Color\ColorConverter;
9+
use Mpdf\Css\BorderMerger;
910
use Mpdf\CssManager;
1011
use Mpdf\Form;
1112
use Mpdf\Image\ImageProcessor;
@@ -137,6 +138,45 @@ protected function withSpanVisibility(array $objattr)
137138
return $objattr;
138139
}
139140

141+
/**
142+
* The background and border a form field's CSS sets, for Form to draw whether or not forms are active. What the
143+
* CSS leaves unset is left out, so Form keeps its default.
144+
*
145+
* @param string[] $properties the field's computed CSS
146+
*
147+
* @return mixed[] any of 'background-col', 'border-col', 'border-width' in mm and 'border-style'
148+
*/
149+
protected function formFieldStyle(array $properties)
150+
{
151+
$style = [];
152+
if (isset($properties['BACKGROUND-COLOR'])) {
153+
$style['background-col'] = $this->colorConverter->convert($properties['BACKGROUND-COLOR'], $this->mpdf->PDFAXwarnings);
154+
}
155+
156+
if (!isset($properties['BORDER-TOP'])) {
157+
return $style;
158+
}
159+
160+
// The cascade folds border-top-width, -style and -color into BORDER-TOP, and keeps them. A part given only as a
161+
// longhand brings BorderMerger's defaults for the others, which the field should not take.
162+
$border = array_combine(array_keys(BorderMerger::DEFAULTS), array_pad(preg_split('/\s+/', trim($properties['BORDER-TOP']), 3), 3, ''));
163+
$longhand = isset($properties['BORDER-TOP-WIDTH']) || isset($properties['BORDER-TOP-STYLE']) || isset($properties['BORDER-TOP-COLOR']);
164+
foreach ($border as $part => $value) {
165+
if ($value === '' || ($longhand && !isset($properties['BORDER-TOP-' . $part]) && $value === BorderMerger::DEFAULTS[$part])) {
166+
continue;
167+
}
168+
if ($part === 'WIDTH') {
169+
$style['border-width'] = $this->sizeConverter->convert($value, $this->mpdf->blk[$this->mpdf->blklvl]['inner_width'], $this->mpdf->FontSize, false);
170+
} elseif ($part === 'STYLE') {
171+
$style['border-style'] = strtolower($value);
172+
} elseif ($color = $this->colorConverter->convert($value, $this->mpdf->PDFAXwarnings)) {
173+
$style['border-col'] = $color;
174+
}
175+
}
176+
177+
return $style;
178+
}
179+
140180
abstract public function open($attr, &$ahtml, &$ihtml);
141181

142182
abstract public function close(&$ahtml, &$ihtml);

‎src/Tag/TextArea.php‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,8 @@ public function open($attr, &$ahtml, &$ihtml)
8282
if (isset($properties['OVERFLOW']) && strtolower($properties['OVERFLOW']) === 'hidden') {
8383
$objattr['donotscroll'] = true;
8484
}
85-
if (isset($properties['BORDER-TOP-COLOR'])) {
86-
$objattr['border-col'] = $this->colorConverter->convert($properties['BORDER-TOP-COLOR'], $this->mpdf->PDFAXwarnings);
87-
}
88-
if (isset($properties['BACKGROUND-COLOR'])) {
89-
$objattr['background-col'] = $this->colorConverter->convert($properties['BACKGROUND-COLOR'], $this->mpdf->PDFAXwarnings);
90-
}
9185
}
86+
$objattr = array_merge($objattr, $this->formFieldStyle($properties));
9287
$this->mpdf->SetLineHeight('', $this->form->textarea_lineheight);
9388

9489
$w = 0;

0 commit comments

Comments
 (0)