OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 LineLayoutBox(getLineLayoutItem()).setInlineBoxWrapper(nullptr); | 206 LineLayoutBox(getLineLayoutItem()).setInlineBoxWrapper(nullptr); |
207 } | 207 } |
208 | 208 |
209 void InlineBox::attachLine() { | 209 void InlineBox::attachLine() { |
210 m_bitfields.setExtracted(false); | 210 m_bitfields.setExtracted(false); |
211 if (getLineLayoutItem().isBox()) | 211 if (getLineLayoutItem().isBox()) |
212 LineLayoutBox(getLineLayoutItem()).setInlineBoxWrapper(this); | 212 LineLayoutBox(getLineLayoutItem()).setInlineBoxWrapper(this); |
213 } | 213 } |
214 | 214 |
215 void InlineBox::move(const LayoutSize& delta) { | 215 void InlineBox::move(const LayoutSize& delta) { |
216 m_topLeft.move(delta); | 216 m_location.move(delta); |
217 | 217 |
218 if (getLineLayoutItem().isAtomicInlineLevel()) | 218 if (getLineLayoutItem().isAtomicInlineLevel()) |
219 LineLayoutBox(getLineLayoutItem()).move(delta.width(), delta.height()); | 219 LineLayoutBox(getLineLayoutItem()).move(delta.width(), delta.height()); |
220 | 220 |
221 setLineLayoutItemShouldDoFullPaintInvalidationIfNeeded(); | 221 setLineLayoutItemShouldDoFullPaintInvalidationIfNeeded(); |
222 } | 222 } |
223 | 223 |
224 void InlineBox::paint(const PaintInfo& paintInfo, | 224 void InlineBox::paint(const PaintInfo& paintInfo, |
225 const LayoutPoint& paintOffset, | 225 const LayoutPoint& paintOffset, |
226 LayoutUnit /* lineTop */, | 226 LayoutUnit /* lineTop */, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 return getLineLayoutItem().getSelectionState(); | 306 return getLineLayoutItem().getSelectionState(); |
307 } | 307 } |
308 | 308 |
309 bool InlineBox::canAccommodateEllipsis(bool ltr, | 309 bool InlineBox::canAccommodateEllipsis(bool ltr, |
310 int blockEdge, | 310 int blockEdge, |
311 int ellipsisWidth) const { | 311 int ellipsisWidth) const { |
312 // Non-atomic inline-level elements can always accommodate an ellipsis. | 312 // Non-atomic inline-level elements can always accommodate an ellipsis. |
313 if (!getLineLayoutItem().isAtomicInlineLevel()) | 313 if (!getLineLayoutItem().isAtomicInlineLevel()) |
314 return true; | 314 return true; |
315 | 315 |
316 IntRect boxRect(left().toInt(), 0, m_logicalWidth.toInt(), 10); | 316 IntRect boxRect(x().toInt(), 0, m_logicalWidth.toInt(), 10); |
317 IntRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, | 317 IntRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, |
318 ellipsisWidth, 10); | 318 ellipsisWidth, 10); |
319 return !(boxRect.intersects(ellipsisRect)); | 319 return !(boxRect.intersects(ellipsisRect)); |
320 } | 320 } |
321 | 321 |
322 LayoutUnit InlineBox::placeEllipsisBox(bool, | 322 LayoutUnit InlineBox::placeEllipsisBox(bool, |
323 LayoutUnit, | 323 LayoutUnit, |
324 LayoutUnit, | 324 LayoutUnit, |
325 LayoutUnit, | 325 LayoutUnit, |
326 LayoutUnit& truncatedWidth, | 326 LayoutUnit& truncatedWidth, |
327 bool&) { | 327 bool&) { |
328 // Use -1 to mean "we didn't set the position." | 328 // Use -1 to mean "we didn't set the position." |
329 truncatedWidth += logicalWidth(); | 329 truncatedWidth += logicalWidth(); |
330 return LayoutUnit(-1); | 330 return LayoutUnit(-1); |
331 } | 331 } |
332 | 332 |
333 void InlineBox::clearKnownToHaveNoOverflow() { | 333 void InlineBox::clearKnownToHaveNoOverflow() { |
334 m_bitfields.setKnownToHaveNoOverflow(false); | 334 m_bitfields.setKnownToHaveNoOverflow(false); |
335 if (parent() && parent()->knownToHaveNoOverflow()) | 335 if (parent() && parent()->knownToHaveNoOverflow()) |
336 parent()->clearKnownToHaveNoOverflow(); | 336 parent()->clearKnownToHaveNoOverflow(); |
337 } | 337 } |
338 | 338 |
339 LayoutPoint InlineBox::locationIncludingFlipping() const { | 339 LayoutPoint InlineBox::physicalLocation() const { |
340 return logicalPositionToPhysicalPoint(m_topLeft, size()); | 340 LayoutRect rect(location(), size()); |
341 } | 341 flipForWritingMode(rect); |
342 | 342 return rect.location(); |
343 LayoutPoint InlineBox::logicalPositionToPhysicalPoint( | |
344 const LayoutPoint& point, | |
345 const LayoutSize& size) const { | |
346 if (!UNLIKELY(getLineLayoutItem().hasFlippedBlocksWritingMode())) | |
347 return LayoutPoint(point.x(), point.y()); | |
348 | |
349 LineLayoutBlockFlow block = root().block(); | |
350 if (block.style()->isHorizontalWritingMode()) | |
351 return LayoutPoint(point.x(), | |
chrishtr
2016/11/28 15:13:29
This old code looks backward to me now...why is it
Xianzhu
2016/11/28 18:42:36
This seems for horizontal-bt which is not supporte
| |
352 block.size().height() - size.height() - point.y()); | |
353 | |
354 return LayoutPoint(block.size().width() - size.width() - point.x(), | |
355 point.y()); | |
356 } | 343 } |
357 | 344 |
358 void InlineBox::logicalRectToPhysicalRect(LayoutRect& current) const { | 345 void InlineBox::logicalRectToPhysicalRect(LayoutRect& current) const { |
chrishtr
2016/11/28 15:13:29
Please unittest this.
Xianzhu
2016/11/28 18:42:36
Done.
| |
359 if (isHorizontal() && !getLineLayoutItem().hasFlippedBlocksWritingMode()) | 346 if (!isHorizontal()) |
360 return; | |
361 | |
362 if (!isHorizontal()) { | |
363 current = current.transposedRect(); | 347 current = current.transposedRect(); |
364 } | 348 flipForWritingMode(current); |
365 current.setLocation( | |
366 logicalPositionToPhysicalPoint(current.location(), current.size())); | |
367 return; | |
368 } | 349 } |
369 | 350 |
370 void InlineBox::flipForWritingMode(FloatRect& rect) const { | 351 void InlineBox::flipForWritingMode(FloatRect& rect) const { |
371 if (!UNLIKELY(getLineLayoutItem().hasFlippedBlocksWritingMode())) | 352 if (!UNLIKELY(getLineLayoutItem().hasFlippedBlocksWritingMode())) |
372 return; | 353 return; |
373 root().block().flipForWritingMode(rect); | 354 root().block().flipForWritingMode(rect); |
374 } | 355 } |
375 | 356 |
376 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point) const { | 357 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point) const { |
377 if (!UNLIKELY(getLineLayoutItem().hasFlippedBlocksWritingMode())) | 358 if (!UNLIKELY(getLineLayoutItem().hasFlippedBlocksWritingMode())) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 } | 400 } |
420 | 401 |
421 void showLineTree(const blink::InlineBox* b) { | 402 void showLineTree(const blink::InlineBox* b) { |
422 if (b) | 403 if (b) |
423 b->showLineTreeForThis(); | 404 b->showLineTreeForThis(); |
424 else | 405 else |
425 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n"); | 406 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n"); |
426 } | 407 } |
427 | 408 |
428 #endif | 409 #endif |
OLD | NEW |