Reviewed by Mitz.
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2006 03:55:58 +0000 (03:55 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2006 03:55:58 +0000 (03:55 +0000)
        Fix for http://bugs.webkit.org/show_bug.cgi?id=11506
        Cleanup RenderObject

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::operator delete):
        (WebCore::RenderObject::createObject):
        (WebCore::RenderObjectCounter::~RenderObjectCounter):
        (WebCore::RenderObject::RenderObject):
        (WebCore::RenderObject::isDescendantOf):
        (WebCore::RenderObject::isRoot):
        (WebCore::RenderObject::addChild):
        (WebCore::RenderObject::removeChildNode):
        (WebCore::RenderObject::removeChild):
        (WebCore::RenderObject::appendChildNode):
        (WebCore::RenderObject::insertChildNode):
        (WebCore::RenderObject::nextInPreOrder):
        (WebCore::RenderObject::nextInPreOrderAfterChildren):
        (WebCore::RenderObject::previousInPreOrder):
        (WebCore::RenderObject::isEditable):
        (WebCore::RenderObject::nextEditable):
        (WebCore::RenderObject::previousEditable):
        (WebCore::RenderObject::firstLeafChild):
        (WebCore::RenderObject::lastLeafChild):
        (WebCore::RenderObject::addLayers):
        (WebCore::RenderObject::removeLayers):
        (WebCore::RenderObject::moveLayers):
        (WebCore::RenderObject::findNextLayer):
        (WebCore::RenderObject::enclosingLayer):
        (WebCore::RenderObject::updateFirstLetter):
        (WebCore::RenderObject::offsetParent):
        (WebCore::RenderObject::scroll):
        (WebCore::RenderObject::hasStaticX):
        (WebCore::RenderObject::setNeedsLayout):
        (WebCore::RenderObject::setChildNeedsLayout):
        (WebCore::RenderObject::markContainingBlocksForLayout):
        (WebCore::RenderObject::containingBlock):
        (WebCore::RenderObject::containingBlockWidth):
        (WebCore::RenderObject::containingBlockHeight):
        (WebCore::RenderObject::mustRepaintBackgroundOrBorder):
        (WebCore::RenderObject::drawBorderArc):
        (WebCore::RenderObject::drawBorder):
        (WebCore::RenderObject::paintBorderImage):
        (WebCore::RenderObject::paintBorder):
        (WebCore::RenderObject::absoluteRects):
        (WebCore::RenderObject::addPDFURLRect):
        (WebCore::RenderObject::addFocusRingRects):
        (WebCore::RenderObject::paintOutline):
        (WebCore::RenderObject::repaint):
        (WebCore::RenderObject::repaintRectangle):
        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
        (WebCore::RenderObject::repaintObjectsBeforeLayout):
        (WebCore::RenderObject::getAbsoluteRepaintRectWithOutline):
        (WebCore::RenderObject::information):
        (WebCore::RenderObject::dump):
        (WebCore::selectStartNode):
        (WebCore::RenderObject::shouldSelect):
        (WebCore::RenderObject::draggableNode):
        (WebCore::RenderObject::createAnonymousBlock):
        (WebCore::RenderObject::handleDynamicFloatPositionChange):
        (WebCore::RenderObject::setStyle):
        (WebCore::RenderObject::setStyleInternal):
        (WebCore::RenderObject::updateBackgroundImages):
        (WebCore::RenderObject::absolutePosition):
        (WebCore::RenderObject::caretRect):
        (WebCore::RenderObject::paddingTop):
        (WebCore::RenderObject::paddingBottom):
        (WebCore::RenderObject::paddingLeft):
        (WebCore::RenderObject::paddingRight):
        (WebCore::RenderObject::tabWidth):
        (WebCore::RenderObject::container):
        (WebCore::RenderObject::removeFromObjectLists):
        (WebCore::RenderObject::destroy):
        (WebCore::RenderObject::arenaDelete):
        (WebCore::RenderObject::hitTest):
        (WebCore::RenderObject::setInnerNode):
        (WebCore::RenderObject::nodeAtPoint):
        (WebCore::RenderObject::verticalPositionHint):
        (WebCore::RenderObject::getVerticalPosition):
        (WebCore::RenderObject::lineHeight):
        (WebCore::RenderObject::invalidateVerticalPositions):
        (WebCore::RenderObject::recalcMinMaxWidths):
        (WebCore::RenderObject::scheduleRelayout):
        (WebCore::RenderObject::setInlineBoxWrapper):
        (WebCore::RenderObject::firstLineStyle):
        (WebCore::RenderObject::getPseudoStyle):
        (WebCore::RenderObject::getTextDecorationColors):
        (WebCore::RenderObject::addDashboardRegions):
        (WebCore::RenderObject::collectDashboardRegions):
        (WebCore::RenderObject::avoidsFloats):
        (WebCore::RenderObject::findCounter):
        (WebCore::RenderObject::backslashAsCurrencySymbol):
        (WebCore::RenderObject::imageChanged):
        (WebCore::RenderObject::previousOffset):
        (WebCore::RenderObject::nextOffset):
        (WebCore::RenderObject::inlineBox):
        * rendering/RenderObject.h:
        (WebCore::):
        (WebCore::RenderObject::renderName):
        (WebCore::RenderObject::parent):
        (WebCore::RenderObject::previousSibling):
        (WebCore::RenderObject::nextSibling):
        (WebCore::RenderObject::firstChild):
        (WebCore::RenderObject::lastChild):
        (WebCore::RenderObject::getOverflowClipRect):
        (WebCore::RenderObject::getClipRect):
        (WebCore::RenderObject::getBaselineOfFirstLineBox):
        (WebCore::RenderObject::setEdited):
        (WebCore::RenderObject::setStaticX):
        (WebCore::RenderObject::setStaticY):
        (WebCore::RenderObject::setPreviousSibling):
        (WebCore::RenderObject::setNextSibling):
        (WebCore::RenderObject::setParent):
        (WebCore::RenderObject::isInlineBlockOrInlineTable):
        (WebCore::RenderObject::isRenderView):
        (WebCore::RenderObject::childrenInline):
        (WebCore::RenderObject::setChildrenInline):
        (WebCore::RenderObject::isAnonymousBlock):
        (WebCore::RenderObject::isDragging):
        (WebCore::RenderObject::needsLayout):
        (WebCore::RenderObject::setMinMaxKnown):
        (WebCore::RenderObject::setNeedsLayoutAndMinMaxRecalc):
        (WebCore::RenderObject::setPositioned):
        (WebCore::RenderObject::setRelPositioned):
        (WebCore::RenderObject::setFloating):
        (WebCore::RenderObject::setInline):
        (WebCore::RenderObject::setShouldPaintBackgroundOrBorder):
        (WebCore::RenderObject::setReplaced):
        (WebCore::RenderObject::PaintInfo::PaintInfo):
        (WebCore::RenderObject::paintBackgroundExtended):
        (WebCore::RenderObject::calcWidth):
        (WebCore::RenderObject::updateFromElement):
        (WebCore::RenderObject::RepaintInfo::RepaintInfo):
        (WebCore::RenderObject::setOverrideSize):
        (WebCore::RenderObject::setPos):
        (WebCore::RenderObject::setWidth):
        (WebCore::RenderObject::setHeight):
        (WebCore::RenderObject::absolutePositionForContent):
        (WebCore::RenderObject::overflowHeight):
        (WebCore::RenderObject::overflowWidth):
        (WebCore::RenderObject::setOverflowHeight):
        (WebCore::RenderObject::setOverflowWidth):
        (WebCore::RenderObject::overflowLeft):
        (WebCore::RenderObject::overflowTop):
        (WebCore::RenderObject::overflowRect):
        (WebCore::RenderObject::stopAutoscroll):
        (WebCore::RenderObject::collapsedMarginTop):
        (WebCore::RenderObject::collapsedMarginBottom):
        (WebCore::RenderObject::maxTopMargin):
        (WebCore::RenderObject::maxBottomMargin):
        (WebCore::RenderObject::):
        (WebCore::RenderObject::setTable):
        (WebCore::RenderObject::isFloatingOrPositioned):
        (WebCore::RenderObject::containsFloat):
        (WebCore::RenderObject::setSelectionState):
        (WebCore::RenderObject::SelectionInfo::SelectionInfo):
        (WebCore::RenderObject::lowestPosition):
        (WebCore::RenderObject::rightmostPosition):
        (WebCore::RenderObject::leftmostPosition):
        (WebCore::RenderObject::calcVerticalMargins):
        (WebCore::RenderObject::font):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17677 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h

