| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return false; | 188 return false; |
| 189 } | 189 } |
| 190 | 190 |
| 191 void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl
e) | 191 void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl
e) |
| 192 { | 192 { |
| 193 // There is no need to ever schedule repaints from a style change of a text
run, since | 193 // There is no need to ever schedule repaints from a style change of a text
run, since |
| 194 // we already did this for the parent of the text run. | 194 // we already did this for the parent of the text run. |
| 195 // We do have to schedule layouts, though, since a style change can force us
to | 195 // We do have to schedule layouts, though, since a style change can force us
to |
| 196 // need to relayout. | 196 // need to relayout. |
| 197 if (diff.needsFullLayout()) { | 197 if (diff.needsFullLayout()) { |
| 198 setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); | 198 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 199 m_knownToHaveNoOverflowAndNoFallbackFonts = false; | 199 m_knownToHaveNoOverflowAndNoFallbackFonts = false; |
| 200 } | 200 } |
| 201 | 201 |
| 202 RenderStyle* newStyle = style(); | 202 RenderStyle* newStyle = style(); |
| 203 ETextTransform oldTransform = oldStyle ? oldStyle->textTransform() : TTNONE; | 203 ETextTransform oldTransform = oldStyle ? oldStyle->textTransform() : TTNONE; |
| 204 ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE; | 204 ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE; |
| 205 if (oldTransform != newStyle->textTransform() || oldSecurity != newStyle->te
xtSecurity()) | 205 if (oldTransform != newStyle->textTransform() || oldSecurity != newStyle->te
xtSecurity()) |
| 206 transformText(); | 206 transformText(); |
| 207 | 207 |
| 208 // This is an optimization that kicks off font load before layout. | 208 // This is an optimization that kicks off font load before layout. |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 ASSERT(text); | 1403 ASSERT(text); |
| 1404 | 1404 |
| 1405 if (!force && equal(m_text.impl(), text.get())) | 1405 if (!force && equal(m_text.impl(), text.get())) |
| 1406 return; | 1406 return; |
| 1407 | 1407 |
| 1408 setTextInternal(text); | 1408 setTextInternal(text); |
| 1409 // If preferredLogicalWidthsDirty() of an orphan child is true, RenderObject
ChildList:: | 1409 // If preferredLogicalWidthsDirty() of an orphan child is true, RenderObject
ChildList:: |
| 1410 // insertChildNode() fails to set true to owner. To avoid that, we call | 1410 // insertChildNode() fails to set true to owner. To avoid that, we call |
| 1411 // setNeedsLayoutAndPrefWidthsRecalc() only if this RenderText has parent. | 1411 // setNeedsLayoutAndPrefWidthsRecalc() only if this RenderText has parent. |
| 1412 if (parent()) | 1412 if (parent()) |
| 1413 setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); | 1413 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 1414 m_knownToHaveNoOverflowAndNoFallbackFonts = false; | 1414 m_knownToHaveNoOverflowAndNoFallbackFonts = false; |
| 1415 | 1415 |
| 1416 if (AXObjectCache* cache = document().existingAXObjectCache()) | 1416 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 1417 cache->textChanged(this); | 1417 cache->textChanged(this); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 void RenderText::dirtyLineBoxes(bool fullLayout) | 1420 void RenderText::dirtyLineBoxes(bool fullLayout) |
| 1421 { | 1421 { |
| 1422 if (fullLayout) | 1422 if (fullLayout) |
| 1423 deleteTextBoxes(); | 1423 deleteTextBoxes(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); | 1562 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); |
| 1563 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; | 1563 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; |
| 1564 LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - lo
gicalTop; | 1564 LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - lo
gicalTop; |
| 1565 | 1565 |
| 1566 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); | 1566 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
| 1567 if (!style()->isHorizontalWritingMode()) | 1567 if (!style()->isHorizontalWritingMode()) |
| 1568 rect = rect.transposedRect(); | 1568 rect = rect.transposedRect(); |
| 1569 return rect; | 1569 return rect; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 LayoutRect RenderText::clippedOverflowRectForRepaint(const RenderLayerModelObjec
t* repaintContainer) const | 1572 LayoutRect RenderText::clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer) const |
| 1573 { | 1573 { |
| 1574 RenderObject* rendererToRepaint = containingBlock(); | 1574 RenderObject* rendererToRepaint = containingBlock(); |
| 1575 | 1575 |
| 1576 // Do not cross self-painting layer boundaries. | 1576 // Do not cross self-painting layer boundaries. |
| 1577 RenderObject* enclosingLayerRenderer = enclosingLayer()->renderer(); | 1577 RenderObject* enclosingLayerRenderer = enclosingLayer()->renderer(); |
| 1578 if (enclosingLayerRenderer != rendererToRepaint && !rendererToRepaint->isDes
cendantOf(enclosingLayerRenderer)) | 1578 if (enclosingLayerRenderer != rendererToRepaint && !rendererToRepaint->isDes
cendantOf(enclosingLayerRenderer)) |
| 1579 rendererToRepaint = enclosingLayerRenderer; | 1579 rendererToRepaint = enclosingLayerRenderer; |
| 1580 | 1580 |
| 1581 // The renderer we chose to repaint may be an ancestor of repaintContainer,
but we need to do a repaintContainer-relative repaint. | 1581 // The renderer we chose to repaint may be an ancestor of paintInvalidationC
ontainer, but we need to do a paintInvalidationContainer-relative repaint. |
| 1582 if (repaintContainer && repaintContainer != rendererToRepaint && !rendererTo
Repaint->isDescendantOf(repaintContainer)) | 1582 if (paintInvalidationContainer && paintInvalidationContainer != rendererToRe
paint && !rendererToRepaint->isDescendantOf(paintInvalidationContainer)) |
| 1583 return repaintContainer->clippedOverflowRectForRepaint(repaintContainer)
; | 1583 return paintInvalidationContainer->clippedOverflowRectForPaintInvalidati
on(paintInvalidationContainer); |
| 1584 | 1584 |
| 1585 return rendererToRepaint->clippedOverflowRectForRepaint(repaintContainer); | 1585 return rendererToRepaint->clippedOverflowRectForPaintInvalidation(paintInval
idationContainer); |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 LayoutRect RenderText::selectionRectForRepaint(const RenderLayerModelObject* rep
aintContainer, bool clipToVisibleContent) | 1588 LayoutRect RenderText::selectionRectForPaintInvalidation(const RenderLayerModelO
bject* paintInvalidationContainer, bool clipToVisibleContent) |
| 1589 { | 1589 { |
| 1590 ASSERT(!needsLayout()); | 1590 ASSERT(!needsLayout()); |
| 1591 | 1591 |
| 1592 if (selectionState() == SelectionNone) | 1592 if (selectionState() == SelectionNone) |
| 1593 return LayoutRect(); | 1593 return LayoutRect(); |
| 1594 RenderBlock* cb = containingBlock(); | 1594 RenderBlock* cb = containingBlock(); |
| 1595 if (!cb) | 1595 if (!cb) |
| 1596 return LayoutRect(); | 1596 return LayoutRect(); |
| 1597 | 1597 |
| 1598 // Now calculate startPos and endPos for painting selection. | 1598 // Now calculate startPos and endPos for painting selection. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1613 if (startPos == endPos) | 1613 if (startPos == endPos) |
| 1614 return IntRect(); | 1614 return IntRect(); |
| 1615 | 1615 |
| 1616 LayoutRect rect; | 1616 LayoutRect rect; |
| 1617 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { | 1617 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
| 1618 rect.unite(box->localSelectionRect(startPos, endPos)); | 1618 rect.unite(box->localSelectionRect(startPos, endPos)); |
| 1619 rect.unite(ellipsisRectForBox(box, startPos, endPos)); | 1619 rect.unite(ellipsisRectForBox(box, startPos, endPos)); |
| 1620 } | 1620 } |
| 1621 | 1621 |
| 1622 if (clipToVisibleContent) | 1622 if (clipToVisibleContent) |
| 1623 mapRectToRepaintBacking(repaintContainer, rect); | 1623 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect); |
| 1624 else { | 1624 else { |
| 1625 if (cb->hasColumns()) | 1625 if (cb->hasColumns()) |
| 1626 cb->adjustRectForColumns(rect); | 1626 cb->adjustRectForColumns(rect); |
| 1627 | 1627 |
| 1628 rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosing
BoundingBox(); | 1628 rect = localToContainerQuad(FloatRect(rect), paintInvalidationContainer)
.enclosingBoundingBox(); |
| 1629 } | 1629 } |
| 1630 | 1630 |
| 1631 return rect; | 1631 return rect; |
| 1632 } | 1632 } |
| 1633 | 1633 |
| 1634 int RenderText::caretMinOffset() const | 1634 int RenderText::caretMinOffset() const |
| 1635 { | 1635 { |
| 1636 InlineTextBox* box = firstTextBox(); | 1636 InlineTextBox* box = firstTextBox(); |
| 1637 if (!box) | 1637 if (!box) |
| 1638 return 0; | 1638 return 0; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 } | 1868 } |
| 1869 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); | 1869 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); |
| 1870 } | 1870 } |
| 1871 | 1871 |
| 1872 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() | 1872 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() |
| 1873 { | 1873 { |
| 1874 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); | 1874 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); |
| 1875 } | 1875 } |
| 1876 | 1876 |
| 1877 } // namespace WebCore | 1877 } // namespace WebCore |
| OLD | NEW |