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

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

Issue 182413005: Return refererence from InlineBox::root() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-upload because previous patch didn't upload correctly. Created 6 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. 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 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 1949
1950 void RenderBox::positionLineBox(InlineBox* box) 1950 void RenderBox::positionLineBox(InlineBox* box)
1951 { 1951 {
1952 if (isOutOfFlowPositioned()) { 1952 if (isOutOfFlowPositioned()) {
1953 // Cache the x position only if we were an INLINE type originally. 1953 // Cache the x position only if we were an INLINE type originally.
1954 bool wasInline = style()->isOriginalDisplayInlineType(); 1954 bool wasInline = style()->isOriginalDisplayInlineType();
1955 if (wasInline) { 1955 if (wasInline) {
1956 // The value is cached in the xPos of the box. We only need this va lue if 1956 // The value is cached in the xPos of the box. We only need this va lue if
1957 // our object was inline originally, since otherwise it would have e nded up underneath 1957 // our object was inline originally, since otherwise it would have e nded up underneath
1958 // the inlines. 1958 // the inlines.
1959 RootInlineBox* root = box->root(); 1959 RootInlineBox& root = box->root();
1960 root->block().setStaticInlinePositionForChild(this, root->lineTopWit hLeading(), LayoutUnit::fromFloatRound(box->logicalLeft())); 1960 root.block().setStaticInlinePositionForChild(this, root.lineTopWithL eading(), LayoutUnit::fromFloatRound(box->logicalLeft()));
1961 if (style()->hasStaticInlinePosition(box->isHorizontal())) 1961 if (style()->hasStaticInlinePosition(box->isHorizontal()))
1962 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly. 1962 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly.
1963 } else { 1963 } else {
1964 // Our object was a block originally, so we make our normal flow pos ition be 1964 // Our object was a block originally, so we make our normal flow pos ition be
1965 // just below the line box (as though all the inlines that came befo re us got 1965 // just below the line box (as though all the inlines that came befo re us got
1966 // wrapped in an anonymous block, which is what would have happened had we been 1966 // wrapped in an anonymous block, which is what would have happened had we been
1967 // in flow). This value was cached in the y() of the box. 1967 // in flow). This value was cached in the y() of the box.
1968 layer()->setStaticBlockPosition(box->logicalTop()); 1968 layer()->setStaticBlockPosition(box->logicalTop());
1969 if (style()->hasStaticBlockPosition(box->isHorizontal())) 1969 if (style()->hasStaticBlockPosition(box->isHorizontal()))
1970 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly. 1970 setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly.
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
4006 // They never refer to children. 4006 // They never refer to children.
4007 // FIXME: Paint the carets inside empty blocks differently than the carets b efore/after elements. 4007 // FIXME: Paint the carets inside empty blocks differently than the carets b efore/after elements.
4008 4008
4009 LayoutRect rect(location(), LayoutSize(caretWidth, height())); 4009 LayoutRect rect(location(), LayoutSize(caretWidth, height()));
4010 bool ltr = box ? box->isLeftToRightDirection() : style()->isLeftToRightDirec tion(); 4010 bool ltr = box ? box->isLeftToRightDirection() : style()->isLeftToRightDirec tion();
4011 4011
4012 if ((!caretOffset) ^ ltr) 4012 if ((!caretOffset) ^ ltr)
4013 rect.move(LayoutSize(width() - caretWidth, 0)); 4013 rect.move(LayoutSize(width() - caretWidth, 0));
4014 4014
4015 if (box) { 4015 if (box) {
4016 RootInlineBox* rootBox = box->root(); 4016 RootInlineBox& rootBox = box->root();
4017 LayoutUnit top = rootBox->lineTop(); 4017 LayoutUnit top = rootBox.lineTop();
4018 rect.setY(top); 4018 rect.setY(top);
4019 rect.setHeight(rootBox->lineBottom() - top); 4019 rect.setHeight(rootBox.lineBottom() - top);
4020 } 4020 }
4021 4021
4022 // If height of box is smaller than font height, use the latter one, 4022 // If height of box is smaller than font height, use the latter one,
4023 // otherwise the caret might become invisible. 4023 // otherwise the caret might become invisible.
4024 // 4024 //
4025 // Also, if the box is not a replaced element, always use the font height. 4025 // Also, if the box is not a replaced element, always use the font height.
4026 // This prevents the "big caret" bug described in: 4026 // This prevents the "big caret" bug described in:
4027 // <rdar://problem/3777804> Deleting all content in a document can result in giant tall-as-window insertion point 4027 // <rdar://problem/3777804> Deleting all content in a document can result in giant tall-as-window insertion point
4028 // 4028 //
4029 // FIXME: ignoring :first-line, missing good reason to take care of 4029 // FIXME: ignoring :first-line, missing good reason to take care of
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 return 0; 4692 return 0;
4693 4693
4694 if (!layoutState && !flowThreadContainingBlock()) 4694 if (!layoutState && !flowThreadContainingBlock())
4695 return 0; 4695 return 0;
4696 4696
4697 RenderBlock* containerBlock = containingBlock(); 4697 RenderBlock* containerBlock = containingBlock();
4698 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4698 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4699 } 4699 }
4700 4700
4701 } // namespace WebCore 4701 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698