index 9b6f7d1..dfe0dd9 100644 (file)
@@ -1,3 +1,168 @@
+2006-11-08  Sam Weinig  <sam.weinig@gmail.com>
+
+        Reviewed by Mitz.
+
+        Fix for http://bugs.webkit.org/show_bug.cgi?id=11506
+        Cleanup RenderObject
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::operator delete):
+        (WebCore::RenderObject::createObject):
+        (WebCore::RenderObjectCounter::~RenderObjectCounter):
+        (WebCore::RenderObject::RenderObject):
+        (WebCore::RenderObject::isDescendantOf):
+        (WebCore::RenderObject::isRoot):
+        (WebCore::RenderObject::addChild):
+        (WebCore::RenderObject::removeChildNode):
+        (WebCore::RenderObject::removeChild):
+        (WebCore::RenderObject::appendChildNode):
+        (WebCore::RenderObject::insertChildNode):
+        (WebCore::RenderObject::nextInPreOrder):
+        (WebCore::RenderObject::nextInPreOrderAfterChildren):
+        (WebCore::RenderObject::previousInPreOrder):
+        (WebCore::RenderObject::isEditable):
+        (WebCore::RenderObject::nextEditable):
+        (WebCore::RenderObject::previousEditable):
+        (WebCore::RenderObject::firstLeafChild):
+        (WebCore::RenderObject::lastLeafChild):
+        (WebCore::RenderObject::addLayers):
+        (WebCore::RenderObject::removeLayers):
+        (WebCore::RenderObject::moveLayers):
+        (WebCore::RenderObject::findNextLayer):
+        (WebCore::RenderObject::enclosingLayer):
+        (WebCore::RenderObject::updateFirstLetter):
+        (WebCore::RenderObject::offsetParent):
+        (WebCore::RenderObject::scroll):
+        (WebCore::RenderObject::hasStaticX):
+        (WebCore::RenderObject::setNeedsLayout):
+        (WebCore::RenderObject::setChildNeedsLayout):
+        (WebCore::RenderObject::markContainingBlocksForLayout):
+        (WebCore::RenderObject::containingBlock):
+        (WebCore::RenderObject::containingBlockWidth):
+        (WebCore::RenderObject::containingBlockHeight):
+        (WebCore::RenderObject::mustRepaintBackgroundOrBorder):
+        (WebCore::RenderObject::drawBorderArc):
+        (WebCore::RenderObject::drawBorder):
+        (WebCore::RenderObject::paintBorderImage):
+        (WebCore::RenderObject::paintBorder):
+        (WebCore::RenderObject::absoluteRects):
+        (WebCore::RenderObject::addPDFURLRect):
+        (WebCore::RenderObject::addFocusRingRects):
+        (WebCore::RenderObject::paintOutline):
+        (WebCore::RenderObject::repaint):
+        (WebCore::RenderObject::repaintRectangle):
+        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
+        (WebCore::RenderObject::repaintObjectsBeforeLayout):
+        (WebCore::RenderObject::getAbsoluteRepaintRectWithOutline):
+        (WebCore::RenderObject::information):
+        (WebCore::RenderObject::dump):
+        (WebCore::selectStartNode):
+        (WebCore::RenderObject::shouldSelect):
+        (WebCore::RenderObject::draggableNode):
+        (WebCore::RenderObject::createAnonymousBlock):
+        (WebCore::RenderObject::handleDynamicFloatPositionChange):
+        (WebCore::RenderObject::setStyle):
+        (WebCore::RenderObject::setStyleInternal):
+        (WebCore::RenderObject::updateBackgroundImages):
+        (WebCore::RenderObject::absolutePosition):
+        (WebCore::RenderObject::caretRect):
+        (WebCore::RenderObject::paddingTop):
+        (WebCore::RenderObject::paddingBottom):
+        (WebCore::RenderObject::paddingLeft):
+        (WebCore::RenderObject::paddingRight):
+        (WebCore::RenderObject::tabWidth):
+        (WebCore::RenderObject::container):
+        (WebCore::RenderObject::removeFromObjectLists):
+        (WebCore::RenderObject::destroy):
+        (WebCore::RenderObject::arenaDelete):
+        (WebCore::RenderObject::hitTest):
+        (WebCore::RenderObject::setInnerNode):
+        (WebCore::RenderObject::nodeAtPoint):
+        (WebCore::RenderObject::verticalPositionHint):
+        (WebCore::RenderObject::getVerticalPosition):
+        (WebCore::RenderObject::lineHeight):
+        (WebCore::RenderObject::invalidateVerticalPositions):
+        (WebCore::RenderObject::recalcMinMaxWidths):
+        (WebCore::RenderObject::scheduleRelayout):
+        (WebCore::RenderObject::setInlineBoxWrapper):
+        (WebCore::RenderObject::firstLineStyle):
+        (WebCore::RenderObject::getPseudoStyle):
+        (WebCore::RenderObject::getTextDecorationColors):
+        (WebCore::RenderObject::addDashboardRegions):
+        (WebCore::RenderObject::collectDashboardRegions):
+        (WebCore::RenderObject::avoidsFloats):
+        (WebCore::RenderObject::findCounter):
+        (WebCore::RenderObject::backslashAsCurrencySymbol):
+        (WebCore::RenderObject::imageChanged):
+        (WebCore::RenderObject::previousOffset):
+        (WebCore::RenderObject::nextOffset):
+        (WebCore::RenderObject::inlineBox):
+        * rendering/RenderObject.h:
+        (WebCore::):
+        (WebCore::RenderObject::renderName):
+        (WebCore::RenderObject::parent):
+        (WebCore::RenderObject::previousSibling):
+        (WebCore::RenderObject::nextSibling):
+        (WebCore::RenderObject::firstChild):
+        (WebCore::RenderObject::lastChild):
+        (WebCore::RenderObject::getOverflowClipRect):
+        (WebCore::RenderObject::getClipRect):
+        (WebCore::RenderObject::getBaselineOfFirstLineBox):
+        (WebCore::RenderObject::setEdited):
+        (WebCore::RenderObject::setStaticX):
+        (WebCore::RenderObject::setStaticY):
+        (WebCore::RenderObject::setPreviousSibling):
+        (WebCore::RenderObject::setNextSibling):
+        (WebCore::RenderObject::setParent):
+        (WebCore::RenderObject::isInlineBlockOrInlineTable):
+        (WebCore::RenderObject::isRenderView):
+        (WebCore::RenderObject::childrenInline):
+        (WebCore::RenderObject::setChildrenInline):
+        (WebCore::RenderObject::isAnonymousBlock):
+        (WebCore::RenderObject::isDragging):
+        (WebCore::RenderObject::needsLayout):
+        (WebCore::RenderObject::setMinMaxKnown):
+        (WebCore::RenderObject::setNeedsLayoutAndMinMaxRecalc):
+        (WebCore::RenderObject::setPositioned):
+        (WebCore::RenderObject::setRelPositioned):
+        (WebCore::RenderObject::setFloating):
+        (WebCore::RenderObject::setInline):
+        (WebCore::RenderObject::setShouldPaintBackgroundOrBorder):
+        (WebCore::RenderObject::setReplaced):
+        (WebCore::RenderObject::PaintInfo::PaintInfo):
+        (WebCore::RenderObject::paintBackgroundExtended):
+        (WebCore::RenderObject::calcWidth):
+        (WebCore::RenderObject::updateFromElement):
+        (WebCore::RenderObject::RepaintInfo::RepaintInfo):
+        (WebCore::RenderObject::setOverrideSize):
+        (WebCore::RenderObject::setPos):
+        (WebCore::RenderObject::setWidth):
+        (WebCore::RenderObject::setHeight):
+        (WebCore::RenderObject::absolutePositionForContent):
+        (WebCore::RenderObject::overflowHeight):
+        (WebCore::RenderObject::overflowWidth):
+        (WebCore::RenderObject::setOverflowHeight):
+        (WebCore::RenderObject::setOverflowWidth):
+        (WebCore::RenderObject::overflowLeft):
+        (WebCore::RenderObject::overflowTop):
+        (WebCore::RenderObject::overflowRect):
+        (WebCore::RenderObject::stopAutoscroll):
+        (WebCore::RenderObject::collapsedMarginTop):
+        (WebCore::RenderObject::collapsedMarginBottom):
+        (WebCore::RenderObject::maxTopMargin):
+        (WebCore::RenderObject::maxBottomMargin):
+        (WebCore::RenderObject::):
+        (WebCore::RenderObject::setTable):
+        (WebCore::RenderObject::isFloatingOrPositioned):
+        (WebCore::RenderObject::containsFloat):
+        (WebCore::RenderObject::setSelectionState):
+        (WebCore::RenderObject::SelectionInfo::SelectionInfo):
+        (WebCore::RenderObject::lowestPosition):
+        (WebCore::RenderObject::rightmostPosition):
+        (WebCore::RenderObject::leftmostPosition):
+        (WebCore::RenderObject::calcVerticalMargins):
+        (WebCore::RenderObject::font):
+
 2006-11-08  Darin Adler  <darin@apple.com>
 
         Reviewed by Anders.
