[webkit-dev] Determining the device pixel density of target device

Dean Jackson dino at apple.com
Thu Mar 6 13:47:57 PST 2014

Greetings AgentX, if that is your real name,

On 5 Mar 2014, at 3:59 pm, AgentX <pulkit.mehra.001 at gmail.com> wrote:

> I was working with *responsive images* in Webkit and I came across this
> *‘deviceScaleFactor’* attribute with determines the pixel density on the
> target device.
> I was unable to find out how does Webkit determine it, that is which
> functions does it use and where can I find them in the Source Code? All I
> was able to find was that it used a function *‘page->deviceScaleFactor()’*
> which somehow returned the scale factor but I was unable to find the exact
> function which actually computes the scale factor.
> Any help here would be highly appreciated!!

As the longer email response suggested, the deviceScaleFactor is initialised
by the hosting application. For example, in WebKit1 on OS X, you can see it 
set in WebView.

WebKit itself does not detect the hardware scaling factor.


More information about the webkit-dev mailing list