[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hyatt at apple.com
hyatt at apple.com
Wed Dec 22 13:37:01 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit d2c45ea83cf77ee38cdf343af4818b3f716c8416
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Sep 21 17:49:19 2010 +0000
https://bugs.webkit.org/show_bug.cgi?id=46196, add marginStart/Before/End/After accessors to RenderBoxModelObject.
Reviewed by Dan Bernstein.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::marginBefore):
(WebCore::RenderBox::marginAfter):
(WebCore::RenderBox::marginStart):
(WebCore::RenderBox::marginEnd):
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.h:
* rendering/RenderInline.cpp:
(WebCore::computeMargin):
(WebCore::RenderInline::marginLeft):
(WebCore::RenderInline::marginRight):
(WebCore::RenderInline::marginTop):
(WebCore::RenderInline::marginBottom):
(WebCore::RenderInline::marginStart):
(WebCore::RenderInline::marginEnd):
* rendering/RenderInline.h:
(WebCore::RenderInline::marginBefore):
(WebCore::RenderInline::marginAfter):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c892340..1108d57 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,31 @@
Reviewed by Dan Bernstein.
+ https://bugs.webkit.org/show_bug.cgi?id=46196, add marginStart/Before/End/After accessors to RenderBoxModelObject.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::marginBefore):
+ (WebCore::RenderBox::marginAfter):
+ (WebCore::RenderBox::marginStart):
+ (WebCore::RenderBox::marginEnd):
+ * rendering/RenderBox.h:
+ * rendering/RenderBoxModelObject.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::computeMargin):
+ (WebCore::RenderInline::marginLeft):
+ (WebCore::RenderInline::marginRight):
+ (WebCore::RenderInline::marginTop):
+ (WebCore::RenderInline::marginBottom):
+ (WebCore::RenderInline::marginStart):
+ (WebCore::RenderInline::marginEnd):
+ * rendering/RenderInline.h:
+ (WebCore::RenderInline::marginBefore):
+ (WebCore::RenderInline::marginAfter):
+
+2010-09-21 David Hyatt <hyatt at apple.com>
+
+ Reviewed by Dan Bernstein.
+
https://bugs.webkit.org/show_bug.cgi?id=46190, add borderStart/Before/End/After accessors to RenderBoxModelObject.
* rendering/RenderBoxModelObject.h:
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 4eb4a42..514d731 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -83,6 +83,52 @@ RenderBox::~RenderBox()
{
}
+int RenderBox::marginBefore() const
+{
+ switch (style()->blockFlow()) {
+ case TopToBottomBlockFlow:
+ return m_marginTop;
+ case BottomToTopBlockFlow:
+ return m_marginBottom;
+ case LeftToRightBlockFlow:
+ return m_marginLeft;
+ case RightToLeftBlockFlow:
+ return m_marginRight;
+ }
+ ASSERT_NOT_REACHED();
+ return m_marginTop;
+}
+
+int RenderBox::marginAfter() const
+{
+ switch (style()->blockFlow()) {
+ case TopToBottomBlockFlow:
+ return m_marginBottom;
+ case BottomToTopBlockFlow:
+ return m_marginTop;
+ case LeftToRightBlockFlow:
+ return m_marginRight;
+ case RightToLeftBlockFlow:
+ return m_marginLeft;
+ }
+ ASSERT_NOT_REACHED();
+ return m_marginBottom;
+}
+
+int RenderBox::marginStart() const
+{
+ if (style()->isVerticalBlockFlow())
+ return style()->direction() == LTR ? m_marginLeft : m_marginRight;
+ return style()->direction() == LTR ? m_marginTop : m_marginBottom;
+}
+
+int RenderBox::marginEnd() const
+{
+ if (style()->isVerticalBlockFlow())
+ return style()->direction() == LTR ? m_marginRight : m_marginLeft;
+ return style()->direction() == LTR ? m_marginBottom : m_marginTop;
+}
+
void RenderBox::destroy()
{
// A lot of the code in this function is just pasted into
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index 476bcf9..d23db11 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -139,6 +139,10 @@ public:
virtual int marginBottom() const { return m_marginBottom; }
virtual int marginLeft() const { return m_marginLeft; }
virtual int marginRight() const { return m_marginRight; }
+ virtual int marginBefore() const;
+ virtual int marginAfter() const;
+ virtual int marginStart() const;
+ virtual int marginEnd() const;
// The following five functions are used to implement collapsing margins.
// All objects know their maximal positive and negative margins. The
diff --git a/WebCore/rendering/RenderBoxModelObject.h b/WebCore/rendering/RenderBoxModelObject.h
index 14f7c9f..72d784e 100644
--- a/WebCore/rendering/RenderBoxModelObject.h
+++ b/WebCore/rendering/RenderBoxModelObject.h
@@ -93,6 +93,10 @@ public:
virtual int marginBottom() const = 0;
virtual int marginLeft() const = 0;
virtual int marginRight() const = 0;
+ virtual int marginBefore() const = 0;
+ virtual int marginAfter() const = 0;
+ virtual int marginStart() const = 0;
+ virtual int marginEnd() const = 0;
bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBordersOrPadding() || marginLeft() != 0 || marginRight() != 0; }
bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || borderRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; }
diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp
index c985b92..1bee4e7 100644
--- a/WebCore/rendering/RenderInline.cpp
+++ b/WebCore/rendering/RenderInline.cpp
@@ -458,28 +458,53 @@ int RenderInline::offsetTop() const
return y;
}
-int RenderInline::marginLeft() const
+static int computeMargin(const RenderInline* renderer, const Length& margin)
{
- Length margin = style()->marginLeft();
if (margin.isAuto())
return 0;
if (margin.isFixed())
return margin.value();
if (margin.isPercent())
- return margin.calcMinValue(max(0, containingBlock()->availableWidth()));
+ return margin.calcMinValue(max(0, renderer->containingBlock()->availableLogicalWidth()));
return 0;
}
+int RenderInline::marginLeft() const
+{
+ if (!style()->isVerticalBlockFlow())
+ return 0;
+ return computeMargin(this, style()->marginLeft());
+}
+
int RenderInline::marginRight() const
{
- Length margin = style()->marginRight();
- if (margin.isAuto())
+ if (!style()->isVerticalBlockFlow())
return 0;
- if (margin.isFixed())
- return margin.value();
- if (margin.isPercent())
- return margin.calcMinValue(max(0, containingBlock()->availableWidth()));
- return 0;
+ return computeMargin(this, style()->marginRight());
+}
+
+int RenderInline::marginTop() const
+{
+ if (style()->isVerticalBlockFlow())
+ return 0;
+ return computeMargin(this, style()->marginTop());
+}
+
+int RenderInline::marginBottom() const
+{
+ if (style()->isVerticalBlockFlow())
+ return 0;
+ return computeMargin(this, style()->marginBottom());
+}
+
+int RenderInline::marginStart() const
+{
+ return computeMargin(this, style()->marginStart());
+}
+
+int RenderInline::marginEnd() const
+{
+ return computeMargin(this, style()->marginEnd());
}
const char* RenderInline::renderName() const
diff --git a/WebCore/rendering/RenderInline.h b/WebCore/rendering/RenderInline.h
index 71a8a89..feb8b8f 100644
--- a/WebCore/rendering/RenderInline.h
+++ b/WebCore/rendering/RenderInline.h
@@ -40,7 +40,13 @@ public:
virtual int marginLeft() const;
virtual int marginRight() const;
-
+ virtual int marginTop() const;
+ virtual int marginBottom() const;
+ virtual int marginBefore() const { return 0; }
+ virtual int marginAfter() const { return 0; }
+ virtual int marginStart() const;
+ virtual int marginEnd() const;
+
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&);
@@ -108,9 +114,6 @@ private:
virtual int offsetWidth() const { return linesBoundingBox().width(); }
virtual int offsetHeight() const { return linesBoundingBox().height(); }
- // Just ignore top/bottom margins on RenderInlines.
- virtual int marginTop() const { return 0; }
- virtual int marginBottom() const { return 0; }
virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth);
virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list