OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "core/rendering/RenderCounter.h" | 27 #include "core/rendering/RenderCounter.h" |
28 #include "core/rendering/RenderFlowThread.h" | 28 #include "core/rendering/RenderFlowThread.h" |
29 #include "core/rendering/RenderLayer.h" | 29 #include "core/rendering/RenderLayer.h" |
30 #include "core/rendering/RenderListMarker.h" | 30 #include "core/rendering/RenderListMarker.h" |
31 #include "core/rendering/RenderRegion.h" | 31 #include "core/rendering/RenderRegion.h" |
32 #include "core/rendering/RenderRubyRun.h" | 32 #include "core/rendering/RenderRubyRun.h" |
33 #include "core/rendering/RenderView.h" | 33 #include "core/rendering/RenderView.h" |
34 #include "core/rendering/TrailingFloatsRootInlineBox.h" | 34 #include "core/rendering/TrailingFloatsRootInlineBox.h" |
35 #include "core/rendering/VerticalPositionCache.h" | 35 #include "core/rendering/VerticalPositionCache.h" |
36 #include "core/rendering/line/BreakingContextInlineHeaders.h" | 36 #include "core/rendering/line/BreakingContextInlineHeaders.h" |
| 37 #include "core/rendering/line/LineLayoutState.h" |
37 #include "core/rendering/svg/SVGRootInlineBox.h" | 38 #include "core/rendering/svg/SVGRootInlineBox.h" |
38 #include "platform/text/BidiResolver.h" | 39 #include "platform/text/BidiResolver.h" |
39 #include "wtf/RefCountedLeakCounter.h" | 40 #include "wtf/RefCountedLeakCounter.h" |
40 #include "wtf/StdLibExtras.h" | 41 #include "wtf/StdLibExtras.h" |
41 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
42 #include "wtf/unicode/CharacterNames.h" | 43 #include "wtf/unicode/CharacterNames.h" |
43 | 44 |
44 namespace WebCore { | 45 namespace WebCore { |
45 | 46 |
46 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, RenderStyle* style) | 47 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, RenderStyle* style) |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 ASSERT(isSVGText()); | 956 ASSERT(isSVGText()); |
956 toSVGRootInlineBox(lineBox)->computePerCharacterLayoutInformation(); | 957 toSVGRootInlineBox(lineBox)->computePerCharacterLayoutInformation(); |
957 } | 958 } |
958 | 959 |
959 // Compute our overflow now. | 960 // Compute our overflow now. |
960 lineBox->computeOverflow(lineBox->lineTop(), lineBox->lineBottom(), textBoxD
ataMap); | 961 lineBox->computeOverflow(lineBox->lineTop(), lineBox->lineBottom(), textBoxD
ataMap); |
961 | 962 |
962 return lineBox; | 963 return lineBox; |
963 } | 964 } |
964 | 965 |
965 // Like LayoutState for layout(), LineLayoutState keeps track of global informat
ion | |
966 // during an entire linebox tree layout pass (aka layoutInlineChildren). | |
967 class LineLayoutState { | |
968 public: | |
969 LineLayoutState(bool fullLayout, LayoutUnit& repaintLogicalTop, LayoutUnit&
repaintLogicalBottom, RenderFlowThread* flowThread) | |
970 : m_lastFloat(0) | |
971 , m_endLine(0) | |
972 , m_floatIndex(0) | |
973 , m_endLineLogicalTop(0) | |
974 , m_endLineMatched(false) | |
975 , m_checkForFloatsFromLastLine(false) | |
976 , m_isFullLayout(fullLayout) | |
977 , m_repaintLogicalTop(repaintLogicalTop) | |
978 , m_repaintLogicalBottom(repaintLogicalBottom) | |
979 , m_adjustedLogicalLineTop(0) | |
980 , m_usesRepaintBounds(false) | |
981 , m_flowThread(flowThread) | |
982 { } | |
983 | |
984 void markForFullLayout() { m_isFullLayout = true; } | |
985 bool isFullLayout() const { return m_isFullLayout; } | |
986 | |
987 bool usesRepaintBounds() const { return m_usesRepaintBounds; } | |
988 | |
989 void setRepaintRange(LayoutUnit logicalHeight) | |
990 { | |
991 m_usesRepaintBounds = true; | |
992 m_repaintLogicalTop = m_repaintLogicalBottom = logicalHeight; | |
993 } | |
994 | |
995 void updateRepaintRangeFromBox(RootInlineBox* box, LayoutUnit paginationDelt
a = 0) | |
996 { | |
997 m_usesRepaintBounds = true; | |
998 m_repaintLogicalTop = min(m_repaintLogicalTop, box->logicalTopVisualOver
flow() + min<LayoutUnit>(paginationDelta, 0)); | |
999 m_repaintLogicalBottom = max(m_repaintLogicalBottom, box->logicalBottomV
isualOverflow() + max<LayoutUnit>(paginationDelta, 0)); | |
1000 } | |
1001 | |
1002 bool endLineMatched() const { return m_endLineMatched; } | |
1003 void setEndLineMatched(bool endLineMatched) { m_endLineMatched = endLineMatc
hed; } | |
1004 | |
1005 bool checkForFloatsFromLastLine() const { return m_checkForFloatsFromLastLin
e; } | |
1006 void setCheckForFloatsFromLastLine(bool check) { m_checkForFloatsFromLastLin
e = check; } | |
1007 | |
1008 LineInfo& lineInfo() { return m_lineInfo; } | |
1009 const LineInfo& lineInfo() const { return m_lineInfo; } | |
1010 | |
1011 LayoutUnit endLineLogicalTop() const { return m_endLineLogicalTop; } | |
1012 void setEndLineLogicalTop(LayoutUnit logicalTop) { m_endLineLogicalTop = log
icalTop; } | |
1013 | |
1014 RootInlineBox* endLine() const { return m_endLine; } | |
1015 void setEndLine(RootInlineBox* line) { m_endLine = line; } | |
1016 | |
1017 FloatingObject* lastFloat() const { return m_lastFloat; } | |
1018 void setLastFloat(FloatingObject* lastFloat) { m_lastFloat = lastFloat; } | |
1019 | |
1020 Vector<RenderBlockFlow::FloatWithRect>& floats() { return m_floats; } | |
1021 | |
1022 unsigned floatIndex() const { return m_floatIndex; } | |
1023 void setFloatIndex(unsigned floatIndex) { m_floatIndex = floatIndex; } | |
1024 | |
1025 LayoutUnit adjustedLogicalLineTop() const { return m_adjustedLogicalLineTop;
} | |
1026 void setAdjustedLogicalLineTop(LayoutUnit value) { m_adjustedLogicalLineTop
= value; } | |
1027 | |
1028 RenderFlowThread* flowThread() const { return m_flowThread; } | |
1029 void setFlowThread(RenderFlowThread* thread) { m_flowThread = thread; } | |
1030 | |
1031 private: | |
1032 Vector<RenderBlockFlow::FloatWithRect> m_floats; | |
1033 FloatingObject* m_lastFloat; | |
1034 RootInlineBox* m_endLine; | |
1035 LineInfo m_lineInfo; | |
1036 unsigned m_floatIndex; | |
1037 LayoutUnit m_endLineLogicalTop; | |
1038 bool m_endLineMatched; | |
1039 bool m_checkForFloatsFromLastLine; | |
1040 | |
1041 bool m_isFullLayout; | |
1042 | |
1043 // FIXME: Should this be a range object instead of two ints? | |
1044 LayoutUnit& m_repaintLogicalTop; | |
1045 LayoutUnit& m_repaintLogicalBottom; | |
1046 | |
1047 LayoutUnit m_adjustedLogicalLineTop; | |
1048 | |
1049 bool m_usesRepaintBounds; | |
1050 | |
1051 RenderFlowThread* m_flowThread; | |
1052 }; | |
1053 | |
1054 static void deleteLineRange(LineLayoutState& layoutState, RootInlineBox* startLi
ne, RootInlineBox* stopLine = 0) | 966 static void deleteLineRange(LineLayoutState& layoutState, RootInlineBox* startLi
ne, RootInlineBox* stopLine = 0) |
1055 { | 967 { |
1056 RootInlineBox* boxToDelete = startLine; | 968 RootInlineBox* boxToDelete = startLine; |
1057 while (boxToDelete && boxToDelete != stopLine) { | 969 while (boxToDelete && boxToDelete != stopLine) { |
1058 layoutState.updateRepaintRangeFromBox(boxToDelete); | 970 layoutState.updateRepaintRangeFromBox(boxToDelete); |
1059 // Note: deleteLineRange(firstRootBox()) is not identical to deleteLineB
oxTree(). | 971 // Note: deleteLineRange(firstRootBox()) is not identical to deleteLineB
oxTree(). |
1060 // deleteLineBoxTree uses nextLineBox() instead of nextRootBox() when tr
aversing. | 972 // deleteLineBoxTree uses nextLineBox() instead of nextRootBox() when tr
aversing. |
1061 RootInlineBox* next = boxToDelete->nextRootBox(); | 973 RootInlineBox* next = boxToDelete->nextRootBox(); |
1062 boxToDelete->deleteLine(); | 974 boxToDelete->deleteLine(); |
1063 boxToDelete = next; | 975 boxToDelete = next; |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 2245 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
2334 | 2246 |
2335 setLineGridBox(lineGridBox); | 2247 setLineGridBox(lineGridBox); |
2336 | 2248 |
2337 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 2249 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
2338 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 2250 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
2339 // to this grid. | 2251 // to this grid. |
2340 } | 2252 } |
2341 | 2253 |
2342 } | 2254 } |
OLD | NEW |