Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: sky/engine/core/rendering/InlineFlowBox.cpp

Issue 688233002: Remove writing mode code from the linebox tree. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: merge to ToT Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/rendering/InlineFlowBox.h ('k') | sky/engine/core/rendering/InlineTextBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 child->setParent(this); 95 child->setParent(this);
96 if (!m_firstChild) { 96 if (!m_firstChild) {
97 m_firstChild = child; 97 m_firstChild = child;
98 m_lastChild = child; 98 m_lastChild = child;
99 } else { 99 } else {
100 m_lastChild->setNextOnLine(child); 100 m_lastChild->setNextOnLine(child);
101 child->setPrevOnLine(m_lastChild); 101 child->setPrevOnLine(m_lastChild);
102 m_lastChild = child; 102 m_lastChild = child;
103 } 103 }
104 child->setFirstLineStyleBit(isFirstLineStyle()); 104 child->setFirstLineStyleBit(isFirstLineStyle());
105 child->setIsHorizontal(isHorizontal());
106 if (child->isText()) { 105 if (child->isText()) {
107 if (child->renderer().parent() == renderer()) 106 if (child->renderer().parent() == renderer())
108 m_hasTextChildren = true; 107 m_hasTextChildren = true;
109 setHasTextDescendantsOnAncestors(this); 108 setHasTextDescendantsOnAncestors(this);
110 } else if (child->isInlineFlowBox()) { 109 } else if (child->isInlineFlowBox()) {
111 if (toInlineFlowBox(child)->hasTextDescendants()) 110 if (toInlineFlowBox(child)->hasTextDescendants())
112 setHasTextDescendantsOnAncestors(this); 111 setHasTextDescendantsOnAncestors(this);
113 } 112 }
114 113
115 if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer().isOutOf FlowPositioned()) { 114 if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer().isOutOf FlowPositioned()) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 logicalLeft += flow->marginLogicalLeft(); 398 logicalLeft += flow->marginLogicalLeft();
400 if (knownToHaveNoOverflow()) 399 if (knownToHaveNoOverflow())
401 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); 400 minLogicalLeft = std::min(logicalLeft, minLogicalLeft);
402 logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, nee dsWordSpacing); 401 logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, nee dsWordSpacing);
403 if (knownToHaveNoOverflow()) 402 if (knownToHaveNoOverflow())
404 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); 403 maxLogicalRight = std::max(logicalLeft, maxLogicalRight);
405 logicalLeft += flow->marginLogicalRight(); 404 logicalLeft += flow->marginLogicalRight();
406 } else { 405 } else {
407 // The box can have a different writing-mode than the overall li ne, so this is a bit complicated. 406 // The box can have a different writing-mode than the overall li ne, so this is a bit complicated.
408 // Just get all the physical margin and overflow values by hand based off |isVertical|. 407 // Just get all the physical margin and overflow values by hand based off |isVertical|.
409 LayoutUnit logicalLeftMargin = isHorizontal() ? curr->boxModelOb ject()->marginLeft() : curr->boxModelObject()->marginTop(); 408 LayoutUnit logicalLeftMargin = curr->boxModelObject()->marginLef t();
410 LayoutUnit logicalRightMargin = isHorizontal() ? curr->boxModelO bject()->marginRight() : curr->boxModelObject()->marginBottom(); 409 LayoutUnit logicalRightMargin = curr->boxModelObject()->marginRi ght();
411 410
412 logicalLeft += logicalLeftMargin; 411 logicalLeft += logicalLeftMargin;
413 curr->setLogicalLeft(logicalLeft); 412 curr->setLogicalLeft(logicalLeft);
414 if (knownToHaveNoOverflow()) 413 if (knownToHaveNoOverflow())
415 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); 414 minLogicalLeft = std::min(logicalLeft, minLogicalLeft);
416 logicalLeft += curr->logicalWidth(); 415 logicalLeft += curr->logicalWidth();
417 if (knownToHaveNoOverflow()) 416 if (knownToHaveNoOverflow())
418 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); 417 maxLogicalRight = std::max(logicalLeft, maxLogicalRight);
419 logicalLeft += logicalRightMargin; 418 logicalLeft += logicalRightMargin;
420 // If we encounter any space after this inline block then ensure it is treated as the space between two words. 419 // If we encounter any space after this inline block then ensure it is treated as the space between two words.
421 needsWordSpacing = true; 420 needsWordSpacing = true;
422 } 421 }
423 } 422 }
424 } 423 }
425 return logicalLeft; 424 return logicalLeft;
426 } 425 }
427 426
428 bool InlineFlowBox::requiresIdeographicBaseline(const GlyphOverflowAndFallbackFo ntsMap& textBoxDataMap) const
429 {
430 if (isHorizontal())
431 return false;
432
433 if (renderer().style(isFirstLineStyle())->fontDescription().nonCJKGlyphOrien tation() == NonCJKGlyphOrientationUpright
434 || renderer().style(isFirstLineStyle())->font().primaryFont()->hasVertic alGlyphs())
435 return true;
436
437 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
438 if (curr->renderer().isOutOfFlowPositioned())
439 continue; // Positioned placeholders don't affect calculations.
440
441 if (curr->isInlineFlowBox()) {
442 if (toInlineFlowBox(curr)->requiresIdeographicBaseline(textBoxDataMa p))
443 return true;
444 } else {
445 if (curr->renderer().style(isFirstLineStyle())->font().primaryFont() ->hasVerticalGlyphs())
446 return true;
447
448 const Vector<const SimpleFontData*>* usedFonts = 0;
449 if (curr->isInlineTextBox()) {
450 GlyphOverflowAndFallbackFontsMap::const_iterator it = textBoxDat aMap.find(toInlineTextBox(curr));
451 usedFonts = it == textBoxDataMap.end() ? 0 : &it->value.first;
452 }
453
454 if (usedFonts) {
455 for (size_t i = 0; i < usedFonts->size(); ++i) {
456 if (usedFonts->at(i)->hasVerticalGlyphs())
457 return true;
458 }
459 }
460 }
461 }
462
463 return false;
464 }
465
466 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i nt maxPositionTop, int maxPositionBottom) 427 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i nt maxPositionTop, int maxPositionBottom)
467 { 428 {
468 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 429 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
469 // The computed lineheight needs to be extended for the 430 // The computed lineheight needs to be extended for the
470 // positioned elements 431 // positioned elements
471 if (curr->renderer().isOutOfFlowPositioned()) 432 if (curr->renderer().isOutOfFlowPositioned())
472 continue; // Positioned placeholders don't affect calculations. 433 continue; // Positioned placeholders don't affect calculations.
473 if (curr->verticalAlign() == TOP || curr->verticalAlign() == BOTTOM) { 434 if (curr->verticalAlign() == TOP || curr->verticalAlign() == BOTTOM) {
474 int lineHeight = curr->lineHeight(); 435 int lineHeight = curr->lineHeight();
475 if (curr->verticalAlign() == TOP) { 436 if (curr->verticalAlign() == TOP) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics. ascent(baselineType); 599 newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics. ascent(baselineType);
639 if (curr->isInlineFlowBox()) { 600 if (curr->isInlineFlowBox()) {
640 RenderBoxModelObject& boxObject = toRenderBoxModelObject(curr->r enderer()); 601 RenderBoxModelObject& boxObject = toRenderBoxModelObject(curr->r enderer());
641 newLogicalTop -= boxObject.borderTop() + boxObject.paddingTop(); 602 newLogicalTop -= boxObject.borderTop() + boxObject.paddingTop();
642 borderPaddingHeight = boxObject.borderAndPaddingLogicalHeight(); 603 borderPaddingHeight = boxObject.borderAndPaddingLogicalHeight();
643 } 604 }
644 newLogicalTopIncludingMargins = newLogicalTop; 605 newLogicalTopIncludingMargins = newLogicalTop;
645 } else { 606 } else {
646 RenderBox& box = toRenderBox(curr->renderer()); 607 RenderBox& box = toRenderBox(curr->renderer());
647 newLogicalTopIncludingMargins = newLogicalTop; 608 newLogicalTopIncludingMargins = newLogicalTop;
648 LayoutUnit overSideMargin = curr->isHorizontal() ? box.marginTop() : box.marginRight(); 609 LayoutUnit overSideMargin = box.marginTop();
649 LayoutUnit underSideMargin = curr->isHorizontal() ? box.marginBottom () : box.marginLeft(); 610 LayoutUnit underSideMargin = box.marginBottom();
650 newLogicalTop += overSideMargin; 611 newLogicalTop += overSideMargin;
651 boxHeightIncludingMargins += overSideMargin + underSideMargin; 612 boxHeightIncludingMargins += overSideMargin + underSideMargin;
652 } 613 }
653 614
654 curr->setLogicalTop(newLogicalTop.toFloat()); 615 curr->setLogicalTop(newLogicalTop.toFloat());
655 616
656 if (childAffectsTopBottomPos) { 617 if (childAffectsTopBottomPos) {
657 if (curr->isInlineTextBox()) { 618 if (curr->isInlineTextBox()) {
658 TextEmphasisPosition emphasisMarkPosition; 619 TextEmphasisPosition emphasisMarkPosition;
659 if (toInlineTextBox(curr)->getEmphasisMarkPosition(curr->rendere r().style(isFirstLineStyle()), emphasisMarkPosition)) { 620 if (toInlineTextBox(curr)->getEmphasisMarkPosition(curr->rendere r().style(isFirstLineStyle()), emphasisMarkPosition)) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 921
961 if (!m_overflow) 922 if (!m_overflow)
962 m_overflow = adoptPtr(new RenderOverflow(frameBox, frameBox)); 923 m_overflow = adoptPtr(new RenderOverflow(frameBox, frameBox));
963 924
964 m_overflow->setVisualOverflow(rect); 925 m_overflow->setVisualOverflow(rect);
965 } 926 }
966 927
967 void InlineFlowBox::setOverflowFromLogicalRects(const LayoutRect& logicalLayoutO verflow, const LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom) 928 void InlineFlowBox::setOverflowFromLogicalRects(const LayoutRect& logicalLayoutO verflow, const LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom)
968 { 929 {
969 LayoutRect frameBox = enclosingLayoutRect(frameRectIncludingLineHeight(lineT op, lineBottom)); 930 LayoutRect frameBox = enclosingLayoutRect(frameRectIncludingLineHeight(lineT op, lineBottom));
970 931 setLayoutOverflow(logicalLayoutOverflow, frameBox);
971 LayoutRect layoutOverflow(isHorizontal() ? logicalLayoutOverflow : logicalLa youtOverflow.transposedRect()); 932 setVisualOverflow(logicalVisualOverflow, frameBox);
972 setLayoutOverflow(layoutOverflow, frameBox);
973
974 LayoutRect visualOverflow(isHorizontal() ? logicalVisualOverflow : logicalVi sualOverflow.transposedRect());
975 setVisualOverflow(visualOverflow, frameBox);
976 } 933 }
977 934
978 bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit lineTop, LayoutUnit lineBottom) 935 bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit lineTop, LayoutUnit lineBottom)
979 { 936 {
980 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); 937 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
981 overflowRect.moveBy(accumulatedOffset); 938 overflowRect.moveBy(accumulatedOffset);
982 if (!locationInContainer.intersects(overflowRect)) 939 if (!locationInContainer.intersects(overflowRect))
983 return false; 940 return false;
984 941
985 // Check children first. 942 // Check children first.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 totalLogicalWidth = logicalOffsetOnLine; 1098 totalLogicalWidth = logicalOffsetOnLine;
1142 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) 1099 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
1143 totalLogicalWidth += curr->logicalWidth(); 1100 totalLogicalWidth += curr->logicalWidth();
1144 } else { 1101 } else {
1145 for (InlineFlowBox* curr = nextLineBox(); curr; curr = curr->nextLin eBox()) 1102 for (InlineFlowBox* curr = nextLineBox(); curr; curr = curr->nextLin eBox())
1146 logicalOffsetOnLine += curr->logicalWidth(); 1103 logicalOffsetOnLine += curr->logicalWidth();
1147 totalLogicalWidth = logicalOffsetOnLine; 1104 totalLogicalWidth = logicalOffsetOnLine;
1148 for (InlineFlowBox* curr = this; curr; curr = curr->prevLineBox()) 1105 for (InlineFlowBox* curr = this; curr; curr = curr->prevLineBox())
1149 totalLogicalWidth += curr->logicalWidth(); 1106 totalLogicalWidth += curr->logicalWidth();
1150 } 1107 }
1151 LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : L ayoutUnit()); 1108 LayoutUnit stripX = rect.x() - logicalOffsetOnLine;
1152 LayoutUnit stripY = rect.y() - (isHorizontal() ? LayoutUnit() : logicalO ffsetOnLine); 1109 LayoutUnit stripY = rect.y();
1153 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : static_cast <LayoutUnit>(width()); 1110 LayoutUnit stripWidth = totalLogicalWidth;
1154 LayoutUnit stripHeight = isHorizontal() ? static_cast<LayoutUnit>(height ()) : totalLogicalWidth; 1111 LayoutUnit stripHeight = static_cast<LayoutUnit>(height());
1155 1112
1156 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1113 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1157 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height() )); 1114 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height() ));
1158 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, Layout Rect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, this, rect.s ize(), op); 1115 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, Layout Rect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, this, rect.s ize(), op);
1159 } 1116 }
1160 } 1117 }
1161 1118
1162 void InlineFlowBox::paintBoxShadow(const PaintInfo& info, RenderStyle* s, Shadow Style shadowStyle, const LayoutRect& paintRect) 1119 void InlineFlowBox::paintBoxShadow(const PaintInfo& info, RenderStyle* s, Shadow Style shadowStyle, const LayoutRect& paintRect)
1163 { 1120 {
1164 if ((!prevLineBox() && !nextLineBox()) || !parent()) 1121 if ((!prevLineBox() && !nextLineBox()) || !parent())
1165 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle); 1122 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle);
1166 else { 1123 else {
1167 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't 1124 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't
1168 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines 1125 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines
1169 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle, includ eLogicalLeftEdge(), includeLogicalRightEdge()); 1126 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle, includ eLogicalLeftEdge(), includeLogicalRightEdge());
1170 } 1127 }
1171 } 1128 }
1172 1129
1173 static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP ieceImage& image, const LayoutRect& paintRect) 1130 static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP ieceImage& image, const LayoutRect& paintRect)
1174 { 1131 {
1175 LayoutRect clipRect(paintRect); 1132 LayoutRect clipRect(paintRect);
1176 RenderStyle* style = box->renderer().style(); 1133 RenderStyle* style = box->renderer().style();
1177 LayoutBoxExtent outsets = style->imageOutsets(image); 1134 LayoutBoxExtent outsets = style->imageOutsets(image);
1178 if (box->isHorizontal()) { 1135 clipRect.setY(paintRect.y() - outsets.top());
1179 clipRect.setY(paintRect.y() - outsets.top()); 1136 clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom());
1180 clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom() ); 1137 if (box->includeLogicalLeftEdge()) {
1181 if (box->includeLogicalLeftEdge()) {
1182 clipRect.setX(paintRect.x() - outsets.left());
1183 clipRect.setWidth(paintRect.width() + outsets.left());
1184 }
1185 if (box->includeLogicalRightEdge())
1186 clipRect.setWidth(clipRect.width() + outsets.right());
1187 } else {
1188 clipRect.setX(paintRect.x() - outsets.left()); 1138 clipRect.setX(paintRect.x() - outsets.left());
1189 clipRect.setWidth(paintRect.width() + outsets.left() + outsets.right()); 1139 clipRect.setWidth(paintRect.width() + outsets.left());
1190 if (box->includeLogicalLeftEdge()) {
1191 clipRect.setY(paintRect.y() - outsets.top());
1192 clipRect.setHeight(paintRect.height() + outsets.top());
1193 }
1194 if (box->includeLogicalRightEdge())
1195 clipRect.setHeight(clipRect.height() + outsets.bottom());
1196 } 1140 }
1141 if (box->includeLogicalRightEdge())
1142 clipRect.setWidth(clipRect.width() + outsets.right());
1197 return clipRect; 1143 return clipRect;
1198 } 1144 }
1199 1145
1200 void InlineFlowBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const Lay outPoint& paintOffset) 1146 void InlineFlowBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const Lay outPoint& paintOffset)
1201 { 1147 {
1202 ASSERT(paintInfo.phase == PaintPhaseForeground); 1148 ASSERT(paintInfo.phase == PaintPhaseForeground);
1203 if (!paintInfo.shouldPaintWithinRoot(&renderer())) 1149 if (!paintInfo.shouldPaintWithinRoot(&renderer()))
1204 return; 1150 return;
1205 1151
1206 // You can use p::first-line to specify a background. If so, the root line b oxes for 1152 // You can use p::first-line to specify a background. If so, the root line b oxes for
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 // as though you had one single line. This means each line has to pi ck up the image where 1199 // as though you had one single line. This means each line has to pi ck up the image where
1254 // the previous line left off. 1200 // the previous line left off.
1255 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right, 1201 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right,
1256 // but it isn't even clear how this should work at all. 1202 // but it isn't even clear how this should work at all.
1257 LayoutUnit logicalOffsetOnLine = 0; 1203 LayoutUnit logicalOffsetOnLine = 0;
1258 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLin eBox()) 1204 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLin eBox())
1259 logicalOffsetOnLine += curr->logicalWidth(); 1205 logicalOffsetOnLine += curr->logicalWidth();
1260 LayoutUnit totalLogicalWidth = logicalOffsetOnLine; 1206 LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
1261 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) 1207 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
1262 totalLogicalWidth += curr->logicalWidth(); 1208 totalLogicalWidth += curr->logicalWidth();
1263 LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logi calOffsetOnLine : LayoutUnit()); 1209 LayoutUnit stripX = adjustedPaintOffset.x() - logicalOffsetOnLine;
1264 LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? Layo utUnit() : logicalOffsetOnLine); 1210 LayoutUnit stripY = adjustedPaintOffset.y();
1265 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRe ct.width(); 1211 LayoutUnit stripWidth = totalLogicalWidth;
1266 LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : total LogicalWidth; 1212 LayoutUnit stripHeight = frameRect.height();
1267 1213
1268 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, borderIma ge, paintRect); 1214 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, borderIma ge, paintRect);
1269 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1215 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1270 paintInfo.context->clip(clipRect); 1216 paintInfo.context->clip(clipRect);
1271 boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer().style(isFirstLineStyle())); 1217 boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer().style(isFirstLineStyle()));
1272 } 1218 }
1273 } 1219 }
1274 } 1220 }
1275 1221
1276 void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs et) 1222 void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs et)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adju stedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage, comp ositeOp); 1267 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adju stedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage, comp ositeOp);
1322 } else { 1268 } else {
1323 // We have a mask image that spans multiple lines. 1269 // We have a mask image that spans multiple lines.
1324 // We need to adjust _tx and _ty by the width of all previous lines. 1270 // We need to adjust _tx and _ty by the width of all previous lines.
1325 LayoutUnit logicalOffsetOnLine = 0; 1271 LayoutUnit logicalOffsetOnLine = 0;
1326 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox ()) 1272 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox ())
1327 logicalOffsetOnLine += curr->logicalWidth(); 1273 logicalOffsetOnLine += curr->logicalWidth();
1328 LayoutUnit totalLogicalWidth = logicalOffsetOnLine; 1274 LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
1329 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) 1275 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
1330 totalLogicalWidth += curr->logicalWidth(); 1276 totalLogicalWidth += curr->logicalWidth();
1331 LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalO ffsetOnLine : LayoutUnit()); 1277 LayoutUnit stripX = adjustedPaintOffset.x() - logicalOffsetOnLine;
1332 LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? LayoutUn it() : logicalOffsetOnLine); 1278 LayoutUnit stripY = adjustedPaintOffset.y();
1333 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.w idth(); 1279 LayoutUnit stripWidth = totalLogicalWidth;
1334 LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogi calWidth; 1280 LayoutUnit stripHeight = frameRect.height();
1335 1281
1336 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePiece Image, paintRect); 1282 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePiece Image, paintRect);
1337 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1283 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1338 paintInfo.context->clip(clipRect); 1284 paintInfo.context->clip(clipRect);
1339 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stri pX, stripY, stripWidth, stripHeight), renderer().style(), maskNinePieceImage, co mpositeOp); 1285 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stri pX, stripY, stripWidth, stripHeight), renderer().style(), maskNinePieceImage, co mpositeOp);
1340 } 1286 }
1341 1287
1342 if (pushTransparencyLayer) 1288 if (pushTransparencyLayer)
1343 paintInfo.context->endLayer(); 1289 paintInfo.context->endLayer();
1344 } 1290 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 ASSERT(child->prevOnLine() == prev); 1478 ASSERT(child->prevOnLine() == prev);
1533 prev = child; 1479 prev = child;
1534 } 1480 }
1535 ASSERT(prev == m_lastChild); 1481 ASSERT(prev == m_lastChild);
1536 #endif 1482 #endif
1537 } 1483 }
1538 1484
1539 #endif 1485 #endif
1540 1486
1541 } // namespace blink 1487 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/InlineFlowBox.h ('k') | sky/engine/core/rendering/InlineTextBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698