| 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 17 matching lines...) Expand all Loading... |
| 28 #include "wtf/text/AtomicString.h" | 28 #include "wtf/text/AtomicString.h" |
| 29 | 29 |
| 30 #include <algorithm> | 30 #include <algorithm> |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 RenderQuote::RenderQuote(Document* node, QuoteType quote) | 34 RenderQuote::RenderQuote(Document* node, QuoteType quote) |
| 35 : RenderInline(0) | 35 : RenderInline(0) |
| 36 , m_type(quote) | 36 , m_type(quote) |
| 37 , m_depth(0) | 37 , m_depth(0) |
| 38 , m_next(0) | 38 , m_next(nullptr) |
| 39 , m_previous(0) | 39 , m_previous(nullptr) |
| 40 , m_attached(false) | 40 , m_attached(false) |
| 41 { | 41 { |
| 42 setDocumentForAnonymous(node); | 42 setDocumentForAnonymous(node); |
| 43 } | 43 } |
| 44 | 44 |
| 45 RenderQuote::~RenderQuote() | 45 RenderQuote::~RenderQuote() |
| 46 { | 46 { |
| 47 ASSERT(!m_attached); | 47 ASSERT(!m_attached); |
| 48 ASSERT(!m_next && !m_previous); | 48 ASSERT(!m_next && !m_previous); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void RenderQuote::trace(Visitor* visitor) |
| 52 { |
| 53 visitor->trace(m_next); |
| 54 visitor->trace(m_previous); |
| 55 RenderInline::trace(visitor); |
| 56 } |
| 57 |
| 51 void RenderQuote::willBeDestroyed() | 58 void RenderQuote::willBeDestroyed() |
| 52 { | 59 { |
| 53 detachQuote(); | 60 detachQuote(); |
| 54 RenderInline::willBeDestroyed(); | 61 RenderInline::willBeDestroyed(); |
| 55 } | 62 } |
| 56 | 63 |
| 57 void RenderQuote::willBeRemovedFromTree() | 64 void RenderQuote::willBeRemovedFromTree() |
| 58 { | 65 { |
| 59 RenderInline::willBeRemovedFromTree(); | 66 RenderInline::willBeRemovedFromTree(); |
| 60 detachQuote(); | 67 detachQuote(); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 m_previous->m_next = m_next; | 357 m_previous->m_next = m_next; |
| 351 else if (view()) | 358 else if (view()) |
| 352 view()->setRenderQuoteHead(m_next); | 359 view()->setRenderQuoteHead(m_next); |
| 353 if (m_next) | 360 if (m_next) |
| 354 m_next->m_previous = m_previous; | 361 m_next->m_previous = m_previous; |
| 355 if (!documentBeingDestroyed()) { | 362 if (!documentBeingDestroyed()) { |
| 356 for (RenderQuote* quote = m_next; quote; quote = quote->m_next) | 363 for (RenderQuote* quote = m_next; quote; quote = quote->m_next) |
| 357 quote->updateDepth(); | 364 quote->updateDepth(); |
| 358 } | 365 } |
| 359 m_attached = false; | 366 m_attached = false; |
| 360 m_next = 0; | 367 m_next = nullptr; |
| 361 m_previous = 0; | 368 m_previous = nullptr; |
| 362 m_depth = 0; | 369 m_depth = 0; |
| 363 } | 370 } |
| 364 | 371 |
| 365 void RenderQuote::updateDepth() | 372 void RenderQuote::updateDepth() |
| 366 { | 373 { |
| 367 ASSERT(m_attached); | 374 ASSERT(m_attached); |
| 368 int oldDepth = m_depth; | 375 int oldDepth = m_depth; |
| 369 m_depth = 0; | 376 m_depth = 0; |
| 370 if (m_previous) { | 377 if (m_previous) { |
| 371 m_depth = m_previous->m_depth; | 378 m_depth = m_previous->m_depth; |
| 372 switch (m_previous->m_type) { | 379 switch (m_previous->m_type) { |
| 373 case OPEN_QUOTE: | 380 case OPEN_QUOTE: |
| 374 case NO_OPEN_QUOTE: | 381 case NO_OPEN_QUOTE: |
| 375 m_depth++; | 382 m_depth++; |
| 376 break; | 383 break; |
| 377 case CLOSE_QUOTE: | 384 case CLOSE_QUOTE: |
| 378 case NO_CLOSE_QUOTE: | 385 case NO_CLOSE_QUOTE: |
| 379 if (m_depth) | 386 if (m_depth) |
| 380 m_depth--; | 387 m_depth--; |
| 381 break; | 388 break; |
| 382 } | 389 } |
| 383 } | 390 } |
| 384 if (oldDepth != m_depth) | 391 if (oldDepth != m_depth) |
| 385 updateText(); | 392 updateText(); |
| 386 } | 393 } |
| 387 | 394 |
| 388 } // namespace blink | 395 } // namespace blink |
| OLD | NEW |