Title: [143410] trunk/Source/WebCore
- Revision
- 143410
- Author
- e...@chromium.org
- Date
- 2013-02-19 16:45:40 -0800 (Tue, 19 Feb 2013)
Log Message
Change computeStickyPositionConstraints to use LayoutBoxExtent for margins
https://bugs.webkit.org/show_bug.cgi?id=108872
Reviewed by Levi Weintraub.
Change RenderBoxModelObject::computeStickyPositionConstraints to
use a LayoutBoxExtent to represent margins.
No new tests, no change in functionality.
* platform/graphics/LayoutRect.h:
(WebCore::LayoutRect::contract):
Add version contract methods that takes a LayoutBoxExtent object.
* platform/graphics/LayoutSize.h:
(WebCore::LayoutSize::shrink):
Add shrink method.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints):
Change to use a LayoutBoxExtent object to represent margins.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (143409 => 143410)
--- trunk/Source/WebCore/ChangeLog 2013-02-20 00:45:09 UTC (rev 143409)
+++ trunk/Source/WebCore/ChangeLog 2013-02-20 00:45:40 UTC (rev 143410)
@@ -1,3 +1,27 @@
+2013-02-19 Emil A Eklund <e...@chromium.org>
+
+ Change computeStickyPositionConstraints to use LayoutBoxExtent for margins
+ https://bugs.webkit.org/show_bug.cgi?id=108872
+
+ Reviewed by Levi Weintraub.
+
+ Change RenderBoxModelObject::computeStickyPositionConstraints to
+ use a LayoutBoxExtent to represent margins.
+
+ No new tests, no change in functionality.
+
+ * platform/graphics/LayoutRect.h:
+ (WebCore::LayoutRect::contract):
+ Add version contract methods that takes a LayoutBoxExtent object.
+
+ * platform/graphics/LayoutSize.h:
+ (WebCore::LayoutSize::shrink):
+ Add shrink method.
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::computeStickyPositionConstraints):
+ Change to use a LayoutBoxExtent object to represent margins.
+
2013-02-19 Tony Gentilcore <to...@chromium.org>
Disable ASSERT(!hasInsertionPoint()) for background parser
Modified: trunk/Source/WebCore/platform/graphics/LayoutRect.h (143409 => 143410)
--- trunk/Source/WebCore/platform/graphics/LayoutRect.h 2013-02-20 00:45:09 UTC (rev 143409)
+++ trunk/Source/WebCore/platform/graphics/LayoutRect.h 2013-02-20 00:45:40 UTC (rev 143410)
@@ -107,6 +107,11 @@
}
void expand(LayoutUnit dw, LayoutUnit dh) { m_size.expand(dw, dh); }
void contract(const LayoutSize& size) { m_size -= size; }
+ void contract(const LayoutBoxExtent& box)
+ {
+ m_location.move(box.left(), box.top());
+ m_size.shrink(box.left() + box.right(), box.top() + box.bottom());
+ }
void contract(LayoutUnit dw, LayoutUnit dh) { m_size.expand(-dw, -dh); }
void shiftXEdgeTo(LayoutUnit edge)
Modified: trunk/Source/WebCore/platform/graphics/LayoutSize.h (143409 => 143410)
--- trunk/Source/WebCore/platform/graphics/LayoutSize.h 2013-02-20 00:45:09 UTC (rev 143409)
+++ trunk/Source/WebCore/platform/graphics/LayoutSize.h 2013-02-20 00:45:40 UTC (rev 143410)
@@ -72,6 +72,12 @@
m_height += height;
}
+ void shrink(LayoutUnit width, LayoutUnit height)
+ {
+ m_width -= width;
+ m_height -= height;
+ }
+
void scale(float scale)
{
m_width *= scale;
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (143409 => 143410)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-02-20 00:45:09 UTC (rev 143409)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-02-20 00:45:40 UTC (rev 143410)
@@ -475,17 +475,17 @@
RenderBlock* containingBlock = this->containingBlock();
LayoutRect containerContentRect = containingBlock->contentBoxRect();
+ LayoutUnit maxWidth = containingBlock->availableLogicalWidth();
// Sticky positioned element ignore any override logical width on the containing block (as they don't call
// containingBlockLogicalWidthForContent). It's unclear whether this is totally fine.
- LayoutUnit minLeftMargin = minimumValueForLength(style()->marginLeft(), containingBlock->availableLogicalWidth(), view());
- LayoutUnit minTopMargin = minimumValueForLength(style()->marginTop(), containingBlock->availableLogicalWidth(), view());
- LayoutUnit minRightMargin = minimumValueForLength(style()->marginRight(), containingBlock->availableLogicalWidth(), view());
- LayoutUnit minBottomMargin = minimumValueForLength(style()->marginBottom(), containingBlock->availableLogicalWidth(), view());
+ LayoutBoxExtent minMargin(minimumValueForLength(style()->marginTop(), maxWidth, view()),
+ minimumValueForLength(style()->marginRight(), maxWidth, view()),
+ minimumValueForLength(style()->marginBottom(), maxWidth, view()),
+ minimumValueForLength(style()->marginLeft(), maxWidth, view()));
// Compute the container-relative area within which the sticky element is allowed to move.
- containerContentRect.move(minLeftMargin, minTopMargin);
- containerContentRect.contract(minLeftMargin + minRightMargin, minTopMargin + minBottomMargin);
+ containerContentRect.contract(minMargin);
// Map to the view to avoid including page scale factor.
constraints.setAbsoluteContainingBlockRect(containingBlock->localToContainerQuad(FloatRect(containerContentRect), view()).boundingBox());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes