| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // FIXME: Do we need an RTL version of this? | 127 // FIXME: Do we need an RTL version of this? |
| 128 if (ltr && (logicalLeft() + logicalWidth() + ellipsisWidth) <= blockRightEdg
e) { | 128 if (ltr && (logicalLeft() + logicalWidth() + ellipsisWidth) <= blockRightEdg
e) { |
| 129 ellipsisBox->setLogicalLeft(logicalLeft() + logicalWidth()); | 129 ellipsisBox->setLogicalLeft(logicalLeft() + logicalWidth()); |
| 130 return logicalWidth() + ellipsisWidth; | 130 return logicalWidth() + ellipsisWidth; |
| 131 } | 131 } |
| 132 | 132 |
| 133 // Now attempt to find the nearest glyph horizontally and place just to the
right (or left in RTL) | 133 // Now attempt to find the nearest glyph horizontally and place just to the
right (or left in RTL) |
| 134 // of that glyph. Mark all of the objects that intersect the ellipsis box a
s not painting (as being | 134 // of that glyph. Mark all of the objects that intersect the ellipsis box a
s not painting (as being |
| 135 // truncated). | 135 // truncated). |
| 136 bool foundBox = false; | 136 bool foundBox = false; |
| 137 LayoutUnit truncatedWidth = 0; | 137 LayoutUnit truncatedWidth; |
| 138 LayoutUnit position = placeEllipsisBox(ltr, blockLeftEdge, blockRightEdge, e
llipsisWidth, truncatedWidth, foundBox); | 138 LayoutUnit position = placeEllipsisBox(ltr, blockLeftEdge, blockRightEdge, e
llipsisWidth, truncatedWidth, foundBox); |
| 139 ellipsisBox->setLogicalLeft(position); | 139 ellipsisBox->setLogicalLeft(position); |
| 140 return truncatedWidth; | 140 return truncatedWidth; |
| 141 } | 141 } |
| 142 | 142 |
| 143 LayoutUnit RootInlineBox::placeEllipsisBox(bool ltr, LayoutUnit blockLeftEdge, L
ayoutUnit blockRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncatedWidth,
bool& foundBox) | 143 LayoutUnit RootInlineBox::placeEllipsisBox(bool ltr, LayoutUnit blockLeftEdge, L
ayoutUnit blockRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncatedWidth,
bool& foundBox) |
| 144 { | 144 { |
| 145 LayoutUnit result = InlineFlowBox::placeEllipsisBox(ltr, blockLeftEdge, bloc
kRightEdge, ellipsisWidth, truncatedWidth, foundBox); | 145 LayoutUnit result = InlineFlowBox::placeEllipsisBox(ltr, blockLeftEdge, bloc
kRightEdge, ellipsisWidth, truncatedWidth, foundBox); |
| 146 if (result == -1) { | 146 if (result == -1) { |
| 147 result = ltr ? blockRightEdge - ellipsisWidth : blockLeftEdge; | 147 result = ltr ? blockRightEdge - ellipsisWidth : blockLeftEdge; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 prev->markDirty(); | 189 prev->markDirty(); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G
lyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& vertical
PositionCache) | 193 LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G
lyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& vertical
PositionCache) |
| 194 { | 194 { |
| 195 // SVG will handle vertical alignment on its own. | 195 // SVG will handle vertical alignment on its own. |
| 196 if (isSVGRootInlineBox()) | 196 if (isSVGRootInlineBox()) |
| 197 return 0; | 197 return 0; |
| 198 | 198 |
| 199 LayoutUnit maxPositionTop = 0; | 199 LayoutUnit maxPositionTop; |
| 200 LayoutUnit maxPositionBottom = 0; | 200 LayoutUnit maxPositionBottom; |
| 201 int maxAscent = 0; | 201 int maxAscent = 0; |
| 202 int maxDescent = 0; | 202 int maxDescent = 0; |
| 203 bool setMaxAscent = false; | 203 bool setMaxAscent = false; |
| 204 bool setMaxDescent = false; | 204 bool setMaxDescent = false; |
| 205 | 205 |
| 206 // Figure out if we're in no-quirks mode. | 206 // Figure out if we're in no-quirks mode. |
| 207 bool noQuirksMode = lineLayoutItem().document().inNoQuirksMode(); | 207 bool noQuirksMode = lineLayoutItem().document().inNoQuirksMode(); |
| 208 | 208 |
| 209 m_baselineType = dominantBaseline(); | 209 m_baselineType = dominantBaseline(); |
| 210 | 210 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 LayoutUnit RootInlineBox::maxLogicalTop() const | 244 LayoutUnit RootInlineBox::maxLogicalTop() const |
| 245 { | 245 { |
| 246 LayoutUnit maxLogicalTop; | 246 LayoutUnit maxLogicalTop; |
| 247 computeMaxLogicalTop(maxLogicalTop); | 247 computeMaxLogicalTop(maxLogicalTop); |
| 248 return maxLogicalTop; | 248 return maxLogicalTop; |
| 249 } | 249 } |
| 250 | 250 |
| 251 LayoutUnit RootInlineBox::beforeAnnotationsAdjustment() const | 251 LayoutUnit RootInlineBox::beforeAnnotationsAdjustment() const |
| 252 { | 252 { |
| 253 LayoutUnit result = 0; | 253 LayoutUnit result; |
| 254 | 254 |
| 255 if (!lineLayoutItem().style()->isFlippedLinesWritingMode()) { | 255 if (!lineLayoutItem().style()->isFlippedLinesWritingMode()) { |
| 256 // Annotations under the previous line may push us down. | 256 // Annotations under the previous line may push us down. |
| 257 if (prevRootBox() && prevRootBox()->hasAnnotationsAfter()) | 257 if (prevRootBox() && prevRootBox()->hasAnnotationsAfter()) |
| 258 result = prevRootBox()->computeUnderAnnotationAdjustment(lineTop()); | 258 result = prevRootBox()->computeUnderAnnotationAdjustment(lineTop()); |
| 259 | 259 |
| 260 if (!hasAnnotationsBefore()) | 260 if (!hasAnnotationsBefore()) |
| 261 return result; | 261 return result; |
| 262 | 262 |
| 263 // Annotations over this line may push us further down. | 263 // Annotations over this line may push us further down. |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 firstLine = false; | 612 firstLine = false; |
| 613 | 613 |
| 614 // Check the cache. | 614 // Check the cache. |
| 615 bool isLayoutInline = boxModel.isLayoutInline(); | 615 bool isLayoutInline = boxModel.isLayoutInline(); |
| 616 if (isLayoutInline && !firstLine) { | 616 if (isLayoutInline && !firstLine) { |
| 617 LayoutUnit verticalPosition = verticalPositionCache.get(boxModel, baseli
neType()); | 617 LayoutUnit verticalPosition = verticalPositionCache.get(boxModel, baseli
neType()); |
| 618 if (verticalPosition != PositionUndefined) | 618 if (verticalPosition != PositionUndefined) |
| 619 return verticalPosition; | 619 return verticalPosition; |
| 620 } | 620 } |
| 621 | 621 |
| 622 LayoutUnit verticalPosition = 0; | 622 LayoutUnit verticalPosition; |
| 623 EVerticalAlign verticalAlign = boxModel.style()->verticalAlign(); | 623 EVerticalAlign verticalAlign = boxModel.style()->verticalAlign(); |
| 624 if (verticalAlign == TOP || verticalAlign == BOTTOM) | 624 if (verticalAlign == TOP || verticalAlign == BOTTOM) |
| 625 return 0; | 625 return 0; |
| 626 | 626 |
| 627 LineLayoutItem parent = boxModel.parent(); | 627 LineLayoutItem parent = boxModel.parent(); |
| 628 if (parent.isLayoutInline() && parent.style()->verticalAlign() != TOP && par
ent.style()->verticalAlign() != BOTTOM) | 628 if (parent.isLayoutInline() && parent.style()->verticalAlign() != TOP && par
ent.style()->verticalAlign() != BOTTOM) |
| 629 verticalPosition = box->parent()->logicalTop(); | 629 verticalPosition = box->parent()->logicalTop(); |
| 630 | 630 |
| 631 if (verticalAlign != BASELINE) { | 631 if (verticalAlign != BASELINE) { |
| 632 const Font& font = parent.style(firstLine)->font(); | 632 const Font& font = parent.style(firstLine)->font(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 endBox = nullptr; | 700 endBox = nullptr; |
| 701 return nullptr; | 701 return nullptr; |
| 702 } | 702 } |
| 703 | 703 |
| 704 const char* RootInlineBox::boxName() const | 704 const char* RootInlineBox::boxName() const |
| 705 { | 705 { |
| 706 return "RootInlineBox"; | 706 return "RootInlineBox"; |
| 707 } | 707 } |
| 708 | 708 |
| 709 } // namespace blink | 709 } // namespace blink |
| OLD | NEW |