Skip to content

Commit

Permalink
Fix individual border rendering (Fix #1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh committed Jan 2, 2018
1 parent 9a4a506 commit ea6062c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default class Renderer {
!container.style.background.backgroundColor.isTransparent() ||
container.style.background.backgroundImage.length;

const renderableBorders = container.style.border.filter(
const hasRenderableBorders = container.style.border.some(
border =>
border.borderStyle !== BORDER_STYLE.NONE && !border.borderColor.isTransparent()
);
Expand All @@ -186,12 +186,17 @@ export default class Renderer {
});
}

renderableBorders.forEach((border, side) => {
this.renderBorder(border, side, container.curvedBounds);
container.style.border.forEach((border, side) => {
if (
border.borderStyle !== BORDER_STYLE.NONE &&
!border.borderColor.isTransparent()
) {
this.renderBorder(border, side, container.curvedBounds);
}
});
};

if (HAS_BACKGROUND || renderableBorders.length) {
if (HAS_BACKGROUND || hasRenderableBorders) {
const paths = container.parent ? container.parent.getClipPaths() : [];
if (paths.length) {
this.target.clip(paths, callback);
Expand Down
8 changes: 8 additions & 0 deletions tests/reftests/border/solid.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
margin: 10px;
background:#6F428C;
border-style: solid;
border-width: 0;
}

.box1 {
Expand All @@ -33,6 +34,12 @@
border-color: green;
}

.box5 {
border-style: none;
border-bottom: 50px solid #807d32;
border-bottom-width: 50px;
}

html {
background: #3a84c3;
}
Expand All @@ -43,5 +50,6 @@
<div class="box2">&nbsp;</div>
<div class="box3">&nbsp;</div>
<div class="box4">&nbsp;</div>
<div class="box5">&nbsp;</div>
</body>
</html>

0 comments on commit ea6062c

Please sign in to comment.