| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007 Apple 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 * | 19 * |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "core/layout/LayoutCounter.h" | 22 #include "core/layout/LayoutCounter.h" |
| 23 | 23 |
| 24 #include <memory> |
| 24 #include "core/HTMLNames.h" | 25 #include "core/HTMLNames.h" |
| 25 #include "core/dom/Element.h" | 26 #include "core/dom/Element.h" |
| 26 #include "core/dom/ElementTraversal.h" | 27 #include "core/dom/ElementTraversal.h" |
| 28 #include "core/dom/PseudoElement.h" |
| 27 #include "core/html/HTMLOListElement.h" | 29 #include "core/html/HTMLOListElement.h" |
| 28 #include "core/layout/CounterNode.h" | 30 #include "core/layout/CounterNode.h" |
| 29 #include "core/layout/LayoutListItem.h" | 31 #include "core/layout/LayoutListItem.h" |
| 30 #include "core/layout/LayoutView.h" | 32 #include "core/layout/LayoutView.h" |
| 31 #include "core/layout/ListMarkerText.h" | 33 #include "core/layout/ListMarkerText.h" |
| 32 #include "core/style/ComputedStyle.h" | 34 #include "core/style/ComputedStyle.h" |
| 33 #include "wtf/PtrUtil.h" | 35 #include "wtf/PtrUtil.h" |
| 34 #include "wtf/StdLibExtras.h" | 36 #include "wtf/StdLibExtras.h" |
| 35 #include <memory> | |
| 36 | 37 |
| 37 #ifndef NDEBUG | 38 #ifndef NDEBUG |
| 38 #include <stdio.h> | 39 #include <stdio.h> |
| 39 #endif | 40 #endif |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 44 | 45 |
| 45 typedef HashMap<AtomicString, RefPtr<CounterNode>> CounterMap; | 46 typedef HashMap<AtomicString, RefPtr<CounterNode>> CounterMap; |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 if (currentCounter->parent()) | 418 if (currentCounter->parent()) |
| 418 continue; | 419 continue; |
| 419 if (stayWithin == parentElement(*currentLayoutObject) && | 420 if (stayWithin == parentElement(*currentLayoutObject) && |
| 420 currentCounter->hasResetType()) | 421 currentCounter->hasResetType()) |
| 421 break; | 422 break; |
| 422 newNode->insertAfter(currentCounter, newNode->lastChild(), identifier); | 423 newNode->insertAfter(currentCounter, newNode->lastChild(), identifier); |
| 423 } | 424 } |
| 424 return newNode.get(); | 425 return newNode.get(); |
| 425 } | 426 } |
| 426 | 427 |
| 427 LayoutCounter::LayoutCounter(Document* node, const CounterContent& counter) | 428 LayoutCounter::LayoutCounter(PseudoElement& pseudo, |
| 428 : LayoutText(node, StringImpl::empty), | 429 const CounterContent& counter) |
| 430 : LayoutText(nullptr, StringImpl::empty), |
| 429 m_counter(counter), | 431 m_counter(counter), |
| 430 m_counterNode(nullptr), | 432 m_counterNode(nullptr), |
| 431 m_nextForSameCounter(nullptr) { | 433 m_nextForSameCounter(nullptr) { |
| 434 setDocumentForAnonymous(&pseudo.document()); |
| 432 view()->addLayoutCounter(); | 435 view()->addLayoutCounter(); |
| 433 } | 436 } |
| 434 | 437 |
| 435 LayoutCounter::~LayoutCounter() {} | 438 LayoutCounter::~LayoutCounter() {} |
| 436 | 439 |
| 437 void LayoutCounter::willBeDestroyed() { | 440 void LayoutCounter::willBeDestroyed() { |
| 438 if (m_counterNode) { | 441 if (m_counterNode) { |
| 439 m_counterNode->removeLayoutObject(this); | 442 m_counterNode->removeLayoutObject(this); |
| 440 ASSERT(!m_counterNode); | 443 ASSERT(!m_counterNode); |
| 441 } | 444 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 current->nextSibling(), | 707 current->nextSibling(), |
| 705 current->hasCounterNodeMap() | 708 current->hasCounterNodeMap() |
| 706 ? counterName ? blink::counterMaps().at(current)->at(identifier) | 709 ? counterName ? blink::counterMaps().at(current)->at(identifier) |
| 707 : (blink::CounterNode*)1 | 710 : (blink::CounterNode*)1 |
| 708 : (blink::CounterNode*)0); | 711 : (blink::CounterNode*)0); |
| 709 } | 712 } |
| 710 fflush(stderr); | 713 fflush(stderr); |
| 711 } | 714 } |
| 712 | 715 |
| 713 #endif // NDEBUG | 716 #endif // NDEBUG |
| OLD | NEW |