| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2016 Google Inc. All rights reserved. | 2 * Copyright (C) 2016 Google 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 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 ExecutionContext* DOMVisualViewport::getExecutionContext() const { | 54 ExecutionContext* DOMVisualViewport::getExecutionContext() const { |
| 55 return m_window->getExecutionContext(); | 55 return m_window->getExecutionContext(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 float DOMVisualViewport::scrollLeft() { | 58 float DOMVisualViewport::scrollLeft() { |
| 59 LocalFrame* frame = m_window->frame(); | 59 LocalFrame* frame = m_window->frame(); |
| 60 if (!frame || !frame->isMainFrame()) | 60 if (!frame || !frame->isMainFrame()) |
| 61 return 0; | 61 return 0; |
| 62 | 62 |
| 63 if (FrameHost* host = frame->host()) | 63 if (Page* page = frame->page()) |
| 64 return host->visualViewport().scrollLeft(); | 64 return page->visualViewport().scrollLeft(); |
| 65 | 65 |
| 66 return 0; | 66 return 0; |
| 67 } | 67 } |
| 68 | 68 |
| 69 float DOMVisualViewport::scrollTop() { | 69 float DOMVisualViewport::scrollTop() { |
| 70 LocalFrame* frame = m_window->frame(); | 70 LocalFrame* frame = m_window->frame(); |
| 71 if (!frame || !frame->isMainFrame()) | 71 if (!frame || !frame->isMainFrame()) |
| 72 return 0; | 72 return 0; |
| 73 | 73 |
| 74 if (FrameHost* host = frame->host()) | 74 if (Page* page = frame->page()) |
| 75 return host->visualViewport().scrollTop(); | 75 return page->visualViewport().scrollTop(); |
| 76 | 76 |
| 77 return 0; | 77 return 0; |
| 78 } | 78 } |
| 79 | 79 |
| 80 float DOMVisualViewport::pageX() { | 80 float DOMVisualViewport::pageX() { |
| 81 LocalFrame* frame = m_window->frame(); | 81 LocalFrame* frame = m_window->frame(); |
| 82 if (!frame) | 82 if (!frame) |
| 83 return 0; | 83 return 0; |
| 84 | 84 |
| 85 FrameView* view = frame->view(); | 85 FrameView* view = frame->view(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 109 LocalFrame* frame = m_window->frame(); | 109 LocalFrame* frame = m_window->frame(); |
| 110 if (!frame) | 110 if (!frame) |
| 111 return 0; | 111 return 0; |
| 112 | 112 |
| 113 if (!frame->isMainFrame()) { | 113 if (!frame->isMainFrame()) { |
| 114 FloatSize viewportSize = m_window->getViewportSize(ExcludeScrollbars); | 114 FloatSize viewportSize = m_window->getViewportSize(ExcludeScrollbars); |
| 115 return adjustForAbsoluteZoom(expandedIntSize(viewportSize).width(), | 115 return adjustForAbsoluteZoom(expandedIntSize(viewportSize).width(), |
| 116 frame->pageZoomFactor()); | 116 frame->pageZoomFactor()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (FrameHost* host = frame->host()) | 119 if (Page* page = frame->page()) |
| 120 return host->visualViewport().clientWidth(); | 120 return page->visualViewport().clientWidth(); |
| 121 | 121 |
| 122 return 0; | 122 return 0; |
| 123 } | 123 } |
| 124 | 124 |
| 125 double DOMVisualViewport::clientHeight() { | 125 double DOMVisualViewport::clientHeight() { |
| 126 LocalFrame* frame = m_window->frame(); | 126 LocalFrame* frame = m_window->frame(); |
| 127 if (!frame) | 127 if (!frame) |
| 128 return 0; | 128 return 0; |
| 129 | 129 |
| 130 if (!frame->isMainFrame()) { | 130 if (!frame->isMainFrame()) { |
| 131 FloatSize viewportSize = m_window->getViewportSize(ExcludeScrollbars); | 131 FloatSize viewportSize = m_window->getViewportSize(ExcludeScrollbars); |
| 132 return adjustForAbsoluteZoom(expandedIntSize(viewportSize).height(), | 132 return adjustForAbsoluteZoom(expandedIntSize(viewportSize).height(), |
| 133 frame->pageZoomFactor()); | 133 frame->pageZoomFactor()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 if (FrameHost* host = frame->host()) | 136 if (Page* page = frame->page()) |
| 137 return host->visualViewport().clientHeight(); | 137 return page->visualViewport().clientHeight(); |
| 138 | 138 |
| 139 return 0; | 139 return 0; |
| 140 } | 140 } |
| 141 | 141 |
| 142 double DOMVisualViewport::scale() { | 142 double DOMVisualViewport::scale() { |
| 143 LocalFrame* frame = m_window->frame(); | 143 LocalFrame* frame = m_window->frame(); |
| 144 if (!frame) | 144 if (!frame) |
| 145 return 0; | 145 return 0; |
| 146 | 146 |
| 147 if (!frame->isMainFrame()) | 147 if (!frame->isMainFrame()) |
| 148 return 1; | 148 return 1; |
| 149 | 149 |
| 150 if (FrameHost* host = m_window->frame()->host()) | 150 if (Page* page = m_window->frame()->page()) |
| 151 return host->visualViewport().pageScale(); | 151 return page->visualViewport().pageScale(); |
| 152 | 152 |
| 153 return 0; | 153 return 0; |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |