| 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 if (m_mapping.size() > 0) { | 121 FloatPoint rendererMappedResult = m_mapping.last().m_renderer->localToAbsolu
te(p, m_mapCoordinatesFlags); |
| 122 FloatPoint rendererMappedResult = m_mapping.last().m_renderer->localToAb
solute(p, m_mapCoordinatesFlags); | 122 ASSERT(roundedIntPoint(rendererMappedResult) == roundedIntPoint(result)); |
| 123 ASSERT(roundedIntPoint(rendererMappedResult) == roundedIntPoint(result))
; | 123 // if (roundedIntPoint(rendererMappedResult) != roundedIntPoint(result)) |
| 124 } | 124 // fprintf(stderr, "Mismatched point\n"); |
| 125 #endif | 125 #endif |
| 126 | 126 |
| 127 return result; | 127 return result; |
| 128 } | 128 } |
| 129 | 129 |
| 130 #ifndef NDEBUG | 130 #ifndef NDEBUG |
| 131 // Handy function to call from gdb while debugging mismatched point/rect errors. | 131 // Handy function to call from gdb while debugging mismatched point/rect errors. |
| 132 void RenderGeometryMap::dumpSteps() | 132 void RenderGeometryMap::dumpSteps() |
| 133 { | 133 { |
| 134 fprintf(stderr, "RenderGeometryMap::dumpSteps accumulatedOffset=%d,%d\n", m_
accumulatedOffset.width().toInt(), m_accumulatedOffset.height().toInt()); | 134 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))) { | 148 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() &
& (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) { |
| 149 result = rect; | 149 result = rect; |
| 150 result.move(m_accumulatedOffset); | 150 result.move(m_accumulatedOffset); |
| 151 } else { | 151 } else { |
| 152 TransformState transformState(TransformState::ApplyTransformDirection, r
ect.center(), rect); | 152 TransformState transformState(TransformState::ApplyTransformDirection, r
ect.center(), rect); |
| 153 mapToContainer(transformState, container); | 153 mapToContainer(transformState, container); |
| 154 result = transformState.lastPlanarQuad().boundingBox(); | 154 result = transformState.lastPlanarQuad().boundingBox(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 #if !ASSERT_DISABLED | 157 #if !ASSERT_DISABLED |
| 158 if (m_mapping.size() > 0) { | 158 const RenderObject* lastRenderer = m_mapping.last().m_renderer; |
| 159 const RenderObject* lastRenderer = m_mapping.last().m_renderer; | 159 const RenderLayer* layer = lastRenderer->enclosingLayer(); |
| 160 const RenderLayer* layer = lastRenderer->enclosingLayer(); | |
| 161 | 160 |
| 162 // Bounds for invisible layers are intentionally not calculated, and are | 161 // Bounds for invisible layers are intentionally not calculated, and are |
| 163 // therefore not necessarily expected to be correct here. This is ok, | 162 // therefore not necessarily expected to be correct here. This is ok, |
| 164 // because they will be recomputed if the layer becomes visible. | 163 // because they will be recomputed if the layer becomes visible. |
| 165 if (!layer || !layer->subtreeIsInvisible()) { | 164 if (!layer || !layer->subtreeIsInvisible()) { |
| 166 FloatRect rendererMappedResult = lastRenderer->localToContainerQuad(
rect, container, m_mapCoordinatesFlags).boundingBox(); | 165 FloatRect rendererMappedResult = lastRenderer->localToContainerQuad(rect
, container, m_mapCoordinatesFlags).boundingBox(); |
| 167 | 166 |
| 168 // Inspector creates renderers with negative width <https://bugs.web
kit.org/show_bug.cgi?id=87194>. | 167 // Inspector creates renderers with negative width <https://bugs.webkit.
org/show_bug.cgi?id=87194>. |
| 169 // Taking FloatQuad bounds avoids spurious assertions because of tha
t. | 168 // Taking FloatQuad bounds avoids spurious assertions because of that. |
| 170 ASSERT(enclosingIntRect(rendererMappedResult) == enclosingIntRect(Fl
oatQuad(result).boundingBox())); | 169 ASSERT(enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQ
uad(result).boundingBox())); |
| 171 } | 170 // if (enclosingIntRect(rendererMappedResult) != enclosingIntRect(FloatQu
ad(result).boundingBox())) |
| 171 // fprintf(stderr, "Mismatched rects\n"); |
| 172 } | 172 } |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 return result; | 175 return result; |
| 176 } | 176 } |
| 177 | 177 |
| 178 void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, con
st RenderLayerModelObject* ancestorRenderer) | 178 void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, con
st RenderLayerModelObject* ancestorRenderer) |
| 179 { | 179 { |
| 180 // We need to push mappings in reverse order here, so do insertions rather t
han appends. | 180 // 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()
); | 181 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). | 330 // "topmost" (to preserve original behavior). |
| 331 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) | 331 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) |
| 332 return true; | 332 return true; |
| 333 | 333 |
| 334 Frame* thisFrame = renderer->frame(); | 334 Frame* thisFrame = renderer->frame(); |
| 335 return thisFrame == thisFrame->page()->mainFrame(); | 335 return thisFrame == thisFrame->page()->mainFrame(); |
| 336 } | 336 } |
| 337 #endif | 337 #endif |
| 338 | 338 |
| 339 } // namespace WebCore | 339 } // namespace WebCore |
| OLD | NEW |