Fix overflow: auto

This commit is contained in:
MoyuScript 2017-12-21 23:29:59 +08:00
parent b6997257f4
commit 4210cee7ac
2 changed files with 101 additions and 64 deletions

View File

@ -202,8 +202,7 @@ export default class NodeContainer {
} }
getClipPaths(): Array<Path> { getClipPaths(): Array<Path> {
const parentClips = this.parent ? this.parent.getClipPaths() : []; const parentClips = this.parent ? this.parent.getClipPaths() : [];
const isClipped = const isClipped = this.style.overflow !== OVERFLOW.VISIBLE;
this.style.overflow === OVERFLOW.HIDDEN || this.style.overflow === OVERFLOW.SCROLL;
return isClipped return isClipped
? parentClips.concat([calculatePaddingBoxPath(this.curvedBounds)]) ? parentClips.concat([calculatePaddingBoxPath(this.curvedBounds)])

View File

@ -31,11 +31,49 @@
line-height: 17px; line-height: 17px;
font-size: 1em; font-size: 1em;
} }
.cell {
display: inline-block;
width: 100px;
float: right;
height: 100px;
}
.cell p {
height: 60px;
}
.visible {
overflow: visible;
}
.hidden {
overflow: hidden;
}
.scroll {
overflow: scroll;
}
.auto {
overflow: auto;
}
</style> </style>
</head> </head>
<body> <body>
<div class="cell">
visible
<p class="visible">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
</div>
<div class="cell">
hidden
<p class="hidden">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
</div>
<div class="cell">
scroll
<p class="scroll">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
</div>
<div class="cell">
auto
<p class="auto">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
</div>
<h1>Overflow: visible</h1> <h1>Overflow: visible</h1>
<div> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like <b>Aldus PageMaker</b> including versions of Lorem Ipsum. <div> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like <b>Aldus PageMaker</b> including versions of Lorem Ipsum.
</div> </div>