Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 | 111 |
| 112 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() & & (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) | 112 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() & & (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) |
| 113 result = p + roundedIntSize(m_accumulatedOffset); | 113 result = p + roundedIntSize(m_accumulatedOffset); |
| 114 else { | 114 else { |
| 115 TransformState transformState(TransformState::ApplyTransformDirection, p ); | 115 TransformState transformState(TransformState::ApplyTransformDirection, p ); |
| 116 mapToContainer(transformState, container); | 116 mapToContainer(transformState, container); |
| 117 result = transformState.lastPlanarPoint(); | 117 result = transformState.lastPlanarPoint(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 #if !ASSERT_DISABLED | 120 #if !ASSERT_DISABLED |
| 121 FloatPoint rendererMappedResult = m_mapping.last().m_renderer->localToAbsolu te(p, m_mapCoordinatesFlags); | 121 if (m_mapping.size() > 0) { |
| 122 ASSERT(roundedIntPoint(rendererMappedResult) == roundedIntPoint(result)); | 122 FloatPoint rendererMappedResult = m_mapping.last().m_renderer->localToAb solute(p, m_mapCoordinatesFlags); |
| 123 // if (roundedIntPoint(rendererMappedResult) != roundedIntPoint(result)) | 123 ASSERT(roundedIntPoint(rendererMappedResult) == roundedIntPoint(result)) ; |
| 124 // fprintf(stderr, "Mismatched point\n"); | 124 // if (roundedIntPoint(rendererMappedResult) != roundedIntPoint(resul t)) |
|
jamesr
2013/10/18 15:56:42
please remove before landing
| |
| 125 // fprintf(stderr, "Mismatched point\n"); | |
| 126 } | |
| 125 #endif | 127 #endif |
| 126 | 128 |
| 127 return result; | 129 return result; |
| 128 } | 130 } |
| 129 | 131 |
| 130 #ifndef NDEBUG | 132 #ifndef NDEBUG |
| 131 // Handy function to call from gdb while debugging mismatched point/rect errors. | 133 // Handy function to call from gdb while debugging mismatched point/rect errors. |
| 132 void RenderGeometryMap::dumpSteps() | 134 void RenderGeometryMap::dumpSteps() |
| 133 { | 135 { |
| 134 fprintf(stderr, "RenderGeometryMap::dumpSteps accumulatedOffset=%d,%d\n", m_ accumulatedOffset.width().toInt(), m_accumulatedOffset.height().toInt()); | 136 fprintf(stderr, "RenderGeometryMap::dumpSteps accumulatedOffset=%d,%d\n", m_ accumulatedOffset.width().toInt(), m_accumulatedOffset.height().toInt()); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 148 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() & & (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) { | 150 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() & & (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) { |
| 149 result = rect; | 151 result = rect; |
| 150 result.move(m_accumulatedOffset); | 152 result.move(m_accumulatedOffset); |
| 151 } else { | 153 } else { |
| 152 TransformState transformState(TransformState::ApplyTransformDirection, r ect.center(), rect); | 154 TransformState transformState(TransformState::ApplyTransformDirection, r ect.center(), rect); |
| 153 mapToContainer(transformState, container); | 155 mapToContainer(transformState, container); |
| 154 result = transformState.lastPlanarQuad().boundingBox(); | 156 result = transformState.lastPlanarQuad().boundingBox(); |
| 155 } | 157 } |
| 156 | 158 |
| 157 #if !ASSERT_DISABLED | 159 #if !ASSERT_DISABLED |
| 158 const RenderObject* lastRenderer = m_mapping.last().m_renderer; | 160 if (m_mapping.size() > 0) { |
| 159 const RenderLayer* layer = lastRenderer->enclosingLayer(); | 161 const RenderObject* lastRenderer = m_mapping.last().m_renderer; |
| 162 const RenderLayer* layer = lastRenderer->enclosingLayer(); | |
| 160 | 163 |
| 161 // Bounds for invisible layers are intentionally not calculated, and are | 164 // Bounds for invisible layers are intentionally not calculated, and are |
| 162 // therefore not necessarily expected to be correct here. This is ok, | 165 // therefore not necessarily expected to be correct here. This is ok, |
| 163 // because they will be recomputed if the layer becomes visible. | 166 // because they will be recomputed if the layer becomes visible. |
| 164 if (!layer || !layer->subtreeIsInvisible()) { | 167 if (!layer || !layer->subtreeIsInvisible()) { |
| 165 FloatRect rendererMappedResult = lastRenderer->localToContainerQuad(rect , container, m_mapCoordinatesFlags).boundingBox(); | 168 FloatRect rendererMappedResult = lastRenderer->localToContainerQuad( rect, container, m_mapCoordinatesFlags).boundingBox(); |
| 166 | 169 |
| 167 // Inspector creates renderers with negative width <https://bugs.webkit. org/show_bug.cgi?id=87194>. | 170 // Inspector creates renderers with negative width <https://bugs.web kit.org/show_bug.cgi?id=87194>. |
| 168 // Taking FloatQuad bounds avoids spurious assertions because of that. | 171 // Taking FloatQuad bounds avoids spurious assertions because of tha t. |
| 169 ASSERT(enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQ uad(result).boundingBox())); | 172 ASSERT(enclosingIntRect(rendererMappedResult) == enclosingIntRect(Fl oatQuad(result).boundingBox())); |
| 170 // if (enclosingIntRect(rendererMappedResult) != enclosingIntRect(FloatQu ad(result).boundingBox())) | 173 // if (enclosingIntRect(rendererMappedResult) != enclosingInt Rect(FloatQuad(result).boundingBox())) |
|
jamesr
2013/10/18 15:56:42
ditto
| |
| 171 // fprintf(stderr, "Mismatched rects\n"); | 174 // fprintf(stderr, "Mismatched rects\n"); |
| 175 } | |
| 172 } | 176 } |
| 173 #endif | 177 #endif |
| 174 | 178 |
| 175 return result; | 179 return result; |
| 176 } | 180 } |
| 177 | 181 |
| 178 void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, con st RenderLayerModelObject* ancestorRenderer) | 182 void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, con st RenderLayerModelObject* ancestorRenderer) |
| 179 { | 183 { |
| 180 // We need to push mappings in reverse order here, so do insertions rather t han appends. | 184 // We need to push mappings in reverse order here, so do insertions rather t han appends. |
| 181 TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size() ); | 185 TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size() ); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 // "topmost" (to preserve original behavior). | 334 // "topmost" (to preserve original behavior). |
| 331 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) | 335 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) |
| 332 return true; | 336 return true; |
| 333 | 337 |
| 334 Frame* thisFrame = renderer->frame(); | 338 Frame* thisFrame = renderer->frame(); |
| 335 return thisFrame == thisFrame->page()->mainFrame(); | 339 return thisFrame == thisFrame->page()->mainFrame(); |
| 336 } | 340 } |
| 337 #endif | 341 #endif |
| 338 | 342 |
| 339 } // namespace WebCore | 343 } // namespace WebCore |
| OLD | NEW |