| 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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 return 0; | 1324 return 0; |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 IntRect RenderLayer::scrollableAreaBoundingBox() const | 1327 IntRect RenderLayer::scrollableAreaBoundingBox() const |
| 1328 { | 1328 { |
| 1329 return renderer()->absoluteBoundingBoxRect(); | 1329 return renderer()->absoluteBoundingBoxRect(); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 bool RenderLayer::userInputScrollable(ScrollbarOrientation orientation) const |
| 1333 { |
| 1334 RenderBox* box = renderBox(); |
| 1335 ASSERT(box); |
| 1336 |
| 1337 EOverflow overflowStyle = (orientation == HorizontalScrollbar) ? |
| 1338 renderer()->style()->overflowX() : renderer()->style()->overflowY(); |
| 1339 return (overflowStyle == OSCROLL || overflowStyle == OAUTO); |
| 1340 } |
| 1341 |
| 1342 int RenderLayer::pageStep(ScrollbarOrientation orientation) const |
| 1343 { |
| 1344 RenderBox* box = renderBox(); |
| 1345 ASSERT(box); |
| 1346 |
| 1347 int length = (orientation == HorizontalScrollbar) ? |
| 1348 box->pixelSnappedClientWidth() : box->pixelSnappedClientHeight(); |
| 1349 int minPageStep = static_cast<float>(length) * ScrollableArea::minFractionTo
StepWhenPaging(); |
| 1350 int pageStep = max(minPageStep, length - ScrollableArea::maxOverlapBetweenPa
ges()); |
| 1351 |
| 1352 return max(pageStep, 1); |
| 1353 } |
| 1354 |
| 1332 RenderLayer* RenderLayer::enclosingTransformedAncestor() const | 1355 RenderLayer* RenderLayer::enclosingTransformedAncestor() const |
| 1333 { | 1356 { |
| 1334 RenderLayer* curr = parent(); | 1357 RenderLayer* curr = parent(); |
| 1335 while (curr && !curr->isRootLayer() && !curr->transform()) | 1358 while (curr && !curr->isRootLayer() && !curr->transform()) |
| 1336 curr = curr->parent(); | 1359 curr = curr->parent(); |
| 1337 | 1360 |
| 1338 return curr; | 1361 return curr; |
| 1339 } | 1362 } |
| 1340 | 1363 |
| 1341 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) | 1364 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2482 styledElement->setInlineStyleProperty(CSSPropertyHeight, String::number(
roundToInt(baseHeight + difference.height())) + "px", false); | 2505 styledElement->setInlineStyleProperty(CSSPropertyHeight, String::number(
roundToInt(baseHeight + difference.height())) + "px", false); |
| 2483 } | 2506 } |
| 2484 | 2507 |
| 2485 document->updateLayout(); | 2508 document->updateLayout(); |
| 2486 | 2509 |
| 2487 // FIXME (Radar 4118564): We should also autoscroll the window as necessary
to keep the point under the cursor in view. | 2510 // FIXME (Radar 4118564): We should also autoscroll the window as necessary
to keep the point under the cursor in view. |
| 2488 } | 2511 } |
| 2489 | 2512 |
| 2490 int RenderLayer::scrollSize(ScrollbarOrientation orientation) const | 2513 int RenderLayer::scrollSize(ScrollbarOrientation orientation) const |
| 2491 { | 2514 { |
| 2492 Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_hBar : m_vB
ar).get(); | 2515 RenderBox* box = renderBox(); |
| 2493 return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0; | 2516 ASSERT(box); |
| 2517 |
| 2518 if (orientation == HorizontalScrollbar) |
| 2519 return m_scrollSize.width() - box->pixelSnappedClientWidth(); |
| 2520 |
| 2521 return m_scrollSize.height() - box->pixelSnappedClientHeight(); |
| 2494 } | 2522 } |
| 2495 | 2523 |
| 2496 int RenderLayer::scrollPosition(Scrollbar* scrollbar) const | 2524 int RenderLayer::scrollPosition(Scrollbar* scrollbar) const |
| 2497 { | 2525 { |
| 2498 if (scrollbar->orientation() == HorizontalScrollbar) | 2526 if (scrollbar->orientation() == HorizontalScrollbar) |
| 2499 return scrollXOffset(); | 2527 return scrollXOffset(); |
| 2500 if (scrollbar->orientation() == VerticalScrollbar) | 2528 if (scrollbar->orientation() == VerticalScrollbar) |
| 2501 return scrollYOffset(); | 2529 return scrollYOffset(); |
| 2502 return 0; | 2530 return 0; |
| 2503 } | 2531 } |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2853 willRemoveHorizontalScrollbar(scrollbar.get()); | 2881 willRemoveHorizontalScrollbar(scrollbar.get()); |
| 2854 else | 2882 else |
| 2855 willRemoveVerticalScrollbar(scrollbar.get()); | 2883 willRemoveVerticalScrollbar(scrollbar.get()); |
| 2856 } | 2884 } |
| 2857 | 2885 |
| 2858 scrollbar->removeFromParent(); | 2886 scrollbar->removeFromParent(); |
| 2859 scrollbar->disconnectFromScrollableArea(); | 2887 scrollbar->disconnectFromScrollableArea(); |
| 2860 scrollbar = 0; | 2888 scrollbar = 0; |
| 2861 } | 2889 } |
| 2862 | 2890 |
| 2863 bool RenderLayer::scrollsOverflow() const | |
| 2864 { | |
| 2865 if (!renderer()->isBox()) | |
| 2866 return false; | |
| 2867 | |
| 2868 return toRenderBox(renderer())->scrollsOverflow(); | |
| 2869 } | |
| 2870 | |
| 2871 void RenderLayer::setHasHorizontalScrollbar(bool hasScrollbar) | 2891 void RenderLayer::setHasHorizontalScrollbar(bool hasScrollbar) |
| 2872 { | 2892 { |
| 2873 if (hasScrollbar == hasHorizontalScrollbar()) | 2893 if (hasScrollbar == hasHorizontalScrollbar()) |
| 2874 return; | 2894 return; |
| 2875 | 2895 |
| 2876 if (hasScrollbar) | 2896 if (hasScrollbar) |
| 2877 m_hBar = createScrollbar(HorizontalScrollbar); | 2897 m_hBar = createScrollbar(HorizontalScrollbar); |
| 2878 else | 2898 else |
| 2879 destroyScrollbar(HorizontalScrollbar); | 2899 destroyScrollbar(HorizontalScrollbar); |
| 2880 | 2900 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3119 } else | 3139 } else |
| 3120 renderer()->layout(); | 3140 renderer()->layout(); |
| 3121 m_inOverflowRelayout = false; | 3141 m_inOverflowRelayout = false; |
| 3122 } | 3142 } |
| 3123 } | 3143 } |
| 3124 } | 3144 } |
| 3125 | 3145 |
| 3126 // Set up the range (and page step/line step). | 3146 // Set up the range (and page step/line step). |
| 3127 if (m_hBar) { | 3147 if (m_hBar) { |
| 3128 int clientWidth = box->pixelSnappedClientWidth(); | 3148 int clientWidth = box->pixelSnappedClientWidth(); |
| 3129 int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWh
enPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); | |
| 3130 m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); | |
| 3131 m_hBar->setProportion(clientWidth, m_scrollSize.width()); | 3149 m_hBar->setProportion(clientWidth, m_scrollSize.width()); |
| 3132 } | 3150 } |
| 3133 if (m_vBar) { | 3151 if (m_vBar) { |
| 3134 int clientHeight = box->pixelSnappedClientHeight(); | 3152 int clientHeight = box->pixelSnappedClientHeight(); |
| 3135 int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepW
henPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); | |
| 3136 m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); | |
| 3137 m_vBar->setProportion(clientHeight, m_scrollSize.height()); | 3153 m_vBar->setProportion(clientHeight, m_scrollSize.height()); |
| 3138 } | 3154 } |
| 3139 | 3155 |
| 3140 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVe
rticalOverflow()); | 3156 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVe
rticalOverflow()); |
| 3141 } | 3157 } |
| 3142 | 3158 |
| 3143 void RenderLayer::updateScrollInfoAfterLayout() | 3159 void RenderLayer::updateScrollInfoAfterLayout() |
| 3144 { | 3160 { |
| 3145 RenderBox* box = renderBox(); | 3161 RenderBox* box = renderBox(); |
| 3146 if (!box) | 3162 if (!box) |
| (...skipping 3250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6397 } | 6413 } |
| 6398 } | 6414 } |
| 6399 | 6415 |
| 6400 void showLayerTree(const WebCore::RenderObject* renderer) | 6416 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6401 { | 6417 { |
| 6402 if (!renderer) | 6418 if (!renderer) |
| 6403 return; | 6419 return; |
| 6404 showLayerTree(renderer->enclosingLayer()); | 6420 showLayerTree(renderer->enclosingLayer()); |
| 6405 } | 6421 } |
| 6406 #endif | 6422 #endif |
| OLD | NEW |