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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase to master 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 unified diff | Download patch | Annotate | Revision Log
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. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 } 2368 }
2369 2369
2370 return false; 2370 return false;
2371 } 2371 }
2372 2372
2373 Position LayoutBlock::positionForBox(InlineBox *box, bool start) const 2373 Position LayoutBlock::positionForBox(InlineBox *box, bool start) const
2374 { 2374 {
2375 if (!box) 2375 if (!box)
2376 return Position(); 2376 return Position();
2377 2377
2378 if (!box->renderer().nonPseudoNode()) 2378 if (!box->layoutObject().nonPseudoNode())
2379 return createLegacyEditingPosition(nonPseudoNode(), start ? caretMinOffs et() : caretMaxOffset()); 2379 return createLegacyEditingPosition(nonPseudoNode(), start ? caretMinOffs et() : caretMaxOffset());
2380 2380
2381 if (!box->isInlineTextBox()) 2381 if (!box->isInlineTextBox())
2382 return createLegacyEditingPosition(box->renderer().nonPseudoNode(), star t ? box->renderer().caretMinOffset() : box->renderer().caretMaxOffset()); 2382 return createLegacyEditingPosition(box->layoutObject().nonPseudoNode(), start ? box->layoutObject().caretMinOffset() : box->layoutObject().caretMaxOffse t());
2383 2383
2384 InlineTextBox* textBox = toInlineTextBox(box); 2384 InlineTextBox* textBox = toInlineTextBox(box);
2385 return createLegacyEditingPosition(box->renderer().nonPseudoNode(), start ? textBox->start() : textBox->start() + textBox->len()); 2385 return createLegacyEditingPosition(box->layoutObject().nonPseudoNode(), star t ? textBox->start() : textBox->start() + textBox->len());
2386 } 2386 }
2387 2387
2388 static inline bool isEditingBoundary(LayoutObject* ancestor, LayoutObject* child ) 2388 static inline bool isEditingBoundary(LayoutObject* ancestor, LayoutObject* child )
2389 { 2389 {
2390 ASSERT(!ancestor || ancestor->nonPseudoNode()); 2390 ASSERT(!ancestor || ancestor->nonPseudoNode());
2391 ASSERT(child && child->nonPseudoNode()); 2391 ASSERT(child && child->nonPseudoNode());
2392 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor ->parent()->isLayoutView()) 2392 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor ->parent()->isLayoutView())
2393 || ancestor->nonPseudoNode()->hasEditableStyle() == child->nonPseudoNode ()->hasEditableStyle(); 2393 || ancestor->nonPseudoNode()->hasEditableStyle() == child->nonPseudoNode ()->hasEditableStyle();
2394 } 2394 }
2395 2395
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 } 2490 }
2491 // y coordinate is above first root line box, so return the star t of the first 2491 // y coordinate is above first root line box, so return the star t of the first
2492 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA M); 2492 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA M);
2493 } 2493 }
2494 } 2494 }
2495 2495
2496 // pass the box a top position that is inside it 2496 // pass the box a top position that is inside it
2497 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi rectionPointInLine()); 2497 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi rectionPointInLine());
2498 if (!isHorizontalWritingMode()) 2498 if (!isHorizontalWritingMode())
2499 point = point.transposedPoint(); 2499 point = point.transposedPoint();
2500 if (closestBox->renderer().isReplaced()) 2500 if (closestBox->layoutObject().isReplaced())
2501 return positionForPointRespectingEditingBoundaries(this, &toLayoutBo x(closestBox->renderer()), point); 2501 return positionForPointRespectingEditingBoundaries(this, &toLayoutBo x(closestBox->layoutObject()), point);
2502 return closestBox->renderer().positionForPoint(point); 2502 return closestBox->layoutObject().positionForPoint(point);
2503 } 2503 }
2504 2504
2505 if (lastRootBoxWithChildren) { 2505 if (lastRootBoxWithChildren) {
2506 // We hit this case for Mac behavior when the Y coordinate is below the last box. 2506 // We hit this case for Mac behavior when the Y coordinate is below the last box.
2507 ASSERT(moveCaretToBoundary); 2507 ASSERT(moveCaretToBoundary);
2508 InlineBox* logicallyLastBox; 2508 InlineBox* logicallyLastBox;
2509 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) 2509 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox))
2510 return PositionWithAffinity(positionForBox(logicallyLastBox, false), DOWNSTREAM); 2510 return PositionWithAffinity(positionForBox(logicallyLastBox, false), DOWNSTREAM);
2511 } 2511 }
2512 2512
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3538 { 3538 {
3539 // For blocks inside inlines, we go ahead and include margins so that we run right up to the 3539 // For blocks inside inlines, we go ahead and include margins so that we run right up to the
3540 // inline boxes above and below us (thus getting merged with them to form a single irregular 3540 // inline boxes above and below us (thus getting merged with them to form a single irregular
3541 // shape). 3541 // shape).
3542 if (inlineElementContinuation()) { 3542 if (inlineElementContinuation()) {
3543 // FIXME: This check really isn't accurate. 3543 // FIXME: This check really isn't accurate.
3544 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); 3544 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox();
3545 // FIXME: This is wrong. The principal renderer may not be the continuat ion preceding this block. 3545 // FIXME: This is wrong. The principal renderer may not be the continuat ion preceding this block.
3546 // FIXME: This is wrong for vertical writing-modes. 3546 // FIXME: This is wrong for vertical writing-modes.
3547 // https://bugs.webkit.org/show_bug.cgi?id=46781 3547 // https://bugs.webkit.org/show_bug.cgi?id=46781
3548 bool prevInlineHasLineBox = toLayoutInline(inlineElementContinuation()-> node()->renderer())->firstLineBox(); 3548 bool prevInlineHasLineBox = toLayoutInline(inlineElementContinuation()-> node()->layoutObject())->firstLineBox();
3549 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit(); 3549 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit();
3550 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit(); 3550 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit();
3551 LayoutRect rect(additionalOffset, size()); 3551 LayoutRect rect(additionalOffset, size());
3552 rect.expandEdges(topMargin, 0, bottomMargin, 0); 3552 rect.expandEdges(topMargin, 0, bottomMargin, 0);
3553 3553
3554 if (!rect.isEmpty()) 3554 if (!rect.isEmpty())
3555 rects.append(rect); 3555 rects.append(rect);
3556 } else if (size().width() && size().height()) { 3556 } else if (size().width() && size().height()) {
3557 rects.append(LayoutRect(additionalOffset, size())); 3557 rects.append(LayoutRect(additionalOffset, size()));
3558 } 3558 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
3655 } 3655 }
3656 3656
3657 LayoutUnit LayoutBlock::offsetFromLogicalTopOfFirstPage() const 3657 LayoutUnit LayoutBlock::offsetFromLogicalTopOfFirstPage() const
3658 { 3658 {
3659 LayoutState* layoutState = view()->layoutState(); 3659 LayoutState* layoutState = view()->layoutState();
3660 RELEASE_ASSERT(layoutState); 3660 RELEASE_ASSERT(layoutState);
3661 if (!layoutState->isPaginated()) 3661 if (!layoutState->isPaginated())
3662 return LayoutUnit(); 3662 return LayoutUnit();
3663 // It would be possible to remove the requirement that this block be the one currently being 3663 // It would be possible to remove the requirement that this block be the one currently being
3664 // laid out, but nobody needs that at the moment. 3664 // laid out, but nobody needs that at the moment.
3665 ASSERT(layoutState->renderer() == this); 3665 ASSERT(layoutState->layoutObject() == this);
3666 LayoutSize offsetDelta = layoutState->layoutOffset() - layoutState->pageOffs et(); 3666 LayoutSize offsetDelta = layoutState->layoutOffset() - layoutState->pageOffs et();
3667 return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width( ); 3667 return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width( );
3668 } 3668 }
3669 3669
3670 LayoutUnit LayoutBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co nst 3670 LayoutUnit LayoutBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co nst
3671 { 3671 {
3672 // If the child has the same directionality as we do, then we can just retur n its 3672 // If the child has the same directionality as we do, then we can just retur n its
3673 // collapsed margin. 3673 // collapsed margin.
3674 if (!child.isWritingModeRoot()) 3674 if (!child.isWritingModeRoot())
3675 return child.collapsedMarginBefore(); 3675 return child.collapsedMarginBefore();
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
3922 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 3922 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
3923 { 3923 {
3924 showLayoutObject(); 3924 showLayoutObject();
3925 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 3925 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
3926 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 3926 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
3927 } 3927 }
3928 3928
3929 #endif 3929 #endif
3930 3930
3931 } // namespace blink 3931 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698