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::isHorizontallyScrollable() const |
| 1333 { |
| 1334 RenderBox* box = renderBox(); |
| 1335 ASSERT(box); |
| 1336 |
| 1337 EOverflow overflowStyle = renderer()->style()->overflowX(); |
| 1338 return (overflowStyle == OSCROLL || overflowStyle == OAUTO); |
| 1339 } |
| 1340 |
| 1341 bool RenderLayer::isVerticallyScrollable() const |
| 1342 { |
| 1343 RenderBox* box = renderBox(); |
| 1344 ASSERT(box); |
| 1345 |
| 1346 EOverflow overflowStyle = renderer()->style()->overflowY(); |
| 1347 return (overflowStyle == OSCROLL || overflowStyle == OAUTO); |
| 1348 } |
| 1349 |
1332 RenderLayer* RenderLayer::enclosingTransformedAncestor() const | 1350 RenderLayer* RenderLayer::enclosingTransformedAncestor() const |
1333 { | 1351 { |
1334 RenderLayer* curr = parent(); | 1352 RenderLayer* curr = parent(); |
1335 while (curr && !curr->isRootLayer() && !curr->transform()) | 1353 while (curr && !curr->isRootLayer() && !curr->transform()) |
1336 curr = curr->parent(); | 1354 curr = curr->parent(); |
1337 | 1355 |
1338 return curr; | 1356 return curr; |
1339 } | 1357 } |
1340 | 1358 |
1341 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) | 1359 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); | 2500 styledElement->setInlineStyleProperty(CSSPropertyHeight, String::number(
roundToInt(baseHeight + difference.height())) + "px", false); |
2483 } | 2501 } |
2484 | 2502 |
2485 document->updateLayout(); | 2503 document->updateLayout(); |
2486 | 2504 |
2487 // FIXME (Radar 4118564): We should also autoscroll the window as necessary
to keep the point under the cursor in view. | 2505 // FIXME (Radar 4118564): We should also autoscroll the window as necessary
to keep the point under the cursor in view. |
2488 } | 2506 } |
2489 | 2507 |
2490 int RenderLayer::scrollSize(ScrollbarOrientation orientation) const | 2508 int RenderLayer::scrollSize(ScrollbarOrientation orientation) const |
2491 { | 2509 { |
2492 Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_hBar : m_vB
ar).get(); | 2510 RenderBox* box = renderBox(); |
2493 return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0; | 2511 ASSERT(box); |
| 2512 |
| 2513 if (orientation == HorizontalScrollbar) |
| 2514 return m_scrollSize.width() - box->pixelSnappedClientWidth(); |
| 2515 |
| 2516 return m_scrollSize.height() - box->pixelSnappedClientHeight(); |
2494 } | 2517 } |
2495 | 2518 |
2496 int RenderLayer::scrollPosition(Scrollbar* scrollbar) const | 2519 int RenderLayer::scrollPosition(Scrollbar* scrollbar) const |
2497 { | 2520 { |
2498 if (scrollbar->orientation() == HorizontalScrollbar) | 2521 if (scrollbar->orientation() == HorizontalScrollbar) |
2499 return scrollXOffset(); | 2522 return scrollXOffset(); |
2500 if (scrollbar->orientation() == VerticalScrollbar) | 2523 if (scrollbar->orientation() == VerticalScrollbar) |
2501 return scrollYOffset(); | 2524 return scrollYOffset(); |
2502 return 0; | 2525 return 0; |
2503 } | 2526 } |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2853 willRemoveHorizontalScrollbar(scrollbar.get()); | 2876 willRemoveHorizontalScrollbar(scrollbar.get()); |
2854 else | 2877 else |
2855 willRemoveVerticalScrollbar(scrollbar.get()); | 2878 willRemoveVerticalScrollbar(scrollbar.get()); |
2856 } | 2879 } |
2857 | 2880 |
2858 scrollbar->removeFromParent(); | 2881 scrollbar->removeFromParent(); |
2859 scrollbar->disconnectFromScrollableArea(); | 2882 scrollbar->disconnectFromScrollableArea(); |
2860 scrollbar = 0; | 2883 scrollbar = 0; |
2861 } | 2884 } |
2862 | 2885 |
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) | 2886 void RenderLayer::setHasHorizontalScrollbar(bool hasScrollbar) |
2872 { | 2887 { |
2873 if (hasScrollbar == hasHorizontalScrollbar()) | 2888 if (hasScrollbar == hasHorizontalScrollbar()) |
2874 return; | 2889 return; |
2875 | 2890 |
2876 if (hasScrollbar) | 2891 if (hasScrollbar) |
2877 m_hBar = createScrollbar(HorizontalScrollbar); | 2892 m_hBar = createScrollbar(HorizontalScrollbar); |
2878 else | 2893 else |
2879 destroyScrollbar(HorizontalScrollbar); | 2894 destroyScrollbar(HorizontalScrollbar); |
2880 | 2895 |
(...skipping 3516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6397 } | 6412 } |
6398 } | 6413 } |
6399 | 6414 |
6400 void showLayerTree(const WebCore::RenderObject* renderer) | 6415 void showLayerTree(const WebCore::RenderObject* renderer) |
6401 { | 6416 { |
6402 if (!renderer) | 6417 if (!renderer) |
6403 return; | 6418 return; |
6404 showLayerTree(renderer->enclosingLayer()); | 6419 showLayerTree(renderer->enclosingLayer()); |
6405 } | 6420 } |
6406 #endif | 6421 #endif |
OLD | NEW |