index 7fca61a..06c40ab 100644 (file)
 #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"
@@ -43,9 +42,9 @@
 #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"
@@ -60,6 +59,7 @@
 #include "RenderTheme.h"
 #include "RenderView.h"
 #include "Screen.h"
+#include "TextResourceDecoder.h"
 #include "TextStream.h"
 #include "cssstyleselector.h"
 #include <algorithm>
@@ -72,7 +72,7 @@ using namespace EventNames;
 using namespace HTMLNames;
 
 #ifndef NDEBUG
-static void *baseOfRenderObjectBeingDeleted;
+static voidbaseOfRenderObjectBeingDeleted;
 #endif
 
 typedef HashMap<String, CounterNode*> CounterNodeMap;
@@ -92,18 +92,18 @@ void* RenderObject::operator new(size_t sz, RenderArena* renderArena) throw()
 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;
+    RenderObjecto = 0;
     RenderArena* arena = node->document()->renderArena();
-    
-    if (ContentData *contentData = style->contentData()) {
-        RenderImage *contentImage = new (arena) RenderImage(node);
+
+    if (ContentDatacontentData = style->contentData()) {
+        RenderImagecontentImage = new (arena) RenderImage(node);
         if (contentImage) {
             contentImage->setStyle(style);
             contentImage->setContentObject(contentData->contentObject());
@@ -112,92 +112,88 @@ RenderObject *RenderObject::createObject(Node* node,  RenderStyle* style)
         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;
@@ -211,18 +207,18 @@ RenderObject::~RenderObject()
 #endif
 }
 
-bool RenderObject::isDescendantOf(const RenderObject *obj) const
+bool RenderObject::isDescendantOf(const RenderObjectobj) 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
@@ -255,37 +251,37 @@ bool RenderObject::isInlineContinuation() 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
+RenderObjectRenderObject::nextInPreOrder() const
 {
     if (RenderObject* o = firstChild())
         return o;
-        
+
     return nextInPreOrderAfterChildren();
 }
 
@@ -299,10 +295,11 @@ RenderObject* RenderObject::nextInPreOrderAfterChildren() const
         if (o)
             o = o->nextSibling();
     }
+
     return o;
 }
 
