Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 120493004: Set m_pos as private in InlineIterator, and use getter and setter functions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 return false; 2060 return false;
2061 return checkPaginationAndFloatsAtEndLine(layoutState); 2061 return checkPaginationAndFloatsAtEndLine(layoutState);
2062 } 2062 }
2063 2063
2064 // The first clean line doesn't match, but we can check a handful of followi ng lines to try 2064 // The first clean line doesn't match, but we can check a handful of followi ng lines to try
2065 // to match back up. 2065 // to match back up.
2066 static int numLines = 8; // The # of lines we're willing to match against. 2066 static int numLines = 8; // The # of lines we're willing to match against.
2067 RootInlineBox* originalEndLine = layoutState.endLine(); 2067 RootInlineBox* originalEndLine = layoutState.endLine();
2068 RootInlineBox* line = originalEndLine; 2068 RootInlineBox* line = originalEndLine;
2069 for (int i = 0; i < numLines && line; i++, line = line->nextRootBox()) { 2069 for (int i = 0; i < numLines && line; i++, line = line->nextRootBox()) {
2070 if (line->lineBreakObj() == resolver.position().object() && line->lineBr eakPos() == resolver.position().m_pos) { 2070 if (line->lineBreakObj() == resolver.position().object() && line->lineBr eakPos() == resolver.position().offset()) {
2071 // We have a match. 2071 // We have a match.
2072 if (line->lineBreakBidiStatus() != resolver.status()) 2072 if (line->lineBreakBidiStatus() != resolver.status())
2073 return false; // ...but the bidi state doesn't match. 2073 return false; // ...but the bidi state doesn't match.
2074 2074
2075 bool matched = false; 2075 bool matched = false;
2076 RootInlineBox* result = line->nextRootBox(); 2076 RootInlineBox* result = line->nextRootBox();
2077 layoutState.setEndLine(result); 2077 layoutState.setEndLine(result);
2078 if (result) { 2078 if (result) {
2079 layoutState.setEndLineLogicalTop(line->lineBottomWithLeading()); 2079 layoutState.setEndLineLogicalTop(line->lineBottomWithLeading());
2080 matched = checkPaginationAndFloatsAtEndLine(layoutState); 2080 matched = checkPaginationAndFloatsAtEndLine(layoutState);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 resolver.setPositionIgnoringNestedIsolates(oldEnd); 2187 resolver.setPositionIgnoringNestedIsolates(oldEnd);
2188 return end; 2188 return end;
2189 } 2189 }
2190 2190
2191 InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineI nfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPrev iousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurement s) 2191 InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineI nfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPrev iousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurement s)
2192 { 2192 {
2193 reset(); 2193 reset();
2194 2194
2195 ASSERT(resolver.position().root() == m_block); 2195 ASSERT(resolver.position().root() == m_block);
2196 2196
2197 bool appliedStartWidth = resolver.position().m_pos > 0; 2197 bool appliedStartWidth = resolver.position().offset() > 0;
2198 2198
2199 LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.is FirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style())); 2199 LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.is FirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style()));
2200 2200
2201 skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width); 2201 skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width);
2202 2202
2203 if (resolver.position().atEnd()) 2203 if (resolver.position().atEnd())
2204 return resolver.position(); 2204 return resolver.position();
2205 2205
2206 BreakingContext context(resolver, lineInfo, width, renderTextInfo, lastFloat FromPreviousLine, appliedStartWidth, m_block); 2206 BreakingContext context(resolver, lineInfo, width, renderTextInfo, lastFloat FromPreviousLine, appliedStartWidth, m_block);
2207 2207
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); 2415 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache);
2416 2416
2417 setLineGridBox(lineGridBox); 2417 setLineGridBox(lineGridBox);
2418 2418
2419 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying 2419 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying
2420 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping 2420 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping
2421 // to this grid. 2421 // to this grid.
2422 } 2422 }
2423 2423
2424 } 2424 }
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineIterator.h ('k') | Source/core/rendering/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698