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

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

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No reference reassignment. 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 * 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { 552 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
553 if (curr->isFloatingOrOutOfFlowPositioned()) 553 if (curr->isFloatingOrOutOfFlowPositioned())
554 continue; 554 continue;
555 555
556 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block 556 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block
557 // direction (aligned to the root box's baseline). 557 // direction (aligned to the root box's baseline).
558 if (curr->isBox()) { 558 if (curr->isBox()) {
559 RenderBox* currBox = toRenderBox(curr); 559 RenderBox* currBox = toRenderBox(curr);
560 if (currBox->inlineBoxWrapper()) { 560 if (currBox->inlineBoxWrapper()) {
561 RootInlineBox* rootBox = currBox->inlineBoxWrapper()->root(); 561 RootInlineBox* rootBox = currBox->inlineBoxWrapper()->root();
562 int logicalTop = rootBox->logicalTop() + (rootBox->renderer()->s tyle(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->st yle(rootBox->isFirstLineStyle())->font().fontMetrics().ascent()); 562 int logicalTop = rootBox->logicalTop() + (rootBox->renderer().st yle(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->sty le(rootBox->isFirstLineStyle())->font().fontMetrics().ascent());
563 int logicalHeight = container->style(rootBox->isFirstLineStyle() )->font().fontMetrics().height(); 563 int logicalHeight = container->style(rootBox->isFirstLineStyle() )->font().fontMetrics().height();
564 if (isHorizontal) 564 if (isHorizontal)
565 yield(FloatRect(currBox->inlineBoxWrapper()->x() - currBox-> marginLeft(), logicalTop, currBox->width() + currBox->marginWidth(), logicalHeig ht)); 565 yield(FloatRect(currBox->inlineBoxWrapper()->x() - currBox-> marginLeft(), logicalTop, currBox->width() + currBox->marginWidth(), logicalHeig ht));
566 else 566 else
567 yield(FloatRect(logicalTop, currBox->inlineBoxWrapper()->y() - currBox->marginTop(), logicalHeight, currBox->height() + currBox->marginHeigh t())); 567 yield(FloatRect(logicalTop, currBox->inlineBoxWrapper()->y() - currBox->marginTop(), logicalHeight, currBox->height() + currBox->marginHeigh t()));
568 } 568 }
569 } else if (curr->isRenderInline()) { 569 } else if (curr->isRenderInline()) {
570 // If the child doesn't need line boxes either, then we can recur. 570 // If the child doesn't need line boxes either, then we can recur.
571 RenderInline* currInline = toRenderInline(curr); 571 RenderInline* currInline = toRenderInline(curr);
572 if (!currInline->alwaysCreateLineBoxes()) 572 if (!currInline->alwaysCreateLineBoxes())
573 currInline->generateCulledLineBoxRects(yield, container); 573 currInline->generateCulledLineBoxRects(yield, container);
574 else { 574 else {
575 for (InlineFlowBox* childLine = currInline->firstLineBox(); chil dLine; childLine = childLine->nextLineBox()) { 575 for (InlineFlowBox* childLine = currInline->firstLineBox(); chil dLine; childLine = childLine->nextLineBox()) {
576 RootInlineBox* rootBox = childLine->root(); 576 RootInlineBox* rootBox = childLine->root();
577 int logicalTop = rootBox->logicalTop() + (rootBox->renderer( )->style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container ->style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent()); 577 int logicalTop = rootBox->logicalTop() + (rootBox->renderer( ).style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container- >style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent());
578 int logicalHeight = container->style(rootBox->isFirstLineSty le())->font().fontMetrics().height(); 578 int logicalHeight = container->style(rootBox->isFirstLineSty le())->font().fontMetrics().height();
579 if (isHorizontal) 579 if (isHorizontal)
580 yield(FloatRect(childLine->x() - childLine->marginLogica lLeft(), 580 yield(FloatRect(childLine->x() - childLine->marginLogica lLeft(),
581 logicalTop, 581 logicalTop,
582 childLine->logicalWidth() + childLine->marginLogical Left() + childLine->marginLogicalRight(), 582 childLine->logicalWidth() + childLine->marginLogical Left() + childLine->marginLogicalRight(),
583 logicalHeight)); 583 logicalHeight));
584 else 584 else
585 yield(FloatRect(logicalTop, 585 yield(FloatRect(logicalTop,
586 childLine->y() - childLine->marginLogicalLeft(), 586 childLine->y() - childLine->marginLogicalLeft(),
587 logicalHeight, 587 logicalHeight,
588 childLine->logicalWidth() + childLine->marginLogical Left() + childLine->marginLogicalRight())); 588 childLine->logicalWidth() + childLine->marginLogical Left() + childLine->marginLogicalRight()));
589 } 589 }
590 } 590 }
591 } else if (curr->isText()) { 591 } else if (curr->isText()) {
592 RenderText* currText = toRenderText(curr); 592 RenderText* currText = toRenderText(curr);
593 for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) { 593 for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) {
594 RootInlineBox* rootBox = childText->root(); 594 RootInlineBox* rootBox = childText->root();
595 int logicalTop = rootBox->logicalTop() + (rootBox->renderer()->s tyle(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->st yle(rootBox->isFirstLineStyle())->font().fontMetrics().ascent()); 595 int logicalTop = rootBox->logicalTop() + (rootBox->renderer().st yle(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->sty le(rootBox->isFirstLineStyle())->font().fontMetrics().ascent());
596 int logicalHeight = container->style(rootBox->isFirstLineStyle() )->font().fontMetrics().height(); 596 int logicalHeight = container->style(rootBox->isFirstLineStyle() )->font().fontMetrics().height();
597 if (isHorizontal) 597 if (isHorizontal)
598 yield(FloatRect(childText->x(), logicalTop, childText->logic alWidth(), logicalHeight)); 598 yield(FloatRect(childText->x(), logicalTop, childText->logic alWidth(), logicalHeight));
599 else 599 else
600 yield(FloatRect(logicalTop, childText->y(), logicalHeight, c hildText->logicalWidth())); 600 yield(FloatRect(logicalTop, childText->y(), logicalHeight, c hildText->logicalWidth()));
601 } 601 }
602 } 602 }
603 } 603 }
604 } 604 }
605 605
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 m_lineBoxes.dirtyLineBoxes(); 1263 m_lineBoxes.dirtyLineBoxes();
1264 } 1264 }
1265 1265
1266 void RenderInline::deleteLineBoxTree() 1266 void RenderInline::deleteLineBoxTree()
1267 { 1267 {
1268 m_lineBoxes.deleteLineBoxTree(); 1268 m_lineBoxes.deleteLineBoxTree();
1269 } 1269 }
1270 1270
1271 InlineFlowBox* RenderInline::createInlineFlowBox() 1271 InlineFlowBox* RenderInline::createInlineFlowBox()
1272 { 1272 {
1273 return new InlineFlowBox(this); 1273 return new InlineFlowBox(*this);
1274 } 1274 }
1275 1275
1276 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() 1276 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox()
1277 { 1277 {
1278 setAlwaysCreateLineBoxes(); 1278 setAlwaysCreateLineBoxes();
1279 InlineFlowBox* flowBox = createInlineFlowBox(); 1279 InlineFlowBox* flowBox = createInlineFlowBox();
1280 m_lineBoxes.appendLineBox(flowBox); 1280 m_lineBoxes.appendLineBox(flowBox);
1281 return flowBox; 1281 return flowBox;
1282 } 1282 }
1283 1283
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 container = this; 1572 container = this;
1573 1573
1574 FloatPoint absPos = container->localToAbsolute(); 1574 FloatPoint absPos = container->localToAbsolute();
1575 region.bounds.setX(absPos.x() + region.bounds.x()); 1575 region.bounds.setX(absPos.x() + region.bounds.x());
1576 region.bounds.setY(absPos.y() + region.bounds.y()); 1576 region.bounds.setY(absPos.y() + region.bounds.y());
1577 1577
1578 regions.append(region); 1578 regions.append(region);
1579 } 1579 }
1580 1580
1581 } // namespace WebCore 1581 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderDeprecatedFlexibleBox.cpp ('k') | Source/core/rendering/RenderListMarker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698