Changeset 68465 in webkit
- Timestamp:
- Sep 27, 2010 6:22:57 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r68463 r68465 1 2010-09-27 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 queryCommandState with justifyCenter, justifyLeft, and justifyRight always return false 6 https://bugs.webkit.org/show_bug.cgi?id=45910 7 8 Added tests for queryCommandState with justifyCenter, justifyLeft, and justifyRight commands. 9 10 * editing/execCommand/query-text-alignment-expected.txt: Added. 11 * editing/execCommand/query-text-alignment.html: Added. 12 * editing/execCommand/script-tests/query-text-alignment.js: Added. 13 (queryTextAlignment): 14 (selectFirstPosition): 15 (selectMiddleOfHelloWorld): 16 (runRangeTests): 17 1 18 2010-09-27 James Robinson <jamesr@chromium.org> 2 19 -
trunk/WebCore/ChangeLog
r68464 r68465 1 2010-09-27 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 queryCommandState with justifyCenter, justifyLeft, and justifyRight always return false 6 https://bugs.webkit.org/show_bug.cgi?id=45910 7 8 Implemented queryCommandState for justifyCenter, justifyLeft, and justifyRight commands. 9 Added getTextAlignment to convert -webkit-center, -webkit-left, and -webkit-right to 10 center, left, and right respectively because they can be treated equally for editing purposes. 11 12 Test: editing/execCommand/query-text-alignment.html 13 14 * editing/ApplyStyleCommand.cpp: 15 (WebCore::getTextAlignment): Added. 16 (WebCore::getPropertiesNotIn): Uses getTextAlignment. 17 * editing/EditorCommand.cpp: 18 (WebCore::stateJustifyCenter): Added. 19 (WebCore::stateJustifyLeft): Added. 20 (WebCore::stateJustifyRight): Added. 21 (WebCore::createCommandMap): Refers to stateJustifyCenter, stateJustifyLeft, and stateJustifyRight. 22 1 23 2010-09-27 Alpha Lam <hclam@chromium.org> 2 24 -
trunk/WebCore/editing/ApplyStyleCommand.cpp
r68072 r68465 389 389 } 390 390 391 static int getTextAlignment(CSSStyleDeclaration* style) 392 { 393 int textAlign = getIdentifierValue(style, CSSPropertyTextAlign); 394 switch (textAlign) { 395 case CSSValueCenter: 396 case CSSValueWebkitCenter: 397 return CSSValueCenter; 398 case CSSValueLeft: 399 case CSSValueWebkitLeft: 400 return CSSValueLeft; 401 case CSSValueRight: 402 case CSSValueWebkitRight: 403 return CSSValueRight; 404 } 405 return CSSValueInvalid; 406 } 407 391 408 RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle) 392 409 { … … 405 422 if (getRGBAFontColor(result.get()) == getRGBAFontColor(baseStyle)) 406 423 result->removeProperty(CSSPropertyColor); 424 425 if (getTextAlignment(result.get()) == getTextAlignment(baseStyle)) 426 result->removeProperty(CSSPropertyTextAlign); 407 427 408 428 return result; -
trunk/WebCore/editing/EditorCommand.cpp
r68423 r68465 1298 1298 { 1299 1299 return frame->editor()->selectionUnorderedListState(); 1300 } 1301 1302 static TriState stateJustifyCenter(Frame* frame, Event*) 1303 { 1304 return stateStyle(frame, CSSPropertyTextAlign, "center"); 1305 } 1306 1307 static TriState stateJustifyLeft(Frame* frame, Event*) 1308 { 1309 return stateStyle(frame, CSSPropertyTextAlign, "left"); 1310 } 1311 1312 static TriState stateJustifyRight(Frame* frame, Event*) 1313 { 1314 return stateStyle(frame, CSSPropertyTextAlign, "right"); 1300 1315 } 1301 1316 … … 1386 1401 { "InsertUnorderedList", { executeInsertUnorderedList, supported, enabledInRichlyEditableText, stateUnorderedList, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1387 1402 { "Italic", { executeToggleItalic, supported, enabledInRichlyEditableText, stateItalic, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1388 { "JustifyCenter", { executeJustifyCenter, supported, enabledInRichlyEditableText, state None, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1403 { "JustifyCenter", { executeJustifyCenter, supported, enabledInRichlyEditableText, stateJustifyCenter, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1389 1404 { "JustifyFull", { executeJustifyFull, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1390 { "JustifyLeft", { executeJustifyLeft, supported, enabledInRichlyEditableText, state None, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1405 { "JustifyLeft", { executeJustifyLeft, supported, enabledInRichlyEditableText, stateJustifyLeft, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1391 1406 { "JustifyNone", { executeJustifyLeft, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1392 { "JustifyRight", { executeJustifyRight, supported, enabledInRichlyEditableText, state None, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },1407 { "JustifyRight", { executeJustifyRight, supported, enabledInRichlyEditableText, stateJustifyRight, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1393 1408 { "MakeTextWritingDirectionLeftToRight", { executeMakeTextWritingDirectionLeftToRight, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionLeftToRight, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1394 1409 { "MakeTextWritingDirectionNatural", { executeMakeTextWritingDirectionNatural, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateTextWritingDirectionNatural, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
Note: See TracChangeset
for help on using the changeset viewer.