Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 4 * reserved. | 4 * reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 * | 20 * |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "core/style/ContentData.h" | 23 #include "core/style/ContentData.h" |
| 24 | 24 |
| 25 #include <memory> | |
|
rune
2017/03/15 14:58:37
I thought we used to include them below. Did the u
emilio
2017/03/15 15:36:15
Yes, git cl format did this change, and reverting
| |
| 26 #include "core/dom/PseudoElement.h" | |
| 25 #include "core/layout/LayoutCounter.h" | 27 #include "core/layout/LayoutCounter.h" |
| 26 #include "core/layout/LayoutImage.h" | 28 #include "core/layout/LayoutImage.h" |
| 27 #include "core/layout/LayoutImageResource.h" | 29 #include "core/layout/LayoutImageResource.h" |
| 28 #include "core/layout/LayoutImageResourceStyleImage.h" | 30 #include "core/layout/LayoutImageResourceStyleImage.h" |
| 29 #include "core/layout/LayoutQuote.h" | 31 #include "core/layout/LayoutQuote.h" |
| 30 #include "core/layout/LayoutTextFragment.h" | 32 #include "core/layout/LayoutTextFragment.h" |
| 31 #include "core/style/ComputedStyle.h" | 33 #include "core/style/ComputedStyle.h" |
| 32 #include <memory> | |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 ContentData* ContentData::create(StyleImage* image) { | 37 ContentData* ContentData::create(StyleImage* image) { |
| 37 return new ImageContentData(image); | 38 return new ImageContentData(image); |
| 38 } | 39 } |
| 39 | 40 |
| 40 ContentData* ContentData::create(const String& text) { | 41 ContentData* ContentData::create(const String& text) { |
| 41 return new TextContentData(text); | 42 return new TextContentData(text); |
| 42 } | 43 } |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 61 } | 62 } |
| 62 | 63 |
| 63 return result; | 64 return result; |
| 64 } | 65 } |
| 65 | 66 |
| 66 DEFINE_TRACE(ContentData) { | 67 DEFINE_TRACE(ContentData) { |
| 67 visitor->trace(m_next); | 68 visitor->trace(m_next); |
| 68 } | 69 } |
| 69 | 70 |
| 70 LayoutObject* ImageContentData::createLayoutObject( | 71 LayoutObject* ImageContentData::createLayoutObject( |
| 71 Document& doc, | 72 PseudoElement& pseudo, |
| 72 ComputedStyle& pseudoStyle) const { | 73 ComputedStyle& pseudoStyle) const { |
| 73 LayoutImage* image = LayoutImage::createAnonymous(&doc); | 74 LayoutImage* image = LayoutImage::createAnonymous(pseudo); |
| 74 image->setPseudoStyle(&pseudoStyle); | 75 image->setPseudoStyle(&pseudoStyle); |
| 75 if (m_image) | 76 if (m_image) |
| 76 image->setImageResource( | 77 image->setImageResource( |
| 77 LayoutImageResourceStyleImage::create(m_image.get())); | 78 LayoutImageResourceStyleImage::create(m_image.get())); |
| 78 else | 79 else |
| 79 image->setImageResource(LayoutImageResource::create()); | 80 image->setImageResource(LayoutImageResource::create()); |
| 80 return image; | 81 return image; |
| 81 } | 82 } |
| 82 | 83 |
| 83 DEFINE_TRACE(ImageContentData) { | 84 DEFINE_TRACE(ImageContentData) { |
| 84 visitor->trace(m_image); | 85 visitor->trace(m_image); |
| 85 ContentData::trace(visitor); | 86 ContentData::trace(visitor); |
| 86 } | 87 } |
| 87 | 88 |
| 88 LayoutObject* TextContentData::createLayoutObject( | 89 LayoutObject* TextContentData::createLayoutObject( |
| 89 Document& doc, | 90 PseudoElement& pseudo, |
| 90 ComputedStyle& pseudoStyle) const { | 91 ComputedStyle& pseudoStyle) const { |
| 91 LayoutObject* layoutObject = new LayoutTextFragment(&doc, m_text.impl()); | 92 LayoutObject* layoutObject = |
| 93 LayoutTextFragment::createAnonymous(pseudo, m_text.impl()); | |
| 92 layoutObject->setPseudoStyle(&pseudoStyle); | 94 layoutObject->setPseudoStyle(&pseudoStyle); |
| 93 return layoutObject; | 95 return layoutObject; |
| 94 } | 96 } |
| 95 | 97 |
| 96 LayoutObject* CounterContentData::createLayoutObject( | 98 LayoutObject* CounterContentData::createLayoutObject( |
| 97 Document& doc, | 99 PseudoElement& pseudo, |
| 98 ComputedStyle& pseudoStyle) const { | 100 ComputedStyle& pseudoStyle) const { |
| 99 LayoutObject* layoutObject = new LayoutCounter(&doc, *m_counter); | 101 LayoutObject* layoutObject = new LayoutCounter(pseudo, *m_counter); |
| 100 layoutObject->setPseudoStyle(&pseudoStyle); | 102 layoutObject->setPseudoStyle(&pseudoStyle); |
| 101 return layoutObject; | 103 return layoutObject; |
| 102 } | 104 } |
| 103 | 105 |
| 104 LayoutObject* QuoteContentData::createLayoutObject( | 106 LayoutObject* QuoteContentData::createLayoutObject( |
| 105 Document& doc, | 107 PseudoElement& pseudo, |
| 106 ComputedStyle& pseudoStyle) const { | 108 ComputedStyle& pseudoStyle) const { |
| 107 LayoutObject* layoutObject = new LayoutQuote(&doc, m_quote); | 109 LayoutObject* layoutObject = new LayoutQuote(pseudo, m_quote); |
| 108 layoutObject->setPseudoStyle(&pseudoStyle); | 110 layoutObject->setPseudoStyle(&pseudoStyle); |
| 109 return layoutObject; | 111 return layoutObject; |
| 110 } | 112 } |
| 111 | 113 |
| 112 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |