Turbopower_ipro: Fix RTL of table cells. Add some colspan test cases.

This commit is contained in:
wp_xyz 2022-05-31 18:00:15 +02:00
parent 420416181f
commit 6b204cd770
7 changed files with 80 additions and 18 deletions

View File

@ -461,7 +461,7 @@ begin
isRTL := true; isRTL := true;
end; end;
if isRTL then if isRTL then
R.SetLocation(FPageRect.Right - R.Right + FPageRect.Left, R.Top); R.SetLocation(FPageRect.Right - R.Right + FPageRect.Left - 1, R.Top);
SetWordRect(CurElem, R); SetWordRect(CurElem, R);
end else end else
@ -538,13 +538,6 @@ begin
while Assigned(node) do begin while Assigned(node) do begin
if (node is TIpHtmlNodeCore) then if (node is TIpHtmlNodeCore) then
lAlign := TIpHtmlNodeCore(node).Align lAlign := TIpHtmlNodeCore(node).Align
{
if (node is TIpHtmlNodeP) then
lAlign := TIpHtmlNodeP(node).Align
else
if (node is TIpHtmlNodeDIV) then
lAlign := TIpHtmlNodeDIV(node).Align
}
else else
break; break;
if lAlign = haDefault then if lAlign = haDefault then

View File

@ -1197,7 +1197,9 @@ var
begin begin
Result := hdLTR; Result := hdLTR;
S := UpperCase(FindAttribute(htmlAttrDIR)); S := UpperCase(FindAttribute(htmlAttrDIR));
if (S = '') or (S = 'LTR') then if (S = '') then
Result := hdNone
else if (S = 'LTR') then
Result := hdLTR Result := hdLTR
else if (S = 'RTL') then else if (S = 'RTL') then
Result := hdRTL Result := hdRTL

View File

