2009-02-05  David Hyatt  <hyatt@apple.com>

        Move the m_layer member variable of RenderBox up into RenderBoxModelObject.  Refactor styleDidChange'
        of RenderObject, RenderBoxModelObject and RenderBox to get more of the code in the correct subclass.  
        In order to set the various RenderObject bits properly prior to the test for whether a layer is 
        required, I added an additional method, updateBoxModelInfoAfterStyleChange, that is responsible
        for setting all of the bits.
        
        Eliminate hasStaticX/Y, staticX/Y, and setStaticX/Y from the render tree.  Move hasStaticX/Y to
        RenderStyle, and just use the corresponding layer() methods for the
        staticX/Y getters/setters.

        Reviewed by Sam Weinig

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::layoutBlock):
        (WebCore::RenderBlock::adjustPositionedBlock):
        (WebCore::RenderBlock::layoutOnlyPositionedObjects):
        (WebCore::RenderBlock::layoutPositionedObjects):
        (WebCore::RenderBlock::paintObject):
        (WebCore::RenderBlock::nodeAtPoint):
        (WebCore::RenderBlock::offsetForContents):
        (WebCore::RenderBlock::calcPrefWidths):
        (WebCore::RenderBlock::baselinePosition):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::RenderBox):
        (WebCore::RenderBox::destroy):
        (WebCore::RenderBox::styleWillChange):
        (WebCore::RenderBox::styleDidChange):
        (WebCore::RenderBox::updateBoxModelInfoFromStyle):
        (WebCore::RenderBox::scrollWidth):
        (WebCore::RenderBox::scrollHeight):
        (WebCore::RenderBox::scrollLeft):
        (WebCore::RenderBox::scrollTop):
        (WebCore::RenderBox::setScrollLeft):
        (WebCore::RenderBox::setScrollTop):
        (WebCore::RenderBox::getOverflowClipRect):
        (WebCore::RenderBox::localToAbsolute):
        (WebCore::RenderBox::absoluteToLocal):
        (WebCore::RenderBox::localToContainerQuad):
        (WebCore::RenderBox::position):
        (WebCore::RenderBox::computeRectForRepaint):
        (WebCore::RenderBox::calcAbsoluteHorizontal):
        (WebCore::RenderBox::calcAbsoluteVertical):
        (WebCore::RenderBox::calcAbsoluteHorizontalReplaced):
        (WebCore::RenderBox::calcAbsoluteVerticalReplaced):
        * rendering/RenderBox.h:
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::RenderBoxModelObject):
        (WebCore::RenderBoxModelObject::destroy):
        (WebCore::RenderBoxModelObject::styleWillChange):
        (WebCore::RenderBoxModelObject::styleDidChange):
        (WebCore::RenderBoxModelObject::updateBoxModelInfoFromStyle):
        * rendering/RenderBoxModelObject.h:
        (WebCore::RenderBoxModelObject::layer):
        (WebCore::RenderBoxModelObject::requiresLayer):
        * rendering/RenderFlexibleBox.cpp:
        (WebCore::RenderFlexibleBox::layoutBlock):
        (WebCore::RenderFlexibleBox::layoutHorizontalBox):
        (WebCore::RenderFlexibleBox::layoutVerticalBox):
        * rendering/RenderInline.cpp:
        (WebCore::RenderInline::updateBoxModelInfoFromStyle):
        (WebCore::RenderInline::styleDidChange):
        (WebCore::RenderInline::relativePositionedInlineOffset):
        * rendering/RenderInline.h:
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::setStaticY):
        (WebCore::RenderLayer::updateLayerPosition):
        * rendering/RenderLayer.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::setStyle):
        (WebCore::RenderObject::styleDidChange):
        * rendering/RenderObject.h:
        (WebCore::RenderObject::markContainingBlocksForLayout):
        * rendering/RenderTableRow.cpp:
        (WebCore::RenderTableRow::paint):
        * rendering/RenderWidget.cpp:
        (WebCore::RenderWidget::destroy):
        * rendering/bidi.cpp:
        (WebCore::appendRunsForObject):
        (WebCore::RenderBlock::layoutInlineChildren):
        (WebCore::RenderBlock::skipTrailingWhitespace):
        (WebCore::RenderBlock::skipLeadingWhitespace):
        (WebCore::RenderBlock::findNextLineBreak):
        * rendering/style/RenderStyle.h:
        (WebCore::InheritedFlags::hasStaticX):
        (WebCore::InheritedFlags::hasStaticY):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index 451a2ed..5ae0c0b 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -387,7 +387,7 @@
 static void appendRunsForObject(int start, int end, RenderObject* obj, InlineBidiResolver& resolver)
 {
     if (start > end || obj->isFloating() ||
-        (obj->isPositioned() && !obj->hasStaticX() && !obj->hasStaticY() && !obj->container()->isRenderInline()))
+        (obj->isPositioned() && !obj->style()->hasStaticX() && !obj->style()->hasStaticY() && !obj->container()->isRenderInline()))
         return;
 
     bool haveNextMidpoint = (sCurrMidpoint < sNumMidpoints);
