| 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/paint/GridPainter.h" | 29 #include "core/paint/GridPainter.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/TextAutosizer.h" | 32 #include "core/rendering/TextAutosizer.h" |
| 33 #include "core/rendering/style/GridCoordinate.h" | 33 #include "core/rendering/style/GridCoordinate.h" |
| 34 #include "core/rendering/style/RenderStyle.h" | 34 #include "core/rendering/style/RenderStyle.h" |
| 35 #include "platform/LengthFunctions.h" | 35 #include "platform/LengthFunctions.h" |
| 36 #include "wtf/VectorTraits.h" | |
| 37 | 36 |
| 38 namespace blink { | 37 namespace blink { |
| 39 | 38 |
| 40 static const int infinity = -1; | 39 static const int infinity = -1; |
| 41 | 40 |
| 42 class GridTrack { | 41 class GridTrack { |
| 43 public: | 42 public: |
| 44 GridTrack() | 43 GridTrack() |
| 45 : m_usedBreadth(0) | 44 : m_usedBreadth(0) |
| 46 , m_maxBreadth(0) | 45 , m_maxBreadth(0) |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 { | 688 { |
| 690 visitor->trace(m_gridItem); | 689 visitor->trace(m_gridItem); |
| 691 } | 690 } |
| 692 | 691 |
| 693 private: | 692 private: |
| 694 RawPtrWillBeMember<RenderBox> m_gridItem; | 693 RawPtrWillBeMember<RenderBox> m_gridItem; |
| 695 GridCoordinate m_coordinate; | 694 GridCoordinate m_coordinate; |
| 696 size_t m_span; | 695 size_t m_span; |
| 697 }; | 696 }; |
| 698 | 697 |
| 699 } // namespace blink | |
| 700 | |
| 701 namespace WTF { | |
| 702 | |
| 703 template<> | |
| 704 struct VectorTraits<blink::GridItemWithSpan> : SimpleClassVectorTraits<blink::Gr
idItemWithSpan> { | |
| 705 // needsDestruction is by default defined in terms of IsPod<>, but as | |
| 706 // it doesn't handle embedded structs/enums (e.g., GridCoordinate), | |
| 707 // override it here. | |
| 708 static const bool needsDestruction = false; | |
| 709 }; | |
| 710 | |
| 711 } // namespace WTF | |
| 712 | |
| 713 namespace blink { | |
| 714 | |
| 715 void RenderGrid::resolveContentBasedTrackSizingFunctions(GridTrackSizingDirectio
n direction, GridSizingData& sizingData, LayoutUnit& availableLogicalSpace) | 698 void RenderGrid::resolveContentBasedTrackSizingFunctions(GridTrackSizingDirectio
n direction, GridSizingData& sizingData, LayoutUnit& availableLogicalSpace) |
| 716 { | 699 { |
| 717 sizingData.itemsSortedByIncreasingSpan.shrink(0); | 700 sizingData.itemsSortedByIncreasingSpan.shrink(0); |
| 718 HashSet<RenderBox*> itemsSet; | 701 HashSet<RenderBox*> itemsSet; |
| 719 size_t contentSizedTracksCount = sizingData.contentSizedTracksIndex.size(); | 702 size_t contentSizedTracksCount = sizingData.contentSizedTracksIndex.size(); |
| 720 for (size_t i = 0; i < contentSizedTracksCount; ++i) { | 703 for (size_t i = 0; i < contentSizedTracksCount; ++i) { |
| 721 GridIterator iterator(m_grid, direction, sizingData.contentSizedTracksIn
dex[i]); | 704 GridIterator iterator(m_grid, direction, sizingData.contentSizedTracksIn
dex[i]); |
| 722 while (RenderBox* gridItem = iterator.nextGridItem()) { | 705 while (RenderBox* gridItem = iterator.nextGridItem()) { |
| 723 if (itemsSet.add(gridItem).isNewEntry) | 706 if (itemsSet.add(gridItem).isNewEntry) |
| 724 sizingData.itemsSortedByIncreasingSpan.append(GridItemWithSpan(*
gridItem, cachedGridCoordinate(*gridItem), direction)); | 707 sizingData.itemsSortedByIncreasingSpan.append(GridItemWithSpan(*
gridItem, cachedGridCoordinate(*gridItem), direction)); |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 if (isOutOfFlowPositioned()) | 1401 if (isOutOfFlowPositioned()) |
| 1419 return "RenderGrid (positioned)"; | 1402 return "RenderGrid (positioned)"; |
| 1420 if (isAnonymous()) | 1403 if (isAnonymous()) |
| 1421 return "RenderGrid (generated)"; | 1404 return "RenderGrid (generated)"; |
| 1422 if (isRelPositioned()) | 1405 if (isRelPositioned()) |
| 1423 return "RenderGrid (relative positioned)"; | 1406 return "RenderGrid (relative positioned)"; |
| 1424 return "RenderGrid"; | 1407 return "RenderGrid"; |
| 1425 } | 1408 } |
| 1426 | 1409 |
| 1427 } // namespace blink | 1410 } // namespace blink |
| OLD | NEW |