From d0abc1a165ce7130e802d892e1417617a99a3ba0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 3 Sep 2010 17:11:27 +0000 Subject: Merge commit 1170303 from the Enterprise branch git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171389 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- khtml/rendering/bidi.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'khtml/rendering/bidi.h') diff --git a/khtml/rendering/bidi.h b/khtml/rendering/bidi.h index 15a9ab906..c8776ce19 100644 --- a/khtml/rendering/bidi.h +++ b/khtml/rendering/bidi.h @@ -24,6 +24,7 @@ #define BIDI_H #include +#include "rendering/render_object.h" namespace khtml { class RenderArena; @@ -101,6 +102,71 @@ public: struct BidiIterator; struct BidiState; + struct InlineMinMaxIterator + { + /* InlineMinMaxIterator is a class that will iterate over all render objects that contribute to + inline min/max width calculations. Note the following about the way it walks: + (1) Positioned content is skipped (since it does not contribute to min/max width of a block) + (2) We do not drill into the children of floats or replaced elements, since you can't break + in the middle of such an element. + (3) Inline flows (e.g., , , ) are walked twice, since each side can have + distinct borders/margin/padding that contribute to the min/max width. + */ + RenderObject* parent; + RenderObject* current; + bool endOfInline; + bool skipPositioned; + InlineMinMaxIterator(RenderObject* p, RenderObject* o, bool eOI=false, bool skipPos=true) + :parent(p), current(o), endOfInline(eOI), skipPositioned(skipPos) {} + inline RenderObject* next(); + }; + + inline RenderObject* InlineMinMaxIterator::next() + { + RenderObject* result = 0; + bool oldEndOfInline = endOfInline; + endOfInline = false; + while (current != 0 || (current == parent)) + { + //kDebug( 6040 ) << "current = " << current; + if (!oldEndOfInline && + (current == parent || + (!current->isFloating() && !current->isReplaced() && !current->isPositioned()))) + result = current->firstChild(); + if (!result) { + // We hit the end of our inline. (It was empty, e.g., .) + if (!oldEndOfInline && current->isInlineFlow()) { + result = current; + endOfInline = true; + break; + } + while (current && current != parent) { + result = current->nextSibling(); + if (result) break; + current = current->parent(); + if (current && current != parent && current->isInlineFlow()) { + result = current; + endOfInline = true; + break; + } + } + } + + if (!result) break; + + if ((!skipPositioned || !result->isPositioned()) && (result->isText() || result->isBR() || + result->isFloatingOrPositioned() || result->isReplaced() || result->isGlyph() || result->isInlineFlow())) + break; + + current = result; + result = 0; + } + + // Update our position. + current = result; + return current; + } + } #endif -- cgit v1.2.1