github.com/MontFerret/ferret@v0.18.0/pkg/drivers/cdp/utils/layout.go (about) 1 package utils 2 3 import "github.com/mafredri/cdp/protocol/page" 4 5 func GetLayoutViewportWH(metrics *page.GetLayoutMetricsReply) (width int, height int) { 6 if metrics.CSSLayoutViewport.ClientWidth > 0 { 7 width = metrics.CSSLayoutViewport.ClientWidth 8 } else { 9 // Chrome version <=89 10 width = metrics.LayoutViewport.ClientWidth 11 } 12 13 if metrics.CSSLayoutViewport.ClientHeight > 0 { 14 height = metrics.CSSLayoutViewport.ClientHeight 15 } else { 16 // Chrome version <=89 17 height = metrics.LayoutViewport.ClientHeight 18 } 19 20 return 21 }