Merged revision(s) 51086 #170279af46, 51100 #871641c688 from trunk:

ipro: Fix non-breaking space character given by numerical value instead of " "; fixes issue #28174.
........
TurboPower_iPro: Fix bgcolor attribute of tables, rows and cells
........

git-svn-id: branches/fixes_1_6@51149 -
This commit is contained in:
maxim 2016-01-03 12:33:35 +00:00
parent a47a2dffda
commit 36a750c573
2 changed files with 35 additions and 15 deletions

View File

@ -2718,6 +2718,7 @@ const
MaxElements = 1024*1024;
ShyChar = #1; {character used to represent soft-hyphen in strings}
NbspChar = #2; {character used to represent no-break space in strings}
NbspUtf8 = #194#160; {utf8 code of no-break space character}
WheelDelta = 8;
const
@ -3229,7 +3230,10 @@ begin {'Complete boolean eval' must be off}
if not OnUTF8 and (Index1 >= 32) and (Index1 <= 255) then
Result := Chr(Index1)
else
begin
Result := UnicodeToUTF8(Index1);
if Result = NbspUTF8 then Result := NbspChar;
end;
end;
end else
begin
@ -3316,12 +3320,25 @@ end;
function NoBreakToSpace(const S: string): string;
var
P : Integer;
P, n : Integer;
begin
Result := S;
for P := length(Result) downto 1 do
if Result[P] = NbspChar then
Result[P] := ' ';
SetLength(Result, Length(S));
n := 0;
P := 1;
while P <= Length(S) do
begin
inc(n);
if S[P] = NbspChar then
Result[n] := ' '
else if (P < Length(S)) and (S[P] = NbspUtf8[1]) and (S[P+1] = NbspUtf8[2]) then
begin
Result[n] := ' ';
inc(P);
end else
Result[n] := S[P];
inc(P);
end;
SetLength(Result, n);
end;
procedure SetRawWordValue(Entry: PIpHtmlElement; const Value: string);
@ -6318,6 +6335,7 @@ begin
FixupPercentages(CurRow);
CurRow := TIpHtmlNodeTR.Create(Parent);
CurRow.ParseBaseProps(Self);
CurRow.BgColor := ColorFromString(FindAttribute(htmlAttrBGCOLOR));
CurRow.Align := ParseAlignment;
CurRow.VAlign := ParseVAlignment;
CurRow.LoadAndApplyCSSProps;
@ -6443,11 +6461,11 @@ begin
Border := ParseInteger(htmlAttrBORDER, 0);
CellSpacing := ParseInteger(htmlAttrCELLSPACING, 2);
CellPadding := ParseInteger(htmlAttrCELLPADDING, 2);
BgColor := ColorFromString(FindAttribute(htmlAttrBGCOLOR));
ParseBaseProps(Self);
Summary := FindAttribute(htmlAttrSUMMARY);
Frame := ParseFrameProp(Frame);
Rules := ParseRules(Rules);
BgColor := ColorFromString(FindAttribute(htmlAttrBGCOLOR));
end;
repeat
@ -9259,7 +9277,7 @@ begin
case CurElem.ElementType of
etWord :
begin
if CurElem.AnsiWord <> NAnchorChar then begin
S := S + NoBreakToSpace(CurElem.AnsiWord);
LFDone := False;
end;
@ -10096,10 +10114,14 @@ var
aCanvas : TCanvas;
begin
aCanvas := Owner.Target;
Props.BGColor := BGColor;
if (Props.BGColor <> -1) and PageRectToScreen(BorderRect, R) then begin
aCanvas.Brush.Color := Props.BGColor;
aCanvas.Brush.Color :=Props.BGColor;
aCanvas.FillRect(R);
end;
end
else if (Props.BGColor = -1) then
aCanvas.Brush.Style := bsClear;
aCanvas.Pen.Color := clBlack;
Al := Props.VAlignment;
@ -10138,11 +10160,8 @@ begin
end;
// set TR color, Render override them anyway if TD/TH have own settings
if TrBgColor <> -1 then
Props.BGColor := TrBgColor;
if TrTextColor <> -1 then
Props.FontColor := TrTextColor;
Props.BGColor := TrBgColor;
Props.FontColor := TrTextColor;
Props.VAlignment := Al;
Render(Props);

View File

@ -1480,7 +1480,8 @@ begin
begin
FIpHtml.Target.Brush.Color := Props.BGColor;
FIpHtml.Target.FillRect(R);
end;
end else
FIpHtml.Target.Brush.Style := bsClear;
end;
Props.DelayCache:=False;
inherited Render(Props);