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

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

Issue 1055263002: Make custom layout actually work. (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 249486fcbab8c8a41f4b43692075170cf338deac..ff0798b1e8f8e33578a31697508606879cc972c9 100644
--- a/sky/engine/core/dom/Element.cpp
+++ b/sky/engine/core/dom/Element.cpp
@@ -925,8 +925,11 @@ double Element::width() const
void Element::setWidth(double width)
{
- if (RenderBox* box = renderBox())
- return box->setWidth(width);
+ if (RenderBox* box = renderBox()) {
+ box->setWidth(width);
+ // TODO(ojan): Remove override widths once we remove box layout from the C++ code.
+ box->setOverrideLogicalContentWidth(width);
+ }
}
double Element::height() const
@@ -942,6 +945,18 @@ void Element::setHeight(double height)
return box->setHeight(height);
}
+void Element::setNeedsLayout()
+{
+ if (RenderBox* box = renderBox())
+ box->setNeedsLayout();
+}
+
+void Element::layout()
+{
+ if (RenderBox* box = renderBox())
+ box->layoutIfNeeded();
+}
+
LayoutCallback* Element::layoutManager() const
{
return m_layoutManager.get();
@@ -949,6 +964,12 @@ LayoutCallback* Element::layoutManager() const
void Element::setLayoutManager(PassOwnPtr<LayoutCallback> callback)
{
+ if (renderer() && !renderer()->isRenderCustomLayout()) {
+ // We don't go through the normal reattach codepaths because
+ // those are all tied to changes to the RenderStyle.
+ markAncestorsWithChildNeedsStyleRecalc();
+ detach();
+ }
m_layoutManager = callback;
}
« 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