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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 return nullptr; // This can still happen in case of an orphaned tree 915 return nullptr; // This can still happen in case of an orphaned tree
916 916
917 return toLayoutBlock(object); 917 return toLayoutBlock(object);
918 } 918 }
919 919
920 LayoutBlock* LayoutObject::containingBlock(AncestorSkipInfo* skipInfo) const { 920 LayoutBlock* LayoutObject::containingBlock(AncestorSkipInfo* skipInfo) const {
921 LayoutObject* object = parent(); 921 LayoutObject* object = parent();
922 if (!object && isLayoutScrollbarPart()) 922 if (!object && isLayoutScrollbarPart())
923 object = toLayoutScrollbarPart(this)->scrollbarStyleSource(); 923 object = toLayoutScrollbarPart(this)->scrollbarStyleSource();
924 if (!isTextOrSVGChild()) { 924 if (!isTextOrSVGChild()) {
925 if (m_style->position() == FixedPosition) 925 if (m_style->position() == EPosition::kFixed)
926 return containerForFixedPosition(skipInfo); 926 return containerForFixedPosition(skipInfo);
927 if (m_style->position() == AbsolutePosition) 927 if (m_style->position() == EPosition::kAbsolute)
928 return containingBlockForAbsolutePosition(skipInfo); 928 return containingBlockForAbsolutePosition(skipInfo);
929 } 929 }
930 if (isColumnSpanAll()) { 930 if (isColumnSpanAll()) {
931 object = spannerPlaceholder()->containingBlock(); 931 object = spannerPlaceholder()->containingBlock();
932 } else { 932 } else {
933 while (object && ((object->isInline() && !object->isAtomicInlineLevel()) || 933 while (object && ((object->isInline() && !object->isAtomicInlineLevel()) ||
934 !object->isLayoutBlock())) { 934 !object->isLayoutBlock())) {
935 if (skipInfo) 935 if (skipInfo)
936 skipInfo->update(*object); 936 skipInfo->update(*object);
937 object = object->parent(); 937 object = object->parent();
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 // There can't be a transform between |ancestor| and |o|, because transforms 2108 // There can't be a transform between |ancestor| and |o|, because transforms
2109 // create containers, so it should be safe to just subtract the delta 2109 // create containers, so it should be safe to just subtract the delta
2110 // between the ancestor and |o|. 2110 // between the ancestor and |o|.
2111 LayoutSize containerOffset = 2111 LayoutSize containerOffset =
2112 ancestor->offsetFromAncestorContainer(container); 2112 ancestor->offsetFromAncestorContainer(container);
2113 transformState.move(-containerOffset.width(), -containerOffset.height(), 2113 transformState.move(-containerOffset.width(), -containerOffset.height(),
2114 preserve3D ? TransformState::AccumulateTransform 2114 preserve3D ? TransformState::AccumulateTransform
2115 : TransformState::FlattenTransform); 2115 : TransformState::FlattenTransform);
2116 // If the ancestor is fixed, then the rect is already in its coordinates so 2116 // If the ancestor is fixed, then the rect is already in its coordinates so
2117 // doesn't need viewport-adjusting. 2117 // doesn't need viewport-adjusting.
2118 if (ancestor->style()->position() != FixedPosition && 2118 if (ancestor->style()->position() != EPosition::kFixed &&
2119 container->isLayoutView() && styleRef().position() == FixedPosition) { 2119 container->isLayoutView() &&
2120 styleRef().position() == EPosition::kFixed) {
2120 LayoutSize adjustment = toLayoutView(container)->offsetForFixedPosition(); 2121 LayoutSize adjustment = toLayoutView(container)->offsetForFixedPosition();
2121 transformState.move(adjustment.width(), adjustment.height()); 2122 transformState.move(adjustment.width(), adjustment.height());
2122 } 2123 }
2123 return; 2124 return;
2124 } 2125 }
2125 2126
2126 container->mapLocalToAncestor(ancestor, transformState, mode); 2127 container->mapLocalToAncestor(ancestor, transformState, mode);
2127 } 2128 }
2128 2129
2129 const LayoutObject* LayoutObject::pushMappingToContainer( 2130 const LayoutObject* LayoutObject::pushMappingToContainer(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 transformState.move( 2188 transformState.move(
2188 centerPoint - 2189 centerPoint -
2189 toLayoutBox(container)->flipForWritingMode(LayoutPoint(centerPoint))); 2190 toLayoutBox(container)->flipForWritingMode(LayoutPoint(centerPoint)));
2190 } 2191 }
2191 2192
2192 if (skipInfo.ancestorSkipped()) { 2193 if (skipInfo.ancestorSkipped()) {
2193 containerOffset = ancestor->offsetFromAncestorContainer(container); 2194 containerOffset = ancestor->offsetFromAncestorContainer(container);
2194 transformState.move(-containerOffset.width(), -containerOffset.height()); 2195 transformState.move(-containerOffset.width(), -containerOffset.height());
2195 // If the ancestor is fixed, then the rect is already in its coordinates so 2196 // If the ancestor is fixed, then the rect is already in its coordinates so
2196 // doesn't need viewport-adjusting. 2197 // doesn't need viewport-adjusting.
2197 if (ancestor->style()->position() != FixedPosition && 2198 if (ancestor->style()->position() != EPosition::kFixed &&
2198 container->isLayoutView() && styleRef().position() == FixedPosition) { 2199 container->isLayoutView() &&
2200 styleRef().position() == EPosition::kFixed) {
2199 LayoutSize adjustment = toLayoutView(container)->offsetForFixedPosition(); 2201 LayoutSize adjustment = toLayoutView(container)->offsetForFixedPosition();
2200 transformState.move(adjustment.width(), adjustment.height()); 2202 transformState.move(adjustment.width(), adjustment.height());
2201 } 2203 }
2202 } 2204 }
2203 } 2205 }
2204 2206
2205 bool LayoutObject::shouldUseTransformFromContainer( 2207 bool LayoutObject::shouldUseTransformFromContainer(
2206 const LayoutObject* containerObject) const { 2208 const LayoutObject* containerObject) const {
2207 // hasTransform() indicates whether the object has transform, transform-style 2209 // hasTransform() indicates whether the object has transform, transform-style
2208 // or perspective. We just care about transform, so check the layer's 2210 // or perspective. We just care about transform, so check the layer's
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 LayoutObject* LayoutObject::container(AncestorSkipInfo* skipInfo) const { 2480 LayoutObject* LayoutObject::container(AncestorSkipInfo* skipInfo) const {
2479 // TODO(mstensho): Get rid of this. Nobody should call this method with those 2481 // TODO(mstensho): Get rid of this. Nobody should call this method with those
2480 // flags already set. 2482 // flags already set.
2481 if (skipInfo) 2483 if (skipInfo)
2482 skipInfo->resetOutput(); 2484 skipInfo->resetOutput();
2483 2485
2484 if (isTextOrSVGChild()) 2486 if (isTextOrSVGChild())
2485 return parent(); 2487 return parent();
2486 2488
2487 EPosition pos = m_style->position(); 2489 EPosition pos = m_style->position();
2488 if (pos == FixedPosition) 2490 if (pos == EPosition::kFixed)
2489 return containerForFixedPosition(skipInfo); 2491 return containerForFixedPosition(skipInfo);
2490 2492
2491 if (pos == AbsolutePosition) { 2493 if (pos == EPosition::kAbsolute) {
2492 return containerForAbsolutePosition(skipInfo); 2494 return containerForAbsolutePosition(skipInfo);
2493 } 2495 }
2494 2496
2495 if (isColumnSpanAll()) { 2497 if (isColumnSpanAll()) {
2496 LayoutObject* multicolContainer = spannerPlaceholder()->container(); 2498 LayoutObject* multicolContainer = spannerPlaceholder()->container();
2497 if (skipInfo) { 2499 if (skipInfo) {
2498 // We jumped directly from the spanner to the multicol container. Need to 2500 // We jumped directly from the spanner to the multicol container. Need to
2499 // check if we skipped |ancestor| or filter/reflection on the way. 2501 // check if we skipped |ancestor| or filter/reflection on the way.
2500 for (LayoutObject* walker = parent(); 2502 for (LayoutObject* walker = parent();
2501 walker && walker != multicolContainer; walker = walker->parent()) 2503 walker && walker != multicolContainer; walker = walker->parent())
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
3497 const blink::LayoutObject* root = object1; 3499 const blink::LayoutObject* root = object1;
3498 while (root->parent()) 3500 while (root->parent())
3499 root = root->parent(); 3501 root = root->parent();
3500 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3502 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3501 } else { 3503 } else {
3502 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3504 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3503 } 3505 }
3504 } 3506 }
3505 3507
3506 #endif 3508 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698