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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 2667493002: Changed EPosition to an enum class and renamed its members (Closed)
Patch Set: Rebase Created 3 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. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
211 void LayoutBlock::styleDidChange(StyleDifference diff, 211 void LayoutBlock::styleDidChange(StyleDifference diff,
212 const ComputedStyle* oldStyle) { 212 const ComputedStyle* oldStyle) {
213 LayoutBox::styleDidChange(diff, oldStyle); 213 LayoutBox::styleDidChange(diff, oldStyle);
214 214
215 const ComputedStyle& newStyle = styleRef(); 215 const ComputedStyle& newStyle = styleRef();
216 216
217 if (oldStyle && parent()) { 217 if (oldStyle && parent()) {
218 if (oldStyle->position() != newStyle.position() && 218 if (oldStyle->position() != newStyle.position() &&
219 newStyle.position() != StaticPosition) { 219 newStyle.position() != EPosition::kStatic) {
220 // In LayoutObject::styleWillChange() we already removed ourself from our 220 // In LayoutObject::styleWillChange() we already removed ourself from our
221 // old containing block's positioned descendant list, and we will be 221 // old containing block's positioned descendant list, and we will be
222 // inserted to the new containing block's list during layout. However the 222 // inserted to the new containing block's list during layout. However the
223 // positioned descendant layout logic assumes layout objects to obey 223 // positioned descendant layout logic assumes layout objects to obey
224 // parent-child order in the list. Remove our descendants here so they 224 // parent-child order in the list. Remove our descendants here so they
225 // will be re-inserted after us. 225 // will be re-inserted after us.
226 if (LayoutBlock* cb = containingBlock()) { 226 if (LayoutBlock* cb = containingBlock()) {
227 cb->removePositionedObjects(this, NewContainingBlock); 227 cb->removePositionedObjects(this, NewContainingBlock);
228 if (isOutOfFlowPositioned()) { 228 if (isOutOfFlowPositioned()) {
229 // Insert this object into containing block's positioned descendants 229 // Insert this object into containing block's positioned descendants
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 511 }
512 512
513 void LayoutBlock::addOverflowFromPositionedObjects() { 513 void LayoutBlock::addOverflowFromPositionedObjects() {
514 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); 514 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects();
515 if (!positionedDescendants) 515 if (!positionedDescendants)
516 return; 516 return;
517 517
518 for (auto* positionedObject : *positionedDescendants) { 518 for (auto* positionedObject : *positionedDescendants) {
519 // Fixed positioned elements don't contribute to layout overflow, since they 519 // Fixed positioned elements don't contribute to layout overflow, since they
520 // don't scroll with the content. 520 // don't scroll with the content.
521 if (positionedObject->style()->position() != FixedPosition) 521 if (positionedObject->style()->position() != EPosition::kFixed)
522 addOverflowFromChild(positionedObject, 522 addOverflowFromChild(positionedObject,
523 toLayoutSize(positionedObject->location())); 523 toLayoutSize(positionedObject->location()));
524 } 524 }
525 } 525 }
526 526
527 void LayoutBlock::addVisualOverflowFromTheme() { 527 void LayoutBlock::addVisualOverflowFromTheme() {
528 if (!style()->hasAppearance()) 528 if (!style()->hasAppearance())
529 return; 529 return;
530 530
531 IntRect inflatedRect = pixelSnappedBorderBoxRect(); 531 IntRect inflatedRect = pixelSnappedBorderBoxRect();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 670
671 if (LayoutAnalyzer* analyzer = frameView()->layoutAnalyzer()) 671 if (LayoutAnalyzer* analyzer = frameView()->layoutAnalyzer())
672 analyzer->increment(LayoutAnalyzer::LayoutObjectsThatNeedSimplifiedLayout); 672 analyzer->increment(LayoutAnalyzer::LayoutObjectsThatNeedSimplifiedLayout);
673 673
674 return true; 674 return true;
675 } 675 }
676 676
677 void LayoutBlock::markFixedPositionObjectForLayoutIfNeeded( 677 void LayoutBlock::markFixedPositionObjectForLayoutIfNeeded(
678 LayoutObject* child, 678 LayoutObject* child,
679 SubtreeLayoutScope& layoutScope) { 679 SubtreeLayoutScope& layoutScope) {
680 if (child->style()->position() != FixedPosition) 680 if (child->style()->position() != EPosition::kFixed)
681 return; 681 return;
682 682
683 bool hasStaticBlockPosition = 683 bool hasStaticBlockPosition =
684 child->style()->hasStaticBlockPosition(isHorizontalWritingMode()); 684 child->style()->hasStaticBlockPosition(isHorizontalWritingMode());
685 bool hasStaticInlinePosition = 685 bool hasStaticInlinePosition =
686 child->style()->hasStaticInlinePosition(isHorizontalWritingMode()); 686 child->style()->hasStaticInlinePosition(isHorizontalWritingMode());
687 if (!hasStaticBlockPosition && !hasStaticInlinePosition) 687 if (!hasStaticBlockPosition && !hasStaticInlinePosition)
688 return; 688 return;
689 689
690 LayoutObject* o = child->parent(); 690 LayoutObject* o = child->parent();
691 while (o && !o->isLayoutView() && o->style()->position() != AbsolutePosition) 691 while (o && !o->isLayoutView() &&
692 o->style()->position() != EPosition::kAbsolute)
692 o = o->parent(); 693 o = o->parent();
693 // The LayoutView is absolute-positioned, but does not move. 694 // The LayoutView is absolute-positioned, but does not move.
694 if (o->isLayoutView()) 695 if (o->isLayoutView())
695 return; 696 return;
696 697
697 // We must compute child's width and height, but not update them now. 698 // We must compute child's width and height, but not update them now.
698 // The child will update its width and height when it gets laid out, and needs 699 // The child will update its width and height when it gets laid out, and needs
699 // to see them change there. 700 // to see them change there.
700 LayoutBox* box = toLayoutBox(child); 701 LayoutBox* box = toLayoutBox(child);
701 if (hasStaticInlinePosition) { 702 if (hasStaticInlinePosition) {
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 2053
2053 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); 2054 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects();
2054 if (!positionedDescendants) 2055 if (!positionedDescendants)
2055 return childrenOverflowChanged; 2056 return childrenOverflowChanged;
2056 2057
2057 for (auto* box : *positionedDescendants) { 2058 for (auto* box : *positionedDescendants) {
2058 if (!box->needsOverflowRecalcAfterStyleChange()) 2059 if (!box->needsOverflowRecalcAfterStyleChange())
2059 continue; 2060 continue;
2060 LayoutBlock* block = toLayoutBlock(box); 2061 LayoutBlock* block = toLayoutBlock(box);
2061 if (!block->recalcOverflowAfterStyleChange() || 2062 if (!block->recalcOverflowAfterStyleChange() ||
2062 box->style()->position() == FixedPosition) 2063 box->style()->position() == EPosition::kFixed)
2063 continue; 2064 continue;
2064 2065
2065 childrenOverflowChanged = true; 2066 childrenOverflowChanged = true;
2066 } 2067 }
2067 return childrenOverflowChanged; 2068 return childrenOverflowChanged;
2068 } 2069 }
2069 2070
2070 bool LayoutBlock::recalcOverflowAfterStyleChange() { 2071 bool LayoutBlock::recalcOverflowAfterStyleChange() {
2071 ASSERT(needsOverflowRecalcAfterStyleChange()); 2072 ASSERT(needsOverflowRecalcAfterStyleChange());
2072 2073
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 } 2215 }
2215 2216
2216 return availableHeight; 2217 return availableHeight;
2217 } 2218 }
2218 2219
2219 bool LayoutBlock::hasDefiniteLogicalHeight() const { 2220 bool LayoutBlock::hasDefiniteLogicalHeight() const {
2220 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); 2221 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1);
2221 } 2222 }
2222 2223
2223 } // namespace blink 2224 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698