OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2011 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2011 Nokia Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "core/layout/LayoutTextFragment.h" | 24 #include "core/layout/LayoutTextFragment.h" |
25 #include "core/layout/LayoutView.h" | 25 #include "core/layout/LayoutView.h" |
26 #include "wtf/StdLibExtras.h" | 26 #include "wtf/StdLibExtras.h" |
27 #include "wtf/text/AtomicString.h" | 27 #include "wtf/text/AtomicString.h" |
28 | 28 |
29 #include <algorithm> | 29 #include <algorithm> |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 LayoutQuote::LayoutQuote(Document* node, QuoteType quote) | 33 LayoutQuote::LayoutQuote(PseudoElement& node, QuoteType quote) |
34 : LayoutInline(nullptr), | 34 : LayoutInline(nullptr), |
35 m_type(quote), | 35 m_type(quote), |
36 m_depth(0), | 36 m_depth(0), |
37 m_next(nullptr), | 37 m_next(nullptr), |
38 m_previous(nullptr), | 38 m_previous(nullptr), |
39 m_attached(false) { | 39 m_attached(false), |
40 setDocumentForAnonymous(node); | 40 m_owningPseudo(&node) { |
| 41 setPseudoForAnonymous(node); |
41 } | 42 } |
42 | 43 |
43 LayoutQuote::~LayoutQuote() { | 44 LayoutQuote::~LayoutQuote() { |
44 ASSERT(!m_attached); | 45 ASSERT(!m_attached); |
45 ASSERT(!m_next && !m_previous); | 46 ASSERT(!m_next && !m_previous); |
46 } | 47 } |
47 | 48 |
48 void LayoutQuote::willBeDestroyed() { | 49 void LayoutQuote::willBeDestroyed() { |
49 detachQuote(); | 50 detachQuote(); |
50 LayoutInline::willBeDestroyed(); | 51 LayoutInline::willBeDestroyed(); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 if (m_text == text) | 258 if (m_text == text) |
258 return; | 259 return; |
259 | 260 |
260 m_text = text; | 261 m_text = text; |
261 | 262 |
262 LayoutTextFragment* fragment = findFragmentChild(); | 263 LayoutTextFragment* fragment = findFragmentChild(); |
263 if (fragment) { | 264 if (fragment) { |
264 fragment->setStyle(mutableStyle()); | 265 fragment->setStyle(mutableStyle()); |
265 fragment->setContentString(m_text.impl()); | 266 fragment->setContentString(m_text.impl()); |
266 } else { | 267 } else { |
267 fragment = new LayoutTextFragment(&document(), m_text.impl()); | 268 fragment = |
| 269 LayoutTextFragment::createAnonymous(*m_owningPseudo, m_text.impl()); |
268 fragment->setStyle(mutableStyle()); | 270 fragment->setStyle(mutableStyle()); |
269 addChild(fragment); | 271 addChild(fragment); |
270 } | 272 } |
271 } | 273 } |
272 | 274 |
273 LayoutTextFragment* LayoutQuote::findFragmentChild() const { | 275 LayoutTextFragment* LayoutQuote::findFragmentChild() const { |
274 // We walk from the end of the child list because, if we've had a first-letter | 276 // We walk from the end of the child list because, if we've had a first-letter |
275 // LayoutObject inserted then the remaining text will be at the end. | 277 // LayoutObject inserted then the remaining text will be at the end. |
276 while (LayoutObject* child = lastChild()) { | 278 while (LayoutObject* child = lastChild()) { |
277 if (child->isText() && toLayoutText(child)->isTextFragment()) | 279 if (child->isText() && toLayoutText(child)->isTextFragment()) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 if (m_depth) | 392 if (m_depth) |
391 m_depth--; | 393 m_depth--; |
392 break; | 394 break; |
393 } | 395 } |
394 } | 396 } |
395 if (oldDepth != m_depth) | 397 if (oldDepth != m_depth) |
396 updateText(); | 398 updateText(); |
397 } | 399 } |
398 | 400 |
399 } // namespace blink | 401 } // namespace blink |
OLD | NEW |