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

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

Issue 1101793003: Expose minContentWidth/maxContentWidth and a callback for computing them. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: make variable names consistent Created 5 years, 8 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
Index: sky/engine/core/dom/Element.cpp
diff --git a/sky/engine/core/dom/Element.cpp b/sky/engine/core/dom/Element.cpp
index c3b6a981518ff0c3c2861d0d1ffbb9d540ae2890..c6452401ce22d976196de8cb296406c52febfc17 100644
--- a/sky/engine/core/dom/Element.cpp
+++ b/sky/engine/core/dom/Element.cpp
@@ -945,6 +945,32 @@ void Element::setHeight(double height)
return box->setHeight(height);
}
+double Element::minContentWidth() const
+{
+ if (RenderBox* box = renderBox())
+ return box->minPreferredLogicalWidth();
+ return 0;
+}
+
+void Element::setMinContentWidth(double width)
+{
+ if (RenderBox* box = renderBox())
+ return box->setMinPreferredLogicalWidth(width);
+}
+
+double Element::maxContentWidth() const
+{
+ if (RenderBox* box = renderBox())
+ return box->maxPreferredLogicalWidth();
+ return 0;
+}
+
+void Element::setMaxContentWidth(double width)
+{
+ if (RenderBox* box = renderBox())
+ return box->setMaxPreferredLogicalWidth(width);
+}
+
void Element::setNeedsLayout()
{
if (RenderBox* box = renderBox())
@@ -962,19 +988,26 @@ LayoutCallback* Element::layoutManager() const
return m_layoutManager.get();
}
-void Element::setLayoutManager(PassOwnPtr<LayoutCallback> callback)
+LayoutCallback* Element::intrinsicWidthsComputer() const
+{
+ return m_intrinsicWidthsComputer.get();
+}
+
+void Element::setLayoutManager(PassOwnPtr<LayoutCallback> layoutManager,
+ PassOwnPtr<LayoutCallback> intrinsicWidthsComputer)
{
bool isAlreadyCustomLayout = renderer() && renderer()->isRenderCustomLayout();
- bool requiresCustomLayout = callback;
+ bool requiresCustomLayout = layoutManager;
if (requiresCustomLayout != isAlreadyCustomLayout) {
// We don't go through the normal reattach codepaths because
// those are all tied to changes to the RenderStyle.
markAncestorsWithChildNeedsStyleRecalc();
detach();
- } else if (callback.get() != m_layoutManager) {
+ } else if (layoutManager.get() != m_layoutManager) {
setNeedsLayout();
}
- m_layoutManager = callback;
+ m_layoutManager = layoutManager;
+ m_intrinsicWidthsComputer = intrinsicWidthsComputer;
}
void Element::childrenChanged(const ChildrenChange& change)

Powered by Google App Engine
This is Rietveld 408576698