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

Side by Side Diff: Source/core/rendering/RenderBlock.h

Issue 13909006: Merge patch for stacked floats with shape-outside from WebKit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase to reflect movment of WebCore -> core Created 7 years, 8 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 template <class Iterator> struct MidpointState; 64 template <class Iterator> struct MidpointState;
65 typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver; 65 typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver;
66 typedef MidpointState<InlineIterator> LineMidpointState; 66 typedef MidpointState<InlineIterator> LineMidpointState;
67 typedef WTF::ListHashSet<RenderBox*, 16> TrackedRendererListHashSet; 67 typedef WTF::ListHashSet<RenderBox*, 16> TrackedRendererListHashSet;
68 typedef WTF::HashMap<const RenderBlock*, OwnPtr<TrackedRendererListHashSet> > Tr ackedDescendantsMap; 68 typedef WTF::HashMap<const RenderBlock*, OwnPtr<TrackedRendererListHashSet> > Tr ackedDescendantsMap;
69 typedef WTF::HashMap<const RenderBox*, OwnPtr<HashSet<RenderBlock*> > > TrackedC ontainerMap; 69 typedef WTF::HashMap<const RenderBox*, OwnPtr<HashSet<RenderBlock*> > > TrackedC ontainerMap;
70 typedef Vector<WordMeasurement, 64> WordMeasurements; 70 typedef Vector<WordMeasurement, 64> WordMeasurements;
71 71
72 enum CaretType { CursorCaret, DragCaret }; 72 enum CaretType { CursorCaret, DragCaret };
73 enum ContainingBlockState { NewContainingBlock, SameContainingBlock }; 73 enum ContainingBlockState { NewContainingBlock, SameContainingBlock };
74 enum ShapeOutsideFloatOffsetMode { ShapeOutsideFloatShapeOffset, ShapeOutsideFlo atBoundingBoxOffset };
74 75
75 enum TextRunFlag { 76 enum TextRunFlag {
76 DefaultTextRunFlags = 0, 77 DefaultTextRunFlags = 0,
77 RespectDirection = 1 << 0, 78 RespectDirection = 1 << 0,
78 RespectDirectionOverride = 1 << 1 79 RespectDirectionOverride = 1 << 1
79 }; 80 };
80 81
81 typedef unsigned TextRunFlags; 82 typedef unsigned TextRunFlags;
82 83
83 class RenderBlock : public RenderBox { 84 class RenderBlock : public RenderBox {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bool containsFloats() const { return m_floatingObjects && !m_floatingObjects ->set().isEmpty(); } 164 bool containsFloats() const { return m_floatingObjects && !m_floatingObjects ->set().isEmpty(); }
164 bool containsFloat(RenderBox*) const; 165 bool containsFloat(RenderBox*) const;
165 166
166 // Versions that can compute line offsets with the region and page offset pa ssed in. Used for speed to avoid having to 167 // Versions that can compute line offsets with the region and page offset pa ssed in. Used for speed to avoid having to
167 // compute the region all over again when you already know it. 168 // compute the region all over again when you already know it.
168 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldInde ntText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, Layout Unit logicalHeight = 0) const 169 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldInde ntText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, Layout Unit logicalHeight = 0) const
169 { 170 {
170 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldInde ntText, region, offsetFromLogicalTopOfFirstPage, logicalHeight) 171 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldInde ntText, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
171 - logicalLeftOffsetForLine(position, shouldIndentText, region, offse tFromLogicalTopOfFirstPage, logicalHeight)); 172 - logicalLeftOffsetForLine(position, shouldIndentText, region, offse tFromLogicalTopOfFirstPage, logicalHeight));
172 } 173 }
173 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentT ext, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUni t logicalHeight = 0) const 174 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentT ext, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUni t logicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = ShapeOutsideFloatS hapeOffset) const
Julien - ping for review 2013/04/17 21:20:22 Adding more parameters is making this function con
174 { 175 {
175 return logicalRightOffsetForLine(position, logicalRightOffsetForContent( region, offsetFromLogicalTopOfFirstPage), shouldIndentText, 0, logicalHeight); 176 return logicalRightOffsetForLine(position, logicalRightOffsetForContent( region, offsetFromLogicalTopOfFirstPage), shouldIndentText, 0, logicalHeight, of fsetMode);
176 } 177 }
177 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentTe xt, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0) const 178 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentTe xt, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = ShapeOutsideFloatSh apeOffset) const
178 { 179 {
179 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(re gion, offsetFromLogicalTopOfFirstPage), shouldIndentText, 0, logicalHeight); 180 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(re gion, offsetFromLogicalTopOfFirstPage), shouldIndentText, 0, logicalHeight, offs etMode);
180 } 181 }
181 LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, Re nderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logic alHeight = 0) const 182 LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, Re nderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logic alHeight = 0) const
182 { 183 {
183 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(posi tion, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight) 184 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(posi tion, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
184 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT ext, region, offsetFromLogicalTopOfFirstPage, logicalHeight); 185 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT ext, region, offsetFromLogicalTopOfFirstPage, logicalHeight);
185 } 186 }
186 LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, Rend erRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logical Height = 0) const 187 LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, Rend erRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnit logical Height = 0) const
187 { 188 {
188 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(pos ition, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight) 189 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(pos ition, shouldIndentText, region, offsetFromLogicalTopOfFirstPage, logicalHeight)
189 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT ext, region, offsetFromLogicalTopOfFirstPage, logicalHeight); 190 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentT ext, region, offsetFromLogicalTopOfFirstPage, logicalHeight);
190 } 191 }
191 192
192 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldInde ntText, LayoutUnit logicalHeight = 0) const 193 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldInde ntText, LayoutUnit logicalHeight = 0) const
193 { 194 {
194 return availableLogicalWidthForLine(position, shouldIndentText, regionAt BlockOffset(position), offsetFromLogicalTopOfFirstPage(), logicalHeight); 195 return availableLogicalWidthForLine(position, shouldIndentText, regionAt BlockOffset(position), offsetFromLogicalTopOfFirstPage(), logicalHeight);
195 } 196 }
196 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentT ext, LayoutUnit logicalHeight = 0) const 197 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentT ext, LayoutUnit logicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = Shap eOutsideFloatShapeOffset) const
197 { 198 {
198 return logicalRightOffsetForLine(position, logicalRightOffsetForContent( position), shouldIndentText, 0, logicalHeight); 199 return logicalRightOffsetForLine(position, logicalRightOffsetForContent( position), shouldIndentText, 0, logicalHeight, offsetMode);
199 } 200 }
200 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentTe xt, LayoutUnit logicalHeight = 0) const 201 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentTe xt, LayoutUnit logicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = Shape OutsideFloatShapeOffset) const
201 { 202 {
202 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(po sition), shouldIndentText, 0, logicalHeight); 203 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(po sition), shouldIndentText, 0, logicalHeight, offsetMode);
203 } 204 }
204 LayoutUnit pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool sh ouldIndentText, LayoutUnit logicalHeight = 0) const 205 LayoutUnit pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool sh ouldIndentText, LayoutUnit logicalHeight = 0) const
205 { 206 {
206 return roundToInt(logicalLeftOffsetForLine(position, shouldIndentText, l ogicalHeight)); 207 return roundToInt(logicalLeftOffsetForLine(position, shouldIndentText, l ogicalHeight));
207 } 208 }
208 LayoutUnit pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool s houldIndentText, LayoutUnit logicalHeight = 0) const 209 LayoutUnit pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool s houldIndentText, LayoutUnit logicalHeight = 0) const
209 { 210 {
210 // FIXME: Multicolumn layouts break carrying over subpixel values to the logical right offset because the lines may be shifted 211 // FIXME: Multicolumn layouts break carrying over subpixel values to the logical right offset because the lines may be shifted
211 // by a subpixel value for all but the first column. This can lead to th e actual pixel snapped width of the column being off 212 // by a subpixel value for all but the first column. This can lead to th e actual pixel snapped width of the column being off
212 // by one pixel when rendered versus layed out, which can result in the line being clipped. For now, we have to floor. 213 // by one pixel when rendered versus layed out, which can result in the line being clipped. For now, we have to floor.
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 virtual void layout(); 508 virtual void layout();
508 509
509 void layoutPositionedObjects(bool relayoutChildren, bool fixedPositionObject sOnly = false); 510 void layoutPositionedObjects(bool relayoutChildren, bool fixedPositionObject sOnly = false);
510 void markFixedPositionObjectForLayoutIfNeeded(RenderObject* child); 511 void markFixedPositionObjectForLayoutIfNeeded(RenderObject* child);
511 512
512 virtual void paint(PaintInfo&, const LayoutPoint&); 513 virtual void paint(PaintInfo&, const LayoutPoint&);
513 virtual void paintObject(PaintInfo&, const LayoutPoint&); 514 virtual void paintObject(PaintInfo&, const LayoutPoint&);
514 virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo & forChild, bool usePrintRect); 515 virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo & forChild, bool usePrintRect);
515 bool paintChild(RenderBox*, PaintInfo& forSelf, const LayoutPoint&, PaintInf o& forChild, bool usePrintRect); 516 bool paintChild(RenderBox*, PaintInfo& forSelf, const LayoutPoint&, PaintInf o& forChild, bool usePrintRect);
516 517
517 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOf fset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit l ogicalHeight = 0) const; 518 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOf fset, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit l ogicalHeight = 0, ShapeOutsideFloatOffsetMode = ShapeOutsideFloatShapeOffset) co nst;
518 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOff set, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit lo gicalHeight = 0) const; 519 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOff set, bool applyTextIndent, LayoutUnit* logicalHeightRemaining = 0, LayoutUnit lo gicalHeight = 0, ShapeOutsideFloatOffsetMode = ShapeOutsideFloatShapeOffset) con st;
519 520
520 virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const; 521 virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
521 virtual void adjustInlineDirectionLineBounds(int /* expansionOpportunityCoun t */, float& /* logicalLeft */, float& /* logicalWidth */) const { } 522 virtual void adjustInlineDirectionLineBounds(int /* expansionOpportunityCoun t */, float& /* logicalLeft */, float& /* logicalWidth */) const { }
522 523
523 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) OVERRIDE; 524 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) OVERRIDE;
524 525
525 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo utUnit& maxLogicalWidth) const OVERRIDE; 526 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo utUnit& maxLogicalWidth) const OVERRIDE;
526 virtual void computePreferredLogicalWidths() OVERRIDE; 527 virtual void computePreferredLogicalWidths() OVERRIDE;
527 528
528 virtual int firstLineBoxBaseline() const; 529 virtual int firstLineBoxBaseline() const;
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 static String string(const int value); 1326 static String string(const int value);
1326 }; 1327 };
1327 template<> struct ValueToString<RenderBlock::FloatingObject*> { 1328 template<> struct ValueToString<RenderBlock::FloatingObject*> {
1328 static String string(const RenderBlock::FloatingObject*); 1329 static String string(const RenderBlock::FloatingObject*);
1329 }; 1330 };
1330 #endif 1331 #endif
1331 1332
1332 } // namespace WebCore 1333 } // namespace WebCore
1333 1334
1334 #endif // RenderBlock_h 1335 #endif // RenderBlock_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698