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

2014-03-07 Thread Ryosuke Niwa
Hi,

I don't want to be a pain but I kindly ask you to move this discussion to
webkit-help.  webkit-dev is a mailing list for WebKit contributors (i.e.
people who work on WebKit development) and it's not appropriate to ask
questions related to Web development or applications that embed WebKit.

Thanks,
R. Niwa

On Thu, Mar 6, 2014 at 11:57 PM, AgentX pulkit.mehra@gmail.com wrote:

 Hey Enrique thanks for the info. Do you know how the browser determines the
 actual number of physical pixels on the device?



 --
 View this message in context:
 http://mac-os-forge.2317878.n4.nabble.com/Determining-the-device-pixel-density-of-target-device-tp245535p245738.html
 Sent from the Webkit mailing list archive at Nabble.com.
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


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

2014-03-07 Thread AgentX
Hey Ryosuke, my apologies!! I will post the topic on webkit-help



--
View this message in context: 
http://mac-os-forge.2317878.n4.nabble.com/Determining-the-device-pixel-density-of-target-device-tp245535p245740.html
Sent from the Webkit mailing list archive at Nabble.com.
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


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

2014-03-06 Thread Dean Jackson
Greetings AgentX, if that is your real name,

On 5 Mar 2014, at 3:59 pm, AgentX pulkit.mehra@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.

Dean

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


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

2014-03-06 Thread AgentX
Hey Dean, what exactly do you mean by the term 'hosting application' ? is it
the browser , does it determine the deviceScalefactor?? After a little more
research I found that the deviceScaleFactor or pixel density is actually the
ratio of the device independent pixels to the css pixels. Any idea as to how
does the browser in general determine these atributes.?



--
View this message in context: 
http://mac-os-forge.2317878.n4.nabble.com/Determining-the-device-pixel-density-of-target-device-tp245535p245737.html
Sent from the Webkit mailing list archive at Nabble.com.
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


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

2014-03-06 Thread AgentX
Hey Enrique thanks for the info. Do you know how the browser determines the
actual number of physical pixels on the device?



--
View this message in context: 
http://mac-os-forge.2317878.n4.nabble.com/Determining-the-device-pixel-density-of-target-device-tp245535p245738.html
Sent from the Webkit mailing list archive at Nabble.com.
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


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

2014-03-05 Thread Enrique Ocaña González
El Martes, 4 de marzo de 2014 20:59:10 AgentX escribió:

 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.

First of all, excuse me if some answer is inaccurate. I'm not acquainted with 
that part of the code and I'm only going to expose my findings just in case 
they might be helpful for you.

TL; DR: Based on my analysis of the code, the scale factor is set by the end 
user program in EFL, got from NSWindow in Mac and never set in GTK+, where 1 
(the default) is used.

The full story:

After git grepping [1][2] the code several times, I've found that 
WebCore::Page initializes its m_deviceScaleFactor to 1 in its constructor. 
Then, other code call WebCore::Page::setDeviceScaleFactor(), but that depends 
on each particular port.

In the case of the EFL port, the actual scale factor (ratio) is set here:

WebKit/efl/ewk/ewk_view.h:EAPI Eina_Bool 
ewk_view_device_pixel_ratio_set(Evas_Object *o, float ratio);
WebKit2/UIProcess/API/efl/ewk_view.h:EAPI Eina_Bool 
ewk_view_device_pixel_ratio_set(Evas_Object *o, float ratio);

and nobody (except the tests) uses that code, it's API for the end user 
program, so we can't know who actually computes the scale factor in that port.

Similar delegation to external code seems to happen on Mac, either manually:

WebKit/mac/WebView/WebViewPrivate.h:- (void)_setCustomBackingScaleFactor:
(CGFloat)overrideScaleFactor;

...or automatically, where the scale factor is taken from NSWindow[3]:

WebKit/mac/WebView/WebView.mm:- (float)_deviceScaleFactor

Regarding WebKitGTK+, I haven't found any specific code to set the scale 
factor. Maybe they always use the default one.

There's also a field in WebPageCreationParameters which determines the scale 
factor to be used in WebKit::WebPage at creation time by the WebProcess. Now 
using Eclipse's code analysis features, I've found that it's set by the 
UIProcess based on the result of:

WebKit2/UIProcess/WebPageProxy.cpp:float WebPageProxy::deviceScaleFactor() 
const

In the end, its value depends on 
WebPageProxy::setIntrinsicDeviceScaleFactor(), apparently not used by anybody, 
and WKPageSetCustomBackingScaleFactor(), used only by the tests and by EFL's 
EwkView.ewk_view_device_pixel_ratio_set(), already mentioned before.

The final summary is actually the TL;DR section in the begining. Take it with 
a grain of salt. Of course, experts acquainted by the code have the final word 
on this analysis.

Regards.

[1] git grep deviceScaleFactor | grep -v ChangeLog
[2] git grep -e '-setDeviceScaleFactor' | grep -v ChangeLog
[3] 
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/backingScaleFactor

-- 
Enrique Ocaña González
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


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

2014-03-04 Thread AgentX
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!!



--
View this message in context: 
http://mac-os-forge.2317878.n4.nabble.com/Determining-the-device-pixel-density-of-target-device-tp245535.html
Sent from the Webkit mailing list archive at Nabble.com.
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev