Chromium Code Reviews| 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/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/layout/LayoutInline.h" | |
| 9 #include "core/layout/LayoutPart.h" | 10 #include "core/layout/LayoutPart.h" |
| 10 #include "core/paint/ObjectPaintProperties.h" | 11 #include "core/paint/ObjectPaintProperties.h" |
| 11 #include "core/paint/PaintLayer.h" | 12 #include "core/paint/PaintLayer.h" |
| 12 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 13 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 13 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 14 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 14 #include "platform/transforms/TransformationMatrix.h" | 15 #include "platform/transforms/TransformationMatrix.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 // The context for layout tree walk. | 19 // The context for layout tree walk. |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 context.currentTransform = scrollTranslation.get(); | 327 context.currentTransform = scrollTranslation.get(); |
| 327 object.ensureObjectPaintProperties().setScrollTranslation(scrollTranslation. release()); | 328 object.ensureObjectPaintProperties().setScrollTranslation(scrollTranslation. release()); |
| 328 } | 329 } |
| 329 | 330 |
| 330 void PaintPropertyTreeBuilder::updateOutOfFlowContext(LayoutObject& object, Pain tPropertyTreeBuilderContext& context) | 331 void PaintPropertyTreeBuilder::updateOutOfFlowContext(LayoutObject& object, Pain tPropertyTreeBuilderContext& context) |
| 331 { | 332 { |
| 332 if (object.canContainAbsolutePositionObjects()) { | 333 if (object.canContainAbsolutePositionObjects()) { |
| 333 context.transformForAbsolutePosition = context.currentTransform; | 334 context.transformForAbsolutePosition = context.currentTransform; |
| 334 context.paintOffsetForAbsolutePosition = context.paintOffset; | 335 context.paintOffsetForAbsolutePosition = context.paintOffset; |
| 335 context.clipForAbsolutePosition = context.currentClip; | 336 context.clipForAbsolutePosition = context.currentClip; |
| 337 | |
| 338 // Absolutely positioned content in an inline should be positioned relat ive to the first | |
| 339 // inline box. See: LayoutInline::offsetForInFlowPositionedInline. | |
| 340 // FIXME(pdr): There is a special case when the descendant has static po sition where this | |
| 341 // offset should be removed and an offset based on the inline position s hould be used instead. | |
| 342 if (object.isInline() && object.isLayoutInline()) { | |
| 343 const LayoutInline& layoutInline = toLayoutInline(object); | |
| 344 if (layoutInline.firstLineBox()) { | |
| 345 LayoutPoint inlineOffset = layoutInline.firstLineBox()->topLeft( ); | |
| 346 if (!object.styleRef().isHorizontalWritingMode()) | |
| 347 inlineOffset = inlineOffset.transposedPoint(); | |
| 348 context.paintOffsetForAbsolutePosition += inlineOffset; | |
| 349 } | |
| 350 } | |
|
Xianzhu
2016/05/26 18:02:27
It's better to use the same algorithm as in PaintI
| |
| 336 } | 351 } |
| 337 | 352 |
| 338 // TODO(pdr): Remove the !object.isLayoutView() condition when removing Fram eView | 353 // TODO(pdr): Remove the !object.isLayoutView() condition when removing Fram eView |
| 339 // paint properties for rootLayerScrolls. | 354 // paint properties for rootLayerScrolls. |
| 340 if (!object.isLayoutView() && object.canContainFixedPositionObjects()) { | 355 if (!object.isLayoutView() && object.canContainFixedPositionObjects()) { |
| 341 context.transformForFixedPosition = context.currentTransform; | 356 context.transformForFixedPosition = context.currentTransform; |
| 342 context.paintOffsetForFixedPosition = context.paintOffset; | 357 context.paintOffsetForFixedPosition = context.paintOffset; |
| 343 context.clipForFixedPosition = context.currentClip; | 358 context.clipForFixedPosition = context.currentClip; |
| 344 } else if (object.objectPaintProperties() && object.objectPaintProperties()- >cssClip()) { | 359 } else if (object.objectPaintProperties() && object.objectPaintProperties()- >cssClip()) { |
| 345 // CSS clip applies to all descendants, even if this object is not a con taining block | 360 // CSS clip applies to all descendants, even if this object is not a con taining block |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 | 450 |
| 436 if (object.isLayoutPart()) { | 451 if (object.isLayoutPart()) { |
| 437 Widget* widget = toLayoutPart(object).widget(); | 452 Widget* widget = toLayoutPart(object).widget(); |
| 438 if (widget && widget->isFrameView()) | 453 if (widget && widget->isFrameView()) |
| 439 walk(*toFrameView(widget), localContext); | 454 walk(*toFrameView(widget), localContext); |
| 440 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). | 455 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| 441 } | 456 } |
| 442 } | 457 } |
| 443 | 458 |
| 444 } // namespace blink | 459 } // namespace blink |
| OLD | NEW |