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

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

Issue 397723006: Move RenderBlockFlow::constructTextRun out. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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/rendering/RenderListBox.cpp ('k') | Source/core/rendering/RenderText.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 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com) 6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com)
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 11 matching lines...) Expand all
22 * 22 *
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #include "core/rendering/RenderListMarker.h" 26 #include "core/rendering/RenderListMarker.h"
27 27
28 #include "core/fetch/ImageResource.h" 28 #include "core/fetch/ImageResource.h"
29 #include "core/rendering/GraphicsContextAnnotator.h" 29 #include "core/rendering/GraphicsContextAnnotator.h"
30 #include "core/rendering/RenderLayer.h" 30 #include "core/rendering/RenderLayer.h"
31 #include "core/rendering/RenderListItem.h" 31 #include "core/rendering/RenderListItem.h"
32 #include "core/rendering/RenderView.h" 32 #include "core/rendering/TextRunConstructor.h"
33 #include "platform/fonts/Font.h" 33 #include "platform/fonts/Font.h"
34 #include "platform/graphics/GraphicsContextStateSaver.h" 34 #include "platform/graphics/GraphicsContextStateSaver.h"
35 #include "wtf/text/StringBuilder.h" 35 #include "wtf/text/StringBuilder.h"
36 #include "wtf/unicode/CharacterNames.h" 36 #include "wtf/unicode/CharacterNames.h"
37 37
38 using namespace WTF; 38 using namespace WTF;
39 using namespace Unicode; 39 using namespace Unicode;
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 case UpperRoman: 1255 case UpperRoman:
1256 case Urdu: 1256 case Urdu:
1257 case Asterisks: 1257 case Asterisks:
1258 case Footnotes: 1258 case Footnotes:
1259 break; 1259 break;
1260 } 1260 }
1261 if (m_text.isEmpty()) 1261 if (m_text.isEmpty())
1262 return; 1262 return;
1263 1263
1264 const Font& font = style()->font(); 1264 const Font& font = style()->font();
1265 TextRun textRun = RenderBlockFlow::constructTextRun(this, font, m_text, styl e()); 1265 TextRun textRun = constructTextRun(this, font, m_text, style());
1266 1266
1267 GraphicsContextStateSaver stateSaver(*context, false); 1267 GraphicsContextStateSaver stateSaver(*context, false);
1268 if (!style()->isHorizontalWritingMode()) { 1268 if (!style()->isHorizontalWritingMode()) {
1269 marker.moveBy(roundedIntPoint(-boxOrigin)); 1269 marker.moveBy(roundedIntPoint(-boxOrigin));
1270 marker = marker.transposedRect(); 1270 marker = marker.transposedRect();
1271 marker.moveBy(IntPoint(roundToInt(box.x()), roundToInt(box.y() - logical Height()))); 1271 marker.moveBy(IntPoint(roundToInt(box.x()), roundToInt(box.y() - logical Height())));
1272 stateSaver.save(); 1272 stateSaver.save();
1273 context->translate(marker.x(), marker.maxY()); 1273 context->translate(marker.x(), marker.maxY());
1274 context->rotate(static_cast<float>(deg2rad(90.))); 1274 context->rotate(static_cast<float>(deg2rad(90.)));
1275 context->translate(-marker.x(), -marker.maxY()); 1275 context->translate(-marker.x(), -marker.maxY());
(...skipping 18 matching lines...) Expand all
1294 reversedText.append(m_text[i]); 1294 reversedText.append(m_text[i]);
1295 ASSERT(reversedText.length() == reversedText.capacity()); 1295 ASSERT(reversedText.length() == reversedText.capacity());
1296 textRun.setText(reversedText.toString()); 1296 textRun.setText(reversedText.toString());
1297 } 1297 }
1298 1298
1299 const UChar suffix = listMarkerSuffix(type, m_listItem->value()); 1299 const UChar suffix = listMarkerSuffix(type, m_listItem->value());
1300 UChar suffixStr[2] = { 1300 UChar suffixStr[2] = {
1301 style()->isLeftToRightDirection() ? suffix : ' ', 1301 style()->isLeftToRightDirection() ? suffix : ' ',
1302 style()->isLeftToRightDirection() ? ' ' : suffix 1302 style()->isLeftToRightDirection() ? ' ' : suffix
1303 }; 1303 };
1304 TextRun suffixRun = RenderBlockFlow::constructTextRun(this, font, suffix Str, 2, style(), style()->direction()); 1304 TextRun suffixRun = constructTextRun(this, font, suffixStr, 2, style(), style()->direction());
1305 TextRunPaintInfo suffixRunInfo(suffixRun); 1305 TextRunPaintInfo suffixRunInfo(suffixRun);
1306 suffixRunInfo.bounds = marker; 1306 suffixRunInfo.bounds = marker;
1307 1307
1308 if (style()->isLeftToRightDirection()) { 1308 if (style()->isLeftToRightDirection()) {
1309 context->drawText(font, textRunPaintInfo, textOrigin); 1309 context->drawText(font, textRunPaintInfo, textOrigin);
1310 context->drawText(font, suffixRunInfo, textOrigin + IntSize(font.wid th(textRun), 0)); 1310 context->drawText(font, suffixRunInfo, textOrigin + IntSize(font.wid th(textRun), 0));
1311 } else { 1311 } else {
1312 context->drawText(font, suffixRunInfo, textOrigin); 1312 context->drawText(font, suffixRunInfo, textOrigin);
1313 context->drawText(font, textRunPaintInfo, textOrigin + IntSize(font. width(suffixRun), 0)); 1313 context->drawText(font, textRunPaintInfo, textOrigin + IntSize(font. width(suffixRun), 0));
1314 } 1314 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 case UpperHexadecimal: 1571 case UpperHexadecimal:
1572 case UpperLatin: 1572 case UpperLatin:
1573 case UpperNorwegian: 1573 case UpperNorwegian:
1574 case UpperRoman: 1574 case UpperRoman:
1575 case Urdu: 1575 case Urdu:
1576 if (m_text.isEmpty()) 1576 if (m_text.isEmpty())
1577 logicalWidth = 0; 1577 logicalWidth = 0;
1578 else { 1578 else {
1579 LayoutUnit itemWidth = font.width(m_text); 1579 LayoutUnit itemWidth = font.width(m_text);
1580 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->valu e()), ' ' }; 1580 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->valu e()), ' ' };
1581 LayoutUnit suffixSpaceWidth = font.width(RenderBlockFlow::constr uctTextRun(this, font, suffixSpace, 2, style(), style()->direction())); 1581 LayoutUnit suffixSpaceWidth = font.width(constructTextRun(this, font, suffixSpace, 2, style(), style()->direction()));
1582 logicalWidth = itemWidth + suffixSpaceWidth; 1582 logicalWidth = itemWidth + suffixSpaceWidth;
1583 } 1583 }
1584 break; 1584 break;
1585 } 1585 }
1586 1586
1587 m_minPreferredLogicalWidth = logicalWidth; 1587 m_minPreferredLogicalWidth = logicalWidth;
1588 m_maxPreferredLogicalWidth = logicalWidth; 1588 m_maxPreferredLogicalWidth = logicalWidth;
1589 1589
1590 clearPreferredLogicalWidthsDirty(); 1590 clearPreferredLogicalWidthsDirty();
1591 1591
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1797 case UpperHexadecimal: 1797 case UpperHexadecimal:
1798 case UpperLatin: 1798 case UpperLatin:
1799 case UpperNorwegian: 1799 case UpperNorwegian:
1800 case UpperRoman: 1800 case UpperRoman:
1801 case Urdu: 1801 case Urdu:
1802 if (m_text.isEmpty()) 1802 if (m_text.isEmpty())
1803 return IntRect(); 1803 return IntRect();
1804 const Font& font = style()->font(); 1804 const Font& font = style()->font();
1805 int itemWidth = font.width(m_text); 1805 int itemWidth = font.width(m_text);
1806 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()) , ' ' }; 1806 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()) , ' ' };
1807 int suffixSpaceWidth = font.width(RenderBlockFlow::constructTextRun( this, font, suffixSpace, 2, style(), style()->direction())); 1807 int suffixSpaceWidth = font.width(constructTextRun(this, font, suffi xSpace, 2, style(), style()->direction()));
1808 relativeRect = IntRect(0, 0, itemWidth + suffixSpaceWidth, font.font Metrics().height()); 1808 relativeRect = IntRect(0, 0, itemWidth + suffixSpaceWidth, font.font Metrics().height());
1809 } 1809 }
1810 1810
1811 if (!style()->isHorizontalWritingMode()) { 1811 if (!style()->isHorizontalWritingMode()) {
1812 relativeRect = relativeRect.transposedRect(); 1812 relativeRect = relativeRect.transposedRect();
1813 relativeRect.setX(width() - relativeRect.x() - relativeRect.width()); 1813 relativeRect.setX(width() - relativeRect.x() - relativeRect.width());
1814 } 1814 }
1815 1815
1816 return relativeRect; 1816 return relativeRect;
1817 } 1817 }
(...skipping 19 matching lines...) Expand all
1837 1837
1838 if (clipToVisibleContent) 1838 if (clipToVisibleContent)
1839 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect); 1839 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect);
1840 else 1840 else
1841 rect = localToContainerQuad(FloatRect(rect), paintInvalidationContainer) .enclosingBoundingBox(); 1841 rect = localToContainerQuad(FloatRect(rect), paintInvalidationContainer) .enclosingBoundingBox();
1842 1842
1843 return rect; 1843 return rect;
1844 } 1844 }
1845 1845
1846 } // namespace WebCore 1846 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderListBox.cpp ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698