OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/PaintPropertyTreeBuilder.h" | 5 #include "core/paint/PaintPropertyTreeBuilder.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
10 #include "core/layout/LayoutInline.h" | 10 #include "core/layout/LayoutInline.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 break; | 338 break; |
339 case FixedPosition: | 339 case FixedPosition: |
340 context.currentTransform = context.transformForFixedPosition; | 340 context.currentTransform = context.transformForFixedPosition; |
341 context.paintOffset = context.paintOffsetForFixedPosition; | 341 context.paintOffset = context.paintOffsetForFixedPosition; |
342 context.currentClip = context.clipForFixedPosition; | 342 context.currentClip = context.clipForFixedPosition; |
343 break; | 343 break; |
344 default: | 344 default: |
345 ASSERT_NOT_REACHED(); | 345 ASSERT_NOT_REACHED(); |
346 } | 346 } |
347 if (boxModelObject.isBox()) { | 347 if (boxModelObject.isBox()) { |
348 context.paintOffset += toLayoutBox(boxModelObject).locationOffset(); | 348 // TODO(pdr): Several calls in this function walk back up the tree to ca
lculate containers |
| 349 // (e.g., topLeftLocation, offsetForInFlowPosition*). The containing blo
ck and other |
| 350 // containers can be stored on PaintPropertyTreeBuilderContext instead o
f recomputing them. |
| 351 context.paintOffset.moveBy(toLayoutBox(boxModelObject).topLeftLocation()
); |
349 // This is a weird quirk that table cells paint as children of table row
s, | 352 // This is a weird quirk that table cells paint as children of table row
s, |
350 // but their location have the row's location baked-in. | 353 // but their location have the row's location baked-in. |
351 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). | 354 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). |
352 if (boxModelObject.isTableCell()) { | 355 if (boxModelObject.isTableCell()) { |
353 LayoutObject* parentRow = boxModelObject.parent(); | 356 LayoutObject* parentRow = boxModelObject.parent(); |
354 ASSERT(parentRow && parentRow->isTableRow()); | 357 ASSERT(parentRow && parentRow->isTableRow()); |
355 context.paintOffset -= toLayoutBox(parentRow)->locationOffset(); | 358 context.paintOffset.moveBy(-toLayoutBox(parentRow)->topLeftLocation(
)); |
356 } | 359 } |
357 } | 360 } |
358 } | 361 } |
359 | 362 |
360 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP
ropertyTreeBuilderContext& context) | 363 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP
ropertyTreeBuilderContext& context) |
361 { | 364 { |
362 object.getMutableForPainting().clearObjectPaintProperties(); | 365 object.getMutableForPainting().clearObjectPaintProperties(); |
363 | 366 |
364 deriveBorderBoxFromContainerContext(object, context); | 367 deriveBorderBoxFromContainerContext(object, context); |
365 | 368 |
366 updatePaintOffsetTranslation(object, context); | 369 updatePaintOffsetTranslation(object, context); |
367 updateTransform(object, context); | 370 updateTransform(object, context); |
368 updateEffect(object, context); | 371 updateEffect(object, context); |
369 updateCssClip(object, context); | 372 updateCssClip(object, context); |
370 updateLocalBorderBoxContext(object, context); | 373 updateLocalBorderBoxContext(object, context); |
371 updateScrollbarPaintOffset(object, context); | 374 updateScrollbarPaintOffset(object, context); |
372 updateOverflowClip(object, context); | 375 updateOverflowClip(object, context); |
373 // TODO(trchen): Insert flattening transform here, as specified by | 376 // TODO(trchen): Insert flattening transform here, as specified by |
374 // http://www.w3.org/TR/css3-transforms/#transform-style-property | 377 // http://www.w3.org/TR/css3-transforms/#transform-style-property |
375 updatePerspective(object, context); | 378 updatePerspective(object, context); |
376 updateSvgLocalTransform(object, context); | 379 updateSvgLocalTransform(object, context); |
377 updateScrollTranslation(object, context); | 380 updateScrollTranslation(object, context); |
378 updateOutOfFlowContext(object, context); | 381 updateOutOfFlowContext(object, context); |
379 } | 382 } |
380 | 383 |
381 } // namespace blink | 384 } // namespace blink |
OLD | NEW |