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 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
6 * All rights reserved. | 6 * All rights reserved. |
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 | 128 |
129 LayoutBlock::~LayoutBlock() { | 129 LayoutBlock::~LayoutBlock() { |
130 removeFromGlobalMaps(); | 130 removeFromGlobalMaps(); |
131 } | 131 } |
132 | 132 |
133 void LayoutBlock::willBeDestroyed() { | 133 void LayoutBlock::willBeDestroyed() { |
134 if (!documentBeingDestroyed() && parent()) | 134 if (!documentBeingDestroyed() && parent()) |
135 parent()->dirtyLinesFromChangedChild(this); | 135 parent()->dirtyLinesFromChangedChild(this); |
136 | 136 |
| 137 if (LocalFrame* frame = this->frame()) { |
| 138 frame->selection().layoutBlockWillBeDestroyed(*this); |
| 139 frame->page()->dragCaret().layoutBlockWillBeDestroyed(*this); |
| 140 } |
| 141 |
137 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 142 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
138 textAutosizer->destroy(this); | 143 textAutosizer->destroy(this); |
139 | 144 |
140 LayoutBox::willBeDestroyed(); | 145 LayoutBox::willBeDestroyed(); |
141 } | 146 } |
142 | 147 |
143 void LayoutBlock::styleWillChange(StyleDifference diff, | 148 void LayoutBlock::styleWillChange(StyleDifference diff, |
144 const ComputedStyle& newStyle) { | 149 const ComputedStyle& newStyle) { |
145 const ComputedStyle* oldStyle = style(); | 150 const ComputedStyle* oldStyle = style(); |
146 | 151 |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 } | 1022 } |
1018 } | 1023 } |
1019 | 1024 |
1020 PaintInvalidationReason LayoutBlock::invalidatePaintIfNeeded( | 1025 PaintInvalidationReason LayoutBlock::invalidatePaintIfNeeded( |
1021 const PaintInvalidationState& paintInvalidationState) { | 1026 const PaintInvalidationState& paintInvalidationState) { |
1022 return LayoutBox::invalidatePaintIfNeeded(paintInvalidationState); | 1027 return LayoutBox::invalidatePaintIfNeeded(paintInvalidationState); |
1023 } | 1028 } |
1024 | 1029 |
1025 PaintInvalidationReason LayoutBlock::invalidatePaintIfNeeded( | 1030 PaintInvalidationReason LayoutBlock::invalidatePaintIfNeeded( |
1026 const PaintInvalidatorContext& context) const { | 1031 const PaintInvalidatorContext& context) const { |
1027 return BlockPaintInvalidator(*this, context).invalidatePaintIfNeeded(); | 1032 return BlockPaintInvalidator(*this).invalidatePaintIfNeeded(context); |
| 1033 } |
| 1034 |
| 1035 void LayoutBlock::clearPreviousVisualRects() { |
| 1036 LayoutBox::clearPreviousVisualRects(); |
| 1037 BlockPaintInvalidator(*this).clearPreviousVisualRects(); |
1028 } | 1038 } |
1029 | 1039 |
1030 void LayoutBlock::removePositionedObjects( | 1040 void LayoutBlock::removePositionedObjects( |
1031 LayoutObject* o, | 1041 LayoutObject* o, |
1032 ContainingBlockState containingBlockState) { | 1042 ContainingBlockState containingBlockState) { |
1033 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); | 1043 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); |
1034 if (!positionedDescendants) | 1044 if (!positionedDescendants) |
1035 return; | 1045 return; |
1036 | 1046 |
1037 Vector<LayoutBox*, 16> deadObjects; | 1047 Vector<LayoutBox*, 16> deadObjects; |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 result.setNodeAndPosition(n, point); | 1845 result.setNodeAndPosition(n, point); |
1836 } | 1846 } |
1837 | 1847 |
1838 // An inline-block uses its inlineBox as the inlineBoxWrapper, | 1848 // An inline-block uses its inlineBox as the inlineBoxWrapper, |
1839 // so the firstChild() is nullptr if the only child is an empty inline-block. | 1849 // so the firstChild() is nullptr if the only child is an empty inline-block. |
1840 inline bool LayoutBlock::isInlineBoxWrapperActuallyChild() const { | 1850 inline bool LayoutBlock::isInlineBoxWrapperActuallyChild() const { |
1841 return isInlineBlockOrInlineTable() && !size().isEmpty() && node() && | 1851 return isInlineBlockOrInlineTable() && !size().isEmpty() && node() && |
1842 editingIgnoresContent(*node()); | 1852 editingIgnoresContent(*node()); |
1843 } | 1853 } |
1844 | 1854 |
1845 bool LayoutBlock::hasCursorCaret() const { | 1855 bool LayoutBlock::shouldPaintCursorCaret() const { |
1846 LocalFrame* frame = this->frame(); | 1856 return frame()->selection().shouldPaintCaret(*this); |
1847 return frame->selection().hasCaretIn(*this); | |
1848 } | 1857 } |
1849 | 1858 |
1850 bool LayoutBlock::hasDragCaret() const { | 1859 bool LayoutBlock::shouldPaintDragCaret() const { |
1851 LocalFrame* frame = this->frame(); | 1860 return frame()->page()->dragCaret().shouldPaintCaret(*this); |
1852 DragCaret& dragCaret = frame->page()->dragCaret(); | |
1853 return dragCaret.hasCaretIn(*this); | |
1854 } | 1861 } |
1855 | 1862 |
1856 LayoutRect LayoutBlock::localCaretRect(InlineBox* inlineBox, | 1863 LayoutRect LayoutBlock::localCaretRect(InlineBox* inlineBox, |
1857 int caretOffset, | 1864 int caretOffset, |
1858 LayoutUnit* extraWidthToEndOfLine) { | 1865 LayoutUnit* extraWidthToEndOfLine) { |
1859 // Do the normal calculation in most cases. | 1866 // Do the normal calculation in most cases. |
1860 if ((firstChild() && !firstChild()->isPseudoElement()) || | 1867 if ((firstChild() && !firstChild()->isPseudoElement()) || |
1861 isInlineBoxWrapperActuallyChild()) | 1868 isInlineBoxWrapperActuallyChild()) |
1862 return LayoutBox::localCaretRect(inlineBox, caretOffset, | 1869 return LayoutBox::localCaretRect(inlineBox, caretOffset, |
1863 extraWidthToEndOfLine); | 1870 extraWidthToEndOfLine); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 } | 2212 } |
2206 | 2213 |
2207 return availableHeight; | 2214 return availableHeight; |
2208 } | 2215 } |
2209 | 2216 |
2210 bool LayoutBlock::hasDefiniteLogicalHeight() const { | 2217 bool LayoutBlock::hasDefiniteLogicalHeight() const { |
2211 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); | 2218 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); |
2212 } | 2219 } |
2213 | 2220 |
2214 } // namespace blink | 2221 } // namespace blink |
OLD | NEW |