Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(624)

Unified Diff: sky/engine/core/dom/Element.cpp

Issue 1055243002: Revert "Revert "First iteration on custom layout."" (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/dom/Element.h ('k') | sky/engine/core/dom/Element.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/Element.cpp
diff --git a/sky/engine/core/dom/Element.cpp b/sky/engine/core/dom/Element.cpp
index 558182c17df21b3bc7b0346c54ec3cfd05b1fd85..249486fcbab8c8a41f4b43692075170cf338deac 100644
--- a/sky/engine/core/dom/Element.cpp
+++ b/sky/engine/core/dom/Element.cpp
@@ -72,11 +72,13 @@
#include "sky/engine/core/html/HTMLTemplateElement.h"
#include "sky/engine/core/html/parser/HTMLDocumentParser.h"
#include "sky/engine/core/html/parser/HTMLParserIdioms.h"
+#include "sky/engine/core/layout/LayoutCallback.h"
#include "sky/engine/core/page/ChromeClient.h"
#include "sky/engine/core/page/FocusController.h"
#include "sky/engine/core/page/Page.h"
#include "sky/engine/core/painting/PaintingCallback.h"
#include "sky/engine/core/painting/PaintingTasks.h"
+#include "sky/engine/core/rendering/RenderCustomLayout.h"
#include "sky/engine/core/rendering/RenderLayer.h"
#include "sky/engine/core/rendering/RenderView.h"
#include "sky/engine/platform/EventDispatchForbiddenScope.h"
@@ -627,6 +629,8 @@ const AtomicString Element::imageSourceURL() const
RenderObject* Element::createRenderer(RenderStyle* style)
{
+ if (m_layoutManager)
+ return new RenderCustomLayout(this);
return RenderObject::createObject(this, style);
}
@@ -886,6 +890,68 @@ ShadowRoot* Element::shadowRoot() const
return elementShadow->shadowRoot();
}
+double Element::x() const
+{
+ if (RenderBox* box = renderBox())
+ return box->x();
+ return 0;
+}
+
+void Element::setX(double x)
+{
+ if (RenderBox* box = renderBox())
+ return box->setX(x);
+}
+
+double Element::y() const
+{
+ if (RenderBox* box = renderBox())
+ return box->y();
+ return 0;
+}
+
+void Element::setY(double y)
+{
+ if (RenderBox* box = renderBox())
+ return box->setY(y);
+}
+
+double Element::width() const
+{
+ if (RenderBox* box = renderBox())
+ return box->width();
+ return 0;
+}
+
+void Element::setWidth(double width)
+{
+ if (RenderBox* box = renderBox())
+ return box->setWidth(width);
+}
+
+double Element::height() const
+{
+ if (RenderBox* box = renderBox())
+ return box->height();
+ return 0;
+}
+
+void Element::setHeight(double height)
+{
+ if (RenderBox* box = renderBox())
+ return box->setHeight(height);
+}
+
+LayoutCallback* Element::layoutManager() const
+{
+ return m_layoutManager.get();
+}
+
+void Element::setLayoutManager(PassOwnPtr<LayoutCallback> callback)
+{
+ m_layoutManager = callback;
+}
+
void Element::childrenChanged(const ChildrenChange& change)
{
ContainerNode::childrenChanged(change);
« no previous file with comments | « sky/engine/core/dom/Element.h ('k') | sky/engine/core/dom/Element.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698