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

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

Issue 178473024: Convert some Shape code to use references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase with 185393015 Created 6 years, 9 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 bool didBreakAtLineToAvoidWidow() const { return m_rareData && m_rareData->m _didBreakAtLineToAvoidWidow; } 220 bool didBreakAtLineToAvoidWidow() const { return m_rareData && m_rareData->m _didBreakAtLineToAvoidWidow; }
221 221
222 // The page logical offset is the object's offset from the top of the page i n the page progression 222 // The page logical offset is the object's offset from the top of the page i n the page progression
223 // direction (so an x-offset in vertical text and a y-offset for horizontal text). 223 // direction (so an x-offset in vertical text and a y-offset for horizontal text).
224 LayoutUnit pageLogicalOffset() const { return m_rareData ? m_rareData->m_pag eLogicalOffset : LayoutUnit(); } 224 LayoutUnit pageLogicalOffset() const { return m_rareData ? m_rareData->m_pag eLogicalOffset : LayoutUnit(); }
225 void setPageLogicalOffset(LayoutUnit); 225 void setPageLogicalOffset(LayoutUnit);
226 226
227 // Accessors for logical width/height and margins in the containing block's block-flow direction. 227 // Accessors for logical width/height and margins in the containing block's block-flow direction.
228 LayoutUnit logicalWidthForChild(const RenderBox* child) const { return isHor izontalWritingMode() ? child->width() : child->height(); } 228 LayoutUnit logicalWidthForChild(const RenderBox* child) const { return isHor izontalWritingMode() ? child->width() : child->height(); }
229 LayoutUnit logicalHeightForChild(const RenderBox* child) const { return isHo rizontalWritingMode() ? child->height() : child->width(); } 229 LayoutUnit logicalHeightForChild(const RenderBox* child) const { return isHo rizontalWritingMode() ? child->height() : child->width(); }
230 LayoutSize logicalSizeForChild(const RenderBox* child) const { return isHori zontalWritingMode() ? child->size() : child->size().transposedSize(); }
adamk 2014/03/04 19:45:05 This change seems out of place in this patch, as i
230 LayoutUnit logicalTopForChild(const RenderBox* child) const { return isHoriz ontalWritingMode() ? child->y() : child->x(); } 231 LayoutUnit logicalTopForChild(const RenderBox* child) const { return isHoriz ontalWritingMode() ? child->y() : child->x(); }
231 LayoutUnit marginBeforeForChild(const RenderBoxModelObject* child) const { r eturn child->marginBefore(style()); } 232 LayoutUnit marginBeforeForChild(const RenderBoxModelObject* child) const { r eturn child->marginBefore(style()); }
232 LayoutUnit marginAfterForChild(const RenderBoxModelObject* child) const { re turn child->marginAfter(style()); } 233 LayoutUnit marginAfterForChild(const RenderBoxModelObject* child) const { re turn child->marginAfter(style()); }
233 LayoutUnit marginStartForChild(const RenderBoxModelObject* child) const { re turn child->marginStart(style()); } 234 LayoutUnit marginStartForChild(const RenderBoxModelObject* child) const { re turn child->marginStart(style()); }
234 LayoutUnit marginEndForChild(const RenderBoxModelObject* child) const { retu rn child->marginEnd(style()); } 235 LayoutUnit marginEndForChild(const RenderBoxModelObject* child) const { retu rn child->marginEnd(style()); }
235 void setMarginStartForChild(RenderBox* child, LayoutUnit value) const { chil d->setMarginStart(value, style()); } 236 void setMarginStartForChild(RenderBox* child, LayoutUnit value) const { chil d->setMarginStart(value, style()); }
236 void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child- >setMarginEnd(value, style()); } 237 void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child- >setMarginEnd(value, style()); }
237 void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { chi ld->setMarginBefore(value, style()); } 238 void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { chi ld->setMarginBefore(value, style()); }
238 void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { chil d->setMarginAfter(value, style()); } 239 void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { chil d->setMarginAfter(value, style()); }
239 LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; 240 LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const;
240 LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; 241 LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const;
241 242
242 virtual void updateFirstLetter(); 243 virtual void updateFirstLetter();
243 244
244 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*v erticalScrollbarChanged*/) { }; 245 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*v erticalScrollbarChanged*/) { };
245 246
246 LayoutUnit availableLogicalWidthForContent() const { return max<LayoutUnit>( 0, logicalRightOffsetForContent() - logicalLeftOffsetForContent()); } 247 LayoutUnit availableLogicalWidthForContent() const { return max<LayoutUnit>( 0, logicalRightOffsetForContent() - logicalLeftOffsetForContent()); }
247 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } 248 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); }
248 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo rContent() + availableLogicalWidth(); } 249 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo rContent() + availableLogicalWidth(); }
249 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor Content(); } 250 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor Content(); }
250 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC ontent(); } 251 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC ontent(); }
251 252
252 #ifndef NDEBUG 253 #ifndef NDEBUG
253 void checkPositionedObjectsNeedLayout(); 254 void checkPositionedObjectsNeedLayout();
254 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline Box* = 0, const char* = 0, const RenderObject* = 0) const; 255 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline Box* = 0, const char* = 0, const RenderObject* = 0) const;
255 #endif 256 #endif
256 257
257 ShapeInsideInfo* ensureShapeInsideInfo() 258 ShapeInsideInfo& ensureShapeInsideInfo()
258 { 259 {
259 if (!m_rareData || !m_rareData->m_shapeInsideInfo) 260 if (!m_rareData || !m_rareData->m_shapeInsideInfo)
260 setShapeInsideInfo(ShapeInsideInfo::createInfo(this)); 261 setShapeInsideInfo(ShapeInsideInfo::createInfo(*this));
261 return m_rareData->m_shapeInsideInfo.get(); 262 return *m_rareData->m_shapeInsideInfo;
262 } 263 }
263 ShapeInsideInfo* shapeInsideInfo() const 264 ShapeInsideInfo* shapeInsideInfo() const
264 { 265 {
265 return m_rareData && m_rareData->m_shapeInsideInfo && ShapeInsideInfo::i sEnabledFor(this) ? m_rareData->m_shapeInsideInfo.get() : 0; 266 return m_rareData && m_rareData->m_shapeInsideInfo && ShapeInsideInfo::i sEnabledFor(*this) ? m_rareData->m_shapeInsideInfo.get() : 0;
266 } 267 }
267 void setShapeInsideInfo(PassOwnPtr<ShapeInsideInfo> value) 268 void setShapeInsideInfo(PassOwnPtr<ShapeInsideInfo> value)
268 { 269 {
269 if (!m_rareData) 270 if (!m_rareData)
270 m_rareData = adoptPtr(new RenderBlockRareData()); 271 m_rareData = adoptPtr(new RenderBlockRareData());
271 m_rareData->m_shapeInsideInfo = value; 272 m_rareData->m_shapeInsideInfo = value;
272 } 273 }
273 ShapeInsideInfo* layoutShapeInsideInfo() const; 274 ShapeInsideInfo* layoutShapeInsideInfo() const;
274 bool allowsShapeInsideInfoSharing(const RenderBlock* other) const; 275 bool allowsShapeInsideInfoSharing(const RenderBlock* other) const;
275 LayoutSize logicalOffsetFromShapeAncestorContainer(const RenderBlock* contai ner) const; 276 LayoutSize logicalOffsetFromShapeAncestorContainer(const RenderBlock* contai ner) const;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 return false; 578 return false;
578 } 579 }
579 return true; 580 return true;
580 } 581 }
581 582
582 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); 583 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock());
583 584
584 } // namespace WebCore 585 } // namespace WebCore
585 586
586 #endif // RenderBlock_h 587 #endif // RenderBlock_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698