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

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

Issue 414863002: Minimize RenderObject* casting to RenderText* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 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
« no previous file with comments | « Source/core/page/TouchAdjustment.cpp ('k') | Source/core/rendering/InlineTextBox.h » ('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) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 endPlacingBoxRangesInInlineDirection(startLogicalLeft, logicalLeft, minLogic alLeft, maxLogicalRight); 374 endPlacingBoxRangesInInlineDirection(startLogicalLeft, logicalLeft, minLogic alLeft, maxLogicalRight);
375 return logicalLeft; 375 return logicalLeft;
376 } 376 }
377 377
378 float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inlin eBox* lastChild, 378 float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inlin eBox* lastChild,
379 float& logicalLeft, float& minLogicalLeft, float& maxLogicalRight, bool& nee dsWordSpacing) 379 float& logicalLeft, float& minLogicalLeft, float& maxLogicalRight, bool& nee dsWordSpacing)
380 { 380 {
381 for (InlineBox* curr = firstChild; curr && curr != lastChild; curr = curr->n extOnLine()) { 381 for (InlineBox* curr = firstChild; curr && curr != lastChild; curr = curr->n extOnLine()) {
382 if (curr->renderer().isText()) { 382 if (curr->renderer().isText()) {
383 InlineTextBox* text = toInlineTextBox(curr); 383 InlineTextBox* text = toInlineTextBox(curr);
384 RenderText& rt = toRenderText(text->renderer()); 384 RenderText& rt = text->renderer();
385 if (rt.textLength()) { 385 if (rt.textLength()) {
386 if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->st art()))) 386 if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->st art())))
387 logicalLeft += rt.style(isFirstLineStyle())->font().fontDesc ription().wordSpacing(); 387 logicalLeft += rt.style(isFirstLineStyle())->font().fontDesc ription().wordSpacing();
388 needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end()) ); 388 needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end()) );
389 } 389 }
390 text->setLogicalLeft(logicalLeft); 390 text->setLogicalLeft(logicalLeft);
391 if (knownToHaveNoOverflow()) 391 if (knownToHaveNoOverflow())
392 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); 392 minLogicalLeft = std::min(logicalLeft, minLogicalLeft);
393 logicalLeft += text->logicalWidth(); 393 logicalLeft += text->logicalWidth();
394 if (knownToHaveNoOverflow()) 394 if (knownToHaveNoOverflow())
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 addBoxShadowVisualOverflow(logicalVisualOverflow); 949 addBoxShadowVisualOverflow(logicalVisualOverflow);
950 addBorderOutsetVisualOverflow(logicalVisualOverflow); 950 addBorderOutsetVisualOverflow(logicalVisualOverflow);
951 addOutlineVisualOverflow(logicalVisualOverflow); 951 addOutlineVisualOverflow(logicalVisualOverflow);
952 952
953 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 953 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
954 if (curr->renderer().isOutOfFlowPositioned()) 954 if (curr->renderer().isOutOfFlowPositioned())
955 continue; // Positioned placeholders don't affect calculations. 955 continue; // Positioned placeholders don't affect calculations.
956 956
957 if (curr->renderer().isText()) { 957 if (curr->renderer().isText()) {
958 InlineTextBox* text = toInlineTextBox(curr); 958 InlineTextBox* text = toInlineTextBox(curr);
959 RenderText& rt = toRenderText(text->renderer()); 959 RenderText& rt = text->renderer();
960 if (rt.isBR()) 960 if (rt.isBR())
961 continue; 961 continue;
962 LayoutRect textBoxOverflow(enclosingLayoutRect(text->logicalFrameRec t())); 962 LayoutRect textBoxOverflow(enclosingLayoutRect(text->logicalFrameRec t()));
963 addTextBoxVisualOverflow(text, textBoxDataMap, textBoxOverflow); 963 addTextBoxVisualOverflow(text, textBoxDataMap, textBoxOverflow);
964 logicalVisualOverflow.unite(textBoxOverflow); 964 logicalVisualOverflow.unite(textBoxOverflow);
965 } else if (curr->renderer().isRenderInline()) { 965 } else if (curr->renderer().isRenderInline()) {
966 InlineFlowBox* flow = toInlineFlowBox(curr); 966 InlineFlowBox* flow = toInlineFlowBox(curr);
967 flow->computeOverflow(lineTop, lineBottom, textBoxDataMap); 967 flow->computeOverflow(lineTop, lineBottom, textBoxDataMap);
968 if (!flow->boxModelObject()->hasSelfPaintingLayer()) 968 if (!flow->boxModelObject()->hasSelfPaintingLayer())
969 logicalVisualOverflow.unite(flow->logicalVisualOverflowRect(line Top, lineBottom)); 969 logicalVisualOverflow.unite(flow->logicalVisualOverflowRect(line Top, lineBottom));
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 ASSERT(child->prevOnLine() == prev); 1665 ASSERT(child->prevOnLine() == prev);
1666 prev = child; 1666 prev = child;
1667 } 1667 }
1668 ASSERT(prev == m_lastChild); 1668 ASSERT(prev == m_lastChild);
1669 #endif 1669 #endif
1670 } 1670 }
1671 1671
1672 #endif 1672 #endif
1673 1673
1674 } // namespace blink 1674 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/TouchAdjustment.cpp ('k') | Source/core/rendering/InlineTextBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698