@ -51,7 +51,7 @@ type
); );
TIpHtmlDirection = ( TIpHtmlDirection = (
hdLTR, hdRTL hdNone, hdLTR, hdRTL
); );
TIpHtmlElemMarginStyle = ( TIpHtmlElemMarginStyle = (

View File

@ -562,6 +562,48 @@ const
'</body>' + LE + '</body>' + LE +
'</html>'; '</html>';
ColWidth_colspan200px_title =
'Three columns, two merged.';
ColWidth_colspan200px_descr =
'Two columns merged, 200px in total; 3rd column 200px';
ColWidth_colspan200px_html =
'<html>' + LE +
'<body>' + LE +
'<table border="1">' + LE +
' <tr>' + LE +
' <th width="200" colspan="2">Columns A and B</th>' + LE +
' <th width="200">Column B</th>' + LE +
' </tr>' + LE +
' <tr>' + LE +
' <td>Cell 1</td>' + LE +
' <td>Cell 2</td>' + LE +
' <td>Cell 3</td>' + LE +
' </tr>' + LE +
'</table>' + LE +
'</body>' + LE +
'</html>';
ColWidth_colspan200px_100perc_title =
'Three columns, two merged. Total 100%.';
ColWidth_colspan200px_100perc_descr =
'Two columns merged, 200px in total; 3rd column 200px. Total table width covers entire space. CONFLICTING PARAMETERS!';
ColWidth_colspan200px_100perc_html =
'<html>' + LE +
'<body>' + LE +
'<table border="1" width="100%">' + LE +
' <tr>' + LE +
' <th width="200" colspan="2">Columns A and B</th>' + LE +
' <th width="200">Column B</th>' + LE +
' </tr>' + LE +
' <tr>' + LE +
' <td>Cell 1</td>' + LE +
' <td>Cell 2</td>' + LE +
' <td>Cell 3</td>' + LE +
' </tr>' + LE +
'</table>' + LE +
'</body>' + LE +
'</html>';
ColGroup_ColWidth_200px_total100perc_title = ColGroup_ColWidth_200px_total100perc_title =
'Table using ColGroup, table width 100%, 1st column 200px, 2nd column covers rest'; 'Table using ColGroup, table width 100%, 1st column 200px, 2nd column covers rest';
ColGroup_ColWidth_200px_total100perc_descr = ColGroup_ColWidth_200px_total100perc_descr =
@ -1002,6 +1044,26 @@ const
'</body>' + LE + '</body>' + LE +
'</html>'; '</html>';
Table_RTL_title =
'Column widths specified, total width automatic';
Table_RTL_descr =
'The table should be at the right.' + LE +'The narrow column (A) should be at the right.';
Table_RTL_html =
'<html>' + LE +
'<body dir="rtl">' + LE +
'<table border="1">' + LE +
' <tr>' + LE +
' <th width="80">Column A</th>' + LE +
' <th width="160">Column B</th>' + LE +
' </tr>' + LE +
' <tr>' + LE +
' <td>Cell 1</td>' + LE +
' <td>Cell 2</td>' + LE +
' </tr>' + LE +
'</table>' + LE +
'</body>' + LE +
'</html>';
implementation implementation

View File

@ -695,7 +695,7 @@ object TestForm: TTestForm
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnPassed AnchorSideTop.Control = btnPassed
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 500 Left = 474
Height = 25 Height = 25
Top = 1 Top = 1
Width = 137 Width = 137
@ -712,11 +712,11 @@ object TestForm: TTestForm
Left = 224 Left = 224
Height = 26 Height = 26
Top = 0 Top = 0
Width = 82 Width = 69
AutoSize = True AutoSize = True
BorderSpacing.Left = 24 BorderSpacing.Left = 24
BorderSpacing.Right = 3 BorderSpacing.Right = 3
Caption = 'Passed' Caption = 'Pass'
HotImageIndex = 1 HotImageIndex = 1
Images = ImageList1 Images = ImageList1
ImageIndex = 1 ImageIndex = 1
@ -728,12 +728,12 @@ object TestForm: TTestForm
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel3 AnchorSideTop.Control = Panel3
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 309 Left = 296
Height = 26 Height = 26
Top = 0 Top = 0
Width = 77 Width = 64
AutoSize = True AutoSize = True
Caption = 'Failed' Caption = 'Fail'
HotImageIndex = 0 HotImageIndex = 0
Images = ImageList1 Images = ImageList1
ImageIndex = 0 ImageIndex = 0
@ -745,7 +745,7 @@ object TestForm: TTestForm
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnPassed AnchorSideTop.Control = btnPassed
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 389 Left = 363
Height = 25 Height = 25
Top = 1 Top = 1
Width = 87 Width = 87

View File

@ -246,7 +246,8 @@ begin
AddTest(node1, ColWidth_100perc_title, ColWidth_100perc_descr, ColWidth_100perc_html); AddTest(node1, ColWidth_100perc_title, ColWidth_100perc_descr, ColWidth_100perc_html);
AddTest(node1, ColWidth_30perc_70perc_title, ColWidth_30perc_70perc_descr, ColWidth_30perc_70perc_html); AddTest(node1, ColWidth_30perc_70perc_title, ColWidth_30perc_70perc_descr, ColWidth_30perc_70perc_html);
AddTest(node1, ColWidth_200px_total100perc_title, ColWidth_200px_total100perc_descr, ColWidth_200px_total100perc_html); AddTest(node1, ColWidth_200px_total100perc_title, ColWidth_200px_total100perc_descr, ColWidth_200px_total100perc_html);
AddTest(node1, ColWidth_colspan_fixed_total100perc_title, ColWidth_colspan_fixed_total100perc_descr, ColWidth_colspan_fixed_total100perc_html); AddTest(node1, ColWidth_colspan200px_title, ColWidth_colspan200px_descr, ColWidth_colspan200px_html);
AddTest(node1, ColWidth_colspan200px_100perc_title, ColWidth_colspan200px_100perc_descr, ColWidth_colspan200px_100perc_html);
AddTest(node1, ColGroup_ColWidth_200px_total100perc_title, ColGroup_ColWidth_200px_total100perc_descr, ColGroup_ColWidth_200px_total100perc_html); AddTest(node1, ColGroup_ColWidth_200px_total100perc_title, ColGroup_ColWidth_200px_total100perc_descr, ColGroup_ColWidth_200px_total100perc_html);
node1.Expanded := true; node1.Expanded := true;
node.Expanded := true; node.Expanded := true;
@ -306,6 +307,7 @@ begin
AddTest(node, Hebrew_bodyRTL_title, Hebrew_bodyRTL_descr, Hebrew_bodyRTL_html); AddTest(node, Hebrew_bodyRTL_title, Hebrew_bodyRTL_descr, Hebrew_bodyRTL_html);
AddTest(node, Hebrew_divRTL_title, Hebrew_divRTL_descr, Hebrew_divRTL_html); AddTest(node, Hebrew_divRTL_title, Hebrew_divRTL_descr, Hebrew_divRTL_html);
AddTest(node, Hebrew_pRTL_title, Hebrew_pRTL_descr, Hebrew_pRTL_html); AddTest(node, Hebrew_pRTL_title, Hebrew_pRTL_descr, Hebrew_pRTL_html);
AddTest(node, Table_RTL_title, Table_RTL_descr, Table_RTL_html);
node.Expanded := true; node.Expanded := true;
LoadResults; LoadResults;

View File

@ -17,6 +17,8 @@ d5068632b7f322c1076e0e78442ae6a3|1
c9798563026960f2332ed2fe9bc74b61|1 c9798563026960f2332ed2fe9bc74b61|1
0f50b75c007ba031862243f4cb9cd99b|1 0f50b75c007ba031862243f4cb9cd99b|1
eadb0b01c9e5cb899dd67a83e9edfe1f|0 eadb0b01c9e5cb899dd67a83e9edfe1f|0
71211d7bcfa2c07bc7b3a9c8d97d2575|1
9c5cc26c029b1e7a8d3f4df6b7bbee18|0
b84b1fcd170be4b397c019e7fe21f166|0 b84b1fcd170be4b397c019e7fe21f166|0
d042fcbe050041d0b45543b2a51d4bd1|1 d042fcbe050041d0b45543b2a51d4bd1|1
d5f938967363593d58c09959ea56f05a|1 d5f938967363593d58c09959ea56f05a|1
@ -50,3 +52,4 @@ f738db5e8941192ab14e0ecb485c8ed5|1
68af7a5a96a05d18d55eef5c3bf00a89|1 68af7a5a96a05d18d55eef5c3bf00a89|1
4fd8f73a6676e4967e653268ca3e7225|1 4fd8f73a6676e4967e653268ca3e7225|1
2e943290006b8273a3d2592c7632a6db|1 2e943290006b8273a3d2592c7632a6db|1
243218193755012c5a97b3e8e08a97e7|1