OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 // In this case, there is no need to dirty our ancestors further. | 466 // In this case, there is no need to dirty our ancestors further. |
467 if (layer->renderer()->isOutOfFlowPositioned()) { | 467 if (layer->renderer()->isOutOfFlowPositioned()) { |
468 ASSERT(!parent() || parent()->m_hasOutOfFlowPositionedDescendantDirt
y || parent()->hasOutOfFlowPositionedDescendant()); | 468 ASSERT(!parent() || parent()->m_hasOutOfFlowPositionedDescendantDirt
y || parent()->hasOutOfFlowPositionedDescendant()); |
469 break; | 469 break; |
470 } | 470 } |
471 } | 471 } |
472 } | 472 } |
473 | 473 |
474 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const | 474 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
475 { | 475 { |
476 const Settings* settings = renderer()->document()->settings(); | 476 const Settings* settings = renderer()->document().settings(); |
477 return settings && settings->acceleratedCompositingForOverflowScrollEnabled(
); | 477 return settings && settings->acceleratedCompositingForOverflowScrollEnabled(
); |
478 } | 478 } |
479 | 479 |
480 // FIXME: This is a temporary flag and should be removed once accelerated | 480 // FIXME: This is a temporary flag and should be removed once accelerated |
481 // overflow scroll is ready (crbug.com/254111). | 481 // overflow scroll is ready (crbug.com/254111). |
482 bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const | 482 bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const |
483 { | 483 { |
484 if (!acceleratedCompositingForOverflowScrollEnabled()) | 484 if (!acceleratedCompositingForOverflowScrollEnabled()) |
485 return false; | 485 return false; |
486 | 486 |
487 const Settings* settings = renderer()->document()->settings(); | 487 const Settings* settings = renderer()->document().settings(); |
488 return settings && settings->isCompositorDrivenAcceleratedScrollingEnabled()
; | 488 return settings && settings->isCompositorDrivenAcceleratedScrollingEnabled()
; |
489 } | 489 } |
490 | 490 |
491 // Determine whether the current layer can be promoted to a stacking container. | 491 // Determine whether the current layer can be promoted to a stacking container. |
492 // We do this by computing what positive and negative z-order lists would look | 492 // We do this by computing what positive and negative z-order lists would look |
493 // like before and after promotion, and ensuring that proper stacking order is | 493 // like before and after promotion, and ensuring that proper stacking order is |
494 // preserved between the two sets of lists. | 494 // preserved between the two sets of lists. |
495 void RenderLayer::updateCanBeStackingContainer() | 495 void RenderLayer::updateCanBeStackingContainer() |
496 { | 496 { |
497 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayer::updateCanBeStackin
gContainer"); | 497 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayer::updateCanBeStackin
gContainer"); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 // If the previous block is absolutely positioned, then we can't be paginate
d by the columns block. | 931 // If the previous block is absolutely positioned, then we can't be paginate
d by the columns block. |
932 if (prevBlock->isOutOfFlowPositioned()) | 932 if (prevBlock->isOutOfFlowPositioned()) |
933 return false; | 933 return false; |
934 | 934 |
935 // Otherwise we are paginated by the columns block. | 935 // Otherwise we are paginated by the columns block. |
936 return true; | 936 return true; |
937 } | 937 } |
938 | 938 |
939 bool RenderLayer::useRegionBasedColumns() const | 939 bool RenderLayer::useRegionBasedColumns() const |
940 { | 940 { |
941 const Settings* settings = renderer()->document()->settings(); | 941 const Settings* settings = renderer()->document().settings(); |
942 return settings && settings->regionBasedColumnsEnabled(); | 942 return settings && settings->regionBasedColumnsEnabled(); |
943 } | 943 } |
944 | 944 |
945 void RenderLayer::updatePagination() | 945 void RenderLayer::updatePagination() |
946 { | 946 { |
947 m_isPaginated = false; | 947 m_isPaginated = false; |
948 m_enclosingPaginationLayer = 0; | 948 m_enclosingPaginationLayer = 0; |
949 | 949 |
950 if (isComposited() || !parent()) | 950 if (isComposited() || !parent()) |
951 return; // FIXME: We will have to deal with paginated compositing layers
someday. | 951 return; // FIXME: We will have to deal with paginated compositing layers
someday. |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 | 2274 |
2275 if (compositor()->inCompositingMode() && usesCompositedScrolling()) | 2275 if (compositor()->inCompositingMode() && usesCompositedScrolling()) |
2276 requiresRepaint = false; | 2276 requiresRepaint = false; |
2277 | 2277 |
2278 // Just schedule a full repaint of our object. | 2278 // Just schedule a full repaint of our object. |
2279 if (view && requiresRepaint) | 2279 if (view && requiresRepaint) |
2280 renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(
m_repaintRect)); | 2280 renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(
m_repaintRect)); |
2281 | 2281 |
2282 // Schedule the scroll DOM event. | 2282 // Schedule the scroll DOM event. |
2283 if (renderer()->node()) | 2283 if (renderer()->node()) |
2284 renderer()->node()->document()->eventQueue()->enqueueOrDispatchScrollEve
nt(renderer()->node(), DocumentEventQueue::ScrollEventElementTarget); | 2284 renderer()->node()->document().eventQueue()->enqueueOrDispatchScrollEven
t(renderer()->node(), DocumentEventQueue::ScrollEventElementTarget); |
2285 | 2285 |
2286 InspectorInstrumentation::didScrollLayer(renderer()); | 2286 InspectorInstrumentation::didScrollLayer(renderer()); |
2287 } | 2287 } |
2288 | 2288 |
2289 static inline bool frameElementAndViewPermitScroll(HTMLFrameElementBase* frameEl
ementBase, FrameView* frameView) | 2289 static inline bool frameElementAndViewPermitScroll(HTMLFrameElementBase* frameEl
ementBase, FrameView* frameView) |
2290 { | 2290 { |
2291 // If scrollbars aren't explicitly forbidden, permit scrolling. | 2291 // If scrollbars aren't explicitly forbidden, permit scrolling. |
2292 if (frameElementBase && frameElementBase->scrollingMode() != ScrollbarAlways
Off) | 2292 if (frameElementBase && frameElementBase->scrollingMode() != ScrollbarAlways
Off) |
2293 return true; | 2293 return true; |
2294 | 2294 |
2295 // If scrollbars are forbidden, user initiated scrolls should obviously be i
gnored. | 2295 // If scrollbars are forbidden, user initiated scrolls should obviously be i
gnored. |
2296 if (frameView->wasScrolledByUser()) | 2296 if (frameView->wasScrolledByUser()) |
2297 return false; | 2297 return false; |
2298 | 2298 |
2299 // Forbid autoscrolls when scrollbars are off, but permits other programmati
c scrolls, | 2299 // Forbid autoscrolls when scrollbars are off, but permits other programmati
c scrolls, |
2300 // like navigation to an anchor. | 2300 // like navigation to an anchor. |
2301 Page* page = frameView->frame()->page(); | 2301 Page* page = frameView->frame()->page(); |
2302 if (!page) | 2302 if (!page) |
2303 return false; | 2303 return false; |
2304 return !page->autoscrollInProgress(); | 2304 return !page->autoscrollInProgress(); |
2305 } | 2305 } |
2306 | 2306 |
2307 void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignm
ent& alignX, const ScrollAlignment& alignY) | 2307 void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignm
ent& alignX, const ScrollAlignment& alignY) |
2308 { | 2308 { |
2309 RenderLayer* parentLayer = 0; | 2309 RenderLayer* parentLayer = 0; |
2310 LayoutRect newRect = rect; | 2310 LayoutRect newRect = rect; |
2311 | 2311 |
2312 // We may end up propagating a scroll event. It is important that we suspend
events until | 2312 // We may end up propagating a scroll event. It is important that we suspend
events until |
2313 // the end of the function since they could delete the layer or the layer's
renderer(). | 2313 // the end of the function since they could delete the layer or the layer's
renderer(). |
2314 FrameView* frameView = renderer()->document()->view(); | 2314 FrameView* frameView = renderer()->document().view(); |
2315 if (frameView) | 2315 if (frameView) |
2316 frameView->pauseScheduledEvents(); | 2316 frameView->pauseScheduledEvents(); |
2317 | 2317 |
2318 bool restrictedByLineClamp = false; | 2318 bool restrictedByLineClamp = false; |
2319 if (renderer()->parent()) { | 2319 if (renderer()->parent()) { |
2320 parentLayer = renderer()->parent()->enclosingLayer(); | 2320 parentLayer = renderer()->parent()->enclosingLayer(); |
2321 restrictedByLineClamp = !renderer()->parent()->style()->lineClamp().isNo
ne(); | 2321 restrictedByLineClamp = !renderer()->parent()->style()->lineClamp().isNo
ne(); |
2322 } | 2322 } |
2323 | 2323 |
2324 if (renderer()->hasOverflowClip() && !restrictedByLineClamp) { | 2324 if (renderer()->hasOverflowClip() && !restrictedByLineClamp) { |
2325 // Don't scroll to reveal an overflow layer that is restricted by the -w
ebkit-line-clamp property. | 2325 // Don't scroll to reveal an overflow layer that is restricted by the -w
ebkit-line-clamp property. |
2326 // This will prevent us from revealing text hidden by the slider in Safa
ri RSS. | 2326 // This will prevent us from revealing text hidden by the slider in Safa
ri RSS. |
2327 RenderBox* box = renderBox(); | 2327 RenderBox* box = renderBox(); |
2328 ASSERT(box); | 2328 ASSERT(box); |
2329 LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(
rect)), UseTransforms).boundingBox()); | 2329 LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(
rect)), UseTransforms).boundingBox()); |
2330 LayoutRect layerBounds(0, 0, box->clientWidth(), box->clientHeight()); | 2330 LayoutRect layerBounds(0, 0, box->clientWidth(), box->clientHeight()); |
2331 LayoutRect r = getRectToExpose(layerBounds, localExposeRect, alignX, ali
gnY); | 2331 LayoutRect r = getRectToExpose(layerBounds, localExposeRect, alignX, ali
gnY); |
2332 | 2332 |
2333 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset() +
toIntSize(roundedIntRect(r).location())); | 2333 IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset() +
toIntSize(roundedIntRect(r).location())); |
2334 if (clampedScrollOffset != adjustedScrollOffset()) { | 2334 if (clampedScrollOffset != adjustedScrollOffset()) { |
2335 IntSize oldScrollOffset = adjustedScrollOffset(); | 2335 IntSize oldScrollOffset = adjustedScrollOffset(); |
2336 scrollToOffset(clampedScrollOffset); | 2336 scrollToOffset(clampedScrollOffset); |
2337 IntSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollO
ffset; | 2337 IntSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollO
ffset; |
2338 localExposeRect.move(-scrollOffsetDifference); | 2338 localExposeRect.move(-scrollOffsetDifference); |
2339 newRect = LayoutRect(box->localToAbsoluteQuad(FloatQuad(FloatRect(lo
calExposeRect)), UseTransforms).boundingBox()); | 2339 newRect = LayoutRect(box->localToAbsoluteQuad(FloatQuad(FloatRect(lo
calExposeRect)), UseTransforms).boundingBox()); |
2340 } | 2340 } |
2341 } else if (!parentLayer && renderer()->isBox() && renderBox()->canBePrograma
ticallyScrolled()) { | 2341 } else if (!parentLayer && renderer()->isBox() && renderBox()->canBePrograma
ticallyScrolled()) { |
2342 if (frameView) { | 2342 if (frameView) { |
2343 Element* ownerElement = 0; | 2343 Element* ownerElement = renderer()->document().ownerElement(); |
2344 if (renderer()->document()) | |
2345 ownerElement = renderer()->document()->ownerElement(); | |
2346 | 2344 |
2347 if (ownerElement && ownerElement->renderer()) { | 2345 if (ownerElement && ownerElement->renderer()) { |
2348 HTMLFrameElementBase* frameElementBase = 0; | 2346 HTMLFrameElementBase* frameElementBase = 0; |
2349 | 2347 |
2350 if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagNa
me(iframeTag)) | 2348 if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagNa
me(iframeTag)) |
2351 frameElementBase = toHTMLFrameElementBase(ownerElement); | 2349 frameElementBase = toHTMLFrameElementBase(ownerElement); |
2352 | 2350 |
2353 if (frameElementAndViewPermitScroll(frameElementBase, frameView)
) { | 2351 if (frameElementAndViewPermitScroll(frameElementBase, frameView)
) { |
2354 LayoutRect viewRect = frameView->visibleContentRect(); | 2352 LayoutRect viewRect = frameView->visibleContentRect(); |
2355 LayoutRect exposeRect = getRectToExpose(viewRect, rect, alig
nX, alignY); | 2353 LayoutRect exposeRect = getRectToExpose(viewRect, rect, alig
nX, alignY); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 void RenderLayer::resize(const PlatformEvent& evt, const LayoutSize& oldOffset) | 2497 void RenderLayer::resize(const PlatformEvent& evt, const LayoutSize& oldOffset) |
2500 { | 2498 { |
2501 // FIXME: This should be possible on generated content but is not right now. | 2499 // FIXME: This should be possible on generated content but is not right now. |
2502 if (!inResizeMode() || !canResize() || !renderer()->node()) | 2500 if (!inResizeMode() || !canResize() || !renderer()->node()) |
2503 return; | 2501 return; |
2504 | 2502 |
2505 ASSERT(renderer()->node()->isElementNode()); | 2503 ASSERT(renderer()->node()->isElementNode()); |
2506 Element* element = toElement(renderer()->node()); | 2504 Element* element = toElement(renderer()->node()); |
2507 RenderBox* renderer = toRenderBox(element->renderer()); | 2505 RenderBox* renderer = toRenderBox(element->renderer()); |
2508 | 2506 |
2509 Document* document = element->document(); | 2507 Document& document = element->document(); |
2510 | 2508 |
2511 IntPoint pos; | 2509 IntPoint pos; |
2512 const PlatformGestureEvent* gevt = 0; | 2510 const PlatformGestureEvent* gevt = 0; |
2513 | 2511 |
2514 switch (evt.type()) { | 2512 switch (evt.type()) { |
2515 case PlatformEvent::MouseMoved: | 2513 case PlatformEvent::MouseMoved: |
2516 if (!document->frame()->eventHandler()->mousePressed()) | 2514 if (!document.frame()->eventHandler()->mousePressed()) |
2517 return; | 2515 return; |
2518 pos = static_cast<const PlatformMouseEvent*>(&evt)->position(); | 2516 pos = static_cast<const PlatformMouseEvent*>(&evt)->position(); |
2519 break; | 2517 break; |
2520 case PlatformEvent::GestureScrollUpdate: | 2518 case PlatformEvent::GestureScrollUpdate: |
2521 case PlatformEvent::GestureScrollUpdateWithoutPropagation: | 2519 case PlatformEvent::GestureScrollUpdateWithoutPropagation: |
2522 pos = static_cast<const PlatformGestureEvent*>(&evt)->position(); | 2520 pos = static_cast<const PlatformGestureEvent*>(&evt)->position(); |
2523 gevt = static_cast<const PlatformGestureEvent*>(&evt); | 2521 gevt = static_cast<const PlatformGestureEvent*>(&evt); |
2524 pos = gevt->position(); | 2522 pos = gevt->position(); |
2525 pos.move(gevt->deltaX(), gevt->deltaY()); | 2523 pos.move(gevt->deltaX(), gevt->deltaY()); |
2526 break; | 2524 break; |
2527 default: | 2525 default: |
2528 ASSERT_NOT_REACHED(); | 2526 ASSERT_NOT_REACHED(); |
2529 } | 2527 } |
2530 | 2528 |
2531 float zoomFactor = renderer->style()->effectiveZoom(); | 2529 float zoomFactor = renderer->style()->effectiveZoom(); |
2532 | 2530 |
2533 LayoutSize newOffset = offsetFromResizeCorner(document->view()->windowToCont
ents(pos)); | 2531 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte
nts(pos)); |
2534 newOffset.setWidth(newOffset.width() / zoomFactor); | 2532 newOffset.setWidth(newOffset.width() / zoomFactor); |
2535 newOffset.setHeight(newOffset.height() / zoomFactor); | 2533 newOffset.setHeight(newOffset.height() / zoomFactor); |
2536 | 2534 |
2537 LayoutSize currentSize = LayoutSize(renderer->width() / zoomFactor, renderer
->height() / zoomFactor); | 2535 LayoutSize currentSize = LayoutSize(renderer->width() / zoomFactor, renderer
->height() / zoomFactor); |
2538 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentS
ize); | 2536 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentS
ize); |
2539 element->setMinimumSizeForResizing(minimumSize); | 2537 element->setMinimumSizeForResizing(minimumSize); |
2540 | 2538 |
2541 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol
dOffset.height() / zoomFactor); | 2539 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol
dOffset.height() / zoomFactor); |
2542 if (renderer->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { | 2540 if (renderer->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
2543 newOffset.setWidth(-newOffset.width()); | 2541 newOffset.setWidth(-newOffset.width()); |
(...skipping 20 matching lines...) Expand all Loading... |
2564 if (element->isFormControlElement()) { | 2562 if (element->isFormControlElement()) { |
2565 // Make implicit margins from the theme explicit (see <http://bugs.w
ebkit.org/show_bug.cgi?id=9547>). | 2563 // Make implicit margins from the theme explicit (see <http://bugs.w
ebkit.org/show_bug.cgi?id=9547>). |
2566 element->setInlineStyleProperty(CSSPropertyMarginTop, renderer->marg
inTop() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 2564 element->setInlineStyleProperty(CSSPropertyMarginTop, renderer->marg
inTop() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
2567 element->setInlineStyleProperty(CSSPropertyMarginBottom, renderer->m
arginBottom() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 2565 element->setInlineStyleProperty(CSSPropertyMarginBottom, renderer->m
arginBottom() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
2568 } | 2566 } |
2569 LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? Layout
Unit() : renderer->borderAndPaddingHeight()); | 2567 LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? Layout
Unit() : renderer->borderAndPaddingHeight()); |
2570 baseHeight = baseHeight / zoomFactor; | 2568 baseHeight = baseHeight / zoomFactor; |
2571 element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight
+ difference.height()), CSSPrimitiveValue::CSS_PX); | 2569 element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight
+ difference.height()), CSSPrimitiveValue::CSS_PX); |
2572 } | 2570 } |
2573 | 2571 |
2574 document->updateLayout(); | 2572 document.updateLayout(); |
2575 | 2573 |
2576 // FIXME (Radar 4118564): We should also autoscroll the window as necessary
to keep the point under the cursor in view. | 2574 // FIXME (Radar 4118564): We should also autoscroll the window as necessary
to keep the point under the cursor in view. |
2577 } | 2575 } |
2578 | 2576 |
2579 int RenderLayer::scrollSize(ScrollbarOrientation orientation) const | 2577 int RenderLayer::scrollSize(ScrollbarOrientation orientation) const |
2580 { | 2578 { |
2581 IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition()
; | 2579 IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition()
; |
2582 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scr
ollDimensions.height(); | 2580 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scr
ollDimensions.height(); |
2583 } | 2581 } |
2584 | 2582 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2890 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st
yle()->hasPseudoStyle(SCROLLBAR); | 2888 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st
yle()->hasPseudoStyle(SCROLLBAR); |
2891 if (hasCustomScrollbarStyle) | 2889 if (hasCustomScrollbarStyle) |
2892 widget = RenderScrollbar::createCustomScrollbar(scrollableArea(), orient
ation, actualRenderer->node()); | 2890 widget = RenderScrollbar::createCustomScrollbar(scrollableArea(), orient
ation, actualRenderer->node()); |
2893 else { | 2891 else { |
2894 widget = Scrollbar::createNativeScrollbar(scrollableArea(), orientation,
RegularScrollbar); | 2892 widget = Scrollbar::createNativeScrollbar(scrollableArea(), orientation,
RegularScrollbar); |
2895 if (orientation == HorizontalScrollbar) | 2893 if (orientation == HorizontalScrollbar) |
2896 scrollableArea()->didAddHorizontalScrollbar(widget.get()); | 2894 scrollableArea()->didAddHorizontalScrollbar(widget.get()); |
2897 else | 2895 else |
2898 scrollableArea()->didAddVerticalScrollbar(widget.get()); | 2896 scrollableArea()->didAddVerticalScrollbar(widget.get()); |
2899 } | 2897 } |
2900 renderer()->document()->view()->addChild(widget.get()); | 2898 renderer()->document().view()->addChild(widget.get()); |
2901 return widget.release(); | 2899 return widget.release(); |
2902 } | 2900 } |
2903 | 2901 |
2904 void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation) | 2902 void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation) |
2905 { | 2903 { |
2906 RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar :
m_vBar; | 2904 RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar :
m_vBar; |
2907 if (!scrollbar) | 2905 if (!scrollbar) |
2908 return; | 2906 return; |
2909 | 2907 |
2910 if (!scrollbar->isCustomScrollbar()) { | 2908 if (!scrollbar->isCustomScrollbar()) { |
(...skipping 18 matching lines...) Expand all Loading... |
2929 else | 2927 else |
2930 destroyScrollbar(HorizontalScrollbar); | 2928 destroyScrollbar(HorizontalScrollbar); |
2931 | 2929 |
2932 // Destroying or creating one bar can cause our scrollbar corner to come and
go. We need to update the opposite scrollbar's style. | 2930 // Destroying or creating one bar can cause our scrollbar corner to come and
go. We need to update the opposite scrollbar's style. |
2933 if (m_hBar) | 2931 if (m_hBar) |
2934 m_hBar->styleChanged(); | 2932 m_hBar->styleChanged(); |
2935 if (m_vBar) | 2933 if (m_vBar) |
2936 m_vBar->styleChanged(); | 2934 m_vBar->styleChanged(); |
2937 | 2935 |
2938 // Force an update since we know the scrollbars have changed things. | 2936 // Force an update since we know the scrollbars have changed things. |
2939 if (renderer()->document()->hasAnnotatedRegions()) | 2937 if (renderer()->document().hasAnnotatedRegions()) |
2940 renderer()->document()->setAnnotatedRegionsDirty(true); | 2938 renderer()->document().setAnnotatedRegionsDirty(true); |
2941 } | 2939 } |
2942 | 2940 |
2943 void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar) | 2941 void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar) |
2944 { | 2942 { |
2945 if (hasScrollbar == hasVerticalScrollbar()) | 2943 if (hasScrollbar == hasVerticalScrollbar()) |
2946 return; | 2944 return; |
2947 | 2945 |
2948 if (hasScrollbar) | 2946 if (hasScrollbar) |
2949 m_vBar = createScrollbar(VerticalScrollbar); | 2947 m_vBar = createScrollbar(VerticalScrollbar); |
2950 else | 2948 else |
2951 destroyScrollbar(VerticalScrollbar); | 2949 destroyScrollbar(VerticalScrollbar); |
2952 | 2950 |
2953 // Destroying or creating one bar can cause our scrollbar corner to come an
d go. We need to update the opposite scrollbar's style. | 2951 // Destroying or creating one bar can cause our scrollbar corner to come an
d go. We need to update the opposite scrollbar's style. |
2954 if (m_hBar) | 2952 if (m_hBar) |
2955 m_hBar->styleChanged(); | 2953 m_hBar->styleChanged(); |
2956 if (m_vBar) | 2954 if (m_vBar) |
2957 m_vBar->styleChanged(); | 2955 m_vBar->styleChanged(); |
2958 | 2956 |
2959 // Force an update since we know the scrollbars have changed things. | 2957 // Force an update since we know the scrollbars have changed things. |
2960 if (renderer()->document()->hasAnnotatedRegions()) | 2958 if (renderer()->document().hasAnnotatedRegions()) |
2961 renderer()->document()->setAnnotatedRegionsDirty(true); | 2959 renderer()->document().setAnnotatedRegionsDirty(true); |
2962 } | 2960 } |
2963 | 2961 |
2964 ScrollableArea* RenderLayer::enclosingScrollableArea() const | 2962 ScrollableArea* RenderLayer::enclosingScrollableArea() const |
2965 { | 2963 { |
2966 if (RenderLayer* scrollableLayer = enclosingScrollableLayer()) | 2964 if (RenderLayer* scrollableLayer = enclosingScrollableLayer()) |
2967 return scrollableLayer->scrollableArea(); | 2965 return scrollableLayer->scrollableArea(); |
2968 | 2966 |
2969 // FIXME: We should return the frame view here (or possibly an ancestor fram
e view, | 2967 // FIXME: We should return the frame view here (or possibly an ancestor fram
e view, |
2970 // if the frame view isn't scrollable. | 2968 // if the frame view isn't scrollable. |
2971 return 0; | 2969 return 0; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3114 | 3112 |
3115 if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged) { | 3113 if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged) { |
3116 if (box->hasAutoHorizontalScrollbar()) | 3114 if (box->hasAutoHorizontalScrollbar()) |
3117 setHasHorizontalScrollbar(hasHorizontalOverflow); | 3115 setHasHorizontalScrollbar(hasHorizontalOverflow); |
3118 if (box->hasAutoVerticalScrollbar()) | 3116 if (box->hasAutoVerticalScrollbar()) |
3119 setHasVerticalScrollbar(hasVerticalOverflow); | 3117 setHasVerticalScrollbar(hasVerticalOverflow); |
3120 | 3118 |
3121 updateSelfPaintingLayer(); | 3119 updateSelfPaintingLayer(); |
3122 | 3120 |
3123 // Force an update since we know the scrollbars have changed things. | 3121 // Force an update since we know the scrollbars have changed things. |
3124 if (renderer()->document()->hasAnnotatedRegions()) | 3122 if (renderer()->document().hasAnnotatedRegions()) |
3125 renderer()->document()->setAnnotatedRegionsDirty(true); | 3123 renderer()->document().setAnnotatedRegionsDirty(true); |
3126 | 3124 |
3127 renderer()->repaint(); | 3125 renderer()->repaint(); |
3128 | 3126 |
3129 if (renderer()->style()->overflowX() == OAUTO || renderer()->style()->ov
erflowY() == OAUTO) { | 3127 if (renderer()->style()->overflowX() == OAUTO || renderer()->style()->ov
erflowY() == OAUTO) { |
3130 if (!m_inOverflowRelayout) { | 3128 if (!m_inOverflowRelayout) { |
3131 // Our proprietary overflow: overlay value doesn't trigger a lay
out. | 3129 // Our proprietary overflow: overlay value doesn't trigger a lay
out. |
3132 m_inOverflowRelayout = true; | 3130 m_inOverflowRelayout = true; |
3133 SubtreeLayoutScope layoutScope(renderer()); | 3131 SubtreeLayoutScope layoutScope(renderer()); |
3134 layoutScope.setNeedsLayout(renderer()); | 3132 layoutScope.setNeedsLayout(renderer()); |
3135 if (renderer()->isRenderBlock()) { | 3133 if (renderer()->isRenderBlock()) { |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3517 static bool shouldDoSoftwarePaint(const RenderLayer* layer, bool paintingReflect
ion) | 3515 static bool shouldDoSoftwarePaint(const RenderLayer* layer, bool paintingReflect
ion) |
3518 { | 3516 { |
3519 return paintingReflection && !layer->has3DTransform(); | 3517 return paintingReflection && !layer->has3DTransform(); |
3520 } | 3518 } |
3521 | 3519 |
3522 static inline bool shouldSuppressPaintingLayer(RenderLayer* layer) | 3520 static inline bool shouldSuppressPaintingLayer(RenderLayer* layer) |
3523 { | 3521 { |
3524 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. | 3522 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. |
3525 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document | 3523 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document |
3526 // will do a full repaint(). | 3524 // will do a full repaint(). |
3527 if (layer->renderer()->document()->didLayoutWithPendingStylesheets() && !lay
er->isRootLayer() && !layer->renderer()->isRoot()) | 3525 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye
r->isRootLayer() && !layer->renderer()->isRoot()) |
3528 return true; | 3526 return true; |
3529 | 3527 |
3530 return false; | 3528 return false; |
3531 } | 3529 } |
3532 | 3530 |
3533 static bool paintForFixedRootBackground(const RenderLayer* layer, RenderLayer::P
aintLayerFlags paintFlags) | 3531 static bool paintForFixedRootBackground(const RenderLayer* layer, RenderLayer::P
aintLayerFlags paintFlags) |
3534 { | 3532 { |
3535 return layer->renderer()->isRoot() && (paintFlags & RenderLayer::PaintLayerP
aintingRootBackgroundOnly); | 3533 return layer->renderer()->isRoot() && (paintFlags & RenderLayer::PaintLayerP
aintingRootBackgroundOnly); |
3536 } | 3534 } |
3537 | 3535 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3683 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperatio
n*>(style->clipPath()); | 3681 ShapeClipPathOperation* clipPath = static_cast<ShapeClipPathOperatio
n*>(style->clipPath()); |
3684 | 3682 |
3685 if (!rootRelativeBoundsComputed) { | 3683 if (!rootRelativeBoundsComputed) { |
3686 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer
, &offsetFromRoot, 0); | 3684 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer
, &offsetFromRoot, 0); |
3687 rootRelativeBoundsComputed = true; | 3685 rootRelativeBoundsComputed = true; |
3688 } | 3686 } |
3689 | 3687 |
3690 context->clipPath(clipPath->path(rootRelativeBounds), clipPath->wind
Rule()); | 3688 context->clipPath(clipPath->path(rootRelativeBounds), clipPath->wind
Rule()); |
3691 } else if (style->clipPath()->getOperationType() == ClipPathOperation::R
EFERENCE) { | 3689 } else if (style->clipPath()->getOperationType() == ClipPathOperation::R
EFERENCE) { |
3692 ReferenceClipPathOperation* referenceClipPathOperation = static_cast
<ReferenceClipPathOperation*>(style->clipPath()); | 3690 ReferenceClipPathOperation* referenceClipPathOperation = static_cast
<ReferenceClipPathOperation*>(style->clipPath()); |
3693 Document* document = renderer()->document(); | 3691 Document& document = renderer()->document(); |
3694 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) | 3692 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) |
3695 Element* element = document ? document->getElementById(referenceClip
PathOperation->fragment()) : 0; | 3693 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); |
3696 if (element && element->hasTagName(SVGNames::clipPathTag) && element
->renderer()) { | 3694 if (element && element->hasTagName(SVGNames::clipPathTag) && element
->renderer()) { |
3697 if (!rootRelativeBoundsComputed) { | 3695 if (!rootRelativeBoundsComputed) { |
3698 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootL
ayer, &offsetFromRoot, 0); | 3696 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootL
ayer, &offsetFromRoot, 0); |
3699 rootRelativeBoundsComputed = true; | 3697 rootRelativeBoundsComputed = true; |
3700 } | 3698 } |
3701 | 3699 |
3702 // FIXME: This should use a safer cast such as toRenderSVGResour
ceContainer(). | 3700 // FIXME: This should use a safer cast such as toRenderSVGResour
ceContainer(). |
3703 resourceClipper = static_cast<RenderSVGResourceClipper*>(element
->renderer()); | 3701 resourceClipper = static_cast<RenderSVGResourceClipper*>(element
->renderer()); |
3704 if (!resourceClipper->applyClippingToContext(renderer(), rootRel
ativeBounds, paintingInfo.paintDirtyRect, context)) { | 3702 if (!resourceClipper->applyClippingToContext(renderer(), rootRel
ativeBounds, paintingInfo.paintDirtyRect, context)) { |
3705 // No need to post-apply the clipper if this failed. | 3703 // No need to post-apply the clipper if this failed. |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4248 LayoutUnit blockDelta = isHorizontal ? colRect.height() : colRect.width(
); | 4246 LayoutUnit blockDelta = isHorizontal ? colRect.height() : colRect.width(
); |
4249 if (columnBlock->style()->isFlippedBlocksWritingMode()) | 4247 if (columnBlock->style()->isFlippedBlocksWritingMode()) |
4250 currLogicalTopOffset += blockDelta; | 4248 currLogicalTopOffset += blockDelta; |
4251 else | 4249 else |
4252 currLogicalTopOffset -= blockDelta; | 4250 currLogicalTopOffset -= blockDelta; |
4253 } | 4251 } |
4254 } | 4252 } |
4255 | 4253 |
4256 static inline LayoutRect frameVisibleRect(RenderObject* renderer) | 4254 static inline LayoutRect frameVisibleRect(RenderObject* renderer) |
4257 { | 4255 { |
4258 FrameView* frameView = renderer->document()->view(); | 4256 FrameView* frameView = renderer->document().view(); |
4259 if (!frameView) | 4257 if (!frameView) |
4260 return LayoutRect(); | 4258 return LayoutRect(); |
4261 | 4259 |
4262 return frameView->visibleContentRect(); | 4260 return frameView->visibleContentRect(); |
4263 } | 4261 } |
4264 | 4262 |
4265 bool RenderLayer::hitTest(const HitTestRequest& request, HitTestResult& result) | 4263 bool RenderLayer::hitTest(const HitTestRequest& request, HitTestResult& result) |
4266 { | 4264 { |
4267 return hitTest(request, result.hitTestLocation(), result); | 4265 return hitTest(request, result.hitTestLocation(), result); |
4268 } | 4266 } |
4269 | 4267 |
4270 bool RenderLayer::hitTest(const HitTestRequest& request, const HitTestLocation&
hitTestLocation, HitTestResult& result) | 4268 bool RenderLayer::hitTest(const HitTestRequest& request, const HitTestLocation&
hitTestLocation, HitTestResult& result) |
4271 { | 4269 { |
4272 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | 4270 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
4273 | 4271 |
4274 // RenderView should make sure to update layout before entering hit testing | 4272 // RenderView should make sure to update layout before entering hit testing |
4275 ASSERT(!renderer()->frame()->view()->layoutPending()); | 4273 ASSERT(!renderer()->frame()->view()->layoutPending()); |
4276 ASSERT(!renderer()->document()->renderer()->needsLayout()); | 4274 ASSERT(!renderer()->document().renderer()->needsLayout()); |
4277 | 4275 |
4278 LayoutRect hitTestArea = isOutOfFlowRenderFlowThread() ? toRenderFlowThread(
renderer())->borderBoxRect() : renderer()->view()->documentRect(); | 4276 LayoutRect hitTestArea = isOutOfFlowRenderFlowThread() ? toRenderFlowThread(
renderer())->borderBoxRect() : renderer()->view()->documentRect(); |
4279 if (!request.ignoreClipping()) | 4277 if (!request.ignoreClipping()) |
4280 hitTestArea.intersect(frameVisibleRect(renderer())); | 4278 hitTestArea.intersect(frameVisibleRect(renderer())); |
4281 | 4279 |
4282 RenderLayer* insideLayer = hitTestLayer(this, 0, request, result, hitTestAre
a, hitTestLocation, false); | 4280 RenderLayer* insideLayer = hitTestLayer(this, 0, request, result, hitTestAre
a, hitTestLocation, false); |
4283 if (!insideLayer) { | 4281 if (!insideLayer) { |
4284 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, | 4282 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, |
4285 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has | 4283 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has |
4286 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. | 4284 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. |
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6117 // Overlay scrollbars can make this layer self-painting so we need | 6115 // Overlay scrollbars can make this layer self-painting so we need |
6118 // to recompute the bit once scrollbars have been updated. | 6116 // to recompute the bit once scrollbars have been updated. |
6119 updateSelfPaintingLayer(); | 6117 updateSelfPaintingLayer(); |
6120 updateOutOfFlowPositioned(oldStyle); | 6118 updateOutOfFlowPositioned(oldStyle); |
6121 | 6119 |
6122 if (!hasReflection() && m_reflection) | 6120 if (!hasReflection() && m_reflection) |
6123 removeReflection(); | 6121 removeReflection(); |
6124 else if (hasReflection()) { | 6122 else if (hasReflection()) { |
6125 if (!m_reflection) | 6123 if (!m_reflection) |
6126 createReflection(); | 6124 createReflection(); |
6127 UseCounter::count(renderer()->document(), UseCounter::Reflection); | 6125 UseCounter::count(&renderer()->document(), UseCounter::Reflection); |
6128 updateReflectionStyle(); | 6126 updateReflectionStyle(); |
6129 } | 6127 } |
6130 | 6128 |
6131 // FIXME: Need to detect a swap from custom to native scrollbars (and vice v
ersa). | 6129 // FIXME: Need to detect a swap from custom to native scrollbars (and vice v
ersa). |
6132 if (m_hBar) | 6130 if (m_hBar) |
6133 m_hBar->styleChanged(); | 6131 m_hBar->styleChanged(); |
6134 if (m_vBar) | 6132 if (m_vBar) |
6135 m_vBar->styleChanged(); | 6133 m_vBar->styleChanged(); |
6136 | 6134 |
6137 updateScrollCornerStyle(); | 6135 updateScrollCornerStyle(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6194 setNeedsCompositedScrolling(false); | 6192 setNeedsCompositedScrolling(false); |
6195 } | 6193 } |
6196 } | 6194 } |
6197 | 6195 |
6198 void RenderLayer::updateScrollCornerStyle() | 6196 void RenderLayer::updateScrollCornerStyle() |
6199 { | 6197 { |
6200 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6198 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
6201 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer-
>getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st
yle()) : PassRefPtr<RenderStyle>(0); | 6199 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer-
>getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st
yle()) : PassRefPtr<RenderStyle>(0); |
6202 if (corner) { | 6200 if (corner) { |
6203 if (!m_scrollCorner) { | 6201 if (!m_scrollCorner) { |
6204 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do
cument()); | 6202 m_scrollCorner = RenderScrollbarPart::createAnonymous(&renderer()->d
ocument()); |
6205 m_scrollCorner->setParent(renderer()); | 6203 m_scrollCorner->setParent(renderer()); |
6206 } | 6204 } |
6207 m_scrollCorner->setStyle(corner.release()); | 6205 m_scrollCorner->setStyle(corner.release()); |
6208 } else if (m_scrollCorner) { | 6206 } else if (m_scrollCorner) { |
6209 m_scrollCorner->destroy(); | 6207 m_scrollCorner->destroy(); |
6210 m_scrollCorner = 0; | 6208 m_scrollCorner = 0; |
6211 } | 6209 } |
6212 } | 6210 } |
6213 | 6211 |
6214 void RenderLayer::updateResizerStyle() | 6212 void RenderLayer::updateResizerStyle() |
6215 { | 6213 { |
6216 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6214 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
6217 RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer
->getUncachedPseudoStyle(PseudoStyleRequest(RESIZER), actualRenderer->style()) :
PassRefPtr<RenderStyle>(0); | 6215 RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer
->getUncachedPseudoStyle(PseudoStyleRequest(RESIZER), actualRenderer->style()) :
PassRefPtr<RenderStyle>(0); |
6218 if (resizer) { | 6216 if (resizer) { |
6219 if (!m_resizer) { | 6217 if (!m_resizer) { |
6220 m_resizer = RenderScrollbarPart::createAnonymous(renderer()->documen
t()); | 6218 m_resizer = RenderScrollbarPart::createAnonymous(&renderer()->docume
nt()); |
6221 m_resizer->setParent(renderer()); | 6219 m_resizer->setParent(renderer()); |
6222 } | 6220 } |
6223 m_resizer->setStyle(resizer.release()); | 6221 m_resizer->setStyle(resizer.release()); |
6224 } else if (m_resizer) { | 6222 } else if (m_resizer) { |
6225 m_resizer->destroy(); | 6223 m_resizer->destroy(); |
6226 m_resizer = 0; | 6224 m_resizer = 0; |
6227 } | 6225 } |
6228 } | 6226 } |
6229 | 6227 |
6230 RenderLayer* RenderLayer::reflectionLayer() const | 6228 RenderLayer* RenderLayer::reflectionLayer() const |
6231 { | 6229 { |
6232 return m_reflection ? m_reflection->layer() : 0; | 6230 return m_reflection ? m_reflection->layer() : 0; |
6233 } | 6231 } |
6234 | 6232 |
6235 void RenderLayer::createReflection() | 6233 void RenderLayer::createReflection() |
6236 { | 6234 { |
6237 ASSERT(!m_reflection); | 6235 ASSERT(!m_reflection); |
6238 m_reflection = RenderReplica::createAnonymous(renderer()->document()); | 6236 m_reflection = RenderReplica::createAnonymous(&renderer()->document()); |
6239 m_reflection->setParent(renderer()); // We create a 1-way connection. | 6237 m_reflection->setParent(renderer()); // We create a 1-way connection. |
6240 } | 6238 } |
6241 | 6239 |
6242 void RenderLayer::removeReflection() | 6240 void RenderLayer::removeReflection() |
6243 { | 6241 { |
6244 if (!m_reflection->documentBeingDestroyed()) | 6242 if (!m_reflection->documentBeingDestroyed()) |
6245 m_reflection->removeLayers(this); | 6243 m_reflection->removeLayers(this); |
6246 | 6244 |
6247 m_reflection->setParent(0); | 6245 m_reflection->setParent(0); |
6248 m_reflection->destroy(); | 6246 m_reflection->destroy(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6282 | 6280 |
6283 // Map in our mask. | 6281 // Map in our mask. |
6284 newStyle->setMaskBoxImage(renderer()->style()->boxReflect()->mask()); | 6282 newStyle->setMaskBoxImage(renderer()->style()->boxReflect()->mask()); |
6285 | 6283 |
6286 m_reflection->setStyle(newStyle.release()); | 6284 m_reflection->setStyle(newStyle.release()); |
6287 } | 6285 } |
6288 | 6286 |
6289 bool RenderLayer::isCSSCustomFilterEnabled() const | 6287 bool RenderLayer::isCSSCustomFilterEnabled() const |
6290 { | 6288 { |
6291 // We only want to enable shaders if WebGL is also enabled on this platform. | 6289 // We only want to enable shaders if WebGL is also enabled on this platform. |
6292 const Settings* settings = renderer()->document()->settings(); | 6290 const Settings* settings = renderer()->document().settings(); |
6293 return settings && settings->isCSSCustomFilterEnabled() && settings->webGLEn
abled(); | 6291 return settings && settings->isCSSCustomFilterEnabled() && settings->webGLEn
abled(); |
6294 } | 6292 } |
6295 | 6293 |
6296 FilterOperations RenderLayer::computeFilterOperations(const RenderStyle* style) | 6294 FilterOperations RenderLayer::computeFilterOperations(const RenderStyle* style) |
6297 { | 6295 { |
6298 const FilterOperations& filters = style->filter(); | 6296 const FilterOperations& filters = style->filter(); |
6299 if (filters.hasReferenceFilter()) { | 6297 if (filters.hasReferenceFilter()) { |
6300 for (size_t i = 0; i < filters.size(); ++i) { | 6298 for (size_t i = 0; i < filters.size(); ++i) { |
6301 FilterOperation* filterOperation = filters.operations().at(i).get(); | 6299 FilterOperation* filterOperation = filters.operations().at(i).get(); |
6302 if (filterOperation->getOperationType() != FilterOperation::REFERENC
E) | 6300 if (filterOperation->getOperationType() != FilterOperation::REFERENC
E) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6381 } | 6379 } |
6382 | 6380 |
6383 RenderLayerFilterInfo* filterInfo = ensureFilterInfo(); | 6381 RenderLayerFilterInfo* filterInfo = ensureFilterInfo(); |
6384 if (!filterInfo->renderer()) { | 6382 if (!filterInfo->renderer()) { |
6385 RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::crea
te(); | 6383 RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::crea
te(); |
6386 RenderingMode renderingMode = renderer()->frame()->page()->settings().ac
celeratedFiltersEnabled() ? Accelerated : Unaccelerated; | 6384 RenderingMode renderingMode = renderer()->frame()->page()->settings().ac
celeratedFiltersEnabled() ? Accelerated : Unaccelerated; |
6387 filterRenderer->setRenderingMode(renderingMode); | 6385 filterRenderer->setRenderingMode(renderingMode); |
6388 filterInfo->setRenderer(filterRenderer.release()); | 6386 filterInfo->setRenderer(filterRenderer.release()); |
6389 | 6387 |
6390 // We can optimize away code paths in other places if we know that there
are no software filters. | 6388 // We can optimize away code paths in other places if we know that there
are no software filters. |
6391 renderer()->document()->view()->setHasSoftwareFilters(true); | 6389 renderer()->document().view()->setHasSoftwareFilters(true); |
6392 } | 6390 } |
6393 | 6391 |
6394 // If the filter fails to build, remove it from the layer. It will still att
empt to | 6392 // If the filter fails to build, remove it from the layer. It will still att
empt to |
6395 // go through regular processing (e.g. compositing), but never apply anythin
g. | 6393 // go through regular processing (e.g. compositing), but never apply anythin
g. |
6396 if (!filterInfo->renderer()->build(renderer(), computeFilterOperations(rende
rer()->style()))) | 6394 if (!filterInfo->renderer()->build(renderer(), computeFilterOperations(rende
rer()->style()))) |
6397 filterInfo->setRenderer(0); | 6395 filterInfo->setRenderer(0); |
6398 } | 6396 } |
6399 | 6397 |
6400 void RenderLayer::filterNeedsRepaint() | 6398 void RenderLayer::filterNeedsRepaint() |
6401 { | 6399 { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6475 } | 6473 } |
6476 } | 6474 } |
6477 | 6475 |
6478 void showLayerTree(const WebCore::RenderObject* renderer) | 6476 void showLayerTree(const WebCore::RenderObject* renderer) |
6479 { | 6477 { |
6480 if (!renderer) | 6478 if (!renderer) |
6481 return; | 6479 return; |
6482 showLayerTree(renderer->enclosingLayer()); | 6480 showLayerTree(renderer->enclosingLayer()); |
6483 } | 6481 } |
6484 #endif | 6482 #endif |
OLD | NEW |