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

Side by Side Diff: Source/core/layout/LayoutBlockFlowLine.cpp

Issue 1175953003: Revert "Remove obsolete float-management code from line layout" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/layout/line/LineLayoutState.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 #include "core/layout/LayoutListMarker.h" 29 #include "core/layout/LayoutListMarker.h"
30 #include "core/layout/LayoutObject.h" 30 #include "core/layout/LayoutObject.h"
31 #include "core/layout/LayoutRubyRun.h" 31 #include "core/layout/LayoutRubyRun.h"
32 #include "core/layout/LayoutView.h" 32 #include "core/layout/LayoutView.h"
33 #include "core/layout/TextRunConstructor.h" 33 #include "core/layout/TextRunConstructor.h"
34 #include "core/layout/VerticalPositionCache.h" 34 #include "core/layout/VerticalPositionCache.h"
35 #include "core/layout/line/BreakingContextInlineHeaders.h" 35 #include "core/layout/line/BreakingContextInlineHeaders.h"
36 #include "core/layout/line/LayoutTextInfo.h" 36 #include "core/layout/line/LayoutTextInfo.h"
37 #include "core/layout/line/LineLayoutState.h" 37 #include "core/layout/line/LineLayoutState.h"
38 #include "core/layout/line/LineWidth.h" 38 #include "core/layout/line/LineWidth.h"
39 #include "core/layout/line/TrailingFloatsRootInlineBox.h"
39 #include "core/layout/line/WordMeasurement.h" 40 #include "core/layout/line/WordMeasurement.h"
40 #include "core/layout/svg/line/SVGRootInlineBox.h" 41 #include "core/layout/svg/line/SVGRootInlineBox.h"
41 #include "platform/fonts/Character.h" 42 #include "platform/fonts/Character.h"
42 #include "platform/text/BidiResolver.h" 43 #include "platform/text/BidiResolver.h"
43 #include "wtf/RefCountedLeakCounter.h" 44 #include "wtf/RefCountedLeakCounter.h"
44 #include "wtf/StdLibExtras.h" 45 #include "wtf/StdLibExtras.h"
45 #include "wtf/Vector.h" 46 #include "wtf/Vector.h"
46 #include "wtf/unicode/CharacterNames.h" 47 #include "wtf/unicode/CharacterNames.h"
47 48
48 namespace blink { 49 namespace blink {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 763
763 WordMeasurements wordMeasurements; 764 WordMeasurements wordMeasurements;
764 endOfLine = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), layoutTextInfo, 765 endOfLine = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), layoutTextInfo,
765 lastFloatFromPreviousLine, wordMeasurements); 766 lastFloatFromPreviousLine, wordMeasurements);
766 layoutTextInfo.m_lineBreakIterator.resetPriorContext(); 767 layoutTextInfo.m_lineBreakIterator.resetPriorContext();
767 if (resolver.position().atEnd()) { 768 if (resolver.position().atEnd()) {
768 // FIXME: We shouldn't be creating any runs in nextLineBreak to begi n with! 769 // FIXME: We shouldn't be creating any runs in nextLineBreak to begi n with!
769 // Once BidiRunList is separated from BidiResolver this will not be needed. 770 // Once BidiRunList is separated from BidiResolver this will not be needed.
770 resolver.runs().deleteRuns(); 771 resolver.runs().deleteRuns();
771 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla ced by an ASSERT (or just removed). 772 resolver.markCurrentRunEmpty(); // FIXME: This can probably be repla ced by an ASSERT (or just removed).
773 layoutState.setCheckForFloatsFromLastLine(true);
772 resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0 ), 0); 774 resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0 ), 0);
773 break; 775 break;
774 } 776 }
775 777
776 ASSERT(endOfLine != resolver.position()); 778 ASSERT(endOfLine != resolver.position());
777 779
778 // This is a short-cut for empty lines. 780 // This is a short-cut for empty lines.
779 if (layoutState.lineInfo().isEmpty()) { 781 if (layoutState.lineInfo().isEmpty()) {
780 if (lastRootBox()) 782 if (lastRootBox())
781 lastRootBox()->setLineBreakInfo(endOfLine.object(), endOfLine.of fset(), resolver.status()); 783 lastRootBox()->setLineBreakInfo(endOfLine.object(), endOfLine.of fset(), resolver.status());
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 960 }
959 } 961 }
960 } 962 }
961 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); 963 setLogicalHeight(lastRootBox()->lineBottomWithLeading());
962 } else { 964 } else {
963 // Delete all the remaining lines. 965 // Delete all the remaining lines.
964 deleteLineRange(layoutState, layoutState.endLine()); 966 deleteLineRange(layoutState, layoutState.endLine());
965 } 967 }
966 } 968 }
967 969
968 if (positionNewFloats() && lastRootBox()) { 970 if (m_floatingObjects && (layoutState.checkForFloatsFromLastLine() || positi onNewFloats()) && lastRootBox()) {
969 // In case we have a float on the last line, it might not be positioned up to now. 971 // In case we have a float on the last line, it might not be positioned up to now.
970 // This has to be done before adding in the bottom border/padding, or th e float will 972 // This has to be done before adding in the bottom border/padding, or th e float will
971 // include the padding incorrectly. -dwh 973 // include the padding incorrectly. -dwh
972 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 974 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
973 FloatingObjectSetIterator it = floatingObjectSet.begin(); 975 FloatingObjectSetIterator it = floatingObjectSet.begin();
974 FloatingObjectSetIterator end = floatingObjectSet.end(); 976 FloatingObjectSetIterator end = floatingObjectSet.end();
975 if (layoutState.lastFloat()) { 977 if (layoutState.lastFloat()) {
976 FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.find (layoutState.lastFloat()); 978 FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.find (layoutState.lastFloat());
977 ASSERT(lastFloatIterator != end); 979 ASSERT(lastFloatIterator != end);
978 ++lastFloatIterator; 980 ++lastFloatIterator;
979 it = lastFloatIterator; 981 it = lastFloatIterator;
980 } 982 }
981 layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSe t.last().get() : 0); 983 layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSe t.last().get() : 0);
982 984
983 if (it == end) 985 if (it == end)
984 return; 986 return;
985 987
988 if (layoutState.checkForFloatsFromLastLine()) {
989 LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisual Overflow();
990 LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayout Overflow();
991 TrailingFloatsRootInlineBox* trailingFloatsLineBox = new TrailingFlo atsRootInlineBox(*this);
992 m_lineBoxes.appendLineBox(trailingFloatsLineBox);
993 trailingFloatsLineBox->setConstructed();
994 GlyphOverflowAndFallbackFontsMap textBoxDataMap;
995 VerticalPositionCache verticalPositionCache;
996 LayoutUnit blockLogicalHeight = logicalHeight();
997 trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight , textBoxDataMap, verticalPositionCache);
998 trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight, blockLogicalHeight, blockLogicalHeight, blockLogicalHeight);
999 LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLay outOverflow - blockLogicalHeight);
1000 LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVis ualOverflow - blockLogicalHeight);
1001 trailingFloatsLineBox->setOverflowFromLogicalRects(logicalLayoutOver flow, logicalVisualOverflow, trailingFloatsLineBox->lineTop(), trailingFloatsLin eBox->lineBottom());
1002 }
1003
986 for (; it != end; ++it) 1004 for (; it != end; ++it)
987 appendFloatingObjectToLastLine(it->get()); 1005 appendFloatingObjectToLastLine(it->get());
988 } 1006 }
989 } 1007 }
990 1008
991 void LayoutBlockFlow::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& floats) 1009 void LayoutBlockFlow::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& floats)
992 { 1010 {
993 size_t floatCount = floats.size(); 1011 size_t floatCount = floats.size();
994 // Floats that did not have layout did not paint invalidations when we laid them out. They would have 1012 // Floats that did not have layout did not paint invalidations when we laid them out. They would have
995 // painted by now if they had moved, but if they stayed at (0, 0), they stil l need to be 1013 // painted by now if they had moved, but if they stayed at (0, 0), they stil l need to be
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 1992 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
1975 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft; 1993 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft;
1976 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 1994 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
1977 1995
1978 if (!style()->isLeftToRightDirection()) 1996 if (!style()->isLeftToRightDirection())
1979 return logicalWidth() - logicalLeft; 1997 return logicalWidth() - logicalLeft;
1980 return logicalLeft; 1998 return logicalLeft;
1981 } 1999 }
1982 2000
1983 } 2001 }
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/layout/line/LineLayoutState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698