Commit 32316ab6 authored by pilgrim's avatar pilgrim Committed by Commit bot

[Layout API] Introduce Layout API shim and use in LayerClipRecorderTest.cpp

There are a few final obstacles to removing Document::layoutView() and
FrameView::layoutView(), and they require the use of a shim to bust
through the block layout API. In LayerClipRecorderTest, it gets a
reference to the document's layout view and later passes it to
LayoutObjectDrawingRecorder::useCachedDrawingIfPossible, which in turn
passes it to DrawingRecorder::useCachedDrawingIfPossible, which is
defined in platform/ and can not have a hard dependency on the block
layout API.

BUG=499321

Review-Url: https://codereview.chromium.org/2036213002
Cr-Commit-Position: refs/heads/master@{#397789}
parent fa24cdfe
...@@ -501,6 +501,7 @@ ...@@ -501,6 +501,7 @@
], ],
'webcore_rendering_files': [ 'webcore_rendering_files': [
'layout/api/HitTestAction.h', 'layout/api/HitTestAction.h',
'layout/api/LayoutAPIShim.h',
'layout/api/LayoutBlockItem.h', 'layout/api/LayoutBlockItem.h',
'layout/api/LayoutBoxItem.h', 'layout/api/LayoutBoxItem.h',
'layout/api/LayoutBoxModel.h', 'layout/api/LayoutBoxModel.h',
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LayoutAPIShim_h
#define LayoutAPIShim_h
#include "core/layout/api/LayoutItem.h"
namespace blink {
class LayoutObject;
// TODO(pilgrim): Remove this kludge once clients have a real API and no longer need access to the underlying LayoutObject.
class LayoutAPIShim {
public:
static LayoutObject* layoutObjectFrom(LayoutItem item)
{
return item.layoutObject();
}
static const LayoutObject* constLayoutObjectFrom(LayoutItem item)
{
return item.layoutObject();
}
};
} // namespace blink
#endif // LayoutAPIShim_h
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
namespace blink { namespace blink {
class FrameView; class FrameView;
class LayoutAPIShim;
class Node; class Node;
class LayoutItem { class LayoutItem {
...@@ -257,6 +258,8 @@ protected: ...@@ -257,6 +258,8 @@ protected:
private: private:
LayoutObject* m_layoutObject; LayoutObject* m_layoutObject;
friend class LayoutAPIShim;
}; };
} // namespace blink } // namespace blink
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "core/layout/LayoutTestHelper.h" #include "core/layout/LayoutTestHelper.h"
#include "core/layout/LayoutView.h" #include "core/layout/LayoutView.h"
#include "core/layout/api/LayoutAPIShim.h"
#include "core/layout/compositing/PaintLayerCompositor.h" #include "core/layout/compositing/PaintLayerCompositor.h"
#include "core/paint/LayoutObjectDrawingRecorder.h" #include "core/paint/LayoutObjectDrawingRecorder.h"
#include "core/paint/PaintLayer.h" #include "core/paint/PaintLayer.h"
...@@ -32,7 +33,7 @@ private: ...@@ -32,7 +33,7 @@ private:
RenderingTest::SetUp(); RenderingTest::SetUp();
enableCompositing(); enableCompositing();
m_layoutView = document().view()->layoutView(); m_layoutView = toLayoutView(LayoutAPIShim::layoutObjectFrom(document().view()->layoutViewItem()));
ASSERT_TRUE(m_layoutView); ASSERT_TRUE(m_layoutView);
} }
......
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