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

Side by Side Diff: Source/core/layout/LayoutBlockFlowLine.cpp

Issue 1278543002: Include the whole outline into visual overflow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/LayoutBox.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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google 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 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 oldAutoWrap = autoWrap; 1485 oldAutoWrap = autoWrap;
1486 } 1486 }
1487 1487
1488 if (styleToUse.collapseWhiteSpace()) 1488 if (styleToUse.collapseWhiteSpace())
1489 stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild); 1489 stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild);
1490 1490
1491 minLogicalWidth = std::max(minLogicalWidth, inlineMin); 1491 minLogicalWidth = std::max(minLogicalWidth, inlineMin);
1492 maxLogicalWidth = std::max(maxLogicalWidth, inlineMax); 1492 maxLogicalWidth = std::max(maxLogicalWidth, inlineMax);
1493 } 1493 }
1494 1494
1495 static bool isInlineWithOutlineAndContinuation(const LayoutObject& o)
1496 {
1497 return o.isLayoutInline() && o.styleRef().hasOutline() && !o.isElementContin uation() && toLayoutInline(o).continuation();
1498 }
1499
1495 void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa intInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUni t afterEdge) 1500 void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa intInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUni t afterEdge)
1496 { 1501 {
1497 LayoutFlowThread* flowThread = flowThreadContainingBlock(); 1502 LayoutFlowThread* flowThread = flowThreadContainingBlock();
1498 bool clearLinesForPagination = firstLineBox() && flowThread && !flowThread-> hasColumnSets(); 1503 bool clearLinesForPagination = firstLineBox() && flowThread && !flowThread-> hasColumnSets();
1499 1504
1500 // Figure out if we should clear out our line boxes. 1505 // Figure out if we should clear out our line boxes.
1501 // FIXME: Handle resize eventually! 1506 // FIXME: Handle resize eventually!
1502 bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren || clearLinesForPagination; 1507 bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren || clearLinesForPagination;
1503 LineLayoutState layoutState(isFullLayout, paintInvalidationLogicalTop, paint InvalidationLogicalBottom, flowThread); 1508 LineLayoutState layoutState(isFullLayout, paintInvalidationLogicalTop, paint InvalidationLogicalBottom, flowThread);
1504 1509
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 else 1564 else
1560 o->layoutIfNeeded(); 1565 o->layoutIfNeeded();
1561 } 1566 }
1562 } else if (o->isText() || (o->isLayoutInline() && !walker.atEndOfInl ine())) { 1567 } else if (o->isText() || (o->isLayoutInline() && !walker.atEndOfInl ine())) {
1563 if (!o->isText()) 1568 if (!o->isText())
1564 toLayoutInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout()); 1569 toLayoutInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout());
1565 if (layoutState.isFullLayout() || o->selfNeedsLayout()) 1570 if (layoutState.isFullLayout() || o->selfNeedsLayout())
1566 dirtyLineBoxesForObject(o, layoutState.isFullLayout()); 1571 dirtyLineBoxesForObject(o, layoutState.isFullLayout());
1567 o->clearNeedsLayout(); 1572 o->clearNeedsLayout();
1568 } 1573 }
1574
1575 if (isInlineWithOutlineAndContinuation(*o))
1576 setContainsInlineWithOutlineAndContinuation(true);
1569 } 1577 }
1570 1578
1571 for (size_t i = 0; i < replacedChildren.size(); i++) 1579 for (size_t i = 0; i < replacedChildren.size(); i++)
1572 replacedChildren[i]->layoutIfNeeded(); 1580 replacedChildren[i]->layoutIfNeeded();
1573 1581
1574 layoutRunsAndFloats(layoutState); 1582 layoutRunsAndFloats(layoutState);
1575 } 1583 }
1576 1584
1577 // Expand the last line to accommodate Ruby and emphasis marks. 1585 // Expand the last line to accommodate Ruby and emphasis marks.
1578 int lastLineAnnotationsAdjustment = 0; 1586 int lastLineAnnotationsAdjustment = 0;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 } 1855 }
1848 1856
1849 void LayoutBlockFlow::addOverflowFromInlineChildren() 1857 void LayoutBlockFlow::addOverflowFromInlineChildren()
1850 { 1858 {
1851 LayoutUnit endPadding = hasOverflowClip() ? paddingEnd() : LayoutUnit(); 1859 LayoutUnit endPadding = hasOverflowClip() ? paddingEnd() : LayoutUnit();
1852 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { 1860 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
1853 addLayoutOverflow(curr->paddedLayoutOverflowRect(endPadding)); 1861 addLayoutOverflow(curr->paddedLayoutOverflowRect(endPadding));
1854 LayoutRect visualOverflow = curr->visualOverflowRect(curr->lineTop(), cu rr->lineBottom()); 1862 LayoutRect visualOverflow = curr->visualOverflowRect(curr->lineTop(), cu rr->lineBottom());
1855 addContentsVisualOverflow(visualOverflow); 1863 addContentsVisualOverflow(visualOverflow);
1856 } 1864 }
1865
1866 if (!containsInlineWithOutlineAndContinuation())
1867 return;
1868
1869 // Add outline rects of continuations of descendant inlines into visual over flow of this block.
1870 LayoutRect outlineBoundsOfAllContinuations;
1871 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
1872 const LayoutObject& o = *walker.current();
1873 if (!isInlineWithOutlineAndContinuation(o))
1874 continue;
1875
1876 Vector<LayoutRect> outlineRects;
1877 toLayoutInline(o).addOutlineRectsForContinuations(outlineRects, LayoutPo int());
1878 LayoutRect outlineBounds = unionRect(outlineRects);
1879 outlineBounds.inflate(o.styleRef().outlineOutsetExtent());
chrishtr 2015/08/27 23:14:52 Why do you need to include the outset extent of th
Xianzhu 2015/08/27 23:40:15 The contents visual overflow of a block should cov
chrishtr 2015/08/28 00:10:05 Sure, but why is o.styleRef().outlineOutsetExtent(
Xianzhu 2015/08/28 00:24:09 It's the visual outset of the outline outside of t
1880 outlineBoundsOfAllContinuations.unite(outlineBounds);
1881 }
1882 addContentsVisualOverflow(outlineBoundsOfAllContinuations);
1857 } 1883 }
1858 1884
1859 void LayoutBlockFlow::deleteEllipsisLineBoxes() 1885 void LayoutBlockFlow::deleteEllipsisLineBoxes()
1860 { 1886 {
1861 ETextAlign textAlign = style()->textAlign(); 1887 ETextAlign textAlign = style()->textAlign();
1862 bool firstLine = true; 1888 bool firstLine = true;
1863 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { 1889 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
1864 if (curr->hasEllipsisBox()) { 1890 if (curr->hasEllipsisBox()) {
1865 curr->clearTruncation(); 1891 curr->clearTruncation();
1866 1892
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 2039 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
2014 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft; 2040 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft;
2015 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2041 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2016 2042
2017 if (!style()->isLeftToRightDirection()) 2043 if (!style()->isLeftToRightDirection())
2018 return logicalWidth() - logicalLeft; 2044 return logicalWidth() - logicalLeft;
2019 return logicalLeft; 2045 return logicalLeft;
2020 } 2046 }
2021 2047
2022 } 2048 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.cpp ('k') | Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698