Make CapurePageText capture textContent only on dirty layout
This is a partial revert for r536969 Change TranslateHelper to use a TextContent-like text dump. r536969 is a workaround for a lifecycle violation bug that layout is still dirty after running layout update. It turns out that textContent is not a good text dump for TranslateHelper, as pages may hide arbitrary content (e.g., JSON) in invisible text nodes, which can't be reliably filtered without checking element style or layout. Since we don't always run CapturePageText() with dirty layout, there is no need to always dump textContent. Hence, this patch partially reverts r536969 that, we still dump innerText as long as layout is clean. We dump textContent only when layout is dirty, which is enough to get around the lifecycle violation bug. Bug: 826174 Change-Id: I63e97832caa9858e67992847fb9a22f6405183cb Reviewed-on: https://chromium-review.googlesource.com/984474Reviewed-by:Kent Tamura <tkent@chromium.org> Reviewed-by:
Rachel Blum <groby@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#547334}
Showing
Please register or sign in to comment