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

Side by Side Diff: sky/engine/core/rendering/RenderObject.cpp

Issue 953673002: Delete RenderLayerModelObject. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderView.h » ('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) 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. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 RenderLayer*& beforeChild) 305 RenderLayer*& beforeChild)
306 { 306 {
307 if (obj->hasLayer()) { 307 if (obj->hasLayer()) {
308 if (!beforeChild && newObject) { 308 if (!beforeChild && newObject) {
309 // We need to figure out the layer that follows newObject. We only d o 309 // We need to figure out the layer that follows newObject. We only d o
310 // this the first time we find a child layer, and then we update the 310 // this the first time we find a child layer, and then we update the
311 // pointer values for newObject and beforeChild used by everyone els e. 311 // pointer values for newObject and beforeChild used by everyone els e.
312 beforeChild = newObject->parent()->findNextLayer(parentLayer, newObj ect); 312 beforeChild = newObject->parent()->findNextLayer(parentLayer, newObj ect);
313 newObject = 0; 313 newObject = 0;
314 } 314 }
315 parentLayer->addChild(toRenderLayerModelObject(obj)->layer(), beforeChil d); 315 parentLayer->addChild(toRenderBox(obj)->layer(), beforeChild);
316 return; 316 return;
317 } 317 }
318 318
319 for (RenderObject* curr = obj->slowFirstChild(); curr; curr = curr->nextSibl ing()) 319 for (RenderObject* curr = obj->slowFirstChild(); curr; curr = curr->nextSibl ing())
320 addLayers(curr, parentLayer, newObject, beforeChild); 320 addLayers(curr, parentLayer, newObject, beforeChild);
321 } 321 }
322 322
323 void RenderObject::addLayers(RenderLayer* parentLayer) 323 void RenderObject::addLayers(RenderLayer* parentLayer)
324 { 324 {
325 if (!parentLayer) 325 if (!parentLayer)
326 return; 326 return;
327 327
328 RenderObject* object = this; 328 RenderObject* object = this;
329 RenderLayer* beforeChild = 0; 329 RenderLayer* beforeChild = 0;
330 blink::addLayers(this, parentLayer, object, beforeChild); 330 blink::addLayers(this, parentLayer, object, beforeChild);
331 } 331 }
332 332
333 void RenderObject::removeLayers(RenderLayer* parentLayer) 333 void RenderObject::removeLayers(RenderLayer* parentLayer)
334 { 334 {
335 if (!parentLayer) 335 if (!parentLayer)
336 return; 336 return;
337 337
338 if (hasLayer()) { 338 if (hasLayer()) {
339 parentLayer->removeChild(toRenderLayerModelObject(this)->layer()); 339 parentLayer->removeChild(toRenderBox(this)->layer());
340 return; 340 return;
341 } 341 }
342 342
343 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() ) 343 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
344 curr->removeLayers(parentLayer); 344 curr->removeLayers(parentLayer);
345 } 345 }
346 346
347 void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent) 347 void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent)
348 { 348 {
349 if (!newParent) 349 if (!newParent)
350 return; 350 return;
351 351
352 if (hasLayer()) { 352 if (hasLayer()) {
353 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); 353 RenderLayer* layer = toRenderBox(this)->layer();
354 ASSERT(oldParent == layer->parent()); 354 ASSERT(oldParent == layer->parent());
355 if (oldParent) 355 if (oldParent)
356 oldParent->removeChild(layer); 356 oldParent->removeChild(layer);
357 newParent->addChild(layer); 357 newParent->addChild(layer);
358 return; 358 return;
359 } 359 }
360 360
361 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() ) 361 for (RenderObject* curr = slowFirstChild(); curr; curr = curr->nextSibling() )
362 curr->moveLayers(oldParent, newParent); 362 curr->moveLayers(oldParent, newParent);
363 } 363 }
364 364
365 RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, 365 RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint,
366 bool checkParent) 366 bool checkParent)
367 { 367 {
368 // Error check the parent layer passed in. If it's null, we can't find anyth ing. 368 // Error check the parent layer passed in. If it's null, we can't find anyth ing.
369 if (!parentLayer) 369 if (!parentLayer)
370 return 0; 370 return 0;
371 371
372 // Step 1: If our layer is a child of the desired parent, then return our la yer. 372 // Step 1: If our layer is a child of the desired parent, then return our la yer.
373 RenderLayer* ourLayer = hasLayer() ? toRenderLayerModelObject(this)->layer() : 0; 373 RenderLayer* ourLayer = hasLayer() ? toRenderBox(this)->layer() : 0;
374 if (ourLayer && ourLayer->parent() == parentLayer) 374 if (ourLayer && ourLayer->parent() == parentLayer)
375 return ourLayer; 375 return ourLayer;
376 376
377 // Step 2: If we don't have a layer, or our layer is the desired parent, the n descend 377 // Step 2: If we don't have a layer, or our layer is the desired parent, the n descend
378 // into our siblings trying to find the next layer whose parent is the desir ed parent. 378 // into our siblings trying to find the next layer whose parent is the desir ed parent.
379 if (!ourLayer || ourLayer == parentLayer) { 379 if (!ourLayer || ourLayer == parentLayer) {
380 for (RenderObject* curr = startPoint ? startPoint->nextSibling() : slowF irstChild(); 380 for (RenderObject* curr = startPoint ? startPoint->nextSibling() : slowF irstChild();
381 curr; curr = curr->nextSibling()) { 381 curr; curr = curr->nextSibling()) {
382 RenderLayer* nextLayer = curr->findNextLayer(parentLayer, 0, false); 382 RenderLayer* nextLayer = curr->findNextLayer(parentLayer, 0, false);
383 if (nextLayer) 383 if (nextLayer)
(...skipping 11 matching lines...) Expand all
395 if (checkParent && parent()) 395 if (checkParent && parent())
396 return parent()->findNextLayer(parentLayer, this, true); 396 return parent()->findNextLayer(parentLayer, this, true);
397 397
398 return 0; 398 return 0;
399 } 399 }
400 400
401 RenderLayer* RenderObject::enclosingLayer() const 401 RenderLayer* RenderObject::enclosingLayer() const
402 { 402 {
403 for (const RenderObject* current = this; current; current = current->parent( )) { 403 for (const RenderObject* current = this; current; current = current->parent( )) {
404 if (current->hasLayer()) 404 if (current->hasLayer())
405 return toRenderLayerModelObject(current)->layer(); 405 return toRenderBox(current)->layer();
406 } 406 }
407 // FIXME: We should remove the one caller that triggers this case and make 407 // FIXME: We should remove the one caller that triggers this case and make
408 // this function return a reference. 408 // this function return a reference.
409 ASSERT(!m_parent && !isRenderView()); 409 ASSERT(!m_parent && !isRenderView());
410 return 0; 410 return 0;
411 } 411 }
412 412
413 RenderBox* RenderObject::enclosingBox() const 413 RenderBox* RenderObject::enclosingBox() const
414 { 414 {
415 RenderObject* curr = const_cast<RenderObject*>(this); 415 RenderObject* curr = const_cast<RenderObject*>(this);
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 936
937 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, leftInner, bottomOu ter, BSLeft, outlineColor, outlineStyle, outlineWidth, outlineWidth); 937 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, leftInner, bottomOu ter, BSLeft, outlineColor, outlineStyle, outlineWidth, outlineWidth);
938 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, rightOuter, topInne r, BSTop, outlineColor, outlineStyle, outlineWidth, outlineWidth); 938 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, rightOuter, topInne r, BSTop, outlineColor, outlineStyle, outlineWidth, outlineWidth);
939 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth); 939 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth);
940 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth); 940 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth);
941 941
942 if (useTransparencyLayer) 942 if (useTransparencyLayer)
943 graphicsContext->endLayer(); 943 graphicsContext->endLayer();
944 } 944 }
945 945
946 void RenderObject::addChildFocusRingRects(Vector<IntRect>& rects, const LayoutPo int& additionalOffset, const RenderLayerModelObject* paintContainer) const 946 void RenderObject::addChildFocusRingRects(Vector<IntRect>& rects, const LayoutPo int& additionalOffset, const RenderBox* paintContainer) const
947 { 947 {
948 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling()) { 948 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling()) {
949 if (current->isText()) 949 if (current->isText())
950 continue; 950 continue;
951 951
952 if (current->isBox()) { 952 if (current->isBox()) {
953 RenderBox* box = toRenderBox(current); 953 RenderBox* box = toRenderBox(current);
954 if (box->hasLayer()) { 954 if (box->hasLayer()) {
955 Vector<IntRect> layerFocusRingRects; 955 Vector<IntRect> layerFocusRingRects;
956 box->addFocusRingRects(layerFocusRingRects, LayoutPoint(), box); 956 box->addFocusRingRects(layerFocusRingRects, LayoutPoint(), box);
(...skipping 28 matching lines...) Expand all
985 985
986 IntRect result = quads[0].enclosingBoundingBox(); 986 IntRect result = quads[0].enclosingBoundingBox();
987 for (size_t i = 1; i < n; ++i) 987 for (size_t i = 1; i < n; ++i)
988 result.unite(quads[i].enclosingBoundingBox()); 988 result.unite(quads[i].enclosingBoundingBox());
989 return result; 989 return result;
990 } 990 }
991 991
992 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) 992 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
993 { 993 {
994 Vector<IntRect> rects; 994 Vector<IntRect> rects;
995 const RenderLayerModelObject* container = containerForPaintInvalidation(); 995 const RenderBox* container = containerForPaintInvalidation();
996 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con tainer)), container); 996 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con tainer)), container);
997 size_t count = rects.size(); 997 size_t count = rects.size();
998 for (size_t i = 0; i < count; ++i) 998 for (size_t i = 0; i < count; ++i)
999 quads.append(container->localToAbsoluteQuad(FloatQuad(rects[i]))); 999 quads.append(container->localToAbsoluteQuad(FloatQuad(rects[i])));
1000 } 1000 }
1001 1001
1002 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) 1002 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range)
1003 { 1003 {
1004 if (!range || !range->startContainer()) 1004 if (!range || !range->startContainer())
1005 return FloatRect(); 1005 return FloatRect();
(...skipping 15 matching lines...) Expand all
1021 if (hasLayer()) 1021 if (hasLayer())
1022 result.unite(absoluteBoundingBoxRect()); 1022 result.unite(absoluteBoundingBoxRect());
1023 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling()) 1023 for (RenderObject* current = slowFirstChild(); current; current = current->n extSibling())
1024 current->addAbsoluteRectForLayer(result); 1024 current->addAbsoluteRectForLayer(result);
1025 } 1025 }
1026 1026
1027 void RenderObject::paint(PaintInfo&, const LayoutPoint&, Vector<RenderBox*>& lay ers) 1027 void RenderObject::paint(PaintInfo&, const LayoutPoint&, Vector<RenderBox*>& lay ers)
1028 { 1028 {
1029 } 1029 }
1030 1030
1031 const RenderLayerModelObject* RenderObject::containerForPaintInvalidation() cons t 1031 const RenderView* RenderObject::containerForPaintInvalidation() const
1032 { 1032 {
1033 return isRooted() ? view() : 0; 1033 return isRooted() ? view() : 0;
1034 } 1034 }
1035 1035
1036 const RenderLayerModelObject* RenderObject::adjustCompositedContainerForSpecialA ncestors(const RenderLayerModelObject* paintInvalidationContainer) const 1036 const RenderBox* RenderObject::adjustCompositedContainerForSpecialAncestors(cons t RenderBox* paintInvalidationContainer) const
1037 { 1037 {
1038 // FIXME(sky): We shouldn't have any special ancestors and we don't have com posited containers 1038 // FIXME(sky): We shouldn't have any special ancestors and we don't have com posited containers
1039 if (paintInvalidationContainer) 1039 if (paintInvalidationContainer)
1040 return paintInvalidationContainer; 1040 return paintInvalidationContainer;
1041 return view(); 1041 return view();
1042 } 1042 }
1043 1043
1044 void RenderObject::dirtyLinesFromChangedChild(RenderObject*) 1044 void RenderObject::dirtyLinesFromChangedChild(RenderObject*)
1045 { 1045 {
1046 } 1046 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 void RenderObject::selectionStartEnd(int& spos, int& epos) const 1143 void RenderObject::selectionStartEnd(int& spos, int& epos) const
1144 { 1144 {
1145 view()->selectionStartEnd(spos, epos); 1145 view()->selectionStartEnd(spos, epos);
1146 } 1146 }
1147 1147
1148 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff) const 1148 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff) const
1149 { 1149 {
1150 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual 1150 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual
1151 // style changing, since it depends on whether we decide to composite these elements. When the 1151 // style changing, since it depends on whether we decide to composite these elements. When the
1152 // layer status of one of these elements changes, we need to force a layout. 1152 // layer status of one of these elements changes, we need to force a layout.
1153 if (!diff.needsFullLayout() && style() && isLayerModelObject()) { 1153 if (!diff.needsFullLayout() && style() && isBox()) {
1154 bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired() != NoLayer; 1154 bool requiresLayer = toRenderBox(this)->layerTypeRequired() != NoLayer;
1155 if (hasLayer() != requiresLayer) 1155 if (hasLayer() != requiresLayer)
1156 diff.setNeedsFullLayout(); 1156 diff.setNeedsFullLayout();
1157 } 1157 }
1158 1158
1159 return diff; 1159 return diff;
1160 } 1160 }
1161 1161
1162 inline bool RenderObject::hasImmediateNonWhitespaceTextChildOrPropertiesDependen tOnColor() const 1162 inline bool RenderObject::hasImmediateNonWhitespaceTextChildOrPropertiesDependen tOnColor() const
1163 { 1163 {
1164 if (style()->hasBorder() || style()->hasOutline()) 1164 if (style()->hasBorder() || style()->hasOutline())
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 } 1372 }
1373 1373
1374 FloatQuad RenderObject::absoluteToLocalQuad(const FloatQuad& quad, MapCoordinate sFlags mode) const 1374 FloatQuad RenderObject::absoluteToLocalQuad(const FloatQuad& quad, MapCoordinate sFlags mode) const
1375 { 1375 {
1376 TransformState transformState(TransformState::UnapplyInverseTransformDirecti on, quad.boundingBox().center(), quad); 1376 TransformState transformState(TransformState::UnapplyInverseTransformDirecti on, quad.boundingBox().center(), quad);
1377 mapAbsoluteToLocalPoint(mode, transformState); 1377 mapAbsoluteToLocalPoint(mode, transformState);
1378 transformState.flatten(); 1378 transformState.flatten();
1379 return transformState.lastPlanarQuad(); 1379 return transformState.lastPlanarQuad();
1380 } 1380 }
1381 1381
1382 void RenderObject::mapLocalToContainer(const RenderLayerModelObject* paintInvali dationContainer, TransformState& transformState, MapCoordinatesFlags mode) const 1382 void RenderObject::mapLocalToContainer(const RenderBox* paintInvalidationContain er, TransformState& transformState, MapCoordinatesFlags mode) const
1383 { 1383 {
1384 if (paintInvalidationContainer == this) 1384 if (paintInvalidationContainer == this)
1385 return; 1385 return;
1386 1386
1387 RenderObject* o = parent(); 1387 RenderObject* o = parent();
1388 if (!o) 1388 if (!o)
1389 return; 1389 return;
1390 1390
1391 // FIXME: this should call offsetFromContainer to share code, but I'm not su re it's ever called. 1391 // FIXME: this should call offsetFromContainer to share code, but I'm not su re it's ever called.
1392 if (mode & ApplyContainerFlip && o->isBox()) 1392 if (mode & ApplyContainerFlip && o->isBox())
1393 mode &= ~ApplyContainerFlip; 1393 mode &= ~ApplyContainerFlip;
1394 1394
1395 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode); 1395 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode);
1396 } 1396 }
1397 1397
1398 const RenderObject* RenderObject::pushMappingToContainer(const RenderLayerModelO bject* ancestorToStopAt, RenderGeometryMap& geometryMap) const 1398 const RenderObject* RenderObject::pushMappingToContainer(const RenderBox* ancest orToStopAt, RenderGeometryMap& geometryMap) const
1399 { 1399 {
1400 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this); 1400 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this);
1401 1401
1402 RenderObject* container = parent(); 1402 RenderObject* container = parent();
1403 if (!container) 1403 if (!container)
1404 return 0; 1404 return 0;
1405 // FIXME(sky): Do we need to make this call? 1405 // FIXME(sky): Do we need to make this call?
1406 geometryMap.push(this, LayoutSize(), false); 1406 geometryMap.push(this, LayoutSize(), false);
1407 return container; 1407 return container;
1408 } 1408 }
1409 1409
1410 void RenderObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformSt ate& transformState) const 1410 void RenderObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformSt ate& transformState) const
1411 { 1411 {
1412 RenderObject* o = parent(); 1412 RenderObject* o = parent();
1413 if (o) 1413 if (o)
1414 o->mapAbsoluteToLocalPoint(mode, transformState); 1414 o->mapAbsoluteToLocalPoint(mode, transformState);
1415 } 1415 }
1416 1416
1417 bool RenderObject::shouldUseTransformFromContainer(const RenderObject* container Object) const 1417 bool RenderObject::shouldUseTransformFromContainer(const RenderObject* container Object) const
1418 { 1418 {
1419 // hasTransform() indicates whether the object has transform, transform-styl e or perspective. We just care about transform, 1419 // hasTransform() indicates whether the object has transform, transform-styl e or perspective. We just care about transform,
1420 // so check the layer's transform directly. 1420 // so check the layer's transform directly.
1421 return (hasLayer() && toRenderLayerModelObject(this)->layer()->transform()) || (containerObject && containerObject->style()->hasPerspective()); 1421 return (hasLayer() && toRenderBox(this)->layer()->transform()) || (container Object && containerObject->style()->hasPerspective());
1422 } 1422 }
1423 1423
1424 void RenderObject::getTransformFromContainer(const RenderObject* containerObject , const LayoutSize& offsetInContainer, TransformationMatrix& transform) const 1424 void RenderObject::getTransformFromContainer(const RenderObject* containerObject , const LayoutSize& offsetInContainer, TransformationMatrix& transform) const
1425 { 1425 {
1426 transform.makeIdentity(); 1426 transform.makeIdentity();
1427 transform.translate(offsetInContainer.width().toFloat(), offsetInContainer.h eight().toFloat()); 1427 transform.translate(offsetInContainer.width().toFloat(), offsetInContainer.h eight().toFloat());
1428 RenderLayer* layer = hasLayer() ? toRenderLayerModelObject(this)->layer() : 0; 1428 RenderLayer* layer = hasLayer() ? toRenderBox(this)->layer() : 0;
1429 if (layer && layer->transform()) 1429 if (layer && layer->transform())
1430 transform.multiply(layer->currentTransform()); 1430 transform.multiply(layer->currentTransform());
1431 1431
1432 if (containerObject && containerObject->hasLayer() && containerObject->style ()->hasPerspective()) { 1432 if (containerObject && containerObject->hasLayer() && containerObject->style ()->hasPerspective()) {
1433 // Perpsective on the container affects us, so we have to factor it in h ere. 1433 // Perpsective on the container affects us, so we have to factor it in h ere.
1434 ASSERT(containerObject->hasLayer()); 1434 ASSERT(containerObject->hasLayer());
1435 FloatPoint perspectiveOrigin = toRenderLayerModelObject(containerObject) ->layer()->perspectiveOrigin(); 1435 FloatPoint perspectiveOrigin = toRenderBox(containerObject)->layer()->pe rspectiveOrigin();
1436 1436
1437 TransformationMatrix perspectiveMatrix; 1437 TransformationMatrix perspectiveMatrix;
1438 perspectiveMatrix.applyPerspective(containerObject->style()->perspective ()); 1438 perspectiveMatrix.applyPerspective(containerObject->style()->perspective ());
1439 1439
1440 transform.translateRight3d(-perspectiveOrigin.x(), -perspectiveOrigin.y( ), 0); 1440 transform.translateRight3d(-perspectiveOrigin.x(), -perspectiveOrigin.y( ), 0);
1441 transform = perspectiveMatrix * transform; 1441 transform = perspectiveMatrix * transform;
1442 transform.translateRight3d(perspectiveOrigin.x(), perspectiveOrigin.y(), 0); 1442 transform.translateRight3d(perspectiveOrigin.x(), perspectiveOrigin.y(), 0);
1443 } 1443 }
1444 } 1444 }
1445 1445
1446 FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, const R enderLayerModelObject* paintInvalidationContainer, MapCoordinatesFlags mode) con st 1446 FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, const R enderBox* paintInvalidationContainer, MapCoordinatesFlags mode) const
1447 { 1447 {
1448 // Track the point at the center of the quad's bounding box. As mapLocalToCo ntainer() calls offsetFromContainer(), 1448 // Track the point at the center of the quad's bounding box. As mapLocalToCo ntainer() calls offsetFromContainer(),
1449 // it will use that point as the reference point to decide which column's tr ansform to apply in multiple-column blocks. 1449 // it will use that point as the reference point to decide which column's tr ansform to apply in multiple-column blocks.
1450 TransformState transformState(TransformState::ApplyTransformDirection, local Quad.boundingBox().center(), localQuad); 1450 TransformState transformState(TransformState::ApplyTransformDirection, local Quad.boundingBox().center(), localQuad);
1451 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms); 1451 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms);
1452 transformState.flatten(); 1452 transformState.flatten();
1453 1453
1454 return transformState.lastPlanarQuad(); 1454 return transformState.lastPlanarQuad();
1455 } 1455 }
1456 1456
1457 FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, con st RenderLayerModelObject* paintInvalidationContainer, MapCoordinatesFlags mode) const 1457 FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, con st RenderBox* paintInvalidationContainer, MapCoordinatesFlags mode) const
1458 { 1458 {
1459 TransformState transformState(TransformState::ApplyTransformDirection, local Point); 1459 TransformState transformState(TransformState::ApplyTransformDirection, local Point);
1460 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms); 1460 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms);
1461 transformState.flatten(); 1461 transformState.flatten();
1462 1462
1463 return transformState.lastPlanarPoint(); 1463 return transformState.lastPlanarPoint();
1464 } 1464 }
1465 1465
1466 LayoutSize RenderObject::offsetFromContainer(const RenderObject* o, const Layout Point& point, bool* offsetDependsOnPoint) const 1466 LayoutSize RenderObject::offsetFromContainer(const RenderObject* o, const Layout Point& point, bool* offsetDependsOnPoint) const
1467 { 1467 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 1499
1500 return LayoutRect(); 1500 return LayoutRect();
1501 } 1501 }
1502 1502
1503 bool RenderObject::isRooted() const 1503 bool RenderObject::isRooted() const
1504 { 1504 {
1505 const RenderObject* object = this; 1505 const RenderObject* object = this;
1506 while (object->parent() && !object->hasLayer()) 1506 while (object->parent() && !object->hasLayer())
1507 object = object->parent(); 1507 object = object->parent();
1508 if (object->hasLayer()) 1508 if (object->hasLayer())
1509 return toRenderLayerModelObject(object)->layer()->root()->isRootLayer(); 1509 return toRenderBox(object)->layer()->root()->isRootLayer();
1510 return false; 1510 return false;
1511 } 1511 }
1512 1512
1513 RespectImageOrientationEnum RenderObject::shouldRespectImageOrientation() const 1513 RespectImageOrientationEnum RenderObject::shouldRespectImageOrientation() const
1514 { 1514 {
1515 // Respect the image's orientation if it's being used as a full-page image o r it's 1515 // Respect the image's orientation if it's being used as a full-page image o r it's
1516 // an <img> and the setting to respect it everywhere is set. 1516 // an <img> and the setting to respect it everywhere is set.
1517 return (document().settings() && document().settings()->shouldRespectImageOr ientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotResp ectImageOrientation; 1517 return (document().settings() && document().settings()->shouldRespectImageOr ientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotResp ectImageOrientation;
1518 } 1518 }
1519 1519
1520 bool RenderObject::hasEntirelyFixedBackground() const 1520 bool RenderObject::hasEntirelyFixedBackground() const
1521 { 1521 {
1522 return m_style->hasEntirelyFixedBackground(); 1522 return m_style->hasEntirelyFixedBackground();
1523 } 1523 }
1524 1524
1525 RenderObject* RenderObject::container(const RenderLayerModelObject* paintInvalid ationContainer, bool* paintInvalidationContainerSkipped) const 1525 RenderObject* RenderObject::container(const RenderBox* paintInvalidationContaine r, bool* paintInvalidationContainerSkipped) const
1526 { 1526 {
1527 if (paintInvalidationContainerSkipped) 1527 if (paintInvalidationContainerSkipped)
1528 *paintInvalidationContainerSkipped = false; 1528 *paintInvalidationContainerSkipped = false;
1529 1529
1530 // This method is extremely similar to containingBlock(), but with a few not able 1530 // This method is extremely similar to containingBlock(), but with a few not able
1531 // exceptions. 1531 // exceptions.
1532 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when 1532 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when
1533 // the object is not part of the primary document subtree yet. 1533 // the object is not part of the primary document subtree yet.
1534 // (2) For normal flow elements, it just returns the parent. 1534 // (2) For normal flow elements, it just returns the parent.
1535 // (3) For absolute positioned elements, it will return a relative positione d inline. 1535 // (3) For absolute positioned elements, it will return a relative positione d inline.
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 { 1972 {
1973 if (object1) { 1973 if (object1) {
1974 const blink::RenderObject* root = object1; 1974 const blink::RenderObject* root = object1;
1975 while (root->parent()) 1975 while (root->parent())
1976 root = root->parent(); 1976 root = root->parent();
1977 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 1977 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
1978 } 1978 }
1979 } 1979 }
1980 1980
1981 #endif 1981 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698