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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 return frame->IsMainFrame(); | 265 return frame->IsMainFrame(); |
266 } | 266 } |
267 | 267 |
268 unsigned LocalDOMWindow::PendingUnloadEventListeners() const { | 268 unsigned LocalDOMWindow::PendingUnloadEventListeners() const { |
269 return WindowsWithUnloadEventListeners().count( | 269 return WindowsWithUnloadEventListeners().count( |
270 const_cast<LocalDOMWindow*>(this)); | 270 const_cast<LocalDOMWindow*>(this)); |
271 } | 271 } |
272 | 272 |
273 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame) | 273 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame) |
274 : DOMWindow(frame), | 274 : DOMWindow(frame), |
275 visual_viewport_(DOMVisualViewport::Create(this)), | 275 view_(DOMVisualViewport::Create(this)), |
276 unused_preloads_timer_( | 276 unused_preloads_timer_( |
277 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), | 277 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), |
278 this, | 278 this, |
279 &LocalDOMWindow::WarnUnusedPreloads), | 279 &LocalDOMWindow::WarnUnusedPreloads), |
280 should_print_when_finished_loading_(false), | 280 should_print_when_finished_loading_(false), |
281 custom_elements_(this, nullptr) {} | 281 custom_elements_(this, nullptr) {} |
282 | 282 |
283 void LocalDOMWindow::ClearDocument() { | 283 void LocalDOMWindow::ClearDocument() { |
284 if (!document_) | 284 if (!document_) |
285 return; | 285 return; |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 return lroundf(chrome_client.RootWindowRect().Y() * | 1050 return lroundf(chrome_client.RootWindowRect().Y() * |
1051 chrome_client.GetScreenInfo().device_scale_factor); | 1051 chrome_client.GetScreenInfo().device_scale_factor); |
1052 return chrome_client.RootWindowRect().Y(); | 1052 return chrome_client.RootWindowRect().Y(); |
1053 } | 1053 } |
1054 | 1054 |
1055 double LocalDOMWindow::scrollX() const { | 1055 double LocalDOMWindow::scrollX() const { |
1056 if (!GetFrame() || !GetFrame()->GetPage()) | 1056 if (!GetFrame() || !GetFrame()->GetPage()) |
1057 return 0; | 1057 return 0; |
1058 | 1058 |
1059 if (!GetFrame()->GetPage()->GetSettings().GetInertVisualViewport()) | 1059 if (!GetFrame()->GetPage()->GetSettings().GetInertVisualViewport()) |
1060 return visual_viewport_->pageX(); | 1060 return view_->pageLeft(); |
1061 | 1061 |
1062 FrameView* view = GetFrame()->View(); | 1062 FrameView* view = GetFrame()->View(); |
1063 if (!view) | 1063 if (!view) |
1064 return 0; | 1064 return 0; |
1065 | 1065 |
1066 document()->UpdateStyleAndLayoutIgnorePendingStylesheets(); | 1066 document()->UpdateStyleAndLayoutIgnorePendingStylesheets(); |
1067 | 1067 |
1068 double viewport_x = | 1068 double viewport_x = |
1069 view->LayoutViewportScrollableArea()->GetScrollOffset().Width(); | 1069 view->LayoutViewportScrollableArea()->GetScrollOffset().Width(); |
1070 return AdjustScrollForAbsoluteZoom(viewport_x, GetFrame()->PageZoomFactor()); | 1070 return AdjustScrollForAbsoluteZoom(viewport_x, GetFrame()->PageZoomFactor()); |
1071 } | 1071 } |
1072 | 1072 |
1073 double LocalDOMWindow::scrollY() const { | 1073 double LocalDOMWindow::scrollY() const { |
1074 if (!GetFrame() || !GetFrame()->GetPage()) | 1074 if (!GetFrame() || !GetFrame()->GetPage()) |
1075 return 0; | 1075 return 0; |
1076 | 1076 |
1077 if (!GetFrame()->GetPage()->GetSettings().GetInertVisualViewport()) | 1077 if (!GetFrame()->GetPage()->GetSettings().GetInertVisualViewport()) |
1078 return visual_viewport_->pageY(); | 1078 return view_->pageTop(); |
1079 | 1079 |
1080 FrameView* view = GetFrame()->View(); | 1080 FrameView* view = GetFrame()->View(); |
1081 if (!view) | 1081 if (!view) |
1082 return 0; | 1082 return 0; |
1083 | 1083 |
1084 document()->UpdateStyleAndLayoutIgnorePendingStylesheets(); | 1084 document()->UpdateStyleAndLayoutIgnorePendingStylesheets(); |
1085 | 1085 |
1086 double viewport_y = | 1086 double viewport_y = |
1087 view->LayoutViewportScrollableArea()->GetScrollOffset().Height(); | 1087 view->LayoutViewportScrollableArea()->GetScrollOffset().Height(); |
1088 return AdjustScrollForAbsoluteZoom(viewport_y, GetFrame()->PageZoomFactor()); | 1088 return AdjustScrollForAbsoluteZoom(viewport_y, GetFrame()->PageZoomFactor()); |
1089 } | 1089 } |
1090 | 1090 |
1091 DOMVisualViewport* LocalDOMWindow::visualViewport() { | 1091 DOMVisualViewport* LocalDOMWindow::view() { |
1092 if (!GetFrame()) | 1092 if (!GetFrame()) |
1093 return nullptr; | 1093 return nullptr; |
1094 | 1094 |
1095 return visual_viewport_; | 1095 return view_; |
1096 } | 1096 } |
1097 | 1097 |
1098 const AtomicString& LocalDOMWindow::name() const { | 1098 const AtomicString& LocalDOMWindow::name() const { |
1099 if (!IsCurrentlyDisplayedInFrame()) | 1099 if (!IsCurrentlyDisplayedInFrame()) |
1100 return g_null_atom; | 1100 return g_null_atom; |
1101 | 1101 |
1102 return GetFrame()->Tree().GetName(); | 1102 return GetFrame()->Tree().GetName(); |
1103 } | 1103 } |
1104 | 1104 |
1105 void LocalDOMWindow::setName(const AtomicString& name) { | 1105 void LocalDOMWindow::setName(const AtomicString& name) { |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 visitor->Trace(scrollbars_); | 1673 visitor->Trace(scrollbars_); |
1674 visitor->Trace(statusbar_); | 1674 visitor->Trace(statusbar_); |
1675 visitor->Trace(toolbar_); | 1675 visitor->Trace(toolbar_); |
1676 visitor->Trace(navigator_); | 1676 visitor->Trace(navigator_); |
1677 visitor->Trace(media_); | 1677 visitor->Trace(media_); |
1678 visitor->Trace(custom_elements_); | 1678 visitor->Trace(custom_elements_); |
1679 visitor->Trace(external_); | 1679 visitor->Trace(external_); |
1680 visitor->Trace(application_cache_); | 1680 visitor->Trace(application_cache_); |
1681 visitor->Trace(event_queue_); | 1681 visitor->Trace(event_queue_); |
1682 visitor->Trace(post_message_timers_); | 1682 visitor->Trace(post_message_timers_); |
1683 visitor->Trace(visual_viewport_); | 1683 visitor->Trace(view_); |
1684 visitor->Trace(event_listener_observers_); | 1684 visitor->Trace(event_listener_observers_); |
1685 DOMWindow::Trace(visitor); | 1685 DOMWindow::Trace(visitor); |
1686 Supplementable<LocalDOMWindow>::Trace(visitor); | 1686 Supplementable<LocalDOMWindow>::Trace(visitor); |
1687 } | 1687 } |
1688 | 1688 |
1689 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { | 1689 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { |
1690 visitor->TraceWrappers(custom_elements_); | 1690 visitor->TraceWrappers(custom_elements_); |
1691 DOMWindow::TraceWrappers(visitor); | 1691 DOMWindow::TraceWrappers(visitor); |
1692 } | 1692 } |
1693 | 1693 |
1694 } // namespace blink | 1694 } // namespace blink |
OLD | NEW |