OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // We must always return a value of 1 or greater. Column count = 0 is a mean
ingless situation, | 285 // We must always return a value of 1 or greater. Column count = 0 is a mean
ingless situation, |
286 // and will confuse and cause problems in other parts of the code. | 286 // and will confuse and cause problems in other parts of the code. |
287 if (!computedColumnHeight()) | 287 if (!computedColumnHeight()) |
288 return 1; | 288 return 1; |
289 | 289 |
290 // Our portion rect determines our column count. We have as many columns as
needed to fit all the content. | 290 // Our portion rect determines our column count. We have as many columns as
needed to fit all the content. |
291 LayoutUnit logicalHeightInColumns = flowThread()->isHorizontalWritingMode()
? flowThreadPortionRect().height() : flowThreadPortionRect().width(); | 291 LayoutUnit logicalHeightInColumns = flowThread()->isHorizontalWritingMode()
? flowThreadPortionRect().height() : flowThreadPortionRect().width(); |
292 if (!logicalHeightInColumns) | 292 if (!logicalHeightInColumns) |
293 return 1; | 293 return 1; |
294 | 294 |
295 unsigned count = ceil(static_cast<float>(logicalHeightInColumns) / computedC
olumnHeight()); | 295 unsigned count = ceil(logicalHeightInColumns.toFloat() / computedColumnHeigh
t().toFloat()); |
296 ASSERT(count >= 1); | 296 ASSERT(count >= 1); |
297 return count; | 297 return count; |
298 } | 298 } |
299 | 299 |
300 LayoutRect RenderMultiColumnSet::columnRectAt(unsigned index) const | 300 LayoutRect RenderMultiColumnSet::columnRectAt(unsigned index) const |
301 { | 301 { |
302 LayoutUnit colLogicalWidth = computedColumnWidth(); | 302 LayoutUnit colLogicalWidth = computedColumnWidth(); |
303 LayoutUnit colLogicalHeight = computedColumnHeight(); | 303 LayoutUnit colLogicalHeight = computedColumnHeight(); |
304 LayoutUnit colLogicalTop = borderBefore() + paddingBefore(); | 304 LayoutUnit colLogicalTop = borderBefore() + paddingBefore(); |
305 LayoutUnit colLogicalLeft = borderAndPaddingLogicalLeft(); | 305 LayoutUnit colLogicalLeft = borderAndPaddingLogicalLeft(); |
(...skipping 18 matching lines...) Expand all Loading... |
324 return 0; | 324 return 0; |
325 // If we're laying out right now, we cannot constrain against some logical b
ottom, since it | 325 // If we're laying out right now, we cannot constrain against some logical b
ottom, since it |
326 // isn't known yet. Otherwise, just return the last column if we're past the
logical bottom. | 326 // isn't known yet. Otherwise, just return the last column if we're past the
logical bottom. |
327 if (mode == ClampToExistingColumns) { | 327 if (mode == ClampToExistingColumns) { |
328 LayoutUnit flowThreadLogicalBottom = isHorizontalWritingMode() ? portion
Rect.maxY() : portionRect.maxX(); | 328 LayoutUnit flowThreadLogicalBottom = isHorizontalWritingMode() ? portion
Rect.maxY() : portionRect.maxX(); |
329 if (offset >= flowThreadLogicalBottom) | 329 if (offset >= flowThreadLogicalBottom) |
330 return columnCount() - 1; | 330 return columnCount() - 1; |
331 } | 331 } |
332 | 332 |
333 // Just divide by the column height to determine the correct column. | 333 // Just divide by the column height to determine the correct column. |
334 return static_cast<float>(offset - flowThreadLogicalTop) / computedColumnHei
ght(); | 334 return (offset - flowThreadLogicalTop).toFloat() / computedColumnHeight().to
Float(); |
335 } | 335 } |
336 | 336 |
337 LayoutRect RenderMultiColumnSet::flowThreadPortionRectAt(unsigned index) const | 337 LayoutRect RenderMultiColumnSet::flowThreadPortionRectAt(unsigned index) const |
338 { | 338 { |
339 LayoutRect portionRect = flowThreadPortionRect(); | 339 LayoutRect portionRect = flowThreadPortionRect(); |
340 if (isHorizontalWritingMode()) | 340 if (isHorizontalWritingMode()) |
341 portionRect = LayoutRect(portionRect.x(), portionRect.y() + index * comp
utedColumnHeight(), portionRect.width(), computedColumnHeight()); | 341 portionRect = LayoutRect(portionRect.x(), portionRect.y() + index * comp
utedColumnHeight(), portionRect.width(), computedColumnHeight()); |
342 else | 342 else |
343 portionRect = LayoutRect(portionRect.x() + index * computedColumnHeight(
), portionRect.y(), computedColumnHeight(), portionRect.height()); | 343 portionRect = LayoutRect(portionRect.x() + index * computedColumnHeight(
), portionRect.y(), computedColumnHeight(), portionRect.height()); |
344 return portionRect; | 344 return portionRect; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 fragments.append(fragment); | 584 fragments.append(fragment); |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 const char* RenderMultiColumnSet::renderName() const | 588 const char* RenderMultiColumnSet::renderName() const |
589 { | 589 { |
590 return "RenderMultiColumnSet"; | 590 return "RenderMultiColumnSet"; |
591 } | 591 } |
592 | 592 |
593 } | 593 } |
OLD | NEW |