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. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class BidiContext; | 42 class BidiContext; |
43 class InlineIterator; | 43 class InlineIterator; |
44 class LayoutStateMaintainer; | 44 class LayoutStateMaintainer; |
45 class LineLayoutState; | 45 class LineLayoutState; |
46 class LineWidth; | 46 class LineWidth; |
47 class RenderInline; | 47 class RenderInline; |
48 class RenderText; | 48 class RenderText; |
49 | 49 |
50 struct BidiRun; | 50 struct BidiRun; |
51 struct PaintInfo; | 51 struct PaintInfo; |
| 52 class LineBreaker; |
52 class LineInfo; | 53 class LineInfo; |
53 class RenderRubyRun; | 54 class RenderRubyRun; |
54 class TextLayout; | 55 class TextLayout; |
55 class WordMeasurement; | 56 class WordMeasurement; |
56 | 57 |
57 template <class Iterator, class Run> class BidiResolver; | 58 template <class Iterator, class Run> class BidiResolver; |
58 template <class Run> class BidiRunList; | 59 template <class Run> class BidiRunList; |
59 template <class Iterator> struct MidpointState; | 60 template <class Iterator> struct MidpointState; |
60 typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver; | 61 typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver; |
61 typedef MidpointState<InlineIterator> LineMidpointState; | 62 typedef MidpointState<InlineIterator> LineMidpointState; |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) con
st | 669 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) con
st |
669 { | 670 { |
670 if (isHorizontalWritingMode()) | 671 if (isHorizontalWritingMode()) |
671 return child->y() + marginBeforeForChild(child->renderer()); | 672 return child->y() + marginBeforeForChild(child->renderer()); |
672 else | 673 else |
673 return child->y() + child->renderer()->marginTop(); | 674 return child->y() + child->renderer()->marginTop(); |
674 } | 675 } |
675 | 676 |
676 LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit
logicalTopOffset) const; | 677 LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit
logicalTopOffset) const; |
677 | 678 |
678 // The following functions' implementations are in RenderBlockLineLayout.cpp
. | |
679 struct RenderTextInfo { | |
680 // Destruction of m_layout requires TextLayout to be a complete type, so
the constructor and destructor are made non-inline to avoid compilation errors. | |
681 RenderTextInfo(); | |
682 ~RenderTextInfo(); | |
683 | |
684 RenderText* m_text; | |
685 OwnPtr<TextLayout> m_layout; | |
686 LazyLineBreakIterator m_lineBreakIterator; | |
687 const Font* m_font; | |
688 }; | |
689 | |
690 class LineBreaker { | |
691 public: | |
692 LineBreaker(RenderBlock* block) | |
693 : m_block(block) | |
694 { | |
695 reset(); | |
696 } | |
697 | |
698 InlineIterator nextLineBreak(InlineBidiResolver&, LineInfo&, RenderTextI
nfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedL
ines, WordMeasurements&); | |
699 | |
700 bool lineWasHyphenated() { return m_hyphenated; } | |
701 const Vector<RenderBox*>& positionedObjects() { return m_positionedObjec
ts; } | |
702 EClear clear() { return m_clear; } | |
703 private: | |
704 void reset(); | |
705 | |
706 InlineIterator nextSegmentBreak(InlineBidiResolver&, LineInfo&, RenderTe
xtInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenat
edLines, WordMeasurements&); | |
707 void skipTrailingWhitespace(InlineIterator&, const LineInfo&); | |
708 void skipLeadingWhitespace(InlineBidiResolver&, LineInfo&, FloatingObjec
t* lastFloatFromPreviousLine, LineWidth&); | |
709 | |
710 RenderBlock* m_block; | |
711 bool m_hyphenated; | |
712 EClear m_clear; | |
713 Vector<RenderBox*> m_positionedObjects; | |
714 }; | |
715 | |
716 void checkFloatsInCleanLine(RootInlineBox*, Vector<FloatWithRect>&, size_t&
floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat); | 679 void checkFloatsInCleanLine(RootInlineBox*, Vector<FloatWithRect>&, size_t&
floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat); |
717 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&)
; | 680 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&)
; |
718 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI
terator& cleanLineStart, BidiStatus& cleanLineBidiStatus); | 681 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI
terator& cleanLineStart, BidiStatus& cleanLineBidiStatus); |
719 bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const Inlin
eIterator& endLineStart, const BidiStatus& endLineStatus); | 682 bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const Inlin
eIterator& endLineStart, const BidiStatus& endLineStatus); |
720 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&); | 683 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&); |
721 | 684 |
722 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); | 685 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); |
723 InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* ch
ildBox, bool startsNewSegment); | 686 InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* ch
ildBox, bool startsNewSegment); |
724 | 687 |
725 void setMarginsForRubyRun(BidiRun*, RenderRubyRun*, RenderObject*, const Lin
eInfo&); | 688 void setMarginsForRubyRun(BidiRun*, RenderRubyRun*, RenderObject*, const Lin
eInfo&); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 mutable signed m_lineHeight : 27; | 1037 mutable signed m_lineHeight : 27; |
1075 unsigned m_hasMarginBeforeQuirk : 1; // Note these quirk values can't be put
in RenderBlockRareData since they are set too frequently. | 1038 unsigned m_hasMarginBeforeQuirk : 1; // Note these quirk values can't be put
in RenderBlockRareData since they are set too frequently. |
1076 unsigned m_hasMarginAfterQuirk : 1; | 1039 unsigned m_hasMarginAfterQuirk : 1; |
1077 unsigned m_beingDestroyed : 1; | 1040 unsigned m_beingDestroyed : 1; |
1078 unsigned m_hasMarkupTruncation : 1; | 1041 unsigned m_hasMarkupTruncation : 1; |
1079 unsigned m_hasBorderOrPaddingLogicalWidthChanged : 1; | 1042 unsigned m_hasBorderOrPaddingLogicalWidthChanged : 1; |
1080 | 1043 |
1081 // RenderRubyBase objects need to be able to split and merge, moving their c
hildren around | 1044 // RenderRubyBase objects need to be able to split and merge, moving their c
hildren around |
1082 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). | 1045 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). |
1083 friend class RenderRubyBase; | 1046 friend class RenderRubyBase; |
| 1047 friend class LineBreaker; |
1084 friend class LineWidth; // Needs to know FloatingObject | 1048 friend class LineWidth; // Needs to know FloatingObject |
1085 | 1049 |
1086 private: | 1050 private: |
1087 // Used to store state between styleWillChange and styleDidChange | 1051 // Used to store state between styleWillChange and styleDidChange |
1088 static bool s_canPropagateFloatIntoSibling; | 1052 static bool s_canPropagateFloatIntoSibling; |
1089 }; | 1053 }; |
1090 | 1054 |
1091 inline RenderBlock* toRenderBlock(RenderObject* object) | 1055 inline RenderBlock* toRenderBlock(RenderObject* object) |
1092 { | 1056 { |
1093 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock()); | 1057 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock()); |
1094 return static_cast<RenderBlock*>(object); | 1058 return static_cast<RenderBlock*>(object); |
1095 } | 1059 } |
1096 | 1060 |
1097 inline const RenderBlock* toRenderBlock(const RenderObject* object) | 1061 inline const RenderBlock* toRenderBlock(const RenderObject* object) |
1098 { | 1062 { |
1099 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock()); | 1063 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderBlock()); |
1100 return static_cast<const RenderBlock*>(object); | 1064 return static_cast<const RenderBlock*>(object); |
1101 } | 1065 } |
1102 | 1066 |
1103 // This will catch anyone doing an unnecessary cast. | 1067 // This will catch anyone doing an unnecessary cast. |
1104 void toRenderBlock(const RenderBlock*); | 1068 void toRenderBlock(const RenderBlock*); |
1105 | 1069 |
1106 } // namespace WebCore | 1070 } // namespace WebCore |
1107 | 1071 |
1108 #endif // RenderBlock_h | 1072 #endif // RenderBlock_h |
OLD | NEW |