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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1952613002: Move LayoutDeprecatedFlexibleBox-specific line handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Const all the things! Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 06e73dba1f4ea003b7dd1afdb40018e6751e1a62..87a2f7d19ded9ab6783cb4204caba738a1f3e77e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -2194,119 +2194,6 @@ LayoutBlockFlow* LayoutBlock::nearestInnerBlockWithFirstLine() const
return nullptr;
}
-// Helper methods for obtaining the last line, computing line counts and heights for line counts
-// (crawling into blocks).
-static bool shouldCheckLines(LayoutObject* obj)
-{
- return !obj->isFloatingOrOutOfFlowPositioned()
- && obj->isLayoutBlock() && obj->style()->height().isAuto()
- && (!obj->isDeprecatedFlexibleBox() || obj->style()->boxOrient() == VERTICAL);
-}
-
-static int getHeightForLineCount(LayoutBlock* block, int lineCount, bool includeBottom, int& count)
-{
- if (block->style()->visibility() == VISIBLE) {
- if (block->isLayoutBlockFlow() && block->childrenInline()) {
- for (RootInlineBox* box = toLayoutBlockFlow(block)->firstRootBox(); box; box = box->nextRootBox()) {
- if (++count == lineCount)
- return box->lineBottom() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : LayoutUnit());
- }
- } else {
- LayoutBox* normalFlowChildWithoutLines = nullptr;
- for (LayoutBox* obj = block->firstChildBox(); obj; obj = obj->nextSiblingBox()) {
- if (shouldCheckLines(obj)) {
- int result = getHeightForLineCount(toLayoutBlock(obj), lineCount, false, count);
- if (result != -1)
- return result + obj->location().y() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : LayoutUnit());
- } else if (!obj->isFloatingOrOutOfFlowPositioned()) {
- normalFlowChildWithoutLines = obj;
- }
- }
- if (normalFlowChildWithoutLines && lineCount == 0)
- return normalFlowChildWithoutLines->location().y() + normalFlowChildWithoutLines->size().height();
- }
- }
-
- return -1;
-}
-
-RootInlineBox* LayoutBlock::lineAtIndex(int i) const
-{
- ASSERT(i >= 0);
-
- if (style()->visibility() != VISIBLE)
- return nullptr;
-
- if (childrenInline()) {
- for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) {
- if (!i--)
- return box;
- }
- } else {
- for (LayoutObject* child = firstChild(); child; child = child->nextSibling()) {
- if (!shouldCheckLines(child))
- continue;
- if (RootInlineBox* box = toLayoutBlock(child)->lineAtIndex(i))
- return box;
- }
- }
-
- return nullptr;
-}
-
-int LayoutBlock::lineCount(const RootInlineBox* stopRootInlineBox, bool* found) const
-{
- int count = 0;
-
- if (style()->visibility() == VISIBLE) {
- if (childrenInline()) {
- for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) {
- count++;
- if (box == stopRootInlineBox) {
- if (found)
- *found = true;
- break;
- }
- }
- } else {
- for (LayoutObject* obj = firstChild(); obj; obj = obj->nextSibling()) {
- if (shouldCheckLines(obj)) {
- bool recursiveFound = false;
- count += toLayoutBlock(obj)->lineCount(stopRootInlineBox, &recursiveFound);
- if (recursiveFound) {
- if (found)
- *found = true;
- break;
- }
- }
- }
- }
- }
- return count;
-}
-
-int LayoutBlock::heightForLineCount(int lineCount)
-{
- int count = 0;
- return getHeightForLineCount(this, lineCount, true, count);
-}
-
-void LayoutBlock::clearTruncation()
-{
- if (style()->visibility() == VISIBLE) {
- if (childrenInline() && hasMarkupTruncation()) {
- setHasMarkupTruncation(false);
- for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox())
- box->clearTruncation();
- } else {
- for (LayoutObject* obj = firstChild(); obj; obj = obj->nextSibling()) {
- if (shouldCheckLines(obj))
- toLayoutBlock(obj)->clearTruncation();
- }
- }
- }
-}
-
void LayoutBlock::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
{
// For blocks inside inlines, we go ahead and include margins so that we run right up to the
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698