Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Side by Side Diff: third_party/WebKit/Source/core/layout/FragmentainerIterator.h

Issue 2360913004: Support for multiple block fragments in getClientRects(). (Closed)
Patch Set: fast/overflow/overflow-height-float-not-removed-crash3.html crashed because saturated LayoutUnits caused zero height Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef FragmentainerIterator_h 5 #ifndef FragmentainerIterator_h
6 #define FragmentainerIterator_h 6 #define FragmentainerIterator_h
7 7
8 #include "core/layout/LayoutFlowThread.h" 8 #include "core/layout/LayoutFlowThread.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 class MultiColumnFragmentainerGroup; 12 class MultiColumnFragmentainerGroup;
13 13
14 // Used to find the fragmentainers that intersect with a given portion of the fl ow thread. The 14 // Used to find the fragmentainers that intersect with a given portion of the fl ow thread. The
15 // portion typically corresponds to the bounds of some descendant layout object. The iterator walks 15 // portion typically corresponds to the bounds of some descendant layout object. The iterator walks
16 // in block direction order. 16 // in block direction order.
17 class FragmentainerIterator { 17 class FragmentainerIterator {
18 public: 18 public:
19 FragmentainerIterator(const LayoutFlowThread&, const LayoutRect& physicalBou ndingBoxInFlowThread, const LayoutRect& clipRectInMulticolContainer); 19 // Initialize the iterator, and move to the first fragmentainer of interest.
20 // The clip rectangle is optional. If it's empty, it means that no clipping will be performed,
21 // and that the only thing that can limit the set of fragmentainers to visit is
22 // |physicalBoundingBox|.
23 FragmentainerIterator(const LayoutFlowThread&, const LayoutRect& physicalBou ndingBoxInFlowThread, const LayoutRect& clipRectInMulticolContainer = LayoutRect ());
20 24
21 // Advance to the next fragmentainer. Not allowed to call this if atEnd() is true. 25 // Advance to the next fragmentainer. Not allowed to call this if atEnd() is true.
22 void advance(); 26 void advance();
23 27
24 // Return true if we have walked through all relevant fragmentainers. 28 // Return true if we have walked through all relevant fragmentainers.
25 bool atEnd() const { return !m_currentColumnSet; } 29 bool atEnd() const { return !m_currentColumnSet; }
26 30
27 // The physical translation to apply to shift the box when converting from f lowthread to visual 31 // The physical translation to apply to shift the box when converting from f lowthread to visual
28 // coordinates. 32 // coordinates.
29 LayoutSize paginationOffset() const { DCHECK(!atEnd()); return m_paginationO ffset; } 33 LayoutSize paginationOffset() const;
34
35 // Return the physical content box of the current fragmentainer, relative to the flow thread.
36 LayoutRect fragmentainerInFlowThread() const;
30 37
31 // Return the physical clip rectangle of the current fragmentainer, relative to the flow thread. 38 // Return the physical clip rectangle of the current fragmentainer, relative to the flow thread.
32 LayoutRect clipRectInFlowThread() const { DCHECK(!atEnd()); return m_clipRec tInFlowThread; } 39 LayoutRect clipRectInFlowThread() const;
33 40
34 private: 41 private:
35 const LayoutFlowThread& m_flowThread; 42 const LayoutFlowThread& m_flowThread;
36 const LayoutRect m_clipRectInMulticolContainer; 43 const LayoutRect m_clipRectInMulticolContainer;
37 44
38 const LayoutMultiColumnSet* m_currentColumnSet; 45 const LayoutMultiColumnSet* m_currentColumnSet;
39 unsigned m_currentFragmentainerGroupIndex; 46 unsigned m_currentFragmentainerGroupIndex;
40 unsigned m_currentFragmentainerIndex; 47 unsigned m_currentFragmentainerIndex;
41 unsigned m_endFragmentainerIndex; 48 unsigned m_endFragmentainerIndex;
42 49
43 LayoutUnit m_logicalTopInFlowThread; 50 LayoutUnit m_logicalTopInFlowThread;
44 LayoutUnit m_logicalBottomInFlowThread; 51 LayoutUnit m_logicalBottomInFlowThread;
45 52
46 LayoutSize m_paginationOffset;
47 LayoutRect m_clipRectInFlowThread;
48
49 const MultiColumnFragmentainerGroup& currentGroup() const; 53 const MultiColumnFragmentainerGroup& currentGroup() const;
50 void moveToNextFragmentainerGroup(); 54 void moveToNextFragmentainerGroup();
51 bool setFragmentainersOfInterest(); 55 bool setFragmentainersOfInterest();
52 void updateOutput();
53 void setAtEnd() { m_currentColumnSet = nullptr; } 56 void setAtEnd() { m_currentColumnSet = nullptr; }
57 bool hasClipRect() const { return !m_clipRectInMulticolContainer.isEmpty(); }
54 }; 58 };
55 59
56 } // namespace blink 60 } // namespace blink
57 61
58 #endif // FragmentainerIterator_h 62 #endif // FragmentainerIterator_h
59 63
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698