@@ -841,12 +841,12 @@
             setNeedsLayout(true, false);  // Mark ourselves as needing a full layout. This way we'll repaint like
                                           // we're supposed to.
             RenderView* v = view();
-            if (v && !v->doingFullRepaint() && m_layer) {
+            if (v && !v->doingFullRepaint() && hasLayer()) {
                 // Because we waited until we were already inside layout to discover
                 // that the block really needed a full layout, we missed our chance to repaint the layer
                 // before layout started.  Luckily the layer has cached the repaint rect for its original
                 // position and size, and so we can use that to make a repaint happen now.
-                repaintUsingContainer(containerForRepaint(), m_layer->repaintRect());
+                repaintUsingContainer(containerForRepaint(), layer()->repaintRect());
             }
         }
 
@@ -1438,19 +1438,20 @@
                 // A relative positioned inline encloses us.  In this case, we also have to determine our
                 // position as though we were an inline.  Set |staticX| and |staticY| on the relative positioned
                 // inline so that we can obtain the value later.
-                c->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : rightOffset(height(), false));
-                c->setStaticY(height());
+                toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : rightOffset(height(), false));
+                toRenderInline(c)->layer()->setStaticY(height());
             }
     
-            if (object->hasStaticX()) {
-                if (object->style()->isOriginalDisplayInlineType())
-                    object->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : width() - rightOffset(height(), false));
+            RenderBox* box = toRenderBox(object);
+            if (box->style()->hasStaticX()) {
+                if (box->style()->isOriginalDisplayInlineType())
+                    box->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : width() - rightOffset(height(), false));
                 else
-                    object->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
+                    box->layer()->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
             }
     
-            if (object->hasStaticY())
-                object->setStaticY(height());
+            if (box->style()->hasStaticY())
+                box->layer()->setStaticY(height());
         }
         iterator.increment();
     }
@@ -1473,19 +1474,20 @@
                 // A relative positioned inline encloses us.  In this case, we also have to determine our
                 // position as though we were an inline.  Set |staticX| and |staticY| on the relative positioned
                 // inline so that we can obtain the value later.
-                c->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : rightOffset(height(), firstLine));
-                c->setStaticY(height());
+                toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : rightOffset(height(), firstLine));
+                toRenderInline(c)->layer()->setStaticY(height());
             }
     
-            if (object->hasStaticX()) {
+            RenderBox* box = toRenderBox(object);
+            if (box->style()->hasStaticX()) {
                 if (object->style()->isOriginalDisplayInlineType())
-                    object->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : width() - rightOffset(height(), firstLine));
+                    box->layer()->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : width() - rightOffset(height(), firstLine));
                 else
-                    object->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
+                    box->layer()->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
             }
     
-            if (object->hasStaticY())
-                object->setStaticY(height());
+            if (box->style()->hasStaticY())
+                box->layer()->setStaticY(height());
         }
         resolver.increment();
     }
@@ -1642,10 +1644,11 @@
             } else if (o->isPositioned()) {
                 // If our original display wasn't an inline type, then we can
                 // go ahead and determine our static x position now.
-                bool isInlineType = o->style()->isOriginalDisplayInlineType();
-                bool needToSetStaticX = o->hasStaticX();
-                if (o->hasStaticX() && !isInlineType) {
-                    o->setStaticX(o->parent()->style()->direction() == LTR ?
+                RenderBox* box = toRenderBox(o);
+                bool isInlineType = box->style()->isOriginalDisplayInlineType();
+                bool needToSetStaticX = box->style()->hasStaticX();
+                if (box->style()->hasStaticX() && !isInlineType) {
+                    box->layer()->setStaticX(o->parent()->style()->direction() == LTR ?
                                   borderLeft() + paddingLeft() :
                                   borderRight() + paddingRight());
                     needToSetStaticX = false;
@@ -1653,9 +1656,9 @@
 
                 // If our original display was an INLINE type, then we can go ahead
                 // and determine our static y position now.
-                bool needToSetStaticY = o->hasStaticY();
-                if (o->hasStaticY() && isInlineType) {
-                    o->setStaticY(height());
+                bool needToSetStaticY = box->style()->hasStaticY();
+                if (box->style()->hasStaticY() && isInlineType) {
+                    box->layer()->setStaticY(height());
                     needToSetStaticY = false;
                 }