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 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2196 void LayoutBlockFlow::setMustDiscardMarginBefore(bool value) { | 2196 void LayoutBlockFlow::setMustDiscardMarginBefore(bool value) { |
2197 if (style()->marginBeforeCollapse() == MarginCollapseDiscard) { | 2197 if (style()->marginBeforeCollapse() == MarginCollapseDiscard) { |
2198 ASSERT(value); | 2198 ASSERT(value); |
2199 return; | 2199 return; |
2200 } | 2200 } |
2201 | 2201 |
2202 if (!m_rareData && !value) | 2202 if (!m_rareData && !value) |
2203 return; | 2203 return; |
2204 | 2204 |
2205 if (!m_rareData) | 2205 if (!m_rareData) |
2206 m_rareData = makeUnique<LayoutBlockFlowRareData>(this); | 2206 m_rareData = WTF::makeUnique<LayoutBlockFlowRareData>(this); |
2207 | 2207 |
2208 m_rareData->m_discardMarginBefore = value; | 2208 m_rareData->m_discardMarginBefore = value; |
2209 } | 2209 } |
2210 | 2210 |
2211 void LayoutBlockFlow::setMustDiscardMarginAfter(bool value) { | 2211 void LayoutBlockFlow::setMustDiscardMarginAfter(bool value) { |
2212 if (style()->marginAfterCollapse() == MarginCollapseDiscard) { | 2212 if (style()->marginAfterCollapse() == MarginCollapseDiscard) { |
2213 ASSERT(value); | 2213 ASSERT(value); |
2214 return; | 2214 return; |
2215 } | 2215 } |
2216 | 2216 |
2217 if (!m_rareData && !value) | 2217 if (!m_rareData && !value) |
2218 return; | 2218 return; |
2219 | 2219 |
2220 if (!m_rareData) | 2220 if (!m_rareData) |
2221 m_rareData = makeUnique<LayoutBlockFlowRareData>(this); | 2221 m_rareData = WTF::makeUnique<LayoutBlockFlowRareData>(this); |
2222 | 2222 |
2223 m_rareData->m_discardMarginAfter = value; | 2223 m_rareData->m_discardMarginAfter = value; |
2224 } | 2224 } |
2225 | 2225 |
2226 bool LayoutBlockFlow::mustDiscardMarginBefore() const { | 2226 bool LayoutBlockFlow::mustDiscardMarginBefore() const { |
2227 return style()->marginBeforeCollapse() == MarginCollapseDiscard || | 2227 return style()->marginBeforeCollapse() == MarginCollapseDiscard || |
2228 (m_rareData && m_rareData->m_discardMarginBefore); | 2228 (m_rareData && m_rareData->m_discardMarginBefore); |
2229 } | 2229 } |
2230 | 2230 |
2231 bool LayoutBlockFlow::mustDiscardMarginAfter() const { | 2231 bool LayoutBlockFlow::mustDiscardMarginAfter() const { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 | 2270 |
2271 // FIXME: See |mustDiscardMarginBeforeForChild| above. | 2271 // FIXME: See |mustDiscardMarginBeforeForChild| above. |
2272 return false; | 2272 return false; |
2273 } | 2273 } |
2274 | 2274 |
2275 void LayoutBlockFlow::setMaxMarginBeforeValues(LayoutUnit pos, LayoutUnit neg) { | 2275 void LayoutBlockFlow::setMaxMarginBeforeValues(LayoutUnit pos, LayoutUnit neg) { |
2276 if (!m_rareData) { | 2276 if (!m_rareData) { |
2277 if (pos == LayoutBlockFlowRareData::positiveMarginBeforeDefault(this) && | 2277 if (pos == LayoutBlockFlowRareData::positiveMarginBeforeDefault(this) && |
2278 neg == LayoutBlockFlowRareData::negativeMarginBeforeDefault(this)) | 2278 neg == LayoutBlockFlowRareData::negativeMarginBeforeDefault(this)) |
2279 return; | 2279 return; |
2280 m_rareData = makeUnique<LayoutBlockFlowRareData>(this); | 2280 m_rareData = WTF::makeUnique<LayoutBlockFlowRareData>(this); |
2281 } | 2281 } |
2282 m_rareData->m_margins.setPositiveMarginBefore(pos); | 2282 m_rareData->m_margins.setPositiveMarginBefore(pos); |
2283 m_rareData->m_margins.setNegativeMarginBefore(neg); | 2283 m_rareData->m_margins.setNegativeMarginBefore(neg); |
2284 } | 2284 } |
2285 | 2285 |
2286 void LayoutBlockFlow::setMaxMarginAfterValues(LayoutUnit pos, LayoutUnit neg) { | 2286 void LayoutBlockFlow::setMaxMarginAfterValues(LayoutUnit pos, LayoutUnit neg) { |
2287 if (!m_rareData) { | 2287 if (!m_rareData) { |
2288 if (pos == LayoutBlockFlowRareData::positiveMarginAfterDefault(this) && | 2288 if (pos == LayoutBlockFlowRareData::positiveMarginAfterDefault(this) && |
2289 neg == LayoutBlockFlowRareData::negativeMarginAfterDefault(this)) | 2289 neg == LayoutBlockFlowRareData::negativeMarginAfterDefault(this)) |
2290 return; | 2290 return; |
2291 m_rareData = makeUnique<LayoutBlockFlowRareData>(this); | 2291 m_rareData = WTF::makeUnique<LayoutBlockFlowRareData>(this); |
2292 } | 2292 } |
2293 m_rareData->m_margins.setPositiveMarginAfter(pos); | 2293 m_rareData->m_margins.setPositiveMarginAfter(pos); |
2294 m_rareData->m_margins.setNegativeMarginAfter(neg); | 2294 m_rareData->m_margins.setNegativeMarginAfter(neg); |
2295 } | 2295 } |
2296 | 2296 |
2297 bool LayoutBlockFlow::mustSeparateMarginBeforeForChild( | 2297 bool LayoutBlockFlow::mustSeparateMarginBeforeForChild( |
2298 const LayoutBox& child) const { | 2298 const LayoutBox& child) const { |
2299 ASSERT(!child.selfNeedsLayout()); | 2299 ASSERT(!child.selfNeedsLayout()); |
2300 const ComputedStyle& childStyle = child.styleRef(); | 2300 const ComputedStyle& childStyle = child.styleRef(); |
2301 if (!child.isWritingModeRoot()) | 2301 if (!child.isWritingModeRoot()) |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2714 if (newLogicalTop < logicalTop) | 2714 if (newLogicalTop < logicalTop) |
2715 break; | 2715 break; |
2716 } | 2716 } |
2717 ASSERT_NOT_REACHED(); | 2717 ASSERT_NOT_REACHED(); |
2718 } | 2718 } |
2719 return result; | 2719 return result; |
2720 } | 2720 } |
2721 | 2721 |
2722 void LayoutBlockFlow::createFloatingObjects() { | 2722 void LayoutBlockFlow::createFloatingObjects() { |
2723 m_floatingObjects = | 2723 m_floatingObjects = |
2724 wrapUnique(new FloatingObjects(this, isHorizontalWritingMode())); | 2724 WTF::wrapUnique(new FloatingObjects(this, isHorizontalWritingMode())); |
2725 } | 2725 } |
2726 | 2726 |
2727 void LayoutBlockFlow::willBeDestroyed() { | 2727 void LayoutBlockFlow::willBeDestroyed() { |
2728 // Mark as being destroyed to avoid trouble with merges in removeChild(). | 2728 // Mark as being destroyed to avoid trouble with merges in removeChild(). |
2729 m_beingDestroyed = true; | 2729 m_beingDestroyed = true; |
2730 | 2730 |
2731 // Make sure to destroy anonymous children first while they are still | 2731 // Make sure to destroy anonymous children first while they are still |
2732 // connected to the rest of the tree, so that they will properly dirty line | 2732 // connected to the rest of the tree, so that they will properly dirty line |
2733 // boxes that they are removed from. Effects that do :before/:after only on | 2733 // boxes that they are removed from. Effects that do :before/:after only on |
2734 // hover could crash otherwise. | 2734 // hover could crash otherwise. |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4096 // This is a first in-flow child. We'll still allow the strut if it can be | 4096 // This is a first in-flow child. We'll still allow the strut if it can be |
4097 // re-propagated to our containing block. | 4097 // re-propagated to our containing block. |
4098 return containingBlockFlow->allowsPaginationStrut(); | 4098 return containingBlockFlow->allowsPaginationStrut(); |
4099 } | 4099 } |
4100 | 4100 |
4101 void LayoutBlockFlow::setPaginationStrutPropagatedFromChild(LayoutUnit strut) { | 4101 void LayoutBlockFlow::setPaginationStrutPropagatedFromChild(LayoutUnit strut) { |
4102 strut = std::max(strut, LayoutUnit()); | 4102 strut = std::max(strut, LayoutUnit()); |
4103 if (!m_rareData) { | 4103 if (!m_rareData) { |
4104 if (!strut) | 4104 if (!strut) |
4105 return; | 4105 return; |
4106 m_rareData = makeUnique<LayoutBlockFlowRareData>(this); | 4106 m_rareData = WTF::makeUnique<LayoutBlockFlowRareData>(this); |
4107 } | 4107 } |
4108 m_rareData->m_paginationStrutPropagatedFromChild = strut; | 4108 m_rareData->m_paginationStrutPropagatedFromChild = strut; |
4109 } | 4109 } |
4110 | 4110 |
4111 void LayoutBlockFlow::setFirstForcedBreakOffset(LayoutUnit blockOffset) { | 4111 void LayoutBlockFlow::setFirstForcedBreakOffset(LayoutUnit blockOffset) { |
4112 if (!m_rareData) { | 4112 if (!m_rareData) { |
4113 if (!blockOffset) | 4113 if (!blockOffset) |
4114 return; | 4114 return; |
4115 m_rareData = makeUnique<LayoutBlockFlowRareData>(this); | 4115 m_rareData = WTF::makeUnique<LayoutBlockFlowRareData>(this); |
4116 } | 4116 } |
4117 m_rareData->m_firstForcedBreakOffset = blockOffset; | 4117 m_rareData->m_firstForcedBreakOffset = blockOffset; |
4118 } | 4118 } |
4119 | 4119 |
4120 void LayoutBlockFlow::positionSpannerDescendant( | 4120 void LayoutBlockFlow::positionSpannerDescendant( |
4121 LayoutMultiColumnSpannerPlaceholder& child) { | 4121 LayoutMultiColumnSpannerPlaceholder& child) { |
4122 LayoutBox& spanner = *child.layoutObjectInFlowThread(); | 4122 LayoutBox& spanner = *child.layoutObjectInFlowThread(); |
4123 // FIXME: |spanner| is a descendant, but never a direct child, so the names | 4123 // FIXME: |spanner| is a descendant, but never a direct child, so the names |
4124 // here are bad, if nothing else. | 4124 // here are bad, if nothing else. |
4125 setLogicalTopForChild(spanner, child.logicalTop()); | 4125 setLogicalTopForChild(spanner, child.logicalTop()); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4266 flowThread->populate(); | 4266 flowThread->populate(); |
4267 LayoutBlockFlowRareData& rareData = ensureRareData(); | 4267 LayoutBlockFlowRareData& rareData = ensureRareData(); |
4268 ASSERT(!rareData.m_multiColumnFlowThread); | 4268 ASSERT(!rareData.m_multiColumnFlowThread); |
4269 rareData.m_multiColumnFlowThread = flowThread; | 4269 rareData.m_multiColumnFlowThread = flowThread; |
4270 } | 4270 } |
4271 | 4271 |
4272 LayoutBlockFlow::LayoutBlockFlowRareData& LayoutBlockFlow::ensureRareData() { | 4272 LayoutBlockFlow::LayoutBlockFlowRareData& LayoutBlockFlow::ensureRareData() { |
4273 if (m_rareData) | 4273 if (m_rareData) |
4274 return *m_rareData; | 4274 return *m_rareData; |
4275 | 4275 |
4276 m_rareData = makeUnique<LayoutBlockFlowRareData>(this); | 4276 m_rareData = WTF::makeUnique<LayoutBlockFlowRareData>(this); |
4277 return *m_rareData; | 4277 return *m_rareData; |
4278 } | 4278 } |
4279 | 4279 |
4280 void LayoutBlockFlow::positionDialog() { | 4280 void LayoutBlockFlow::positionDialog() { |
4281 HTMLDialogElement* dialog = toHTMLDialogElement(node()); | 4281 HTMLDialogElement* dialog = toHTMLDialogElement(node()); |
4282 if (dialog->getCenteringMode() == HTMLDialogElement::NotCentered) | 4282 if (dialog->getCenteringMode() == HTMLDialogElement::NotCentered) |
4283 return; | 4283 return; |
4284 | 4284 |
4285 bool canCenterDialog = (style()->position() == AbsolutePosition || | 4285 bool canCenterDialog = (style()->position() == AbsolutePosition || |
4286 style()->position() == FixedPosition) && | 4286 style()->position() == FixedPosition) && |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4570 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); | 4570 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
4571 } | 4571 } |
4572 | 4572 |
4573 void LayoutBlockFlow::invalidateDisplayItemClients( | 4573 void LayoutBlockFlow::invalidateDisplayItemClients( |
4574 PaintInvalidationReason invalidationReason) const { | 4574 PaintInvalidationReason invalidationReason) const { |
4575 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( | 4575 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( |
4576 invalidationReason); | 4576 invalidationReason); |
4577 } | 4577 } |
4578 | 4578 |
4579 } // namespace blink | 4579 } // namespace blink |
OLD | NEW |