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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: 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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 object = toLayoutScrollbarPart(this)->scrollbarStyleSource(); 919 object = toLayoutScrollbarPart(this)->scrollbarStyleSource();
920 if (!isTextOrSVGChild()) { 920 if (!isTextOrSVGChild()) {
921 if (m_style->position() == EPosition::kFixed) 921 if (m_style->position() == EPosition::kFixed)
922 return containerForFixedPosition(skipInfo); 922 return containerForFixedPosition(skipInfo);
923 if (m_style->position() == EPosition::kAbsolute) 923 if (m_style->position() == EPosition::kAbsolute)
924 return containingBlockForAbsolutePosition(skipInfo); 924 return containingBlockForAbsolutePosition(skipInfo);
925 } 925 }
926 if (isColumnSpanAll()) { 926 if (isColumnSpanAll()) {
927 object = spannerPlaceholder()->containingBlock(); 927 object = spannerPlaceholder()->containingBlock();
928 } else { 928 } else {
929 while (object && ((object->isInline() && !object->isAtomicInlineLevel()) || 929 while (object &&
930 !object->isLayoutBlock())) { 930 ((object->isInline() && !object->isAtomicInlineLevel()) ||
931 !object->isLayoutBlock())) {
931 if (skipInfo) 932 if (skipInfo)
932 skipInfo->update(*object); 933 skipInfo->update(*object);
933 object = object->parent(); 934 object = object->parent();
934 } 935 }
935 } 936 }
936 937
937 if (!object || !object->isLayoutBlock()) 938 if (!object || !object->isLayoutBlock())
938 return nullptr; // This can still happen in case of an orphaned tree 939 return nullptr; // This can still happen in case of an orphaned tree
939 940
940 return toLayoutBlock(object); 941 return toLayoutBlock(object);
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 if (!isSVGRoot()) 1457 if (!isSVGRoot())
1457 diff.setNeedsFullLayout(); 1458 diff.setNeedsFullLayout();
1458 } 1459 }
1459 1460
1460 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1461 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1461 // If transform changed, and the layer does not paint into its own separate 1462 // If transform changed, and the layer does not paint into its own separate
1462 // backing, then we need to invalidate paints. 1463 // backing, then we need to invalidate paints.
1463 if (diff.transformChanged()) { 1464 if (diff.transformChanged()) {
1464 // Text nodes share style with their parents but transforms don't apply to 1465 // Text nodes share style with their parents but transforms don't apply to
1465 // them, hence the !isText() check. 1466 // them, hence the !isText() check.
1466 if (!isText() && (!hasLayer() || 1467 if (!isText() &&
1467 !toLayoutBoxModelObject(this) 1468 (!hasLayer() ||
1468 ->layer() 1469 !toLayoutBoxModelObject(this)
1469 ->hasStyleDeterminedDirectCompositingReasons())) 1470 ->layer()
1471 ->hasStyleDeterminedDirectCompositingReasons()))
1470 diff.setNeedsPaintInvalidationSubtree(); 1472 diff.setNeedsPaintInvalidationSubtree();
1471 } 1473 }
1472 1474
1473 // If opacity or zIndex changed, and the layer does not paint into its own 1475 // If opacity or zIndex changed, and the layer does not paint into its own
1474 // separate backing, then we need to invalidate paints (also 1476 // separate backing, then we need to invalidate paints (also
1475 // ignoring text nodes). 1477 // ignoring text nodes).
1476 if (diff.opacityChanged() || diff.zIndexChanged()) { 1478 if (diff.opacityChanged() || diff.zIndexChanged()) {
1477 if (!isText() && (!hasLayer() || 1479 if (!isText() &&
1478 !toLayoutBoxModelObject(this) 1480 (!hasLayer() ||
1479 ->layer() 1481 !toLayoutBoxModelObject(this)
1480 ->hasStyleDeterminedDirectCompositingReasons())) 1482 ->layer()
1483 ->hasStyleDeterminedDirectCompositingReasons()))
1481 diff.setNeedsPaintInvalidationSubtree(); 1484 diff.setNeedsPaintInvalidationSubtree();
1482 } 1485 }
1483 1486
1484 // If filter changed, and the layer does not paint into its own separate 1487 // If filter changed, and the layer does not paint into its own separate
1485 // backing or it paints with filters, then we need to invalidate paints. 1488 // backing or it paints with filters, then we need to invalidate paints.
1486 if (diff.filterChanged() && hasLayer()) { 1489 if (diff.filterChanged() && hasLayer()) {
1487 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); 1490 PaintLayer* layer = toLayoutBoxModelObject(this)->layer();
1488 if (!layer->hasStyleDeterminedDirectCompositingReasons() || 1491 if (!layer->hasStyleDeterminedDirectCompositingReasons() ||
1489 layer->paintsWithFilters()) 1492 layer->paintsWithFilters())
1490 diff.setNeedsPaintInvalidationSubtree(); 1493 diff.setNeedsPaintInvalidationSubtree();
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 } 1817 }
1815 1818
1816 static bool areNonIdenticalCursorListsEqual(const ComputedStyle* a, 1819 static bool areNonIdenticalCursorListsEqual(const ComputedStyle* a,
1817 const ComputedStyle* b) { 1820 const ComputedStyle* b) {
1818 ASSERT(a->cursors() != b->cursors()); 1821 ASSERT(a->cursors() != b->cursors());
1819 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors(); 1822 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors();
1820 } 1823 }
1821 1824
1822 static inline bool areCursorsEqual(const ComputedStyle* a, 1825 static inline bool areCursorsEqual(const ComputedStyle* a,
1823 const ComputedStyle* b) { 1826 const ComputedStyle* b) {
1824 return a->cursor() == b->cursor() && (a->cursors() == b->cursors() || 1827 return a->cursor() == b->cursor() &&
1825 areNonIdenticalCursorListsEqual(a, b)); 1828 (a->cursors() == b->cursors() ||
1829 areNonIdenticalCursorListsEqual(a, b));
1826 } 1830 }
1827 1831
1828 void LayoutObject::setScrollAnchorDisablingStyleChangedOnAncestor() { 1832 void LayoutObject::setScrollAnchorDisablingStyleChangedOnAncestor() {
1829 // Walk up the parent chain and find the first scrolling block to disable 1833 // Walk up the parent chain and find the first scrolling block to disable
1830 // scroll anchoring on. 1834 // scroll anchoring on.
1831 LayoutObject* object = parent(); 1835 LayoutObject* object = parent();
1832 Element* viewportDefiningElement = document().viewportDefiningElement(); 1836 Element* viewportDefiningElement = document().viewportDefiningElement();
1833 while (object) { 1837 while (object) {
1834 if (object->isLayoutBlock()) { 1838 if (object->isLayoutBlock()) {
1835 LayoutBlock* block = toLayoutBlock(object); 1839 LayoutBlock* block = toLayoutBlock(object);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 2088
2085 // Text objects just copy their parent's computed style, so we need to ignore 2089 // Text objects just copy their parent's computed style, so we need to ignore
2086 // them. 2090 // them.
2087 bool preserve3D = 2091 bool preserve3D =
2088 mode & UseTransforms && 2092 mode & UseTransforms &&
2089 ((container->style()->preserves3D() && !container->isText()) || 2093 ((container->style()->preserves3D() && !container->isText()) ||
2090 (style()->preserves3D() && !isText())); 2094 (style()->preserves3D() && !isText()));
2091 if (mode & UseTransforms && shouldUseTransformFromContainer(container)) { 2095 if (mode & UseTransforms && shouldUseTransformFromContainer(container)) {
2092 TransformationMatrix t; 2096 TransformationMatrix t;
2093 getTransformFromContainer(container, containerOffset, t); 2097 getTransformFromContainer(container, containerOffset, t);
2094 transformState.applyTransform(t, preserve3D 2098 transformState.applyTransform(t,
2095 ? TransformState::AccumulateTransform 2099 preserve3D
2096 : TransformState::FlattenTransform); 2100 ? TransformState::AccumulateTransform
2101 : TransformState::FlattenTransform);
2097 } else { 2102 } else {
2098 transformState.move(containerOffset.width(), containerOffset.height(), 2103 transformState.move(containerOffset.width(), containerOffset.height(),
2099 preserve3D ? TransformState::AccumulateTransform 2104 preserve3D ? TransformState::AccumulateTransform
2100 : TransformState::FlattenTransform); 2105 : TransformState::FlattenTransform);
2101 } 2106 }
2102 2107
2103 if (skipInfo.ancestorSkipped()) { 2108 if (skipInfo.ancestorSkipped()) {
2104 // There can't be a transform between |ancestor| and |o|, because transforms 2109 // There can't be a transform between |ancestor| and |o|, because transforms
2105 // create containers, so it should be safe to just subtract the delta 2110 // create containers, so it should be safe to just subtract the delta
2106 // between the ancestor and |o|. 2111 // between the ancestor and |o|.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 if (!skipInfo.ancestorSkipped()) 2159 if (!skipInfo.ancestorSkipped())
2155 container->mapAncestorToLocal(ancestor, transformState, mode); 2160 container->mapAncestorToLocal(ancestor, transformState, mode);
2156 2161
2157 LayoutSize containerOffset = offsetFromContainer(container); 2162 LayoutSize containerOffset = offsetFromContainer(container);
2158 bool preserve3D = 2163 bool preserve3D =
2159 mode & UseTransforms && 2164 mode & UseTransforms &&
2160 (container->style()->preserves3D() || style()->preserves3D()); 2165 (container->style()->preserves3D() || style()->preserves3D());
2161 if (mode & UseTransforms && shouldUseTransformFromContainer(container)) { 2166 if (mode & UseTransforms && shouldUseTransformFromContainer(container)) {
2162 TransformationMatrix t; 2167 TransformationMatrix t;
2163 getTransformFromContainer(container, containerOffset, t); 2168 getTransformFromContainer(container, containerOffset, t);
2164 transformState.applyTransform(t, preserve3D 2169 transformState.applyTransform(t,
2165 ? TransformState::AccumulateTransform 2170 preserve3D
2166 : TransformState::FlattenTransform); 2171 ? TransformState::AccumulateTransform
2172 : TransformState::FlattenTransform);
2167 } else { 2173 } else {
2168 transformState.move(containerOffset.width(), containerOffset.height(), 2174 transformState.move(containerOffset.width(), containerOffset.height(),
2169 preserve3D ? TransformState::AccumulateTransform 2175 preserve3D ? TransformState::AccumulateTransform
2170 : TransformState::FlattenTransform); 2176 : TransformState::FlattenTransform);
2171 } 2177 }
2172 2178
2173 if (isLayoutFlowThread()) { 2179 if (isLayoutFlowThread()) {
2174 // Descending into a flow thread. Convert to the local coordinate space, 2180 // Descending into a flow thread. Convert to the local coordinate space,
2175 // i.e. flow thread coordinates. 2181 // i.e. flow thread coordinates.
2176 LayoutPoint visualPoint = LayoutPoint(transformState.mappedPoint()); 2182 LayoutPoint visualPoint = LayoutPoint(transformState.mappedPoint());
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 const blink::LayoutObject* root = object1; 3501 const blink::LayoutObject* root = object1;
3496 while (root->parent()) 3502 while (root->parent())
3497 root = root->parent(); 3503 root = root->parent();
3498 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3504 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3499 } else { 3505 } else {
3500 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3506 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3501 } 3507 }
3502 } 3508 }
3503 3509
3504 #endif 3510 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutReplaced.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698