Changeset 143410 in webkit


Ignore:
Timestamp:
Feb 19, 2013, 4:45:40 PM (12 years ago)
Author:
eae@chromium.org
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.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143407 r143410  
     12013-02-19  Emil A Eklund  <eae@chromium.org>
     2
     3        Change computeStickyPositionConstraints to use LayoutBoxExtent for margins
     4        https://bugs.webkit.org/show_bug.cgi?id=108872
     5
     6        Reviewed by Levi Weintraub.
     7       
     8        Change RenderBoxModelObject::computeStickyPositionConstraints to
     9        use a LayoutBoxExtent to represent margins.
     10
     11        No new tests, no change in functionality.
     12
     13        * platform/graphics/LayoutRect.h:
     14        (WebCore::LayoutRect::contract):
     15        Add version contract methods that takes a LayoutBoxExtent object.
     16       
     17        * platform/graphics/LayoutSize.h:
     18        (WebCore::LayoutSize::shrink):
     19        Add shrink method.
     20       
     21        * rendering/RenderBoxModelObject.cpp:
     22        (WebCore::RenderBoxModelObject::computeStickyPositionConstraints):
     23        Change to use a LayoutBoxExtent object to represent margins.
     24
    1252013-02-19  Tony Gentilcore  <tonyg@chromium.org>
    226
  • trunk/Source/WebCore/platform/graphics/LayoutRect.h

    r133779 r143410  
    108108    void expand(LayoutUnit dw, LayoutUnit dh) { m_size.expand(dw, dh); }
    109109    void contract(const LayoutSize& size) { m_size -= size; }
     110    void contract(const LayoutBoxExtent& box)
     111    {
     112        m_location.move(box.left(), box.top());
     113        m_size.shrink(box.left() + box.right(), box.top() + box.bottom());
     114    }
    110115    void contract(LayoutUnit dw, LayoutUnit dh) { m_size.expand(-dw, -dh); }
    111116
  • trunk/Source/WebCore/platform/graphics/LayoutSize.h

    r133779 r143410  
    7171        m_width += width;
    7272        m_height += height;
     73    }
     74   
     75    void shrink(LayoutUnit width, LayoutUnit height)
     76    {
     77        m_width -= width;
     78        m_height -= height;
    7379    }
    7480   
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r143102 r143410  
    476476
    477477    LayoutRect containerContentRect = containingBlock->contentBoxRect();
     478    LayoutUnit maxWidth = containingBlock->availableLogicalWidth();
    478479
    479480    // Sticky positioned element ignore any override logical width on the containing block (as they don't call
    480481    // containingBlockLogicalWidthForContent). It's unclear whether this is totally fine.
    481     LayoutUnit minLeftMargin = minimumValueForLength(style()->marginLeft(), containingBlock->availableLogicalWidth(), view());
    482     LayoutUnit minTopMargin = minimumValueForLength(style()->marginTop(), containingBlock->availableLogicalWidth(), view());
    483     LayoutUnit minRightMargin = minimumValueForLength(style()->marginRight(), containingBlock->availableLogicalWidth(), view());
    484     LayoutUnit minBottomMargin = minimumValueForLength(style()->marginBottom(), containingBlock->availableLogicalWidth(), view());
     482    LayoutBoxExtent minMargin(minimumValueForLength(style()->marginTop(), maxWidth, view()),
     483        minimumValueForLength(style()->marginRight(), maxWidth, view()),
     484        minimumValueForLength(style()->marginBottom(), maxWidth, view()),
     485        minimumValueForLength(style()->marginLeft(), maxWidth, view()));
    485486
    486487    // Compute the container-relative area within which the sticky element is allowed to move.
    487     containerContentRect.move(minLeftMargin, minTopMargin);
    488     containerContentRect.contract(minLeftMargin + minRightMargin, minTopMargin + minBottomMargin);
     488    containerContentRect.contract(minMargin);
    489489    // Map to the view to avoid including page scale factor.
    490490    constraints.setAbsoluteContainingBlockRect(containingBlock->localToContainerQuad(FloatRect(containerContentRect), view()).boundingBox());
Note: See TracChangeset for help on using the changeset viewer.