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 |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 return toGeorgian(value); | 1041 return toGeorgian(value); |
1042 case Hebrew: | 1042 case Hebrew: |
1043 return toHebrew(value); | 1043 return toHebrew(value); |
1044 } | 1044 } |
1045 | 1045 |
1046 ASSERT_NOT_REACHED(); | 1046 ASSERT_NOT_REACHED(); |
1047 return ""; | 1047 return ""; |
1048 } | 1048 } |
1049 | 1049 |
1050 LayoutListMarker::LayoutListMarker(LayoutListItem* item) | 1050 LayoutListMarker::LayoutListMarker(LayoutListItem* item) |
1051 : RenderBox(0) | 1051 : LayoutBox(0) |
1052 , m_listItem(item) | 1052 , m_listItem(item) |
1053 { | 1053 { |
1054 // init LayoutObject attributes | 1054 // init LayoutObject attributes |
1055 setInline(true); // our object is Inline | 1055 setInline(true); // our object is Inline |
1056 setReplaced(true); // pretend to be replaced | 1056 setReplaced(true); // pretend to be replaced |
1057 } | 1057 } |
1058 | 1058 |
1059 LayoutListMarker::~LayoutListMarker() | 1059 LayoutListMarker::~LayoutListMarker() |
1060 { | 1060 { |
1061 } | 1061 } |
1062 | 1062 |
1063 void LayoutListMarker::destroy() | 1063 void LayoutListMarker::destroy() |
1064 { | 1064 { |
1065 if (m_image) | 1065 if (m_image) |
1066 m_image->removeClient(this); | 1066 m_image->removeClient(this); |
1067 RenderBox::destroy(); | 1067 LayoutBox::destroy(); |
1068 } | 1068 } |
1069 | 1069 |
1070 LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item) | 1070 LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item) |
1071 { | 1071 { |
1072 Document& document = item->document(); | 1072 Document& document = item->document(); |
1073 LayoutListMarker* renderer = new LayoutListMarker(item); | 1073 LayoutListMarker* renderer = new LayoutListMarker(item); |
1074 renderer->setDocumentForAnonymous(&document); | 1074 renderer->setDocumentForAnonymous(&document); |
1075 return renderer; | 1075 return renderer; |
1076 } | 1076 } |
1077 | 1077 |
1078 void LayoutListMarker::styleWillChange(StyleDifference diff, const LayoutStyle&
newStyle) | 1078 void LayoutListMarker::styleWillChange(StyleDifference diff, const LayoutStyle&
newStyle) |
1079 { | 1079 { |
1080 if (style() && (newStyle.listStylePosition() != style()->listStylePosition()
|| newStyle.listStyleType() != style()->listStyleType())) | 1080 if (style() && (newStyle.listStylePosition() != style()->listStylePosition()
|| newStyle.listStyleType() != style()->listStyleType())) |
1081 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 1081 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
1082 | 1082 |
1083 RenderBox::styleWillChange(diff, newStyle); | 1083 LayoutBox::styleWillChange(diff, newStyle); |
1084 } | 1084 } |
1085 | 1085 |
1086 void LayoutListMarker::styleDidChange(StyleDifference diff, const LayoutStyle* o
ldStyle) | 1086 void LayoutListMarker::styleDidChange(StyleDifference diff, const LayoutStyle* o
ldStyle) |
1087 { | 1087 { |
1088 RenderBox::styleDidChange(diff, oldStyle); | 1088 LayoutBox::styleDidChange(diff, oldStyle); |
1089 | 1089 |
1090 if (m_image != style()->listStyleImage()) { | 1090 if (m_image != style()->listStyleImage()) { |
1091 if (m_image) | 1091 if (m_image) |
1092 m_image->removeClient(this); | 1092 m_image->removeClient(this); |
1093 m_image = style()->listStyleImage(); | 1093 m_image = style()->listStyleImage(); |
1094 if (m_image) | 1094 if (m_image) |
1095 m_image->addClient(this); | 1095 m_image->addClient(this); |
1096 } | 1096 } |
1097 } | 1097 } |
1098 | 1098 |
1099 InlineBox* LayoutListMarker::createInlineBox() | 1099 InlineBox* LayoutListMarker::createInlineBox() |
1100 { | 1100 { |
1101 InlineBox* result = RenderBox::createInlineBox(); | 1101 InlineBox* result = LayoutBox::createInlineBox(); |
1102 result->setIsText(isText()); | 1102 result->setIsText(isText()); |
1103 return result; | 1103 return result; |
1104 } | 1104 } |
1105 | 1105 |
1106 bool LayoutListMarker::isImage() const | 1106 bool LayoutListMarker::isImage() const |
1107 { | 1107 { |
1108 return m_image && !m_image->errorOccurred(); | 1108 return m_image && !m_image->errorOccurred(); |
1109 } | 1109 } |
1110 | 1110 |
1111 LayoutRect LayoutListMarker::localSelectionRect() | 1111 LayoutRect LayoutListMarker::localSelectionRect() |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 } | 1466 } |
1467 | 1467 |
1468 style()->setMarginStart(Length(marginStart, Fixed)); | 1468 style()->setMarginStart(Length(marginStart, Fixed)); |
1469 style()->setMarginEnd(Length(marginEnd, Fixed)); | 1469 style()->setMarginEnd(Length(marginEnd, Fixed)); |
1470 } | 1470 } |
1471 | 1471 |
1472 LayoutUnit LayoutListMarker::lineHeight(bool firstLine, LineDirectionMode direct
ion, LinePositionMode linePositionMode) const | 1472 LayoutUnit LayoutListMarker::lineHeight(bool firstLine, LineDirectionMode direct
ion, LinePositionMode linePositionMode) const |
1473 { | 1473 { |
1474 if (!isImage()) | 1474 if (!isImage()) |
1475 return m_listItem->lineHeight(firstLine, direction, PositionOfInteriorLi
neBoxes); | 1475 return m_listItem->lineHeight(firstLine, direction, PositionOfInteriorLi
neBoxes); |
1476 return RenderBox::lineHeight(firstLine, direction, linePositionMode); | 1476 return LayoutBox::lineHeight(firstLine, direction, linePositionMode); |
1477 } | 1477 } |
1478 | 1478 |
1479 int LayoutListMarker::baselinePosition(FontBaseline baselineType, bool firstLine
, LineDirectionMode direction, LinePositionMode linePositionMode) const | 1479 int LayoutListMarker::baselinePosition(FontBaseline baselineType, bool firstLine
, LineDirectionMode direction, LinePositionMode linePositionMode) const |
1480 { | 1480 { |
1481 ASSERT(linePositionMode == PositionOnContainingLine); | 1481 ASSERT(linePositionMode == PositionOnContainingLine); |
1482 if (!isImage()) | 1482 if (!isImage()) |
1483 return m_listItem->baselinePosition(baselineType, firstLine, direction,
PositionOfInteriorLineBoxes); | 1483 return m_listItem->baselinePosition(baselineType, firstLine, direction,
PositionOfInteriorLineBoxes); |
1484 return RenderBox::baselinePosition(baselineType, firstLine, direction, lineP
ositionMode); | 1484 return LayoutBox::baselinePosition(baselineType, firstLine, direction, lineP
ositionMode); |
1485 } | 1485 } |
1486 | 1486 |
1487 bool LayoutListMarker::isInside() const | 1487 bool LayoutListMarker::isInside() const |
1488 { | 1488 { |
1489 return m_listItem->notInList() || style()->listStylePosition() == INSIDE; | 1489 return m_listItem->notInList() || style()->listStylePosition() == INSIDE; |
1490 } | 1490 } |
1491 | 1491 |
1492 IntRect LayoutListMarker::getRelativeMarkerRect() | 1492 IntRect LayoutListMarker::getRelativeMarkerRect() |
1493 { | 1493 { |
1494 if (isImage()) | 1494 if (isImage()) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 relativeRect = relativeRect.transposedRect(); | 1603 relativeRect = relativeRect.transposedRect(); |
1604 relativeRect.setX(size().width() - relativeRect.x() - relativeRect.width
()); | 1604 relativeRect.setX(size().width() - relativeRect.x() - relativeRect.width
()); |
1605 } | 1605 } |
1606 | 1606 |
1607 return relativeRect; | 1607 return relativeRect; |
1608 } | 1608 } |
1609 | 1609 |
1610 void LayoutListMarker::setSelectionState(SelectionState state) | 1610 void LayoutListMarker::setSelectionState(SelectionState state) |
1611 { | 1611 { |
1612 // The selection state for our containing block hierarchy is updated by the
base class call. | 1612 // The selection state for our containing block hierarchy is updated by the
base class call. |
1613 RenderBox::setSelectionState(state); | 1613 LayoutBox::setSelectionState(state); |
1614 | 1614 |
1615 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) | 1615 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) |
1616 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); | 1616 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); |
1617 } | 1617 } |
1618 | 1618 |
1619 LayoutRect LayoutListMarker::selectionRectForPaintInvalidation(const LayoutBoxMo
delObject* paintInvalidationContainer) const | 1619 LayoutRect LayoutListMarker::selectionRectForPaintInvalidation(const LayoutBoxMo
delObject* paintInvalidationContainer) const |
1620 { | 1620 { |
1621 ASSERT(!needsLayout()); | 1621 ASSERT(!needsLayout()); |
1622 | 1622 |
1623 if (selectionState() == SelectionNone || !inlineBoxWrapper()) | 1623 if (selectionState() == SelectionNone || !inlineBoxWrapper()) |
(...skipping 17 matching lines...) Expand all Loading... |
1641 if (style()) { | 1641 if (style()) { |
1642 // Reuse the current margins. Otherwise resetting the margins to initial
values | 1642 // Reuse the current margins. Otherwise resetting the margins to initial
values |
1643 // would trigger unnecessary layout. | 1643 // would trigger unnecessary layout. |
1644 newStyle->setMarginStart(style()->marginStart()); | 1644 newStyle->setMarginStart(style()->marginStart()); |
1645 newStyle->setMarginEnd(style()->marginRight()); | 1645 newStyle->setMarginEnd(style()->marginRight()); |
1646 } | 1646 } |
1647 setStyle(newStyle.release()); | 1647 setStyle(newStyle.release()); |
1648 } | 1648 } |
1649 | 1649 |
1650 } // namespace blink | 1650 } // namespace blink |
OLD | NEW |