Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. |
| 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com) | 6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/rendering/RenderListMarker.h" | 26 #include "core/rendering/RenderListMarker.h" |
| 27 | 27 |
| 28 #include "core/dom/MarkerPseudoElement.h" | |
| 28 #include "core/fetch/ImageResource.h" | 29 #include "core/fetch/ImageResource.h" |
| 29 #include "core/paint/ListMarkerPainter.h" | 30 #include "core/paint/ListMarkerPainter.h" |
| 30 #include "core/rendering/RenderLayer.h" | 31 #include "core/rendering/RenderLayer.h" |
| 31 #include "core/rendering/RenderListItem.h" | 32 #include "core/rendering/RenderListItem.h" |
| 32 #include "core/rendering/TextRunConstructor.h" | 33 #include "core/rendering/TextRunConstructor.h" |
| 33 #include "platform/fonts/Font.h" | 34 #include "platform/fonts/Font.h" |
| 34 #include "wtf/text/StringBuilder.h" | 35 #include "wtf/text/StringBuilder.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1040 case Georgian: | 1041 case Georgian: |
| 1041 return toGeorgian(value); | 1042 return toGeorgian(value); |
| 1042 case Hebrew: | 1043 case Hebrew: |
| 1043 return toHebrew(value); | 1044 return toHebrew(value); |
| 1044 } | 1045 } |
| 1045 | 1046 |
| 1046 ASSERT_NOT_REACHED(); | 1047 ASSERT_NOT_REACHED(); |
| 1047 return ""; | 1048 return ""; |
| 1048 } | 1049 } |
| 1049 | 1050 |
| 1051 RenderListMarker::RenderListMarker(Element* node, RenderListItem* item) | |
| 1052 : RenderBox(node) | |
| 1053 , m_listItem(item) | |
| 1054 { | |
| 1055 // init RenderObject attributes | |
| 1056 setInline(true); // our object is Inline | |
| 1057 setReplaced(true); // pretend to be replaced | |
| 1058 } | |
| 1059 | |
| 1050 RenderListMarker::RenderListMarker(RenderListItem* item) | 1060 RenderListMarker::RenderListMarker(RenderListItem* item) |
| 1051 : RenderBox(0) | 1061 : RenderBox(0) |
| 1052 , m_listItem(item) | 1062 , m_listItem(item) |
| 1053 { | 1063 { |
| 1054 // init RenderObject attributes | 1064 // init RenderObject attributes |
| 1055 setInline(true); // our object is Inline | 1065 setInline(true); // our object is Inline |
| 1056 setReplaced(true); // pretend to be replaced | 1066 setReplaced(true); // pretend to be replaced |
| 1057 } | 1067 } |
| 1058 | 1068 |
| 1059 RenderListMarker::~RenderListMarker() | 1069 RenderListMarker::~RenderListMarker() |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1631 LayoutRect rect(0, root.selectionTop() - location().y(), size().width(), roo t.selectionHeight()); | 1641 LayoutRect rect(0, root.selectionTop() - location().y(), size().width(), roo t.selectionHeight()); |
| 1632 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); | 1642 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); |
| 1633 // FIXME: groupedMapping() leaks the squashing abstraction. | 1643 // FIXME: groupedMapping() leaks the squashing abstraction. |
| 1634 if (paintInvalidationContainer->layer()->groupedMapping()) | 1644 if (paintInvalidationContainer->layer()->groupedMapping()) |
| 1635 RenderLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer , rect); | 1645 RenderLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer , rect); |
| 1636 return rect; | 1646 return rect; |
| 1637 } | 1647 } |
| 1638 | 1648 |
| 1639 void RenderListMarker::listItemStyleDidChange() | 1649 void RenderListMarker::listItemStyleDidChange() |
| 1640 { | 1650 { |
| 1641 RefPtr<RenderStyle> newStyle = RenderStyle::create(); | 1651 RefPtr<RenderStyle> newStyle = MarkerPseudoElement::styleForListMarkerRender er(*m_listItem, style()); |
|
Julien - ping for review
2015/02/04 01:56:34
styleRef() (and more generally let's use const Ren
dsinclair
2015/02/04 15:30:59
Making this a const RenderStyle& is a much larger
| |
| 1642 // The marker always inherits from the list item, regardless of where it mig ht end | |
| 1643 // up (e.g., in some deeply nested line box). See CSS3 spec. | |
| 1644 newStyle->inheritFrom(m_listItem->style()); | |
| 1645 if (style()) { | |
| 1646 // Reuse the current margins. Otherwise resetting the margins to initial values | |
| 1647 // would trigger unnecessary layout. | |
| 1648 newStyle->setMarginStart(style()->marginStart()); | |
| 1649 newStyle->setMarginEnd(style()->marginRight()); | |
| 1650 } | |
| 1651 setStyle(newStyle.release()); | 1652 setStyle(newStyle.release()); |
| 1652 } | 1653 } |
| 1653 | 1654 |
| 1654 } // namespace blink | 1655 } // namespace blink |
| OLD | NEW |