Changeset 246635 in webkit
- Timestamp:
- Jun 20, 2019 8:55:52 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246632 r246635 1 2019-06-20 Alexander Mikhaylenko <exalm7659@gmail.com> 2 3 [GTK] The Previous/Next gesture should handle RTL 4 https://bugs.webkit.org/show_bug.cgi?id=198707 5 6 Reviewed by Michael Catanzaro. 7 8 The gesture uses PageClientImpl::userInterfaceLayoutDirection() to determine the text 9 direction. Implement that method, then adjust drawing so that the pages move from/to 10 the left instead of right side for RTL locales. 11 12 * UIProcess/API/gtk/PageClientImpl.cpp: 13 (WebKit::): Implemented. 14 * UIProcess/API/gtk/PageClientImpl.h: 15 * UIProcess/gtk/ViewGestureControllerGtk.cpp: 16 (WebKit::ViewGestureController::draw): 17 1 18 2019-06-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 19 -
trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
r246592 r246635 539 539 } 540 540 541 UserInterfaceLayoutDirection PageClientImpl::userInterfaceLayoutDirection() 542 { 543 GtkTextDirection direction = gtk_widget_get_direction(m_viewWidget); 544 if (direction == GTK_TEXT_DIR_RTL) 545 return UserInterfaceLayoutDirection::RTL; 546 547 return UserInterfaceLayoutDirection::LTR; 548 } 549 541 550 bool PageClientImpl::effectiveAppearanceIsDark() const 542 551 { -
trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h
r246592 r246635 162 162 #endif 163 163 164 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; }164 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override; 165 165 166 166 bool effectiveAppearanceIsDark() const override; -
trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp
r246496 r246635 329 329 { 330 330 bool swipingLeft = isPhysicallySwipingLeft(m_swipeProgressTracker.direction()); 331 bool swipingBack = m_swipeProgressTracker.direction() == SwipeDirection::Back; 332 bool isRTL = m_webPageProxy.userInterfaceLayoutDirection() == WebCore::UserInterfaceLayoutDirection::RTL; 331 333 float progress = m_swipeProgressTracker.progress(); 332 334 … … 337 339 338 340 double dimmingProgress = swipingLeft ? 1 - progress : -progress; 341 if (isRTL) 342 dimmingProgress = 1 - dimmingProgress; 339 343 340 344 double remainingSwipeDistance = dimmingProgress * width; … … 345 349 shadowOpacity = (remainingSwipeDistance / shadowFadeDistance) * swipeOverlayShadowOpacity; 346 350 347 RefPtr<cairo_pattern_t> shadowPattern = adoptRef(cairo_pattern_create_linear(0, 0, -swipeOverlayShadowWidth, 0));351 RefPtr<cairo_pattern_t> shadowPattern = adoptRef(cairo_pattern_create_linear(0, 0, swipeOverlayShadowWidth, 0)); 348 352 for (int i = 0; i < 16; i++) { 349 353 double offset = swipeOverlayShadowGradientOffsets[i]; … … 354 358 cairo_save(cr); 355 359 356 cairo_rectangle(cr, 0, 0, swipingLayerOffset, height); 357 cairo_set_source(cr, swipingLeft ? m_currentSwipeSnapshotPattern.get() : pageGroup); 360 if (isRTL) 361 cairo_rectangle(cr, swipingLayerOffset, 0, width - swipingLayerOffset, height); 362 else 363 cairo_rectangle(cr, 0, 0, swipingLayerOffset, height); 364 cairo_set_source(cr, swipingBack ? m_currentSwipeSnapshotPattern.get() : pageGroup); 358 365 cairo_fill_preserve(cr); 359 366 … … 364 371 365 372 if (progress) { 366 cairo_rectangle(cr, -swipeOverlayShadowWidth, 0, swipeOverlayShadowWidth, height); 373 cairo_save(cr); 374 if (!isRTL) 375 cairo_scale(cr, -1, 1); 376 cairo_rectangle(cr, 0, 0, swipeOverlayShadowWidth, height); 367 377 cairo_set_source(cr, shadowPattern.get()); 368 378 cairo_fill(cr); 369 } 370 371 cairo_rectangle(cr, 0, 0, width - swipingLayerOffset, height); 372 cairo_set_source(cr, swipingLeft ? pageGroup : m_currentSwipeSnapshotPattern.get()); 379 cairo_restore(cr); 380 } 381 382 if (isRTL) { 383 cairo_translate(cr, -width, 0); 384 cairo_rectangle(cr, width - swipingLayerOffset, 0, swipingLayerOffset, height); 385 } else 386 cairo_rectangle(cr, 0, 0, width - swipingLayerOffset, height); 387 cairo_set_source(cr, swipingBack ? pageGroup : m_currentSwipeSnapshotPattern.get()); 373 388 cairo_fill(cr); 374 389
Note: See TracChangeset
for help on using the changeset viewer.