OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 | 1219 |
1220 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1220 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
1221 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()
)); | 1221 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()
)); |
1222 BoxPainter::paintFillLayerExtended(*boxModelObject(), paintInfo, c, fill
Layer, LayoutRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone,
this, rect.size(), op); | 1222 BoxPainter::paintFillLayerExtended(*boxModelObject(), paintInfo, c, fill
Layer, LayoutRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone,
this, rect.size(), op); |
1223 } | 1223 } |
1224 } | 1224 } |
1225 | 1225 |
1226 void InlineFlowBox::paintBoxShadow(const PaintInfo& info, RenderStyle* s, Shadow
Style shadowStyle, const LayoutRect& paintRect) | 1226 void InlineFlowBox::paintBoxShadow(const PaintInfo& info, RenderStyle* s, Shadow
Style shadowStyle, const LayoutRect& paintRect) |
1227 { | 1227 { |
1228 if ((!prevLineBox() && !nextLineBox()) || !parent()) | 1228 if ((!prevLineBox() && !nextLineBox()) || !parent()) |
1229 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle); | 1229 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle); |
1230 else { | 1230 else { |
1231 // FIXME: We can do better here in the multi-line case. We want to push
a clip so that the shadow doesn't | 1231 // FIXME: We can do better here in the multi-line case. We want to push
a clip so that the shadow doesn't |
1232 // protrude incorrectly at the edges, and we want to possibly include sh
adows cast from the previous/following lines | 1232 // protrude incorrectly at the edges, and we want to possibly include sh
adows cast from the previous/following lines |
1233 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle, includ
eLogicalLeftEdge(), includeLogicalRightEdge()); | 1233 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle, includeLogic
alLeftEdge(), includeLogicalRightEdge()); |
1234 } | 1234 } |
1235 } | 1235 } |
1236 | 1236 |
1237 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const | 1237 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const |
1238 { | 1238 { |
1239 bool noQuirksMode = renderer().document().inNoQuirksMode(); | 1239 bool noQuirksMode = renderer().document().inNoQuirksMode(); |
1240 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn
dBaseline() && hasTextDescendants())) { | 1240 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn
dBaseline() && hasTextDescendants())) { |
1241 const RootInlineBox& rootBox = root(); | 1241 const RootInlineBox& rootBox = root(); |
1242 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x(); | 1242 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x(); |
1243 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width()
; | 1243 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width()
; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 if (parent() && renderer().style()->hasBorder()) { | 1323 if (parent() && renderer().style()->hasBorder()) { |
1324 const NinePieceImage& borderImage = renderer().style()->borderImage(); | 1324 const NinePieceImage& borderImage = renderer().style()->borderImage(); |
1325 StyleImage* borderImageSource = borderImage.image(); | 1325 StyleImage* borderImageSource = borderImage.image(); |
1326 bool hasBorderImage = borderImageSource && borderImageSource->canRender(
renderer(), styleToUse->effectiveZoom()); | 1326 bool hasBorderImage = borderImageSource && borderImageSource->canRender(
renderer(), styleToUse->effectiveZoom()); |
1327 if (hasBorderImage && !borderImageSource->isLoaded()) | 1327 if (hasBorderImage && !borderImageSource->isLoaded()) |
1328 return; // Don't paint anything while we wait for the image to load. | 1328 return; // Don't paint anything while we wait for the image to load. |
1329 | 1329 |
1330 // The simple case is where we either have no border image or we are the
only box for this object. | 1330 // The simple case is where we either have no border image or we are the
only box for this object. |
1331 // In those cases only a single call to draw is required. | 1331 // In those cases only a single call to draw is required. |
1332 if (!hasBorderImage || (!prevLineBox() && !nextLineBox())) { | 1332 if (!hasBorderImage || (!prevLineBox() && !nextLineBox())) { |
1333 boxModelObject()->paintBorder(paintInfo, paintRect, renderer().style
(isFirstLineStyle()), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogi
calRightEdge()); | 1333 BoxPainter::paintBorder(*boxModelObject(), paintInfo, paintRect, ren
derer().style(isFirstLineStyle()), BackgroundBleedNone, includeLogicalLeftEdge()
, includeLogicalRightEdge()); |
1334 } else { | 1334 } else { |
1335 // We have a border image that spans multiple lines. | 1335 // We have a border image that spans multiple lines. |
1336 // We need to adjust tx and ty by the width of all previous lines. | 1336 // We need to adjust tx and ty by the width of all previous lines. |
1337 // Think of border image painting on inlines as though you had one l
ong line, a single continuous | 1337 // Think of border image painting on inlines as though you had one l
ong line, a single continuous |
1338 // strip. Even though that strip has been broken up across multiple
lines, you still paint it | 1338 // strip. Even though that strip has been broken up across multiple
lines, you still paint it |
1339 // as though you had one single line. This means each line has to pi
ck up the image where | 1339 // as though you had one single line. This means each line has to pi
ck up the image where |
1340 // the previous line left off. | 1340 // the previous line left off. |
1341 // FIXME: What the heck do we do with RTL here? The math we're using
is obviously not right, | 1341 // FIXME: What the heck do we do with RTL here? The math we're using
is obviously not right, |
1342 // but it isn't even clear how this should work at all. | 1342 // but it isn't even clear how this should work at all. |
1343 LayoutUnit logicalOffsetOnLine = 0; | 1343 LayoutUnit logicalOffsetOnLine = 0; |
1344 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLin
eBox()) | 1344 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLin
eBox()) |
1345 logicalOffsetOnLine += curr->logicalWidth(); | 1345 logicalOffsetOnLine += curr->logicalWidth(); |
1346 LayoutUnit totalLogicalWidth = logicalOffsetOnLine; | 1346 LayoutUnit totalLogicalWidth = logicalOffsetOnLine; |
1347 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) | 1347 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) |
1348 totalLogicalWidth += curr->logicalWidth(); | 1348 totalLogicalWidth += curr->logicalWidth(); |
1349 LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logi
calOffsetOnLine : LayoutUnit()); | 1349 LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logi
calOffsetOnLine : LayoutUnit()); |
1350 LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? Layo
utUnit() : logicalOffsetOnLine); | 1350 LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? Layo
utUnit() : logicalOffsetOnLine); |
1351 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRe
ct.width(); | 1351 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRe
ct.width(); |
1352 LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : total
LogicalWidth; | 1352 LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : total
LogicalWidth; |
1353 | 1353 |
1354 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, borderIma
ge, paintRect); | 1354 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, borderIma
ge, paintRect); |
1355 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1355 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
1356 paintInfo.context->clip(clipRect); | 1356 paintInfo.context->clip(clipRect); |
1357 boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY,
stripWidth, stripHeight), renderer().style(isFirstLineStyle())); | 1357 BoxPainter::paintBorder(*boxModelObject(), paintInfo, LayoutRect(str
ipX, stripY, stripWidth, stripHeight), renderer().style(isFirstLineStyle())); |
1358 } | 1358 } |
1359 } | 1359 } |
1360 } | 1360 } |
1361 | 1361 |
1362 void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 1362 void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
1363 { | 1363 { |
1364 if (!paintInfo.shouldPaintWithinRoot(&renderer()) || renderer().style()->vis
ibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) | 1364 if (!paintInfo.shouldPaintWithinRoot(&renderer()) || renderer().style()->vis
ibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) |
1365 return; | 1365 return; |
1366 | 1366 |
1367 // Pixel snap mask painting. | 1367 // Pixel snap mask painting. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer(), rende
rer().style()->effectiveZoom()); | 1400 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer(), rende
rer().style()->effectiveZoom()); |
1401 if (!hasBoxImage || !maskBoxImage->isLoaded()) { | 1401 if (!hasBoxImage || !maskBoxImage->isLoaded()) { |
1402 if (pushTransparencyLayer) | 1402 if (pushTransparencyLayer) |
1403 paintInfo.context->endLayer(); | 1403 paintInfo.context->endLayer(); |
1404 return; // Don't paint anything while we wait for the image to load. | 1404 return; // Don't paint anything while we wait for the image to load. |
1405 } | 1405 } |
1406 | 1406 |
1407 // The simple case is where we are the only box for this object. In those | 1407 // The simple case is where we are the only box for this object. In those |
1408 // cases only a single call to draw is required. | 1408 // cases only a single call to draw is required. |
1409 if (!prevLineBox() && !nextLineBox()) { | 1409 if (!prevLineBox() && !nextLineBox()) { |
1410 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adju
stedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage, comp
ositeOp); | 1410 BoxPainter::paintNinePieceImage(*boxModelObject(), paintInfo.context, La
youtRect(adjustedPaintOffset, frameRect.size()), renderer().style(), maskNinePie
ceImage, compositeOp); |
1411 } else { | 1411 } else { |
1412 // We have a mask image that spans multiple lines. | 1412 // We have a mask image that spans multiple lines. |
1413 // We need to adjust _tx and _ty by the width of all previous lines. | 1413 // We need to adjust _tx and _ty by the width of all previous lines. |
1414 LayoutUnit logicalOffsetOnLine = 0; | 1414 LayoutUnit logicalOffsetOnLine = 0; |
1415 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox
()) | 1415 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox
()) |
1416 logicalOffsetOnLine += curr->logicalWidth(); | 1416 logicalOffsetOnLine += curr->logicalWidth(); |
1417 LayoutUnit totalLogicalWidth = logicalOffsetOnLine; | 1417 LayoutUnit totalLogicalWidth = logicalOffsetOnLine; |
1418 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) | 1418 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) |
1419 totalLogicalWidth += curr->logicalWidth(); | 1419 totalLogicalWidth += curr->logicalWidth(); |
1420 LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalO
ffsetOnLine : LayoutUnit()); | 1420 LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalO
ffsetOnLine : LayoutUnit()); |
1421 LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? LayoutUn
it() : logicalOffsetOnLine); | 1421 LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? LayoutUn
it() : logicalOffsetOnLine); |
1422 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.w
idth(); | 1422 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.w
idth(); |
1423 LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogi
calWidth; | 1423 LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogi
calWidth; |
1424 | 1424 |
1425 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePiece
Image, paintRect); | 1425 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePiece
Image, paintRect); |
1426 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1426 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
1427 paintInfo.context->clip(clipRect); | 1427 paintInfo.context->clip(clipRect); |
1428 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stri
pX, stripY, stripWidth, stripHeight), renderer().style(), maskNinePieceImage, co
mpositeOp); | 1428 BoxPainter::paintNinePieceImage(*boxModelObject(), paintInfo.context, La
youtRect(stripX, stripY, stripWidth, stripHeight), renderer().style(), maskNineP
ieceImage, compositeOp); |
1429 } | 1429 } |
1430 | 1430 |
1431 if (pushTransparencyLayer) | 1431 if (pushTransparencyLayer) |
1432 paintInfo.context->endLayer(); | 1432 paintInfo.context->endLayer(); |
1433 } | 1433 } |
1434 | 1434 |
1435 InlineBox* InlineFlowBox::firstLeafChild() const | 1435 InlineBox* InlineFlowBox::firstLeafChild() const |
1436 { | 1436 { |
1437 InlineBox* leaf = 0; | 1437 InlineBox* leaf = 0; |
1438 for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnL
ine()) | 1438 for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnL
ine()) |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 ASSERT(child->prevOnLine() == prev); | 1673 ASSERT(child->prevOnLine() == prev); |
1674 prev = child; | 1674 prev = child; |
1675 } | 1675 } |
1676 ASSERT(prev == m_lastChild); | 1676 ASSERT(prev == m_lastChild); |
1677 #endif | 1677 #endif |
1678 } | 1678 } |
1679 | 1679 |
1680 #endif | 1680 #endif |
1681 | 1681 |
1682 } // namespace blink | 1682 } // namespace blink |
OLD | NEW |