[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
hyatt
hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:23:33 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit f0afc11d54d9fa20d07e16416d026da9ba183b56
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Feb 4 22:51:08 2003 +0000
Patch #1: Compacts are supposed to use their maximum intrinsic width
when determining if they will fit. I was wrongly using the
minwidth (i.e., being too aggressive about trying to squeeze
the compact in there).
Also yanking the setMaxWidth/MinWidth setters, since I'm not
using them any more.
Reviewed by kocienda
Patch #2: Implement an iterator for min/max width calculations
of blocks with inline children. This iterator will include
inline flows twice (with a bool flag indicating whether you're at the
start or end of the flow).
Reviewed by darin
* khtml/rendering/render_block.cpp:
(RenderBlock::layoutBlockChildren):
* khtml/rendering/render_box.h:
* khtml/rendering/render_object.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 8d9d44b..a0c3c1a 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,27 @@
+2003-02-04 David Hyatt <hyatt at apple.com>
+
+ Patch #1: Compacts are supposed to use their maximum intrinsic width
+ when determining if they will fit. I was wrongly using the
+ minwidth (i.e., being too aggressive about trying to squeeze
+ the compact in there).
+
+ Also yanking the setMaxWidth/MinWidth setters, since I'm not
+ using them any more.
+
+ Reviewed by kocienda
+
+ Patch #2: Implement an iterator for min/max width calculations
+ of blocks with inline children. This iterator will include
+ inline flows twice (with a bool flag indicating whether you're at the
+ start or end of the flow).
+
+ Reviewed by darin
+
+ * khtml/rendering/render_block.cpp:
+ (RenderBlock::layoutBlockChildren):
+ * khtml/rendering/render_box.h:
+ * khtml/rendering/render_object.h:
+
2003-02-04 Darin Adler <darin at apple.com>
Reviewed by Maciej.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8d9d44b..a0c3c1a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,27 @@
+2003-02-04 David Hyatt <hyatt at apple.com>
+
+ Patch #1: Compacts are supposed to use their maximum intrinsic width
+ when determining if they will fit. I was wrongly using the
+ minwidth (i.e., being too aggressive about trying to squeeze
+ the compact in there).
+
+ Also yanking the setMaxWidth/MinWidth setters, since I'm not
+ using them any more.
+
+ Reviewed by kocienda
+
+ Patch #2: Implement an iterator for min/max width calculations
+ of blocks with inline children. This iterator will include
+ inline flows twice (with a bool flag indicating whether you're at the
+ start or end of the flow).
+
+ Reviewed by darin
+
+ * khtml/rendering/render_block.cpp:
+ (RenderBlock::layoutBlockChildren):
+ * khtml/rendering/render_box.h:
+ * khtml/rendering/render_object.h:
+
2003-02-04 Darin Adler <darin at apple.com>
Reviewed by Maciej.
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index 80027bb..6387cb8 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -662,16 +662,13 @@ void RenderBlock::layoutBlockChildren( bool relayoutChildren )
child->style()->setDisplay(COMPACT);
int childMargins = child->marginLeft() + child->marginRight();
int margin = style()->direction() == LTR ? curr->marginLeft() : curr->marginRight();
- if (margin < (childMargins + child->minWidth())) {
+ if (margin < (childMargins + child->maxWidth())) {
// It won't fit. Kill the "compact" boolean and just treat
// the child like a normal block. This is only temporary.
child->style()->setDisplay(BLOCK);
treatCompactAsBlock = true;
}
else {
- // Cap our maxwidth at the margin's value.
- if (child->maxWidth() + childMargins > margin)
- child->setMaxWidth(margin - childMargins);
blockForCompactChild = curr;
compactChild = child;
child = child->nextSibling();
@@ -1753,29 +1750,73 @@ void RenderBlock::calcMinMaxWidth()
// ### compare with min/max width set in style sheet...
}
-static inline RenderObject *next(RenderObject *par, RenderObject *current)
+struct InlineMinMaxIterator
{
- RenderObject *next = 0;
- while(current != 0)
+/* 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., <a>, <span>, <i>) 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;
+
+ InlineMinMaxIterator(RenderObject* p, RenderObject* o, bool end = false)
+ :parent(p), current(o), endOfInline(end) {}
+
+ RenderObject* next();
+};
+
+RenderObject* InlineMinMaxIterator::next()
+{
+ RenderObject* result = 0;
+ bool oldEndOfInline = endOfInline;
+ endOfInline = false;
+ while (current != 0 || (current == parent))
{
//kdDebug( 6040 ) << "current = " << current << endl;
- if(!current->isFloating() && !current->isReplaced() && !current->isPositioned())
- next = current->firstChild();
- if(!next) {
- while(current && current != par) {
- next = current->nextSibling();
- if(next) break;
+ 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., <span></span>.)
+ if (!oldEndOfInline && (current->isRenderInline() || current->isRunIn())) {
+ result = current;
+ endOfInline = true;
+ break;
+ }
+
+ while (current && current != parent) {
+ result = current->nextSibling();
+ if (result) break;
current = current->parent();
+ if (current && current != parent &&
+ (current->isRenderInline() || current->isRunIn())) {
+ result = current;
+ endOfInline = true;
+ break;
+ }
}
}
- if(!next) break;
+ if (!result) break;
- if(next->isText() || next->isBR() || next->isFloating() || next->isReplaced() || next->isPositioned())
+ if (result->isText() || result->isBR() ||
+ result->isFloating() || result->isReplaced() ||
+ result->isRenderInline() || result->isRunIn())
break;
- current = next;
+
+ current = result;
+ result = 0;
}
- return next;
+
+ // Update our position.
+ current = result;
+ return current;
}
void RenderBlock::calcInlineMinMaxWidth()
@@ -1785,26 +1826,18 @@ void RenderBlock::calcInlineMinMaxWidth()
int cw = containingBlock()->contentWidth();
- RenderObject *child = firstChild();
-
// If we are at the start of a line, we want to ignore all white-space.
// Also strip spaces if we previously had text that ended in a trailing space.
bool stripFrontSpaces = true;
RenderObject* trailingSpaceChild = 0;
- bool nowrap, oldnowrap;
- nowrap = oldnowrap = style()->whiteSpace() == NOWRAP;
+ bool normal, oldnormal;
+ normal = oldnormal = style()->whiteSpace() == NORMAL;
- while(child != 0)
+ InlineMinMaxIterator childIterator(this, this);
+ while (RenderObject* child = childIterator.next())
{
- // positioned children don't affect the minmaxwidth
- if (child->isPositioned())
- {
- child = next(this, child);
- continue;
- }
-
- nowrap = child->style()->whiteSpace() == NOWRAP;
+ normal = child->style()->whiteSpace() == NORMAL;
if( !child->isBR() )
{
@@ -1851,7 +1884,7 @@ void RenderBlock::calcInlineMinMaxWidth()
short childMin = 0;
short childMax = 0;
- if (!child->isText()) {
+ if (!child->isText() && !childIterator.endOfInline) {
// Case (1) and (2). Inline replaced and inline flow elements. Both
// add in their margins to their min/max values.
int margins = 0;
@@ -1864,7 +1897,7 @@ void RenderBlock::calcInlineMinMaxWidth()
childMin += margins;
childMax += margins;
- if (child->isRenderInline()) {
+ if (child->isRenderInline() || child->isRunIn()) {
// Add in padding for inline flow elements. This is wrong in the
// same way the margin addition is wrong. XXXdwh fixme.
int padding = 0;
@@ -1889,7 +1922,7 @@ void RenderBlock::calcInlineMinMaxWidth()
childMin += child->minWidth();
childMax += child->maxWidth();
- if (!nowrap || !oldnowrap) {
+ if (normal || oldnormal) {
if(m_minWidth < inlineMin) m_minWidth = inlineMin;
inlineMin = 0;
}
@@ -1897,7 +1930,7 @@ void RenderBlock::calcInlineMinMaxWidth()
// Add our width to the max.
inlineMax += childMax;
- if (nowrap)
+ if (!normal)
inlineMin += childMin;
else {
// Now check our line.
@@ -1993,9 +2026,7 @@ void RenderBlock::calcInlineMinMaxWidth()
trailingSpaceChild = 0;
}
- oldnowrap = nowrap;
-
- child = next(this, child);
+ oldnormal = normal;
}
if (trailingSpaceChild && trailingSpaceChild->isText() && !m_pre) {
diff --git a/WebCore/khtml/rendering/render_box.h b/WebCore/khtml/rendering/render_box.h
index 755eca0..faed5bd 100644
--- a/WebCore/khtml/rendering/render_box.h
+++ b/WebCore/khtml/rendering/render_box.h
@@ -56,9 +56,7 @@ public:
virtual short minWidth() const { return m_minWidth; }
virtual short maxWidth() const { return m_maxWidth; }
- virtual void setMaxWidth(short s) { m_maxWidth = s; }
- virtual void setMinWidth(short s) { m_minWidth = s; }
-
+
virtual short contentWidth() const;
virtual int contentHeight() const;
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 1ba374d..3066a6a 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -466,8 +466,6 @@ public:
virtual short minWidth() const { return 0; }
virtual short maxWidth() const { return 0; }
- virtual void setMaxWidth(short s) { }
- virtual void setMinWidth(short s) { }
RenderStyle* style() const { return m_style; }
RenderStyle* style( bool firstLine ) const {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list