| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 LayoutUnit InlineFlowBox::placeEllipsisBox(bool ltr, LayoutUnit blockLeftEdge, L
ayoutUnit blockRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncatedWidth,
bool& foundBox) | 1109 LayoutUnit InlineFlowBox::placeEllipsisBox(bool ltr, LayoutUnit blockLeftEdge, L
ayoutUnit blockRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncatedWidth,
bool& foundBox) |
| 1110 { | 1110 { |
| 1111 LayoutUnit result(-1); | 1111 LayoutUnit result(-1); |
| 1112 // We iterate over all children, the foundBox variable tells us when we've f
ound the | 1112 // We iterate over all children, the foundBox variable tells us when we've f
ound the |
| 1113 // box containing the ellipsis. All boxes after that one in the flow are hi
dden. | 1113 // box containing the ellipsis. All boxes after that one in the flow are hi
dden. |
| 1114 // If our flow is ltr then iterate over the boxes from left to right, otherw
ise iterate | 1114 // If our flow is ltr then iterate over the boxes from left to right, otherw
ise iterate |
| 1115 // from right to left. Varying the order allows us to correctly hide the box
es following the ellipsis. | 1115 // from right to left. Varying the order allows us to correctly hide the box
es following the ellipsis. |
| 1116 InlineBox* box = ltr ? firstChild() : lastChild(); | 1116 InlineBox* box = ltr ? firstChild() : lastChild(); |
| 1117 | 1117 |
| 1118 // NOTE: these will cross after foundBox = true. | 1118 // NOTE: these will cross after foundBox = true. |
| 1119 int visibleLeftEdge = blockLeftEdge; | 1119 int visibleLeftEdge = blockLeftEdge.toInt(); |
| 1120 int visibleRightEdge = blockRightEdge; | 1120 int visibleRightEdge = blockRightEdge.toInt(); |
| 1121 | 1121 |
| 1122 while (box) { | 1122 while (box) { |
| 1123 int currResult = box->placeEllipsisBox(ltr, LayoutUnit(visibleLeftEdge),
LayoutUnit(visibleRightEdge), | 1123 int currResult = box->placeEllipsisBox(ltr, LayoutUnit(visibleLeftEdge),
LayoutUnit(visibleRightEdge), |
| 1124 ellipsisWidth, truncatedWidth, foundBox); | 1124 ellipsisWidth, truncatedWidth, foundBox).toInt(); |
| 1125 if (currResult != -1 && result == -1) | 1125 if (currResult != -1 && result == -1) |
| 1126 result = LayoutUnit(currResult); | 1126 result = LayoutUnit(currResult); |
| 1127 | 1127 |
| 1128 if (ltr) { | 1128 if (ltr) { |
| 1129 visibleLeftEdge += box->logicalWidth().round(); | 1129 visibleLeftEdge += box->logicalWidth().round(); |
| 1130 box = box->nextOnLine(); | 1130 box = box->nextOnLine(); |
| 1131 } else { | 1131 } else { |
| 1132 visibleRightEdge -= box->logicalWidth().round(); | 1132 visibleRightEdge -= box->logicalWidth().round(); |
| 1133 box = box->prevOnLine(); | 1133 box = box->prevOnLine(); |
| 1134 } | 1134 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 bottomOfLastRubyTextLine += curr->logicalTop(); | 1171 bottomOfLastRubyTextLine += curr->logicalTop(); |
| 1172 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); | 1172 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
| 1173 } | 1173 } |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 if (curr->isInlineTextBox()) { | 1176 if (curr->isInlineTextBox()) { |
| 1177 const ComputedStyle& style = curr->getLineLayoutItem().styleRef(isFi
rstLineStyle()); | 1177 const ComputedStyle& style = curr->getLineLayoutItem().styleRef(isFi
rstLineStyle()); |
| 1178 TextEmphasisPosition emphasisMarkPosition; | 1178 TextEmphasisPosition emphasisMarkPosition; |
| 1179 if (style.getTextEmphasisMark() != TextEmphasisMarkNone && toInlineT
extBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMa
rkPosition == TextEmphasisPositionOver) { | 1179 if (style.getTextEmphasisMark() != TextEmphasisMarkNone && toInlineT
extBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMa
rkPosition == TextEmphasisPositionOver) { |
| 1180 if (!style.isFlippedLinesWritingMode()) { | 1180 if (!style.isFlippedLinesWritingMode()) { |
| 1181 int topOfEmphasisMark = curr->logicalTop() - style.font().em
phasisMarkHeight(style.textEmphasisMarkString()); | 1181 int topOfEmphasisMark = (curr->logicalTop() - style.font().e
mphasisMarkHeight(style.textEmphasisMarkString())).toInt(); |
| 1182 result = std::max(result, allowedPosition - topOfEmphasisMar
k); | 1182 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
| 1183 } else { | 1183 } else { |
| 1184 int bottomOfEmphasisMark = curr->logicalBottom() + style.fon
t().emphasisMarkHeight(style.textEmphasisMarkString()); | 1184 int bottomOfEmphasisMark = (curr->logicalBottom() + style.fo
nt().emphasisMarkHeight(style.textEmphasisMarkString())).toInt(); |
| 1185 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); | 1185 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
| 1186 } | 1186 } |
| 1187 } | 1187 } |
| 1188 } | 1188 } |
| 1189 } | 1189 } |
| 1190 return result; | 1190 return result; |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos
ition) const | 1193 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos
ition) const |
| 1194 { | 1194 { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 ASSERT(child->prevOnLine() == prev); | 1316 ASSERT(child->prevOnLine() == prev); |
| 1317 prev = child; | 1317 prev = child; |
| 1318 } | 1318 } |
| 1319 ASSERT(prev == m_lastChild); | 1319 ASSERT(prev == m_lastChild); |
| 1320 #endif | 1320 #endif |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 #endif | 1323 #endif |
| 1324 | 1324 |
| 1325 } // namespace blink | 1325 } // namespace blink |
| OLD | NEW |