| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 while (curr && curr != renderView) { | 152 while (curr && curr != renderView) { |
| 153 if (curr->hasColumns() || curr->isRenderFlowThread()) | 153 if (curr->hasColumns() || curr->isRenderFlowThread()) |
| 154 return true; | 154 return true; |
| 155 if (curr->isFloatingOrOutOfFlowPositioned()) | 155 if (curr->isFloatingOrOutOfFlowPositioned()) |
| 156 return false; | 156 return false; |
| 157 curr = curr->containingBlock(); | 157 curr = curr->containingBlock(); |
| 158 } | 158 } |
| 159 return true; | 159 return true; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void RenderBlockFlow::RenderBlockFlowRareData::trace(Visitor* visitor) | |
| 163 { | |
| 164 visitor->trace(m_multiColumnFlowThread); | |
| 165 } | |
| 166 | |
| 167 RenderBlockFlow::RenderBlockFlow(ContainerNode* node) | 162 RenderBlockFlow::RenderBlockFlow(ContainerNode* node) |
| 168 : RenderBlock(node) | 163 : RenderBlock(node) |
| 169 { | 164 { |
| 170 static_assert(sizeof(MarginInfo) == sizeof(SameSizeAsMarginInfo), "MarginInf
o should stay small"); | 165 static_assert(sizeof(MarginInfo) == sizeof(SameSizeAsMarginInfo), "MarginInf
o should stay small"); |
| 171 setChildrenInline(true); | 166 setChildrenInline(true); |
| 172 } | 167 } |
| 173 | 168 |
| 174 RenderBlockFlow::~RenderBlockFlow() | 169 RenderBlockFlow::~RenderBlockFlow() |
| 175 { | 170 { |
| 176 } | 171 } |
| 177 | 172 |
| 178 void RenderBlockFlow::trace(Visitor* visitor) | |
| 179 { | |
| 180 visitor->trace(m_rareData); | |
| 181 RenderBlock::trace(visitor); | |
| 182 } | |
| 183 | |
| 184 RenderBlockFlow* RenderBlockFlow::createAnonymous(Document* document) | 173 RenderBlockFlow* RenderBlockFlow::createAnonymous(Document* document) |
| 185 { | 174 { |
| 186 RenderBlockFlow* renderer = new RenderBlockFlow(0); | 175 RenderBlockFlow* renderer = new RenderBlockFlow(0); |
| 187 renderer->setDocumentForAnonymous(document); | 176 renderer->setDocumentForAnonymous(document); |
| 188 return renderer; | 177 return renderer; |
| 189 } | 178 } |
| 190 | 179 |
| 191 RenderObject* RenderBlockFlow::layoutSpecialExcludedChild(bool relayoutChildren,
SubtreeLayoutScope& layoutScope) | 180 RenderObject* RenderBlockFlow::layoutSpecialExcludedChild(bool relayoutChildren,
SubtreeLayoutScope& layoutScope) |
| 192 { | 181 { |
| 193 RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread(); | 182 RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread(); |
| (...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 { | 1612 { |
| 1624 if (style()->marginBeforeCollapse() == MDISCARD) { | 1613 if (style()->marginBeforeCollapse() == MDISCARD) { |
| 1625 ASSERT(value); | 1614 ASSERT(value); |
| 1626 return; | 1615 return; |
| 1627 } | 1616 } |
| 1628 | 1617 |
| 1629 if (!m_rareData && !value) | 1618 if (!m_rareData && !value) |
| 1630 return; | 1619 return; |
| 1631 | 1620 |
| 1632 if (!m_rareData) | 1621 if (!m_rareData) |
| 1633 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); | 1622 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 1634 | 1623 |
| 1635 m_rareData->m_discardMarginBefore = value; | 1624 m_rareData->m_discardMarginBefore = value; |
| 1636 } | 1625 } |
| 1637 | 1626 |
| 1638 void RenderBlockFlow::setMustDiscardMarginAfter(bool value) | 1627 void RenderBlockFlow::setMustDiscardMarginAfter(bool value) |
| 1639 { | 1628 { |
| 1640 if (style()->marginAfterCollapse() == MDISCARD) { | 1629 if (style()->marginAfterCollapse() == MDISCARD) { |
| 1641 ASSERT(value); | 1630 ASSERT(value); |
| 1642 return; | 1631 return; |
| 1643 } | 1632 } |
| 1644 | 1633 |
| 1645 if (!m_rareData && !value) | 1634 if (!m_rareData && !value) |
| 1646 return; | 1635 return; |
| 1647 | 1636 |
| 1648 if (!m_rareData) | 1637 if (!m_rareData) |
| 1649 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); | 1638 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 1650 | 1639 |
| 1651 m_rareData->m_discardMarginAfter = value; | 1640 m_rareData->m_discardMarginAfter = value; |
| 1652 } | 1641 } |
| 1653 | 1642 |
| 1654 bool RenderBlockFlow::mustDiscardMarginBefore() const | 1643 bool RenderBlockFlow::mustDiscardMarginBefore() const |
| 1655 { | 1644 { |
| 1656 return style()->marginBeforeCollapse() == MDISCARD || (m_rareData && m_rareD
ata->m_discardMarginBefore); | 1645 return style()->marginBeforeCollapse() == MDISCARD || (m_rareData && m_rareD
ata->m_discardMarginBefore); |
| 1657 } | 1646 } |
| 1658 | 1647 |
| 1659 bool RenderBlockFlow::mustDiscardMarginAfter() const | 1648 bool RenderBlockFlow::mustDiscardMarginAfter() const |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1684 | 1673 |
| 1685 // FIXME: See |mustDiscardMarginBeforeForChild| above. | 1674 // FIXME: See |mustDiscardMarginBeforeForChild| above. |
| 1686 return false; | 1675 return false; |
| 1687 } | 1676 } |
| 1688 | 1677 |
| 1689 void RenderBlockFlow::setMaxMarginBeforeValues(LayoutUnit pos, LayoutUnit neg) | 1678 void RenderBlockFlow::setMaxMarginBeforeValues(LayoutUnit pos, LayoutUnit neg) |
| 1690 { | 1679 { |
| 1691 if (!m_rareData) { | 1680 if (!m_rareData) { |
| 1692 if (pos == RenderBlockFlowRareData::positiveMarginBeforeDefault(this) &&
neg == RenderBlockFlowRareData::negativeMarginBeforeDefault(this)) | 1681 if (pos == RenderBlockFlowRareData::positiveMarginBeforeDefault(this) &&
neg == RenderBlockFlowRareData::negativeMarginBeforeDefault(this)) |
| 1693 return; | 1682 return; |
| 1694 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); | 1683 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 1695 } | 1684 } |
| 1696 m_rareData->m_margins.setPositiveMarginBefore(pos); | 1685 m_rareData->m_margins.setPositiveMarginBefore(pos); |
| 1697 m_rareData->m_margins.setNegativeMarginBefore(neg); | 1686 m_rareData->m_margins.setNegativeMarginBefore(neg); |
| 1698 } | 1687 } |
| 1699 | 1688 |
| 1700 void RenderBlockFlow::setMaxMarginAfterValues(LayoutUnit pos, LayoutUnit neg) | 1689 void RenderBlockFlow::setMaxMarginAfterValues(LayoutUnit pos, LayoutUnit neg) |
| 1701 { | 1690 { |
| 1702 if (!m_rareData) { | 1691 if (!m_rareData) { |
| 1703 if (pos == RenderBlockFlowRareData::positiveMarginAfterDefault(this) &&
neg == RenderBlockFlowRareData::negativeMarginAfterDefault(this)) | 1692 if (pos == RenderBlockFlowRareData::positiveMarginAfterDefault(this) &&
neg == RenderBlockFlowRareData::negativeMarginAfterDefault(this)) |
| 1704 return; | 1693 return; |
| 1705 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); | 1694 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 1706 } | 1695 } |
| 1707 m_rareData->m_margins.setPositiveMarginAfter(pos); | 1696 m_rareData->m_margins.setPositiveMarginAfter(pos); |
| 1708 m_rareData->m_margins.setNegativeMarginAfter(neg); | 1697 m_rareData->m_margins.setNegativeMarginAfter(neg); |
| 1709 } | 1698 } |
| 1710 | 1699 |
| 1711 bool RenderBlockFlow::mustSeparateMarginBeforeForChild(const RenderBox& child) c
onst | 1700 bool RenderBlockFlow::mustSeparateMarginBeforeForChild(const RenderBox& child) c
onst |
| 1712 { | 1701 { |
| 1713 ASSERT(!child.selfNeedsLayout()); | 1702 ASSERT(!child.selfNeedsLayout()); |
| 1714 const RenderStyle* childStyle = child.style(); | 1703 const RenderStyle* childStyle = child.style(); |
| 1715 if (!child.isWritingModeRoot()) | 1704 if (!child.isWritingModeRoot()) |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2989 rightGap = (state == RenderObject::SelectionInside) | 2978 rightGap = (state == RenderObject::SelectionInside) |
| 2990 || (state == RenderObject::SelectionStart && ltr) | 2979 || (state == RenderObject::SelectionStart && ltr) |
| 2991 || (state == RenderObject::SelectionEnd && !ltr); | 2980 || (state == RenderObject::SelectionEnd && !ltr); |
| 2992 } | 2981 } |
| 2993 | 2982 |
| 2994 void RenderBlockFlow::setPaginationStrut(LayoutUnit strut) | 2983 void RenderBlockFlow::setPaginationStrut(LayoutUnit strut) |
| 2995 { | 2984 { |
| 2996 if (!m_rareData) { | 2985 if (!m_rareData) { |
| 2997 if (!strut) | 2986 if (!strut) |
| 2998 return; | 2987 return; |
| 2999 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); | 2988 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 3000 } | 2989 } |
| 3001 m_rareData->m_paginationStrut = strut; | 2990 m_rareData->m_paginationStrut = strut; |
| 3002 } | 2991 } |
| 3003 | 2992 |
| 3004 void RenderBlockFlow::positionSpannerDescendant(RenderMultiColumnSpannerPlacehol
der& child) | 2993 void RenderBlockFlow::positionSpannerDescendant(RenderMultiColumnSpannerPlacehol
der& child) |
| 3005 { | 2994 { |
| 3006 RenderBox& spanner = *child.rendererInFlowThread(); | 2995 RenderBox& spanner = *child.rendererInFlowThread(); |
| 3007 // FIXME: |spanner| is a descendant, but never a direct child, so the names
here are bad, if | 2996 // FIXME: |spanner| is a descendant, but never a direct child, so the names
here are bad, if |
| 3008 // nothing else. | 2997 // nothing else. |
| 3009 setLogicalTopForChild(spanner, child.logicalTop()); | 2998 setLogicalTopForChild(spanner, child.logicalTop()); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3116 RenderBlockFlowRareData& rareData = ensureRareData(); | 3105 RenderBlockFlowRareData& rareData = ensureRareData(); |
| 3117 ASSERT(!rareData.m_multiColumnFlowThread); | 3106 ASSERT(!rareData.m_multiColumnFlowThread); |
| 3118 rareData.m_multiColumnFlowThread = flowThread; | 3107 rareData.m_multiColumnFlowThread = flowThread; |
| 3119 } | 3108 } |
| 3120 | 3109 |
| 3121 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 3110 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 3122 { | 3111 { |
| 3123 if (m_rareData) | 3112 if (m_rareData) |
| 3124 return *m_rareData; | 3113 return *m_rareData; |
| 3125 | 3114 |
| 3126 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); | 3115 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 3127 return *m_rareData; | 3116 return *m_rareData; |
| 3128 } | 3117 } |
| 3129 | 3118 |
| 3130 void RenderBlockFlow::positionDialog() | 3119 void RenderBlockFlow::positionDialog() |
| 3131 { | 3120 { |
| 3132 HTMLDialogElement* dialog = toHTMLDialogElement(node()); | 3121 HTMLDialogElement* dialog = toHTMLDialogElement(node()); |
| 3133 if (dialog->centeringMode() == HTMLDialogElement::NotCentered) | 3122 if (dialog->centeringMode() == HTMLDialogElement::NotCentered) |
| 3134 return; | 3123 return; |
| 3135 | 3124 |
| 3136 bool canCenterDialog = (style()->position() == AbsolutePosition || style()->
position() == FixedPosition) | 3125 bool canCenterDialog = (style()->position() == AbsolutePosition || style()->
position() == FixedPosition) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3151 FrameView* frameView = document().view(); | 3140 FrameView* frameView = document().view(); |
| 3152 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 3141 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
| 3153 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 3142 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
| 3154 if (size().height() < visibleHeight) | 3143 if (size().height() < visibleHeight) |
| 3155 top += (visibleHeight - size().height()) / 2; | 3144 top += (visibleHeight - size().height()) / 2; |
| 3156 setY(top); | 3145 setY(top); |
| 3157 dialog->setCentered(top); | 3146 dialog->setCentered(top); |
| 3158 } | 3147 } |
| 3159 | 3148 |
| 3160 } // namespace blink | 3149 } // namespace blink |
| OLD | NEW |