| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 | 799 |
| 800 LineLayoutRubyRun rubyRun = | 800 LineLayoutRubyRun rubyRun = |
| 801 LineLayoutRubyRun(curr->getLineLayoutItem()); | 801 LineLayoutRubyRun(curr->getLineLayoutItem()); |
| 802 if (LineLayoutRubyBase rubyBase = rubyRun.rubyBase()) { | 802 if (LineLayoutRubyBase rubyBase = rubyRun.rubyBase()) { |
| 803 LayoutUnit bottomRubyBaseLeading = | 803 LayoutUnit bottomRubyBaseLeading = |
| 804 (curr->logicalHeight() - rubyBase.logicalBottom()) + | 804 (curr->logicalHeight() - rubyBase.logicalBottom()) + |
| 805 rubyBase.logicalHeight() - | 805 rubyBase.logicalHeight() - |
| 806 (rubyBase.lastRootBox() ? rubyBase.lastRootBox()->lineBottom() | 806 (rubyBase.lastRootBox() ? rubyBase.lastRootBox()->lineBottom() |
| 807 : LayoutUnit()); | 807 : LayoutUnit()); |
| 808 LayoutUnit topRubyBaseLeading = | 808 LayoutUnit topRubyBaseLeading = |
| 809 rubyBase.logicalTop() + (rubyBase.firstRootBox() | 809 rubyBase.logicalTop() + |
| 810 ? rubyBase.firstRootBox()->lineTop() | 810 (rubyBase.firstRootBox() ? rubyBase.firstRootBox()->lineTop() |
| 811 : LayoutUnit()); | 811 : LayoutUnit()); |
| 812 newLogicalTop += | 812 newLogicalTop += |
| 813 !getLineLayoutItem().style()->isFlippedLinesWritingMode() | 813 !getLineLayoutItem().style()->isFlippedLinesWritingMode() |
| 814 ? topRubyBaseLeading | 814 ? topRubyBaseLeading |
| 815 : bottomRubyBaseLeading; | 815 : bottomRubyBaseLeading; |
| 816 boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); | 816 boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); |
| 817 } | 817 } |
| 818 } | 818 } |
| 819 if (curr->isInlineTextBox()) { | 819 if (curr->isInlineTextBox()) { |
| 820 TextEmphasisPosition emphasisMarkPosition; | 820 TextEmphasisPosition emphasisMarkPosition; |
| 821 if (toInlineTextBox(curr)->getEmphasisMarkPosition( | 821 if (toInlineTextBox(curr)->getEmphasisMarkPosition( |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 flipForWritingMode(rect); | 1351 flipForWritingMode(rect); |
| 1352 rect.moveBy(accumulatedOffset); | 1352 rect.moveBy(accumulatedOffset); |
| 1353 | 1353 |
| 1354 // Pixel snap hit testing. | 1354 // Pixel snap hit testing. |
| 1355 rect = LayoutRect(pixelSnappedIntRect(rect)); | 1355 rect = LayoutRect(pixelSnappedIntRect(rect)); |
| 1356 if (visibleToHitTestRequest(result.hitTestRequest()) && | 1356 if (visibleToHitTestRequest(result.hitTestRequest()) && |
| 1357 locationInContainer.intersects(rect)) { | 1357 locationInContainer.intersects(rect)) { |
| 1358 // Don't add in m_topLeft here, we want coords in the containing block's | 1358 // Don't add in m_topLeft here, we want coords in the containing block's |
| 1359 // coordinate space. | 1359 // coordinate space. |
| 1360 getLineLayoutItem().updateHitTestResult( | 1360 getLineLayoutItem().updateHitTestResult( |
| 1361 result, flipForWritingMode(locationInContainer.point() - | 1361 result, |
| 1362 toLayoutSize(accumulatedOffset))); | 1362 flipForWritingMode(locationInContainer.point() - |
| 1363 toLayoutSize(accumulatedOffset))); |
| 1363 if (result.addNodeToListBasedTestResult(getLineLayoutItem().node(), | 1364 if (result.addNodeToListBasedTestResult(getLineLayoutItem().node(), |
| 1364 locationInContainer, | 1365 locationInContainer, |
| 1365 rect) == StopHitTesting) | 1366 rect) == StopHitTesting) |
| 1366 return true; | 1367 return true; |
| 1367 } | 1368 } |
| 1368 | 1369 |
| 1369 return false; | 1370 return false; |
| 1370 } | 1371 } |
| 1371 | 1372 |
| 1372 void InlineFlowBox::paint(const PaintInfo& paintInfo, | 1373 void InlineFlowBox::paint(const PaintInfo& paintInfo, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 curr->getLineLayoutItem().isRubyRun() && | 1484 curr->getLineLayoutItem().isRubyRun() && |
| 1484 curr->getLineLayoutItem().style()->getRubyPosition() == | 1485 curr->getLineLayoutItem().style()->getRubyPosition() == |
| 1485 RubyPositionBefore) { | 1486 RubyPositionBefore) { |
| 1486 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayoutItem()); | 1487 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayoutItem()); |
| 1487 LineLayoutRubyText rubyText = rubyRun.rubyText(); | 1488 LineLayoutRubyText rubyText = rubyRun.rubyText(); |
| 1488 if (!rubyText) | 1489 if (!rubyText) |
| 1489 continue; | 1490 continue; |
| 1490 | 1491 |
| 1491 if (!rubyRun.style()->isFlippedLinesWritingMode()) { | 1492 if (!rubyRun.style()->isFlippedLinesWritingMode()) { |
| 1492 LayoutUnit topOfFirstRubyTextLine = | 1493 LayoutUnit topOfFirstRubyTextLine = |
| 1493 rubyText.logicalTop() + (rubyText.firstRootBox() | 1494 rubyText.logicalTop() + |
| 1494 ? rubyText.firstRootBox()->lineTop() | 1495 (rubyText.firstRootBox() ? rubyText.firstRootBox()->lineTop() |
| 1495 : LayoutUnit()); | 1496 : LayoutUnit()); |
| 1496 if (topOfFirstRubyTextLine >= 0) | 1497 if (topOfFirstRubyTextLine >= 0) |
| 1497 continue; | 1498 continue; |
| 1498 topOfFirstRubyTextLine += curr->logicalTop(); | 1499 topOfFirstRubyTextLine += curr->logicalTop(); |
| 1499 result = std::max(result, allowedPosition - topOfFirstRubyTextLine); | 1500 result = std::max(result, allowedPosition - topOfFirstRubyTextLine); |
| 1500 } else { | 1501 } else { |
| 1501 LayoutUnit bottomOfLastRubyTextLine = | 1502 LayoutUnit bottomOfLastRubyTextLine = |
| 1502 rubyText.logicalTop() + (rubyText.lastRootBox() | 1503 rubyText.logicalTop() + |
| 1503 ? rubyText.lastRootBox()->lineBottom() | 1504 (rubyText.lastRootBox() ? rubyText.lastRootBox()->lineBottom() |
| 1504 : rubyText.logicalHeight()); | 1505 : rubyText.logicalHeight()); |
| 1505 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1506 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
| 1506 continue; | 1507 continue; |
| 1507 bottomOfLastRubyTextLine += curr->logicalTop(); | 1508 bottomOfLastRubyTextLine += curr->logicalTop(); |
| 1508 result = std::max(result, bottomOfLastRubyTextLine - allowedPosition); | 1509 result = std::max(result, bottomOfLastRubyTextLine - allowedPosition); |
| 1509 } | 1510 } |
| 1510 } | 1511 } |
| 1511 | 1512 |
| 1512 if (curr->isInlineTextBox()) { | 1513 if (curr->isInlineTextBox()) { |
| 1513 const ComputedStyle& style = | 1514 const ComputedStyle& style = |
| 1514 curr->getLineLayoutItem().styleRef(isFirstLineStyle()); | 1515 curr->getLineLayoutItem().styleRef(isFirstLineStyle()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 curr->getLineLayoutItem().isRubyRun() && | 1553 curr->getLineLayoutItem().isRubyRun() && |
| 1553 curr->getLineLayoutItem().style()->getRubyPosition() == | 1554 curr->getLineLayoutItem().style()->getRubyPosition() == |
| 1554 RubyPositionAfter) { | 1555 RubyPositionAfter) { |
| 1555 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayoutItem()); | 1556 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayoutItem()); |
| 1556 LineLayoutRubyText rubyText = rubyRun.rubyText(); | 1557 LineLayoutRubyText rubyText = rubyRun.rubyText(); |
| 1557 if (!rubyText) | 1558 if (!rubyText) |
| 1558 continue; | 1559 continue; |
| 1559 | 1560 |
| 1560 if (rubyRun.style()->isFlippedLinesWritingMode()) { | 1561 if (rubyRun.style()->isFlippedLinesWritingMode()) { |
| 1561 LayoutUnit topOfFirstRubyTextLine = | 1562 LayoutUnit topOfFirstRubyTextLine = |
| 1562 rubyText.logicalTop() + (rubyText.firstRootBox() | 1563 rubyText.logicalTop() + |
| 1563 ? rubyText.firstRootBox()->lineTop() | 1564 (rubyText.firstRootBox() ? rubyText.firstRootBox()->lineTop() |
| 1564 : LayoutUnit()); | 1565 : LayoutUnit()); |
| 1565 if (topOfFirstRubyTextLine >= 0) | 1566 if (topOfFirstRubyTextLine >= 0) |
| 1566 continue; | 1567 continue; |
| 1567 topOfFirstRubyTextLine += curr->logicalTop(); | 1568 topOfFirstRubyTextLine += curr->logicalTop(); |
| 1568 result = std::max(result, allowedPosition - topOfFirstRubyTextLine); | 1569 result = std::max(result, allowedPosition - topOfFirstRubyTextLine); |
| 1569 } else { | 1570 } else { |
| 1570 LayoutUnit bottomOfLastRubyTextLine = | 1571 LayoutUnit bottomOfLastRubyTextLine = |
| 1571 rubyText.logicalTop() + (rubyText.lastRootBox() | 1572 rubyText.logicalTop() + |
| 1572 ? rubyText.lastRootBox()->lineBottom() | 1573 (rubyText.lastRootBox() ? rubyText.lastRootBox()->lineBottom() |
| 1573 : rubyText.logicalHeight()); | 1574 : rubyText.logicalHeight()); |
| 1574 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1575 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
| 1575 continue; | 1576 continue; |
| 1576 bottomOfLastRubyTextLine += curr->logicalTop(); | 1577 bottomOfLastRubyTextLine += curr->logicalTop(); |
| 1577 result = std::max(result, bottomOfLastRubyTextLine - allowedPosition); | 1578 result = std::max(result, bottomOfLastRubyTextLine - allowedPosition); |
| 1578 } | 1579 } |
| 1579 } | 1580 } |
| 1580 | 1581 |
| 1581 if (curr->isInlineTextBox()) { | 1582 if (curr->isInlineTextBox()) { |
| 1582 const ComputedStyle& style = | 1583 const ComputedStyle& style = |
| 1583 curr->getLineLayoutItem().styleRef(isFirstLineStyle()); | 1584 curr->getLineLayoutItem().styleRef(isFirstLineStyle()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 ASSERT(child->prevOnLine() == prev); | 1690 ASSERT(child->prevOnLine() == prev); |
| 1690 prev = child; | 1691 prev = child; |
| 1691 } | 1692 } |
| 1692 ASSERT(prev == m_lastChild); | 1693 ASSERT(prev == m_lastChild); |
| 1693 #endif | 1694 #endif |
| 1694 } | 1695 } |
| 1695 | 1696 |
| 1696 #endif | 1697 #endif |
| 1697 | 1698 |
| 1698 } // namespace blink | 1699 } // namespace blink |
| OLD | NEW |