| 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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 const SegmentRangeList& segmentRanges = shapeInsideInfo->segmentRanges(); | 973 const SegmentRangeList& segmentRanges = shapeInsideInfo->segmentRanges(); |
| 974 ASSERT(segmentRanges.size()); | 974 ASSERT(segmentRanges.size()); |
| 975 | 975 |
| 976 for (size_t i = 0; i < segmentRanges.size(); i++) { | 976 for (size_t i = 0; i < segmentRanges.size(); i++) { |
| 977 LineSegmentIterator iterator = segmentRanges[i].start; | 977 LineSegmentIterator iterator = segmentRanges[i].start; |
| 978 InlineIterator segmentStart(iterator.root, iterator.object, iterator.off
set); | 978 InlineIterator segmentStart(iterator.root, iterator.object, iterator.off
set); |
| 979 iterator = segmentRanges[i].end; | 979 iterator = segmentRanges[i].end; |
| 980 InlineIterator segmentEnd(iterator.root, iterator.object, iterator.offse
t); | 980 InlineIterator segmentEnd(iterator.root, iterator.object, iterator.offse
t); |
| 981 if (i) { | 981 if (i) { |
| 982 ASSERT(segmentStart.object()); | 982 ASSERT(segmentStart.object()); |
| 983 BidiRun* segmentMarker = createRun(segmentStart.m_pos, segmentStart.
m_pos, segmentStart.object(), topResolver); | 983 BidiRun* segmentMarker = createRun(segmentStart.offset(), segmentSta
rt.offset(), segmentStart.object(), topResolver); |
| 984 segmentMarker->m_startsSegment = true; | 984 segmentMarker->m_startsSegment = true; |
| 985 bidiRuns.addRun(segmentMarker); | 985 bidiRuns.addRun(segmentMarker); |
| 986 // Do not collapse midpoints between segments | 986 // Do not collapse midpoints between segments |
| 987 topResolver.midpointState().betweenMidpoints = false; | 987 topResolver.midpointState().betweenMidpoints = false; |
| 988 } | 988 } |
| 989 if (!segmentIsEmpty(segmentStart, segmentEnd)) { | 989 if (!segmentIsEmpty(segmentStart, segmentEnd)) { |
| 990 topResolver.setPosition(segmentStart, numberOfIsolateAncestors(segme
ntStart)); | 990 topResolver.setPosition(segmentStart, numberOfIsolateAncestors(segme
ntStart)); |
| 991 constructBidiRunsForSegment(topResolver, bidiRuns, segmentEnd, overr
ide, previousLineBrokeCleanly, isNewUBAParagraph); | 991 constructBidiRunsForSegment(topResolver, bidiRuns, segmentEnd, overr
ide, previousLineBrokeCleanly, isNewUBAParagraph); |
| 992 } | 992 } |
| 993 } | 993 } |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 if (adjustLogicalLineTopAndLogicalHeightIfNeeded(shapeInsideInfo, logica
lOffsetFromShapeContainer.height(), layoutState, resolver, lastFloatFromPrevious
Line, endOfLine, wordMeasurements)) | 1450 if (adjustLogicalLineTopAndLogicalHeightIfNeeded(shapeInsideInfo, logica
lOffsetFromShapeContainer.height(), layoutState, resolver, lastFloatFromPrevious
Line, endOfLine, wordMeasurements)) |
| 1451 continue; | 1451 continue; |
| 1452 | 1452 |
| 1453 ASSERT(endOfLine != resolver.position()); | 1453 ASSERT(endOfLine != resolver.position()); |
| 1454 | 1454 |
| 1455 // This is a short-cut for empty lines. | 1455 // This is a short-cut for empty lines. |
| 1456 if (layoutState.lineInfo().isEmpty()) { | 1456 if (layoutState.lineInfo().isEmpty()) { |
| 1457 if (lastRootBox()) | 1457 if (lastRootBox()) |
| 1458 lastRootBox()->setLineBreakInfo(endOfLine.object(), endOfLine.m_
pos, resolver.status()); | 1458 lastRootBox()->setLineBreakInfo(endOfLine.object(), endOfLine.of
fset(), resolver.status()); |
| 1459 } else { | 1459 } else { |
| 1460 VisualDirectionOverride override = (styleToUse->rtlOrdering() == Vis
ualOrder ? (styleToUse->direction() == LTR ? VisualLeftToRightOverride : VisualR
ightToLeftOverride) : NoVisualOverride); | 1460 VisualDirectionOverride override = (styleToUse->rtlOrdering() == Vis
ualOrder ? (styleToUse->direction() == LTR ? VisualLeftToRightOverride : VisualR
ightToLeftOverride) : NoVisualOverride); |
| 1461 | 1461 |
| 1462 if (isNewUBAParagraph && styleToUse->unicodeBidi() == Plaintext && !
resolver.context()->parent()) { | 1462 if (isNewUBAParagraph && styleToUse->unicodeBidi() == Plaintext && !
resolver.context()->parent()) { |
| 1463 TextDirection direction = determinePlaintextDirectionality(resol
ver.position().root(), resolver.position().object(), resolver.position().offset(
)); | 1463 TextDirection direction = determinePlaintextDirectionality(resol
ver.position().root(), resolver.position().object(), resolver.position().offset(
)); |
| 1464 resolver.setStatus(BidiStatus(direction, isOverride(styleToUse->
unicodeBidi()))); | 1464 resolver.setStatus(BidiStatus(direction, isOverride(styleToUse->
unicodeBidi()))); |
| 1465 } | 1465 } |
| 1466 // FIXME: This ownership is reversed. We should own the BidiRunList
and pass it to createBidiRunsForLine. | 1466 // FIXME: This ownership is reversed. We should own the BidiRunList
and pass it to createBidiRunsForLine. |
| 1467 BidiRunList<BidiRun>& bidiRuns = resolver.runs(); | 1467 BidiRunList<BidiRun>& bidiRuns = resolver.runs(); |
| 1468 constructBidiRunsForLine(this, resolver, bidiRuns, endOfLine, overri
de, layoutState.lineInfo().previousLineBrokeCleanly(), isNewUBAParagraph); | 1468 constructBidiRunsForLine(this, resolver, bidiRuns, endOfLine, overri
de, layoutState.lineInfo().previousLineBrokeCleanly(), isNewUBAParagraph); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1480 // At the same time we figure out where border/padding/margin should
be applied for | 1480 // At the same time we figure out where border/padding/margin should
be applied for |
| 1481 // inline flow boxes. | 1481 // inline flow boxes. |
| 1482 | 1482 |
| 1483 LayoutUnit oldLogicalHeight = logicalHeight(); | 1483 LayoutUnit oldLogicalHeight = logicalHeight(); |
| 1484 RootInlineBox* lineBox = createLineBoxesFromBidiRuns(resolver.status
().context->level(), bidiRuns, endOfLine, layoutState.lineInfo(), verticalPositi
onCache, trailingSpaceRun, wordMeasurements); | 1484 RootInlineBox* lineBox = createLineBoxesFromBidiRuns(resolver.status
().context->level(), bidiRuns, endOfLine, layoutState.lineInfo(), verticalPositi
onCache, trailingSpaceRun, wordMeasurements); |
| 1485 | 1485 |
| 1486 bidiRuns.deleteRuns(); | 1486 bidiRuns.deleteRuns(); |
| 1487 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla
ced by an ASSERT (or just removed). | 1487 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla
ced by an ASSERT (or just removed). |
| 1488 | 1488 |
| 1489 if (lineBox) { | 1489 if (lineBox) { |
| 1490 lineBox->setLineBreakInfo(endOfLine.object(), endOfLine.m_pos, r
esolver.status()); | 1490 lineBox->setLineBreakInfo(endOfLine.object(), endOfLine.offset()
, resolver.status()); |
| 1491 if (layoutState.usesRepaintBounds()) | 1491 if (layoutState.usesRepaintBounds()) |
| 1492 layoutState.updateRepaintRangeFromBox(lineBox); | 1492 layoutState.updateRepaintRangeFromBox(lineBox); |
| 1493 | 1493 |
| 1494 if (paginated) { | 1494 if (paginated) { |
| 1495 LayoutUnit adjustment = 0; | 1495 LayoutUnit adjustment = 0; |
| 1496 adjustLinePositionForPagination(lineBox, adjustment, layoutS
tate.flowThread()); | 1496 adjustLinePositionForPagination(lineBox, adjustment, layoutS
tate.flowThread()); |
| 1497 if (adjustment) { | 1497 if (adjustment) { |
| 1498 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o
ldLogicalHeight, layoutState.lineInfo().isFirstLine()); | 1498 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o
ldLogicalHeight, layoutState.lineInfo().isFirstLine()); |
| 1499 lineBox->adjustBlockDirectionPosition(adjustment); | 1499 lineBox->adjustBlockDirectionPosition(adjustment); |
| 1500 if (layoutState.usesRepaintBounds()) | 1500 if (layoutState.usesRepaintBounds()) |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 return false; | 2062 return false; |
| 2063 return checkPaginationAndFloatsAtEndLine(layoutState); | 2063 return checkPaginationAndFloatsAtEndLine(layoutState); |
| 2064 } | 2064 } |
| 2065 | 2065 |
| 2066 // The first clean line doesn't match, but we can check a handful of followi
ng lines to try | 2066 // The first clean line doesn't match, but we can check a handful of followi
ng lines to try |
| 2067 // to match back up. | 2067 // to match back up. |
| 2068 static int numLines = 8; // The # of lines we're willing to match against. | 2068 static int numLines = 8; // The # of lines we're willing to match against. |
| 2069 RootInlineBox* originalEndLine = layoutState.endLine(); | 2069 RootInlineBox* originalEndLine = layoutState.endLine(); |
| 2070 RootInlineBox* line = originalEndLine; | 2070 RootInlineBox* line = originalEndLine; |
| 2071 for (int i = 0; i < numLines && line; i++, line = line->nextRootBox()) { | 2071 for (int i = 0; i < numLines && line; i++, line = line->nextRootBox()) { |
| 2072 if (line->lineBreakObj() == resolver.position().object() && line->lineBr
eakPos() == resolver.position().m_pos) { | 2072 if (line->lineBreakObj() == resolver.position().object() && line->lineBr
eakPos() == resolver.position().offset()) { |
| 2073 // We have a match. | 2073 // We have a match. |
| 2074 if (line->lineBreakBidiStatus() != resolver.status()) | 2074 if (line->lineBreakBidiStatus() != resolver.status()) |
| 2075 return false; // ...but the bidi state doesn't match. | 2075 return false; // ...but the bidi state doesn't match. |
| 2076 | 2076 |
| 2077 bool matched = false; | 2077 bool matched = false; |
| 2078 RootInlineBox* result = line->nextRootBox(); | 2078 RootInlineBox* result = line->nextRootBox(); |
| 2079 layoutState.setEndLine(result); | 2079 layoutState.setEndLine(result); |
| 2080 if (result) { | 2080 if (result) { |
| 2081 layoutState.setEndLineLogicalTop(line->lineBottomWithLeading()); | 2081 layoutState.setEndLineLogicalTop(line->lineBottomWithLeading()); |
| 2082 matched = checkPaginationAndFloatsAtEndLine(layoutState); | 2082 matched = checkPaginationAndFloatsAtEndLine(layoutState); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 resolver.setPositionIgnoringNestedIsolates(oldEnd); | 2189 resolver.setPositionIgnoringNestedIsolates(oldEnd); |
| 2190 return end; | 2190 return end; |
| 2191 } | 2191 } |
| 2192 | 2192 |
| 2193 InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineI
nfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPrev
iousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurement
s) | 2193 InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineI
nfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPrev
iousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurement
s) |
| 2194 { | 2194 { |
| 2195 reset(); | 2195 reset(); |
| 2196 | 2196 |
| 2197 ASSERT(resolver.position().root() == m_block); | 2197 ASSERT(resolver.position().root() == m_block); |
| 2198 | 2198 |
| 2199 bool appliedStartWidth = resolver.position().m_pos > 0; | 2199 bool appliedStartWidth = resolver.position().offset() > 0; |
| 2200 | 2200 |
| 2201 LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.is
FirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style())); | 2201 LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.is
FirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style())); |
| 2202 | 2202 |
| 2203 skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width); | 2203 skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width); |
| 2204 | 2204 |
| 2205 if (resolver.position().atEnd()) | 2205 if (resolver.position().atEnd()) |
| 2206 return resolver.position(); | 2206 return resolver.position(); |
| 2207 | 2207 |
| 2208 BreakingContext context(resolver, lineInfo, width, renderTextInfo, lastFloat
FromPreviousLine, appliedStartWidth, m_block); | 2208 BreakingContext context(resolver, lineInfo, width, renderTextInfo, lastFloat
FromPreviousLine, appliedStartWidth, m_block); |
| 2209 | 2209 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2417 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 2417 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
| 2418 | 2418 |
| 2419 setLineGridBox(lineGridBox); | 2419 setLineGridBox(lineGridBox); |
| 2420 | 2420 |
| 2421 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 2421 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
| 2422 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 2422 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
| 2423 // to this grid. | 2423 // to this grid. |
| 2424 } | 2424 } |
| 2425 | 2425 |
| 2426 } | 2426 } |
| OLD | NEW |