OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 15 matching lines...) Expand all Loading... |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/rendering/RenderGrid.h" | 27 #include "core/rendering/RenderGrid.h" |
28 | 28 |
29 #include "core/rendering/LayoutRepainter.h" | 29 #include "core/rendering/LayoutRepainter.h" |
30 #include "core/rendering/RenderLayer.h" | 30 #include "core/rendering/RenderLayer.h" |
31 #include "core/rendering/RenderView.h" | 31 #include "core/rendering/RenderView.h" |
32 #include "core/rendering/style/GridCoordinate.h" | 32 #include "core/rendering/style/GridCoordinate.h" |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 static const int infinity = intMaxForLayoutUnit; | 36 static const int infinity = -1; |
37 | 37 |
38 class GridTrack { | 38 class GridTrack { |
39 public: | 39 public: |
40 GridTrack() | 40 GridTrack() |
41 : m_usedBreadth(0) | 41 : m_usedBreadth(0) |
42 , m_maxBreadth(0) | 42 , m_maxBreadth(0) |
43 { | 43 { |
44 } | 44 } |
45 | 45 |
46 void growUsedBreadth(LayoutUnit growth) | 46 void growUsedBreadth(LayoutUnit growth) |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(TrackSizingDirection direct
ion, const GridLength& gridLength, LayoutUnit usedBreadth) const | 348 LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(TrackSizingDirection direct
ion, const GridLength& gridLength, LayoutUnit usedBreadth) const |
349 { | 349 { |
350 if (gridLength.isFlex()) | 350 if (gridLength.isFlex()) |
351 return usedBreadth; | 351 return usedBreadth; |
352 | 352 |
353 const Length& trackLength = gridLength.length(); | 353 const Length& trackLength = gridLength.length(); |
354 ASSERT(!trackLength.isAuto()); | 354 ASSERT(!trackLength.isAuto()); |
355 if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewpo
rtPercentage()) { | 355 if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewpo
rtPercentage()) { |
356 LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(directi
on, trackLength); | 356 LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(directi
on, trackLength); |
357 // FIXME: We should ASSERT that computedBreadth cannot return infinity b
ut it's currently | 357 ASSERT(computedBreadth != infinity); |
358 // possible. See https://bugs.webkit.org/show_bug.cgi?id=107053 | |
359 return computedBreadth; | 358 return computedBreadth; |
360 } | 359 } |
361 | 360 |
362 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent()); | 361 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent()); |
363 return infinity; | 362 return infinity; |
364 } | 363 } |
365 | 364 |
366 LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(TrackSizingDirection
direction, const Length& trackLength) const | 365 LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(TrackSizingDirection
direction, const Length& trackLength) const |
367 { | 366 { |
368 // FIXME: We still need to support calc() here (https://webkit.org/b/103761)
. | 367 // FIXME: We still need to support calc() here (https://webkit.org/b/103761)
. |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 if (isOutOfFlowPositioned()) | 1050 if (isOutOfFlowPositioned()) |
1052 return "RenderGrid (positioned)"; | 1051 return "RenderGrid (positioned)"; |
1053 if (isAnonymous()) | 1052 if (isAnonymous()) |
1054 return "RenderGrid (generated)"; | 1053 return "RenderGrid (generated)"; |
1055 if (isRelPositioned()) | 1054 if (isRelPositioned()) |
1056 return "RenderGrid (relative positioned)"; | 1055 return "RenderGrid (relative positioned)"; |
1057 return "RenderGrid"; | 1056 return "RenderGrid"; |
1058 } | 1057 } |
1059 | 1058 |
1060 } // namespace WebCore | 1059 } // namespace WebCore |
OLD | NEW |