Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Issue 1508963003: Make isVisible() faster and more accurate

Created:
5 years ago by wychen
Modified:
4 years, 9 months ago
Reviewers:
mdjones
Base URL:
git@github.com:chromium/dom-distiller.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Make isVisible() faster and more accurate Function isVisible() checked whether display is none, but it is not inherited. This is OK when doing DOM traversal, since we skip children of invisible elements. However, this doesn't work in general. For example, when checking whether an anchor element is visible in next page detection. We check properties like offsetParent, offsetWidth, and offsetHeight instead to amend this. Function isVisible() checked for display, opacity and visibility, which requires slow getComputedStyle(). Opacity and visibility are rarely used to hide elements, and display is replaced by offset*, so that we can stop getting computed styles. ** Score changes: Multi-page dataset: Minor changes in content extraction. Most entries here are not distillable anyway. Average F1 of content: 0.561 -> 0.561 https://x20web.corp.google.com/~wychen/domdistillerscore/visible/multi-page.html Reader-image dataset: Average F1 of image: 0.633 -> 0.634 https://x20web.corp.google.com/~wychen/domdistillerscore/visible/reader-images.html No changes on other data sets: - cjk-golden-data - cleaneval-golden-data - golden_data_with_knowledge - page-links-golden-data - reader-mode-golden-data ** Performance impact: The average time reported by eval server for dataset "reader-mode-golden-data" is used as the benchmark. To reduce noise, it is rerun for 100 times. The total time spent is 4.8% shorter. BUG=431067

Patch Set 1 #

Total comments: 4

Patch Set 2 : address mdjones' comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -15 lines) Patch
M java/org/chromium/distiller/DomUtil.java View 1 1 chunk +5 lines, -5 lines 0 comments Download
M javatests/org/chromium/distiller/DomUtilTest.java View 1 chunk +30 lines, -0 lines 0 comments Download
M javatests/org/chromium/distiller/webdocument/DomConverterTest.java View 6 chunks +8 lines, -10 lines 0 comments Download

Messages

Total messages: 7 (3 generated)
wychen
PTAL
5 years ago (2015-12-07 23:23:51 UTC) #2
mdjones
https://codereview.chromium.org/1508963003/diff/1/java/org/chromium/distiller/DomUtil.java File java/org/chromium/distiller/DomUtil.java (right): https://codereview.chromium.org/1508963003/diff/1/java/org/chromium/distiller/DomUtil.java#newcode100 java/org/chromium/distiller/DomUtil.java:100: return !(e.getOffsetParent() == null && e.getOffsetHeight() == 0 && ...
5 years ago (2015-12-08 00:04:33 UTC) #3
wychen
https://codereview.chromium.org/1508963003/diff/1/java/org/chromium/distiller/DomUtil.java File java/org/chromium/distiller/DomUtil.java (right): https://codereview.chromium.org/1508963003/diff/1/java/org/chromium/distiller/DomUtil.java#newcode100 java/org/chromium/distiller/DomUtil.java:100: return !(e.getOffsetParent() == null && e.getOffsetHeight() == 0 && ...
5 years ago (2015-12-08 00:41:46 UTC) #4
mdjones
5 years ago (2015-12-08 01:15:27 UTC) #5
lgtm

Powered by Google App Engine
This is Rietveld 408576698