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

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

Issue 940373003: Rename RenderText to LayoutText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/layout/LayoutCounter.cpp ('k') | Source/core/layout/LayoutListBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 dirtyLineBoxes(false); 253 dirtyLineBoxes(false);
254 setAlwaysCreateLineBoxes(); 254 setAlwaysCreateLineBoxes();
255 } 255 }
256 } 256 }
257 257
258 LayoutRect LayoutInline::localCaretRect(InlineBox* inlineBox, int, LayoutUnit* e xtraWidthToEndOfLine) 258 LayoutRect LayoutInline::localCaretRect(InlineBox* inlineBox, int, LayoutUnit* e xtraWidthToEndOfLine)
259 { 259 {
260 if (firstChild()) { 260 if (firstChild()) {
261 // This condition is possible if the LayoutInline is at an editing bound ary, 261 // This condition is possible if the LayoutInline is at an editing bound ary,
262 // i.e. the VisiblePosition is: 262 // i.e. the VisiblePosition is:
263 // <LayoutInline editingBoundary=true>|<RenderText> </RenderText></Lay outInline> 263 // <LayoutInline editingBoundary=true>|<LayoutText> </LayoutText></Lay outInline>
264 // FIXME: need to figure out how to make this return a valid rect, note that 264 // FIXME: need to figure out how to make this return a valid rect, note that
265 // there are no line boxes created in the above case. 265 // there are no line boxes created in the above case.
266 return LayoutRect(); 266 return LayoutRect();
267 } 267 }
268 268
269 ASSERT_UNUSED(inlineBox, !inlineBox); 269 ASSERT_UNUSED(inlineBox, !inlineBox);
270 270
271 if (extraWidthToEndOfLine) 271 if (extraWidthToEndOfLine)
272 *extraWidthToEndOfLine = 0; 272 *extraWidthToEndOfLine = 0;
273 273
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 logicalHeight)); 612 logicalHeight));
613 } else { 613 } else {
614 yield(FloatRect(logicalTop, 614 yield(FloatRect(logicalTop,
615 childLine->y() - childLine->marginLogicalLeft(), 615 childLine->y() - childLine->marginLogicalLeft(),
616 logicalHeight, 616 logicalHeight,
617 childLine->logicalWidth() + childLine->marginLogical Left() + childLine->marginLogicalRight())); 617 childLine->logicalWidth() + childLine->marginLogical Left() + childLine->marginLogicalRight()));
618 } 618 }
619 } 619 }
620 } 620 }
621 } else if (curr->isText()) { 621 } else if (curr->isText()) {
622 RenderText* currText = toRenderText(curr); 622 LayoutText* currText = toLayoutText(curr);
623 for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) { 623 for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) {
624 RootInlineBox& rootBox = childText->root(); 624 RootInlineBox& rootBox = childText->root();
625 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style( rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); 625 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style( rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
626 int logicalHeight = container->style(rootBox.isFirstLineStyle()) ->font().fontMetrics().height(); 626 int logicalHeight = container->style(rootBox.isFirstLineStyle()) ->font().fontMetrics().height();
627 if (isHorizontal) 627 if (isHorizontal)
628 yield(FloatRect(childText->x(), logicalTop, childText->logic alWidth(), logicalHeight)); 628 yield(FloatRect(childText->x(), logicalTop, childText->logic alWidth(), logicalHeight));
629 else 629 else
630 yield(FloatRect(logicalTop, childText->y(), logicalHeight, c hildText->logicalWidth())); 630 yield(FloatRect(logicalTop, childText->y(), logicalHeight, c hildText->logicalWidth()));
631 } 631 }
632 } 632 }
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block 919 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block
920 // direction (aligned to the root box's baseline). 920 // direction (aligned to the root box's baseline).
921 if (curr->isBox()) 921 if (curr->isBox())
922 return toLayoutBox(curr)->inlineBoxWrapper(); 922 return toLayoutBox(curr)->inlineBoxWrapper();
923 if (curr->isLayoutInline()) { 923 if (curr->isLayoutInline()) {
924 LayoutInline* currInline = toLayoutInline(curr); 924 LayoutInline* currInline = toLayoutInline(curr);
925 InlineBox* result = currInline->firstLineBoxIncludingCulling(); 925 InlineBox* result = currInline->firstLineBoxIncludingCulling();
926 if (result) 926 if (result)
927 return result; 927 return result;
928 } else if (curr->isText()) { 928 } else if (curr->isText()) {
929 RenderText* currText = toRenderText(curr); 929 LayoutText* currText = toLayoutText(curr);
930 if (currText->firstTextBox()) 930 if (currText->firstTextBox())
931 return currText->firstTextBox(); 931 return currText->firstTextBox();
932 } 932 }
933 } 933 }
934 return 0; 934 return 0;
935 } 935 }
936 936
937 InlineBox* LayoutInline::culledInlineLastLineBox() const 937 InlineBox* LayoutInline::culledInlineLastLineBox() const
938 { 938 {
939 for (LayoutObject* curr = lastChild(); curr; curr = curr->previousSibling()) { 939 for (LayoutObject* curr = lastChild(); curr; curr = curr->previousSibling()) {
940 if (curr->isFloatingOrOutOfFlowPositioned()) 940 if (curr->isFloatingOrOutOfFlowPositioned())
941 continue; 941 continue;
942 942
943 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block 943 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block
944 // direction (aligned to the root box's baseline). 944 // direction (aligned to the root box's baseline).
945 if (curr->isBox()) 945 if (curr->isBox())
946 return toLayoutBox(curr)->inlineBoxWrapper(); 946 return toLayoutBox(curr)->inlineBoxWrapper();
947 if (curr->isLayoutInline()) { 947 if (curr->isLayoutInline()) {
948 LayoutInline* currInline = toLayoutInline(curr); 948 LayoutInline* currInline = toLayoutInline(curr);
949 InlineBox* result = currInline->lastLineBoxIncludingCulling(); 949 InlineBox* result = currInline->lastLineBoxIncludingCulling();
950 if (result) 950 if (result)
951 return result; 951 return result;
952 } else if (curr->isText()) { 952 } else if (curr->isText()) {
953 RenderText* currText = toRenderText(curr); 953 LayoutText* currText = toLayoutText(curr);
954 if (currText->lastTextBox()) 954 if (currText->lastTextBox())
955 return currText->lastTextBox(); 955 return currText->lastTextBox();
956 } 956 }
957 } 957 }
958 return 0; 958 return 0;
959 } 959 }
960 960
961 LayoutRect LayoutInline::culledInlineVisualOverflowBoundingBox() const 961 LayoutRect LayoutInline::culledInlineVisualOverflowBoundingBox() const
962 { 962 {
963 FloatRect floatResult; 963 FloatRect floatResult;
(...skipping 21 matching lines...) Expand all
985 } else if (curr->isLayoutInline()) { 985 } else if (curr->isLayoutInline()) {
986 // If the child doesn't need line boxes either, then we can recur. 986 // If the child doesn't need line boxes either, then we can recur.
987 LayoutInline* currInline = toLayoutInline(curr); 987 LayoutInline* currInline = toLayoutInline(curr);
988 if (!currInline->alwaysCreateLineBoxes()) 988 if (!currInline->alwaysCreateLineBoxes())
989 result.uniteIfNonZero(currInline->culledInlineVisualOverflowBoun dingBox()); 989 result.uniteIfNonZero(currInline->culledInlineVisualOverflowBoun dingBox());
990 else if (!currInline->hasSelfPaintingLayer()) 990 else if (!currInline->hasSelfPaintingLayer())
991 result.uniteIfNonZero(currInline->linesVisualOverflowBoundingBox ()); 991 result.uniteIfNonZero(currInline->linesVisualOverflowBoundingBox ());
992 } else if (curr->isText()) { 992 } else if (curr->isText()) {
993 // FIXME; Overflow from text boxes is lost. We will need to cache th is information in 993 // FIXME; Overflow from text boxes is lost. We will need to cache th is information in
994 // InlineTextBoxes. 994 // InlineTextBoxes.
995 RenderText* currText = toRenderText(curr); 995 LayoutText* currText = toLayoutText(curr);
996 result.uniteIfNonZero(currText->linesVisualOverflowBoundingBox()); 996 result.uniteIfNonZero(currText->linesVisualOverflowBoundingBox());
997 } 997 }
998 } 998 }
999 return result; 999 return result;
1000 } 1000 }
1001 1001
1002 LayoutRect LayoutInline::linesVisualOverflowBoundingBox() const 1002 LayoutRect LayoutInline::linesVisualOverflowBoundingBox() const
1003 { 1003 {
1004 if (!alwaysCreateLineBoxes()) 1004 if (!alwaysCreateLineBoxes())
1005 return culledInlineVisualOverflowBoundingBox(); 1005 return culledInlineVisualOverflowBoundingBox();
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 if (curr->isBox() && !curr->needsLayout()) { 1281 if (curr->isBox() && !curr->needsLayout()) {
1282 LayoutBox* currBox = toLayoutBox(curr); 1282 LayoutBox* currBox = toLayoutBox(curr);
1283 if (currBox->inlineBoxWrapper()) 1283 if (currBox->inlineBoxWrapper())
1284 currBox->inlineBoxWrapper()->root().markDirty(); 1284 currBox->inlineBoxWrapper()->root().markDirty();
1285 } else if (!curr->selfNeedsLayout()) { 1285 } else if (!curr->selfNeedsLayout()) {
1286 if (curr->isLayoutInline()) { 1286 if (curr->isLayoutInline()) {
1287 LayoutInline* currInline = toLayoutInline(curr); 1287 LayoutInline* currInline = toLayoutInline(curr);
1288 for (InlineFlowBox* childLine = currInline->firstLineBox(); childLine; childLine = childLine->nextLineBox()) 1288 for (InlineFlowBox* childLine = currInline->firstLineBox(); childLine; childLine = childLine->nextLineBox())
1289 childLine->root().markDirty(); 1289 childLine->root().markDirty();
1290 } else if (curr->isText()) { 1290 } else if (curr->isText()) {
1291 RenderText* currText = toRenderText(curr); 1291 LayoutText* currText = toLayoutText(curr);
1292 for (InlineTextBox* childText = currText->firstTextBox(); ch ildText; childText = childText->nextTextBox()) 1292 for (InlineTextBox* childText = currText->firstTextBox(); ch ildText; childText = childText->nextTextBox())
1293 childText->root().markDirty(); 1293 childText->root().markDirty();
1294 } 1294 }
1295 } 1295 }
1296 } 1296 }
1297 } else { 1297 } else {
1298 m_lineBoxes.dirtyLineBoxes(); 1298 m_lineBoxes.dirtyLineBoxes();
1299 } 1299 }
1300 } 1300 }
1301 1301
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 } 1456 }
1457 1457
1458 void LayoutInline::invalidateDisplayItemClients(DisplayItemList* displayItemList ) const 1458 void LayoutInline::invalidateDisplayItemClients(DisplayItemList* displayItemList ) const
1459 { 1459 {
1460 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList); 1460 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList);
1461 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1461 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1462 displayItemList->invalidate(box->displayItemClient()); 1462 displayItemList->invalidate(box->displayItemClient());
1463 } 1463 }
1464 1464
1465 } // namespace blink 1465 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutCounter.cpp ('k') | Source/core/layout/LayoutListBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698