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

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

Issue 720313002: Push selection gaps logic down to RenderBlockFlow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move even MOAR! Created 6 years, 1 month 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/paint/BlockPainter.cpp ('k') | Source/core/rendering/RenderBlock.cpp » ('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) 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 // Block flows subclass availableWidth to handle multi column layout (shrink ing the width available to children when laying out.) 150 // Block flows subclass availableWidth to handle multi column layout (shrink ing the width available to children when laying out.)
151 virtual LayoutUnit availableLogicalWidth() const override final; 151 virtual LayoutUnit availableLogicalWidth() const override final;
152 152
153 LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const; 153 LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const;
154 void adjustStartEdgeForWritingModeIncludingColumns(LayoutRect&) const; 154 void adjustStartEdgeForWritingModeIncludingColumns(LayoutRect&) const;
155 155
156 LayoutUnit blockDirectionOffset(const LayoutSize& offsetFromBlock) const; 156 LayoutUnit blockDirectionOffset(const LayoutSize& offsetFromBlock) const;
157 LayoutUnit inlineDirectionOffset(const LayoutSize& offsetFromBlock) const; 157 LayoutUnit inlineDirectionOffset(const LayoutSize& offsetFromBlock) const;
158 158
159 virtual bool shouldPaintSelectionGaps() const override final;
160 GapRects selectionGapRectsForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer) const;
161 LayoutRect logicalLeftSelectionGap(const RenderBlock* rootBlock, const Layou tPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
162 const RenderObject* selObj, LayoutUnit lo gicalLeft, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo*) co nst;
163 LayoutRect logicalRightSelectionGap(const RenderBlock* rootBlock, const Layo utPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
164 const RenderObject* selObj, LayoutUnit l ogicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo*) const;
165 void getSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap) cons t;
166 RenderBlock* blockBeforeWithinSelectionRoot(LayoutSize& offset) const; 159 RenderBlock* blockBeforeWithinSelectionRoot(LayoutSize& offset) const;
167 160
168 virtual void setSelectionState(SelectionState) override; 161 virtual void setSelectionState(SelectionState) override;
169 162
170 LayoutRect logicalRectToPhysicalRect(const LayoutPoint& physicalPosition, co nst LayoutRect& logicalRect) const; 163 LayoutRect logicalRectToPhysicalRect(const LayoutPoint& physicalPosition, co nst LayoutRect& logicalRect) const;
171 164
172 // Helper methods for computing line counts and heights for line counts. 165 // Helper methods for computing line counts and heights for line counts.
173 RootInlineBox* lineAtIndex(int) const; 166 RootInlineBox* lineAtIndex(int) const;
174 int lineCount(const RootInlineBox* = 0, bool* = 0) const; 167 int lineCount(const RootInlineBox* = 0, bool* = 0) const;
175 int heightForLineCount(int); 168 int heightForLineCount(int);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 226
234 LayoutUnit availableLogicalWidthForContent() const { return max<LayoutUnit>( 0, logicalRightOffsetForContent() - logicalLeftOffsetForContent()); } 227 LayoutUnit availableLogicalWidthForContent() const { return max<LayoutUnit>( 0, logicalRightOffsetForContent() - logicalLeftOffsetForContent()); }
235 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } 228 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); }
236 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo rContent() + availableLogicalWidth(); } 229 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo rContent() + availableLogicalWidth(); }
237 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor Content(); } 230 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor Content(); }
238 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC ontent(); } 231 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC ontent(); }
239 232
240 virtual LayoutUnit logicalLeftSelectionOffset(const RenderBlock* rootBlock, LayoutUnit position) const; 233 virtual LayoutUnit logicalLeftSelectionOffset(const RenderBlock* rootBlock, LayoutUnit position) const;
241 virtual LayoutUnit logicalRightSelectionOffset(const RenderBlock* rootBlock, LayoutUnit position) const; 234 virtual LayoutUnit logicalRightSelectionOffset(const RenderBlock* rootBlock, LayoutUnit position) const;
242 235
243 GapRects selectionGaps(const RenderBlock* rootBlock, const LayoutPoint& root BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
244 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las tLogicalRight, const PaintInfo* = 0) const;
245
246 #if ENABLE(ASSERT) 236 #if ENABLE(ASSERT)
247 void checkPositionedObjectsNeedLayout(); 237 void checkPositionedObjectsNeedLayout();
248 bool paintsContinuationOutline(RenderInline* flow); 238 bool paintsContinuationOutline(RenderInline* flow);
249 #endif 239 #endif
250 #ifndef NDEBUG 240 #ifndef NDEBUG
251 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline Box* = 0, const char* = 0, const RenderObject* = 0) const; 241 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline Box* = 0, const char* = 0, const RenderObject* = 0) const;
252 #endif 242 #endif
253 243
254 bool recalcChildOverflowAfterStyleChange(); 244 bool recalcChildOverflowAfterStyleChange();
255 bool recalcOverflowAfterStyleChange(); 245 bool recalcOverflowAfterStyleChange();
256 246
257 virtual LayoutRect selectionRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer) const override final;
258
259 protected: 247 protected:
260 virtual void willBeDestroyed() override; 248 virtual void willBeDestroyed() override;
261 249
262 void dirtyForLayoutFromPercentageHeightDescendants(SubtreeLayoutScope&); 250 void dirtyForLayoutFromPercentageHeightDescendants(SubtreeLayoutScope&);
263 251
264 virtual void layout() override; 252 virtual void layout() override;
265 virtual bool updateImageLoadingPriorities() override final; 253 virtual bool updateImageLoadingPriorities() override final;
266 254
267 enum PositionedLayoutBehavior { 255 enum PositionedLayoutBehavior {
268 DefaultLayout, 256 DefaultLayout,
269 LayoutOnlyFixedPositionedObjects, 257 LayoutOnlyFixedPositionedObjects,
270 ForcedLayoutAfterContainingBlockMoved 258 ForcedLayoutAfterContainingBlockMoved
271 }; 259 };
272 260
273 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout); 261 void layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior = DefaultLayout);
274 void markFixedPositionObjectForLayoutIfNeeded(RenderObject* child, SubtreeLa youtScope&); 262 void markFixedPositionObjectForLayoutIfNeeded(RenderObject* child, SubtreeLa youtScope&);
275 263
276 LayoutUnit marginIntrinsicLogicalWidthForChild(RenderBox* child) const; 264 LayoutUnit marginIntrinsicLogicalWidthForChild(RenderBox* child) const;
277 265
278 int beforeMarginInLineDirection(LineDirectionMode) const; 266 int beforeMarginInLineDirection(LineDirectionMode) const;
279 267
280 virtual void paint(PaintInfo&, const LayoutPoint&) override; 268 virtual void paint(PaintInfo&, const LayoutPoint&) override;
281 public: 269 public:
282 virtual void paintObject(PaintInfo&, const LayoutPoint&) override; 270 virtual void paintObject(PaintInfo&, const LayoutPoint&) override;
283 virtual void paintChildren(PaintInfo&, const LayoutPoint&); 271 virtual void paintChildren(PaintInfo&, const LayoutPoint&);
284 272
285 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to Rend erBlockFlow 273 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to Rend erBlockFlow
286 virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool) { } 274 virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool) { }
275 virtual void paintSelection(PaintInfo&, const LayoutPoint&) { }
287 276
288 protected: 277 protected:
289 virtual void adjustInlineDirectionLineBounds(unsigned /* expansionOpportunit yCount */, float& /* logicalLeft */, float& /* logicalWidth */) const { } 278 virtual void adjustInlineDirectionLineBounds(unsigned /* expansionOpportunit yCount */, float& /* logicalLeft */, float& /* logicalWidth */) const { }
290 279
291 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo utUnit& maxLogicalWidth) const override; 280 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo utUnit& maxLogicalWidth) const override;
292 virtual void computePreferredLogicalWidths() override; 281 virtual void computePreferredLogicalWidths() override;
293 void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, Lay outUnit& maxLogicalWidth) const; 282 void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, Lay outUnit& maxLogicalWidth) const;
294 283
295 virtual int firstLineBoxBaseline() const override; 284 virtual int firstLineBoxBaseline() const override;
296 virtual int inlineBlockBaseline(LineDirectionMode) const override; 285 virtual int inlineBlockBaseline(LineDirectionMode) const override;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // children. 375 // children.
387 virtual RenderBlock* firstLineBlock() const override; 376 virtual RenderBlock* firstLineBlock() const override;
388 377
389 virtual LayoutRect rectWithOutlineForPaintInvalidation(const RenderLayerMode lObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvalid ationState* = 0) const override final; 378 virtual LayoutRect rectWithOutlineForPaintInvalidation(const RenderLayerMode lObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvalid ationState* = 0) const override final;
390 379
391 virtual RenderObject* hoverAncestor() const override final; 380 virtual RenderObject* hoverAncestor() const override final;
392 virtual void updateDragState(bool dragOn) override final; 381 virtual void updateDragState(bool dragOn) override final;
393 virtual void childBecameNonInline(RenderObject* child) override final; 382 virtual void childBecameNonInline(RenderObject* child) override final;
394 383
395 bool isSelectionRoot() const; 384 bool isSelectionRoot() const;
396 GapRects blockSelectionGaps(const RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
397 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogi calLeft, LayoutUnit& lastLogicalRight, const PaintInfo*) const;
398 LayoutRect blockSelectionGap(const RenderBlock* rootBlock, const LayoutPoint & rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
399 LayoutUnit lastLogicalTop, LayoutUnit lastLogic alLeft, LayoutUnit lastLogicalRight, LayoutUnit logicalBottom, const PaintInfo*) const;
400 385
401 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to Rend erBlockFlow 386 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to Rend erBlockFlow
402 virtual void clipOutFloatingObjects(const RenderBlock*, const PaintInfo*, co nst LayoutPoint&, const LayoutSize&) const { }; 387 virtual void clipOutFloatingObjects(const RenderBlock*, const PaintInfo*, co nst LayoutPoint&, const LayoutSize&) const { };
403 388
404 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const override; 389 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const override;
405 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid e; 390 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid e;
406 391
407 LayoutUnit desiredColumnWidth() const; 392 LayoutUnit desiredColumnWidth() const;
408 393
409 private: 394 private:
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 // FIXME: This is temporary as we move code that accesses block flow 477 // FIXME: This is temporary as we move code that accesses block flow
493 // member variables out of RenderBlock and into RenderBlockFlow. 478 // member variables out of RenderBlock and into RenderBlockFlow.
494 friend class RenderBlockFlow; 479 friend class RenderBlockFlow;
495 }; 480 };
496 481
497 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); 482 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock());
498 483
499 } // namespace blink 484 } // namespace blink
500 485
501 #endif // RenderBlock_h 486 #endif // RenderBlock_h
OLDNEW
« no previous file with comments | « Source/core/paint/BlockPainter.cpp ('k') | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698