| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 PositionOfInteriorLineBoxes); | 85 PositionOfInteriorLineBoxes); |
| 86 } | 86 } |
| 87 | 87 |
| 88 LayoutUnit RootInlineBox::lineHeight() const { | 88 LayoutUnit RootInlineBox::lineHeight() const { |
| 89 return boxModelObject().lineHeight( | 89 return boxModelObject().lineHeight( |
| 90 isFirstLineStyle(), isHorizontal() ? HorizontalLine : VerticalLine, | 90 isFirstLineStyle(), isHorizontal() ? HorizontalLine : VerticalLine, |
| 91 PositionOfInteriorLineBoxes); | 91 PositionOfInteriorLineBoxes); |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool RootInlineBox::lineCanAccommodateEllipsis(bool ltr, | 94 bool RootInlineBox::lineCanAccommodateEllipsis(bool ltr, |
| 95 int blockEdge, | 95 LayoutUnit blockEdge, |
| 96 int lineBoxEdge, | 96 LayoutUnit lineBoxEdge, |
| 97 int ellipsisWidth) { | 97 LayoutUnit ellipsisWidth) { |
| 98 // First sanity-check the unoverflowed width of the whole line to see if there | 98 // First sanity-check the unoverflowed width of the whole line to see if there |
| 99 // is sufficient room. | 99 // is sufficient room. |
| 100 int delta = ltr ? lineBoxEdge - blockEdge : blockEdge - lineBoxEdge; | 100 LayoutUnit delta = ltr ? lineBoxEdge - blockEdge : blockEdge - lineBoxEdge; |
| 101 if (logicalWidth() - delta < ellipsisWidth) | 101 if (logicalWidth() - delta < ellipsisWidth) |
| 102 return false; | 102 return false; |
| 103 | 103 |
| 104 // Next iterate over all the line boxes on the line. If we find a replaced | 104 // Next iterate over all the line boxes on the line. If we find a replaced |
| 105 // element that intersects then we refuse to accommodate the ellipsis. | 105 // element that intersects then we refuse to accommodate the ellipsis. |
| 106 // Otherwise we're ok. | 106 // Otherwise we're ok. |
| 107 return InlineFlowBox::canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth); | 107 return InlineFlowBox::canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth); |
| 108 } | 108 } |
| 109 | 109 |
| 110 LayoutUnit RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, | 110 LayoutUnit RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, |
| 111 bool ltr, | 111 bool ltr, |
| 112 LayoutUnit blockLeftEdge, | 112 LayoutUnit blockLeftEdge, |
| 113 LayoutUnit blockRightEdge, | 113 LayoutUnit blockRightEdge, |
| 114 LayoutUnit ellipsisWidth) { | 114 LayoutUnit ellipsisWidth) { |
| 115 // Create an ellipsis box. | 115 // Create an ellipsis box. |
| 116 EllipsisBox* ellipsisBox = | 116 EllipsisBox* ellipsisBox = new EllipsisBox( |
| 117 new EllipsisBox(getLineLayoutItem(), ellipsisStr, this, ellipsisWidth, | 117 getLineLayoutItem(), ellipsisStr, this, ellipsisWidth, logicalHeight(), |
| 118 logicalHeight().toFloat(), x().toInt(), y().toInt(), | 118 location(), !prevRootBox(), isHorizontal()); |
| 119 !prevRootBox(), isHorizontal()); | |
| 120 | 119 |
| 121 if (!gEllipsisBoxMap) | 120 if (!gEllipsisBoxMap) |
| 122 gEllipsisBoxMap = new EllipsisBoxMap(); | 121 gEllipsisBoxMap = new EllipsisBoxMap(); |
| 123 gEllipsisBoxMap->insert(this, ellipsisBox); | 122 gEllipsisBoxMap->insert(this, ellipsisBox); |
| 124 setHasEllipsisBox(true); | 123 setHasEllipsisBox(true); |
| 125 | 124 |
| 126 // FIXME: Do we need an RTL version of this? | 125 // FIXME: Do we need an RTL version of this? |
| 127 if (ltr && | 126 if (ltr && |
| 128 (logicalLeft() + logicalWidth() + ellipsisWidth) <= blockRightEdge) { | 127 (logicalLeft() + logicalWidth() + ellipsisWidth) <= blockRightEdge) { |
| 129 ellipsisBox->setLogicalLeft(logicalLeft() + logicalWidth()); | 128 ellipsisBox->setLogicalLeft(logicalLeft() + logicalWidth()); |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 } | 775 } |
| 777 endBox = nullptr; | 776 endBox = nullptr; |
| 778 return nullptr; | 777 return nullptr; |
| 779 } | 778 } |
| 780 | 779 |
| 781 const char* RootInlineBox::boxName() const { | 780 const char* RootInlineBox::boxName() const { |
| 782 return "RootInlineBox"; | 781 return "RootInlineBox"; |
| 783 } | 782 } |
| 784 | 783 |
| 785 } // namespace blink | 784 } // namespace blink |
| OLD | NEW |