Task #850: rhwp-studio 답안지 성명 칸 입력 회귀 정정#865
Open
postmelee wants to merge 4 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
Task #850 / Issue #850 대응입니다.
rhwp-studio에서samples/exam_social.hwp,samples/exam_science.hwp의 답안지 상단성명칸에 입력할 때 다음 오류로 입력이 막히던 회귀를 수정합니다.추가로, 중첩 셀 입력 경로가 정상화된 뒤 드러난 입력 지연도 함께 줄였습니다. 성능 보완은 원래 오류 수정의 필수 조건이 아니라, 수정 후 입력 루프에서 매번 큰 페이지 레이어 JSON을 왕복하던 비용을 제거하기 위한 별도 보완입니다.
회귀 지점
이 문제는 v0.7.10에서는 사용자 입력이 오류 없이 진행되었고, v0.7.11부터 재현됩니다.
회귀를 만든 직접적인 변경은 #717 Task #717: Fix table cell whitespace hit test (ef67efa1)입니다. 이 변경은 빈 공간 클릭 시 더 작은 셀 bbox를 우선 선택하도록 hit-test 정밀도를 높였습니다. 그 결과 v0.7.11에서는
성명칸의 실제 중첩 셀까지 도달하게 되었지만, 반환되는 편집 경로가 문서 루트 기준 경로가 아니라 중첩 테이블 내부의 로컬 경로로 잘려 나갔습니다.v0.7.10에서 동작했던 이유
v0.7.10이 정상처럼 보였던 이유는 올바른 중첩 셀을 정확히 찾았기 때문이 아닙니다. 동일 좌표에서 v0.7.10은 실제
성명칸이 아닌 바깥쪽/이전 컨텍스트에 가까운 유효한 경로를 반환했습니다.예:
samples/exam_social.hwppage 0, 성명 칸 좌표{ "parentParaIndex": 0, "controlIndex": 1, "cellPath": [ { "controlIndex": 1, "cellIndex": 0, "cellParaIndex": 0 } ], "cursorRect": { "x": 486.8, "y": 1393.7 } }이 경로는 시각적으로 성명 칸을 정확히 가리키지 않지만,
parentParaIndex=0,controlIndex=1이 문서 루트에서 유효했기 때문에insertTextInCell이 실패하지 않았습니다. 즉 v0.7.10은 오류가 없었던 것이고, 정확한 중첩 셀 편집 경로가 보장되었던 것은 아닙니다.v0.7.11에서 실패한 이유
v0.7.11은 hit-test가 더 정확해져 성명 칸 근처의 실제 중첩 셀을 선택했지만, 반환 경로가 다음처럼 로컬 기준으로 잘렸습니다.
{ "parentParaIndex": 3, "controlIndex": 0, "cellPath": [ { "controlIndex": 0, "cellIndex": 1, "cellParaIndex": 0 } ], "cursorRect": { "x": 212.7, "y": 211.8 } }여기서
parentParaIndex=3,controlIndex=0은 중첩 테이블 내부에서는 의미가 있지만, Studio의 삽입 API는 문서 루트 기준parentParaIndex/controlIndex/cellPath를 기대합니다. 그래서 Studio가 이 값을 루트 문단의 컨트롤 인덱스로 해석하면서컨트롤 인덱스 0 범위 초과가 발생했습니다.이번 수정 후
exam_social.hwp의 성명 칸은 루트 기준 전체 경로를 반환합니다.{ "parentParaIndex": 0, "controlIndex": 4, "cellPath": [ { "controlIndex": 4, "cellIndex": 0, "cellParaIndex": 3 }, { "controlIndex": 0, "cellIndex": 1, "cellParaIndex": 0 } ] }exam_science.hwp도 같은 구조이며, 바깥쪽 컨트롤 인덱스만 문서에 맞게6으로 달라집니다.수정 방향
cellPath로 보존합니다.PageLayerTreeJSON을 요청하지 않도록getPageOverlayImages를 추가합니다.getPageOverlayImages가 필요한 이유getPageOverlayImages는 원래 입력 오류를 고치기 위한 필수 수정은 아닙니다. 원래 오류의 필수 수정은 루트 기준 중첩 셀 경로 보존입니다.다만 이 수정으로 실제 중첩 셀 입력 경로가 활성화되자, Studio 입력 루프의 기존 렌더 비용이 체감될 만큼 커졌습니다. 기존 Studio는 오버레이 이미지 목록과 이미지 개수만 필요해도 매 렌더마다 전체
getPageLayerTree()를 호출했습니다.exam_social.hwppage 0 기준 전체 레이어 JSON은 약 1.4MB였고, Node/WASM 측정에서 직렬화 비용이 약 16.81ms였습니다.getPageOverlayImages는 기존getPageLayerTree계약을 바꾸지 않고, Studio가 실제로 필요한BehindText/InFrontOfText이미지와imageCount만 받도록 추가한 좁은 API입니다. 따라서 기존 전체 레이어 트리 소비자는 그대로 유지되고, 입력 중 불필요한 대형 JSON 직렬화/파싱만 피할 수 있습니다.검증
실행한 검증:
검증 결과:
issue_850_answer_sheet_name_hit_test: 3 passedissue_717_table_cell_hit_test: 3 passedtest_task105_nested_table_path_api: 1 passedrhwp-studiobuild 통과cargo test통과exam_social.hwp성명 칸 입력 정상 동작 확인Closes #850