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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 return box->height(); 938 return box->height();
939 return 0; 939 return 0;
940 } 940 }
941 941
942 void Element::setHeight(double height) 942 void Element::setHeight(double height)
943 { 943 {
944 if (RenderBox* box = renderBox()) 944 if (RenderBox* box = renderBox())
945 return box->setHeight(height); 945 return box->setHeight(height);
946 } 946 }
947 947
948 double Element::minContentWidth() const
949 {
950 if (RenderBox* box = renderBox())
951 return box->minPreferredLogicalWidth();
952 return 0;
953 }
954
955 void Element::setMinContentWidth(double width)
956 {
957 if (RenderBox* box = renderBox())
958 return box->setMinPreferredLogicalWidth(width);
959 }
960
961 double Element::maxContentWidth() const
962 {
963 if (RenderBox* box = renderBox())
964 return box->maxPreferredLogicalWidth();
965 return 0;
966 }
967
968 void Element::setMaxContentWidth(double width)
969 {
970 if (RenderBox* box = renderBox())
971 return box->setMaxPreferredLogicalWidth(width);
972 }
973
948 void Element::setNeedsLayout() 974 void Element::setNeedsLayout()
949 { 975 {
950 if (RenderBox* box = renderBox()) 976 if (RenderBox* box = renderBox())
951 box->setNeedsLayout(); 977 box->setNeedsLayout();
952 } 978 }
953 979
954 void Element::layout() 980 void Element::layout()
955 { 981 {
956 if (RenderBox* box = renderBox()) 982 if (RenderBox* box = renderBox())
957 box->layoutIfNeeded(); 983 box->layoutIfNeeded();
958 } 984 }
959 985
960 LayoutCallback* Element::layoutManager() const 986 LayoutCallback* Element::layoutManager() const
961 { 987 {
962 return m_layoutManager.get(); 988 return m_layoutManager.get();
963 } 989 }
964 990
965 void Element::setLayoutManager(PassOwnPtr<LayoutCallback> callback) 991 LayoutCallback* Element::intrinsicWidthsComputer() const
992 {
993 return m_intrinsicWidthsComputer.get();
994 }
995
996 void Element::setLayoutManager(PassOwnPtr<LayoutCallback> layoutManager,
997 PassOwnPtr<LayoutCallback> intrinsicWidthsComputer)
966 { 998 {
967 bool isAlreadyCustomLayout = renderer() && renderer()->isRenderCustomLayout( ); 999 bool isAlreadyCustomLayout = renderer() && renderer()->isRenderCustomLayout( );
968 bool requiresCustomLayout = callback; 1000 bool requiresCustomLayout = layoutManager;
969 if (requiresCustomLayout != isAlreadyCustomLayout) { 1001 if (requiresCustomLayout != isAlreadyCustomLayout) {
970 // We don't go through the normal reattach codepaths because 1002 // We don't go through the normal reattach codepaths because
971 // those are all tied to changes to the RenderStyle. 1003 // those are all tied to changes to the RenderStyle.
972 markAncestorsWithChildNeedsStyleRecalc(); 1004 markAncestorsWithChildNeedsStyleRecalc();
973 detach(); 1005 detach();
974 } else if (callback.get() != m_layoutManager) { 1006 } else if (layoutManager.get() != m_layoutManager) {
975 setNeedsLayout(); 1007 setNeedsLayout();
976 } 1008 }
977 m_layoutManager = callback; 1009 m_layoutManager = layoutManager;
1010 m_intrinsicWidthsComputer = intrinsicWidthsComputer;
978 } 1011 }
979 1012
980 void Element::childrenChanged(const ChildrenChange& change) 1013 void Element::childrenChanged(const ChildrenChange& change)
981 { 1014 {
982 ContainerNode::childrenChanged(change); 1015 ContainerNode::childrenChanged(change);
983 1016
984 if (ElementShadow* shadow = this->shadow()) 1017 if (ElementShadow* shadow = this->shadow())
985 shadow->setNeedsDistributionRecalc(); 1018 shadow->setNeedsDistributionRecalc();
986 } 1019 }
987 1020
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 return false; 1679 return false;
1647 if (treeScope().scopedStyleResolver().hasSelectorForId(idValue)) 1680 if (treeScope().scopedStyleResolver().hasSelectorForId(idValue))
1648 return true; 1681 return true;
1649 // Host rules could also have effects. 1682 // Host rules could also have effects.
1650 if (ShadowRoot* shadowRoot = this->shadowRoot()) 1683 if (ShadowRoot* shadowRoot = this->shadowRoot())
1651 return shadowRoot->scopedStyleResolver().hasSelectorForId(idValue); 1684 return shadowRoot->scopedStyleResolver().hasSelectorForId(idValue);
1652 return false; 1685 return false;
1653 } 1686 }
1654 1687
1655 } // namespace blink 1688 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698