OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 isFirstCounter = false; | 743 isFirstCounter = false; |
744 String str(toRenderText(child)->text()); | 744 String str(toRenderText(child)->text()); |
745 stream << str; | 745 stream << str; |
746 } | 746 } |
747 } | 747 } |
748 } | 748 } |
749 | 749 |
750 String counterValueForElement(Element* element) | 750 String counterValueForElement(Element* element) |
751 { | 751 { |
752 // Make sure the element is not freed during the layout. | 752 // Make sure the element is not freed during the layout. |
753 RefPtr<Element> elementRef(element); | 753 RefPtrWillBeRawPtr<Element> protector(element); |
754 element->document().updateLayout(); | 754 element->document().updateLayout(); |
755 TextStream stream; | 755 TextStream stream; |
756 bool isFirstCounter = true; | 756 bool isFirstCounter = true; |
757 // The counter renderers should be children of :before or :after pseudo-elem
ents. | 757 // The counter renderers should be children of :before or :after pseudo-elem
ents. |
758 if (RenderObject* before = element->pseudoElementRenderer(BEFORE)) | 758 if (RenderObject* before = element->pseudoElementRenderer(BEFORE)) |
759 writeCounterValuesFromChildren(stream, before, isFirstCounter); | 759 writeCounterValuesFromChildren(stream, before, isFirstCounter); |
760 if (RenderObject* after = element->pseudoElementRenderer(AFTER)) | 760 if (RenderObject* after = element->pseudoElementRenderer(AFTER)) |
761 writeCounterValuesFromChildren(stream, after, isFirstCounter); | 761 writeCounterValuesFromChildren(stream, after, isFirstCounter); |
762 return stream.release(); | 762 return stream.release(); |
763 } | 763 } |
764 | 764 |
765 String markerTextForListItem(Element* element) | 765 String markerTextForListItem(Element* element) |
766 { | 766 { |
767 // Make sure the element is not freed during the layout. | 767 // Make sure the element is not freed during the layout. |
768 RefPtr<Element> elementRef(element); | 768 RefPtrWillBeRawPtr<Element> protector(element); |
769 element->document().updateLayout(); | 769 element->document().updateLayout(); |
770 | 770 |
771 RenderObject* renderer = element->renderer(); | 771 RenderObject* renderer = element->renderer(); |
772 if (!renderer || !renderer->isListItem()) | 772 if (!renderer || !renderer->isListItem()) |
773 return String(); | 773 return String(); |
774 | 774 |
775 return toRenderListItem(renderer)->markerText(); | 775 return toRenderListItem(renderer)->markerText(); |
776 } | 776 } |
777 | 777 |
778 } // namespace WebCore | 778 } // namespace WebCore |
OLD | NEW |