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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 if (TextAutosizer* textAutosizer = document().textAutosizer()) 238 if (TextAutosizer* textAutosizer = document().textAutosizer())
239 textAutosizer->record(this); 239 textAutosizer->record(this);
240 240
241 propagateStyleToAnonymousChildren(); 241 propagateStyleToAnonymousChildren();
242 242
243 // It's possible for our border/padding to change, but for the overall logical 243 // It's possible for our border/padding to change, but for the overall logical
244 // width or height of the block to end up being the same. We keep track of 244 // width or height of the block to end up being the same. We keep track of
245 // this change so in layoutBlock, we can know to set relayoutChildren=true. 245 // this change so in layoutBlock, we can know to set relayoutChildren=true.
246 m_widthAvailableToChildrenChanged |= 246 m_widthAvailableToChildrenChanged |= oldStyle && needsLayout() &&
247 oldStyle && needsLayout() && 247 (diff.needsFullLayout() ||
248 (diff.needsFullLayout() || borderOrPaddingLogicalDimensionChanged( 248 borderOrPaddingLogicalDimensionChanged(
249 *oldStyle, newStyle, LogicalWidth)); 249 *oldStyle, newStyle, LogicalWidth));
250 m_heightAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && 250 m_heightAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() &&
251 needsLayout() && 251 needsLayout() &&
252 borderOrPaddingLogicalDimensionChanged( 252 borderOrPaddingLogicalDimensionChanged(
253 *oldStyle, newStyle, LogicalHeight); 253 *oldStyle, newStyle, LogicalHeight);
254 } 254 }
255 255
256 void LayoutBlock::updateFromStyle() { 256 void LayoutBlock::updateFromStyle() {
257 LayoutBox::updateFromStyle(); 257 LayoutBox::updateFromStyle();
258 258
259 bool shouldClipOverflow = 259 bool shouldClipOverflow =
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // container moves, and the absolute element has a fixed position child 634 // container moves, and the absolute element has a fixed position child
635 // neither the fixed element nor its container learn of the movement since 635 // neither the fixed element nor its container learn of the movement since
636 // posChildNeedsLayout() is only marked as far as the relative positioned 636 // posChildNeedsLayout() is only marked as far as the relative positioned
637 // container. So if we can have fixed pos objects in our positioned objects 637 // container. So if we can have fixed pos objects in our positioned objects
638 // list check if any of them are statically positioned and thus need to move 638 // list check if any of them are statically positioned and thus need to move
639 // with their absolute ancestors. 639 // with their absolute ancestors.
640 bool canContainFixedPosObjects = canContainFixedPositionObjects(); 640 bool canContainFixedPosObjects = canContainFixedPositionObjects();
641 if (posChildNeedsLayout() || needsPositionedMovementLayout() || 641 if (posChildNeedsLayout() || needsPositionedMovementLayout() ||
642 canContainFixedPosObjects) 642 canContainFixedPosObjects)
643 layoutPositionedObjects( 643 layoutPositionedObjects(
644 false, needsPositionedMovementLayout() 644 false,
645 ? ForcedLayoutAfterContainingBlockMoved 645 needsPositionedMovementLayout()
646 : (!posChildNeedsLayout() && canContainFixedPosObjects 646 ? ForcedLayoutAfterContainingBlockMoved
647 ? LayoutOnlyFixedPositionedObjects 647 : (!posChildNeedsLayout() && canContainFixedPosObjects
648 : DefaultLayout)); 648 ? LayoutOnlyFixedPositionedObjects
649 : DefaultLayout));
649 650
650 // Recompute our overflow information. 651 // Recompute our overflow information.
651 // FIXME: We could do better here by computing a temporary overflow object 652 // FIXME: We could do better here by computing a temporary overflow object
652 // from layoutPositionedObjects and only updating our overflow if we either 653 // from layoutPositionedObjects and only updating our overflow if we either
653 // used to have overflow or if the new temporary object has overflow. 654 // used to have overflow or if the new temporary object has overflow.
654 // For now just always recompute overflow. This is no worse performance-wise 655 // For now just always recompute overflow. This is no worse performance-wise
655 // than the old code that called rightmostPosition and lowestPosition on 656 // than the old code that called rightmostPosition and lowestPosition on
656 // every relayout so it's not a regression. computeOverflow expects the 657 // every relayout so it's not a regression. computeOverflow expects the
657 // bottom edge before we clamp our height. Since this information isn't 658 // bottom edge before we clamp our height. Since this information isn't
658 // available during simplifiedLayout, we cache the value in m_overflow. 659 // available during simplifiedLayout, we cache the value in m_overflow.
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 932
932 LayoutBlock* LayoutBlock::blockBeforeWithinSelectionRoot( 933 LayoutBlock* LayoutBlock::blockBeforeWithinSelectionRoot(
933 LayoutSize& offset) const { 934 LayoutSize& offset) const {
934 if (isSelectionRoot()) 935 if (isSelectionRoot())
935 return nullptr; 936 return nullptr;
936 937
937 const LayoutObject* object = this; 938 const LayoutObject* object = this;
938 LayoutObject* sibling; 939 LayoutObject* sibling;
939 do { 940 do {
940 sibling = object->previousSibling(); 941 sibling = object->previousSibling();
941 while (sibling && (!sibling->isLayoutBlock() || 942 while (sibling &&
942 toLayoutBlock(sibling)->isSelectionRoot())) 943 (!sibling->isLayoutBlock() ||
944 toLayoutBlock(sibling)->isSelectionRoot()))
943 sibling = sibling->previousSibling(); 945 sibling = sibling->previousSibling();
944 946
945 offset -= LayoutSize(toLayoutBlock(object)->logicalLeft(), 947 offset -= LayoutSize(toLayoutBlock(object)->logicalLeft(),
946 toLayoutBlock(object)->logicalTop()); 948 toLayoutBlock(object)->logicalTop());
947 object = object->parent(); 949 object = object->parent();
948 } while (!sibling && object && object->isLayoutBlock() && 950 } while (!sibling && object && object->isLayoutBlock() &&
949 !toLayoutBlock(object)->isSelectionRoot()); 951 !toLayoutBlock(object)->isSelectionRoot());
950 952
951 if (!sibling) 953 if (!sibling)
952 return nullptr; 954 return nullptr;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 if (hitTestAction == HitTestChildBlockBackgrounds) 1203 if (hitTestAction == HitTestChildBlockBackgrounds)
1202 childHitTest = HitTestChildBlockBackground; 1204 childHitTest = HitTestChildBlockBackground;
1203 for (LayoutBox* child = lastChildBox(); child; 1205 for (LayoutBox* child = lastChildBox(); child;
1204 child = child->previousSiblingBox()) { 1206 child = child->previousSiblingBox()) {
1205 LayoutPoint childPoint = flipForWritingModeForChild(child, scrolledOffset); 1207 LayoutPoint childPoint = flipForWritingModeForChild(child, scrolledOffset);
1206 if (!child->hasSelfPaintingLayer() && !child->isFloating() && 1208 if (!child->hasSelfPaintingLayer() && !child->isFloating() &&
1207 !child->isColumnSpanAll() && 1209 !child->isColumnSpanAll() &&
1208 child->nodeAtPoint(result, locationInContainer, childPoint, 1210 child->nodeAtPoint(result, locationInContainer, childPoint,
1209 childHitTest)) { 1211 childHitTest)) {
1210 updateHitTestResult( 1212 updateHitTestResult(
1211 result, flipForWritingMode(toLayoutPoint(locationInContainer.point() - 1213 result,
1212 accumulatedOffset))); 1214 flipForWritingMode(
1215 toLayoutPoint(locationInContainer.point() - accumulatedOffset)));
1213 return true; 1216 return true;
1214 } 1217 }
1215 } 1218 }
1216 1219
1217 return false; 1220 return false;
1218 } 1221 }
1219 1222
1220 Position LayoutBlock::positionForBox(InlineBox* box, bool start) const { 1223 Position LayoutBlock::positionForBox(InlineBox* box, bool start) const {
1221 if (!box) 1224 if (!box)
1222 return Position(); 1225 return Position();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 1415
1413 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); 1416 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
1414 1417
1415 if (isHTMLMarqueeElement(node()) && 1418 if (isHTMLMarqueeElement(node()) &&
1416 toHTMLMarqueeElement(node())->isHorizontal()) 1419 toHTMLMarqueeElement(node())->isHorizontal())
1417 minLogicalWidth = LayoutUnit(); 1420 minLogicalWidth = LayoutUnit();
1418 1421
1419 if (isTableCell()) { 1422 if (isTableCell()) {
1420 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth(); 1423 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth();
1421 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) 1424 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0)
1422 maxLogicalWidth = 1425 maxLogicalWidth = std::max(minLogicalWidth,
1423 std::max(minLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing( 1426 adjustContentBoxLogicalWidthForBoxSizing(
1424 LayoutUnit(tableCellWidth.value()))); 1427 LayoutUnit(tableCellWidth.value())));
1425 } 1428 }
1426 1429
1427 int scrollbarWidth = scrollbarLogicalWidth(); 1430 int scrollbarWidth = scrollbarLogicalWidth();
1428 maxLogicalWidth += scrollbarWidth; 1431 maxLogicalWidth += scrollbarWidth;
1429 minLogicalWidth += scrollbarWidth; 1432 minLogicalWidth += scrollbarWidth;
1430 } 1433 }
1431 1434
1432 DISABLE_CFI_PERF 1435 DISABLE_CFI_PERF
1433 void LayoutBlock::computePreferredLogicalWidths() { 1436 void LayoutBlock::computePreferredLogicalWidths() {
1434 ASSERT(preferredLogicalWidthsDirty()); 1437 ASSERT(preferredLogicalWidthsDirty());
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2215 } 2218 }
2216 2219
2217 return availableHeight; 2220 return availableHeight;
2218 } 2221 }
2219 2222
2220 bool LayoutBlock::hasDefiniteLogicalHeight() const { 2223 bool LayoutBlock::hasDefiniteLogicalHeight() const {
2221 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); 2224 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1);
2222 } 2225 }
2223 2226
2224 } // namespace blink 2227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698