Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 2393313002: reflow comments in core/frame (Closed)
Patch Set: tweak Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (!mainFrame()) 121 if (!mainFrame())
122 return; 122 return;
123 123
124 enqueueResizeEvent(); 124 enqueueResizeEvent();
125 125
126 bool autosizerNeedsUpdating = 126 bool autosizerNeedsUpdating =
127 widthDidChange && mainFrame()->settings() && 127 widthDidChange && mainFrame()->settings() &&
128 mainFrame()->settings()->textAutosizingEnabled(); 128 mainFrame()->settings()->textAutosizingEnabled();
129 129
130 if (autosizerNeedsUpdating) { 130 if (autosizerNeedsUpdating) {
131 // This needs to happen after setting the m_size member since it'll be read in the update call. 131 // This needs to happen after setting the m_size member since it'll be read
132 // in the update call.
132 if (TextAutosizer* textAutosizer = mainFrame()->document()->textAutosizer()) 133 if (TextAutosizer* textAutosizer = mainFrame()->document()->textAutosizer())
133 textAutosizer->updatePageInfoInAllFrames(); 134 textAutosizer->updatePageInfoInAllFrames();
134 } 135 }
135 } 136 }
136 137
137 void VisualViewport::reset() { 138 void VisualViewport::reset() {
138 setScaleAndLocation(1, FloatPoint()); 139 setScaleAndLocation(1, FloatPoint());
139 } 140 }
140 141
141 void VisualViewport::mainFrameDidChangeSize() { 142 void VisualViewport::mainFrameDidChangeSize() {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 frameHost().chromeClient().pageScaleFactorChanged(); 268 frameHost().chromeClient().pageScaleFactorChanged();
268 enqueueResizeEvent(); 269 enqueueResizeEvent();
269 } 270 }
270 271
271 FloatPoint clampedOffset(clampOffsetToBoundaries(location)); 272 FloatPoint clampedOffset(clampOffsetToBoundaries(location));
272 273
273 if (clampedOffset != m_offset) { 274 if (clampedOffset != m_offset) {
274 m_offset = clampedOffset; 275 m_offset = clampedOffset;
275 scrollAnimator().setCurrentPosition(m_offset); 276 scrollAnimator().setCurrentPosition(m_offset);
276 277
277 // SVG runs with accelerated compositing disabled so no ScrollingCoordinator . 278 // SVG runs with accelerated compositing disabled so no
279 // ScrollingCoordinator.
278 if (ScrollingCoordinator* coordinator = 280 if (ScrollingCoordinator* coordinator =
279 frameHost().page().scrollingCoordinator()) 281 frameHost().page().scrollingCoordinator())
280 coordinator->scrollableAreaScrollLayerDidChange(this); 282 coordinator->scrollableAreaScrollLayerDidChange(this);
281 283
282 if (!frameHost().settings().inertVisualViewport()) { 284 if (!frameHost().settings().inertVisualViewport()) {
283 if (Document* document = mainFrame()->document()) 285 if (Document* document = mainFrame()->document())
284 document->enqueueScrollEventForNode(document); 286 document->enqueueScrollEventForNode(document);
285 } 287 }
286 288
287 enqueueScrollEvent(); 289 enqueueScrollEvent();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 331
330 // Modifies the top of the graphics layer tree to add layers needed to support 332 // Modifies the top of the graphics layer tree to add layers needed to support
331 // the inner/outer viewport fixed-position model for pinch zoom. When finished, 333 // the inner/outer viewport fixed-position model for pinch zoom. When finished,
332 // the tree will look like this (with * denoting added layers): 334 // the tree will look like this (with * denoting added layers):
333 // 335 //
334 // *rootTransformLayer 336 // *rootTransformLayer
335 // +- *innerViewportContainerLayer (fixed pos container) 337 // +- *innerViewportContainerLayer (fixed pos container)
336 // +- *overscrollElasticityLayer 338 // +- *overscrollElasticityLayer
337 // | +- *pageScaleLayer 339 // | +- *pageScaleLayer
338 // | +- *innerViewportScrollLayer 340 // | +- *innerViewportScrollLayer
339 // | +-- overflowControlsHostLayer (root layer) [ owned by PaintLa yerCompositor ] 341 // | +-- overflowControlsHostLayer (root layer)
340 // | +-- outerViewportContainerLayer (fixed pos container) [fr ame container layer in PaintLayerCompositor] 342 // | | [ owned by PaintLayerCompositor ]
341 // | | +-- outerViewportScrollLayer [frame scroll layer in P aintLayerCompositor] 343 // | +-- outerViewportContainerLayer (fixed pos container)
344 // | | [frame container layer in PaintLayerCompositor]
345 // | | +-- outerViewportScrollLayer
346 // | | | [frame scroll layer in PaintLayerCompositor]
342 // | | +-- content layers ... 347 // | | +-- content layers ...
343 // +- *PageOverlay for InspectorOverlay 348 // +- *PageOverlay for InspectorOverlay
344 // +- *PageOverlay for ColorOverlay 349 // +- *PageOverlay for ColorOverlay
345 // +- horizontalScrollbarLayer [ owned by PaintLayerCompositor ] 350 // +- horizontalScrollbarLayer [ owned by PaintLayerCompositor ]
346 // +- verticalScrollbarLayer [ owned by PaintLayerCompositor ] 351 // +- verticalScrollbarLayer [ owned by PaintLayerCompositor ]
347 // +- scroll corner (non-overlay only) [ owned by PaintLayerCompositor ] 352 // +- scroll corner (non-overlay only) [ owned by PaintLayerCompositor ]
348 // 353 //
349 void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot) { 354 void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot) {
350 TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree", 355 TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree",
351 "currentLayerTreeRoot", (bool)currentLayerTreeRoot); 356 "currentLayerTreeRoot", (bool)currentLayerTreeRoot);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 451
447 if (!webScrollbarLayer) { 452 if (!webScrollbarLayer) {
448 ScrollingCoordinator* coordinator = 453 ScrollingCoordinator* coordinator =
449 frameHost().page().scrollingCoordinator(); 454 frameHost().page().scrollingCoordinator();
450 ASSERT(coordinator); 455 ASSERT(coordinator);
451 ScrollbarOrientation webcoreOrientation = 456 ScrollbarOrientation webcoreOrientation =
452 isHorizontal ? HorizontalScrollbar : VerticalScrollbar; 457 isHorizontal ? HorizontalScrollbar : VerticalScrollbar;
453 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer( 458 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(
454 webcoreOrientation, thumbThickness, scrollbarMargin, false); 459 webcoreOrientation, thumbThickness, scrollbarMargin, false);
455 460
456 // The compositor will control the scrollbar's visibility. Set to invisible by default 461 // The compositor will control the scrollbar's visibility. Set to invisible
457 // so scrollbars don't show up in layout tests. 462 // by default so scrollbars don't show up in layout tests.
458 webScrollbarLayer->layer()->setOpacity(0); 463 webScrollbarLayer->layer()->setOpacity(0);
459 scrollbarGraphicsLayer->setContentsToPlatformLayer( 464 scrollbarGraphicsLayer->setContentsToPlatformLayer(
460 webScrollbarLayer->layer()); 465 webScrollbarLayer->layer());
461 scrollbarGraphicsLayer->setDrawsContent(false); 466 scrollbarGraphicsLayer->setDrawsContent(false);
462 } 467 }
463 468
464 int xPosition = isHorizontal ? 0 469 int xPosition = isHorizontal ? 0
465 : m_innerViewportContainerLayer->size().width() - 470 : m_innerViewportContainerLayer->size().width() -
466 scrollbarThickness; 471 scrollbarThickness;
467 int yPosition = 472 int yPosition =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 553 }
549 554
550 IntPoint VisualViewport::maximumScrollPosition() const { 555 IntPoint VisualViewport::maximumScrollPosition() const {
551 return flooredIntPoint(maximumScrollPositionDouble()); 556 return flooredIntPoint(maximumScrollPositionDouble());
552 } 557 }
553 558
554 DoublePoint VisualViewport::maximumScrollPositionDouble() const { 559 DoublePoint VisualViewport::maximumScrollPositionDouble() const {
555 if (!mainFrame()) 560 if (!mainFrame())
556 return IntPoint(); 561 return IntPoint();
557 562
558 // TODO(bokan): We probably shouldn't be storing the bounds in a float. crbug. com/470718. 563 // TODO(bokan): We probably shouldn't be storing the bounds in a float.
564 // crbug.com/470718.
559 FloatSize frameViewSize(contentsSize()); 565 FloatSize frameViewSize(contentsSize());
560 566
561 if (m_topControlsAdjustment) { 567 if (m_topControlsAdjustment) {
562 float minScale = 568 float minScale =
563 frameHost().pageScaleConstraintsSet().finalConstraints().minimumScale; 569 frameHost().pageScaleConstraintsSet().finalConstraints().minimumScale;
564 frameViewSize.expand(0, m_topControlsAdjustment / minScale); 570 frameViewSize.expand(0, m_topControlsAdjustment / minScale);
565 } 571 }
566 572
567 frameViewSize.scale(m_scale); 573 frameViewSize.scale(m_scale);
568 frameViewSize = FloatSize(flooredIntSize(frameViewSize)); 574 frameViewSize = FloatSize(flooredIntSize(frameViewSize));
(...skipping 28 matching lines...) Expand all
597 return clamped; 603 return clamped;
598 } 604 }
599 605
600 void VisualViewport::setTopControlsAdjustment(float adjustment) { 606 void VisualViewport::setTopControlsAdjustment(float adjustment) {
601 m_topControlsAdjustment = adjustment; 607 m_topControlsAdjustment = adjustment;
602 } 608 }
603 609
604 IntRect VisualViewport::scrollableAreaBoundingBox() const { 610 IntRect VisualViewport::scrollableAreaBoundingBox() const {
605 // This method should return the bounding box in the parent view's coordinate 611 // This method should return the bounding box in the parent view's coordinate
606 // space; however, VisualViewport technically isn't a child of any Frames. 612 // space; however, VisualViewport technically isn't a child of any Frames.
607 // Nonetheless, the VisualViewport always occupies the entire main frame so ju st 613 // Nonetheless, the VisualViewport always occupies the entire main frame so
608 // return that. 614 // just return that.
609 LocalFrame* frame = mainFrame(); 615 LocalFrame* frame = mainFrame();
610 616
611 if (!frame || !frame->view()) 617 if (!frame || !frame->view())
612 return IntRect(); 618 return IntRect();
613 619
614 return frame->view()->frameRect(); 620 return frame->view()->frameRect();
615 } 621 }
616 622
617 IntSize VisualViewport::contentsSize() const { 623 IntSize VisualViewport::contentsSize() const {
618 LocalFrame* frame = mainFrame(); 624 LocalFrame* frame = mainFrame();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 if (m_trackPinchZoomStatsForPage) { 769 if (m_trackPinchZoomStatsForPage) {
764 bool didScale = m_maxPageScale > 0; 770 bool didScale = m_maxPageScale > 0;
765 771
766 DEFINE_STATIC_LOCAL(EnumerationHistogram, didScaleHistogram, 772 DEFINE_STATIC_LOCAL(EnumerationHistogram, didScaleHistogram,
767 ("Viewport.DidScalePage", 2)); 773 ("Viewport.DidScalePage", 2));
768 didScaleHistogram.count(didScale ? 1 : 0); 774 didScaleHistogram.count(didScale ? 1 : 0);
769 775
770 if (didScale) { 776 if (didScale) {
771 int zoomPercentage = floor(m_maxPageScale * 100); 777 int zoomPercentage = floor(m_maxPageScale * 100);
772 778
773 // See the PageScaleFactor enumeration in histograms.xml for the bucket ra nges. 779 // See the PageScaleFactor enumeration in histograms.xml for the bucket
780 // ranges.
774 int bucket = floor(zoomPercentage / 25.f); 781 int bucket = floor(zoomPercentage / 25.f);
775 782
776 DEFINE_STATIC_LOCAL(EnumerationHistogram, maxScaleHistogram, 783 DEFINE_STATIC_LOCAL(EnumerationHistogram, maxScaleHistogram,
777 ("Viewport.MaxPageScale", 21)); 784 ("Viewport.MaxPageScale", 21));
778 maxScaleHistogram.count(bucket); 785 maxScaleHistogram.count(bucket);
779 } 786 }
780 } 787 }
781 788
782 m_maxPageScale = -1; 789 m_maxPageScale = -1;
783 m_trackPinchZoomStatsForPage = false; 790 m_trackPinchZoomStatsForPage = false;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 } else if (graphicsLayer == m_rootTransformLayer.get()) { 845 } else if (graphicsLayer == m_rootTransformLayer.get()) {
839 name = "Root Transform Layer"; 846 name = "Root Transform Layer";
840 } else { 847 } else {
841 ASSERT_NOT_REACHED(); 848 ASSERT_NOT_REACHED();
842 } 849 }
843 850
844 return name; 851 return name;
845 } 852 }
846 853
847 } // namespace blink 854 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698