From b8607952161fde86e424398c24be902f573b241c Mon Sep 17 00:00:00 2001 From: Shiki Okasaka Date: Sat, 1 Jun 2013 03:03:44 +0900 Subject: [PATCH] [CSS] Fix not to render inline-block boxes twice; cf. css-003.html (StackingContext::addBase) : Fix a bug testdata/css-003.html : New --- src/css/StackingContext.cpp | 16 +++++++++++++--- testdata/css-003.html | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 testdata/css-003.html diff --git a/src/css/StackingContext.cpp b/src/css/StackingContext.cpp index 3932ae6..72dfabc 100644 --- a/src/css/StackingContext.cpp +++ b/src/css/StackingContext.cpp @@ -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 { diff --git a/testdata/css-003.html b/testdata/css-003.html new file mode 100644 index 0000000..2b2615d --- /dev/null +++ b/testdata/css-003.html @@ -0,0 +1,21 @@ + + + + + +
+
+
PASS
+
+
+ +