[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 08:36:38 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 59975e0963ac71b21c079168aa2fbf90e9912297
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Apr 23 23:43:33 2004 +0000
Fix to make the containing block percentage height calculation actually work according to the CSS2 spec.
Percentages other than 100% are now supported, and flexing percentage height blocks inside table cells
are now supported.
Reviewed by kocienda
* khtml/rendering/render_box.cpp:
(RenderBox::calcHeight):
(RenderBox::calcPercentageHeight):
* khtml/rendering/render_box.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a8ff1ec..c3859c7 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,16 @@
+2004-04-23 David Hyatt <hyatt at apple.com>
+
+ Fix to make the containing block percentage height calculation actually work according to the CSS2 spec.
+ Percentages other than 100% are now supported, and flexing percentage height blocks inside table cells
+ are now supported.
+
+ Reviewed by kocienda
+
+ * khtml/rendering/render_box.cpp:
+ (RenderBox::calcHeight):
+ (RenderBox::calcPercentageHeight):
+ * khtml/rendering/render_box.h:
+
2004-04-23 Ken Kocienda <kocienda at apple.com>
Reviewed by John
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index ccb317a..bb83c5d 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -923,39 +923,16 @@ void RenderBox::calcHeight()
h = Length(parent()->contentHeight() - marginTop() - marginBottom() -
borderTop() - paddingTop() - borderBottom() - paddingBottom(), Fixed);
- if (!h.isVariable())
- {
- int fh=-1;
+ if (!h.isVariable()) {
+ int fh = -1;
if (h.isFixed())
- fh = h.value + borderTop() + paddingTop() + borderBottom() + paddingBottom();
- else if (h.isPercent()) {
- // Handle a common case: nested 100% height <div>s.
- // This is kind of a one-off hack rather than doing it right.
- // Makes dbaron's z-index root bg testcases work. Bad dave. - dwh
- RenderBlock* cb = containingBlock();
- Length ch = containingBlock()->style()->height();
- while (cb && !cb->isTableCell() && ch.isPercent() && ch.value == 100) {
- cb = cb->containingBlock();
- ch = cb->style()->height();
- }
-
- if (cb->isCanvas()) {
- // Don't allow this to affect the canvas' m_height member variable, since this
- // can get called while the canvas is still laying out its kids.
- // e.g., <html style="height:100%">etc. -dwh
- int oldHeight = cb->height();
- static_cast<RenderCanvas*>(cb)->calcHeight();
- fh = h.width(cb->height()) + borderTop() + paddingTop() + borderBottom() + paddingBottom();
- cb->setHeight(oldHeight);
- }
- else if (ch.isFixed())
- fh = h.width(ch.value) + borderTop() + paddingTop() + borderBottom() + paddingBottom();
- }
- if (fh!=-1)
- {
- if (fh<m_height && !overhangingContents() && style()->overflow()==OVISIBLE)
+ fh = h.value;
+ else if (h.isPercent())
+ fh = calcPercentageHeight();
+ if (fh != -1) {
+ fh += borderTop() + paddingTop() + borderBottom() + paddingBottom();
+ if (fh < m_height && !overhangingContents() && style()->overflow() == OVISIBLE)
setOverhangingContents();
-
m_height = fh;
}
}
@@ -969,6 +946,36 @@ void RenderBox::calcHeight()
}
}
+int RenderBox::calcPercentageHeight()
+{
+ int result = -1;
+ RenderBlock* cb = containingBlock();
+ // Table cells violate what the CSS spec says to do with heights. Basically we
+ // don't care if the cell specified a height or not. We just always make ourselves
+ // be a percentage of the cell's current content height.
+ if (cb->isTableCell())
+ result = static_cast<RenderTableCell*>(cb)->getCellPercentageHeight();
+
+ // Otherwise we only use our percentage height if our containing block had a specified
+ // height.
+ else if (cb->style()->height().isFixed())
+ result = cb->style()->height().value;
+ else if (cb->style()->height().isPercent())
+ // We need to recur and compute the percentage height for our containing block.
+ result = cb->calcPercentageHeight();
+ else if (cb->isCanvas()) {
+ // Don't allow this to affect the block' m_height member variable, since this
+ // can get called while the block is still laying out its kids.
+ int oldHeight = cb->height();
+ cb->calcHeight();
+ result = cb->height();
+ cb->setHeight(oldHeight);
+ }
+ if (result != -1)
+ result = style()->height().width(result);
+ return result;
+}
+
int RenderBox::calcReplacedWidth() const
{
int width = calcReplacedWidthUsing(Width);
diff --git a/WebCore/khtml/rendering/render_box.h b/WebCore/khtml/rendering/render_box.h
index a2130a5..2934dee 100644
--- a/WebCore/khtml/rendering/render_box.h
+++ b/WebCore/khtml/rendering/render_box.h
@@ -113,6 +113,8 @@ public:
virtual int calcReplacedWidth() const;
virtual int calcReplacedHeight() const;
+ int calcPercentageHeight();
+
virtual int availableHeight() const;
int availableHeightUsing(const Length& h) const;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list