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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 if (resolver.position().atEnd()) { | 866 if (resolver.position().atEnd()) { |
867 // FIXME: We shouldn't be creating any runs in nextLineBreak to begi
n with! | 867 // FIXME: We shouldn't be creating any runs in nextLineBreak to begi
n with! |
868 // Once BidiRunList is separated from BidiResolver this will not be
needed. | 868 // Once BidiRunList is separated from BidiResolver this will not be
needed. |
869 resolver.runs().deleteRuns(); | 869 resolver.runs().deleteRuns(); |
870 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla
ced by an ASSERT (or just removed). | 870 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla
ced by an ASSERT (or just removed). |
871 resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0
), 0); | 871 resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0
), 0); |
872 break; | 872 break; |
873 } | 873 } |
874 | 874 |
875 ASSERT(endOfLine != resolver.position()); | 875 ASSERT(endOfLine != resolver.position()); |
| 876 RootInlineBox* lineBox = nullptr; |
876 | 877 |
877 // This is a short-cut for empty lines. | 878 // This is a short-cut for empty lines. |
878 if (layoutState.lineInfo().isEmpty()) { | 879 if (layoutState.lineInfo().isEmpty()) { |
879 ASSERT(!paginationStrutFromDeletedLine); | 880 ASSERT(!paginationStrutFromDeletedLine); |
880 if (lastRootBox()) | 881 if (lastRootBox()) |
881 lastRootBox()->setLineBreakInfo(endOfLine.getLineLayoutItem(), e
ndOfLine.offset(), resolver.status()); | 882 lastRootBox()->setLineBreakInfo(endOfLine.getLineLayoutItem(), e
ndOfLine.offset(), resolver.status()); |
882 resolver.runs().deleteRuns(); | 883 resolver.runs().deleteRuns(); |
883 } else { | 884 } else { |
884 VisualDirectionOverride override = (styleToUse.rtlOrdering() == Visu
alOrder ? (styleToUse.direction() == LTR ? VisualLeftToRightOverride : VisualRig
htToLeftOverride) : NoVisualOverride); | 885 VisualDirectionOverride override = (styleToUse.rtlOrdering() == Visu
alOrder ? (styleToUse.direction() == LTR ? VisualLeftToRightOverride : VisualRig
htToLeftOverride) : NoVisualOverride); |
885 if (isNewUBAParagraph && styleToUse.unicodeBidi() == Plaintext && !r
esolver.context()->parent()) { | 886 if (isNewUBAParagraph && styleToUse.unicodeBidi() == Plaintext && !r
esolver.context()->parent()) { |
886 TextDirection direction = determinePlaintextDirectionality(resol
ver.position().root(), resolver.position().getLineLayoutItem(), resolver.positio
n().offset()); | 887 TextDirection direction = determinePlaintextDirectionality(resol
ver.position().root(), resolver.position().getLineLayoutItem(), resolver.positio
n().offset()); |
887 resolver.setStatus(BidiStatus(direction, isOverride(styleToUse.u
nicodeBidi()))); | 888 resolver.setStatus(BidiStatus(direction, isOverride(styleToUse.u
nicodeBidi()))); |
888 } | 889 } |
889 // FIXME: This ownership is reversed. We should own the BidiRunList
and pass it to createBidiRunsForLine. | 890 // FIXME: This ownership is reversed. We should own the BidiRunList
and pass it to createBidiRunsForLine. |
890 BidiRunList<BidiRun>& bidiRuns = resolver.runs(); | 891 BidiRunList<BidiRun>& bidiRuns = resolver.runs(); |
891 constructBidiRunsForLine(resolver, bidiRuns, endOfLine, override, la
youtState.lineInfo().previousLineBrokeCleanly(), isNewUBAParagraph); | 892 constructBidiRunsForLine(resolver, bidiRuns, endOfLine, override, la
youtState.lineInfo().previousLineBrokeCleanly(), isNewUBAParagraph); |
892 ASSERT(resolver.position() == endOfLine); | 893 ASSERT(resolver.position() == endOfLine); |
893 | 894 |
894 BidiRun* trailingSpaceRun = resolver.trailingSpaceRun(); | 895 BidiRun* trailingSpaceRun = resolver.trailingSpaceRun(); |
895 | 896 |
896 if (bidiRuns.runCount() && lineBreaker.lineWasHyphenated()) | 897 if (bidiRuns.runCount() && lineBreaker.lineWasHyphenated()) |
897 bidiRuns.logicallyLastRun()->m_hasHyphen = true; | 898 bidiRuns.logicallyLastRun()->m_hasHyphen = true; |
898 | 899 |
899 // Now that the runs have been ordered, we create the line boxes. | 900 // Now that the runs have been ordered, we create the line boxes. |
900 // At the same time we figure out where border/padding/margin should
be applied for | 901 // At the same time we figure out where border/padding/margin should
be applied for |
901 // inline flow boxes. | 902 // inline flow boxes. |
902 | 903 |
903 LayoutUnit oldLogicalHeight = logicalHeight(); | 904 LayoutUnit oldLogicalHeight = logicalHeight(); |
904 RootInlineBox* lineBox = createLineBoxesFromBidiRuns(resolver.status
().context->level(), bidiRuns, endOfLine, layoutState.lineInfo(), verticalPositi
onCache, trailingSpaceRun, wordMeasurements); | 905 lineBox = createLineBoxesFromBidiRuns(resolver.status().context->lev
el(), bidiRuns, endOfLine, layoutState.lineInfo(), verticalPositionCache, traili
ngSpaceRun, wordMeasurements); |
905 | 906 |
906 bidiRuns.deleteRuns(); | 907 bidiRuns.deleteRuns(); |
907 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla
ced by an ASSERT (or just removed). | 908 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla
ced by an ASSERT (or just removed). |
908 | 909 |
909 // If we decided to re-create the line due to pagination, we better
have a new line now. | 910 // If we decided to re-create the line due to pagination, we better
have a new line now. |
910 ASSERT(lineBox || !paginationStrutFromDeletedLine); | 911 ASSERT(lineBox || !paginationStrutFromDeletedLine); |
911 | 912 |
912 if (lineBox) { | 913 if (lineBox) { |
913 lineBox->setLineBreakInfo(endOfLine.getLineLayoutItem(), endOfLi
ne.offset(), resolver.status()); | 914 lineBox->setLineBreakInfo(endOfLine.getLineLayoutItem(), endOfLi
ne.offset(), resolver.status()); |
914 if (paginated) { | 915 if (paginated) { |
(...skipping 24 matching lines...) Expand all Loading... |
939 } else { | 940 } else { |
940 setLogicalHeight(lineBox->lineBottomWithLeading(
)); | 941 setLogicalHeight(lineBox->lineBottomWithLeading(
)); |
941 } | 942 } |
942 } | 943 } |
943 } | 944 } |
944 } | 945 } |
945 } | 946 } |
946 } | 947 } |
947 | 948 |
948 if (!paginationStrutFromDeletedLine) { | 949 if (!paginationStrutFromDeletedLine) { |
949 for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i) | 950 for (const auto& positionedObject : lineBreaker.positionedObjects())
{ |
950 setStaticPositions(LineLayoutBlockFlow(this), LineLayoutBox(line
Breaker.positionedObjects()[i]), DoNotIndentText); | 951 if (positionedObject.style()->isOriginalDisplayInlineType()) { |
| 952 // Auto-positioend "inline" out-of-flow objects have already
been positioned, |
| 953 // but if we're paginated, we need to update their position
now, since the line |
| 954 // they "belong" to may have been pushed by a pagination str
ut. |
| 955 if (paginated && lineBox) |
| 956 positionedObject.layer()->setStaticBlockPosition(lineBox
->lineTopWithLeading()); |
| 957 continue; |
| 958 } |
| 959 setStaticPositions(LineLayoutBlockFlow(this), positionedObject,
DoNotIndentText); |
| 960 } |
951 | 961 |
952 if (!layoutState.lineInfo().isEmpty()) | 962 if (!layoutState.lineInfo().isEmpty()) |
953 layoutState.lineInfo().setFirstLine(false); | 963 layoutState.lineInfo().setFirstLine(false); |
954 clearFloats(lineBreaker.clear()); | 964 clearFloats(lineBreaker.clear()); |
955 | 965 |
956 if (m_floatingObjects && lastRootBox()) { | 966 if (m_floatingObjects && lastRootBox()) { |
957 InlineBidiResolver endOfLineResolver; | 967 InlineBidiResolver endOfLineResolver; |
958 endOfLineResolver.setPosition(endOfLine, numberOfIsolateAncestor
s(endOfLine)); | 968 endOfLineResolver.setPosition(endOfLine, numberOfIsolateAncestor
s(endOfLine)); |
959 endOfLineResolver.setStatus(resolver.status()); | 969 endOfLineResolver.setStatus(resolver.status()); |
960 appendFloatsToLastLine(layoutState, cleanLineStart, endOfLineRes
olver, cleanLineBidiStatus); | 970 appendFloatsToLastLine(layoutState, cleanLineStart, endOfLineRes
olver, cleanLineBidiStatus); |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2079 | 2089 |
2080 PaintInvalidationReason LayoutBlockFlow::invalidatePaintIfNeeded(const PaintInva
lidationState& paintInvalidationState) | 2090 PaintInvalidationReason LayoutBlockFlow::invalidatePaintIfNeeded(const PaintInva
lidationState& paintInvalidationState) |
2081 { | 2091 { |
2082 if (containsFloats()) | 2092 if (containsFloats()) |
2083 paintInvalidationState.paintingLayer().setNeedsPaintPhaseFloat(); | 2093 paintInvalidationState.paintingLayer().setNeedsPaintPhaseFloat(); |
2084 | 2094 |
2085 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); | 2095 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
2086 } | 2096 } |
2087 | 2097 |
2088 } // namespace blink | 2098 } // namespace blink |
OLD | NEW |