Skip to content

Commit

Permalink
[CSS] Fix not to render inline-block boxes twice; cf. css-003.html
Browse files Browse the repository at this point in the history
(StackingContext::addBase) : Fix a bug
testdata/css-003.html : New
  • Loading branch information
ShikiOkasaka committed May 31, 2013
1 parent 6800297 commit b860795
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/css/StackingContext.cpp
Expand Up @@ -355,10 +355,20 @@ void StackingContext::renderFloats(ViewCSSImp* view, Box* last, Box* current)

void StackingContext::addBase(Box* box)
{
#ifndef NDEBUG
for (Box* i = firstBase; i; i = i->nextBase)
Box* prev = 0;
for (Box* i = firstBase; i; prev = i, i = i->nextBase) {
assert(box != i);
#endif
if (i->parentBox == box) { // This happens with positioned inline-level boxes
if (prev)
prev->nextBase = box;
else
firstBase = box;
box->nextBase = i->nextBase;
if (lastBase == i)
lastBase = box;
return;
}
}
if (!firstBase)
firstBase = lastBase = box;
else {
Expand Down
21 changes: 21 additions & 0 deletions testdata/css-003.html
@@ -0,0 +1,21 @@
<html>
<head>
<style>
#test {
display: inline-block;
overflow: hidden;
position: relative;
}
.float {
float: left;
}
</style>
</head>
<body>
<div class="float">
<div id="test">
<div class="float">PASS</div>
</div>
</div>
</body>
</html>

0 comments on commit b860795

Please sign in to comment.