#include "config.h"
#include "RenderObject.h"
-#include "AXObjectCache.h"
+#include "AXObjectCache.h"
#include "AffineTransform.h"
#include "CachedImage.h"
#include "Chrome.h"
#include "CounterNode.h"
#include "CounterResetNode.h"
-#include "TextResourceDecoder.h"
#include "Document.h"
#include "Element.h"
#include "EventNames.h"
#include "GraphicsContext.h"
#include "HTMLNames.h"
#include "HTMLOListElement.h"
-#include "KURL.h"
#include "HitTestRequest.h"
#include "HitTestResult.h"
+#include "KURL.h"
#include "Page.h"
#include "Position.h"
#include "RenderArena.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "Screen.h"
+#include "TextResourceDecoder.h"
#include "TextStream.h"
#include "cssstyleselector.h"
#include <algorithm>
using namespace HTMLNames;
#ifndef NDEBUG
-static void *baseOfRenderObjectBeingDeleted;
+static void* baseOfRenderObjectBeingDeleted;
#endif
typedef HashMap<String, CounterNode*> CounterNodeMap;
void RenderObject::operator delete(void* ptr, size_t sz)
{
ASSERT(baseOfRenderObjectBeingDeleted == ptr);
-
+
// Stash size where destroy can find it.
*(size_t *)ptr = sz;
}
-RenderObject *RenderObject::createObject(Node* node, RenderStyle* style)
+RenderObject* RenderObject::createObject(Node* node, RenderStyle* style)
{
- RenderObject *o = 0;
+ RenderObject* o = 0;
RenderArena* arena = node->document()->renderArena();
-
- if (ContentData *contentData = style->contentData()) {
- RenderImage *contentImage = new (arena) RenderImage(node);
+
+ if (ContentData* contentData = style->contentData()) {
+ RenderImage* contentImage = new (arena) RenderImage(node);
if (contentImage) {
contentImage->setStyle(style);
contentImage->setContentObject(contentData->contentObject());
return contentImage;
}
- switch(style->display())
- {
- case NONE:
- break;
- case INLINE:
- o = new (arena) RenderInline(node);
- break;
- case BLOCK:
- o = new (arena) RenderBlock(node);
- break;
- case INLINE_BLOCK:
- o = new (arena) RenderBlock(node);
- break;
- case LIST_ITEM:
- o = new (arena) RenderListItem(node);
- break;
- case RUN_IN:
- case COMPACT:
- o = new (arena) RenderBlock(node);
- break;
- case TABLE:
- case INLINE_TABLE:
- o = new (arena) RenderTable(node);
- break;
- case TABLE_ROW_GROUP:
- case TABLE_HEADER_GROUP:
- case TABLE_FOOTER_GROUP:
- o = new (arena) RenderTableSection(node);
- break;
- case TABLE_ROW:
- o = new (arena) RenderTableRow(node);
- break;
- case TABLE_COLUMN_GROUP:
- case TABLE_COLUMN:
- o = new (arena) RenderTableCol(node);
- break;
- case TABLE_CELL:
- o = new (arena) RenderTableCell(node);
- break;
- case TABLE_CAPTION:
- o = new (arena) RenderBlock(node);
- break;
- case BOX:
- case INLINE_BOX:
- o = new (arena) RenderFlexibleBox(node);
- break;
+ switch (style->display()) {
+ case NONE:
+ break;
+ case INLINE:
+ o = new (arena) RenderInline(node);
+ break;
+ case BLOCK:
+ o = new (arena) RenderBlock(node);
+ break;
+ case INLINE_BLOCK:
+ o = new (arena) RenderBlock(node);
+ break;
+ case LIST_ITEM:
+ o = new (arena) RenderListItem(node);
+ break;
+ case RUN_IN:
+ case COMPACT:
+ o = new (arena) RenderBlock(node);
+ break;
+ case TABLE:
+ case INLINE_TABLE:
+ o = new (arena) RenderTable(node);
+ break;
+ case TABLE_ROW_GROUP:
+ case TABLE_HEADER_GROUP:
+ case TABLE_FOOTER_GROUP:
+ o = new (arena) RenderTableSection(node);
+ break;
+ case TABLE_ROW:
+ o = new (arena) RenderTableRow(node);
+ break;
+ case TABLE_COLUMN_GROUP:
+ case TABLE_COLUMN:
+ o = new (arena) RenderTableCol(node);
+ break;
+ case TABLE_CELL:
+ o = new (arena) RenderTableCell(node);
+ break;
+ case TABLE_CAPTION:
+ o = new (arena) RenderBlock(node);
+ break;
+ case BOX:
+ case INLINE_BOX:
+ o = new (arena) RenderFlexibleBox(node);
+ break;
}
return o;
}
#ifndef NDEBUG
-struct RenderObjectCounter {
- static int count;
- ~RenderObjectCounter() { if (count != 0) fprintf(stderr, "LEAK: %d RenderObject\n", count); }
+struct RenderObjectCounter {
+ static int count;
+ ~RenderObjectCounter() { if (count != 0) fprintf(stderr, "LEAK: %d RenderObject\n", count); }
};
int RenderObjectCounter::count;
static RenderObjectCounter renderObjectCounter;
#endif
RenderObject::RenderObject(Node* node)
- : CachedResourceClient(),
-m_style( 0 ),
-m_node( node ),
-m_parent( 0 ),
-m_previous( 0 ),
-m_next( 0 ),
-m_verticalPosition( PositionUndefined ),
-m_needsLayout( false ),
-m_normalChildNeedsLayout( false ),
-m_posChildNeedsLayout( false ),
-m_minMaxKnown( false ),
-m_floating( false ),
-
-m_positioned( false ),
-m_relPositioned( false ),
-m_paintBackground( false ),
-
-m_isAnonymous( node == node->document() ),
-m_recalcMinMax( false ),
-m_isText( false ),
-m_inline( true ),
-
-m_replaced( false ),
-m_isDragging( false ),
-m_hasOverflowClip(false),
-m_hasCounterNodeMap(false)
+ : CachedResourceClient()
+ , m_style(0)
+ , m_node(node)
+ , m_parent(0)
+ , m_previous(0)
+ , m_next(0)
+ , m_verticalPosition(PositionUndefined)
+ , m_needsLayout(false)
+ , m_normalChildNeedsLayout(false)
+ , m_posChildNeedsLayout(false)
+ , m_minMaxKnown(false)
+ , m_floating(false)
+ , m_positioned(false)
+ , m_relPositioned(false)
+ , m_paintBackground(false)
+ , m_isAnonymous(node == node->document())
+ , m_recalcMinMax(false)
+ , m_isText(false)
+ , m_inline(true)
+ , m_replaced(false)
+ , m_isDragging(false)
+ , m_hasOverflowClip(false)
+ , m_hasCounterNodeMap(false)
{
#ifndef NDEBUG
++RenderObjectCounter::count;
#endif
}
-bool RenderObject::isDescendantOf(const RenderObject *obj) const
+bool RenderObject::isDescendantOf(const RenderObject* obj) const
{
- for (const RenderObject *r = this; r; r = r->m_parent)
+ for (const RenderObject* r = this; r; r = r->m_parent) {
if (r == obj)
return true;
+ }
return false;
}
bool RenderObject::isRoot() const
{
- return element() && element()->renderer() == this &&
- element()->document()->documentElement() == element();
+ return element() && element()->renderer() == this && element()->document()->documentElement() == element();
}
bool RenderObject::isBody() const
return false;
}
-void RenderObject::addChild(RenderObject* , RenderObject *)
+void RenderObject::addChild(RenderObject*, RenderObject*)
{
- ASSERT(0);
+ ASSERT_NOT_REACHED();
}
-RenderObject* RenderObject::removeChildNode(RenderObject* )
+RenderObject* RenderObject::removeChildNode(RenderObject*)
{
- ASSERT(0);
+ ASSERT_NOT_REACHED();
return 0;
}
-void RenderObject::removeChild(RenderObject* )
+void RenderObject::removeChild(RenderObject*)
{
- ASSERT(0);
+ ASSERT_NOT_REACHED();
}
void RenderObject::appendChildNode(RenderObject*)
{
- ASSERT(0);
+ ASSERT_NOT_REACHED();
}
void RenderObject::insertChildNode(RenderObject*, RenderObject*)
{
- ASSERT(0);
+ ASSERT_NOT_REACHED();
}
-RenderObject *RenderObject::nextInPreOrder() const
+RenderObject* RenderObject::nextInPreOrder() const
{
if (RenderObject* o = firstChild())
return o;
-
+
return nextInPreOrderAfterChildren();
}
if (o)
o = o->nextSibling();
}
+
return o;
}
-RenderObject *RenderObject::previousInPreOrder() const
+RenderObject* RenderObject::previousInPreOrder() const
{
if (RenderObject* o = previousSibling()) {
while (o->lastChild())
bool RenderObject::isEditable() const
{
- RenderText *textRenderer = 0;
- if (isText()) {
- textRenderer = static_cast<RenderText *>(const_cast<RenderObject *>(this));
- }
+ RenderText* textRenderer = 0;
+ if (isText())
+ textRenderer = static_cast<RenderText*>(const_cast<RenderObject*>(this));
- return style()->visibility() == VISIBLE &&
+ return style()->visibility() == VISIBLE &&
element() && element()->isContentEditable() &&
- ((isBlockFlow() && !firstChild()) ||
- isReplaced() ||
- isBR() ||
+ ((isBlockFlow() && !firstChild()) ||
+ isReplaced() ||
+ isBR() ||
(textRenderer && textRenderer->firstTextBox()));
}
-RenderObject *RenderObject::nextEditable() const
+RenderObject* RenderObject::nextEditable() const
{
- RenderObject *r = const_cast<RenderObject *>(this);
- RenderObject *n = firstChild();
+ RenderObject* r = const_cast<RenderObject*>(this);
+ RenderObject* n = firstChild();
if (n) {
- while (n) {
- r = n;
- n = n->firstChild();
+ while (n) {
+ r = n;
+ n = n->firstChild();
}
if (r->isEditable())
return r;
- else
+ else
return r->nextEditable();
}
n = r->nextSibling();
if (n) {
r = n;
- while (n) {
- r = n;
- n = n->firstChild();
+ while (n) {
+ r = n;
+ n = n->firstChild();
}
if (r->isEditable())
return r;
- else
+ else
return r->nextEditable();
}
n = r->parent();
if (n) {
r = n;
n = r->firstChild();
- while (n) {
- r = n;
- n = n->firstChild();
+ while (n) {
+ r = n;
+ n = n->firstChild();
}
if (r->isEditable())
return r;
- else
+ else
return r->nextEditable();
}
n = r->parent();
}
+
return 0;
}
-RenderObject *RenderObject::previousEditable() const
+RenderObject* RenderObject::previousEditable() const
{
- RenderObject *r = const_cast<RenderObject *>(this);
- RenderObject *n = firstChild();
+ RenderObject* r = const_cast<RenderObject*>(this);
+ RenderObject* n = firstChild();
if (n) {
- while (n) {
- r = n;
- n = n->lastChild();
+ while (n) {
+ r = n;
+ n = n->lastChild();
}
if (r->isEditable())
return r;
- else
+ else
return r->previousEditable();
}
n = r->previousSibling();
if (n) {
r = n;
- while (n) {
- r = n;
- n = n->lastChild();
+ while (n) {
+ r = n;
+ n = n->lastChild();
}
if (r->isEditable())
return r;
- else
+ else
return r->previousEditable();
- }
+ }
n = r->parent();
while (n) {
r = n;
if (n) {
r = n;
n = r->lastChild();
- while (n) {
- r = n;
- n = n->lastChild();
+ while (n) {
+ r = n;
+ n = n->lastChild();
}
if (r->isEditable())
return r;
- else
+ else
return r->previousEditable();
}
n = r->parent();
}
+
return 0;
-}
+}
-RenderObject *RenderObject::firstLeafChild() const
+RenderObject* RenderObject::firstLeafChild() const
{
- RenderObject *r = firstChild();
+ RenderObject* r = firstChild();
while (r) {
- RenderObject *n = 0;
+ RenderObject* n = 0;
n = r->firstChild();
if (!n)
break;
return r;
}
-RenderObject *RenderObject::lastLeafChild() const
+RenderObject* RenderObject::lastLeafChild() const
{
- RenderObject *r = lastChild();
+ RenderObject* r = lastChild();
while (r) {
- RenderObject *n = 0;
+ RenderObject* n = 0;
n = r->lastChild();
if (!n)
break;
{
if (!parentLayer)
return;
-
+
RenderObject* object = newObject;
RenderLayer* beforeChild = 0;
WebCore::addLayers(this, parentLayer, object, beforeChild);
{
if (!parentLayer)
return;
-
+
if (layer()) {
parentLayer->removeChild(layer());
return;
{
if (!newParent)
return;
-
+
if (layer()) {
if (oldParent)
oldParent->removeChild(layer());
// Error check the parent layer passed in. If it's null, we can't find anything.
if (!parentLayer)
return 0;
-
+
// Step 1: If our layer is a child of the desired parent, then return our layer.
RenderLayer* ourLayer = layer();
if (ourLayer && ourLayer->parent() == parentLayer)
return ourLayer;
-
+
// Step 2: If we don't have a layer, or our layer is the desired parent, then descend
// into our siblings trying to find the next layer whose parent is the desired parent.
if (!ourLayer || ourLayer == parentLayer) {
return nextLayer;
}
}
-
+
// Step 3: If our layer is the desired parent layer, then we're finished. We didn't
// find anything.
if (parentLayer == ourLayer)
return 0;
-
+
// Step 4: If |checkParent| is set, climb up to our parent and check its siblings that
// follow us to see if we can locate a layer.
if (checkParent && parent())
return parent()->findNextLayer(parentLayer, this, true);
-
+
return 0;
}
-
+
RenderLayer* RenderObject::enclosingLayer() const
{
const RenderObject* curr = this;
while (curr) {
- RenderLayer *layer = curr->layer();
+ RenderLayer* layer = curr->layer();
if (layer)
return layer;
curr = curr->parent();
}
void RenderObject::updateFirstLetter()
-{}
+{
+}
int RenderObject::offsetLeft() const
{
}
return y;
}
-
+
RenderObject* RenderObject::offsetParent() const
{
// FIXME: It feels like this function could almost be written using containing blocks.
if (isBody())
return 0;
+
bool skipTables = isPositioned() || isRelPositioned();
RenderObject* curr = parent();
- while (curr && (!curr->element() ||
- (!curr->isPositioned() && !curr->isRelPositioned() &&
+ while (curr && (!curr->element() ||
+ (!curr->isPositioned() && !curr->isRelPositioned() &&
!(!style()->htmlHacks() && skipTables ? curr->isRoot() : curr->isBody())))) {
if (!skipTables && curr->element() && (curr->isTableCell() || curr->isTable()))
break;
bool RenderObject::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
{
- RenderLayer *l = layer();
+ RenderLayer* l = layer();
if (l && l->scroll(direction, granularity, multiplier))
return true;
- RenderBlock *b = containingBlock();
+ RenderBlock* b = containingBlock();
if (b && !b->isRenderView())
return b->scroll(direction, granularity, multiplier);
return false;
bool RenderObject::hasStaticX() const
{
- return (style()->left().isAuto() && style()->right().isAuto()) ||
- style()->left().isStatic() ||
- style()->right().isStatic();
+ return (style()->left().isAuto() && style()->right().isAuto()) || style()->left().isStatic() || style()->right().isStatic();
}
bool RenderObject::hasStaticY() const
{
}
-void RenderObject::setNeedsLayout(bool b, bool markParents)
+void RenderObject::setNeedsLayout(bool b, bool markParents)
{
bool alreadyNeededLayout = m_needsLayout;
m_needsLayout = b;
if (b) {
if (!alreadyNeededLayout && markParents)
markContainingBlocksForLayout();
- }
- else {
+ } else {
m_posChildNeedsLayout = false;
m_normalChildNeedsLayout = false;
}
if (b) {
if (!alreadyNeededLayout && markParents)
markContainingBlocksForLayout();
- }
- else {
+ } else {
m_posChildNeedsLayout = false;
m_normalChildNeedsLayout = false;
}
void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout)
{
- RenderObject *o = container();
- RenderObject *last = this;
+ RenderObject* o = container();
+ RenderObject* last = this;
while (o) {
if (!last->isText() && (last->style()->position() == FixedPosition || last->style()->position() == AbsolutePosition)) {
RenderBlock* RenderObject::containingBlock() const
{
- if(isTableCell())
- return static_cast<const RenderTableCell *>(this)->table();
+ if (isTableCell())
+ return static_cast<const RenderTableCell*>(this)->table();
if (isRenderView())
return (RenderBlock*)this;
- RenderObject *o = parent();
+ RenderObject* o = parent();
if (!isText() && m_style->position() == FixedPosition) {
while ( o && !o->isRenderView() )
o = o->parent();
- }
- else if (!isText() && m_style->position() == AbsolutePosition) {
+ } else if (!isText() && m_style->position() == AbsolutePosition) {
while (o && (o->style()->position() == StaticPosition || (o->isInline() && !o->isReplaced())) && !o->isRenderView()) {
// For relpositioned inlines, we return the nearest enclosing block. We don't try
// to return the inline itself. This allows us to avoid having a positioned objects
if (!o || !o->isRenderBlock())
return 0; // Probably doesn't happen any more, but leave just in case. -dwh
-
+
return static_cast<RenderBlock*>(o);
}
int RenderObject::containingBlockWidth() const
{
- // ###
+ // FIXME ?
return containingBlock()->contentWidth();
}
int RenderObject::containingBlockHeight() const
{
- // ###
+ // FIXME ?
return containingBlock()->contentHeight();
}
// If we don't have a background/border, then nothing to do.
if (!shouldPaintBackgroundOrBorder())
return false;
-
+
// Ok, let's check the background first.
const BackgroundLayer* bgLayer = style()->backgroundLayers();
+
+ // Nobody will use multiple background layers without wanting fancy positioning.
if (bgLayer->next())
- return true; // Nobody will use multiple background layers without wanting fancy positioning.
-
+ return true;
+
// Make sure we have a valid background image.
CachedImage* bg = bgLayer->backgroundImage();
bool shouldPaintBackgroundImage = bg && bg->canRender();
-
+
// These are always percents or auto.
- if (shouldPaintBackgroundImage &&
- (bgLayer->backgroundXPosition().value() != 0 || bgLayer->backgroundYPosition().value() != 0
- || bgLayer->backgroundSize().width.isPercent() || bgLayer->backgroundSize().height.isPercent()))
- return true; // The background image will shift unpredictably if the size changes.
-
+ if (shouldPaintBackgroundImage &&
+ (bgLayer->backgroundXPosition().value() != 0 || bgLayer->backgroundYPosition().value() != 0 ||
+ bgLayer->backgroundSize().width.isPercent() || bgLayer->backgroundSize().height.isPercent()))
+ // The background image will shift unpredictably if the size changes.
+ return true;
+
// Background is ok. Let's check border.
if (style()->hasBorder()) {
// Border images are not ok.
CachedImage* borderImage = style()->borderImage().image();
bool shouldPaintBorderImage = borderImage && borderImage->canRender();
+
+ // If the image hasn't loaded, we're still using the normal border style.
if (shouldPaintBorderImage && borderImage->isLoaded())
- return true; // If the image hasn't loaded, we're still using the normal border style.
+ return true;
}
return false;
}
-void RenderObject::drawBorderArc(GraphicsContext* p, int x, int y, float thickness, IntSize radius, int angleStart,
- int angleSpan, BorderSide s, Color c, const Color& textColor, EBorderStyle style, bool firstCorner)
+void RenderObject::drawBorderArc(GraphicsContext* graphicsContext, int x, int y, float thickness, IntSize radius,
+ int angleStart, int angleSpan, BorderSide s, Color c, const Color& textColor,
+ EBorderStyle style, bool firstCorner)
{
- if ((style == DOUBLE && ((thickness / 2) < 3)) ||
- ((style == RIDGE || style == GROOVE) && ((thickness / 2) < 2)))
+ if ((style == DOUBLE && thickness / 2 < 3) || ((style == RIDGE || style == GROOVE) && thickness / 2 < 2))
style = SOLID;
-
+
if (!c.isValid()) {
if (style == INSET || style == OUTSET || style == RIDGE || style == GROOVE)
c.setRGB(238, 238, 238);
else
c = textColor;
}
-
+
switch (style) {
case BNONE:
case BHIDDEN:
return;
case DOTTED:
- p->setPen(Pen(c, thickness == 1 ? 0 : (int)thickness, Pen::DotLine));
+ graphicsContext->setPen(Pen(c, thickness == 1 ? 0 : static_cast<int>(thickness), Pen::DotLine));
case DASHED:
- if(style == DASHED)
- p->setPen(Pen(c, thickness == 1 ? 0 : (int)thickness, Pen::DashLine));
-
- if (thickness > 0) {
- if (s == BSBottom || s == BSTop)
- p->drawArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), thickness, angleStart, angleSpan);
- else //We are drawing a left or right border
- p->drawArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), thickness, angleStart, angleSpan);
- }
-
+ if (style == DASHED)
+ graphicsContext->setPen(Pen(c, thickness == 1 ? 0 : static_cast<int>(thickness), Pen::DashLine));
+
+ if (thickness > 0)
+ graphicsContext->drawArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), thickness, angleStart, angleSpan);
+
break;
case DOUBLE: {
- float third = thickness / 3;
- float innerThird = (thickness + 1) / 6;
- int shiftForInner = (int)(innerThird * 2.5);
- p->setPen(Pen::NoPen);
-
+ float third = thickness / 3.0f;
+ float innerThird = (thickness + 1.0f) / 6.0f;
+ int shiftForInner = static_cast<int>(innerThird * 2.5f);
+ graphicsContext->setPen(Pen::NoPen);
+
int outerY = y;
int outerHeight = radius.height() * 2;
int innerX = x + shiftForInner;
outerHeight += 2;
innerHeight += 2;
}
-
- p->drawArc(IntRect(x, outerY, radius.width() * 2, outerHeight), third, angleStart, angleSpan);
- p->drawArc(IntRect(innerX, innerY, innerWidth, innerHeight), (innerThird > 2) ? innerThird - 1 : innerThird,
- angleStart, angleSpan);
+
+ graphicsContext->drawArc(IntRect(x, outerY, radius.width() * 2, outerHeight), third, angleStart, angleSpan);
+ graphicsContext->drawArc(IntRect(innerX, innerY, innerWidth, innerHeight), (innerThird > 2) ? innerThird - 1 : innerThird,
+ angleStart, angleSpan);
break;
}
case GROOVE:
case RIDGE: {
Color c2;
- if ((style == RIDGE && (s == BSTop || s == BSLeft)) ||
- (style == GROOVE && (s == BSBottom || s == BSRight)))
+ if ((style == RIDGE && (s == BSTop || s == BSLeft)) ||
+ (style == GROOVE && (s == BSBottom || s == BSRight)))
c2 = c.dark();
else {
c2 = c;
c = c.dark();
}
- p->setPen(Pen::NoPen);
- p->setFillColor(c.rgb());
- p->drawArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), thickness, angleStart, angleSpan);
-
- float halfThickness = (thickness + 1) / 4;
- int shiftForInner = (int)(halfThickness * 1.5);
- p->setFillColor(c2.rgb());
- p->drawArc(IntRect(x + shiftForInner, y + shiftForInner, (radius.width() - shiftForInner) * 2,
- (radius.height() - shiftForInner) * 2), (halfThickness > 2) ? halfThickness - 1 : halfThickness,
- angleStart, angleSpan);
+ graphicsContext->setPen(Pen::NoPen);
+ graphicsContext->setFillColor(c);
+ graphicsContext->drawArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), thickness, angleStart, angleSpan);
+
+ float halfThickness = (thickness + 1.0f) / 4.0f;
+ int shiftForInner = static_cast<int>(halfThickness * 1.5f);
+ graphicsContext->setFillColor(c2);
+ graphicsContext->drawArc(IntRect(x + shiftForInner, y + shiftForInner, (radius.width() - shiftForInner) * 2,
+ (radius.height() - shiftForInner) * 2), (halfThickness > 2) ? halfThickness - 1 : halfThickness,
+ angleStart, angleSpan);
break;
}
case INSET:
- if(s == BSTop || s == BSLeft)
+ if (s == BSTop || s == BSLeft)
c = c.dark();
case OUTSET:
- if(style == OUTSET && (s == BSBottom || s == BSRight))
+ if (style == OUTSET && (s == BSBottom || s == BSRight))
c = c.dark();
case SOLID:
- p->setPen(Pen::NoPen);
- p->setFillColor(c.rgb());
- p->drawArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), thickness, angleStart, angleSpan);
+ graphicsContext->setPen(Pen::NoPen);
+ graphicsContext->setFillColor(c);
+ graphicsContext->drawArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), thickness, angleStart, angleSpan);
break;
}
}
-void RenderObject::drawBorder(GraphicsContext* p, int x1, int y1, int x2, int y2,
+void RenderObject::drawBorder(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2,
BorderSide s, Color c, const Color& textcolor, EBorderStyle style,
int adjbw1, int adjbw2)
{
c = textcolor;
}
- switch(style)
- {
- case BNONE:
- case BHIDDEN:
- return;
- case DOTTED:
- p->setPen(Pen(c, width == 1 ? 0 : width, Pen::DotLine));
- /* nobreak; */
- case DASHED:
- if(style == DASHED)
- p->setPen(Pen(c, width == 1 ? 0 : width, Pen::DashLine));
-
- if (width > 0)
- switch(s)
- {
- case BSBottom:
- case BSTop:
- p->drawLine(IntPoint(x1, (y1+y2)/2), IntPoint(x2, (y1+y2)/2));
- break;
- case BSRight:
- case BSLeft:
- p->drawLine(IntPoint((x1+x2)/2, y1), IntPoint((x1+x2)/2, y2));
- break;
- }
-
- break;
-
- case DOUBLE:
- {
- int third = (width+1)/3;
+ switch (style) {
+ case BNONE:
+ case BHIDDEN:
+ return;
+ case DOTTED:
+ case DASHED:
+ graphicsContext->setPen(Pen(c, width == 1 ? 0 : width, style == DASHED ? Pen::DashLine : Pen::DotLine));
- if (adjbw1 == 0 && adjbw2 == 0)
- {
- p->setPen(Pen::NoPen);
- p->setFillColor(c.rgb());
- switch(s)
- {
- case BSTop:
- case BSBottom:
- p->drawRect(IntRect(x1, y1 , x2-x1, third));
- p->drawRect(IntRect(x1, y2-third, x2-x1, third));
- break;
- case BSLeft:
- p->drawRect(IntRect(x1 , y1+1, third, y2-y1-1));
- p->drawRect(IntRect(x2-third, y1+1, third, y2-y1-1));
- break;
- case BSRight:
- p->drawRect(IntRect(x1 , y1+1, third, y2-y1-1));
- p->drawRect(IntRect(x2-third, y1+1, third, y2-y1-1));
- break;
+ if (width > 0)
+ switch (s) {
+ case BSBottom:
+ case BSTop:
+ graphicsContext->drawLine(IntPoint(x1, (y1 + y2) / 2), IntPoint(x2, (y1 + y2) / 2));
+ break;
+ case BSRight:
+ case BSLeft:
+ graphicsContext->drawLine(IntPoint((x1 + x2) / 2, y1), IntPoint((x1 + x2) / 2, y2));
+ break;
+ }
+ break;
+ case DOUBLE: {
+ int third = (width + 1) / 3;
+
+ if (adjbw1 == 0 && adjbw2 == 0) {
+ graphicsContext->setPen(Pen::NoPen);
+ graphicsContext->setFillColor(c);
+ switch (s) {
+ case BSTop:
+ case BSBottom:
+ graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, third));
+ graphicsContext->drawRect(IntRect(x1, y2 - third, x2 - x1, third));
+ break;
+ case BSLeft:
+ graphicsContext->drawRect(IntRect(x1, y1 + 1, third, y2 - y1 - 1));
+ graphicsContext->drawRect(IntRect(x2 - third, y1 + 1, third, y2 - y1 - 1));
+ break;
+ case BSRight:
+ graphicsContext->drawRect(IntRect(x1, y1 + 1, third, y2 - y1 - 1));
+ graphicsContext->drawRect(IntRect(x2 - third, y1 + 1, third, y2 - y1 - 1));
+ break;
+ }
+ } else {
+ int adjbw1bigthird = ((adjbw1 > 0) ? adjbw1 + 1 : adjbw1 - 1) / 3;
+ int adjbw2bigthird = ((adjbw2 > 0) ? adjbw2 + 1 : adjbw2 - 1) / 3;
+
+ switch (s) {
+ case BSTop:
+ drawBorder(graphicsContext, x1 + max((-adjbw1 * 2 + 1) / 3, 0),
+ y1, x2 - max((-adjbw2 * 2 + 1) / 3, 0), y1 + third,
+ s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
+ drawBorder(graphicsContext, x1 + max((adjbw1 * 2 + 1) / 3, 0),
+ y2 - third, x2 - max((adjbw2 * 2 + 1) / 3, 0), y2,
+ s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
+ break;
+ case BSLeft:
+ drawBorder(graphicsContext, x1, y1 + max((-adjbw1 * 2 + 1) / 3, 0),
+ x1 + third, y2 - max((-adjbw2 * 2 + 1) / 3, 0),
+ s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
+ drawBorder(graphicsContext, x2 - third, y1 + max((adjbw1 * 2 + 1) / 3, 0),
+ x2, y2 - max((adjbw2 * 2 + 1) / 3, 0),
+ s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
+ break;
+ case BSBottom:
+ drawBorder(graphicsContext, x1 + max((adjbw1 * 2 + 1) / 3, 0),
+ y1, x2 - max((adjbw2 * 2 + 1) / 3, 0), y1 + third,
+ s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
+ drawBorder(graphicsContext, x1 + max((-adjbw1 * 2 + 1) / 3, 0),
+ y2 - third, x2 - max((-adjbw2 * 2 + 1) / 3, 0), y2,
+ s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
+ break;
+ case BSRight:
+ drawBorder(graphicsContext, x1, y1 + max((adjbw1 * 2 + 1) / 3, 0),
+ x1 + third, y2 - max(( adjbw2 * 2 + 1) / 3, 0),
+ s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
+ drawBorder(graphicsContext, x2 - third, y1 + max((-adjbw1 * 2 + 1) / 3, 0),
+ x2, y2 - max((-adjbw2 * 2 + 1) / 3, 0),
+ s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
+ break;
+ default:
+ break;
+ }
}
+ break;
}
- else
+ case RIDGE:
+ case GROOVE:
{
- int adjbw1bigthird;
- if (adjbw1>0)
- adjbw1bigthird = adjbw1+1;
- else
- adjbw1bigthird = adjbw1 - 1;
- adjbw1bigthird /= 3;
-
- int adjbw2bigthird;
- if (adjbw2>0)
- adjbw2bigthird = adjbw2 + 1;
- else
- adjbw2bigthird = adjbw2 - 1;
- adjbw2bigthird /= 3;
+ EBorderStyle s1;
+ EBorderStyle s2;
+ if (style == GROOVE) {
+ s1 = INSET;
+ s2 = OUTSET;
+ } else {
+ s1 = OUTSET;
+ s2 = INSET;
+ }
- switch(s)
- {
- case BSTop:
- drawBorder(p, x1+max((-adjbw1*2+1)/3,0), y1 , x2-max((-adjbw2*2+1)/3,0), y1 + third, s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
- drawBorder(p, x1+max(( adjbw1*2+1)/3,0), y2 - third, x2-max(( adjbw2*2+1)/3,0), y2 , s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
- break;
- case BSLeft:
- drawBorder(p, x1 , y1+max((-adjbw1*2+1)/3,0), x1+third, y2-max((-adjbw2*2+1)/3,0), s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
- drawBorder(p, x2 - third, y1+max(( adjbw1*2+1)/3,0), x2 , y2-max(( adjbw2*2+1)/3,0), s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
- break;
- case BSBottom:
- drawBorder(p, x1+max(( adjbw1*2+1)/3,0), y1 , x2-max(( adjbw2*2+1)/3,0), y1+third, s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
- drawBorder(p, x1+max((-adjbw1*2+1)/3,0), y2-third, x2-max((-adjbw2*2+1)/3,0), y2 , s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
- break;
- case BSRight:
- drawBorder(p, x1 , y1+max(( adjbw1*2+1)/3,0), x1+third, y2-max(( adjbw2*2+1)/3,0), s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
- drawBorder(p, x2-third, y1+max((-adjbw1*2+1)/3,0), x2 , y2-max((-adjbw2*2+1)/3,0), s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);
- break;
- default:
- break;
+ int adjbw1bighalf = ((adjbw1 > 0) ? adjbw1 + 1 : adjbw1 - 1) / 2;
+ int adjbw2bighalf = ((adjbw2 > 0) ? adjbw2 + 1 : adjbw2 - 1) / 2;
+
+ switch (s) {
+ case BSTop:
+ drawBorder(graphicsContext, x1 + max(-adjbw1, 0) / 2, y1, x2 - max(-adjbw2, 0) / 2, (y1 + y2 + 1) / 2,
+ s, c, textcolor, s1, adjbw1bighalf, adjbw2bighalf);
+ drawBorder(graphicsContext, x1 + max(adjbw1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(adjbw2 + 1, 0) / 2, y2,
+ s, c, textcolor, s2, adjbw1 / 2, adjbw2 / 2);
+ break;
+ case BSLeft:
+ drawBorder(graphicsContext, x1, y1 + max(-adjbw1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(-adjbw2, 0) / 2,
+ s, c, textcolor, s1, adjbw1bighalf, adjbw2bighalf);
+ drawBorder(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(adjbw1 + 1, 0) / 2, x2, y2 - max(adjbw2 + 1, 0) / 2,
+ s, c, textcolor, s2, adjbw1 / 2, adjbw2 / 2);
+ break;
+ case BSBottom:
+ drawBorder(graphicsContext, x1 + max(adjbw1, 0) / 2, y1, x2 - max(adjbw2, 0) / 2, (y1 + y2 + 1) / 2,
+ s, c, textcolor, s2, adjbw1bighalf, adjbw2bighalf);
+ drawBorder(graphicsContext, x1 + max(-adjbw1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(-adjbw2 + 1, 0) / 2, y2,
+ s, c, textcolor, s1, adjbw1/2, adjbw2/2);
+ break;
+ case BSRight:
+ drawBorder(graphicsContext, x1, y1 + max(adjbw1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(adjbw2, 0) / 2,
+ s, c, textcolor, s2, adjbw1bighalf, adjbw2bighalf);
+ drawBorder(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(-adjbw1 + 1, 0) / 2, x2, y2 - max(-adjbw2 + 1, 0) / 2,
+ s, c, textcolor, s1, adjbw1/2, adjbw2/2);
+ break;
}
+ break;
}
- break;
- }
- case RIDGE:
- case GROOVE:
- {
- EBorderStyle s1;
- EBorderStyle s2;
- if (style==GROOVE)
- {
- s1 = INSET;
- s2 = OUTSET;
- }
- else
- {
- s1 = OUTSET;
- s2 = INSET;
- }
-
- int adjbw1bighalf;
- int adjbw2bighalf;
- if (adjbw1>0) adjbw1bighalf=adjbw1+1;
- else adjbw1bighalf=adjbw1-1;
- adjbw1bighalf/=2;
-
- if (adjbw2>0) adjbw2bighalf=adjbw2+1;
- else adjbw2bighalf=adjbw2-1;
- adjbw2bighalf/=2;
-
- switch (s)
+ case INSET:
+ if (s == BSTop || s == BSLeft)
+ c = c.dark();
+ // fall through
+ case OUTSET:
+ if (style == OUTSET && (s == BSBottom || s == BSRight))
+ c = c.dark();
+ // fall through
+ case SOLID:
{
- case BSTop:
- drawBorder(p, x1+max(-adjbw1 ,0)/2, y1 , x2-max(-adjbw2,0)/2, (y1+y2+1)/2, s, c, textcolor, s1, adjbw1bighalf, adjbw2bighalf);
- drawBorder(p, x1+max( adjbw1+1,0)/2, (y1+y2+1)/2, x2-max( adjbw2+1,0)/2, y2 , s, c, textcolor, s2, adjbw1/2, adjbw2/2);
- break;
- case BSLeft:
- drawBorder(p, x1 , y1+max(-adjbw1 ,0)/2, (x1+x2+1)/2, y2-max(-adjbw2,0)/2, s, c, textcolor, s1, adjbw1bighalf, adjbw2bighalf);
- drawBorder(p, (x1+x2+1)/2, y1+max( adjbw1+1,0)/2, x2 , y2-max( adjbw2+1,0)/2, s, c, textcolor, s2, adjbw1/2, adjbw2/2);
- break;
- case BSBottom:
- drawBorder(p, x1+max( adjbw1 ,0)/2, y1 , x2-max( adjbw2,0)/2, (y1+y2+1)/2, s, c, textcolor, s2, adjbw1bighalf, adjbw2bighalf);
- drawBorder(p, x1+max(-adjbw1+1,0)/2, (y1+y2+1)/2, x2-max(-adjbw2+1,0)/2, y2 , s, c, textcolor, s1, adjbw1/2, adjbw2/2);
- break;
- case BSRight:
- drawBorder(p, x1 , y1+max( adjbw1 ,0)/2, (x1+x2+1)/2, y2-max( adjbw2,0)/2, s, c, textcolor, s2, adjbw1bighalf, adjbw2bighalf);
- drawBorder(p, (x1+x2+1)/2, y1+max(-adjbw1+1,0)/2, x2 , y2-max(-adjbw2+1,0)/2, s, c, textcolor, s1, adjbw1/2, adjbw2/2);
+ graphicsContext->setPen(Pen::NoPen);
+ graphicsContext->setFillColor(c);
+ ASSERT(x2 >= x1);
+ ASSERT(y2 >= y1);
+ if (!adjbw1 && !adjbw2) {
+ graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1));
+ return;
+ }
+ FloatPoint quad[4];
+ switch (s) {
+ case BSTop:
+ quad[0] = FloatPoint(x1 + max(-adjbw1, 0), y1);
+ quad[1] = FloatPoint(x1 + max(adjbw1, 0), y2);
+ quad[2] = FloatPoint(x2 - max(adjbw2, 0), y2);
+ quad[3] = FloatPoint(x2 - max(-adjbw2, 0), y1);
+ break;
+ case BSBottom:
+ quad[0] = FloatPoint(x1 + max(adjbw1, 0), y1);
+ quad[1] = FloatPoint(x1 + max(-adjbw1, 0), y2);
+ quad[2] = FloatPoint(x2 - max(-adjbw2, 0), y2);
+ quad[3] = FloatPoint(x2 - max(adjbw2, 0), y1);
+ break;
+ case BSLeft:
+ quad[0] = FloatPoint(x1, y1 + max(-adjbw1, 0));
+ quad[1] = FloatPoint(x1, y2 - max(-adjbw2, 0));
+ quad[2] = FloatPoint(x2, y2 - max(adjbw2, 0));
+ quad[3] = FloatPoint(x2, y1 + max(adjbw1, 0));
+ break;
+ case BSRight:
+ quad[0] = FloatPoint(x1, y1 + max(adjbw1, 0));
+ quad[1] = FloatPoint(x1, y2 - max(adjbw2, 0));
+ quad[2] = FloatPoint(x2, y2 - max(-adjbw2, 0));
+ quad[3] = FloatPoint(x2, y1 + max(-adjbw1, 0));
+ break;
+ }
+ graphicsContext->drawConvexPolygon(4, quad);
break;
}
- break;
- }
- case INSET:
- if (s == BSTop || s == BSLeft)
- c = c.dark();
- /* nobreak; */
- case OUTSET:
- if (style == OUTSET && (s == BSBottom || s == BSRight))
- c = c.dark();
- /* nobreak; */
- case SOLID:
- {
- p->setPen(Pen::NoPen);
- p->setFillColor(c);
- ASSERT(x2 >= x1);
- ASSERT(y2 >= y1);
- if (!adjbw1 && !adjbw2) {
- p->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1));
- return;
- }
- FloatPoint quad[4];
- switch (s) {
- case BSTop:
- quad[0] = FloatPoint(x1 + max(-adjbw1, 0), y1);
- quad[1] = FloatPoint(x1 + max( adjbw1, 0), y2);
- quad[2] = FloatPoint(x2 - max( adjbw2, 0), y2);
- quad[3] = FloatPoint(x2 - max(-adjbw2, 0), y1);
- break;
- case BSBottom:
- quad[0] = FloatPoint(x1 + max( adjbw1, 0), y1);
- quad[1] = FloatPoint(x1 + max(-adjbw1, 0), y2);
- quad[2] = FloatPoint(x2 - max(-adjbw2, 0), y2);
- quad[3] = FloatPoint(x2 - max( adjbw2, 0), y1);
- break;
- case BSLeft:
- quad[0] = FloatPoint(x1, y1 + max(-adjbw1, 0));
- quad[1] = FloatPoint(x1, y2 - max(-adjbw2, 0));
- quad[2] = FloatPoint(x2, y2 - max( adjbw2, 0));
- quad[3] = FloatPoint(x2, y1 + max( adjbw1, 0));
- break;
- case BSRight:
- quad[0] = FloatPoint(x1, y1 + max( adjbw1, 0));
- quad[1] = FloatPoint(x1, y2 - max( adjbw2, 0));
- quad[2] = FloatPoint(x2, y2 - max(-adjbw2, 0));
- quad[3] = FloatPoint(x2, y1 + max(-adjbw1, 0));
- break;
- }
- p->drawConvexPolygon(4, quad);
- break;
- }
}
}
-bool RenderObject::paintBorderImage(GraphicsContext* p, int _tx, int _ty, int w, int h, const RenderStyle* style)
+bool RenderObject::paintBorderImage(GraphicsContext* graphicsContext, int tx, int ty, int w, int h, const RenderStyle* style)
{
CachedImage* borderImage = style->borderImage().image();
if (!borderImage->isLoaded())
return true; // Never paint a border image incrementally, but don't paint the fallback borders either.
-
+
// If we have a border radius, the border image gets clipped to the rounded rect.
bool clipped = false;
if (style->hasBorderRadius()) {
- IntRect clipRect(_tx, _ty, w, h);
- p->save();
- p->addRoundedRectClip(clipRect,
- style->borderTopLeftRadius(), style->borderTopRightRadius(),
- style->borderBottomLeftRadius(), style->borderBottomRightRadius());
+ IntRect clipRect(tx, ty, w, h);
+ graphicsContext->save();
+ graphicsContext->addRoundedRectClip(clipRect, style->borderTopLeftRadius(), style->borderTopRightRadius(),
+ style->borderBottomLeftRadius(), style->borderBottomRightRadius());
clipped = true;
}
int topSlice = min(imageHeight, style->borderImage().m_slices.top.calcValue(borderImage->image()->height()));
int bottomSlice = min(imageHeight, style->borderImage().m_slices.bottom.calcValue(borderImage->image()->height()));
- int leftSlice = min(imageWidth, style->borderImage().m_slices.left.calcValue(borderImage->image()->width()));
+ int leftSlice = min(imageWidth, style->borderImage().m_slices.left.calcValue(borderImage->image()->width()));
int rightSlice = min(imageWidth, style->borderImage().m_slices.right.calcValue(borderImage->image()->width()));
EBorderImageRule hRule = style->borderImage().horizontalRule();
EBorderImageRule vRule = style->borderImage().verticalRule();
-
+
bool drawLeft = leftSlice > 0 && style->borderLeftWidth() > 0;
bool drawTop = topSlice > 0 && style->borderTopWidth() > 0;
bool drawRight = rightSlice > 0 && style->borderRightWidth() > 0;
if (drawLeft) {
// Paint the top and bottom left corners.
-
- // The top left corner rect is (_tx, _ty, leftWidth, topWidth)
+
+ // The top left corner rect is (tx, ty, leftWidth, topWidth)
// The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice)
if (drawTop)
- p->drawImage(borderImage->image(), IntRect(_tx, _ty, style->borderLeftWidth(), style->borderTopWidth()),
- IntRect(0, 0, leftSlice, topSlice));
-
- // The bottom left corner rect is (_tx, _ty + h - bottomWidth, leftWidth, bottomWidth)
+ graphicsContext->drawImage(borderImage->image(), IntRect(tx, ty, style->borderLeftWidth(), style->borderTopWidth()),
+ IntRect(0, 0, leftSlice, topSlice));
+
+ // The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth, bottomWidth)
// The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice)
if (drawBottom)
- p->drawImage(borderImage->image(), IntRect(_tx, _ty + h - style->borderBottomWidth(), style->borderLeftWidth(), style->borderBottomWidth()),
- IntRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice));
-
+ graphicsContext->drawImage(borderImage->image(), IntRect(tx, ty + h - style->borderBottomWidth(), style->borderLeftWidth(), style->borderBottomWidth()),
+ IntRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice));
+
// Paint the left edge.
// Have to scale and tile into the border rect.
- p->drawTiledImage(borderImage->image(), IntRect(_tx, _ty + style->borderTopWidth(), style->borderLeftWidth(),
- h - style->borderTopWidth() - style->borderBottomWidth()),
- IntRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice),
- Image::StretchTile, (Image::TileRule)vRule);
+ graphicsContext->drawTiledImage(borderImage->image(), IntRect(tx, ty + style->borderTopWidth(), style->borderLeftWidth(),
+ h - style->borderTopWidth() - style->borderBottomWidth()),
+ IntRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice),
+ Image::StretchTile, (Image::TileRule)vRule);
}
-
+
if (drawRight) {
// Paint the top and bottom right corners
- // The top right corner rect is (_tx + w - rightWidth, _ty, rightWidth, topWidth)
+ // The top right corner rect is (tx + w - rightWidth, ty, rightWidth, topWidth)
// The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice)
if (drawTop)
- p->drawImage(borderImage->image(), IntRect(_tx + w - style->borderRightWidth(), _ty, style->borderRightWidth(), style->borderTopWidth()),
- IntRect(imageWidth - rightSlice, 0, rightSlice, topSlice));
-
- // The bottom right corner rect is (_tx + w - rightWidth, _ty + h - bottomWidth, rightWidth, bottomWidth)
+ graphicsContext->drawImage(borderImage->image(), IntRect(tx + w - style->borderRightWidth(), ty, style->borderRightWidth(), style->borderTopWidth()),
+ IntRect(imageWidth - rightSlice, 0, rightSlice, topSlice));
+
+ // The bottom right corner rect is (tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth)
// The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, botomSlice)
if (drawBottom)
- p->drawImage(borderImage->image(), IntRect(_tx + w - style->borderRightWidth(), _ty + h - style->borderBottomWidth(), style->borderRightWidth(), style->borderBottomWidth()),
- IntRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice));
-
+ graphicsContext->drawImage(borderImage->image(), IntRect(tx + w - style->borderRightWidth(), ty + h - style->borderBottomWidth(), style->borderRightWidth(), style->borderBottomWidth()),
+ IntRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice));
+
// Paint the right edge.
- p->drawTiledImage(borderImage->image(), IntRect(_tx + w - style->borderRightWidth(), _ty + style->borderTopWidth(), style->borderRightWidth(),
- h - style->borderTopWidth() - style->borderBottomWidth()),
- IntRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice),
- Image::StretchTile, (Image::TileRule)vRule);
+ graphicsContext->drawTiledImage(borderImage->image(), IntRect(tx + w - style->borderRightWidth(), ty + style->borderTopWidth(), style->borderRightWidth(),
+ h - style->borderTopWidth() - style->borderBottomWidth()),
+ IntRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice),
+ Image::StretchTile, (Image::TileRule)vRule);
}
// Paint the top edge.
if (drawTop)
- p->drawTiledImage(borderImage->image(), IntRect(_tx + style->borderLeftWidth(), _ty, w - style->borderLeftWidth() - style->borderRightWidth(), style->borderTopWidth()),
- IntRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice),
- (Image::TileRule)hRule, Image::StretchTile);
-
+ graphicsContext->drawTiledImage(borderImage->image(), IntRect(tx + style->borderLeftWidth(), ty, w - style->borderLeftWidth() - style->borderRightWidth(), style->borderTopWidth()),
+ IntRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice),
+ (Image::TileRule)hRule, Image::StretchTile);
+
// Paint the bottom edge.
if (drawBottom)
- p->drawTiledImage(borderImage->image(), IntRect(_tx + style->borderLeftWidth(), _ty + h - style->borderBottomWidth(),
- w - style->borderLeftWidth() - style->borderRightWidth(), style->borderBottomWidth()),
- IntRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice),
- (Image::TileRule)hRule, Image::StretchTile);
-
+ graphicsContext->drawTiledImage(borderImage->image(), IntRect(tx + style->borderLeftWidth(), ty + h - style->borderBottomWidth(),
+ w - style->borderLeftWidth() - style->borderRightWidth(), style->borderBottomWidth()),
+ IntRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice),
+ (Image::TileRule)hRule, Image::StretchTile);
+
// Paint the middle.
if (drawMiddle)
- p->drawTiledImage(borderImage->image(), IntRect(_tx + style->borderLeftWidth(), _ty + style->borderTopWidth(), w - style->borderLeftWidth() - style->borderRightWidth(),
- h - style->borderTopWidth() - style->borderBottomWidth()),
- IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),
- (Image::TileRule)hRule, (Image::TileRule)vRule);
+ graphicsContext->drawTiledImage(borderImage->image(), IntRect(tx + style->borderLeftWidth(), ty + style->borderTopWidth(), w - style->borderLeftWidth() - style->borderRightWidth(),
+ h - style->borderTopWidth() - style->borderBottomWidth()),
+ IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),
+ (Image::TileRule)hRule, (Image::TileRule)vRule);
// Clear the clip for the border radius.
if (clipped)
- p->restore();
+ graphicsContext->restore();
return true;
}
-void RenderObject::paintBorder(GraphicsContext* p, int _tx, int _ty, int w, int h, const RenderStyle* style, bool begin, bool end)
+void RenderObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h,
+ const RenderStyle* style, bool begin, bool end)
{
CachedImage* borderImage = style->borderImage().image();
bool shouldPaintBackgroundImage = borderImage && borderImage->canRender();
if (shouldPaintBackgroundImage)
- shouldPaintBackgroundImage = paintBorderImage(p, _tx, _ty, w, h, style);
-
+ shouldPaintBackgroundImage = paintBorderImage(graphicsContext, tx, ty, w, h, style);
+
if (shouldPaintBackgroundImage)
return;
bool bt = style->borderBottomIsTransparent();
bool rt = style->borderRightIsTransparent();
bool lt = style->borderLeftIsTransparent();
-
+
EBorderStyle ts = style->borderTopStyle();
EBorderStyle bs = style->borderBottomStyle();
EBorderStyle ls = style->borderLeftStyle();
int requiredHeight = max(topLeft.height() + bottomLeft.height(), topRight.height() + bottomRight.height());
renderRadii = (requiredWidth <= w && requiredHeight <= h);
}
-
+
// Clip to the rounded rectangle.
if (renderRadii) {
- p->save();
- p->addRoundedRectClip(IntRect(_tx, _ty, w, h), topLeft, topRight, bottomLeft, bottomRight);
+ graphicsContext->save();
+ graphicsContext->addRoundedRectClip(IntRect(tx, ty, w, h), topLeft, topRight, bottomLeft, bottomRight);
}
int firstAngleStart, secondAngleStart, firstAngleSpan, secondAngleSpan;
if (renderTop) {
bool ignore_left = (renderRadii && topLeft.width() > 0) ||
- ((tc == lc) && (tt == lt) &&
- (ts >= OUTSET) &&
- (ls == DOTTED || ls == DASHED || ls == SOLID || ls == OUTSET));
+ (tc == lc && tt == lt && ts >= OUTSET &&
+ (ls == DOTTED || ls == DASHED || ls == SOLID || ls == OUTSET));
bool ignore_right = (renderRadii && topRight.width() > 0) ||
- ((tc == rc) && (tt == rt) &&
- (ts >= OUTSET) &&
- (rs == DOTTED || rs == DASHED || rs == SOLID || rs == INSET));
-
- int x = _tx;
- int x2 = _tx + w;
+ (tc == rc && tt == rt && ts >= OUTSET &&
+ (rs == DOTTED || rs == DASHED || rs == SOLID || rs == INSET));
+
+ int x = tx;
+ int x2 = tx + w;
if (renderRadii) {
x += topLeft.width();
x2 -= topRight.width();
}
-
- drawBorder(p, x, _ty, x2, _ty + style->borderTopWidth(), BSTop, tc, style->color(), ts,
- ignore_left ? 0 : style->borderLeftWidth(),
- ignore_right? 0 : style->borderRightWidth());
-
+
+ drawBorder(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, tc, style->color(), ts,
+ ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth());
+
if (renderRadii) {
- int leftX = _tx;
- int leftY = _ty;
- int rightX = _tx + w - topRight.width() * 2;
+ int leftX = tx;
+ int leftY = ty;
+ int rightX = tx + w - topRight.width() * 2;
firstAngleStart = 90;
firstAngleSpan = upperLeftBorderStylesMatch ? 90 : 45;
-
+
// We make the arc double thick and let the clip rect take care of clipping the extra off.
// We're doing this because it doesn't seem possible to match the curve of the clip exactly
// with the arc-drawing function.
thickness = style->borderTopWidth() * 2;
-
+
if (upperRightBorderStylesMatch) {
secondAngleStart = 0;
secondAngleSpan = 90;
secondAngleStart = 45;
secondAngleSpan = 45;
}
-
+
// The inner clip clips inside the arc. This is especially important for 1px borders.
bool applyLeftInnerClip = (style->borderLeftWidth() < topLeft.width())
&& (style->borderTopWidth() < topLeft.height())
&& (ts != DOUBLE || style->borderTopWidth() > 6);
if (applyLeftInnerClip) {
- p->save();
- p->addInnerRoundedRectClip(IntRect(leftX, leftY, topLeft.width() * 2, topLeft.height() * 2),
- style->borderTopWidth());
+ graphicsContext->save();
+ graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, topLeft.width() * 2, topLeft.height() * 2),
+ style->borderTopWidth());
}
-
+
// Draw upper left arc
- drawBorderArc(p, leftX, leftY, thickness, topLeft, firstAngleStart, firstAngleSpan,
- BSTop, tc, style->color(), ts, true);
+ drawBorderArc(graphicsContext, leftX, leftY, thickness, topLeft, firstAngleStart, firstAngleSpan,
+ BSTop, tc, style->color(), ts, true);
if (applyLeftInnerClip)
- p->restore();
-
+ graphicsContext->restore();
+
bool applyRightInnerClip = (style->borderRightWidth() < topRight.width())
&& (style->borderTopWidth() < topRight.height())
&& (ts != DOUBLE || style->borderTopWidth() > 6);
if (applyRightInnerClip) {
- p->save();
- p->addInnerRoundedRectClip(IntRect(rightX, leftY, topRight.width() * 2, topRight.height() * 2),
- style->borderTopWidth());
+ graphicsContext->save();
+ graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, topRight.width() * 2, topRight.height() * 2),
+ style->borderTopWidth());
}
-
+
// Draw upper right arc
- drawBorderArc(p, rightX, leftY, thickness, topRight, secondAngleStart, secondAngleSpan,
- BSTop, tc, style->color(), ts, false);
+ drawBorderArc(graphicsContext, rightX, leftY, thickness, topRight, secondAngleStart, secondAngleSpan,
+ BSTop, tc, style->color(), ts, false);
if (applyRightInnerClip)
- p->restore();
+ graphicsContext->restore();
}
}
if (renderBottom) {
bool ignore_left = (renderRadii && bottomLeft.width() > 0) ||
- ((bc == lc) && (bt == lt) &&
- (bs >= OUTSET) &&
- (ls == DOTTED || ls == DASHED || ls == SOLID || ls == OUTSET));
+ (bc == lc && bt == lt && bs >= OUTSET &&
+ (ls == DOTTED || ls == DASHED || ls == SOLID || ls == OUTSET));
bool ignore_right = (renderRadii && bottomRight.width() > 0) ||
- ((bc == rc) && (bt == rt) &&
- (bs >= OUTSET) &&
- (rs == DOTTED || rs == DASHED || rs == SOLID || rs == INSET));
-
- int x = _tx;
- int x2 = _tx + w;
+ (bc == rc && bt == rt && bs >= OUTSET &&
+ (rs == DOTTED || rs == DASHED || rs == SOLID || rs == INSET));
+
+ int x = tx;
+ int x2 = tx + w;
if (renderRadii) {
x += bottomLeft.width();
x2 -= bottomRight.width();
}
- drawBorder(p, x, _ty + h - style->borderBottomWidth(), x2, _ty + h, BSBottom, bc, style->color(), bs,
- ignore_left ? 0 :style->borderLeftWidth(),
- ignore_right? 0 :style->borderRightWidth());
-
+ drawBorder(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bc, style->color(), bs,
+ ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth());
+
if (renderRadii) {
- int leftX = _tx;
- int leftY = _ty + h - bottomLeft.height() * 2;
- int rightX = _tx + w - bottomRight.width() * 2;
+ int leftX = tx;
+ int leftY = ty + h - bottomLeft.height() * 2;
+ int rightX = tx + w - bottomRight.width() * 2;
secondAngleStart = 270;
secondAngleSpan = upperRightBorderStylesMatch ? 90 : 45;
thickness = style->borderBottomWidth() * 2;
-
+
if (upperLeftBorderStylesMatch) {
firstAngleStart = 180;
firstAngleSpan = 90;
} else {
firstAngleStart = 225;
- firstAngleSpan = 45;
+ firstAngleSpan = 45;
}
-
+
bool applyLeftInnerClip = (style->borderLeftWidth() < bottomLeft.width())
&& (style->borderBottomWidth() < bottomLeft.height())
&& (bs != DOUBLE || style->borderBottomWidth() > 6);
if (applyLeftInnerClip) {
- p->save();
- p->addInnerRoundedRectClip(IntRect(leftX, leftY, bottomLeft.width() * 2, bottomLeft.height() * 2),
- style->borderBottomWidth());
+ graphicsContext->save();
+ graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, bottomLeft.width() * 2, bottomLeft.height() * 2),
+ style->borderBottomWidth());
}
-
+
// Draw lower left arc
- drawBorderArc(p, leftX, leftY, thickness, bottomLeft, firstAngleStart, firstAngleSpan,
- BSBottom, bc, style->color(), bs, true);
+ drawBorderArc(graphicsContext, leftX, leftY, thickness, bottomLeft, firstAngleStart, firstAngleSpan,
+ BSBottom, bc, style->color(), bs, true);
if (applyLeftInnerClip)
- p->restore();
-
+ graphicsContext->restore();
+
bool applyRightInnerClip = (style->borderRightWidth() < bottomRight.width())
&& (style->borderBottomWidth() < bottomRight.height())
&& (bs != DOUBLE || style->borderBottomWidth() > 6);
if (applyRightInnerClip) {
- p->save();
- p->addInnerRoundedRectClip(IntRect(rightX, leftY, bottomRight.width() * 2, bottomRight.height() * 2),
- style->borderBottomWidth());
+ graphicsContext->save();
+ graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, bottomRight.width() * 2, bottomRight.height() * 2),
+ style->borderBottomWidth());
}
-
+
// Draw lower right arc
- drawBorderArc(p, rightX, leftY, thickness, bottomRight, secondAngleStart, secondAngleSpan,
- BSBottom, bc, style->color(), bs, false);
+ drawBorderArc(graphicsContext, rightX, leftY, thickness, bottomRight, secondAngleStart, secondAngleSpan,
+ BSBottom, bc, style->color(), bs, false);
if (applyRightInnerClip)
- p->restore();
+ graphicsContext->restore();
}
}
-
+
if (renderLeft) {
bool ignore_top = (renderRadii && topLeft.height() > 0) ||
- ((tc == lc) && (tt == lt) &&
- (ls >= OUTSET) &&
- (ts == DOTTED || ts == DASHED || ts == SOLID || ts == OUTSET));
+ (tc == lc && tt == lt && ls >= OUTSET &&
+ (ts == DOTTED || ts == DASHED || ts == SOLID || ts == OUTSET));
bool ignore_bottom = (renderRadii && bottomLeft.height() > 0) ||
- ((bc == lc) && (bt == lt) &&
- (ls >= OUTSET) &&
- (bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET));
+ (bc == lc && bt == lt && ls >= OUTSET &&
+ (bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET));
- int y = _ty;
- int y2 = _ty + h;
+ int y = ty;
+ int y2 = ty + h;
if (renderRadii) {
y += topLeft.height();
y2 -= bottomLeft.height();
}
-
- drawBorder(p, _tx, y, _tx + style->borderLeftWidth(), y2, BSLeft, lc, style->color(), ls,
- ignore_top?0:style->borderTopWidth(),
- ignore_bottom?0:style->borderBottomWidth());
+
+ drawBorder(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, lc, style->color(), ls,
+ ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) {
- int topX = _tx;
- int topY = _ty;
- int bottomY = _ty + h - bottomLeft.height() * 2;
+ int topX = tx;
+ int topY = ty;
+ int bottomY = ty + h - bottomLeft.height() * 2;
firstAngleStart = 135;
secondAngleStart = 180;
firstAngleSpan = secondAngleSpan = 45;
thickness = style->borderLeftWidth() * 2;
-
+
bool applyTopInnerClip = (style->borderLeftWidth() < topLeft.width())
&& (style->borderTopWidth() < topLeft.height())
&& (ls != DOUBLE || style->borderLeftWidth() > 6);
if (applyTopInnerClip) {
- p->save();
- p->addInnerRoundedRectClip(IntRect(topX, topY, topLeft.width() * 2, topLeft.height() * 2),
- style->borderLeftWidth());
+ graphicsContext->save();
+ graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topLeft.width() * 2, topLeft.height() * 2),
+ style->borderLeftWidth());
}
-
+
// Draw top left arc
- drawBorderArc(p, topX, topY, thickness, topLeft, firstAngleStart, firstAngleSpan,
- BSLeft, lc, style->color(), ls, true);
+ drawBorderArc(graphicsContext, topX, topY, thickness, topLeft, firstAngleStart, firstAngleSpan,
+ BSLeft, lc, style->color(), ls, true);
if (applyTopInnerClip)
- p->restore();
-
+ graphicsContext->restore();
+
bool applyBottomInnerClip = (style->borderLeftWidth() < bottomLeft.width())
&& (style->borderBottomWidth() < bottomLeft.height())
&& (ls != DOUBLE || style->borderLeftWidth() > 6);
if (applyBottomInnerClip) {
- p->save();
- p->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomLeft.width() * 2, bottomLeft.height() * 2),
- style->borderLeftWidth());
+ graphicsContext->save();
+ graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomLeft.width() * 2, bottomLeft.height() * 2),
+ style->borderLeftWidth());
}
-
+
// Draw bottom left arc
- drawBorderArc(p, topX, bottomY, thickness, bottomLeft, secondAngleStart, secondAngleSpan,
- BSLeft, lc, style->color(), ls, false);
+ drawBorderArc(graphicsContext, topX, bottomY, thickness, bottomLeft, secondAngleStart, secondAngleSpan,
+ BSLeft, lc, style->color(), ls, false);
if (applyBottomInnerClip)
- p->restore();
+ graphicsContext->restore();
}
}
if (renderRight) {
bool ignore_top = (renderRadii && topRight.height() > 0) ||
- ((tc == rc) && (tt == rt) &&
- (rs >= DOTTED || rs == INSET) &&
- (ts == DOTTED || ts == DASHED || ts == SOLID || ts == OUTSET));
+ ((tc == rc) && (tt == rt) &&
+ (rs >= DOTTED || rs == INSET) &&
+ (ts == DOTTED || ts == DASHED || ts == SOLID || ts == OUTSET));
bool ignore_bottom = (renderRadii && bottomRight.height() > 0) ||
- ((bc == rc) && (bt == rt) &&
- (rs >= DOTTED || rs == INSET) &&
- (bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET));
+ ((bc == rc) && (bt == rt) &&
+ (rs >= DOTTED || rs == INSET) &&
+ (bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET));
- int y = _ty;
- int y2 = _ty + h;
+ int y = ty;
+ int y2 = ty + h;
if (renderRadii) {
y += topRight.height();
y2 -= bottomRight.height();
}
- drawBorder(p, _tx + w - style->borderRightWidth(), y, _tx + w, y2, BSRight, rc, style->color(), rs,
- ignore_top?0:style->borderTopWidth(),
- ignore_bottom?0:style->borderBottomWidth());
+ drawBorder(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rc, style->color(), rs,
+ ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
if (renderRadii && (!upperRightBorderStylesMatch || !lowerRightBorderStylesMatch)) {
- int topX = _tx + w - topRight.width() * 2;
- int topY = _ty;
- int bottomY = _ty + h - bottomRight.height() * 2;
- firstAngleStart = 0;
+ int topX = tx + w - topRight.width() * 2;
+ int topY = ty;
+ int bottomY = ty + h - bottomRight.height() * 2;
+ firstAngleStart = 0;
secondAngleStart = 315;
firstAngleSpan = secondAngleSpan = 45;
thickness = style->borderRightWidth() * 2;
-
+
bool applyTopInnerClip = (style->borderRightWidth() < topRight.width())
&& (style->borderTopWidth() < topRight.height())
&& (rs != DOUBLE || style->borderRightWidth() > 6);
if (applyTopInnerClip) {
- p->save();
- p->addInnerRoundedRectClip(IntRect(topX, topY, topRight.width() * 2, topRight.height() * 2),
- style->borderRightWidth());
+ graphicsContext->save();
+ graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topRight.width() * 2, topRight.height() * 2),
+ style->borderRightWidth());
}
-
+
// Draw top right arc
- drawBorderArc(p, topX, topY, thickness, topRight, firstAngleStart, firstAngleSpan,
- BSRight, rc, style->color(), rs, true);
+ drawBorderArc(graphicsContext, topX, topY, thickness, topRight, firstAngleStart, firstAngleSpan,
+ BSRight, rc, style->color(), rs, true);
if (applyTopInnerClip)
- p->restore();
-
+ graphicsContext->restore();
+
bool applyBottomInnerClip = (style->borderRightWidth() < bottomRight.width())
&& (style->borderBottomWidth() < bottomRight.height())
&& (rs != DOUBLE || style->borderRightWidth() > 6);
if (applyBottomInnerClip) {
- p->save();
- p->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomRight.width() * 2, bottomRight.height() * 2),
- style->borderRightWidth());
+ graphicsContext->save();
+ graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomRight.width() * 2, bottomRight.height() * 2),
+ style->borderRightWidth());
}
-
+
// Draw bottom right arc
- drawBorderArc(p, topX, bottomY, thickness, bottomRight, secondAngleStart, secondAngleSpan,
- BSRight, rc, style->color(), rs, false);
+ drawBorderArc(graphicsContext, topX, bottomY, thickness, bottomRight, secondAngleStart, secondAngleSpan,
+ BSRight, rc, style->color(), rs, false);
if (applyBottomInnerClip)
- p->restore();
+ graphicsContext->restore();
}
}
-
+
if (renderRadii)
- p->restore(); // Undo the clip.
+ graphicsContext->restore();
}
void RenderObject::addLineBoxRects(Vector<IntRect>&, unsigned startOffset, unsigned endOffset)
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
if (continuation()) {
- rects.append(IntRect(tx, ty - collapsedMarginTop(),
- width(), height()+collapsedMarginTop()+collapsedMarginBottom()));
- continuation()->absoluteRects(rects,
+ rects.append(IntRect(tx, ty - collapsedMarginTop(),
+ width(), height() + collapsedMarginTop() + collapsedMarginBottom()));
+ continuation()->absoluteRects(rects,
tx - xPos() + continuation()->containingBlock()->xPos(),
ty - yPos() + continuation()->containingBlock()->yPos());
- }
- else
+ } else
rects.append(IntRect(tx, ty, width(), height() + borderTopExtra() + borderBottomExtra()));
}
return result;
}
-void RenderObject::addPDFURLRect(GraphicsContext* p, IntRect rect)
+void RenderObject::addPDFURLRect(GraphicsContext* graphicsContext, IntRect rect)
{
Node* node = element();
if (node) {
- if (p) {
+ if (graphicsContext) {
if (rect.width() > 0 && rect.height() > 0) {
Element* element = static_cast<Element*>(node);
String href;
if (element->isLink())
href = element->getAttribute(hrefAttr);
-
+
if (!href.isNull()) {
KURL link = element->document()->completeURL(href.deprecatedString());
if (link.isValid())
- p->setURLForRect(link, rect);
+ graphicsContext->setURLForRect(link, rect);
}
}
}
}
-void RenderObject::addFocusRingRects(GraphicsContext* p, int _tx, int _ty)
+void RenderObject::addFocusRingRects(GraphicsContext* graphicsContext, int tx, int ty)
{
// For blocks inside inlines, we go ahead and include margins so that we run right up to the
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
if (continuation()) {
- p->addFocusRingRect(IntRect(_tx, _ty - collapsedMarginTop(), width(), height()+collapsedMarginTop()+collapsedMarginBottom()));
- continuation()->addFocusRingRects(p,
- _tx - xPos() + continuation()->containingBlock()->xPos(),
- _ty - yPos() + continuation()->containingBlock()->yPos());
- }
- else
- p->addFocusRingRect(IntRect(_tx, _ty, width(), height()));
+ graphicsContext->addFocusRingRect(IntRect(tx, ty - collapsedMarginTop(), width(), height() + collapsedMarginTop() + collapsedMarginBottom()));
+ continuation()->addFocusRingRects(graphicsContext,
+ tx - xPos() + continuation()->containingBlock()->xPos(),
+ ty - yPos() + continuation()->containingBlock()->yPos());
+ } else
+ graphicsContext->addFocusRingRect(IntRect(tx, ty, width(), height()));
}
-void RenderObject::paintOutline(GraphicsContext* p, int _tx, int _ty, int w, int h, const RenderStyle* style)
+void RenderObject::paintOutline(GraphicsContext* graphicsContext, int tx, int ty, int w, int h, const RenderStyle* style)
{
if (!hasOutline())
return;
-
+
int ow = style->outlineWidth();
EBorderStyle os = style->outlineStyle();
-
+
Color oc = style->outlineColor();
if (!oc.isValid())
oc = style->color();
-
+
int offset = style->outlineOffset();
-
+
if (style->outlineStyleIsAuto() || hasOutlineAnnotation()) {
if (!theme()->supportsFocusRing(style)) {
// Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
- p->initFocusRing(ow, offset);
+ graphicsContext->initFocusRing(ow, offset);
if (style->outlineStyleIsAuto())
- addFocusRingRects(p, _tx, _ty);
+ addFocusRingRects(graphicsContext, tx, ty);
else
- addPDFURLRect(p, p->focusRingBoundingRect());
- p->drawFocusRing(oc);
- p->clearFocusRing();
+ addPDFURLRect(graphicsContext, graphicsContext->focusRingBoundingRect());
+ graphicsContext->drawFocusRing(oc);
+ graphicsContext->clearFocusRing();
}
}
if (style->outlineStyleIsAuto() || style->outlineStyle() <= BHIDDEN)
return;
- _tx -= offset;
- _ty -= offset;
- w += 2*offset;
- h += 2*offset;
-
- drawBorder(p, _tx-ow, _ty-ow, _tx, _ty+h+ow, BSLeft,
- Color(oc), style->color(),
- os, ow, ow);
+ tx -= offset;
+ ty -= offset;
+ w += 2 * offset;
+ h += 2 * offset;
- drawBorder(p, _tx-ow, _ty-ow, _tx+w+ow, _ty, BSTop,
- Color(oc), style->color(),
- os, ow, ow);
+ drawBorder(graphicsContext, tx - ow, ty - ow, tx, ty + h + ow,
+ BSLeft, Color(oc), style->color(), os, ow, ow);
- drawBorder(p, _tx+w, _ty-ow, _tx+w+ow, _ty+h+ow, BSRight,
- Color(oc), style->color(),
- os, ow, ow);
+ drawBorder(graphicsContext, tx - ow, ty - ow, tx + w + ow, ty,
+ BSTop, Color(oc), style->color(), os, ow, ow);
- drawBorder(p, _tx-ow, _ty+h, _tx+w+ow, _ty+h+ow, BSBottom,
- Color(oc), style->color(),
- os, ow, ow);
+ drawBorder(graphicsContext, tx + w, ty - ow, tx + w + ow, ty + h + ow,
+ BSRight, Color(oc), style->color(), os, ow, ow);
+ drawBorder(graphicsContext, tx - ow, ty + h, tx + w + ow, ty + h + ow,
+ BSBottom, Color(oc), style->color(), os, ow, ow);
}
void RenderObject::paint(PaintInfo& /*paintInfo*/, int /*tx*/, int /*ty*/)
{
// Can't use view(), since we might be unrooted.
RenderObject* o = this;
- while ( o->parent() ) o = o->parent();
+ while (o->parent())
+ o = o->parent();
if (!o->isRenderView())
return;
- RenderView* c = static_cast<RenderView*>(o);
- if (c->printingMode())
+ RenderView* view = static_cast<RenderView*>(o);
+ if (view->printingMode())
return; // Don't repaint if we're printing.
- c->repaintViewRectangle(getAbsoluteRepaintRect(), immediate);
+ view->repaintViewRectangle(getAbsoluteRepaintRect(), immediate);
}
void RenderObject::repaintRectangle(const IntRect& r, bool immediate)
{
// Can't use view(), since we might be unrooted.
RenderObject* o = this;
- while ( o->parent() ) o = o->parent();
+ while (o->parent())
+ o = o->parent();
if (!o->isRenderView())
return;
- RenderView* c = static_cast<RenderView*>(o);
- if (c->printingMode())
+ RenderView* view = static_cast<RenderView*>(o);
+ if (view->printingMode())
return; // Don't repaint if we're printing.
IntRect absRect(r);
computeAbsoluteRepaintRect(absRect);
- c->repaintViewRectangle(absRect, immediate);
+ view->repaintViewRectangle(absRect, immediate);
}
bool RenderObject::repaintAfterLayoutIfNeeded(const IntRect& oldBounds, const IntRect& oldFullBounds)
{
- RenderView* c = view();
- if (c->printingMode())
+ RenderView* v = view();
+ if (v->printingMode())
return false; // Don't repaint if we're printing.
-
+
IntRect newBounds, newFullBounds;
getAbsoluteRepaintRectIncludingFloats(newBounds, newFullBounds);
if (newBounds == oldBounds && !selfNeedsLayout())
bool fullRepaint = selfNeedsLayout() || newBounds.location() != oldBounds.location() || mustRepaintBackgroundOrBorder();
if (fullRepaint) {
- c->repaintViewRectangle(oldFullBounds);
+ v->repaintViewRectangle(oldFullBounds);
if (newBounds != oldBounds)
- c->repaintViewRectangle(newFullBounds);
+ v->repaintViewRectangle(newFullBounds);
return true;
}
- // We didn't move, but we did change size. Invalidate the delta, which will consist of possibly
+ // We didn't move, but we did change size. Invalidate the delta, which will consist of possibly
// two rectangles (but typically only one).
int ow = style() ? style()->outlineSize() : 0;
int width = abs(newBounds.width() - oldBounds.width());
if (width)
- c->repaintViewRectangle(IntRect(min(newBounds.x() + newBounds.width(), oldBounds.x() + oldBounds.width()) - borderRight() - ow,
+ v->repaintViewRectangle(IntRect(min(newBounds.x() + newBounds.width(), oldBounds.x() + oldBounds.width()) - borderRight() - ow,
newBounds.y(),
width + borderRight() + ow,
max(newBounds.height(), oldBounds.height())));
int height = abs(newBounds.height() - oldBounds.height());
if (height)
- c->repaintViewRectangle(IntRect(newBounds.x(),
+ v->repaintViewRectangle(IntRect(newBounds.x(),
min(newBounds.bottom(), oldBounds.bottom()) - borderBottom() - ow,
max(newBounds.width(), oldBounds.width()),
height + borderBottom() + ow));
{
if (!needsLayout() || isText())
return;
-
+
bool blockWithInlineChildren = (isRenderBlock() && !isTable() && normalChildNeedsLayout() && childrenInline());
if (selfNeedsLayout()) {
repaint();
if (continuation() && !isInline())
r.inflateY(collapsedMarginTop());
-
- if (isInlineFlow())
- for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
+
+ if (isInlineFlow()) {
+ for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
if (!curr->isText())
r.unite(curr->getAbsoluteRepaintRectWithOutline(ow));
+ }
+ }
return r;
}
DeprecatedString str;
TextStream ts(&str);
ts << renderName()
- << "(" << (style() ? style()->refCount() : 0) << ")"
+ << "(" << (style() ? style()->refCount() : 0) << ")"
<< ": " << (void*)this << " ";
- if (isInline()) ts << "il ";
- if (childrenInline()) ts << "ci ";
- if (isFloating()) ts << "fl ";
- if (isAnonymous()) ts << "an ";
- if (isRelPositioned()) ts << "rp ";
- if (isPositioned()) ts << "ps ";
- if (needsLayout()) ts << "nl ";
- if (m_recalcMinMax) ts << "rmm ";
- if (style() && style()->zIndex()) ts << "zI: " << style()->zIndex();
+ if (isInline())
+ ts << "il ";
+ if (childrenInline())
+ ts << "ci ";
+ if (isFloating())
+ ts << "fl ";
+ if (isAnonymous())
+ ts << "an ";
+ if (isRelPositioned())
+ ts << "rp ";
+ if (isPositioned())
+ ts << "ps ";
+ if (needsLayout())
+ ts << "nl ";
+ if (m_recalcMinMax)
+ ts << "rmm ";
+ if (style() && style()->zIndex())
+ ts << "zI: " << style()->zIndex();
if (element()) {
if (element()->active())
ts << "act ";
ts << "anchor ";
if (element()->focused())
ts << "focus ";
- ts << " <" << element()->localName().deprecatedString() << ">";
+ ts << " <" << element()->localName().deprecatedString() << ">";
ts << " (" << xPos() << "," << yPos() << "," << width() << "," << height() << ")";
if (isTableCell()) {
- const RenderTableCell* cell = static_cast<const RenderTableCell *>(this);
+ const RenderTableCell* cell = static_cast<const RenderTableCell*>(this);
ts << " [r=" << cell->row() << " c=" << cell->col() << " rs=" << cell->rowSpan() << " cs=" << cell->colSpan() << "]";
}
}
return str;
}
-void RenderObject::dump(TextStream *stream, DeprecatedString ind) const
+void RenderObject::dump(TextStream* stream, DeprecatedString ind) const
{
- if (isAnonymous()) { *stream << " anonymous"; }
- if (isFloating()) { *stream << " floating"; }
- if (isPositioned()) { *stream << " positioned"; }
- if (isRelPositioned()) { *stream << " relPositioned"; }
- if (isText()) { *stream << " text"; }
- if (isInline()) { *stream << " inline"; }
- if (isReplaced()) { *stream << " replaced"; }
- if (shouldPaintBackgroundOrBorder()) { *stream << " paintBackground"; }
- if (needsLayout()) { *stream << " needsLayout"; }
- if (minMaxKnown()) { *stream << " minMaxKnown"; }
+ if (isAnonymous())
+ *stream << " anonymous";
+ if (isFloating())
+ *stream << " floating";
+ if (isPositioned())
+ *stream << " positioned";
+ if (isRelPositioned())
+ *stream << " relPositioned";
+ if (isText())
+ *stream << " text";
+ if (isInline())
+ *stream << " inline";
+ if (isReplaced())
+ *stream << " replaced";
+ if (shouldPaintBackgroundOrBorder())
+ *stream << " paintBackground";
+ if (needsLayout())
+ *stream << " needsLayout";
+ if (minMaxKnown())
+ *stream << " minMaxKnown";
*stream << endl;
- RenderObject *child = firstChild();
- while( child != 0 )
- {
+ RenderObject* child = firstChild();
+ while (child) {
*stream << ind << child->renderName() << ": ";
- child->dump(stream,ind+" ");
+ child->dump(stream, ind + " ");
child = child->nextSibling();
}
}
element()->showTreeForThis();
}
-#endif
+#endif // NDEBUG
-static Node *selectStartNode(const RenderObject *object)
+static Node* selectStartNode(const RenderObject* object)
{
- Node *node = 0;
+ Node* node = 0;
bool forcedOn = false;
- for (const RenderObject *curr = object; curr; curr = curr->parent()) {
+ for (const RenderObject* curr = object; curr; curr = curr->parent()) {
if (curr->style()->userSelect() == SELECT_TEXT)
forcedOn = true;
if (!forcedOn && curr->style()->userSelect() == SELECT_NONE)
bool RenderObject::shouldSelect() const
{
- if (Node *node = selectStartNode(this))
+ if (Node* node = selectStartNode(this))
return EventTargetNodeCast(node)->dispatchHTMLEvent(selectstartEvent, true, true);
return false;
const RenderObject* curr = this;
while (curr) {
- Node *elt = curr->element();
+ Node* elt = curr->element();
if (elt && elt->nodeType() == Node::TEXT_NODE) {
// Since there's no way for the author to address the -webkit-user-drag style for a text node,
// we use our own judgement.
if (uaOK && view()->frameView()->frame()->shouldDragAutoNode(curr->node(), IntPoint(x, y))) {
dhtmlWillDrag = false;
return curr->node();
- } else if (curr->shouldSelect()) {
+ } else if (curr->shouldSelect())
// In this case we have a click in the unselected portion of text. If this text is
// selectable, we want to start the selection process instead of looking for a parent
// to try to drag.
return 0;
- }
} else {
EUserDrag dragMode = curr->style()->userDrag();
if (dhtmlOK && dragMode == DRAG_ELEMENT) {
RenderBlock* RenderObject::createAnonymousBlock()
{
- RenderStyle *newStyle = new (renderArena()) RenderStyle();
+ RenderStyle* newStyle = new (renderArena()) RenderStyle();
newStyle->inheritFrom(m_style);
newStyle->setDisplay(BLOCK);
- RenderBlock *newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
+ RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
newBox->setStyle(newStyle);
return newBox;
}
// We have to split the parent flow.
RenderInline* parentInline = static_cast<RenderInline*>(parent());
RenderBlock* newBox = parentInline->createAnonymousBlock();
-
+
RenderFlow* oldContinuation = parent()->continuation();
parentInline->setContinuation(newBox);
RenderObject* beforeChild = nextSibling();
parent()->removeChildNode(this);
parentInline->splitFlow(beforeChild, newBox, this, oldContinuation);
- }
- else if (parent()->isRenderBlock())
+ } else if (parent()->isRenderBlock())
static_cast<RenderBlock*>(parent())->makeChildrenNonInline();
- }
- else {
+ } else {
// An anonymous block must be made to wrap this inline.
RenderBlock* box = createAnonymousBlock();
parent()->insertChildNode(box, this);
}
}
-void RenderObject::setStyle(RenderStyle *style)
+void RenderObject::setStyle(RenderStyle* style)
{
if (m_style == style)
return;
if (style) {
#if PLATFORM(MAC)
if (m_style->visibility() != style->visibility() ||
- m_style->zIndex() != style->zIndex() ||
- m_style->hasAutoZIndex() != style->hasAutoZIndex())
+ m_style->zIndex() != style->zIndex() ||
+ m_style->hasAutoZIndex() != style->hasAutoZIndex())
document()->setDashboardRegionsDirty(true);
#endif
if ((m_style->hasAutoZIndex() != style->hasAutoZIndex() ||
- m_style->zIndex() != style->zIndex() ||
- m_style->visibility() != style->visibility()) && layer()) {
+ m_style->zIndex() != style->zIndex() ||
+ m_style->visibility() != style->visibility()) && layer()) {
layer()->stackingContext()->dirtyZOrderLists();
if (m_style->hasAutoZIndex() != style->hasAutoZIndex() ||
- m_style->visibility() != style->visibility())
+ m_style->visibility() != style->visibility())
layer()->dirtyZOrderLists();
}
// keep layer hierarchy visibility bits up to date if visibility changes
if (m_style->visibility() != style->visibility()) {
- RenderLayer* l = enclosingLayer();
+ RenderLayer* l = enclosingLayer();
if (style->visibility() == VISIBLE && l)
l->setHasVisibleContent(true);
- else if (l && l->hasVisibleContent() &&
- (this == l->renderer() || l->renderer()->style()->visibility() != VISIBLE))
+ else if (l && l->hasVisibleContent() &&
+ (this == l->renderer() || l->renderer()->style()->visibility() != VISIBLE))
l->dirtyVisibleContentStatus();
- }
+ }
}
d = m_style->diff(style);
// If we have no layer(), just treat a RepaintLayer hint as a normal Repaint.
if (d == RenderStyle::RepaintLayer && !layer())
d = RenderStyle::Repaint;
-
+
// The background of the root element or the body element could propagate up to
// the canvas. Just dirty the entire canvas when our style changes substantially.
if (d >= RenderStyle::Repaint && element() &&
- (element()->hasTagName(htmlTag) || element()->hasTagName(bodyTag)))
+ (element()->hasTagName(htmlTag) || element()->hasTagName(bodyTag)))
view()->repaint();
else if (m_parent && !isText()) {
// Do a repaint with the old style first, e.g., for example if we go from
// When a layout hint happens, we go ahead and do a repaint of the layer, since the layer could
// end up being destroyed.
if (d == RenderStyle::Layout && layer() &&
- (m_style->position() != style->position() ||
- m_style->zIndex() != style->zIndex() ||
- m_style->hasAutoZIndex() != style->hasAutoZIndex() ||
- !(m_style->clip() == style->clip()) ||
- m_style->hasClip() != style->hasClip() ||
- m_style->opacity() != style->opacity()))
+ (m_style->position() != style->position() ||
+ m_style->zIndex() != style->zIndex() ||
+ m_style->hasAutoZIndex() != style->hasAutoZIndex() ||
+ !(m_style->clip() == style->clip()) ||
+ m_style->hasClip() != style->hasClip() ||
+ m_style->opacity() != style->opacity()))
layer()->repaintIncludingDescendants();
// When a layout hint happens and an object's position style changes, we have to do a layout
if (m_style->position() == StaticPosition)
repaint();
if (isRenderBlock()) {
- if (style->position() == StaticPosition) {
+ if (style->position() == StaticPosition)
// Clear our positioned objects list. Our absolutely positioned descendants will be
// inserted into our containing block's positioned objects list during layout.
removePositionedObjects(0);
- } else if (m_style->position() == StaticPosition) {
+ else if (m_style->position() == StaticPosition) {
// Remove our absolutely positioned descendants from their current containing block.
// They will be inserted into our positioned objects list during layout.
RenderObject* cb = parent();
while (cb && (cb->style()->position() == StaticPosition || (cb->isInline() && !cb->isReplaced())) && !cb->isRoot() && !cb->isRenderView()) {
if (cb->style()->position() == RelativePosition && cb->isInline() && !cb->isReplaced()) {
- cb = cb->containingBlock();
+ cb = cb->containingBlock();
break;
}
cb = cb->parent();
}
}
}
-
+
if (isFloating() && (m_style->floating() != style->floating()))
// For changes in float styles, we need to conceivably remove ourselves
// from the floating objects list.
// For changes in positioning styles, we need to conceivably remove ourselves
// from the positioned objects list.
removeFromObjectLists();
-
+
affectsParentBlock = m_style && isFloatingOrPositioned() &&
(!style->isFloating() && style->position() != AbsolutePosition && style->position() != FixedPosition)
&& parent() && (parent()->isBlockFlow() || parent()->isInlineFlow());
-
+
// reset style flags
m_floating = false;
m_positioned = false;
}
}
- RenderStyle *oldStyle = m_style;
+ RenderStyle* oldStyle = m_style;
m_style = style;
updateBackgroundImages(oldStyle);
-
+
if (m_style)
m_style->ref();
-
+
if (oldStyle)
oldStyle->deref(renderArena());
if (affectsParentBlock)
handleDynamicFloatPositionChange();
-
+
// No need to ever schedule repaints from a style change of a text run, since
// we already did this for the parent of the text run.
if (d == RenderStyle::Layout && m_parent)
repaint();
}
-void RenderObject::setStyleInternal(RenderStyle* st)
+void RenderObject::setStyleInternal(RenderStyle* style)
{
- if (m_style == st)
+ if (m_style == style)
return;
if (m_style)
m_style->deref(renderArena());
- m_style = st;
+ m_style = style;
if (m_style)
m_style->ref();
}
if (currNew->backgroundImage() && (!oldLayers || !oldLayers->containsImage(currNew->backgroundImage())))
currNew->backgroundImage()->ref(this);
}
-
+
CachedImage* oldBorderImage = oldStyle ? oldStyle->borderImage().image() : 0;
CachedImage* newBorderImage = m_style ? m_style->borderImage().image() : 0;
if (oldBorderImage != newBorderImage) {
return view()->viewRect();
}
-bool RenderObject::absolutePosition(int &xPos, int &yPos, bool f)
+bool RenderObject::absolutePosition(int& xPos, int& yPos, bool f)
{
RenderObject* o = parent();
if (o) {
o->absolutePosition(xPos, yPos, f);
yPos += o->borderTopExtra();
if (o->hasOverflowClip())
- o->layer()->subtractScrollOffset(xPos, yPos);
+ o->layer()->subtractScrollOffset(xPos, yPos);
return true;
- }
- else
- {
+ } else {
xPos = yPos = 0;
return false;
}
}
-IntRect RenderObject::caretRect(int offset, EAffinity affinity, int *extraWidthToEndOfLine)
+IntRect RenderObject::caretRect(int offset, EAffinity affinity, int* extraWidthToEndOfLine)
{
if (extraWidthToEndOfLine)
*extraWidthToEndOfLine = 0;
if (padding.isPercent())
w = containingBlock()->contentWidth();
w = padding.calcMinValue(w);
- if ( isTableCell() && padding.isAuto() )
- w = static_cast<const RenderTableCell *>(this)->table()->cellPadding();
+ if (isTableCell() && padding.isAuto())
+ w = static_cast<const RenderTableCell*>(this)->table()->cellPadding();
return w;
}
if (padding.isPercent())
w = containingBlock()->contentWidth();
w = padding.calcMinValue(w);
- if ( isTableCell() && padding.isAuto() )
- w = static_cast<const RenderTableCell *>(this)->table()->cellPadding();
+ if (isTableCell() && padding.isAuto())
+ w = static_cast<const RenderTableCell*>(this)->table()->cellPadding();
return w;
}
if (padding.isPercent())
w = containingBlock()->contentWidth();
w = padding.calcMinValue(w);
- if ( isTableCell() && padding.isAuto() )
- w = static_cast<const RenderTableCell *>(this)->table()->cellPadding();
+ if (isTableCell() && padding.isAuto())
+ w = static_cast<const RenderTableCell*>(this)->table()->cellPadding();
return w;
}
if (padding.isPercent())
w = containingBlock()->contentWidth();
w = padding.calcMinValue(w);
- if ( isTableCell() && padding.isAuto() )
- w = static_cast<const RenderTableCell *>(this)->table()->cellPadding();
+ if (isTableCell() && padding.isAuto())
+ w = static_cast<const RenderTableCell*>(this)->table()->cellPadding();
return w;
}
{
if (style()->collapseWhiteSpace())
return 0;
-
+
return containingBlock()->tabWidth(true);
}
return element() && element()->isLink() && document()->printing();
}
-RenderObject *RenderObject::container() const
+RenderObject* RenderObject::container() const
{
// This method is extremely similar to containingBlock(), but with a few notable
// exceptions.
// the layout of the positioned object. This does mean that calcAbsoluteHorizontal and
// calcAbsoluteVertical have to use container().
EPosition pos = m_style->position();
- RenderObject *o = 0;
+ RenderObject* o = parent();
if (!isText() && pos == FixedPosition) {
// container() can be called on an object that is not in the
// tree yet. We don't call view() since it will assert if it
// as we can. If we're in the tree, we'll get the root. If we
// aren't we'll get the root of our little subtree (most likely
// we'll just return 0).
- o = parent();
- while (o && o->parent()) o = o->parent();
- }
- else if (!isText() && pos == AbsolutePosition) {
+ while (o && o->parent())
+ o = o->parent();
+ } else if (!isText() && pos == AbsolutePosition) {
// Same goes here. We technically just want our containing block, but
// we may not have one if we're part of an uninstalled subtree. We'll
// climb as high as we can though.
- o = parent();
while (o && o->style()->position() == StaticPosition && !o->isRenderView())
o = o->parent();
}
- else
- o = parent();
+
return o;
}
return st == SelectionStart || st == SelectionEnd || st == SelectionBoth;
}
-
void RenderObject::removeFromObjectLists()
{
if (documentBeingDestroyed())
if (p->containsFloat(this))
outermostBlock = p;
}
-
+
if (outermostBlock)
outermostBlock->markAllDescendantsWithFloatsForLayout(this);
}
if (isPositioned()) {
- RenderObject *p;
+ RenderObject* p;
for (p = parent(); p; p = p->parent()) {
if (p->isRenderBlock())
static_cast<RenderBlock*>(p)->removePositionedObject(this);
delete counterNodesMap;
}
}
-
+
document()->axObjectCache()->remove(this);
// By default no ref-counting. RenderWidget::destroy() doesn't call
// this function because it needs to do ref-counting. If anything
- // in this function changes, be sure to fix RenderWidget::destroy() as well.
+ // in this function changes, be sure to fix RenderWidget::destroy() as well.
remove();
-
+
arenaDelete(document()->renderArena(), this);
}
-void RenderObject::arenaDelete(RenderArena *arena, void *base)
+void RenderObject::arenaDelete(RenderArena* arena, void* base)
{
if (m_style->backgroundImage())
m_style->backgroundImage()->deref(this);
if (m_style)
m_style->deref(arena);
-
+
#ifndef NDEBUG
- void *savedBase = baseOfRenderObjectBeingDeleted;
+ void* savedBase = baseOfRenderObjectBeingDeleted;
baseOfRenderObjectBeingDeleted = base;
#endif
delete this;
#ifndef NDEBUG
baseOfRenderObjectBeingDeleted = savedBase;
#endif
-
+
// Recover the size left there for us by operator delete and free the memory.
- arena->free(*(size_t *)base, base);
+ arena->free(*(size_t*)base, base);
}
VisiblePosition RenderObject::positionForCoordinates(int x, int y)
return VisiblePosition(element(), caretMinOffset(), DOWNSTREAM);
}
-bool RenderObject::isDragging() const
-{
- return m_isDragging;
-}
-
void RenderObject::updateDragState(bool dragOn)
{
bool valueChanged = (dragOn != m_isDragging);
if (hitTestFilter != HitTestSelf) {
// First test the foreground layer (lines and inlines).
inside = nodeAtPoint(request, result, x, y, tx, ty, HitTestForeground);
-
+
// Test floats next.
if (!inside)
inside = nodeAtPoint(request, result, x, y, tx, ty, HitTestFloat);
if (!inside)
inside = nodeAtPoint(request, result, x, y, tx, ty, HitTestChildBlockBackgrounds);
}
-
+
// See if the mouse is inside us but not any of our descendants
if (hitTestFilter != HitTestDescendants && !inside)
inside = nodeAtPoint(request, result, x, y, tx, ty, HitTestBlockBackground);
-
+
return inside;
}
// this case we're actually still inside the enclosing inline element that was
// split. Go ahead and set our inner node accordingly.
node = continuation()->element();
-
+
if (node) {
result.setInnerNode(node);
if (!result.innerNonSharedNode())
}
}
-bool RenderObject::nodeAtPoint(const HitTestRequest& request, HitTestResult& result,
- int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction)
+bool RenderObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, int /*x*/, int /*y*/, int /*tx*/, int /*ty*/, HitTestAction)
{
return false;
}
-short RenderObject::verticalPositionHint( bool firstLine ) const
+short RenderObject::verticalPositionHint(bool firstLine) const
{
short vpos = m_verticalPosition;
- if ( m_verticalPosition == PositionUndefined || firstLine ) {
- vpos = getVerticalPosition( firstLine );
- if ( !firstLine )
+ if (m_verticalPosition == PositionUndefined || firstLine) {
+ vpos = getVerticalPosition(firstLine);
+ if (!firstLine)
m_verticalPosition = vpos;
}
- return vpos;
+ return vpos;
}
-short RenderObject::getVerticalPosition( bool firstLine ) const
+short RenderObject::getVerticalPosition(bool firstLine) const
{
if (!isInline())
return 0;
// This method determines the vertical position for inline elements.
int vpos = 0;
EVerticalAlign va = style()->verticalAlign();
- if ( va == TOP ) {
+ if (va == TOP)
vpos = PositionTop;
- } else if ( va == BOTTOM ) {
+ else if (va == BOTTOM)
vpos = PositionBottom;
- } else if ( va == LENGTH ) {
- vpos = -style()->verticalAlignLength().calcValue( lineHeight( firstLine ) );
- } else {
+ else if (va == LENGTH)
+ vpos = -style()->verticalAlignLength().calcValue(lineHeight(firstLine));
+ else {
bool checkParent = parent()->isInline() && !parent()->isInlineBlockOrInlineTable() && parent()->style()->verticalAlign() != TOP && parent()->style()->verticalAlign() != BOTTOM;
- vpos = checkParent ? parent()->verticalPositionHint( firstLine ) : 0;
+ vpos = checkParent ? parent()->verticalPositionHint(firstLine) : 0;
// don't allow elements nested inside text-top to have a different valignment.
- if ( va == BASELINE )
+ if (va == BASELINE)
return vpos;
- const Font &f = parent()->font(firstLine);
+ const Font& f = parent()->font(firstLine);
int fontsize = f.pixelSize();
-
+
if (va == SUB)
- vpos += fontsize/5 + 1;
+ vpos += fontsize / 5 + 1;
else if (va == SUPER)
- vpos -= fontsize/3 + 1;
+ vpos -= fontsize / 3 + 1;
else if (va == TEXT_TOP)
vpos += baselinePosition(firstLine) - f.ascent();
else if (va == MIDDLE)
- vpos += - (int)(f.xHeight()/2) - lineHeight( firstLine )/2 + baselinePosition( firstLine );
+ vpos += -static_cast<int>(f.xHeight() / 2) - lineHeight(firstLine) / 2 + baselinePosition(firstLine);
else if (va == TEXT_BOTTOM) {
vpos += f.descent();
if (!isReplaced())
vpos -= font(firstLine).descent();
- } else if ( va == BASELINE_MIDDLE )
- vpos += - lineHeight( firstLine )/2 + baselinePosition( firstLine );
+ } else if (va == BASELINE_MIDDLE)
+ vpos += -lineHeight(firstLine) / 2 + baselinePosition(firstLine);
}
-
+
return vpos;
}
-short RenderObject::lineHeight( bool firstLine, bool ) const
+short RenderObject::lineHeight(bool firstLine, bool /*isRootLineBox*/) const
{
RenderStyle* s = style(firstLine);
-
+
Length lh = s->lineHeight();
// its "unset", choose nice default
void RenderObject::invalidateVerticalPositions()
{
m_verticalPosition = PositionUndefined;
- RenderObject *child = firstChild();
- while( child ) {
+ RenderObject* child = firstChild();
+ while(child) {
child->invalidateVerticalPositions();
child = child->nextSibling();
}
void RenderObject::recalcMinMaxWidths()
{
- ASSERT( m_recalcMinMax );
-
-#ifdef DEBUG_LAYOUT
- kdDebug( 6040 ) << renderName() << " recalcMinMaxWidths() this=" << this <<endl;
-#endif
+ ASSERT(m_recalcMinMax);
if (m_recalcMinMax)
updateFirstLetter();
-
- RenderObject *child = firstChild();
- while( child ) {
+
+ RenderObject* child = firstChild();
+ while (child) {
int cmin = 0;
int cmax = 0;
bool test = false;
- if ( ( m_minMaxKnown && child->m_recalcMinMax ) || !child->m_minMaxKnown ) {
+ if ((m_minMaxKnown && child->m_recalcMinMax) || !child->m_minMaxKnown) {
cmin = child->minWidth();
cmax = child->maxWidth();
test = true;
}
- if ( child->m_recalcMinMax )
+ if (child->m_recalcMinMax)
child->recalcMinMaxWidths();
- if ( !child->m_minMaxKnown )
+ if (!child->m_minMaxKnown)
child->calcMinMaxWidth();
- if ( m_minMaxKnown && test && (cmin != child->minWidth() || cmax != child->maxWidth()) )
+ if (m_minMaxKnown && test && (cmin != child->minWidth() || cmax != child->maxWidth()))
m_minMaxKnown = false;
child = child->nextSibling();
}
if ((!isInline() || isInlineBlockOrInlineTable()) && childrenInline())
m_minMaxKnown = false;
- if ( !m_minMaxKnown )
+ if (!m_minMaxKnown)
calcMinMaxWidth();
m_recalcMinMax = false;
}
void RenderObject::scheduleRelayout()
{
- if (isRenderView()) {
- FrameView* view = static_cast<RenderView*>(this)->frameView();
- if (view)
- view->scheduleRelayout();
- } else {
- FrameView* v = view() ? view()->frameView() : 0;
- if (v)
- v->scheduleRelayoutOfSubtree(node());
- }
+ if (isRenderView()) {
+ FrameView* view = static_cast<RenderView*>(this)->frameView();
+ if (view)
+ view->scheduleRelayout();
+ } else {
+ FrameView* v = view() ? view()->frameView() : 0;
+ if (v)
+ v->scheduleRelayoutOfSubtree(node());
+ }
}
-
void RenderObject::removeLeftoverAnonymousBoxes()
{
}
return 0;
}
-void RenderObject::setInlineBoxWrapper(InlineBox* b)
+void RenderObject::setInlineBoxWrapper(InlineBox*)
{
}
{
}
-RenderStyle* RenderObject::firstLineStyle() const
+RenderStyle* RenderObject::firstLineStyle() const
{
- RenderStyle *s = m_style;
+ RenderStyle* s = m_style;
const RenderObject* obj = isText() ? parent() : this;
if (obj->isBlockFlow()) {
RenderBlock* firstLineBlock = obj->firstLineBlock();
{
if (!style()->hasPseudoStyle(pseudo))
return 0;
-
+
if (!parentStyle)
parentStyle = style();
RenderStyle* result = style()->getPseudoStyle(pseudo);
if (result)
return result;
-
+
Node* node = element();
if (isText())
node = element()->parentNode();
if (!node)
return 0;
-
+
if (pseudo == RenderStyle::FIRST_LINE_INHERITED) {
result = document()->styleSelector()->styleForElement(static_cast<Element*>(node), parentStyle, false);
result->setStyleType(RenderStyle::FIRST_LINE_INHERITED);
overline = curr->style()->color();
if (decorations & LINE_THROUGH)
linethrough = curr->style()->color();
- }
+ }
}
void RenderObject::updateWidgetPosition()
void RenderObject::addDashboardRegions(Vector<DashboardRegionValue>& regions)
{
// Convert the style regions to absolute coordinates.
- if (style()->visibility() != VISIBLE)
+ if (style()->visibility() != VISIBLE)
return;
const Vector<StyleDashboardRegion>& styleRegions = style()->dashboardRegions();
unsigned i, count = styleRegions.size();
- for (i = 0; i < count; i++){
+ for (i = 0; i < count; i++) {
StyleDashboardRegion styleRegion = styleRegions[i];
-
+
int w = width();
int h = height();
-
+
DashboardRegionValue region;
region.label = styleRegion.label;
- region.bounds = IntRect (
- styleRegion.offset.left.value(),
- styleRegion.offset.top.value(),
- w - styleRegion.offset.left.value() - styleRegion.offset.right.value(),
- h - styleRegion.offset.top.value() - styleRegion.offset.bottom.value());
+ region.bounds = IntRect(styleRegion.offset.left.value(),
+ styleRegion.offset.top.value(),
+ w - styleRegion.offset.left.value() - styleRegion.offset.right.value(),
+ h - styleRegion.offset.top.value() - styleRegion.offset.bottom.value());
region.type = styleRegion.type;
region.clip = region.bounds;
absolutePosition(x, y);
region.bounds.setX(x + styleRegion.offset.left.value());
region.bounds.setY(y + styleRegion.offset.top.value());
-
+
if (document()->frame()) {
float pageScaleFactor = document()->frame()->page()->chrome()->scaleFactor();
if (pageScaleFactor != 1.0f) {
region.clip.scale(pageScaleFactor);
}
}
-
+
regions.append(region);
}
}
// so we don't want to include them.
if (isText())
return;
-
+
addDashboardRegions(regions);
for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
curr->collectDashboardRegions(regions);
}
-
void RenderObject::collectBorders(DeprecatedValueList<CollapsedBorderValue>& borderStyles)
{
for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
bool RenderObject::avoidsFloats() const
{
- return isReplaced() || hasOverflowClip() || isHR();
+ return isReplaced() || hasOverflowClip() || isHR();
}
bool RenderObject::usesLineWidth() const
}
CounterNode* RenderObject::findCounter(const String& counterName, bool willNeedLayout,
- bool usesSeparator, bool createIfNotFound)
+ bool usesSeparator, bool createIfNotFound)
{
if (!style())
return 0;
RenderObjectsToCounterNodeMaps* objectsMap = getRenderObjectsToCounterNodeMaps();
CounterNode* newNode = 0;
- if (CounterNodeMap* counterNodesMap = objectsMap->get(this))
+ if (CounterNodeMap* counterNodesMap = objectsMap->get(this)) {
if (counterNodesMap)
newNode = counterNodesMap->get(counterName);
-
+ }
+
if (newNode)
return newNode;
newNode = new CounterResetNode(this);
val = v.toInt();
}
- }
-
+ }
+
if (!newNode) {
newNode = new CounterNode(this);
val = 1;
newNode = new CounterResetNode(this);
newNode->setValue(0);
}
- }
-
+ }
+
if (!newNode && !createIfNotFound)
return 0;
else if (!newNode) {
objectsMap->set(this, nodeMap);
m_hasCounterNodeMap = true;
}
-
+
nodeMap->set(counterName, newNode);
if (!isRoot()) {
if (current)
break;
}
-
+
CounterNode* last = current;
CounterNode* sibling = current;
if (last && !newNode->isReset()) {
}
n = n->previousSibling();
}
-
+
if (sibling->isReset()) {
if (last != sibling)
sibling->insertAfter(newNode, last);
UChar RenderObject::backslashAsCurrencySymbol() const
{
- if (Node *node = element())
- if (TextResourceDecoder *decoder = node->document()->decoder())
+ if (Node *node = element()) {
+ if (TextResourceDecoder* decoder = node->document()->decoder())
return decoder->encoding().backslashAsCurrencySymbol();
+ }
return '\\';
}
-void RenderObject::imageChanged(CachedImage *image)
+void RenderObject::imageChanged(CachedImage* image)
{
// Repaint when the background image or border image finishes loading.
// This is needed for RenderBox objects, and also for table objects that hold
// would avoid putting this function and the CachedResourceClient base class into RenderObject.
if (image && image->canRender() && parent()) {
if (view() && element() && (element()->hasTagName(htmlTag) || element()->hasTagName(bodyTag)))
- view()->repaint(); // repaint the entire canvas since the background gets propagated up
+ // repaint the entire canvas since the background gets propagated up
+ view()->repaint();
else
- repaint(); // repaint object, which is a box or a container with boxes inside it
+ // repaint object, which is a box or a container with boxes inside it
+ repaint();
}
}
return 0;
}
-int RenderObject::previousOffset (int current) const
+int RenderObject::previousOffset(int current) const
{
int previousOffset = current - 1;
return previousOffset;
}
-int RenderObject::nextOffset (int current) const
+int RenderObject::nextOffset(int current) const
{
int nextOffset = current + 1;
return nextOffset;
}
-InlineBox *RenderObject::inlineBox(int offset, EAffinity affinity)
+InlineBox* RenderObject::inlineBox(int offset, EAffinity affinity)
{
return inlineBoxWrapper();
}
{
return AffineTransform(1, 0, 0, 1, xPos(), yPos());
}
-
+
void RenderObject::setLocalTransform(const AffineTransform&)
{
ASSERT(false);
return localTransform();
}
-#endif
+#endif // SVG_SUPPORT
-}
+} // namespace WebCore
#ifndef NDEBUG
#include "RenderStyle.h"
#include "ScrollBar.h"
#include "VisiblePosition.h"
+#include <algorithm>
#include <wtf/HashMap.h>
/*
class FloatRect;
class FrameView;
class HTMLAreaElement;
+class HitTestResult;
class InlineBox;
class InlineFlowBox;
-class HitTestResult;
class PlatformScrollbar;
class Position;
class RenderArena;
class String;
class TextStream;
class VisiblePosition;
-
struct HitTestRequest;
enum PaintPhase {
HitTestForeground
};
-struct DashboardRegionValue
-{
- String label;
- IntRect bounds;
- IntRect clip;
- int type;
+enum VerticalPositionHint {
+ PositionTop = -0x4000,
+ PositionBottom = 0x4000,
+ PositionUndefined = 0x3fff
+};
+struct DashboardRegionValue {
bool operator==(const DashboardRegionValue& o) const
{
return type == o.type && bounds == o.bounds && label == o.label;
}
+
+ String label;
+ IntRect bounds;
+ IntRect clip;
+ int type;
};
// FIXME: This should be a HashSequencedSet, but we don't have that data structure yet.
/**
* Base Class for all rendering tree objects.
*/
-class RenderObject : public CachedResourceClient
-{
+class RenderObject : public CachedResourceClient {
+ friend class RenderListItem;
+ friend class RenderContainer;
+ friend class RenderView;
public:
// Anonymous objects should pass the document as their node, and they will then automatically be
// marked as anonymous in the constructor.
- RenderObject(Node* node);
+ RenderObject(Node*);
virtual ~RenderObject();
- RenderObject *parent() const { return m_parent; }
- bool isDescendantOf(const RenderObject *obj) const;
+ virtual const char* renderName() const { return "RenderObject"; }
- RenderObject *previousSibling() const { return m_previous; }
- RenderObject *nextSibling() const { return m_next; }
+ RenderObject* parent() const { return m_parent; }
+ bool isDescendantOf(const RenderObject*) const;
- virtual RenderObject *firstChild() const { return 0; }
- virtual RenderObject *lastChild() const { return 0; }
+ RenderObject* previousSibling() const { return m_previous; }
+ RenderObject* nextSibling() const { return m_next; }
+
+ virtual RenderObject* firstChild() const { return 0; }
+ virtual RenderObject* lastChild() const { return 0; }
RenderObject* nextInPreOrder() const;
RenderObject* nextInPreOrderAfterChildren() const;
RenderObject* previousInPreOrder() const;
RenderObject* childAt(unsigned) const;
- RenderObject *nextEditable() const;
- RenderObject *previousEditable() const;
+ RenderObject* nextEditable() const;
+ RenderObject* previousEditable() const;
+
+ RenderObject* firstLeafChild() const;
+ RenderObject* lastLeafChild() const;
- RenderObject *firstLeafChild() const;
- RenderObject *lastLeafChild() const;
-
virtual RenderLayer* layer() const { return 0; }
RenderLayer* enclosingLayer() const;
void addLayers(RenderLayer* parentLayer, RenderObject* newObject);
void removeLayers(RenderLayer* parentLayer);
void moveLayers(RenderLayer* oldParent, RenderLayer* newParent);
- RenderLayer* findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint,
- bool checkParent=true);
+ RenderLayer* findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, bool checkParent = true);
virtual void positionChildLayers() { }
virtual bool requiresLayer();
-
- virtual IntRect getOverflowClipRect(int tx, int ty) { return IntRect(0,0,0,0); }
- virtual IntRect getClipRect(int tx, int ty) { return IntRect(0,0,0,0); }
+
+ virtual IntRect getOverflowClipRect(int /*tx*/, int /*ty*/) { return IntRect(0, 0, 0, 0); }
+ virtual IntRect getClipRect(int /*tx*/, int /*ty*/) { return IntRect(0, 0, 0, 0); }
bool hasClip() { return isPositioned() && style()->hasClip(); }
-
- virtual int getBaselineOfFirstLineBox() const { return -1; }
+
+ virtual int getBaselineOfFirstLineBox() const { return -1; }
virtual int getBaselineOfLastLineBox() const { return -1; }
+
virtual bool isEmpty() const { return firstChild() == 0; }
-
+
virtual bool isEdited() const { return false; }
- virtual void setEdited(bool) { return; };
-
+ virtual void setEdited(bool) { }
+
// Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
// children.
virtual RenderBlock* firstLineBlock() const;
virtual void updateFirstLetter();
-
+
// Called when an object that was floating or positioned becomes a normal flow object
// again. We have to make sure the render tree updates as needed to accommodate the new
// normal flow object.
// This function is a convenience helper for creating an anonymous block that inherits its
// style from this RenderObject.
RenderBlock* createAnonymousBlock();
-
+
// Whether or not a positioned element requires normal flow x/y to be computed
// to determine its position.
bool hasStaticX() const;
bool hasStaticY() const;
- virtual void setStaticX(int staticX) {};
- virtual void setStaticY(int staticY) {};
+ virtual void setStaticX(int /*staticX*/) { }
+ virtual void setStaticY(int /*staticY*/) { }
virtual int staticX() const { return 0; }
virtual int staticY() const { return 0; }
-
+
CounterNode* findCounter(const String& counterName, bool willNeedLayout = false,
- bool usesSeparator = false, bool createIfNotFound = true);
+ bool usesSeparator = false, bool createIfNotFound = true);
-public:
// RenderObject tree manipulation
//////////////////////////////////////////
virtual bool canHaveChildren() const;
- virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0);
- virtual void removeChild(RenderObject *oldChild);
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
+ virtual void removeChild(RenderObject*);
virtual bool createsAnonymousWrapper() const { return false; }
// raw tree manipulation
- virtual RenderObject* removeChildNode(RenderObject* child);
- virtual void appendChildNode(RenderObject* child);
+ virtual RenderObject* removeChildNode(RenderObject*);
+ virtual void appendChildNode(RenderObject*);
virtual void insertChildNode(RenderObject* child, RenderObject* before);
//////////////////////////////////////////
protected:
//////////////////////////////////////////
// Helper functions. Dangerous to use!
- void setPreviousSibling(RenderObject *previous) { m_previous = previous; }
- void setNextSibling(RenderObject *next) { m_next = next; }
- void setParent(RenderObject *parent) { m_parent = parent; }
+ void setPreviousSibling(RenderObject* previous) { m_previous = previous; }
+ void setNextSibling(RenderObject* next) { m_next = next; }
+ void setParent(RenderObject* parent) { m_parent = parent; }
//////////////////////////////////////////
private:
void addAbsoluteRectForLayer(IntRect& result);
public:
- virtual const char *renderName() const { return "RenderObject"; }
#ifndef NDEBUG
DeprecatedString information() const;
- virtual void dump(TextStream *stream, DeprecatedString ind = "") const;
+ virtual void dump(TextStream*, DeprecatedString ind = "") const;
void showTreeForThis() const;
#endif
- static RenderObject *createObject(Node* node, RenderStyle* style);
+ static RenderObject* createObject(Node*, RenderStyle*);
// Overloaded new operator. Derived classes must override operator new
// in order to allocate out of the RenderArena.
- void* operator new(size_t sz, RenderArena* renderArena) throw();
+ void* operator new(size_t, RenderArena*) throw();
// Overridden to prevent the normal delete from being called.
- void operator delete(void* ptr, size_t sz);
-
+ void operator delete(void*, size_t);
+
private:
// The normal operator new is disallowed on all render objects.
- void* operator new(size_t sz) throw();
-
+ void* operator new(size_t) throw();
+
public:
RenderArena* renderArena() const;
-
+
// some helper functions...
virtual bool isRenderBlock() const { return false; }
virtual bool isRenderInline() const { return false; }
virtual bool isInlineFlow() const { return false; }
virtual bool isBlockFlow() const { return false; }
virtual bool isInlineBlockOrInlineTable() const { return false; }
- virtual bool childrenInline() const { return false; }
- virtual void setChildrenInline(bool b) { };
-
- virtual RenderFlow* continuation() const;
virtual bool isInlineContinuation() const;
-
virtual bool isListItem() const { return false; }
virtual bool isListMarker() const { return false; }
virtual bool isCounter() const { return false; }
virtual bool isRenderView() const { return false; }
- bool isRoot() const;
- bool isBody() const;
- bool isHR() const;
virtual bool isBR() const { return false; }
virtual bool isTableCell() const { return false; }
virtual bool isTableRow() const { return false; }
virtual bool isApplet() const { return false; }
virtual bool isMenuList() const { return false; }
virtual bool isListBox() const { return false; }
-
+
+ bool isRoot() const;
+ bool isBody() const;
+ bool isHR() const;
+
+ bool isHTMLMarquee() const;
+
+ virtual bool childrenInline() const { return false; }
+ virtual void setChildrenInline(bool) { }
+
+ virtual RenderFlow* continuation() const;
+
#ifdef SVG_SUPPORT
virtual bool isKCanvasContainer() const { return false; }
virtual bool isRenderPath() const { return false; }
virtual void setLocalTransform(const AffineTransform&);
virtual AffineTransform absoluteTransform() const;
#endif
-
+
virtual bool isEditable() const;
- bool isHTMLMarquee() const;
-
bool isAnonymous() const { return m_isAnonymous; }
void setIsAnonymous(bool b) { m_isAnonymous = b; }
- bool isAnonymousBlock() const { return m_isAnonymous &&
- style()->display() == BLOCK &&
- style()->styleType() == RenderStyle::NOPSEUDO &&
- !isListMarker(); }
-
+ bool isAnonymousBlock() const
+ {
+ return m_isAnonymous && style()->display() == BLOCK && style()->styleType() == RenderStyle::NOPSEUDO && !isListMarker();
+ }
+
bool isFloating() const { return m_floating; }
bool isPositioned() const { return m_positioned; } // absolute or fixed positioning
bool isRelPositioned() const { return m_relPositioned; } // relative positioning
bool isInline() const { return m_inline; } // inline object
bool isCompact() const { return style()->display() == COMPACT; } // compact object
bool isRunIn() const { return style()->display() == RUN_IN; } // run-in object
- bool isDragging() const;
+ bool isDragging() const { return m_isDragging; }
bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
+
bool shouldPaintBackgroundOrBorder() const { return m_paintBackground; }
bool mustRepaintBackgroundOrBorder() const;
- bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout; }
+
+ bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout; }
bool selfNeedsLayout() const { return m_needsLayout; }
bool posChildNeedsLayout() const { return m_posChildNeedsLayout; }
bool normalChildNeedsLayout() const { return m_normalChildNeedsLayout; }
+
bool minMaxKnown() const{ return m_minMaxKnown; }
bool recalcMinMax() const { return m_recalcMinMax; }
+
bool isSelectionBorder() const;
-
+
bool hasOverflowClip() const { return m_hasOverflowClip; }
-
+
bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); }
bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); }
bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
-
+
bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); }
bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); }
- RenderStyle* getPseudoStyle(RenderStyle::PseudoId pseudo, RenderStyle* parentStyle = 0) const;
-
+ RenderStyle* getPseudoStyle(RenderStyle::PseudoId, RenderStyle* parentStyle = 0) const;
+
void updateDragState(bool dragOn);
RenderView* view() const;
Document* document() const { return m_node->document(); }
void setNode(Node* node) { m_node = node; }
Node* node() const { return m_node; }
-
+
bool hasOutlineAnnotation() const;
bool hasOutline() const { return style()->hasOutline() || hasOutlineAnnotation(); }
-
+
/**
* returns the object containing this one. can be different from parent for
* positioned elements
*/
- RenderObject *container() const;
+ RenderObject* container() const;
RenderObject* hoverAncestor() const;
virtual void markAllDescendantsWithFloatsForLayout(RenderObject* floatToRemove = 0);
void markContainingBlocksForLayout(bool scheduleRelayout = true);
void setNeedsLayout(bool b, bool markParents = true);
void setChildNeedsLayout(bool b, bool markParents = true);
- void setMinMaxKnown(bool b=true) {
+
+ void setMinMaxKnown(bool b = true)
+ {
m_minMaxKnown = b;
- if ( !b ) {
- RenderObject *o = this;
- RenderObject *root = this;
- while( o ) { // ### && !o->m_recalcMinMax ) {
+ if (!b) {
+ RenderObject* o = this;
+ RenderObject* root = this;
+ while(o) { // FIXME: && !o->m_recalcMinMax ) {
o->m_recalcMinMax = true;
root = o;
o = o->m_parent;
}
}
- void setNeedsLayoutAndMinMaxRecalc() {
+ void setNeedsLayoutAndMinMaxRecalc()
+ {
setMinMaxKnown(false);
setNeedsLayout(true);
}
-
- void setPositioned(bool b=true) { m_positioned = b; }
- void setRelPositioned(bool b=true) { m_relPositioned = b; }
- void setFloating(bool b=true) { m_floating = b; }
- void setInline(bool b=true) { m_inline = b; }
- void setShouldPaintBackgroundOrBorder(bool b=true) { m_paintBackground = b; }
+
+ void setPositioned(bool b = true) { m_positioned = b; }
+ void setRelPositioned(bool b = true) { m_relPositioned = b; }
+ void setFloating(bool b = true) { m_floating = b; }
+ void setInline(bool b = true) { m_inline = b; }
+ void setShouldPaintBackgroundOrBorder(bool b = true) { m_paintBackground = b; }
void setRenderText() { m_isText = true; }
- void setReplaced(bool b=true) { m_replaced = b; }
+ void setReplaced(bool b = true) { m_replaced = b; }
void setHasOverflowClip(bool b = true) { m_hasOverflowClip = b; }
void scheduleRelayout();
-
+
void updateBackgroundImages(RenderStyle* oldStyle);
- virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
- virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox=false);
-
+ virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun = false);
+ virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
+
// For inline replaced elements, this function returns the inline box that owns us. Enables
// the replaced RenderObject to quickly determine what line it is contained on and to easily
// iterate over structures on the line.
virtual InlineBox* inlineBoxWrapper() const;
- virtual void setInlineBoxWrapper(InlineBox* b);
+ virtual void setInlineBoxWrapper(InlineBox*);
virtual void deleteLineBoxWrapper();
- virtual InlineBox *inlineBox(int offset=0, EAffinity affinity = UPSTREAM);
-
+ virtual InlineBox* inlineBox(int offset = 0, EAffinity = UPSTREAM);
+
// for discussion of lineHeight see CSS2 spec
- virtual short lineHeight( bool firstLine, bool isRootLineBox=false ) const;
+ virtual short lineHeight(bool firstLine, bool isRootLineBox = false) const;
// for the vertical-align property of inline elements
// the difference between this objects baseline position and the lines baseline position.
- virtual short verticalPositionHint( bool firstLine ) const;
+ virtual short verticalPositionHint(bool firstLine) const;
// the offset of baseline from the top of the object.
- virtual short baselinePosition( bool firstLine, bool isRootLineBox=false ) const;
+ virtual short baselinePosition(bool firstLine, bool isRootLineBox = false) const;
// width of tab character
int tabWidth() const;
* (tx|ty) is the calculated position of the parent
*/
struct PaintInfo {
- PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceWhiteText, RenderObject* newPaintingRoot, RenderFlowSequencedSet* newOutlineObjects)
+ PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceWhiteText,
+ RenderObject* newPaintingRoot, RenderFlowSequencedSet* newOutlineObjects)
: context(newContext)
, rect(newRect)
, phase(newPhase)
virtual void paint(PaintInfo&, int tx, int ty);
void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, bool begin = true, bool end = true);
- bool paintBorderImage(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle* style);
- void paintOutline(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle* style);
+ bool paintBorderImage(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*);
+ void paintOutline(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*);
// RenderBox implements this.
virtual void paintBoxDecorations(PaintInfo&, int tx, int ty) { }
- virtual void paintBackgroundExtended(GraphicsContext*, const Color&, const BackgroundLayer*, int clipy, int cliph,
- int tx, int ty, int w, int height, int bleft, int bright, int pleft, int pright) {}
+ virtual void paintBackgroundExtended(GraphicsContext*, const Color&, const BackgroundLayer*,
+ int clipy, int cliph, int tx, int ty, int width, int height,
+ int bleft, int bright, int pleft, int pright) { }
/*
* This function calculates the minimum & maximum width that the object
* Calculates the actual width of the object (only for non inline
* objects)
*/
- virtual void calcWidth() {}
+ virtual void calcWidth() { }
/*
* This function should cause the Element to calculate its
// used for element state updates that can not be fixed with a
// repaint and do not need a relayout
- virtual void updateFromElement() {};
+ virtual void updateFromElement() { }
virtual int availableHeight() const { return 0; }
virtual void updateWidgetPosition();
-
+
void addDashboardRegions(Vector<DashboardRegionValue>&);
void collectDashboardRegions(Vector<DashboardRegionValue>&);
// Used to signal a specific subrect within an object that must be repainted after
// layout is complete.
struct RepaintInfo {
+ RepaintInfo(RenderObject* object, const IntRect& repaintRect)
+ : m_object(object)
+ , m_repaintRect(repaintRect)
+ {
+ }
+
RenderObject* m_object;
IntRect m_repaintRect;
-
- RepaintInfo(RenderObject* o, const IntRect& r) :m_object(o), m_repaintRect(r) {}
};
-
- bool hitTest(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestFilter hitTestFilter = HitTestAll);
+
+ bool hitTest(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestFilter = HitTestAll);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
void setInnerNode(HitTestResult&);
virtual VisiblePosition positionForCoordinates(int x, int y);
VisiblePosition positionForPoint(const IntPoint& point) { return positionForCoordinates(point.x(), point.y()); }
-
- virtual void dirtyLinesFromChangedChild(RenderObject* child);
-
+
+ virtual void dirtyLinesFromChangedChild(RenderObject*);
+
// Set the style of the object and update the state of the object accordingly.
- virtual void setStyle(RenderStyle* style);
+ virtual void setStyle(RenderStyle*);
// Updates only the local style ptr of the object. Does not update the state of the object,
// and so only should be called when the style is known not to have changed (or from setStyle).
- void setStyleInternal(RenderStyle* style);
+ void setStyleInternal(RenderStyle*);
// returns the containing block level element for this element.
- RenderBlock *containingBlock() const;
+ RenderBlock* containingBlock() const;
// return just the width of the containing block
virtual int containingBlockWidth() const;
virtual int overrideSize() const { return 0; }
virtual int overrideWidth() const { return 0; }
virtual int overrideHeight() const { return 0; }
- virtual void setOverrideSize(int s) {}
+ virtual void setOverrideSize(int /*overrideSize*/) { }
// relative to parent node
- virtual void setPos( int /*xPos*/, int /*yPos*/ ) { }
- virtual void setWidth( int /*width*/ ) { }
- virtual void setHeight( int /*height*/ ) { }
+ virtual void setPos(int /*xPos*/, int /*yPos*/) { }
+ virtual void setWidth(int /*width*/) { }
+ virtual void setHeight(int /*height*/) { }
virtual int xPos() const { return 0; }
virtual int yPos() const { return 0; }
// calculate client position of box
- virtual bool absolutePosition(int &/*xPos*/, int &/*yPos*/, bool fixed = false);
-
+ virtual bool absolutePosition(int& /*xPos*/, int& /*yPos*/, bool /*fixed*/ = false);
+
// This function is used to deal with the extra top space that can occur in table cells (called borderTopExtra).
// The children of the cell do not factor this space in, so we have to add it in. Any code that wants to
// accurately deal with the contents of a cell must call this function instad of absolutePosition.
- void absolutePositionForContent(int& xPos, int& yPos, bool fixed = false) {
+ void absolutePositionForContent(int& xPos, int& yPos, bool fixed = false)
+ {
absolutePosition(xPos, yPos, fixed);
yPos += borderTopExtra();
}
// The height of a block when you include normal flow overflow spillage out of the bottom
// of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
// it would have an overflow height of borderTop() + paddingTop() + 100px.
- virtual int overflowHeight(bool includeInterior=true) const { return height(); }
- virtual int overflowWidth(bool includeInterior=true) const { return width(); }
- virtual void setOverflowHeight(int) {}
- virtual void setOverflowWidth(int) {}
- virtual int overflowLeft(bool includeInterior=true) const { return 0; }
- virtual int overflowTop(bool includeInterior=true) const { return 0; }
- virtual IntRect overflowRect(bool includeInterior=true) const { return borderBox(); }
-
- // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
+ virtual int overflowHeight(bool /*includeInterior*/ = true) const { return height(); }
+ virtual int overflowWidth(bool /*includeInterior*/ = true) const { return width(); }
+ virtual void setOverflowHeight(int) { }
+ virtual void setOverflowWidth(int) { }
+ virtual int overflowLeft(bool /*includeInterior*/ = true) const { return 0; }
+ virtual int overflowTop(bool /*includeInterior*/ = true) const { return 0; }
+ virtual IntRect overflowRect(bool /*includeInterior*/ = true) const { return borderBox(); }
+
+ // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
// to return the remaining width on a given line (and the height of a single line). -dwh
virtual int offsetWidth() const { return width(); }
virtual int offsetHeight() const { return height() + borderTopExtra() + borderBottomExtra(); }
-
- // IE exxtensions. Also supported by Gecko. We override in render flow to get the
+
+ // IE extensions. Also supported by Gecko. We override in render flow to get the
// left and top correct. -dwh
virtual int offsetLeft() const;
virtual int offsetTop() const;
virtual void setScrollLeft(int);
virtual void setScrollTop(int);
- virtual bool scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier=1.0);
+ virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
virtual bool shouldAutoscroll() const;
virtual void autoscroll();
- virtual void stopAutoscroll() {};
+ virtual void stopAutoscroll() { }
// The following seven functions are used to implement collapsing margins.
// All objects know their maximal positive and negative margins. The
// the margin of the element. Blocks override the maxTopMargin and maxBottomMargin
// methods.
virtual bool isSelfCollapsingBlock() const { return false; }
- virtual int collapsedMarginTop() const
- { return maxTopMargin(true)-maxTopMargin(false); }
- virtual int collapsedMarginBottom() const
- { return maxBottomMargin(true)-maxBottomMargin(false); }
+ virtual int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(false); }
+ virtual int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottomMargin(false); }
virtual bool isTopMarginQuirk() const { return false; }
virtual bool isBottomMarginQuirk() const { return false; }
- virtual int maxTopMargin(bool positive) const {
- if (positive)
- if (marginTop() > 0)
- return marginTop();
- else
- return 0;
- else
- if (marginTop() < 0)
- return 0 - marginTop();
- else
- return 0;
- }
- virtual int maxBottomMargin(bool positive) const {
- if (positive)
- if (marginBottom() > 0)
- return marginBottom();
- else
- return 0;
- else
- if (marginBottom() < 0)
- return 0 - marginBottom();
- else
- return 0;
- }
+
+ virtual int maxTopMargin(bool positive) const { return positive ? std::max(0, marginTop()) : -std::min(0, marginTop()); }
+ virtual int maxBottomMargin(bool positive) const { return positive ? std::max(0, marginBottom()) : -std::min(0, marginBottom()); }
virtual int marginTop() const { return 0; }
virtual int marginBottom() const { return 0; }
virtual int marginLeft() const { return 0; }
virtual int marginRight() const { return 0; }
- // Virtual since table cells override
+ // Virtual since table cells override
virtual int paddingTop() const;
virtual int paddingBottom() const;
virtual int paddingLeft() const;
virtual int paddingRight() const;
-
+
virtual int borderTop() const { return style()->borderTopWidth(); }
virtual int borderBottom() const { return style()->borderBottomWidth(); }
virtual int borderTopExtra() const { return 0; }
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
IntRect absoluteBoundingBoxRect();
-
+
// the rect that will be painted if this object is passed as the paintingRoot
IntRect paintingRootRect(IntRect& topLevelRect);
- void addPDFURLRect(GraphicsContext* p, IntRect rect);
+ void addPDFURLRect(GraphicsContext*, IntRect);
virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
RenderStyle* firstLineStyle() const;
RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); }
-
void getTextDecorationColors(int decorations, Color& underline, Color& overline,
- Color& linethrough, bool quirksMode=false);
+ Color& linethrough, bool quirksMode = false);
enum BorderSide {
- BSTop, BSBottom, BSLeft, BSRight
+ BSTop,
+ BSBottom,
+ BSLeft,
+ BSRight
};
+
void drawBorderArc(GraphicsContext*, int x, int y, float thickness, IntSize radius, int angleStart,
- int angleSpan, BorderSide, Color, const Color& textcolor, EBorderStyle, bool firstCorner);
+ int angleSpan, BorderSide, Color, const Color& textcolor, EBorderStyle, bool firstCorner);
void drawBorder(GraphicsContext*, int x1, int y1, int x2, int y2, BorderSide,
- Color, const Color& textcolor, EBorderStyle, int adjbw1, int adjbw2);
+ Color, const Color& textcolor, EBorderStyle, int adjbw1, int adjbw2);
- virtual void setTable(RenderTable*) {};
+ virtual void setTable(RenderTable*) { }
// Used by collapsed border tables.
virtual void collectBorders(DeprecatedValueList<CollapsedBorderValue>&);
void repaint(bool immediate = false);
// Repaint a specific subrectangle within a given object. The rect |r| is in the object's coordinate space.
- void repaintRectangle(const IntRect& r, bool immediate = false);
-
+ void repaintRectangle(const IntRect&, bool immediate = false);
+
// Repaint only if our old bounds and new bounds are different.
bool repaintAfterLayoutIfNeeded(const IntRect& oldBounds, const IntRect& oldFullBounds);
// Given a rect in the object's coordinate space, this method converts the rectangle to the view's
// coordinate space.
- virtual void computeAbsoluteRepaintRect(IntRect& r, bool f=false);
-
+ virtual void computeAbsoluteRepaintRect(IntRect&, bool fixed = false);
+
virtual unsigned int length() const { return 1; }
- bool isFloatingOrPositioned() const { return (isFloating() || isPositioned()); };
+ bool isFloatingOrPositioned() const { return (isFloating() || isPositioned()); }
virtual bool containsFloats() { return false; }
- virtual bool containsFloat(RenderObject* o) { return false; }
+ virtual bool containsFloat(RenderObject*) { return false; }
virtual bool hasOverhangingFloats() { return false; }
virtual bool expandsToEncloseOverhangingFloats() const { return isFloating() && style()->height().isAuto(); }
virtual IntRect floatRect() const { return borderBox(); }
float opacity() const { return style()->opacity(); }
// Applied as a "slop" to dirty rect checks during the outline painting phase's dirty-rect checks.
- int maximalOutlineSize(PaintPhase p) const;
+ int maximalOutlineSize(PaintPhase) const;
enum SelectionState {
SelectionNone, // The object is not selected.
// The current selection state for an object. For blocks, the state refers to the state of the leaf
// descendants (as described above in the SelectionState enum declaration).
virtual SelectionState selectionState() const { return SelectionNone; }
-
+
// Sets the selection state for an object.
- virtual void setSelectionState(SelectionState s) { if (parent()) parent()->setSelectionState(s); }
+ virtual void setSelectionState(SelectionState state) { if (parent()) parent()->setSelectionState(state); }
// A single rectangle that encompasses all of the selected objects within this object. Used to determine the tightest
// possible bounding box for the selection.
virtual IntRect selectionRect() { return IntRect(); }
-
+
// Whether or not an object can be part of the leaf elements of the selection.
virtual bool canBeSelectionLeaf() const { return false; }
// Whether or not a selection can be attempted on this object. Should only be called right before actually beginning a selection,
// since it fires the selectstart DOM event.
bool shouldSelect() const;
-
+
// Obtains the selection colors that should be used when painting a selection.
Color selectionBackgroundColor() const;
Color selectionForegroundColor() const;
// This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject.
struct SelectionInfo {
- RenderObject* m_object;
- IntRect m_rect;
- RenderObject::SelectionState m_state;
+ SelectionInfo()
+ : m_object(0)
+ , m_state(SelectionNone)
+ {
+ }
+
+ SelectionInfo(RenderObject* o)
+ : m_object(o)
+ , m_rect(o->selectionRect())
+ , m_state(o->selectionState())
+ {
+ }
RenderObject* object() const { return m_object; }
IntRect rect() const { return m_rect; }
SelectionState state() const { return m_state; }
-
- SelectionInfo() { m_object = 0; m_state = SelectionNone; }
- SelectionInfo(RenderObject* o) :m_object(o), m_rect(o->selectionRect()), m_state(o->selectionState()) {}
+
+ RenderObject* m_object;
+ IntRect m_rect;
+ SelectionState m_state;
};
Node* draggableNode(bool dhtmlOK, bool uaOK, int x, int y, bool& dhtmlWillDrag) const;
* @param extraWidthToEndOfLine optional out arg to give extra width to end of line -
* useful for character range rect computations
*/
- virtual IntRect caretRect(int offset, EAffinity affinity = UPSTREAM, int *extraWidthToEndOfLine = 0);
+ virtual IntRect caretRect(int offset, EAffinity = UPSTREAM, int* extraWidthToEndOfLine = 0);
- virtual int lowestPosition(bool includeOverflowInterior=true, bool includeSelf=true) const { return 0; }
- virtual int rightmostPosition(bool includeOverflowInterior=true, bool includeSelf=true) const { return 0; }
- virtual int leftmostPosition(bool includeOverflowInterior=true, bool includeSelf=true) const { return 0; }
-
- virtual void calcVerticalMargins() {}
+ virtual int lowestPosition(bool /*includeOverflowInterior*/ = true, bool /*includeSelf*/ = true) const { return 0; }
+ virtual int rightmostPosition(bool /*includeOverflowInterior*/ = true, bool /*includeSelf*/ = true) const { return 0; }
+ virtual int leftmostPosition(bool /*includeOverflowInterior*/ = true, bool /*includeSelf*/ = true) const { return 0; }
+
+ virtual void calcVerticalMargins() { }
void removeFromObjectLists();
// When performing a global document tear-down, the renderer of the document is cleared. We use this
virtual void destroy();
- const Font& font(bool firstLine) const {
- return style(firstLine)->font();
- }
+ const Font& font(bool firstLine) const { return style(firstLine)->font(); }
// Virtual function helpers for CSS3 Flexible Box Layout
virtual bool isFlexibleBox() const { return false; }
virtual int caretMaxOffset() const;
virtual unsigned caretMaxRenderedOffset() const;
- virtual int previousOffset (int current) const;
- virtual int nextOffset (int current) const;
+ virtual int previousOffset(int current) const;
+ virtual int nextOffset(int current) const;
virtual void imageChanged(CachedImage*);
virtual bool willRenderImage(CachedImage*);
short getVerticalPosition(bool firstLine) const;
virtual void removeLeftoverAnonymousBoxes();
-
+
void arenaDelete(RenderArena*, void* objectBase);
private:
Node* m_node;
- RenderObject *m_parent;
- RenderObject *m_previous;
- RenderObject *m_next;
+ RenderObject* m_parent;
+ RenderObject* m_previous;
+ RenderObject* m_next;
mutable short m_verticalPosition;
bool m_inline : 1;
bool m_replaced : 1;
bool m_isDragging : 1;
-
- bool m_hasOverflowClip : 1;
-
- bool m_hasCounterNodeMap : 1;
-
- friend class RenderListItem;
- friend class RenderContainer;
- friend class RenderView;
-};
+ bool m_hasOverflowClip : 1;
-enum VerticalPositionHint {
- PositionTop = -0x4000,
- PositionBottom = 0x4000,
- PositionUndefined = 0x3fff
+ bool m_hasCounterNodeMap : 1;
};
-} //namespace
+} // namespace WebCore
#ifndef NDEBUG
// Outside the WebCore namespace for ease of invocation from gdb.
void showTree(const WebCore::RenderObject*);
#endif
-
-#endif
+#endif // RenderObject_h