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

Side by Side Diff: Source/core/rendering/RenderThemeChromiumMac.mm

Issue 323013004: Clean up transform methods in GraphicsContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2nd Attempt Mac build fix Created 6 years, 6 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) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Google, Inc. 3 * Copyright (C) 2008, 2009 Google, Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 902
903 GraphicsContextStateSaver stateSaver(*paintInfo.context); 903 GraphicsContextStateSaver stateSaver(*paintInfo.context);
904 904
905 // On Leopard, the cell will draw outside of the given rect, so we have to c lip to the rect 905 // On Leopard, the cell will draw outside of the given rect, so we have to c lip to the rect
906 paintInfo.context->clip(inflatedRect); 906 paintInfo.context->clip(inflatedRect);
907 907
908 if (zoomLevel != 1.0f) { 908 if (zoomLevel != 1.0f) {
909 inflatedRect.setWidth(inflatedRect.width() / zoomLevel); 909 inflatedRect.setWidth(inflatedRect.width() / zoomLevel);
910 inflatedRect.setHeight(inflatedRect.height() / zoomLevel); 910 inflatedRect.setHeight(inflatedRect.height() / zoomLevel);
911 paintInfo.context->translate(inflatedRect.x(), inflatedRect.y()); 911 paintInfo.context->translate(inflatedRect.x(), inflatedRect.y());
912 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); 912 paintInfo.context->scale(zoomLevel, zoomLevel);
913 paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y()); 913 paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y());
914 } 914 }
915 915
916 NSView *view = documentViewFor(o); 916 NSView *view = documentViewFor(o);
917 [popupButton drawWithFrame:inflatedRect inView:view]; 917 [popupButton drawWithFrame:inflatedRect inView:view];
918 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING 918 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
919 if (isFocused(o) && o->style()->outlineStyleIsAuto()) 919 if (isFocused(o) && o->style()->outlineStyleIsAuto())
920 [popupButton _web_drawFocusRingWithFrame:inflatedRect inView:view]; 920 [popupButton _web_drawFocusRingWithFrame:inflatedRect inView:view];
921 #endif 921 #endif
922 [popupButton setControlView:nil]; 922 [popupButton setControlView:nil];
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 return true; 1095 return true;
1096 1096
1097 ContextContainer cgContextContainer(imageBuffer->context()); 1097 ContextContainer cgContextContainer(imageBuffer->context());
1098 CGContextRef cgContext = cgContextContainer.context(); 1098 CGContextRef cgContext = cgContextContainer.context();
1099 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); 1099 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal);
1100 1100
1101 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1101 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1102 1102
1103 if (!renderProgress->style()->isLeftToRightDirection()) { 1103 if (!renderProgress->style()->isLeftToRightDirection()) {
1104 paintInfo.context->translate(2 * inflatedRect.x() + inflatedRect.width() , 0); 1104 paintInfo.context->translate(2 * inflatedRect.x() + inflatedRect.width() , 0);
1105 paintInfo.context->scale(FloatSize(-1, 1)); 1105 paintInfo.context->scale(-1, 1);
1106 } 1106 }
1107 1107
1108 paintInfo.context->drawImageBuffer(imageBuffer.get(), 1108 paintInfo.context->drawImageBuffer(imageBuffer.get(),
1109 FloatRect(inflatedRect.location(), imageBuffer->size())); 1109 FloatRect(inflatedRect.location(), imageBuffer->size()));
1110 return false; 1110 return false;
1111 } 1111 }
1112 1112
1113 const float baseFontSize = 11.0f; 1113 const float baseFontSize = 11.0f;
1114 const float baseArrowHeight = 4.0f; 1114 const float baseArrowHeight = 4.0f;
1115 const float baseArrowWidth = 5.0f; 1115 const float baseArrowWidth = 5.0f;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 } 1305 }
1306 1306
1307 if (zoomLevel != 1) { 1307 if (zoomLevel != 1) {
1308 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); 1308 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
1309 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); 1309 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
1310 } 1310 }
1311 1311
1312 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1312 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1313 if (zoomLevel != 1) { 1313 if (zoomLevel != 1) {
1314 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); 1314 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y());
1315 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); 1315 paintInfo.context->scale(zoomLevel, zoomLevel);
1316 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); 1316 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
1317 } 1317 }
1318 1318
1319 Color fillColor(205, 205, 205); 1319 Color fillColor(205, 205, 205);
1320 Color borderGradientTopColor(109, 109, 109); 1320 Color borderGradientTopColor(109, 109, 109);
1321 Color borderGradientBottomColor(181, 181, 181); 1321 Color borderGradientBottomColor(181, 181, 181);
1322 Color shadowColor(0, 0, 0, 118); 1322 Color shadowColor(0, 0, 0, 118);
1323 1323
1324 if (!isEnabled(o)) { 1324 if (!isEnabled(o)) {
1325 Color tintColor(255, 255, 255, 128); 1325 Color tintColor(255, 255, 255, 128);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 const int sliderThumbBorderWidth = 1; 1370 const int sliderThumbBorderWidth = 1;
1371 1371
1372 bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) 1372 bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
1373 { 1373 {
1374 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1374 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1375 float zoomLevel = o->style()->effectiveZoom(); 1375 float zoomLevel = o->style()->effectiveZoom();
1376 1376
1377 FloatRect unzoomedRect(r.x(), r.y(), sliderThumbWidth, sliderThumbHeight); 1377 FloatRect unzoomedRect(r.x(), r.y(), sliderThumbWidth, sliderThumbHeight);
1378 if (zoomLevel != 1.0f) { 1378 if (zoomLevel != 1.0f) {
1379 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); 1379 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y());
1380 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); 1380 paintInfo.context->scale(zoomLevel, zoomLevel);
1381 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); 1381 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
1382 } 1382 }
1383 1383
1384 Color fillGradientTopColor(250, 250, 250); 1384 Color fillGradientTopColor(250, 250, 250);
1385 Color fillGradientUpperMiddleColor(244, 244, 244); 1385 Color fillGradientUpperMiddleColor(244, 244, 244);
1386 Color fillGradientLowerMiddleColor(236, 236, 236); 1386 Color fillGradientLowerMiddleColor(236, 236, 236);
1387 Color fillGradientBottomColor(238, 238, 238); 1387 Color fillGradientBottomColor(238, 238, 238);
1388 Color borderGradientTopColor(151, 151, 151); 1388 Color borderGradientTopColor(151, 151, 151);
1389 Color borderGradientBottomColor(128, 128, 128); 1389 Color borderGradientBottomColor(128, 128, 128);
1390 Color shadowColor(0, 0, 0, 36); 1390 Color shadowColor(0, 0, 0, 36);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1455 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1456 1456
1457 float zoomLevel = o->style()->effectiveZoom(); 1457 float zoomLevel = o->style()->effectiveZoom();
1458 1458
1459 IntRect unzoomedRect = r; 1459 IntRect unzoomedRect = r;
1460 1460
1461 if (zoomLevel != 1.0f) { 1461 if (zoomLevel != 1.0f) {
1462 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); 1462 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
1463 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); 1463 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
1464 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); 1464 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y());
1465 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); 1465 paintInfo.context->scale(zoomLevel, zoomLevel);
1466 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); 1466 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
1467 } 1467 }
1468 1468
1469 // Set the search button to nil before drawing. Then reset it so we can dra w it later. 1469 // Set the search button to nil before drawing. Then reset it so we can dra w it later.
1470 [search setSearchButtonCell:nil]; 1470 [search setSearchButtonCell:nil];
1471 1471
1472 [search drawWithFrame:NSRect(unzoomedRect) inView:documentViewFor(o)]; 1472 [search drawWithFrame:NSRect(unzoomedRect) inView:documentViewFor(o)];
1473 1473
1474 [search setControlView:nil]; 1474 [search setControlView:nil];
1475 [search resetSearchButtonCell]; 1475 [search resetSearchButtonCell];
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 return false; 1555 return false;
1556 1556
1557 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1557 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1558 1558
1559 float zoomLevel = o->style()->effectiveZoom(); 1559 float zoomLevel = o->style()->effectiveZoom();
1560 FloatRect unzoomedRect(r); 1560 FloatRect unzoomedRect(r);
1561 if (zoomLevel != 1.0f) { 1561 if (zoomLevel != 1.0f) {
1562 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); 1562 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
1563 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); 1563 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
1564 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); 1564 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y());
1565 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); 1565 paintInfo.context->scale(zoomLevel, zoomLevel);
1566 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); 1566 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
1567 } 1567 }
1568 1568
1569 Color fillColor(200, 200, 200); 1569 Color fillColor(200, 200, 200);
1570 1570
1571 if (isPressed(o)) { 1571 if (isPressed(o)) {
1572 Color tintColor(0, 0, 0, 32); 1572 Color tintColor(0, 0, 0, 32);
1573 fillColor = fillColor.blend(tintColor); 1573 fillColor = fillColor.blend(tintColor);
1574 } 1574 }
1575 1575
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 return false; 1654 return false;
1655 1655
1656 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1656 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1657 1657
1658 float zoomLevel = o->style()->effectiveZoom(); 1658 float zoomLevel = o->style()->effectiveZoom();
1659 FloatRect unzoomedRect(r); 1659 FloatRect unzoomedRect(r);
1660 if (zoomLevel != 1) { 1660 if (zoomLevel != 1) {
1661 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); 1661 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
1662 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); 1662 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
1663 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); 1663 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y());
1664 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); 1664 paintInfo.context->scale(zoomLevel, zoomLevel);
1665 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); 1665 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
1666 } 1666 }
1667 1667
1668 LocalCurrentGraphicsContext localContext(paintInfo.context); 1668 LocalCurrentGraphicsContext localContext(paintInfo.context);
1669 1669
1670 NSSearchFieldCell* search = this->search(); 1670 NSSearchFieldCell* search = this->search();
1671 setSearchCellState(input->renderer(), r); 1671 setSearchCellState(input->renderer(), r);
1672 [search setControlSize:searchFieldControlSizeForFont(o->style())]; 1672 [search setControlSize:searchFieldControlSizeForFont(o->style())];
1673 if ([search searchMenuTemplate] != nil) 1673 if ([search searchMenuTemplate] != nil)
1674 [search setSearchMenuTemplate:nil]; 1674 [search setSearchMenuTemplate:nil];
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 1903
1904 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const 1904 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const
1905 { 1905 {
1906 ControlPart part = style->appearance(); 1906 ControlPart part = style->appearance();
1907 if (part == CheckboxPart || part == RadioPart) 1907 if (part == CheckboxPart || part == RadioPart)
1908 return style->effectiveZoom() != 1; 1908 return style->effectiveZoom() != 1;
1909 return false; 1909 return false;
1910 } 1910 }
1911 1911
1912 } // namespace WebCore 1912 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderThemeChromiumDefault.cpp ('k') | Source/core/rendering/RenderThemeChromiumSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698