| OLD | NEW |
| 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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 if (!style()->isHorizontalWritingMode()) { | 1270 if (!style()->isHorizontalWritingMode()) { |
| 1271 marker.moveBy(roundedIntPoint(-boxOrigin)); | 1271 marker.moveBy(roundedIntPoint(-boxOrigin)); |
| 1272 marker = marker.transposedRect(); | 1272 marker = marker.transposedRect(); |
| 1273 marker.moveBy(IntPoint(roundToInt(box.x()), roundToInt(box.y() - logical
Height()))); | 1273 marker.moveBy(IntPoint(roundToInt(box.x()), roundToInt(box.y() - logical
Height()))); |
| 1274 stateSaver.save(); | 1274 stateSaver.save(); |
| 1275 context->translate(marker.x(), marker.maxY()); | 1275 context->translate(marker.x(), marker.maxY()); |
| 1276 context->rotate(static_cast<float>(deg2rad(90.))); | 1276 context->rotate(static_cast<float>(deg2rad(90.))); |
| 1277 context->translate(-marker.x(), -marker.maxY()); | 1277 context->translate(-marker.x(), -marker.maxY()); |
| 1278 } | 1278 } |
| 1279 | 1279 |
| 1280 TextRunPaintInfo textRunPaintInfo(textRun); |
| 1281 textRunPaintInfo.bounds = marker; |
| 1280 IntPoint textOrigin = IntPoint(marker.x(), marker.y() + style()->fontMetrics
().ascent()); | 1282 IntPoint textOrigin = IntPoint(marker.x(), marker.y() + style()->fontMetrics
().ascent()); |
| 1281 | 1283 |
| 1282 if (type == Asterisks || type == Footnotes) | 1284 if (type == Asterisks || type == Footnotes) { |
| 1283 context->drawText(font, textRun, textOrigin); | 1285 context->drawText(font, textRunPaintInfo, textOrigin); |
| 1286 } |
| 1284 else { | 1287 else { |
| 1285 // Text is not arbitrary. We can judge whether it's RTL from the first c
haracter, | 1288 // Text is not arbitrary. We can judge whether it's RTL from the first c
haracter, |
| 1286 // and we only need to handle the direction RightToLeft for now. | 1289 // and we only need to handle the direction RightToLeft for now. |
| 1287 bool textNeedsReversing = direction(m_text[0]) == RightToLeft; | 1290 bool textNeedsReversing = direction(m_text[0]) == RightToLeft; |
| 1288 StringBuilder reversedText; | 1291 StringBuilder reversedText; |
| 1289 if (textNeedsReversing) { | 1292 if (textNeedsReversing) { |
| 1290 int length = m_text.length(); | 1293 int length = m_text.length(); |
| 1291 reversedText.reserveCapacity(length); | 1294 reversedText.reserveCapacity(length); |
| 1292 for (int i = length - 1; i >= 0; --i) | 1295 for (int i = length - 1; i >= 0; --i) |
| 1293 reversedText.append(m_text[i]); | 1296 reversedText.append(m_text[i]); |
| 1294 textRun.setText(reversedText.characters(), length); | 1297 textRun.setText(reversedText.characters(), length); |
| 1295 } | 1298 } |
| 1296 | 1299 |
| 1297 const UChar suffix = listMarkerSuffix(type, m_listItem->value()); | 1300 const UChar suffix = listMarkerSuffix(type, m_listItem->value()); |
| 1298 if (style()->isLeftToRightDirection()) { | 1301 if (style()->isLeftToRightDirection()) { |
| 1299 int width = font.width(textRun); | 1302 context->drawText(font, textRunPaintInfo, textOrigin); |
| 1300 context->drawText(font, textRun, textOrigin); | 1303 |
| 1301 UChar suffixSpace[2] = { suffix, ' ' }; | 1304 UChar suffixSpace[2] = { suffix, ' ' }; |
| 1302 context->drawText(font, RenderBlock::constructTextRun(this, font, su
ffixSpace, 2, style()), textOrigin + IntSize(width, 0)); | 1305 TextRun suffixRun = RenderBlock::constructTextRun(this, font, suffix
Space, 2, style()); |
| 1306 TextRunPaintInfo suffixRunInfo(suffixRun); |
| 1307 suffixRunInfo.bounds = marker; |
| 1308 context->drawText(font, suffixRunInfo, textOrigin + IntSize(font.wid
th(textRun), 0)); |
| 1303 } else { | 1309 } else { |
| 1304 UChar spaceSuffix[2] = { ' ', suffix }; | 1310 UChar spaceSuffix[2] = { ' ', suffix }; |
| 1305 TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, s
paceSuffix, 2, style()); | 1311 TextRun suffixRun = RenderBlock::constructTextRun(this, font, spaceS
uffix, 2, style()); |
| 1306 int width = font.width(spaceSuffixRun); | 1312 TextRunPaintInfo suffixRunInfo(suffixRun); |
| 1307 context->drawText(font, spaceSuffixRun, textOrigin); | 1313 suffixRunInfo.bounds = marker; |
| 1308 context->drawText(font, textRun, textOrigin + IntSize(width, 0)); | 1314 context->drawText(font, suffixRunInfo, textOrigin); |
| 1315 |
| 1316 context->drawText(font, textRunPaintInfo, textOrigin + IntSize(font.
width(suffixRun), 0)); |
| 1309 } | 1317 } |
| 1310 } | 1318 } |
| 1311 } | 1319 } |
| 1312 | 1320 |
| 1313 void RenderListMarker::layout() | 1321 void RenderListMarker::layout() |
| 1314 { | 1322 { |
| 1315 StackStats::LayoutCheckPoint layoutCheckPoint; | 1323 StackStats::LayoutCheckPoint layoutCheckPoint; |
| 1316 ASSERT(needsLayout()); | 1324 ASSERT(needsLayout()); |
| 1317 | 1325 |
| 1318 if (isImage()) { | 1326 if (isImage()) { |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 void RenderListMarker::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
st | 1849 void RenderListMarker::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
st |
| 1842 { | 1850 { |
| 1843 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering)
; | 1851 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering)
; |
| 1844 RenderBox::reportMemoryUsage(memoryObjectInfo); | 1852 RenderBox::reportMemoryUsage(memoryObjectInfo); |
| 1845 info.addMember(m_text, "text"); | 1853 info.addMember(m_text, "text"); |
| 1846 info.addMember(m_image, "image"); | 1854 info.addMember(m_image, "image"); |
| 1847 info.addMember(m_listItem, "listItem"); | 1855 info.addMember(m_listItem, "listItem"); |
| 1848 } | 1856 } |
| 1849 | 1857 |
| 1850 } // namespace WebCore | 1858 } // namespace WebCore |
| OLD | NEW |