Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2033 mapAbsoluteToLocalPoint(mode, transformState); | 2033 mapAbsoluteToLocalPoint(mode, transformState); |
| 2034 transformState.flatten(); | 2034 transformState.flatten(); |
| 2035 return transformState.lastPlanarQuad(); | 2035 return transformState.lastPlanarQuad(); |
| 2036 } | 2036 } |
| 2037 | 2037 |
| 2038 void LayoutObject::mapLocalToContainer(const LayoutBoxModelObject* paintInvalida tionContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* w asFixed, const PaintInvalidationState* paintInvalidationState) const | 2038 void LayoutObject::mapLocalToContainer(const LayoutBoxModelObject* paintInvalida tionContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* w asFixed, const PaintInvalidationState* paintInvalidationState) const |
| 2039 { | 2039 { |
| 2040 if (paintInvalidationContainer == this) | 2040 if (paintInvalidationContainer == this) |
| 2041 return; | 2041 return; |
| 2042 | 2042 |
| 2043 LayoutObject* o = parent(); | 2043 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain tInvalidationContainer)) { |
| 2044 LayoutSize offset = paintInvalidationState->paintOffset(); | |
| 2045 if (!isText() && style()->hasInFlowPosition() && hasLayer()) | |
|
ojan
2015/06/19 02:21:09
Nit: I believe a LayoutText can't have a layer, so
mstensho (USE GERRIT)
2015/06/19 09:52:42
Indeed. I can remove it. I put it there, so that w
| |
| 2046 offset += toLayoutBoxModelObject(this)->layer()->offsetForInFlowPosi tion(); | |
| 2047 transformState.move(offset); | |
| 2048 return; | |
| 2049 } | |
| 2050 | |
| 2051 bool containerSkipped; | |
| 2052 LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); | |
| 2044 if (!o) | 2053 if (!o) |
| 2045 return; | 2054 return; |
| 2046 | 2055 |
| 2047 // FIXME: this should call offsetFromContainer to share code, but I'm not su re it's ever called. | |
| 2048 LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); | |
| 2049 if (mode & ApplyContainerFlip && o->isBox()) { | 2056 if (mode & ApplyContainerFlip && o->isBox()) { |
| 2050 if (o->style()->isFlippedBlocksWritingMode()) | 2057 if (o->style()->isFlippedBlocksWritingMode()) { |
| 2051 transformState.move(toLayoutBox(o)->flipForWritingMode(roundedLayout Point(transformState.mappedPoint())) - centerPoint); | 2058 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint()) ; |
| 2059 transformState.move(toLayoutBox(o)->flipForWritingMode(LayoutPoint(c enterPoint)) - centerPoint); | |
| 2060 } | |
| 2052 mode &= ~ApplyContainerFlip; | 2061 mode &= ~ApplyContainerFlip; |
| 2053 } | 2062 } |
| 2054 | 2063 |
| 2055 transformState.move(o->columnOffset(roundedLayoutPoint(transformState.mapped Point()))); | 2064 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans formState.mappedPoint())); |
| 2056 | 2065 |
| 2057 if (o->hasOverflowClip()) | 2066 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || (!is Text() && style()->preserves3D())); |
|
ojan
2015/06/19 02:21:09
I don't think this is right. Even if your parent p
mstensho (USE GERRIT)
2015/06/19 09:52:42
First of all: this was an unintended change from m
| |
| 2058 transformState.move(-toLayoutBox(o)->scrolledContentOffset()); | 2067 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { |
| 2068 TransformationMatrix t; | |
| 2069 getTransformFromContainer(o, containerOffset, t); | |
| 2070 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform); | |
| 2071 } else { | |
| 2072 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm); | |
| 2073 } | |
| 2074 | |
| 2075 if (containerSkipped) { | |
| 2076 // There can't be a transform between paintInvalidationContainer and o, because transforms create containers, so it should be safe | |
| 2077 // to just subtract the delta between the paintInvalidationContainer and o. | |
| 2078 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o); | |
| 2079 transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans form); | |
| 2080 return; | |
| 2081 } | |
| 2059 | 2082 |
| 2060 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was Fixed, paintInvalidationState); | 2083 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was Fixed, paintInvalidationState); |
| 2061 } | 2084 } |
| 2062 | 2085 |
| 2063 const LayoutObject* LayoutObject::pushMappingToContainer(const LayoutBoxModelObj ect* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 2086 const LayoutObject* LayoutObject::pushMappingToContainer(const LayoutBoxModelObj ect* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
| 2064 { | 2087 { |
| 2065 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this); | 2088 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this); |
| 2066 | 2089 |
| 2067 LayoutObject* container = parent(); | 2090 LayoutObject* container = parent(); |
| 2068 if (!container) | 2091 if (!container) |
| (...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3270 const blink::LayoutObject* root = object1; | 3293 const blink::LayoutObject* root = object1; |
| 3271 while (root->parent()) | 3294 while (root->parent()) |
| 3272 root = root->parent(); | 3295 root = root->parent(); |
| 3273 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3296 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3274 } else { | 3297 } else { |
| 3275 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3298 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3276 } | 3299 } |
| 3277 } | 3300 } |
| 3278 | 3301 |
| 3279 #endif | 3302 #endif |
| OLD | NEW |