OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.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 14 matching lines...) Expand all Loading... |
25 #include "config.h" | 25 #include "config.h" |
26 #include "core/rendering/RenderText.h" | 26 #include "core/rendering/RenderText.h" |
27 | 27 |
28 #include "core/dom/AXObjectCache.h" | 28 #include "core/dom/AXObjectCache.h" |
29 #include "core/dom/Text.h" | 29 #include "core/dom/Text.h" |
30 #include "core/editing/VisiblePosition.h" | 30 #include "core/editing/VisiblePosition.h" |
31 #include "core/editing/iterators/TextIterator.h" | 31 #include "core/editing/iterators/TextIterator.h" |
32 #include "core/frame/FrameView.h" | 32 #include "core/frame/FrameView.h" |
33 #include "core/frame/Settings.h" | 33 #include "core/frame/Settings.h" |
34 #include "core/html/parser/TextResourceDecoder.h" | 34 #include "core/html/parser/TextResourceDecoder.h" |
| 35 #include "core/layout/Layer.h" |
35 #include "core/rendering/AbstractInlineTextBox.h" | 36 #include "core/rendering/AbstractInlineTextBox.h" |
36 #include "core/rendering/EllipsisBox.h" | 37 #include "core/rendering/EllipsisBox.h" |
37 #include "core/rendering/InlineTextBox.h" | 38 #include "core/rendering/InlineTextBox.h" |
38 #include "core/rendering/RenderBlock.h" | 39 #include "core/rendering/RenderBlock.h" |
39 #include "core/rendering/RenderCombineText.h" | 40 #include "core/rendering/RenderCombineText.h" |
40 #include "core/rendering/RenderLayer.h" | |
41 #include "core/rendering/RenderView.h" | 41 #include "core/rendering/RenderView.h" |
42 #include "core/rendering/TextRunConstructor.h" | 42 #include "core/rendering/TextRunConstructor.h" |
43 #include "platform/fonts/Character.h" | 43 #include "platform/fonts/Character.h" |
44 #include "platform/fonts/FontCache.h" | 44 #include "platform/fonts/FontCache.h" |
45 #include "platform/geometry/FloatQuad.h" | 45 #include "platform/geometry/FloatQuad.h" |
46 #include "platform/graphics/paint/DisplayItemList.h" | 46 #include "platform/graphics/paint/DisplayItemList.h" |
47 #include "platform/text/BidiResolver.h" | 47 #include "platform/text/BidiResolver.h" |
48 #include "platform/text/TextBreakIterator.h" | 48 #include "platform/text/TextBreakIterator.h" |
49 #include "platform/text/TextRunIterator.h" | 49 #include "platform/text/TextRunIterator.h" |
50 #include "wtf/text/StringBuffer.h" | 50 #include "wtf/text/StringBuffer.h" |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 for (; previousText; previousText = previousText->previousInPreOrder()) | 1331 for (; previousText; previousText = previousText->previousInPreOrder()) |
1332 if (!isInlineFlowOrEmptyText(previousText)) | 1332 if (!isInlineFlowOrEmptyText(previousText)) |
1333 break; | 1333 break; |
1334 UChar prev = space; | 1334 UChar prev = space; |
1335 if (previousText && previousText->isText()) | 1335 if (previousText && previousText->isText()) |
1336 if (StringImpl* previousString = toRenderText(previousText)->text().impl
()) | 1336 if (StringImpl* previousString = toRenderText(previousText)->text().impl
()) |
1337 prev = (*previousString)[previousString->length() - 1]; | 1337 prev = (*previousString)[previousString->length() - 1]; |
1338 return prev; | 1338 return prev; |
1339 } | 1339 } |
1340 | 1340 |
1341 void RenderText::addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur
rentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) cons
t | 1341 void RenderText::addLayerHitTestRects(LayerHitTestRects&, const Layer* currentLa
yer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const |
1342 { | 1342 { |
1343 // Text nodes aren't event targets, so don't descend any further. | 1343 // Text nodes aren't event targets, so don't descend any further. |
1344 } | 1344 } |
1345 | 1345 |
1346 void applyTextTransform(const RenderStyle* style, String& text, UChar previousCh
aracter) | 1346 void applyTextTransform(const RenderStyle* style, String& text, UChar previousCh
aracter) |
1347 { | 1347 { |
1348 if (!style) | 1348 if (!style) |
1349 return; | 1349 return; |
1350 | 1350 |
1351 switch (style->textTransform()) { | 1351 switch (style->textTransform()) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); | 1587 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); |
1588 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; | 1588 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; |
1589 LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - lo
gicalTop; | 1589 LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - lo
gicalTop; |
1590 | 1590 |
1591 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); | 1591 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
1592 if (!style()->isHorizontalWritingMode()) | 1592 if (!style()->isHorizontalWritingMode()) |
1593 rect = rect.transposedRect(); | 1593 rect = rect.transposedRect(); |
1594 return rect; | 1594 return rect; |
1595 } | 1595 } |
1596 | 1596 |
1597 LayoutRect RenderText::clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInva
lidationState) const | 1597 LayoutRect RenderText::clippedOverflowRectForPaintInvalidation(const LayoutLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInva
lidationState) const |
1598 { | 1598 { |
1599 if (style()->visibility() != VISIBLE) | 1599 if (style()->visibility() != VISIBLE) |
1600 return LayoutRect(); | 1600 return LayoutRect(); |
1601 | 1601 |
1602 LayoutRect paintInvalidationRect(linesVisualOverflowBoundingBox()); | 1602 LayoutRect paintInvalidationRect(linesVisualOverflowBoundingBox()); |
1603 mapRectToPaintInvalidationBacking(paintInvalidationContainer, paintInvalidat
ionRect, paintInvalidationState); | 1603 mapRectToPaintInvalidationBacking(paintInvalidationContainer, paintInvalidat
ionRect, paintInvalidationState); |
1604 return paintInvalidationRect; | 1604 return paintInvalidationRect; |
1605 } | 1605 } |
1606 | 1606 |
1607 LayoutRect RenderText::selectionRectForPaintInvalidation(const RenderLayerModelO
bject* paintInvalidationContainer) const | 1607 LayoutRect RenderText::selectionRectForPaintInvalidation(const LayoutLayerModelO
bject* paintInvalidationContainer) const |
1608 { | 1608 { |
1609 ASSERT(!needsLayout()); | 1609 ASSERT(!needsLayout()); |
1610 | 1610 |
1611 if (selectionState() == SelectionNone) | 1611 if (selectionState() == SelectionNone) |
1612 return LayoutRect(); | 1612 return LayoutRect(); |
1613 RenderBlock* cb = containingBlock(); | 1613 RenderBlock* cb = containingBlock(); |
1614 if (!cb) | 1614 if (!cb) |
1615 return LayoutRect(); | 1615 return LayoutRect(); |
1616 | 1616 |
1617 // Now calculate startPos and endPos for painting selection. | 1617 // Now calculate startPos and endPos for painting selection. |
(...skipping 16 matching lines...) Expand all Loading... |
1634 | 1634 |
1635 LayoutRect rect; | 1635 LayoutRect rect; |
1636 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { | 1636 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
1637 rect.unite(box->localSelectionRect(startPos, endPos)); | 1637 rect.unite(box->localSelectionRect(startPos, endPos)); |
1638 rect.unite(ellipsisRectForBox(box, startPos, endPos)); | 1638 rect.unite(ellipsisRectForBox(box, startPos, endPos)); |
1639 } | 1639 } |
1640 | 1640 |
1641 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); | 1641 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); |
1642 // FIXME: groupedMapping() leaks the squashing abstraction. | 1642 // FIXME: groupedMapping() leaks the squashing abstraction. |
1643 if (paintInvalidationContainer->layer()->groupedMapping()) | 1643 if (paintInvalidationContainer->layer()->groupedMapping()) |
1644 RenderLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer
, rect); | 1644 Layer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect
); |
1645 return rect; | 1645 return rect; |
1646 } | 1646 } |
1647 | 1647 |
1648 int RenderText::caretMinOffset() const | 1648 int RenderText::caretMinOffset() const |
1649 { | 1649 { |
1650 InlineTextBox* box = firstTextBox(); | 1650 InlineTextBox* box = firstTextBox(); |
1651 if (!box) | 1651 if (!box) |
1652 return 0; | 1652 return 0; |
1653 int minOffset = box->start(); | 1653 int minOffset = box->start(); |
1654 for (box = box->nextTextBox(); box; box = box->nextTextBox()) | 1654 for (box = box->nextTextBox(); box; box = box->nextTextBox()) |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 } | 1889 } |
1890 | 1890 |
1891 void RenderText::invalidateDisplayItemClients(DisplayItemList* displayItemList)
const | 1891 void RenderText::invalidateDisplayItemClients(DisplayItemList* displayItemList)
const |
1892 { | 1892 { |
1893 RenderObject::invalidateDisplayItemClients(displayItemList); | 1893 RenderObject::invalidateDisplayItemClients(displayItemList); |
1894 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) | 1894 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) |
1895 displayItemList->invalidate(box->displayItemClient()); | 1895 displayItemList->invalidate(box->displayItemClient()); |
1896 } | 1896 } |
1897 | 1897 |
1898 } // namespace blink | 1898 } // namespace blink |
OLD | NEW |