diff options
Diffstat (limited to 'WebCore/rendering/RenderText.cpp')
-rw-r--r-- | WebCore/rendering/RenderText.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp index d786e6a..fada8b4 100644 --- a/WebCore/rendering/RenderText.cpp +++ b/WebCore/rendering/RenderText.cpp @@ -263,7 +263,7 @@ PassRefPtr<StringImpl> RenderText::originalText() const void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty) { for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) - rects.append(IntRect(tx + box->x(), ty + box->y(), box->width(), box->height())); + rects.append(IntRect(tx + box->x(), ty + box->y(), box->logicalWidth(), box->logicalHeight())); } void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool useSelectionHeight) @@ -281,7 +281,7 @@ void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, u for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { // Note: box->end() returns the index of the last character, not the index past it if (start <= box->start() && box->end() < end) { - IntRect r = IntRect(box->x(), box->y(), box->width(), box->height()); + IntRect r = IntRect(box->x(), box->y(), box->logicalWidth(), box->logicalHeight()); if (useSelectionHeight) { IntRect selectionRect = box->selectionRect(0, 0, start, end); r.setHeight(selectionRect.height()); @@ -297,7 +297,7 @@ void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, u if (!r.isEmpty()) { if (!useSelectionHeight) { // change the height and y position because selectionRect uses selection-specific values - r.setHeight(box->height()); + r.setHeight(box->logicalHeight()); r.setY(box->y()); } FloatPoint origin = localToAbsolute(r.location()); @@ -380,7 +380,7 @@ void RenderText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, if (r.height()) { if (!useSelectionHeight) { // change the height and y position because selectionRect uses selection-specific values - r.setHeight(box->height()); + r.setHeight(box->logicalHeight()); r.setY(box->y()); } quads.append(localToAbsoluteQuad(FloatRect(r))); @@ -425,7 +425,7 @@ VisiblePosition RenderText::positionForPoint(const IntPoint& point) offset = firstTextBox()->offsetForPosition(point.x()); return createVisiblePosition(offset + firstTextBox()->start(), DOWNSTREAM); } - if (lastTextBox() && point.y() >= lastTextBox()->root()->lineTop() && point.x() >= lastTextBox()->m_x + lastTextBox()->m_width) { + if (lastTextBox() && point.y() >= lastTextBox()->root()->lineTop() && point.x() >= lastTextBox()->m_x + lastTextBox()->logicalWidth()) { // at the y coordinate of the last line or below // and the x coordinate is to the right of the last text box right edge offset = lastTextBox()->offsetForPosition(point.x()); @@ -444,7 +444,7 @@ VisiblePosition RenderText::positionForPoint(const IntPoint& point) // the affinity must be downstream so the position doesn't jump back to the previous line return createVisiblePosition(offset + box->start(), DOWNSTREAM); - if (point.x() < box->m_x + box->m_width) + if (point.x() < box->m_x + box->logicalWidth()) // and the x coordinate is to the left of the right edge of this box // check to see if position goes in this box return createVisiblePosition(offset + box->start(), offset > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM); @@ -489,11 +489,11 @@ IntRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, int* e int caretWidthRightOfOffset = caretWidth - caretWidthLeftOfOffset; int rootLeft = box->root()->x(); - int rootRight = rootLeft + box->root()->width(); + int rootRight = rootLeft + box->root()->logicalWidth(); // FIXME: should we use the width of the root inline box or the // width of the containing block for this? if (extraWidthToEndOfLine) - *extraWidthToEndOfLine = (box->root()->width() + rootLeft) - (left + 1); + *extraWidthToEndOfLine = (box->root()->logicalWidth() + rootLeft) - (left + 1); RenderBlock* cb = containingBlock(); RenderStyle* cbStyle = cb->style(); @@ -581,8 +581,8 @@ void RenderText::trimmedPrefWidths(int leadWidth, if (!collapseWhiteSpace) stripFrontSpaces = false; - if (m_hasTab || prefWidthsDirty()) - calcPrefWidths(leadWidth); + if (m_hasTab || preferredLogicalWidthsDirty()) + computePreferredLogicalWidths(leadWidth); beginWS = !stripFrontSpaces && m_hasBeginWS; endWS = m_hasEndWS; @@ -664,34 +664,34 @@ static inline bool isSpaceAccordingToStyle(UChar c, RenderStyle* style) return c == ' ' || (c == noBreakSpace && style->nbspMode() == SPACE); } -int RenderText::minPrefWidth() const +int RenderText::minPreferredLogicalWidth() const { - if (prefWidthsDirty()) - const_cast<RenderText*>(this)->calcPrefWidths(0); + if (preferredLogicalWidthsDirty()) + const_cast<RenderText*>(this)->computePreferredLogicalWidths(0); return m_minWidth; } -int RenderText::maxPrefWidth() const +int RenderText::maxPreferredLogicalWidth() const { - if (prefWidthsDirty()) - const_cast<RenderText*>(this)->calcPrefWidths(0); + if (preferredLogicalWidthsDirty()) + const_cast<RenderText*>(this)->computePreferredLogicalWidths(0); return m_maxWidth; } -void RenderText::calcPrefWidths(int leadWidth) +void RenderText::computePreferredLogicalWidths(int leadWidth) { HashSet<const SimpleFontData*> fallbackFonts; GlyphOverflow glyphOverflow; - calcPrefWidths(leadWidth, fallbackFonts, glyphOverflow); + computePreferredLogicalWidths(leadWidth, fallbackFonts, glyphOverflow); if (fallbackFonts.isEmpty() && !glyphOverflow.left && !glyphOverflow.right && !glyphOverflow.top && !glyphOverflow.bottom) m_knownToHaveNoOverflowAndNoFallbackFonts = true; } -void RenderText::calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow) +void RenderText::computePreferredLogicalWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow) { - ASSERT(m_hasTab || prefWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts); + ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts); m_minWidth = 0; m_beginMinWidth = 0; @@ -877,7 +877,7 @@ void RenderText::calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& f m_endMinWidth = currMaxWidth; } - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); } bool RenderText::isAllCollapsibleWhitespace() @@ -1249,14 +1249,14 @@ unsigned RenderText::width(unsigned from, unsigned len, const Font& f, int xPos, if (!style()->preserveNewline() && !from && len == textLength()) { if (fallbackFonts) { ASSERT(glyphOverflow); - if (prefWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts) { - const_cast<RenderText*>(this)->calcPrefWidths(0, *fallbackFonts, *glyphOverflow); + if (preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts) { + const_cast<RenderText*>(this)->computePreferredLogicalWidths(0, *fallbackFonts, *glyphOverflow); if (fallbackFonts->isEmpty() && !glyphOverflow->left && !glyphOverflow->right && !glyphOverflow->top && !glyphOverflow->bottom) m_knownToHaveNoOverflowAndNoFallbackFonts = true; } w = m_maxWidth; } else - w = maxPrefWidth(); + w = maxPreferredLogicalWidth(); } else w = widthFromCache(f, from, len, xPos, fallbackFonts, glyphOverflow); } else @@ -1277,12 +1277,12 @@ IntRect RenderText::linesBoundingBox() const for (InlineTextBox* curr = firstTextBox(); curr; curr = curr->nextTextBox()) { if (curr == firstTextBox() || curr->x() < leftSide) leftSide = curr->x(); - if (curr == firstTextBox() || curr->x() + curr->width() > rightSide) - rightSide = curr->x() + curr->width(); + if (curr == firstTextBox() || curr->x() + curr->logicalWidth() > rightSide) + rightSide = curr->x() + curr->logicalWidth(); } result.setWidth(rightSide - leftSide); result.setX(leftSide); - result.setHeight(lastTextBox()->y() + lastTextBox()->height() - firstTextBox()->y()); + result.setHeight(lastTextBox()->y() + lastTextBox()->logicalHeight() - firstTextBox()->y()); result.setY(firstTextBox()->y()); } |