OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 ? view()->frameView()->visibleContentSize().height() | 1551 ? view()->frameView()->visibleContentSize().height() |
1552 : view()->frameView()->visibleContentSize().width(); | 1552 : view()->frameView()->visibleContentSize().width(); |
1553 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 1553 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
1554 return std::min(fillAvailableExtent, fillFallbackExtent); | 1554 return std::min(fillAvailableExtent, fillFallbackExtent); |
1555 } | 1555 } |
1556 | 1556 |
1557 // Use the content box logical height as specified by the style. | 1557 // Use the content box logical height as specified by the style. |
1558 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); | 1558 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); |
1559 } | 1559 } |
1560 | 1560 |
1561 void LayoutBox::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidatio
nContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasF
ixed, const PaintInvalidationState* paintInvalidationState) const | |
1562 { | |
1563 if (paintInvalidationContainer == this) | |
1564 return; | |
1565 | |
1566 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | |
1567 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); | |
1568 if (style()->hasInFlowPosition() && layer()) | |
1569 offset += layer()->offsetForInFlowPosition(); | |
1570 transformState.move(offset); | |
1571 return; | |
1572 } | |
1573 | |
1574 bool containerSkipped; | |
1575 LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); | |
1576 if (!o) | |
1577 return; | |
1578 | |
1579 bool isFixedPos = style()->position() == FixedPosition; | |
1580 bool hasTransform = hasLayer() && layer()->transform(); | |
1581 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, | |
1582 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. | |
1583 if (hasTransform && !isFixedPos) | |
1584 mode &= ~IsFixed; | |
1585 else if (isFixedPos) | |
1586 mode |= IsFixed; | |
1587 | |
1588 if (wasFixed) | |
1589 *wasFixed = mode & IsFixed; | |
1590 | |
1591 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans
formState.mappedPoint())); | |
1592 | |
1593 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); | |
1594 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | |
1595 TransformationMatrix t; | |
1596 getTransformFromContainer(o, containerOffset, t); | |
1597 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); | |
1598 } else { | |
1599 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); | |
1600 } | |
1601 | |
1602 if (containerSkipped) { | |
1603 // There can't be a transform between paintInvalidationContainer and o,
because transforms create containers, so it should be safe | |
1604 // to just subtract the delta between the paintInvalidationContainer and
o. | |
1605 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); | |
1606 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); | |
1607 return; | |
1608 } | |
1609 | |
1610 mode &= ~ApplyContainerFlip; | |
1611 | |
1612 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was
Fixed); | |
1613 } | |
1614 | |
1615 void LayoutBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
& transformState) const | 1561 void LayoutBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
& transformState) const |
1616 { | 1562 { |
1617 bool isFixedPos = style()->position() == FixedPosition; | 1563 bool isFixedPos = style()->position() == FixedPosition; |
1618 bool hasTransform = hasLayer() && layer()->transform(); | 1564 bool hasTransform = hasLayer() && layer()->transform(); |
1619 if (hasTransform && !isFixedPos) { | 1565 if (hasTransform && !isFixedPos) { |
1620 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, | 1566 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, |
1621 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. | 1567 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. |
1622 mode &= ~IsFixed; | 1568 mode &= ~IsFixed; |
1623 } else if (isFixedPos) { | 1569 } else if (isFixedPos) { |
1624 mode |= IsFixed; | 1570 mode |= IsFixed; |
1625 } | 1571 } |
1626 | 1572 |
1627 LayoutBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState); | 1573 LayoutBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState); |
1628 } | 1574 } |
1629 | 1575 |
1630 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o, const LayoutPoi
nt& point, bool* offsetDependsOnPoint) const | 1576 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const |
1631 { | 1577 { |
1632 ASSERT(o == container()); | 1578 LayoutSize offset = topLeftLocationOffset(); |
1633 | |
1634 LayoutSize offset; | |
1635 if (isRelPositioned()) | |
1636 offset += offsetForInFlowPosition(); | |
1637 | |
1638 if (!isInline() || isReplaced()) { | |
1639 offset += topLeftLocationOffset(); | |
1640 if (o->isLayoutFlowThread()) { | |
1641 // So far the point has been in flow thread coordinates (i.e. as if
everything in | |
1642 // the fragmentation context lived in one tall single column). Conve
rt it to a | |
1643 // visual point now. | |
1644 LayoutPoint pointInContainer = point + offset; | |
1645 offset += o->columnOffset(pointInContainer); | |
1646 if (offsetDependsOnPoint) | |
1647 *offsetDependsOnPoint = true; | |
1648 } | |
1649 } | |
1650 | |
1651 if (o->hasOverflowClip()) | |
1652 offset -= toLayoutBox(o)->scrolledContentOffset(); | |
1653 | 1579 |
1654 if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->is
LayoutInline()) | 1580 if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->is
LayoutInline()) |
1655 offset += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); | 1581 offset += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); |
1656 | 1582 |
1657 return offset; | 1583 return offset + LayoutBoxModelObject::offsetFromContainer(o); |
1658 } | 1584 } |
1659 | 1585 |
1660 InlineBox* LayoutBox::createInlineBox() | 1586 InlineBox* LayoutBox::createInlineBox() |
1661 { | 1587 { |
1662 return new InlineBox(*this); | 1588 return new InlineBox(*this); |
1663 } | 1589 } |
1664 | 1590 |
1665 void LayoutBox::dirtyLineBoxes(bool fullLayout) | 1591 void LayoutBox::dirtyLineBoxes(bool fullLayout) |
1666 { | 1592 { |
1667 if (inlineBoxWrapper()) { | 1593 if (inlineBoxWrapper()) { |
(...skipping 3101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4769 bool LayoutBox::canRenderBorderImage() const | 4695 bool LayoutBox::canRenderBorderImage() const |
4770 { | 4696 { |
4771 if (!style()->hasBorderDecoration()) | 4697 if (!style()->hasBorderDecoration()) |
4772 return false; | 4698 return false; |
4773 | 4699 |
4774 StyleImage* borderImage = style()->borderImage().image(); | 4700 StyleImage* borderImage = style()->borderImage().image(); |
4775 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); | 4701 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); |
4776 } | 4702 } |
4777 | 4703 |
4778 } // namespace blink | 4704 } // namespace blink |
OLD | NEW |