Index: Source/core/editing/EditingStyle.cpp |
diff --git a/Source/core/editing/EditingStyle.cpp b/Source/core/editing/EditingStyle.cpp |
index c0fdd1fb75bf2c76455952fe50cd93c9095a3841..5719e79c6a2432e880d527457db298f24dffc40a 100644 |
--- a/Source/core/editing/EditingStyle.cpp |
+++ b/Source/core/editing/EditingStyle.cpp |
@@ -34,6 +34,7 @@ |
#include "core/css/CSSRuleList.h" |
#include "core/css/CSSStyleRule.h" |
#include "core/css/CSSValueList.h" |
+#include "core/css/CSSValuePool.h" |
#include "core/css/FontSize.h" |
#include "core/css/RuntimeCSSEnabled.h" |
#include "core/css/StylePropertySet.h" |
@@ -51,6 +52,8 @@ |
#include "core/editing/htmlediting.h" |
#include "core/frame/LocalFrame.h" |
#include "core/html/HTMLFontElement.h" |
+#include "core/rendering/RenderBox.h" |
+#include "core/rendering/RenderObject.h" |
#include "core/rendering/style/RenderStyle.h" |
namespace WebCore { |
@@ -1232,6 +1235,31 @@ void EditingStyle::removePropertiesInElementDefaultStyle(Element* element) |
removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); |
} |
+void EditingStyle::addAbsolutePositioningFromElement(const Element& element) |
+{ |
+ LayoutRect rect = element.boundingBox(); |
+ RenderObject* renderer = element.renderer(); |
+ |
+ LayoutUnit x = rect.x(); |
+ LayoutUnit y = rect.y(); |
+ LayoutUnit width = rect.width(); |
+ LayoutUnit height = rect.height(); |
+ if (renderer && renderer->isBox()) { |
+ RenderBox* renderBox = toRenderBox(renderer); |
+ |
+ x -= renderBox->marginLeft(); |
+ y -= renderBox->marginTop(); |
+ |
+ m_mutableStyle->setProperty(CSSPropertyBoxSizing, CSSValueBorderBox); |
esprehn
2014/06/26 09:32:55
The spec is going to have to be really clear about
|
+ } |
+ |
+ m_mutableStyle->setProperty(CSSPropertyPosition, CSSValueAbsolute); |
+ m_mutableStyle->setProperty(CSSPropertyLeft, cssValuePool().createValue(x, CSSPrimitiveValue::CSS_PX)); |
+ m_mutableStyle->setProperty(CSSPropertyTop, cssValuePool().createValue(y, CSSPrimitiveValue::CSS_PX)); |
+ m_mutableStyle->setProperty(CSSPropertyWidth, cssValuePool().createValue(width, CSSPrimitiveValue::CSS_PX)); |
+ m_mutableStyle->setProperty(CSSPropertyHeight, cssValuePool().createValue(height, CSSPrimitiveValue::CSS_PX)); |
+} |
+ |
void EditingStyle::forceInline() |
{ |
if (!m_mutableStyle) |