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

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: tkent's comments (Part 2) 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"
29 #include "core/dom/shadow/ElementShadow.h"
28 #include "core/editing/FrameSelection.h" 30 #include "core/editing/FrameSelection.h"
29 #include "core/fileapi/FileList.h" 31 #include "core/fileapi/FileList.h"
32 #include "core/html/HTMLCollection.h"
33 #include "core/html/HTMLDataListElement.h"
30 #include "core/html/HTMLInputElement.h" 34 #include "core/html/HTMLInputElement.h"
31 #include "core/html/HTMLMeterElement.h" 35 #include "core/html/HTMLMeterElement.h"
36 #include "core/html/HTMLOptionElement.h"
37 #include "core/html/parser/HTMLParserIdioms.h"
32 #include "core/html/shadow/MediaControlElements.h" 38 #include "core/html/shadow/MediaControlElements.h"
33 #include "core/html/shadow/SpinButtonElement.h" 39 #include "core/html/shadow/SpinButtonElement.h"
34 #include "core/html/shadow/TextControlInnerElements.h" 40 #include "core/html/shadow/TextControlInnerElements.h"
35 #include "core/page/FocusController.h" 41 #include "core/page/FocusController.h"
36 #include "core/page/Frame.h" 42 #include "core/page/Frame.h"
37 #include "core/page/Page.h" 43 #include "core/page/Page.h"
38 #include "core/page/Settings.h" 44 #include "core/page/Settings.h"
39 #include "core/platform/FileSystem.h" 45 #include "core/platform/FileSystem.h"
40 #include "core/platform/FloatConversion.h" 46 #include "core/platform/FloatConversion.h"
41 #include "core/platform/LocalizedStrings.h" 47 #include "core/platform/LocalizedStrings.h"
42 #include "core/platform/graphics/FontSelector.h" 48 #include "core/platform/graphics/FontSelector.h"
43 #include "core/platform/graphics/GraphicsContextStateSaver.h" 49 #include "core/platform/graphics/GraphicsContextStateSaver.h"
44 #include "core/platform/graphics/StringTruncator.h" 50 #include "core/platform/graphics/StringTruncator.h"
45 #include "core/rendering/PaintInfo.h" 51 #include "core/rendering/PaintInfo.h"
46 #include "core/rendering/RenderMeter.h" 52 #include "core/rendering/RenderMeter.h"
47 #include "core/rendering/RenderView.h" 53 #include "core/rendering/RenderView.h"
48 #include "core/rendering/style/RenderStyle.h" 54 #include "core/rendering/style/RenderStyle.h"
49 55
50 #if ENABLE(INPUT_SPEECH) 56 #if ENABLE(INPUT_SPEECH)
51 #include "core/rendering/RenderInputSpeech.h" 57 #include "core/rendering/RenderInputSpeech.h"
52 #endif 58 #endif
53 59
54 #if ENABLE(DATALIST_ELEMENT)
55 #include "core/dom/shadow/ElementShadow.h"
56 #include "core/html/HTMLCollection.h"
57 #include "core/html/HTMLDataListElement.h"
58 #include "core/html/HTMLOptionElement.h"
59 #include "core/html/parser/HTMLParserIdioms.h"
60 #endif
61
62 // The methods in this file are shared by all themes on every platform. 60 // The methods in this file are shared by all themes on every platform.
63 61
64 namespace WebCore { 62 namespace WebCore {
65 63
66 using namespace HTMLNames; 64 using namespace HTMLNames;
67 65
68 static Color& customFocusRingColor() 66 static Color& customFocusRingColor()
69 { 67 {
70 DEFINE_STATIC_LOCAL(Color, color, ()); 68 DEFINE_STATIC_LOCAL(Color, color, ());
71 return color; 69 return color;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 #if ENABLE(INPUT_SPEECH) 446 #if ENABLE(INPUT_SPEECH)
449 case InputSpeechButtonPart: 447 case InputSpeechButtonPart:
450 #endif 448 #endif
451 default: 449 default:
452 break; 450 break;
453 } 451 }
454 452
455 return false; 453 return false;
456 } 454 }
457 455
456 String RenderTheme::extraDefaultStyleSheet()
457 {
458 static String dataListElementCSS = (RuntimeEnabledFeatures::dataListElementE nabled()) ? ASCIILiteral("datalist {display: none ;}") : ASCIILiteral("");
459
460 #if ENABLE(INPUT_TYPE_COLOR)
461 StringBuilder inputTypeCSS;
tkent 2013/05/22 00:40:38 This code block should be enabled only if the runt
462 inputTypeCSS.appendLiteral("input[type=\"color\"][list] { -webkit-appearance : menulist; width: 88px; height: 23px;}");
463 inputTypeCSS.appendLiteral("input[type=\"color\"][list]::-webkit-color-swatc h-wrapper { padding-left: 8px; padding-right: 24px;}");
464 inputTypeCSS.appendLiteral("input[type=\"color\"][list]::-webkit-color-swatc h { border-color: #000000;}");
465 inputTypeCSS.append(dataListElementCSS);
466 return inputTypeCSS.toString();
467 #endif
468
469 return dataListElementCSS;
470 }
471
458 String RenderTheme::formatMediaControlsTime(float time) const 472 String RenderTheme::formatMediaControlsTime(float time) const
459 { 473 {
460 if (!std::isfinite(time)) 474 if (!std::isfinite(time))
461 time = 0; 475 time = 0;
462 int seconds = (int)fabsf(time); 476 int seconds = (int)fabsf(time);
463 int hours = seconds / (60 * 60); 477 int hours = seconds / (60 * 60);
464 int minutes = (seconds / 60) % 60; 478 int minutes = (seconds / 60) % 60;
465 seconds %= 60; 479 seconds %= 60;
466 if (hours) { 480 if (hours) {
467 if (hours > 9) 481 if (hours > 9)
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 bool RenderTheme::supportsMeter(ControlPart) const 897 bool RenderTheme::supportsMeter(ControlPart) const
884 { 898 {
885 return false; 899 return false;
886 } 900 }
887 901
888 bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&) 902 bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&)
889 { 903 {
890 return true; 904 return true;
891 } 905 }
892 906
893 #if ENABLE(DATALIST_ELEMENT)
894 LayoutUnit RenderTheme::sliderTickSnappingThreshold() const 907 LayoutUnit RenderTheme::sliderTickSnappingThreshold() const
895 { 908 {
896 return 0; 909 return 0;
897 } 910 }
898 911
899 void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect) 912 void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect)
900 { 913 {
901 Node* node = o->node(); 914 Node* node = o->node();
902 if (!node) 915 if (!node)
903 return; 916 return;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 double tickFraction = (parsedValue - min) / (max - min); 983 double tickFraction = (parsedValue - min) / (max - min);
971 double tickRatio = isHorizontal && o->style()->isLeftToRightDirection() ? tickFraction : 1.0 - tickFraction; 984 double tickRatio = isHorizontal && o->style()->isLeftToRightDirection() ? tickFraction : 1.0 - tickFraction;
972 double tickPosition = round(tickRegionSideMargin + tickRegionWidth * tic kRatio); 985 double tickPosition = round(tickRegionSideMargin + tickRegionWidth * tic kRatio);
973 if (isHorizontal) 986 if (isHorizontal)
974 tickRect.setX(tickPosition); 987 tickRect.setX(tickPosition);
975 else 988 else
976 tickRect.setY(tickPosition); 989 tickRect.setY(tickPosition);
977 paintInfo.context->fillRect(tickRect); 990 paintInfo.context->fillRect(tickRect);
978 } 991 }
979 } 992 }
980 #endif
981 993
982 double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const 994 double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const
983 { 995 {
984 return 0; 996 return 0;
985 } 997 }
986 998
987 double RenderTheme::animationDurationForProgressBar(RenderProgress*) const 999 double RenderTheme::animationDurationForProgressBar(RenderProgress*) const
988 { 1000 {
989 return 0; 1001 return 0;
990 } 1002 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 1198
1187 return StringTruncator::centerTruncate(string, width, font, StringTruncator: :EnableRoundingHacks); 1199 return StringTruncator::centerTruncate(string, width, font, StringTruncator: :EnableRoundingHacks);
1188 } 1200 }
1189 1201
1190 bool RenderTheme::shouldOpenPickerWithF4Key() const 1202 bool RenderTheme::shouldOpenPickerWithF4Key() const
1191 { 1203 {
1192 return false; 1204 return false;
1193 } 1205 }
1194 1206
1195 } // namespace WebCore 1207 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698