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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 LocalFrame* frame = m_window->frame(); | 78 LocalFrame* frame = m_window->frame(); |
79 if (!frame || !frame->isMainFrame()) | 79 if (!frame || !frame->isMainFrame()) |
80 return 0; | 80 return 0; |
81 | 81 |
82 if (FrameHost* host = frame->host()) | 82 if (FrameHost* host = frame->host()) |
83 return host->visualViewport().scrollTop(); | 83 return host->visualViewport().scrollTop(); |
84 | 84 |
85 return 0; | 85 return 0; |
86 } | 86 } |
87 | 87 |
88 void DOMVisualViewport::setScrollLeft(double x) | |
89 { | |
90 LocalFrame* frame = m_window->frame(); | |
91 if (!frame || !frame->isMainFrame()) | |
92 return; | |
93 | |
94 if (FrameHost* host = frame->host()) | |
95 host->visualViewport().setScrollLeft(x); | |
96 } | |
97 | |
98 void DOMVisualViewport::setScrollTop(double y) | |
99 { | |
100 LocalFrame* frame = m_window->frame(); | |
101 if (!frame || !frame->isMainFrame()) | |
102 return; | |
103 | |
104 if (FrameHost* host = frame->host()) | |
105 host->visualViewport().setScrollTop(y); | |
106 } | |
107 | |
108 double DOMVisualViewport::clientWidth() | 88 double DOMVisualViewport::clientWidth() |
109 { | 89 { |
110 LocalFrame* frame = m_window->frame(); | 90 LocalFrame* frame = m_window->frame(); |
111 if (!frame) | 91 if (!frame) |
112 return 0; | 92 return 0; |
113 | 93 |
114 if (!frame->isMainFrame()) { | 94 if (!frame->isMainFrame()) { |
115 FloatSize viewportSize = m_window->getViewportSize(ExcludeScrollbars); | 95 FloatSize viewportSize = m_window->getViewportSize(ExcludeScrollbars); |
116 return adjustForAbsoluteZoom(expandedIntSize(viewportSize).width(), fram
e->pageZoomFactor()); | 96 return adjustForAbsoluteZoom(expandedIntSize(viewportSize).width(), fram
e->pageZoomFactor()); |
117 } | 97 } |
(...skipping 30 matching lines...) Expand all Loading... |
148 if (!frame->isMainFrame()) | 128 if (!frame->isMainFrame()) |
149 return 1; | 129 return 1; |
150 | 130 |
151 if (FrameHost* host = m_window->frame()->host()) | 131 if (FrameHost* host = m_window->frame()->host()) |
152 return host->visualViewport().pageScale(); | 132 return host->visualViewport().pageScale(); |
153 | 133 |
154 return 0; | 134 return 0; |
155 } | 135 } |
156 | 136 |
157 } // namespace blink | 137 } // namespace blink |
OLD | NEW |