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

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

Issue 566973002: Constify the rendering/ selection code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderListMarker.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 floatingObject->renderer()->paint(currentPaintInfo, childPoint); 2119 floatingObject->renderer()->paint(currentPaintInfo, childPoint);
2120 currentPaintInfo.phase = PaintPhaseForeground; 2120 currentPaintInfo.phase = PaintPhaseForeground;
2121 floatingObject->renderer()->paint(currentPaintInfo, childPoint); 2121 floatingObject->renderer()->paint(currentPaintInfo, childPoint);
2122 currentPaintInfo.phase = PaintPhaseOutline; 2122 currentPaintInfo.phase = PaintPhaseOutline;
2123 floatingObject->renderer()->paint(currentPaintInfo, childPoint); 2123 floatingObject->renderer()->paint(currentPaintInfo, childPoint);
2124 } 2124 }
2125 } 2125 }
2126 } 2126 }
2127 } 2127 }
2128 2128
2129 void RenderBlockFlow::clipOutFloatingObjects(RenderBlock* rootBlock, const Paint Info* paintInfo, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock) 2129 void RenderBlockFlow::clipOutFloatingObjects(const RenderBlock* rootBlock, const PaintInfo* paintInfo, const LayoutPoint& rootBlockPhysicalPosition, const Layou tSize& offsetFromRootBlock) const
2130 { 2130 {
2131 if (m_floatingObjects) { 2131 if (m_floatingObjects) {
2132 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2132 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2133 FloatingObjectSetIterator end = floatingObjectSet.end(); 2133 FloatingObjectSetIterator end = floatingObjectSet.end();
2134 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { 2134 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) {
2135 FloatingObject* floatingObject = it->get(); 2135 FloatingObject* floatingObject = it->get();
2136 LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatI ncludingMargin(floatingObject), 2136 LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatI ncludingMargin(floatingObject),
2137 offsetFromRootBlock.height() + yPositionForFloatIncludingMargin( floatingObject), 2137 offsetFromRootBlock.height() + yPositionForFloatIncludingMargin( floatingObject),
2138 floatingObject->renderer()->width(), floatingObject->renderer()- >height()); 2138 floatingObject->renderer()->width(), floatingObject->renderer()- >height());
2139 rootBlock->flipForWritingMode(floatBox); 2139 rootBlock->flipForWritingMode(floatBox);
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 } 2728 }
2729 2729
2730 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const 2730 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
2731 { 2731 {
2732 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) 2732 if (m_floatingObjects && m_floatingObjects->hasRightObjects())
2733 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo gicalHeight); 2733 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo gicalHeight);
2734 2734
2735 return fixedOffset; 2735 return fixedOffset;
2736 } 2736 }
2737 2737
2738 GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock* rootBlock, const Layo utPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 2738 GapRects RenderBlockFlow::inlineSelectionGaps(const RenderBlock* rootBlock, cons t LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
2739 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLog icalRight, const PaintInfo* paintInfo) 2739 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLog icalRight, const PaintInfo* paintInfo) const
2740 { 2740 {
2741 GapRects result; 2741 GapRects result;
2742 2742
2743 bool containsStart = selectionState() == SelectionStart || selectionState() == SelectionBoth; 2743 bool containsStart = selectionState() == SelectionStart || selectionState() == SelectionBoth;
2744 2744
2745 if (!firstLineBox()) { 2745 if (!firstLineBox()) {
2746 if (containsStart) { 2746 if (containsStart) {
2747 // Go ahead and update our lastLogicalTop to be the bottom of the bl ock. <hr>s or empty blocks with height can trip this 2747 // Go ahead and update our lastLogicalTop to be the bottom of the bl ock. <hr>s or empty blocks with height can trip this
2748 // case. 2748 // case.
2749 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock ) + logicalHeight(); 2749 lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock ) + logicalHeight();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 m_rareData->m_paginationStrut = strut; 2801 m_rareData->m_paginationStrut = strut;
2802 } 2802 }
2803 2803
2804 bool RenderBlockFlow::avoidsFloats() const 2804 bool RenderBlockFlow::avoidsFloats() const
2805 { 2805 {
2806 // Floats can't intrude into our box if we have a non-auto column count or w idth. 2806 // Floats can't intrude into our box if we have a non-auto column count or w idth.
2807 // Note: we need to use RenderBox::avoidsFloats here since RenderBlock::avoi dsFloats is always true. 2807 // Note: we need to use RenderBox::avoidsFloats here since RenderBlock::avoi dsFloats is always true.
2808 return RenderBox::avoidsFloats() || !style()->hasAutoColumnCount() || !style ()->hasAutoColumnWidth(); 2808 return RenderBox::avoidsFloats() || !style()->hasAutoColumnCount() || !style ()->hasAutoColumnWidth();
2809 } 2809 }
2810 2810
2811 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L ayoutUnit position) 2811 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(const RenderBlock* rootBl ock, LayoutUnit position) const
2812 { 2812 {
2813 LayoutUnit logicalLeft = logicalLeftOffsetForLine(position, false); 2813 LayoutUnit logicalLeft = logicalLeftOffsetForLine(position, false);
2814 if (logicalLeft == logicalLeftOffsetForContent()) 2814 if (logicalLeft == logicalLeftOffsetForContent())
2815 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); 2815 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position);
2816 2816
2817 RenderBlock* cb = this; 2817 const RenderBlock* cb = this;
2818 while (cb != rootBlock) { 2818 while (cb != rootBlock) {
2819 logicalLeft += cb->logicalLeft(); 2819 logicalLeft += cb->logicalLeft();
2820 cb = cb->containingBlock(); 2820 cb = cb->containingBlock();
2821 } 2821 }
2822 return logicalLeft; 2822 return logicalLeft;
2823 } 2823 }
2824 2824
2825 LayoutUnit RenderBlockFlow::logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position) 2825 LayoutUnit RenderBlockFlow::logicalRightSelectionOffset(const RenderBlock* rootB lock, LayoutUnit position) const
2826 { 2826 {
2827 LayoutUnit logicalRight = logicalRightOffsetForLine(position, false); 2827 LayoutUnit logicalRight = logicalRightOffsetForLine(position, false);
2828 if (logicalRight == logicalRightOffsetForContent()) 2828 if (logicalRight == logicalRightOffsetForContent())
2829 return RenderBlock::logicalRightSelectionOffset(rootBlock, position); 2829 return RenderBlock::logicalRightSelectionOffset(rootBlock, position);
2830 2830
2831 RenderBlock* cb = this; 2831 const RenderBlock* cb = this;
2832 while (cb != rootBlock) { 2832 while (cb != rootBlock) {
2833 logicalRight += cb->logicalLeft(); 2833 logicalRight += cb->logicalLeft();
2834 cb = cb->containingBlock(); 2834 cb = cb->containingBlock();
2835 } 2835 }
2836 return logicalRight; 2836 return logicalRight;
2837 } 2837 }
2838 2838
2839 RootInlineBox* RenderBlockFlow::createRootInlineBox() 2839 RootInlineBox* RenderBlockFlow::createRootInlineBox()
2840 { 2840 {
2841 return new RootInlineBox(*this); 2841 return new RootInlineBox(*this);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2905 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2906 { 2906 {
2907 if (m_rareData) 2907 if (m_rareData)
2908 return *m_rareData; 2908 return *m_rareData;
2909 2909
2910 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); 2910 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this));
2911 return *m_rareData; 2911 return *m_rareData;
2912 } 2912 }
2913 2913
2914 } // namespace blink 2914 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderListMarker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698