-RenderObject *RenderObject::previousInPreOrder() const
+RenderObjectRenderObject::previousInPreOrder() const
 {
     if (RenderObject* o = previousSibling()) {
         while (o->lastChild())
@@ -323,43 +320,42 @@ RenderObject* RenderObject::childAt(unsigned index) const
 
 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
+RenderObjectRenderObject::nextEditable() const
 {
-    RenderObject *r = const_cast<RenderObject *>(this);
-    RenderObject *n = firstChild();
+    RenderObject* r = const_cast<RenderObject*>(this);
+    RenderObjectn = 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();
@@ -369,46 +365,47 @@ RenderObject *RenderObject::nextEditable() const
         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
+RenderObjectRenderObject::previousEditable() const
 {
-    RenderObject *r = const_cast<RenderObject *>(this);
-    RenderObject *n = firstChild();
+    RenderObject* r = const_cast<RenderObject*>(this);
+    RenderObjectn = 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;
@@ -416,25 +413,26 @@ RenderObject *RenderObject::previousEditable() const
         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
+RenderObjectRenderObject::firstLeafChild() const
 {
-    RenderObject *r = firstChild();
+    RenderObjectr = firstChild();
     while (r) {
-        RenderObject *n = 0;
+        RenderObjectn = 0;
         n = r->firstChild();
         if (!n)
             break;
@@ -443,11 +441,11 @@ RenderObject *RenderObject::firstLeafChild() const
     return r;
 }
 
-RenderObject *RenderObject::lastLeafChild() const
+RenderObjectRenderObject::lastLeafChild() const
 {
-    RenderObject *r = lastChild();
+    RenderObjectr = lastChild();
     while (r) {
-        RenderObject *n = 0;
+        RenderObjectn = 0;
         n = r->lastChild();
         if (!n)
             break;
@@ -479,7 +477,7 @@ void RenderObject::addLayers(RenderLayer* parentLayer, RenderObject* newObject)
 {
     if (!parentLayer)
         return;
-    
+
     RenderObject* object = newObject;
     RenderLayer* beforeChild = 0;
     WebCore::addLayers(this, parentLayer, object, beforeChild);
@@ -489,7 +487,7 @@ void RenderObject::removeLayers(RenderLayer* parentLayer)
 {
     if (!parentLayer)
         return;
-    
+
     if (layer()) {
         parentLayer->removeChild(layer());
         return;
@@ -503,7 +501,7 @@ void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent)
 {
     if (!newParent)
         return;
-    
+
     if (layer()) {
         if (oldParent)
             oldParent->removeChild(layer());
@@ -521,12 +519,12 @@ RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject*
     // 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) {
@@ -537,25 +535,25 @@ RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject*
                 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();
+        RenderLayerlayer = curr->layer();
         if (layer)
             return layer;
         curr = curr->parent();
@@ -574,7 +572,8 @@ RenderBlock* RenderObject::firstLineBlock() const
 }
 
 void RenderObject::updateFirstLetter()
-{}
+{
+}
 
 int RenderObject::offsetLeft() const
 {
@@ -612,16 +611,17 @@ int RenderObject::offsetTop() 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;
@@ -680,10 +680,10 @@ void RenderObject::setScrollTop(int newTop)
 
 bool RenderObject::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
 {
-    RenderLayer *l = layer();
+    RenderLayerl = layer();
     if (l && l->scroll(direction, granularity, multiplier))
         return true;
-    RenderBlock *b = containingBlock();
+    RenderBlockb = containingBlock();
     if (b && !b->isRenderView())
         return b->scroll(direction, granularity, multiplier);
     return false;
@@ -702,9 +702,7 @@ void RenderObject::autoscroll()
 
 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
@@ -716,15 +714,14 @@ void RenderObject::markAllDescendantsWithFloatsForLayout(RenderObject*)
 {
 }
 
-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;
     }
@@ -737,8 +734,7 @@ void RenderObject::setChildNeedsLayout(bool b, bool markParents)
     if (b) {
         if (!alreadyNeededLayout && markParents)
             markContainingBlocksForLayout();
-    }
-    else {
+    } else {
         m_posChildNeedsLayout = false;
         m_normalChildNeedsLayout = false;
     }
@@ -746,8 +742,8 @@ void RenderObject::setChildNeedsLayout(bool b, bool markParents)
 
 void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout)
 {
-    RenderObject *o = container();
-    RenderObject *last = this;
+    RenderObjecto = container();
+    RenderObjectlast = this;
 
     while (o) {
         if (!last->isText() && (last->style()->position() == FixedPosition || last->style()->position() == AbsolutePosition)) {
@@ -772,17 +768,16 @@ void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout)
 
 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();
+    RenderObjecto = 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
@@ -805,19 +800,19 @@ RenderBlock* RenderObject::containingBlock() const
 
     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();
 }
 
@@ -826,72 +821,73 @@ bool RenderObject::mustRepaintBackgroundOrBorder() const
     // 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;
@@ -902,50 +898,50 @@ void RenderObject::drawBorderArc(GraphicsContext* p, int x, int y, float thickne
                 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)
 {
@@ -961,210 +957,198 @@ void RenderObject::drawBorder(GraphicsContext* p, int x1, int y1, int x2, int y2
             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;
     }
 
@@ -1173,12 +1157,12 @@ bool RenderObject::paintBorderImage(GraphicsContext* p, int _tx, int _ty, int w,
 
     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;
@@ -1188,82 +1172,83 @@ bool RenderObject::paintBorderImage(GraphicsContext* p, int _tx, int _ty, int w,
 
     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;
 
@@ -1276,7 +1261,7 @@ void RenderObject::paintBorder(GraphicsContext* p, int _tx, int _ty, int w, int
     bool bt = style->borderBottomIsTransparent();
     bool rt = style->borderRightIsTransparent();
     bool lt = style->borderLeftIsTransparent();
-    
+
     EBorderStyle ts = style->borderTopStyle();
     EBorderStyle bs = style->borderBottomStyle();
     EBorderStyle ls = style->borderLeftStyle();
@@ -1301,11 +1286,11 @@ void RenderObject::paintBorder(GraphicsContext* p, int _tx, int _ty, int w, int
         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;
@@ -1317,38 +1302,35 @@ void RenderObject::paintBorder(GraphicsContext* p, int _tx, int _ty, int w, int
 
     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;
@@ -1356,238 +1338,231 @@ void RenderObject::paintBorder(GraphicsContext* p, int _tx, int _ty, int w, int
                 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)
@@ -1600,13 +1575,12 @@ void RenderObject::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
     // 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()));
 }
 
@@ -1644,21 +1618,21 @@ IntRect RenderObject::paintingRootRect(IntRect& topLevelRect)
     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);
                 }
             }
         }
@@ -1666,73 +1640,67 @@ void RenderObject::addPDFURLRect(GraphicsContext* p, IntRect 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*/)
@@ -1743,36 +1711,38 @@ void RenderObject::repaint(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.
-    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())
@@ -1780,24 +1750,24 @@ bool RenderObject::repaintAfterLayoutIfNeeded(const IntRect& oldBounds, const In
 
     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));
@@ -1821,7 +1791,7 @@ void RenderObject::repaintObjectsBeforeLayout()
 {
     if (!needsLayout() || isText())
         return;
-    
+
     bool blockWithInlineChildren = (isRenderBlock() && !isTable() && normalChildNeedsLayout() && childrenInline());
     if (selfNeedsLayout()) {
         repaint();
@@ -1842,11 +1812,13 @@ IntRect RenderObject::getAbsoluteRepaintRectWithOutline(int ow)
 
     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;
 }
@@ -1880,17 +1852,26 @@ DeprecatedString RenderObject::information() const
     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 ";
@@ -1898,35 +1879,44 @@ DeprecatedString RenderObject::information() const
             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(TextStreamstream, 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();
     }
 }
@@ -1937,14 +1927,14 @@ void RenderObject::showTreeForThis() const
         element()->showTreeForThis();
 }
 
-#endif
+#endif // NDEBUG
 
-static Node *selectStartNode(const RenderObject *object)
+static Node* selectStartNode(const RenderObject* object)
 {
-    Node *node = 0;
+    Nodenode = 0;
     bool forcedOn = false;
 
-    for (const RenderObject *curr = object; curr; curr = curr->parent()) {
+    for (const RenderObjectcurr = object; curr; curr = curr->parent()) {
         if (curr->style()->userSelect() == SELECT_TEXT)
             forcedOn = true;
         if (!forcedOn && curr->style()->userSelect() == SELECT_NONE)
@@ -1967,7 +1957,7 @@ bool RenderObject::canSelect() const
 
 bool RenderObject::shouldSelect() const
 {
-    if (Node *node = selectStartNode(this))
+    if (Nodenode = selectStartNode(this))
         return EventTargetNodeCast(node)->dispatchHTMLEvent(selectstartEvent, true, true);
 
     return false;
@@ -2012,19 +2002,18 @@ Node* RenderObject::draggableNode(bool dhtmlOK, bool uaOK, int x, int y, bool& d
 
     const RenderObject* curr = this;
     while (curr) {
-        Node *elt = curr->element();
+        Nodeelt = 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) {
@@ -2049,11 +2038,11 @@ void RenderObject::selectionStartEnd(int& spos, int& epos)
 
 RenderBlock* RenderObject::createAnonymousBlock()
 {
-    RenderStyle *newStyle = new (renderArena()) RenderStyle();
+    RenderStylenewStyle = new (renderArena()) RenderStyle();
     newStyle->inheritFrom(m_style);
     newStyle->setDisplay(BLOCK);
 
-    RenderBlock *newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
+    RenderBlocknewBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
     newBox->setStyle(newStyle);
     return newBox;
 }
@@ -2070,18 +2059,16 @@ void RenderObject::handleDynamicFloatPositionChange()
                 // 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);
@@ -2090,7 +2077,7 @@ void RenderObject::handleDynamicFloatPositionChange()
     }
 }
 
-void RenderObject::setStyle(RenderStyle *style)
+void RenderObject::setStyle(RenderStylestyle)
 {
     if (m_style == style)
         return;
@@ -2103,28 +2090,28 @@ void RenderObject::setStyle(RenderStyle *style)
         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);
@@ -2132,11 +2119,11 @@ void RenderObject::setStyle(RenderStyle *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
@@ -2152,12 +2139,12 @@ void RenderObject::setStyle(RenderStyle *style)
         // 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
@@ -2167,17 +2154,17 @@ void RenderObject::setStyle(RenderStyle *style)
             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();
@@ -2186,7 +2173,7 @@ void RenderObject::setStyle(RenderStyle *style)
                 }
             }
         }
-        
+
         if (isFloating() && (m_style->floating() != style->floating()))
             // For changes in float styles, we need to conceivably remove ourselves
             // from the floating objects list.
@@ -2195,11 +2182,11 @@ void RenderObject::setStyle(RenderStyle *style)
             // 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;
@@ -2221,14 +2208,14 @@ void RenderObject::setStyle(RenderStyle *style)
         }
     }
 
-    RenderStyle *oldStyle = m_style;
+    RenderStyleoldStyle = m_style;
     m_style = style;
 
     updateBackgroundImages(oldStyle);
-    
+
     if (m_style)
         m_style->ref();
-    
+
     if (oldStyle)
         oldStyle->deref(renderArena());
 
@@ -2236,7 +2223,7 @@ void RenderObject::setStyle(RenderStyle *style)
 
     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)
@@ -2247,13 +2234,13 @@ void RenderObject::setStyle(RenderStyle *style)
         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();
 }
@@ -2271,7 +2258,7 @@ void RenderObject::updateBackgroundImages(RenderStyle* oldStyle)
         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) {
@@ -2287,24 +2274,22 @@ IntRect RenderObject::viewRect() const
     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, intextraWidthToEndOfLine)
 {
    if (extraWidthToEndOfLine)
        *extraWidthToEndOfLine = 0;
@@ -2319,8 +2304,8 @@ int RenderObject::paddingTop() const
     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;
 }
 
@@ -2331,8 +2316,8 @@ int RenderObject::paddingBottom() const
     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;
 }
 
@@ -2343,8 +2328,8 @@ int RenderObject::paddingLeft() const
     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;
 }
 
@@ -2355,8 +2340,8 @@ int RenderObject::paddingRight() const
     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;
 }
 
@@ -2364,7 +2349,7 @@ int RenderObject::tabWidth() const
 {
     if (style()->collapseWhiteSpace())
         return 0;
-        
+
     return containingBlock()->tabWidth(true);
 }
 
@@ -2378,7 +2363,7 @@ bool RenderObject::hasOutlineAnnotation() const
     return element() && element()->isLink() && document()->printing();
 }
 
-RenderObject *RenderObject::container() const
+RenderObjectRenderObject::container() const
 {
     // This method is extremely similar to containingBlock(), but with a few notable
     // exceptions.
@@ -2390,7 +2375,7 @@ RenderObject *RenderObject::container() const
     // 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
@@ -2398,19 +2383,16 @@ RenderObject *RenderObject::container() const
         // 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;
 }
 
@@ -2427,7 +2409,6 @@ bool RenderObject::isSelectionBorder() const
     return st == SelectionStart || st == SelectionEnd || st == SelectionBoth;
 }
 
-
 void RenderObject::removeFromObjectLists()
 {
     if (documentBeingDestroyed())
@@ -2439,13 +2420,13 @@ void RenderObject::removeFromObjectLists()
             if (p->containsFloat(this))
                 outermostBlock = p;
         }
-        
+
         if (outermostBlock)
             outermostBlock->markAllDescendantsWithFloatsForLayout(this);
     }
 
     if (isPositioned()) {
-        RenderObject *p;
+        RenderObjectp;
         for (p = parent(); p; p = p->parent()) {
             if (p->isRenderBlock())
                 static_cast<RenderBlock*>(p)->removePositionedObject(this);
@@ -2484,36 +2465,36 @@ void RenderObject::destroy()
             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;
+    voidsavedBase = 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)
@@ -2521,11 +2502,6 @@ 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);
@@ -2544,7 +2520,7 @@ bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result,
     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);
