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

Side by Side 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, 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
« no previous file with comments | « sky/engine/core/dom/Element.h ('k') | sky/engine/core/dom/Element.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 918
919 double Element::width() const 919 double Element::width() const
920 { 920 {
921 if (RenderBox* box = renderBox()) 921 if (RenderBox* box = renderBox())
922 return box->width(); 922 return box->width();
923 return 0; 923 return 0;
924 } 924 }
925 925
926 void Element::setWidth(double width) 926 void Element::setWidth(double width)
927 { 927 {
928 if (RenderBox* box = renderBox()) 928 if (RenderBox* box = renderBox()) {
929 return box->setWidth(width); 929 box->setWidth(width);
930 // TODO(ojan): Remove override widths once we remove box layout from the C++ code.
931 box->setOverrideLogicalContentWidth(width);
932 }
930 } 933 }
931 934
932 double Element::height() const 935 double Element::height() const
933 { 936 {
934 if (RenderBox* box = renderBox()) 937 if (RenderBox* box = renderBox())
935 return box->height(); 938 return box->height();
936 return 0; 939 return 0;
937 } 940 }
938 941
939 void Element::setHeight(double height) 942 void Element::setHeight(double height)
940 { 943 {
941 if (RenderBox* box = renderBox()) 944 if (RenderBox* box = renderBox())
942 return box->setHeight(height); 945 return box->setHeight(height);
943 } 946 }
944 947
948 void Element::setNeedsLayout()
949 {
950 if (RenderBox* box = renderBox())
951 box->setNeedsLayout();
952 }
953
954 void Element::layout()
955 {
956 if (RenderBox* box = renderBox())
957 box->layoutIfNeeded();
958 }
959
945 LayoutCallback* Element::layoutManager() const 960 LayoutCallback* Element::layoutManager() const
946 { 961 {
947 return m_layoutManager.get(); 962 return m_layoutManager.get();
948 } 963 }
949 964
950 void Element::setLayoutManager(PassOwnPtr<LayoutCallback> callback) 965 void Element::setLayoutManager(PassOwnPtr<LayoutCallback> callback)
951 { 966 {
967 if (renderer() && !renderer()->isRenderCustomLayout()) {
968 // We don't go through the normal reattach codepaths because
969 // those are all tied to changes to the RenderStyle.
970 markAncestorsWithChildNeedsStyleRecalc();
971 detach();
972 }
952 m_layoutManager = callback; 973 m_layoutManager = callback;
953 } 974 }
954 975
955 void Element::childrenChanged(const ChildrenChange& change) 976 void Element::childrenChanged(const ChildrenChange& change)
956 { 977 {
957 ContainerNode::childrenChanged(change); 978 ContainerNode::childrenChanged(change);
958 979
959 if (ElementShadow* shadow = this->shadow()) 980 if (ElementShadow* shadow = this->shadow())
960 shadow->setNeedsDistributionRecalc(); 981 shadow->setNeedsDistributionRecalc();
961 } 982 }
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 return false; 1642 return false;
1622 if (treeScope().scopedStyleResolver().hasSelectorForId(idValue)) 1643 if (treeScope().scopedStyleResolver().hasSelectorForId(idValue))
1623 return true; 1644 return true;
1624 // Host rules could also have effects. 1645 // Host rules could also have effects.
1625 if (ShadowRoot* shadowRoot = this->shadowRoot()) 1646 if (ShadowRoot* shadowRoot = this->shadowRoot())
1626 return shadowRoot->scopedStyleResolver().hasSelectorForId(idValue); 1647 return shadowRoot->scopedStyleResolver().hasSelectorForId(idValue);
1627 return false; 1648 return false;
1628 } 1649 }
1629 1650
1630 } // namespace blink 1651 } // namespace blink
OLDNEW
« 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