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

Unified Diff: Source/core/layout/line/RootInlineBox.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/line/LineWidth.cpp ('k') | Source/core/layout/svg/LayoutSVGGradientStop.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/line/RootInlineBox.cpp
diff --git a/Source/core/layout/line/RootInlineBox.cpp b/Source/core/layout/line/RootInlineBox.cpp
index dbaeaf17713f209754fa86bfef722cff572c8c82..04a0f12c05fe408fd33a969e2e861c4c9d4ec963 100644
--- a/Source/core/layout/line/RootInlineBox.cpp
+++ b/Source/core/layout/line/RootInlineBox.cpp
@@ -116,7 +116,7 @@ bool RootInlineBox::lineCanAccommodateEllipsis(bool ltr, int blockEdge, int line
FloatWillBeLayoutUnit RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, bool ltr, FloatWillBeLayoutUnit blockLeftEdge, FloatWillBeLayoutUnit blockRightEdge, FloatWillBeLayoutUnit ellipsisWidth, InlineBox* markupBox)
{
// Create an ellipsis box.
- EllipsisBox* ellipsisBox = new EllipsisBox(renderer(), ellipsisStr, this,
+ EllipsisBox* ellipsisBox = new EllipsisBox(layoutObject(), ellipsisStr, this,
ellipsisWidth - (markupBox ? markupBox->logicalWidth().toFloat() : 0), logicalHeight().toFloat(),
x(), y(), !prevRootBox(), isHorizontal(), markupBox);
@@ -160,7 +160,7 @@ bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
{
if (hasEllipsisBox() && visibleToHitTestRequest(request)) {
if (ellipsisBox()->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom)) {
- renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
+ layoutObject().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
return true;
}
}
@@ -182,10 +182,10 @@ void RootInlineBox::adjustPosition(FloatWillBeLayoutUnit dx, FloatWillBeLayoutUn
void RootInlineBox::childRemoved(InlineBox* box)
{
- if (&box->renderer() == m_lineBreakObj)
+ if (&box->layoutObject() == m_lineBreakObj)
setLineBreakInfo(0, 0, BidiStatus());
- for (RootInlineBox* prev = prevRootBox(); prev && prev->lineBreakObj() == &box->renderer(); prev = prev->prevRootBox()) {
+ for (RootInlineBox* prev = prevRootBox(); prev && prev->lineBreakObj() == &box->layoutObject(); prev = prev->prevRootBox()) {
prev->setLineBreakInfo(0, 0, BidiStatus());
prev->markDirty();
}
@@ -205,7 +205,7 @@ LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G
bool setMaxDescent = false;
// Figure out if we're in no-quirks mode.
- bool noQuirksMode = renderer().document().inNoQuirksMode();
+ bool noQuirksMode = layoutObject().document().inNoQuirksMode();
m_baselineType = requiresIdeographicBaseline(textBoxDataMap) ? IdeographicBaseline : AlphabeticBaseline;
@@ -253,7 +253,7 @@ LayoutUnit RootInlineBox::beforeAnnotationsAdjustment() const
{
LayoutUnit result = 0;
- if (!renderer().style()->isFlippedLinesWritingMode()) {
+ if (!layoutObject().style()->isFlippedLinesWritingMode()) {
// Annotations under the previous line may push us down.
if (prevRootBox() && prevRootBox()->hasAnnotationsAfter())
result = prevRootBox()->computeUnderAnnotationAdjustment(lineTop());
@@ -293,11 +293,11 @@ GapRects RootInlineBox::lineSelectionGap(const LayoutBlock* rootBlock, const Lay
InlineBox* lastBox = lastSelectedBox();
if (leftGap) {
result.uniteLeft(block().logicalLeftSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock,
- &firstBox->parent()->renderer(), firstBox->logicalLeft(), selTop, selHeight, paintInfo));
+ &firstBox->parent()->layoutObject(), firstBox->logicalLeft(), selTop, selHeight, paintInfo));
}
if (rightGap) {
result.uniteRight(block().logicalRightSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock,
- &lastBox->parent()->renderer(), lastBox->logicalRight(), selTop, selHeight, paintInfo));
+ &lastBox->parent()->layoutObject(), lastBox->logicalRight(), selTop, selHeight, paintInfo));
}
// When dealing with bidi text, a non-contiguous selection region is possible.
@@ -314,11 +314,11 @@ GapRects RootInlineBox::lineSelectionGap(const LayoutBlock* rootBlock, const Lay
for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLeafChild()) {
if (box->selectionState() != LayoutObject::SelectionNone) {
LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft() - lastLogicalLeft, selHeight);
- logicalRect.move(renderer().isHorizontalWritingMode() ? offsetFromRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.width()));
+ logicalRect.move(layoutObject().isHorizontalWritingMode() ? offsetFromRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.width()));
LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, logicalRect);
if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.height() > 0) {
- if (paintInfo && box->parent()->renderer().style()->visibility() == VISIBLE)
- paintInfo->context->fillRect(gapRect, box->parent()->renderer().selectionBackgroundColor());
+ if (paintInfo && box->parent()->layoutObject().style()->visibility() == VISIBLE)
+ paintInfo->context->fillRect(gapRect, box->parent()->layoutObject().selectionBackgroundColor());
// VisibleSelection may be non-contiguous, see comment above.
result.uniteCenter(gapRect);
}
@@ -380,9 +380,9 @@ LayoutUnit RootInlineBox::selectionTop() const
LayoutUnit selectionTop = m_lineTop;
if (m_hasAnnotationsBefore)
- selectionTop -= !renderer().style()->isFlippedLinesWritingMode() ? computeOverAnnotationAdjustment(m_lineTop) : computeUnderAnnotationAdjustment(m_lineTop);
+ selectionTop -= !layoutObject().style()->isFlippedLinesWritingMode() ? computeOverAnnotationAdjustment(m_lineTop) : computeUnderAnnotationAdjustment(m_lineTop);
- if (renderer().style()->isFlippedLinesWritingMode() || !prevRootBox())
+ if (layoutObject().style()->isFlippedLinesWritingMode() || !prevRootBox())
return selectionTop;
LayoutUnit prevBottom = prevRootBox()->selectionBottom();
@@ -431,9 +431,9 @@ LayoutUnit RootInlineBox::selectionBottom() const
LayoutUnit selectionBottom = m_selectionBottom;
if (m_hasAnnotationsAfter)
- selectionBottom += !renderer().style()->isFlippedLinesWritingMode() ? computeUnderAnnotationAdjustment(m_lineBottom) : computeOverAnnotationAdjustment(m_lineBottom);
+ selectionBottom += !layoutObject().style()->isFlippedLinesWritingMode() ? computeUnderAnnotationAdjustment(m_lineBottom) : computeOverAnnotationAdjustment(m_lineBottom);
- if (!renderer().style()->isFlippedLinesWritingMode() || !nextRootBox())
+ if (!layoutObject().style()->isFlippedLinesWritingMode() || !nextRootBox())
return selectionBottom;
LayoutUnit nextTop = nextRootBox()->selectionTop();
@@ -459,12 +459,12 @@ LayoutUnit RootInlineBox::blockDirectionPointInLine() const
LayoutBlockFlow& RootInlineBox::block() const
{
- return toLayoutBlockFlow(renderer());
+ return toLayoutBlockFlow(layoutObject());
}
static bool isEditableLeaf(InlineBox* leaf)
{
- return leaf && leaf->renderer().node() && leaf->renderer().node()->hasEditableStyle();
+ return leaf && leaf->layoutObject().node() && leaf->layoutObject().node()->hasEditableStyle();
}
InlineBox* RootInlineBox::closestLeafChildForPoint(const LayoutPoint& pointInContents, bool onlyEditableLeaves)
@@ -488,13 +488,13 @@ InlineBox* RootInlineBox::closestLeafChildForLogicalLeftPosition(LayoutUnit left
return firstLeaf;
// Avoid returning a list marker when possible.
- if (leftPosition <= firstLeaf->logicalLeft() && !firstLeaf->renderer().isListMarker() && (!onlyEditableLeaves || isEditableLeaf(firstLeaf))) {
+ if (leftPosition <= firstLeaf->logicalLeft() && !firstLeaf->layoutObject().isListMarker() && (!onlyEditableLeaves || isEditableLeaf(firstLeaf))) {
// The leftPosition coordinate is less or equal to left edge of the firstLeaf.
// Return it.
return firstLeaf;
}
- if (leftPosition >= lastLeaf->logicalRight() && !lastLeaf->renderer().isListMarker() && (!onlyEditableLeaves || isEditableLeaf(lastLeaf))) {
+ if (leftPosition >= lastLeaf->logicalRight() && !lastLeaf->layoutObject().isListMarker() && (!onlyEditableLeaves || isEditableLeaf(lastLeaf))) {
// The leftPosition coordinate is greater or equal to right edge of the lastLeaf.
// Return it.
return lastLeaf;
@@ -502,7 +502,7 @@ InlineBox* RootInlineBox::closestLeafChildForLogicalLeftPosition(LayoutUnit left
InlineBox* closestLeaf = 0;
for (InlineBox* leaf = firstLeaf; leaf; leaf = leaf->nextLeafChildIgnoringLineBreak()) {
- if (!leaf->renderer().isListMarker() && (!onlyEditableLeaves || isEditableLeaf(leaf))) {
+ if (!leaf->layoutObject().isListMarker() && (!onlyEditableLeaves || isEditableLeaf(leaf))) {
closestLeaf = leaf;
if (leftPosition < leaf->logicalRight()) {
// The x coordinate is less than the right edge of the box.
@@ -598,8 +598,8 @@ void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallb
// Replaced boxes will return 0 for the line-height if line-box-contain says they are
// not to be included.
- if (box->renderer().isReplaced()) {
- if (renderer().style(isFirstLineStyle())->lineBoxContain() & LineBoxContainReplaced) {
+ if (box->layoutObject().isReplaced()) {
+ if (layoutObject().style(isFirstLineStyle())->lineBoxContain() & LineBoxContainReplaced) {
ascent = box->baselinePosition(baselineType());
descent = box->lineHeight() - ascent;
@@ -624,8 +624,8 @@ void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallb
bool setUsedFont = false;
bool setUsedFontWithLeading = false;
- if (usedFonts && !usedFonts->isEmpty() && (includeFont || (box->renderer().style(isFirstLineStyle())->lineHeight().isNegative() && includeLeading))) {
- usedFonts->append(box->renderer().style(isFirstLineStyle())->font().primaryFont());
+ if (usedFonts && !usedFonts->isEmpty() && (includeFont || (box->layoutObject().style(isFirstLineStyle())->lineHeight().isNegative() && includeLeading))) {
+ usedFonts->append(box->layoutObject().style(isFirstLineStyle())->font().primaryFont());
for (size_t i = 0; i < usedFonts->size(); ++i) {
const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
int usedFontAscent = fontMetrics.ascent(baselineType());
@@ -663,8 +663,8 @@ void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallb
}
if (includeFontForBox(box) && !setUsedFont) {
- int fontAscent = box->renderer().style(isFirstLineStyle())->fontMetrics().ascent(baselineType());
- int fontDescent = box->renderer().style(isFirstLineStyle())->fontMetrics().descent(baselineType());
+ int fontAscent = box->layoutObject().style(isFirstLineStyle())->fontMetrics().ascent(baselineType());
+ int fontDescent = box->layoutObject().style(isFirstLineStyle())->fontMetrics().descent(baselineType());
setAscentAndDescent(ascent, descent, fontAscent, fontDescent, ascentDescentSet);
affectsAscent = fontAscent - box->logicalTop() > 0;
affectsDescent = fontDescent + box->logicalTop() > 0;
@@ -677,9 +677,9 @@ void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallb
}
if (includeMarginForBox(box)) {
- LayoutUnit ascentWithMargin = box->renderer().style(isFirstLineStyle())->fontMetrics().ascent(baselineType());
- LayoutUnit descentWithMargin = box->renderer().style(isFirstLineStyle())->fontMetrics().descent(baselineType());
- if (box->parent() && !box->renderer().isText()) {
+ LayoutUnit ascentWithMargin = box->layoutObject().style(isFirstLineStyle())->fontMetrics().ascent(baselineType());
+ LayoutUnit descentWithMargin = box->layoutObject().style(isFirstLineStyle())->fontMetrics().descent(baselineType());
+ if (box->parent() && !box->layoutObject().isText()) {
ascentWithMargin += box->boxModelObject()->borderBefore() + box->boxModelObject()->paddingBefore() + box->boxModelObject()->marginBefore();
descentWithMargin += box->boxModelObject()->borderAfter() + box->boxModelObject()->paddingAfter() + box->boxModelObject()->marginAfter();
}
@@ -693,7 +693,7 @@ void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallb
LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositionCache& verticalPositionCache)
{
- if (box->renderer().isText())
+ if (box->layoutObject().isText())
return box->parent()->logicalTop();
LayoutBoxModelObject* renderer = box->boxModelObject();
@@ -765,45 +765,45 @@ LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio
bool RootInlineBox::includeLeadingForBox(InlineBox* box) const
{
- if (box->renderer().isReplaced() || (box->renderer().isText() && !box->isText()))
+ if (box->layoutObject().isReplaced() || (box->layoutObject().isText() && !box->isText()))
return false;
- LineBoxContain lineBoxContain = renderer().style()->lineBoxContain();
+ LineBoxContain lineBoxContain = layoutObject().style()->lineBoxContain();
return (lineBoxContain & LineBoxContainInline) || (box == this && (lineBoxContain & LineBoxContainBlock));
}
bool RootInlineBox::includeFontForBox(InlineBox* box) const
{
- if (box->renderer().isReplaced() || (box->renderer().isText() && !box->isText()))
+ if (box->layoutObject().isReplaced() || (box->layoutObject().isText() && !box->isText()))
return false;
if (!box->isText() && box->isInlineFlowBox() && !toInlineFlowBox(box)->hasTextChildren())
return false;
// For now map "glyphs" to "font" in vertical text mode until the bounds returned by glyphs aren't garbage.
- LineBoxContain lineBoxContain = renderer().style()->lineBoxContain();
+ LineBoxContain lineBoxContain = layoutObject().style()->lineBoxContain();
return (lineBoxContain & LineBoxContainFont) || (!isHorizontal() && (lineBoxContain & LineBoxContainGlyphs));
}
bool RootInlineBox::includeGlyphsForBox(InlineBox* box) const
{
- if (box->renderer().isReplaced() || (box->renderer().isText() && !box->isText()))
+ if (box->layoutObject().isReplaced() || (box->layoutObject().isText() && !box->isText()))
return false;
if (!box->isText() && box->isInlineFlowBox() && !toInlineFlowBox(box)->hasTextChildren())
return false;
// FIXME: We can't fit to glyphs yet for vertical text, since the bounds returned are garbage.
- LineBoxContain lineBoxContain = renderer().style()->lineBoxContain();
+ LineBoxContain lineBoxContain = layoutObject().style()->lineBoxContain();
return isHorizontal() && (lineBoxContain & LineBoxContainGlyphs);
}
bool RootInlineBox::includeMarginForBox(InlineBox* box) const
{
- if (box->renderer().isReplaced() || (box->renderer().isText() && !box->isText()))
+ if (box->layoutObject().isReplaced() || (box->layoutObject().isText() && !box->isText()))
return false;
- LineBoxContain lineBoxContain = renderer().style()->lineBoxContain();
+ LineBoxContain lineBoxContain = layoutObject().style()->lineBoxContain();
return lineBoxContain & LineBoxContainInlineBox;
}
@@ -811,13 +811,13 @@ bool RootInlineBox::includeMarginForBox(InlineBox* box) const
bool RootInlineBox::fitsToGlyphs() const
{
// FIXME: We can't fit to glyphs yet for vertical text, since the bounds returned are garbage.
- LineBoxContain lineBoxContain = renderer().style()->lineBoxContain();
+ LineBoxContain lineBoxContain = layoutObject().style()->lineBoxContain();
return isHorizontal() && (lineBoxContain & LineBoxContainGlyphs);
}
bool RootInlineBox::includesRootLineBoxFontOrLeading() const
{
- LineBoxContain lineBoxContain = renderer().style()->lineBoxContain();
+ LineBoxContain lineBoxContain = layoutObject().style()->lineBoxContain();
return (lineBoxContain & LineBoxContainBlock) || (lineBoxContain & LineBoxContainInline) || (lineBoxContain & LineBoxContainFont);
}
@@ -826,9 +826,9 @@ Node* RootInlineBox::getLogicalStartBoxWithNode(InlineBox*& startBox) const
Vector<InlineBox*> leafBoxesInLogicalOrder;
collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder);
for (size_t i = 0; i < leafBoxesInLogicalOrder.size(); ++i) {
- if (leafBoxesInLogicalOrder[i]->renderer().nonPseudoNode()) {
+ if (leafBoxesInLogicalOrder[i]->layoutObject().nonPseudoNode()) {
startBox = leafBoxesInLogicalOrder[i];
- return startBox->renderer().nonPseudoNode();
+ return startBox->layoutObject().nonPseudoNode();
}
}
startBox = 0;
@@ -840,9 +840,9 @@ Node* RootInlineBox::getLogicalEndBoxWithNode(InlineBox*& endBox) const
Vector<InlineBox*> leafBoxesInLogicalOrder;
collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder);
for (size_t i = leafBoxesInLogicalOrder.size(); i > 0; --i) {
- if (leafBoxesInLogicalOrder[i - 1]->renderer().nonPseudoNode()) {
+ if (leafBoxesInLogicalOrder[i - 1]->layoutObject().nonPseudoNode()) {
endBox = leafBoxesInLogicalOrder[i - 1];
- return endBox->renderer().nonPseudoNode();
+ return endBox->layoutObject().nonPseudoNode();
}
}
endBox = 0;
« no previous file with comments | « Source/core/layout/line/LineWidth.cpp ('k') | Source/core/layout/svg/LayoutSVGGradientStop.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698