Changeset 139891 in webkit
- Timestamp:
- Jan 16, 2013 10:02:46 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r139890 r139891 1 2013-01-16 Ojan Vafai <ojan@chromium.org> 2 3 RenderListMarker::computePreferredLogicalWidth should not be public 4 https://bugs.webkit.org/show_bug.cgi?id=106956 5 6 Reviewed by Tony Chang. 7 8 RenderListItem was calling computePreferredLogicalWidths for the side 9 effects of updating the marker content and margins. Instead, call 10 updateMarginsAndContent directly. 11 12 * rendering/RenderListItem.cpp: 13 (WebCore::RenderListItem::updateMarkerLocation): 14 * rendering/RenderListMarker.cpp: 15 (WebCore::RenderListMarker::layout): 16 The isImage() codepath never calls computePreferredLogicalWidths, so we need to make 17 sure the content and margins are updated. 18 19 (WebCore::RenderListMarker::updateContent): 20 (WebCore::RenderListMarker::computePreferredLogicalWidths): 21 (WebCore::RenderListMarker::updateMarginsAndContent): 22 * rendering/RenderListMarker.h: 23 1 24 2013-01-16 Claudio Saavedra <csaavedra@igalia.com> 2 25 -
trunk/Source/WebCore/rendering/RenderListItem.cpp
r139693 r139891 266 266 lineBoxParent = this; 267 267 lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent)); 268 if (m_marker->preferredLogicalWidthsDirty()) 269 m_marker->computePreferredLogicalWidths(); 268 m_marker->updateMarginsAndContent(); 270 269 // If markerPar is an anonymous block that has lost all its children, destroy it. 271 270 if (markerPar && markerPar->isAnonymousBlock() && !markerPar->firstChild() && !toRenderBlock(markerPar)->continuation()) -
trunk/Source/WebCore/rendering/RenderListMarker.cpp
r139789 r139891 1319 1319 1320 1320 if (isImage()) { 1321 updateMarginsAndContent(); 1321 1322 setWidth(m_image->imageSize(this, style()->effectiveZoom()).width()); 1322 1323 setHeight(m_image->imageSize(this, style()->effectiveZoom()).height()); … … 1351 1352 } 1352 1353 1353 void RenderListMarker::computePreferredLogicalWidths() 1354 { 1355 ASSERT(preferredLogicalWidthsDirty()); 1354 void RenderListMarker::updateMarginsAndContent() 1355 { 1356 updateContent(); 1357 updateMargins(); 1358 } 1359 1360 void RenderListMarker::updateContent() 1361 { 1362 // FIXME: This if-statement is just a performance optimization, but it's messy to use the preferredLogicalWidths dirty bit for this. 1363 // It's unclear if this is a premature optimization. 1364 if (!preferredLogicalWidthsDirty()) 1365 return; 1356 1366 1357 1367 m_text = ""; 1358 1359 const Font& font = style()->font();1360 const FontMetrics& fontMetrics = font.fontMetrics();1361 1368 1362 1369 if (isImage()) { 1363 1370 // FIXME: This is a somewhat arbitrary width. Generated images for markers really won't become particularly useful 1364 1371 // until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box. 1365 int bulletWidth = fontMetrics.ascent() / 2;1372 int bulletWidth = style()->fontMetrics().ascent() / 2; 1366 1373 m_image->setContainerSizeForRenderer(this, IntSize(bulletWidth, bulletWidth), style()->effectiveZoom()); 1374 return; 1375 } 1376 1377 EListStyleType type = style()->listStyleType(); 1378 switch (type) { 1379 case NoneListStyle: 1380 break; 1381 case Circle: 1382 case Disc: 1383 case Square: 1384 m_text = listMarkerText(type, 0); // value is ignored for these types 1385 break; 1386 case Asterisks: 1387 case Footnotes: 1388 case Afar: 1389 case Amharic: 1390 case AmharicAbegede: 1391 case ArabicIndic: 1392 case Armenian: 1393 case BinaryListStyle: 1394 case Bengali: 1395 case Cambodian: 1396 case CJKIdeographic: 1397 case CjkEarthlyBranch: 1398 case CjkHeavenlyStem: 1399 case DecimalLeadingZero: 1400 case DecimalListStyle: 1401 case Devanagari: 1402 case Ethiopic: 1403 case EthiopicAbegede: 1404 case EthiopicAbegedeAmEt: 1405 case EthiopicAbegedeGez: 1406 case EthiopicAbegedeTiEr: 1407 case EthiopicAbegedeTiEt: 1408 case EthiopicHalehameAaEr: 1409 case EthiopicHalehameAaEt: 1410 case EthiopicHalehameAmEt: 1411 case EthiopicHalehameGez: 1412 case EthiopicHalehameOmEt: 1413 case EthiopicHalehameSidEt: 1414 case EthiopicHalehameSoEt: 1415 case EthiopicHalehameTiEr: 1416 case EthiopicHalehameTiEt: 1417 case EthiopicHalehameTig: 1418 case Georgian: 1419 case Gujarati: 1420 case Gurmukhi: 1421 case Hangul: 1422 case HangulConsonant: 1423 case Hebrew: 1424 case Hiragana: 1425 case HiraganaIroha: 1426 case Kannada: 1427 case Katakana: 1428 case KatakanaIroha: 1429 case Khmer: 1430 case Lao: 1431 case LowerAlpha: 1432 case LowerArmenian: 1433 case LowerGreek: 1434 case LowerHexadecimal: 1435 case LowerLatin: 1436 case LowerNorwegian: 1437 case LowerRoman: 1438 case Malayalam: 1439 case Mongolian: 1440 case Myanmar: 1441 case Octal: 1442 case Oriya: 1443 case Oromo: 1444 case Persian: 1445 case Sidama: 1446 case Somali: 1447 case Telugu: 1448 case Thai: 1449 case Tibetan: 1450 case Tigre: 1451 case TigrinyaEr: 1452 case TigrinyaErAbegede: 1453 case TigrinyaEt: 1454 case TigrinyaEtAbegede: 1455 case UpperAlpha: 1456 case UpperArmenian: 1457 case UpperGreek: 1458 case UpperHexadecimal: 1459 case UpperLatin: 1460 case UpperNorwegian: 1461 case UpperRoman: 1462 case Urdu: 1463 m_text = listMarkerText(type, m_listItem->value()); 1464 break; 1465 } 1466 } 1467 1468 void RenderListMarker::computePreferredLogicalWidths() 1469 { 1470 ASSERT(preferredLogicalWidthsDirty()); 1471 updateContent(); 1472 1473 if (isImage()) { 1367 1474 LayoutSize imageSize = m_image->imageSize(this, style()->effectiveZoom()); 1368 1475 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = style()->isHorizontalWritingMode() ? imageSize.width() : imageSize.height(); … … 1371 1478 return; 1372 1479 } 1480 1481 const Font& font = style()->font(); 1373 1482 1374 1483 LayoutUnit logicalWidth = 0; … … 1379 1488 case Asterisks: 1380 1489 case Footnotes: 1381 m_text = listMarkerText(type, m_listItem->value());1382 1490 logicalWidth = font.width(m_text); // no suffix for these types 1383 1491 break; … … 1385 1493 case Disc: 1386 1494 case Square: 1387 m_text = listMarkerText(type, 0); // value is ignored for these types 1388 logicalWidth = (fontMetrics.ascent() * 2 / 3 + 1) / 2 + 2; 1495 logicalWidth = (font.fontMetrics().ascent() * 2 / 3 + 1) / 2 + 2; 1389 1496 break; 1390 1497 case Afar: … … 1463 1570 case UpperRoman: 1464 1571 case Urdu: 1465 m_text = listMarkerText(type, m_listItem->value());1466 1572 if (m_text.isEmpty()) 1467 1573 logicalWidth = 0; -
trunk/Source/WebCore/rendering/RenderListMarker.h
r137169 r139891 39 39 virtual ~RenderListMarker(); 40 40 41 virtual void computePreferredLogicalWidths();42 43 41 const String& text() const { return m_text; } 44 42 String suffix() const; … … 48 46 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; 49 47 48 void updateMarginsAndContent(); 49 50 50 private: 51 51 virtual const char* renderName() const { return "RenderListMarker"; } 52 virtual void computePreferredLogicalWidths() OVERRIDE; 52 53 53 54 virtual bool isListMarker() const { return true; } … … 72 73 73 74 void updateMargins(); 75 void updateContent(); 74 76 75 77 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
Note: See TracChangeset
for help on using the changeset viewer.