18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (C) 1999 Antti Koivisto (koivisto@kde.org) 48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is free software; you can redistribute it and/or 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modify it under the terms of the GNU Library General Public 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * License as published by the Free Software Foundation; either 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * version 2 of the License, or (at your option) any later version. 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is distributed in the hope that it will be useful, 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * but WITHOUT ANY WARRANTY; without even the implied warranty of 138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Library General Public License for more details. 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * You should have received a copy of the GNU Library General Public License 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * along with this library; see the file COPYING.LIB. If not, write to 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Boston, MA 02110-1301, USA. 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef RenderBox_h 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define RenderBox_h 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 268f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian#include "RenderBoxModelObject.h" 27231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "RenderOverflow.h" 28635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project#include "ScrollTypes.h" 298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore { 318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochstruct PaintInfo; 3365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 34bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsenenum LogicalWidthType { LogicalWidth, MinLogicalWidth, MaxLogicalWidth }; 358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 362bde8e466a4451c7319e3a072d118917957d6554Steve Blockenum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayScrollbarSize }; 372bde8e466a4451c7319e3a072d118917957d6554Steve Block 388f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qianclass RenderBox : public RenderBoxModelObject { 398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic: 408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project RenderBox(Node*); 418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual ~RenderBox(); 428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 438f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian // Use this with caution! No type checking is done! 448f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian RenderBox* firstChildBox() const; 458f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian RenderBox* lastChildBox() const; 468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 47635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int x() const { return m_frameRect.x(); } 48635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int y() const { return m_frameRect.y(); } 498f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian int width() const { return m_frameRect.width(); } 508f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian int height() const { return m_frameRect.height(); } 51bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 52635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void setX(int x) { m_frameRect.setX(x); } 53635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void setY(int y) { m_frameRect.setY(y); } 54635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void setWidth(int width) { m_frameRect.setWidth(width); } 55635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void setHeight(int height) { m_frameRect.setHeight(height); } 56bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 57a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int logicalLeft() const { return style()->isHorizontalWritingMode() ? x() : y(); } 5828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu int logicalRight() const { return logicalLeft() + logicalWidth(); } 59a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int logicalTop() const { return style()->isHorizontalWritingMode() ? y() : x(); } 6028040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu int logicalBottom() const { return logicalTop() + logicalHeight(); } 61a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); } 62a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); } 6328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu 64bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setLogicalLeft(int left) 65bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen { 66a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (style()->isHorizontalWritingMode()) 67bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setX(left); 68bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen else 69bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setY(left); 70bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen } 71bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setLogicalTop(int top) 72bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen { 73a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (style()->isHorizontalWritingMode()) 74bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setY(top); 75bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen else 76bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setX(top); 77bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen } 78bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setLogicalWidth(int size) 79bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen { 80a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (style()->isHorizontalWritingMode()) 81bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setWidth(size); 82bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen else 83bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setHeight(size); 84bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen } 85bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setLogicalHeight(int size) 86bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen { 87a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (style()->isHorizontalWritingMode()) 88bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setHeight(size); 89bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen else 90bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setWidth(size); 91bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen } 92bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setLogicalLocation(int left, int top) 93bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen { 94a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (style()->isHorizontalWritingMode()) 95bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setLocation(left, top); 96bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen else 97bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen setLocation(top, left); 98bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen } 99bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 100635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project IntPoint location() const { return m_frameRect.location(); } 1016c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen IntSize locationOffset() const { return IntSize(x(), y()); } 1028f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian IntSize size() const { return m_frameRect.size(); } 103635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 104635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void setLocation(const IntPoint& location) { m_frameRect.setLocation(location); } 105635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void setLocation(int x, int y) { setLocation(IntPoint(x, y)); } 106635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 107635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void setSize(const IntSize& size) { m_frameRect.setSize(size); } 108635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void move(int dx, int dy) { m_frameRect.move(dx, dy); } 109635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 1108f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian IntRect frameRect() const { return m_frameRect; } 111635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void setFrameRect(const IntRect& rect) { m_frameRect = rect; } 112635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 113635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project IntRect borderBoxRect() const { return IntRect(0, 0, width(), height()); } 1148f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual IntRect borderBoundingBox() const { return borderBoxRect(); } 115f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 116635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // The content area of the box (excludes padding and border). 117635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project IntRect contentBoxRect() const { return IntRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); } 118635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // The content box in absolute coords. Ignores transforms. 119635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project IntRect absoluteContentBox() const; 120635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // The content box converted to absolute coords (taking transforms into account). 121635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project FloatQuad absoluteContentQuad() const; 122635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 123635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // Bounds of the outline box in absolute coords. Respects transforms 124dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/, IntPoint* cachedOffsetToRepaintContainer) const; 125d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty); 126635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 127635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // Use this with caution! No type checking is done! 128635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project RenderBox* previousSiblingBox() const; 129635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project RenderBox* nextSiblingBox() const; 130635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project RenderBox* parentBox() const; 131635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 1322fc2651226baac27029e38c9d6ef883fa32084dbSteve Block // Visual and layout overflow are in the coordinate space of the box. This means that they aren't purely physical directions. 1332fc2651226baac27029e38c9d6ef883fa32084dbSteve Block // For horizontal-tb and vertical-lr they will match physical directions, but for horizontal-bt and vertical-rl, the top/bottom and left/right 1342fc2651226baac27029e38c9d6ef883fa32084dbSteve Block // respectively are flipped when compared to their physical counterparts. For example minX is on the left in vertical-lr, 1352fc2651226baac27029e38c9d6ef883fa32084dbSteve Block // but it is on the right in vertical-rl. 136f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch IntRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); } 1372fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : borderTop(); } 1382fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : borderTop() + clientHeight(); } 1392fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int minXLayoutOverflow() const { return m_overflow ? m_overflow->minXLayoutOverflow() : borderLeft(); } 1402fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int maxXLayoutOverflow() const { return m_overflow ? m_overflow->maxXLayoutOverflow() : borderLeft() + clientWidth(); } 1412fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? minXLayoutOverflow() : minYLayoutOverflow(); } 1422fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? maxXLayoutOverflow() : maxYLayoutOverflow(); } 143231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 144231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block IntRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); } 1452fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int minYVisualOverflow() const { return m_overflow? m_overflow->minYVisualOverflow() : 0; } 1462fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int maxYVisualOverflow() const { return m_overflow ? m_overflow->maxYVisualOverflow() : height(); } 1472fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int minXVisualOverflow() const { return m_overflow ? m_overflow->minXVisualOverflow() : 0; } 1482fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int maxXVisualOverflow() const { return m_overflow ? m_overflow->maxXVisualOverflow() : width(); } 1492fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? minXVisualOverflow() : minYVisualOverflow(); } 1502fc2651226baac27029e38c9d6ef883fa32084dbSteve Block int logicalRightVisualOverflow() const { return style()->isHorizontalWritingMode() ? maxXVisualOverflow() : maxYVisualOverflow(); } 151a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 152231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block void addLayoutOverflow(const IntRect&); 153231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block void addVisualOverflow(const IntRect&); 154231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 155231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block void addShadowOverflow(); 156231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block void addOverflowFromChild(RenderBox* child) { addOverflowFromChild(child, IntSize(child->x(), child->y())); } 157231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block void addOverflowFromChild(RenderBox* child, const IntSize& delta); 158231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block void clearLayoutOverflow(); 159f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 160f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch void updateLayerTransform(); 161635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 16228040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu void blockDirectionOverflow(bool isLineHorizontal, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow, 163e14391e94c850b8bd03680c23b38978db68687a8John Reck int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow); 164e14391e94c850b8bd03680c23b38978db68687a8John Reck 165635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); } 166635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); } 167a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int contentLogicalWidth() const { return style()->isHorizontalWritingMode() ? contentWidth() : contentHeight(); } 168a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int contentLogicalHeight() const { return style()->isHorizontalWritingMode() ? contentHeight() : contentWidth(); } 169635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 170635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) 171635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // to return the remaining width on a given line (and the height of a single line). 172635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual int offsetWidth() const { return width(); } 173635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual int offsetHeight() const { return height(); } 174635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 175635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // More IE extensions. clientWidth and clientHeight represent the interior of an object 176635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth. 177635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int clientLeft() const { return borderLeft(); } 178635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int clientTop() const { return borderTop(); } 179635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int clientWidth() const; 180635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int clientHeight() const; 18181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); } 18281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); } 18381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); } 184f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch IntRect clientBoxRect() const { return IntRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); } 185635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 186635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the 187635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // object has overflow:hidden/scroll/auto specified and also has overflow. 188635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // scrollLeft/Top return the current scroll position. These methods are virtual so that objects like 189635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // textareas can scroll shadow content (but pretend that they are the objects that are 190635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // scrolling). 191635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual int scrollLeft() const; 192635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual int scrollTop() const; 193635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual int scrollWidth() const; 194635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual int scrollHeight() const; 195635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual void setScrollLeft(int); 196635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual void setScrollTop(int); 197635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 1988f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual int marginTop() const { return m_marginTop; } 1998f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual int marginBottom() const { return m_marginBottom; } 2008f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual int marginLeft() const { return m_marginLeft; } 2018f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual int marginRight() const { return m_marginRight; } 202a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch void setMarginTop(int margin) { m_marginTop = margin; } 203a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch void setMarginBottom(int margin) { m_marginBottom = margin; } 204a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch void setMarginLeft(int margin) { m_marginLeft = margin; } 205a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch void setMarginRight(int margin) { m_marginRight = margin; } 206bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual int marginBefore() const; 207bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual int marginAfter() const; 208bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual int marginStart() const; 209bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual int marginEnd() const; 210bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setMarginStart(int); 211bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setMarginEnd(int); 212bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setMarginBefore(int); 213bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void setMarginAfter(int); 214a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 2158f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian // The following five functions are used to implement collapsing margins. 216635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // All objects know their maximal positive and negative margins. The 217635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|. 218635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // For a non-collapsing box, such as a leaf element, this formula will simply return 219bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // the margin of the element. Blocks override the maxMarginBefore and maxMarginAfter 220635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // methods. 221bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen enum MarginSign { PositiveMargin, NegativeMargin }; 222635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual bool isSelfCollapsingBlock() const { return false; } 223a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual int collapsedMarginBefore() const { return marginBefore(); } 224a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual int collapsedMarginAfter() const { return marginAfter(); } 225635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 2265f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); 2275f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian virtual void absoluteQuads(Vector<FloatQuad>&); 228635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 229635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project IntRect reflectionBox() const; 230635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int reflectionOffset() const; 231635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // Given a rect in the object's coordinate space, returns the corresponding rect in the reflection. 232635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project IntRect reflectedRect(const IntRect&) const; 233635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 2348f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual void layout(); 2358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void paint(PaintInfo&, int tx, int ty); 2368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); 2378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void destroy(); 2398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 240bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual int minPreferredLogicalWidth() const; 241bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual int maxPreferredLogicalWidth() const; 2428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2438f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian int overrideSize() const; 2448f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian int overrideWidth() const; 2458f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian int overrideHeight() const; 2468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void setOverrideSize(int); 2478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 248692e5dbf12901edacf14812a6fae25462920af42Steve Block virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const; 249635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 250bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int computeBorderBoxLogicalWidth(int width) const; 251bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int computeBorderBoxLogicalHeight(int height) const; 252bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int computeContentBoxLogicalWidth(int width) const; 253bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int computeContentBoxLogicalHeight(int height) const; 2548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 255635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the box in which the border paints if border-fit is set. 2568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 257bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // Resolve auto margins in the inline direction of the containing block so that objects can be pushed to the start, middle or end 258bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // of the containing block. 259bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void computeInlineDirectionMargins(RenderBlock* containingBlock, int containerWidth, int childWidth); 260bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 261bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // Used to resolve margins in the containing block's block-flow direction. 262bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void computeBlockDirectionMargins(RenderBlock* containingBlock); 2638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2648f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void positionLineBox(InlineBox*); 2658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2668f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual InlineBox* createInlineBox(); 2678f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void dirtyLineBoxes(bool fullLayout); 2688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // For inline replaced elements, this function returns the inline box that owns us. Enables 2708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // the replaced RenderObject to quickly determine what line it is contained on and to easily 2718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // iterate over structures on the line. 2728f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; } 2738f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void setInlineBoxWrapper(InlineBox* boxWrapper) { m_inlineBoxWrapper = boxWrapper; } 2748f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void deleteLineBoxWrapper(); 2758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2768f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); 2778f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false); 2788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void repaintDuringLayoutIfMoved(const IntRect&); 2808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 281bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual int containingBlockLogicalWidthForContent() const; 282bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int perpendicularContainingBlockLogicalHeight() const; 283bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 284bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual void computeLogicalWidth(); 285bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual void computeLogicalHeight(); 2868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 287a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch bool stretchesToViewport() const 2888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project { 289e14391e94c850b8bd03680c23b38978db68687a8John Reck return document()->inQuirksMode() && style()->logicalHeight().isAuto() && !isFloatingOrPositioned() && (isRoot() || isBody()); 2908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 2918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual IntSize intrinsicSize() const { return IntSize(); } 293a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int intrinsicLogicalWidth() const { return style()->isHorizontalWritingMode() ? intrinsicSize().width() : intrinsicSize().height(); } 294a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int intrinsicLogicalHeight() const { return style()->isHorizontalWritingMode() ? intrinsicSize().height() : intrinsicSize().width(); } 2958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // Whether or not the element shrinks to its intrinsic width (rather than filling the width 2978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // of a containing block). HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this. 298bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen bool sizesToIntrinsicLogicalWidth(LogicalWidthType) const; 299bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual bool stretchesToMinIntrinsicLogicalWidth() const { return false; } 3008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 301bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int computeLogicalWidthUsing(LogicalWidthType, int availableLogicalWidth); 302bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int computeLogicalHeightUsing(const Length& height); 303a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int computeReplacedLogicalWidthUsing(Length width) const; 304a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int computeReplacedLogicalHeightUsing(Length height) const; 3058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 306a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const; 307a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual int computeReplacedLogicalHeight() const; 3088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 309bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int computePercentageLogicalHeight(const Length& height); 3108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 311635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.) 312bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual int availableLogicalWidth() const { return contentLogicalWidth(); } 313bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int availableLogicalHeight() const; 314bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int availableLogicalHeightUsing(const Length&) const; 315bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 316bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // There are a few cases where we need to refer specifically to the available physical width and available physical height. 317bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // Relative positioning is one of those cases, since left/top offsets are physical. 318a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int availableWidth() const { return style()->isHorizontalWritingMode() ? availableLogicalWidth() : availableLogicalHeight(); } 319a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int availableHeight() const { return style()->isHorizontalWritingMode() ? availableLogicalHeight() : availableLogicalWidth(); } 3208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 321635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual int verticalScrollbarWidth() const; 322635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int horizontalScrollbarHeight() const; 323a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int scrollbarLogicalHeight() const { return style()->isHorizontalWritingMode() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); } 3245ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0); 325f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0); 326231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bool canBeScrolledAndHasScrollableArea() const; 327635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual bool canBeProgramaticallyScrolled(bool) const; 328635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual void autoscroll(); 329635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual void stopAutoscroll() { } 330635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual void panScroll(const IntPoint&); 331635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); } 332635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } 333635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); } 334635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); } 335635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); } 336635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 337635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0); 3388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3392bde8e466a4451c7319e3a072d118917957d6554Steve Block virtual IntRect overflowClipRect(int tx, int ty, OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize); 3408f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian IntRect clipRect(int tx, int ty); 3418f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual bool hasControlClip() const { return false; } 3428f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual IntRect controlClipRect(int /*tx*/, int /*ty*/) const { return IntRect(); } 3438f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian bool pushContentsClip(PaintInfo&, int tx, int ty); 3448f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void popContentsClip(PaintInfo&, PaintPhase originalPhase, int tx, int ty); 3458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3468f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual void paintObject(PaintInfo&, int /*tx*/, int /*ty*/) { ASSERT_NOT_REACHED(); } 3478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); 3480bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch virtual void paintMask(PaintInfo&, int tx, int ty); 349635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); 3508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 351dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Called when a positioned object moves but doesn't necessarily change size. A simplified layout is attempted 352dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // that just updates the object's position. If the size does change, the object remains dirty. 3532daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch bool tryLayoutDoingPositionedMovementOnly() 3548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project { 355635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int oldWidth = width(); 356bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen computeLogicalWidth(); 3578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // If we shrink to fit our width may have changed, so we still need full layout. 358635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (oldWidth != width()) 3592daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return false; 360bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen computeLogicalHeight(); 3612daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return true; 3628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 3638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 364635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project IntRect maskClipRect(); 3658f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 3668f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual VisiblePosition positionForPoint(const IntPoint&); 3678f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 3688f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void removeFloatingOrPositionedChildFromBlockLists(); 3698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 370f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch RenderLayer* enclosingFloatPaintingLayer() const; 371f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 3728f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual int firstLineBoxBaseline() const { return -1; } 3738f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual int lastLineBoxBaseline() const { return -1; } 3748f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 3758f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian bool shrinkToAvoidFloats() const; 3768f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual bool avoidsFloats() const; 3778f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 378a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual void markForPaginationRelayoutIfNeeded() { } 379a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 380a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch bool isWritingModeRoot() const { return !parent() || parent()->style()->writingMode() != style()->writingMode(); } 3818de7ac488df2f39f82e56811541f4847b3f2e952Steve Block 382a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; 3836b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; 384e1a0cd8247467a70fed9f6099fc9c65ec35ae23eKristian Monsen 385e14391e94c850b8bd03680c23b38978db68687a8John Reck enum FlippingAdjustment { ChildToParentFlippingAdjustment, ParentToChildFlippingAdjustment }; 3866b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner IntPoint flipForWritingMode(const RenderBox* child, const IntPoint&, FlippingAdjustment) const; 3876b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner int flipForWritingMode(int position) const; // The offset is in the block direction (y for horizontal writing modes, x for vertical writing modes). 3886b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner IntPoint flipForWritingMode(const IntPoint&) const; 3892fc2651226baac27029e38c9d6ef883fa32084dbSteve Block IntPoint flipForWritingModeIncludingColumns(const IntPoint&) const; 3906b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner IntSize flipForWritingMode(const IntSize&) const; 3916b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner void flipForWritingMode(IntRect&) const; 39281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch FloatPoint flipForWritingMode(const FloatPoint&) const; 39381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch void flipForWritingMode(FloatRect&) const; 3946b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner IntSize locationOffsetIncludingFlipping() const; 3954326279fef480892cd059ad1c738f1320601d33fJohn Reck 396f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch IntRect logicalVisualOverflowRectForPropagation(RenderStyle*) const; 397f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch IntRect visualOverflowRectForPropagation(RenderStyle*) const; 398f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch IntRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const; 399f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch IntRect layoutOverflowRectForPropagation(RenderStyle*) const; 400e7bbc0900fd93114f04d2690ce8eab67b784b8c8Ben Murdoch 401bbcce278be9be6a85f47928c38a74c8d36a13a85Ben Murdoch RenderOverflow* hasRenderOverflow() const { return m_overflow.get(); } 402bbcce278be9be6a85f47928c38a74c8d36a13a85Ben Murdoch 403e7bbc0900fd93114f04d2690ce8eab67b784b8c8Ben Murdoch#ifdef ANDROID_LAYOUT 404e7bbc0900fd93114f04d2690ce8eab67b784b8c8Ben Murdoch int getVisibleWidth() const { return m_visibleWidth; } 405e7bbc0900fd93114f04d2690ce8eab67b784b8c8Ben Murdoch#endif 40623e9dd818a876304304944c844be7625f63383c4Shimeng (Simon) Wang 4078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprotected: 4088f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); 4098f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 4108f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual void updateBoxModelInfoFromStyle(); 4118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 412d0825bca7fe65beaee391d30da42e937db621564Steve Block void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int width, int height, CompositeOperator op, RenderObject* backgroundObject); 413d0825bca7fe65beaee391d30da42e937db621564Steve Block void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int width, int height, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0); 4148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 41521939df44de1705786c545cd1bf519d47250322dBen Murdoch void paintBoxDecorationsWithSize(PaintInfo&, int tx, int ty, int width, int height); 4160bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch void paintMaskImages(const PaintInfo&, int tx, int ty, int width, int height); 4178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if PLATFORM(MAC) 4198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText); 4208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif 4218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 422bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void computePositionedLogicalWidth(); 4238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 424bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } 4258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 426cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&) const; 4278f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; 4288f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 4292bde8e466a4451c7319e3a072d118917957d6554Steve Block void paintRootBoxFillLayers(const PaintInfo&); 4302bde8e466a4451c7319e3a072d118917957d6554Steve Block 4318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprivate: 432ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch bool includeVerticalScrollbarSize() const; 433ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch bool includeHorizontalScrollbarSize() const; 434635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 4358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // Returns true if we did a full repaint 4368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layers, bool drawingBackground); 4378f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 43881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode = true) const; 43981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int containingBlockLogicalHeightForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode = true) const; 4408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 441bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void computePositionedLogicalHeight(); 44281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch void computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, 44381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int containerLogicalWidth, int bordersPlusPadding, 44481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight, 44581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int& logicalWidthValue, int& marginLogicalLeftValue, int& marginLogicalRightValue, int& logicalLeftPos); 44681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch void computePositionedLogicalHeightUsing(Length logicalHeight, const RenderBoxModelObject* containerBlock, 44781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int containerLogicalHeight, int bordersPlusPadding, 44881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom, 44981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch int& logicalHeightValue, int& marginLogicalTopValue, int& marginLogicalBottomValue, int& logicalTopPos); 4508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 451bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void computePositionedLogicalHeightReplaced(); 452bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void computePositionedLogicalWidthReplaced(); 4538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // This function calculates the minimum and maximum preferred widths for an object. 4558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // These values are used in shrink-to-fit layout systems. 4568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // These include tables, positioned objects, floats and flexible boxes. 457bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirty(false); } 458bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 459635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Projectprivate: 460635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). 461635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project IntRect m_frameRect; 462635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 4638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprotected: 4648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifdef ANDROID_LAYOUT 46623e9dd818a876304304944c844be7625f63383c4Shimeng (Simon) Wang void setVisibleWidth(int newWidth); 46723e9dd818a876304304944c844be7625f63383c4Shimeng (Simon) Wang bool checkAndSetRelayoutChildren(bool* relayoutChildren); 4688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif 4698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int m_marginLeft; 4718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int m_marginRight; 4728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int m_marginTop; 4738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int m_marginBottom; 4748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 475bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // The preferred logical width of the element if it were to break its lines at every possible opportunity. 476bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int m_minPreferredLogicalWidth; 4778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 478bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // The preferred logical width of the element if it never breaks any lines at all. 479bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int m_maxPreferredLogicalWidth; 4808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // For inline replaced elements, the inline box that owns us. 4828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project InlineBox* m_inlineBoxWrapper; 4838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 484231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Our overflow information. 485231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block OwnPtr<RenderOverflow> m_overflow; 486231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 4878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprivate: 4888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // Used to store state between styleWillChange and styleDidChange 4898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project static bool s_hadOverflowClip; 49023e9dd818a876304304944c844be7625f63383c4Shimeng (Simon) Wang 49123e9dd818a876304304944c844be7625f63383c4Shimeng (Simon) Wang#ifdef ANDROID_LAYOUT 49223e9dd818a876304304944c844be7625f63383c4Shimeng (Simon) Wang int m_visibleWidth; 49323e9dd818a876304304944c844be7625f63383c4Shimeng (Simon) Wang bool m_isVisibleWidthChangedBeforeLayout; 49423e9dd818a876304304944c844be7625f63383c4Shimeng (Simon) Wang#endif 4958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}; 4968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4970bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochinline RenderBox* toRenderBox(RenderObject* object) 498635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project{ 4990bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch ASSERT(!object || object->isBox()); 5000bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return static_cast<RenderBox*>(object); 501635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project} 502635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 5030bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochinline const RenderBox* toRenderBox(const RenderObject* object) 504635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project{ 5050bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch ASSERT(!object || object->isBox()); 5060bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return static_cast<const RenderBox*>(object); 507635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project} 508635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 5098f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian// This will catch anyone doing an unnecessary cast. 5108f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qianvoid toRenderBox(const RenderBox*); 5118f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 512635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Projectinline RenderBox* RenderBox::previousSiblingBox() const 513635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project{ 514635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return toRenderBox(previousSibling()); 515635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project} 516635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 517635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Projectinline RenderBox* RenderBox::nextSiblingBox() const 518635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project{ 519635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return toRenderBox(nextSibling()); 520635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project} 521635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 522635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Projectinline RenderBox* RenderBox::parentBox() const 523635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project{ 524635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return toRenderBox(parent()); 525635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project} 526635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 5278f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qianinline RenderBox* RenderBox::firstChildBox() const 5288f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian{ 5298f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian return toRenderBox(firstChild()); 5308f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian} 5318f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 5328f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qianinline RenderBox* RenderBox::lastChildBox() const 5338f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian{ 5348f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian return toRenderBox(lastChild()); 5358f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian} 5368f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 5378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} // namespace WebCore 5388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif // RenderBox_h 540