Commit 7d651685 authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Fold Page::NonFastScrollableRectsForTesting

Fold Page::NonFastScrollableRectsForTesting into the only user
Internals::nonFastScrollableRects. The former method does not even touch
the Page object.

Change-Id: I3d8bec815dbcbb45cb01e2a77a1d87885d7d94f9
Reviewed-on: https://chromium-review.googlesource.com/1206590Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#588939}
parent 04f62b5d
......@@ -21,13 +21,11 @@
#include "third_party/blink/renderer/core/page/page.h"
#include "cc/layers/picture_layer.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_layer_tree_view.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/source_location.h"
#include "third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
......@@ -49,7 +47,6 @@
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/viewport_data.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/geometry/dom_rect_list.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/inspector/console_message_storage.h"
......@@ -67,8 +64,6 @@
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h"
#include "third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h"
#include "third_party/blink/renderer/core/page/validation_message_client_impl.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.h"
......@@ -271,23 +266,6 @@ LinkHighlights& Page::GetLinkHighlights() {
return *link_highlights_;
}
DOMRectList* Page::NonFastScrollableRectsForTesting(const LocalFrame* frame) {
// Update lifecycle to kPrePaintClean. This includes the compositing update
// and ScrollingCoordinator::UpdateAfterPaint, which computes the non-fast
// scrollable region.
frame->View()->UpdateAllLifecyclePhases();
GraphicsLayer* layer = frame->View()->LayoutViewport()->LayerForScrolling();
if (!layer)
return DOMRectList::Create();
const cc::Region& region = layer->CcLayer()->non_fast_scrollable_region();
Vector<IntRect> rects;
rects.ReserveCapacity(region.GetRegionComplexity());
for (const gfx::Rect& rect : region)
rects.push_back(IntRect(rect));
return DOMRectList::Create(rects);
}
void Page::SetMainFrame(Frame* main_frame) {
// Should only be called during initialization or swaps between local and
// remote frames.
......
......@@ -37,8 +37,6 @@
#include "third_party/blink/renderer/core/page/page_visibility_observer.h"
#include "third_party/blink/renderer/core/page/page_visibility_state.h"
#include "third_party/blink/renderer/core/page/viewport_description.h"
#include "third_party/blink/renderer/platform/geometry/layout_rect.h"
#include "third_party/blink/renderer/platform/geometry/region.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/scheduler/public/page_lifecycle_state.h"
#include "third_party/blink/renderer/platform/scheduler/public/page_scheduler.h"
......@@ -46,6 +44,7 @@
#include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/skia/include/core/SkColor.h"
namespace blink {
......@@ -54,7 +53,6 @@ class BrowserControls;
class ChromeClient;
class ContextMenuController;
class Document;
class DOMRectList;
class DragCaret;
class DragController;
class FocusController;
......@@ -185,8 +183,6 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
ScrollingCoordinator* GetScrollingCoordinator();
DOMRectList* NonFastScrollableRectsForTesting(const LocalFrame*);
Settings& GetSettings() const { return *settings_; }
Deprecation& GetDeprecation() { return deprecation_; }
......
......@@ -2240,17 +2240,27 @@ DOMRectList* Internals::nonFastScrollableRects(
Document* document,
ExceptionState& exception_state) const {
DCHECK(document);
if (!document->GetFrame()) {
const LocalFrame* frame = document->GetFrame();
if (!frame) {
exception_state.ThrowDOMException(DOMExceptionCode::kInvalidAccessError,
"The document provided is invalid.");
return nullptr;
}
Page* page = document->GetPage();
if (!page)
return nullptr;
// Update lifecycle to kPrePaintClean. This includes the compositing update
// and ScrollingCoordinator::UpdateAfterPaint, which computes the non-fast
// scrollable region.
frame->View()->UpdateAllLifecyclePhases();
return page->NonFastScrollableRectsForTesting(document->GetFrame());
GraphicsLayer* layer = frame->View()->LayoutViewport()->LayerForScrolling();
if (!layer)
return DOMRectList::Create();
const cc::Region& region = layer->CcLayer()->non_fast_scrollable_region();
Vector<IntRect> rects;
rects.ReserveCapacity(region.GetRegionComplexity());
for (const gfx::Rect& rect : region)
rects.push_back(IntRect(rect));
return DOMRectList::Create(rects);
}
void Internals::evictAllResources() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment