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

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: Rebase master 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
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBox.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) 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()->hasInlinePaginationAxis() ? Column Info::InlineAxis : ColumnInfo::BlockAxis);
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)
3431 {
3432 if (!hasColumns())
3433 return;
3434
3435 ColumnInfo* info = gColumnInfoMap->get(this);
3436
3437 bool needsLayout = false;
3438 ColumnInfo::Axis oldAxis = info->progressionAxis();
3439 ColumnInfo::Axis newAxis = style->hasInlineColumnAxis() ? ColumnInfo::Inline Axis : ColumnInfo::BlockAxis;
3440 if (oldAxis != newAxis) {
3441 info->setProgressionAxis(newAxis);
3442 needsLayout = true;
3443 }
3444
3445 bool oldProgressionIsReversed = info->progressionIsReversed();
3446 bool newProgressionIsReversed = style->columnProgression() == ReverseColumnP rogression;
3447 if (oldProgressionIsReversed != newProgressionIsReversed) {
3448 info->setProgressionIsReversed(newProgressionIsReversed);
3449 needsLayout = true;
3450 }
3451
3452 if (needsLayout)
3453 setNeedsLayoutAndPrefWidthsRecalc();
3454 }
3455
3456 LayoutUnit RenderBlock::desiredColumnWidth() const 3434 LayoutUnit RenderBlock::desiredColumnWidth() const
3457 { 3435 {
3458 if (!hasColumns()) 3436 if (!hasColumns())
3459 return contentLogicalWidth(); 3437 return contentLogicalWidth();
3460 return gColumnInfoMap->get(this)->desiredColumnWidth(); 3438 return gColumnInfoMap->get(this)->desiredColumnWidth();
3461 } 3439 }
3462 3440
3463 ColumnInfo* RenderBlock::columnInfo() const 3441 ColumnInfo* RenderBlock::columnInfo() const
3464 { 3442 {
3465 if (!hasColumns()) 3443 if (!hasColumns())
(...skipping 2175 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 5619 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5642 { 5620 {
5643 showRenderObject(); 5621 showRenderObject();
5644 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5622 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5645 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5623 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5646 } 5624 }
5647 5625
5648 #endif 5626 #endif
5649 5627
5650 } // namespace WebCore 5628 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698