| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 void WebNode::reset() | 44 void WebNode::reset() |
| 45 { | 45 { |
| 46 assign(0); | 46 assign(0); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void WebNode::assign(const WebNode& other) | 49 void WebNode::assign(const WebNode& other) |
| 50 { | 50 { |
| 51 WebNodePrivate* p = const_cast<WebNodePrivate*>(other.m_private); | 51 WebNodePrivate* p = const_cast<WebNodePrivate*>(other.m_private); |
| 52 p->ref(); | 52 if (p) |
| 53 p->ref(); |
| 53 assign(p); | 54 assign(p); |
| 54 } | 55 } |
| 55 | 56 |
| 56 WebNode WebNode::parentNode() const | 57 WebNode WebNode::parentNode() const |
| 57 { | 58 { |
| 58 return PassRefPtr<Node>(const_cast<Node*>(m_private->parentNode())); | 59 return PassRefPtr<Node>(const_cast<Node*>(m_private->parentNode())); |
| 59 } | 60 } |
| 60 | 61 |
| 61 WebString WebNode::nodeName() const | 62 WebString WebNode::nodeName() const |
| 62 { | 63 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 81 | 82 |
| 82 void WebNode::assign(WebNodePrivate* p) | 83 void WebNode::assign(WebNodePrivate* p) |
| 83 { | 84 { |
| 84 // p is already ref'd for us by the caller | 85 // p is already ref'd for us by the caller |
| 85 if (m_private) | 86 if (m_private) |
| 86 m_private->deref(); | 87 m_private->deref(); |
| 87 m_private = p; | 88 m_private = p; |
| 88 } | 89 } |
| 89 | 90 |
| 90 } // namespace WebKit | 91 } // namespace WebKit |
| OLD | NEW |