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

Side by Side Diff: Source/core/rendering/RenderTheme.cpp

Issue 14859003: Remove the compile time flag for DATALIST Element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporate tkent's comments Created 7 years, 7 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 * This file is part of the theme implementation for form controls in WebCore. 2 * This file is part of the theme implementation for form controls in WebCore.
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #include "config.h" 22 #include "config.h"
23 #include "core/rendering/RenderTheme.h" 23 #include "core/rendering/RenderTheme.h"
24 24
25 #include "CSSValueKeywords.h" 25 #include "CSSValueKeywords.h"
26 #include "HTMLNames.h" 26 #include "HTMLNames.h"
27 #include "RuntimeEnabledFeatures.h"
27 #include "core/dom/Document.h" 28 #include "core/dom/Document.h"
28 #include "core/editing/FrameSelection.h" 29 #include "core/editing/FrameSelection.h"
29 #include "core/fileapi/FileList.h" 30 #include "core/fileapi/FileList.h"
30 #include "core/html/HTMLInputElement.h" 31 #include "core/html/HTMLInputElement.h"
31 #include "core/html/HTMLMeterElement.h" 32 #include "core/html/HTMLMeterElement.h"
32 #include "core/html/shadow/MediaControlElements.h" 33 #include "core/html/shadow/MediaControlElements.h"
33 #include "core/html/shadow/SpinButtonElement.h" 34 #include "core/html/shadow/SpinButtonElement.h"
34 #include "core/html/shadow/TextControlInnerElements.h" 35 #include "core/html/shadow/TextControlInnerElements.h"
35 #include "core/page/FocusController.h" 36 #include "core/page/FocusController.h"
36 #include "core/page/Frame.h" 37 #include "core/page/Frame.h"
37 #include "core/page/Page.h" 38 #include "core/page/Page.h"
38 #include "core/page/Settings.h" 39 #include "core/page/Settings.h"
39 #include "core/platform/FileSystem.h" 40 #include "core/platform/FileSystem.h"
40 #include "core/platform/FloatConversion.h" 41 #include "core/platform/FloatConversion.h"
41 #include "core/platform/LocalizedStrings.h" 42 #include "core/platform/LocalizedStrings.h"
42 #include "core/platform/graphics/FontSelector.h" 43 #include "core/platform/graphics/FontSelector.h"
43 #include "core/platform/graphics/GraphicsContextStateSaver.h" 44 #include "core/platform/graphics/GraphicsContextStateSaver.h"
44 #include "core/platform/graphics/StringTruncator.h" 45 #include "core/platform/graphics/StringTruncator.h"
45 #include "core/rendering/PaintInfo.h" 46 #include "core/rendering/PaintInfo.h"
46 #include "core/rendering/RenderMeter.h" 47 #include "core/rendering/RenderMeter.h"
47 #include "core/rendering/RenderView.h" 48 #include "core/rendering/RenderView.h"
48 #include "core/rendering/style/RenderStyle.h" 49 #include "core/rendering/style/RenderStyle.h"
49 50
50 #if ENABLE(INPUT_SPEECH) 51 #if ENABLE(INPUT_SPEECH)
51 #include "core/rendering/RenderInputSpeech.h" 52 #include "core/rendering/RenderInputSpeech.h"
52 #endif 53 #endif
53 54
54 #if ENABLE(DATALIST_ELEMENT)
55 #include "core/dom/shadow/ElementShadow.h" 55 #include "core/dom/shadow/ElementShadow.h"
tkent 2013/05/21 21:05:44 Merge these #includes to the above block.
56 #include "core/html/HTMLCollection.h" 56 #include "core/html/HTMLCollection.h"
57 #include "core/html/HTMLDataListElement.h" 57 #include "core/html/HTMLDataListElement.h"
58 #include "core/html/HTMLOptionElement.h" 58 #include "core/html/HTMLOptionElement.h"
59 #include "core/html/parser/HTMLParserIdioms.h" 59 #include "core/html/parser/HTMLParserIdioms.h"
60 #endif
61 60
62 // The methods in this file are shared by all themes on every platform. 61 // The methods in this file are shared by all themes on every platform.
63 62
64 namespace WebCore { 63 namespace WebCore {
65 64
66 using namespace HTMLNames; 65 using namespace HTMLNames;
67 66
68 static Color& customFocusRingColor() 67 static Color& customFocusRingColor()
69 { 68 {
70 DEFINE_STATIC_LOCAL(Color, color, ()); 69 DEFINE_STATIC_LOCAL(Color, color, ());
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 #if ENABLE(INPUT_SPEECH) 447 #if ENABLE(INPUT_SPEECH)
449 case InputSpeechButtonPart: 448 case InputSpeechButtonPart:
450 #endif 449 #endif
451 default: 450 default:
452 break; 451 break;
453 } 452 }
454 453
455 return false; 454 return false;
456 } 455 }
457 456
457 String RenderTheme::extraDefaultStyleSheet()
458 {
459 static String datalistElementCss = (RuntimeEnabledFeatures::dataListElementE nabled) ? "datalist {display: none ;}" : "";
tkent 2013/05/21 21:05:44 Acronyms should be upper-case. So the variable na
460
461 #if defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR
tkent 2013/05/21 21:05:44 #if ENABLE(INPUT_TYPE_COLOR)
462 StringBuilder inputTypeCss;
tkent 2013/05/21 21:05:44 Css -> CSS
463 inputTypeCss.append("input[type=\"color\"][list] { -webkit-appearance: menul ist; width: 88px; height: 23px;}");
464 inputTypeCss.append("input[type=\"color\"][list]::-webkit-color-swatch-wrapp er { padding-left: 8px; padding-right: 24px;}");
465 inputTypeCss.append("input[type=\"color\"][list]::-webkit-color-swatch { bor der-color: #000000;}");
466
467 return datalistElementCss + inputTypeCss.toString();
tkent 2013/05/21 21:05:44 Because you already have a StringBuilder, use it.
468 #endif // defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR
tkent 2013/05/21 21:05:44 This is a small #if block. I don't think we need a
469
470 return datalistElementCss;
471 }
472
458 String RenderTheme::formatMediaControlsTime(float time) const 473 String RenderTheme::formatMediaControlsTime(float time) const
459 { 474 {
460 if (!std::isfinite(time)) 475 if (!std::isfinite(time))
461 time = 0; 476 time = 0;
462 int seconds = (int)fabsf(time); 477 int seconds = (int)fabsf(time);
463 int hours = seconds / (60 * 60); 478 int hours = seconds / (60 * 60);
464 int minutes = (seconds / 60) % 60; 479 int minutes = (seconds / 60) % 60;
465 seconds %= 60; 480 seconds %= 60;
466 if (hours) { 481 if (hours) {
467 if (hours > 9) 482 if (hours > 9)
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 bool RenderTheme::supportsMeter(ControlPart) const 898 bool RenderTheme::supportsMeter(ControlPart) const
884 { 899 {
885 return false; 900 return false;
886 } 901 }
887 902
888 bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&) 903 bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&)
889 { 904 {
890 return true; 905 return true;
891 } 906 }
892 907
893 #if ENABLE(DATALIST_ELEMENT)
894 LayoutUnit RenderTheme::sliderTickSnappingThreshold() const 908 LayoutUnit RenderTheme::sliderTickSnappingThreshold() const
895 { 909 {
896 return 0; 910 return 0;
897 } 911 }
898 912
899 void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect) 913 void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect)
900 { 914 {
901 Node* node = o->node(); 915 Node* node = o->node();
902 if (!node) 916 if (!node)
903 return; 917 return;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 double tickFraction = (parsedValue - min) / (max - min); 984 double tickFraction = (parsedValue - min) / (max - min);
971 double tickRatio = isHorizontal && o->style()->isLeftToRightDirection() ? tickFraction : 1.0 - tickFraction; 985 double tickRatio = isHorizontal && o->style()->isLeftToRightDirection() ? tickFraction : 1.0 - tickFraction;
972 double tickPosition = round(tickRegionSideMargin + tickRegionWidth * tic kRatio); 986 double tickPosition = round(tickRegionSideMargin + tickRegionWidth * tic kRatio);
973 if (isHorizontal) 987 if (isHorizontal)
974 tickRect.setX(tickPosition); 988 tickRect.setX(tickPosition);
975 else 989 else
976 tickRect.setY(tickPosition); 990 tickRect.setY(tickPosition);
977 paintInfo.context->fillRect(tickRect); 991 paintInfo.context->fillRect(tickRect);
978 } 992 }
979 } 993 }
980 #endif
981 994
982 double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const 995 double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const
983 { 996 {
984 return 0; 997 return 0;
985 } 998 }
986 999
987 double RenderTheme::animationDurationForProgressBar(RenderProgress*) const 1000 double RenderTheme::animationDurationForProgressBar(RenderProgress*) const
988 { 1001 {
989 return 0; 1002 return 0;
990 } 1003 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 1199
1187 return StringTruncator::centerTruncate(string, width, font, StringTruncator: :EnableRoundingHacks); 1200 return StringTruncator::centerTruncate(string, width, font, StringTruncator: :EnableRoundingHacks);
1188 } 1201 }
1189 1202
1190 bool RenderTheme::shouldOpenPickerWithF4Key() const 1203 bool RenderTheme::shouldOpenPickerWithF4Key() const
1191 { 1204 {
1192 return false; 1205 return false;
1193 } 1206 }
1194 1207
1195 } // namespace WebCore 1208 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698