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

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 752723004: Use references in RenderBlock and RenderBlockFlow methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cover RenderBlockFlow class as well Created 6 years 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. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. 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 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 void RenderBox::positionLineBox(InlineBox* box) 1604 void RenderBox::positionLineBox(InlineBox* box)
1605 { 1605 {
1606 if (isOutOfFlowPositioned()) { 1606 if (isOutOfFlowPositioned()) {
1607 // Cache the x position only if we were an INLINE type originally. 1607 // Cache the x position only if we were an INLINE type originally.
1608 bool wasInline = style()->isOriginalDisplayInlineType(); 1608 bool wasInline = style()->isOriginalDisplayInlineType();
1609 if (wasInline) { 1609 if (wasInline) {
1610 // The value is cached in the xPos of the box. We only need this va lue if 1610 // The value is cached in the xPos of the box. We only need this va lue if
1611 // our object was inline originally, since otherwise it would have e nded up underneath 1611 // our object was inline originally, since otherwise it would have e nded up underneath
1612 // the inlines. 1612 // the inlines.
1613 RootInlineBox& root = box->root(); 1613 RootInlineBox& root = box->root();
1614 root.block().setStaticInlinePositionForChild(this, LayoutUnit::fromF loatRound(box->logicalLeft())); 1614 root.block().setStaticInlinePositionForChild(*this, LayoutUnit::from FloatRound(box->logicalLeft()));
1615 if (style()->hasStaticInlinePosition(box->isHorizontal())) 1615 if (style()->hasStaticInlinePosition(box->isHorizontal()))
1616 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly. 1616 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly.
1617 } else { 1617 } else {
1618 // Our object was a block originally, so we make our normal flow pos ition be 1618 // Our object was a block originally, so we make our normal flow pos ition be
1619 // just below the line box (as though all the inlines that came befo re us got 1619 // just below the line box (as though all the inlines that came befo re us got
1620 // wrapped in an anonymous block, which is what would have happened had we been 1620 // wrapped in an anonymous block, which is what would have happened had we been
1621 // in flow). This value was cached in the y() of the box. 1621 // in flow). This value was cached in the y() of the box.
1622 layer()->setStaticBlockPosition(box->logicalTop()); 1622 layer()->setStaticBlockPosition(box->logicalTop());
1623 if (style()->hasStaticBlockPosition(box->isHorizontal())) 1623 if (style()->hasStaticBlockPosition(box->isHorizontal()))
1624 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly. 1624 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly.
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize , styleToUse->logicalWidth(), containerWidthInInlineDirection, cb); 1884 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize , styleToUse->logicalWidth(), containerWidthInInlineDirection, cb);
1885 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb); 1885 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb);
1886 } 1886 }
1887 1887
1888 // Margin calculations. 1888 // Margin calculations.
1889 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu tedValues.m_extent, computedValues.m_margins.m_start, 1889 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu tedValues.m_extent, computedValues.m_margins.m_start,
1890 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE nd()); 1890 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE nd());
1891 1891
1892 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp utedValues.m_margins.m_end) 1892 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp utedValues.m_margins.m_end)
1893 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated () && !cb->isRenderGrid()) { 1893 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated () && !cb->isRenderGrid()) {
1894 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent - cb->marginStartForChild(this); 1894 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent - cb->marginStartForChild(*this);
1895 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty le()->isLeftToRightDirection(); 1895 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty le()->isLeftToRightDirection();
1896 if (hasInvertedDirection) 1896 if (hasInvertedDirection)
1897 computedValues.m_margins.m_start = newMargin; 1897 computedValues.m_margins.m_start = newMargin;
1898 else 1898 else
1899 computedValues.m_margins.m_end = newMargin; 1899 computedValues.m_margins.m_end = newMargin;
1900 } 1900 }
1901 1901
1902 if (styleToUse->textAutosizingMultiplier() != 1 && styleToUse->marginStart() .type() == Fixed) { 1902 if (styleToUse->textAutosizingMultiplier() != 1 && styleToUse->marginStart() .type() == Fixed) {
1903 Node* parentNode = generatingNode(); 1903 Node* parentNode = generatingNode();
1904 if (parentNode && (isHTMLOListElement(*parentNode) || isHTMLUListElement (*parentNode))) { 1904 if (parentNode && (isHTMLOListElement(*parentNode) || isHTMLUListElement (*parentNode))) {
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 2583
2584 void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containing Block) 2584 void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containing Block)
2585 { 2585 {
2586 LayoutUnit marginBefore; 2586 LayoutUnit marginBefore;
2587 LayoutUnit marginAfter; 2587 LayoutUnit marginAfter;
2588 computeMarginsForDirection(BlockDirection, containingBlock, containingBlockL ogicalWidthForContent(), logicalHeight(), marginBefore, marginAfter, 2588 computeMarginsForDirection(BlockDirection, containingBlock, containingBlockL ogicalWidthForContent(), logicalHeight(), marginBefore, marginAfter,
2589 style()->marginBeforeUsing(containingBlock->style()), 2589 style()->marginBeforeUsing(containingBlock->style()),
2590 style()->marginAfterUsing(containingBlock->style())); 2590 style()->marginAfterUsing(containingBlock->style()));
2591 // Note that in this 'positioning phase' of the layout we are using the cont aining block's writing mode rather than our own when calculating margins. 2591 // Note that in this 'positioning phase' of the layout we are using the cont aining block's writing mode rather than our own when calculating margins.
2592 // See http://www.w3.org/TR/2014/CR-css-writing-modes-3-20140320/#orthogonal -flows 2592 // See http://www.w3.org/TR/2014/CR-css-writing-modes-3-20140320/#orthogonal -flows
2593 containingBlock->setMarginBeforeForChild(this, marginBefore); 2593 containingBlock->setMarginBeforeForChild(*this, marginBefore);
2594 containingBlock->setMarginAfterForChild(this, marginAfter); 2594 containingBlock->setMarginAfterForChild(*this, marginAfter);
2595 } 2595 }
2596 2596
2597 LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo delObject* containingBlock, bool checkForPerpendicularWritingMode) const 2597 LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo delObject* containingBlock, bool checkForPerpendicularWritingMode) const
2598 { 2598 {
2599 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting Mode() != isHorizontalWritingMode()) 2599 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting Mode() != isHorizontalWritingMode())
2600 return containingBlockLogicalHeightForPositioned(containingBlock, false) ; 2600 return containingBlockLogicalHeightForPositioned(containingBlock, false) ;
2601 2601
2602 // Use viewport as container for top-level fixed-position elements. 2602 // Use viewport as container for top-level fixed-position elements.
2603 if (style()->position() == FixedPosition && containingBlock->isRenderView()) { 2603 if (style()->position() == FixedPosition && containingBlock->isRenderView()) {
2604 const RenderView* view = toRenderView(containingBlock); 2604 const RenderView* view = toRenderView(containingBlock);
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after
4431 4431
4432 setLogicalTop(oldLogicalTop); 4432 setLogicalTop(oldLogicalTop);
4433 setLogicalWidth(oldLogicalWidth); 4433 setLogicalWidth(oldLogicalWidth);
4434 setMarginLeft(oldMarginLeft); 4434 setMarginLeft(oldMarginLeft);
4435 setMarginRight(oldMarginRight); 4435 setMarginRight(oldMarginRight);
4436 4436
4437 return borderBox; 4437 return borderBox;
4438 } 4438 }
4439 4439
4440 } // namespace blink 4440 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockLineLayout.cpp ('k') | Source/core/rendering/RenderFieldset.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698