Index: third_party/WebKit/WebCore/rendering/RenderBoxModelObject.cpp |
=================================================================== |
--- third_party/WebKit/WebCore/rendering/RenderBoxModelObject.cpp (revision 9383) |
+++ third_party/WebKit/WebCore/rendering/RenderBoxModelObject.cpp (working copy) |
@@ -1,120 +1,35 @@ |
-/* |
- * Copyright (C) 2009 Apple Inc. All rights reserved. |
- * |
- * This library is free software; you can redistribute it and/or |
- * modify it under the terms of the GNU Library General Public |
- * License as published by the Free Software Foundation; either |
- * version 2 of the License, or (at your option) any later version. |
- * |
- * This library is distributed in the hope that it will be useful, |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
- * Library General Public License for more details. |
- * |
- * You should have received a copy of the GNU Library General Public License |
- * along with this library; see the file COPYING.LIB. If not, write to |
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
- * Boston, MA 02110-1301, USA. |
- * |
- */ |
- |
-#include "config.h" |
-#include "RenderBoxModelObject.h" |
- |
-#include "RenderBlock.h" |
-#include "RenderLayer.h" |
-#include "RenderView.h" |
- |
-namespace WebCore { |
- |
-bool RenderBoxModelObject::s_wasFloating = false; |
- |
-RenderBoxModelObject::RenderBoxModelObject(Node* node) |
- : RenderObject(node) |
- , m_layer(0) |
-{ |
-} |
- |
-RenderBoxModelObject::~RenderBoxModelObject() |
-{ |
-} |
- |
-void RenderBoxModelObject::destroy() |
-{ |
- // This must be done before we destroy the RenderObject. |
- if (m_layer) |
- m_layer->clearClipRects(); |
- RenderObject::destroy(); |
-} |
- |
-void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) |
-{ |
- s_wasFloating = isFloating(); |
- RenderObject::styleWillChange(diff, newStyle); |
-} |
- |
-void RenderBoxModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) |
-{ |
- RenderObject::styleDidChange(diff, oldStyle); |
- updateBoxModelInfoFromStyle(); |
- |
- if (requiresLayer()) { |
- if (!layer()) { |
- if (s_wasFloating && isFloating()) |
- setChildNeedsLayout(true); |
- m_layer = new (renderArena()) RenderLayer(this); |
- setHasLayer(true); |
- m_layer->insertOnlyThisLayer(); |
- if (parent() && !needsLayout() && containingBlock()) |
- m_layer->updateLayerPositions(); |
- } |
- } else if (layer() && layer()->parent()) { |
- |
- RenderLayer* layer = m_layer; |
- m_layer = 0; |
- setHasLayer(false); |
- setHasTransform(false); // Either a transform wasn't specified or the object doesn't support transforms, so just null out the bit. |
- setHasReflection(false); |
- layer->removeOnlyThisLayer(); |
- if (s_wasFloating && isFloating()) |
- setChildNeedsLayout(true); |
- } |
- |
- if (m_layer) |
- m_layer->styleChanged(diff, oldStyle); |
-} |
- |
-void RenderBoxModelObject::updateBoxModelInfoFromStyle() |
-{ |
- // Set the appropriate bits for a box model object. Since all bits are cleared in styleWillChange, |
- // we only check for bits that could possibly be set to true. |
- setHasBoxDecorations(style()->hasBorder() || style()->hasBackground() || style()->hasAppearance() || style()->boxShadow()); |
- setInline(style()->isDisplayInlineType()); |
- setRelPositioned(style()->position() == RelativePosition); |
-} |
- |
-int RenderBoxModelObject::relativePositionOffsetX() const |
-{ |
- if (!style()->left().isAuto()) { |
- if (!style()->right().isAuto() && containingBlock()->style()->direction() == RTL) |
- return -style()->right().calcValue(containingBlockWidth()); |
- return style()->left().calcValue(containingBlockWidth()); |
- } |
- if (!style()->right().isAuto()) |
- return -style()->right().calcValue(containingBlockWidth()); |
- return 0; |
-} |
- |
-int RenderBoxModelObject::relativePositionOffsetY() const |
-{ |
- if (!style()->top().isAuto()) { |
- if (!style()->top().isPercent() || containingBlock()->style()->height().isFixed()) |
- return style()->top().calcValue(containingBlockHeight()); |
- } else if (!style()->bottom().isAuto()) { |
- if (!style()->bottom().isPercent() || containingBlock()->style()->height().isFixed()) |
- return -style()->bottom().calcValue(containingBlockHeight()); |
- } |
- return 0; |
-} |
- |
-} // namespace WebCore |
+/* |
+ * Copyright (C) 2009 Apple Inc. All rights reserved. |
+ * |
+ * This library is free software; you can redistribute it and/or |
+ * modify it under the terms of the GNU Library General Public |
+ * License as published by the Free Software Foundation; either |
+ * version 2 of the License, or (at your option) any later version. |
+ * |
+ * This library is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+ * Library General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU Library General Public License |
+ * along with this library; see the file COPYING.LIB. If not, write to |
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
+ * Boston, MA 02110-1301, USA. |
+ * |
+ */ |
+ |
+#include "config.h" |
+#include "RenderBoxModelObject.h" |
+ |
+namespace WebCore { |
+ |
+RenderBoxModelObject::RenderBoxModelObject(Node* node) |
+ : RenderObject(node) |
+{ |
+} |
+ |
+RenderBoxModelObject::~RenderBoxModelObject() |
+{ |
+} |
+ |
+} // namespace WebCore |