| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/painting/LayoutRoot.h" | 6 #include "sky/engine/core/painting/LayoutRoot.h" |
| 7 | 7 |
| 8 #include "sky/engine/core/dom/Document.h" | 8 #include "sky/engine/core/dom/Document.h" |
| 9 #include "sky/engine/core/dom/Element.h" | 9 #include "sky/engine/core/dom/Element.h" |
| 10 #include "sky/engine/core/frame/FrameView.h" | 10 #include "sky/engine/core/frame/FrameView.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 m_settings = Settings::create(); | 30 m_settings = Settings::create(); |
| 31 m_settings->setDefaultFixedFontSize(13); | 31 m_settings->setDefaultFixedFontSize(13); |
| 32 m_settings->setDefaultFontSize(16); | 32 m_settings->setDefaultFontSize(16); |
| 33 m_frameHost = FrameHost::createDummy(m_settings.get()); | 33 m_frameHost = FrameHost::createDummy(m_settings.get()); |
| 34 m_frame = LocalFrame::create(nullptr, m_frameHost.get()); | 34 m_frame = LocalFrame::create(nullptr, m_frameHost.get()); |
| 35 m_frame->createView(IntSize(), Color::white, false); | 35 m_frame->createView(IntSize(), Color::white, false); |
| 36 } | 36 } |
| 37 | 37 |
| 38 LayoutRoot::~LayoutRoot() | 38 LayoutRoot::~LayoutRoot() |
| 39 { | 39 { |
| 40 if (!m_document->needsAttach()) |
| 41 m_document->detach(); |
| 40 } | 42 } |
| 41 | 43 |
| 42 Element* LayoutRoot::rootElement() const | 44 Element* LayoutRoot::rootElement() const |
| 43 { | 45 { |
| 44 if (!m_document) | 46 if (!m_document) |
| 45 return nullptr; | 47 return nullptr; |
| 46 return m_document->firstElementChild(); | 48 return m_document->firstElementChild(); |
| 47 } | 49 } |
| 48 | 50 |
| 49 void LayoutRoot::setRootElement(Element* root) | 51 void LayoutRoot::setRootElement(Element* root) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 77 m_frame->setDocument(nullptr); | 79 m_frame->setDocument(nullptr); |
| 78 } | 80 } |
| 79 | 81 |
| 80 void LayoutRoot::paint(Canvas* canvas) | 82 void LayoutRoot::paint(Canvas* canvas) |
| 81 { | 83 { |
| 82 if (m_document) | 84 if (m_document) |
| 83 rootElement()->paint(canvas); | 85 rootElement()->paint(canvas); |
| 84 } | 86 } |
| 85 | 87 |
| 86 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |