OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 | 891 |
892 int LocalDOMWindow::outerHeight() const | 892 int LocalDOMWindow::outerHeight() const |
893 { | 893 { |
894 if (!frame()) | 894 if (!frame()) |
895 return 0; | 895 return 0; |
896 | 896 |
897 FrameHost* host = frame()->host(); | 897 FrameHost* host = frame()->host(); |
898 if (!host) | 898 if (!host) |
899 return 0; | 899 return 0; |
900 | 900 |
| 901 ChromeClient& chromeClient = host->chromeClient(); |
901 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 902 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
902 return lroundf(host->chromeClient().windowRect().height() * host->device
ScaleFactor()); | 903 return lroundf(chromeClient.windowRect().height() * chromeClient.screenI
nfo().deviceScaleFactor); |
903 return host->chromeClient().windowRect().height(); | 904 return chromeClient.windowRect().height(); |
904 } | 905 } |
905 | 906 |
906 int LocalDOMWindow::outerWidth() const | 907 int LocalDOMWindow::outerWidth() const |
907 { | 908 { |
908 if (!frame()) | 909 if (!frame()) |
909 return 0; | 910 return 0; |
910 | 911 |
911 FrameHost* host = frame()->host(); | 912 FrameHost* host = frame()->host(); |
912 if (!host) | 913 if (!host) |
913 return 0; | 914 return 0; |
914 | 915 |
| 916 ChromeClient& chromeClient = host->chromeClient(); |
915 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 917 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
916 return lroundf(host->chromeClient().windowRect().width() * host->deviceS
caleFactor()); | 918 return lroundf(chromeClient.windowRect().width() * chromeClient.screenIn
fo().deviceScaleFactor); |
917 return host->chromeClient().windowRect().width(); | 919 |
| 920 return chromeClient.windowRect().width(); |
918 } | 921 } |
919 | 922 |
920 static FloatSize getViewportSize(LocalFrame* frame) | 923 static FloatSize getViewportSize(LocalFrame* frame) |
921 { | 924 { |
922 FrameView* view = frame->view(); | 925 FrameView* view = frame->view(); |
923 if (!view) | 926 if (!view) |
924 return FloatSize(); | 927 return FloatSize(); |
925 | 928 |
926 FrameHost* host = frame->host(); | 929 FrameHost* host = frame->host(); |
927 if (!host) | 930 if (!host) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 968 |
966 int LocalDOMWindow::screenX() const | 969 int LocalDOMWindow::screenX() const |
967 { | 970 { |
968 if (!frame()) | 971 if (!frame()) |
969 return 0; | 972 return 0; |
970 | 973 |
971 FrameHost* host = frame()->host(); | 974 FrameHost* host = frame()->host(); |
972 if (!host) | 975 if (!host) |
973 return 0; | 976 return 0; |
974 | 977 |
| 978 ChromeClient& chromeClient = host->chromeClient(); |
975 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 979 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
976 return lroundf(host->chromeClient().windowRect().x() * host->deviceScale
Factor()); | 980 return lroundf(chromeClient.windowRect().x() * chromeClient.screenInfo()
.deviceScaleFactor); |
977 return host->chromeClient().windowRect().x(); | 981 return chromeClient.windowRect().x(); |
978 } | 982 } |
979 | 983 |
980 int LocalDOMWindow::screenY() const | 984 int LocalDOMWindow::screenY() const |
981 { | 985 { |
982 if (!frame()) | 986 if (!frame()) |
983 return 0; | 987 return 0; |
984 | 988 |
985 FrameHost* host = frame()->host(); | 989 FrameHost* host = frame()->host(); |
986 if (!host) | 990 if (!host) |
987 return 0; | 991 return 0; |
988 | 992 |
| 993 ChromeClient& chromeClient = host->chromeClient(); |
989 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 994 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
990 return lroundf(host->chromeClient().windowRect().y() * host->deviceScale
Factor()); | 995 return lroundf(chromeClient.windowRect().y() * chromeClient.screenInfo()
.deviceScaleFactor); |
991 return host->chromeClient().windowRect().y(); | 996 return chromeClient.windowRect().y(); |
992 } | 997 } |
993 | 998 |
994 double LocalDOMWindow::scrollX() const | 999 double LocalDOMWindow::scrollX() const |
995 { | 1000 { |
996 if (!frame()) | 1001 if (!frame()) |
997 return 0; | 1002 return 0; |
998 | 1003 |
999 FrameView* view = frame()->view(); | 1004 FrameView* view = frame()->view(); |
1000 if (!view) | 1005 if (!view) |
1001 return 0; | 1006 return 0; |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 { | 1538 { |
1534 // If the LocalDOMWindow still has a frame reference, that frame must point | 1539 // If the LocalDOMWindow still has a frame reference, that frame must point |
1535 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation | 1540 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation |
1536 // where script execution leaks between different LocalDOMWindows. | 1541 // where script execution leaks between different LocalDOMWindows. |
1537 if (m_frameObserver->frame()) | 1542 if (m_frameObserver->frame()) |
1538 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); | 1543 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); |
1539 return m_frameObserver->frame(); | 1544 return m_frameObserver->frame(); |
1540 } | 1545 } |
1541 | 1546 |
1542 } // namespace blink | 1547 } // namespace blink |
OLD | NEW |