@@ -2553,11 +2529,11 @@ bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result,
         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;
 }
 
@@ -2574,7 +2550,7 @@ void RenderObject::setInnerNode(HitTestResult& result)
         // 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())
@@ -2582,25 +2558,24 @@ void RenderObject::setInnerNode(HitTestResult& result)
     }
 }
 
-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;
@@ -2608,45 +2583,45 @@ short RenderObject::getVerticalPosition( bool firstLine ) const
     // 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 Fontf = 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
@@ -2669,8 +2644,8 @@ short RenderObject::baselinePosition(bool firstLine, bool isRootLineBox) const
 void RenderObject::invalidateVerticalPositions()
 {
     m_verticalPosition = PositionUndefined;
-    RenderObject *child = firstChild();
-    while( child ) {
+    RenderObjectchild = firstChild();
+    while(child) {
         child->invalidateVerticalPositions();
         child = child->nextSibling();
     }
@@ -2678,30 +2653,26 @@ void RenderObject::invalidateVerticalPositions()
 
 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 ) {
+
+    RenderObjectchild = 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();
     }
@@ -2712,25 +2683,24 @@ void RenderObject::recalcMinMaxWidths()
     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()
 {
 }
@@ -2750,7 +2720,7 @@ InlineBox* RenderObject::inlineBoxWrapper() const
     return 0;
 }
 
