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

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

Issue 2332053002: Add DISABLE_CFI_PERF attribute on the methods with CFI checks disabled. (Closed)
Patch Set: LayoutObject, LayoutObjectChildList Created 4 years, 3 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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 bool LayoutGrid::updateOverrideContainingBlockContentSizeForChild(LayoutBox& chi ld, GridTrackSizingDirection direction, GridSizingData& sizingData) const 994 bool LayoutGrid::updateOverrideContainingBlockContentSizeForChild(LayoutBox& chi ld, GridTrackSizingDirection direction, GridSizingData& sizingData) const
995 { 995 {
996 LayoutUnit overrideSize = gridAreaBreadthForChild(child, direction, sizingDa ta); 996 LayoutUnit overrideSize = gridAreaBreadthForChild(child, direction, sizingDa ta);
997 if (hasOverrideContainingBlockContentSizeForChild(child, direction) && overr ideContainingBlockContentSizeForChild(child, direction) == overrideSize) 997 if (hasOverrideContainingBlockContentSizeForChild(child, direction) && overr ideContainingBlockContentSizeForChild(child, direction) == overrideSize)
998 return false; 998 return false;
999 999
1000 setOverrideContainingBlockContentSizeForChild(child, direction, overrideSize ); 1000 setOverrideContainingBlockContentSizeForChild(child, direction, overrideSize );
1001 return true; 1001 return true;
1002 } 1002 }
1003 1003
1004 DISABLE_CFI_PERF
1004 LayoutUnit LayoutGrid::minContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, GridSizingData& sizingData) const 1005 LayoutUnit LayoutGrid::minContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, GridSizingData& sizingData) const
1005 { 1006 {
1006 GridTrackSizingDirection childInlineDirection = flowAwareDirectionForChild(c hild, ForColumns); 1007 GridTrackSizingDirection childInlineDirection = flowAwareDirectionForChild(c hild, ForColumns);
1007 if (direction == childInlineDirection) { 1008 if (direction == childInlineDirection) {
1008 // If |child| has a relative logical width, we shouldn't let it override its intrinsic width, which is 1009 // If |child| has a relative logical width, we shouldn't let it override its intrinsic width, which is
1009 // what we are interested in here. Thus we need to set the inline-axis o verride size to -1 (no possible resolution). 1010 // what we are interested in here. Thus we need to set the inline-axis o verride size to -1 (no possible resolution).
1010 if (shouldClearOverrideContainingBlockContentSizeForChild(child, ForColu mns)) 1011 if (shouldClearOverrideContainingBlockContentSizeForChild(child, ForColu mns))
1011 setOverrideContainingBlockContentSizeForChild(child, childInlineDire ction, LayoutUnit(-1)); 1012 setOverrideContainingBlockContentSizeForChild(child, childInlineDire ction, LayoutUnit(-1));
1012 1013
1013 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width. 1014 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width.
1014 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html 1015 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
1015 return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child); 1016 return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child);
1016 } 1017 }
1017 1018
1018 // All orthogonal flow boxes were already laid out during an early layout ph ase performed in FrameView::performLayout. 1019 // All orthogonal flow boxes were already laid out during an early layout ph ase performed in FrameView::performLayout.
1019 // It's true that grid track sizing was not completed at that time and it ma y afffect the final height of a 1020 // It's true that grid track sizing was not completed at that time and it ma y afffect the final height of a
1020 // grid item, but since it's forbidden to perform a layout during intrinsic width computation, we have to use 1021 // grid item, but since it's forbidden to perform a layout during intrinsic width computation, we have to use
1021 // that computed height for now. 1022 // that computed height for now.
1022 if (direction == ForColumns && sizingData.sizingOperation == IntrinsicSizeCo mputation) { 1023 if (direction == ForColumns && sizingData.sizingOperation == IntrinsicSizeCo mputation) {
1023 DCHECK(isOrthogonalChild(child)); 1024 DCHECK(isOrthogonalChild(child));
1024 return child.logicalHeight() + child.marginLogicalHeight(); 1025 return child.logicalHeight() + child.marginLogicalHeight();
1025 } 1026 }
1026 1027
1027 SubtreeLayoutScope layouter(child); 1028 SubtreeLayoutScope layouter(child);
1028 if (updateOverrideContainingBlockContentSizeForChild(child, childInlineDirec tion, sizingData)) 1029 if (updateOverrideContainingBlockContentSizeForChild(child, childInlineDirec tion, sizingData))
1029 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); 1030 child.setNeedsLayout(LayoutInvalidationReason::GridChanged);
1030 return logicalHeightForChild(child, sizingData); 1031 return logicalHeightForChild(child, sizingData);
1031 } 1032 }
1032 1033
1034 DISABLE_CFI_PERF
1033 LayoutUnit LayoutGrid::maxContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, GridSizingData& sizingData) const 1035 LayoutUnit LayoutGrid::maxContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, GridSizingData& sizingData) const
1034 { 1036 {
1035 GridTrackSizingDirection childInlineDirection = flowAwareDirectionForChild(c hild, ForColumns); 1037 GridTrackSizingDirection childInlineDirection = flowAwareDirectionForChild(c hild, ForColumns);
1036 if (direction == childInlineDirection) { 1038 if (direction == childInlineDirection) {
1037 // If |child| has a relative logical width, we shouldn't let it override its intrinsic width, which is 1039 // If |child| has a relative logical width, we shouldn't let it override its intrinsic width, which is
1038 // what we are interested in here. Thus we need to set the inline-axis o verride size to -1 (no possible resolution). 1040 // what we are interested in here. Thus we need to set the inline-axis o verride size to -1 (no possible resolution).
1039 if (shouldClearOverrideContainingBlockContentSizeForChild(child, ForColu mns)) 1041 if (shouldClearOverrideContainingBlockContentSizeForChild(child, ForColu mns))
1040 setOverrideContainingBlockContentSizeForChild(child, childInlineDire ction, LayoutUnit(-1)); 1042 setOverrideContainingBlockContentSizeForChild(child, childInlineDire ction, LayoutUnit(-1));
1041 1043
1042 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width. 1044 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width.
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 2287
2286 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be move d to LayoutBox. 2288 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be move d to LayoutBox.
2287 bool LayoutGrid::hasAutoMarginsInRowAxis(const LayoutBox& child) const 2289 bool LayoutGrid::hasAutoMarginsInRowAxis(const LayoutBox& child) const
2288 { 2290 {
2289 if (isHorizontalWritingMode()) 2291 if (isHorizontalWritingMode())
2290 return child.styleRef().marginLeft().isAuto() || child.styleRef().margin Right().isAuto(); 2292 return child.styleRef().marginLeft().isAuto() || child.styleRef().margin Right().isAuto();
2291 return child.styleRef().marginTop().isAuto() || child.styleRef().marginBotto m().isAuto(); 2293 return child.styleRef().marginTop().isAuto() || child.styleRef().marginBotto m().isAuto();
2292 } 2294 }
2293 2295
2294 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be move d to LayoutBox. 2296 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be move d to LayoutBox.
2297 DISABLE_CFI_PERF
2295 void LayoutGrid::updateAutoMarginsInRowAxisIfNeeded(LayoutBox& child) 2298 void LayoutGrid::updateAutoMarginsInRowAxisIfNeeded(LayoutBox& child)
2296 { 2299 {
2297 ASSERT(!child.isOutOfFlowPositioned()); 2300 ASSERT(!child.isOutOfFlowPositioned());
2298 2301
2299 LayoutUnit availableAlignmentSpace = child.overrideContainingBlockContentLog icalWidth() - child.logicalWidth() - child.marginLogicalWidth(); 2302 LayoutUnit availableAlignmentSpace = child.overrideContainingBlockContentLog icalWidth() - child.logicalWidth() - child.marginLogicalWidth();
2300 if (availableAlignmentSpace <= 0) 2303 if (availableAlignmentSpace <= 0)
2301 return; 2304 return;
2302 2305
2303 Length marginStart = child.style()->marginStartUsing(style()); 2306 Length marginStart = child.style()->marginStartUsing(style());
2304 Length marginEnd = child.style()->marginEndUsing(style()); 2307 Length marginEnd = child.style()->marginEndUsing(style());
2305 if (marginStart.isAuto() && marginEnd.isAuto()) { 2308 if (marginStart.isAuto() && marginEnd.isAuto()) {
2306 child.setMarginStart(availableAlignmentSpace / 2, style()); 2309 child.setMarginStart(availableAlignmentSpace / 2, style());
2307 child.setMarginEnd(availableAlignmentSpace / 2, style()); 2310 child.setMarginEnd(availableAlignmentSpace / 2, style());
2308 } else if (marginStart.isAuto()) { 2311 } else if (marginStart.isAuto()) {
2309 child.setMarginStart(availableAlignmentSpace, style()); 2312 child.setMarginStart(availableAlignmentSpace, style());
2310 } else if (marginEnd.isAuto()) { 2313 } else if (marginEnd.isAuto()) {
2311 child.setMarginEnd(availableAlignmentSpace, style()); 2314 child.setMarginEnd(availableAlignmentSpace, style());
2312 } 2315 }
2313 } 2316 }
2314 2317
2315 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be move d to LayoutBox. 2318 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be move d to LayoutBox.
2319 DISABLE_CFI_PERF
2316 void LayoutGrid::updateAutoMarginsInColumnAxisIfNeeded(LayoutBox& child) 2320 void LayoutGrid::updateAutoMarginsInColumnAxisIfNeeded(LayoutBox& child)
2317 { 2321 {
2318 ASSERT(!child.isOutOfFlowPositioned()); 2322 ASSERT(!child.isOutOfFlowPositioned());
2319 2323
2320 LayoutUnit availableAlignmentSpace = child.overrideContainingBlockContentLog icalHeight() - child.logicalHeight() - child.marginLogicalHeight(); 2324 LayoutUnit availableAlignmentSpace = child.overrideContainingBlockContentLog icalHeight() - child.logicalHeight() - child.marginLogicalHeight();
2321 if (availableAlignmentSpace <= 0) 2325 if (availableAlignmentSpace <= 0)
2322 return; 2326 return;
2323 2327
2324 Length marginBefore = child.style()->marginBeforeUsing(style()); 2328 Length marginBefore = child.style()->marginBeforeUsing(style());
2325 Length marginAfter = child.style()->marginAfterUsing(style()); 2329 Length marginAfter = child.style()->marginAfterUsing(style());
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation; 2666 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation;
2663 } 2667 }
2664 2668
2665 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2669 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2666 { 2670 {
2667 if (!m_gridItemArea.isEmpty()) 2671 if (!m_gridItemArea.isEmpty())
2668 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2672 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2669 } 2673 }
2670 2674
2671 } // namespace blink 2675 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698