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

Side by Side Diff: Source/core/rendering/RenderDeprecatedFlexibleBox.cpp

Issue 351213002: Change RenderObject::style(bool) to accept an enum instead (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Renamed enum to OwnOrFirstLineStyle, rebased and got rid of duplicate state on the stack in RootInl… Created 6 years, 5 months 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
OLDNEW
1 /* 1 /*
2 * This file is part of the render object implementation for KHTML. 2 * This file is part of the render object implementation for KHTML.
3 * 3 *
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * Copyright (C) 2003 Apple Computer, Inc. 6 * Copyright (C) 2003 Apple Computer, Inc.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 maxDescent = std::max(maxDescent, descent); 394 maxDescent = std::max(maxDescent, descent);
395 395
396 // Now update our height. 396 // Now update our height.
397 setHeight(std::max(yPos + maxAscent + maxDescent, height())); 397 setHeight(std::max(yPos + maxAscent + maxDescent, height()));
398 } else { 398 } else {
399 setHeight(std::max(height(), yPos + child->height() + child->mar ginHeight())); 399 setHeight(std::max(height(), yPos + child->height() + child->mar ginHeight()));
400 } 400 }
401 } 401 }
402 402
403 if (!iterator.first() && hasLineIfEmpty()) 403 if (!iterator.first() && hasLineIfEmpty())
404 setHeight(height() + lineHeight(true, style()->isHorizontalWritingMo de() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)); 404 setHeight(height() + lineHeight(FirstLineStyle, style()->isHorizonta lWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
405 405
406 setHeight(height() + toAdd); 406 setHeight(height() + toAdd);
407 407
408 oldHeight = height(); 408 oldHeight = height();
409 updateLogicalHeight(); 409 updateLogicalHeight();
410 410
411 relayoutChildren = false; 411 relayoutChildren = false;
412 if (oldHeight != height()) 412 if (oldHeight != height())
413 heightSpecified = true; 413 heightSpecified = true;
414 414
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 } 710 }
711 711
712 // Place the child. 712 // Place the child.
713 placeChild(child, LayoutPoint(childX, height())); 713 placeChild(child, LayoutPoint(childX, height()));
714 setHeight(height() + child->height() + child->marginBottom()); 714 setHeight(height() + child->height() + child->marginBottom());
715 } 715 }
716 716
717 yPos = height(); 717 yPos = height();
718 718
719 if (!iterator.first() && hasLineIfEmpty()) 719 if (!iterator.first() && hasLineIfEmpty())
720 setHeight(height() + lineHeight(true, style()->isHorizontalWritingMo de() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)); 720 setHeight(height() + lineHeight(FirstLineStyle, style()->isHorizonta lWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
721 721
722 setHeight(height() + toAdd); 722 setHeight(height() + toAdd);
723 723
724 // Negative margins can cause our height to shrink below our minimal hei ght (border/padding). 724 // Negative margins can cause our height to shrink below our minimal hei ght (border/padding).
725 // If this happens, ensure that the computed height is increased to the minimal height. 725 // If this happens, ensure that the computed height is increased to the minimal height.
726 if (height() < minHeight) 726 if (height() < minHeight)
727 setHeight(minHeight); 727 setHeight(minHeight);
728 728
729 // Now we have to calc our height, so we know how much space we have rem aining. 729 // Now we have to calc our height, so we know how much space we have rem aining.
730 oldHeight = height(); 730 oldHeight = height();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 if (!lastLine) 927 if (!lastLine)
928 continue; 928 continue;
929 929
930 RootInlineBox* lastVisibleLine = blockChild->lineAtIndex(numVisibleLines - 1); 930 RootInlineBox* lastVisibleLine = blockChild->lineAtIndex(numVisibleLines - 1);
931 if (!lastVisibleLine) 931 if (!lastVisibleLine)
932 continue; 932 continue;
933 933
934 const UChar ellipsisAndSpace[2] = { horizontalEllipsis, ' ' }; 934 const UChar ellipsisAndSpace[2] = { horizontalEllipsis, ' ' };
935 DEFINE_STATIC_LOCAL(AtomicString, ellipsisAndSpaceStr, (ellipsisAndSpace , 2)); 935 DEFINE_STATIC_LOCAL(AtomicString, ellipsisAndSpaceStr, (ellipsisAndSpace , 2));
936 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1)) ; 936 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1)) ;
937 const Font& font = style(numVisibleLines == 1)->font(); 937 const Font& font = style(numVisibleLines == 1 ? FirstLineStyle : OwnStyl e)->font();
938 938
939 // Get ellipsis width, and if the last child is an anchor, it will go af ter the ellipsis, so add in a space and the anchor width too 939 // Get ellipsis width, and if the last child is an anchor, it will go af ter the ellipsis, so add in a space and the anchor width too
940 float totalWidth; 940 float totalWidth;
941 InlineBox* anchorBox = lastLine->lastChild(); 941 InlineBox* anchorBox = lastLine->lastChild();
942 if (anchorBox && anchorBox->renderer().style()->isLink()) 942 if (anchorBox && anchorBox->renderer().style()->isLink())
943 totalWidth = anchorBox->logicalWidth() + font.width(RenderBlockFlow: :constructTextRun(this, font, ellipsisAndSpace, 2, style(), style()->direction() )); 943 totalWidth = anchorBox->logicalWidth() + font.width(RenderBlockFlow: :constructTextRun(this, font, ellipsisAndSpace, 2, style(), style()->direction() ));
944 else { 944 else {
945 anchorBox = 0; 945 anchorBox = 0;
946 totalWidth = font.width(RenderBlockFlow::constructTextRun(this, font , &horizontalEllipsis, 1, style(), style()->direction())); 946 totalWidth = font.width(RenderBlockFlow::constructTextRun(this, font , &horizontalEllipsis, 1, style(), style()->direction()));
947 } 947 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 if (isPseudoElement()) 1068 if (isPseudoElement())
1069 return "RenderDeprecatedFlexibleBox (generated)"; 1069 return "RenderDeprecatedFlexibleBox (generated)";
1070 if (isAnonymous()) 1070 if (isAnonymous())
1071 return "RenderDeprecatedFlexibleBox (generated)"; 1071 return "RenderDeprecatedFlexibleBox (generated)";
1072 if (isRelPositioned()) 1072 if (isRelPositioned())
1073 return "RenderDeprecatedFlexibleBox (relative positioned)"; 1073 return "RenderDeprecatedFlexibleBox (relative positioned)";
1074 return "RenderDeprecatedFlexibleBox"; 1074 return "RenderDeprecatedFlexibleBox";
1075 } 1075 }
1076 1076
1077 } // namespace WebCore 1077 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderButton.cpp ('k') | Source/core/rendering/RenderFileUploadControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698