Title: [111772] trunk/Source/WebKit/blackberry
- Revision
- 111772
- Author
- mifen...@rim.com
- Date
- 2012-03-22 15:12:23 -0700 (Thu, 22 Mar 2012)
Log Message
[BlackBerry] Add pattern matching for hexadecimal type input fields
https://bugs.webkit.org/show_bug.cgi?id=81944
Reviewed by Rob Buis.
PR 98504.
Add mapping of patterns matching hexadecimal input
to a specialized type and provide input styling based
on that format.
Reviewed Internally by Gen Mak.
* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::elementPatternIndicatesHexadecimal):
(DOMSupport):
* WebKitSupport/DOMSupport.h:
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::convertInputType):
(BlackBerry::WebKit::inputStyle):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/ChangeLog (111771 => 111772)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-03-22 22:05:04 UTC (rev 111771)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-03-22 22:12:23 UTC (rev 111772)
@@ -1,5 +1,28 @@
2012-03-22 Mike Fenton <mifen...@rim.com>
+ [BlackBerry] Add pattern matching for hexadecimal type input fields
+ https://bugs.webkit.org/show_bug.cgi?id=81944
+
+ Reviewed by Rob Buis.
+
+ PR 98504.
+
+ Add mapping of patterns matching hexadecimal input
+ to a specialized type and provide input styling based
+ on that format.
+
+ Reviewed Internally by Gen Mak.
+
+ * WebKitSupport/DOMSupport.cpp:
+ (BlackBerry::WebKit::DOMSupport::elementPatternIndicatesHexadecimal):
+ (DOMSupport):
+ * WebKitSupport/DOMSupport.h:
+ * WebKitSupport/InputHandler.cpp:
+ (BlackBerry::WebKit::convertInputType):
+ (BlackBerry::WebKit::inputStyle):
+
+2012-03-22 Mike Fenton <mifen...@rim.com>
+
[BlackBerry] DOMSupport isPositionInNode should have early returns for null nodes
https://bugs.webkit.org/show_bug.cgi?id=81929
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp (111771 => 111772)
--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp 2012-03-22 22:05:04 UTC (rev 111771)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp 2012-03-22 22:12:23 UTC (rev 111772)
@@ -385,6 +385,34 @@
return false;
}
+bool elementPatternIndicatesHexadecimal(const HTMLInputElement* inputElement)
+{
+ if (!inputElement)
+ return false;
+
+ if (inputElement->fastHasAttribute(HTMLNames::patternAttr)) {
+ AtomicString patternAttribute = inputElement->fastGetAttribute(HTMLNames::patternAttr);
+ if (patternAttribute.startsWith("[0-9a-fA-F]")) {
+ // The pattern is for hexadecimal, make sure nothing else is permitted.
+
+ // Check if it was an exact match.
+ if (patternAttribute.length() == 11)
+ return true;
+
+ // Is the regex specifying a character count?
+ if (patternAttribute[11] != '{' || !patternAttribute.endsWith("}"))
+ return false;
+
+ int count = 0;
+ // Make sure the number in the regex is actually a number.
+ if ((sscanf(patternAttribute.string().latin1().data(), "[0-9a-fA-F]{%d}\0", &count) == 1) && count > 0)
+ return true;
+ }
+ }
+
+ return false;
+}
+
IntPoint convertPointToFrame(const Frame* sourceFrame, const Frame* targetFrame, const IntPoint& point, const bool clampToTargetFrame)
{
ASSERT(sourceFrame && targetFrame);
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h (111771 => 111772)
--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h 2012-03-22 22:05:04 UTC (rev 111771)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h 2012-03-22 22:12:23 UTC (rev 111772)
@@ -77,6 +77,7 @@
bool elementIdOrNameIndicatesNoAutocomplete(const WebCore::Element*);
bool elementIdOrNameIndicatesEmail(const WebCore::HTMLInputElement*);
bool elementIdOrNameIndicatesUrl(const WebCore::HTMLInputElement*);
+bool elementPatternIndicatesHexadecimal(const WebCore::HTMLInputElement*);
WebCore::IntPoint convertPointToFrame(const WebCore::Frame* sourceFrame, const WebCore::Frame* targetFrame, const WebCore::IntPoint& sourcePoint, const bool clampToTargetFrame = false);
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (111771 => 111772)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-03-22 22:05:04 UTC (rev 111771)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-03-22 22:12:23 UTC (rev 111772)
@@ -158,6 +158,8 @@
return InputTypeEmail;
if (DOMSupport::elementIdOrNameIndicatesUrl(inputElement))
return InputTypeURL;
+ if (DOMSupport::elementPatternIndicatesHexadecimal(inputElement))
+ return InputTypeHexadecimal;
return InputTypeText;
}
@@ -196,6 +198,7 @@
case InputTypePassword:
case InputTypeNumber:
case InputTypeTelephone:
+ case InputTypeHexadecimal:
// Disable special handling.
return NO_AUTO_TEXT | NO_PREDICTION | NO_AUTO_CORRECTION;
default:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes