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

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

Issue 1516003003: Merge LayoutInline::mapLocalToAncestor() into LayoutObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review constness + bonus constness Created 4 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1148
1149 return offset; 1149 return offset;
1150 } 1150 }
1151 1151
1152 PaintLayerType LayoutInline::layerTypeRequired() const 1152 PaintLayerType LayoutInline::layerTypeRequired() const
1153 { 1153 {
1154 return isInFlowPositioned() || createsGroup() || hasClipPath() || style()->s houldCompositeForCurrentAnimations() 1154 return isInFlowPositioned() || createsGroup() || hasClipPath() || style()->s houldCompositeForCurrentAnimations()
1155 || style()->hasCompositorProxy() || style()->containsPaint() ? NormalPa intLayer : NoPaintLayer; 1155 || style()->hasCompositorProxy() || style()->containsPaint() ? NormalPa intLayer : NoPaintLayer;
1156 } 1156 }
1157 1157
1158 void LayoutInline::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Tran sformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const Pain tInvalidationState* paintInvalidationState) const
1159 {
1160 if (ancestor == this)
1161 return;
1162
1163 if (paintInvalidationState && paintInvalidationState->canMapToContainer(ance stor)) {
1164 LayoutSize offset = paintInvalidationState->paintOffset();
1165 if (style()->hasInFlowPosition() && layer())
1166 offset += layer()->offsetForInFlowPosition();
1167 transformState.move(offset);
1168 return;
1169 }
1170
1171 bool containerSkipped;
1172 LayoutObject* o = container(ancestor, &containerSkipped);
1173 if (!o)
1174 return;
1175
1176 if (mode & ApplyContainerFlip && o->isBox()) {
1177 if (o->style()->isFlippedBlocksWritingMode()) {
1178 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()) ;
1179 transformState.move(toLayoutBox(o)->flipForWritingMode(LayoutPoint(c enterPoint)) - centerPoint);
1180 }
1181 mode &= ~ApplyContainerFlip;
1182 }
1183
1184 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans formState.mappedPoint()));
1185
1186 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D());
1187 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) {
1188 TransformationMatrix t;
1189 getTransformFromContainer(o, containerOffset, t);
1190 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform);
1191 } else {
1192 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm);
1193 }
1194
1195 if (containerSkipped) {
1196 // There can't be a transform between paintInvalidationContainer and o, because transforms create containers, so it should be safe
1197 // to just subtract the delta between the paintInvalidationContainer and o.
1198 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(o);
1199 transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans form);
1200 return;
1201 }
1202
1203 o->mapLocalToAncestor(ancestor, transformState, mode, wasFixed, paintInvalid ationState);
1204 }
1205
1206 void LayoutInline::updateDragState(bool dragOn) 1158 void LayoutInline::updateDragState(bool dragOn)
1207 { 1159 {
1208 LayoutBoxModelObject::updateDragState(dragOn); 1160 LayoutBoxModelObject::updateDragState(dragOn);
1209 if (LayoutBoxModelObject* continuation = this->continuation()) 1161 if (LayoutBoxModelObject* continuation = this->continuation())
1210 continuation->updateDragState(dragOn); 1162 continuation->updateDragState(dragOn);
1211 } 1163 }
1212 1164
1213 void LayoutInline::childBecameNonInline(LayoutObject* child) 1165 void LayoutInline::childBecameNonInline(LayoutObject* child)
1214 { 1166 {
1215 // We have to split the parent flow. 1167 // We have to split the parent flow.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 1386
1435 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1387 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1436 { 1388 {
1437 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); 1389 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason);
1438 1390
1439 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1391 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1440 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1392 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1441 } 1393 }
1442 1394
1443 } // namespace blink 1395 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutInline.h ('k') | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698