| 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, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 552 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
| 553 if (curr->isFloatingOrOutOfFlowPositioned()) | 553 if (curr->isFloatingOrOutOfFlowPositioned()) |
| 554 continue; | 554 continue; |
| 555 | 555 |
| 556 // We want to get the margin box in the inline direction, and then use o
ur font ascent/descent in the block | 556 // We want to get the margin box in the inline direction, and then use o
ur font ascent/descent in the block |
| 557 // direction (aligned to the root box's baseline). | 557 // direction (aligned to the root box's baseline). |
| 558 if (curr->isBox()) { | 558 if (curr->isBox()) { |
| 559 RenderBox* currBox = toRenderBox(curr); | 559 RenderBox* currBox = toRenderBox(curr); |
| 560 if (currBox->inlineBoxWrapper()) { | 560 if (currBox->inlineBoxWrapper()) { |
| 561 RootInlineBox* rootBox = currBox->inlineBoxWrapper()->root(); | 561 RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root(); |
| 562 int logicalTop = rootBox->logicalTop() + (rootBox->renderer().st
yle(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->sty
le(rootBox->isFirstLineStyle())->font().fontMetrics().ascent()); | 562 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl
e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(
rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); |
| 563 int logicalHeight = container->style(rootBox->isFirstLineStyle()
)->font().fontMetrics().height(); | 563 int logicalHeight = container->style(rootBox.isFirstLineStyle())
->font().fontMetrics().height(); |
| 564 if (isHorizontal) | 564 if (isHorizontal) |
| 565 yield(FloatRect(currBox->inlineBoxWrapper()->x() - currBox->
marginLeft(), logicalTop, currBox->width() + currBox->marginWidth(), logicalHeig
ht)); | 565 yield(FloatRect(currBox->inlineBoxWrapper()->x() - currBox->
marginLeft(), logicalTop, currBox->width() + currBox->marginWidth(), logicalHeig
ht)); |
| 566 else | 566 else |
| 567 yield(FloatRect(logicalTop, currBox->inlineBoxWrapper()->y()
- currBox->marginTop(), logicalHeight, currBox->height() + currBox->marginHeigh
t())); | 567 yield(FloatRect(logicalTop, currBox->inlineBoxWrapper()->y()
- currBox->marginTop(), logicalHeight, currBox->height() + currBox->marginHeigh
t())); |
| 568 } | 568 } |
| 569 } else if (curr->isRenderInline()) { | 569 } else if (curr->isRenderInline()) { |
| 570 // If the child doesn't need line boxes either, then we can recur. | 570 // If the child doesn't need line boxes either, then we can recur. |
| 571 RenderInline* currInline = toRenderInline(curr); | 571 RenderInline* currInline = toRenderInline(curr); |
| 572 if (!currInline->alwaysCreateLineBoxes()) | 572 if (!currInline->alwaysCreateLineBoxes()) |
| 573 currInline->generateCulledLineBoxRects(yield, container); | 573 currInline->generateCulledLineBoxRects(yield, container); |
| 574 else { | 574 else { |
| 575 for (InlineFlowBox* childLine = currInline->firstLineBox(); chil
dLine; childLine = childLine->nextLineBox()) { | 575 for (InlineFlowBox* childLine = currInline->firstLineBox(); chil
dLine; childLine = childLine->nextLineBox()) { |
| 576 RootInlineBox* rootBox = childLine->root(); | 576 RootInlineBox& rootBox = childLine->root(); |
| 577 int logicalTop = rootBox->logicalTop() + (rootBox->renderer(
).style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container-
>style(rootBox->isFirstLineStyle())->font().fontMetrics().ascent()); | 577 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().
style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->st
yle(rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); |
| 578 int logicalHeight = container->style(rootBox->isFirstLineSty
le())->font().fontMetrics().height(); | 578 int logicalHeight = container->style(rootBox.isFirstLineStyl
e())->font().fontMetrics().height(); |
| 579 if (isHorizontal) | 579 if (isHorizontal) |
| 580 yield(FloatRect(childLine->x() - childLine->marginLogica
lLeft(), | 580 yield(FloatRect(childLine->x() - childLine->marginLogica
lLeft(), |
| 581 logicalTop, | 581 logicalTop, |
| 582 childLine->logicalWidth() + childLine->marginLogical
Left() + childLine->marginLogicalRight(), | 582 childLine->logicalWidth() + childLine->marginLogical
Left() + childLine->marginLogicalRight(), |
| 583 logicalHeight)); | 583 logicalHeight)); |
| 584 else | 584 else |
| 585 yield(FloatRect(logicalTop, | 585 yield(FloatRect(logicalTop, |
| 586 childLine->y() - childLine->marginLogicalLeft(), | 586 childLine->y() - childLine->marginLogicalLeft(), |
| 587 logicalHeight, | 587 logicalHeight, |
| 588 childLine->logicalWidth() + childLine->marginLogical
Left() + childLine->marginLogicalRight())); | 588 childLine->logicalWidth() + childLine->marginLogical
Left() + childLine->marginLogicalRight())); |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 } else if (curr->isText()) { | 591 } else if (curr->isText()) { |
| 592 RenderText* currText = toRenderText(curr); | 592 RenderText* currText = toRenderText(curr); |
| 593 for (InlineTextBox* childText = currText->firstTextBox(); childText;
childText = childText->nextTextBox()) { | 593 for (InlineTextBox* childText = currText->firstTextBox(); childText;
childText = childText->nextTextBox()) { |
| 594 RootInlineBox* rootBox = childText->root(); | 594 RootInlineBox& rootBox = childText->root(); |
| 595 int logicalTop = rootBox->logicalTop() + (rootBox->renderer().st
yle(rootBox->isFirstLineStyle())->font().fontMetrics().ascent() - container->sty
le(rootBox->isFirstLineStyle())->font().fontMetrics().ascent()); | 595 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl
e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(
rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); |
| 596 int logicalHeight = container->style(rootBox->isFirstLineStyle()
)->font().fontMetrics().height(); | 596 int logicalHeight = container->style(rootBox.isFirstLineStyle())
->font().fontMetrics().height(); |
| 597 if (isHorizontal) | 597 if (isHorizontal) |
| 598 yield(FloatRect(childText->x(), logicalTop, childText->logic
alWidth(), logicalHeight)); | 598 yield(FloatRect(childText->x(), logicalTop, childText->logic
alWidth(), logicalHeight)); |
| 599 else | 599 else |
| 600 yield(FloatRect(logicalTop, childText->y(), logicalHeight, c
hildText->logicalWidth())); | 600 yield(FloatRect(logicalTop, childText->y(), logicalHeight, c
hildText->logicalWidth())); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 } | 603 } |
| 604 } | 604 } |
| 605 | 605 |
| 606 namespace { | 606 namespace { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 return LayoutRect(); | 973 return LayoutRect(); |
| 974 | 974 |
| 975 // Return the width of the minimal left side and the maximal right side. | 975 // Return the width of the minimal left side and the maximal right side. |
| 976 LayoutUnit logicalLeftSide = LayoutUnit::max(); | 976 LayoutUnit logicalLeftSide = LayoutUnit::max(); |
| 977 LayoutUnit logicalRightSide = LayoutUnit::min(); | 977 LayoutUnit logicalRightSide = LayoutUnit::min(); |
| 978 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ | 978 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ |
| 979 logicalLeftSide = min(logicalLeftSide, curr->logicalLeftVisualOverflow()
); | 979 logicalLeftSide = min(logicalLeftSide, curr->logicalLeftVisualOverflow()
); |
| 980 logicalRightSide = max(logicalRightSide, curr->logicalRightVisualOverflo
w()); | 980 logicalRightSide = max(logicalRightSide, curr->logicalRightVisualOverflo
w()); |
| 981 } | 981 } |
| 982 | 982 |
| 983 RootInlineBox* firstRootBox = firstLineBox()->root(); | 983 RootInlineBox& firstRootBox = firstLineBox()->root(); |
| 984 RootInlineBox* lastRootBox = lastLineBox()->root(); | 984 RootInlineBox& lastRootBox = lastLineBox()->root(); |
| 985 | 985 |
| 986 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo
x->lineTop()); | 986 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo
x.lineTop()); |
| 987 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; | 987 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; |
| 988 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox->lineBottom()) - logicalTop; | 988 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; |
| 989 | 989 |
| 990 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); | 990 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
| 991 if (!style()->isHorizontalWritingMode()) | 991 if (!style()->isHorizontalWritingMode()) |
| 992 rect = rect.transposedRect(); | 992 rect = rect.transposedRect(); |
| 993 return rect; | 993 return rect; |
| 994 } | 994 } |
| 995 | 995 |
| 996 LayoutRect RenderInline::clippedOverflowRectForRepaint(const RenderLayerModelObj
ect* repaintContainer) const | 996 LayoutRect RenderInline::clippedOverflowRectForRepaint(const RenderLayerModelObj
ect* repaintContainer) const |
| 997 { | 997 { |
| 998 ASSERT(!view() || !view()->layoutStateEnabled() || LayoutRectRecorder::shoul
dRecordLayoutRects()); | 998 ASSERT(!view() || !view()->layoutStateEnabled() || LayoutRectRecorder::shoul
dRecordLayoutRects()); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 if (!alwaysCreateLineBoxes()) { | 1241 if (!alwaysCreateLineBoxes()) { |
| 1242 // We have to grovel into our children in order to dirty the appropriate
lines. | 1242 // We have to grovel into our children in order to dirty the appropriate
lines. |
| 1243 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { | 1243 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { |
| 1244 if (curr->isFloatingOrOutOfFlowPositioned()) | 1244 if (curr->isFloatingOrOutOfFlowPositioned()) |
| 1245 continue; | 1245 continue; |
| 1246 if (curr->isBox() && !curr->needsLayout()) { | 1246 if (curr->isBox() && !curr->needsLayout()) { |
| 1247 RenderBox* currBox = toRenderBox(curr); | 1247 RenderBox* currBox = toRenderBox(curr); |
| 1248 if (currBox->inlineBoxWrapper()) | 1248 if (currBox->inlineBoxWrapper()) |
| 1249 currBox->inlineBoxWrapper()->root()->markDirty(); | 1249 currBox->inlineBoxWrapper()->root().markDirty(); |
| 1250 } else if (!curr->selfNeedsLayout()) { | 1250 } else if (!curr->selfNeedsLayout()) { |
| 1251 if (curr->isRenderInline()) { | 1251 if (curr->isRenderInline()) { |
| 1252 RenderInline* currInline = toRenderInline(curr); | 1252 RenderInline* currInline = toRenderInline(curr); |
| 1253 for (InlineFlowBox* childLine = currInline->firstLineBox();
childLine; childLine = childLine->nextLineBox()) | 1253 for (InlineFlowBox* childLine = currInline->firstLineBox();
childLine; childLine = childLine->nextLineBox()) |
| 1254 childLine->root()->markDirty(); | 1254 childLine->root().markDirty(); |
| 1255 } else if (curr->isText()) { | 1255 } else if (curr->isText()) { |
| 1256 RenderText* currText = toRenderText(curr); | 1256 RenderText* currText = toRenderText(curr); |
| 1257 for (InlineTextBox* childText = currText->firstTextBox(); ch
ildText; childText = childText->nextTextBox()) | 1257 for (InlineTextBox* childText = currText->firstTextBox(); ch
ildText; childText = childText->nextTextBox()) |
| 1258 childText->root()->markDirty(); | 1258 childText->root().markDirty(); |
| 1259 } | 1259 } |
| 1260 } | 1260 } |
| 1261 } | 1261 } |
| 1262 } else | 1262 } else |
| 1263 m_lineBoxes.dirtyLineBoxes(); | 1263 m_lineBoxes.dirtyLineBoxes(); |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 void RenderInline::deleteLineBoxTree() | 1266 void RenderInline::deleteLineBoxTree() |
| 1267 { | 1267 { |
| 1268 m_lineBoxes.deleteLineBoxTree(); | 1268 m_lineBoxes.deleteLineBoxTree(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 if (graphicsContext->paintingDisabled()) | 1417 if (graphicsContext->paintingDisabled()) |
| 1418 return; | 1418 return; |
| 1419 | 1419 |
| 1420 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE) | 1420 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE) |
| 1421 return; | 1421 return; |
| 1422 | 1422 |
| 1423 Vector<LayoutRect> rects; | 1423 Vector<LayoutRect> rects; |
| 1424 | 1424 |
| 1425 rects.append(LayoutRect()); | 1425 rects.append(LayoutRect()); |
| 1426 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ | 1426 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ |
| 1427 RootInlineBox* root = curr->root(); | 1427 RootInlineBox& root = curr->root(); |
| 1428 LayoutUnit top = max<LayoutUnit>(root->lineTop(), curr->logicalTop()); | 1428 LayoutUnit top = max<LayoutUnit>(root.lineTop(), curr->logicalTop()); |
| 1429 LayoutUnit bottom = min<LayoutUnit>(root->lineBottom(), curr->logicalBot
tom()); | 1429 LayoutUnit bottom = min<LayoutUnit>(root.lineBottom(), curr->logicalBott
om()); |
| 1430 rects.append(LayoutRect(curr->x(), top, curr->logicalWidth(), bottom - t
op)); | 1430 rects.append(LayoutRect(curr->x(), top, curr->logicalWidth(), bottom - t
op)); |
| 1431 } | 1431 } |
| 1432 rects.append(LayoutRect()); | 1432 rects.append(LayoutRect()); |
| 1433 | 1433 |
| 1434 Color outlineColor = resolveColor(styleToUse, CSSPropertyOutlineColor); | 1434 Color outlineColor = resolveColor(styleToUse, CSSPropertyOutlineColor); |
| 1435 bool useTransparencyLayer = outlineColor.hasAlpha(); | 1435 bool useTransparencyLayer = outlineColor.hasAlpha(); |
| 1436 if (useTransparencyLayer) { | 1436 if (useTransparencyLayer) { |
| 1437 graphicsContext->beginTransparencyLayer(static_cast<float>(outlineColor.
alpha()) / 255); | 1437 graphicsContext->beginTransparencyLayer(static_cast<float>(outlineColor.
alpha()) / 255); |
| 1438 outlineColor = Color(outlineColor.red(), outlineColor.green(), outlineCo
lor.blue()); | 1438 outlineColor = Color(outlineColor.red(), outlineColor.green(), outlineCo
lor.blue()); |
| 1439 } | 1439 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 container = this; | 1572 container = this; |
| 1573 | 1573 |
| 1574 FloatPoint absPos = container->localToAbsolute(); | 1574 FloatPoint absPos = container->localToAbsolute(); |
| 1575 region.bounds.setX(absPos.x() + region.bounds.x()); | 1575 region.bounds.setX(absPos.x() + region.bounds.x()); |
| 1576 region.bounds.setY(absPos.y() + region.bounds.y()); | 1576 region.bounds.setY(absPos.y() + region.bounds.y()); |
| 1577 | 1577 |
| 1578 regions.append(region); | 1578 regions.append(region); |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 } // namespace WebCore | 1581 } // namespace WebCore |
| OLD | NEW |