Skip to content

Commit ea6062c

Browse files
committed
Fix individual border rendering (Fix niklasvh#1349)
1 parent 9a4a506 commit ea6062c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/Renderer.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export default class Renderer {
165165
!container.style.background.backgroundColor.isTransparent() ||
166166
container.style.background.backgroundImage.length;
167167

168-
const renderableBorders = container.style.border.filter(
168+
const hasRenderableBorders = container.style.border.some(
169169
border =>
170170
border.borderStyle !== BORDER_STYLE.NONE && !border.borderColor.isTransparent()
171171
);
@@ -186,12 +186,17 @@ export default class Renderer {
186186
});
187187
}
188188

189-
renderableBorders.forEach((border, side) => {
190-
this.renderBorder(border, side, container.curvedBounds);
189+
container.style.border.forEach((border, side) => {
190+
if (
191+
border.borderStyle !== BORDER_STYLE.NONE &&
192+
!border.borderColor.isTransparent()
193+
) {
194+
this.renderBorder(border, side, container.curvedBounds);
195+
}
191196
});
192197
};
193198

194-
if (HAS_BACKGROUND || renderableBorders.length) {
199+
if (HAS_BACKGROUND || hasRenderableBorders) {
195200
const paths = container.parent ? container.parent.getClipPaths() : [];
196201
if (paths.length) {
197202
this.target.clip(paths, callback);

tests/reftests/border/solid.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
margin: 10px;
1313
background:#6F428C;
1414
border-style: solid;
15+
border-width: 0;
1516
}
1617

1718
.box1 {
@@ -33,6 +34,12 @@
3334
border-color: green;
3435
}
3536

37+
.box5 {
38+
border-style: none;
39+
border-bottom: 50px solid #807d32;
40+
border-bottom-width: 50px;
41+
}
42+
3643
html {
3744
background: #3a84c3;
3845
}
@@ -43,5 +50,6 @@
4350
<div class="box2">&nbsp;</div>
4451
<div class="box3">&nbsp;</div>
4552
<div class="box4">&nbsp;</div>
53+
<div class="box5">&nbsp;</div>
4654
</body>
4755
</html>

0 commit comments

Comments
 (0)