| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 Screen::Screen(LocalFrame* frame) | 43 Screen::Screen(LocalFrame* frame) |
| 44 : DOMWindowProperty(frame) | 44 : DOMWindowProperty(frame) |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 unsigned Screen::height() const | 48 unsigned Screen::height() const |
| 49 { | 49 { |
| 50 if (!m_frame) | 50 if (!localFrame()) |
| 51 return 0; | 51 return 0; |
| 52 FrameHost* host = m_frame->host(); | 52 FrameHost* host = localFrame()->host(); |
| 53 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 53 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
| 54 return lroundf(screenRect(m_frame->view()).height() * host->deviceScaleF
actor()); | 54 return lroundf(screenRect(localFrame()->view()).height() * host->deviceS
caleFactor()); |
| 55 return static_cast<unsigned>(screenRect(m_frame->view()).height()); | 55 return static_cast<unsigned>(screenRect(localFrame()->view()).height()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 unsigned Screen::width() const | 58 unsigned Screen::width() const |
| 59 { | 59 { |
| 60 if (!m_frame) | 60 if (!localFrame()) |
| 61 return 0; | 61 return 0; |
| 62 FrameHost* host = m_frame->host(); | 62 FrameHost* host = localFrame()->host(); |
| 63 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 63 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
| 64 return lroundf(screenRect(m_frame->view()).width() * host->deviceScaleFa
ctor()); | 64 return lroundf(screenRect(localFrame()->view()).width() * host->deviceSc
aleFactor()); |
| 65 return static_cast<unsigned>(screenRect(m_frame->view()).width()); | 65 return static_cast<unsigned>(screenRect(localFrame()->view()).width()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 unsigned Screen::colorDepth() const | 68 unsigned Screen::colorDepth() const |
| 69 { | 69 { |
| 70 if (!m_frame) | 70 if (!localFrame()) |
| 71 return 0; | 71 return 0; |
| 72 return static_cast<unsigned>(screenDepth(m_frame->view())); | 72 return static_cast<unsigned>(screenDepth(localFrame()->view())); |
| 73 } | 73 } |
| 74 | 74 |
| 75 unsigned Screen::pixelDepth() const | 75 unsigned Screen::pixelDepth() const |
| 76 { | 76 { |
| 77 if (!m_frame) | 77 if (!localFrame()) |
| 78 return 0; | 78 return 0; |
| 79 return static_cast<unsigned>(screenDepth(m_frame->view())); | 79 return static_cast<unsigned>(screenDepth(localFrame()->view())); |
| 80 } | 80 } |
| 81 | 81 |
| 82 int Screen::availLeft() const | 82 int Screen::availLeft() const |
| 83 { | 83 { |
| 84 if (!m_frame) | 84 if (!localFrame()) |
| 85 return 0; | 85 return 0; |
| 86 FrameHost* host = m_frame->host(); | 86 FrameHost* host = localFrame()->host(); |
| 87 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 87 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
| 88 return lroundf(screenAvailableRect(m_frame->view()).x() * host->deviceSc
aleFactor()); | 88 return lroundf(screenAvailableRect(localFrame()->view()).x() * host->dev
iceScaleFactor()); |
| 89 return static_cast<int>(screenAvailableRect(m_frame->view()).x()); | 89 return static_cast<int>(screenAvailableRect(localFrame()->view()).x()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 int Screen::availTop() const | 92 int Screen::availTop() const |
| 93 { | 93 { |
| 94 if (!m_frame) | 94 if (!localFrame()) |
| 95 return 0; | 95 return 0; |
| 96 FrameHost* host = m_frame->host(); | 96 FrameHost* host = localFrame()->host(); |
| 97 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 97 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
| 98 return lroundf(screenAvailableRect(m_frame->view()).y() * host->deviceSc
aleFactor()); | 98 return lroundf(screenAvailableRect(localFrame()->view()).y() * host->dev
iceScaleFactor()); |
| 99 return static_cast<int>(screenAvailableRect(m_frame->view()).y()); | 99 return static_cast<int>(screenAvailableRect(localFrame()->view()).y()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 unsigned Screen::availHeight() const | 102 unsigned Screen::availHeight() const |
| 103 { | 103 { |
| 104 if (!m_frame) | 104 if (!localFrame()) |
| 105 return 0; | 105 return 0; |
| 106 FrameHost* host = m_frame->host(); | 106 FrameHost* host = localFrame()->host(); |
| 107 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 107 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
| 108 return lroundf(screenAvailableRect(m_frame->view()).height() * host->dev
iceScaleFactor()); | 108 return lroundf(screenAvailableRect(localFrame()->view()).height() * host
->deviceScaleFactor()); |
| 109 return static_cast<unsigned>(screenAvailableRect(m_frame->view()).height()); | 109 return static_cast<unsigned>(screenAvailableRect(localFrame()->view()).heigh
t()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 unsigned Screen::availWidth() const | 112 unsigned Screen::availWidth() const |
| 113 { | 113 { |
| 114 if (!m_frame) | 114 if (!localFrame()) |
| 115 return 0; | 115 return 0; |
| 116 FrameHost* host = m_frame->host(); | 116 FrameHost* host = localFrame()->host(); |
| 117 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 117 if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
| 118 return lroundf(screenAvailableRect(m_frame->view()).width() * host->devi
ceScaleFactor()); | 118 return lroundf(screenAvailableRect(localFrame()->view()).width() * host-
>deviceScaleFactor()); |
| 119 return static_cast<unsigned>(screenAvailableRect(m_frame->view()).width()); | 119 return static_cast<unsigned>(screenAvailableRect(localFrame()->view()).width
()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void Screen::trace(Visitor* visitor) | 122 void Screen::trace(Visitor* visitor) |
| 123 { | 123 { |
| 124 #if ENABLE(OILPAN) | 124 #if ENABLE(OILPAN) |
| 125 HeapSupplementable<Screen>::trace(visitor); | 125 HeapSupplementable<Screen>::trace(visitor); |
| 126 #endif | 126 #endif |
| 127 DOMWindowProperty::trace(visitor); | 127 DOMWindowProperty::trace(visitor); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |