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

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

Issue 157553002: Remove the Pagination struct, clean up viewport scroll policy propagation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
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 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colG ap; 3384 desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colG ap;
3385 } else { 3385 } else {
3386 desiredColumnCount = max<LayoutUnit>(min<LayoutUnit>(colCount, (availWid th + colGap) / (colWidth + colGap)), 1); 3386 desiredColumnCount = max<LayoutUnit>(min<LayoutUnit>(colCount, (availWid th + colGap) / (colWidth + colGap)), 1);
3387 desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colG ap; 3387 desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colG ap;
3388 } 3388 }
3389 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); 3389 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth);
3390 } 3390 }
3391 3391
3392 bool RenderBlock::requiresColumns(int desiredColumnCount) const 3392 bool RenderBlock::requiresColumns(int desiredColumnCount) const
3393 { 3393 {
3394 // If overflow-y is set to paged-x or paged-y on the body or html element, w e'll handle the paginating 3394 // Paged overflow is treated as multicol here, unless this element was the o ne that got its
3395 // in the RenderView instead. 3395 // overflow propagated to the viewport.
3396 bool isPaginated = (style()->overflowY() == OPAGEDX || style()->overflowY() == OPAGEDY) && !(isRoot() || isBody()); 3396 bool isPaginated = style()->isOverflowPaged() && node() != document().viewpo rtDefiningElement();
3397 3397
3398 return firstChild() 3398 return firstChild()
3399 && (desiredColumnCount != 1 || !style()->hasAutoColumnWidth() || !style( )->hasInlineColumnAxis() || isPaginated) 3399 && (desiredColumnCount != 1 || !style()->hasAutoColumnWidth() || !style( )->hasInlineColumnAxis() || isPaginated)
3400 && !firstChild()->isAnonymousColumnsBlock() 3400 && !firstChild()->isAnonymousColumnsBlock()
3401 && !firstChild()->isAnonymousColumnSpanBlock(); 3401 && !firstChild()->isAnonymousColumnSpanBlock();
3402 } 3402 }
3403 3403
3404 void RenderBlock::setDesiredColumnCountAndWidth(int count, LayoutUnit width) 3404 void RenderBlock::setDesiredColumnCountAndWidth(int count, LayoutUnit width)
3405 { 3405 {
3406 bool destroyColumns = !requiresColumns(count); 3406 bool destroyColumns = !requiresColumns(count);
3407 if (destroyColumns) { 3407 if (destroyColumns) {
3408 if (hasColumns()) { 3408 if (hasColumns()) {
3409 gColumnInfoMap->take(this); 3409 gColumnInfoMap->take(this);
3410 setHasColumns(false); 3410 setHasColumns(false);
3411 } 3411 }
3412 } else { 3412 } else {
3413 ColumnInfo* info; 3413 ColumnInfo* info;
3414 if (hasColumns()) 3414 if (hasColumns())
3415 info = gColumnInfoMap->get(this); 3415 info = gColumnInfoMap->get(this);
3416 else { 3416 else {
3417 if (!gColumnInfoMap) 3417 if (!gColumnInfoMap)
3418 gColumnInfoMap = new ColumnInfoMap; 3418 gColumnInfoMap = new ColumnInfoMap;
3419 info = new ColumnInfo; 3419 info = new ColumnInfo;
3420 gColumnInfoMap->add(this, adoptPtr(info)); 3420 gColumnInfoMap->add(this, adoptPtr(info));
3421 setHasColumns(true); 3421 setHasColumns(true);
3422 } 3422 }
3423 info->setDesiredColumnCount(count);
3424 info->setDesiredColumnWidth(width); 3423 info->setDesiredColumnWidth(width);
3425 info->setProgressionAxis(style()->hasInlineColumnAxis() ? ColumnInfo::In lineAxis : ColumnInfo::BlockAxis); 3424 if (style()->isOverflowPaged()) {
3426 info->setProgressionIsReversed(style()->columnProgression() == ReverseCo lumnProgression); 3425 info->setProgressionAxis((style()->overflowY() == OPAGEDX) == style( )->isHorizontalWritingMode() ? ColumnInfo::InlineAxis : ColumnInfo::BlockAxis);
rune 2014/02/07 16:44:27 I find this hard to read. Would it be better with
mstensho (USE GERRIT) 2014/02/11 10:44:14 Done.
3426 } else {
3427 info->setDesiredColumnCount(count);
3428 info->setProgressionAxis(style()->hasInlineColumnAxis() ? ColumnInfo ::InlineAxis : ColumnInfo::BlockAxis);
3429 info->setProgressionIsReversed(style()->columnProgression() == Rever seColumnProgression);
3430 }
3427 } 3431 }
3428 } 3432 }
3429 3433
3430 void RenderBlock::updateColumnInfoFromStyle(RenderStyle* style) 3434 void RenderBlock::updateColumnInfoFromStyle(RenderStyle* style)
3431 { 3435 {
3432 if (!hasColumns()) 3436 if (!hasColumns())
3433 return; 3437 return;
3434 3438
3435 ColumnInfo* info = gColumnInfoMap->get(this); 3439 ColumnInfo* info = gColumnInfoMap->get(this);
3436 3440
(...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after
5641 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5645 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5642 { 5646 {
5643 showRenderObject(); 5647 showRenderObject();
5644 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5648 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5645 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5649 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5646 } 5650 }
5647 5651
5648 #endif 5652 #endif
5649 5653
5650 } // namespace WebCore 5654 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698