Compare commits

..

1 Commits

Author SHA1 Message Date
Abdi Ibrahim
2d0cb3ae03
Merge 4f50603b8f into cf12cd6af8 2025-01-03 13:34:29 +11:00
4 changed files with 6 additions and 14 deletions

4
clay.h
View File

@ -1842,13 +1842,12 @@ void Clay__ElementPostConfiguration(void) {
} }
} else { } else {
Clay_LayoutElementHashMapItem *parentItem = Clay__GetHashMapItem(floatingConfig->parentId); Clay_LayoutElementHashMapItem *parentItem = Clay__GetHashMapItem(floatingConfig->parentId);
clipElementId = Clay__int32_tArray_Get(&Clay__layoutElementClipElementIds, (int32_t)(parentItem->layoutElement - Clay__layoutElements.internalArray));
if (!parentItem) { if (!parentItem) {
Clay__errorHandler.errorHandlerFunction(CLAY__INIT(Clay_ErrorData) { Clay__errorHandler.errorHandlerFunction(CLAY__INIT(Clay_ErrorData) {
.errorType = CLAY_ERROR_TYPE_FLOATING_CONTAINER_PARENT_NOT_FOUND, .errorType = CLAY_ERROR_TYPE_FLOATING_CONTAINER_PARENT_NOT_FOUND,
.errorText = CLAY_STRING("A floating element was declared with a parentId, but no element with that ID was found."), .errorText = CLAY_STRING("A floating element was declared with a parentId, but no element with that ID was found."),
.userData = Clay__errorHandler.userData }); .userData = Clay__errorHandler.userData });
} else {
clipElementId = Clay__int32_tArray_Get(&Clay__layoutElementClipElementIds, parentItem->layoutElement - Clay__layoutElements.internalArray);
} }
} }
Clay__LayoutElementTreeRootArray_Add(&Clay__layoutElementTreeRoots, CLAY__INIT(Clay__LayoutElementTreeRoot) { Clay__LayoutElementTreeRootArray_Add(&Clay__layoutElementTreeRoots, CLAY__INIT(Clay__LayoutElementTreeRoot) {
@ -2392,7 +2391,6 @@ void Clay__CalculateFinalLayout(void) {
Clay__WrappedTextLineArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay__WrappedTextLine) { { measuredWord->width, lineHeight }, { .length = measuredWord->length, .chars = &textElementData->text.chars[measuredWord->startOffset] } }); Clay__WrappedTextLineArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay__WrappedTextLine) { { measuredWord->width, lineHeight }, { .length = measuredWord->length, .chars = &textElementData->text.chars[measuredWord->startOffset] } });
textElementData->wrappedLines.length++; textElementData->wrappedLines.length++;
wordIndex = measuredWord->next; wordIndex = measuredWord->next;
lineStartOffset = measuredWord->startOffset + measuredWord->length;
} }
// measuredWord->length == 0 means a newline character // measuredWord->length == 0 means a newline character
else if (measuredWord->length == 0 || lineWidth + measuredWord->width > containerElement->dimensions.width) { else if (measuredWord->length == 0 || lineWidth + measuredWord->width > containerElement->dimensions.width) {

View File

@ -426,8 +426,7 @@
element.style.height = Math.round(renderCommand.boundingBox.height.value) + 'px'; element.style.height = Math.round(renderCommand.boundingBox.height.value) + 'px';
} }
// note: commandType is packed to uint8_t and has 3 garbage bytes of padding switch(renderCommand.commandType.value) {
switch(renderCommand.commandType.value & 0xff) {
case (CLAY_RENDER_COMMAND_TYPE_NONE): { case (CLAY_RENDER_COMMAND_TYPE_NONE): {
break; break;
} }
@ -581,9 +580,7 @@
for (let i = 0; i < length; i++, arrayOffset += renderCommandSize) { for (let i = 0; i < length; i++, arrayOffset += renderCommandSize) {
let renderCommand = readStructAtAddress(arrayOffset, renderCommandDefinition); let renderCommand = readStructAtAddress(arrayOffset, renderCommandDefinition);
let boundingBox = renderCommand.boundingBox; let boundingBox = renderCommand.boundingBox;
switch(renderCommand.commandType.value) {
// note: commandType is packed to uint8_t and has 3 garbage bytes of padding
switch(renderCommand.commandType.value & 0xff) {
case (CLAY_RENDER_COMMAND_TYPE_NONE): { case (CLAY_RENDER_COMMAND_TYPE_NONE): {
break; break;
} }

View File

@ -317,9 +317,7 @@
for (let i = 0; i < length; i++, arrayOffset += renderCommandSize) { for (let i = 0; i < length; i++, arrayOffset += renderCommandSize) {
let renderCommand = readStructAtAddress(arrayOffset, renderCommandDefinition); let renderCommand = readStructAtAddress(arrayOffset, renderCommandDefinition);
let boundingBox = renderCommand.boundingBox; let boundingBox = renderCommand.boundingBox;
switch(renderCommand.commandType.value) {
// note: commandType is packed to uint8_t and has 3 garbage bytes of padding
switch(renderCommand.commandType.value & 0xff) {
case (CLAY_RENDER_COMMAND_TYPE_NONE): { case (CLAY_RENDER_COMMAND_TYPE_NONE): {
break; break;
} }

View File

@ -336,7 +336,7 @@
let element = null; let element = null;
if (!elementCache[renderCommand.id.value]) { if (!elementCache[renderCommand.id.value]) {
let elementType = 'div'; let elementType = 'div';
switch (renderCommand.commandType.value & 0xff) { switch (renderCommand.commandType.value) {
case CLAY_RENDER_COMMAND_TYPE_RECTANGLE: { case CLAY_RENDER_COMMAND_TYPE_RECTANGLE: {
if (readStructAtAddress(renderCommand.config.value, rectangleConfigDefinition).link.length.value > 0) { if (readStructAtAddress(renderCommand.config.value, rectangleConfigDefinition).link.length.value > 0) {
elementType = 'a'; elementType = 'a';
@ -384,8 +384,7 @@
element.style.height = Math.round(renderCommand.boundingBox.height.value) + 'px'; element.style.height = Math.round(renderCommand.boundingBox.height.value) + 'px';
} }
// note: commandType is packed to uint8_t and has 3 garbage bytes of padding switch(renderCommand.commandType.value) {
switch(renderCommand.commandType.value & 0xff) {
case (CLAY_RENDER_COMMAND_TYPE_NONE): { case (CLAY_RENDER_COMMAND_TYPE_NONE): {
break; break;
} }