| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2010 Google, Inc. All Rights Reserved. |    2  * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 
|    3  * Copyright (C) 2011 Apple Inc. All rights reserved. |    3  * Copyright (C) 2011 Apple Inc. All rights reserved. | 
|    4  * |    4  * | 
|    5  * Redistribution and use in source and binary forms, with or without |    5  * Redistribution and use in source and binary forms, with or without | 
|    6  * modification, are permitted provided that the following conditions |    6  * modification, are permitted provided that the following conditions | 
|    7  * are met: |    7  * are met: | 
|    8  * 1. Redistributions of source code must retain the above copyright |    8  * 1. Redistributions of source code must retain the above copyright | 
|    9  *    notice, this list of conditions and the following disclaimer. |    9  *    notice, this list of conditions and the following disclaimer. | 
|   10  * 2. Redistributions in binary form must reproduce the above copyright |   10  * 2. Redistributions in binary form must reproduce the above copyright | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|   39     ASSERT(m_node); |   39     ASSERT(m_node); | 
|   40 } |   40 } | 
|   41  |   41  | 
|   42 HTMLElementStack::ElementRecord::~ElementRecord() |   42 HTMLElementStack::ElementRecord::~ElementRecord() | 
|   43 { |   43 { | 
|   44 } |   44 } | 
|   45  |   45  | 
|   46 HTMLElementStack::HTMLElementStack() |   46 HTMLElementStack::HTMLElementStack() | 
|   47     : m_rootNode(nullptr) |   47     : m_rootNode(nullptr) | 
|   48     , m_stackDepth(0) |   48     , m_stackDepth(0) | 
 |   49     , m_preserveWhiteSpaceCount(0) | 
|   49 { |   50 { | 
|   50 } |   51 } | 
|   51  |   52  | 
|   52 HTMLElementStack::~HTMLElementStack() |   53 HTMLElementStack::~HTMLElementStack() | 
|   53 { |   54 { | 
|   54 } |   55 } | 
|   55  |   56  | 
|   56 void HTMLElementStack::popAll() |   57 void HTMLElementStack::popAll() | 
|   57 { |   58 { | 
|   58     m_rootNode = nullptr; |   59     m_rootNode = nullptr; | 
|   59     m_stackDepth = 0; |   60     m_stackDepth = 0; | 
 |   61     m_preserveWhiteSpaceCount = 0; | 
|   60     while (m_top) |   62     while (m_top) | 
|   61         m_top = m_top->releaseNext(); |   63         m_top = m_top->releaseNext(); | 
|   62 } |   64 } | 
|   63  |   65  | 
|   64 void HTMLElementStack::pop() |   66 void HTMLElementStack::pop() | 
|   65 { |   67 { | 
|   66     popCommon(); |   68     popCommon(); | 
|   67 } |   69 } | 
|   68  |   70  | 
|   69 void HTMLElementStack::popUntil(Element* element) |   71 void HTMLElementStack::popUntil(Element* element) | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|   95 HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const |   97 HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const | 
|   96 { |   98 { | 
|   97     ASSERT(m_top); |   99     ASSERT(m_top); | 
|   98     return m_top.get(); |  100     return m_top.get(); | 
|   99 } |  101 } | 
|  100  |  102  | 
|  101 void HTMLElementStack::pushCommon(PassRefPtr<ContainerNode> node) |  103 void HTMLElementStack::pushCommon(PassRefPtr<ContainerNode> node) | 
|  102 { |  104 { | 
|  103     ASSERT(m_rootNode); |  105     ASSERT(m_rootNode); | 
|  104  |  106  | 
 |  107     if (isHTMLTElement(node)) | 
 |  108         ++m_preserveWhiteSpaceCount; | 
|  105     m_stackDepth++; |  109     m_stackDepth++; | 
|  106     m_top = adoptPtr(new ElementRecord(node, m_top.release())); |  110     m_top = adoptPtr(new ElementRecord(node, m_top.release())); | 
|  107 } |  111 } | 
|  108  |  112  | 
|  109 void HTMLElementStack::popCommon() |  113 void HTMLElementStack::popCommon() | 
|  110 { |  114 { | 
 |  115     if (isHTMLTElement(topNode())) { | 
 |  116         ASSERT(m_preserveWhiteSpaceCount); | 
 |  117         --m_preserveWhiteSpaceCount; | 
 |  118     } | 
|  111     m_top = m_top->releaseNext(); |  119     m_top = m_top->releaseNext(); | 
|  112     m_stackDepth--; |  120     m_stackDepth--; | 
|  113 } |  121 } | 
|  114  |  122  | 
|  115 #ifndef NDEBUG |  123 #ifndef NDEBUG | 
|  116  |  124  | 
|  117 void HTMLElementStack::show() |  125 void HTMLElementStack::show() | 
|  118 { |  126 { | 
|  119     for (ElementRecord* record = m_top.get(); record; record = record->next()) |  127     for (ElementRecord* record = m_top.get(); record; record = record->next()) | 
|  120         record->element()->showNode(); |  128         record->element()->showNode(); | 
|  121 } |  129 } | 
|  122  |  130  | 
|  123 #endif |  131 #endif | 
|  124  |  132  | 
|  125 } |  133 } | 
| OLD | NEW |