View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037931 | Patches | LCL | public | 2020-10-16 01:15 | 2020-10-17 22:58 |
Reporter | Zaher Dirkey | Assigned To | wp | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Summary | 0037931: ipHTML Fix: Bug background color of text element | ||||
Description | if element have class with background color, it not applied to text element, see example, because the default textstyle not opaque, we need to set it if there is backcolor exists. | ||||
Steps To Reproduce | [code] <html> <head> <style type="text/css"> .class1 { color: #86f9c8; background-color: #fa8585; } </style> </head> <body> <p class="class1">Testing backcolor </body> </html> [/code] | ||||
Tags | ipHTMLPanel | ||||
Fixed in Revision | 64036 | ||||
LazTarget | 2.2 | ||||
Widgetset | |||||
Attached Files |
|
|
iphtmlblocklayout02.patch (2,201 bytes)
Index: components/turbopower_ipro/iphtmlblocklayout.pas =================================================================== --- components/turbopower_ipro/iphtmlblocklayout.pas (revision 63936) +++ components/turbopower_ipro/iphtmlblocklayout.pas (working copy) @@ -1267,6 +1267,7 @@ P : TPoint; R : TRect; {$IFDEF IP_LAZARUS} + TextStyle: TTextStyle; OldBrushcolor: TColor; OldFontColor: TColor; OldFontStyle: TFontStyles; @@ -1304,26 +1305,30 @@ {$IFDEF IP_LAZARUS} //if (LastOwner <> aCurWord.Owner) then LastPoint := P; saveCanvasProperties; + TextStyle := FCanvas.TextStyle; + //debugln(['TIpHtmlNodeBlock.RenderQueue ',aCurWord.AnsiWord]); + FIpHtml.PageRectToScreen(aCurWord.WordRect2, R); if aCurWord.IsSelected or FIpHtml.AllSelected then begin - FCanvas.Font.color := clHighlightText; + FCanvas.Font.Color := clHighlightText; FCanvas.brush.Style := bsSolid; - FCanvas.brush.color := clHighLight; - FIpHtml.PageRectToScreen(aCurWord.WordRect2, R); + FCanvas.brush.Color := clHighLight; FCanvas.FillRect(R); end - else if FCurProps.BgColor > 0 then + else if FCurProps.BgColor <> 0 then begin FCanvas.brush.Style := bsSolid; - FCanvas.brush.color := FCurProps.BgColor; + FCanvas.brush.Color := FCurProps.BgColor; + TextStyle.Opaque := True; end else + begin + TextStyle.Opaque := True; {$ENDIF} FCanvas.Brush.Style := bsClear; - //debugln(['TIpHtmlNodeBlock.RenderQueue ',aCurWord.AnsiWord]); - FIpHtml.PageRectToScreen(aCurWord.WordRect2, R); + {$IFDEF IP_LAZARUS} + end; - {$IFDEF IP_LAZARUS} if aCurWord.Owner.ParentNode = aCurTabFocus then FCanvas.DrawFocusRect(R); if FCanvas.Font.color = -1 then @@ -1331,8 +1336,12 @@ FCanvas.Font.Quality := FOwner.Owner.FontQuality; {$ENDIF} if aCurWord.AnsiWord <> NAnchorChar then - FCanvas.TextRect(R, P.x, P.y, NoBreakToSpace(aCurWord.AnsiWord)); {$IFDEF IP_LAZARUS} + FCanvas.TextRect(R, P.x, P.y, NoBreakToSpace(aCurWord.AnsiWord), TextStyle); + {$ELSE} + FCanvas.TextRect(R, P.x, P.y, NoBreakToSpace(aCurWord.AnsiWord)); + {$ENDIF} + {$IFDEF IP_LAZARUS} RestoreCanvasProperties; {$ENDIF} |
|
There is one issue which has been there all the time but was not apparent because background color did not work before your patch: Background although property set is not painted when the color is black <code> <html> <head> <style type="text/css"> .class1 { color: #86f9c8; background-color: #fa8585; } .class2 { color: #86f9c8; background-color: #000000; } </style> </head> <body> <p class="class1">Testing backcolor No back color <p class="class2">Back background </body> </html> </code> P.S. The pasted HTML is badly malformed here... I am attaching a test program with a SynEdit containing this code and a IpHtmlPanel. |
|
|
|
Sorry for mistake, in ipHTML they used -1 for color as none color, it should compared to -1 not 0, it is typo from me, please modify it to -1 not 0else if FCurProps.BgColor <> -1 then Also I want to change all -1 any where of ipHTML code to clNone instead, but I want permession to do that |
|
This is a new patch iphtmlblocklayout03.patch (2,202 bytes)
Index: components/turbopower_ipro/iphtmlblocklayout.pas =================================================================== --- components/turbopower_ipro/iphtmlblocklayout.pas (revision 63936) +++ components/turbopower_ipro/iphtmlblocklayout.pas (working copy) @@ -1267,6 +1267,7 @@ P : TPoint; R : TRect; {$IFDEF IP_LAZARUS} + TextStyle: TTextStyle; OldBrushcolor: TColor; OldFontColor: TColor; OldFontStyle: TFontStyles; @@ -1304,26 +1305,30 @@ {$IFDEF IP_LAZARUS} //if (LastOwner <> aCurWord.Owner) then LastPoint := P; saveCanvasProperties; + TextStyle := FCanvas.TextStyle; + //debugln(['TIpHtmlNodeBlock.RenderQueue ',aCurWord.AnsiWord]); + FIpHtml.PageRectToScreen(aCurWord.WordRect2, R); if aCurWord.IsSelected or FIpHtml.AllSelected then begin - FCanvas.Font.color := clHighlightText; + FCanvas.Font.Color := clHighlightText; FCanvas.brush.Style := bsSolid; - FCanvas.brush.color := clHighLight; - FIpHtml.PageRectToScreen(aCurWord.WordRect2, R); + FCanvas.brush.Color := clHighLight; FCanvas.FillRect(R); end - else if FCurProps.BgColor > 0 then + else if FCurProps.BgColor <> -1 then begin FCanvas.brush.Style := bsSolid; - FCanvas.brush.color := FCurProps.BgColor; + FCanvas.brush.Color := FCurProps.BgColor; + TextStyle.Opaque := True; end else + begin + TextStyle.Opaque := True; {$ENDIF} FCanvas.Brush.Style := bsClear; - //debugln(['TIpHtmlNodeBlock.RenderQueue ',aCurWord.AnsiWord]); - FIpHtml.PageRectToScreen(aCurWord.WordRect2, R); + {$IFDEF IP_LAZARUS} + end; - {$IFDEF IP_LAZARUS} if aCurWord.Owner.ParentNode = aCurTabFocus then FCanvas.DrawFocusRect(R); if FCanvas.Font.color = -1 then @@ -1331,8 +1336,12 @@ FCanvas.Font.Quality := FOwner.Owner.FontQuality; {$ENDIF} if aCurWord.AnsiWord <> NAnchorChar then - FCanvas.TextRect(R, P.x, P.y, NoBreakToSpace(aCurWord.AnsiWord)); {$IFDEF IP_LAZARUS} + FCanvas.TextRect(R, P.x, P.y, NoBreakToSpace(aCurWord.AnsiWord), TextStyle); + {$ELSE} + FCanvas.TextRect(R, P.x, P.y, NoBreakToSpace(aCurWord.AnsiWord)); + {$ENDIF} + {$IFDEF IP_LAZARUS} RestoreCanvasProperties; {$ENDIF} |
|
> I want to change all -1 any where of ipHTML code to clNone instead, but I want permession to do that That's a good idea. I'll put your blocklayout03 patch on hold then... |
|
Ok, but would you apply this patch because it fix a bug, and my next patch will generate bugs if i missed -1 there or there. In my plan, I want to make it work with Right to Left languages. |
|
OK, done: r64036. |
|
Please test and close if ok. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-10-16 01:15 | Zaher Dirkey | New Issue | |
2020-10-16 01:15 | Zaher Dirkey | File Added: iphtmlblocklayout02.patch | |
2020-10-16 17:52 | wp | Assigned To | => wp |
2020-10-16 17:52 | wp | Status | new => assigned |
2020-10-16 18:02 | wp | Status | assigned => feedback |
2020-10-16 18:02 | wp | LazTarget | => - |
2020-10-16 18:02 | wp | Note Added: 0126348 | |
2020-10-16 18:05 | wp | Note Edited: 0126348 | View Revisions |
2020-10-16 18:06 | wp | Note Edited: 0126348 | View Revisions |
2020-10-16 18:19 | wp | Note Edited: 0126348 | View Revisions |
2020-10-16 18:19 | wp | Note Added: 0126349 | |
2020-10-16 18:19 | wp | File Added: 37931 - IpHtmlPanel_TextBackgroundColor.zip | |
2020-10-16 23:07 | Zaher Dirkey | Note Added: 0126354 | |
2020-10-16 23:07 | Zaher Dirkey | Status | feedback => assigned |
2020-10-16 23:10 | Zaher Dirkey | Note Added: 0126356 | |
2020-10-16 23:10 | Zaher Dirkey | File Added: iphtmlblocklayout03.patch | |
2020-10-17 00:45 | Zaher Dirkey | Tag Attached: ipHTMLPanel | |
2020-10-17 01:04 | wp | Note Added: 0126359 | |
2020-10-17 10:50 | Zaher Dirkey | Note Added: 0126360 | |
2020-10-17 11:39 | wp | Note Added: 0126362 | |
2020-10-17 22:28 | wp | Status | assigned => resolved |
2020-10-17 22:28 | wp | Resolution | open => fixed |
2020-10-17 22:28 | wp | Fixed in Revision | => 64036 |
2020-10-17 22:28 | wp | LazTarget | - => 2.2 |
2020-10-17 22:28 | wp | Note Added: 0126378 | |
2020-10-17 22:58 | Zaher Dirkey | Status | resolved => closed |