rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
public void testDeletionSync() throws IOException, InterruptedException { // file "host" and "client" folder1.setSyncProfile(SyncProfile.MANUAL_DOWNLOAD); folder2.setSyncProfile(SyncProfile.SYNCHRONIZE_PCS); File file1 = createTestFile(folder1, "/TestFile.txt", "This are the contents of the testfile".getBytes()); File file2 = createTestFile(folder1, "/TestFile2.txt", "This are the contents of the 2nd testfile".getBytes()); File file3 = createTestFile(folder1, "/sub/sub/TestFile3.txt", "This are the contents of the 3nd testfile".getBytes()); // Let him scan the new content folder1.forceNextScan(); folder1.scan(); assertEquals(3, folder1.getFilesCount()); // Give them time to copy Thread.sleep(3000); // Test ;) assertEquals(3, folder2.getFilesCount()); // No active downloads? assertEquals(0, getContoller2().getTransferManager() .getActiveDownloadCount()); assertEquals(getContoller1().getRecycleBin().getSize(), 0); assertEquals(getContoller2().getRecycleBin().getSize(), 0); file1.delete(); file2.delete(); file3.delete(); assertFalse(file1.exists()); assertFalse(file2.exists()); assertFalse(file3.exists()); // Let him scan the new content folder1.forceNextScan(); folder1.scan(); //all 3 must be deleted FileInfo[] localFiles = folder1.getFiles(); for (FileInfo fileInfo : localFiles) { assertTrue(fileInfo.isDeleted()); } // Give them time to copy Thread.sleep(3000); // all 3 must be deleted remote FileInfo[] remoteFiles = folder2.getFiles(); for (FileInfo fileInfo : remoteFiles) { assertTrue(fileInfo.isDeleted()); File file = folder2.getDiskFile(fileInfo); assertFalse(file.exists()); } assertEquals(getContoller2().getRecycleBin().getSize(), 3); } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/277ea8b19ea90026784553f8d75a4b9eae65c2c0/DeletionSyncTest.java/buggy/src/test/de/dal33t/powerfolder/test/DeletionSyncTest.java |
||
folder1.setSyncProfile(SyncProfile.SYNCHRONIZE_PCS); folder2.setSyncProfile(SyncProfile.MANUAL_DOWNLOAD); RecycleBin recycleBin = getContoller2().getRecycleBin(); List<FileInfo> deletedFiles = getContoller2().getRecycleBin() .getAllRecycledFiles(); for (FileInfo deletedFileInfo : deletedFiles) { recycleBin.restoreFromRecycleBin(deletedFileInfo); } for (FileInfo fileInfo : folder2.getFiles()) { assertEquals(0, fileInfo.getVersion()); } Thread.sleep(3000); assertEquals(folder1.getFilesCount(), 3); for (FileInfo fileInfo : folder1.getFiles()) { assertEquals(0, fileInfo.getVersion()); } | public void testDeletionSync() throws IOException, InterruptedException { // file "host" and "client" folder1.setSyncProfile(SyncProfile.MANUAL_DOWNLOAD); folder2.setSyncProfile(SyncProfile.SYNCHRONIZE_PCS); File file1 = createTestFile(folder1, "/TestFile.txt", "This are the contents of the testfile".getBytes()); File file2 = createTestFile(folder1, "/TestFile2.txt", "This are the contents of the 2nd testfile".getBytes()); File file3 = createTestFile(folder1, "/sub/sub/TestFile3.txt", "This are the contents of the 3nd testfile".getBytes()); // Let him scan the new content folder1.forceNextScan(); folder1.scan(); assertEquals(3, folder1.getFilesCount()); // Give them time to copy Thread.sleep(3000); // Test ;) assertEquals(3, folder2.getFilesCount()); // No active downloads? assertEquals(0, getContoller2().getTransferManager() .getActiveDownloadCount()); assertEquals(getContoller1().getRecycleBin().getSize(), 0); assertEquals(getContoller2().getRecycleBin().getSize(), 0); file1.delete(); file2.delete(); file3.delete(); assertFalse(file1.exists()); assertFalse(file2.exists()); assertFalse(file3.exists()); // Let him scan the new content folder1.forceNextScan(); folder1.scan(); //all 3 must be deleted FileInfo[] localFiles = folder1.getFiles(); for (FileInfo fileInfo : localFiles) { assertTrue(fileInfo.isDeleted()); } // Give them time to copy Thread.sleep(3000); // all 3 must be deleted remote FileInfo[] remoteFiles = folder2.getFiles(); for (FileInfo fileInfo : remoteFiles) { assertTrue(fileInfo.isDeleted()); File file = folder2.getDiskFile(fileInfo); assertFalse(file.exists()); } assertEquals(getContoller2().getRecycleBin().getSize(), 3); } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/277ea8b19ea90026784553f8d75a4b9eae65c2c0/DeletionSyncTest.java/buggy/src/test/de/dal33t/powerfolder/test/DeletionSyncTest.java |
|
return RubyFixnum.newFixnum(getRuntime(), method.getArity().getValue()); | return getRuntime().newFixnum(method.getArity().getValue()); | public RubyFixnum arity() { return RubyFixnum.newFixnum(getRuntime(), method.getArity().getValue()); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/RubyMethod.java/buggy/src/org/jruby/RubyMethod.java |
throw new ArgumentError(getRuntime(), ""); | throw getRuntime().newArgumentError(""); | public IRubyObject call(IRubyObject[] args) { if (args == null) { args = IRubyObject.NULL_ARRAY; } if (args.length != method.getArity().getValue()) { throw new ArgumentError(getRuntime(), ""); } getRuntime().getIterStack().push(getRuntime().isBlockGiven() ? Iter.ITER_PRE : Iter.ITER_NOT); try { return implementationModule.call0(receiver, methodName, args, method, false); } finally { getRuntime().getIterStack().pop(); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/RubyMethod.java/buggy/src/org/jruby/RubyMethod.java |
return runtime.iterate( | return getRuntime().iterate( | public IRubyObject to_proc() { return runtime.iterate( callbackFactory().getSingletonMethod(RubyMethod.class, "mproc"), runtime.getNil(), callbackFactory().getBlockMethod(RubyMethod.class, "bmcall"), this); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/RubyMethod.java/buggy/src/org/jruby/RubyMethod.java |
runtime.getNil(), | getRuntime().getNil(), | public IRubyObject to_proc() { return runtime.iterate( callbackFactory().getSingletonMethod(RubyMethod.class, "mproc"), runtime.getNil(), callbackFactory().getBlockMethod(RubyMethod.class, "bmcall"), this); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/RubyMethod.java/buggy/src/org/jruby/RubyMethod.java |
double x = pf.getImageableX(); double y = pf.getImageableY(); double w = pf.getImageableWidth(); double h = pf.getImageableHeight(); g2.translate(x, y); | public int print(Graphics g, PageFormat pf, int page) { try { Graphics2D g2 = (Graphics2D) g; double x = pf.getImageableX(); double y = pf.getImageableY(); double w = pf.getImageableWidth(); double h = pf.getImageableHeight(); g2.translate(x, y); //Uu.p("printing: page = " + page + " clip = " + g.getClipRect()); //quit if this page would put us over the length of the document if (h * page > height) { //Uu.p("quitting: " + h*page); //Uu.p("height = " + height); return Printable.NO_SUCH_PAGE; } int trans = (int) (-h * page); //Uu.p("translating by " + trans); g2.translate(0, trans); // lay out the document if it's not already if (g2r == null) { //Uu.p("building new Graphics2DRenderer"); g2r = new Graphics2DRenderer(); g2r.getSharedContext().setPrint(true); g2r.getSharedContext().setInteractive(false); g2r.getSharedContext().setDPI(72f); g2r.getSharedContext().getTextRenderer().setSmoothingThreshold(0); g2r.getSharedContext().getTextRenderer().setSmoothingLevel(TextRenderer.HIGH); g2r.setDocument(panel.getSharedContext().getUac().getBaseURL()); Dimension dim = new Dimension((int) w, (int) h); g2r.layout(g2, dim); Rectangle rect = g2r.getMinimumSize(); //Uu.p("laid out height = " + rect.getHeight()); height = (int) rect.getHeight(); } // render the document g2r.render(g2); return Printable.PAGE_EXISTS; } catch (Exception ex) { Uu.p(ex); return Printable.NO_SUCH_PAGE; } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/374d17ea4f8f5f5914c5c65d8a4c5a5ce9f4749d/XHTMLPrintable.java/clean/src/java/org/xhtmlrenderer/simple/XHTMLPrintable.java |
|
if (h * page > height) { return Printable.NO_SUCH_PAGE; } int trans = (int) (-h * page); g2.translate(0, trans); | public int print(Graphics g, PageFormat pf, int page) { try { Graphics2D g2 = (Graphics2D) g; double x = pf.getImageableX(); double y = pf.getImageableY(); double w = pf.getImageableWidth(); double h = pf.getImageableHeight(); g2.translate(x, y); //Uu.p("printing: page = " + page + " clip = " + g.getClipRect()); //quit if this page would put us over the length of the document if (h * page > height) { //Uu.p("quitting: " + h*page); //Uu.p("height = " + height); return Printable.NO_SUCH_PAGE; } int trans = (int) (-h * page); //Uu.p("translating by " + trans); g2.translate(0, trans); // lay out the document if it's not already if (g2r == null) { //Uu.p("building new Graphics2DRenderer"); g2r = new Graphics2DRenderer(); g2r.getSharedContext().setPrint(true); g2r.getSharedContext().setInteractive(false); g2r.getSharedContext().setDPI(72f); g2r.getSharedContext().getTextRenderer().setSmoothingThreshold(0); g2r.getSharedContext().getTextRenderer().setSmoothingLevel(TextRenderer.HIGH); g2r.setDocument(panel.getSharedContext().getUac().getBaseURL()); Dimension dim = new Dimension((int) w, (int) h); g2r.layout(g2, dim); Rectangle rect = g2r.getMinimumSize(); //Uu.p("laid out height = " + rect.getHeight()); height = (int) rect.getHeight(); } // render the document g2r.render(g2); return Printable.PAGE_EXISTS; } catch (Exception ex) { Uu.p(ex); return Printable.NO_SUCH_PAGE; } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/374d17ea4f8f5f5914c5c65d8a4c5a5ce9f4749d/XHTMLPrintable.java/clean/src/java/org/xhtmlrenderer/simple/XHTMLPrintable.java |
|
public int print(Graphics g, PageFormat pf, int page) { try { Graphics2D g2 = (Graphics2D) g; double x = pf.getImageableX(); double y = pf.getImageableY(); double w = pf.getImageableWidth(); double h = pf.getImageableHeight(); g2.translate(x, y); //Uu.p("printing: page = " + page + " clip = " + g.getClipRect()); //quit if this page would put us over the length of the document if (h * page > height) { //Uu.p("quitting: " + h*page); //Uu.p("height = " + height); return Printable.NO_SUCH_PAGE; } int trans = (int) (-h * page); //Uu.p("translating by " + trans); g2.translate(0, trans); // lay out the document if it's not already if (g2r == null) { //Uu.p("building new Graphics2DRenderer"); g2r = new Graphics2DRenderer(); g2r.getSharedContext().setPrint(true); g2r.getSharedContext().setInteractive(false); g2r.getSharedContext().setDPI(72f); g2r.getSharedContext().getTextRenderer().setSmoothingThreshold(0); g2r.getSharedContext().getTextRenderer().setSmoothingLevel(TextRenderer.HIGH); g2r.setDocument(panel.getSharedContext().getUac().getBaseURL()); Dimension dim = new Dimension((int) w, (int) h); g2r.layout(g2, dim); Rectangle rect = g2r.getMinimumSize(); //Uu.p("laid out height = " + rect.getHeight()); height = (int) rect.getHeight(); } // render the document g2r.render(g2); return Printable.PAGE_EXISTS; } catch (Exception ex) { Uu.p(ex); return Printable.NO_SUCH_PAGE; } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/374d17ea4f8f5f5914c5c65d8a4c5a5ce9f4749d/XHTMLPrintable.java/clean/src/java/org/xhtmlrenderer/simple/XHTMLPrintable.java |
||
Dimension dim = new Dimension((int) w, (int) h); g2r.layout(g2, dim); Rectangle rect = g2r.getMinimumSize(); height = (int) rect.getHeight(); | g2r.layout(g2, null); g2r.getPanel().assignPagePaintingPositions(g2, 0); } if (page >= g2r.getPanel().getRootLayer().getPages().size()) { return Printable.NO_SUCH_PAGE; | public int print(Graphics g, PageFormat pf, int page) { try { Graphics2D g2 = (Graphics2D) g; double x = pf.getImageableX(); double y = pf.getImageableY(); double w = pf.getImageableWidth(); double h = pf.getImageableHeight(); g2.translate(x, y); //Uu.p("printing: page = " + page + " clip = " + g.getClipRect()); //quit if this page would put us over the length of the document if (h * page > height) { //Uu.p("quitting: " + h*page); //Uu.p("height = " + height); return Printable.NO_SUCH_PAGE; } int trans = (int) (-h * page); //Uu.p("translating by " + trans); g2.translate(0, trans); // lay out the document if it's not already if (g2r == null) { //Uu.p("building new Graphics2DRenderer"); g2r = new Graphics2DRenderer(); g2r.getSharedContext().setPrint(true); g2r.getSharedContext().setInteractive(false); g2r.getSharedContext().setDPI(72f); g2r.getSharedContext().getTextRenderer().setSmoothingThreshold(0); g2r.getSharedContext().getTextRenderer().setSmoothingLevel(TextRenderer.HIGH); g2r.setDocument(panel.getSharedContext().getUac().getBaseURL()); Dimension dim = new Dimension((int) w, (int) h); g2r.layout(g2, dim); Rectangle rect = g2r.getMinimumSize(); //Uu.p("laid out height = " + rect.getHeight()); height = (int) rect.getHeight(); } // render the document g2r.render(g2); return Printable.PAGE_EXISTS; } catch (Exception ex) { Uu.p(ex); return Printable.NO_SUCH_PAGE; } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/374d17ea4f8f5f5914c5c65d8a4c5a5ce9f4749d/XHTMLPrintable.java/clean/src/java/org/xhtmlrenderer/simple/XHTMLPrintable.java |
g2r.render(g2); | g2r.getPanel().paintPage(g2, page); | public int print(Graphics g, PageFormat pf, int page) { try { Graphics2D g2 = (Graphics2D) g; double x = pf.getImageableX(); double y = pf.getImageableY(); double w = pf.getImageableWidth(); double h = pf.getImageableHeight(); g2.translate(x, y); //Uu.p("printing: page = " + page + " clip = " + g.getClipRect()); //quit if this page would put us over the length of the document if (h * page > height) { //Uu.p("quitting: " + h*page); //Uu.p("height = " + height); return Printable.NO_SUCH_PAGE; } int trans = (int) (-h * page); //Uu.p("translating by " + trans); g2.translate(0, trans); // lay out the document if it's not already if (g2r == null) { //Uu.p("building new Graphics2DRenderer"); g2r = new Graphics2DRenderer(); g2r.getSharedContext().setPrint(true); g2r.getSharedContext().setInteractive(false); g2r.getSharedContext().setDPI(72f); g2r.getSharedContext().getTextRenderer().setSmoothingThreshold(0); g2r.getSharedContext().getTextRenderer().setSmoothingLevel(TextRenderer.HIGH); g2r.setDocument(panel.getSharedContext().getUac().getBaseURL()); Dimension dim = new Dimension((int) w, (int) h); g2r.layout(g2, dim); Rectangle rect = g2r.getMinimumSize(); //Uu.p("laid out height = " + rect.getHeight()); height = (int) rect.getHeight(); } // render the document g2r.render(g2); return Printable.PAGE_EXISTS; } catch (Exception ex) { Uu.p(ex); return Printable.NO_SUCH_PAGE; } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/374d17ea4f8f5f5914c5c65d8a4c5a5ce9f4749d/XHTMLPrintable.java/clean/src/java/org/xhtmlrenderer/simple/XHTMLPrintable.java |
AnonymousBlockBox block = new AnonymousBlockBox(text, c); | AnonymousBlockBox block = new AnonymousBlockBox(content); | public Box createBox(Context c, Content content) { AnonymousBlockBox block = new AnonymousBlockBox(text, c); return block; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/AnonymousBoxLayout.java/buggy/src/java/org/xhtmlrenderer/layout/AnonymousBoxLayout.java |
System.out.println("Drawing image"); | private void addControlListeners() { control.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { dispose(); } }); control.addFocusListener(new FocusListener() { public void focusGained(FocusEvent event) { hasFocus = true; if (showOnlyOnFocus) { update(); } } public void focusLost(FocusEvent event) { hasFocus = false; if (showOnlyOnFocus) { update(); } } }); // Listener for painting the decoration paintListener = new PaintListener() { public void paintControl(PaintEvent event) { Control control = (Control) event.widget; Rectangle rect = getDecorationRectangle(control); if (shouldShowDecoration()) { event.gc.drawImage(decoration.getImage(), rect.x, rect.y); System.out.println("Drawing image"); //$NON-NLS-1$ } } }; // Listener for tracking the end of a hover. Only installed // after a hover begins. mouseMoveListener = new MouseMoveListener() { public void mouseMove(MouseEvent event) { if (showHover) { if (!decorationRectangle.contains(event.x, event.y)) { hideHover(); ((Control) event.widget) .removeMouseMoveListener(mouseMoveListener); } } } }; // Listener for tracking the beginning of a hover. Always installed. mouseListener = new MouseTrackListener() { public void mouseExit(MouseEvent event) { // Just in case we didn't catch it before. ((Control) event.widget) .removeMouseMoveListener(mouseMoveListener); hideHover(); } public void mouseHover(MouseEvent event) { if (showHover) { decorationRectangle = getDecorationRectangle((Control) event.widget); if (decorationRectangle.contains(event.x, event.y)) { showHoverText(decoration.getDescription()); ((Control) event.widget) .addMouseMoveListener(mouseMoveListener); } } } public void mouseEnter(MouseEvent event) { // Nothing to do until a hover occurs. } }; // We are never quite sure which parent in the control hierarchy // is providing the margin space, so hook all the way up. Control c = control.getParent(); while (c != null) { c.addPaintListener(paintListener); c.addMouseTrackListener(mouseListener); c.redraw(); if (c instanceof Shell) break; c = c.getParent(); } } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/a35b4342bcb72b08139991a25639f7288451a819/ControlDecoration.java/buggy/bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ControlDecoration.java |
|
System.out.println("Drawing image"); | public void paintControl(PaintEvent event) { Control control = (Control) event.widget; Rectangle rect = getDecorationRectangle(control); if (shouldShowDecoration()) { event.gc.drawImage(decoration.getImage(), rect.x, rect.y); System.out.println("Drawing image"); //$NON-NLS-1$ } } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/a35b4342bcb72b08139991a25639f7288451a819/ControlDecoration.java/buggy/bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ControlDecoration.java |
|
public Object getContent(Context c) { | public List getContent(Context c) { | public Object getContent(Context c) { return ContentUtil.getInlineContentList(_elem, c); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/BlockContent.java/buggy/src/java/org/xhtmlrenderer/layout/content/BlockContent.java |
timeClass.defineMethod("strftime", CallbackFactory.getMethod(RubyTime.class, "strftime", RubyObject.class)); timeClass.defineMethod("tv_usec", CallbackFactory.getMethod(RubyTime.class, "usec")); timeClass.defineMethod("usec", CallbackFactory.getMethod(RubyTime.class, "usec")); timeClass.defineMethod("tv_sec", CallbackFactory.getMethod(RubyTime.class, "to_i")); timeClass.defineMethod("to_i", CallbackFactory.getMethod(RubyTime.class, "to_i")); timeClass.defineMethod("zone", CallbackFactory.getMethod(RubyTime.class, "zone")); | public static RubyClass createTimeClass(Ruby ruby) { RubyClass timeClass = ruby.defineClass("Time", ruby.getClasses().getObjectClass()); Callback s_new = CallbackFactory.getSingletonMethod(RubyTime.class, "s_new"); timeClass.defineSingletonMethod("new", s_new); timeClass.defineSingletonMethod("now", s_new); timeClass.defineMethod("-", CallbackFactory.getMethod(RubyTime.class, "op_minus", RubyObject.class)); timeClass.defineMethod("to_s", CallbackFactory.getMethod(RubyTime.class, "to_s")); timeClass.defineMethod("inspect", CallbackFactory.getMethod(RubyTime.class, "to_s")); return timeClass; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/34c3fc5f55ea30c0bf3f66a309ac42090f75cca6/RubyTime.java/buggy/org/jruby/RubyTime.java |
|
Platform .getPlugin(PlatformUI.PLUGIN_ID) | IDEWorkbenchPlugin.getDefault() | private void performFileImport(File[] files, IContainer target, IProgressMonitor monitor) { IOverwriteQuery query = new IOverwriteQuery() { public String queryOverwrite(String pathString) { if (alwaysOverwrite) return ALL; final String returnCode[] = { CANCEL }; final String msg = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteQuestion, pathString); final String[] options = { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; parentShell.getDisplay().syncExec(new Runnable() { public void run() { MessageDialog dialog = new MessageDialog( parentShell, IDEWorkbenchMessages.CopyFilesAndFoldersOperation_question, null, msg, MessageDialog.QUESTION, options, 0); dialog.open(); int returnVal = dialog.getReturnCode(); String[] returnCodes = { YES, ALL, NO, CANCEL }; returnCode[0] = returnVal == -1 ? CANCEL : returnCodes[returnVal]; } }); if (returnCode[0] == ALL) { alwaysOverwrite = true; } else if (returnCode[0] == CANCEL) { canceled = true; } return returnCode[0]; } }; ImportOperation op = new ImportOperation(target.getFullPath(), null, FileSystemStructureProvider.INSTANCE, query, Arrays .asList(files)); op.setContext(parentShell); op.setCreateContainerStructure(false); try { op.run(monitor); } catch (InterruptedException e) { return; } catch (InvocationTargetException e) { if (e.getTargetException() instanceof CoreException) { final IStatus status = ((CoreException) e.getTargetException()) .getStatus(); parentShell.getDisplay().syncExec(new Runnable() { public void run() { ErrorDialog .openError( parentShell, IDEWorkbenchMessages.CopyFilesAndFoldersOperation_importErrorDialogTitle, null, // no special message status); } }); } else { // CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur. Platform .getPlugin(PlatformUI.PLUGIN_ID) .getLog() .log( StatusUtil .newStatus( IStatus.ERROR, MessageFormat .format( "Exception in {0}.performFileImport(): {1}", //$NON-NLS-1$ new Object[] { getClass() .getName(), e .getTargetException() }), null)); displayError(NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_internalError, e.getTargetException().getMessage())); } return; } // Special case since ImportOperation doesn't throw a CoreException on // failure. IStatus status = op.getStatus(); if (!status.isOK()) { if (errorStatus == null) errorStatus = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.ERROR, getProblemsMessage(), null); //$NON-NLS-1$ errorStatus.merge(status); } } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/b44617ebe568f7f4382cb371e3d1a291dd46bd17/CopyFilesAndFoldersOperation.java/clean/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java |
ActivityDefinition castedObject = (ActivityDefinition) object; boolean equals = true; equals &= Util.equals(id, castedObject.id); equals &= Util.equals(name, castedObject.name); equals &= Util.equals(sourceId, castedObject.sourceId); return equals; | final ActivityDefinition castedObject = (ActivityDefinition) object; if (!Util.equals(id, castedObject.id)) { return false; } if (!Util.equals(name, castedObject.name)) { return false; } return Util.equals(sourceId, castedObject.sourceId); | public boolean equals(Object object) { if (!(object instanceof ActivityDefinition)) return false; ActivityDefinition castedObject = (ActivityDefinition) object; boolean equals = true; equals &= Util.equals(id, castedObject.id); equals &= Util.equals(name, castedObject.name); equals &= Util.equals(sourceId, castedObject.sourceId); return equals; } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/93a9ee73087009b29275c4fd77412f1b5a0354e8/ActivityDefinition.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityDefinition.java |
new IRubyObject[] { result, RubyString.newString(runtime, bean.type.getName())}); | new IRubyObject[] { result, runtime.newString(bean.type.getName())}); | public IRubyObject getValue() { IRubyObject result = JavaUtil.convertJavaToRuby(runtime, bean.bean, bean.type); if (result instanceof JavaObject) { runtime.getLoadService().require("java"); result = runtime.getClasses().getObjectClass().getConstant("JavaUtilities").callMethod( "wrap", new IRubyObject[] { result, RubyString.newString(runtime, bean.type.getName())}); } return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JRubyEngine.java/buggy/src/org/jruby/javasupport/bsf/JRubyEngine.java |
new IRubyObject[] { result, RubyString.newString(runtime, BSFFunctions.class.getName())}); | new IRubyObject[] { result, runtime.newString(BSFFunctions.class.getName())}); | public IRubyObject getValue() { IRubyObject result = JavaUtil.convertJavaToRuby(runtime, functions, BSFFunctions.class); if (result instanceof JavaObject) { runtime.getLoadService().require("java"); result = runtime.getClasses().getObjectClass().getConstant("JavaUtilities").callMethod( "wrap", new IRubyObject[] { result, RubyString.newString(runtime, BSFFunctions.class.getName())}); } return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JRubyEngine.java/buggy/src/org/jruby/javasupport/bsf/JRubyEngine.java |
obj, RubyString.newString(runtime, obj.getClass().getName()) | obj, runtime.newString(obj.getClass().getName()) | public Object call(Object recv, String method, Object[] args) throws BSFException { try { IRubyObject rubyRecv = recv != null ? JavaUtil.convertJavaToRuby(runtime, recv) : runtime.getTopSelf(); IRubyObject[] rubyArgs = JavaUtil.convertJavaArrayToRuby(runtime, args); // Create Ruby proxies for any input arguments that are not primitives. IRubyObject javaUtilities = runtime.getClasses().getObjectClass().getConstant("JavaUtilities"); for (int i = 0; i < rubyArgs.length; i++) { IRubyObject obj = rubyArgs[i]; if (obj instanceof JavaObject) { rubyArgs[i] = javaUtilities.callMethod("wrap", new IRubyObject[] { obj, RubyString.newString(runtime, obj.getClass().getName()) }); } } IRubyObject result = rubyRecv.callMethod(method, rubyArgs); return convertToJava(result, Object.class); } catch (Exception excptn) { printException(runtime, excptn); throw new BSFException(BSFException.REASON_EXECUTION_ERROR, excptn.getMessage(), excptn); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JRubyEngine.java/buggy/src/org/jruby/javasupport/bsf/JRubyEngine.java |
new IRubyObject[] { result, RubyString.newString(runtime, value.getClass().getName())}); | new IRubyObject[] { result, runtime.newString(value.getClass().getName())}); | private IRubyObject convertToRuby(Object value) { IRubyObject result = JavaUtil.convertJavaToRuby(runtime, value); if (result instanceof JavaObject) { runtime.getLoadService().require("java"); result = runtime.getClasses().getObjectClass().getConstant("JavaUtilities").callMethod( "wrap", new IRubyObject[] { result, RubyString.newString(runtime, value.getClass().getName())}); } return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JRubyEngine.java/buggy/src/org/jruby/javasupport/bsf/JRubyEngine.java |
Callback clone = new ReflectionCallbackMethod(RubyObject.class, "rbClone"); Callback dup = new ReflectionCallbackMethod(RubyObject.class, "dup"); Callback equal = new ReflectionCallbackMethod(RubyObject.class, "equal", RubyObject.class); Callback respond_to = new ReflectionCallbackMethod(RubyObject.class, "respond_to", RubySymbol.class); Callback extend = new ReflectionCallbackMethod(RubyObject.class, "extend", RubyObject[].class, true); Callback freeze = new ReflectionCallbackMethod(RubyObject.class, "freeze"); Callback frozen = new ReflectionCallbackMethod(RubyObject.class, "frozen"); Callback id = new ReflectionCallbackMethod(RubyObject.class, "id"); Callback inspect = new ReflectionCallbackMethod(RubyObject.class, "inspect"); Callback instance_eval = new ReflectionCallbackMethod(RubyObject.class, "instance_eval", RubyObject[].class, true); Callback instance_of = new ReflectionCallbackMethod(RubyObject.class, "instance_of", RubyModule.class); Callback instance_variables = new ReflectionCallbackMethod(RubyObject.class, "instance_variables"); Callback kind_of = new ReflectionCallbackMethod(RubyObject.class, "kind_of", RubyModule.class); Callback method = new ReflectionCallbackMethod(RubyObject.class, "method", RubyObject.class); Callback methods = new ReflectionCallbackMethod(RubyObject.class, "methods"); Callback private_methods = new ReflectionCallbackMethod(RubyObject.class, "private_methods"); Callback protected_methods = new ReflectionCallbackMethod(RubyObject.class, "protected_methods"); Callback taint = new ReflectionCallbackMethod(RubyObject.class, "taint"); Callback tainted = new ReflectionCallbackMethod(RubyObject.class, "tainted"); Callback to_a = new ReflectionCallbackMethod(RubyObject.class, "to_a"); Callback to_s = new ReflectionCallbackMethod(RubyObject.class, "to_s"); Callback type = new ReflectionCallbackMethod(RubyObject.class, "type"); Callback untaint = new ReflectionCallbackMethod(RubyObject.class, "untaint"); | kernelModule.defineMethod("==", CallbackFactory.getMethod(RubyObject.class, "equal", RubyObject.class)); | public static void createObjectClass(RubyModule kernelModule) { // TODO: convert to CallbackFactory invokes. Callback clone = new ReflectionCallbackMethod(RubyObject.class, "rbClone"); Callback dup = new ReflectionCallbackMethod(RubyObject.class, "dup"); Callback equal = new ReflectionCallbackMethod(RubyObject.class, "equal", RubyObject.class); Callback respond_to = new ReflectionCallbackMethod(RubyObject.class, "respond_to", RubySymbol.class); Callback extend = new ReflectionCallbackMethod(RubyObject.class, "extend", RubyObject[].class, true); Callback freeze = new ReflectionCallbackMethod(RubyObject.class, "freeze"); Callback frozen = new ReflectionCallbackMethod(RubyObject.class, "frozen"); Callback id = new ReflectionCallbackMethod(RubyObject.class, "id"); Callback inspect = new ReflectionCallbackMethod(RubyObject.class, "inspect"); Callback instance_eval = new ReflectionCallbackMethod(RubyObject.class, "instance_eval", RubyObject[].class, true); Callback instance_of = new ReflectionCallbackMethod(RubyObject.class, "instance_of", RubyModule.class); Callback instance_variables = new ReflectionCallbackMethod(RubyObject.class, "instance_variables"); Callback kind_of = new ReflectionCallbackMethod(RubyObject.class, "kind_of", RubyModule.class); Callback method = new ReflectionCallbackMethod(RubyObject.class, "method", RubyObject.class); Callback methods = new ReflectionCallbackMethod(RubyObject.class, "methods"); Callback private_methods = new ReflectionCallbackMethod(RubyObject.class, "private_methods"); Callback protected_methods = new ReflectionCallbackMethod(RubyObject.class, "protected_methods"); Callback taint = new ReflectionCallbackMethod(RubyObject.class, "taint"); Callback tainted = new ReflectionCallbackMethod(RubyObject.class, "tainted"); Callback to_a = new ReflectionCallbackMethod(RubyObject.class, "to_a"); Callback to_s = new ReflectionCallbackMethod(RubyObject.class, "to_s"); Callback type = new ReflectionCallbackMethod(RubyObject.class, "type"); Callback untaint = new ReflectionCallbackMethod(RubyObject.class, "untaint"); kernelModule.defineMethod("=~", CallbackFactory.getFalseMethod()); kernelModule.defineMethod("==", equal); kernelModule.defineMethod("respond_to?", respond_to); kernelModule.defineMethod("class", type); kernelModule.defineMethod("clone", clone); kernelModule.defineMethod("dup", dup); kernelModule.defineMethod("eql?", equal); kernelModule.defineMethod("extend", extend); kernelModule.defineMethod("freeze", freeze); kernelModule.defineMethod("frozen?", frozen); kernelModule.defineMethod("hash", id); kernelModule.defineMethod("id", id); kernelModule.defineMethod("__id__", id); kernelModule.defineMethod("inspect", inspect); kernelModule.defineMethod("instance_eval", instance_eval); kernelModule.defineMethod("instance_of?", instance_of); kernelModule.defineMethod("instance_variables", instance_variables); kernelModule.defineMethod("is_a?", kind_of); kernelModule.defineMethod("kind_of?", kind_of); kernelModule.defineMethod("method", method); kernelModule.defineMethod("methods", methods); kernelModule.defineMethod("private_methods", private_methods); kernelModule.defineMethod("protected_methods", protected_methods); kernelModule.defineMethod("public_methods", methods); kernelModule.defineMethod("nil?", CallbackFactory.getFalseMethod()); kernelModule.defineMethod("send", CallbackFactory.getOptMethod(RubyObject.class, "send", RubyObject.class)); kernelModule.defineMethod("__send__", CallbackFactory.getOptMethod(RubyObject.class, "send", RubyObject.class)); kernelModule.defineMethod("taint", taint); kernelModule.defineMethod("tainted?", tainted); kernelModule.defineMethod("to_a", to_a); kernelModule.defineMethod("to_s", to_s); kernelModule.defineMethod("type", type); kernelModule.defineMethod("untaint", untaint); kernelModule.defineAlias("===", "=="); kernelModule.defineAlias("equal?", "=="); Ruby ruby = kernelModule.getRuby(); ruby.defineGlobalFunction("method_missing", CallbackFactory.getOptMethod(RubyObject.class, "method_missing", RubyObject.class)); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyObject.java/clean/org/jruby/RubyObject.java |
kernelModule.defineMethod("==", equal); kernelModule.defineMethod("respond_to?", respond_to); kernelModule.defineMethod("class", type); kernelModule.defineMethod("clone", clone); kernelModule.defineMethod("dup", dup); kernelModule.defineMethod("eql?", equal); kernelModule.defineMethod("extend", extend); kernelModule.defineMethod("freeze", freeze); kernelModule.defineMethod("frozen?", frozen); kernelModule.defineMethod("hash", id); kernelModule.defineMethod("id", id); kernelModule.defineMethod("__id__", id); kernelModule.defineMethod("inspect", inspect); kernelModule.defineMethod("instance_eval", instance_eval); kernelModule.defineMethod("instance_of?", instance_of); kernelModule.defineMethod("instance_variables", instance_variables); kernelModule.defineMethod("is_a?", kind_of); kernelModule.defineMethod("kind_of?", kind_of); kernelModule.defineMethod("method", method); kernelModule.defineMethod("methods", methods); kernelModule.defineMethod("private_methods", private_methods); kernelModule.defineMethod("protected_methods", protected_methods); kernelModule.defineMethod("public_methods", methods); | kernelModule.defineMethod("clone", CallbackFactory.getMethod(RubyObject.class, "rbClone")); kernelModule.defineMethod("dup", CallbackFactory.getMethod(RubyObject.class, "dup")); kernelModule.defineMethod("eql?", CallbackFactory.getMethod(RubyObject.class, "equal", RubyObject.class)); kernelModule.defineMethod("respond_to?", CallbackFactory.getMethod(RubyObject.class, "respond_to", RubyObject.class)); kernelModule.defineMethod("extend", CallbackFactory.getOptMethod(RubyObject.class, "extend")); kernelModule.defineMethod("freeze", CallbackFactory.getMethod(RubyObject.class, "freeze")); kernelModule.defineMethod("frozen?", CallbackFactory.getMethod(RubyObject.class, "frozen")); kernelModule.defineMethod("id", CallbackFactory.getMethod(RubyObject.class, "id")); kernelModule.defineMethod("hash", CallbackFactory.getMethod(RubyObject.class, "id")); kernelModule.defineMethod("__id__", CallbackFactory.getMethod(RubyObject.class, "id")); kernelModule.defineMethod("inspect", CallbackFactory.getMethod(RubyObject.class, "inspect")); kernelModule.defineMethod("instance_eval", CallbackFactory.getOptMethod(RubyObject.class, "instance_eval")); kernelModule.defineMethod("instance_of?", CallbackFactory.getMethod(RubyObject.class, "instance_of", RubyModule.class)); kernelModule.defineMethod("instance_variables", CallbackFactory.getMethod(RubyObject.class, "instance_variables")); kernelModule.defineMethod("is_a?", CallbackFactory.getMethod(RubyObject.class, "kind_of", RubyModule.class)); kernelModule.defineMethod("kind_of?", CallbackFactory.getMethod(RubyObject.class, "kind_of", RubyModule.class)); kernelModule.defineMethod("method", CallbackFactory.getMethod(RubyObject.class, "method", RubyObject.class)); kernelModule.defineMethod("methods", CallbackFactory.getMethod(RubyObject.class, "methods")); | public static void createObjectClass(RubyModule kernelModule) { // TODO: convert to CallbackFactory invokes. Callback clone = new ReflectionCallbackMethod(RubyObject.class, "rbClone"); Callback dup = new ReflectionCallbackMethod(RubyObject.class, "dup"); Callback equal = new ReflectionCallbackMethod(RubyObject.class, "equal", RubyObject.class); Callback respond_to = new ReflectionCallbackMethod(RubyObject.class, "respond_to", RubySymbol.class); Callback extend = new ReflectionCallbackMethod(RubyObject.class, "extend", RubyObject[].class, true); Callback freeze = new ReflectionCallbackMethod(RubyObject.class, "freeze"); Callback frozen = new ReflectionCallbackMethod(RubyObject.class, "frozen"); Callback id = new ReflectionCallbackMethod(RubyObject.class, "id"); Callback inspect = new ReflectionCallbackMethod(RubyObject.class, "inspect"); Callback instance_eval = new ReflectionCallbackMethod(RubyObject.class, "instance_eval", RubyObject[].class, true); Callback instance_of = new ReflectionCallbackMethod(RubyObject.class, "instance_of", RubyModule.class); Callback instance_variables = new ReflectionCallbackMethod(RubyObject.class, "instance_variables"); Callback kind_of = new ReflectionCallbackMethod(RubyObject.class, "kind_of", RubyModule.class); Callback method = new ReflectionCallbackMethod(RubyObject.class, "method", RubyObject.class); Callback methods = new ReflectionCallbackMethod(RubyObject.class, "methods"); Callback private_methods = new ReflectionCallbackMethod(RubyObject.class, "private_methods"); Callback protected_methods = new ReflectionCallbackMethod(RubyObject.class, "protected_methods"); Callback taint = new ReflectionCallbackMethod(RubyObject.class, "taint"); Callback tainted = new ReflectionCallbackMethod(RubyObject.class, "tainted"); Callback to_a = new ReflectionCallbackMethod(RubyObject.class, "to_a"); Callback to_s = new ReflectionCallbackMethod(RubyObject.class, "to_s"); Callback type = new ReflectionCallbackMethod(RubyObject.class, "type"); Callback untaint = new ReflectionCallbackMethod(RubyObject.class, "untaint"); kernelModule.defineMethod("=~", CallbackFactory.getFalseMethod()); kernelModule.defineMethod("==", equal); kernelModule.defineMethod("respond_to?", respond_to); kernelModule.defineMethod("class", type); kernelModule.defineMethod("clone", clone); kernelModule.defineMethod("dup", dup); kernelModule.defineMethod("eql?", equal); kernelModule.defineMethod("extend", extend); kernelModule.defineMethod("freeze", freeze); kernelModule.defineMethod("frozen?", frozen); kernelModule.defineMethod("hash", id); kernelModule.defineMethod("id", id); kernelModule.defineMethod("__id__", id); kernelModule.defineMethod("inspect", inspect); kernelModule.defineMethod("instance_eval", instance_eval); kernelModule.defineMethod("instance_of?", instance_of); kernelModule.defineMethod("instance_variables", instance_variables); kernelModule.defineMethod("is_a?", kind_of); kernelModule.defineMethod("kind_of?", kind_of); kernelModule.defineMethod("method", method); kernelModule.defineMethod("methods", methods); kernelModule.defineMethod("private_methods", private_methods); kernelModule.defineMethod("protected_methods", protected_methods); kernelModule.defineMethod("public_methods", methods); kernelModule.defineMethod("nil?", CallbackFactory.getFalseMethod()); kernelModule.defineMethod("send", CallbackFactory.getOptMethod(RubyObject.class, "send", RubyObject.class)); kernelModule.defineMethod("__send__", CallbackFactory.getOptMethod(RubyObject.class, "send", RubyObject.class)); kernelModule.defineMethod("taint", taint); kernelModule.defineMethod("tainted?", tainted); kernelModule.defineMethod("to_a", to_a); kernelModule.defineMethod("to_s", to_s); kernelModule.defineMethod("type", type); kernelModule.defineMethod("untaint", untaint); kernelModule.defineAlias("===", "=="); kernelModule.defineAlias("equal?", "=="); Ruby ruby = kernelModule.getRuby(); ruby.defineGlobalFunction("method_missing", CallbackFactory.getOptMethod(RubyObject.class, "method_missing", RubyObject.class)); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyObject.java/clean/org/jruby/RubyObject.java |
kernelModule.defineMethod("taint", taint); kernelModule.defineMethod("tainted?", tainted); kernelModule.defineMethod("to_a", to_a); kernelModule.defineMethod("to_s", to_s); kernelModule.defineMethod("type", type); kernelModule.defineMethod("untaint", untaint); | kernelModule.defineMethod("taint", CallbackFactory.getMethod(RubyObject.class, "taint")); kernelModule.defineMethod("tainted?", CallbackFactory.getMethod(RubyObject.class, "tainted")); kernelModule.defineMethod("to_a", CallbackFactory.getMethod(RubyObject.class, "to_a")); kernelModule.defineMethod("to_s", CallbackFactory.getMethod(RubyObject.class, "to_s")); kernelModule.defineMethod("type", CallbackFactory.getMethod(RubyObject.class, "type")); kernelModule.defineMethod("untaint", CallbackFactory.getMethod(RubyObject.class, "untaint")); | public static void createObjectClass(RubyModule kernelModule) { // TODO: convert to CallbackFactory invokes. Callback clone = new ReflectionCallbackMethod(RubyObject.class, "rbClone"); Callback dup = new ReflectionCallbackMethod(RubyObject.class, "dup"); Callback equal = new ReflectionCallbackMethod(RubyObject.class, "equal", RubyObject.class); Callback respond_to = new ReflectionCallbackMethod(RubyObject.class, "respond_to", RubySymbol.class); Callback extend = new ReflectionCallbackMethod(RubyObject.class, "extend", RubyObject[].class, true); Callback freeze = new ReflectionCallbackMethod(RubyObject.class, "freeze"); Callback frozen = new ReflectionCallbackMethod(RubyObject.class, "frozen"); Callback id = new ReflectionCallbackMethod(RubyObject.class, "id"); Callback inspect = new ReflectionCallbackMethod(RubyObject.class, "inspect"); Callback instance_eval = new ReflectionCallbackMethod(RubyObject.class, "instance_eval", RubyObject[].class, true); Callback instance_of = new ReflectionCallbackMethod(RubyObject.class, "instance_of", RubyModule.class); Callback instance_variables = new ReflectionCallbackMethod(RubyObject.class, "instance_variables"); Callback kind_of = new ReflectionCallbackMethod(RubyObject.class, "kind_of", RubyModule.class); Callback method = new ReflectionCallbackMethod(RubyObject.class, "method", RubyObject.class); Callback methods = new ReflectionCallbackMethod(RubyObject.class, "methods"); Callback private_methods = new ReflectionCallbackMethod(RubyObject.class, "private_methods"); Callback protected_methods = new ReflectionCallbackMethod(RubyObject.class, "protected_methods"); Callback taint = new ReflectionCallbackMethod(RubyObject.class, "taint"); Callback tainted = new ReflectionCallbackMethod(RubyObject.class, "tainted"); Callback to_a = new ReflectionCallbackMethod(RubyObject.class, "to_a"); Callback to_s = new ReflectionCallbackMethod(RubyObject.class, "to_s"); Callback type = new ReflectionCallbackMethod(RubyObject.class, "type"); Callback untaint = new ReflectionCallbackMethod(RubyObject.class, "untaint"); kernelModule.defineMethod("=~", CallbackFactory.getFalseMethod()); kernelModule.defineMethod("==", equal); kernelModule.defineMethod("respond_to?", respond_to); kernelModule.defineMethod("class", type); kernelModule.defineMethod("clone", clone); kernelModule.defineMethod("dup", dup); kernelModule.defineMethod("eql?", equal); kernelModule.defineMethod("extend", extend); kernelModule.defineMethod("freeze", freeze); kernelModule.defineMethod("frozen?", frozen); kernelModule.defineMethod("hash", id); kernelModule.defineMethod("id", id); kernelModule.defineMethod("__id__", id); kernelModule.defineMethod("inspect", inspect); kernelModule.defineMethod("instance_eval", instance_eval); kernelModule.defineMethod("instance_of?", instance_of); kernelModule.defineMethod("instance_variables", instance_variables); kernelModule.defineMethod("is_a?", kind_of); kernelModule.defineMethod("kind_of?", kind_of); kernelModule.defineMethod("method", method); kernelModule.defineMethod("methods", methods); kernelModule.defineMethod("private_methods", private_methods); kernelModule.defineMethod("protected_methods", protected_methods); kernelModule.defineMethod("public_methods", methods); kernelModule.defineMethod("nil?", CallbackFactory.getFalseMethod()); kernelModule.defineMethod("send", CallbackFactory.getOptMethod(RubyObject.class, "send", RubyObject.class)); kernelModule.defineMethod("__send__", CallbackFactory.getOptMethod(RubyObject.class, "send", RubyObject.class)); kernelModule.defineMethod("taint", taint); kernelModule.defineMethod("tainted?", tainted); kernelModule.defineMethod("to_a", to_a); kernelModule.defineMethod("to_s", to_s); kernelModule.defineMethod("type", type); kernelModule.defineMethod("untaint", untaint); kernelModule.defineAlias("===", "=="); kernelModule.defineAlias("equal?", "=="); Ruby ruby = kernelModule.getRuby(); ruby.defineGlobalFunction("method_missing", CallbackFactory.getOptMethod(RubyObject.class, "method_missing", RubyObject.class)); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyObject.java/clean/org/jruby/RubyObject.java |
kernelModule.defineAlias("class", "type"); | public static void createObjectClass(RubyModule kernelModule) { // TODO: convert to CallbackFactory invokes. Callback clone = new ReflectionCallbackMethod(RubyObject.class, "rbClone"); Callback dup = new ReflectionCallbackMethod(RubyObject.class, "dup"); Callback equal = new ReflectionCallbackMethod(RubyObject.class, "equal", RubyObject.class); Callback respond_to = new ReflectionCallbackMethod(RubyObject.class, "respond_to", RubySymbol.class); Callback extend = new ReflectionCallbackMethod(RubyObject.class, "extend", RubyObject[].class, true); Callback freeze = new ReflectionCallbackMethod(RubyObject.class, "freeze"); Callback frozen = new ReflectionCallbackMethod(RubyObject.class, "frozen"); Callback id = new ReflectionCallbackMethod(RubyObject.class, "id"); Callback inspect = new ReflectionCallbackMethod(RubyObject.class, "inspect"); Callback instance_eval = new ReflectionCallbackMethod(RubyObject.class, "instance_eval", RubyObject[].class, true); Callback instance_of = new ReflectionCallbackMethod(RubyObject.class, "instance_of", RubyModule.class); Callback instance_variables = new ReflectionCallbackMethod(RubyObject.class, "instance_variables"); Callback kind_of = new ReflectionCallbackMethod(RubyObject.class, "kind_of", RubyModule.class); Callback method = new ReflectionCallbackMethod(RubyObject.class, "method", RubyObject.class); Callback methods = new ReflectionCallbackMethod(RubyObject.class, "methods"); Callback private_methods = new ReflectionCallbackMethod(RubyObject.class, "private_methods"); Callback protected_methods = new ReflectionCallbackMethod(RubyObject.class, "protected_methods"); Callback taint = new ReflectionCallbackMethod(RubyObject.class, "taint"); Callback tainted = new ReflectionCallbackMethod(RubyObject.class, "tainted"); Callback to_a = new ReflectionCallbackMethod(RubyObject.class, "to_a"); Callback to_s = new ReflectionCallbackMethod(RubyObject.class, "to_s"); Callback type = new ReflectionCallbackMethod(RubyObject.class, "type"); Callback untaint = new ReflectionCallbackMethod(RubyObject.class, "untaint"); kernelModule.defineMethod("=~", CallbackFactory.getFalseMethod()); kernelModule.defineMethod("==", equal); kernelModule.defineMethod("respond_to?", respond_to); kernelModule.defineMethod("class", type); kernelModule.defineMethod("clone", clone); kernelModule.defineMethod("dup", dup); kernelModule.defineMethod("eql?", equal); kernelModule.defineMethod("extend", extend); kernelModule.defineMethod("freeze", freeze); kernelModule.defineMethod("frozen?", frozen); kernelModule.defineMethod("hash", id); kernelModule.defineMethod("id", id); kernelModule.defineMethod("__id__", id); kernelModule.defineMethod("inspect", inspect); kernelModule.defineMethod("instance_eval", instance_eval); kernelModule.defineMethod("instance_of?", instance_of); kernelModule.defineMethod("instance_variables", instance_variables); kernelModule.defineMethod("is_a?", kind_of); kernelModule.defineMethod("kind_of?", kind_of); kernelModule.defineMethod("method", method); kernelModule.defineMethod("methods", methods); kernelModule.defineMethod("private_methods", private_methods); kernelModule.defineMethod("protected_methods", protected_methods); kernelModule.defineMethod("public_methods", methods); kernelModule.defineMethod("nil?", CallbackFactory.getFalseMethod()); kernelModule.defineMethod("send", CallbackFactory.getOptMethod(RubyObject.class, "send", RubyObject.class)); kernelModule.defineMethod("__send__", CallbackFactory.getOptMethod(RubyObject.class, "send", RubyObject.class)); kernelModule.defineMethod("taint", taint); kernelModule.defineMethod("tainted?", tainted); kernelModule.defineMethod("to_a", to_a); kernelModule.defineMethod("to_s", to_s); kernelModule.defineMethod("type", type); kernelModule.defineMethod("untaint", untaint); kernelModule.defineAlias("===", "=="); kernelModule.defineAlias("equal?", "=="); Ruby ruby = kernelModule.getRuby(); ruby.defineGlobalFunction("method_missing", CallbackFactory.getOptMethod(RubyObject.class, "method_missing", RubyObject.class)); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyObject.java/clean/org/jruby/RubyObject.java |
|
return RubyNumeric.fix2int(funcall("hash")); | long rubyHash = RubyNumeric.fix2long(funcall("hash")); int result = (int) rubyHash; result ^= (rubyHash >> 32); return result; | public int hashCode() { return RubyNumeric.fix2int(funcall("hash")); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyObject.java/clean/org/jruby/RubyObject.java |
public RubyBoolean respond_to(RubySymbol sym) { | public RubyBoolean respond_to(RubyObject methodName) { String name; if (methodName instanceof RubySymbol) { name = ((RubySymbol) methodName).toId(); } else if (methodName instanceof RubyString) { name = ((RubyString) methodName).getValue(); } else { throw new ArgumentError(getRuby(), "not a symbol"); } | public RubyBoolean respond_to(RubySymbol sym) { //Look in cache CacheEntry ent = getRuby().getMethodCache().getEntry(getRubyClass(), sym.toId()); if (ent != null) { //Check to see if it's private and we're not including privates(return false) //otherwise return true return ruby.getTrue(); } //Get from instance IMethod method = getRubyClass().searchMethod(sym.toId()); if (method != null) { return ruby.getTrue(); } return ruby.getFalse(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyObject.java/clean/org/jruby/RubyObject.java |
CacheEntry ent = getRuby().getMethodCache().getEntry(getRubyClass(), sym.toId()); | CacheEntry ent = getRuby().getMethodCache().getEntry(getRubyClass(), name); | public RubyBoolean respond_to(RubySymbol sym) { //Look in cache CacheEntry ent = getRuby().getMethodCache().getEntry(getRubyClass(), sym.toId()); if (ent != null) { //Check to see if it's private and we're not including privates(return false) //otherwise return true return ruby.getTrue(); } //Get from instance IMethod method = getRubyClass().searchMethod(sym.toId()); if (method != null) { return ruby.getTrue(); } return ruby.getFalse(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyObject.java/clean/org/jruby/RubyObject.java |
IMethod method = getRubyClass().searchMethod(sym.toId()); | IMethod method = getRubyClass().searchMethod(name); | public RubyBoolean respond_to(RubySymbol sym) { //Look in cache CacheEntry ent = getRuby().getMethodCache().getEntry(getRubyClass(), sym.toId()); if (ent != null) { //Check to see if it's private and we're not including privates(return false) //otherwise return true return ruby.getTrue(); } //Get from instance IMethod method = getRubyClass().searchMethod(sym.toId()); if (method != null) { return ruby.getTrue(); } return ruby.getFalse(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/4e4c0a90262b62b83d3fc5717371745bcc928c2b/RubyObject.java/clean/org/jruby/RubyObject.java |
if (widget instanceof Item && widget.getData() != null && !isExpandable((Item) widget, null, widget.getData())) { return; } | protected void internalExpandToLevel(Widget widget, int level) { if (level == ALL_LEVELS || level > 0) { createChildren(widget); if (widget instanceof Item) { setExpanded((Item) widget, true); } if (level == ALL_LEVELS || level > 1) { Item[] children = getChildren(widget); if (children != null) { int newLevel = (level == ALL_LEVELS ? ALL_LEVELS : level - 1); for (int i = 0; i < children.length; i++) { internalExpandToLevel(children[i], newLevel); } } } } } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/9b73a19afff49dea05eeb3f356b148fe442d77dc/AbstractTreeViewer.java/buggy/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java |
|
if (path.length() == 0) { return part.getTitle(); | String title = part.getTitle(); if (title == null || path == null || path.length() == 0) { return title; | public String getColumnText(Object element, int columnIndex) { if (element instanceof IWorkbenchPart) { IWorkbenchPart part = (IWorkbenchPart)element; String path = part.getTitleToolTip(); if (path.length() == 0) { return part.getTitle(); } else { return part.getTitle() + " [" + part.getTitleToolTip() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } } return null;} | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/9f092cdf294dcfa5c3aee77338af2d191c5f7370/WorkbenchPartLabelProvider.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartLabelProvider.java |
return part.getTitle() + " [" + part.getTitleToolTip() + "]"; | return title + " [" + path + "]"; | public String getColumnText(Object element, int columnIndex) { if (element instanceof IWorkbenchPart) { IWorkbenchPart part = (IWorkbenchPart)element; String path = part.getTitleToolTip(); if (path.length() == 0) { return part.getTitle(); } else { return part.getTitle() + " [" + part.getTitleToolTip() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } } return null;} | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/9f092cdf294dcfa5c3aee77338af2d191c5f7370/WorkbenchPartLabelProvider.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartLabelProvider.java |
public Object getContent(Context c) { return _sb.toString(); | public List getContent(Context c) { return null; | public Object getContent(Context c) { return _sb.toString(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/TextContent.java/clean/src/java/org/xhtmlrenderer/layout/content/TextContent.java |
setModified(true); | public void setDescription(String description) { if (((description == null) && (_description != null)) || ((description != null) && (_description == null)) || ((description != null) && (_description != null) && !description.equals(_description))) { if (!XSS_ALLOW_DESCRIPTION) { description = XSSUtil.strip(description); } _description = description; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingItemFieldModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingItemFieldModel.java |
|
setModified(true); | public void setItemFieldId(String itemFieldId) { if (((itemFieldId == null) && (_itemFieldId != null)) || ((itemFieldId != null) && (_itemFieldId == null)) || ((itemFieldId != null) && (_itemFieldId != null) && !itemFieldId.equals(_itemFieldId))) { if (!XSS_ALLOW_ITEMFIELDID) { itemFieldId = XSSUtil.strip(itemFieldId); } _itemFieldId = itemFieldId; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingItemFieldModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingItemFieldModel.java |
|
setModified(true); | public void setItemId(String itemId) { if (((itemId == null) && (_itemId != null)) || ((itemId != null) && (_itemId == null)) || ((itemId != null) && (_itemId != null) && !itemId.equals(_itemId))) { if (!XSS_ALLOW_ITEMID) { itemId = XSSUtil.strip(itemId); } _itemId = itemId; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingItemFieldModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingItemFieldModel.java |
|
setModified(true); | public void setName(String name) { if (((name == null) && (_name != null)) || ((name != null) && (_name == null)) || ((name != null) && (_name != null) && !name.equals(_name))) { if (!XSS_ALLOW_NAME) { name = XSSUtil.strip(name); } _name = name; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingItemFieldModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingItemFieldModel.java |
|
setModified(true); | public void setValues(String values) { if (((values == null) && (_values != null)) || ((values != null) && (_values == null)) || ((values != null) && (_values != null) && !values.equals(_values))) { if (!XSS_ALLOW_VALUES) { values = XSSUtil.strip(values); } _values = values; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingItemFieldModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingItemFieldModel.java |
|
void handleSetChange(IObservableSet source, SetDiff diff); | void handleSetChange(SetChangeEvent event); | void handleSetChange(IObservableSet source, SetDiff diff); | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/6aecdb31231a8602dbf72944625703c440949c78/ISetChangeListener.java/buggy/bundles/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/ISetChangeListener.java |
public static InlineBox generateFloatedBlockInlineBox(Context c, Node node, int avail, InlineBox prev, String text, InlineBox prev_align, Font font) { | public static InlineBox generateFloatedBlockInlineBox(Context c, Content content, int avail, InlineBox prev_align, Font font) { | public static InlineBox generateFloatedBlockInlineBox(Context c, Node node, int avail, InlineBox prev, String text, InlineBox prev_align, Font font) { // u.p("generate floated block inline box: avail = " + avail); /* joshy: change this to just modify the existing block instead of creating a new one. is that possible? */ //u.p("generate floated block inline box"); BoxLayout layout = (BoxLayout) c.getLayout(node); // Rectangle oe = c.getExtents(); // copy the extents for safety c.setExtents(new Rectangle(oe)); //BlockBox block = (BlockBox)layout.layout( c, (Element)node ); InlineBlockBox inline_block = new InlineBlockBox(); inline_block.setNode(node); layout.layout(c, inline_block); //u.p("got a block box from the sub layout: " + block); Rectangle bounds = new Rectangle(inline_block.x, inline_block.y, inline_block.width, inline_block.height); c.setExtents(oe); //InlineBox box = // u.p("before newbox block = " + inline_block); int x = inline_block.x; int y = inline_block.y; LineBreaker.newBox(c, node, 0, 0, prev, text, bounds, prev_align, font, inline_block); inline_block.x = x; inline_block.y = y; // u.p("after newbox = " + inline_block); //box.sub_block = block; //block.setParent( box ); inline_block.width = bounds.width; inline_block.height = bounds.height; inline_block.break_after = false; inline_block.floated = true; // u.p("width = " + inline_block.width); // u.p("avail = " + avail); if (inline_block.width > avail) { inline_block.break_before = true; //inline_block.x = 0; } //inline_block.floated = true; //inline_block.x = bfc.getLeftFloatDistance(line) - inline.width - inline.width; //inline_block.x = 0; //inline_block.y = 0; // u.p("final inline block = " + inline_block); return inline_block; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/FloatUtil.java/buggy/src/java/org/xhtmlrenderer/layout/inline/FloatUtil.java |
BoxLayout layout = (BoxLayout) c.getLayout(node); | BoxLayout layout = (BoxLayout) c.getLayout(content.getElement()); | public static InlineBox generateFloatedBlockInlineBox(Context c, Node node, int avail, InlineBox prev, String text, InlineBox prev_align, Font font) { // u.p("generate floated block inline box: avail = " + avail); /* joshy: change this to just modify the existing block instead of creating a new one. is that possible? */ //u.p("generate floated block inline box"); BoxLayout layout = (BoxLayout) c.getLayout(node); // Rectangle oe = c.getExtents(); // copy the extents for safety c.setExtents(new Rectangle(oe)); //BlockBox block = (BlockBox)layout.layout( c, (Element)node ); InlineBlockBox inline_block = new InlineBlockBox(); inline_block.setNode(node); layout.layout(c, inline_block); //u.p("got a block box from the sub layout: " + block); Rectangle bounds = new Rectangle(inline_block.x, inline_block.y, inline_block.width, inline_block.height); c.setExtents(oe); //InlineBox box = // u.p("before newbox block = " + inline_block); int x = inline_block.x; int y = inline_block.y; LineBreaker.newBox(c, node, 0, 0, prev, text, bounds, prev_align, font, inline_block); inline_block.x = x; inline_block.y = y; // u.p("after newbox = " + inline_block); //box.sub_block = block; //block.setParent( box ); inline_block.width = bounds.width; inline_block.height = bounds.height; inline_block.break_after = false; inline_block.floated = true; // u.p("width = " + inline_block.width); // u.p("avail = " + avail); if (inline_block.width > avail) { inline_block.break_before = true; //inline_block.x = 0; } //inline_block.floated = true; //inline_block.x = bfc.getLeftFloatDistance(line) - inline.width - inline.width; //inline_block.x = 0; //inline_block.y = 0; // u.p("final inline block = " + inline_block); return inline_block; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/FloatUtil.java/buggy/src/java/org/xhtmlrenderer/layout/inline/FloatUtil.java |
inline_block.setNode(node); | inline_block.setNode(content.getElement()); inline_block.setContent(content); | public static InlineBox generateFloatedBlockInlineBox(Context c, Node node, int avail, InlineBox prev, String text, InlineBox prev_align, Font font) { // u.p("generate floated block inline box: avail = " + avail); /* joshy: change this to just modify the existing block instead of creating a new one. is that possible? */ //u.p("generate floated block inline box"); BoxLayout layout = (BoxLayout) c.getLayout(node); // Rectangle oe = c.getExtents(); // copy the extents for safety c.setExtents(new Rectangle(oe)); //BlockBox block = (BlockBox)layout.layout( c, (Element)node ); InlineBlockBox inline_block = new InlineBlockBox(); inline_block.setNode(node); layout.layout(c, inline_block); //u.p("got a block box from the sub layout: " + block); Rectangle bounds = new Rectangle(inline_block.x, inline_block.y, inline_block.width, inline_block.height); c.setExtents(oe); //InlineBox box = // u.p("before newbox block = " + inline_block); int x = inline_block.x; int y = inline_block.y; LineBreaker.newBox(c, node, 0, 0, prev, text, bounds, prev_align, font, inline_block); inline_block.x = x; inline_block.y = y; // u.p("after newbox = " + inline_block); //box.sub_block = block; //block.setParent( box ); inline_block.width = bounds.width; inline_block.height = bounds.height; inline_block.break_after = false; inline_block.floated = true; // u.p("width = " + inline_block.width); // u.p("avail = " + avail); if (inline_block.width > avail) { inline_block.break_before = true; //inline_block.x = 0; } //inline_block.floated = true; //inline_block.x = bfc.getLeftFloatDistance(line) - inline.width - inline.width; //inline_block.x = 0; //inline_block.y = 0; // u.p("final inline block = " + inline_block); return inline_block; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/FloatUtil.java/buggy/src/java/org/xhtmlrenderer/layout/inline/FloatUtil.java |
LineBreaker.newBox(c, node, 0, 0, prev, text, bounds, prev_align, font, inline_block); | CascadedStyle firstLineStyle = c.css.getPseudoElementStyle(content.getElement(), "first-line"); LineBreaker.styleBox(c, content.getElement(), 0, 0, null, bounds, prev_align, font, inline_block, firstLineStyle); | public static InlineBox generateFloatedBlockInlineBox(Context c, Node node, int avail, InlineBox prev, String text, InlineBox prev_align, Font font) { // u.p("generate floated block inline box: avail = " + avail); /* joshy: change this to just modify the existing block instead of creating a new one. is that possible? */ //u.p("generate floated block inline box"); BoxLayout layout = (BoxLayout) c.getLayout(node); // Rectangle oe = c.getExtents(); // copy the extents for safety c.setExtents(new Rectangle(oe)); //BlockBox block = (BlockBox)layout.layout( c, (Element)node ); InlineBlockBox inline_block = new InlineBlockBox(); inline_block.setNode(node); layout.layout(c, inline_block); //u.p("got a block box from the sub layout: " + block); Rectangle bounds = new Rectangle(inline_block.x, inline_block.y, inline_block.width, inline_block.height); c.setExtents(oe); //InlineBox box = // u.p("before newbox block = " + inline_block); int x = inline_block.x; int y = inline_block.y; LineBreaker.newBox(c, node, 0, 0, prev, text, bounds, prev_align, font, inline_block); inline_block.x = x; inline_block.y = y; // u.p("after newbox = " + inline_block); //box.sub_block = block; //block.setParent( box ); inline_block.width = bounds.width; inline_block.height = bounds.height; inline_block.break_after = false; inline_block.floated = true; // u.p("width = " + inline_block.width); // u.p("avail = " + avail); if (inline_block.width > avail) { inline_block.break_before = true; //inline_block.x = 0; } //inline_block.floated = true; //inline_block.x = bfc.getLeftFloatDistance(line) - inline.width - inline.width; //inline_block.x = 0; //inline_block.y = 0; // u.p("final inline block = " + inline_block); return inline_block; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/bbe26e114cd1f823901a5ca3d63b5fccfdfedf81/FloatUtil.java/buggy/src/java/org/xhtmlrenderer/layout/inline/FloatUtil.java |
if (! box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, prev_line, bounds.width); | if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance(c, prev_line, bounds.width); | public static void layoutContent(LayoutContext c, Box box, List contentList) { //Here we should always be inside something that corresponds to a block-level element //for formatting purposes Rectangle bounds = new Rectangle(); bounds.width = c.getExtents().width; validateBounds(bounds); bounds.x = 0; bounds.y = 0; bounds.height = 0; //dummy style to make sure that text nodes don't get extra padding and such //doesn't work here because blocks may be inside inlines, losing inline styling: //c.pushStyle(CascadedStyle.emptyCascadedStyle); int blockLineHeight = (int) Math.round(box.getStyle().getCalculatedStyle().getLineHeight(c)); LineMetrics blockLineMetrics = c.getTextRenderer().getLineMetrics(c.getGraphics(), box.getStyle().getFont(c), "thequickbrownfoxjumpedoverthelazydogTHEQUICKBROWNFOXJUMPEDOVERTHELAZYDOG"); // more setup LineBox prev_line = new LineBox(); c.pushStyle(CascadedStyle.emptyCascadedStyle); prev_line.setStyle(new Style(c.getCurrentStyle(), 0)); c.popStyle(); prev_line.setParent(box); prev_line.y = 0; prev_line.height = 0; InlineBox prev_inline = null; InlineBox prev_align_inline = null; // prepare remaining width and first linebox int remaining_width = bounds.width; if (! box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, prev_line, bounds.width); } LineBox curr_line = newLine(box, bounds, null, blockLineMetrics, c); List pushedOnFirstLine = null; // account for text-indent CalculatedStyle parentStyle = c.getCurrentStyle(); float indent = parentStyle.getFloatPropertyProportionalWidth( CSSName.TEXT_INDENT, bounds.width, c); remaining_width -= (int) indent; curr_line.x = curr_line.x + (int) indent; boolean isFirstLetter = true; int pendingPushStyles = 0; List pendingFloats = new ArrayList(); int pendingLeftPadding = 0; int pendingRightPadding = 0; // loop until no more nodes Iterator contentIter = contentList.iterator(); while (contentIter.hasNext() && !c.shouldStop()) { Object o = contentIter.next(); if (o instanceof FirstLineStyle) {//can actually only be the first object in list box.firstLineStyle = ((FirstLineStyle) o).getStyle(); c.addFirstLineStyle(box.firstLineStyle); continue; } if (o instanceof FirstLetterStyle) {//can actually only be the first or second object in list box.firstLetterStyle = ((FirstLetterStyle) o).getStyle(); continue; } if (o instanceof StylePush) { CascadedStyle cascaded; StylePush sp = (StylePush) o; if (sp.getElement() == null) { //anonymous inline box cascaded = CascadedStyle.emptyCascadedStyle; } else if (sp.getPseudoElement() != null) { cascaded = c.getCss().getPseudoElementStyle(sp.getElement(), sp.getPseudoElement()); } else { cascaded = c.getCss().getCascadedStyle(sp.getElement(), false);//already restyled by ContentUtil } //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(cascaded); } c.pushStyle(cascaded); /*if (pendingPushStyles == null) { pendingPushStyles = new ArrayList(); } pendingPushStyles.add((StylePush) o);*/ pendingPushStyles++; //Relative.translateRelative(c, c.getCurrentStyle(), false); CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; c.setCurrentInlineElement(new InlineElement(((StylePush) o).getElement(), ((StylePush) o).getPseudoElement(), c.getCurrentInlineElement())); c.getCurrentInlineElement().setStartStyle(new Style(style, parent_width)); //To break the line well, assume we don't just want to paint padding on next line BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding += margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding += (int) padding.right() + (int) border.right() + margin.right(); continue; } if (o instanceof StylePop) { if (pendingPushStyles != 0) { //if (pendingPushStyles != null && pendingPushStyles.size() != 0) { //pendingPushStyles.remove(pendingPushStyles.size() - 1);//was a redundant one pendingPushStyles--; //TODO: is it correct that empty inline elements get ignored? //correct the pending padding CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding -= margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding -= (int) padding.right() + (int) border.right() + margin.right(); } else { if (prev_inline == null) {//only when there was a block child just before element end prev_inline = new InlineTextBox();//hope it is decently initialised as empty ((InlineTextBox) prev_inline).setMasterText(""); ((InlineTextBox) prev_inline).start_index = 0; ((InlineTextBox) prev_inline).end_index = 0; curr_line.addChild(prev_inline); prev_inline.setInlineElement(c.getCurrentInlineElement()); } prev_inline.popstyles++; int parent_width = bounds.width; CalculatedStyle style = c.getCurrentStyle(); c.getCurrentInlineElement().setEndStyle(new Style(style, parent_width)); c.setCurrentInlineElement(c.getCurrentInlineElement().getParent()); BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); // CLEAN: cast to int int rp = (int) padding.right() + (int) border.right() + (int) margin.right(); //CHECK: not sure this is where the padding really goes, always prev_inline.rightPadding += rp; pendingRightPadding -= rp; remaining_width -= rp; } if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } //Relative.untranslateRelative(c, c.getCurrentStyle(), false); c.popStyle(); continue; } Content currentContent = (Content) o; if (currentContent.getStyle() != null) { //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(currentContent.getStyle()); } c.pushStyle(currentContent.getStyle()); } // loop until no more text in this node InlineBox new_inline = null; int start = 0; InlineBlockBox pendingBlockBox = null; do { new_inline = null; if (currentContent instanceof AbsolutelyPositionedContent) { Absolute.generateAbsoluteBox(c, currentContent, curr_line); break; } else if (currentContent instanceof FloatedBlockContent) { //Uu.p("calcinline: is floated block"); FloatedBlockBox floater = FloatUtil.generateFloatedBlock(c, currentContent, remaining_width, curr_line, pendingFloats); if (!floater.isPending()) { remaining_width -= floater.getWidth(); } break; } // debugging check if (bounds.width < 0) { Uu.p("bounds width = " + bounds.width); Uu.dump_stack(); System.exit(-1); } // the crash warning code if (bounds.width < 1) { Uu.p("warning. width < 1 " + bounds.width); } // look at current inline // break off the longest section that will fit int fit = pendingRightPadding;//Note: this is not necessarily entirely correct if (start == 0) fit += pendingLeftPadding; start = trimLeadingSpace(c.getCurrentStyle(), prev_inline, currentContent, start); new_inline = calculateInline(c, currentContent, remaining_width - fit, bounds.width, prev_align_inline, isFirstLetter, box.firstLetterStyle, curr_line, start, pendingBlockBox, pendingFloats); pendingBlockBox = null; // if this inline needs to be on a new line if (prev_align_inline != null && new_inline.break_before) { // Uu.p("break before"); remaining_width = bounds.width; saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); // skip adjusting for tabs if this box is cleared if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } //have to discard it and recalculate, particularly if this was the first line prev_align_inline.break_after = true; if (new_inline instanceof InlineBlockBox) pendingBlockBox = (InlineBlockBox) new_inline; new_inline = null; continue; } // save the new inline to the list // Uu.p("adding inline child: " + new_inline); //the inline might be set to size 0,0 after this, if it is first whitespace on line. // Cannot discard because it may contain style-pushes if (!(currentContent instanceof FloatedBlockContent)) { curr_line.addInlineChild(new_inline); } // Uu.p("current line = " + curr_line); if (new_inline instanceof InlineTextBox) { start = ((InlineTextBox) new_inline).end_index; } isFirstLetter = false; new_inline.pushstyles = pendingPushStyles; pendingPushStyles = 0; new_inline.leftPadding += pendingLeftPadding; pendingLeftPadding = 0; // calc new height of the line // don't count floats and absolutes if (!new_inline.getStyle().isFloated() && !new_inline.getStyle().isAbsolute()) { adjustLineHeight(c, curr_line, new_inline); } // calc new width of the line curr_line.contentWidth += new_inline.getWidth(); // reduce the available width remaining_width = remaining_width - new_inline.getWidth(); // if the last inline was at the end of a line, then go to next line if (new_inline.break_after) { // Uu.p("break after"); // then remaining_width = max_width remaining_width = bounds.width; // save the line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); // increase bounds height to account for the new line bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } } // set the inline to use for left alignment if (!isOutsideFlow(currentContent)) {//is this necessary now? prev_align_inline = new_inline; } prev_inline = new_inline; } while (!c.shouldStop() && (new_inline == null || !new_inline.isEndOfParentContent())); if (currentContent.getStyle() != null) { c.popStyle(); if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } } } // save the final line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; if (!c.shrinkWrap()) box.contentWidth = bounds.width; box.height = bounds.height; //box.x = 0; //box.y = 0; // Uu.p("- InlineLayout.layoutContent(): " + box); //pop the dummy style, but no, see above //c.popStyle(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineBoxing.java/clean/src/java/org/xhtmlrenderer/layout/InlineBoxing.java |
public static void layoutContent(LayoutContext c, Box box, List contentList) { //Here we should always be inside something that corresponds to a block-level element //for formatting purposes Rectangle bounds = new Rectangle(); bounds.width = c.getExtents().width; validateBounds(bounds); bounds.x = 0; bounds.y = 0; bounds.height = 0; //dummy style to make sure that text nodes don't get extra padding and such //doesn't work here because blocks may be inside inlines, losing inline styling: //c.pushStyle(CascadedStyle.emptyCascadedStyle); int blockLineHeight = (int) Math.round(box.getStyle().getCalculatedStyle().getLineHeight(c)); LineMetrics blockLineMetrics = c.getTextRenderer().getLineMetrics(c.getGraphics(), box.getStyle().getFont(c), "thequickbrownfoxjumpedoverthelazydogTHEQUICKBROWNFOXJUMPEDOVERTHELAZYDOG"); // more setup LineBox prev_line = new LineBox(); c.pushStyle(CascadedStyle.emptyCascadedStyle); prev_line.setStyle(new Style(c.getCurrentStyle(), 0)); c.popStyle(); prev_line.setParent(box); prev_line.y = 0; prev_line.height = 0; InlineBox prev_inline = null; InlineBox prev_align_inline = null; // prepare remaining width and first linebox int remaining_width = bounds.width; if (! box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, prev_line, bounds.width); } LineBox curr_line = newLine(box, bounds, null, blockLineMetrics, c); List pushedOnFirstLine = null; // account for text-indent CalculatedStyle parentStyle = c.getCurrentStyle(); float indent = parentStyle.getFloatPropertyProportionalWidth( CSSName.TEXT_INDENT, bounds.width, c); remaining_width -= (int) indent; curr_line.x = curr_line.x + (int) indent; boolean isFirstLetter = true; int pendingPushStyles = 0; List pendingFloats = new ArrayList(); int pendingLeftPadding = 0; int pendingRightPadding = 0; // loop until no more nodes Iterator contentIter = contentList.iterator(); while (contentIter.hasNext() && !c.shouldStop()) { Object o = contentIter.next(); if (o instanceof FirstLineStyle) {//can actually only be the first object in list box.firstLineStyle = ((FirstLineStyle) o).getStyle(); c.addFirstLineStyle(box.firstLineStyle); continue; } if (o instanceof FirstLetterStyle) {//can actually only be the first or second object in list box.firstLetterStyle = ((FirstLetterStyle) o).getStyle(); continue; } if (o instanceof StylePush) { CascadedStyle cascaded; StylePush sp = (StylePush) o; if (sp.getElement() == null) { //anonymous inline box cascaded = CascadedStyle.emptyCascadedStyle; } else if (sp.getPseudoElement() != null) { cascaded = c.getCss().getPseudoElementStyle(sp.getElement(), sp.getPseudoElement()); } else { cascaded = c.getCss().getCascadedStyle(sp.getElement(), false);//already restyled by ContentUtil } //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(cascaded); } c.pushStyle(cascaded); /*if (pendingPushStyles == null) { pendingPushStyles = new ArrayList(); } pendingPushStyles.add((StylePush) o);*/ pendingPushStyles++; //Relative.translateRelative(c, c.getCurrentStyle(), false); CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; c.setCurrentInlineElement(new InlineElement(((StylePush) o).getElement(), ((StylePush) o).getPseudoElement(), c.getCurrentInlineElement())); c.getCurrentInlineElement().setStartStyle(new Style(style, parent_width)); //To break the line well, assume we don't just want to paint padding on next line BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding += margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding += (int) padding.right() + (int) border.right() + margin.right(); continue; } if (o instanceof StylePop) { if (pendingPushStyles != 0) { //if (pendingPushStyles != null && pendingPushStyles.size() != 0) { //pendingPushStyles.remove(pendingPushStyles.size() - 1);//was a redundant one pendingPushStyles--; //TODO: is it correct that empty inline elements get ignored? //correct the pending padding CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding -= margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding -= (int) padding.right() + (int) border.right() + margin.right(); } else { if (prev_inline == null) {//only when there was a block child just before element end prev_inline = new InlineTextBox();//hope it is decently initialised as empty ((InlineTextBox) prev_inline).setMasterText(""); ((InlineTextBox) prev_inline).start_index = 0; ((InlineTextBox) prev_inline).end_index = 0; curr_line.addChild(prev_inline); prev_inline.setInlineElement(c.getCurrentInlineElement()); } prev_inline.popstyles++; int parent_width = bounds.width; CalculatedStyle style = c.getCurrentStyle(); c.getCurrentInlineElement().setEndStyle(new Style(style, parent_width)); c.setCurrentInlineElement(c.getCurrentInlineElement().getParent()); BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); // CLEAN: cast to int int rp = (int) padding.right() + (int) border.right() + (int) margin.right(); //CHECK: not sure this is where the padding really goes, always prev_inline.rightPadding += rp; pendingRightPadding -= rp; remaining_width -= rp; } if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } //Relative.untranslateRelative(c, c.getCurrentStyle(), false); c.popStyle(); continue; } Content currentContent = (Content) o; if (currentContent.getStyle() != null) { //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(currentContent.getStyle()); } c.pushStyle(currentContent.getStyle()); } // loop until no more text in this node InlineBox new_inline = null; int start = 0; InlineBlockBox pendingBlockBox = null; do { new_inline = null; if (currentContent instanceof AbsolutelyPositionedContent) { Absolute.generateAbsoluteBox(c, currentContent, curr_line); break; } else if (currentContent instanceof FloatedBlockContent) { //Uu.p("calcinline: is floated block"); FloatedBlockBox floater = FloatUtil.generateFloatedBlock(c, currentContent, remaining_width, curr_line, pendingFloats); if (!floater.isPending()) { remaining_width -= floater.getWidth(); } break; } // debugging check if (bounds.width < 0) { Uu.p("bounds width = " + bounds.width); Uu.dump_stack(); System.exit(-1); } // the crash warning code if (bounds.width < 1) { Uu.p("warning. width < 1 " + bounds.width); } // look at current inline // break off the longest section that will fit int fit = pendingRightPadding;//Note: this is not necessarily entirely correct if (start == 0) fit += pendingLeftPadding; start = trimLeadingSpace(c.getCurrentStyle(), prev_inline, currentContent, start); new_inline = calculateInline(c, currentContent, remaining_width - fit, bounds.width, prev_align_inline, isFirstLetter, box.firstLetterStyle, curr_line, start, pendingBlockBox, pendingFloats); pendingBlockBox = null; // if this inline needs to be on a new line if (prev_align_inline != null && new_inline.break_before) { // Uu.p("break before"); remaining_width = bounds.width; saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); // skip adjusting for tabs if this box is cleared if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } //have to discard it and recalculate, particularly if this was the first line prev_align_inline.break_after = true; if (new_inline instanceof InlineBlockBox) pendingBlockBox = (InlineBlockBox) new_inline; new_inline = null; continue; } // save the new inline to the list // Uu.p("adding inline child: " + new_inline); //the inline might be set to size 0,0 after this, if it is first whitespace on line. // Cannot discard because it may contain style-pushes if (!(currentContent instanceof FloatedBlockContent)) { curr_line.addInlineChild(new_inline); } // Uu.p("current line = " + curr_line); if (new_inline instanceof InlineTextBox) { start = ((InlineTextBox) new_inline).end_index; } isFirstLetter = false; new_inline.pushstyles = pendingPushStyles; pendingPushStyles = 0; new_inline.leftPadding += pendingLeftPadding; pendingLeftPadding = 0; // calc new height of the line // don't count floats and absolutes if (!new_inline.getStyle().isFloated() && !new_inline.getStyle().isAbsolute()) { adjustLineHeight(c, curr_line, new_inline); } // calc new width of the line curr_line.contentWidth += new_inline.getWidth(); // reduce the available width remaining_width = remaining_width - new_inline.getWidth(); // if the last inline was at the end of a line, then go to next line if (new_inline.break_after) { // Uu.p("break after"); // then remaining_width = max_width remaining_width = bounds.width; // save the line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); // increase bounds height to account for the new line bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } } // set the inline to use for left alignment if (!isOutsideFlow(currentContent)) {//is this necessary now? prev_align_inline = new_inline; } prev_inline = new_inline; } while (!c.shouldStop() && (new_inline == null || !new_inline.isEndOfParentContent())); if (currentContent.getStyle() != null) { c.popStyle(); if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } } } // save the final line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; if (!c.shrinkWrap()) box.contentWidth = bounds.width; box.height = bounds.height; //box.x = 0; //box.y = 0; // Uu.p("- InlineLayout.layoutContent(): " + box); //pop the dummy style, but no, see above //c.popStyle(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineBoxing.java/clean/src/java/org/xhtmlrenderer/layout/InlineBoxing.java |
||
float indent = parentStyle.getFloatPropertyProportionalWidth( CSSName.TEXT_INDENT, bounds.width, c); | float indent = parentStyle.getFloatPropertyProportionalWidth(CSSName.TEXT_INDENT, bounds.width, c); | public static void layoutContent(LayoutContext c, Box box, List contentList) { //Here we should always be inside something that corresponds to a block-level element //for formatting purposes Rectangle bounds = new Rectangle(); bounds.width = c.getExtents().width; validateBounds(bounds); bounds.x = 0; bounds.y = 0; bounds.height = 0; //dummy style to make sure that text nodes don't get extra padding and such //doesn't work here because blocks may be inside inlines, losing inline styling: //c.pushStyle(CascadedStyle.emptyCascadedStyle); int blockLineHeight = (int) Math.round(box.getStyle().getCalculatedStyle().getLineHeight(c)); LineMetrics blockLineMetrics = c.getTextRenderer().getLineMetrics(c.getGraphics(), box.getStyle().getFont(c), "thequickbrownfoxjumpedoverthelazydogTHEQUICKBROWNFOXJUMPEDOVERTHELAZYDOG"); // more setup LineBox prev_line = new LineBox(); c.pushStyle(CascadedStyle.emptyCascadedStyle); prev_line.setStyle(new Style(c.getCurrentStyle(), 0)); c.popStyle(); prev_line.setParent(box); prev_line.y = 0; prev_line.height = 0; InlineBox prev_inline = null; InlineBox prev_align_inline = null; // prepare remaining width and first linebox int remaining_width = bounds.width; if (! box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, prev_line, bounds.width); } LineBox curr_line = newLine(box, bounds, null, blockLineMetrics, c); List pushedOnFirstLine = null; // account for text-indent CalculatedStyle parentStyle = c.getCurrentStyle(); float indent = parentStyle.getFloatPropertyProportionalWidth( CSSName.TEXT_INDENT, bounds.width, c); remaining_width -= (int) indent; curr_line.x = curr_line.x + (int) indent; boolean isFirstLetter = true; int pendingPushStyles = 0; List pendingFloats = new ArrayList(); int pendingLeftPadding = 0; int pendingRightPadding = 0; // loop until no more nodes Iterator contentIter = contentList.iterator(); while (contentIter.hasNext() && !c.shouldStop()) { Object o = contentIter.next(); if (o instanceof FirstLineStyle) {//can actually only be the first object in list box.firstLineStyle = ((FirstLineStyle) o).getStyle(); c.addFirstLineStyle(box.firstLineStyle); continue; } if (o instanceof FirstLetterStyle) {//can actually only be the first or second object in list box.firstLetterStyle = ((FirstLetterStyle) o).getStyle(); continue; } if (o instanceof StylePush) { CascadedStyle cascaded; StylePush sp = (StylePush) o; if (sp.getElement() == null) { //anonymous inline box cascaded = CascadedStyle.emptyCascadedStyle; } else if (sp.getPseudoElement() != null) { cascaded = c.getCss().getPseudoElementStyle(sp.getElement(), sp.getPseudoElement()); } else { cascaded = c.getCss().getCascadedStyle(sp.getElement(), false);//already restyled by ContentUtil } //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(cascaded); } c.pushStyle(cascaded); /*if (pendingPushStyles == null) { pendingPushStyles = new ArrayList(); } pendingPushStyles.add((StylePush) o);*/ pendingPushStyles++; //Relative.translateRelative(c, c.getCurrentStyle(), false); CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; c.setCurrentInlineElement(new InlineElement(((StylePush) o).getElement(), ((StylePush) o).getPseudoElement(), c.getCurrentInlineElement())); c.getCurrentInlineElement().setStartStyle(new Style(style, parent_width)); //To break the line well, assume we don't just want to paint padding on next line BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding += margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding += (int) padding.right() + (int) border.right() + margin.right(); continue; } if (o instanceof StylePop) { if (pendingPushStyles != 0) { //if (pendingPushStyles != null && pendingPushStyles.size() != 0) { //pendingPushStyles.remove(pendingPushStyles.size() - 1);//was a redundant one pendingPushStyles--; //TODO: is it correct that empty inline elements get ignored? //correct the pending padding CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding -= margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding -= (int) padding.right() + (int) border.right() + margin.right(); } else { if (prev_inline == null) {//only when there was a block child just before element end prev_inline = new InlineTextBox();//hope it is decently initialised as empty ((InlineTextBox) prev_inline).setMasterText(""); ((InlineTextBox) prev_inline).start_index = 0; ((InlineTextBox) prev_inline).end_index = 0; curr_line.addChild(prev_inline); prev_inline.setInlineElement(c.getCurrentInlineElement()); } prev_inline.popstyles++; int parent_width = bounds.width; CalculatedStyle style = c.getCurrentStyle(); c.getCurrentInlineElement().setEndStyle(new Style(style, parent_width)); c.setCurrentInlineElement(c.getCurrentInlineElement().getParent()); BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); // CLEAN: cast to int int rp = (int) padding.right() + (int) border.right() + (int) margin.right(); //CHECK: not sure this is where the padding really goes, always prev_inline.rightPadding += rp; pendingRightPadding -= rp; remaining_width -= rp; } if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } //Relative.untranslateRelative(c, c.getCurrentStyle(), false); c.popStyle(); continue; } Content currentContent = (Content) o; if (currentContent.getStyle() != null) { //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(currentContent.getStyle()); } c.pushStyle(currentContent.getStyle()); } // loop until no more text in this node InlineBox new_inline = null; int start = 0; InlineBlockBox pendingBlockBox = null; do { new_inline = null; if (currentContent instanceof AbsolutelyPositionedContent) { Absolute.generateAbsoluteBox(c, currentContent, curr_line); break; } else if (currentContent instanceof FloatedBlockContent) { //Uu.p("calcinline: is floated block"); FloatedBlockBox floater = FloatUtil.generateFloatedBlock(c, currentContent, remaining_width, curr_line, pendingFloats); if (!floater.isPending()) { remaining_width -= floater.getWidth(); } break; } // debugging check if (bounds.width < 0) { Uu.p("bounds width = " + bounds.width); Uu.dump_stack(); System.exit(-1); } // the crash warning code if (bounds.width < 1) { Uu.p("warning. width < 1 " + bounds.width); } // look at current inline // break off the longest section that will fit int fit = pendingRightPadding;//Note: this is not necessarily entirely correct if (start == 0) fit += pendingLeftPadding; start = trimLeadingSpace(c.getCurrentStyle(), prev_inline, currentContent, start); new_inline = calculateInline(c, currentContent, remaining_width - fit, bounds.width, prev_align_inline, isFirstLetter, box.firstLetterStyle, curr_line, start, pendingBlockBox, pendingFloats); pendingBlockBox = null; // if this inline needs to be on a new line if (prev_align_inline != null && new_inline.break_before) { // Uu.p("break before"); remaining_width = bounds.width; saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); // skip adjusting for tabs if this box is cleared if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } //have to discard it and recalculate, particularly if this was the first line prev_align_inline.break_after = true; if (new_inline instanceof InlineBlockBox) pendingBlockBox = (InlineBlockBox) new_inline; new_inline = null; continue; } // save the new inline to the list // Uu.p("adding inline child: " + new_inline); //the inline might be set to size 0,0 after this, if it is first whitespace on line. // Cannot discard because it may contain style-pushes if (!(currentContent instanceof FloatedBlockContent)) { curr_line.addInlineChild(new_inline); } // Uu.p("current line = " + curr_line); if (new_inline instanceof InlineTextBox) { start = ((InlineTextBox) new_inline).end_index; } isFirstLetter = false; new_inline.pushstyles = pendingPushStyles; pendingPushStyles = 0; new_inline.leftPadding += pendingLeftPadding; pendingLeftPadding = 0; // calc new height of the line // don't count floats and absolutes if (!new_inline.getStyle().isFloated() && !new_inline.getStyle().isAbsolute()) { adjustLineHeight(c, curr_line, new_inline); } // calc new width of the line curr_line.contentWidth += new_inline.getWidth(); // reduce the available width remaining_width = remaining_width - new_inline.getWidth(); // if the last inline was at the end of a line, then go to next line if (new_inline.break_after) { // Uu.p("break after"); // then remaining_width = max_width remaining_width = bounds.width; // save the line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); // increase bounds height to account for the new line bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } } // set the inline to use for left alignment if (!isOutsideFlow(currentContent)) {//is this necessary now? prev_align_inline = new_inline; } prev_inline = new_inline; } while (!c.shouldStop() && (new_inline == null || !new_inline.isEndOfParentContent())); if (currentContent.getStyle() != null) { c.popStyle(); if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } } } // save the final line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; if (!c.shrinkWrap()) box.contentWidth = bounds.width; box.height = bounds.height; //box.x = 0; //box.y = 0; // Uu.p("- InlineLayout.layoutContent(): " + box); //pop the dummy style, but no, see above //c.popStyle(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineBoxing.java/clean/src/java/org/xhtmlrenderer/layout/InlineBoxing.java |
if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } | public static void layoutContent(LayoutContext c, Box box, List contentList) { //Here we should always be inside something that corresponds to a block-level element //for formatting purposes Rectangle bounds = new Rectangle(); bounds.width = c.getExtents().width; validateBounds(bounds); bounds.x = 0; bounds.y = 0; bounds.height = 0; //dummy style to make sure that text nodes don't get extra padding and such //doesn't work here because blocks may be inside inlines, losing inline styling: //c.pushStyle(CascadedStyle.emptyCascadedStyle); int blockLineHeight = (int) Math.round(box.getStyle().getCalculatedStyle().getLineHeight(c)); LineMetrics blockLineMetrics = c.getTextRenderer().getLineMetrics(c.getGraphics(), box.getStyle().getFont(c), "thequickbrownfoxjumpedoverthelazydogTHEQUICKBROWNFOXJUMPEDOVERTHELAZYDOG"); // more setup LineBox prev_line = new LineBox(); c.pushStyle(CascadedStyle.emptyCascadedStyle); prev_line.setStyle(new Style(c.getCurrentStyle(), 0)); c.popStyle(); prev_line.setParent(box); prev_line.y = 0; prev_line.height = 0; InlineBox prev_inline = null; InlineBox prev_align_inline = null; // prepare remaining width and first linebox int remaining_width = bounds.width; if (! box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, prev_line, bounds.width); } LineBox curr_line = newLine(box, bounds, null, blockLineMetrics, c); List pushedOnFirstLine = null; // account for text-indent CalculatedStyle parentStyle = c.getCurrentStyle(); float indent = parentStyle.getFloatPropertyProportionalWidth( CSSName.TEXT_INDENT, bounds.width, c); remaining_width -= (int) indent; curr_line.x = curr_line.x + (int) indent; boolean isFirstLetter = true; int pendingPushStyles = 0; List pendingFloats = new ArrayList(); int pendingLeftPadding = 0; int pendingRightPadding = 0; // loop until no more nodes Iterator contentIter = contentList.iterator(); while (contentIter.hasNext() && !c.shouldStop()) { Object o = contentIter.next(); if (o instanceof FirstLineStyle) {//can actually only be the first object in list box.firstLineStyle = ((FirstLineStyle) o).getStyle(); c.addFirstLineStyle(box.firstLineStyle); continue; } if (o instanceof FirstLetterStyle) {//can actually only be the first or second object in list box.firstLetterStyle = ((FirstLetterStyle) o).getStyle(); continue; } if (o instanceof StylePush) { CascadedStyle cascaded; StylePush sp = (StylePush) o; if (sp.getElement() == null) { //anonymous inline box cascaded = CascadedStyle.emptyCascadedStyle; } else if (sp.getPseudoElement() != null) { cascaded = c.getCss().getPseudoElementStyle(sp.getElement(), sp.getPseudoElement()); } else { cascaded = c.getCss().getCascadedStyle(sp.getElement(), false);//already restyled by ContentUtil } //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(cascaded); } c.pushStyle(cascaded); /*if (pendingPushStyles == null) { pendingPushStyles = new ArrayList(); } pendingPushStyles.add((StylePush) o);*/ pendingPushStyles++; //Relative.translateRelative(c, c.getCurrentStyle(), false); CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; c.setCurrentInlineElement(new InlineElement(((StylePush) o).getElement(), ((StylePush) o).getPseudoElement(), c.getCurrentInlineElement())); c.getCurrentInlineElement().setStartStyle(new Style(style, parent_width)); //To break the line well, assume we don't just want to paint padding on next line BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding += margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding += (int) padding.right() + (int) border.right() + margin.right(); continue; } if (o instanceof StylePop) { if (pendingPushStyles != 0) { //if (pendingPushStyles != null && pendingPushStyles.size() != 0) { //pendingPushStyles.remove(pendingPushStyles.size() - 1);//was a redundant one pendingPushStyles--; //TODO: is it correct that empty inline elements get ignored? //correct the pending padding CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding -= margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding -= (int) padding.right() + (int) border.right() + margin.right(); } else { if (prev_inline == null) {//only when there was a block child just before element end prev_inline = new InlineTextBox();//hope it is decently initialised as empty ((InlineTextBox) prev_inline).setMasterText(""); ((InlineTextBox) prev_inline).start_index = 0; ((InlineTextBox) prev_inline).end_index = 0; curr_line.addChild(prev_inline); prev_inline.setInlineElement(c.getCurrentInlineElement()); } prev_inline.popstyles++; int parent_width = bounds.width; CalculatedStyle style = c.getCurrentStyle(); c.getCurrentInlineElement().setEndStyle(new Style(style, parent_width)); c.setCurrentInlineElement(c.getCurrentInlineElement().getParent()); BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); // CLEAN: cast to int int rp = (int) padding.right() + (int) border.right() + (int) margin.right(); //CHECK: not sure this is where the padding really goes, always prev_inline.rightPadding += rp; pendingRightPadding -= rp; remaining_width -= rp; } if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } //Relative.untranslateRelative(c, c.getCurrentStyle(), false); c.popStyle(); continue; } Content currentContent = (Content) o; if (currentContent.getStyle() != null) { //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(currentContent.getStyle()); } c.pushStyle(currentContent.getStyle()); } // loop until no more text in this node InlineBox new_inline = null; int start = 0; InlineBlockBox pendingBlockBox = null; do { new_inline = null; if (currentContent instanceof AbsolutelyPositionedContent) { Absolute.generateAbsoluteBox(c, currentContent, curr_line); break; } else if (currentContent instanceof FloatedBlockContent) { //Uu.p("calcinline: is floated block"); FloatedBlockBox floater = FloatUtil.generateFloatedBlock(c, currentContent, remaining_width, curr_line, pendingFloats); if (!floater.isPending()) { remaining_width -= floater.getWidth(); } break; } // debugging check if (bounds.width < 0) { Uu.p("bounds width = " + bounds.width); Uu.dump_stack(); System.exit(-1); } // the crash warning code if (bounds.width < 1) { Uu.p("warning. width < 1 " + bounds.width); } // look at current inline // break off the longest section that will fit int fit = pendingRightPadding;//Note: this is not necessarily entirely correct if (start == 0) fit += pendingLeftPadding; start = trimLeadingSpace(c.getCurrentStyle(), prev_inline, currentContent, start); new_inline = calculateInline(c, currentContent, remaining_width - fit, bounds.width, prev_align_inline, isFirstLetter, box.firstLetterStyle, curr_line, start, pendingBlockBox, pendingFloats); pendingBlockBox = null; // if this inline needs to be on a new line if (prev_align_inline != null && new_inline.break_before) { // Uu.p("break before"); remaining_width = bounds.width; saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); // skip adjusting for tabs if this box is cleared if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } //have to discard it and recalculate, particularly if this was the first line prev_align_inline.break_after = true; if (new_inline instanceof InlineBlockBox) pendingBlockBox = (InlineBlockBox) new_inline; new_inline = null; continue; } // save the new inline to the list // Uu.p("adding inline child: " + new_inline); //the inline might be set to size 0,0 after this, if it is first whitespace on line. // Cannot discard because it may contain style-pushes if (!(currentContent instanceof FloatedBlockContent)) { curr_line.addInlineChild(new_inline); } // Uu.p("current line = " + curr_line); if (new_inline instanceof InlineTextBox) { start = ((InlineTextBox) new_inline).end_index; } isFirstLetter = false; new_inline.pushstyles = pendingPushStyles; pendingPushStyles = 0; new_inline.leftPadding += pendingLeftPadding; pendingLeftPadding = 0; // calc new height of the line // don't count floats and absolutes if (!new_inline.getStyle().isFloated() && !new_inline.getStyle().isAbsolute()) { adjustLineHeight(c, curr_line, new_inline); } // calc new width of the line curr_line.contentWidth += new_inline.getWidth(); // reduce the available width remaining_width = remaining_width - new_inline.getWidth(); // if the last inline was at the end of a line, then go to next line if (new_inline.break_after) { // Uu.p("break after"); // then remaining_width = max_width remaining_width = bounds.width; // save the line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); // increase bounds height to account for the new line bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } } // set the inline to use for left alignment if (!isOutsideFlow(currentContent)) {//is this necessary now? prev_align_inline = new_inline; } prev_inline = new_inline; } while (!c.shouldStop() && (new_inline == null || !new_inline.isEndOfParentContent())); if (currentContent.getStyle() != null) { c.popStyle(); if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } } } // save the final line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; if (!c.shrinkWrap()) box.contentWidth = bounds.width; box.height = bounds.height; //box.x = 0; //box.y = 0; // Uu.p("- InlineLayout.layoutContent(): " + box); //pop the dummy style, but no, see above //c.popStyle(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineBoxing.java/clean/src/java/org/xhtmlrenderer/layout/InlineBoxing.java |
|
if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } | public static void layoutContent(LayoutContext c, Box box, List contentList) { //Here we should always be inside something that corresponds to a block-level element //for formatting purposes Rectangle bounds = new Rectangle(); bounds.width = c.getExtents().width; validateBounds(bounds); bounds.x = 0; bounds.y = 0; bounds.height = 0; //dummy style to make sure that text nodes don't get extra padding and such //doesn't work here because blocks may be inside inlines, losing inline styling: //c.pushStyle(CascadedStyle.emptyCascadedStyle); int blockLineHeight = (int) Math.round(box.getStyle().getCalculatedStyle().getLineHeight(c)); LineMetrics blockLineMetrics = c.getTextRenderer().getLineMetrics(c.getGraphics(), box.getStyle().getFont(c), "thequickbrownfoxjumpedoverthelazydogTHEQUICKBROWNFOXJUMPEDOVERTHELAZYDOG"); // more setup LineBox prev_line = new LineBox(); c.pushStyle(CascadedStyle.emptyCascadedStyle); prev_line.setStyle(new Style(c.getCurrentStyle(), 0)); c.popStyle(); prev_line.setParent(box); prev_line.y = 0; prev_line.height = 0; InlineBox prev_inline = null; InlineBox prev_align_inline = null; // prepare remaining width and first linebox int remaining_width = bounds.width; if (! box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, prev_line, bounds.width); } LineBox curr_line = newLine(box, bounds, null, blockLineMetrics, c); List pushedOnFirstLine = null; // account for text-indent CalculatedStyle parentStyle = c.getCurrentStyle(); float indent = parentStyle.getFloatPropertyProportionalWidth( CSSName.TEXT_INDENT, bounds.width, c); remaining_width -= (int) indent; curr_line.x = curr_line.x + (int) indent; boolean isFirstLetter = true; int pendingPushStyles = 0; List pendingFloats = new ArrayList(); int pendingLeftPadding = 0; int pendingRightPadding = 0; // loop until no more nodes Iterator contentIter = contentList.iterator(); while (contentIter.hasNext() && !c.shouldStop()) { Object o = contentIter.next(); if (o instanceof FirstLineStyle) {//can actually only be the first object in list box.firstLineStyle = ((FirstLineStyle) o).getStyle(); c.addFirstLineStyle(box.firstLineStyle); continue; } if (o instanceof FirstLetterStyle) {//can actually only be the first or second object in list box.firstLetterStyle = ((FirstLetterStyle) o).getStyle(); continue; } if (o instanceof StylePush) { CascadedStyle cascaded; StylePush sp = (StylePush) o; if (sp.getElement() == null) { //anonymous inline box cascaded = CascadedStyle.emptyCascadedStyle; } else if (sp.getPseudoElement() != null) { cascaded = c.getCss().getPseudoElementStyle(sp.getElement(), sp.getPseudoElement()); } else { cascaded = c.getCss().getCascadedStyle(sp.getElement(), false);//already restyled by ContentUtil } //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(cascaded); } c.pushStyle(cascaded); /*if (pendingPushStyles == null) { pendingPushStyles = new ArrayList(); } pendingPushStyles.add((StylePush) o);*/ pendingPushStyles++; //Relative.translateRelative(c, c.getCurrentStyle(), false); CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; c.setCurrentInlineElement(new InlineElement(((StylePush) o).getElement(), ((StylePush) o).getPseudoElement(), c.getCurrentInlineElement())); c.getCurrentInlineElement().setStartStyle(new Style(style, parent_width)); //To break the line well, assume we don't just want to paint padding on next line BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding += margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding += (int) padding.right() + (int) border.right() + margin.right(); continue; } if (o instanceof StylePop) { if (pendingPushStyles != 0) { //if (pendingPushStyles != null && pendingPushStyles.size() != 0) { //pendingPushStyles.remove(pendingPushStyles.size() - 1);//was a redundant one pendingPushStyles--; //TODO: is it correct that empty inline elements get ignored? //correct the pending padding CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding -= margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding -= (int) padding.right() + (int) border.right() + margin.right(); } else { if (prev_inline == null) {//only when there was a block child just before element end prev_inline = new InlineTextBox();//hope it is decently initialised as empty ((InlineTextBox) prev_inline).setMasterText(""); ((InlineTextBox) prev_inline).start_index = 0; ((InlineTextBox) prev_inline).end_index = 0; curr_line.addChild(prev_inline); prev_inline.setInlineElement(c.getCurrentInlineElement()); } prev_inline.popstyles++; int parent_width = bounds.width; CalculatedStyle style = c.getCurrentStyle(); c.getCurrentInlineElement().setEndStyle(new Style(style, parent_width)); c.setCurrentInlineElement(c.getCurrentInlineElement().getParent()); BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); // CLEAN: cast to int int rp = (int) padding.right() + (int) border.right() + (int) margin.right(); //CHECK: not sure this is where the padding really goes, always prev_inline.rightPadding += rp; pendingRightPadding -= rp; remaining_width -= rp; } if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } //Relative.untranslateRelative(c, c.getCurrentStyle(), false); c.popStyle(); continue; } Content currentContent = (Content) o; if (currentContent.getStyle() != null) { //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(currentContent.getStyle()); } c.pushStyle(currentContent.getStyle()); } // loop until no more text in this node InlineBox new_inline = null; int start = 0; InlineBlockBox pendingBlockBox = null; do { new_inline = null; if (currentContent instanceof AbsolutelyPositionedContent) { Absolute.generateAbsoluteBox(c, currentContent, curr_line); break; } else if (currentContent instanceof FloatedBlockContent) { //Uu.p("calcinline: is floated block"); FloatedBlockBox floater = FloatUtil.generateFloatedBlock(c, currentContent, remaining_width, curr_line, pendingFloats); if (!floater.isPending()) { remaining_width -= floater.getWidth(); } break; } // debugging check if (bounds.width < 0) { Uu.p("bounds width = " + bounds.width); Uu.dump_stack(); System.exit(-1); } // the crash warning code if (bounds.width < 1) { Uu.p("warning. width < 1 " + bounds.width); } // look at current inline // break off the longest section that will fit int fit = pendingRightPadding;//Note: this is not necessarily entirely correct if (start == 0) fit += pendingLeftPadding; start = trimLeadingSpace(c.getCurrentStyle(), prev_inline, currentContent, start); new_inline = calculateInline(c, currentContent, remaining_width - fit, bounds.width, prev_align_inline, isFirstLetter, box.firstLetterStyle, curr_line, start, pendingBlockBox, pendingFloats); pendingBlockBox = null; // if this inline needs to be on a new line if (prev_align_inline != null && new_inline.break_before) { // Uu.p("break before"); remaining_width = bounds.width; saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); // skip adjusting for tabs if this box is cleared if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } //have to discard it and recalculate, particularly if this was the first line prev_align_inline.break_after = true; if (new_inline instanceof InlineBlockBox) pendingBlockBox = (InlineBlockBox) new_inline; new_inline = null; continue; } // save the new inline to the list // Uu.p("adding inline child: " + new_inline); //the inline might be set to size 0,0 after this, if it is first whitespace on line. // Cannot discard because it may contain style-pushes if (!(currentContent instanceof FloatedBlockContent)) { curr_line.addInlineChild(new_inline); } // Uu.p("current line = " + curr_line); if (new_inline instanceof InlineTextBox) { start = ((InlineTextBox) new_inline).end_index; } isFirstLetter = false; new_inline.pushstyles = pendingPushStyles; pendingPushStyles = 0; new_inline.leftPadding += pendingLeftPadding; pendingLeftPadding = 0; // calc new height of the line // don't count floats and absolutes if (!new_inline.getStyle().isFloated() && !new_inline.getStyle().isAbsolute()) { adjustLineHeight(c, curr_line, new_inline); } // calc new width of the line curr_line.contentWidth += new_inline.getWidth(); // reduce the available width remaining_width = remaining_width - new_inline.getWidth(); // if the last inline was at the end of a line, then go to next line if (new_inline.break_after) { // Uu.p("break after"); // then remaining_width = max_width remaining_width = bounds.width; // save the line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); // increase bounds height to account for the new line bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } } // set the inline to use for left alignment if (!isOutsideFlow(currentContent)) {//is this necessary now? prev_align_inline = new_inline; } prev_inline = new_inline; } while (!c.shouldStop() && (new_inline == null || !new_inline.isEndOfParentContent())); if (currentContent.getStyle() != null) { c.popStyle(); if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } } } // save the final line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; if (!c.shrinkWrap()) box.contentWidth = bounds.width; box.height = bounds.height; //box.x = 0; //box.y = 0; // Uu.p("- InlineLayout.layoutContent(): " + box); //pop the dummy style, but no, see above //c.popStyle(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineBoxing.java/clean/src/java/org/xhtmlrenderer/layout/InlineBoxing.java |
|
remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); | remaining_width -= c.getBlockFormattingContext().getFloatDistance(c, curr_line, remaining_width); | public static void layoutContent(LayoutContext c, Box box, List contentList) { //Here we should always be inside something that corresponds to a block-level element //for formatting purposes Rectangle bounds = new Rectangle(); bounds.width = c.getExtents().width; validateBounds(bounds); bounds.x = 0; bounds.y = 0; bounds.height = 0; //dummy style to make sure that text nodes don't get extra padding and such //doesn't work here because blocks may be inside inlines, losing inline styling: //c.pushStyle(CascadedStyle.emptyCascadedStyle); int blockLineHeight = (int) Math.round(box.getStyle().getCalculatedStyle().getLineHeight(c)); LineMetrics blockLineMetrics = c.getTextRenderer().getLineMetrics(c.getGraphics(), box.getStyle().getFont(c), "thequickbrownfoxjumpedoverthelazydogTHEQUICKBROWNFOXJUMPEDOVERTHELAZYDOG"); // more setup LineBox prev_line = new LineBox(); c.pushStyle(CascadedStyle.emptyCascadedStyle); prev_line.setStyle(new Style(c.getCurrentStyle(), 0)); c.popStyle(); prev_line.setParent(box); prev_line.y = 0; prev_line.height = 0; InlineBox prev_inline = null; InlineBox prev_align_inline = null; // prepare remaining width and first linebox int remaining_width = bounds.width; if (! box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, prev_line, bounds.width); } LineBox curr_line = newLine(box, bounds, null, blockLineMetrics, c); List pushedOnFirstLine = null; // account for text-indent CalculatedStyle parentStyle = c.getCurrentStyle(); float indent = parentStyle.getFloatPropertyProportionalWidth( CSSName.TEXT_INDENT, bounds.width, c); remaining_width -= (int) indent; curr_line.x = curr_line.x + (int) indent; boolean isFirstLetter = true; int pendingPushStyles = 0; List pendingFloats = new ArrayList(); int pendingLeftPadding = 0; int pendingRightPadding = 0; // loop until no more nodes Iterator contentIter = contentList.iterator(); while (contentIter.hasNext() && !c.shouldStop()) { Object o = contentIter.next(); if (o instanceof FirstLineStyle) {//can actually only be the first object in list box.firstLineStyle = ((FirstLineStyle) o).getStyle(); c.addFirstLineStyle(box.firstLineStyle); continue; } if (o instanceof FirstLetterStyle) {//can actually only be the first or second object in list box.firstLetterStyle = ((FirstLetterStyle) o).getStyle(); continue; } if (o instanceof StylePush) { CascadedStyle cascaded; StylePush sp = (StylePush) o; if (sp.getElement() == null) { //anonymous inline box cascaded = CascadedStyle.emptyCascadedStyle; } else if (sp.getPseudoElement() != null) { cascaded = c.getCss().getPseudoElementStyle(sp.getElement(), sp.getPseudoElement()); } else { cascaded = c.getCss().getCascadedStyle(sp.getElement(), false);//already restyled by ContentUtil } //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(cascaded); } c.pushStyle(cascaded); /*if (pendingPushStyles == null) { pendingPushStyles = new ArrayList(); } pendingPushStyles.add((StylePush) o);*/ pendingPushStyles++; //Relative.translateRelative(c, c.getCurrentStyle(), false); CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; c.setCurrentInlineElement(new InlineElement(((StylePush) o).getElement(), ((StylePush) o).getPseudoElement(), c.getCurrentInlineElement())); c.getCurrentInlineElement().setStartStyle(new Style(style, parent_width)); //To break the line well, assume we don't just want to paint padding on next line BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding += margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding += (int) padding.right() + (int) border.right() + margin.right(); continue; } if (o instanceof StylePop) { if (pendingPushStyles != 0) { //if (pendingPushStyles != null && pendingPushStyles.size() != 0) { //pendingPushStyles.remove(pendingPushStyles.size() - 1);//was a redundant one pendingPushStyles--; //TODO: is it correct that empty inline elements get ignored? //correct the pending padding CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding -= margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding -= (int) padding.right() + (int) border.right() + margin.right(); } else { if (prev_inline == null) {//only when there was a block child just before element end prev_inline = new InlineTextBox();//hope it is decently initialised as empty ((InlineTextBox) prev_inline).setMasterText(""); ((InlineTextBox) prev_inline).start_index = 0; ((InlineTextBox) prev_inline).end_index = 0; curr_line.addChild(prev_inline); prev_inline.setInlineElement(c.getCurrentInlineElement()); } prev_inline.popstyles++; int parent_width = bounds.width; CalculatedStyle style = c.getCurrentStyle(); c.getCurrentInlineElement().setEndStyle(new Style(style, parent_width)); c.setCurrentInlineElement(c.getCurrentInlineElement().getParent()); BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); // CLEAN: cast to int int rp = (int) padding.right() + (int) border.right() + (int) margin.right(); //CHECK: not sure this is where the padding really goes, always prev_inline.rightPadding += rp; pendingRightPadding -= rp; remaining_width -= rp; } if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } //Relative.untranslateRelative(c, c.getCurrentStyle(), false); c.popStyle(); continue; } Content currentContent = (Content) o; if (currentContent.getStyle() != null) { //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(currentContent.getStyle()); } c.pushStyle(currentContent.getStyle()); } // loop until no more text in this node InlineBox new_inline = null; int start = 0; InlineBlockBox pendingBlockBox = null; do { new_inline = null; if (currentContent instanceof AbsolutelyPositionedContent) { Absolute.generateAbsoluteBox(c, currentContent, curr_line); break; } else if (currentContent instanceof FloatedBlockContent) { //Uu.p("calcinline: is floated block"); FloatedBlockBox floater = FloatUtil.generateFloatedBlock(c, currentContent, remaining_width, curr_line, pendingFloats); if (!floater.isPending()) { remaining_width -= floater.getWidth(); } break; } // debugging check if (bounds.width < 0) { Uu.p("bounds width = " + bounds.width); Uu.dump_stack(); System.exit(-1); } // the crash warning code if (bounds.width < 1) { Uu.p("warning. width < 1 " + bounds.width); } // look at current inline // break off the longest section that will fit int fit = pendingRightPadding;//Note: this is not necessarily entirely correct if (start == 0) fit += pendingLeftPadding; start = trimLeadingSpace(c.getCurrentStyle(), prev_inline, currentContent, start); new_inline = calculateInline(c, currentContent, remaining_width - fit, bounds.width, prev_align_inline, isFirstLetter, box.firstLetterStyle, curr_line, start, pendingBlockBox, pendingFloats); pendingBlockBox = null; // if this inline needs to be on a new line if (prev_align_inline != null && new_inline.break_before) { // Uu.p("break before"); remaining_width = bounds.width; saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); // skip adjusting for tabs if this box is cleared if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } //have to discard it and recalculate, particularly if this was the first line prev_align_inline.break_after = true; if (new_inline instanceof InlineBlockBox) pendingBlockBox = (InlineBlockBox) new_inline; new_inline = null; continue; } // save the new inline to the list // Uu.p("adding inline child: " + new_inline); //the inline might be set to size 0,0 after this, if it is first whitespace on line. // Cannot discard because it may contain style-pushes if (!(currentContent instanceof FloatedBlockContent)) { curr_line.addInlineChild(new_inline); } // Uu.p("current line = " + curr_line); if (new_inline instanceof InlineTextBox) { start = ((InlineTextBox) new_inline).end_index; } isFirstLetter = false; new_inline.pushstyles = pendingPushStyles; pendingPushStyles = 0; new_inline.leftPadding += pendingLeftPadding; pendingLeftPadding = 0; // calc new height of the line // don't count floats and absolutes if (!new_inline.getStyle().isFloated() && !new_inline.getStyle().isAbsolute()) { adjustLineHeight(c, curr_line, new_inline); } // calc new width of the line curr_line.contentWidth += new_inline.getWidth(); // reduce the available width remaining_width = remaining_width - new_inline.getWidth(); // if the last inline was at the end of a line, then go to next line if (new_inline.break_after) { // Uu.p("break after"); // then remaining_width = max_width remaining_width = bounds.width; // save the line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); // increase bounds height to account for the new line bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } } // set the inline to use for left alignment if (!isOutsideFlow(currentContent)) {//is this necessary now? prev_align_inline = new_inline; } prev_inline = new_inline; } while (!c.shouldStop() && (new_inline == null || !new_inline.isEndOfParentContent())); if (currentContent.getStyle() != null) { c.popStyle(); if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } } } // save the final line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; if (!c.shrinkWrap()) box.contentWidth = bounds.width; box.height = bounds.height; //box.x = 0; //box.y = 0; // Uu.p("- InlineLayout.layoutContent(): " + box); //pop the dummy style, but no, see above //c.popStyle(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineBoxing.java/clean/src/java/org/xhtmlrenderer/layout/InlineBoxing.java |
remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); | remaining_width -= c.getBlockFormattingContext().getFloatDistance(c, curr_line, remaining_width); | public static void layoutContent(LayoutContext c, Box box, List contentList) { //Here we should always be inside something that corresponds to a block-level element //for formatting purposes Rectangle bounds = new Rectangle(); bounds.width = c.getExtents().width; validateBounds(bounds); bounds.x = 0; bounds.y = 0; bounds.height = 0; //dummy style to make sure that text nodes don't get extra padding and such //doesn't work here because blocks may be inside inlines, losing inline styling: //c.pushStyle(CascadedStyle.emptyCascadedStyle); int blockLineHeight = (int) Math.round(box.getStyle().getCalculatedStyle().getLineHeight(c)); LineMetrics blockLineMetrics = c.getTextRenderer().getLineMetrics(c.getGraphics(), box.getStyle().getFont(c), "thequickbrownfoxjumpedoverthelazydogTHEQUICKBROWNFOXJUMPEDOVERTHELAZYDOG"); // more setup LineBox prev_line = new LineBox(); c.pushStyle(CascadedStyle.emptyCascadedStyle); prev_line.setStyle(new Style(c.getCurrentStyle(), 0)); c.popStyle(); prev_line.setParent(box); prev_line.y = 0; prev_line.height = 0; InlineBox prev_inline = null; InlineBox prev_align_inline = null; // prepare remaining width and first linebox int remaining_width = bounds.width; if (! box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, prev_line, bounds.width); } LineBox curr_line = newLine(box, bounds, null, blockLineMetrics, c); List pushedOnFirstLine = null; // account for text-indent CalculatedStyle parentStyle = c.getCurrentStyle(); float indent = parentStyle.getFloatPropertyProportionalWidth( CSSName.TEXT_INDENT, bounds.width, c); remaining_width -= (int) indent; curr_line.x = curr_line.x + (int) indent; boolean isFirstLetter = true; int pendingPushStyles = 0; List pendingFloats = new ArrayList(); int pendingLeftPadding = 0; int pendingRightPadding = 0; // loop until no more nodes Iterator contentIter = contentList.iterator(); while (contentIter.hasNext() && !c.shouldStop()) { Object o = contentIter.next(); if (o instanceof FirstLineStyle) {//can actually only be the first object in list box.firstLineStyle = ((FirstLineStyle) o).getStyle(); c.addFirstLineStyle(box.firstLineStyle); continue; } if (o instanceof FirstLetterStyle) {//can actually only be the first or second object in list box.firstLetterStyle = ((FirstLetterStyle) o).getStyle(); continue; } if (o instanceof StylePush) { CascadedStyle cascaded; StylePush sp = (StylePush) o; if (sp.getElement() == null) { //anonymous inline box cascaded = CascadedStyle.emptyCascadedStyle; } else if (sp.getPseudoElement() != null) { cascaded = c.getCss().getPseudoElementStyle(sp.getElement(), sp.getPseudoElement()); } else { cascaded = c.getCss().getCascadedStyle(sp.getElement(), false);//already restyled by ContentUtil } //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(cascaded); } c.pushStyle(cascaded); /*if (pendingPushStyles == null) { pendingPushStyles = new ArrayList(); } pendingPushStyles.add((StylePush) o);*/ pendingPushStyles++; //Relative.translateRelative(c, c.getCurrentStyle(), false); CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; c.setCurrentInlineElement(new InlineElement(((StylePush) o).getElement(), ((StylePush) o).getPseudoElement(), c.getCurrentInlineElement())); c.getCurrentInlineElement().setStartStyle(new Style(style, parent_width)); //To break the line well, assume we don't just want to paint padding on next line BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding += margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding += (int) padding.right() + (int) border.right() + margin.right(); continue; } if (o instanceof StylePop) { if (pendingPushStyles != 0) { //if (pendingPushStyles != null && pendingPushStyles.size() != 0) { //pendingPushStyles.remove(pendingPushStyles.size() - 1);//was a redundant one pendingPushStyles--; //TODO: is it correct that empty inline elements get ignored? //correct the pending padding CalculatedStyle style = c.getCurrentStyle(); int parent_width = bounds.width; BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); pendingLeftPadding -= margin.left() + (int) border.left() + (int) padding.left(); pendingRightPadding -= (int) padding.right() + (int) border.right() + margin.right(); } else { if (prev_inline == null) {//only when there was a block child just before element end prev_inline = new InlineTextBox();//hope it is decently initialised as empty ((InlineTextBox) prev_inline).setMasterText(""); ((InlineTextBox) prev_inline).start_index = 0; ((InlineTextBox) prev_inline).end_index = 0; curr_line.addChild(prev_inline); prev_inline.setInlineElement(c.getCurrentInlineElement()); } prev_inline.popstyles++; int parent_width = bounds.width; CalculatedStyle style = c.getCurrentStyle(); c.getCurrentInlineElement().setEndStyle(new Style(style, parent_width)); c.setCurrentInlineElement(c.getCurrentInlineElement().getParent()); BorderPropertySet border = style.getBorder(c); //note: percentages here refer to width of containing block RectPropertySet margin = style.getMarginRect(parent_width, parent_width, c); RectPropertySet padding = style.getPaddingRect(parent_width, parent_width, c); // CLEAN: cast to int int rp = (int) padding.right() + (int) border.right() + (int) margin.right(); //CHECK: not sure this is where the padding really goes, always prev_inline.rightPadding += rp; pendingRightPadding -= rp; remaining_width -= rp; } if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } //Relative.untranslateRelative(c, c.getCurrentStyle(), false); c.popStyle(); continue; } Content currentContent = (Content) o; if (currentContent.getStyle() != null) { //first push first-line styles if (c.hasFirstLineStyles()) { if (pushedOnFirstLine == null) { pushedOnFirstLine = new ArrayList(); for (Iterator i = c.getFirstLineStyles().iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } } pushedOnFirstLine.add(currentContent.getStyle()); } c.pushStyle(currentContent.getStyle()); } // loop until no more text in this node InlineBox new_inline = null; int start = 0; InlineBlockBox pendingBlockBox = null; do { new_inline = null; if (currentContent instanceof AbsolutelyPositionedContent) { Absolute.generateAbsoluteBox(c, currentContent, curr_line); break; } else if (currentContent instanceof FloatedBlockContent) { //Uu.p("calcinline: is floated block"); FloatedBlockBox floater = FloatUtil.generateFloatedBlock(c, currentContent, remaining_width, curr_line, pendingFloats); if (!floater.isPending()) { remaining_width -= floater.getWidth(); } break; } // debugging check if (bounds.width < 0) { Uu.p("bounds width = " + bounds.width); Uu.dump_stack(); System.exit(-1); } // the crash warning code if (bounds.width < 1) { Uu.p("warning. width < 1 " + bounds.width); } // look at current inline // break off the longest section that will fit int fit = pendingRightPadding;//Note: this is not necessarily entirely correct if (start == 0) fit += pendingLeftPadding; start = trimLeadingSpace(c.getCurrentStyle(), prev_inline, currentContent, start); new_inline = calculateInline(c, currentContent, remaining_width - fit, bounds.width, prev_align_inline, isFirstLetter, box.firstLetterStyle, curr_line, start, pendingBlockBox, pendingFloats); pendingBlockBox = null; // if this inline needs to be on a new line if (prev_align_inline != null && new_inline.break_before) { // Uu.p("break before"); remaining_width = bounds.width; saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); // skip adjusting for tabs if this box is cleared if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } //have to discard it and recalculate, particularly if this was the first line prev_align_inline.break_after = true; if (new_inline instanceof InlineBlockBox) pendingBlockBox = (InlineBlockBox) new_inline; new_inline = null; continue; } // save the new inline to the list // Uu.p("adding inline child: " + new_inline); //the inline might be set to size 0,0 after this, if it is first whitespace on line. // Cannot discard because it may contain style-pushes if (!(currentContent instanceof FloatedBlockContent)) { curr_line.addInlineChild(new_inline); } // Uu.p("current line = " + curr_line); if (new_inline instanceof InlineTextBox) { start = ((InlineTextBox) new_inline).end_index; } isFirstLetter = false; new_inline.pushstyles = pendingPushStyles; pendingPushStyles = 0; new_inline.leftPadding += pendingLeftPadding; pendingLeftPadding = 0; // calc new height of the line // don't count floats and absolutes if (!new_inline.getStyle().isFloated() && !new_inline.getStyle().isAbsolute()) { adjustLineHeight(c, curr_line, new_inline); } // calc new width of the line curr_line.contentWidth += new_inline.getWidth(); // reduce the available width remaining_width = remaining_width - new_inline.getWidth(); // if the last inline was at the end of a line, then go to next line if (new_inline.break_after) { // Uu.p("break after"); // then remaining_width = max_width remaining_width = bounds.width; // save the line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); // increase bounds height to account for the new line bounds.height += curr_line.height; prev_line = curr_line; curr_line = newLine(box, bounds, prev_line, blockLineMetrics, c); if (!box.getStyle().isCleared()) { remaining_width -= c.getBlockFormattingContext().getFloatDistance( c, curr_line, remaining_width); } } // set the inline to use for left alignment if (!isOutsideFlow(currentContent)) {//is this necessary now? prev_align_inline = new_inline; } prev_inline = new_inline; } while (!c.shouldStop() && (new_inline == null || !new_inline.isEndOfParentContent())); if (currentContent.getStyle() != null) { c.popStyle(); if (c.hasFirstLineStyles()) { pushedOnFirstLine.remove(pushedOnFirstLine.size() - 1); } } } // save the final line saveLine(curr_line, prev_line, bounds, c, box, blockLineHeight, pushedOnFirstLine, pendingFloats); bounds.height += curr_line.height; if (!c.shrinkWrap()) box.contentWidth = bounds.width; box.height = bounds.height; //box.x = 0; //box.y = 0; // Uu.p("- InlineLayout.layoutContent(): " + box); //pop the dummy style, but no, see above //c.popStyle(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineBoxing.java/clean/src/java/org/xhtmlrenderer/layout/InlineBoxing.java |
if (! block.getStyle().isClearLeft()) { line_to_save.x += c.getBlockFormattingContext().getLeftFloatDistance( c, line_to_save, bounds.width); | if (!block.getStyle().isClearLeft()) { line_to_save.x += c.getBlockFormattingContext().getLeftFloatDistance(c, line_to_save, bounds.width); | private static void saveLine(LineBox line_to_save, LineBox prev_line, Rectangle bounds, LayoutContext c, Box block, int minHeight, List pushedOnFirstLine, List pendingFloats) { line_to_save.isFirstLine = c.isFirstLine(); c.setFirstLine(false); if (c.hasFirstLineStyles()) { //first pop element styles pushed on first line for (int i = 0; i < pushedOnFirstLine.size(); i++) c.popStyle(); //then pop first-line styles for (int i = 0; i < c.getFirstLineStyles().size(); i++) c.popStyle(); //reinstate element styles for (Iterator i = pushedOnFirstLine.iterator(); i.hasNext();) { c.pushStyle((CascadedStyle) i.next()); } c.clearFirstLineStyles(); } if (c.shrinkWrap()) { //if (line_to_save.width > block.width) block.width = line_to_save.width; block.adjustWidthForChild(line_to_save.contentWidth); } //text-align now handled in render // set the y line_to_save.y = prev_line.y + prev_line.height; if (line_to_save.height != 0) {//would like to discard it otherwise, but that loses floats if (line_to_save.height < minHeight) { line_to_save.height = minHeight; } } block.addChild(line_to_save); if (pendingFloats.size() > 0) { c.setFloatingY(c.getFloatingY() + line_to_save.height); c.getBlockFormattingContext().floatPending(c, pendingFloats); } // new float code if (! block.getStyle().isClearLeft()) { line_to_save.x += c.getBlockFormattingContext().getLeftFloatDistance( c, line_to_save, bounds.width); } if (c.isPrint() && line_to_save.crossesPageBreak(c)) { line_to_save.moveToNextPage(c, bounds); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineBoxing.java/clean/src/java/org/xhtmlrenderer/layout/InlineBoxing.java |
newWizardAction = new NewWizardAction(); | protected void makeActions() { Shell shell = navigator.getSite().getShell(); IWorkbench workbench = navigator.getSite().getWorkbenchWindow().getWorkbench(); addBookmarkAction = new AddBookmarkAction(shell); addTaskAction = new AddTaskAction(shell); newWizardAction = new NewWizardAction(); propertyDialogAction = new PropertyDialogAction(shell, navigator.getViewer()); importAction = new ImportResourcesAction(workbench); importAction.setDisabledImageDescriptor(getImageDescriptor("dtool16/import_wiz.gif")); //$NON-NLS-1$ importAction.setImageDescriptor(getImageDescriptor("etool16/import_wiz.gif")); //$NON-NLS-1$ importAction.setHoverImageDescriptor(getImageDescriptor("ctool16/import_wiz.gif")); //$NON-NLS-1$ exportAction = new ExportResourcesAction(workbench); exportAction.setDisabledImageDescriptor(getImageDescriptor("dtool16/export_wiz.gif")); //$NON-NLS-1$ exportAction.setImageDescriptor(getImageDescriptor("etool16/export_wiz.gif")); //$NON-NLS-1$ exportAction.setHoverImageDescriptor(getImageDescriptor("ctool16/export_wiz.gif")); //$NON-NLS-1$ collapseAllAction = new CollapseAllAction(navigator, ResourceNavigatorMessages.getString("CollapseAllAction.title"));//$NON-NLS-1$ collapseAllAction.setToolTipText(ResourceNavigatorMessages.getString("CollapseAllAction.toolTip")); //$NON-NLS-1$ collapseAllAction.setImageDescriptor(getImageDescriptor("elcl16/collapseall.gif")); //$NON-NLS-1$ //TODO uncomment when image is supplied //collapseAllAction.setHoverImageDescriptor(getImageDescriptor("clcl16/collapseall.gif")); //$NON-NLS-1$ syncWithEditorAction = new SyncWithEditorAction(navigator, ResourceNavigatorMessages.getString("SyncWithEditorAction.title"));//$NON-NLS-1$ syncWithEditorAction.setToolTipText(ResourceNavigatorMessages.getString("SyncWithEditorAction.toolTip")); //$NON-NLS-1$ //TODO uncomment when image is supplied //syncWithEditorAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/synced.gif")); //$NON-NLS-1$ syncWithEditorAction.setHoverImageDescriptor(getImageDescriptor("clcl16/synced.gif")); //$NON-NLS-1$ navigator.getSite().getWorkbenchWindow().getPartService().addPartListener(syncWithEditorAction); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/b5ff95c2dec300844ac72bd554e4f0f8365497fb/MainActionGroup.java/clean/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/MainActionGroup.java |
|
private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { | private static Polygon getBevelledPolygon(final Rectangle bounds, final BorderPropertySet border, final int sides, int currentSide, boolean isClipRegion) { | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); | int rightCorner = (((sides & RIGHT) == RIGHT) ? (int)border.right() : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? (int)border.left() - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? (int)border.top() - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? (int)border.bottom() : adjust); | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.top != 1) { | if ((int)border.top() != 1) { | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); | poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + (int)border.top() - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + (int)border.top() - adjust); | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.bottom != 1) { | if ((int)border.bottom() != 1) { | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); | poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - (int)border.bottom()); | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); | poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - (int)border.bottom()); | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.right != 1) { | if ((int)border.right() != 1) { | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); | poly.addPoint(bounds.x + bounds.width - (int)border.right(), bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - (int)border.right(), bounds.y + bounds.height - bottomCorner + snuggle); | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.left != 1) { | if ((int)border.left() != 1) { | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); | poly.addPoint(bounds.x + (int)border.left() - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + (int)border.left() - adjust, bounds.y + bounds.height - bottomCorner + snuggle); | private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) { //adjust for bug in polygon filling final int adjust; //adjust inside corners to make sides fit snugly final int snuggle; if (isClipRegion) { adjust = 0; snuggle = 1; } else { adjust = 1; snuggle = 0; } int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust); int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0); int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0); int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust); Polygon poly = null; if (currentSide == TOP) { if (border.top != 1) { // use polygons for borders over 1px wide poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust); } } else if (currentSide == BOTTOM) { if (border.bottom != 1) { poly = new Polygon(); // upper right poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom); // upper left poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom); // lower left poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); // lower right poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == RIGHT) { if (border.right != 1) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust); } } else if (currentSide == LEFT) { if (border.left != 1) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle); poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle); poly.addPoint(bounds.x, bounds.y + bounds.height - adjust); } } return poly; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
BorderColor border_color = style.getBorderColor(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; | BorderPropertySet border = style.getBorder(ctx); | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { | if ( border.noTop()) { | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { | if ( border.noLeft() ) { | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { | if ( border.noBottom()) { | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { | if ( border.noRight()) { | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); | paintBorderSide(border, g, bounds, sides, TOP, border.topStyle(), xOffset); | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); | paintBorderSide(border, g, bounds, sides, LEFT, border.leftStyle(), xOffset); | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); | paintBorderSide(border, g, bounds, sides, BOTTOM, border.bottomStyle(), xOffset); | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); | paintBorderSide(border, g, bounds, sides, RIGHT, border.rightStyle(), xOffset); | public static void paint(Rectangle bounds, int sides, CalculatedStyle style, Graphics g, RenderingContext ctx, int xOffset) { //Graphics g = c.getGraphics(); //CalculatedStyle style = c.getCurrentStyle(); BorderColor border_color = style.getBorderColor(); //int width = (int) bounds.getWidth(); //int height = (int) bounds.getHeight(); Border border = style.getBorderWidth(ctx); IdentValue topStyle = null; IdentValue leftStyle = null; IdentValue bottomStyle = null; IdentValue rightStyle = null; if ((sides & TOP) == TOP) { topStyle = style.getIdent(CSSName.BORDER_STYLE_TOP); if (topStyle == IdentValue.NONE || border.top == 0) { sides -= TOP; } } if ((sides & LEFT) == LEFT) { leftStyle = style.getIdent(CSSName.BORDER_STYLE_LEFT); if (leftStyle == IdentValue.NONE || border.left == 0) { sides -= LEFT; } } if ((sides & BOTTOM) == BOTTOM) { bottomStyle = style.getIdent(CSSName.BORDER_STYLE_BOTTOM); if (bottomStyle == IdentValue.NONE || border.bottom == 0) { sides -= BOTTOM; } } if ((sides & RIGHT) == RIGHT) { rightStyle = style.getIdent(CSSName.BORDER_STYLE_RIGHT); if (rightStyle == IdentValue.NONE || border.right == 0) { sides -= RIGHT; } } //Now paint! if ((sides & TOP) == TOP) paintBorderSide(border, g, bounds, border_color, sides, TOP, topStyle, xOffset); if ((sides & LEFT) == LEFT) paintBorderSide(border, g, bounds, border_color, sides, LEFT, leftStyle, xOffset); if ((sides & BOTTOM) == BOTTOM) paintBorderSide(border, g, bounds, border_color, sides, BOTTOM, bottomStyle, xOffset); if ((sides & RIGHT) == RIGHT) paintBorderSide(border, g, bounds, border_color, sides, RIGHT, rightStyle, xOffset); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { | private static void paintBorderSide(final BorderPropertySet border, final Graphics g, final Rectangle bounds, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; | BorderPropertySet bd2 = new BorderPropertySet( (int)(border.top() / 2), (int)(border.right() / 2), (int)(border.bottom() / 2), (int)(border.left() / 2)); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); | paintGoodBevel(g2, bounds, border, border.darker(borderSideStyle), border.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border.brighter(borderSideStyle), border.darker(borderSideStyle), sides, currentSide); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); | paintGoodBevel(g2, bounds, border, border.brighter(borderSideStyle), border.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border.darker(borderSideStyle), border.brighter(borderSideStyle), sides, currentSide); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); | border.brighter(borderSideStyle), border.darker(borderSideStyle), sides, currentSide); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); | border.darker(borderSideStyle), border.brighter(borderSideStyle), sides, currentSide); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintSolid(g2, bounds, border, border_color, sides, currentSide); | paintSolid(g2, bounds, border, border, sides, currentSide); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); | BorderPropertySet outer = new BorderPropertySet( (int)(border.top() / 3), (int)(border.bottom() / 3), (int)(border.left() / 3), (int)(border.right() / 3)); BorderPropertySet center = new BorderPropertySet(outer); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; | BorderPropertySet inner = new BorderPropertySet(outer); if ((int)border.top() == 1) { outer.setTop(1f); center.setTop(0f); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; | if ((int)border.bottom() == 1) { outer.setBottom(1f); center.setBottom(0f); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.left == 1) { outer.left = 1; center.left = 0; | if ((int)border.left() == 1) { outer.setLeft(1f); center.setLeft(0f); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.right == 1) { outer.right = 1; center.right = 0; | if ((int)border.right() == 1) { outer.setRight(1f); center.setRight(0f); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; | if ((int)border.top() == 2) { outer.setTop(1f); center.setTop(0f); inner.setTop(1f); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; | if ((int)border.bottom() == 2) { outer.setBottom(1f); center.setBottom(0f); inner.setBottom(1f); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; | if ((int)border.left() == 2) { outer.setLeft(1f); center.setLeft(0f); inner.setLeft(1f); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; | if ((int)border.right() == 2) { outer.setRight(1f); center.setRight(0f); inner.setRight(1f); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); | paintSolid((Graphics2D) g, bounds, outer, border, sides, currentSide); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); | paintSolid((Graphics2D) g, b2, inner, border, sides, currentSide); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; | if (currentSide == TOP) thickness = (int)border.top(); if (currentSide == BOTTOM) thickness = (int)border.bottom(); if (currentSide == RIGHT) thickness = (int)border.right(); if (currentSide == LEFT) thickness = (int)border.left(); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); | paintPatternedRect(g2, bounds, border, border, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); | paintPatternedRect(g2, bounds, border, border, new float[]{thickness, thickness}, sides, currentSide, xOffset); | private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) { Graphics2D g2 = (Graphics2D) g; if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) { Border bd2 = new Border(); bd2.top = border.top / 2; bd2.bottom = border.bottom / 2; bd2.left = border.left / 2; bd2.right = border.right / 2; if (borderSideStyle == IdentValue.RIDGE) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); } else { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); } return; } if (borderSideStyle == IdentValue.OUTSET) { paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.INSET) { paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide); return; } if (borderSideStyle == IdentValue.SOLID) { paintSolid(g2, bounds, border, border_color, sides, currentSide); return; } if (borderSideStyle == IdentValue.DOUBLE) { // this may need to be modified to account for rounding errors // create a new border only 1/3 the thickness Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer); Border inner = new Border(outer); if (border.top == 1) { outer.top = 1; center.top = 0; } if (border.bottom == 1) { outer.bottom = 1; center.bottom = 0; } if (border.left == 1) { outer.left = 1; center.left = 0; } if (border.right == 1) { outer.right = 1; center.right = 0; } if (border.top == 2) { outer.top = 1; center.top = 0; inner.top = 1; } if (border.bottom == 2) { outer.bottom = 1; center.bottom = 0; inner.bottom = 1; } if (border.left == 2) { outer.left = 1; center.left = 0; inner.left = 1; } if (border.right == 2) { outer.right = 1; center.right = 0; inner.right = 1; } Rectangle b2 = shrinkRect(bounds, outer, sides); b2 = shrinkRect(b2, center, sides); // draw outer border paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide); // draw inner border paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide); return; } int thickness = 0; if (currentSide == TOP) thickness = border.top; if (currentSide == BOTTOM) thickness = border.bottom; if (currentSide == RIGHT) thickness = border.right; if (currentSide == LEFT) thickness = border.left; if (borderSideStyle == IdentValue.DASHED) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } if (borderSideStyle == IdentValue.DOTTED) { // turn off anti-aliasing or the dots will be all blurry g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
private static void paintGoodBevel(final Graphics2D g2, final Rectangle bounds, final Border border, final BorderColor high, final BorderColor low, final int sides, int currentSide) { | private static void paintGoodBevel(final Graphics2D g2, final Rectangle bounds, final BorderPropertySet border, final BorderPropertySet high, final BorderPropertySet low, final int sides, int currentSide) { | private static void paintGoodBevel(final Graphics2D g2, final Rectangle bounds, final Border border, final BorderColor high, final BorderColor low, final int sides, int currentSide) { if (currentSide == TOP) { paintSolid(g2, bounds, border, high, sides, currentSide); } else if (currentSide == BOTTOM) { paintSolid(g2, bounds, border, low, sides, currentSide); } else if (currentSide == RIGHT) { paintSolid(g2, bounds, border, low, sides, currentSide); } else if (currentSide == LEFT) { paintSolid(g2, bounds, border, high, sides, currentSide); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
private static void paintPatternedRect(final Graphics2D g2, final Rectangle bounds, final Border border, final BorderColor color, final float[] pattern, final int sides, final int currentSide, int xOffset) { | private static void paintPatternedRect(final Graphics2D g2, final Rectangle bounds, final BorderPropertySet border, final BorderPropertySet color, final float[] pattern, final int sides, final int currentSide, int xOffset) { | private static void paintPatternedRect(final Graphics2D g2, final Rectangle bounds, final Border border, final BorderColor color, final float[] pattern, final int sides, final int currentSide, int xOffset) { Polygon clip = getBevelledPolygon(bounds, border, sides, currentSide, true); Shape old_clip = g2.getClip(); if (clip != null) g2.clip(clip); Stroke old_stroke = g2.getStroke(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; if (currentSide == TOP) { g2.setColor(color.topColor); g2.setStroke(new BasicStroke(border.top, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + border.top / 2, x + w - 1, y + border.top / 2); } else if (currentSide == LEFT) { g2.setColor(color.leftColor); g2.setStroke(new BasicStroke(border.left, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + border.left / 2, y, x + border.left / 2, y + h - 1); } else if (currentSide == RIGHT) { g2.setColor(color.rightColor); g2.setStroke(new BasicStroke(border.right, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + w - border.right / 2, y, x + w - border.right / 2, y + h); } else if (currentSide == BOTTOM) { g2.setColor(color.bottomColor); g2.setStroke(new BasicStroke(border.bottom, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + h - border.bottom / 2, x + w, y + h - border.bottom / 2); } g2.setStroke(old_stroke); g2.setClip(old_clip); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
g2.setColor(color.topColor); g2.setStroke(new BasicStroke(border.top, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + border.top / 2, x + w - 1, y + border.top / 2); | g2.setColor(color.topColor()); g2.setStroke(new BasicStroke((int)border.top(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + (int)(border.top() / 2), x + w - 1, y + (int)(border.top() / 2)); | private static void paintPatternedRect(final Graphics2D g2, final Rectangle bounds, final Border border, final BorderColor color, final float[] pattern, final int sides, final int currentSide, int xOffset) { Polygon clip = getBevelledPolygon(bounds, border, sides, currentSide, true); Shape old_clip = g2.getClip(); if (clip != null) g2.clip(clip); Stroke old_stroke = g2.getStroke(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; if (currentSide == TOP) { g2.setColor(color.topColor); g2.setStroke(new BasicStroke(border.top, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + border.top / 2, x + w - 1, y + border.top / 2); } else if (currentSide == LEFT) { g2.setColor(color.leftColor); g2.setStroke(new BasicStroke(border.left, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + border.left / 2, y, x + border.left / 2, y + h - 1); } else if (currentSide == RIGHT) { g2.setColor(color.rightColor); g2.setStroke(new BasicStroke(border.right, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + w - border.right / 2, y, x + w - border.right / 2, y + h); } else if (currentSide == BOTTOM) { g2.setColor(color.bottomColor); g2.setStroke(new BasicStroke(border.bottom, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + h - border.bottom / 2, x + w, y + h - border.bottom / 2); } g2.setStroke(old_stroke); g2.setClip(old_clip); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
g2.setColor(color.leftColor); g2.setStroke(new BasicStroke(border.left, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + border.left / 2, y, x + border.left / 2, y + h - 1); | g2.setColor(color.leftColor()); g2.setStroke(new BasicStroke((int)border.left(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + (int)(border.left() / 2), y, x + (int)(border.left() / 2), y + h - 1); | private static void paintPatternedRect(final Graphics2D g2, final Rectangle bounds, final Border border, final BorderColor color, final float[] pattern, final int sides, final int currentSide, int xOffset) { Polygon clip = getBevelledPolygon(bounds, border, sides, currentSide, true); Shape old_clip = g2.getClip(); if (clip != null) g2.clip(clip); Stroke old_stroke = g2.getStroke(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; if (currentSide == TOP) { g2.setColor(color.topColor); g2.setStroke(new BasicStroke(border.top, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + border.top / 2, x + w - 1, y + border.top / 2); } else if (currentSide == LEFT) { g2.setColor(color.leftColor); g2.setStroke(new BasicStroke(border.left, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + border.left / 2, y, x + border.left / 2, y + h - 1); } else if (currentSide == RIGHT) { g2.setColor(color.rightColor); g2.setStroke(new BasicStroke(border.right, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + w - border.right / 2, y, x + w - border.right / 2, y + h); } else if (currentSide == BOTTOM) { g2.setColor(color.bottomColor); g2.setStroke(new BasicStroke(border.bottom, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + h - border.bottom / 2, x + w, y + h - border.bottom / 2); } g2.setStroke(old_stroke); g2.setClip(old_clip); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
g2.setColor(color.rightColor); g2.setStroke(new BasicStroke(border.right, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + w - border.right / 2, y, x + w - border.right / 2, y + h); | g2.setColor(color.rightColor()); g2.setStroke(new BasicStroke((int)border.right(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + w - (int)(border.right() / 2), y, x + w - (int)(border.right() / 2), y + h); | private static void paintPatternedRect(final Graphics2D g2, final Rectangle bounds, final Border border, final BorderColor color, final float[] pattern, final int sides, final int currentSide, int xOffset) { Polygon clip = getBevelledPolygon(bounds, border, sides, currentSide, true); Shape old_clip = g2.getClip(); if (clip != null) g2.clip(clip); Stroke old_stroke = g2.getStroke(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; if (currentSide == TOP) { g2.setColor(color.topColor); g2.setStroke(new BasicStroke(border.top, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + border.top / 2, x + w - 1, y + border.top / 2); } else if (currentSide == LEFT) { g2.setColor(color.leftColor); g2.setStroke(new BasicStroke(border.left, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + border.left / 2, y, x + border.left / 2, y + h - 1); } else if (currentSide == RIGHT) { g2.setColor(color.rightColor); g2.setStroke(new BasicStroke(border.right, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + w - border.right / 2, y, x + w - border.right / 2, y + h); } else if (currentSide == BOTTOM) { g2.setColor(color.bottomColor); g2.setStroke(new BasicStroke(border.bottom, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + h - border.bottom / 2, x + w, y + h - border.bottom / 2); } g2.setStroke(old_stroke); g2.setClip(old_clip); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
g2.setColor(color.bottomColor); g2.setStroke(new BasicStroke(border.bottom, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + h - border.bottom / 2, x + w, y + h - border.bottom / 2); | g2.setColor(color.bottomColor()); g2.setStroke(new BasicStroke((int)border.bottom(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + h - (int)(border.bottom() / 2), x + w, y + h - (int)(border.bottom() / 2)); | private static void paintPatternedRect(final Graphics2D g2, final Rectangle bounds, final Border border, final BorderColor color, final float[] pattern, final int sides, final int currentSide, int xOffset) { Polygon clip = getBevelledPolygon(bounds, border, sides, currentSide, true); Shape old_clip = g2.getClip(); if (clip != null) g2.clip(clip); Stroke old_stroke = g2.getStroke(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; if (currentSide == TOP) { g2.setColor(color.topColor); g2.setStroke(new BasicStroke(border.top, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + border.top / 2, x + w - 1, y + border.top / 2); } else if (currentSide == LEFT) { g2.setColor(color.leftColor); g2.setStroke(new BasicStroke(border.left, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + border.left / 2, y, x + border.left / 2, y + h - 1); } else if (currentSide == RIGHT) { g2.setColor(color.rightColor); g2.setStroke(new BasicStroke(border.right, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, 0)); g2.drawLine(x + w - border.right / 2, y, x + w - border.right / 2, y + h); } else if (currentSide == BOTTOM) { g2.setColor(color.bottomColor); g2.setStroke(new BasicStroke(border.bottom, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, pattern, xOffset)); g2.drawLine(x, y + h - border.bottom / 2, x + w, y + h - border.bottom / 2); } g2.setStroke(old_stroke); g2.setClip(old_clip); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/8ea25aa585e94d56872f163ff3c60962f3a3ddce/BorderPainter.java/clean/src/java/org/xhtmlrenderer/render/BorderPainter.java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.