Introduce first marker

Summary: @public Adds a marker section for a complete layout pass

Reviewed By: SidharthGuglani

Differential Revision: D13819447

fbshipit-source-id: 21a80f0fe3d325d804a968508761d115c50d3dc1
This commit is contained in:
David Aurelio
2019-01-29 10:30:11 -08:00
committed by Facebook Github Bot
parent 58f0cca7c7
commit 74dd627495
2 changed files with 16 additions and 2 deletions

View File

@@ -85,6 +85,16 @@ TEST_F(MarkerTest, marker_end_works) {
<< "pointer returned by `startMarker` was not passed to `endMarker`"; << "pointer returned by `startMarker` was not passed to `endMarker`";
} }
TEST_F(MarkerTest, layout_marker) {
auto config = makeConfig();
auto root = makeNode(config);
YGNodeCalculateLayout(root.get(), YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(markerCookie.start.marker, YGMarkerLayout);
ASSERT_EQ(markerCookie.start.node, root.get());
}
void* MarkerTest::startMarker( void* MarkerTest::startMarker(
YGMarker marker, YGMarker marker,
YGNodeRef node, YGNodeRef node,

View File

@@ -12,6 +12,7 @@
#include "YGNode.h" #include "YGNode.h"
#include "YGNodePrint.h" #include "YGNodePrint.h"
#include "Yoga-internal.h" #include "Yoga-internal.h"
#include "instrumentation.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#include <float.h> #include <float.h>
@@ -4004,6 +4005,8 @@ void YGNodeCalculateLayout(
const float ownerWidth, const float ownerWidth,
const float ownerHeight, const float ownerHeight,
const YGDirection ownerDirection) { const YGDirection ownerDirection) {
marker::MarkerSection<YGMarkerLayout> marker{node};
// Increment the generation count. This will force the recursive routine to // Increment the generation count. This will force the recursive routine to
// visit all dirty nodes at least once. Subsequent visits will be skipped if // visit all dirty nodes at least once. Subsequent visits will be skipped if
// the input parameters don't change. // the input parameters don't change.
@@ -4118,8 +4121,9 @@ void YGNodeCalculateLayout(
0.0f); 0.0f);
// Set whether the two layouts are different or not. // Set whether the two layouts are different or not.
node->setLayoutDoesLegacyFlagAffectsLayout( auto neededLegacyStretchBehaviour =
!originalNode->isLayoutTreeEqualToNode(*node)); !originalNode->isLayoutTreeEqualToNode(*node);
node->setLayoutDoesLegacyFlagAffectsLayout(neededLegacyStretchBehaviour);
if (originalNode->getConfig()->printTree) { if (originalNode->getConfig()->printTree) {
YGNodePrint( YGNodePrint(