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

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

Issue 734813004: Get rid of continuations. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 | « no previous file | sky/engine/core/rendering/RenderBlock.h » ('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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // All boxes start off open. They will not apply any margins/border/padding on 293 // All boxes start off open. They will not apply any margins/border/padding on
294 // any side. 294 // any side.
295 bool includeLeftEdge = false; 295 bool includeLeftEdge = false;
296 bool includeRightEdge = false; 296 bool includeRightEdge = false;
297 297
298 // The root inline box never has borders/margins/padding. 298 // The root inline box never has borders/margins/padding.
299 if (parent()) { 299 if (parent()) {
300 bool ltr = renderer().style()->isLeftToRightDirection(); 300 bool ltr = renderer().style()->isLeftToRightDirection();
301 301
302 // Check to see if all initial lines are unconstructed. If so, then 302 // Check to see if all initial lines are unconstructed. If so, then
303 // we know the inline began on this line (unless we are a continuation). 303 // we know the inline began on this line.
304 RenderLineBoxList* lineBoxList = rendererLineBoxes(); 304 RenderLineBoxList* lineBoxList = rendererLineBoxes();
305 if (!lineBoxList->firstLineBox()->isConstructed() && !renderer().isInlin eElementContinuation()) { 305 if (!lineBoxList->firstLineBox()->isConstructed()) {
306 if (renderer().style()->boxDecorationBreak() == DCLONE) 306 if (renderer().style()->boxDecorationBreak() == DCLONE)
307 includeLeftEdge = includeRightEdge = true; 307 includeLeftEdge = includeRightEdge = true;
308 else if (ltr && lineBoxList->firstLineBox() == this) 308 else if (ltr && lineBoxList->firstLineBox() == this)
309 includeLeftEdge = true; 309 includeLeftEdge = true;
310 else if (!ltr && lineBoxList->lastLineBox() == this) 310 else if (!ltr && lineBoxList->lastLineBox() == this)
311 includeRightEdge = true; 311 includeRightEdge = true;
312 } 312 }
313 313
314 if (!lineBoxList->lastLineBox()->isConstructed()) { 314 if (!lineBoxList->lastLineBox()->isConstructed()) {
315 RenderInline& inlineFlow = toRenderInline(renderer());
316 bool isLastObjectOnLine = !isAnsectorAndWithinBlock(&renderer(), log icallyLastRunRenderer) || (isLastChildForRenderer(&renderer(), logicallyLastRunR enderer) && !isLogicallyLastRunWrapped); 315 bool isLastObjectOnLine = !isAnsectorAndWithinBlock(&renderer(), log icallyLastRunRenderer) || (isLastChildForRenderer(&renderer(), logicallyLastRunR enderer) && !isLogicallyLastRunWrapped);
317 316
318 // We include the border under these conditions: 317 // We include the border under these conditions:
319 // (1) The next line was not created, or it is constructed. We check the previous line for rtl. 318 // (1) The next line was not created, or it is constructed. We check the previous line for rtl.
320 // (2) The logicallyLastRun is not a descendant of this renderer. 319 // (2) The logicallyLastRun is not a descendant of this renderer.
321 // (3) The logicallyLastRun is a descendant of this renderer, but it is the last child of this renderer and it does not wrap to the next line. 320 // (3) The logicallyLastRun is a descendant of this renderer, but it is the last child of this renderer and it does not wrap to the next line.
322 // (4) The decoration break is set to clone therefore there will be borders on every sides. 321 // (4) The decoration break is set to clone therefore there will be borders on every sides.
323 if (renderer().style()->boxDecorationBreak() == DCLONE) 322 if (renderer().style()->boxDecorationBreak() == DCLONE)
324 includeLeftEdge = includeRightEdge = true; 323 includeLeftEdge = includeRightEdge = true;
325 else if (ltr) { 324 else if (ltr) {
326 if (!nextLineBox() 325 if (!nextLineBox()
327 && ((lastLine || isLastObjectOnLine) && !inlineFlow.continua tion())) 326 && (lastLine || isLastObjectOnLine))
328 includeRightEdge = true; 327 includeRightEdge = true;
329 } else { 328 } else {
330 if ((!prevLineBox() || prevLineBox()->isConstructed()) 329 if ((!prevLineBox() || prevLineBox()->isConstructed())
331 && ((lastLine || isLastObjectOnLine) && !inlineFlow.continua tion())) 330 && (lastLine || isLastObjectOnLine))
332 includeLeftEdge = true; 331 includeLeftEdge = true;
333 } 332 }
334 } 333 }
335 } 334 }
336 335
337 setEdges(includeLeftEdge, includeRightEdge); 336 setEdges(includeLeftEdge, includeRightEdge);
338 337
339 // Recur into our children. 338 // Recur into our children.
340 for (InlineBox* currChild = firstChild(); currChild; currChild = currChild-> nextOnLine()) { 339 for (InlineBox* currChild = firstChild(); currChild; currChild = currChild-> nextOnLine()) {
341 if (currChild->isInlineFlowBox()) { 340 if (currChild->isInlineFlowBox()) {
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 } 990 }
992 991
993 void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom) 992 void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
994 { 993 {
995 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); 994 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
996 overflowRect.moveBy(paintOffset); 995 overflowRect.moveBy(paintOffset);
997 996
998 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) 997 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect)))
999 return; 998 return;
1000 999
1001 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSel fOutline) { 1000 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe lfOutline)
1002 // Add ourselves to the paint info struct's list of inlines that need to paint their 1001 && renderer().style()->hasOutline() && !isRootInlineBox()) {
1003 // outlines. 1002 RenderInline& inlineFlow = toRenderInline(renderer());
1004 if (renderer().style()->hasOutline() && !isRootInlineBox()) { 1003 paintInfo.outlineObjects()->add(&inlineFlow);
1005 RenderInline& inlineFlow = toRenderInline(renderer());
1006
1007 RenderBlock* cb = 0;
1008 bool containingBlockPaintsContinuationOutline = inlineFlow.continuat ion() || inlineFlow.isInlineElementContinuation();
1009 if (containingBlockPaintsContinuationOutline) {
1010 // FIXME: See https://bugs.webkit.org/show_bug.cgi?id=54690. We currently don't reconnect inline continuations
1011 // after a child removal. As a result, those merged inlines do n ot get seperated and hence not get enclosed by
1012 // anonymous blocks. In this case, it is better to bail out and paint it ourself.
1013 RenderBlock* enclosingAnonymousBlock = renderer().containingBloc k();
1014 if (!enclosingAnonymousBlock->isAnonymousBlock()) {
1015 containingBlockPaintsContinuationOutline = false;
1016 } else {
1017 cb = enclosingAnonymousBlock->containingBlock();
1018 for (RenderBoxModelObject* box = boxModelObject(); box != cb ; box = box->parent()->enclosingBoxModelObject()) {
1019 if (box->hasSelfPaintingLayer()) {
1020 containingBlockPaintsContinuationOutline = false;
1021 break;
1022 }
1023 }
1024 }
1025 }
1026
1027 if (containingBlockPaintsContinuationOutline) {
1028 // Add ourselves to the containing block of the entire continuat ion so that it can
1029 // paint us atomically.
1030 cb->addContinuationWithOutline(toRenderInline(renderer().node()- >renderer()));
1031 } else if (!inlineFlow.isInlineElementContinuation()) {
1032 paintInfo.outlineObjects()->add(&inlineFlow);
1033 }
1034 }
1035 } else if (paintInfo.phase == PaintPhaseMask) { 1004 } else if (paintInfo.phase == PaintPhaseMask) {
1036 paintMask(paintInfo, paintOffset); 1005 paintMask(paintInfo, paintOffset);
1037 return; 1006 return;
1038 } else if (paintInfo.phase == PaintPhaseForeground) { 1007 } else if (paintInfo.phase == PaintPhaseForeground) {
1039 // Paint our background, border and box-shadow. 1008 // Paint our background, border and box-shadow.
1040 paintBoxDecorationBackground(paintInfo, paintOffset); 1009 paintBoxDecorationBackground(paintInfo, paintOffset);
1041 } 1010 }
1042 1011
1043 // Paint our children. 1012 // Paint our children.
1044 if (paintInfo.phase != PaintPhaseSelfOutline) { 1013 if (paintInfo.phase != PaintPhaseSelfOutline) {
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 ASSERT(child->prevOnLine() == prev); 1447 ASSERT(child->prevOnLine() == prev);
1479 prev = child; 1448 prev = child;
1480 } 1449 }
1481 ASSERT(prev == m_lastChild); 1450 ASSERT(prev == m_lastChild);
1482 #endif 1451 #endif
1483 } 1452 }
1484 1453
1485 #endif 1454 #endif
1486 1455
1487 } // namespace blink 1456 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/rendering/RenderBlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698