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

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

Issue 620753006: Rendering API cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years, 2 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
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBox.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 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007 Apple 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 RenderBox* lastChildBox() const; 90 RenderBox* lastChildBox() const;
91 91
92 LayoutUnit x() const { return m_frameRect.x(); } 92 LayoutUnit x() const { return m_frameRect.x(); }
93 LayoutUnit y() const { return m_frameRect.y(); } 93 LayoutUnit y() const { return m_frameRect.y(); }
94 LayoutUnit width() const { return m_frameRect.width(); } 94 LayoutUnit width() const { return m_frameRect.width(); }
95 LayoutUnit height() const { return m_frameRect.height(); } 95 LayoutUnit height() const { return m_frameRect.height(); }
96 96
97 int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); } 97 int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
98 int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); } 98 int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
99 99
100 // These represent your location relative to your container as a physical of fset.
101 // In layout related methods you almost always want the logical location (e. g. x() and y()).
102 LayoutUnit top() const { return topLeftLocation().y(); }
103 LayoutUnit left() const { return topLeftLocation().x(); }
104
105 void setX(LayoutUnit x) { m_frameRect.setX(x); } 100 void setX(LayoutUnit x) { m_frameRect.setX(x); }
106 void setY(LayoutUnit y) { m_frameRect.setY(y); } 101 void setY(LayoutUnit y) { m_frameRect.setY(y); }
107 void setWidth(LayoutUnit width) { m_frameRect.setWidth(width); } 102 void setWidth(LayoutUnit width) { m_frameRect.setWidth(width); }
108 void setHeight(LayoutUnit height) { m_frameRect.setHeight(height); } 103 void setHeight(LayoutUnit height) { m_frameRect.setHeight(height); }
109 104
110 LayoutUnit logicalLeft() const { return style()->isHorizontalWritingMode() ? x() : y(); } 105 LayoutUnit logicalLeft() const { return style()->isHorizontalWritingMode() ? x() : y(); }
111 LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); } 106 LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
112 LayoutUnit logicalTop() const { return style()->isHorizontalWritingMode() ? y() : x(); } 107 LayoutUnit logicalTop() const { return style()->isHorizontalWritingMode() ? y() : x(); }
113 LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); } 108 LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); }
114 LayoutUnit logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); } 109 LayoutUnit logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 else 144 else
150 setHeight(size); 145 setHeight(size);
151 } 146 }
152 void setLogicalHeight(LayoutUnit size) 147 void setLogicalHeight(LayoutUnit size)
153 { 148 {
154 if (style()->isHorizontalWritingMode()) 149 if (style()->isHorizontalWritingMode())
155 setHeight(size); 150 setHeight(size);
156 else 151 else
157 setWidth(size); 152 setWidth(size);
158 } 153 }
159 void setLogicalSize(const LayoutSize& size)
160 {
161 if (style()->isHorizontalWritingMode())
162 setSize(size);
163 else
164 setSize(size.transposedSize());
165 }
166 154
167 LayoutPoint location() const { return m_frameRect.location(); } 155 LayoutPoint location() const { return m_frameRect.location(); }
168 LayoutSize locationOffset() const { return LayoutSize(x(), y()); } 156 LayoutSize locationOffset() const { return LayoutSize(x(), y()); }
169 LayoutSize size() const { return m_frameRect.size(); } 157 LayoutSize size() const { return m_frameRect.size(); }
170 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); } 158 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); }
171 159
172 void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(loca tion); } 160 void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(loca tion); }
173 161
174 void setSize(const LayoutSize& size) { m_frameRect.setSize(size); } 162 void setSize(const LayoutSize& size) { m_frameRect.setSize(size); }
175 void move(LayoutUnit dx, LayoutUnit dy) { m_frameRect.move(dx, dy); } 163 void move(LayoutUnit dx, LayoutUnit dy) { m_frameRect.move(dx, dy); }
176 164
177 LayoutRect frameRect() const { return m_frameRect; } 165 LayoutRect frameRect() const { return m_frameRect; }
178 IntRect pixelSnappedFrameRect() const { return pixelSnappedIntRect(m_frameRe ct); }
179 void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; } 166 void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; }
180 167
181 LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); } 168 LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); }
182 LayoutRect paddingBoxRect() const { return LayoutRect(borderLeft(), borderTo p(), contentWidth() + paddingLeft() + paddingRight(), contentHeight() + paddingT op() + paddingBottom()); } 169 LayoutRect paddingBoxRect() const { return LayoutRect(borderLeft(), borderTo p(), contentWidth() + paddingLeft() + paddingRight(), contentHeight() + paddingT op() + paddingBottom()); }
183 IntRect pixelSnappedBorderBoxRect() const { return IntRect(IntPoint(), m_fra meRect.pixelSnappedSize()); } 170 IntRect pixelSnappedBorderBoxRect() const { return IntRect(IntPoint(), m_fra meRect.pixelSnappedSize()); }
184 virtual IntRect borderBoundingBox() const OVERRIDE FINAL { return pixelSnapp edBorderBoxRect(); } 171 virtual IntRect borderBoundingBox() const OVERRIDE FINAL { return pixelSnapp edBorderBoxRect(); }
185 172
186 // The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border). 173 // The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border).
187 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + padding Left(), borderTop() + paddingTop(), contentWidth(), contentHeight()); } 174 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + padding Left(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
188 // The content box in absolute coords. Ignores transforms. 175 // The content box in absolute coords. Ignores transforms.
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 LayoutUnit availableHeight() const { return style()->isHorizontalWritingMode () ? availableLogicalHeight(IncludeMarginBorderPadding) : availableLogicalWidth( ); } 453 LayoutUnit availableHeight() const { return style()->isHorizontalWritingMode () ? availableLogicalHeight(IncludeMarginBorderPadding) : availableLogicalWidth( ); }
467 454
468 virtual int verticalScrollbarWidth() const; 455 virtual int verticalScrollbarWidth() const;
469 int horizontalScrollbarHeight() const; 456 int horizontalScrollbarHeight() const;
470 int instrinsicScrollbarLogicalWidth() const; 457 int instrinsicScrollbarLogicalWidth() const;
471 int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode () ? horizontalScrollbarHeight() : verticalScrollbarWidth(); } 458 int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode () ? horizontalScrollbarHeight() : verticalScrollbarWidth(); }
472 virtual bool scroll(ScrollDirection, ScrollGranularity, float delta = 1); 459 virtual bool scroll(ScrollDirection, ScrollGranularity, float delta = 1);
473 bool canBeScrolledAndHasScrollableArea() const; 460 bool canBeScrolledAndHasScrollableArea() const;
474 virtual bool canBeProgramaticallyScrolled() const; 461 virtual bool canBeProgramaticallyScrolled() const;
475 virtual void autoscroll(const IntPoint&); 462 virtual void autoscroll(const IntPoint&);
476 bool autoscrollInProgress() const;
477 bool canAutoscroll() const; 463 bool canAutoscroll() const;
478 IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const; 464 IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const;
479 static RenderBox* findAutoscrollable(RenderObject*); 465 static RenderBox* findAutoscrollable(RenderObject*);
480 virtual void stopAutoscroll() { } 466 virtual void stopAutoscroll() { }
481 virtual void panScroll(const IntPoint&); 467 virtual void panScroll(const IntPoint&);
482 468
483 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style() ->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); } 469 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style() ->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); }
484 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style ()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } 470 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style ()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); }
485 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY (); } 471 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY (); }
486 472
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 if (UNLIKELY(inlineBoxWrapper() != 0)) 767 if (UNLIKELY(inlineBoxWrapper() != 0))
782 deleteLineBoxWrapper(); 768 deleteLineBoxWrapper();
783 } 769 }
784 770
785 ensureRareData().m_inlineBoxWrapper = boxWrapper; 771 ensureRareData().m_inlineBoxWrapper = boxWrapper;
786 } 772 }
787 773
788 } // namespace blink 774 } // namespace blink
789 775
790 #endif // RenderBox_h 776 #endif // RenderBox_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698