| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 Adobe Systems Incorporated. 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #define LayoutFlowThread_h | 31 #define LayoutFlowThread_h |
| 32 | 32 |
| 33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
| 34 #include "core/layout/LayoutBlockFlow.h" | 34 #include "core/layout/LayoutBlockFlow.h" |
| 35 #include "core/paint/DeprecatedPaintLayerFragment.h" | 35 #include "core/paint/DeprecatedPaintLayerFragment.h" |
| 36 #include "wtf/ListHashSet.h" | 36 #include "wtf/ListHashSet.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class LayoutMultiColumnSet; | 40 class LayoutMultiColumnSet; |
| 41 class LayoutRegion; | |
| 42 | 41 |
| 43 typedef ListHashSet<LayoutMultiColumnSet*> LayoutMultiColumnSetList; | 42 typedef ListHashSet<LayoutMultiColumnSet*> LayoutMultiColumnSetList; |
| 44 | 43 |
| 45 // LayoutFlowThread is used to collect all the layout objects that participate i
n a | 44 // LayoutFlowThread is used to collect all the layout objects that participate i
n a flow thread. It |
| 46 // flow thread. It will also help in doing the layout. However, it will not layo
ut | 45 // will also help in doing the layout. However, it will not layout directly to s
creen. Instead, |
| 47 // directly to screen. Instead, LayoutRegion objects will redirect their paint | 46 // LayoutMultiColumnSet objects will redirect their paint and nodeAtPoint method
s to this |
| 48 // and nodeAtPoint methods to this object. Each LayoutRegion will actually be a
viewPort | 47 // object. Each LayoutMultiColumnSet will actually be a viewPort of the LayoutFl
owThread. |
| 49 // of the LayoutFlowThread. | |
| 50 | |
| 51 class CORE_EXPORT LayoutFlowThread: public LayoutBlockFlow { | 48 class CORE_EXPORT LayoutFlowThread: public LayoutBlockFlow { |
| 52 public: | 49 public: |
| 53 LayoutFlowThread(); | 50 LayoutFlowThread(); |
| 54 virtual ~LayoutFlowThread() { }; | 51 virtual ~LayoutFlowThread() { }; |
| 55 | 52 |
| 56 virtual bool isLayoutFlowThread() const override final { return true; } | 53 virtual bool isLayoutFlowThread() const override final { return true; } |
| 57 virtual bool isLayoutMultiColumnFlowThread() const { return false; } | 54 virtual bool isLayoutMultiColumnFlowThread() const { return false; } |
| 58 virtual bool isLayoutPagedFlowThread() const { return false; } | 55 virtual bool isLayoutPagedFlowThread() const { return false; } |
| 59 | 56 |
| 60 virtual bool supportsPaintInvalidationStateCachedOffsets() const override {
return false; } | 57 virtual bool supportsPaintInvalidationStateCachedOffsets() const override {
return false; } |
| 61 | 58 |
| 62 virtual void layout() override; | 59 virtual void layout() override; |
| 63 | 60 |
| 64 // Always create a Layer for the LayoutFlowThread so that we | 61 // Always create a Layer for the LayoutFlowThread so that we |
| 65 // can easily avoid drawing the children directly. | 62 // can easily avoid drawing the children directly. |
| 66 virtual DeprecatedPaintLayerType layerTypeRequired() const override final {
return NormalDeprecatedPaintLayer; } | 63 virtual DeprecatedPaintLayerType layerTypeRequired() const override final {
return NormalDeprecatedPaintLayer; } |
| 67 | 64 |
| 68 // Skip past a column spanner during flow thread layout. Spanners are not la
id out inside the | 65 // Skip past a column spanner during flow thread layout. Spanners are not la
id out inside the |
| 69 // flow thread, since the flow thread is not in a spanner's containing block
chain (since the | 66 // flow thread, since the flow thread is not in a spanner's containing block
chain (since the |
| 70 // containing block is the multicol container). If the spanner follows right
after a column set | 67 // containing block is the multicol container). If the spanner follows right
after a column set |
| 71 // (as opposed to following another spanner), we may have to stretch the flo
w thread to ensure | 68 // (as opposed to following another spanner), we may have to stretch the flo
w thread to ensure |
| 72 // completely filled columns in the preceding column set. Return this adjust
ment, if any. | 69 // completely filled columns in the preceding column set. Return this adjust
ment, if any. |
| 73 virtual LayoutUnit skipColumnSpanner(LayoutBox*, LayoutUnit logicalTopInFlow
Thread) { return LayoutUnit(); } | 70 virtual LayoutUnit skipColumnSpanner(LayoutBox*, LayoutUnit logicalTopInFlow
Thread) { return LayoutUnit(); } |
| 74 | 71 |
| 75 virtual void flowThreadDescendantWasInserted(LayoutObject*) { } | 72 virtual void flowThreadDescendantWasInserted(LayoutObject*) { } |
| 76 virtual void flowThreadDescendantWillBeRemoved(LayoutObject*) { } | 73 virtual void flowThreadDescendantWillBeRemoved(LayoutObject*) { } |
| 77 | 74 |
| 78 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset, HitTestAction) override final; | 75 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset, HitTestAction) override final; |
| 79 | 76 |
| 80 virtual void addRegionToThread(LayoutMultiColumnSet*) = 0; | 77 virtual void addColumnSetToThread(LayoutMultiColumnSet*) = 0; |
| 81 virtual void removeRegionFromThread(LayoutMultiColumnSet*); | 78 virtual void removeColumnSetFromThread(LayoutMultiColumnSet*); |
| 82 | 79 |
| 83 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const override; | 80 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const override; |
| 84 | 81 |
| 85 bool hasRegions() const { return m_multiColumnSetList.size(); } | 82 bool hasColumnSets() const { return m_multiColumnSetList.size(); } |
| 86 | 83 |
| 87 void validateRegions(); | 84 void validateColumnSets(); |
| 88 void invalidateRegions(); | 85 void invalidateColumnSets(); |
| 89 bool hasValidRegionInfo() const { return !m_regionsInvalidated && !m_multiCo
lumnSetList.isEmpty(); } | 86 bool hasValidColumnSetInfo() const { return !m_columnSetsInvalidated && !m_m
ultiColumnSetList.isEmpty(); } |
| 90 | 87 |
| 91 virtual void mapRectToPaintInvalidationBacking(const LayoutBoxModelObject* p
aintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const ove
rride; | 88 virtual void mapRectToPaintInvalidationBacking(const LayoutBoxModelObject* p
aintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const ove
rride; |
| 92 | 89 |
| 93 LayoutUnit pageLogicalHeightForOffset(LayoutUnit); | 90 LayoutUnit pageLogicalHeightForOffset(LayoutUnit); |
| 94 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule
= IncludePageBoundary); | 91 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule
= IncludePageBoundary); |
| 95 | 92 |
| 96 virtual void setPageBreak(LayoutUnit /*offset*/, LayoutUnit /*spaceShortage*
/) { } | 93 virtual void setPageBreak(LayoutUnit /*offset*/, LayoutUnit /*spaceShortage*
/) { } |
| 97 virtual void updateMinimumPageHeight(LayoutUnit /*offset*/, LayoutUnit /*min
Height*/) { } | 94 virtual void updateMinimumPageHeight(LayoutUnit /*offset*/, LayoutUnit /*min
Height*/) { } |
| 98 | 95 |
| 99 bool regionsHaveUniformLogicalHeight() const { return m_regionsHaveUniformLo
gicalHeight; } | 96 bool columnSetsHaveUniformLogicalHeight() const { return m_columnSetsHaveUni
formLogicalHeight; } |
| 100 | 97 |
| 101 // FIXME: These 2 functions should return a LayoutMultiColumnSet. | 98 virtual bool addForcedColumnBreak(LayoutUnit, LayoutObject* breakChild, bool
isBefore, LayoutUnit* offsetBreakAdjustment = 0) { return false; } |
| 102 LayoutRegion* firstRegion() const; | |
| 103 LayoutRegion* lastRegion() const; | |
| 104 | |
| 105 virtual bool addForcedRegionBreak(LayoutUnit, LayoutObject* breakChild, bool
isBefore, LayoutUnit* offsetBreakAdjustment = 0) { return false; } | |
| 106 | 99 |
| 107 virtual bool isPageLogicalHeightKnown() const { return true; } | 100 virtual bool isPageLogicalHeightKnown() const { return true; } |
| 108 bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; } | 101 bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; } |
| 109 | 102 |
| 110 void collectLayerFragments(DeprecatedPaintLayerFragments&, const LayoutRect&
layerBoundingBox, const LayoutRect& dirtyRect); | 103 void collectLayerFragments(DeprecatedPaintLayerFragments&, const LayoutRect&
layerBoundingBox, const LayoutRect& dirtyRect); |
| 111 | 104 |
| 112 // Return the visual bounding box based on the supplied flow-thread bounding
box. Both | 105 // Return the visual bounding box based on the supplied flow-thread bounding
box. Both |
| 113 // rectangles are completely physical in terms of writing mode. | 106 // rectangles are completely physical in terms of writing mode. |
| 114 LayoutRect fragmentsBoundingBox(const LayoutRect& layerBoundingBox) const; | 107 LayoutRect fragmentsBoundingBox(const LayoutRect& layerBoundingBox) const; |
| 115 | 108 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 142 |
| 150 LayoutMultiColumnSet* result() const { return m_result; } | 143 LayoutMultiColumnSet* result() const { return m_result; } |
| 151 | 144 |
| 152 private: | 145 private: |
| 153 LayoutUnit m_offset; | 146 LayoutUnit m_offset; |
| 154 LayoutMultiColumnSet* m_result; | 147 LayoutMultiColumnSet* m_result; |
| 155 }; | 148 }; |
| 156 | 149 |
| 157 MultiColumnSetIntervalTree m_multiColumnSetIntervalTree; | 150 MultiColumnSetIntervalTree m_multiColumnSetIntervalTree; |
| 158 | 151 |
| 159 bool m_regionsInvalidated : 1; | 152 bool m_columnSetsInvalidated : 1; |
| 160 bool m_regionsHaveUniformLogicalHeight : 1; | 153 bool m_columnSetsHaveUniformLogicalHeight : 1; |
| 161 bool m_pageLogicalSizeChanged : 1; | 154 bool m_pageLogicalSizeChanged : 1; |
| 162 }; | 155 }; |
| 163 | 156 |
| 164 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlowThread, isLayoutFlowThread()); | 157 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlowThread, isLayoutFlowThread()); |
| 165 | 158 |
| 166 // These structures are used by PODIntervalTree for debugging. | 159 // These structures are used by PODIntervalTree for debugging. |
| 167 #ifndef NDEBUG | 160 #ifndef NDEBUG |
| 168 template <> struct ValueToString<LayoutUnit> { | 161 template <> struct ValueToString<LayoutUnit> { |
| 169 static String string(const LayoutUnit value) { return String::number(value.t
oFloat()); } | 162 static String string(const LayoutUnit value) { return String::number(value.t
oFloat()); } |
| 170 }; | 163 }; |
| 171 | 164 |
| 172 template <> struct ValueToString<LayoutMultiColumnSet*> { | 165 template <> struct ValueToString<LayoutMultiColumnSet*> { |
| 173 static String string(const LayoutMultiColumnSet* value) { return String::for
mat("%p", value); } | 166 static String string(const LayoutMultiColumnSet* value) { return String::for
mat("%p", value); } |
| 174 }; | 167 }; |
| 175 #endif | 168 #endif |
| 176 | 169 |
| 177 } // namespace blink | 170 } // namespace blink |
| 178 | 171 |
| 179 #endif // LayoutFlowThread_h | 172 #endif // LayoutFlowThread_h |
| OLD | NEW |