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

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

Issue 14160005: Track the region where text is painted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase with TOT Created 7 years, 8 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
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 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 IntPoint textOrigin = IntPoint(marker.x(), marker.y() + style()->fontMetrics ().ascent()); 1280 IntPoint textOrigin = IntPoint(marker.x(), marker.y() + style()->fontMetrics ().ascent());
1281 1281
1282 if (type == Asterisks || type == Footnotes) 1282 if (type == Asterisks || type == Footnotes)
1283 context->drawText(font, textRun, textOrigin); 1283 context->drawText(font, textRun, textOrigin, marker);
1284 else { 1284 else {
1285 // Text is not arbitrary. We can judge whether it's RTL from the first c haracter, 1285 // 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. 1286 // and we only need to handle the direction RightToLeft for now.
1287 bool textNeedsReversing = direction(m_text[0]) == RightToLeft; 1287 bool textNeedsReversing = direction(m_text[0]) == RightToLeft;
1288 StringBuilder reversedText; 1288 StringBuilder reversedText;
1289 if (textNeedsReversing) { 1289 if (textNeedsReversing) {
1290 int length = m_text.length(); 1290 int length = m_text.length();
1291 reversedText.reserveCapacity(length); 1291 reversedText.reserveCapacity(length);
1292 for (int i = length - 1; i >= 0; --i) 1292 for (int i = length - 1; i >= 0; --i)
1293 reversedText.append(m_text[i]); 1293 reversedText.append(m_text[i]);
1294 textRun.setText(reversedText.characters(), length); 1294 textRun.setText(reversedText.characters(), length);
1295 } 1295 }
1296 1296
1297 const UChar suffix = listMarkerSuffix(type, m_listItem->value()); 1297 const UChar suffix = listMarkerSuffix(type, m_listItem->value());
1298 if (style()->isLeftToRightDirection()) { 1298 if (style()->isLeftToRightDirection()) {
1299 int width = font.width(textRun); 1299 int width = font.width(textRun);
1300 context->drawText(font, textRun, textOrigin); 1300 context->drawText(font, textRun, textOrigin, marker);
1301 UChar suffixSpace[2] = { suffix, ' ' }; 1301 UChar suffixSpace[2] = { suffix, ' ' };
1302 context->drawText(font, RenderBlock::constructTextRun(this, font, su ffixSpace, 2, style()), textOrigin + IntSize(width, 0)); 1302 context->drawText(font, RenderBlock::constructTextRun(this, font, su ffixSpace, 2, style()), textOrigin + IntSize(width, 0), marker);
1303 } else { 1303 } else {
1304 UChar spaceSuffix[2] = { ' ', suffix }; 1304 UChar spaceSuffix[2] = { ' ', suffix };
1305 TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, s paceSuffix, 2, style()); 1305 TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, s paceSuffix, 2, style());
1306 int width = font.width(spaceSuffixRun); 1306 int width = font.width(spaceSuffixRun);
1307 context->drawText(font, spaceSuffixRun, textOrigin); 1307 context->drawText(font, spaceSuffixRun, textOrigin, marker);
1308 context->drawText(font, textRun, textOrigin + IntSize(width, 0)); 1308 context->drawText(font, textRun, textOrigin + IntSize(width, 0), mar ker);
1309 } 1309 }
1310 } 1310 }
1311 } 1311 }
1312 1312
1313 void RenderListMarker::layout() 1313 void RenderListMarker::layout()
1314 { 1314 {
1315 StackStats::LayoutCheckPoint layoutCheckPoint; 1315 StackStats::LayoutCheckPoint layoutCheckPoint;
1316 ASSERT(needsLayout()); 1316 ASSERT(needsLayout());
1317 1317
1318 if (isImage()) { 1318 if (isImage()) {
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 void RenderListMarker::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con st 1840 void RenderListMarker::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con st
1841 { 1841 {
1842 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ; 1842 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ;
1843 RenderBox::reportMemoryUsage(memoryObjectInfo); 1843 RenderBox::reportMemoryUsage(memoryObjectInfo);
1844 info.addMember(m_text, "text"); 1844 info.addMember(m_text, "text");
1845 info.addMember(m_image, "image"); 1845 info.addMember(m_image, "image");
1846 info.addMember(m_listItem, "listItem"); 1846 info.addMember(m_listItem, "listItem");
1847 } 1847 }
1848 1848
1849 } // namespace WebCore 1849 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698