OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #ifndef RenderBlock_h | 23 #ifndef RenderBlock_h |
24 #define RenderBlock_h | 24 #define RenderBlock_h |
25 | 25 |
26 #include "core/platform/PODIntervalTree.h" | |
27 #include "core/platform/graphics/TextRun.h" | 26 #include "core/platform/graphics/TextRun.h" |
28 #include "core/platform/text/TextBreakIterator.h" | 27 #include "core/platform/text/TextBreakIterator.h" |
29 #include "core/rendering/ColumnInfo.h" | 28 #include "core/rendering/ColumnInfo.h" |
| 29 #include "core/rendering/FloatingObjects.h" |
30 #include "core/rendering/GapRects.h" | 30 #include "core/rendering/GapRects.h" |
31 #include "core/rendering/RenderBox.h" | 31 #include "core/rendering/RenderBox.h" |
32 #include "core/rendering/RenderLineBoxList.h" | 32 #include "core/rendering/RenderLineBoxList.h" |
33 #include "core/rendering/RootInlineBox.h" | 33 #include "core/rendering/RootInlineBox.h" |
34 #include "core/rendering/shapes/ShapeInsideInfo.h" | 34 #include "core/rendering/shapes/ShapeInsideInfo.h" |
35 #include "core/rendering/style/ShapeValue.h" | 35 #include "core/rendering/style/ShapeValue.h" |
36 #include "wtf/ListHashSet.h" | 36 #include "wtf/ListHashSet.h" |
37 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 DefaultTextRunFlags = 0, | 71 DefaultTextRunFlags = 0, |
72 RespectDirection = 1 << 0, | 72 RespectDirection = 1 << 0, |
73 RespectDirectionOverride = 1 << 1 | 73 RespectDirectionOverride = 1 << 1 |
74 }; | 74 }; |
75 | 75 |
76 typedef unsigned TextRunFlags; | 76 typedef unsigned TextRunFlags; |
77 | 77 |
78 class RenderBlock : public RenderBox { | 78 class RenderBlock : public RenderBox { |
79 public: | 79 public: |
80 friend class LineLayoutState; | 80 friend class LineLayoutState; |
81 #ifndef NDEBUG | |
82 // Used by the PODIntervalTree for debugging the FloatingObject. | |
83 template <class> friend struct ValueToString; | |
84 #endif | |
85 | |
86 explicit RenderBlock(ContainerNode*); | 81 explicit RenderBlock(ContainerNode*); |
87 virtual ~RenderBlock(); | 82 virtual ~RenderBlock(); |
88 | 83 |
89 static RenderBlock* createAnonymous(Document*); | 84 static RenderBlock* createAnonymous(Document*); |
90 | 85 |
91 RenderObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } | 86 RenderObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } |
92 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } | 87 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } |
93 | 88 |
94 const RenderObjectChildList* children() const { return &m_children; } | 89 const RenderObjectChildList* children() const { return &m_children; } |
95 RenderObjectChildList* children() { return &m_children; } | 90 RenderObjectChildList* children() { return &m_children; } |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } | 572 } |
578 | 573 |
579 bool updateRegionsAndShapesLogicalSize(RenderFlowThread*); | 574 bool updateRegionsAndShapesLogicalSize(RenderFlowThread*); |
580 void computeRegionRangeForBlock(RenderFlowThread*); | 575 void computeRegionRangeForBlock(RenderFlowThread*); |
581 | 576 |
582 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox*
); | 577 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox*
); |
583 | 578 |
584 virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHe
ight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight); | 579 virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHe
ight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight); |
585 | 580 |
586 private: | 581 private: |
587 enum ShapeOutsideFloatOffsetMode { ShapeOutsideFloatShapeOffset, ShapeOutsid
eFloatMarginBoxOffset }; | |
588 | |
589 LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit
fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, ShapeOutside
FloatOffsetMode) const; | 582 LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit
fixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, ShapeOutside
FloatOffsetMode) const; |
590 LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit f
ixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, ShapeOutsideF
loatOffsetMode) const; | 583 LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit f
ixedOffset, LayoutUnit* heightRemaining, LayoutUnit logicalHeight, ShapeOutsideF
loatOffsetMode) const; |
591 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool
applyTextIndent) const; | 584 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool
applyTextIndent) const; |
592 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool
applyTextIndent) const; | 585 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool
applyTextIndent) const; |
593 | 586 |
594 void computeShapeSize(); | 587 void computeShapeSize(); |
595 void updateRegionsAndShapesAfterChildLayout(RenderFlowThread*, bool); | 588 void updateRegionsAndShapesAfterChildLayout(RenderFlowThread*, bool); |
596 void updateShapeInsideInfoAfterStyleChange(const ShapeValue*, const ShapeVal
ue* oldShape); | 589 void updateShapeInsideInfoAfterStyleChange(const ShapeValue*, const ShapeVal
ue* oldShape); |
597 | 590 |
598 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi
ldren(); } | 591 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi
ldren(); } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 , rect(LayoutRect(f->x() - f->marginLeft(), f->y() - f->marginTop(),
f->width() + f->marginWidth(), f->height() + f->marginHeight())) | 641 , rect(LayoutRect(f->x() - f->marginLeft(), f->y() - f->marginTop(),
f->width() + f->marginWidth(), f->height() + f->marginHeight())) |
649 , everHadLayout(f->everHadLayout()) | 642 , everHadLayout(f->everHadLayout()) |
650 { | 643 { |
651 } | 644 } |
652 | 645 |
653 RenderBox* object; | 646 RenderBox* object; |
654 LayoutRect rect; | 647 LayoutRect rect; |
655 bool everHadLayout; | 648 bool everHadLayout; |
656 }; | 649 }; |
657 | 650 |
658 class FloatingObject { | |
659 WTF_MAKE_NONCOPYABLE(FloatingObject); WTF_MAKE_FAST_ALLOCATED; | |
660 public: | |
661 // Note that Type uses bits so you can use FloatLeftRight as a mask to q
uery for both left and right. | |
662 enum Type { FloatLeft = 1, FloatRight = 2, FloatLeftRight = 3 }; | |
663 | |
664 FloatingObject(EFloat type) | |
665 : m_renderer(0) | |
666 , m_originatingLine(0) | |
667 , m_paginationStrut(0) | |
668 , m_shouldPaint(true) | |
669 , m_isDescendant(false) | |
670 , m_isPlaced(false) | |
671 #ifndef NDEBUG | |
672 , m_isInPlacedTree(false) | |
673 #endif | |
674 { | |
675 ASSERT(type != NoFloat); | |
676 if (type == LeftFloat) | |
677 m_type = FloatLeft; | |
678 else if (type == RightFloat) | |
679 m_type = FloatRight; | |
680 } | |
681 | |
682 FloatingObject(Type type, const LayoutRect& frameRect) | |
683 : m_renderer(0) | |
684 , m_originatingLine(0) | |
685 , m_frameRect(frameRect) | |
686 , m_paginationStrut(0) | |
687 , m_type(type) | |
688 , m_shouldPaint(true) | |
689 , m_isDescendant(false) | |
690 , m_isPlaced(true) | |
691 #ifndef NDEBUG | |
692 , m_isInPlacedTree(false) | |
693 #endif | |
694 { | |
695 } | |
696 | |
697 FloatingObject* clone() const | |
698 { | |
699 FloatingObject* cloneObject = new FloatingObject(type(), m_frameRect
); | |
700 cloneObject->m_renderer = m_renderer; | |
701 cloneObject->m_originatingLine = m_originatingLine; | |
702 cloneObject->m_paginationStrut = m_paginationStrut; | |
703 cloneObject->m_shouldPaint = m_shouldPaint; | |
704 cloneObject->m_isDescendant = m_isDescendant; | |
705 cloneObject->m_isPlaced = m_isPlaced; | |
706 return cloneObject; | |
707 } | |
708 | |
709 Type type() const { return static_cast<Type>(m_type); } | |
710 RenderBox* renderer() const { return m_renderer; } | |
711 | |
712 bool isPlaced() const { return m_isPlaced; } | |
713 void setIsPlaced(bool placed = true) { m_isPlaced = placed; } | |
714 | |
715 LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); } | |
716 LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX();
} | |
717 LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); } | |
718 LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY();
} | |
719 LayoutUnit width() const { return m_frameRect.width(); } | |
720 LayoutUnit height() const { return m_frameRect.height(); } | |
721 | |
722 void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x)
; } | |
723 void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y)
; } | |
724 void setWidth(LayoutUnit width) { ASSERT(!isInPlacedTree()); m_frameRect
.setWidth(width); } | |
725 void setHeight(LayoutUnit height) { ASSERT(!isInPlacedTree()); m_frameRe
ct.setHeight(height); } | |
726 | |
727 const LayoutRect& frameRect() const { ASSERT(isPlaced()); return m_frame
Rect; } | |
728 void setFrameRect(const LayoutRect& frameRect) { ASSERT(!isInPlacedTree(
)); m_frameRect = frameRect; } | |
729 | |
730 int paginationStrut() const { return m_paginationStrut; } | |
731 void setPaginationStrut(int strut) { m_paginationStrut = strut; } | |
732 | |
733 #ifndef NDEBUG | |
734 bool isInPlacedTree() const { return m_isInPlacedTree; } | |
735 void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } | |
736 #endif | |
737 | |
738 bool shouldPaint() const { return m_shouldPaint; } | |
739 void setShouldPaint(bool shouldPaint) { m_shouldPaint = shouldPaint; } | |
740 bool isDescendant() const { return m_isDescendant; } | |
741 void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant;
} | |
742 | |
743 // FIXME: Callers of these methods are dangerous and should be whitelist
ed explicitly or removed. | |
744 void setRenderer(RenderBox* renderer) { m_renderer = renderer; } | |
745 RootInlineBox* originatingLine() const { return m_originatingLine; } | |
746 void setOriginatingLine(RootInlineBox* line) { m_originatingLine = line;
} | |
747 | |
748 LayoutUnit logicalTop(bool isHorizontalWritingMode) const { return isHor
izontalWritingMode ? y() : x(); } | |
749 LayoutUnit logicalBottom(bool isHorizontalWritingMode) const { return is
HorizontalWritingMode ? maxY() : maxX(); } | |
750 LayoutUnit logicalLeft(bool isHorizontalWritingMode) const { return isHo
rizontalWritingMode ? x() : y(); } | |
751 LayoutUnit logicalRight(bool isHorizontalWritingMode) const { return isH
orizontalWritingMode ? maxX() : maxY(); } | |
752 LayoutUnit logicalWidth(bool isHorizontalWritingMode) const { return isH
orizontalWritingMode ? width() : height(); } | |
753 | |
754 int pixelSnappedLogicalTop(bool isHorizontalWritingMode) const { return
isHorizontalWritingMode ? frameRect().pixelSnappedY() : frameRect().pixelSnapped
X(); } | |
755 int pixelSnappedLogicalBottom(bool isHorizontalWritingMode) const { retu
rn isHorizontalWritingMode ? frameRect().pixelSnappedMaxY() : frameRect().pixelS
nappedMaxX(); } | |
756 int pixelSnappedLogicalLeft(bool isHorizontalWritingMode) const { return
isHorizontalWritingMode ? frameRect().pixelSnappedX() : frameRect().pixelSnappe
dY(); } | |
757 int pixelSnappedLogicalRight(bool isHorizontalWritingMode) const { retur
n isHorizontalWritingMode ? frameRect().pixelSnappedMaxX() : frameRect().pixelSn
appedMaxY(); } | |
758 | |
759 void setLogicalTop(LayoutUnit logicalTop, bool isHorizontalWritingMode) | |
760 { | |
761 if (isHorizontalWritingMode) | |
762 setY(logicalTop); | |
763 else | |
764 setX(logicalTop); | |
765 } | |
766 void setLogicalLeft(LayoutUnit logicalLeft, bool isHorizontalWritingMode
) | |
767 { | |
768 if (isHorizontalWritingMode) | |
769 setX(logicalLeft); | |
770 else | |
771 setY(logicalLeft); | |
772 } | |
773 void setLogicalHeight(LayoutUnit logicalHeight, bool isHorizontalWriting
Mode) | |
774 { | |
775 if (isHorizontalWritingMode) | |
776 setHeight(logicalHeight); | |
777 else | |
778 setWidth(logicalHeight); | |
779 } | |
780 void setLogicalWidth(LayoutUnit logicalWidth, bool isHorizontalWritingMo
de) | |
781 { | |
782 if (isHorizontalWritingMode) | |
783 setWidth(logicalWidth); | |
784 else | |
785 setHeight(logicalWidth); | |
786 } | |
787 | |
788 private: | |
789 RenderBox* m_renderer; | |
790 RootInlineBox* m_originatingLine; | |
791 LayoutRect m_frameRect; | |
792 int m_paginationStrut; // FIXME: Is this class size-sensitive? Does this
need 32-bits? | |
793 | |
794 unsigned m_type : 2; // Type (left or right aligned) | |
795 unsigned m_shouldPaint : 1; | |
796 unsigned m_isDescendant : 1; | |
797 unsigned m_isPlaced : 1; | |
798 #ifndef NDEBUG | |
799 unsigned m_isInPlacedTree : 1; | |
800 #endif | |
801 }; | |
802 | |
803 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const Lay
outPoint&) const; | 651 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const Lay
outPoint&) const; |
804 | 652 |
805 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) con
st | 653 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) con
st |
806 { | 654 { |
807 if (isHorizontalWritingMode()) | 655 if (isHorizontalWritingMode()) |
808 return child->x() + child->renderer()->marginLeft(); | 656 return child->x() + child->renderer()->marginLeft(); |
809 else | 657 else |
810 return child->x() + marginBeforeForChild(child->renderer()); | 658 return child->x() + marginBeforeForChild(child->renderer()); |
811 } | 659 } |
812 | 660 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 virtual bool updateLogicalWidthAndColumnWidth(); | 998 virtual bool updateLogicalWidthAndColumnWidth(); |
1151 | 999 |
1152 virtual bool canCollapseAnonymousBlockChild() const { return true; } | 1000 virtual bool canCollapseAnonymousBlockChild() const { return true; } |
1153 | 1001 |
1154 public: | 1002 public: |
1155 LayoutUnit offsetFromLogicalTopOfFirstPage() const; | 1003 LayoutUnit offsetFromLogicalTopOfFirstPage() const; |
1156 RenderRegion* regionAtBlockOffset(LayoutUnit) const; | 1004 RenderRegion* regionAtBlockOffset(LayoutUnit) const; |
1157 RenderRegion* clampToStartAndEndRegions(RenderRegion*) const; | 1005 RenderRegion* clampToStartAndEndRegions(RenderRegion*) const; |
1158 | 1006 |
1159 protected: | 1007 protected: |
1160 struct FloatingObjectHashFunctions { | |
1161 static unsigned hash(FloatingObject* key) { return DefaultHash<RenderBox
*>::Hash::hash(key->renderer()); } | |
1162 static bool equal(FloatingObject* a, FloatingObject* b) { return a->rend
erer() == b->renderer(); } | |
1163 static const bool safeToCompareToEmptyOrDeleted = true; | |
1164 }; | |
1165 struct FloatingObjectHashTranslator { | |
1166 static unsigned hash(RenderBox* key) { return DefaultHash<RenderBox*>::H
ash::hash(key); } | |
1167 static bool equal(FloatingObject* a, RenderBox* b) { return a->renderer(
) == b; } | |
1168 }; | |
1169 typedef ListHashSet<FloatingObject*, 4, FloatingObjectHashFunctions> Floatin
gObjectSet; | |
1170 typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; | |
1171 typedef PODInterval<int, FloatingObject*> FloatingObjectInterval; | |
1172 typedef PODIntervalTree<int, FloatingObject*> FloatingObjectTree; | |
1173 typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> Inte
rvalArena; | |
1174 | |
1175 template <FloatingObject::Type FloatTypeValue> | |
1176 class ComputeFloatOffsetAdapter { | |
1177 public: | |
1178 typedef FloatingObjectInterval IntervalType; | |
1179 | |
1180 ComputeFloatOffsetAdapter(const RenderBlock* renderer, int lineTop, int
lineBottom, LayoutUnit& offset) | |
1181 : m_renderer(renderer) | |
1182 , m_lineTop(lineTop) | |
1183 , m_lineBottom(lineBottom) | |
1184 , m_offset(offset) | |
1185 , m_outermostFloat(0) | |
1186 { | |
1187 } | |
1188 | |
1189 inline int lowValue() const { return m_lineTop; } | |
1190 inline int highValue() const { return m_lineBottom; } | |
1191 void collectIfNeeded(const IntervalType&); | |
1192 | |
1193 // When computing the offset caused by the floats on a given line, if | |
1194 // the outermost float on that line has a shape-outside, the inline | |
1195 // content that butts up against that float must be positioned using | |
1196 // the contours of the shape, not the margin box of the float. | |
1197 const FloatingObject* outermostFloat() const { return m_outermostFloat;
} | |
1198 | |
1199 LayoutUnit getHeightRemaining() const; | |
1200 | |
1201 private: | |
1202 bool updateOffsetIfNeeded(const FloatingObject*); | |
1203 | |
1204 const RenderBlock* m_renderer; | |
1205 int m_lineTop; | |
1206 int m_lineBottom; | |
1207 LayoutUnit& m_offset; | |
1208 const FloatingObject* m_outermostFloat; | |
1209 }; | |
1210 | 1008 |
1211 void createFloatingObjects(); | 1009 void createFloatingObjects(); |
1212 | 1010 |
1213 public: | 1011 public: |
1214 | 1012 |
1215 class FloatingObjects { | |
1216 WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; | |
1217 public: | |
1218 ~FloatingObjects(); | |
1219 | |
1220 void clear(); | |
1221 void add(FloatingObject*); | |
1222 void remove(FloatingObject*); | |
1223 void addPlacedObject(FloatingObject*); | |
1224 void removePlacedObject(FloatingObject*); | |
1225 void setHorizontalWritingMode(bool b = true) { m_horizontalWritingMode =
b; } | |
1226 | |
1227 bool hasLeftObjects() const { return m_leftObjectsCount > 0; } | |
1228 bool hasRightObjects() const { return m_rightObjectsCount > 0; } | |
1229 const FloatingObjectSet& set() const { return m_set; } | |
1230 void clearLineBoxTreePointers(); | |
1231 LayoutUnit logicalLeftOffset(LayoutUnit fixedOffset, LayoutUnit logicalT
op, LayoutUnit logicalHeight, ShapeOutsideFloatOffsetMode = ShapeOutsideFloatSha
peOffset, LayoutUnit* heightRemaining = 0); | |
1232 LayoutUnit logicalRightOffset(LayoutUnit fixedOffset, LayoutUnit logical
Top, LayoutUnit logicalHeight, ShapeOutsideFloatOffsetMode = ShapeOutsideFloatSh
apeOffset, LayoutUnit* heightRemaining = 0); | |
1233 private: | |
1234 FloatingObjects(const RenderBlock*, bool horizontalWritingMode); | |
1235 void computePlacedFloatsTree(); | |
1236 const FloatingObjectTree& placedFloatsTree() | |
1237 { | |
1238 if (!m_placedFloatsTree.isInitialized()) | |
1239 computePlacedFloatsTree(); | |
1240 return m_placedFloatsTree; | |
1241 } | |
1242 void increaseObjectsCount(FloatingObject::Type); | |
1243 void decreaseObjectsCount(FloatingObject::Type); | |
1244 FloatingObjectInterval intervalForFloatingObject(FloatingObject*); | |
1245 | |
1246 FloatingObjectSet m_set; | |
1247 FloatingObjectTree m_placedFloatsTree; | |
1248 unsigned m_leftObjectsCount; | |
1249 unsigned m_rightObjectsCount; | |
1250 bool m_horizontalWritingMode; | |
1251 const RenderBlock* m_renderer; | |
1252 | |
1253 friend void RenderBlock::createFloatingObjects(); | |
1254 }; | |
1255 | |
1256 // Allocated only when some of these fields have non-default values | 1013 // Allocated only when some of these fields have non-default values |
1257 struct RenderBlockRareData { | 1014 struct RenderBlockRareData { |
1258 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; | 1015 WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; |
1259 public: | 1016 public: |
1260 RenderBlockRareData(const RenderBlock* block) | 1017 RenderBlockRareData(const RenderBlock* block) |
1261 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore
Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl
ock)) | 1018 : m_margins(positiveMarginBeforeDefault(block), negativeMarginBefore
Default(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(bl
ock)) |
1262 , m_paginationStrut(0) | 1019 , m_paginationStrut(0) |
1263 , m_pageLogicalOffset(0) | 1020 , m_pageLogicalOffset(0) |
1264 , m_lineGridBox(0) | 1021 , m_lineGridBox(0) |
1265 , m_lineBreakToAvoidWidow(0) | 1022 , m_lineBreakToAvoidWidow(0) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 | 1089 |
1333 inline const RenderBlock* toRenderBlock(const RenderObject* object) | 1090 inline const RenderBlock* toRenderBlock(const RenderObject* object) |
1334 { | 1091 { |
1335 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock()); | 1092 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock()); |
1336 return static_cast<const RenderBlock*>(object); | 1093 return static_cast<const RenderBlock*>(object); |
1337 } | 1094 } |
1338 | 1095 |
1339 // This will catch anyone doing an unnecessary cast. | 1096 // This will catch anyone doing an unnecessary cast. |
1340 void toRenderBlock(const RenderBlock*); | 1097 void toRenderBlock(const RenderBlock*); |
1341 | 1098 |
1342 #ifndef NDEBUG | |
1343 // These structures are used by PODIntervalTree for debugging purposes. | |
1344 template <> struct ValueToString<int> { | |
1345 static String string(const int value); | |
1346 }; | |
1347 template<> struct ValueToString<RenderBlock::FloatingObject*> { | |
1348 static String string(const RenderBlock::FloatingObject*); | |
1349 }; | |
1350 #endif | |
1351 | |
1352 } // namespace WebCore | 1099 } // namespace WebCore |
1353 | 1100 |
1354 #endif // RenderBlock_h | 1101 #endif // RenderBlock_h |
OLD | NEW |