| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 Copyright (C) 1997 Martin Jones (mjones@kde.org) |
| 3 (C) 1998 Waldo Bastian (bastian@kde.org) | 3 (C) 1998 Waldo Bastian (bastian@kde.org) |
| 4 (C) 1998, 1999 Torben Weis (weis@kde.org) | 4 (C) 1998, 1999 Torben Weis (weis@kde.org) |
| 5 (C) 1999 Lars Knoll (knoll@kde.org) | 5 (C) 1999 Lars Knoll (knoll@kde.org) |
| 6 (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
| 8 reserved. |
| 8 | 9 |
| 9 This library is free software; you can redistribute it and/or | 10 This library is free software; you can redistribute it and/or |
| 10 modify it under the terms of the GNU Library General Public | 11 modify it under the terms of the GNU Library General Public |
| 11 License as published by the Free Software Foundation; either | 12 License as published by the Free Software Foundation; either |
| 12 version 2 of the License, or (at your option) any later version. | 13 version 2 of the License, or (at your option) any later version. |
| 13 | 14 |
| 14 This library is distributed in the hope that it will be useful, | 15 This library is distributed in the hope that it will be useful, |
| 15 but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 Library General Public License for more details. | 18 Library General Public License for more details. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 bool& isPartial); | 144 bool& isPartial); |
| 144 | 145 |
| 145 bool needsLayout() const; | 146 bool needsLayout() const; |
| 146 bool checkDoesNotNeedLayout() const; | 147 bool checkDoesNotNeedLayout() const; |
| 147 void setNeedsLayout(); | 148 void setNeedsLayout(); |
| 148 | 149 |
| 149 void setNeedsUpdateWidgetGeometries() { | 150 void setNeedsUpdateWidgetGeometries() { |
| 150 m_needsUpdateWidgetGeometries = true; | 151 m_needsUpdateWidgetGeometries = true; |
| 151 } | 152 } |
| 152 | 153 |
| 153 // Methods for getting/setting the size Blink should use to layout the content
s. | 154 // Methods for getting/setting the size Blink should use to layout the |
| 154 // NOTE: Scrollbar exclusion is based on the FrameView's scrollbars. To exclud
e | 155 // contents. |
| 155 // scrollbars on the root PaintLayer, use LayoutView::layoutSize. | 156 // NOTE: Scrollbar exclusion is based on the FrameView's scrollbars. To |
| 157 // exclude scrollbars on the root PaintLayer, use LayoutView::layoutSize. |
| 156 IntSize layoutSize(IncludeScrollbarsInRect = ExcludeScrollbars) const; | 158 IntSize layoutSize(IncludeScrollbarsInRect = ExcludeScrollbars) const; |
| 157 void setLayoutSize(const IntSize&); | 159 void setLayoutSize(const IntSize&); |
| 158 | 160 |
| 159 // If this is set to false, the layout size will need to be explicitly set by
the owner. | 161 // If this is set to false, the layout size will need to be explicitly set by |
| 160 // E.g. WebViewImpl sets its mainFrame's layout size manually | 162 // the owner. E.g. WebViewImpl sets its mainFrame's layout size manually |
| 161 void setLayoutSizeFixedToFrameSize(bool isFixed) { | 163 void setLayoutSizeFixedToFrameSize(bool isFixed) { |
| 162 m_layoutSizeFixedToFrameSize = isFixed; | 164 m_layoutSizeFixedToFrameSize = isFixed; |
| 163 } | 165 } |
| 164 bool layoutSizeFixedToFrameSize() { return m_layoutSizeFixedToFrameSize; } | 166 bool layoutSizeFixedToFrameSize() { return m_layoutSizeFixedToFrameSize; } |
| 165 | 167 |
| 166 void updateAcceleratedCompositingSettings(); | 168 void updateAcceleratedCompositingSettings(); |
| 167 | 169 |
| 168 void recalcOverflowAfterStyleChange(); | 170 void recalcOverflowAfterStyleChange(); |
| 169 | 171 |
| 170 bool isEnclosedInCompositingLayer() const; | 172 bool isEnclosedInCompositingLayer() const; |
| 171 | 173 |
| 172 void dispose() override; | 174 void dispose() override; |
| 173 void detachScrollbars(); | 175 void detachScrollbars(); |
| 174 void recalculateCustomScrollbarStyle(); | 176 void recalculateCustomScrollbarStyle(); |
| 175 void invalidateAllCustomScrollbarsOnActiveChanged(); | 177 void invalidateAllCustomScrollbarsOnActiveChanged(); |
| 176 | 178 |
| 177 void clear(); | 179 void clear(); |
| 178 | 180 |
| 179 bool isTransparent() const; | 181 bool isTransparent() const; |
| 180 void setTransparent(bool isTransparent); | 182 void setTransparent(bool isTransparent); |
| 181 | 183 |
| 182 // True if the FrameView is not transparent, and the base background color is
opaque. | 184 // True if the FrameView is not transparent, and the base background color is |
| 185 // opaque. |
| 183 bool hasOpaqueBackground() const; | 186 bool hasOpaqueBackground() const; |
| 184 | 187 |
| 185 Color baseBackgroundColor() const; | 188 Color baseBackgroundColor() const; |
| 186 void setBaseBackgroundColor(const Color&); | 189 void setBaseBackgroundColor(const Color&); |
| 187 void updateBackgroundRecursively(const Color&, bool); | 190 void updateBackgroundRecursively(const Color&, bool); |
| 188 | 191 |
| 189 void adjustViewSize(); | 192 void adjustViewSize(); |
| 190 void adjustViewSizeAndLayout(); | 193 void adjustViewSizeAndLayout(); |
| 191 | 194 |
| 192 // Scale used to convert incoming input events. | 195 // Scale used to convert incoming input events. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 254 |
| 252 void addPart(LayoutPart*); | 255 void addPart(LayoutPart*); |
| 253 void removePart(LayoutPart*); | 256 void removePart(LayoutPart*); |
| 254 | 257 |
| 255 void updateWidgetGeometries(); | 258 void updateWidgetGeometries(); |
| 256 | 259 |
| 257 void addPartToUpdate(LayoutEmbeddedObject&); | 260 void addPartToUpdate(LayoutEmbeddedObject&); |
| 258 | 261 |
| 259 Color documentBackgroundColor() const; | 262 Color documentBackgroundColor() const; |
| 260 | 263 |
| 261 // Run all needed lifecycle stages. After calling this method, all frames will
be in the lifecycle state PaintInvalidationClean. | 264 // Run all needed lifecycle stages. After calling this method, all frames will |
| 262 // If lifecycle throttling is allowed (see DocumentLifecycle::AllowThrottlingS
cope), some frames may skip the lifecycle update | 265 // be in the lifecycle state PaintInvalidationClean. If lifecycle throttling |
| 263 // (e.g., based on visibility) and will not end up being PaintInvalidationClea
n. | 266 // is allowed (see DocumentLifecycle::AllowThrottlingScope), some frames may |
| 267 // skip the lifecycle update (e.g., based on visibility) and will not end up |
| 268 // being PaintInvalidationClean. |
| 264 void updateAllLifecyclePhases(); | 269 void updateAllLifecyclePhases(); |
| 265 | 270 |
| 266 // Everything except paint (the last phase). | 271 // Everything except paint (the last phase). |
| 267 void updateAllLifecyclePhasesExceptPaint(); | 272 void updateAllLifecyclePhasesExceptPaint(); |
| 268 | 273 |
| 269 // Computes the style, layout and compositing lifecycle stages if needed. Afte
r calling this method, all frames will be in a lifecycle | 274 // Computes the style, layout and compositing lifecycle stages if needed. |
| 270 // state >= CompositingClean, and scrolling has been updated (unless throttlin
g is allowed). | 275 // After calling this method, all frames will be in a lifecycle |
| 276 // state >= CompositingClean, and scrolling has been updated (unless |
| 277 // throttling is allowed). |
| 271 void updateLifecycleToCompositingCleanPlusScrolling(); | 278 void updateLifecycleToCompositingCleanPlusScrolling(); |
| 272 | 279 |
| 273 // Computes only the style and layout lifecycle stages. | 280 // Computes only the style and layout lifecycle stages. |
| 274 // After calling this method, all frames will be in a lifecycle state >= Layou
tClean (unless throttling is allowed). | 281 // After calling this method, all frames will be in a lifecycle |
| 282 // state >= LayoutClean (unless throttling is allowed). |
| 275 void updateLifecycleToLayoutClean(); | 283 void updateLifecycleToLayoutClean(); |
| 276 | 284 |
| 277 void scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 285 void scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 278 | 286 |
| 279 bool invalidateViewportConstrainedObjects(); | 287 bool invalidateViewportConstrainedObjects(); |
| 280 | 288 |
| 281 void incrementLayoutObjectCount() { m_layoutObjectCounter.increment(); } | 289 void incrementLayoutObjectCount() { m_layoutObjectCounter.increment(); } |
| 282 void incrementVisuallyNonEmptyCharacterCount(unsigned); | 290 void incrementVisuallyNonEmptyCharacterCount(unsigned); |
| 283 void incrementVisuallyNonEmptyPixelCount(const IntSize&); | 291 void incrementVisuallyNonEmptyPixelCount(const IntSize&); |
| 284 bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; } | 292 bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; } |
| 285 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } | 293 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } |
| 286 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); | 294 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); |
| 287 void disableAutoSizeMode(); | 295 void disableAutoSizeMode(); |
| 288 | 296 |
| 289 void forceLayoutForPagination(const FloatSize& pageSize, | 297 void forceLayoutForPagination(const FloatSize& pageSize, |
| 290 const FloatSize& originalPageSize, | 298 const FloatSize& originalPageSize, |
| 291 float maximumShrinkFactor); | 299 float maximumShrinkFactor); |
| 292 | 300 |
| 293 enum UrlFragmentBehavior { UrlFragmentScroll, UrlFragmentDontScroll }; | 301 enum UrlFragmentBehavior { UrlFragmentScroll, UrlFragmentDontScroll }; |
| 294 // Updates the fragment anchor element based on URL's fragment identifier. | 302 // Updates the fragment anchor element based on URL's fragment identifier. |
| 295 // Updates corresponding ':target' CSS pseudo class on the anchor element. | 303 // Updates corresponding ':target' CSS pseudo class on the anchor element. |
| 296 // If |UrlFragmentScroll| is passed in then makes the anchor element | 304 // If |UrlFragmentScroll| is passed in then makes the anchor element |
| 297 // focused and also visible by scrolling to it. The scroll position is | 305 // focused and also visible by scrolling to it. The scroll position is |
| 298 // maintained during the frame loading process. | 306 // maintained during the frame loading process. |
| 299 void processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll); | 307 void processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll); |
| 300 void clearFragmentAnchor(); | 308 void clearFragmentAnchor(); |
| 301 | 309 |
| 302 // Methods to convert points and rects between the coordinate space of the lay
outObject, and this view. | 310 // Methods to convert points and rects between the coordinate space of the |
| 311 // layoutObject, and this view. |
| 303 IntRect convertFromLayoutObject(const LayoutObject&, const IntRect&) const; | 312 IntRect convertFromLayoutObject(const LayoutObject&, const IntRect&) const; |
| 304 IntRect convertToLayoutObject(const LayoutObject&, const IntRect&) const; | 313 IntRect convertToLayoutObject(const LayoutObject&, const IntRect&) const; |
| 305 IntPoint convertFromLayoutObject(const LayoutObject&, const IntPoint&) const; | 314 IntPoint convertFromLayoutObject(const LayoutObject&, const IntPoint&) const; |
| 306 IntPoint convertToLayoutObject(const LayoutObject&, const IntPoint&) const; | 315 IntPoint convertToLayoutObject(const LayoutObject&, const IntPoint&) const; |
| 307 | 316 |
| 308 bool isFrameViewScrollCorner(LayoutScrollbarPart* scrollCorner) const { | 317 bool isFrameViewScrollCorner(LayoutScrollbarPart* scrollCorner) const { |
| 309 return m_scrollCorner == scrollCorner; | 318 return m_scrollCorner == scrollCorner; |
| 310 } | 319 } |
| 311 | 320 |
| 312 enum ScrollingReasons { | 321 enum ScrollingReasons { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 const ScrollableAreaSet* scrollableAreas() const { | 367 const ScrollableAreaSet* scrollableAreas() const { |
| 359 return m_scrollableAreas.get(); | 368 return m_scrollableAreas.get(); |
| 360 } | 369 } |
| 361 | 370 |
| 362 void addAnimatingScrollableArea(ScrollableArea*); | 371 void addAnimatingScrollableArea(ScrollableArea*); |
| 363 void removeAnimatingScrollableArea(ScrollableArea*); | 372 void removeAnimatingScrollableArea(ScrollableArea*); |
| 364 const ScrollableAreaSet* animatingScrollableAreas() const { | 373 const ScrollableAreaSet* animatingScrollableAreas() const { |
| 365 return m_animatingScrollableAreas.get(); | 374 return m_animatingScrollableAreas.get(); |
| 366 } | 375 } |
| 367 | 376 |
| 368 // With CSS style "resize:" enabled, a little resizer handle will appear at th
e bottom | 377 // With CSS style "resize:" enabled, a little resizer handle will appear at |
| 369 // right of the object. We keep track of these resizer areas for checking if t
ouches | 378 // the bottom right of the object. We keep track of these resizer areas for |
| 370 // (implemented using Scroll gesture) are targeting the resizer. | 379 // checking if touches (implemented using Scroll gesture) are targeting the |
| 380 // resizer. |
| 371 typedef HashSet<LayoutBox*> ResizerAreaSet; | 381 typedef HashSet<LayoutBox*> ResizerAreaSet; |
| 372 void addResizerArea(LayoutBox&); | 382 void addResizerArea(LayoutBox&); |
| 373 void removeResizerArea(LayoutBox&); | 383 void removeResizerArea(LayoutBox&); |
| 374 const ResizerAreaSet* resizerAreas() const { return m_resizerAreas.get(); } | 384 const ResizerAreaSet* resizerAreas() const { return m_resizerAreas.get(); } |
| 375 | 385 |
| 376 bool shouldUseIntegerScrollOffset() const override; | 386 bool shouldUseIntegerScrollOffset() const override; |
| 377 | 387 |
| 378 bool isActive() const override; | 388 bool isActive() const override; |
| 379 | 389 |
| 380 // Override scrollbar notifications to update the AXObject cache. | 390 // Override scrollbar notifications to update the AXObject cache. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 bool shouldPlaceVerticalScrollbarOnLeft() const override; | 431 bool shouldPlaceVerticalScrollbarOnLeft() const override; |
| 422 Widget* getWidget() override; | 432 Widget* getWidget() override; |
| 423 CompositorAnimationTimeline* compositorAnimationTimeline() const override; | 433 CompositorAnimationTimeline* compositorAnimationTimeline() const override; |
| 424 LayoutBox* layoutBox() const override; | 434 LayoutBox* layoutBox() const override; |
| 425 | 435 |
| 426 LayoutRect scrollIntoView(const LayoutRect& rectInContent, | 436 LayoutRect scrollIntoView(const LayoutRect& rectInContent, |
| 427 const ScrollAlignment& alignX, | 437 const ScrollAlignment& alignX, |
| 428 const ScrollAlignment& alignY, | 438 const ScrollAlignment& alignY, |
| 429 ScrollType = ProgrammaticScroll) override; | 439 ScrollType = ProgrammaticScroll) override; |
| 430 | 440 |
| 431 // The window that hosts the FrameView. The FrameView will communicate scrolls
and repaints to the | 441 // The window that hosts the FrameView. The FrameView will communicate scrolls |
| 432 // host window in the window's coordinate space. | 442 // and repaints to the host window in the window's coordinate space. |
| 433 HostWindow* getHostWindow() const; | 443 HostWindow* getHostWindow() const; |
| 434 | 444 |
| 435 typedef HeapHashSet<Member<Widget>> ChildrenWidgetSet; | 445 typedef HeapHashSet<Member<Widget>> ChildrenWidgetSet; |
| 436 | 446 |
| 437 // Functions for child manipulation and inspection. | 447 // Functions for child manipulation and inspection. |
| 438 void setParent(Widget*) override; | 448 void setParent(Widget*) override; |
| 439 void removeChild(Widget*); | 449 void removeChild(Widget*); |
| 440 void addChild(Widget*); | 450 void addChild(Widget*); |
| 441 const ChildrenWidgetSet* children() const { return &m_children; } | 451 const ChildrenWidgetSet* children() const { return &m_children; } |
| 442 | 452 |
| 443 // If the scroll view does not use a native widget, then it will have cross-pl
atform Scrollbars. These functions | 453 // If the scroll view does not use a native widget, then it will have |
| 444 // can be used to obtain those scrollbars. | 454 // cross-platform Scrollbars. These functions can be used to obtain those |
| 455 // scrollbars. |
| 445 Scrollbar* horizontalScrollbar() const override { | 456 Scrollbar* horizontalScrollbar() const override { |
| 446 return m_horizontalScrollbar.get(); | 457 return m_horizontalScrollbar.get(); |
| 447 } | 458 } |
| 448 Scrollbar* verticalScrollbar() const override { | 459 Scrollbar* verticalScrollbar() const override { |
| 449 return m_verticalScrollbar.get(); | 460 return m_verticalScrollbar.get(); |
| 450 } | 461 } |
| 451 LayoutScrollbarPart* scrollCorner() const override { return m_scrollCorner; } | 462 LayoutScrollbarPart* scrollCorner() const override { return m_scrollCorner; } |
| 452 | 463 |
| 453 void positionScrollbarLayers(); | 464 void positionScrollbarLayers(); |
| 454 | 465 |
| 455 // Functions for setting and retrieving the scrolling mode in each axis (horiz
ontal/vertical). The mode has values of | 466 // Functions for setting and retrieving the scrolling mode in each axis |
| 456 // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, Alwa
ysOn means always show a scrollbar. | 467 // (horizontal/vertical). The mode has values of AlwaysOff, AlwaysOn, and |
| 457 // Auto means show a scrollbar only when one is needed. | 468 // Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a |
| 458 // Note that for platforms with native widgets, these modes are considered adv
isory. In other words the underlying native | 469 // scrollbar. Auto means show a scrollbar only when one is needed. |
| 459 // widget may choose not to honor the requested modes. | 470 // Note that for platforms with native widgets, these modes are considered |
| 471 // advisory. In other words the underlying native widget may choose not to |
| 472 // honor the requested modes. |
| 460 void setScrollbarModes(ScrollbarMode horizontalMode, | 473 void setScrollbarModes(ScrollbarMode horizontalMode, |
| 461 ScrollbarMode verticalMode, | 474 ScrollbarMode verticalMode, |
| 462 bool horizontalLock = false, | 475 bool horizontalLock = false, |
| 463 bool verticalLock = false); | 476 bool verticalLock = false); |
| 464 void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { | 477 void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { |
| 465 setScrollbarModes(mode, verticalScrollbarMode(), lock, | 478 setScrollbarModes(mode, verticalScrollbarMode(), lock, |
| 466 verticalScrollbarLock()); | 479 verticalScrollbarLock()); |
| 467 } | 480 } |
| 468 void setVerticalScrollbarMode(ScrollbarMode mode, bool lock = false) { | 481 void setVerticalScrollbarMode(ScrollbarMode mode, bool lock = false) { |
| 469 setScrollbarModes(horizontalScrollbarMode(), mode, | 482 setScrollbarModes(horizontalScrollbarMode(), mode, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 500 // rectangle, but an optional boolean argument allows them to be included. | 513 // rectangle, but an optional boolean argument allows them to be included. |
| 501 IntRect visibleContentRect( | 514 IntRect visibleContentRect( |
| 502 IncludeScrollbarsInRect = ExcludeScrollbars) const override; | 515 IncludeScrollbarsInRect = ExcludeScrollbars) const override; |
| 503 IntSize visibleContentSize(IncludeScrollbarsInRect = ExcludeScrollbars) const; | 516 IntSize visibleContentSize(IncludeScrollbarsInRect = ExcludeScrollbars) const; |
| 504 | 517 |
| 505 // Clips the provided rect to the visible content area. For this purpose, we | 518 // Clips the provided rect to the visible content area. For this purpose, we |
| 506 // also query the chrome client for any active overrides to the visible area | 519 // also query the chrome client for any active overrides to the visible area |
| 507 // (e.g. DevTool's viewport override). | 520 // (e.g. DevTool's viewport override). |
| 508 void clipPaintRect(FloatRect*) const; | 521 void clipPaintRect(FloatRect*) const; |
| 509 | 522 |
| 510 // Functions for getting/setting the size of the document contained inside the
FrameView (as an IntSize or as individual width and height | 523 // Functions for getting/setting the size of the document contained inside the |
| 511 // values). | 524 // FrameView (as an IntSize or as individual width and height values). |
| 512 IntSize contentsSize() const | 525 // Always at least as big as the visibleWidth()/visibleHeight(). |
| 513 override; // Always at least as big as the visibleWidth()/visibleHeight()
. | 526 IntSize contentsSize() const override; |
| 514 int contentsWidth() const { return contentsSize().width(); } | 527 int contentsWidth() const { return contentsSize().width(); } |
| 515 int contentsHeight() const { return contentsSize().height(); } | 528 int contentsHeight() const { return contentsSize().height(); } |
| 516 | 529 |
| 517 // Functions for querying the current scrolled position (both as a point, a si
ze, or as individual X and Y values). | 530 // Functions for querying the current scrolled position (both as a point, a |
| 518 // Be careful in using the Double version scrollPositionDouble() and scrollOff
setDouble(). They are meant to be | 531 // size, or as individual X and Y values). Be careful in using the Double |
| 519 // used to communicate the fractional scroll position/offset with chromium com
positor which can do sub-pixel positioning. | 532 // version scrollPositionDouble() and scrollOffsetDouble(). They are meant to |
| 520 // Do not call these if the scroll position/offset is used in Blink for positi
oning. Use the Int version instead. | 533 // be used to communicate the fractional scroll position/offset with chromium |
| 534 // compositor which can do sub-pixel positioning. Do not call these if the |
| 535 // scroll position/offset is used in Blink for positioning. Use the Int |
| 536 // version instead. |
| 521 IntPoint scrollPosition() const override { | 537 IntPoint scrollPosition() const override { |
| 522 return visibleContentRect().location(); | 538 return visibleContentRect().location(); |
| 523 } | 539 } |
| 524 DoublePoint scrollPositionDouble() const override { return m_scrollPosition; } | 540 DoublePoint scrollPositionDouble() const override { return m_scrollPosition; } |
| 541 // Gets the scrolled position as an IntSize. Convenient for adding to other |
| 542 // sizes. |
| 525 IntSize scrollOffset() const { | 543 IntSize scrollOffset() const { |
| 526 return toIntSize(visibleContentRect().location()); | 544 return toIntSize(visibleContentRect().location()); |
| 527 } // Gets the scrolled position as an IntSize. Convenient for adding to other
sizes. | 545 } |
| 528 DoubleSize scrollOffsetDouble() const { | 546 DoubleSize scrollOffsetDouble() const { |
| 529 return DoubleSize(m_scrollPosition.x(), m_scrollPosition.y()); | 547 return DoubleSize(m_scrollPosition.x(), m_scrollPosition.y()); |
| 530 } | 548 } |
| 531 DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; } | 549 DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; } |
| 532 IntPoint minimumScrollPosition() | 550 // The minimum position we can be scrolled to. |
| 533 const override; // The minimum position we can be scrolled to. | 551 IntPoint minimumScrollPosition() const override; |
| 534 int scrollX() const { return scrollPosition().x(); } | 552 int scrollX() const { return scrollPosition().x(); } |
| 535 int scrollY() const { return scrollPosition().y(); } | 553 int scrollY() const { return scrollPosition().y(); } |
| 536 | 554 |
| 537 // Scroll the actual contents of the view (either blitting or invalidating as
needed). | 555 // Scroll the actual contents of the view (either blitting or invalidating as |
| 556 // needed). |
| 538 void scrollContents(const IntSize& scrollDelta); | 557 void scrollContents(const IntSize& scrollDelta); |
| 539 | 558 |
| 540 // This gives us a means of blocking updating our scrollbars until the first l
ayout has occurred. | 559 // This gives us a means of blocking updating our scrollbars until the first |
| 560 // layout has occurred. |
| 541 void setScrollbarsSuppressed(bool suppressed) { | 561 void setScrollbarsSuppressed(bool suppressed) { |
| 542 m_scrollbarsSuppressed = suppressed; | 562 m_scrollbarsSuppressed = suppressed; |
| 543 } | 563 } |
| 544 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; } | 564 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; } |
| 545 | 565 |
| 546 // Methods for converting between this frame and other coordinate spaces. | 566 // Methods for converting between this frame and other coordinate spaces. |
| 547 // For definitions and an explanation of the varous spaces, please see: | 567 // For definitions and an explanation of the varous spaces, please see: |
| 548 // http://www.chromium.org/developers/design-documents/blink-coordinate-spaces | 568 // http://www.chromium.org/developers/design-documents/blink-coordinate-spaces |
| 549 IntPoint rootFrameToContents(const IntPoint&) const; | 569 IntPoint rootFrameToContents(const IntPoint&) const; |
| 550 FloatPoint rootFrameToContents(const FloatPoint&) const; | 570 FloatPoint rootFrameToContents(const FloatPoint&) const; |
| 551 IntRect rootFrameToContents(const IntRect&) const; | 571 IntRect rootFrameToContents(const IntRect&) const; |
| 552 IntPoint contentsToRootFrame(const IntPoint&) const; | 572 IntPoint contentsToRootFrame(const IntPoint&) const; |
| 553 IntRect contentsToRootFrame(const IntRect&) const; | 573 IntRect contentsToRootFrame(const IntRect&) const; |
| 554 | 574 |
| 555 IntRect viewportToContents(const IntRect&) const; | 575 IntRect viewportToContents(const IntRect&) const; |
| 556 IntRect contentsToViewport(const IntRect&) const; | 576 IntRect contentsToViewport(const IntRect&) const; |
| 557 IntPoint contentsToViewport(const IntPoint&) const; | 577 IntPoint contentsToViewport(const IntPoint&) const; |
| 558 IntPoint viewportToContents(const IntPoint&) const; | 578 IntPoint viewportToContents(const IntPoint&) const; |
| 559 | 579 |
| 560 // FIXME: Some external callers expect to get back a rect that's positioned | 580 // FIXME: Some external callers expect to get back a rect that's positioned |
| 561 // in viewport space, but sized in CSS pixels. This is an artifact of the | 581 // in viewport space, but sized in CSS pixels. This is an artifact of the |
| 562 // old pinch-zoom path. These callers should be converted to expect a rect | 582 // old pinch-zoom path. These callers should be converted to expect a rect |
| 563 // fully in viewport space. crbug.com/459591. | 583 // fully in viewport space. crbug.com/459591. |
| 564 IntRect soonToBeRemovedContentsToUnscaledViewport(const IntRect&) const; | 584 IntRect soonToBeRemovedContentsToUnscaledViewport(const IntRect&) const; |
| 565 IntPoint soonToBeRemovedUnscaledViewportToContents(const IntPoint&) const; | 585 IntPoint soonToBeRemovedUnscaledViewportToContents(const IntPoint&) const; |
| 566 | 586 |
| 567 // Methods for converting between Frame and Content (i.e. Document) coordinate
s. | 587 // Methods for converting between Frame and Content (i.e. Document) |
| 568 // Frame coordinates are relative to the top left corner of the frame and so | 588 // coordinates. Frame coordinates are relative to the top left corner of the |
| 569 // they are affected by scroll offset. Content coordinates are relative to the | 589 // frame and so they are affected by scroll offset. Content coordinates are |
| 570 // document's top left corner and thus are not affected by scroll offset. | 590 // relative to the document's top left corner and thus are not affected by |
| 591 // scroll offset. |
| 571 IntPoint contentsToFrame(const IntPoint&) const; | 592 IntPoint contentsToFrame(const IntPoint&) const; |
| 572 IntRect contentsToFrame(const IntRect&) const; | 593 IntRect contentsToFrame(const IntRect&) const; |
| 573 IntPoint frameToContents(const IntPoint&) const; | 594 IntPoint frameToContents(const IntPoint&) const; |
| 574 FloatPoint frameToContents(const FloatPoint&) const; | 595 FloatPoint frameToContents(const FloatPoint&) const; |
| 575 IntRect frameToContents(const IntRect&) const; | 596 IntRect frameToContents(const IntRect&) const; |
| 576 | 597 |
| 577 // Functions for converting to screen coordinates. | 598 // Functions for converting to screen coordinates. |
| 578 IntRect contentsToScreen(const IntRect&) const; | 599 IntRect contentsToScreen(const IntRect&) const; |
| 579 | 600 |
| 580 // These functions are used to enable scrollbars to avoid window resizer contr
ols that overlap the scroll view. | 601 // These functions are used to enable scrollbars to avoid window resizer |
| 581 // This happens only on Mac OS X 10.6. | 602 // controls that overlap the scroll view. This happens only on Mac OS X 10.6. |
| 582 IntRect windowResizerRect() const; | 603 IntRect windowResizerRect() const; |
| 583 bool containsScrollbarsAvoidingResizer() const; | 604 bool containsScrollbarsAvoidingResizer() const; |
| 584 void adjustScrollbarsAvoidingResizerCount(int overlapDelta); | 605 void adjustScrollbarsAvoidingResizerCount(int overlapDelta); |
| 585 void windowResizerRectChanged(); | 606 void windowResizerRectChanged(); |
| 586 | 607 |
| 587 // For platforms that need to hit test scrollbars from within the engine's eve
nt handlers (like Win32). | 608 // For platforms that need to hit test scrollbars from within the engine's |
| 609 // event handlers (like Win32). |
| 588 Scrollbar* scrollbarAtFramePoint(const IntPoint&); | 610 Scrollbar* scrollbarAtFramePoint(const IntPoint&); |
| 589 | 611 |
| 590 IntPoint convertChildToSelf(const Widget* child, | 612 IntPoint convertChildToSelf(const Widget* child, |
| 591 const IntPoint& point) const override { | 613 const IntPoint& point) const override { |
| 592 IntPoint newPoint = point; | 614 IntPoint newPoint = point; |
| 593 if (!isFrameViewScrollbar(child)) | 615 if (!isFrameViewScrollbar(child)) |
| 594 newPoint = contentsToFrame(point); | 616 newPoint = contentsToFrame(point); |
| 595 newPoint.moveBy(child->location()); | 617 newPoint.moveBy(child->location()); |
| 596 return newPoint; | 618 return newPoint; |
| 597 } | 619 } |
| 598 | 620 |
| 599 IntPoint convertSelfToChild(const Widget* child, | 621 IntPoint convertSelfToChild(const Widget* child, |
| 600 const IntPoint& point) const override { | 622 const IntPoint& point) const override { |
| 601 IntPoint newPoint = point; | 623 IntPoint newPoint = point; |
| 602 if (!isFrameViewScrollbar(child)) | 624 if (!isFrameViewScrollbar(child)) |
| 603 newPoint = frameToContents(point); | 625 newPoint = frameToContents(point); |
| 604 newPoint.moveBy(-child->location()); | 626 newPoint.moveBy(-child->location()); |
| 605 return newPoint; | 627 return newPoint; |
| 606 } | 628 } |
| 607 | 629 |
| 608 // Widget override. Handles painting of the contents of the view as well as th
e scrollbars. | 630 // Widget override. Handles painting of the contents of the view as well as |
| 631 // the scrollbars. |
| 609 void paint(GraphicsContext&, const CullRect&) const override; | 632 void paint(GraphicsContext&, const CullRect&) const override; |
| 610 void paint(GraphicsContext&, const GlobalPaintFlags, const CullRect&) const; | 633 void paint(GraphicsContext&, const GlobalPaintFlags, const CullRect&) const; |
| 611 void paintContents(GraphicsContext&, | 634 void paintContents(GraphicsContext&, |
| 612 const GlobalPaintFlags, | 635 const GlobalPaintFlags, |
| 613 const IntRect& damageRect) const; | 636 const IntRect& damageRect) const; |
| 614 | 637 |
| 615 // Widget overrides to ensure that our children's visibility status is kept up
to date when we get shown and hidden. | 638 // Widget overrides to ensure that our children's visibility status is kept up |
| 639 // to date when we get shown and hidden. |
| 616 void show() override; | 640 void show() override; |
| 617 void hide() override; | 641 void hide() override; |
| 618 void setParentVisible(bool) override; | 642 void setParentVisible(bool) override; |
| 619 | 643 |
| 620 bool isPointInScrollbarCorner(const IntPoint&); | 644 bool isPointInScrollbarCorner(const IntPoint&); |
| 621 bool scrollbarCornerPresent() const; | 645 bool scrollbarCornerPresent() const; |
| 622 IntRect scrollCornerRect() const override; | 646 IntRect scrollCornerRect() const override; |
| 623 | 647 |
| 624 IntRect convertFromScrollbarToContainingWidget(const Scrollbar&, | 648 IntRect convertFromScrollbarToContainingWidget(const Scrollbar&, |
| 625 const IntRect&) const override; | 649 const IntRect&) const override; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 LayoutAnalyzer* layoutAnalyzer() { return m_analyzer.get(); } | 684 LayoutAnalyzer* layoutAnalyzer() { return m_analyzer.get(); } |
| 661 | 685 |
| 662 // Returns true if this frame should not render or schedule visual updates. | 686 // Returns true if this frame should not render or schedule visual updates. |
| 663 bool shouldThrottleRendering() const; | 687 bool shouldThrottleRendering() const; |
| 664 | 688 |
| 665 // Returns true if this frame could potentially skip rendering and avoid | 689 // Returns true if this frame could potentially skip rendering and avoid |
| 666 // scheduling visual updates. | 690 // scheduling visual updates. |
| 667 bool canThrottleRendering() const; | 691 bool canThrottleRendering() const; |
| 668 bool isHiddenForThrottling() const { return m_hiddenForThrottling; } | 692 bool isHiddenForThrottling() const { return m_hiddenForThrottling; } |
| 669 | 693 |
| 670 // For testing, run pending intersection observer notifications for this frame
. | 694 // For testing, run pending intersection observer notifications for this |
| 695 // frame. |
| 671 void notifyRenderThrottlingObserversForTesting(); | 696 void notifyRenderThrottlingObserversForTesting(); |
| 672 | 697 |
| 673 // Paint properties for SPv2 Only. | 698 // Paint properties for SPv2 Only. |
| 674 void setPreTranslation( | 699 void setPreTranslation( |
| 675 PassRefPtr<TransformPaintPropertyNode> preTranslation) { | 700 PassRefPtr<TransformPaintPropertyNode> preTranslation) { |
| 676 m_preTranslation = preTranslation; | 701 m_preTranslation = preTranslation; |
| 677 } | 702 } |
| 678 TransformPaintPropertyNode* preTranslation() const { | 703 TransformPaintPropertyNode* preTranslation() const { |
| 679 return m_preTranslation.get(); | 704 return m_preTranslation.get(); |
| 680 } | 705 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 711 // TODO(ojan): Merge this with IntersectionObserver once it lands. | 736 // TODO(ojan): Merge this with IntersectionObserver once it lands. |
| 712 IntRect computeVisibleArea(); | 737 IntRect computeVisibleArea(); |
| 713 | 738 |
| 714 // Viewport size that should be used for viewport units (i.e. 'vh'/'vw'). | 739 // Viewport size that should be used for viewport units (i.e. 'vh'/'vw'). |
| 715 FloatSize viewportSizeForViewportUnits() const; | 740 FloatSize viewportSizeForViewportUnits() const; |
| 716 | 741 |
| 717 ScrollAnchor* scrollAnchor() override { return &m_scrollAnchor; } | 742 ScrollAnchor* scrollAnchor() override { return &m_scrollAnchor; } |
| 718 void clearScrollAnchor(); | 743 void clearScrollAnchor(); |
| 719 bool shouldPerformScrollAnchoring() const override; | 744 bool shouldPerformScrollAnchoring() const override; |
| 720 | 745 |
| 721 // For PaintInvalidator temporarily. TODO(wangxianzhu): Move into PaintInvalid
ator. | 746 // For PaintInvalidator temporarily. TODO(wangxianzhu): Move into |
| 747 // PaintInvalidator. |
| 722 void invalidatePaintIfNeeded(const PaintInvalidationState&); | 748 void invalidatePaintIfNeeded(const PaintInvalidationState&); |
| 723 | 749 |
| 724 // Only for SPv2. | 750 // Only for SPv2. |
| 725 std::unique_ptr<JSONObject> compositedLayersAsJSON(LayerTreeFlags); | 751 std::unique_ptr<JSONObject> compositedLayersAsJSON(LayerTreeFlags); |
| 726 | 752 |
| 727 protected: | 753 protected: |
| 728 // Scroll the content via the compositor. | 754 // Scroll the content via the compositor. |
| 729 bool scrollContentsFastPath(const IntSize& scrollDelta); | 755 bool scrollContentsFastPath(const IntSize& scrollDelta); |
| 730 | 756 |
| 731 // Scroll the content by invalidating everything. | 757 // Scroll the content by invalidating everything. |
| 732 void scrollContentsSlowPath(); | 758 void scrollContentsSlowPath(); |
| 733 | 759 |
| 734 // These functions are used to create/destroy scrollbars. | 760 // These functions are used to create/destroy scrollbars. |
| 735 void setHasHorizontalScrollbar(bool); | 761 void setHasHorizontalScrollbar(bool); |
| 736 void setHasVerticalScrollbar(bool); | 762 void setHasVerticalScrollbar(bool); |
| 737 | 763 |
| 738 ScrollBehavior scrollBehaviorStyle() const override; | 764 ScrollBehavior scrollBehaviorStyle() const override; |
| 739 | 765 |
| 740 void scrollContentsIfNeeded(); | 766 void scrollContentsIfNeeded(); |
| 741 | 767 |
| 742 enum ComputeScrollbarExistenceOption { FirstPass, Incremental }; | 768 enum ComputeScrollbarExistenceOption { FirstPass, Incremental }; |
| 743 void computeScrollbarExistence( | 769 void computeScrollbarExistence( |
| 744 bool& newHasHorizontalScrollbar, | 770 bool& newHasHorizontalScrollbar, |
| 745 bool& newHasVerticalScrollbar, | 771 bool& newHasVerticalScrollbar, |
| 746 const IntSize& docSize, | 772 const IntSize& docSize, |
| 747 ComputeScrollbarExistenceOption = FirstPass) const; | 773 ComputeScrollbarExistenceOption = FirstPass) const; |
| 748 void updateScrollbarGeometry(); | 774 void updateScrollbarGeometry(); |
| 749 IntRect adjustScrollbarRectForResizer(const IntRect&, Scrollbar&); | 775 IntRect adjustScrollbarRectForResizer(const IntRect&, Scrollbar&); |
| 750 | 776 |
| 751 // Called to update the scrollbars to accurately reflect the state of the view
. | 777 // Called to update the scrollbars to accurately reflect the state of the |
| 778 // view. |
| 752 void updateScrollbars(); | 779 void updateScrollbars(); |
| 753 void updateScrollbarsIfNeeded(); | 780 void updateScrollbarsIfNeeded(); |
| 754 | 781 |
| 755 class InUpdateScrollbarsScope { | 782 class InUpdateScrollbarsScope { |
| 756 STACK_ALLOCATED(); | 783 STACK_ALLOCATED(); |
| 757 | 784 |
| 758 public: | 785 public: |
| 759 explicit InUpdateScrollbarsScope(FrameView* view) | 786 explicit InUpdateScrollbarsScope(FrameView* view) |
| 760 : m_scope(&view->m_inUpdateScrollbars, true) {} | 787 : m_scope(&view->m_inUpdateScrollbars, true) {} |
| 761 | 788 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 784 void updateStyleAndLayoutIfNeededRecursiveInternal(); | 811 void updateStyleAndLayoutIfNeededRecursiveInternal(); |
| 785 void invalidateTreeIfNeededRecursiveInternal(); | 812 void invalidateTreeIfNeededRecursiveInternal(); |
| 786 | 813 |
| 787 void pushPaintArtifactToCompositor(); | 814 void pushPaintArtifactToCompositor(); |
| 788 | 815 |
| 789 void reset(); | 816 void reset(); |
| 790 void init(); | 817 void init(); |
| 791 | 818 |
| 792 void clearLayoutSubtreeRootsAndMarkContainingBlocks(); | 819 void clearLayoutSubtreeRootsAndMarkContainingBlocks(); |
| 793 | 820 |
| 794 // Called when our frame rect changes (or the rect/scroll position of an ances
tor changes). | 821 // Called when our frame rect changes (or the rect/scroll position of an |
| 822 // ancestor changes). |
| 795 void frameRectsChanged() override; | 823 void frameRectsChanged() override; |
| 796 | 824 |
| 797 bool contentsInCompositedLayer() const; | 825 bool contentsInCompositedLayer() const; |
| 798 | 826 |
| 799 void calculateScrollbarModesFromOverflowStyle(const ComputedStyle*, | 827 void calculateScrollbarModesFromOverflowStyle(const ComputedStyle*, |
| 800 ScrollbarMode& hMode, | 828 ScrollbarMode& hMode, |
| 801 ScrollbarMode& vMode); | 829 ScrollbarMode& vMode); |
| 802 | 830 |
| 803 void updateCounters(); | 831 void updateCounters(); |
| 804 void forceLayoutParentViewIfNeeded(); | 832 void forceLayoutParentViewIfNeeded(); |
| 805 void performPreLayoutTasks(); | 833 void performPreLayoutTasks(); |
| 806 void performLayout(bool inSubtreeLayout); | 834 void performLayout(bool inSubtreeLayout); |
| 807 void scheduleOrPerformPostLayoutTasks(); | 835 void scheduleOrPerformPostLayoutTasks(); |
| 808 void performPostLayoutTasks(); | 836 void performPostLayoutTasks(); |
| 809 | 837 |
| 810 DocumentLifecycle& lifecycle() const; | 838 DocumentLifecycle& lifecycle() const; |
| 811 | 839 |
| 812 void contentsResized() override; | 840 void contentsResized() override; |
| 813 void scrollbarExistenceDidChange(); | 841 void scrollbarExistenceDidChange(); |
| 814 | 842 |
| 815 // Override Widget methods to do point conversion via layoutObjects, in order
to | 843 // Override Widget methods to do point conversion via layoutObjects, in order |
| 816 // take transforms into account. | 844 // to take transforms into account. |
| 817 IntRect convertToContainingWidget(const IntRect&) const override; | 845 IntRect convertToContainingWidget(const IntRect&) const override; |
| 818 IntRect convertFromContainingWidget(const IntRect&) const override; | 846 IntRect convertFromContainingWidget(const IntRect&) const override; |
| 819 IntPoint convertToContainingWidget(const IntPoint&) const override; | 847 IntPoint convertToContainingWidget(const IntPoint&) const override; |
| 820 IntPoint convertFromContainingWidget(const IntPoint&) const override; | 848 IntPoint convertFromContainingWidget(const IntPoint&) const override; |
| 821 | 849 |
| 822 void updateWidgetGeometriesIfNeeded(); | 850 void updateWidgetGeometriesIfNeeded(); |
| 823 | 851 |
| 824 bool wasViewportResized(); | 852 bool wasViewportResized(); |
| 825 void sendResizeEventIfNeeded(); | 853 void sendResizeEventIfNeeded(); |
| 826 | 854 |
| 827 void updateScrollableAreaSet(); | 855 void updateScrollableAreaSet(); |
| 828 | 856 |
| 829 void scheduleUpdateWidgetsIfNecessary(); | 857 void scheduleUpdateWidgetsIfNecessary(); |
| 830 void updateWidgetsTimerFired(TimerBase*); | 858 void updateWidgetsTimerFired(TimerBase*); |
| 831 bool updateWidgets(); | 859 bool updateWidgets(); |
| 832 | 860 |
| 833 bool processUrlFragmentHelper(const String&, UrlFragmentBehavior); | 861 bool processUrlFragmentHelper(const String&, UrlFragmentBehavior); |
| 834 void setFragmentAnchor(Node*); | 862 void setFragmentAnchor(Node*); |
| 835 void scrollToFragmentAnchor(); | 863 void scrollToFragmentAnchor(); |
| 836 void didScrollTimerFired(TimerBase*); | 864 void didScrollTimerFired(TimerBase*); |
| 837 | 865 |
| 838 void updateLayersAndCompositingAfterScrollIfNeeded( | 866 void updateLayersAndCompositingAfterScrollIfNeeded( |
| 839 const DoubleSize& scrollDelta); | 867 const DoubleSize& scrollDelta); |
| 840 | 868 |
| 841 static bool computeCompositedSelection(LocalFrame&, CompositedSelection&); | 869 static bool computeCompositedSelection(LocalFrame&, CompositedSelection&); |
| 842 void updateCompositedSelectionIfNeeded(); | 870 void updateCompositedSelectionIfNeeded(); |
| 843 | 871 |
| 844 // Returns true if the FrameView's own scrollbars overlay its content when vis
ible. | 872 // Returns true if the FrameView's own scrollbars overlay its content when |
| 873 // visible. |
| 845 bool hasOverlayScrollbars() const; | 874 bool hasOverlayScrollbars() const; |
| 846 | 875 |
| 847 // Returns true if the frame should use custom scrollbars. If true, one of | 876 // Returns true if the frame should use custom scrollbars. If true, one of |
| 848 // either |customScrollbarElement| or |customScrollbarFrame| will be set to | 877 // either |customScrollbarElement| or |customScrollbarFrame| will be set to |
| 849 // the element or frame which owns the scrollbar with the other set to null. | 878 // the element or frame which owns the scrollbar with the other set to null. |
| 850 bool shouldUseCustomScrollbars(Element*& customScrollbarElement, | 879 bool shouldUseCustomScrollbars(Element*& customScrollbarElement, |
| 851 LocalFrame*& customScrollbarFrame) const; | 880 LocalFrame*& customScrollbarFrame) const; |
| 852 | 881 |
| 853 // Returns true if a scrollbar needs to go from native -> custom or vice versa
. | 882 // Returns true if a scrollbar needs to go from native -> custom or vice |
| 883 // versa. |
| 854 bool needsScrollbarReconstruction() const; | 884 bool needsScrollbarReconstruction() const; |
| 855 | 885 |
| 856 bool shouldIgnoreOverflowHidden() const; | 886 bool shouldIgnoreOverflowHidden() const; |
| 857 | 887 |
| 858 void updateScrollCorner(); | 888 void updateScrollCorner(); |
| 859 | 889 |
| 860 AXObjectCache* axObjectCache() const; | 890 AXObjectCache* axObjectCache() const; |
| 861 | 891 |
| 862 void setLayoutSizeInternal(const IntSize&); | 892 void setLayoutSizeInternal(const IntSize&); |
| 863 | 893 |
| 864 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass); | 894 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass); |
| 865 void adjustScrollbarOpacity(); | 895 void adjustScrollbarOpacity(); |
| 866 void adjustScrollPositionFromUpdateScrollbars(); | 896 void adjustScrollPositionFromUpdateScrollbars(); |
| 867 bool visualViewportSuppliesScrollbars() const; | 897 bool visualViewportSuppliesScrollbars() const; |
| 868 | 898 |
| 869 bool isFrameViewScrollbar(const Widget* child) const { | 899 bool isFrameViewScrollbar(const Widget* child) const { |
| 870 return horizontalScrollbar() == child || verticalScrollbar() == child; | 900 return horizontalScrollbar() == child || verticalScrollbar() == child; |
| 871 } | 901 } |
| 872 | 902 |
| 873 ScrollingCoordinator* scrollingCoordinator() const; | 903 ScrollingCoordinator* scrollingCoordinator() const; |
| 874 | 904 |
| 875 void prepareLayoutAnalyzer(); | 905 void prepareLayoutAnalyzer(); |
| 876 std::unique_ptr<TracedValue> analyzerCounters(); | 906 std::unique_ptr<TracedValue> analyzerCounters(); |
| 877 | 907 |
| 878 // LayoutObject for the viewport-defining element (see Document::viewportDefin
ingElement). | 908 // LayoutObject for the viewport-defining element (see |
| 909 // Document::viewportDefiningElement). |
| 879 LayoutObject* viewportLayoutObject() const; | 910 LayoutObject* viewportLayoutObject() const; |
| 880 | 911 |
| 881 void collectAnnotatedRegions(LayoutObject&, | 912 void collectAnnotatedRegions(LayoutObject&, |
| 882 Vector<AnnotatedRegionValue>&) const; | 913 Vector<AnnotatedRegionValue>&) const; |
| 883 | 914 |
| 884 template <typename Function> | 915 template <typename Function> |
| 885 void forAllNonThrottledFrameViews(const Function&); | 916 void forAllNonThrottledFrameViews(const Function&); |
| 886 | 917 |
| 887 void setNeedsUpdateViewportIntersection(); | 918 void setNeedsUpdateViewportIntersection(); |
| 888 void updateViewportIntersectionsForSubtree( | 919 void updateViewportIntersectionsForSubtree( |
| 889 DocumentLifecycle::LifecycleState targetState); | 920 DocumentLifecycle::LifecycleState targetState); |
| 890 void updateViewportIntersectionIfNeeded(); | 921 void updateViewportIntersectionIfNeeded(); |
| 891 void notifyRenderThrottlingObservers(); | 922 void notifyRenderThrottlingObservers(); |
| 892 void updateThrottlingStatus(); | 923 void updateThrottlingStatus(); |
| 893 void notifyResizeObservers(); | 924 void notifyResizeObservers(); |
| 894 | 925 |
| 895 // PaintInvalidationCapableScrollableArea | 926 // PaintInvalidationCapableScrollableArea |
| 896 LayoutScrollbarPart* resizer() const override { return nullptr; } | 927 LayoutScrollbarPart* resizer() const override { return nullptr; } |
| 897 | 928 |
| 898 bool checkLayoutInvalidationIsAllowed() const; | 929 bool checkLayoutInvalidationIsAllowed() const; |
| 899 | 930 |
| 900 PaintController* paintController() { return m_paintController.get(); } | 931 PaintController* paintController() { return m_paintController.get(); } |
| 901 | 932 |
| 902 LayoutSize m_size; | 933 LayoutSize m_size; |
| 903 | 934 |
| 904 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; | 935 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; |
| 905 EmbeddedObjectSet m_partUpdateSet; | 936 EmbeddedObjectSet m_partUpdateSet; |
| 906 | 937 |
| 907 // FIXME: These are just "children" of the FrameView and should be Member<Widg
et> instead. | 938 // FIXME: These are just "children" of the FrameView and should be |
| 939 // Member<Widget> instead. |
| 908 HashSet<RefPtr<LayoutPart>> m_parts; | 940 HashSet<RefPtr<LayoutPart>> m_parts; |
| 909 | 941 |
| 910 // The RefPtr cycle between LocalFrame and FrameView is broken | 942 // The RefPtr cycle between LocalFrame and FrameView is broken |
| 911 // when a LocalFrame is detached by LocalFrame::detach(). | 943 // when a LocalFrame is detached by LocalFrame::detach(). |
| 912 // It clears the LocalFrame's m_view reference via setView(nullptr). | 944 // It clears the LocalFrame's m_view reference via setView(nullptr). |
| 913 // | 945 // |
| 914 // For Oilpan, Member reference cycles pose no problem, but | 946 // For Oilpan, Member reference cycles pose no problem, but |
| 915 // LocalFrame's FrameView is also cleared by that setView(), so as to | 947 // LocalFrame's FrameView is also cleared by that setView(), so as to |
| 916 // keep the observable lifespan of LocalFrame::view() identical. | 948 // keep the observable lifespan of LocalFrame::view() identical. |
| 917 Member<LocalFrame> m_frame; | 949 Member<LocalFrame> m_frame; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 | 1052 |
| 1021 // The following members control rendering pipeline throttling for this | 1053 // The following members control rendering pipeline throttling for this |
| 1022 // frame. They are only updated in response to intersection observer | 1054 // frame. They are only updated in response to intersection observer |
| 1023 // notifications, i.e., not in the middle of the lifecycle. | 1055 // notifications, i.e., not in the middle of the lifecycle. |
| 1024 bool m_hiddenForThrottling; | 1056 bool m_hiddenForThrottling; |
| 1025 bool m_crossOriginForThrottling; | 1057 bool m_crossOriginForThrottling; |
| 1026 bool m_subtreeThrottled; | 1058 bool m_subtreeThrottled; |
| 1027 | 1059 |
| 1028 // Paint properties for SPv2 Only. | 1060 // Paint properties for SPv2 Only. |
| 1029 // The hierarchy of transform subtree created by a FrameView. | 1061 // The hierarchy of transform subtree created by a FrameView. |
| 1030 // [ preTranslation ] The offset from Widget::frameRect. Establi
shes viewport. | 1062 // [ preTranslation ] The offset from Widget::frameRect. |
| 1063 // | Establishes viewport. |
| 1031 // +---[ scrollTranslation ] Frame scrolling. | 1064 // +---[ scrollTranslation ] Frame scrolling. |
| 1032 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is
enabled. | 1065 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is |
| 1066 // enabled. |
| 1033 RefPtr<TransformPaintPropertyNode> m_preTranslation; | 1067 RefPtr<TransformPaintPropertyNode> m_preTranslation; |
| 1034 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 1068 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
| 1035 RefPtr<ScrollPaintPropertyNode> m_scroll; | 1069 RefPtr<ScrollPaintPropertyNode> m_scroll; |
| 1036 // The content clip clips the document (= LayoutView) but not the scrollbars. | 1070 // The content clip clips the document (= LayoutView) but not the scrollbars. |
| 1037 // TODO(trchen): This will not be needed once settings->rootLayerScrolls() is
enabled. | 1071 // TODO(trchen): This will not be needed once settings->rootLayerScrolls() is |
| 1072 // enabled. |
| 1038 RefPtr<ClipPaintPropertyNode> m_contentClip; | 1073 RefPtr<ClipPaintPropertyNode> m_contentClip; |
| 1039 // The property tree state that should be used for painting contents. These | 1074 // The property tree state that should be used for painting contents. These |
| 1040 // properties are either created by this FrameView or are inherited from | 1075 // properties are either created by this FrameView or are inherited from |
| 1041 // an ancestor. | 1076 // an ancestor. |
| 1042 std::unique_ptr<PropertyTreeState> m_totalPropertyTreeStateForContents; | 1077 std::unique_ptr<PropertyTreeState> m_totalPropertyTreeStateForContents; |
| 1043 | 1078 |
| 1044 // This is set on the local root frame view only. | 1079 // This is set on the local root frame view only. |
| 1045 DocumentLifecycle::LifecycleState m_currentUpdateLifecyclePhasesTargetState; | 1080 DocumentLifecycle::LifecycleState m_currentUpdateLifecyclePhasesTargetState; |
| 1046 | 1081 |
| 1047 ScrollAnchor m_scrollAnchor; | 1082 ScrollAnchor m_scrollAnchor; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1060 | 1095 |
| 1061 // For Slimming Paint v2 only. | 1096 // For Slimming Paint v2 only. |
| 1062 std::unique_ptr<PaintController> m_paintController; | 1097 std::unique_ptr<PaintController> m_paintController; |
| 1063 std::unique_ptr<PaintArtifactCompositor> m_paintArtifactCompositor; | 1098 std::unique_ptr<PaintArtifactCompositor> m_paintArtifactCompositor; |
| 1064 }; | 1099 }; |
| 1065 | 1100 |
| 1066 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) { | 1101 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) { |
| 1067 if (m_isVisuallyNonEmpty) | 1102 if (m_isVisuallyNonEmpty) |
| 1068 return; | 1103 return; |
| 1069 m_visuallyNonEmptyCharacterCount += count; | 1104 m_visuallyNonEmptyCharacterCount += count; |
| 1070 // Use a threshold value to prevent very small amounts of visible content from
triggering didMeaningfulLayout. | 1105 // Use a threshold value to prevent very small amounts of visible content from |
| 1071 // The first few hundred characters rarely contain the interesting content of
the page. | 1106 // triggering didMeaningfulLayout. The first few hundred characters rarely |
| 1107 // contain the interesting content of the page. |
| 1072 static const unsigned visualCharacterThreshold = 200; | 1108 static const unsigned visualCharacterThreshold = 200; |
| 1073 if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold) | 1109 if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold) |
| 1074 setIsVisuallyNonEmpty(); | 1110 setIsVisuallyNonEmpty(); |
| 1075 } | 1111 } |
| 1076 | 1112 |
| 1077 inline void FrameView::incrementVisuallyNonEmptyPixelCount( | 1113 inline void FrameView::incrementVisuallyNonEmptyPixelCount( |
| 1078 const IntSize& size) { | 1114 const IntSize& size) { |
| 1079 if (m_isVisuallyNonEmpty) | 1115 if (m_isVisuallyNonEmpty) |
| 1080 return; | 1116 return; |
| 1081 m_visuallyNonEmptyPixelCount += size.area(); | 1117 m_visuallyNonEmptyPixelCount += size.area(); |
| 1082 // Use a threshold value to prevent very small amounts of visible content from
triggering didMeaningfulLayout. | 1118 // Use a threshold value to prevent very small amounts of visible content from |
| 1119 // triggering didMeaningfulLayout. |
| 1083 static const unsigned visualPixelThreshold = 32 * 32; | 1120 static const unsigned visualPixelThreshold = 32 * 32; |
| 1084 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) | 1121 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) |
| 1085 setIsVisuallyNonEmpty(); | 1122 setIsVisuallyNonEmpty(); |
| 1086 } | 1123 } |
| 1087 | 1124 |
| 1088 DEFINE_TYPE_CASTS(FrameView, | 1125 DEFINE_TYPE_CASTS(FrameView, |
| 1089 Widget, | 1126 Widget, |
| 1090 widget, | 1127 widget, |
| 1091 widget->isFrameView(), | 1128 widget->isFrameView(), |
| 1092 widget.isFrameView()); | 1129 widget.isFrameView()); |
| 1093 DEFINE_TYPE_CASTS(FrameView, | 1130 DEFINE_TYPE_CASTS(FrameView, |
| 1094 ScrollableArea, | 1131 ScrollableArea, |
| 1095 scrollableArea, | 1132 scrollableArea, |
| 1096 scrollableArea->isFrameView(), | 1133 scrollableArea->isFrameView(), |
| 1097 scrollableArea.isFrameView()); | 1134 scrollableArea.isFrameView()); |
| 1098 | 1135 |
| 1099 } // namespace blink | 1136 } // namespace blink |
| 1100 | 1137 |
| 1101 #endif // FrameView_h | 1138 #endif // FrameView_h |
| OLD | NEW |