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

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

Issue 1577433003: Statistics of LayoutBox rare data reasons Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 3 years, 9 months 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) 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. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 static_assert(sizeof(LayoutBox) == sizeof(SameSizeAsLayoutBox), 95 static_assert(sizeof(LayoutBox) == sizeof(SameSizeAsLayoutBox),
96 "LayoutBox should stay small"); 96 "LayoutBox should stay small");
97 97
98 LayoutBox::LayoutBox(ContainerNode* node) 98 LayoutBox::LayoutBox(ContainerNode* node)
99 : LayoutBoxModelObject(node), 99 : LayoutBoxModelObject(node),
100 m_intrinsicContentLogicalHeight(-1), 100 m_intrinsicContentLogicalHeight(-1),
101 m_minPreferredLogicalWidth(-1), 101 m_minPreferredLogicalWidth(-1),
102 m_maxPreferredLogicalWidth(-1), 102 m_maxPreferredLogicalWidth(-1),
103 m_inlineBoxWrapper(nullptr) { 103 m_inlineBoxWrapper(nullptr) {
104 setIsBox(); 104 setIsBox();
105 m_rareStat.addReason(ReasonLBAll);
105 } 106 }
106 107
107 PaintLayerType LayoutBox::layerTypeRequired() const { 108 PaintLayerType LayoutBox::layerTypeRequired() const {
108 // hasAutoZIndex only returns true if the element is positioned or a flex-item 109 // hasAutoZIndex only returns true if the element is positioned or a flex-item
109 // since position:static elements that are not flex-items get their z-index 110 // since position:static elements that are not flex-items get their z-index
110 // coerced to auto. 111 // coerced to auto.
111 if (isPositioned() || createsGroup() || hasClipPath() || 112 if (isPositioned() || createsGroup() || hasClipPath() ||
112 hasTransformRelatedProperty() || style()->hasCompositorProxy() || 113 hasTransformRelatedProperty() || style()->hasCompositorProxy() ||
113 hasHiddenBackface() || hasReflection() || style()->specifiesColumns() || 114 hasHiddenBackface() || hasReflection() || style()->specifiesColumns() ||
114 style()->isStackingContext() || 115 style()->isStackingContext() ||
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 return m_rareData && m_rareData->m_overrideLogicalContentHeight != -1; 1229 return m_rareData && m_rareData->m_overrideLogicalContentHeight != -1;
1229 } 1230 }
1230 1231
1231 bool LayoutBox::hasOverrideLogicalContentWidth() const { 1232 bool LayoutBox::hasOverrideLogicalContentWidth() const {
1232 return m_rareData && m_rareData->m_overrideLogicalContentWidth != -1; 1233 return m_rareData && m_rareData->m_overrideLogicalContentWidth != -1;
1233 } 1234 }
1234 1235
1235 void LayoutBox::setOverrideLogicalContentHeight(LayoutUnit height) { 1236 void LayoutBox::setOverrideLogicalContentHeight(LayoutUnit height) {
1236 ASSERT(height >= 0); 1237 ASSERT(height >= 0);
1237 ensureRareData().m_overrideLogicalContentHeight = height; 1238 ensureRareData().m_overrideLogicalContentHeight = height;
1239 m_rareStat.addReason(ReasonLBOverrideSize);
1238 } 1240 }
1239 1241
1240 void LayoutBox::setOverrideLogicalContentWidth(LayoutUnit width) { 1242 void LayoutBox::setOverrideLogicalContentWidth(LayoutUnit width) {
1241 ASSERT(width >= 0); 1243 ASSERT(width >= 0);
1242 ensureRareData().m_overrideLogicalContentWidth = width; 1244 ensureRareData().m_overrideLogicalContentWidth = width;
1245 m_rareStat.addReason(ReasonLBOverrideSize);
1243 } 1246 }
1244 1247
1245 void LayoutBox::clearOverrideLogicalContentHeight() { 1248 void LayoutBox::clearOverrideLogicalContentHeight() {
1246 if (m_rareData) 1249 if (m_rareData)
1247 m_rareData->m_overrideLogicalContentHeight = LayoutUnit(-1); 1250 m_rareData->m_overrideLogicalContentHeight = LayoutUnit(-1);
1248 } 1251 }
1249 1252
1250 void LayoutBox::clearOverrideLogicalContentWidth() { 1253 void LayoutBox::clearOverrideLogicalContentWidth() {
1251 if (m_rareData) 1254 if (m_rareData)
1252 m_rareData->m_overrideLogicalContentWidth = LayoutUnit(-1); 1255 m_rareData->m_overrideLogicalContentWidth = LayoutUnit(-1);
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 m_inlineBoxWrapper->destroy(); 2101 m_inlineBoxWrapper->destroy();
2099 m_inlineBoxWrapper = nullptr; 2102 m_inlineBoxWrapper = nullptr;
2100 } 2103 }
2101 } 2104 }
2102 2105
2103 void LayoutBox::setSpannerPlaceholder( 2106 void LayoutBox::setSpannerPlaceholder(
2104 LayoutMultiColumnSpannerPlaceholder& placeholder) { 2107 LayoutMultiColumnSpannerPlaceholder& placeholder) {
2105 // Not expected to change directly from one spanner to another. 2108 // Not expected to change directly from one spanner to another.
2106 CHECK(!m_rareData || !m_rareData->m_spannerPlaceholder); 2109 CHECK(!m_rareData || !m_rareData->m_spannerPlaceholder);
2107 ensureRareData().m_spannerPlaceholder = &placeholder; 2110 ensureRareData().m_spannerPlaceholder = &placeholder;
2111 m_rareStat.addReason(ReasonLBSpannerPlaceholder);
2108 } 2112 }
2109 2113
2110 void LayoutBox::clearSpannerPlaceholder() { 2114 void LayoutBox::clearSpannerPlaceholder() {
2111 if (!m_rareData) 2115 if (!m_rareData)
2112 return; 2116 return;
2113 m_rareData->m_spannerPlaceholder = nullptr; 2117 m_rareData->m_spannerPlaceholder = nullptr;
2114 } 2118 }
2115 2119
2116 void LayoutBox::setPaginationStrut(LayoutUnit strut) { 2120 void LayoutBox::setPaginationStrut(LayoutUnit strut) {
2117 if (!strut && !m_rareData) 2121 if (!strut && !m_rareData)
2118 return; 2122 return;
2119 ensureRareData().m_paginationStrut = strut; 2123 ensureRareData().m_paginationStrut = strut;
2124 if (strut)
2125 m_rareStat.addReason(ReasonLBPaginationStrut);
2120 } 2126 }
2121 2127
2122 bool LayoutBox::isBreakBetweenControllable(EBreakBetween breakValue) const { 2128 bool LayoutBox::isBreakBetweenControllable(EBreakBetween breakValue) const {
2123 if (breakValue == EBreakBetween::kAuto) 2129 if (breakValue == EBreakBetween::kAuto)
2124 return true; 2130 return true;
2125 // We currently only support non-auto break-before and break-after values on 2131 // We currently only support non-auto break-before and break-after values on
2126 // in-flow block level elements, which is the minimum requirement according to 2132 // in-flow block level elements, which is the minimum requirement according to
2127 // the spec. 2133 // the spec.
2128 if (isInline() || isFloatingOrOutOfFlowPositioned()) 2134 if (isInline() || isFloatingOrOutOfFlowPositioned())
2129 return false; 2135 return false;
(...skipping 3285 matching lines...) Expand 10 before | Expand all | Expand 10 after
5415 // block. 5421 // block.
5416 LayoutBlock* containerBlock = containingBlock(); 5422 LayoutBlock* containerBlock = containingBlock();
5417 ASSERT(layoutState->layoutObject() == containerBlock); 5423 ASSERT(layoutState->layoutObject() == containerBlock);
5418 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 5424 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
5419 } 5425 }
5420 5426
5421 void LayoutBox::setOffsetToNextPage(LayoutUnit offset) { 5427 void LayoutBox::setOffsetToNextPage(LayoutUnit offset) {
5422 if (!m_rareData && !offset) 5428 if (!m_rareData && !offset)
5423 return; 5429 return;
5424 ensureRareData().m_offsetToNextPage = offset; 5430 ensureRareData().m_offsetToNextPage = offset;
5431 if (offset)
5432 m_rareStat.addReason(ReasonLBPageOffset);
5425 } 5433 }
5426 5434
5427 void LayoutBox::logicalExtentAfterUpdatingLogicalWidth( 5435 void LayoutBox::logicalExtentAfterUpdatingLogicalWidth(
5428 const LayoutUnit& newLogicalTop, 5436 const LayoutUnit& newLogicalTop,
5429 LayoutBox::LogicalExtentComputedValues& computedValues) { 5437 LayoutBox::LogicalExtentComputedValues& computedValues) {
5430 // FIXME: None of this is right for perpendicular writing-mode children. 5438 // FIXME: None of this is right for perpendicular writing-mode children.
5431 LayoutUnit oldLogicalWidth = logicalWidth(); 5439 LayoutUnit oldLogicalWidth = logicalWidth();
5432 LayoutUnit oldLogicalLeft = logicalLeft(); 5440 LayoutUnit oldLogicalLeft = logicalLeft();
5433 LayoutUnit oldMarginLeft = marginLeft(); 5441 LayoutUnit oldMarginLeft = marginLeft();
5434 LayoutUnit oldMarginRight = marginRight(); 5442 LayoutUnit oldMarginRight = marginRight();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
5584 LayoutBoxModelObject::clearPreviousVisualRects(); 5592 LayoutBoxModelObject::clearPreviousVisualRects();
5585 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) 5593 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea())
5586 scrollableArea->clearPreviousVisualRects(); 5594 scrollableArea->clearPreviousVisualRects();
5587 } 5595 }
5588 5596
5589 void LayoutBox::setPercentHeightContainer(LayoutBlock* container) { 5597 void LayoutBox::setPercentHeightContainer(LayoutBlock* container) {
5590 ASSERT(!container || !percentHeightContainer()); 5598 ASSERT(!container || !percentHeightContainer());
5591 if (!container && !m_rareData) 5599 if (!container && !m_rareData)
5592 return; 5600 return;
5593 ensureRareData().m_percentHeightContainer = container; 5601 ensureRareData().m_percentHeightContainer = container;
5602 if (container)
5603 m_rareStat.addReason(ReasonLBPercentHeightContainer);
5594 } 5604 }
5595 5605
5596 void LayoutBox::removeFromPercentHeightContainer() { 5606 void LayoutBox::removeFromPercentHeightContainer() {
5597 if (!percentHeightContainer()) 5607 if (!percentHeightContainer())
5598 return; 5608 return;
5599 5609
5600 ASSERT(percentHeightContainer()->hasPercentHeightDescendant(this)); 5610 ASSERT(percentHeightContainer()->hasPercentHeightDescendant(this));
5601 percentHeightContainer()->removePercentHeightDescendant(this); 5611 percentHeightContainer()->removePercentHeightDescendant(this);
5602 // The above call should call this object's 5612 // The above call should call this object's
5603 // setPercentHeightContainer(nullptr). 5613 // setPercentHeightContainer(nullptr).
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
5753 5763
5754 void LayoutBox::MutableForPainting:: 5764 void LayoutBox::MutableForPainting::
5755 savePreviousContentBoxSizeAndLayoutOverflowRect() { 5765 savePreviousContentBoxSizeAndLayoutOverflowRect() {
5756 auto& rareData = layoutBox().ensureRareData(); 5766 auto& rareData = layoutBox().ensureRareData();
5757 rareData.m_hasPreviousContentBoxSizeAndLayoutOverflowRect = true; 5767 rareData.m_hasPreviousContentBoxSizeAndLayoutOverflowRect = true;
5758 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size(); 5768 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size();
5759 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect(); 5769 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect();
5760 } 5770 }
5761 5771
5762 } // namespace blink 5772 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutInline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698