Skip to content

Commit

Permalink
fix: don't apply text shadows on elements (#1795)
Browse files Browse the repository at this point in the history
* Fix for Issue-1638 (#1638)
Resolution: Clearing the Shadow Properties after they are consumed
  • Loading branch information
niklasvh authored Apr 8, 2019
1 parent 7027900 commit 397595a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/renderer/CanvasRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ export default class CanvasRenderer implements RenderTarget<HTMLCanvasElement> {
text.bounds.top + text.bounds.height
);
});

this.ctx.shadowColor = '';
this.ctx.shadowOffsetX = 0;
this.ctx.shadowOffsetY = 0;
this.ctx.shadowBlur = 0;
} else {
this.ctx.fillText(
text.text,
Expand Down
12 changes: 12 additions & 0 deletions tests/reftests/text/shadow.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@
<span>testing with transparent</span>
<strong>testing with low opacity</strong>
</div>

<div id="capture" style="padding: 10px; background: #f5da55; border:2px solid blue;">
<h4 style="color: #000;text-shadow:0px 0px 5px green;">Hello world!</h4>
<div id="sampleDiv" style="border:2px solid red;padding:5px;margin:5px;">Sample Div with Border</div>
<div style="border:2px solid red;background-color:pink; padding:5px;margin:5px;">Sample Div with Border</div>
<div style="border:2px solid red;color:blue; padding:5px;margin:5px;">Sample Div with Border</div>
<div style="border:2px solid red;padding:5px;margin:5px;">Sample Div with Border</div>
<div style="border:2px solid red;padding:5px;text-shadow:0px 0px 5px red;margin:5px;">Sample Div with Border</div>
<div style="border:2px solid red;padding:5px;margin:5px;">Sample Div with Border</div>
<div style="border:2px solid red;padding:5px;margin:5px;">Sample Div with Border</div>
</div>

<p class="white-text-with-blue-shadow">Sed ut perspiciatis unde omnis iste
natus error sit voluptatem accusantium doloremque laudantium,
totam rem aperiam, eaque ipsa quae ab illo inventore.</p>
Expand Down

0 comments on commit 397595a

Please sign in to comment.