MCPcopy Create free account
hub / github.com/SpartanJ/eepp / updateLayout

Method updateLayout

src/eepp/ui/blocklayouter.cpp:46–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void BlockLayouter::updateLayout() {
47 if ( !mContainer->isType( UI_TYPE_HTML_WIDGET ) )
48 return;
49
50 auto* widget = mContainer->asType<UIHTMLWidget>();
51 auto* rt = widget->getRichTextPtr();
52 if ( rt == nullptr || mPacking )
53 return;
54 mResizedCount = 0;
55 mPacking = true;
56
57 mContainer->beginAttributesTransaction();
58
59 setMatchParentIfNeededVerticalGrowth();
60
61 const StyleSheetProperty* prop = nullptr;
62 if ( mContainer->getLayoutWidthPolicy() == SizePolicy::Fixed && mContainer->getUIStyle() &&
63 ( prop = mContainer->getUIStyle()->getProperty( PropertyId::Width ) ) ) {
64 mContainer->setInternalPixelsSize(
65 { mContainer->lengthFromValue( *prop ), mContainer->getPixelsSize().getHeight() } );
66 }
67
68 UIRichText::rebuildRichText( widget, *rt );
69
70 rt->updateLayout();
71
72 positionRichTextChildren( rt );
73
74 Float totW = mContainer->getPixelsSize().getWidth();
75 if ( mContainer->getLayoutWidthPolicy() == SizePolicy::WrapContent ) {
76 totW = rt->getSize().getWidth() + mContainer->getPixelsPadding().Left +
77 mContainer->getPixelsPadding().Right;
78 if ( !mContainer->getMaxWidthEq().empty() && totW > mContainer->getMaxSizePx().getWidth() )
79 mContainer->setClipType( ClipType::ContentBox );
80 }
81
82 if ( totW != mContainer->getPixelsSize().getWidth() ||
83 mContainer->getLayoutWidthPolicy() == SizePolicy::WrapContent )
84 mContainer->setInternalPixelsWidth( totW );
85
86 Float totH = mContainer->getPixelsSize().getHeight();
87 if ( mContainer->getLayoutHeightPolicy() == SizePolicy::WrapContent ) {
88 totH = rt->getSize().getHeight() + mContainer->getPixelsPadding().Top +
89 mContainer->getPixelsPadding().Bottom;
90 if ( !mContainer->getMaxHeightEq().empty() &&
91 totH > mContainer->getMaxSizePx().getHeight() )
92 mContainer->setClipType( ClipType::ContentBox );
93 }
94
95 if ( totH != mContainer->getPixelsSize().getHeight() ||
96 mContainer->getLayoutHeightPolicy() == SizePolicy::WrapContent )
97 mContainer->setInternalPixelsHeight( totH );
98
99 mContainer->endAttributesTransaction();
100
101 if ( mResizedCount > 0 )
102 positionRichTextChildren( rt );
103

Callers

nothing calls this directly

Calls 15

getUIStyleMethod · 0.80
lengthFromValueMethod · 0.80
getMaxSizePxMethod · 0.80
isTypeMethod · 0.45
getPropertyMethod · 0.45
setInternalPixelsSizeMethod · 0.45
getHeightMethod · 0.45
getPixelsSizeMethod · 0.45

Tested by

no test coverage detected