OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "core/dom/Document.h" | 24 #include "core/dom/Document.h" |
25 #include "core/dom/Element.h" | 25 #include "core/dom/Element.h" |
26 #include "core/editing/FrameSelection.h" | 26 #include "core/editing/FrameSelection.h" |
27 #include "core/editing/VisibleUnits.h" | 27 #include "core/editing/VisibleUnits.h" |
28 #include "core/frame/LocalFrame.h" | 28 #include "core/frame/LocalFrame.h" |
29 #include "core/html/HTMLFrameOwnerElement.h" | 29 #include "core/html/HTMLFrameOwnerElement.h" |
30 #include "core/html/HTMLIFrameElement.h" | 30 #include "core/html/HTMLIFrameElement.h" |
31 #include "core/html/HTMLTextFormControlElement.h" | 31 #include "core/html/HTMLTextFormControlElement.h" |
32 #include "core/layout/HitTestResult.h" | 32 #include "core/layout/HitTestResult.h" |
| 33 #include "core/layout/Layer.h" |
33 #include "core/layout/compositing/CompositedLayerMapping.h" | 34 #include "core/layout/compositing/CompositedLayerMapping.h" |
34 #include "core/layout/compositing/RenderLayerCompositor.h" | 35 #include "core/layout/compositing/LayerCompositor.h" |
35 #include "core/page/Page.h" | 36 #include "core/page/Page.h" |
36 #include "core/paint/ViewPainter.h" | 37 #include "core/paint/ViewPainter.h" |
37 #include "core/rendering/ColumnInfo.h" | 38 #include "core/rendering/ColumnInfo.h" |
38 #include "core/rendering/RenderFlowThread.h" | 39 #include "core/rendering/RenderFlowThread.h" |
39 #include "core/rendering/RenderGeometryMap.h" | 40 #include "core/rendering/RenderGeometryMap.h" |
40 #include "core/rendering/RenderLayer.h" | |
41 #include "core/rendering/RenderPart.h" | 41 #include "core/rendering/RenderPart.h" |
42 #include "core/rendering/RenderQuote.h" | 42 #include "core/rendering/RenderQuote.h" |
43 #include "core/rendering/RenderScrollbarPart.h" | 43 #include "core/rendering/RenderScrollbarPart.h" |
44 #include "core/svg/SVGDocumentExtensions.h" | 44 #include "core/svg/SVGDocumentExtensions.h" |
45 #include "platform/TraceEvent.h" | 45 #include "platform/TraceEvent.h" |
46 #include "platform/geometry/FloatQuad.h" | 46 #include "platform/geometry/FloatQuad.h" |
47 #include "platform/geometry/TransformState.h" | 47 #include "platform/geometry/TransformState.h" |
48 #include "platform/graphics/paint/DisplayItemList.h" | 48 #include "platform/graphics/paint/DisplayItemList.h" |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 { | 82 { |
83 return hitTest(request, result.hitTestLocation(), result); | 83 return hitTest(request, result.hitTestLocation(), result); |
84 } | 84 } |
85 | 85 |
86 bool RenderView::hitTest(const HitTestRequest& request, const HitTestLocation& l
ocation, HitTestResult& result) | 86 bool RenderView::hitTest(const HitTestRequest& request, const HitTestLocation& l
ocation, HitTestResult& result) |
87 { | 87 { |
88 TRACE_EVENT0("blink", "RenderView::hitTest"); | 88 TRACE_EVENT0("blink", "RenderView::hitTest"); |
89 m_hitTestCount++; | 89 m_hitTestCount++; |
90 | 90 |
91 // We have to recursively update layout/style here because otherwise, when t
he hit test recurses | 91 // We have to recursively update layout/style here because otherwise, when t
he hit test recurses |
92 // into a child document, it could trigger a layout on the parent document,
which can destroy RenderLayers | 92 // into a child document, it could trigger a layout on the parent document,
which can destroy Layers |
93 // that are higher up in the call stack, leading to crashes. | 93 // that are higher up in the call stack, leading to crashes. |
94 // Note that Document::updateLayout calls its parent's updateLayout. | 94 // Note that Document::updateLayout calls its parent's updateLayout. |
95 // FIXME: It should be the caller's responsibility to ensure an up-to-date l
ayout. | 95 // FIXME: It should be the caller's responsibility to ensure an up-to-date l
ayout. |
96 frameView()->updateLayoutAndStyleIfNeededRecursive(); | 96 frameView()->updateLayoutAndStyleIfNeededRecursive(); |
97 commitPendingSelection(); | 97 commitPendingSelection(); |
98 | 98 |
99 bool hitLayer = layer()->hitTest(request, location, result); | 99 bool hitLayer = layer()->hitTest(request, location, result); |
100 | 100 |
101 // FrameView scrollbars are not the same as RenderLayer scrollbars tested by
RenderLayer::hitTestOverflowControls, | 101 // FrameView scrollbars are not the same as Layer scrollbars tested by Layer
::hitTestOverflowControls, |
102 // so we need to test FrameView scrollbars separately here. Note that it's i
mportant we do this after | 102 // so we need to test FrameView scrollbars separately here. Note that it's i
mportant we do this after |
103 // the hit test above, because that may overwrite the entire HitTestResult w
hen it finds a hit. | 103 // the hit test above, because that may overwrite the entire HitTestResult w
hen it finds a hit. |
104 IntPoint viewPoint = location.roundedPoint() - frameView()->scrollOffset(); | 104 IntPoint viewPoint = location.roundedPoint() - frameView()->scrollOffset(); |
105 if (Scrollbar* frameScrollbar = frameView()->scrollbarAtViewPoint(viewPoint)
) | 105 if (Scrollbar* frameScrollbar = frameView()->scrollbarAtViewPoint(viewPoint)
) |
106 result.setScrollbar(frameScrollbar); | 106 result.setScrollbar(frameScrollbar); |
107 | 107 |
108 return hitLayer; | 108 return hitLayer; |
109 } | 109 } |
110 | 110 |
111 void RenderView::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit, Logi
calExtentComputedValues& computedValues) const | 111 void RenderView::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit, Logi
calExtentComputedValues& computedValues) const |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 m_pageLogicalHeightChanged = false; | 219 m_pageLogicalHeightChanged = false; |
220 | 220 |
221 layoutContent(); | 221 layoutContent(); |
222 | 222 |
223 #if ENABLE(ASSERT) | 223 #if ENABLE(ASSERT) |
224 checkLayoutState(); | 224 checkLayoutState(); |
225 #endif | 225 #endif |
226 clearNeedsLayout(); | 226 clearNeedsLayout(); |
227 } | 227 } |
228 | 228 |
229 void RenderView::mapLocalToContainer(const RenderLayerModelObject* paintInvalida
tionContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* w
asFixed, const PaintInvalidationState* paintInvalidationState) const | 229 void RenderView::mapLocalToContainer(const LayoutLayerModelObject* paintInvalida
tionContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* w
asFixed, const PaintInvalidationState* paintInvalidationState) const |
230 { | 230 { |
231 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); | 231 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); |
232 | 232 |
233 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor
mFromContainer(0)) { | 233 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor
mFromContainer(0)) { |
234 TransformationMatrix t; | 234 TransformationMatrix t; |
235 getTransformFromContainer(0, LayoutSize(), t); | 235 getTransformFromContainer(0, LayoutSize(), t); |
236 transformState.applyTransform(t); | 236 transformState.applyTransform(t); |
237 } | 237 } |
238 | 238 |
239 if ((mode & IsFixed) && m_frameView) { | 239 if ((mode & IsFixed) && m_frameView) { |
240 transformState.move(m_frameView->scrollOffsetForViewportConstrainedObjec
ts()); | 240 transformState.move(m_frameView->scrollOffsetForViewportConstrainedObjec
ts()); |
241 // IsFixed flag is only applicable within this RenderView. | 241 // IsFixed flag is only applicable within this RenderView. |
242 mode &= ~IsFixed; | 242 mode &= ~IsFixed; |
243 } | 243 } |
244 | 244 |
245 if (paintInvalidationContainer == this) | 245 if (paintInvalidationContainer == this) |
246 return; | 246 return; |
247 | 247 |
248 if (mode & TraverseDocumentBoundaries) { | 248 if (mode & TraverseDocumentBoundaries) { |
249 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { | 249 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { |
250 transformState.move(-frame()->view()->scrollOffset()); | 250 transformState.move(-frame()->view()->scrollOffset()); |
251 if (parentDocRenderer->isBox()) | 251 if (parentDocRenderer->isBox()) |
252 transformState.move(toRenderBox(parentDocRenderer)->contentBoxOf
fset()); | 252 transformState.move(toRenderBox(parentDocRenderer)->contentBoxOf
fset()); |
253 parentDocRenderer->mapLocalToContainer(paintInvalidationContainer, t
ransformState, mode, wasFixed, paintInvalidationState); | 253 parentDocRenderer->mapLocalToContainer(paintInvalidationContainer, t
ransformState, mode, wasFixed, paintInvalidationState); |
254 return; | 254 return; |
255 } | 255 } |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 259 const RenderObject* RenderView::pushMappingToContainer(const LayoutLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
260 { | 260 { |
261 LayoutSize offsetForFixedPosition; | 261 LayoutSize offsetForFixedPosition; |
262 LayoutSize offset; | 262 LayoutSize offset; |
263 RenderObject* container = 0; | 263 RenderObject* container = 0; |
264 | 264 |
265 if (m_frameView) | 265 if (m_frameView) |
266 offsetForFixedPosition = LayoutSize(m_frameView->scrollOffsetForViewport
ConstrainedObjects()); | 266 offsetForFixedPosition = LayoutSize(m_frameView->scrollOffsetForViewport
ConstrainedObjects()); |
267 | 267 |
268 if (geometryMap.mapCoordinatesFlags() & TraverseDocumentBoundaries) { | 268 if (geometryMap.mapCoordinatesFlags() & TraverseDocumentBoundaries) { |
269 if (RenderPart* parentDocRenderer = frame()->ownerRenderer()) { | 269 if (RenderPart* parentDocRenderer = frame()->ownerRenderer()) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 } | 319 } |
320 | 320 |
321 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) | 321 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) |
322 { | 322 { |
323 ASSERT(!needsLayout()); | 323 ASSERT(!needsLayout()); |
324 | 324 |
325 // We specifically need to issue paint invalidations for the viewRect since
other renderers | 325 // We specifically need to issue paint invalidations for the viewRect since
other renderers |
326 // short-circuit on full-paint invalidation. | 326 // short-circuit on full-paint invalidation. |
327 LayoutRect dirtyRect = viewRect(); | 327 LayoutRect dirtyRect = viewRect(); |
328 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { | 328 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { |
329 const RenderLayerModelObject* paintInvalidationContainer = &paintInvalid
ationState.paintInvalidationContainer(); | 329 const LayoutLayerModelObject* paintInvalidationContainer = &paintInvalid
ationState.paintInvalidationContainer(); |
330 RenderLayer::mapRectToPaintInvalidationBacking(this, paintInvalidationCo
ntainer, dirtyRect, &paintInvalidationState); | 330 Layer::mapRectToPaintInvalidationBacking(this, paintInvalidationContaine
r, dirtyRect, &paintInvalidationState); |
331 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Pai
ntInvalidationFull); | 331 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Pai
ntInvalidationFull); |
332 } | 332 } |
333 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); | 333 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); |
334 } | 334 } |
335 | 335 |
336 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation
Rect, PaintInvalidationReason invalidationReason) const | 336 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation
Rect, PaintInvalidationReason invalidationReason) const |
337 { | 337 { |
338 ASSERT(!paintInvalidationRect.isEmpty()); | 338 ASSERT(!paintInvalidationRect.isEmpty()); |
339 | 339 |
340 if (document().printing() || !m_frameView) | 340 if (document().printing() || !m_frameView) |
(...skipping 12 matching lines...) Expand all Loading... |
353 { | 353 { |
354 setShouldDoFullPaintInvalidation(); | 354 setShouldDoFullPaintInvalidation(); |
355 | 355 |
356 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. | 356 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. |
357 DisableCompositingQueryAsserts disabler; | 357 DisableCompositingQueryAsserts disabler; |
358 | 358 |
359 if (compositor()->inCompositingMode()) | 359 if (compositor()->inCompositingMode()) |
360 compositor()->fullyInvalidatePaint(); | 360 compositor()->fullyInvalidatePaint(); |
361 } | 361 } |
362 | 362 |
363 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* inv
alidationState) const | 363 void RenderView::mapRectToPaintInvalidationBacking(const LayoutLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* inv
alidationState) const |
364 { | 364 { |
365 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, IsNotFix
edPosition, invalidationState); | 365 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, IsNotFix
edPosition, invalidationState); |
366 } | 366 } |
367 | 367 |
368 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, ViewportConstrainedPosition viewp
ortConstraint, const PaintInvalidationState* state) const | 368 void RenderView::mapRectToPaintInvalidationBacking(const LayoutLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, ViewportConstrainedPosition viewp
ortConstraint, const PaintInvalidationState* state) const |
369 { | 369 { |
370 if (document().printing()) | 370 if (document().printing()) |
371 return; | 371 return; |
372 | 372 |
373 if (style()->isFlippedBlocksWritingMode()) { | 373 if (style()->isFlippedBlocksWritingMode()) { |
374 // We have to flip by hand since the view's logical height has not been
determined. We | 374 // We have to flip by hand since the view's logical height has not been
determined. We |
375 // can use the viewport width and height. | 375 // can use the viewport width and height. |
376 if (style()->isHorizontalWritingMode()) | 376 if (style()->isHorizontalWritingMode()) |
377 rect.setY(viewHeight() - rect.maxY()); | 377 rect.setY(viewHeight() - rect.maxY()); |
378 else | 378 else |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 } | 676 } |
677 | 677 |
678 // Any new blocks that remain were not found in the old blocks dict, and so
they need to be updated. | 678 // Any new blocks that remain were not found in the old blocks dict, and so
they need to be updated. |
679 SelectedBlockMap::iterator newBlocksEnd = newSelectedBlocks.end(); | 679 SelectedBlockMap::iterator newBlocksEnd = newSelectedBlocks.end(); |
680 for (SelectedBlockMap::iterator i = newSelectedBlocks.begin(); i != newBlock
sEnd; ++i) | 680 for (SelectedBlockMap::iterator i = newSelectedBlocks.begin(); i != newBlock
sEnd; ++i) |
681 i->key->setShouldInvalidateSelection(); | 681 i->key->setShouldInvalidateSelection(); |
682 } | 682 } |
683 | 683 |
684 void RenderView::clearSelection() | 684 void RenderView::clearSelection() |
685 { | 685 { |
686 // For querying RenderLayer::compositingState() | 686 // For querying Layer::compositingState() |
687 // This is correct, since destroying render objects needs to cause eager pai
nt invalidations. | 687 // This is correct, since destroying render objects needs to cause eager pai
nt invalidations. |
688 DisableCompositingQueryAsserts disabler; | 688 DisableCompositingQueryAsserts disabler; |
689 | 689 |
690 layer()->invalidatePaintForBlockSelectionGaps(); | 690 layer()->invalidatePaintForBlockSelectionGaps(); |
691 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld); | 691 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld); |
692 } | 692 } |
693 | 693 |
694 void RenderView::setSelection(const FrameSelection& selection) | 694 void RenderView::setSelection(const FrameSelection& selection) |
695 { | 695 { |
696 // No need to create a pending clearSelection() to be executed in PendingSel
ection::commit() | 696 // No need to create a pending clearSelection() to be executed in PendingSel
ection::commit() |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 | 925 |
926 result.setLocalPoint(adjustedPoint); | 926 result.setLocalPoint(adjustedPoint); |
927 } | 927 } |
928 } | 928 } |
929 | 929 |
930 bool RenderView::usesCompositing() const | 930 bool RenderView::usesCompositing() const |
931 { | 931 { |
932 return m_compositor && m_compositor->staleInCompositingMode(); | 932 return m_compositor && m_compositor->staleInCompositingMode(); |
933 } | 933 } |
934 | 934 |
935 RenderLayerCompositor* RenderView::compositor() | 935 LayerCompositor* RenderView::compositor() |
936 { | 936 { |
937 if (!m_compositor) | 937 if (!m_compositor) |
938 m_compositor = adoptPtr(new RenderLayerCompositor(*this)); | 938 m_compositor = adoptPtr(new LayerCompositor(*this)); |
939 | 939 |
940 return m_compositor.get(); | 940 return m_compositor.get(); |
941 } | 941 } |
942 | 942 |
943 void RenderView::setIsInWindow(bool isInWindow) | 943 void RenderView::setIsInWindow(bool isInWindow) |
944 { | 944 { |
945 if (m_compositor) | 945 if (m_compositor) |
946 m_compositor->setIsInWindow(isInWindow); | 946 m_compositor->setIsInWindow(isInWindow); |
947 } | 947 } |
948 | 948 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 } | 981 } |
982 | 982 |
983 void RenderView::invalidateDisplayItemClients(DisplayItemList* displayItemList)
const | 983 void RenderView::invalidateDisplayItemClients(DisplayItemList* displayItemList)
const |
984 { | 984 { |
985 RenderBlockFlow::invalidateDisplayItemClients(displayItemList); | 985 RenderBlockFlow::invalidateDisplayItemClients(displayItemList); |
986 if (m_frameView) | 986 if (m_frameView) |
987 displayItemList->invalidate(m_frameView->displayItemClient()); | 987 displayItemList->invalidate(m_frameView->displayItemClient()); |
988 } | 988 } |
989 | 989 |
990 } // namespace blink | 990 } // namespace blink |
OLD | NEW |