Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 void LayoutBlockFlow::setMustDiscardMarginBefore(bool value) { 2177 void LayoutBlockFlow::setMustDiscardMarginBefore(bool value) {
2178 if (style()->marginBeforeCollapse() == MarginCollapseDiscard) { 2178 if (style()->marginBeforeCollapse() == MarginCollapseDiscard) {
2179 ASSERT(value); 2179 ASSERT(value);
2180 return; 2180 return;
2181 } 2181 }
2182 2182
2183 if (!m_rareData && !value) 2183 if (!m_rareData && !value)
2184 return; 2184 return;
2185 2185
2186 if (!m_rareData) 2186 if (!m_rareData)
2187 m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); 2187 m_rareData = makeUnique<LayoutBlockFlowRareData>(this);
2188 2188
2189 m_rareData->m_discardMarginBefore = value; 2189 m_rareData->m_discardMarginBefore = value;
2190 } 2190 }
2191 2191
2192 void LayoutBlockFlow::setMustDiscardMarginAfter(bool value) { 2192 void LayoutBlockFlow::setMustDiscardMarginAfter(bool value) {
2193 if (style()->marginAfterCollapse() == MarginCollapseDiscard) { 2193 if (style()->marginAfterCollapse() == MarginCollapseDiscard) {
2194 ASSERT(value); 2194 ASSERT(value);
2195 return; 2195 return;
2196 } 2196 }
2197 2197
2198 if (!m_rareData && !value) 2198 if (!m_rareData && !value)
2199 return; 2199 return;
2200 2200
2201 if (!m_rareData) 2201 if (!m_rareData)
2202 m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); 2202 m_rareData = makeUnique<LayoutBlockFlowRareData>(this);
2203 2203
2204 m_rareData->m_discardMarginAfter = value; 2204 m_rareData->m_discardMarginAfter = value;
2205 } 2205 }
2206 2206
2207 bool LayoutBlockFlow::mustDiscardMarginBefore() const { 2207 bool LayoutBlockFlow::mustDiscardMarginBefore() const {
2208 return style()->marginBeforeCollapse() == MarginCollapseDiscard || 2208 return style()->marginBeforeCollapse() == MarginCollapseDiscard ||
2209 (m_rareData && m_rareData->m_discardMarginBefore); 2209 (m_rareData && m_rareData->m_discardMarginBefore);
2210 } 2210 }
2211 2211
2212 bool LayoutBlockFlow::mustDiscardMarginAfter() const { 2212 bool LayoutBlockFlow::mustDiscardMarginAfter() const {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 2251
2252 // FIXME: See |mustDiscardMarginBeforeForChild| above. 2252 // FIXME: See |mustDiscardMarginBeforeForChild| above.
2253 return false; 2253 return false;
2254 } 2254 }
2255 2255
2256 void LayoutBlockFlow::setMaxMarginBeforeValues(LayoutUnit pos, LayoutUnit neg) { 2256 void LayoutBlockFlow::setMaxMarginBeforeValues(LayoutUnit pos, LayoutUnit neg) {
2257 if (!m_rareData) { 2257 if (!m_rareData) {
2258 if (pos == LayoutBlockFlowRareData::positiveMarginBeforeDefault(this) && 2258 if (pos == LayoutBlockFlowRareData::positiveMarginBeforeDefault(this) &&
2259 neg == LayoutBlockFlowRareData::negativeMarginBeforeDefault(this)) 2259 neg == LayoutBlockFlowRareData::negativeMarginBeforeDefault(this))
2260 return; 2260 return;
2261 m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); 2261 m_rareData = makeUnique<LayoutBlockFlowRareData>(this);
2262 } 2262 }
2263 m_rareData->m_margins.setPositiveMarginBefore(pos); 2263 m_rareData->m_margins.setPositiveMarginBefore(pos);
2264 m_rareData->m_margins.setNegativeMarginBefore(neg); 2264 m_rareData->m_margins.setNegativeMarginBefore(neg);
2265 } 2265 }
2266 2266
2267 void LayoutBlockFlow::setMaxMarginAfterValues(LayoutUnit pos, LayoutUnit neg) { 2267 void LayoutBlockFlow::setMaxMarginAfterValues(LayoutUnit pos, LayoutUnit neg) {
2268 if (!m_rareData) { 2268 if (!m_rareData) {
2269 if (pos == LayoutBlockFlowRareData::positiveMarginAfterDefault(this) && 2269 if (pos == LayoutBlockFlowRareData::positiveMarginAfterDefault(this) &&
2270 neg == LayoutBlockFlowRareData::negativeMarginAfterDefault(this)) 2270 neg == LayoutBlockFlowRareData::negativeMarginAfterDefault(this))
2271 return; 2271 return;
2272 m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); 2272 m_rareData = makeUnique<LayoutBlockFlowRareData>(this);
2273 } 2273 }
2274 m_rareData->m_margins.setPositiveMarginAfter(pos); 2274 m_rareData->m_margins.setPositiveMarginAfter(pos);
2275 m_rareData->m_margins.setNegativeMarginAfter(neg); 2275 m_rareData->m_margins.setNegativeMarginAfter(neg);
2276 } 2276 }
2277 2277
2278 bool LayoutBlockFlow::mustSeparateMarginBeforeForChild( 2278 bool LayoutBlockFlow::mustSeparateMarginBeforeForChild(
2279 const LayoutBox& child) const { 2279 const LayoutBox& child) const {
2280 ASSERT(!child.selfNeedsLayout()); 2280 ASSERT(!child.selfNeedsLayout());
2281 const ComputedStyle& childStyle = child.styleRef(); 2281 const ComputedStyle& childStyle = child.styleRef();
2282 if (!child.isWritingModeRoot()) 2282 if (!child.isWritingModeRoot())
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
4105 // This is a first in-flow child. We'll still allow the strut if it can be 4105 // This is a first in-flow child. We'll still allow the strut if it can be
4106 // re-propagated to our containing block. 4106 // re-propagated to our containing block.
4107 return containingBlockFlow->allowsPaginationStrut(); 4107 return containingBlockFlow->allowsPaginationStrut();
4108 } 4108 }
4109 4109
4110 void LayoutBlockFlow::setPaginationStrutPropagatedFromChild(LayoutUnit strut) { 4110 void LayoutBlockFlow::setPaginationStrutPropagatedFromChild(LayoutUnit strut) {
4111 strut = std::max(strut, LayoutUnit()); 4111 strut = std::max(strut, LayoutUnit());
4112 if (!m_rareData) { 4112 if (!m_rareData) {
4113 if (!strut) 4113 if (!strut)
4114 return; 4114 return;
4115 m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); 4115 m_rareData = makeUnique<LayoutBlockFlowRareData>(this);
4116 } 4116 }
4117 m_rareData->m_paginationStrutPropagatedFromChild = strut; 4117 m_rareData->m_paginationStrutPropagatedFromChild = strut;
4118 } 4118 }
4119 4119
4120 void LayoutBlockFlow::setFirstForcedBreakOffset(LayoutUnit blockOffset) { 4120 void LayoutBlockFlow::setFirstForcedBreakOffset(LayoutUnit blockOffset) {
4121 if (!m_rareData) { 4121 if (!m_rareData) {
4122 if (!blockOffset) 4122 if (!blockOffset)
4123 return; 4123 return;
4124 m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); 4124 m_rareData = makeUnique<LayoutBlockFlowRareData>(this);
4125 } 4125 }
4126 m_rareData->m_firstForcedBreakOffset = blockOffset; 4126 m_rareData->m_firstForcedBreakOffset = blockOffset;
4127 } 4127 }
4128 4128
4129 void LayoutBlockFlow::positionSpannerDescendant( 4129 void LayoutBlockFlow::positionSpannerDescendant(
4130 LayoutMultiColumnSpannerPlaceholder& child) { 4130 LayoutMultiColumnSpannerPlaceholder& child) {
4131 LayoutBox& spanner = *child.layoutObjectInFlowThread(); 4131 LayoutBox& spanner = *child.layoutObjectInFlowThread();
4132 // FIXME: |spanner| is a descendant, but never a direct child, so the names 4132 // FIXME: |spanner| is a descendant, but never a direct child, so the names
4133 // here are bad, if nothing else. 4133 // here are bad, if nothing else.
4134 setLogicalTopForChild(spanner, child.logicalTop()); 4134 setLogicalTopForChild(spanner, child.logicalTop());
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = wrapUnique(new LayoutBlockFlowRareData(this)); 4276 m_rareData = 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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698