一种启发式方法定位响应式布局失败的CSS属性
A Heuristic Approach to Localize CSS Properties for Responsive Layout Failures
AI总结:
针对响应式布局失败问题,提出一种启发式方法,通过分析RLF方向、元素对齐及社区查询,定位导致故障的CSS属性,并实现工具LocaliCSS,在Top-7准确率达92.86%。
摘要:
响应式布局失败(RLF)通常源于在不同屏幕尺寸下阻碍正常布局行为的CSS属性。为了找到修复RLF的准确有效方案,需要定位这些有问题的属性。然而,现有方法仅检测RLF并应用广泛的CSS补丁。这些补丁改变了整个布局,而没有定位故障的根本原因。为解决这一空白,我们提出一种启发式方法,以识别开发者通常手动定位的特定CSS属性。该方法首先检测网页中存在的RLF及其受影响的元素。接着,利用RLF方向和RLF区域内元素的相对对齐来定位附近的HTML元素。然后,通过分析Quora和Stack Overflow查询创建的CSS属性排序搜索集,识别这些元素涉及的CSS属性。最后,根据元素及其对应属性对RLF的影响进行排序。我们将该方法实现为一个名为LocaliCSS的工具,并使用Top N Rank、MRR和P@K指标在一组网页上进行了评估。该工具实现了从45.2%(Top-1)到92.86%(Top-7)的定位准确率,MRR为76%,P@3为77.13%。此外,经验丰富的前端工程师在我们的评估中手动定位了RLF。他们首选的CSS属性与我们的方法在Top-1排名中匹配率为42.86%,在Top-7排名中高达90.48%。
英文摘要:
Responsive Layout Failures (RLFs) typically arise from CSS properties that hinder proper layout behavior in different screen sizes. To find an accurate and effective solution for repairing RLFs, localization of those problematic properties is necessary. However, existing approaches only detect RLFs and apply broad CSS patches for them. The patches alter the entire layout without localizing the root cause of failure. To address this gap, we propose a heuristic approach to identify the specific CSS properties that developers would typically localize manually. The approach first detects the RLFs existing in a webpage and their affected elements. Next, it localizes the nearby HTML elements using RLF direction and relative alignment of the elements present in the RLF region. The involved CSS properties of those elements are then identified using a ranked search set of CSS properties, created by analyzing Quora and Stack Overflow queries. Finally, elements and their corresponding property pairs are ranked based on their impact on RLFs. We have implemented this approach into a tool called {\normalfont \textsc{LocaliCSS}} and evaluated it on a set of webpages using Top N Rank, MRR and P@K metrics. The tool achieved localization accuracy ranging from 45.2% (Top-1) to 92.86% (Top-7), with an MRR of 76% and a P@3 of 77.13%. Additionally, experienced front-end engineers manually localized the RLFs as part of our evaluation. Their preferred CSS properties matched the suggestions from our approach in 42.86% of cases for Top-1 rankings and up to 90.48% for Top-7 rankings.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。