-void RenderObject::setInlineBoxWrapper(InlineBox* b)
+void RenderObject::setInlineBoxWrapper(InlineBox*)
 {
 }
 
@@ -2758,9 +2728,9 @@ void RenderObject::deleteLineBoxWrapper()
 {
 }
 
-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();
@@ -2782,20 +2752,20 @@ RenderStyle* RenderObject::getPseudoStyle(RenderStyle::PseudoId pseudo, RenderSt
 {
     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);
@@ -2842,7 +2812,7 @@ void RenderObject::getTextDecorationColors(int decorations, Color& underline, Co
             overline = curr->style()->color();
         if (decorations & LINE_THROUGH)
             linethrough = curr->style()->color();
-    }        
+    }
 }
 
 void RenderObject::updateWidgetPosition()
@@ -2852,24 +2822,23 @@ 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;
@@ -2883,7 +2852,7 @@ void RenderObject::addDashboardRegions(Vector<DashboardRegionValue>& regions)
         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) {
@@ -2891,7 +2860,7 @@ void RenderObject::addDashboardRegions(Vector<DashboardRegionValue>& regions)
                 region.clip.scale(pageScaleFactor);
             }
         }
-        
+
         regions.append(region);
     }
 }
@@ -2902,13 +2871,12 @@ void RenderObject::collectDashboardRegions(Vector<DashboardRegionValue>& regions
     // 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())
@@ -2917,7 +2885,7 @@ void RenderObject::collectBorders(DeprecatedValueList<CollapsedBorderValue>& bor
 
 bool RenderObject::avoidsFloats() const
 {
-    return isReplaced() || hasOverflowClip() || isHR(); 
+    return isReplaced() || hasOverflowClip() || isHR();
 }
 
 bool RenderObject::usesLineWidth() const
@@ -2931,17 +2899,18 @@ 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;
 
@@ -2963,8 +2932,8 @@ CounterNode* RenderObject::findCounter(const String& counterName, bool willNeedL
                     newNode = new CounterResetNode(this);
                     val = v.toInt();
                 }
-            } 
-            
+            }
+
             if (!newNode) {
                 newNode = new CounterNode(this);
                 val = 1;
@@ -2981,8 +2950,8 @@ CounterNode* RenderObject::findCounter(const String& counterName, bool willNeedL
             newNode = new CounterResetNode(this);
             newNode->setValue(0);
         }
-    } 
-    
+    }
+
     if (!newNode && !createIfNotFound)
         return 0;
     else if (!newNode) {
@@ -3003,7 +2972,7 @@ CounterNode* RenderObject::findCounter(const String& counterName, bool willNeedL
         objectsMap->set(this, nodeMap);
         m_hasCounterNodeMap = true;
     }
-    
+
     nodeMap->set(counterName, newNode);
 
     if (!isRoot()) {
@@ -3016,7 +2985,7 @@ CounterNode* RenderObject::findCounter(const String& counterName, bool willNeedL
             if (current)
                 break;
         }
-        
+
         CounterNode* last = current;
         CounterNode* sibling = current;
         if (last && !newNode->isReset()) {
@@ -3035,7 +3004,7 @@ CounterNode* RenderObject::findCounter(const String& counterName, bool willNeedL
                 }
                 n = n->previousSibling();
             }
-            
+
             if (sibling->isReset()) {
                 if (last != sibling)
                     sibling->insertAfter(newNode, last);
@@ -3058,13 +3027,14 @@ CounterNode* RenderObject::findCounter(const String& counterName, bool willNeedL
 
 UChar RenderObject::backslashAsCurrencySymbol() const
 {
-    if (Node *node = element())
-        if (TextResourceDecoder *decoder = node->document()->decoder())
+    if (Node *node = element()) {
+        if (TextResourceDecoderdecoder = node->document()->decoder())
             return decoder->encoding().backslashAsCurrencySymbol();
+    }
     return '\\';
 }
 
-void RenderObject::imageChanged(CachedImage *image)
+void RenderObject::imageChanged(CachedImageimage)
 {
     // Repaint when the background image or border image finishes loading.
     // This is needed for RenderBox objects, and also for table objects that hold
@@ -3073,9 +3043,11 @@ void RenderObject::imageChanged(CachedImage *image)
     // 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();
     }
 }
 
@@ -3112,19 +3084,19 @@ unsigned RenderObject::caretMaxRenderedOffset() const
     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)
+InlineBoxRenderObject::inlineBox(int offset, EAffinity affinity)
 {
     return inlineBoxWrapper();
 }
@@ -3140,7 +3112,7 @@ AffineTransform RenderObject::localTransform() const
 {
     return AffineTransform(1, 0, 0, 1, xPos(), yPos());
 }
+
 void RenderObject::setLocalTransform(const AffineTransform&)
 {
     ASSERT(false);
@@ -3153,9 +3125,9 @@ AffineTransform RenderObject::absoluteTransform() const
     return localTransform();
 }
 
-#endif
+#endif // SVG_SUPPORT
 
-}
+} // namespace WebCore
 
 #ifndef NDEBUG
 
