mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #286 from abarth/rm_custom_layout
Remove the DOM-based custom layout machinery
This commit is contained in:
commit
ced880d401
@ -400,7 +400,6 @@ sky_core_files = [
|
||||
"inspector/ScriptCallFrame.h",
|
||||
"inspector/ScriptCallStack.cpp",
|
||||
"inspector/ScriptCallStack.h",
|
||||
"layout/LayoutCallback.h",
|
||||
"loader/CanvasImageDecoder.cpp",
|
||||
"loader/CanvasImageDecoder.h",
|
||||
"loader/DocumentLoadTiming.cpp",
|
||||
@ -512,8 +511,6 @@ sky_core_files = [
|
||||
"rendering/RenderBox.h",
|
||||
"rendering/RenderBoxModelObject.cpp",
|
||||
"rendering/RenderBoxModelObject.h",
|
||||
"rendering/RenderCustomLayout.cpp",
|
||||
"rendering/RenderCustomLayout.h",
|
||||
"rendering/RenderFlexibleBox.cpp",
|
||||
"rendering/RenderFlexibleBox.h",
|
||||
"rendering/RenderGeometryMap.cpp",
|
||||
@ -678,7 +675,6 @@ core_idl_files = get_path_info([
|
||||
"html/ImageData.idl",
|
||||
"html/TextMetrics.idl",
|
||||
"html/VoidCallback.idl",
|
||||
"layout/LayoutCallback.idl",
|
||||
"loader/ImageDecoder.idl",
|
||||
"loader/ImageDecoderCallback.idl",
|
||||
"painting/Canvas.idl",
|
||||
|
||||
@ -60,14 +60,12 @@
|
||||
#include "sky/engine/core/frame/Settings.h"
|
||||
#include "sky/engine/core/html/HTMLElement.h"
|
||||
#include "sky/engine/core/html/parser/HTMLParserIdioms.h"
|
||||
#include "sky/engine/core/layout/LayoutCallback.h"
|
||||
#include "sky/engine/core/page/ChromeClient.h"
|
||||
#include "sky/engine/core/page/Page.h"
|
||||
#include "sky/engine/core/painting/Canvas.h"
|
||||
#include "sky/engine/core/painting/PaintingCallback.h"
|
||||
#include "sky/engine/core/painting/PaintingTasks.h"
|
||||
#include "sky/engine/core/painting/PictureRecorder.h"
|
||||
#include "sky/engine/core/rendering/RenderCustomLayout.h"
|
||||
#include "sky/engine/core/rendering/RenderLayer.h"
|
||||
#include "sky/engine/core/rendering/RenderView.h"
|
||||
#include "sky/engine/platform/EventDispatchForbiddenScope.h"
|
||||
@ -524,8 +522,6 @@ const AtomicString Element::imageSourceURL() const
|
||||
|
||||
RenderObject* Element::createRenderer(RenderStyle* style)
|
||||
{
|
||||
if (m_layoutManager)
|
||||
return new RenderCustomLayout(this);
|
||||
return RenderObject::createObject(this, style);
|
||||
}
|
||||
|
||||
@ -794,33 +790,6 @@ void Element::layout()
|
||||
box->layoutIfNeeded();
|
||||
}
|
||||
|
||||
LayoutCallback* Element::layoutManager() const
|
||||
{
|
||||
return m_layoutManager.get();
|
||||
}
|
||||
|
||||
LayoutCallback* Element::intrinsicWidthsComputer() const
|
||||
{
|
||||
return m_intrinsicWidthsComputer.get();
|
||||
}
|
||||
|
||||
void Element::setLayoutManager(PassOwnPtr<LayoutCallback> layoutManager,
|
||||
PassOwnPtr<LayoutCallback> intrinsicWidthsComputer)
|
||||
{
|
||||
bool isAlreadyCustomLayout = renderer() && renderer()->isRenderCustomLayout();
|
||||
bool requiresCustomLayout = layoutManager;
|
||||
if (requiresCustomLayout != isAlreadyCustomLayout) {
|
||||
// We don't go through the normal reattach codepaths because
|
||||
// those are all tied to changes to the RenderStyle.
|
||||
markAncestorsWithChildNeedsStyleRecalc();
|
||||
detach();
|
||||
} else if (layoutManager.get() != m_layoutManager) {
|
||||
setNeedsLayout();
|
||||
}
|
||||
m_layoutManager = layoutManager;
|
||||
m_intrinsicWidthsComputer = intrinsicWidthsComputer;
|
||||
}
|
||||
|
||||
void Element::childrenChanged(const ChildrenChange& change)
|
||||
{
|
||||
ContainerNode::childrenChanged(change);
|
||||
|
||||
@ -214,11 +214,6 @@ public:
|
||||
void setNeedsLayout();
|
||||
void layout();
|
||||
|
||||
LayoutCallback* intrinsicWidthsComputer() const;
|
||||
LayoutCallback* layoutManager() const;
|
||||
void setLayoutManager(PassOwnPtr<LayoutCallback> layoutManager,
|
||||
PassOwnPtr<LayoutCallback> intrinsicWidthsComputer);
|
||||
|
||||
RenderStyle* computedStyle();
|
||||
|
||||
AtomicString computeInheritedLanguage() const;
|
||||
@ -335,8 +330,6 @@ private:
|
||||
ElementRareData& ensureElementRareData();
|
||||
|
||||
RefPtr<ElementData> m_elementData;
|
||||
OwnPtr<LayoutCallback> m_layoutManager;
|
||||
OwnPtr<LayoutCallback> m_intrinsicWidthsComputer;
|
||||
};
|
||||
|
||||
DEFINE_NODE_TYPE_CASTS(Element, isElementNode());
|
||||
|
||||
@ -14,7 +14,6 @@ interface Element : ParentNode {
|
||||
|
||||
void setNeedsLayout();
|
||||
void layout();
|
||||
void setLayoutManager(LayoutCallback layout, LayoutCallback computeIntrinsicWidths);
|
||||
|
||||
// TODO(abarth): Move to Node.
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
|
||||
@ -106,7 +106,6 @@ void FrameView::reset()
|
||||
m_nestedLayoutCount = 0;
|
||||
m_postLayoutTasksTimer.stop();
|
||||
m_firstLayout = true;
|
||||
m_firstLayoutCallbackPending = false;
|
||||
m_lastViewportSize = IntSize();
|
||||
m_lastPaintTime = 0;
|
||||
m_isPainting = false;
|
||||
@ -298,7 +297,6 @@ void FrameView::layout(bool allowSubtree)
|
||||
if (!inSubtreeLayout) {
|
||||
if (m_firstLayout) {
|
||||
m_firstLayout = false;
|
||||
m_firstLayoutCallbackPending = true;
|
||||
m_lastViewportSize = layoutSize();
|
||||
}
|
||||
|
||||
@ -514,11 +512,6 @@ void FrameView::performPostLayoutTasks()
|
||||
m_postLayoutTasksTimer.stop();
|
||||
|
||||
ASSERT(m_frame->document());
|
||||
if (m_nestedLayoutCount <= 1) {
|
||||
if (m_firstLayoutCallbackPending)
|
||||
m_firstLayoutCallbackPending = false;
|
||||
}
|
||||
|
||||
sendResizeEventIfNeeded();
|
||||
}
|
||||
|
||||
|
||||
@ -205,7 +205,6 @@ private:
|
||||
int m_layoutCount;
|
||||
unsigned m_nestedLayoutCount;
|
||||
Timer<FrameView> m_postLayoutTasksTimer;
|
||||
bool m_firstLayoutCallbackPending;
|
||||
|
||||
bool m_firstLayout;
|
||||
bool m_isTransparent;
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
// 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 SKY_ENGINE_CORE_PAINTING_LAYOUTCALLBACK_H_
|
||||
#define SKY_ENGINE_CORE_PAINTING_LAYOUTCALLBACK_H_
|
||||
|
||||
namespace blink {
|
||||
|
||||
class LayoutCallback {
|
||||
public:
|
||||
virtual ~LayoutCallback() {}
|
||||
virtual void handleEvent() = 0;
|
||||
};
|
||||
|
||||
} // namespace blink
|
||||
|
||||
#endif // SKY_ENGINE_CORE_PAINTING_LAYOUTCALLBACK_H_
|
||||
@ -1,7 +0,0 @@
|
||||
// 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.
|
||||
|
||||
callback interface LayoutCallback {
|
||||
void handleEvent();
|
||||
};
|
||||
@ -1,41 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#include "sky/engine/core/rendering/RenderCustomLayout.h"
|
||||
|
||||
#include "sky/engine/core/rendering/RenderLayer.h"
|
||||
#include "sky/engine/core/layout/LayoutCallback.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
RenderCustomLayout::RenderCustomLayout(ContainerNode* node)
|
||||
: RenderBlock(node)
|
||||
{
|
||||
}
|
||||
|
||||
RenderCustomLayout::~RenderCustomLayout()
|
||||
{
|
||||
}
|
||||
|
||||
void RenderCustomLayout::computePreferredLogicalWidths()
|
||||
{
|
||||
ASSERT(node()->isElementNode());
|
||||
toElement(node())->intrinsicWidthsComputer()->handleEvent();
|
||||
clearPreferredLogicalWidthsDirty();
|
||||
}
|
||||
|
||||
void RenderCustomLayout::layout()
|
||||
{
|
||||
ASSERT(node()->isElementNode());
|
||||
toElement(node())->layoutManager()->handleEvent();
|
||||
clearNeedsLayout();
|
||||
}
|
||||
|
||||
const char* RenderCustomLayout::renderName() const
|
||||
{
|
||||
return "RenderCustomLayout";
|
||||
}
|
||||
|
||||
} // namespace blink
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
// 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 SKY_ENGINE_CORE_RENDERING_RENDERCUSTOMLAYOUT_H_
|
||||
#define SKY_ENGINE_CORE_RENDERING_RENDERCUSTOMLAYOUT_H_
|
||||
|
||||
#include "sky/engine/core/rendering/RenderBlock.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
class RenderCustomLayout : public RenderBlock {
|
||||
public:
|
||||
explicit RenderCustomLayout(ContainerNode* node);
|
||||
void computePreferredLogicalWidths() final;
|
||||
void layout() final;
|
||||
const char* renderName() const;
|
||||
bool isRenderCustomLayout() const final { return true; }
|
||||
|
||||
protected:
|
||||
virtual ~RenderCustomLayout();
|
||||
};
|
||||
|
||||
} // namespace blink
|
||||
|
||||
#endif // SKY_ENGINE_CORE_RENDERING_RENDERCUSTOMLAYOUT_H_
|
||||
@ -249,7 +249,6 @@ public:
|
||||
virtual bool isImage() const { return false; }
|
||||
virtual bool isInlineBlock() const { return false; }
|
||||
virtual bool isRenderBlock() const { return false; }
|
||||
virtual bool isRenderCustomLayout() const { return false; }
|
||||
virtual bool isRenderParagraph() const { return false; }
|
||||
virtual bool isRenderInline() const { return false; }
|
||||
virtual bool isRenderView() const { return false; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user