0

给定一个由矩形和 url 定义的区域,有没有办法确定哪些元素位于给定 url 页面上的给定矩形内?

编辑:屏幕分辨率、字体大小等都可以设置为合理的默认值。

4

2 回答 2

1
  • Get the document from the URL.
  • Render it (in a browser).
  • For each element in the browser's DOM:
    • Get the rectangle[s] occupied by the element.
    • Compare the element's rectangle with the rectangle you're interested in.
于 2009-11-30T21:39:47.607 回答
1

也许,但您需要使用完整的浏览器渲染引擎。我推荐webkit的 QT 实现。上手相当简单。

您需要考虑的一些事项:

  • 屏幕分辨率。
  • 浏览器字体大小。
  • 浏览器类型。
于 2009-11-30T21:30:25.527 回答