index 789a809..51ec308 100644 (file)
@@ -32,6 +32,7 @@
 #include "RenderStyle.h"
 #include "ScrollBar.h"
 #include "VisiblePosition.h"
+#include <algorithm>
 #include <wtf/HashMap.h>
 
 /*
@@ -55,9 +56,9 @@ class Event;
 class FloatRect;
 class FrameView;
 class HTMLAreaElement;
+class HitTestResult;
 class InlineBox;
 class InlineFlowBox;
-class HitTestResult;
 class PlatformScrollbar;
 class Position;
 class RenderArena;
@@ -71,7 +72,6 @@ class RenderView;
 class String;
 class TextStream;
 class VisiblePosition;
-
 struct HitTestRequest;
 
 enum PaintPhase {
@@ -107,17 +107,22 @@ enum HitTestAction {
     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.
@@ -127,60 +132,64 @@ typedef HashSet<RenderFlow*> RenderFlowSequencedSet;
 /**
  * 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.
@@ -189,86 +198,76 @@ public:
     // 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(RenderObjectprevious) { m_previous = previous; }
+    void setNextSibling(RenderObjectnext) { m_next = next; }
+    void setParent(RenderObjectparent) { 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; }
@@ -284,7 +283,18 @@ public:
     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; }
@@ -294,18 +304,16 @@ public:
     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
@@ -313,32 +321,36 @@ public:
     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;
@@ -348,27 +360,29 @@ public:
     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;
+    RenderObjectcontainer() 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) {
+            RenderObjecto = this;
+            RenderObjectroot = this;
+            while(o) { // FIXME: && !o->m_recalcMinMax ) {
                 o->m_recalcMinMax = true;
                 root = o;
                 o = o->m_parent;
@@ -376,43 +390,44 @@ public:
         }
     }
 
-    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;
 
@@ -421,7 +436,8 @@ public:
      * (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)
@@ -441,14 +457,15 @@ public:
 
     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
@@ -474,7 +491,7 @@ public:
      * 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
@@ -493,42 +510,46 @@ public:
 
     // 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;
+    RenderBlockcontainingBlock() const;
 
     // return just the width of the containing block
     virtual int containingBlockWidth() const;
@@ -547,23 +568,24 @@ public:
     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();
     }
@@ -577,20 +599,20 @@ public:
     // 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;
@@ -615,10 +637,10 @@ public:
     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
@@ -627,48 +649,25 @@ public:
     // 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; }
@@ -680,11 +679,11 @@ public:
 
     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);
 
@@ -695,19 +694,22 @@ public:
     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>&);
@@ -717,8 +719,8 @@ public:
     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);
 
@@ -743,13 +745,13 @@ public:
 
     // 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(); }
@@ -766,7 +768,7 @@ public:
     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.
@@ -779,14 +781,14 @@ public:
     // 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; }
 
@@ -799,7 +801,7 @@ public:
     // 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;
@@ -809,16 +811,26 @@ public:
 
     // 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;
@@ -831,13 +843,13 @@ public:
      * @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
@@ -846,9 +858,7 @@ public:
 
     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; }
@@ -862,8 +872,8 @@ public:
     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*);
@@ -892,7 +902,7 @@ protected:
     short getVerticalPosition(bool firstLine) const;
 
     virtual void removeLeftoverAnonymousBoxes();
-    
+
     void arenaDelete(RenderArena*, void* objectBase);
 
 private:
@@ -900,9 +910,9 @@ private:
 
     Node* m_node;
 
-    RenderObject *m_parent;
-    RenderObject *m_previous;
-    RenderObject *m_next;
+    RenderObjectm_parent;
+    RenderObjectm_previous;
+    RenderObjectm_next;
 
     mutable short m_verticalPosition;
 
@@ -923,29 +933,17 @@ private:
     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